1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
| var util = require('../../utils/util.js');
| var api = require('../../utils/service-api.js');
|
| var app=getApp();
|
|
| Page({
| data: {
|
| //常量定义
| JOIN_STATUS_NOT_JOIN : 0,
| //1加入状态确认中
| JOIN_STATUS_ING : 1,
| //1加入状态加入成功
| JOIN_STATUS_Y : 2,
| //1加入状态加入失败
| JOIN_STATUS_N : 3,
| JOIN_STATUS_END : 4,
| interval: 2000,
| duration: 1000,
| art: { },
| products: [ ],
| //展示相册
| imgUrls: [],
| imagetext: ['活动说明'],
| currentTabsIndex: 0,
| shareShow: false,
| isShare: 0,
| qrcode:false,
| lxdh:{},
| showModel:0,
| },
|
| onLoad: function(options) {
| console.log(options)
| var id = options.id;
| this.setData({ id: id,shopId:app.shopInfo.id });
| var _this = this;
| util.request({
| method: 'GET',
| api: api.shalong.findSalongById + id,
| callback: function (data) {
|
| let activity = data.mapInfo.activity;
| activity.actContent = activity.actContent.replace(/<img /g, '<img class="rich_img" ');
| let userRecord=data.mapInfo.userRecord;
| let showModel=_this.showModel;
| if(userRecord){
| showModel=userRecord.status;
| }
|
| if(data.mapInfo.status==2){
| showModel=_this.data.JOIN_STATUS_END;
| }
| _this.setData({
| activity: activity,
| imgUrls:[ activity.actImg ],
| showModel:showModel,
| });
| },
| checkLogin:true,
| });
| },
|
| formSubmit(e){
| let _this=this;
| console.log('form发生了submit事件,携带数据为:', e.detail.value)
| util.request({
| api:api.shalong.joinSalong,
| data:{
| actId:_this.data.id,
| attrLists:e.detail.value,
| shopId:_this.data.shopId
| },
| callback:function(data){
| wx.showToast({
| title: data.info,
| });
| if(data.info.indexOf('成功')>0){
| _this.setData({
| showModel:_this.data.JOIN_STATUS_ING
| });
| }
| }
|
| });
| },
| onShow(options) {
|
| },
| // 回到首页
| goBack() {
| wx.switchTab({
| url: '../index/index'
| })
| },
| goIndex() {
| wx.reLaunch({
| url: '/pages/index/index'
| })
| },
| //转发
| onShareAppMessage(res) {
| var _this=this;
| var shopId=this.shopId;
| var title = this.data.activity.actName;
| var id = this.data.id;
| return {
| title: title,
| imageUrl: _this.data.activity.actImg,
| path: "/pages/shalong/shalongDetail?id=" + id + "&&shopId=" +shopId ,
| }
| },
|
| // 分享
| share(e) {
| this.setData({
| shareShow: true,
| popupShow: true
| })
| },
|
|
| // 图文选项卡
| onTabsItemEvent(e) {
| var index = e.currentTarget.dataset.index;
|
| this.setData({
| currentTabsIndex: index
| })
| },
|
|
| // 生成卡片跳转
| card(e) {
| var id = e.currentTarget.dataset.id
| wx.navigateTo({
| url: '../card/card?id=' + id,
| })
| },
|
|
| popupTap(e) {
| this.setData({
| shareShow: false
| })
| },
|
| // 进入商品页
| intoDetail(e) {
| var id = e.currentTarget.dataset.id;
| console.log(id);
| wx.navigateTo({
| url: '/pages/product/details?id=' + id,
| })
| },
|
|
|
| })
|
|