Commit ba1dd70575cfbc72564795801ed5b56feefb7343
Merge branch 'dev' of http://git.vipzhuang.cn/wxd/MShopWeApp into dev
Showing
25 changed files
with
749 additions
and
415 deletions
app.js
... | ... | @@ -113,9 +113,9 @@ App({ |
113 | 113 | wx.getSystemInfo({ |
114 | 114 | success: (res) => { |
115 | 115 | // console.log(res) |
116 | - let modelmes = res.model; //手机品牌 | |
116 | + let modelmes = res?res.model:null; //手机品牌 | |
117 | 117 | console.log('手机品牌', modelmes) |
118 | - if (modelmes.indexOf('iPhone X') != -1) { //XS,XR,XS MAX均可以适配,因为indexOf()会将包含'iPhone X'的字段都查出来 | |
118 | + if (modelmes && modelmes.indexOf('iPhone X') != -1) { //XS,XR,XS MAX均可以适配,因为indexOf()会将包含'iPhone X'的字段都查出来 | |
119 | 119 | this.globalData.isIpx = true |
120 | 120 | } |
121 | 121 | }, |
... | ... | @@ -129,27 +129,36 @@ App({ |
129 | 129 | th.promiseGet(turl,{}).then(res=>{ |
130 | 130 | var o=res; |
131 | 131 | if(o.data.code==0){ |
132 | - th.globalData.config2 = o.data.data; | |
132 | + th.globalData.config2 = o.data.data; | |
133 | 133 | //有配置成要验证过期,因为过期的小程序没有办法审核 |
134 | - if(th.globalData.config2.is_overdue){ | |
135 | - | |
134 | + if(th.globalData.config2 && th.globalData.config2.is_overdue){ | |
135 | + | |
136 | 136 | //要开始验证,小程序有没有购买和过期 |
137 | - if(!currentPage || currentPage.route.indexOf('error/error')==-1){ | |
137 | + if(!currentPage || currentPage.route.indexOf('error/error')==-1 || currentPage.route.indexOf('index/index')==-1){ | |
138 | 138 | var tt=this.globalData.wxapp_buy_obj; |
139 | 139 | if (!tt){ |
140 | 140 | this.get_isbuy(function (){ |
141 | 141 | tt=th.globalData.wxapp_buy_obj; |
142 | 142 | if (tt.isout == 1){ |
143 | 143 | th.promiseGet('/api/weshop/store/get/'+t.stoid,{}).then(res=>{ |
144 | - wx.reLaunch({ | |
145 | - url: "/pages/error/error?msg=该商城已到期,暂停浏览!\r\n可联系:"+res.data.data.store_tel, | |
146 | - }); | |
144 | + | |
145 | + if(!th.err_going){ | |
146 | + wx.reLaunch({ | |
147 | + url: "/pages/error/error?msg=该商城已到期,暂停浏览1!\r\n可联系:"+res.data.data.store_tel, | |
148 | + }); | |
149 | + } | |
147 | 150 | }) |
148 | 151 | } |
149 | - else if (tt.isbuy == 0) | |
150 | - wx.reLaunch({ | |
151 | - url: "/pages/error/error?msg=还未购买小程序", | |
152 | - }); | |
152 | + else if (tt.isbuy == 0){ | |
153 | + | |
154 | + if(!th.err_going){ | |
155 | + wx.reLaunch({ | |
156 | + url: "/pages/error/error?msg=还未购买小程序", | |
157 | + }); | |
158 | + } | |
159 | + | |
160 | + } | |
161 | + | |
153 | 162 | }) |
154 | 163 | } |
155 | 164 | } |
... | ... | @@ -200,8 +209,13 @@ App({ |
200 | 209 | } |
201 | 210 | }, |
202 | 211 | //----------------获取配置参数-------------------- |
203 | - getConfig: function(t, o) { | |
204 | - var e = this; if(this.globalData.config==undefined) this.globalData.config=null; | |
212 | + getConfig: function(t, o) { | |
213 | + var e = this; | |
214 | + if(!e.globalData.setting.stoid){ | |
215 | + t(null); | |
216 | + return false; | |
217 | + } | |
218 | + if(this.globalData.config==undefined) this.globalData.config=null; | |
205 | 219 | this.globalData.config ? "function" == typeof t && t(this.globalData.config) : e.request.get("/api/weshop/store/get/" + e.globalData.setting.stoid, { |
206 | 220 | success: function(o) { |
207 | 221 | console.log('getConfig'); |
... | ... | @@ -211,10 +225,13 @@ App({ |
211 | 225 | } |
212 | 226 | }); |
213 | 227 | }, |
214 | - | |
215 | 228 | //----------------获取配置参数-------------------- |
216 | - getConfig2: function (t, o) { | |
229 | + getConfig2: function (t, o) { | |
217 | 230 | var e = this; |
231 | + if(!e.globalData.setting.stoid) { | |
232 | + t(null); | |
233 | + return false; | |
234 | + } | |
218 | 235 | this.globalData.config2 && !o ? |
219 | 236 | "function" == typeof t && t(this.globalData.config2) : a.get("/api/weshop/storeconfig/get/" + e.globalData.setting.stoid, { |
220 | 237 | success: function (o) { | ... | ... |
components/diy_goodsGroup/diy_goodsGroup.js
... | ... | @@ -75,9 +75,13 @@ Component({ |
75 | 75 | } |
76 | 76 | |
77 | 77 | // 在组件实例进入页面节点树时执行 |
78 | - this.data.classstyle_id = nav_item.classstyle; | |
78 | + if(nav_item) { | |
79 | + this.data.classstyle_id = nav_item.classstyle; | |
80 | + this.data.wgroup =nav_item.wgroup; | |
81 | + } | |
82 | + | |
79 | 83 | this.data.goodscount = this.data.object.goodscount; |
80 | - this.data.wgroup =nav_item.wgroup; | |
84 | + | |
81 | 85 | |
82 | 86 | var hei=280; |
83 | 87 | if(this.data.object.goodstit) hei+=80; |
... | ... | @@ -86,13 +90,13 @@ Component({ |
86 | 90 | |
87 | 91 | this.setData({swiper_hei:hei}); |
88 | 92 | |
89 | - if (nav_item.goodsclass == 1) { | |
93 | + if (nav_item && nav_item.goodsclass == 1) { | |
90 | 94 | this.data.is_recommend = 1 |
91 | 95 | } |
92 | - if (nav_item.goodsclass == 2) { | |
96 | + if (nav_item && nav_item.goodsclass == 2) { | |
93 | 97 | this.data.is_hot = 1 |
94 | 98 | } |
95 | - if (nav_item.goodsclass == 3) { | |
99 | + if (nav_item && nav_item.goodsclass == 3) { | |
96 | 100 | this.data.is_new = 1 |
97 | 101 | } |
98 | 102 | |
... | ... | @@ -353,8 +357,9 @@ Component({ |
353 | 357 | wx.showLoading(); |
354 | 358 | |
355 | 359 | var nav_item=this.data.object.nav_list[title_idx]; |
356 | - | |
357 | - this.data.g_id = this.data.object.nav_list[title_idx].data; | |
360 | + this.data.g_id =[]; | |
361 | + if(this.data.object.nav_list && this.data.object.nav_list[title_idx] && this.data.object.nav_list[title_idx].data) | |
362 | + this.data.g_id=this.data.object.nav_list[title_idx].data; | |
358 | 363 | var arr = []; |
359 | 364 | for (var i = 0; i < this.data.g_id.length; i += this.data.goodscount) { |
360 | 365 | arr.push(this.data.g_id.slice(i, i + this.data.goodscount)); |
... | ... | @@ -364,18 +369,21 @@ Component({ |
364 | 369 | this.data.requestData=[]; |
365 | 370 | |
366 | 371 | // 在组件实例进入页面节点树时执行 |
367 | - this.data.classstyle_id = nav_item.classstyle; | |
368 | - this.data.wgroup =nav_item.wgroup; | |
372 | + if(nav_item){ | |
373 | + this.data.classstyle_id = nav_item.classstyle; | |
374 | + this.data.wgroup =nav_item.wgroup; | |
375 | + } | |
376 | + | |
369 | 377 | |
370 | 378 | this.data.is_recommend = this.data.is_hot=this.data.is_new=0; |
371 | 379 | //推荐,热卖,新品 |
372 | - if (nav_item.goodsclass == 1) { | |
380 | + if (nav_item && nav_item.goodsclass == 1) { | |
373 | 381 | this.data.is_recommend = 1 |
374 | 382 | } |
375 | - if (nav_item.goodsclass == 2) { | |
383 | + if (nav_item && nav_item.goodsclass == 2) { | |
376 | 384 | this.data.is_hot = 1 |
377 | 385 | } |
378 | - if (nav_item.goodsclass == 3) { | |
386 | + if (nav_item && nav_item.goodsclass == 3) { | |
379 | 387 | this.data.is_new = 1 |
380 | 388 | } |
381 | 389 | ... | ... |
packageA/pages/cardDetails/cardDetails.wxml
packageA/pages/cardList/cardList.js
... | ... | @@ -61,6 +61,7 @@ Page({ |
61 | 61 | isLogin: true, |
62 | 62 | }); |
63 | 63 | |
64 | + currentQuery.page=1; | |
64 | 65 | this.getData(true, url, currentQuery); |
65 | 66 | // app.request.promiseGet("/api/weshop/ad/page?pid=2&store_id=" + app.globalData.setting.stoid, { |
66 | 67 | // data: { |
... | ... | @@ -137,9 +138,7 @@ Page({ |
137 | 138 | /** |
138 | 139 | * promiseGet请求数据 |
139 | 140 | */ |
140 | - getData: function(isInit, url, data) { | |
141 | - return new Promise(function(resolve, reject) { | |
142 | - | |
141 | + getData: function(isInit, url, data,callback) { | |
143 | 142 | app.request.promiseGet(url, { |
144 | 143 | data: data, |
145 | 144 | isShowLoading: true, |
... | ... | @@ -172,18 +171,18 @@ Page({ |
172 | 171 | self.setData({ |
173 | 172 | 'list.pageData': [] |
174 | 173 | }); |
175 | - }; | |
176 | - resolve(); | |
174 | + }; | |
175 | + if(callback) callback(); | |
176 | + | |
177 | 177 | }) |
178 | 178 | .catch(function(err) { |
179 | 179 | console.log('出错拉!!!!',err); |
180 | 180 | self.setData({ |
181 | 181 | 'list.pageData': [] |
182 | 182 | }); |
183 | + | |
184 | + if(callback) callback(); | |
183 | 185 | }); |
184 | - | |
185 | - }); | |
186 | - | |
187 | 186 | }, |
188 | 187 | |
189 | 188 | |
... | ... | @@ -207,12 +206,9 @@ Page({ |
207 | 206 | isLoading: true, |
208 | 207 | pageNum: this.data.pageNum + 1 |
209 | 208 | }); |
210 | - requestData.page = this.data.pageNum; | |
209 | + requestData.page = this.data.pageNum; | |
210 | + this.getData(false, url, requestData,callback) | |
211 | 211 | |
212 | - this.getData(false, url, requestData) | |
213 | - .then(function() { | |
214 | - callback(); | |
215 | - }); | |
216 | 212 | }; |
217 | 213 | }, |
218 | 214 | |
... | ... | @@ -221,4 +217,12 @@ Page({ |
221 | 217 | var url = "/packageA/pages/goodsInfo/goodsInfo?goods_id=" + gid; |
222 | 218 | app.goto(url); |
223 | 219 | }, |
220 | + | |
221 | + //图片失败,默认图片 | |
222 | + bind_bnerr: function(e) { | |
223 | + var _errImg = e.target.dataset.errorimg; | |
224 | + var _errObj = {}; | |
225 | + _errObj[_errImg] = "/miniapp/images/default_g_img.gif"; | |
226 | + this.setData(_errObj); //注意这里的赋值方式,只是将数据列表中的此项图片路径值替换掉 ; | |
227 | + }, | |
224 | 228 | }) |
225 | 229 | \ No newline at end of file | ... | ... |
packageA/pages/cardList/cardList.json
... | ... | @@ -3,6 +3,7 @@ |
3 | 3 | "enablePullDownRefresh": false, |
4 | 4 | "usingComponents": { |
5 | 5 | "nodata": "/components/nodata/nodata", |
6 | - "advertising":"/components/diy_advertising/diy_advertising" | |
6 | + "advertising":"/components/diy_advertising/diy_advertising", | |
7 | + "nav_box":"/components/nav_box/nav_box" | |
7 | 8 | } |
8 | 9 | } |
9 | 10 | \ No newline at end of file | ... | ... |
packageA/pages/cardList/cardList.wxml
1 | 1 | <block wx:if="{{object}}"> |
2 | + <view class="bg_view" style="background-color:{{object.bg_color}};"> | |
2 | 3 | <advertising object="{{object}}"></advertising> |
3 | - <view style="background-color: #{{object.bg_color}};"> | |
4 | 4 | <!-- 列表 --> |
5 | 5 | <block wx:if="{{object.column=='4'}}"> |
6 | 6 | |
... | ... | @@ -9,12 +9,14 @@ |
9 | 9 | |
10 | 10 | <view class="flex bg-white "> |
11 | 11 | <view> |
12 | - <image class="image" src="{{imghost + item.imgUrl}}"/> | |
12 | + <image class="image" src="{{imghost}}{{item.imgUrl && item.imgUrl!=''?item.imgUrl:'/miniapp/images/default_g_img.gif'}}" | |
13 | + lazy-load="true" binderror="bind_bnerr" data-errorimg="list.pageData[{{index}}].imgUrl" | |
14 | + /> | |
13 | 15 | </view> |
14 | 16 | <view class="flex fdc space-bt f1 pdl20"> |
15 | 17 | <view> |
16 | 18 | <view class="pdv20 fs28"><text class="ellipsis-2">{{item.serviceName}}</text></view> |
17 | - <view class="fs24 c7b">有效天数:{{item.validDays}}</view> | |
19 | + <view class="fs24 c7b">有效天数:{{item.validDays?item.validDays:0}}</view> | |
18 | 20 | </view> |
19 | 21 | <view class="flex space-bt ali-c"> |
20 | 22 | <view class="price">{{item.money}}</view> |
... | ... | @@ -24,20 +26,21 @@ |
24 | 26 | </view> |
25 | 27 | </view> |
26 | 28 | |
27 | - </block> | |
28 | - | |
29 | + </block> | |
29 | 30 | <!-- 一列和俩列 --> |
30 | 31 | <block wx:else> |
31 | - <view class="pd20 flex-set"> | |
32 | + <view class="pd20 flex-set" style="background-color: #{{object.bg_color}};"> | |
32 | 33 | <!-- 1列 2列 --> |
33 | 34 | <view wx:for="{{list.pageData}}" class="{{object.column=='1'?'w100':'w50'}} {{index%2==1?'ml':''}} bg-white" |
34 | 35 | bindtap="go_goods" data-gid="{{item.id}}" |
35 | 36 | style="margin-bottom: 20rpx;"> |
36 | - <view style="width: 100%;"><image src="{{imghost + item.imgUrl}}" mode="aspectFill"/></view> | |
37 | + <view style="width: 100%;"> | |
38 | + <image style="width: 100%;" lazy-load="true" binderror="bind_bnerr" data-errorimg="list.pageData[{{index}}].imgUrl" | |
39 | + src="{{imghost}}{{item.imgUrl && item.imgUrl!=''?item.imgUrl:'/miniapp/images/default_g_img.gif'}}" mode="aspectFill"/></view> | |
37 | 40 | <view class="flex fdc space-bt f1 pdl20"> |
38 | 41 | <view> |
39 | 42 | <view class="pdv20 fs28"><text class="ellipsis-2">{{item.serviceName}}</text></view> |
40 | - <view class="fs24 c7b">有效天数:{{item.validDays}}</view> | |
43 | + <view class="fs24 c7b">有效天数:{{item.validDays?item.validDays:0}}</view> | |
41 | 44 | </view> |
42 | 45 | <view class="flex space-bt ali-c"> |
43 | 46 | <view class="price">{{item.money}}</view> |
... | ... | @@ -47,9 +50,10 @@ |
47 | 50 | </view> |
48 | 51 | </view> |
49 | 52 | </block> |
50 | - </view> | |
53 | + | |
51 | 54 | <nodata class="t-c" wx:if="{{list.pageData.length == 0 && list.pageData}}"></nodata> |
52 | 55 | <view wx:if="{{noMore}}" class="noMore">- 已经到底了 -</view> |
56 | + </view> | |
53 | 57 | </block> |
54 | 58 | |
55 | 59 | <block wx:else> |
... | ... | @@ -61,12 +65,15 @@ |
61 | 65 | <view class="bg-white"> |
62 | 66 | <view class="flex pd20" wx:for="{{list.pageData}}" bindtap="go_goods" data-gid="{{item.id}}"> |
63 | 67 | <view> |
64 | - <image class="image" src="{{imghost + item.imgUrl}}"/> | |
68 | + <image class="image" | |
69 | + lazy-load="true" binderror="bind_bnerr" data-errorimg="list.pageData[{{index}}].imgUrl" | |
70 | + src="{{imghost}}{{item.imgUrl && item.imgUrl!=''?item.imgUrl:'/miniapp/images/default_g_img.gif'}}" | |
71 | + /> | |
65 | 72 | </view> |
66 | 73 | <view class="flex fdc space-bt f1 pdl20"> |
67 | 74 | <view> |
68 | 75 | <view class="pdv20 fs28"><text class="ellipsis-2">{{item.serviceName}}</text></view> |
69 | - <view class="fs24 c7b">有效天数:{{item.validDays}}</view> | |
76 | + <view class="fs24 c7b">有效天数:{{item.validDays?item.validDays:0}}</view> | |
70 | 77 | </view> |
71 | 78 | <view class="flex space-bt ali-c"> |
72 | 79 | <view class="price">{{item.money}}</view> |
... | ... | @@ -81,4 +88,5 @@ |
81 | 88 | <view wx:if="{{noMore}}" class="noMore">- 已经到底了 -</view> |
82 | 89 | </scroll-view> |
83 | 90 | </view> |
84 | -</block> | |
85 | 91 | \ No newline at end of file |
92 | +</block> | |
93 | +<nav_box id="nav_box"></nav_box> | |
86 | 94 | \ No newline at end of file | ... | ... |
packageA/pages/cardList/cardList.wxss
1 | 1 | /* pages/i_service/cardList/cardList.wxss */ |
2 | -page, | |
2 | +page{ background-color: #f2f2f2;} | |
3 | + | |
4 | + | |
3 | 5 | .page { |
4 | 6 | height: 100%; |
5 | 7 | } |
6 | - | |
7 | -page { | |
8 | - background-color: #f2f2f2; | |
9 | -} | |
10 | - | |
11 | 8 | .scroll-view { |
12 | 9 | height: calc(100% - 300rpx); |
13 | 10 | } |
... | ... | @@ -69,9 +66,16 @@ page { |
69 | 66 | .list_item{ display: inline-block;} |
70 | 67 | .w100{ width: 100%;} |
71 | 68 | .w50{ width: 49%; } |
72 | - | |
69 | +.w50.ml{margin-left: 12rpx;} | |
73 | 70 | |
74 | 71 | .w50 image{ width: 100%; height: 340rpx; } |
75 | 72 | .flex-set{display: flex;flex-wrap: wrap;} |
76 | -.ml{margin-left: 15rpx;} | |
77 | -.b-bottom{ border-bottom:1rpx solid #fff} | |
78 | 73 | \ No newline at end of file |
74 | + | |
75 | +.b-bottom{ border-bottom:1rpx solid #fff} | |
76 | +.bg_view{ | |
77 | + display: block; | |
78 | + min-height: 100%; | |
79 | + width: 100%; | |
80 | + position: absolute; | |
81 | + left: 0;top: 0;z-index: 1; | |
82 | +} | |
79 | 83 | \ No newline at end of file | ... | ... |
packageA/pages/cart2_ser/cart2_ser.js
... | ... | @@ -41,7 +41,11 @@ Page({ |
41 | 41 | //判断页面是返回回来的还是 首次进入的 |
42 | 42 | yuer:0, |
43 | 43 | }, |
44 | - onLoad: function(t) { | |
44 | + onLoad: function(t) { | |
45 | + wx.setNavigationBarTitle({ | |
46 | + title: "填写订单", | |
47 | + }); | |
48 | + | |
45 | 49 | var appD=getApp().globalData.service_now; |
46 | 50 | this.data.postdata=appD; |
47 | 51 | this.data.param=t; |
... | ... | @@ -50,7 +54,7 @@ Page({ |
50 | 54 | getApp().promiseGet("/api/wx/weappSendlist/page", { |
51 | 55 | data: { |
52 | 56 | store_id: os.stoid, |
53 | - typeid: "1002" | |
57 | + typeid: "1001" | |
54 | 58 | }}).then(res=>{ |
55 | 59 | if (res.data.code == 0 && res.data.data.pageData.length > 0) { |
56 | 60 | var template_id = res.data.data.pageData[0].template_id; | ... | ... |
packageA/pages/goodsInfo/goodsInfo.js
... | ... | @@ -399,6 +399,7 @@ Page({ |
399 | 399 | 'data.goods_id': t.data.data.id, |
400 | 400 | 'data.id': t.data.data.id, |
401 | 401 | 'data.sales_sum': t.data.data.sales_sum, |
402 | + 'data.storageId':t.data.data.storageId | |
402 | 403 | }); |
403 | 404 | |
404 | 405 | |
... | ... | @@ -803,7 +804,7 @@ Page({ |
803 | 804 | if(sto_list){ |
804 | 805 | for (var k = 0; k < e.data.data.pageData.length; k++) { |
805 | 806 | var it=e.data.data.pageData[k]; |
806 | - if (sto_list.indexof(it.keyid)==-1) { | |
807 | + if (sto_list.indexOf(it.keyid)==-1) { | |
807 | 808 | //删除 |
808 | 809 | e.data.data.pageData.splice(k--, 1); |
809 | 810 | } | ... | ... |
packageA/pages/goodsInfo/goodsInfo.wxml
... | ... | @@ -40,11 +40,9 @@ |
40 | 40 | |
41 | 41 | <view class="goods-num" style="margin-bottom: 10rpx;"> |
42 | 42 | <view class="sales">销量:{{data.sales_sum}}</view> |
43 | - <view class="sales">有效天数:{{data.validDays}}</view> | |
43 | + <view class="sales">有效天数:{{data.validDays?data.validDays:0}}</view> | |
44 | 44 | </view> |
45 | - | |
46 | - | |
47 | - | |
45 | + | |
48 | 46 | </view> |
49 | 47 | </block> |
50 | 48 | ... | ... |
packageA/pages/profile/profile.js
... | ... | @@ -141,8 +141,6 @@ Page({ |
141 | 141 | } |
142 | 142 | }, |
143 | 143 | |
144 | - | |
145 | - | |
146 | 144 | //---点击二级之后的选择--- |
147 | 145 | choose_for_store: function(e) { |
148 | 146 | var index_c = e.currentTarget.dataset.ind; |
... | ... | @@ -387,12 +385,7 @@ Page({ |
387 | 385 | } |
388 | 386 | } |
389 | 387 | }, 200) |
390 | - //检验门店的点击,看下次数是不是到了 | |
391 | - // this.check_click_ok(function(){ | |
392 | - | |
393 | - | |
394 | - // },2) | |
395 | - | |
388 | + | |
396 | 389 | }, |
397 | 390 | |
398 | 391 | //选择更多门店 |
... | ... | @@ -532,10 +525,16 @@ Page({ |
532 | 525 | |
533 | 526 | self = this; |
534 | 527 | let url1 = '/api/weshop/storeconfig/get/'; |
535 | - let url2 = '/api/weshop/prom/coupon/get/'; | |
536 | 528 | let url3 = '/api/weshop/users/getERPUser/'; |
537 | 529 | url1 += r.stoid; |
530 | + var user=app.globalData.userInfo; | |
531 | + if(!user) return false; | |
538 | 532 | |
533 | + //-- 赋予默认值 -- | |
534 | + if(user['idcard']) this.data.id=user['idcard']; | |
535 | + if(user['vipname']) this.data.name=user['vipname']; | |
536 | + if(user['address']) this.data.address=user['address']; | |
537 | + | |
539 | 538 | app.request.get(url1, { |
540 | 539 | success: function(res) { |
541 | 540 | console.log('x-->', res.data.code, res.data.data.reg_type, res.data.data.reg_info); |
... | ... | @@ -544,19 +543,11 @@ Page({ |
544 | 543 | let reg_info = res.data.data.reg_info; |
545 | 544 | if(reg_type) { //reg_type为1才显示积分信息 |
546 | 545 | if(reg_info) { |
547 | - reg_info = JSON.parse(reg_info); | |
548 | - //获取优惠券 | |
549 | - url2 += reg_info.reginfo_coupon; | |
550 | - app.request.get(url2, { | |
551 | - success: function(r) { | |
552 | - if(r.data.code == 0) { | |
553 | - console.log('000res==>', r.data.data.name); | |
554 | - self.setData({ | |
555 | - couponInfo: r.data.data.name, | |
556 | - }); | |
557 | - }; | |
558 | - }, | |
559 | - }); | |
546 | + reg_info = JSON.parse(reg_info); | |
547 | + if(reg_info.reginfo_coupon){ | |
548 | + //判断有没有领过券 | |
549 | + self.check_is_send_quan(reg_info.reginfo_coupon,user.user_id); | |
550 | + } | |
560 | 551 | }; |
561 | 552 | }; |
562 | 553 | self.setData({ |
... | ... | @@ -568,32 +559,76 @@ Page({ |
568 | 559 | |
569 | 560 | }, |
570 | 561 | }); |
571 | - | |
572 | - | |
562 | + | |
573 | 563 | //获取默认信息 |
574 | - url3 += r.stoid + "/" + app.globalData.user_id; | |
564 | + url3 += r.stoid + "/" +user.user_id; | |
575 | 565 | app.request.get(url3, { |
576 | 566 | success: function(res) { |
577 | 567 | if(res.data.code == 0) { |
578 | 568 | console.log('url3', res.data.data.birthday); |
579 | 569 | let data = res.data.data; |
580 | - self.setData({ | |
581 | - isGender: data.sex, | |
582 | - isLunar: data.islunar, | |
583 | - datet: data.birthday, | |
584 | - stoname: data.pickup_name, | |
585 | - sto_sele_id: data.pickup_id, | |
586 | - }); | |
570 | + | |
571 | + if(data.birthday){ | |
572 | + data.birthday= ut.formar_no_full(data.birthday); | |
573 | + } | |
574 | + | |
575 | + if(user['sex'] && !data.sex){ | |
576 | + data.sex=user['sex']; | |
577 | + } | |
578 | + if(user['birthday'] && !data.birthday){ | |
579 | + data.birthday= ut.formar_no_full(user['birthday']); | |
580 | + } | |
581 | + | |
582 | + if(!data.pickup_name){ | |
583 | + data.pickup_name=""; | |
584 | + } | |
585 | + if(!data.pickup_id){ | |
586 | + data.pickup_id=0; | |
587 | + } | |
588 | + //-- 获取门店 -- | |
589 | + if(user['pickup_id'] && !data.pickup_id){ | |
590 | + getApp().promiseGet("/api/weshop/pickup/get/"+r.stoid+"/"+user['pickup_id']).then(res=>{ | |
591 | + if(res.data.code==0 && res.data.data){ | |
592 | + data.pickup_name=res.data.data.pickup_name; | |
593 | + data.pickup_id=res.data.data.pickup_id; | |
594 | + | |
595 | + self.setData({ | |
596 | + isGender: data.sex, | |
597 | + isLunar: data.islunar, | |
598 | + datet: data.birthday, | |
599 | + stoname: data.pickup_name, | |
600 | + sto_sele_id: data.pickup_id, | |
601 | + }); | |
602 | + } | |
603 | + else{ | |
604 | + self.setData({ | |
605 | + isGender: data.sex, | |
606 | + isLunar: data.islunar, | |
607 | + datet: data.birthday, | |
608 | + stoname: data.pickup_name, | |
609 | + sto_sele_id: data.pickup_id, | |
610 | + }); | |
611 | + } | |
612 | + }) | |
613 | + }else{ | |
614 | + self.setData({ | |
615 | + isGender: data.sex, | |
616 | + isLunar: data.islunar, | |
617 | + datet: data.birthday, | |
618 | + stoname: data.pickup_name, | |
619 | + sto_sele_id: data.pickup_id, | |
620 | + }); | |
621 | + } | |
587 | 622 | }; |
588 | 623 | } |
589 | 624 | }); |
590 | - | |
591 | - | |
625 | + | |
626 | + if(user){ | |
627 | + self.setData({user:user}) | |
628 | + } | |
629 | + | |
592 | 630 | }, |
593 | - | |
594 | - | |
595 | - | |
596 | - | |
631 | + | |
597 | 632 | onShow: function() { |
598 | 633 | var e = this; |
599 | 634 | if (this.data.is_zy) return false; |
... | ... | @@ -607,44 +642,7 @@ Page({ |
607 | 642 | } |
608 | 643 | |
609 | 644 | var req = t; |
610 | - // req.get("/api/weshop/users/getAndUpdateUser/" + r.stoid + "/" + getApp().globalData.user_id, { | |
611 | - // success: function(src) { | |
612 | - // var a = src.data.data; | |
613 | - | |
614 | - // if(!a) a={}; | |
615 | - // var time ="",birthday =""; | |
616 | - // if(a && a.reg_time) time=util.formatTime(a.reg_time, "'Y/M/D"); | |
617 | - // if(a && a.birthday) birthday=util.formatTime(a.birthday, "'Y/M/D"); | |
618 | - | |
619 | - // a.reg_time = time; | |
620 | - // a.birthday = birthday | |
621 | - | |
622 | - // if(a.address=='null' || !a.address){ | |
623 | - // a.address=""; | |
624 | - // } | |
625 | - | |
626 | - // e.data.fir_guide_id=a.staffId; | |
627 | - // if(choice_guide){ | |
628 | - // a.staffName=choice_guide.StaffName; | |
629 | - // a.staffId=choice_guide.Id; | |
630 | - // } | |
631 | - | |
632 | - | |
633 | - // e.setData({ | |
634 | - // // phone: a.mobile, | |
635 | - // user: a, | |
636 | - // openid: a.openid, | |
637 | - // sto_sele_id: a.pickup_id, | |
638 | - // consumption: a.paypwd, | |
639 | - // // identity_card: a.idcard, | |
640 | - // address: a.address, | |
641 | - // // isGender: a.sex, | |
642 | - // // isstcsp: a.vipnopwd, | |
643 | - // // iscalendar:a.islunar | |
644 | - // }); | |
645 | - | |
646 | - // } | |
647 | - // }) | |
645 | + | |
648 | 646 | a.getUserInfo(function(a) { |
649 | 647 | var txt = util.formatTime(a.birthday, 'yyyy-M-d'), |
650 | 648 | arr = txt.split(' '); |
... | ... | @@ -665,19 +663,41 @@ Page({ |
665 | 663 | } |
666 | 664 | }) |
667 | 665 | } |
668 | - // var phone = ""; | |
669 | - // phone+=a.mobile.substr(0, 3)+"****"; | |
670 | - // phone += a.mobile.substr(7, 12); | |
671 | - | |
672 | - | |
673 | - | |
674 | - // e.setData({ | |
675 | - // isGender:e.data.user.sex | |
676 | - // }) | |
666 | + | |
677 | 667 | }, !0); |
678 | 668 | }, |
679 | 669 | |
680 | - | |
670 | + check_is_send_quan:function(cid,uid){ | |
671 | + var self=this; | |
672 | + let url2 = '/api/weshop/prom/coupon/get/'; | |
673 | + //看一下会员有没有领过注册的券 | |
674 | + getApp().promiseGet("/api/weshop/couponList/page",{ | |
675 | + data:{store_id:r.stoid,uid:uid,cid:cid} | |
676 | + }).then(res=>{ | |
677 | + var is_ling=0; | |
678 | + if(res.data.code==0 && res.data.data && res.data.data.total>0){ | |
679 | + is_ling=1; | |
680 | + } | |
681 | + | |
682 | + //没有领过券,就显示 | |
683 | + if(!is_ling){ | |
684 | + //获取优惠券 | |
685 | + url2 += cid; | |
686 | + app.request.get(url2, { | |
687 | + success: function(r) { | |
688 | + if(r.data.code == 0) { | |
689 | + console.log('000res==>', r.data.data.name); | |
690 | + self.setData({ | |
691 | + couponInfo: r.data.data.name, | |
692 | + }); | |
693 | + }; | |
694 | + }, | |
695 | + }); | |
696 | + } | |
697 | + | |
698 | + }) | |
699 | + | |
700 | + }, | |
681 | 701 | |
682 | 702 | |
683 | 703 | //------卡片的显示和关闭-------- |
... | ... | @@ -710,19 +730,6 @@ Page({ |
710 | 730 | }, |
711 | 731 | |
712 | 732 | |
713 | - //用户名字 | |
714 | - // user_name: function(e) { | |
715 | - // var th = this; | |
716 | - // var name = e.detail.value; | |
717 | - // var vipname = 'user.vipname'; | |
718 | - // if (name != "" || name != null) { | |
719 | - // th.setData({ | |
720 | - // [vipname]: name | |
721 | - // }); | |
722 | - // } | |
723 | - | |
724 | - // }, | |
725 | - | |
726 | 733 | //点击确认修改信息 |
727 | 734 | confirm_revision: function() { |
728 | 735 | var th = this; |
... | ... | @@ -988,65 +995,94 @@ Page({ |
988 | 995 | |
989 | 996 | //保存 |
990 | 997 | save: function() { |
991 | - var th = this; | |
992 | - // let isAgree = this.data.isAgree; | |
993 | - // 同意协议 | |
994 | - // if(isAgree) { | |
998 | + var th = this; | |
995 | 999 | var sto_sele_id = this.data.sto_sele_id; |
996 | - let tjrname = this.data.referee; | |
997 | - if (tjrname == "" || tjrname == null) { | |
998 | - app.my_warnning("请输入推荐人", 0, this); | |
999 | - return false; | |
1000 | - }; | |
1001 | - let vipname = this.data.name; | |
1002 | - if (vipname == "" || vipname == null) { | |
1003 | - app.my_warnning("请输入姓名", 0, this); | |
1004 | - return false; | |
1005 | - }; | |
1006 | - let sex = this.data.isGender; | |
1007 | - if (sex != "1" && sex != "2") { | |
1008 | - app.my_warnning("请选择性别", 0, this); | |
1009 | - return false; | |
1010 | - }; | |
1011 | - let birthday = this.data.datet; | |
1012 | - if (birthday == "" || birthday == null) { | |
1013 | - app.my_warnning("请选择出生日期", 0, this); | |
1014 | - return false; | |
1015 | - }; | |
1016 | - let idcard = this.data.id; | |
1017 | - if (idcard == "" || idcard == null) { | |
1018 | - app.my_warnning("请输入身份证号码", 0, this); | |
1019 | - return false; | |
1020 | - }; | |
1021 | - let address = this.data.address; | |
1022 | - if (address == "" || address == null) { | |
1023 | - app.my_warnning("请输入地址", 0, this); | |
1024 | - return false; | |
1025 | - }; | |
1026 | - let pickup_id = sto_sele_id; | |
1027 | - if (pickup_id == "" || pickup_id == null) { | |
1028 | - app.my_warnning("请输入地址", 0, this); | |
1029 | - return false; | |
1000 | + var user=app.globalData.userInfo; | |
1001 | + | |
1002 | + var data = { | |
1003 | + store_id: r.stoid, | |
1004 | + user_id: app.globalData.user_id, | |
1030 | 1005 | }; |
1006 | + | |
1007 | + //-- 需要推荐人 -- | |
1008 | + if(this.data.reg_info.introducer_state){ | |
1009 | + let tjrname = this.data.referee; | |
1010 | + if (tjrname == "" || tjrname == null) { | |
1011 | + app.my_warnning("请输入推荐人", 0, this); | |
1012 | + return false; | |
1013 | + }; | |
1014 | + if(tjrname==user.mobile || tjrname==user.erpvipno ){ | |
1015 | + app.my_warnning("推荐人不能是自己", 0, this); | |
1016 | + return false; | |
1017 | + } | |
1018 | + data.tjrname=tjrname; | |
1019 | + } | |
1020 | + | |
1021 | + //-- 需要姓名 -- | |
1022 | + if(this.data.reg_info.name_state){ | |
1023 | + let vipname = this.data.name; | |
1024 | + if (vipname == "" || vipname == null) { | |
1025 | + app.my_warnning("请输入姓名", 0, this); | |
1026 | + return false; | |
1027 | + }; | |
1028 | + data.vipname=vipname; | |
1029 | + } | |
1030 | + //需要性别 | |
1031 | + if(this.data.reg_info.sex_state){ | |
1032 | + let sex = this.data.isGender; | |
1033 | + if (sex != "1" && sex != "2") { | |
1034 | + app.my_warnning("请选择性别", 0, this); | |
1035 | + return false; | |
1036 | + }; | |
1037 | + data.sex=sex; | |
1038 | + } | |
1039 | + | |
1040 | + //需要生日 | |
1041 | + if(this.data.reg_info.birthday_state){ | |
1042 | + let birthday = this.data.datet; | |
1043 | + if (birthday == "" || birthday == null) { | |
1044 | + app.my_warnning("请选择出生日期", 0, this); | |
1045 | + return false; | |
1046 | + }; | |
1047 | + | |
1048 | + data.birthday=birthday; | |
1049 | + data.islunar=self.data.isLunar; | |
1050 | + } | |
1051 | + | |
1052 | + //-- 需要身份证 -- | |
1053 | + if(this.data.reg_info.idcard_state){ | |
1054 | + let idcard = this.data.id; | |
1055 | + if (idcard == "" || idcard == null) { | |
1056 | + app.my_warnning("请输入身份证号码", 0, this); | |
1057 | + return false; | |
1058 | + }; | |
1059 | + data.idcard=idcard; | |
1060 | + } | |
1061 | + //需要地址 | |
1062 | + if(this.data.reg_info.address_state){ | |
1063 | + let address = this.data.address; | |
1064 | + if (address == "" || address == null) { | |
1065 | + app.my_warnning("请输入地址", 0, this); | |
1066 | + return false; | |
1067 | + }; | |
1068 | + data.address=address; | |
1069 | + } | |
1070 | + //需要门店 | |
1071 | + if(this.data.reg_info.pick_state){ | |
1072 | + let pickup_id = sto_sele_id; | |
1073 | + if (pickup_id == "" || pickup_id == null) { | |
1074 | + app.my_warnning("请输入门店", 0, this); | |
1075 | + return false; | |
1076 | + }; | |
1077 | + data.pickup_id=sto_sele_id; | |
1078 | + } | |
1079 | + | |
1031 | 1080 | let isAgree = this.data.isAgree; |
1032 | 1081 | if(!isAgree) { |
1033 | 1082 | app.my_warnning("请您先阅读和勾选指定的内容", 0, this); |
1034 | 1083 | return false; |
1035 | 1084 | }; |
1036 | - | |
1037 | - var data = { | |
1038 | - store_id: r.stoid, | |
1039 | - user_id: app.globalData.user_id, | |
1040 | - tjrname: tjrname, //推荐人 | |
1041 | - vipname: vipname, //名称 | |
1042 | - sex: sex, //性别 | |
1043 | - birthday: self.data.datet, | |
1044 | - islunar: self.data.isLunar, | |
1045 | - idcard: self.data.id, | |
1046 | - address: address, | |
1047 | - pickup_id: sto_sele_id ,//自提门店 所属门店 | |
1048 | - }; | |
1049 | - | |
1085 | + | |
1050 | 1086 | |
1051 | 1087 | console.log('data==>', data); |
1052 | 1088 | ... | ... |
packageA/pages/profile/profile.wxml
... | ... | @@ -24,21 +24,29 @@ |
24 | 24 | |
25 | 25 | <view class="user-container"> |
26 | 26 | <view class="Bbottom"> |
27 | - <view bindtap="editUserInfo1" class="user-name flex-vertical" data-type="nickname" wx:if="{{reg_info.introducer_state}}"> | |
27 | + | |
28 | + <!-- 如果需要接骚人信息 --> | |
29 | + <view class="user-name flex-vertical" data-type="nickname" wx:if="{{reg_info.introducer_state}}"> | |
28 | 30 | <view class="user-name-txt">推荐人:</view> |
29 | - <input bindinput="getReferee" bindblur="" data-name="推荐人" class="user-txt-right f1 pdl20 t-r" placeholder="请输入推荐人手机号码或卡号"/> | |
30 | - <view class="c-red pdl20 fs24" wx:if="{{reg_info.introducer && (reg_info.introducer_type == 0)}}">+{{reg_info.introducer}}积分</view> | |
31 | - <view class="c-red pdl20 fs24" wx:elif="{{reg_info.introducer && (reg_info.introducer_type == 1)}}">+{{reg_info.introducer}}成长值</view> | |
31 | + <input bindinput="getReferee" bindblur="" value="{{user['fromuser_id']?user['fromuser_id']:''}}" data-name="推荐人" class="user-txt-right f1 pdl20 t-r" placeholder="请输入推荐人手机号码或卡号"/> | |
32 | + | |
33 | + <block wx:if="{{!user['fromuser_id']}}"> | |
34 | + <view class="c-red pdl20 fs24" wx:if="{{reg_info.introducer && (reg_info.introducer_type == 0)}}">+{{reg_info.introducer}}积分</view> | |
35 | + <view class="c-red pdl20 fs24" wx:elif="{{reg_info.introducer && (reg_info.introducer_type == 1)}}">+{{reg_info.introducer}}成长值</view> | |
36 | + </block> | |
32 | 37 | </view> |
33 | - | |
34 | - <view bindtap="editUserInfo1" class="user-name flex-vertical" data-type="nickname" wx:if="{{reg_info.name_state}}"> | |
35 | - <view class="user-name-txt">姓名:</view> | |
36 | - <input bindinput="getName" bindblur="" data-name="姓名" class="user-txt-right f1 pdl20 t-r" placeholder="请输入您的真实姓名"/> | |
37 | - <view class="c-red pdl20 fs24" wx:if="{{reg_info.name && (reg_info.name_val_type == 0)}}">+{{reg_info.name}}积分</view> | |
38 | - <view class="c-red pdl20 fs24" wx:elif="{{reg_info.name && (reg_info.name_val_type == 1)}}">+{{reg_info.name}}成长值</view> | |
38 | + | |
39 | + <!-- 如果需要接姓名信息 --> | |
40 | + <view class="user-name flex-vertical" data-type="nickname" wx:if="{{reg_info.name_state}}"> | |
41 | + <view class="user-name-txt">姓名:</view> | |
42 | + <input bindinput="getName" bindblur="" value="{{user['vipname']?user['vipname']:''}}" data-name="姓名" class="user-txt-right f1 pdl20 t-r" placeholder="请输入您的真实姓名"/> | |
43 | + <block wx:if="{{!user['vipname']}}"> | |
44 | + <view class="c-red pdl20 fs24" wx:if="{{reg_info.name && (reg_info.name_val_type == 0)}}">+{{reg_info.name}}积分</view> | |
45 | + <view class="c-red pdl20 fs24" wx:elif="{{reg_info.name && (reg_info.name_val_type == 1)}}">+{{reg_info.name}}成长值</view> | |
46 | + </block> | |
39 | 47 | </view> |
40 | 48 | |
41 | - <view class="user-name flex-vertical" data-type="sex" wx:if="{{reg_info.sex_state}}"> | |
49 | + <view class="user-name flex-vertical" data-type="sex" wx:if="{{reg_info.sex_state }}"> | |
42 | 50 | <view>性别:</view> |
43 | 51 | <view class="flex f1 pdl20 jc_fe"> |
44 | 52 | <view class="flex-center {{isGender==1?'Gendercheck':'Gender'}}" data-sex="1" bindtap="getGender"> |
... | ... | @@ -60,11 +68,14 @@ |
60 | 68 | <view class="fs26">女</view> |
61 | 69 | </view> |
62 | 70 | </view> |
63 | - <view class="c-red pdl20 fs24" wx:if="{{reg_info.sex && (reg_info.sex_state_type == 0)}}">+{{reg_info.sex}}积分</view> | |
64 | - <view class="c-red pdl20 fs24" wx:elif="{{reg_info.sex && (reg_info.sex_state_type == 1)}}">+{{reg_info.sex}}成长值</view> | |
71 | + | |
72 | + <block wx:if="{{!user['sex']}}"> | |
73 | + <view class="c-red pdl20 fs24" wx:if="{{reg_info.sex && (reg_info.sex_state_type == 0)}}">+{{reg_info.sex}}积分</view> | |
74 | + <view class="c-red pdl20 fs24" wx:elif="{{reg_info.sex && (reg_info.sex_state_type == 1)}}">+{{reg_info.sex}}成长值</view> | |
75 | + </block> | |
65 | 76 | </view> |
66 | 77 | |
67 | - <view class="user-name flex-vertical" data-type="sex" wx:if="{{reg_info.birthday_state}}"> | |
78 | + <view class="user-name flex-vertical" data-type="birthday" wx:if="{{reg_info.birthday_state}}" style="justify-content: space-between;"> | |
68 | 79 | <view class="shrink0">出生日期:</view> |
69 | 80 | <view class="flex fs28 Birth pdl20 jc_fe"> |
70 | 81 | <view class="user-txt-right pdl20 flex ai-center"> |
... | ... | @@ -74,45 +85,52 @@ |
74 | 85 | </label> |
75 | 86 | </checkbox-group> |
76 | 87 | <picker class="pdl20" bindchange='bindChange' mode="date" start="{{year-70}}-1-1" end="{{year}}-12-31"> |
77 | - <view class="flex ai-center">{{datet? filters.format_time(datet):"请选择时间"}}<view class="angle">∟</view></view> | |
88 | + <view class="flex ai-center">{{datet?datet:"请选择时间"}}<view class="angle">∟</view></view> | |
78 | 89 | </picker> |
79 | 90 | |
80 | 91 | |
81 | 92 | </view> |
82 | 93 | </view> |
83 | - <view class="c-red pdl20 fs24 shrink0" wx:if="{{reg_info.birthday && (reg_info.birthday_type == 0)}}">+{{reg_info.birthday}}积分</view> | |
84 | - <view class="c-red pdl20 fs24 shrink0" wx:elif="{{reg_info.birthday && (reg_info.birthday_type == 1)}}">+{{reg_info.birthday}}成长值</view> | |
94 | + | |
95 | + <block wx:if="{{!user['birthday']}}"> | |
96 | + <view class="c-red pdl20 fs24 shrink0" wx:if="{{reg_info.birthday && (reg_info.birthday_type == 0)}}">+{{reg_info.birthday}}积分</view> | |
97 | + <view class="c-red pdl20 fs24 shrink0" wx:elif="{{reg_info.birthday && (reg_info.birthday_type == 1)}}">+{{reg_info.birthday}}成长值</view> | |
98 | + </block> | |
85 | 99 | </view> |
86 | 100 | |
87 | 101 | |
88 | 102 | <view class="user-name flex-vertical" data-type="nickname" wx:if="{{reg_info.idcard_state}}"> |
89 | - <view class="user-name-txt shrink0">身份证:</view> | |
90 | - <input bindinput="getId" bindblur="IdentityIDCard" class="user-txt-right pdl20 f1 t-r" placeholder="请输入身份证号码" value="{{id}}"></input> | |
103 | + <view class="user-name-txt shrink0">身份证:</view> | |
104 | + <input bindinput="getId" bindblur="IdentityIDCard" value="{{user.idcard?user.idcard:''}}" class="user-txt-right pdl20 f1 t-r" placeholder="请输入身份证号码" value="{{id}}"></input> | |
105 | + <block wx:if="{{!user.idcard}}"> | |
91 | 106 | <view class="c-red pdl20 fs24" wx:if="{{reg_info.idcard && (reg_info.idcard_type == 0)}}">+{{reg_info.idcard}}积分</view> |
92 | 107 | <view class="c-red pdl20 fs24" wx:elif="{{reg_info.idcard && (reg_info.idcard_type == 1)}}">+{{reg_info.idcard}}成长值</view> |
108 | + </block> | |
93 | 109 | </view> |
94 | 110 | |
95 | 111 | |
96 | 112 | <view class="user-name flex-vertical" data-type="mobile" wx:if="{{reg_info.address_state}}"> |
97 | 113 | <view class="user-name-txt">地址:</view> |
98 | - <input bindinput="getAddress" bindblur="" data-name="姓名" class="user-txt-right f1" placeholder="请输入详细地址" style="text-align:right" /> | |
99 | - <view class="c-red pdl20 fs24" wx:if="{{reg_info.address && (reg_info.address_type == 0)}}">+{{reg_info.address}}积分</view> | |
100 | - <view class="c-red pdl20 fs24" wx:elif="{{reg_info.address && (reg_info.address_type == 1)}}">+{{reg_info.address}}成长值</view> | |
114 | + <input bindinput="getAddress" bindblur="" value="{{user.address?user.address:''}}" data-name="姓名" class="user-txt-right f1" placeholder="请输入详细地址" style="text-align:right" /> | |
115 | + <block wx:if="{{!user.address}}"> | |
116 | + <view class="c-red pdl20 fs24" wx:if="{{reg_info.address && (reg_info.address_type == 0)}}">+{{reg_info.address}}积分</view> | |
117 | + <view class="c-red pdl20 fs24" wx:elif="{{reg_info.address && (reg_info.address_type == 1)}}">+{{reg_info.address}}成长值</view> | |
118 | + </block> | |
101 | 119 | </view> |
102 | 120 | |
103 | - | |
104 | - | |
105 | - | |
106 | - | |
121 | + | |
107 | 122 | <!-- 选择门店 --> |
108 | 123 | <view bindtap="onclickstore" class="user-name flex-vertical" data-type="email" wx:if="{{reg_info.pick_state}}"> |
109 | 124 | <view class="user-name-txt">所属门店:</view> |
110 | 125 | <view class="user-txt-right f1 flex ai_c jc_fe"> |
111 | - <view class="one-line">{{stoname}}</view> | |
126 | + <view class="one-line">{{stoname?stoname:'请选择门店'}}</view> | |
112 | 127 | <view class="angle">∟</view> |
113 | 128 | </view> |
129 | + | |
130 | + <block wx:if="{{!user.pickup_id}}"> | |
114 | 131 | <view class="c-red pdl20 fs24" wx:if="{{reg_info.pick && (reg_info.pick_type == 0)}}">+{{reg_info.pick}}积分</view> |
115 | 132 | <view class="c-red pdl20 fs24" wx:elif="{{reg_info.pick && (reg_info.pick_type == 1)}}">+{{reg_info.pick}}成长值</view> |
133 | + </block> | |
116 | 134 | </view> |
117 | 135 | |
118 | 136 | <!-- 我的兴趣 --> | ... | ... |
pages/cart/cart/cart.js
... | ... | @@ -783,7 +783,7 @@ Page({ |
783 | 783 | isShowLoading: 0, |
784 | 784 | success: function(res_d) { |
785 | 785 | |
786 | - if(res_d.data.code==0){ | |
786 | + if(res_d.data.code==0 && res_d.data.data){ | |
787 | 787 | if (t.goods_num > store_count) { |
788 | 788 | wx.showModal({ |
789 | 789 | title: '提示', |
... | ... | @@ -1331,10 +1331,9 @@ Page({ |
1331 | 1331 | }); |
1332 | 1332 | }, |
1333 | 1333 | //跳到首页 |
1334 | - goto: function(e) { | |
1335 | - navigateTo({ | |
1336 | - url: '/pages/index/index/index', | |
1337 | - }) | |
1334 | + goto: function(e) { | |
1335 | + var url='/pages/index/index/index'; | |
1336 | + getApp().goto(url); | |
1338 | 1337 | }, |
1339 | 1338 | |
1340 | 1339 | //---加载更多是靠这个函数---- | ... | ... |
pages/cart/cart2/cart2.js
... | ... | @@ -671,7 +671,7 @@ Page({ |
671 | 671 | ob.buynum=num; |
672 | 672 | ob.weight=data.gift_weight; //商品的重量 |
673 | 673 | ob.exp_sum_type=data.gift_exp_sum_type; //商品的物流计算方式 |
674 | - ob.uniform_exp_sum=data.uniform_exp_sum //统一运费的金额 | |
674 | + ob.uniform_exp_sum=data.gift_uniform_exp_sum //统一运费的金额 | |
675 | 675 | |
676 | 676 | th.setData({buy_now_gift_goods:ob}); |
677 | 677 | } |
... | ... | @@ -1541,7 +1541,8 @@ Page({ |
1541 | 1541 | |
1542 | 1542 | //如果有赠品的时候,也要计算赠品的物流费用 |
1543 | 1543 | if(th.data.buy_now_gift_goods){ |
1544 | - shipping_price=th.get_now_gift_goods_wuliu(code, o_shipping_price, th.data.user_addr, gift_freight_free, parseFloat(allpice)-cut_price-quan_price, rs,shipping_price,no_by_data); | |
1544 | + shipping_price=th.get_now_gift_goods_wuliu(code, o_shipping_price, th.data.user_addr, gift_freight_free, | |
1545 | + parseFloat(allpice)-cut_price-quan_price, rs,shipping_price,no_by_data,goods_weight,goods_piece); | |
1545 | 1546 | } |
1546 | 1547 | |
1547 | 1548 | if(shipping_price<=0){ |
... | ... | @@ -3161,7 +3162,7 @@ Page({ |
3161 | 3162 | arr.gift_original_img = get_data.goodsinfo.original_img; |
3162 | 3163 | arr.gift_weight = get_data.goodsinfo.weight; |
3163 | 3164 | arr.gift_exp_sum_type = get_data.goodsinfo.exp_sum_type; |
3164 | - arr.uniform_exp_sum = get_data.goodsinfo.uniform_exp_sum; | |
3165 | + arr.gift_uniform_exp_sum = get_data.goodsinfo.uniform_exp_sum; | |
3165 | 3166 | arr.gift_limit_num = get_data.limit_num; |
3166 | 3167 | arr.gift_storecount = get_data.gift_storecount; |
3167 | 3168 | } |
... | ... | @@ -3239,7 +3240,7 @@ Page({ |
3239 | 3240 | }, |
3240 | 3241 | |
3241 | 3242 | //计算立即购买赠品的物流费用 |
3242 | - get_now_gift_goods_wuliu:function (code, o_shipping_price, user_addr, gift_freight_free,allpice, rs,shipping_price,no_by_data) { | |
3243 | + get_now_gift_goods_wuliu:function (code, o_shipping_price, user_addr, gift_freight_free,allpice, rs,shipping_price,no_by_data,goods_weight1,goods_piece1) { | |
3243 | 3244 | var good=this.data.buy_now_gift_goods; |
3244 | 3245 | var goods_weight=-1, goods_piece=-1; |
3245 | 3246 | var gift_shipping_price=0; |
... | ... | @@ -3247,17 +3248,28 @@ Page({ |
3247 | 3248 | switch (good['exp_sum_type']) { |
3248 | 3249 | case 1: |
3249 | 3250 | //统一运费 |
3250 | - gift_shipping_price += good['uniform_exp_sum']; break; | |
3251 | + gift_shipping_price += good['uniform_exp_sum']; | |
3252 | + gift_shipping_price+=o_shipping_price; | |
3253 | + break; | |
3251 | 3254 | case 2: |
3252 | 3255 | if (goods_weight < 0) goods_weight = 0; |
3253 | 3256 | //累积商品重量 每种商品的重量 * 数量 |
3254 | - goods_weight += good['weight'] * good['buynum'];break; | |
3257 | + goods_weight += good['weight'] * good['buynum']; | |
3258 | + if(goods_weight1>0){ | |
3259 | + goods_weight+=goods_weight1; | |
3260 | + } | |
3261 | + break; | |
3255 | 3262 | case 3: |
3256 | 3263 | if (goods_piece < 0) goods_piece = 0; |
3257 | 3264 | //累积商品数量 |
3258 | - goods_piece += good['buynum']; break; | |
3265 | + goods_piece += good['buynum']; | |
3266 | + if(goods_piece1){ | |
3267 | + goods_piece+=goods_piece1; | |
3268 | + } | |
3269 | + break; | |
3259 | 3270 | } |
3260 | - | |
3271 | + | |
3272 | + | |
3261 | 3273 | //如果有设置不包邮区域的时候 |
3262 | 3274 | if(no_by_data && no_by_data.region_list){ |
3263 | 3275 | if(th.check_by_area(no_by_data.region_list)){ |
... | ... | @@ -3272,10 +3284,11 @@ Page({ |
3272 | 3284 | //th.data.is_no_by[th.data.bn_pick]=1; |
3273 | 3285 | } |
3274 | 3286 | } |
3287 | + | |
3275 | 3288 | var t_shipping_price= |
3276 | 3289 | this.calculatewuliu(code, gift_shipping_price, goods_weight, |
3277 | 3290 | goods_piece, user_addr, gift_freight_free, allpice, rs); |
3278 | - return t_shipping_price+shipping_price; | |
3291 | + return t_shipping_price; | |
3279 | 3292 | |
3280 | 3293 | }, |
3281 | 3294 | ... | ... |
pages/error/error.js
pages/goods/goodsInfo/goodsInfo.js
... | ... | @@ -1587,11 +1587,10 @@ Page({ |
1587 | 1587 | th.setData({goodsInputNum:redis_num}) |
1588 | 1588 | return false; |
1589 | 1589 | } |
1590 | - | |
1591 | 1590 | } |
1592 | - | |
1593 | 1591 | var e = th.data.sele_g.store_count; |
1594 | - if(th.data.sales_rules==2){ | |
1592 | + var p_type=th.data.prom_type; //&& p_type!=1 && p_type!=4 | |
1593 | + if(th.data.sales_rules==2 && (p_type!=1 && p_type!=4 && p_type!=6 || th.data.openSpecModal_inte_normal==1 || th.data.is_normal== 1) ){ | |
1595 | 1594 | if(!th.data.def_pick_store){ |
1596 | 1595 | wx.showModal({ title: '请选择门店', }); |
1597 | 1596 | return false; |
... | ... | @@ -1599,7 +1598,7 @@ Page({ |
1599 | 1598 | e=th.data.def_pick_store.CanOutQty; |
1600 | 1599 | } |
1601 | 1600 | } |
1602 | - | |
1601 | + if(!e) e=0; | |
1603 | 1602 | //库存不足,不增加 |
1604 | 1603 | if(e<t){ wx.showModal({ title: '库存不足', }); |
1605 | 1604 | if(e<0) e=0; |
... | ... | @@ -1669,7 +1668,8 @@ Page({ |
1669 | 1668 | } |
1670 | 1669 | |
1671 | 1670 | var e = th.data.sele_g.store_count; |
1672 | - if(th.data.sales_rules==2){ | |
1671 | + var p_type=th.data.prom_type; //&& p_type!=1 && p_type!=4 | |
1672 | + if(th.data.sales_rules==2 && (p_type!=1 && p_type!=4 && p_type!=6 || th.data.openSpecModal_inte_normal==1 || th.data.is_normal== 1) ){ | |
1673 | 1673 | if(!th.data.def_pick_store){ |
1674 | 1674 | wx.showModal({ title: '请选择门店', }); |
1675 | 1675 | return false; |
... | ... | @@ -1677,7 +1677,7 @@ Page({ |
1677 | 1677 | e=th.data.def_pick_store.CanOutQty; |
1678 | 1678 | } |
1679 | 1679 | } |
1680 | - | |
1680 | + if(!e) e=0; | |
1681 | 1681 | //库存不足,不增加 |
1682 | 1682 | if(e<t){ wx.showModal({ title: '库存不足', }); |
1683 | 1683 | if(e<0) e=0; |
... | ... | @@ -3228,7 +3228,7 @@ Page({ |
3228 | 3228 | openSpecModel_pt: function(e) { |
3229 | 3229 | |
3230 | 3230 | |
3231 | - this.setData({ open_ind_store: 4});//拼团直接给4 | |
3231 | + this.setData({ open_ind_store: 4,goodsInputNum:1});//拼团直接给4 | |
3232 | 3232 | |
3233 | 3233 | |
3234 | 3234 | //--先判断会员状态-- |
... | ... | @@ -5137,7 +5137,7 @@ Page({ |
5137 | 5137 | //-- 积分购 -- |
5138 | 5138 | go_pay_integral:function(){ |
5139 | 5139 | this.get_sto(0) |
5140 | - this.setData({openSpecModal_inte:1}); | |
5140 | + this.setData({openSpecModal_inte:1,goodsInputNum:1}); | |
5141 | 5141 | }, |
5142 | 5142 | //-- 积分购普通购买 -- |
5143 | 5143 | go_pay_integral_normal:function(){ | ... | ... |
pages/index/index/full_screen.js
0 → 100644
1 | + module.exports = { | |
2 | + //判断要不要显示全屏广告 | |
3 | + get_the_full_screen(th){ | |
4 | + var stoid=getApp().globalData.setting.stoid; | |
5 | + if(th.data.full_ad) { | |
6 | + return false; | |
7 | + } | |
8 | + //获取全屏的广告 | |
9 | + getApp().promiseGet("/api/weshop/ad/page?pid=1001&store_id=" + stoid,{ | |
10 | + data: { enabled: 1 } | |
11 | + }).then(res=>{ | |
12 | + //判断是不是有全屏广告 | |
13 | + if(res.data.code==0 && res.data.data.pageData && res.data.data.pageData.length>0){ | |
14 | + th.setData({ | |
15 | + is_full_screen_show:1, | |
16 | + full_ad:res.data.data.pageData[0], | |
17 | + }) | |
18 | + //--定时关闭-- | |
19 | + th.data.full_screen=setInterval(function(){ | |
20 | + if(!th.data.sec_show) { | |
21 | + clearInterval(th.data.full_screen); | |
22 | + th.close_full_screen(); | |
23 | + return false; | |
24 | + } | |
25 | + th.data.sec_show--; | |
26 | + th.setData({sec_show:th.data.sec_show}); | |
27 | + },1000) | |
28 | + } | |
29 | + }) | |
30 | + } | |
31 | +} | |
0 | 32 | \ No newline at end of file | ... | ... |
pages/index/index/index.js
... | ... | @@ -15,6 +15,7 @@ var regeneratorRuntime = require('../../../utils/runtime.js'); |
15 | 15 | var api = require('../../../api/api.js'); |
16 | 16 | var d = getApp().globalData; |
17 | 17 | |
18 | +var full_screen = require('full_screen.js'); | |
18 | 19 | |
19 | 20 | Page({ |
20 | 21 | data: { |
... | ... | @@ -75,18 +76,82 @@ Page({ |
75 | 76 | |
76 | 77 | showHongbao: false, |
77 | 78 | showHongbaoSmall: false, |
78 | - | |
79 | + | |
80 | + is_full_screen_show:0, //全屏显示 | |
81 | + sec_show:3, //倒计时的秒数 | |
82 | + full_ad:null, //全屏广告 | |
83 | + full_screen:0, //全屏广告 | |
84 | + | |
79 | 85 | }, |
80 | 86 | |
81 | 87 | onLoad: async function(tt) { |
82 | 88 | console.log("进入首页-------------"); |
83 | - console.log(tt); | |
84 | - | |
89 | + console.log(tt); | |
85 | 90 | var th = this; |
86 | 91 | var first_leader=tt.first_leader; |
87 | 92 | if(!first_leader && tt.scene){ |
88 | 93 | first_leader= decodeURIComponent(tt.scene); |
89 | 94 | } |
95 | + | |
96 | + getApp().getConfig(function(e){ | |
97 | + //--首页的问题-- | |
98 | + if (getApp().globalData.config && getApp().globalData.config.store_name != undefined && getApp().globalData.config.store_name != null) { | |
99 | + wx.setNavigationBarTitle({ | |
100 | + title: getApp().globalData.config.store_name, | |
101 | + }); | |
102 | + } else { | |
103 | + wx.setNavigationBarTitle({ | |
104 | + title: getApp().globalData.setting.appName, | |
105 | + }); | |
106 | + }; | |
107 | + }); | |
108 | + | |
109 | + | |
110 | + var th = this; | |
111 | + | |
112 | + getApp().getConfig2(function(config2){ | |
113 | + if(config2 && config2.is_overdue==1){ | |
114 | + getApp().promiseGet("/store/storemoduleendtime/page?store_id=" +os.stoid + "&type=5",{}).then(res=>{ | |
115 | + var o=res; | |
116 | + if (o.data.code == 0) { | |
117 | + var ob = { isout: 0, isbuy: 1 }; | |
118 | + var arr = o.data.data.pageData; | |
119 | + var isbuy = 0; | |
120 | + //----如果数组不为空---- | |
121 | + if (arr.length > 0) { | |
122 | + arr.forEach(function (val, ind) { | |
123 | + if (val.is_sy == 0 && val.type == 5) { | |
124 | + isbuy = 1; | |
125 | + var now = ut.gettimestamp(); | |
126 | + if (now > val.end_time) ob.isout = 1; | |
127 | + return false; | |
128 | + } | |
129 | + }) | |
130 | + } | |
131 | + ob.isbuy = isbuy; | |
132 | + | |
133 | + var pages = getCurrentPages(); //获取加载的页面 | |
134 | + var currentPage = pages[pages.length - 1]; //获取当前页面的对象 | |
135 | + | |
136 | + console.log("当前路由"); | |
137 | + console.log(currentPage.route); | |
138 | + | |
139 | + | |
140 | + th.setappdata(ob); | |
141 | + | |
142 | + if(ob.isbuy && !ob.isout){ | |
143 | + th.onload_init(); | |
144 | + } | |
145 | + }else{ | |
146 | + th.onload_init(); | |
147 | + } | |
148 | + }) | |
149 | + } | |
150 | + | |
151 | + else{ | |
152 | + th.onload_init(); | |
153 | + } | |
154 | + }) | |
90 | 155 | |
91 | 156 | if(first_leader){ |
92 | 157 | //-- user_id代过来免登录 -- |
... | ... | @@ -97,7 +162,7 @@ Page({ |
97 | 162 | getApp().globalData.guide_id=res.data.data.id; |
98 | 163 | } |
99 | 164 | }) |
100 | - } | |
165 | + } | |
101 | 166 | |
102 | 167 | // 判断是否有红包活动 |
103 | 168 | getApp().request.promiseGet('/api/weshop/redmoney/redConfig/get/'+getApp().globalData.setting.stoid, { |
... | ... | @@ -144,72 +209,74 @@ Page({ |
144 | 209 | //getApp().globalData.url=th.data.url |
145 | 210 | //t.editTabBar(th,o.stoid,th.data.url); |
146 | 211 | |
147 | - await this.init_load(); | |
148 | - | |
149 | - | |
150 | - //显示的时候要开启计时器 | |
151 | - this.data.is_timer = 1; | |
152 | - //如果是自定义模板 | |
153 | - if (this.data.isTemplate) { | |
154 | - //---先获取会员--- | |
155 | - t.getUserFir(function() { | |
156 | - th.is_festival(); | |
157 | - var new_nav = th.data.new_nav; | |
158 | - if (new_nav == "") { | |
159 | - th.is_new(); | |
160 | - } | |
161 | - setTimeout(function () { | |
162 | - if (getApp().globalData.user_id) getApp().requestCardNum(th); | |
163 | - },500) | |
164 | - | |
165 | - }); | |
166 | - } else { | |
167 | - await this.init_fir(); | |
168 | - wx.setNavigationBarColor({ | |
169 | - frontColor: '#ffffff', // 必写项 | |
170 | - backgroundColor: '#ff7295', // 必写项 | |
171 | - }) | |
172 | - } | |
173 | - | |
174 | - //--正再拼团中的处理-- | |
175 | - var url = "/api/weshop/order/pageTuan?pt_status=2&is_pt=1&store_id=" + os.stoid + "&pageSize=6&page=1" | |
176 | - await getApp().request.promiseGet(url, {}).then(res => { | |
177 | - if (res.data.code == 0 && res.data.data && res.data.data.pageData) { | |
178 | - th.data.pt_timer_arr = res.data.data.pageData; | |
179 | - } | |
180 | - }) | |
181 | - if (th.data.pt_timer_arr && th.data.pt_timer_arr.length > 0) { | |
182 | - for (var i in th.data.pt_timer_arr) { | |
183 | - var p_item = th.data.pt_timer_arr[i]; | |
184 | - await getApp().request.promiseGet("/api/weshop/users/get/" + os.stoid + "/" + p_item.user_id, { | |
185 | - 1: 1 | |
186 | - }).then(res => { | |
187 | - th.data.pt_timer_arr[i].head_pic = res.data.data.head_pic; | |
188 | - th.data.pt_timer_arr[i].nickname = res.data.data.nickname; | |
189 | - }) | |
190 | - } | |
191 | - th.Interval_pt(); | |
192 | - } | |
193 | - | |
194 | - //---处理正在6个分类---- | |
195 | - await getApp().request.promiseGet("/api/weshop/goodscategory/page", { | |
196 | - data: { | |
197 | - store_id: os.stoid, | |
198 | - pageSize: 5, | |
199 | - is_show: 1, | |
200 | - level:1 | |
201 | - } | |
202 | - }).then(res => { | |
203 | - if (res.data.data) { | |
204 | - var gd_category = res.data.data.pageData; | |
205 | - th.setData({ | |
206 | - gd_category: gd_category | |
207 | - }); | |
208 | - } | |
209 | - }) | |
210 | - | |
211 | - | |
212 | 212 | }, |
213 | + | |
214 | + async onload_init(){ | |
215 | + var th=this; | |
216 | + await this.init_load(); | |
217 | + //显示的时候要开启计时器 | |
218 | + this.data.is_timer = 1; | |
219 | + //如果是自定义模板 | |
220 | + if (this.data.isTemplate) { | |
221 | + //---先获取会员--- | |
222 | + t.getUserFir(function() { | |
223 | + th.is_festival(); | |
224 | + var new_nav = th.data.new_nav; | |
225 | + if (new_nav == "") { | |
226 | + th.is_new(); | |
227 | + } | |
228 | + setTimeout(function () { | |
229 | + if (getApp().globalData.user_id) getApp().requestCardNum(th); | |
230 | + },500) | |
231 | + | |
232 | + }); | |
233 | + } else { | |
234 | + await this.init_fir(); | |
235 | + wx.setNavigationBarColor({ | |
236 | + frontColor: '#ffffff', // 必写项 | |
237 | + backgroundColor: '#ff7295', // 必写项 | |
238 | + }) | |
239 | + } | |
240 | + | |
241 | + //--正再拼团中的处理-- | |
242 | + var url = "/api/weshop/order/pageTuan?pt_status=2&is_pt=1&store_id=" + os.stoid + "&pageSize=6&page=1" | |
243 | + await getApp().request.promiseGet(url, {}).then(res => { | |
244 | + if (res.data.code == 0 && res.data.data && res.data.data.pageData) { | |
245 | + th.data.pt_timer_arr = res.data.data.pageData; | |
246 | + } | |
247 | + }) | |
248 | + if (th.data.pt_timer_arr && th.data.pt_timer_arr.length > 0) { | |
249 | + for (var i in th.data.pt_timer_arr) { | |
250 | + var p_item = th.data.pt_timer_arr[i]; | |
251 | + await getApp().request.promiseGet("/api/weshop/users/get/" + os.stoid + "/" + p_item.user_id, { | |
252 | + 1: 1 | |
253 | + }).then(res => { | |
254 | + th.data.pt_timer_arr[i].head_pic = res.data.data.head_pic; | |
255 | + th.data.pt_timer_arr[i].nickname = res.data.data.nickname; | |
256 | + }) | |
257 | + } | |
258 | + th.Interval_pt(); | |
259 | + } | |
260 | + | |
261 | + //---处理正在6个分类---- | |
262 | + await getApp().request.promiseGet("/api/weshop/goodscategory/page", { | |
263 | + data: { | |
264 | + store_id: os.stoid, | |
265 | + pageSize: 5, | |
266 | + is_show: 1, | |
267 | + level:1 | |
268 | + } | |
269 | + }).then(res => { | |
270 | + if (res.data.data) { | |
271 | + var gd_category = res.data.data.pageData; | |
272 | + th.setData({ | |
273 | + gd_category: gd_category | |
274 | + }); | |
275 | + } | |
276 | + }) | |
277 | + }, | |
278 | + | |
279 | + | |
213 | 280 | //关闭新用户领取广告 |
214 | 281 | close_disgraceful: function() { |
215 | 282 | var th = this; |
... | ... | @@ -255,9 +322,8 @@ Page({ |
255 | 322 | if(!userInfo || !userInfo.user_id) userInfo=null; |
256 | 323 | //有加载过一次首页,就显示 |
257 | 324 | if(show || userInfo || getApp().globalData.user_id){ |
258 | - setTimeout(function(){ | |
259 | - var full_screen = th.selectComponent("#full_screen"); //组件的id | |
260 | - full_screen.get_the_full_screen(); | |
325 | + setTimeout(function(){ | |
326 | + full_screen.get_the_full_screen(th); | |
261 | 327 | },800) |
262 | 328 | //动画效果 |
263 | 329 | if(!th.data.f_hidden){ |
... | ... | @@ -282,25 +348,18 @@ Page({ |
282 | 348 | this.data.is_timer = 0; |
283 | 349 | clearInterval(this.data.pt_timer); |
284 | 350 | clearInterval(this.data.w_holiday_pop); |
351 | + clearInterval(this.data.full_screen); | |
352 | + | |
285 | 353 | this.data.w_holiday_pop=0; |
286 | 354 | for(var i = 1; i < 100; i++) { |
287 | 355 | clearInterval(i); |
288 | 356 | } |
289 | 357 | |
290 | - | |
291 | 358 | }, |
292 | 359 | |
293 | 360 | //同步初始加载 |
294 | 361 | async init_load() { |
295 | - await getApp().getConfig_ays(); | |
296 | - var th = this; | |
297 | - if(getApp().globalData.config2.is_overdue==1){ | |
298 | - await getApp().get_isbuy(); | |
299 | - this.setappdata(getApp().globalData.wxapp_buy_obj); | |
300 | - } | |
301 | - | |
302 | - | |
303 | - | |
362 | + var th=this; | |
304 | 363 | //因为营销版本的功能包含了自定义模板的功能,是同时的 |
305 | 364 | //读取全局是否有弄自定义模板 |
306 | 365 | await api.get_template_fir(o.stoid).then(res => { |
... | ... | @@ -327,16 +386,7 @@ Page({ |
327 | 386 | |
328 | 387 | |
329 | 388 | |
330 | - //--首页的问题-- | |
331 | - if (getApp().globalData.config && getApp().globalData.config.store_name != undefined && getApp().globalData.config.store_name != null) { | |
332 | - wx.setNavigationBarTitle({ | |
333 | - title: getApp().globalData.config.store_name, | |
334 | - }); | |
335 | - } else { | |
336 | - wx.setNavigationBarTitle({ | |
337 | - title: getApp().globalData.setting.appName, | |
338 | - }); | |
339 | - }; | |
389 | + | |
340 | 390 | |
341 | 391 | |
342 | 392 | |
... | ... | @@ -1005,5 +1055,17 @@ Page({ |
1005 | 1055 | showHongbaoSmall: true, //显示抢红包小图标 |
1006 | 1056 | }); |
1007 | 1057 | }, |
1058 | + | |
1059 | + /*-- 全屏广告 --*/ | |
1060 | + close_full_screen(){ | |
1061 | + this.setData({is_full_screen_show:0,sec_show:0}); | |
1062 | + }, | |
1063 | + //-- 跳转到满屏广告的链接 -- | |
1064 | + go_full_ad(){ | |
1065 | + if(!this.data.full_ad) return false; | |
1066 | + if(!this.data.full_ad.ad_weapplink) return false; | |
1067 | + getApp().goto(this.data.full_ad.ad_weapplink); | |
1068 | + this.close_full_screen(); | |
1069 | + }, | |
1008 | 1070 | |
1009 | 1071 | }); |
1010 | 1072 | \ No newline at end of file | ... | ... |
pages/index/index/index.wxml
1 | 1 | <!-- <view hidden="{{f_hidden}}" class="full_screen" style="background-color: #fff;"></view> --> |
2 | -<full_screen id="full_screen"></full_screen> | |
2 | +<!-- <full_screen id="full_screen"></full_screen> --> | |
3 | + | |
4 | +<!-- 全屏控制 --> | |
5 | +<view wx:if="{{is_full_screen_show}}" class="full_screen" bindtap="go_full_ad" style="background-image: url('{{url+full_ad.ad_code}}');"> | |
6 | + <view catchtap="close_full_screen" class="skip_box">跳过 <text>{{sec_show}}</text></view> | |
7 | +</view> | |
8 | + | |
3 | 9 | <!--普通界面--> |
4 | 10 | <wxs module="filter" src="../../../utils/filter.wxs"></wxs> |
5 | 11 | |
... | ... | @@ -106,14 +112,12 @@ |
106 | 112 | </view> |
107 | 113 | </view> |
108 | 114 | |
109 | - | |
110 | - | |
111 | - | |
112 | - <!---大分类---> | |
115 | + <!-- 大分类 --> | |
113 | 116 | <view class="flex-center-around"> |
114 | 117 | <view wx:for="{{gd_category}}" bindtap="go_cate2" data-cid="{{item.id}}" data-pid="0"> |
115 | 118 | <view class="circle xc-class-frame t-c"> |
116 | - <image class="xc-class-img" src="{{item.icoimg==null||item.icoimg==''?url+item.icon:item.icoimg}}" binderror="bind_bnerr_icon" data-err="gd_category[{{index}}].icon"></image> | |
119 | + <image class="xc-class-img" src="{{item.icoimg==null||item.icoimg==''?(item.image?url+item.image:url+'/miniapp/images/no_cate_def.png'):item.icoimg}}" | |
120 | + binderror="bind_bnerr_icon" data-err="gd_category[{{index}}].icon"></image> | |
117 | 121 | <view class="fs24 gonju ellipsis-1">{{item.name}}</view> |
118 | 122 | </view> |
119 | 123 | </view> | ... | ... |
pages/index/index/index.wxss
... | ... | @@ -977,3 +977,9 @@ page { |
977 | 977 | background-size: 100% 100%; |
978 | 978 | background-repeat: no-repeat; |
979 | 979 | } |
980 | +.skip_box{ | |
981 | + float: right; margin-top: 10rpx; margin-right: 10rpx; | |
982 | + background-color: gainsboro; width: 120rpx; | |
983 | + height: 48rpx; font-size: 28rpx; line-height: 48rpx; | |
984 | + text-align: center; border-radius: 20rpx; | |
985 | + } | ... | ... |
pages/team/team_show/team_show.js
... | ... | @@ -721,11 +721,12 @@ Page({ |
721 | 721 | go_pay:function () { |
722 | 722 | var th=this; |
723 | 723 | var def_pick_store=this.data.def_pick_store; |
724 | - if(def_pick_store) { | |
724 | + if(def_pick_store && def_pick_store.pickup_id) { | |
725 | 725 | th.data.pick_id=def_pick_store.pickup_id; //选择门店 |
726 | 726 | th.data.end_name=def_pick_store.pickup_name; |
727 | 727 | } |
728 | - if (th.data.pick_id == 0) return s.my_warnning("请选择门店", 0, th); | |
728 | + if (!th.data.pick_id) return s.my_warnning("请选择门店", 0, th); | |
729 | + if (th.data.pick_id==0) return s.my_warnning("请选择门店", 0, th); | |
729 | 730 | |
730 | 731 | //----判断起购数---- |
731 | 732 | var qnum=parseFloat(th.data.teamlist.minbuynum); | ... | ... |
pages/team/team_show/team_show.wxml
... | ... | @@ -215,26 +215,29 @@ |
215 | 215 | <view style="margin-top: 20rpx"> |
216 | 216 | <view class="flex-space-between address ai_end xc-width "> |
217 | 217 | |
218 | - <view class="flex ai_end" wx:if="{{def_pick_store}}"> | |
218 | + <view class="flex ai_end" wx:if="{{def_pick_store && def_pick_store.pickup_name}}"> | |
219 | 219 | <text class="fs30 xc-black3 shop_name">{{def_pick_store.pickup_name}}</text> |
220 | 220 | |
221 | 221 | <view class="distance fs24 xc-ash" wx:if="{{def_pick_store.distance!=null}}"> |
222 | 222 | 距离:{{def_pick_store.distance>1000?filters.toFix(def_pick_store.distance/1000,2)+"km":filters.toFix(def_pick_store.distance,0)+"m"}} |
223 | 223 | </view> |
224 | 224 | </view> |
225 | - <view class="red-co fs28" bindtap="choice_store" wx:if="{{def_pick_store}}"> | |
226 | - 更多门店 | |
227 | - <text class="right-arrow"></text> | |
228 | - </view> | |
225 | + | |
226 | + | |
229 | 227 | <view class="flex" bindtap="choice_store" wx:else> |
230 | 228 | <image class="stores-img" src="{{iurl}}/miniapp/images/stores.png"></image> |
231 | 229 | <view class="fs28 xc-ash-9f">选择门店</view> |
232 | 230 | </view> |
231 | + | |
232 | + <view class="red-co fs28" bindtap="choice_store"> | |
233 | + 更多门店 | |
234 | + <text class="right-arrow"></text> | |
235 | + </view> | |
233 | 236 | |
234 | 237 | |
235 | 238 | </view> |
236 | 239 | <view class="no_store" wx:if="{{def_pick_store && def_pick_store.is_no_dis}}">(配送不匹配)</view> |
237 | - <view class="fs24 xc-ash-9f xc-distance-top " wx:if="{{def_pick_store}}">地址:5{{def_pick_store.fulladdress}}</view> | |
240 | + <view class="fs24 xc-ash-9f xc-distance-top " wx:elif="{{def_pick_store && def_pick_store.fulladdress}}">地址:{{def_pick_store.fulladdress}}</view> | |
238 | 241 | |
239 | 242 | </view> |
240 | 243 | <!-- 商品的属性项目 --> | ... | ... |
pages/togoin/togoin.js
... | ... | @@ -13,6 +13,12 @@ Page({ |
13 | 13 | config2:null, |
14 | 14 | }, |
15 | 15 | onLoad: function (options) { |
16 | + if (wx.getUserProfile) { | |
17 | + this.setData({ | |
18 | + canIUseGetUserProfile: true | |
19 | + }) | |
20 | + } | |
21 | + | |
16 | 22 | getApp().globalData.isLoad_ad=1; |
17 | 23 | //--判断是否有接受到邀请人的ID-- |
18 | 24 | if(options.first_leader){ |
... | ... | @@ -25,22 +31,20 @@ Page({ |
25 | 31 | var logo=th.data.imghots+e.store_logo; |
26 | 32 | th.setData({ store: e,store_logo:logo}); |
27 | 33 | }) |
28 | - | |
34 | + | |
35 | + //判断注册的条件 | |
29 | 36 | app.getConfig2(function (e) { |
30 | - if(e.reg_type==1){ | |
31 | - var need_go=0; | |
37 | + if(e.reg_type==1){ | |
32 | 38 | var arr=JSON.parse(e.reg_info); |
33 | - if(arr['name_state']==1) need_go=1; | |
34 | - if(!need_go && arr['birthday_state']==1) need_go=1; | |
35 | - if(!need_go && arr['idcard_state']==1) need_go=1; | |
36 | - if(!need_go && arr['address_state']==1) need_go=1; | |
37 | - if(!need_go && arr['pick_state']==1) need_go=1; | |
38 | - if(!need_go && arr['sex_state']==1) need_go=1; | |
39 | - if(!need_go && arr['introducer_state']==1) need_go=1; | |
40 | - th.setData({need_go:1}); | |
41 | - } | |
42 | - | |
43 | - }) | |
39 | + if(arr['name_state']==1) th.data.name_need_go=1; | |
40 | + if(arr['birthday_state']==1) th.data.birth_need_go=1; | |
41 | + if(arr['idcard_state']==1) th.data.idcard_need_go=1; | |
42 | + if(arr['address_state']==1) th.data.address_need_go=1; | |
43 | + if(arr['pick_state']==1) th.data.pick_need_go=1; | |
44 | + if(arr['sex_state']==1) th.data.sex_need_go=1; | |
45 | + if(arr['introducer_state']==1) th.data.introducer_need_go=1; | |
46 | + } | |
47 | + },1) | |
44 | 48 | }, |
45 | 49 | //绑定手机号 |
46 | 50 | getphone:function (e) { |
... | ... | @@ -54,8 +58,7 @@ Page({ |
54 | 58 | var th=this; |
55 | 59 | var sessionKey = getApp().globalData.sessionKey; |
56 | 60 | var openid = getApp().globalData.openid; |
57 | - var r=getApp().globalData.getu; | |
58 | - | |
61 | + var r=getApp().globalData.getu; | |
59 | 62 | th.save_the_data(r,e,sessionKey,openid) |
60 | 63 | }, |
61 | 64 | |
... | ... | @@ -108,6 +111,7 @@ Page({ |
108 | 111 | }); |
109 | 112 | } |
110 | 113 | }) |
114 | + | |
111 | 115 | }) |
112 | 116 | }, |
113 | 117 | |
... | ... | @@ -179,14 +183,24 @@ Page({ |
179 | 183 | } else { |
180 | 184 | return app.showWarning("授权登入失败!"+e.data.msg); |
181 | 185 | } |
182 | - | |
183 | - wx.setStorageSync("userinfo",e.data.data); | |
186 | + | |
187 | + | |
188 | + var need_go=0; | |
189 | + var t_user=e.data.data; | |
190 | + | |
191 | + wx.setStorageSync("userinfo",e.data.data); | |
184 | 192 | wx.setStorageSync("isAuth", !0), app.globalData.userInfo = e.data.data, app.globalData.userInfo.head_pic = t.getFullUrl(a.globalData.userInfo.head_pic); |
185 | - //如果有需要跳转,就跳转到.如果微信端有注册,就不需要跳转 | |
186 | - if(app.globalData.userInfo['openid']){ | |
187 | - th.data.need_go=0; | |
188 | - } | |
189 | - if(th.data.need_go){ | |
193 | + | |
194 | + //如果有需要完善的信息没有完善,就需要跳转 | |
195 | + if(!t_user['vipname'] && th.data.name_need_go){ need_go=1;} | |
196 | + if(!t_user['birthday'] && th.data.birth_need_go){ need_go=1;} | |
197 | + if(!t_user['idcard'] && th.data.idcard_need_go){ need_go=1;} | |
198 | + if(!t_user['address'] && th.data.address_need_go){ need_go=1;} | |
199 | + if(!t_user['pickup_id'] && th.data.pick_need_go){ need_go=1;} | |
200 | + if(!t_user['sex'] && th.data.sex_need_go){ need_go=1;} | |
201 | + if(!t_user['fromuser_id'] && th.data.introducer_need_go){ need_go=1;} | |
202 | + | |
203 | + if(need_go){ | |
190 | 204 | getApp().goto("/packageA/pages/profile/profile"); |
191 | 205 | }else{ |
192 | 206 | wx.navigateBack({ delta: 1}) |
... | ... | @@ -207,7 +221,63 @@ Page({ |
207 | 221 | var _errObj = {}; |
208 | 222 | _errObj[_errImg] = this.data.imghots+"/miniapp/images/logo.png"; |
209 | 223 | this.setData(_errObj) //注意这里的赋值方式,只是将数据列表中的此项图片路径值替换掉 ; |
224 | + }, | |
225 | + | |
226 | + //-- 会员授权 -- | |
227 | + bindUserInfo: function(ee) { | |
228 | + var that = this; | |
229 | + var user=ee.detail.userInfo; | |
230 | + //此处授权得到userInfo | |
231 | + getApp().globalData.getu = user; | |
232 | + | |
233 | + //--拿下code-- | |
234 | + wx.login({ | |
235 | + success: function (o) { | |
236 | + var dd = { | |
237 | + js_code:o.code, | |
238 | + store_id: os.stoid, | |
239 | + nickname: app.clear_word(app.globalData.getu.nickName), | |
240 | + head_pic: app.clear_word(app.globalData.getu.avatarUrl) | |
241 | + }; | |
242 | + //-- 导购会员ID -- | |
243 | + if(getApp().globalData.guide_id){ | |
244 | + dd.guide_id=getApp().globalData.guide_id; | |
245 | + } | |
246 | + | |
247 | + getApp().request.get("/api/weshop/users/openidandkey", { | |
248 | + data: dd, | |
249 | + success: function (e) { | |
250 | + if(e.data.code==0){ | |
251 | + that.setData({user:user}) | |
252 | + //如果有会员的话,没有sessionKey | |
253 | + if(!e.data.data.sessionKey){ | |
254 | + getApp().showWarning("登录成功"); | |
255 | + getApp().globalData.userInfo=e.data.data; | |
256 | + getApp().globalData.user_id=e.data.data.user_id; | |
257 | + getApp().globalData.openid = e.data.data.weapp_openid; | |
258 | + //把会员的信息存在内存 | |
259 | + wx.setStorageSync("userinfo",e.data.data); | |
260 | + | |
261 | + setTimeout(function () { | |
262 | + wx.navigateBack({ delta: 1}) //返回上一页 | |
263 | + },1000) | |
264 | + }else{ | |
265 | + getApp().globalData.sessionKey=e.data.data.sessionKey; | |
266 | + getApp().globalData.openid=e.data.data.openid; | |
267 | + that.setData({show_bind:1}); | |
268 | + } | |
269 | + }else{ | |
270 | + getApp().confirmBox(e.data.msg); | |
271 | + } | |
272 | + } | |
273 | + }); | |
274 | + } | |
275 | + }) | |
276 | + | |
277 | + | |
210 | 278 | } |
279 | + | |
280 | + | |
211 | 281 | |
212 | 282 | |
213 | 283 | }) | ... | ... |
pages/togoin/togoin.wxml
... | ... | @@ -14,13 +14,27 @@ |
14 | 14 | <!-- 登录按钮 --> |
15 | 15 | <view> |
16 | 16 | <view class="phones"> |
17 | - <!-- 授权获取基础信息 --> | |
18 | - <button hidden="{{user}}" class="getPhoneNumber" bindtap="bindGetUserInfo"> | |
19 | - <view class="flex flex-center2 ali-c"> | |
20 | - <image class="we_chat" src="{{imghots}}/miniapp/images/we_chat.png"></image> | |
21 | - <view>微信账号快捷登录</view> | |
22 | - </view> | |
23 | - </button> | |
17 | + | |
18 | + <!-- 授权获取基础信息 --> | |
19 | + <block wx:if="{{canIUseGetUserProfile}}"> | |
20 | + <button hidden="{{user}}" class="getPhoneNumber" bindtap="bindGetUserInfo"> | |
21 | + <view class="flex flex-center ali-c"> | |
22 | + <image class="we_chat" src="/images/we_chat.png"></image> | |
23 | + <view>微信账号快捷登录</view> | |
24 | + </view> | |
25 | + </button> | |
26 | + </block> | |
27 | + | |
28 | + <block wx:else> | |
29 | + <!-- 授权获取基础信息 --> | |
30 | + <button hidden="{{user}}" class="getPhoneNumber" open-type="getUserInfo" bindgetuserinfo="bindUserInfo"> | |
31 | + <view class="flex flex-center ali-c"> | |
32 | + <image class="we_chat" src="/images/we_chat.png"></image> | |
33 | + <view>微信账号快捷登录</view> | |
34 | + </view> | |
35 | + </button> | |
36 | + </block> | |
37 | + | |
24 | 38 | <!-- 点击显示绑定手机的对话框 --> |
25 | 39 | <button hidden="{{!user}}" class="getPhoneNumber" bindtap="show_bind_mobile"> |
26 | 40 | <view class="flex flex-center2 ali-c" > | ... | ... |
pages/user/index/index.js
... | ... | @@ -112,10 +112,33 @@ Page({ |
112 | 112 | need_money = 0, |
113 | 113 | cur_g_num = 0; |
114 | 114 | |
115 | - if(getApp().globalData.config2.is_overdue==1){ | |
116 | - //调用底部导航 | |
117 | - getApp().get_isbuy(th.setappdata); | |
118 | - } | |
115 | + getApp().getConfig2(function(config2){ | |
116 | + if(config2 && config2.is_overdue==1){ | |
117 | + getApp().promiseGet("/store/storemoduleendtime/page?store_id=" +os.stoid + "&type=5",{}).then(res=>{ | |
118 | + var o=res; | |
119 | + if (o.data.code == 0) { | |
120 | + var ob = { isout: 0, isbuy: 1 }; | |
121 | + var arr = o.data.data.pageData; | |
122 | + var isbuy = 0; | |
123 | + //----如果数组不为空---- | |
124 | + if (arr.length > 0) { | |
125 | + arr.forEach(function (val, ind) { | |
126 | + if (val.is_sy == 0 && val.type == 5) { | |
127 | + isbuy = 1; | |
128 | + var now = ut.gettimestamp(); | |
129 | + if (now > val.end_time) ob.isout = 1; | |
130 | + return false; | |
131 | + } | |
132 | + }) | |
133 | + } | |
134 | + ob.isbuy = isbuy; | |
135 | + th.setappdata(ob); | |
136 | + } | |
137 | + }) | |
138 | + } | |
139 | + }) | |
140 | + | |
141 | + | |
119 | 142 | setTimeout(function () { |
120 | 143 | if (getApp().globalData.user_id) getApp().requestCardNum(th); |
121 | 144 | },500) |
... | ... | @@ -317,6 +340,11 @@ Page({ |
317 | 340 | if (t_swi) t_swi = JSON.parse(t_swi) |
318 | 341 | if(t_swi){ |
319 | 342 | th.setData({sys_switch:t_swi}); |
343 | + | |
344 | + var user_tool=[]; | |
345 | + if(t_swi.usertool) user_tool=JSON.parse(t_swi.usertool); | |
346 | + th.setData({c_list:user_tool}) | |
347 | + | |
320 | 348 | } |
321 | 349 | |
322 | 350 | |
... | ... | @@ -345,15 +373,16 @@ Page({ |
345 | 373 | } |
346 | 374 | }) |
347 | 375 | //th.requestRecommend(); |
348 | - } | |
349 | - | |
376 | + } | |
377 | + | |
378 | + /*-- | |
350 | 379 | var t_swi= getApp().globalData.config2.switch_list |
351 | 380 | if (t_swi){ |
352 | 381 | t_swi = JSON.parse(t_swi); |
353 | 382 | var user_tool=[]; |
354 | 383 | if(t_swi.usertool) user_tool=JSON.parse(t_swi.usertool); |
355 | 384 | th.setData({c_list:user_tool}) |
356 | - } | |
385 | + } --*/ | |
357 | 386 | |
358 | 387 | |
359 | 388 | var goods_list = this.selectComponent("#goods_recommend"); //组件的id | ... | ... |