Commit 318d68234ad4d040a00489fbe3bd8e94e067af04
Merge branch 'dev' into 'test'
Dev See merge request !840
Showing
28 changed files
with
1050 additions
and
669 deletions
app.wxss
@@ -49,6 +49,9 @@ | @@ -49,6 +49,9 @@ | ||
49 | .pdl30 { | 49 | .pdl30 { |
50 | padding-left: 30rpx; | 50 | padding-left: 30rpx; |
51 | } | 51 | } |
52 | +.pdl60 { | ||
53 | + padding-left: 60rpx; | ||
54 | +} | ||
52 | .pdr10 { | 55 | .pdr10 { |
53 | padding-right: 10rpx; | 56 | padding-right: 10rpx; |
54 | } | 57 | } |
@@ -708,9 +711,9 @@ background: #ffe3e2; | @@ -708,9 +711,9 @@ background: #ffe3e2; | ||
708 | /* 图标字体(ty) */ | 711 | /* 图标字体(ty) */ |
709 | @font-face { | 712 | @font-face { |
710 | font-family: 'iconfont'; /* Project id 2054717 */ | 713 | font-family: 'iconfont'; /* Project id 2054717 */ |
711 | - src: url('//at.alicdn.com/t/font_2054717_hsngh9ootwv.woff2?t=1632559813006') format('woff2'), | ||
712 | - url('//at.alicdn.com/t/font_2054717_hsngh9ootwv.woff?t=1632559813006') format('woff'), | ||
713 | - url('//at.alicdn.com/t/font_2054717_hsngh9ootwv.ttf?t=1632559813006') format('truetype'); | 714 | + src: url('//at.alicdn.com/t/font_2054717_xyebdzzvo1i.woff2?t=1635153304877') format('woff2'), |
715 | + url('//at.alicdn.com/t/font_2054717_xyebdzzvo1i.woff?t=1635153304877') format('woff'), | ||
716 | + url('//at.alicdn.com/t/font_2054717_xyebdzzvo1i.ttf?t=1635153304877') format('truetype'); | ||
714 | } | 717 | } |
715 | 718 | ||
716 | .iconfont { | 719 | .iconfont { |
@@ -721,6 +724,11 @@ background: #ffe3e2; | @@ -721,6 +724,11 @@ background: #ffe3e2; | ||
721 | -moz-osx-font-smoothing: grayscale; | 724 | -moz-osx-font-smoothing: grayscale; |
722 | } | 725 | } |
723 | 726 | ||
727 | +.icon-dingwei:before { | ||
728 | + content: "\e6b4"; | ||
729 | +} | ||
730 | + | ||
731 | + | ||
724 | .icon-fenlei:before { | 732 | .icon-fenlei:before { |
725 | content: "\e628"; | 733 | content: "\e628"; |
726 | } | 734 | } |
components/diy_seckill/diy_seckill.js
@@ -40,21 +40,22 @@ Component({ | @@ -40,21 +40,22 @@ Component({ | ||
40 | pageLifetimes: { | 40 | pageLifetimes: { |
41 | //要处理一下,游客登录后的界面的变化,主要还该是改变会员 | 41 | //要处理一下,游客登录后的界面的变化,主要还该是改变会员 |
42 | show: function () { | 42 | show: function () { |
43 | - | ||
44 | - var th = this; | ||
45 | - if (this.data.goods_array.length > 0) { | ||
46 | - th.data.timer = setInterval(function () { | ||
47 | - th.countDown2(th); | ||
48 | - }, 1000); | ||
49 | - } | 43 | + //会员身份变化 |
44 | + var th = this; | ||
45 | + var g_id = this.data.object; | ||
46 | + this.init(g_id); | ||
47 | + setTimeout(function () { | ||
48 | + if (this.data.goods_array.length > 0) { | ||
49 | + th.data.timer = setInterval(function () { | ||
50 | + th.countDown2(th); | ||
51 | + }, 1000); | ||
52 | + } | ||
53 | + },500) | ||
50 | } | 54 | } |
51 | }, | 55 | }, |
52 | 56 | ||
53 | ready: function () { | 57 | ready: function () { |
54 | - console.log("ready"); | ||
55 | - // var g_id = this.data.object.data; | ||
56 | var g_id = this.data.object; | 58 | var g_id = this.data.object; |
57 | - // console.log(g_id); | ||
58 | this.init(g_id); | 59 | this.init(g_id); |
59 | }, | 60 | }, |
60 | detached() { | 61 | detached() { |
@@ -94,9 +95,11 @@ Component({ | @@ -94,9 +95,11 @@ Component({ | ||
94 | 95 | ||
95 | //当是默认的情况 | 96 | //当是默认的情况 |
96 | no_gid_set() { | 97 | no_gid_set() { |
97 | - console.log(5623); | 98 | + var user_id=getApp().globalData.user_id; |
99 | + if(!user_id){ user_id=0;} | ||
100 | + var req={ store_id: os.stoid, is_end: 0, is_show: 1, timetype: 2,user_id:user_id}; | ||
98 | getApp().request.promiseGet("/api/ms/flash_sale/spikepage?page=1&pageSize=9", | 101 | getApp().request.promiseGet("/api/ms/flash_sale/spikepage?page=1&pageSize=9", |
99 | - { isShowLoading: 1, data: { store_id: os.stoid, is_end: 0, is_show: 1, timetype: 2 } } | 102 | + { isShowLoading: 1, data:req } |
100 | ).then(res => { | 103 | ).then(res => { |
101 | if (res.data.code == 0 && res.data.data.pageData && res.data.data.pageData.length > 0) { | 104 | if (res.data.code == 0 && res.data.data.pageData && res.data.data.pageData.length > 0) { |
102 | var goodsidlist = res.data.data.pageData; | 105 | var goodsidlist = res.data.data.pageData; |
@@ -116,7 +119,6 @@ Component({ | @@ -116,7 +119,6 @@ Component({ | ||
116 | goodslist.forEach(function (vy, indy) { | 119 | goodslist.forEach(function (vy, indy) { |
117 | if (val.goodsid == vy.goods_id) { | 120 | if (val.goodsid == vy.goods_id) { |
118 | all_array.push(vy); | 121 | all_array.push(vy); |
119 | - //th.setData({goods_array:arr}); | ||
120 | } | 122 | } |
121 | }) | 123 | }) |
122 | }) | 124 | }) |
@@ -129,6 +131,11 @@ Component({ | @@ -129,6 +131,11 @@ Component({ | ||
129 | all_array = goodslist; | 131 | all_array = goodslist; |
130 | } | 132 | } |
131 | 133 | ||
134 | + for(let i in all_array){ | ||
135 | + let item=data[i]; | ||
136 | + if(item.user_price) item.price=item.user_price; | ||
137 | + } | ||
138 | + | ||
132 | var arr = new Array(); | 139 | var arr = new Array(); |
133 | //--三个三个一组--- | 140 | //--三个三个一组--- |
134 | for (var i = 0; i < all_array.length; i += 3) { | 141 | for (var i = 0; i < all_array.length; i += 3) { |
components/diy_seckill/diy_seckill.wxml
@@ -62,7 +62,7 @@ | @@ -62,7 +62,7 @@ | ||
62 | </view> | 62 | </view> |
63 | 63 | ||
64 | <view class='sp_wz'> | 64 | <view class='sp_wz'> |
65 | - <view class='sp_wzi'>{{aitem.title}}</view> | 65 | + <view class='sp_wzi'>{{aitem.goods_name}}</view> |
66 | <view class='sp_jg'>¥{{aitem.price}}</view> | 66 | <view class='sp_jg'>¥{{aitem.price}}</view> |
67 | <view class='sp_jgx'>¥{{aitem.market_price}}</view> | 67 | <view class='sp_jgx'>¥{{aitem.market_price}}</view> |
68 | </view> | 68 | </view> |
components/userqy_pop_up/userqy_pop_up.js
packageA/pages/activity_share/activity_share.js
@@ -362,6 +362,8 @@ Page({ | @@ -362,6 +362,8 @@ Page({ | ||
362 | page:this.data.currentPage, | 362 | page:this.data.currentPage, |
363 | store_id:oo.stoid, | 363 | store_id:oo.stoid, |
364 | } | 364 | } |
365 | + var user_id=getApp().globalData.user_id; | ||
366 | + if(!user_id) user_id=0; | ||
365 | 367 | ||
366 | switch(th.data.currentIndex){ | 368 | switch(th.data.currentIndex){ |
367 | case 0: //--秒杀-- | 369 | case 0: //--秒杀-- |
@@ -373,7 +375,8 @@ Page({ | @@ -373,7 +375,8 @@ Page({ | ||
373 | } | 375 | } |
374 | req_data.is_show=1; | 376 | req_data.is_show=1; |
375 | req_data.is_end=0; | 377 | req_data.is_end=0; |
376 | - | 378 | + req_data.user_id=user_id; |
379 | + | ||
377 | if(th.data.key_str && th.data.key_str.trim()){ | 380 | if(th.data.key_str && th.data.key_str.trim()){ |
378 | req_data.key_str=th.data.key_str.trim(); | 381 | req_data.key_str=th.data.key_str.trim(); |
379 | } | 382 | } |
@@ -427,7 +430,15 @@ Page({ | @@ -427,7 +430,15 @@ Page({ | ||
427 | th.data.is_load=0; | 430 | th.data.is_load=0; |
428 | if(res.data.code==0 && res.data.data.pageData && res.data.data.pageData.length>0){ | 431 | if(res.data.code==0 && res.data.data.pageData && res.data.data.pageData.length>0){ |
429 | th.data.currentPage++; | 432 | th.data.currentPage++; |
430 | - var data=res.data.data.pageData; | 433 | + var data=res.data.data.pageData; |
434 | + | ||
435 | + if(th.data.currentIndex==0){ | ||
436 | + for(let i in data){ | ||
437 | + let item=data[i]; | ||
438 | + if(item.user_price) item.price=item.price; | ||
439 | + } | ||
440 | + } | ||
441 | + | ||
431 | if(res.data.data.page*10>res.data.data.total){th.setData({is_no_more:1});} | 442 | if(res.data.data.page*10>res.data.data.total){th.setData({is_no_more:1});} |
432 | var list=th.data.list; | 443 | var list=th.data.list; |
433 | list=list.concat(data); | 444 | list=list.concat(data); |
packageA/pages/chongzhi/g_filter.wxs
1 | var is_acting = function(endtime){ | 1 | var is_acting = function(endtime){ |
2 | - //判断结束时间减去当前时间 ,如果当前时间大于0则为True | ||
3 | - if(endtime=='') return true; | ||
4 | - endtime = endtime.substring(0, 19); | ||
5 | - var reg = getRegExp("-", "g"); | ||
6 | - endtime = endtime.replace(reg, '/'); | ||
7 | - var bijiao = getDate(endtime) - getDate(); | ||
8 | - return bijiao > 0 ? true : false; | 2 | + //判断结束时间减去当前时间 ,如果当前时间大于0则为True |
3 | + endtime=endtime+" 23:59:59"; | ||
4 | + if(endtime=='') return true; | ||
5 | + endtime = endtime.substring(0, 19); | ||
6 | + var reg = getRegExp("-", "g"); | ||
7 | + endtime = endtime.replace(reg, '/'); | ||
8 | + var bijiao = getDate(endtime) - getDate(); | ||
9 | + return bijiao >= 0 ? true : false; | ||
9 | } | 10 | } |
10 | module.exports = { | 11 | module.exports = { |
11 | is_acting:is_acting | 12 | is_acting:is_acting |
packageB/pages/zuhegou/index/index.js
@@ -2004,7 +2004,7 @@ Page({ | @@ -2004,7 +2004,7 @@ Page({ | ||
2004 | await getApp().request.promiseGet("/api/weshop/ordergoods/getUserBuyGoodsNum", { | 2004 | await getApp().request.promiseGet("/api/weshop/ordergoods/getUserBuyGoodsNum", { |
2005 | data: { | 2005 | data: { |
2006 | store_id: os.stoid, | 2006 | store_id: os.stoid, |
2007 | - user_id: user_id, | 2007 | + user_id: oo.user_id, |
2008 | goods_id: item_j.goods_id, | 2008 | goods_id: item_j.goods_id, |
2009 | prom_type: 7, | 2009 | prom_type: 7, |
2010 | prom_id: th.data.act.id | 2010 | prom_id: th.data.act.id |
pages/activity/seckill_list/seckill_list.js
@@ -124,9 +124,12 @@ Page({ | @@ -124,9 +124,12 @@ Page({ | ||
124 | var e = this,th=e, i = "/api/ms/flash_sale/spikepage?page=" + e.data.currentPage; | 124 | var e = this,th=e, i = "/api/ms/flash_sale/spikepage?page=" + e.data.currentPage; |
125 | var plist=null,alllist=th.data.goodlist; | 125 | var plist=null,alllist=th.data.goodlist; |
126 | if(!alllist) alllist=[]; | 126 | if(!alllist) alllist=[]; |
127 | + var user_id=getApp().globalData.user_id; | ||
128 | + if(!user_id) user_id=user_id; | ||
129 | + var req={store_id:os.stoid,timetype:th.data.type,is_end:0,is_show:1,user_id:user_id}; | ||
127 | 130 | ||
128 | await getApp().request.promiseGet(i, | 131 | await getApp().request.promiseGet(i, |
129 | - {isShowLoading:1,data:{store_id:os.stoid,timetype:th.data.type,is_end:0,is_show:1}} | 132 | + {isShowLoading:1,data:req} |
130 | ).then(res=>{ | 133 | ).then(res=>{ |
131 | plist=res.data.data.pageData; | 134 | plist=res.data.data.pageData; |
132 | console.log("是什么即将开始",plist); | 135 | console.log("是什么即将开始",plist); |
@@ -148,6 +151,8 @@ Page({ | @@ -148,6 +151,8 @@ Page({ | ||
148 | 151 | ||
149 | //--循环读取接口--- | 152 | //--循环读取接口--- |
150 | for(var i=0;i<plist.length;i++) { | 153 | for(var i=0;i<plist.length;i++) { |
154 | + | ||
155 | + if( plist[i].user_price) plist[i].price= plist[i].user_price; | ||
151 | var prom_id = plist[i].id; | 156 | var prom_id = plist[i].id; |
152 | await getApp().request.promiseGet("/api/weshop/activitylist/getActLen/" + | 157 | await getApp().request.promiseGet("/api/weshop/activitylist/getActLen/" + |
153 | os.stoid + "/1/" + prom_id, {} | 158 | os.stoid + "/1/" + prom_id, {} |
pages/activity/seckill_list/seckill_list.wxml
@@ -33,13 +33,13 @@ | @@ -33,13 +33,13 @@ | ||
33 | 33 | ||
34 | <view class="kill-list abs seckill_list"> | 34 | <view class="kill-list abs seckill_list"> |
35 | <view class="kill-item" wx:for="{{goodlist}}" wx:if="{{item.djs.hide}}" > | 35 | <view class="kill-item" wx:for="{{goodlist}}" wx:if="{{item.djs.hide}}" > |
36 | - <navigator class="kill-pic rel" url="/pages/goods/goodsInfo/goodsInfo?goods_id={{item.goods_id}}"> | 36 | + <navigator class="kill-pic rel" url="/pages/goods/goodsInfo/goodsInfo?goods_id={{item.goods_id}}&prom_id={{item.id}}&prom_type=1"> |
37 | <image class="abs xc-miaosha" src="{{url}}/miniapp/images/zms.png"></image> | 37 | <image class="abs xc-miaosha" src="{{url}}/miniapp/images/zms.png"></image> |
38 | <image class="wh100" src="{{url+item.original_img}}" data-val="{{item.original_img}}" | 38 | <image class="wh100" src="{{url+item.original_img}}" data-val="{{item.original_img}}" |
39 | data-errorimg="goodlist[{{index}}].original_img" binderror="bind_bnerr2" lazy-load="true"></image> | 39 | data-errorimg="goodlist[{{index}}].original_img" binderror="bind_bnerr2" lazy-load="true"></image> |
40 | </navigator> | 40 | </navigator> |
41 | <view class="kill-cont"> | 41 | <view class="kill-cont"> |
42 | - <navigator class="goods-name ellipsis-2" url="/pages/goods/goodsInfo/goodsInfo?goods_id={{item.goods_id}}">{{item.title}}</navigator> | 42 | + <navigator class="goods-name ellipsis-2" url="/pages/goods/goodsInfo/goodsInfo?goods_id={{item.goods_id}}&prom_id={{item.id}}&prom_type=1">{{item.goods_name}}</navigator> |
43 | <view class="flex-vertical xc-strip-frame"> | 43 | <view class="flex-vertical xc-strip-frame"> |
44 | <view class="xc-strip-blank rel"> | 44 | <view class="xc-strip-blank rel"> |
45 | 45 | ||
@@ -71,9 +71,9 @@ | @@ -71,9 +71,9 @@ | ||
71 | 71 | ||
72 | </view> | 72 | </view> |
73 | <view class="kill-btn "> | 73 | <view class="kill-btn "> |
74 | - <navigator style="background-color: #059de5;" url="/pages/goods/goodsInfo/goodsInfo?goods_id={{item.goods_id}}" wx:if="{{type==0}}" >即将开始</navigator> | ||
75 | - <navigator url="/pages/goods/goodsInfo/goodsInfo?goods_id={{item.goods_id}}" wx:if="{{item.status==1 && type==1}}">马上抢</navigator> | ||
76 | - <navigator class="huise"url="/pages/goods/goodsInfo/goodsInfo?goods_id={{item.goods_id}}" wx:if="{{item.status==3 && type==1}}">已抢光</navigator> | 74 | + <navigator style="background-color: #059de5;" url="/pages/goods/goodsInfo/goodsInfo?goods_id={{item.goods_id}}&prom_id={{item.id}}&prom_type=1" wx:if="{{type==0}}" >即将开始</navigator> |
75 | + <navigator url="/pages/goods/goodsInfo/goodsInfo?goods_id={{item.goods_id}}&prom_id={{item.id}}&prom_type=1" wx:if="{{item.status==1 && type==1}}">马上抢</navigator> | ||
76 | + <navigator class="huise"url="/pages/goods/goodsInfo/goodsInfo?goods_id={{item.goods_id}}&prom_id={{item.id}}&prom_type=1" wx:if="{{item.status==3 && type==1}}">已抢光</navigator> | ||
77 | </view> | 77 | </view> |
78 | </view> | 78 | </view> |
79 | </view> | 79 | </view> |
pages/cart/cart/cart.js
@@ -120,15 +120,20 @@ Page({ | @@ -120,15 +120,20 @@ Page({ | ||
120 | } | 120 | } |
121 | th.setData({ad_data:narr}); | 121 | th.setData({ad_data:narr}); |
122 | }else{ | 122 | }else{ |
123 | + | ||
124 | + var user_id=getApp().globalData.user_id; | ||
125 | + if(!user_id) user_id=0; | ||
126 | + var req_d= { | ||
127 | + store_id: oo.stoid, | ||
128 | + timetype: 2, | ||
129 | + is_end: 0, | ||
130 | + is_show: 1, | ||
131 | + pageSize: 1, | ||
132 | + user_id:user_id | ||
133 | + } | ||
123 | //--获取是否又秒杀活动-- | 134 | //--获取是否又秒杀活动-- |
124 | getApp().request.promiseGet("/api/ms/flash_sale/spikepage", { | 135 | getApp().request.promiseGet("/api/ms/flash_sale/spikepage", { |
125 | - data: { | ||
126 | - store_id: oo.stoid, | ||
127 | - timetype: 2, | ||
128 | - is_end: 0, | ||
129 | - is_show: 1, | ||
130 | - pageSize: 1 | ||
131 | - }, | 136 | + data:req_d, |
132 | }).then(res => { | 137 | }).then(res => { |
133 | if (res.data.code == 0 && res.data.data && res.data.data.pageData.length > 0) { | 138 | if (res.data.code == 0 && res.data.data && res.data.data.pageData.length > 0) { |
134 | th.setData({ | 139 | th.setData({ |
@@ -302,8 +307,11 @@ Page({ | @@ -302,8 +307,11 @@ Page({ | ||
302 | if (item.prom_type == 1) { | 307 | if (item.prom_type == 1) { |
303 | var prom = null; | 308 | var prom = null; |
304 | var now = ut.gettimestamp(); | 309 | var now = ut.gettimestamp(); |
305 | - await getApp().request.promiseGet("/api/ms/flash_sale/get/" + os.stoid + "/" + item.prom_id, {}).then(res => { | ||
306 | - if (res.data.code == 0) prom = res.data.data; | 310 | + await getApp().request.promiseGet("/api/ms/flash_sale/getNew/" + os.stoid +'/'+user_id+ "/" + item.prom_id, {}).then(res => { |
311 | + if (res.data.code == 0){ | ||
312 | + prom = res.data.data; | ||
313 | + prom.price=prom.user_price; | ||
314 | + } | ||
307 | }) | 315 | }) |
308 | //---如果互动都已经过期,或者还未开始,或者无活动 | 316 | //---如果互动都已经过期,或者还未开始,或者无活动 |
309 | if (!prom || prom.is_end == 1 || prom.end_time < now || prom.start_time > now) { | 317 | if (!prom || prom.is_end == 1 || prom.end_time < now || prom.start_time > now) { |
@@ -331,7 +339,18 @@ Page({ | @@ -331,7 +339,18 @@ Page({ | ||
331 | }) | 339 | }) |
332 | item.goods_num=cbuy; | 340 | item.goods_num=cbuy; |
333 | } | 341 | } |
342 | + | ||
343 | + //价格不对,就要更新一下 | ||
344 | + if(good.goods_price!=prom.price){ | ||
345 | + good.goods_price=prom.price; | ||
346 | + //-- 购物车更新秒杀价格 -- | ||
347 | + var updata1={id: item.id,goods_price:prom.price,store_id:os.stoid,user_id:getApp().globalData.userInfo.user_id }; | ||
348 | + getApp().request.put("/api/weshop/cart/update", { | ||
349 | + data: updata1, | ||
350 | + }) | ||
351 | + } | ||
334 | } | 352 | } |
353 | + | ||
335 | //--判断优惠活动有没有过期-- | 354 | //--判断优惠活动有没有过期-- |
336 | else if (item.prom_type == 3) { | 355 | else if (item.prom_type == 3) { |
337 | var isok = 1; | 356 | var isok = 1; |
@@ -423,6 +442,12 @@ Page({ | @@ -423,6 +442,12 @@ Page({ | ||
423 | var t_item=gdlist.find(function (ele) { | 442 | var t_item=gdlist.find(function (ele) { |
424 | return ele.goods_id==item.goods_id | 443 | return ele.goods_id==item.goods_id |
425 | }) | 444 | }) |
445 | + if(!t_item){ | ||
446 | + var url = '/api/weshop/cart/del/' + oo.stoid + '/' + item.id; | ||
447 | + getApp().request.delete(url, {}); | ||
448 | + th.data.zuhe_map[item.prom_id]=-1; | ||
449 | + continue; | ||
450 | + } | ||
426 | item.buyqty=t_item.buyqty; | 451 | item.buyqty=t_item.buyqty; |
427 | item.zh_b_num=promgoodsbuynum; | 452 | item.zh_b_num=promgoodsbuynum; |
428 | item.act=th.data.zuhe_map[item.prom_id]; | 453 | item.act=th.data.zuhe_map[item.prom_id]; |
@@ -1922,7 +1947,7 @@ Page({ | @@ -1922,7 +1947,7 @@ Page({ | ||
1922 | 1947 | ||
1923 | //如果会员是等级会员,商品有等级价,且不是活动商品 | 1948 | //如果会员是等级会员,商品有等级价,且不是活动商品 |
1924 | if (card_field && val[card_field] > 0 && | 1949 | if (card_field && val[card_field] > 0 && |
1925 | - (val.prom_type == 0 || val.prom_type == 3 || val.prom_type == 4 || val.prom_type == 5 || val.prom_type == 7 || normal_arr[val.goods_id])) { | 1950 | + ((val.prom_type == 0 && g_arr[i].prom_type==0) || val.prom_type == 3 || val.prom_type == 4 || val.prom_type == 5 || val.prom_type == 7 || normal_arr[val.goods_id])) { |
1926 | if (g_arr[i].goods_price != val[card_field]) { | 1951 | if (g_arr[i].goods_price != val[card_field]) { |
1927 | isok = 0; | 1952 | isok = 0; |
1928 | gname = val.goods_name; | 1953 | gname = val.goods_name; |
pages/cart/cart/cart.wxml
@@ -91,8 +91,7 @@ | @@ -91,8 +91,7 @@ | ||
91 | <block wx:if="{{items.prom_type==7}}"> | 91 | <block wx:if="{{items.prom_type==7}}"> |
92 | <block wx:if="{{items.selected}}"> | 92 | <block wx:if="{{items.selected}}"> |
93 | <!-- 主要显示限购 --> | 93 | <!-- 主要显示限购 --> |
94 | - <text wx:if="{{items.buyqty>0 && items.zh_b_num>0}}" class="abs2">活动剩余可购{{items.buyqty-items.zh_b_num>0?items.buyqty-items.zh_b_num:0}}件</text> | ||
95 | - <text wx:elif="{{items.zhqty>items.goods_num}}" class="abs2">还需购买{{items.zhqty-items.goods_num}}件</text> | 94 | + <text wx:if="{{items.zhqty>items.goods_num}}" class="abs2">还需购买{{items.zhqty-items.goods_num}}件</text> |
96 | </block> | 95 | </block> |
97 | <block wx:else> | 96 | <block wx:else> |
98 | <text wx:if="{{items.zhqty}}" class="abs2">需购买{{items.zhqty}}件</text> | 97 | <text wx:if="{{items.zhqty}}" class="abs2">需购买{{items.zhqty}}件</text> |
@@ -113,6 +112,7 @@ | @@ -113,6 +112,7 @@ | ||
113 | <block wx:if="{{items.is_gift}}"> | 112 | <block wx:if="{{items.is_gift}}"> |
114 | <view>{{items.goods_num}}件</view> | 113 | <view>{{items.goods_num}}件</view> |
115 | </block> | 114 | </block> |
115 | + <view wx:if="{{items.buyqty>0}}" class="fs22 ml10 c-7b">组合限购{{items.buyqty}}件</view> | ||
116 | </view> | 116 | </view> |
117 | 117 | ||
118 | 118 | ||
@@ -124,6 +124,7 @@ | @@ -124,6 +124,7 @@ | ||
124 | 124 | ||
125 | <view wx:if="{{items.is_offline}}" class="quan_color flex ai-center"><text>券后 ¥{{g_filter.toFix(items.offline_price,2)}}</text></view> | 125 | <view wx:if="{{items.is_offline}}" class="quan_color flex ai-center"><text>券后 ¥{{g_filter.toFix(items.offline_price,2)}}</text></view> |
126 | 126 | ||
127 | + | ||
127 | </view> | 128 | </view> |
128 | <view class="count"> | 129 | <view class="count"> |
129 | <view bindtap="{{items.goods_num <= 1 ? '':'subNum'}}" class="sub fs28 {{items.goods_num <= 1 ? 'active':''}}" data-pitems="{{pidx}}" data-item="{{idx}}">一</view> | 130 | <view bindtap="{{items.goods_num <= 1 ? '':'subNum'}}" class="sub fs28 {{items.goods_num <= 1 ? 'active':''}}" data-pitems="{{pidx}}" data-item="{{idx}}">一</view> |
pages/cart/cart2/cart2.js
@@ -780,6 +780,10 @@ Page({ | @@ -780,6 +780,10 @@ Page({ | ||
780 | } | 780 | } |
781 | } | 781 | } |
782 | 782 | ||
783 | + if(gg.prom_type){ | ||
784 | + gd.prom_type=gg.prom_type; | ||
785 | + gd.prom_id=gg.prom_id; | ||
786 | + } | ||
783 | switch (gd.prom_type) { | 787 | switch (gd.prom_type) { |
784 | case 0: | 788 | case 0: |
785 | case 2: | 789 | case 2: |
@@ -948,22 +952,23 @@ Page({ | @@ -948,22 +952,23 @@ Page({ | ||
948 | break; | 952 | break; |
949 | case 1: //---秒杀----- | 953 | case 1: //---秒杀----- |
950 | var quanlist = null; | 954 | var quanlist = null; |
951 | - getApp().request.get("/api/weshop/activitylist/getSJGoodsPrice/" + gd.store_id | ||
952 | - + "/" + gd.goods_id + "/1/" + gd.prom_id, { | 955 | + getApp().request.get("/api/weshop/activitylist/getSJGoodsPriceNew/" + gd.store_id |
956 | + + "/" + gd.goods_id + "/1/" + gd.prom_id+"/"+app.globalData.user_id, { | ||
953 | success: async function (tt) { | 957 | success: async function (tt) { |
954 | if (tt.data.code == 0) { | 958 | if (tt.data.code == 0) { |
955 | - t.data.data.shop_price = tt.data.data.prom_price; | 959 | + //t.data.data.shop_price = tt.data.data.prom_price; |
960 | + t.data.data.shop_price = tt.data.data.prom_user_price; | ||
961 | + th.data.ckeck_quan_price=0; | ||
956 | } else { | 962 | } else { |
957 | t.data.data.prom_id = 0; | 963 | t.data.data.prom_id = 0; |
958 | t.data.data.prom_type = 0; | 964 | t.data.data.prom_type = 0; |
959 | - | ||
960 | th.data.ckeck_quan_price = t.data.data.shop_price * gg.goods_num; | 965 | th.data.ckeck_quan_price = t.data.data.shop_price * gg.goods_num; |
961 | th.data.check_quan_price_list = t.data.data.shop_price * gg.goods_num + ""; | 966 | th.data.check_quan_price_list = t.data.data.shop_price * gg.goods_num + ""; |
962 | th.data.check_quan_ware_list = t.data.data.erpwareid + ""; | 967 | th.data.check_quan_ware_list = t.data.data.erpwareid + ""; |
963 | } | 968 | } |
964 | 969 | ||
965 | th.setData({ | 970 | th.setData({ |
966 | - bn_goods: t.data.data, | 971 | + bn_goods: gd, |
967 | bn_pickname: gg.pick_name, | 972 | bn_pickname: gg.pick_name, |
968 | bn_exp_type: et, | 973 | bn_exp_type: et, |
969 | index: m_wind, | 974 | index: m_wind, |
pages/giftpack/mygiftpack/mygiftpack.js
@@ -148,5 +148,18 @@ onShareAppMessage: function (e) { | @@ -148,5 +148,18 @@ onShareAppMessage: function (e) { | ||
148 | } | 148 | } |
149 | }, | 149 | }, |
150 | 150 | ||
151 | + onShareTimeline() { | ||
152 | + var curPage=this; | ||
153 | + var pagePath = curPage.route; //当前页面url | ||
154 | + if (pagePath.indexOf('/') != 0) { | ||
155 | + pagePath = '/' + pagePath; | ||
156 | + } | ||
157 | + return { | ||
158 | + title: '专享礼包', | ||
159 | + imageUrl: this.data.ad_data.ad_code, | ||
160 | + path: pagePath, | ||
161 | + } | ||
162 | + }, | ||
163 | + | ||
151 | 164 | ||
152 | }); | 165 | }); |
153 | \ No newline at end of file | 166 | \ No newline at end of file |
pages/goods/goodsInfo/filter.wxs
@@ -8,7 +8,20 @@ function format_tt(ts) { | @@ -8,7 +8,20 @@ function format_tt(ts) { | ||
8 | var fm=(d.getMonth()+1)+"月"+ d.getDate()+"日"; | 8 | var fm=(d.getMonth()+1)+"月"+ d.getDate()+"日"; |
9 | return fm; | 9 | return fm; |
10 | } | 10 | } |
11 | + | ||
12 | +function act_type(ty){ | ||
13 | + switch(ty){ | ||
14 | + case 1: return '秒杀'; | ||
15 | + case 2: return '团购'; | ||
16 | + case 4: return '积分购'; | ||
17 | + case 6: return '拼单'; | ||
18 | + case 7: return '组合购'; | ||
19 | + case 8: return '预售'; | ||
20 | + } | ||
21 | +} | ||
22 | + | ||
11 | module.exports = { | 23 | module.exports = { |
12 | is_has: is_has, | 24 | is_has: is_has, |
13 | - format_tt:format_tt | 25 | + format_tt:format_tt, |
26 | + act_type:act_type | ||
14 | } | 27 | } |
pages/goods/goodsInfo/goodsInfo.js
@@ -255,15 +255,20 @@ Page({ | @@ -255,15 +255,20 @@ Page({ | ||
255 | //------初始化加载---------- | 255 | //------初始化加载---------- |
256 | onLoad: function (t) { | 256 | onLoad: function (t) { |
257 | 257 | ||
258 | - | ||
259 | - | ||
260 | var ee = this, | 258 | var ee = this, |
261 | that = ee, | 259 | that = ee, |
262 | th = ee, | 260 | th = ee, |
263 | gid = t.goods_id, | 261 | gid = t.goods_id, |
264 | first_leader = t.first_leader, | 262 | first_leader = t.first_leader, |
265 | room_id = t.room_id, | 263 | room_id = t.room_id, |
266 | - room_user_share = t.room_user_share; //如果是会员分享带有room_id的话,那么接下来会员分享就不传room_id | 264 | + room_user_share = t.room_user_share, //如果是会员分享带有room_id的话,那么接下来会员分享就不传room_id |
265 | + prom_type=t.prom_type, | ||
266 | + prom_id=t.prom_id; //活动ID | ||
267 | + | ||
268 | + if(prom_type){ | ||
269 | + this.data.prom_type=prom_type; | ||
270 | + this.data.prom_id=prom_id; | ||
271 | + } | ||
267 | 272 | ||
268 | //-- 自定义海报 -- | 273 | //-- 自定义海报 -- |
269 | getApp().request.promiseGet("/api/weshop/goods/poster/page", { | 274 | getApp().request.promiseGet("/api/weshop/goods/poster/page", { |
@@ -300,6 +305,17 @@ Page({ | @@ -300,6 +305,17 @@ Page({ | ||
300 | var gid_str = decodeURIComponent(t.scene); | 305 | var gid_str = decodeURIComponent(t.scene); |
301 | gid_str = gid_str.split("_"); | 306 | gid_str = gid_str.split("_"); |
302 | gid = gid_str[0]; | 307 | gid = gid_str[0]; |
308 | + if(gid.indexOf('.')!=-1){ | ||
309 | + var fir_arr=gid.split("."); | ||
310 | + gid=fir_arr[0]; | ||
311 | + prom_type=fir_arr[1]; | ||
312 | + prom_id=fir_arr[2]; | ||
313 | + this.data.prom_type=prom_type; | ||
314 | + this.data.prom_id=prom_id; | ||
315 | + } | ||
316 | + | ||
317 | + | ||
318 | + | ||
303 | if (gid_str.length > 1) { | 319 | if (gid_str.length > 1) { |
304 | first_leader = gid_str[1]; | 320 | first_leader = gid_str[1]; |
305 | } | 321 | } |
@@ -435,9 +451,6 @@ Page({ | @@ -435,9 +451,6 @@ Page({ | ||
435 | if (th.data.fir_goods) var g_distr_type = th.data.fir_goods.distr_type; | 451 | if (th.data.fir_goods) var g_distr_type = th.data.fir_goods.distr_type; |
436 | //--如果默认门店的配送方式不对,就不能被选择,这里不控制,如果不一样,就说明配送方式不对-- | 452 | //--如果默认门店的配送方式不对,就不能被选择,这里不控制,如果不一样,就说明配送方式不对-- |
437 | if (ee.distr_type != 0 && g_distr_type != 0 && ee.distr_type != g_distr_type) { | 453 | if (ee.distr_type != 0 && g_distr_type != 0 && ee.distr_type != g_distr_type) { |
438 | - //th.data.fir_def_store={}; //赋值空对象 | ||
439 | - //return false; | ||
440 | - //th.data.fir_def_store.is_no_dis=1; | ||
441 | ee.is_no_dis = 1; | 454 | ee.is_no_dis = 1; |
442 | } | 455 | } |
443 | 456 | ||
@@ -452,15 +465,7 @@ Page({ | @@ -452,15 +465,7 @@ Page({ | ||
452 | if (that.data.lat != null) { | 465 | if (that.data.lat != null) { |
453 | //如果经纬度有变化的话 | 466 | //如果经纬度有变化的话 |
454 | if (e && appd.lat == that.data.lat && appd.lon == that.data.lon && e.distance > 0) { | 467 | if (e && appd.lat == that.data.lat && appd.lon == that.data.lon && e.distance > 0) { |
455 | - //that.data.fir_def_store=e; | ||
456 | - // that.setData({ | ||
457 | - // def_pick_store: e, | ||
458 | - // sto_sele_name: e.pickup_name, | ||
459 | - // sto_sele_id: e.pickup_id, | ||
460 | - // sto_sele_distr: e.distr_type | ||
461 | - // }) | ||
462 | that.set_def_storage(e); | 468 | that.set_def_storage(e); |
463 | - | ||
464 | } else { | 469 | } else { |
465 | //要用接口是获取距离,js的计算不准 | 470 | //要用接口是获取距离,js的计算不准 |
466 | getApp().request.promiseGet("/api/weshop/pickup/list", { | 471 | getApp().request.promiseGet("/api/weshop/pickup/list", { |
@@ -471,13 +476,6 @@ Page({ | @@ -471,13 +476,6 @@ Page({ | ||
471 | if (e) { | 476 | if (e) { |
472 | e.is_no_dis = ee.is_no_dis; | 477 | e.is_no_dis = ee.is_no_dis; |
473 | appd.pk_store = e; | 478 | appd.pk_store = e; |
474 | - // that.data.fir_def_store=e; | ||
475 | - // that.setData({ | ||
476 | - // def_pick_store: e, | ||
477 | - // sto_sele_name: e.pickup_name, | ||
478 | - // sto_sele_id: e.pickup_id, | ||
479 | - // sto_sele_distr: e.distr_type | ||
480 | - // }) | ||
481 | that.set_def_storage(e); | 479 | that.set_def_storage(e); |
482 | } | 480 | } |
483 | 481 | ||
@@ -491,13 +489,6 @@ Page({ | @@ -491,13 +489,6 @@ Page({ | ||
491 | } else { | 489 | } else { |
492 | if (e) { | 490 | if (e) { |
493 | e.distance = null; | 491 | e.distance = null; |
494 | - // that.data.fir_def_store=e; | ||
495 | - // that.setData({ | ||
496 | - // def_pick_store: e, | ||
497 | - // sto_sele_name: e.pickup_name, | ||
498 | - // sto_sele_id: e.pickup_id, | ||
499 | - // sto_sele_distr: e.distr_type | ||
500 | - // }) | ||
501 | that.set_def_storage(e); | 492 | that.set_def_storage(e); |
502 | } | 493 | } |
503 | } | 494 | } |
@@ -671,7 +662,7 @@ Page({ | @@ -671,7 +662,7 @@ Page({ | ||
671 | } | 662 | } |
672 | } | 663 | } |
673 | 664 | ||
674 | - if (th.data.is_closecoupon != 1) { | 665 | + if (th.data.is_closecoupon != 1 && (!th.data.fir_quan || th.data.fir_quan.length<=0)) { |
675 | //----获取详情页的券的数量---- | 666 | //----获取详情页的券的数量---- |
676 | await getApp().request.promiseGet("/api/weshop/prom/coupon/pageCouponList", { | 667 | await getApp().request.promiseGet("/api/weshop/prom/coupon/pageCouponList", { |
677 | data: { | 668 | data: { |
@@ -790,7 +781,7 @@ Page({ | @@ -790,7 +781,7 @@ Page({ | ||
790 | if (getApp().globalData.userInfo && t.data.data.prom_type == 7) { | 781 | if (getApp().globalData.userInfo && t.data.data.prom_type == 7) { |
791 | //获取活动信息 | 782 | //获取活动信息 |
792 | var url = "/api/weshop/prom/zhbuy/get/" + os.stoid + "/" + | 783 | var url = "/api/weshop/prom/zhbuy/get/" + os.stoid + "/" + |
793 | - t.data.data.prom_id + "/" + getApp().globalData.userInfo.user_id; | 784 | + t.data.data.prom_id + "/" + getApp().globalData.user_id; |
794 | getApp().request.get(url, { | 785 | getApp().request.get(url, { |
795 | success: function (e) { | 786 | success: function (e) { |
796 | if (e.data.code == 0 && e.data.data) { | 787 | if (e.data.code == 0 && e.data.data) { |
@@ -809,7 +800,8 @@ Page({ | @@ -809,7 +800,8 @@ Page({ | ||
809 | 800 | ||
810 | //-- 把商品的赋值 -- | 801 | //-- 把商品的赋值 -- |
811 | ee.data.fir_goods = JSON.parse(JSON.stringify(t.data.data)); | 802 | ee.data.fir_goods = JSON.parse(JSON.stringify(t.data.data)); |
812 | - ee.check_is_youhui(ee.data.gid); | 803 | + if(ee.data.prom_type!=1 && ee.data.prom_type!=4 && ee.data.prom_type!=6) |
804 | + ee.check_is_youhui(ee.data.gid); | ||
813 | 805 | ||
814 | t.data.data.on_time = ut.formatTime(t.data.data.on_time, 'yyyy-MM-dd hh:mm:ss'); | 806 | t.data.data.on_time = ut.formatTime(t.data.data.on_time, 'yyyy-MM-dd hh:mm:ss'); |
815 | 807 | ||
@@ -835,6 +827,11 @@ Page({ | @@ -835,6 +827,11 @@ Page({ | ||
835 | a.wxParse("content", "html", t.data.data.goods_content, ee, 6); | 827 | a.wxParse("content", "html", t.data.data.goods_content, ee, 6); |
836 | e.wxParseAddFullImageUrl(ee, "content"); | 828 | e.wxParseAddFullImageUrl(ee, "content"); |
837 | 829 | ||
830 | + if(ee.data.prom_type){ | ||
831 | + t.data.data.prom_type=ee.data.prom_type; | ||
832 | + t.data.data.prom_id=ee.data.prom_id; | ||
833 | + } | ||
834 | + | ||
838 | ee.setData({ | 835 | ee.setData({ |
839 | data: t.data.data, | 836 | data: t.data.data, |
840 | sele_g: t.data.data, | 837 | sele_g: t.data.data, |
@@ -848,43 +845,15 @@ Page({ | @@ -848,43 +845,15 @@ Page({ | ||
848 | if (that.data.sales_rules == 2 && that.data.is_newsales_rules) { | 845 | if (that.data.sales_rules == 2 && that.data.is_newsales_rules) { |
849 | //获取门店 | 846 | //获取门店 |
850 | ee.get_sto(); | 847 | ee.get_sto(); |
851 | - //--等待某个值只运行---,这里有可能因为导航的时间太久,而不能计算门店库存 | ||
852 | - /*--- | ||
853 | - getApp().waitfor2(that,"wait_for_user_store","fir_def_store",function(){ | ||
854 | - if(th.data.fir_def_store && th.data.fir_def_store.pickup_id ){ | ||
855 | - var lock=0,plist=null; | ||
856 | - //先读取门店的lock,采用链式写法,少用await | ||
857 | - getApp().request.promiseGet("/api/weshop/order/ware/lock/page",{ | ||
858 | - data:{store_id:os.stoid,wareId:ee.data.data.goods_id,storageId:that.data.fir_def_store.pickup_id,pageSize:1000} | ||
859 | - }).then(res=>{ | ||
860 | - if(res.data.code==0 && res.data.data.total>0){ | ||
861 | - for(var i in res.data.data.pageData) | ||
862 | - lock+=res.data.data.pageData[i].outQty | ||
863 | - } | ||
864 | - //---通过接口获取门店的线下库存信息-- | ||
865 | - return getApp().request.promiseGet("/api/weshop/goods/getWareStorages",{ | ||
866 | - data:{storageNos:that.data.fir_def_store.pickup_no,wareIds:encodeURIComponent(th.data.data.erpwareid),storeId:os.stoid} | ||
867 | - }) | ||
868 | - }).then(res=>{ | ||
869 | - if(res.data.code==0 && res.data.data.total>0){ | ||
870 | - plist=res.data.data.pageData[0]; | ||
871 | - } | ||
872 | - if(plist && plist.CanOutQty-lock>0){ | ||
873 | - that.data.fir_def_store.CanOutQty=plist.CanOutQty-lock; | ||
874 | - }else{ | ||
875 | - that.data.fir_def_store.CanOutQty=0; | ||
876 | - } | ||
877 | - //--给门店赋值线下库存-- | ||
878 | - th.setData({def_pick_store:that.data.fir_def_store}); | ||
879 | - }) | ||
880 | - } | ||
881 | - })--*/ | 848 | + |
882 | } else { | 849 | } else { |
883 | //获取门店 | 850 | //获取门店 |
884 | ee.get_sto(); | 851 | ee.get_sto(); |
885 | } | 852 | } |
886 | 853 | ||
887 | ee.get_sku(o.stoid, t.data.data, gid); | 854 | ee.get_sku(o.stoid, t.data.data, gid); |
855 | + ee.check_has_flash(); | ||
856 | + | ||
888 | } | 857 | } |
889 | else { | 858 | else { |
890 | var gg = "", item = t.data.data; | 859 | var gg = "", item = t.data.data; |
@@ -1260,6 +1229,8 @@ Page({ | @@ -1260,6 +1229,8 @@ Page({ | ||
1260 | goods_name: o.goods_name, | 1229 | goods_name: o.goods_name, |
1261 | goods_sn: o.goods_sn, | 1230 | goods_sn: o.goods_sn, |
1262 | sku: o.sku, | 1231 | sku: o.sku, |
1232 | + prom_id:th.data.sele_g.prom_id, | ||
1233 | + prom_type:th.data.sele_g.prom_type, | ||
1263 | }; | 1234 | }; |
1264 | 1235 | ||
1265 | //---是不是从收藏夹出来的--- | 1236 | //---是不是从收藏夹出来的--- |
@@ -1850,17 +1821,33 @@ Page({ | @@ -1850,17 +1821,33 @@ Page({ | ||
1850 | return false; | 1821 | return false; |
1851 | } | 1822 | } |
1852 | 1823 | ||
1853 | - var ind = t.currentTarget.dataset.ind; | 1824 | + if(th.data.more_flash && open_store==1){ |
1825 | + th.setData({is_pop_more:1}); | ||
1826 | + }else{ | ||
1827 | + var ind = t.currentTarget.dataset.ind; | ||
1828 | + //回调。判断是不是优惠促销 | ||
1829 | + th.check_is_prom_goods(function () { | ||
1830 | + th.setData({ | ||
1831 | + openSpecModal: !0, | ||
1832 | + openSpecModal_ind: ind, | ||
1833 | + }); | ||
1834 | + //var is_open=th.data.config | ||
1835 | + th.get_off_price(); | ||
1836 | + }) | ||
1837 | + } | ||
1838 | + }, | ||
1854 | 1839 | ||
1855 | - //回调。判断是不是优惠促销 | ||
1856 | - th.check_is_prom_goods(function () { | ||
1857 | - th.setData({ | ||
1858 | - openSpecModal: !0, | ||
1859 | - openSpecModal_ind: ind, | ||
1860 | - }); | ||
1861 | - //var is_open=th.data.config | ||
1862 | - th.get_off_price(); | ||
1863 | - }) | 1840 | + open_next(){ |
1841 | + var th=this; | ||
1842 | + //回调。判断是不是优惠促销 | ||
1843 | + th.check_is_prom_goods(function () { | ||
1844 | + th.setData({ | ||
1845 | + openSpecModal: !0, | ||
1846 | + openSpecModal_ind: 1, | ||
1847 | + is_pop_more:0 | ||
1848 | + }); | ||
1849 | + th.get_off_price(); | ||
1850 | + }) | ||
1864 | }, | 1851 | }, |
1865 | 1852 | ||
1866 | //判断是不是优惠促销 | 1853 | //判断是不是优惠促销 |
@@ -2130,13 +2117,13 @@ Page({ | @@ -2130,13 +2117,13 @@ Page({ | ||
2130 | onShareAppMessage: function (t) { | 2117 | onShareAppMessage: function (t) { |
2131 | 2118 | ||
2132 | var th = this; | 2119 | var th = this; |
2133 | - var price = th.data.data.shop_price; | 2120 | + var price = th.data.sele_g.shop_price; |
2134 | if (th.data.prom_act) { | 2121 | if (th.data.prom_act) { |
2135 | price = th.data.prom_act.price; | 2122 | price = th.data.prom_act.price; |
2136 | 2123 | ||
2137 | } | 2124 | } |
2138 | - var title = th.data.data.goods_name; | ||
2139 | - var img = th.data.data.original_img; | 2125 | + var title = th.data.sele_g.goods_name; |
2126 | + var img = th.data.sele_g.original_img; | ||
2140 | if (th.data.prom_type == 6 || th.data.prom_type == 1 || th.data.prom_type == 4) { | 2127 | if (th.data.prom_type == 6 || th.data.prom_type == 1 || th.data.prom_type == 4) { |
2141 | title = th.data.prom_act.share_title; | 2128 | title = th.data.prom_act.share_title; |
2142 | if (!title) title = th.data.prom_act.title; | 2129 | if (!title) title = th.data.prom_act.title; |
@@ -2147,14 +2134,15 @@ Page({ | @@ -2147,14 +2134,15 @@ Page({ | ||
2147 | } | 2134 | } |
2148 | 2135 | ||
2149 | 2136 | ||
2150 | - var url = "/pages/goods/goodsInfo/goodsInfo?goods_id=" + th.data.gid; | 2137 | + var url = "/pages/goods/goodsInfo/goodsInfo?goods_id=" |
2138 | + + th.data.sele_g.gid+"&prom_type="+th.data.sele_g.prom_type+"&prom_id="+th.data.sele_g.prom_id; | ||
2151 | if (getApp().globalData.user_id) { | 2139 | if (getApp().globalData.user_id) { |
2152 | url += "&first_leader=" + getApp().globalData.user_id; | 2140 | url += "&first_leader=" + getApp().globalData.user_id; |
2153 | } | 2141 | } |
2154 | 2142 | ||
2155 | //-- 如果房间分享,且不是会员分享的 -- | 2143 | //-- 如果房间分享,且不是会员分享的 -- |
2156 | if (getApp().globalData.room_id && | 2144 | if (getApp().globalData.room_id && |
2157 | - th.data.data.goods_id == getApp().globalData.room_goods_id && | 2145 | + th.data.sele_g.goods_id == getApp().globalData.room_goods_id && |
2158 | !getApp().globalData.room_user_share | 2146 | !getApp().globalData.room_user_share |
2159 | ) { | 2147 | ) { |
2160 | url += "&room_id=" + getApp().globalData.room_id + "&room_user_share=1"; | 2148 | url += "&room_id=" + getApp().globalData.room_id + "&room_user_share=1"; |
@@ -2185,6 +2173,8 @@ Page({ | @@ -2185,6 +2173,8 @@ Page({ | ||
2185 | ob.title = text + " " + name; | 2173 | ob.title = text + " " + name; |
2186 | } | 2174 | } |
2187 | 2175 | ||
2176 | + //-- 页面不能刷新 -- | ||
2177 | + this.data.show_prew_img=1; | ||
2188 | return ob; | 2178 | return ob; |
2189 | 2179 | ||
2190 | }, | 2180 | }, |
@@ -2266,6 +2256,9 @@ Page({ | @@ -2266,6 +2256,9 @@ Page({ | ||
2266 | case 8: | 2256 | case 8: |
2267 | continue; | 2257 | continue; |
2268 | 2258 | ||
2259 | + case 8: | ||
2260 | + continue; | ||
2261 | + | ||
2269 | } | 2262 | } |
2270 | 2263 | ||
2271 | 2264 | ||
@@ -2347,10 +2340,8 @@ Page({ | @@ -2347,10 +2340,8 @@ Page({ | ||
2347 | }); | 2340 | }); |
2348 | 2341 | ||
2349 | 2342 | ||
2350 | - | ||
2351 | that.check_is_youhui(gid, that.data.is_normal); | 2343 | that.check_is_youhui(gid, that.data.is_normal); |
2352 | 2344 | ||
2353 | - var ty = 0; | ||
2354 | this.get_sto(that.data.is_normal); | 2345 | this.get_sto(that.data.is_normal); |
2355 | 2346 | ||
2356 | 2347 | ||
@@ -2391,11 +2382,14 @@ Page({ | @@ -2391,11 +2382,14 @@ Page({ | ||
2391 | async sele_spec_chech_activity() { | 2382 | async sele_spec_chech_activity() { |
2392 | //---如果是活动的时候--- | 2383 | //---如果是活动的时候--- |
2393 | var prom = null, goodsinfo = this.data.sele_g, th = this; | 2384 | var prom = null, goodsinfo = this.data.sele_g, th = this; |
2385 | + var user_id=getApp().globalData.user_id; | ||
2386 | + if(!user_id) user_id=0; | ||
2394 | if (goodsinfo.prom_type == 1) { | 2387 | if (goodsinfo.prom_type == 1) { |
2395 | - await getApp().request.promiseGet("/api/ms/flash_sale/get/" + os.stoid + "/" + goodsinfo.prom_id, { | 2388 | + await getApp().request.promiseGet("/api/ms/flash_sale/getNew/" + os.stoid + "/" +user_id+"/"+ goodsinfo.prom_id, { |
2396 | }).then(res => { | 2389 | }).then(res => { |
2397 | if (res.data.code == 0) { | 2390 | if (res.data.code == 0) { |
2398 | - prom = res.data.data; | 2391 | + prom = res.data.data; |
2392 | + prom.price=prom.user_price; | ||
2399 | } | 2393 | } |
2400 | }) | 2394 | }) |
2401 | } | 2395 | } |
@@ -2420,16 +2414,53 @@ Page({ | @@ -2420,16 +2414,53 @@ Page({ | ||
2420 | //----------如果有活动,并且在进行中,就不计算线下库存--------------- | 2414 | //----------如果有活动,并且在进行中,就不计算线下库存--------------- |
2421 | var now = ut.gettimestamp(); | 2415 | var now = ut.gettimestamp(); |
2422 | if (prom) { | 2416 | if (prom) { |
2423 | - if (prom.is_end == 0 && prom.end_time > now && prom.start_time < now) { | 2417 | + |
2418 | + var t1=prom.start_time; | ||
2419 | + var prom_st=1; | ||
2420 | + if(prom.show_time){ | ||
2421 | + t1=prom.show_time; | ||
2422 | + if(prom.start_time>now) prom_st=0; | ||
2423 | + } | ||
2424 | + if (prom.is_end == 0 && prom.end_time > now && t1 < now) { | ||
2424 | th.setData({ | 2425 | th.setData({ |
2425 | prom_type: goodsinfo.prom_type, | 2426 | prom_type: goodsinfo.prom_type, |
2426 | prom_price: prom.price, | 2427 | prom_price: prom.price, |
2427 | prom_buy_limit: prom.buy_limit, | 2428 | prom_buy_limit: prom.buy_limit, |
2428 | prom_end_time: prom.end_time, | 2429 | prom_end_time: prom.end_time, |
2429 | prom_start_time: prom.start_time, | 2430 | prom_start_time: prom.start_time, |
2430 | - prom_st: 1, | 2431 | + prom_st: prom_st, |
2432 | + prom_act: prom, | ||
2433 | + prom_id:prom.id | ||
2431 | }) | 2434 | }) |
2432 | - return false; | 2435 | + |
2436 | + //却换图片 | ||
2437 | + th.init(goodsinfo.goods_id); | ||
2438 | + var newTime = ut.gettimestamp(); | ||
2439 | + var endTime2 = prom.end_time; | ||
2440 | + var endTime1 = prom.start_time; | ||
2441 | + | ||
2442 | + this.data.is_timer=0; | ||
2443 | + | ||
2444 | + setTimeout(function () { | ||
2445 | + th.data.is_timer=1; | ||
2446 | + if (endTime1 > newTime) { | ||
2447 | + th.setData({ | ||
2448 | + prom_time_text: '距秒杀开始还有' | ||
2449 | + }) | ||
2450 | + th.countDown(endTime1, 0); | ||
2451 | + } else { | ||
2452 | + if (endTime2 > newTime) { | ||
2453 | + th.setData({ | ||
2454 | + prom_time_text: '距秒杀结束还有', | ||
2455 | + prom_st: 1 | ||
2456 | + }) | ||
2457 | + th.countDown(endTime2); | ||
2458 | + } | ||
2459 | + } | ||
2460 | + | ||
2461 | + },1000) | ||
2462 | + | ||
2463 | + return false; | ||
2433 | } | 2464 | } |
2434 | } | 2465 | } |
2435 | //---设置普通商品--- | 2466 | //---设置普通商品--- |
@@ -2487,13 +2518,6 @@ Page({ | @@ -2487,13 +2518,6 @@ Page({ | ||
2487 | if (!th.data.def_pick_store && th.data.fir_def_store) { | 2518 | if (!th.data.def_pick_store && th.data.fir_def_store) { |
2488 | th.setData({ def_pick_store: th.data.fir_def_store }); | 2519 | th.setData({ def_pick_store: th.data.fir_def_store }); |
2489 | } | 2520 | } |
2490 | - | ||
2491 | - /*--最新的,不用这里筛选配送方式 | ||
2492 | - if(th.data.def_pick_store && g_distr_type!=0 && th.data.def_pick_store.distr_type!=0 && th.data.def_pick_store.distr_type!=g_distr_type ){ | ||
2493 | - th.setData({def_pick_store:null}); | ||
2494 | - }--*/ | ||
2495 | - | ||
2496 | - | ||
2497 | wx.showLoading({ | 2521 | wx.showLoading({ |
2498 | title: '加载中.' | 2522 | title: '加载中.' |
2499 | }); | 2523 | }); |
@@ -2859,9 +2883,7 @@ Page({ | @@ -2859,9 +2883,7 @@ Page({ | ||
2859 | 2883 | ||
2860 | //------隐藏取货门店2级---- | 2884 | //------隐藏取货门店2级---- |
2861 | hide_sec_mend: function () { | 2885 | hide_sec_mend: function () { |
2862 | - this.setData({ | ||
2863 | - is_sec_mend: 0, | ||
2864 | - }); | 2886 | + this.setData({ is_sec_mend: 0, }); |
2865 | }, | 2887 | }, |
2866 | 2888 | ||
2867 | //评论的调用 | 2889 | //评论的调用 |
@@ -2875,7 +2897,7 @@ Page({ | @@ -2875,7 +2897,7 @@ Page({ | ||
2875 | parent_id: 0, goods_id: th.data.gid, commenttype: tp, | 2897 | parent_id: 0, goods_id: th.data.gid, commenttype: tp, |
2876 | } | 2898 | } |
2877 | if (getApp().globalData.userInfo) { | 2899 | if (getApp().globalData.userInfo) { |
2878 | - req_where.userId = getApp().globalData.userInfo.user_id; | 2900 | + req_where.userId = getApp().globalData.user_id; |
2879 | } | 2901 | } |
2880 | 2902 | ||
2881 | var rs_data = null; | 2903 | var rs_data = null; |
@@ -2943,12 +2965,13 @@ Page({ | @@ -2943,12 +2965,13 @@ Page({ | ||
2943 | 2965 | ||
2944 | //--------检查是否活动,活动是否开始,或者是否结束------- | 2966 | //--------检查是否活动,活动是否开始,或者是否结束------- |
2945 | async check_prom(gid, prom_type, prom_id) { | 2967 | async check_prom(gid, prom_type, prom_id) { |
2946 | - var ee = this, | ||
2947 | - th = ee; | 2968 | + var ee = this,th = ee; |
2969 | + var user_id=getApp().globalData.user_id; | ||
2970 | + if(!user_id) user_id=0; | ||
2971 | + | ||
2948 | if (prom_type == 3 || prom_type == 0 || prom_type == 2 || prom_type == 5 || prom_type == 7) { | 2972 | if (prom_type == 3 || prom_type == 0 || prom_type == 2 || prom_type == 5 || prom_type == 7) { |
2949 | this.setData({ | 2973 | this.setData({ |
2950 | - prom_type: 0, | ||
2951 | - isshow: 1, | 2974 | + prom_type: 0,isshow: 1, |
2952 | }); | 2975 | }); |
2953 | return false; | 2976 | return false; |
2954 | } | 2977 | } |
@@ -2967,8 +2990,7 @@ Page({ | @@ -2967,8 +2990,7 @@ Page({ | ||
2967 | prom_r_null: 1 | 2990 | prom_r_null: 1 |
2968 | }); | 2991 | }); |
2969 | //拿取价格并且判断时间-- | 2992 | //拿取价格并且判断时间-- |
2970 | - getApp().request.get("/api/ms/flash_sale/get/" + | ||
2971 | - os.stoid + "/" + prom_id, { | 2993 | + getApp().request.get("/api/ms/flash_sale/getNew/" +os.stoid + "/" +user_id+"/"+ prom_id, { |
2972 | success: function (t) { | 2994 | success: function (t) { |
2973 | if (t.data.code != 0) { | 2995 | if (t.data.code != 0) { |
2974 | ee.setData({ | 2996 | ee.setData({ |
@@ -3015,7 +3037,7 @@ Page({ | @@ -3015,7 +3037,7 @@ Page({ | ||
3015 | var prom_start_time = ut.formatTime(t.data.data.start_time, "yyyy-MM-dd hh:mm:ss"); | 3037 | var prom_start_time = ut.formatTime(t.data.data.start_time, "yyyy-MM-dd hh:mm:ss"); |
3016 | 3038 | ||
3017 | ee.setData({ | 3039 | ee.setData({ |
3018 | - prom_price: t.data.data.price, | 3040 | + prom_price: t.data.data.user_price, |
3019 | prom_type: 1, | 3041 | prom_type: 1, |
3020 | prom_id: prom_id, | 3042 | prom_id: prom_id, |
3021 | prom_buy_limit: t.data.data.buy_limit, | 3043 | prom_buy_limit: t.data.data.buy_limit, |
@@ -3026,17 +3048,9 @@ Page({ | @@ -3026,17 +3048,9 @@ Page({ | ||
3026 | }); | 3048 | }); |
3027 | 3049 | ||
3028 | ee.get_sto(); | 3050 | ee.get_sto(); |
3029 | - | ||
3030 | - | ||
3031 | var newTime = ut.gettimestamp(); | 3051 | var newTime = ut.gettimestamp(); |
3032 | var endTime2 = t.data.data.end_time; | 3052 | var endTime2 = t.data.data.end_time; |
3033 | var endTime1 = t.data.data.start_time; | 3053 | var endTime1 = t.data.data.start_time; |
3034 | - | ||
3035 | - //---苹果机不兼容--- | ||
3036 | - /*---- | ||
3037 | - var endTime2 = new Date(prom_end_time).getTime(); | ||
3038 | - var endTime1 = new Date(prom_start_time).getTime();----*/ | ||
3039 | - | ||
3040 | if (endTime1 > newTime) { | 3054 | if (endTime1 > newTime) { |
3041 | ee.setData({ | 3055 | ee.setData({ |
3042 | prom_time_text: '距秒杀开始还有' | 3056 | prom_time_text: '距秒杀开始还有' |
@@ -3051,6 +3065,56 @@ Page({ | @@ -3051,6 +3065,56 @@ Page({ | ||
3051 | ee.countDown(endTime2); | 3065 | ee.countDown(endTime2); |
3052 | } | 3066 | } |
3053 | } | 3067 | } |
3068 | + | ||
3069 | + //如果是进行中的话 | ||
3070 | + if (endTime1 < newTime) { | ||
3071 | + //-- 获取秒杀活动的多少规格 -- | ||
3072 | + ee.get_more_flahs(function (list) { | ||
3073 | + if (list && list.length > 1) { | ||
3074 | + | ||
3075 | + var n_item = list[0]; | ||
3076 | + var ind = list.findIndex(function (ele) { | ||
3077 | + return ele.goods_id == ee.data.data.goods_id; | ||
3078 | + }) | ||
3079 | + if (ind < 0) return false; | ||
3080 | + if (ind > 0) { | ||
3081 | + n_item = JSON.parse(JSON.stringify(list[ind])); | ||
3082 | + list.splice(ind, 1); | ||
3083 | + list.unshift(n_item); | ||
3084 | + } | ||
3085 | + | ||
3086 | + ee.data.sele_g.viplimited = n_item.viplimited; | ||
3087 | + ee.data.data.viplimited = n_item.viplimited; | ||
3088 | + | ||
3089 | + var gb = 1; | ||
3090 | + //-- 显示多规格 -- | ||
3091 | + for (let i in list) { | ||
3092 | + let item = list[i]; | ||
3093 | + var gg = ""; | ||
3094 | + if (item.goods_spec == "null" || item.goods_spec == null) item.goods_spec = ""; | ||
3095 | + if (item.goods_color == "null" || item.goods_color == null) item.goods_color = ""; | ||
3096 | + | ||
3097 | + if (item.goods_spec != "" && item.goods_color != "") { | ||
3098 | + gg = item.goods_spec + "/" + item.goods_color; | ||
3099 | + } else if (item.goods_spec != "" || item.goods_color != "") { | ||
3100 | + gg = item.goods_spec + item.goods_color; | ||
3101 | + } else { | ||
3102 | + gg = "规格" + gb; | ||
3103 | + gb++; | ||
3104 | + } | ||
3105 | + item.gg = gg; | ||
3106 | + item.prom_id = item.prom_id; | ||
3107 | + item.prom_type = 1; | ||
3108 | + } | ||
3109 | + | ||
3110 | + ee.setData({ | ||
3111 | + sku_g: list, | ||
3112 | + }); | ||
3113 | + | ||
3114 | + } | ||
3115 | + }) | ||
3116 | + } | ||
3117 | + | ||
3054 | } | 3118 | } |
3055 | }); | 3119 | }); |
3056 | } | 3120 | } |
@@ -3106,7 +3170,6 @@ Page({ | @@ -3106,7 +3170,6 @@ Page({ | ||
3106 | 3170 | ||
3107 | } | 3171 | } |
3108 | 3172 | ||
3109 | - | ||
3110 | //---判断拼单---- | 3173 | //---判断拼单---- |
3111 | if (prom_type == 6) { | 3174 | if (prom_type == 6) { |
3112 | //-------判断活动是否抢光--------- | 3175 | //-------判断活动是否抢光--------- |
@@ -4128,9 +4191,7 @@ Page({ | @@ -4128,9 +4191,7 @@ Page({ | ||
4128 | } | 4191 | } |
4129 | 4192 | ||
4130 | if (this.data.share_hidden) { | 4193 | if (this.data.share_hidden) { |
4131 | - this.setData({ | ||
4132 | - share_hidden: false, | ||
4133 | - }); | 4194 | + this.setData({ share_hidden: false,}); |
4134 | }; | 4195 | }; |
4135 | 4196 | ||
4136 | //类型 0普通商品 1秒杀商品 2商家和会员团 3阶梯团 4阶梯团 | 4197 | //类型 0普通商品 1秒杀商品 2商家和会员团 3阶梯团 4阶梯团 |
@@ -4138,11 +4199,8 @@ Page({ | @@ -4138,11 +4199,8 @@ Page({ | ||
4138 | if (type == 6) type = 2; | 4199 | if (type == 6) type = 2; |
4139 | if (this.data.prom_act && this.data.prom_act.kttype == 3) type = 3; | 4200 | if (this.data.prom_act && this.data.prom_act.kttype == 3) type = 3; |
4140 | 4201 | ||
4141 | - wx.showLoading({ | ||
4142 | - title: '生成中...', | ||
4143 | - }) | ||
4144 | - var that = this, | ||
4145 | - th = that; | 4202 | + wx.showLoading({ title: '生成中...',}) |
4203 | + var that = this, th = that; | ||
4146 | //设置画板显示,才能开始绘图 | 4204 | //设置画板显示,才能开始绘图 |
4147 | that.setData({ | 4205 | that.setData({ |
4148 | canvasHidden: false | 4206 | canvasHidden: false |
@@ -4152,6 +4210,10 @@ Page({ | @@ -4152,6 +4210,10 @@ Page({ | ||
4152 | var unit = that.data.screenWidth / 750 * 1.35; //基础单位, | 4210 | var unit = that.data.screenWidth / 750 * 1.35; //基础单位, |
4153 | var path2 = that.data.data.original_img; | 4211 | var path2 = that.data.data.original_img; |
4154 | var scene = th.data.gid + ""; | 4212 | var scene = th.data.gid + ""; |
4213 | + | ||
4214 | + if(th.data.sele_g.prom_type==1){ | ||
4215 | + scene+="."+th.data.sele_g.prom_type+"."+th.data.sele_g.prom_id; | ||
4216 | + } | ||
4155 | var user_id = getApp().globalData.user_id ? getApp().globalData.user_id : 0; | 4217 | var user_id = getApp().globalData.user_id ? getApp().globalData.user_id : 0; |
4156 | if (user_id > 0) { | 4218 | if (user_id > 0) { |
4157 | scene += "_" + user_id; | 4219 | scene += "_" + user_id; |
@@ -5540,9 +5602,6 @@ Page({ | @@ -5540,9 +5602,6 @@ Page({ | ||
5540 | this.add_cart_func_inte(t); | 5602 | this.add_cart_func_inte(t); |
5541 | }, | 5603 | }, |
5542 | 5604 | ||
5543 | - | ||
5544 | - | ||
5545 | - | ||
5546 | onShareTimeline() { | 5605 | onShareTimeline() { |
5547 | var store_name = getApp().globalData.config ? getApp().globalData.config.store_name : ''; | 5606 | var store_name = getApp().globalData.config ? getApp().globalData.config.store_name : ''; |
5548 | if (!store_name) | 5607 | if (!store_name) |
@@ -5602,7 +5661,7 @@ Page({ | @@ -5602,7 +5661,7 @@ Page({ | ||
5602 | check_zh_acting: function (func) { | 5661 | check_zh_acting: function (func) { |
5603 | var isok = 1, item = this.data.sele_g; | 5662 | var isok = 1, item = this.data.sele_g; |
5604 | //如果有组合购 | 5663 | //如果有组合购 |
5605 | - var url = "/api/weshop/prom/zhbuy/get/" + os.stoid + "/" + item.prom_id + "/" + getApp().globalData.userInfo.user_id; | 5664 | + var url = "/api/weshop/prom/zhbuy/get/" + os.stoid + "/" + item.prom_id + "/" + getApp().globalData.user_id; |
5606 | getApp().request.promiseGet(url, {}).then(res => { | 5665 | getApp().request.promiseGet(url, {}).then(res => { |
5607 | if (res.data.code == 0 && res.data.data) { | 5666 | if (res.data.code == 0 && res.data.data) { |
5608 | if (res.data.data.is_show != 1) { | 5667 | if (res.data.data.is_show != 1) { |
@@ -5628,5 +5687,76 @@ Page({ | @@ -5628,5 +5687,76 @@ Page({ | ||
5628 | item.act = res.data.data; | 5687 | item.act = res.data.data; |
5629 | func(isok); | 5688 | func(isok); |
5630 | }) | 5689 | }) |
5631 | - } | 5690 | + }, |
5691 | + | ||
5692 | + //获取更多秒杀 | ||
5693 | + get_more_flahs: async function (func) { | ||
5694 | + var f_more=false; | ||
5695 | + var user_id=getApp().globalData.user_id; | ||
5696 | + if(!user_id) user_id=0; | ||
5697 | + | ||
5698 | + var url="/api/weshop/goods/listSkuFlash?store_id="+os.stoid+"&goods_id="+this.data.data.goods_id+"&user_id="+user_id; | ||
5699 | + //获取秒杀的多规格 | ||
5700 | + await getApp().request.promiseGet(url, {}).then(res=>{ | ||
5701 | + if(res.data.code==0 && res.data.data && res.data.data.length>0){ | ||
5702 | + f_more=res.data.data; | ||
5703 | + } | ||
5704 | + }) | ||
5705 | + if(!f_more) { | ||
5706 | + func(false); | ||
5707 | + return false; | ||
5708 | + } | ||
5709 | + //-- 秒杀的价格要更新 -- | ||
5710 | + for(let i in f_more){ | ||
5711 | + | ||
5712 | + let item=f_more[i]; | ||
5713 | + f_more[i].prom_id=item.act_id; | ||
5714 | + f_more[i].prom_type=1; | ||
5715 | + if(item.goods_id==this.data.data.goods_id){ | ||
5716 | + continue; | ||
5717 | + } | ||
5718 | + var url="/api/ms/flash_sale/getNew/"+os.stoid+"/"+user_id+"/"+item.act_id; | ||
5719 | + await getApp().request.promiseGet(url, {}).then(rs=>{ | ||
5720 | + if(rs.data.code==0){ | ||
5721 | + f_more[i].price=rs.data.data.user_price; | ||
5722 | + | ||
5723 | + } | ||
5724 | + }) | ||
5725 | + } | ||
5726 | + func(f_more); | ||
5727 | + | ||
5728 | + }, | ||
5729 | + | ||
5730 | + //-- 判断是否有秒杀 -- | ||
5731 | + check_has_flash:function () { | ||
5732 | + var th=this; | ||
5733 | + var url="/api/weshop/activitylist/getGoodActInfo"; | ||
5734 | + var req_data={ | ||
5735 | + store_id:os.stoid,goodsidlist:this.data.data.goods_id,is_detail:1 | ||
5736 | + }; | ||
5737 | + //获取秒杀的多规格 | ||
5738 | + getApp().request.promiseGet(url, {data:req_data}).then(res=>{ | ||
5739 | + if(res.data.code==0 && res.data.data){ | ||
5740 | + th.setData({more_flash:res.data.data}); | ||
5741 | + }else{ | ||
5742 | + func(false); | ||
5743 | + } | ||
5744 | + }) | ||
5745 | + }, | ||
5746 | + | ||
5747 | + //-- 跳转到秒杀商品详情页 -- | ||
5748 | + go_more_flash:function (e) { | ||
5749 | + var prom_id=e.currentTarget.dataset.id; | ||
5750 | + var goods_id=this.data.data.goods_id; | ||
5751 | + var url="/pages/goods/goodsInfo/goodsInfo?goods_id="+goods_id+"&prom_id="+prom_id+"&prom_type=1"; | ||
5752 | + getApp().goto(url); | ||
5753 | + }, | ||
5754 | + | ||
5755 | + close_pop_more:function () { | ||
5756 | + this.setData({is_pop_more:0}) | ||
5757 | + } | ||
5758 | + | ||
5759 | + | ||
5760 | + | ||
5761 | + | ||
5632 | }); | 5762 | }); |
pages/goods/goodsInfo/goodsInfo.wxml
@@ -7,16 +7,11 @@ | @@ -7,16 +7,11 @@ | ||
7 | <view class="container"> | 7 | <view class="container"> |
8 | <view class="type-navbar"> | 8 | <view class="type-navbar"> |
9 | <view class="type-box" wx:for="{{categories}}" wx:key="categories"> | 9 | <view class="type-box" wx:for="{{categories}}" wx:key="categories"> |
10 | - <view bindtap="tabClick" class="type-navbar-item {{activeCategoryId==item.id?'type-item-on':''}}" id="{{item.id}}"> | ||
11 | - {{item.name}} | ||
12 | - </view> | 10 | + <view bindtap="tabClick" class="type-navbar-item {{activeCategoryId==item.id?'type-item-on':''}}" id="{{item.id}}">{{item.name}}</view> |
13 | </view> | 11 | </view> |
14 | </view> | 12 | </view> |
15 | <view class="goods-detail"> | 13 | <view class="goods-detail"> |
16 | <view class="goods-info" hidden="{{activeCategoryId==0?false:true}}"> | 14 | <view class="goods-info" hidden="{{activeCategoryId==0?false:true}}"> |
17 | - <!-- 视频 --> | ||
18 | - <!-- <swiper bindchange="swiperChange"class="xc-pictures swiperContainer rel" current="{{swiperCurrent}}" | ||
19 | - indicator-dots="{{indicatorDots}}" autoplay="{{autoplay}}" interval="{{interval}}" duration="{{duration}}"> --> | ||
20 | <view id="id" bindtouchstart="handletouchtart" bindtouchmove="handletouchmove"> | 15 | <view id="id" bindtouchstart="handletouchtart" bindtouchmove="handletouchmove"> |
21 | <view class="xc-videos-picture rel"> | 16 | <view class="xc-videos-picture rel"> |
22 | <swiper autoplay="{{false}}" current="{{swiperCurrent}}" class="swiper_box swiperContainer rel" duration="{{1000}}" indicatorDots="{{mapurl?false:true}}" interval="{{3000}}" vertical="{{false}}" bindchange="swiperChange"> | 17 | <swiper autoplay="{{false}}" current="{{swiperCurrent}}" class="swiper_box swiperContainer rel" duration="{{1000}}" indicatorDots="{{mapurl?false:true}}" interval="{{3000}}" vertical="{{false}}" bindchange="swiperChange"> |
@@ -31,7 +26,6 @@ | @@ -31,7 +26,6 @@ | ||
31 | </view> | 26 | </view> |
32 | </swiper-item> | 27 | </swiper-item> |
33 | <swiper-item wx:for="{{gallery}}" wx:key="gallery"> | 28 | <swiper-item wx:for="{{gallery}}" wx:key="gallery"> |
34 | - <!-- <image class="wh100" src="{{item.image_url}}" mode="aspectFit" binderror="bind_bnerr" lazy-load="true" data-errorimg="gallery[{{index}}].image_url"></image> --> | ||
35 | <view class="wh100 g_img_box" style="background-image:url({{item.image_url}});"></view> | 29 | <view class="wh100 g_img_box" style="background-image:url({{item.image_url}});"></view> |
36 | </swiper-item> | 30 | </swiper-item> |
37 | </swiper> | 31 | </swiper> |
@@ -361,8 +355,8 @@ | @@ -361,8 +355,8 @@ | ||
361 | </view> | 355 | </view> |
362 | </view> | 356 | </view> |
363 | <view class="goods-num" wx:if="{{prom_type!=1}}"> | 357 | <view class="goods-num" wx:if="{{prom_type!=1}}"> |
364 | - <view class="sales">销量:{{data.sales_sum}}件</view> | ||
365 | - <view class="stock">折扣:{{data.disc}}折</view> | 358 | + <view class="sales">销量:{{sele_g.sales_sum}}件</view> |
359 | + <view class="stock">折扣:{{sele_g.disc}}折</view> | ||
366 | <view class="stock">{{categories3[0].num}}人评价</view> | 360 | <view class="stock">{{categories3[0].num}}人评价</view> |
367 | </view> | 361 | </view> |
368 | <view wx:if="{{prom_type==1}}"> | 362 | <view wx:if="{{prom_type==1}}"> |
@@ -390,7 +384,7 @@ | @@ -390,7 +384,7 @@ | ||
390 | </view> | 384 | </view> |
391 | </view> | 385 | </view> |
392 | <view class="xc-explain fs32 ellipsis-2" wx:if="{{prom_type!=0 && prom_type!=4}}"> | 386 | <view class="xc-explain fs32 ellipsis-2" wx:if="{{prom_type!=0 && prom_type!=4}}"> |
393 | - {{data.goods_name}} | 387 | + {{sele_g.goods_name}} |
394 | </view> | 388 | </view> |
395 | <!-- <view wx:if="{{prom_type==1}}" style='height:58rpx'></view> --> | 389 | <!-- <view wx:if="{{prom_type==1}}" style='height:58rpx'></view> --> |
396 | <!-- 许程 7.24 暂时注释 --> | 390 | <!-- 许程 7.24 暂时注释 --> |
@@ -398,7 +392,9 @@ | @@ -398,7 +392,9 @@ | ||
398 | <view class="goods-num" wx:if="{{prom_type==1}}"> | 392 | <view class="goods-num" wx:if="{{prom_type==1}}"> |
399 | <block wx:if="prom_st>0"> | 393 | <block wx:if="prom_st>0"> |
400 | <view class="stock">总数量:{{prom_act.goods_num+prom_act.virtual}}件</view> | 394 | <view class="stock">总数量:{{prom_act.goods_num+prom_act.virtual}}件</view> |
401 | - <view class="stock">限购:{{prom_act.buy_limit}}件</view> | 395 | + <view class="stock" wx:if="{{prom_act.buy_limit>0}}">限购:{{prom_act.buy_limit}}件</view> |
396 | + <view class="stock" wx:else>限购:不限</view> | ||
397 | + | ||
402 | <block wx:if="{{prom_st==0}}"> | 398 | <block wx:if="{{prom_st==0}}"> |
403 | <view class="sales">已购:0件</view> | 399 | <view class="sales">已购:0件</view> |
404 | </block> | 400 | </block> |
@@ -408,7 +404,8 @@ | @@ -408,7 +404,8 @@ | ||
408 | </block> | 404 | </block> |
409 | <block wx:else> | 405 | <block wx:else> |
410 | <view class="stock">总数量:{{prom_act.goods_num}}件</view> | 406 | <view class="stock">总数量:{{prom_act.goods_num}}件</view> |
411 | - <view class="stock">限购:{{prom_act.buy_limit}}件</view> | 407 | + <view class="stock" wx:if="{{prom_act.buy_limit>0}}">限购:{{prom_act.buy_limit}}件</view> |
408 | + <view class="stock" wx:else>限购:不限</view> | ||
412 | <view class="sales">已购:{{prom_act.buy_num}}件</view> | 409 | <view class="sales">已购:{{prom_act.buy_num}}件</view> |
413 | </block> | 410 | </block> |
414 | </view> | 411 | </view> |
@@ -538,6 +535,29 @@ | @@ -538,6 +535,29 @@ | ||
538 | </view> | 535 | </view> |
539 | </view> | 536 | </view> |
540 | </block> | 537 | </block> |
538 | + <!-- 判断是不是有秒杀 --> | ||
539 | + <block wx:if="{{more_flash}}"> | ||
540 | + | ||
541 | + <block wx:for="{{more_flash}}"> | ||
542 | + | ||
543 | + <view class="cx-frame flex" style="position: relative; height: auto" wx:if="{{item.prom_type==1}}" > | ||
544 | + <view class="cx-sizs wsize" style="width: 144rpx">秒杀</view> | ||
545 | + <!-- 中间显示层 --> | ||
546 | + <view class="flex ai-center jc_sb" style="width: 570rpx" bindtap="go_more_flash" data-id="{{item.act_id}}"> | ||
547 | + <view class="flex"> | ||
548 | + <view class="miao_lab">秒</view> | ||
549 | + <view class="order_hui"> | ||
550 | + <view class="fs28 ellipsis-1">{{item.act_name}}</view> | ||
551 | + <view class="fs26"> | ||
552 | + (活动时间:{{tool.format_tt(item.s_time)}} - {{tool.format_tt(item.e_time)}}) | ||
553 | + </view> | ||
554 | + </view> | ||
555 | + </view> | ||
556 | + <view><text class="bg_jj is_more_cx" style="position: relative;top:-10rpx"></text></view> | ||
557 | + </view> | ||
558 | + </view> | ||
559 | + </block> | ||
560 | + </block> | ||
541 | <view class="bz_view flex bdt16" wx:if="{{bconfig}}" style=""> | 561 | <view class="bz_view flex bdt16" wx:if="{{bconfig}}" style=""> |
542 | <image class="bzfu_img" src="{{iurl}}/miniapp/images/bzfu_w.png"></image> | 562 | <image class="bzfu_img" src="{{iurl}}/miniapp/images/bzfu_w.png"></image> |
543 | <view class="flex f1 ai_c rel"> | 563 | <view class="flex f1 ai_c rel"> |
@@ -629,13 +649,6 @@ | @@ -629,13 +649,6 @@ | ||
629 | </view> | 649 | </view> |
630 | <!-- 图文详情 --> | 650 | <!-- 图文详情 --> |
631 | <view class="bdt16"> | 651 | <view class="bdt16"> |
632 | - <!-- <view class="tuwen_title"> | ||
633 | - <view class="g_line"></view> | ||
634 | - <view class="center_s"> | ||
635 | - <image src="{{iurl}}/miniapp/images/tuwen_c.png"></image> | ||
636 | - <text>详情</text> | ||
637 | - </view> | ||
638 | - </view> --> | ||
639 | <view class="t_g_info"> | 652 | <view class="t_g_info"> |
640 | <view class="red_shu"></view> | 653 | <view class="red_shu"></view> |
641 | <view class="fs30 bold">商品详情</view> | 654 | <view class="fs30 bold">商品详情</view> |
@@ -1518,4 +1531,27 @@ | @@ -1518,4 +1531,27 @@ | ||
1518 | </view> | 1531 | </view> |
1519 | </view> | 1532 | </view> |
1520 | </view> | 1533 | </view> |
1521 | -</view> | ||
1522 | \ No newline at end of file | 1534 | \ No newline at end of file |
1535 | +</view> | ||
1536 | + | ||
1537 | +<!-- 商品要加入购物车 --> | ||
1538 | +<view class="pop_more_act" wx:if="{{is_pop_more}}"> | ||
1539 | + <view class="cover-layer" bindtap="close_pop_more"></view> | ||
1540 | + <view class="content"> | ||
1541 | + <view class="main pd20"> | ||
1542 | + <view class="t-c fs36" style="color: #c3172d">提示</view> | ||
1543 | + | ||
1544 | + <block wx:for="{{more_flash}}"> | ||
1545 | + <view bindtap="go_more_flash" data-id="{{item.act_id}}" class="flex jc_sb fs28 mt20" wx:if="{{item.prom_type==1}}"> | ||
1546 | + <view class="ellipsis-2" style="max-width: 80%">该商品有参与{{item.act_name}} {{tool.act_type(item.prom_type)}} 活动</view> | ||
1547 | + <view class="fs26 c-7b">去参与 | ||
1548 | + <text class="bg_jj is_more_cx"></text> | ||
1549 | + </view> | ||
1550 | + </view> | ||
1551 | + </block> | ||
1552 | + | ||
1553 | + <view style="margin-top: 30rpx" bindtap="open_next"> | ||
1554 | + <button class="p_btn">继续加入购物车</button> | ||
1555 | + </view> | ||
1556 | + </view> | ||
1557 | + </view> | ||
1558 | +</view> |
pages/goods/goodsInfo/goodsInfo.wxss
@@ -2842,4 +2842,20 @@ button.custom-service::after{ | @@ -2842,4 +2842,20 @@ button.custom-service::after{ | ||
2842 | width: 132rpx; | 2842 | width: 132rpx; |
2843 | height: 37rpx; | 2843 | height: 37rpx; |
2844 | margin-right: 10rpx; | 2844 | margin-right: 10rpx; |
2845 | -} | ||
2846 | \ No newline at end of file | 2845 | \ No newline at end of file |
2846 | +} | ||
2847 | + | ||
2848 | +.miao_lab{ width: 36rpx; height: 36rpx; border: 4rpx solid #e71f19; color:#e71f19; text-align: center;margin-right: 10rpx; | ||
2849 | + line-height: 36rpx;font-size: 22rpx; font-weight: bolder; border-radius: 50%; } | ||
2850 | + | ||
2851 | +.pop_more_act .content{ | ||
2852 | + position:fixed;background: #fff; width: 100%; | ||
2853 | + left: 0;bottom: 0;z-index: 1000; | ||
2854 | +} | ||
2855 | + | ||
2856 | +.p_btn{ | ||
2857 | + background-color: #f23030; | ||
2858 | + height: 70rpx;line-height: 70rpx; | ||
2859 | + color: #fff; | ||
2860 | +} | ||
2861 | + | ||
2862 | +.mt20{ margin-top: 20rpx} | ||
2847 | \ No newline at end of file | 2863 | \ No newline at end of file |
pages/goods/goodsList/g_filter.wxs
@@ -81,12 +81,13 @@ var g_filters = { | @@ -81,12 +81,13 @@ var g_filters = { | ||
81 | }, | 81 | }, |
82 | //跳转的接口 | 82 | //跳转的接口 |
83 | get_goods_url:function(item){ | 83 | get_goods_url:function(item){ |
84 | - | ||
85 | - console.log(item,111) | ||
86 | var url1="/pages/goods/goodsInfo/goodsInfo?goods_id="+item.goods_id | 84 | var url1="/pages/goods/goodsInfo/goodsInfo?goods_id="+item.goods_id |
87 | if(item.prom_type==8){ | 85 | if(item.prom_type==8){ |
88 | - url1="/packageC/pages/presell/goodsInfo/goodsInfo?goods_id="+item.goods_id+"&prom_id="+item.prom_id | ||
89 | - } | 86 | + url1="/packageC/pages/presell/goodsInfo/goodsInfo?goods_id="+item.goods_id+"&prom_id="+item.prom_id |
87 | + } | ||
88 | + if(item.prom_type==1){ | ||
89 | + url1="/pages/goods/goodsInfo/goodsInfo?goods_id="+item.goods_id+"&prom_id="+item.prom_id+"&prom_type=1"; | ||
90 | + } | ||
90 | return url1; | 91 | return url1; |
91 | } | 92 | } |
92 | } | 93 | } |
pages/goods/search/g_filter.wxs
@@ -83,11 +83,14 @@ var g_filters = { | @@ -83,11 +83,14 @@ var g_filters = { | ||
83 | 83 | ||
84 | 84 | ||
85 | get_goods_url:function(item){ | 85 | get_goods_url:function(item){ |
86 | - console.log(item,111) | 86 | + |
87 | var url1="/pages/goods/goodsInfo/goodsInfo?goods_id="+item.goods_id | 87 | var url1="/pages/goods/goodsInfo/goodsInfo?goods_id="+item.goods_id |
88 | if(item.prom_type==8){ | 88 | if(item.prom_type==8){ |
89 | url1="/packageC/pages/presell/goodsInfo/goodsInfo?goods_id="+item.goods_id+"&prom_id="+item.prom_id | 89 | url1="/packageC/pages/presell/goodsInfo/goodsInfo?goods_id="+item.goods_id+"&prom_id="+item.prom_id |
90 | } | 90 | } |
91 | + if(item.prom_type==1){ | ||
92 | + url1="/pages/goods/goodsInfo/goodsInfo?goods_id="+item.goods_id+"&prom_id="+item.prom_id+"&prom_type=1"; | ||
93 | + } | ||
91 | return url1; | 94 | return url1; |
92 | } | 95 | } |
93 | } | 96 | } |
pages/index/index/index.js
@@ -335,6 +335,49 @@ Page({ | @@ -335,6 +335,49 @@ Page({ | ||
335 | }) | 335 | }) |
336 | 336 | ||
337 | 337 | ||
338 | + //-----秒杀----- | ||
339 | + var flash_data = null; | ||
340 | + var f_req={ | ||
341 | + store_id: os.stoid, | ||
342 | + timetype: 2, | ||
343 | + is_end: 0, | ||
344 | + is_show: 1, | ||
345 | + pageSize: 9, | ||
346 | + user_id:0 | ||
347 | + }; | ||
348 | + if(user_id) f_req.user_id=user_id; | ||
349 | + //--获取活动-- | ||
350 | + await getApp().request.promiseGet("/api/ms/flash_sale/spikepage", { | ||
351 | + data:f_req , | ||
352 | + }).then(res => { | ||
353 | + var e = res; | ||
354 | + if (e.data.code == 0) { | ||
355 | + flash_data = e.data.data.pageData; | ||
356 | + if (flash_data == null || flash_data.length <= 0) return false; | ||
357 | + | ||
358 | + //当前时间戳 | ||
359 | + var nt = ut.gettimestamp(); | ||
360 | + | ||
361 | + flash_data.forEach(function (val, ind) { | ||
362 | + | ||
363 | + if(val.user_price) val.price=val.user_price; | ||
364 | + if (val.start_time > nt) flash_data[ind].status = 0; | ||
365 | + else if (val.end_time > nt) flash_data[ind].status = 1; | ||
366 | + if (val.buy_num >= val.goods_num) flash_data[ind].status = 2; | ||
367 | + }); | ||
368 | + | ||
369 | + var arr = new Array(); | ||
370 | + //--三个三个一组--- | ||
371 | + for (var i = 0; i < flash_data.length; i += 3) { | ||
372 | + arr.push(flash_data.slice(i, i + 3)); | ||
373 | + } | ||
374 | + th.setData({ | ||
375 | + saleGoods: arr | ||
376 | + }); | ||
377 | + } | ||
378 | + }); | ||
379 | + | ||
380 | + | ||
338 | 381 | ||
339 | //优惠券要实时更新 | 382 | //优惠券要实时更新 |
340 | getApp().getConfig2(function (e) { | 383 | getApp().getConfig2(function (e) { |
@@ -458,45 +501,6 @@ Page({ | @@ -458,45 +501,6 @@ Page({ | ||
458 | } | 501 | } |
459 | }) | 502 | }) |
460 | 503 | ||
461 | - //-----秒杀----- | ||
462 | - var flash_data = null; | ||
463 | - //--获取活动-- | ||
464 | - await getApp().request.promiseGet("/api/ms/flash_sale/spikepage", { | ||
465 | - data: { | ||
466 | - store_id: os.stoid, | ||
467 | - timetype: 2, | ||
468 | - is_end: 0, | ||
469 | - is_show: 1, | ||
470 | - pageSize: 9 | ||
471 | - }, | ||
472 | - }).then(res => { | ||
473 | - var e = res; | ||
474 | - if (e.data.code == 0) { | ||
475 | - flash_data = e.data.data.pageData; | ||
476 | - if (flash_data == null || flash_data.length <= 0) return false; | ||
477 | - | ||
478 | - //当前时间戳 | ||
479 | - var nt = ut.gettimestamp(); | ||
480 | - | ||
481 | - flash_data.forEach(function (val, ind) { | ||
482 | - if (val.start_time > nt) flash_data[ind].status = 0; | ||
483 | - else if (val.end_time > nt) flash_data[ind].status = 1; | ||
484 | - if (val.buy_num >= val.goods_num) flash_data[ind].status = 2; | ||
485 | - }); | ||
486 | - | ||
487 | - var arr = new Array(); | ||
488 | - //--三个三个一组--- | ||
489 | - for (var i = 0; i < flash_data.length; i += 3) { | ||
490 | - arr.push(flash_data.slice(i, i + 3)); | ||
491 | - } | ||
492 | - th.setData({ | ||
493 | - saleGoods: arr | ||
494 | - }); | ||
495 | - //th.countDown(); | ||
496 | - } | ||
497 | - }); | ||
498 | - | ||
499 | - | ||
500 | //----拼单----- | 504 | //----拼单----- |
501 | await getApp().request.promiseGet("/api/weshop/teamlist/pageteam/2", { | 505 | await getApp().request.promiseGet("/api/weshop/teamlist/pageteam/2", { |
502 | data: { | 506 | data: { |
pages/index/index/index.wxml
@@ -153,9 +153,9 @@ | @@ -153,9 +153,9 @@ | ||
153 | </view> | 153 | </view> |
154 | </navigator> | 154 | </navigator> |
155 | <view class="seckill-list"> | 155 | <view class="seckill-list"> |
156 | - <swiper class="s_prom" indicator-dots="{{false}}" bindchange="flashSwiperChange" next-margin="105rpx"> | ||
157 | - <swiper-item wx:for="{{saleGoods}}" wx:key="{{index}}" class="p_swiper" wx:key="saleGoods" style="750rpx !important;"> | ||
158 | - <navigator class="nav" hover-class="none" url="/pages/goods/goodsInfo/goodsInfo?goods_id={{aitem.goods_id}}&title={{aitem.goods_name}}" wx:for="{{item}}" wx:key="item" wx:for-item="aitem" wx:for-index="aind"> | 156 | + <swiper class="s_prom" indicator-dots="{{false}}" bindchange="flashSwiperChange"> |
157 | + <swiper-item wx:for="{{saleGoods}}" wx:key="{{index}}" class="p_swiper" wx:key="saleGoods" style="740rpx !important;padding: 0; margin-left: 10rpx"> | ||
158 | + <navigator style="flex-shrink: 0;width: 247rpx" class="nav" hover-class="none" url="/pages/goods/goodsInfo/goodsInfo?goods_id={{aitem.goods_id}}&title={{aitem.goods_name}}&prom_type=1&prom_id={{aitem.id}}" wx:for="{{item}}" wx:key="item" wx:for-item="aitem" wx:for-index="aind"> | ||
159 | <view class="imgview "> | 159 | <view class="imgview "> |
160 | <image src="{{url+aitem.original_img}}" mode="aspectFill" lazy-load="true" data-errorimg="saleGoods[{{index}}][{{aind}}].original_img" binderror="bind_bnerr3" data-img="{{aitem.original_img}}"></image> | 160 | <image src="{{url+aitem.original_img}}" mode="aspectFill" lazy-load="true" data-errorimg="saleGoods[{{index}}][{{aind}}].original_img" binderror="bind_bnerr3" data-img="{{aitem.original_img}}"></image> |
161 | 161 | ||
@@ -163,7 +163,7 @@ | @@ -163,7 +163,7 @@ | ||
163 | <image wx:if="{{aitem.status==1}}" class="status_img" src="{{url}}/miniapp/images/miao/going.png"></image> | 163 | <image wx:if="{{aitem.status==1}}" class="status_img" src="{{url}}/miniapp/images/miao/going.png"></image> |
164 | <image wx:if="{{aitem.status==2}}" class="status_img" src="{{url}}/miniapp/images/miao/mend.png"></image> | 164 | <image wx:if="{{aitem.status==2}}" class="status_img" src="{{url}}/miniapp/images/miao/mend.png"></image> |
165 | </view> | 165 | </view> |
166 | - <view class="ellipsis-2 mar-top10" style="height: 70rpx;">{{aitem.title}}</view> | 166 | + <view class="ellipsis-2 mar-top10" style="height: 76rpx;">{{aitem.goods_name}}</view> |
167 | <!-- <view class="red-co mar-top10 is_seckill_height"> --> | 167 | <!-- <view class="red-co mar-top10 is_seckill_height"> --> |
168 | <view class="co-red mar-top10"> | 168 | <view class="co-red mar-top10"> |
169 | <text class="fs20">¥</text>{{aitem.price}} | 169 | <text class="fs20">¥</text>{{aitem.price}} |
pages/user/index/index.js
@@ -237,8 +237,26 @@ Page({ | @@ -237,8 +237,26 @@ Page({ | ||
237 | }); | 237 | }); |
238 | } | 238 | } |
239 | } | 239 | } |
240 | - }) | ||
241 | - | 240 | + }); |
241 | + | ||
242 | + /*-----物流信息提醒-----*/ | ||
243 | + rq.get('/api/weshop/order/countDadaOrder', { | ||
244 | + isShowLoading:0, | ||
245 | + data: { | ||
246 | + user_id: e.user_id, | ||
247 | + store_id: os.stoid, | ||
248 | + }, | ||
249 | + success: function(su) { | ||
250 | + if (su.data.code == 0) { | ||
251 | + th.setData({ | ||
252 | + countDadaOrder: su.data.data | ||
253 | + }); | ||
254 | + } | ||
255 | + } | ||
256 | + }); | ||
257 | + | ||
258 | + | ||
259 | + | ||
242 | 260 | ||
243 | //--初始化是否有打勾-- | 261 | //--初始化是否有打勾-- |
244 | getApp().request.get("/api/weshop/users/grade/vip/init/get", { | 262 | getApp().request.get("/api/weshop/users/grade/vip/init/get", { |
@@ -395,6 +413,11 @@ Page({ | @@ -395,6 +413,11 @@ Page({ | ||
395 | } | 413 | } |
396 | }) | 414 | }) |
397 | //th.requestRecommend(); | 415 | //th.requestRecommend(); |
416 | + | ||
417 | + | ||
418 | + | ||
419 | + | ||
420 | + | ||
398 | } | 421 | } |
399 | 422 | ||
400 | /*-- | 423 | /*-- |
@@ -817,6 +840,8 @@ Page({ | @@ -817,6 +840,8 @@ Page({ | ||
817 | } | 840 | } |
818 | }) | 841 | }) |
819 | }, | 842 | }, |
843 | + | ||
844 | + | ||
820 | 845 | ||
821 | 846 | ||
822 | }) | 847 | }) |
pages/user/index/index.wxml
@@ -96,14 +96,16 @@ | @@ -96,14 +96,16 @@ | ||
96 | </view> | 96 | </view> |
97 | <view class="xc-after-sale rel"> | 97 | <view class="xc-after-sale rel"> |
98 | <!-- 顶上的一栏 --> | 98 | <!-- 顶上的一栏 --> |
99 | - <view class="xc-equity-title flex-level" bindtap="go_order" data-url="/pages/user/order_list/order_list"> | ||
100 | - <view class="xc-title-frame flex-space-between"> | ||
101 | - <view class="flex-vertical xc-title-content"> | 99 | + <view class="xc-equity-title flex-level"> |
100 | + <view class="xc-title-frame flex ai-center"> | ||
101 | + <view class="flex-vertical xc-title-content" bindtap="go_order" data-url="/pages/user/order_list/order_list"> | ||
102 | <image class="xc-title-img" src="{{iurl}}/miniapp/images/hdindan.png" style="width: 50rpx; height: 55rpx;margin-right: 5rpx"></image> | 102 | <image class="xc-title-img" src="{{iurl}}/miniapp/images/hdindan.png" style="width: 50rpx; height: 55rpx;margin-right: 5rpx"></image> |
103 | <view class="three-level-word">我的订单</view> | 103 | <view class="three-level-word">我的订单</view> |
104 | </view> | 104 | </view> |
105 | + <!-- 物流信息提醒 --> | ||
106 | + <view class="fs26 c-5 pdl60" wx:if="{{countDadaOrder != 0}}" bindtap="go_order" data-url="/pages/user/order_list/order_list?index=1"><text class="iconfont icon-dingwei"></text>您有<text class="c-red">{{countDadaOrder}}</text>个同城配送订单</view> | ||
105 | </view> | 107 | </view> |
106 | - <view class="three-level-word xc-more-frame flex-vertical"> | 108 | + <view class="three-level-word xc-more-frame flex-vertical" bindtap="go_order" data-url="/pages/user/order_list/order_list"> |
107 | <view class="three-level-word xc-more">更多</view> | 109 | <view class="three-level-word xc-more">更多</view> |
108 | <view class="bg_right xc-more-click bcolor"></view> | 110 | <view class="bg_right xc-more-click bcolor"></view> |
109 | </view> | 111 | </view> |
pages/user/index/index.wxss
@@ -725,4 +725,13 @@ button::after{ border: 0} | @@ -725,4 +725,13 @@ button::after{ border: 0} | ||
725 | width: 132rpx; | 725 | width: 132rpx; |
726 | height: 37rpx; | 726 | height: 37rpx; |
727 | margin-right: 10rpx; | 727 | margin-right: 10rpx; |
728 | +} | ||
729 | + | ||
730 | +.icon-dingwei { | ||
731 | + color: #EA4F2B; | ||
732 | + font-size: 28rpx; | ||
733 | +} | ||
734 | + | ||
735 | +.c-5 { | ||
736 | + color: #555; | ||
728 | } | 737 | } |
729 | \ No newline at end of file | 738 | \ No newline at end of file |
pages/user/order_detail/order_detail.js
@@ -322,7 +322,8 @@ Page({ | @@ -322,7 +322,8 @@ Page({ | ||
322 | url: "/pages/team/team_confirm/team_confirm?orderSn=" + this.data.order.order_sn + "&orderPay=true" | 322 | url: "/pages/team/team_confirm/team_confirm?orderSn=" + this.data.order.order_sn + "&orderPay=true" |
323 | }) | 323 | }) |
324 | var order=this.data.order; | 324 | var order=this.data.order; |
325 | - var order_goods=order.order_goods; | 325 | + var order_goods=order.order_goods; |
326 | + var user_id=order.user_id; | ||
326 | 327 | ||
327 | var wlist=""; | 328 | var wlist=""; |
328 | for(var i in order_goods){ | 329 | for(var i in order_goods){ |
@@ -474,8 +475,7 @@ Page({ | @@ -474,8 +475,7 @@ Page({ | ||
474 | 475 | ||
475 | //商品的普通购买 ,不要进行判断 | 476 | //商品的普通购买 ,不要进行判断 |
476 | if((good.prom_type==1 || good.prom_type==6 || good.prom_type==4) && !good.is_gift && !good.is_collocation && !good.is_integral_normal && !good.is_pd_normal){ | 477 | if((good.prom_type==1 || good.prom_type==6 || good.prom_type==4) && !good.is_gift && !good.is_collocation && !good.is_integral_normal && !good.is_pd_normal){ |
477 | - if(gg.prom_type!=good.prom_type) { | ||
478 | - | 478 | + if(gg.prom_type!=good.prom_type && gg.prom_type>0) { |
479 | var content=gg.goods_name+'商品的活动发生了变化,请取消订单重新购买'; | 479 | var content=gg.goods_name+'商品的活动发生了变化,请取消订单重新购买'; |
480 | th.toast(content); | 480 | th.toast(content); |
481 | return false; | 481 | return false; |
@@ -487,10 +487,11 @@ Page({ | @@ -487,10 +487,11 @@ Page({ | ||
487 | //---如果是活动的时候--- | 487 | //---如果是活动的时候--- |
488 | var prom=null,th=this; | 488 | var prom=null,th=this; |
489 | if(gg.prom_type==1){ | 489 | if(gg.prom_type==1){ |
490 | - await getApp().request.promiseGet("/api/ms/flash_sale/get/"+os.stoid+"/"+gg.prom_id,{ | 490 | + await getApp().request.promiseGet("/api/ms/flash_sale/getNew/"+os.stoid+"/"+user_id+"/"+gg.prom_id,{ |
491 | }).then(res=>{ | 491 | }).then(res=>{ |
492 | if(res.data.code==0){ | 492 | if(res.data.code==0){ |
493 | prom=res.data.data; | 493 | prom=res.data.data; |
494 | + prom.price=prom.user_price; | ||
494 | } | 495 | } |
495 | }) | 496 | }) |
496 | } | 497 | } |
@@ -595,10 +596,11 @@ Page({ | @@ -595,10 +596,11 @@ Page({ | ||
595 | //---如果是活动的时候--- | 596 | //---如果是活动的时候--- |
596 | var prom=null,goodsinfo=good,th=this; | 597 | var prom=null,goodsinfo=good,th=this; |
597 | if(goodsinfo.prom_type==1){ | 598 | if(goodsinfo.prom_type==1){ |
598 | - await getApp().request.promiseGet("/api/ms/flash_sale/get/"+os.stoid+"/"+goodsinfo.prom_id,{ | 599 | + await getApp().request.promiseGet("/api/ms/flash_sale/getNew/"+os.stoid+"/"+user_id+"/"+goodsinfo.prom_id,{ |
599 | }).then(res=>{ | 600 | }).then(res=>{ |
600 | if(res.data.code==0){ | 601 | if(res.data.code==0){ |
601 | prom=res.data.data; | 602 | prom=res.data.data; |
603 | + prom.price=prom.user_price; | ||
602 | } | 604 | } |
603 | }) | 605 | }) |
604 | } | 606 | } |
@@ -638,7 +640,13 @@ Page({ | @@ -638,7 +640,13 @@ Page({ | ||
638 | th.toast(content); | 640 | th.toast(content); |
639 | return false; | 641 | return false; |
640 | } | 642 | } |
641 | - | 643 | + //看一下会员的秒杀价格是不是发生了变化 |
644 | + if(goodsinfo.prom_type==1 && goodsinfo.goods_price!=prom.price){ | ||
645 | + var content=goodsinfo.goods_name+'秒杀活动的价格发生了变化'; | ||
646 | + th.toast(content); | ||
647 | + return false; | ||
648 | + } | ||
649 | + | ||
642 | if(goodsinfo.prom_type==4){ | 650 | if(goodsinfo.prom_type==4){ |
643 | if (good.goods_num > prom.limitqty-prom.buy_num) { | 651 | if (good.goods_num > prom.limitqty-prom.buy_num) { |
644 | 652 | ||
@@ -897,6 +905,7 @@ Page({ | @@ -897,6 +905,7 @@ Page({ | ||
897 | 905 | ||
898 | check_more_order:async function(item){ | 906 | check_more_order:async function(item){ |
899 | var pickup=null,th=this; | 907 | var pickup=null,th=this; |
908 | + var user_id=getApp().globalData.userInfo.user_id; | ||
900 | wx.showLoading(); | 909 | wx.showLoading(); |
901 | //--------获取门店----------- | 910 | //--------获取门店----------- |
902 | await getApp().request.promiseGet("/api/weshop/pickup/get/" + os.stoid + "/" + item.pickup_id, { | 911 | await getApp().request.promiseGet("/api/weshop/pickup/get/" + os.stoid + "/" + item.pickup_id, { |
@@ -980,41 +989,62 @@ Page({ | @@ -980,41 +989,62 @@ Page({ | ||
980 | if(card_field && good[card_field]>0){ | 989 | if(card_field && good[card_field]>0){ |
981 | b_item.price=good[card_field]; | 990 | b_item.price=good[card_field]; |
982 | } | 991 | } |
983 | - | ||
984 | - //--判断商品当前的活动情况-- | ||
985 | - switch(good.prom_type){ | ||
986 | - case 1: | ||
987 | - var flash=null; | ||
988 | - getApp().request.promiseGet("/api/ms/flash_sale/get/" + os.stoid + "/" + good.prom_id, { | ||
989 | - }).then(res=>{ | ||
990 | - if (res.data.code== 0) { | ||
991 | - flash=res.data.data; | ||
992 | - } | ||
993 | - }) | ||
994 | - //----已经结束----- | ||
995 | - if (flash && flash.is_end == 0 && flash.end_time > timestamp && flash.start_time > timestamp ) { | ||
996 | - prom=flash; | ||
997 | - b_item.price=prom.price; // | ||
998 | - } | ||
999 | - break; | ||
1000 | - case 6: | ||
1001 | - b_item.is_pd_normal=1; break; | ||
1002 | - case 7: | ||
1003 | - //如果有组合购 | ||
1004 | - var url="/api/weshop/prom/zhbuy/get/"+os.stoid+"/"+good.prom_id+"/"+getApp().globalData.userInfo.user_id; | ||
1005 | - await getApp().request.promiseGet(url, {}).then(res => { | ||
1006 | - if(res.data.code==0 && res.data.data){ | ||
1007 | - if(res.data.data.is_show==1 && res.data.data.is_end==0 | ||
1008 | - && ut.gettimestamp()<res.data.data.end_time | ||
1009 | - && ut.gettimestamp()>res.data.data.start_time | ||
1010 | - ){ | ||
1011 | - b_item.prom_type=7; | ||
1012 | - b_item.prom_id=res.data.data.id; | 992 | + |
993 | + var url="/api/weshop/activitylist/getGoodActInfo"; | ||
994 | + var req_data={ | ||
995 | + store_id:g_item.store_id,goodsidlist:g_item.goods_id,is_detail:1 | ||
996 | + }; | ||
997 | + await getApp().request.promiseGet(url, {data:req_data}).then(res=>{ | ||
998 | + if(res.data.code==0){ | ||
999 | + var list = res.data.data; | ||
1000 | + for(let i in list){ | ||
1001 | + let item=list[i]; | ||
1002 | + if(item.prom_type==1){ good.prom_type=1; good.prom_id=item.act_id; } | ||
1003 | + } | ||
1004 | + } | ||
1005 | + }) | ||
1006 | + | ||
1007 | + if(!prom) { | ||
1008 | + //--判断商品当前的活动情况-- | ||
1009 | + switch (good.prom_type) { | ||
1010 | + case 1: | ||
1011 | + var flash = null; | ||
1012 | + await getApp().request.promiseGet("/api/ms/flash_sale/getNew/" + os.stoid + "/" + user_id + "/" + good.prom_id, {}).then(res => { | ||
1013 | + if (res.data.code == 0) { | ||
1014 | + flash = res.data.data; | ||
1013 | } | 1015 | } |
1016 | + }) | ||
1017 | + //----已经结束----- | ||
1018 | + if (flash && flash.is_end == 0 && flash.end_time > timestamp && flash.start_time < timestamp) { | ||
1019 | + prom = flash; | ||
1020 | + prom.price = prom.user_price; | ||
1021 | + b_item.price = prom.price; | ||
1022 | + good.prom_type = 1; | ||
1023 | + good.prom_id = prom.id; | ||
1014 | } | 1024 | } |
1015 | - }) | ||
1016 | - break; | ||
1017 | - } | 1025 | + break; |
1026 | + case 6: | ||
1027 | + b_item.is_pd_normal = 1; | ||
1028 | + break; | ||
1029 | + case 7: | ||
1030 | + //如果有组合购 | ||
1031 | + var url = "/api/weshop/prom/zhbuy/get/" + os.stoid + "/" + good.prom_id + "/" + getApp().globalData.userInfo.user_id; | ||
1032 | + await getApp().request.promiseGet(url, {}).then(res => { | ||
1033 | + if (res.data.code == 0 && res.data.data) { | ||
1034 | + if (res.data.data.is_show == 1 && res.data.data.is_end == 0 | ||
1035 | + && ut.gettimestamp() < res.data.data.end_time | ||
1036 | + && ut.gettimestamp() > res.data.data.start_time | ||
1037 | + ) { | ||
1038 | + b_item.prom_type = 7; | ||
1039 | + b_item.prom_id = res.data.data.id; | ||
1040 | + good.prom_type = 7; | ||
1041 | + good.prom_id = res.data.data.id; | ||
1042 | + } | ||
1043 | + } | ||
1044 | + }) | ||
1045 | + break; | ||
1046 | + } | ||
1047 | + } | ||
1018 | 1048 | ||
1019 | //如果有优惠促销的时候,要看下商品的优惠活动有没有过期 | 1049 | //如果有优惠促销的时候,要看下商品的优惠活动有没有过期 |
1020 | if(g_item.prom_type==3 || good.prom_type==3){ | 1050 | if(g_item.prom_type==3 || good.prom_type==3){ |
@@ -1132,7 +1162,6 @@ Page({ | @@ -1132,7 +1162,6 @@ Page({ | ||
1132 | back_goods_arr.push(b_item); //返回商品元素 | 1162 | back_goods_arr.push(b_item); //返回商品元素 |
1133 | 1163 | ||
1134 | }else{ | 1164 | }else{ |
1135 | - | ||
1136 | //-- 看一下购物车上有多少商品 -- | 1165 | //-- 看一下购物车上有多少商品 -- |
1137 | var cart_num=0; | 1166 | var cart_num=0; |
1138 | await getApp().request.promiseGet("/api/weshop/cart/page", { | 1167 | await getApp().request.promiseGet("/api/weshop/cart/page", { |
@@ -1151,8 +1180,7 @@ Page({ | @@ -1151,8 +1180,7 @@ Page({ | ||
1151 | } | 1180 | } |
1152 | cart_num=num; | 1181 | cart_num=num; |
1153 | }) | 1182 | }) |
1154 | - | ||
1155 | - | 1183 | + |
1156 | if(good.store_count<=0){ | 1184 | if(good.store_count<=0){ |
1157 | err_text+= good['goods_name']+"库存不足\n"; | 1185 | err_text+= good['goods_name']+"库存不足\n"; |
1158 | continue; | 1186 | continue; |
@@ -1226,16 +1254,19 @@ Page({ | @@ -1226,16 +1254,19 @@ Page({ | ||
1226 | 1254 | ||
1227 | if(b_item.goods_num>redis_num){ | 1255 | if(b_item.goods_num>redis_num){ |
1228 | b_item.goods_num=redis_num; | 1256 | b_item.goods_num=redis_num; |
1229 | - } | ||
1230 | - | ||
1231 | - if(cart_num+buynum>prom['buy_limit']){ | ||
1232 | - err_text+= good['goods_name']+"超出活动限购\n";continue; | ||
1233 | } | 1257 | } |
1234 | - prom['buy_limit'] -= (cart_num+buynum); | ||
1235 | - if(b_item.goods_num>prom['buy_limit']){ | ||
1236 | - b_item.goods_num=prom['buy_limit']; | ||
1237 | - } | ||
1238 | - | 1258 | + |
1259 | + if(prom['buy_limit']>0){ | ||
1260 | + if(cart_num+buynum>prom['buy_limit'] ){ | ||
1261 | + err_text+= good['goods_name']+"超出活动限购\n";continue; | ||
1262 | + } | ||
1263 | + prom['buy_limit'] -= (cart_num+buynum); | ||
1264 | + if(b_item.goods_num>prom['buy_limit']){ | ||
1265 | + b_item.goods_num=prom['buy_limit']; | ||
1266 | + } | ||
1267 | + } | ||
1268 | + | ||
1269 | + | ||
1239 | } | 1270 | } |
1240 | back_goods_arr.push(b_item); //返回商品元素 | 1271 | back_goods_arr.push(b_item); //返回商品元素 |
1241 | } | 1272 | } |
pages/user/order_list/order_list.js
@@ -70,6 +70,13 @@ Page({ | @@ -70,6 +70,13 @@ Page({ | ||
70 | var nowDate = now.getFullYear() + '-' + (now.getMonth() + 1) + '-' + now.getDate(); | 70 | var nowDate = now.getFullYear() + '-' + (now.getMonth() + 1) + '-' + now.getDate(); |
71 | var date = new Date(now.getTime() - 7 * 24 * 3600 * 1000); | 71 | var date = new Date(now.getTime() - 7 * 24 * 3600 * 1000); |
72 | var startDate=date.getFullYear() + '-' + (date.getMonth() + 1) + '-' + date.getDate(); | 72 | var startDate=date.getFullYear() + '-' + (date.getMonth() + 1) + '-' + date.getDate(); |
73 | + | ||
74 | + | ||
75 | + if(t.index) { | ||
76 | + this.setData({ | ||
77 | + currentIndex: t.index | ||
78 | + }); | ||
79 | + }; | ||
73 | 80 | ||
74 | this.setData({ | 81 | this.setData({ |
75 | currentDate: this.currentDate(), | 82 | currentDate: this.currentDate(), |
@@ -497,7 +504,7 @@ Page({ | @@ -497,7 +504,7 @@ Page({ | ||
497 | await getApp().request.promiseGet("/api/weshop/ordergoods/getUserBuyGoodsNum", { | 504 | await getApp().request.promiseGet("/api/weshop/ordergoods/getUserBuyGoodsNum", { |
498 | data: { | 505 | data: { |
499 | store_id: os.stoid, | 506 | store_id: os.stoid, |
500 | - user_id: getApp().globalData.user_id, | 507 | + user_id: user_id, |
501 | goods_id: good.goods_id, | 508 | goods_id: good.goods_id, |
502 | prom_type: good.prom_type, | 509 | prom_type: good.prom_type, |
503 | prom_id: good.prom_id | 510 | prom_id: good.prom_id |
@@ -567,12 +574,9 @@ Page({ | @@ -567,12 +574,9 @@ Page({ | ||
567 | }) | 574 | }) |
568 | 575 | ||
569 | var num = good['buyqty']; | 576 | var num = good['buyqty']; |
570 | - console.log(1111); | ||
571 | - console.log(num); | ||
572 | //---- 要计算商品的限购 ----- | 577 | //---- 要计算商品的限购 ----- |
573 | if (good['buyqty'] > 0) { | 578 | if (good['buyqty'] > 0) { |
574 | if (good.goods_num + promgoodsbuynum > good['buyqty']) { | 579 | if (good.goods_num + promgoodsbuynum > good['buyqty']) { |
575 | - | ||
576 | var content = good['goods_name'] + "超出活动限购\n"; | 580 | var content = good['goods_name'] + "超出活动限购\n"; |
577 | th.toast(content); | 581 | th.toast(content); |
578 | return false; | 582 | return false; |
@@ -658,7 +662,7 @@ Page({ | @@ -658,7 +662,7 @@ Page({ | ||
658 | //商品的普通购买 ,不要进行判断 | 662 | //商品的普通购买 ,不要进行判断 |
659 | if ((good.prom_type == 1 || good.prom_type == 6 || good.prom_type == 4 || good.prom_type == 8) | 663 | if ((good.prom_type == 1 || good.prom_type == 6 || good.prom_type == 4 || good.prom_type == 8) |
660 | && !good.is_gift && !good.is_collocation && !good.is_integral_normal && !good.is_pd_normal) { | 664 | && !good.is_gift && !good.is_collocation && !good.is_integral_normal && !good.is_pd_normal) { |
661 | - if (gg.prom_type != good.prom_type) { | 665 | + if (gg.prom_type != good.prom_type && gg.prom_type>0) { |
662 | var content = gg.goods_name + '商品的活动发生了变化,请取消订单重新购买'; | 666 | var content = gg.goods_name + '商品的活动发生了变化,请取消订单重新购买'; |
663 | th.toast(content); | 667 | th.toast(content); |
664 | return false; | 668 | return false; |
@@ -671,9 +675,10 @@ Page({ | @@ -671,9 +675,10 @@ Page({ | ||
671 | //---如果是活动的时候--- | 675 | //---如果是活动的时候--- |
672 | var prom = null, th = this; | 676 | var prom = null, th = this; |
673 | if (gg.prom_type == 1) { | 677 | if (gg.prom_type == 1) { |
674 | - await getApp().request.promiseGet("/api/ms/flash_sale/get/" + os.stoid + "/" + gg.prom_id, {}).then(res => { | 678 | + await getApp().request.promiseGet("/api/ms/flash_sale/getNew/" + os.stoid + "/"+ user_id + "/" + gg.prom_id, {}).then(res => { |
675 | if (res.data.code == 0) { | 679 | if (res.data.code == 0) { |
676 | prom = res.data.data; | 680 | prom = res.data.data; |
681 | + prom.price=prom.user_price; | ||
677 | } | 682 | } |
678 | }) | 683 | }) |
679 | } | 684 | } |
@@ -771,13 +776,13 @@ Page({ | @@ -771,13 +776,13 @@ Page({ | ||
771 | } | 776 | } |
772 | } | 777 | } |
773 | 778 | ||
774 | - console.log("------------------------------------"); | ||
775 | //---如果是活动的时候--- | 779 | //---如果是活动的时候--- |
776 | var prom = null, goodsinfo = good, th = this; | 780 | var prom = null, goodsinfo = good, th = this; |
777 | if (goodsinfo.prom_type == 1) { | 781 | if (goodsinfo.prom_type == 1) { |
778 | - await getApp().request.promiseGet("/api/ms/flash_sale/get/" + os.stoid + "/" + goodsinfo.prom_id, {}).then(res => { | 782 | + await getApp().request.promiseGet("/api/ms/flash_sale/getNew/" + os.stoid + "/"+ user_id + "/" + goodsinfo.prom_id, {}).then(res => { |
779 | if (res.data.code == 0) { | 783 | if (res.data.code == 0) { |
780 | prom = res.data.data; | 784 | prom = res.data.data; |
785 | + prom.price=prom.user_price; | ||
781 | } | 786 | } |
782 | }) | 787 | }) |
783 | } | 788 | } |
@@ -803,7 +808,6 @@ Page({ | @@ -803,7 +808,6 @@ Page({ | ||
803 | if (prom) { | 808 | if (prom) { |
804 | var now = ut.gettimestamp(); | 809 | var now = ut.gettimestamp(); |
805 | if (prom.is_end == 1 && prom.end_time < now) { | 810 | if (prom.is_end == 1 && prom.end_time < now) { |
806 | - | ||
807 | var content = goodsinfo.goods_name + '商品的活动已经结束,请取消订单' | 811 | var content = goodsinfo.goods_name + '商品的活动已经结束,请取消订单' |
808 | th.toast(content); | 812 | th.toast(content); |
809 | return false; | 813 | return false; |
@@ -817,6 +821,13 @@ Page({ | @@ -817,6 +821,13 @@ Page({ | ||
817 | return false; | 821 | return false; |
818 | } | 822 | } |
819 | 823 | ||
824 | + // --看一下会员的秒杀价格是不是发生了变化,因为会员的身份发生了变化 | ||
825 | + if(goodsinfo.prom_type==1 && goodsinfo.goods_price!=prom.price){ | ||
826 | + var content=goodsinfo.goods_name+'秒杀活动的价格发生了变化'; | ||
827 | + th.toast(content); | ||
828 | + return false; | ||
829 | + } | ||
830 | + | ||
820 | if (goodsinfo.prom_type == 4) { | 831 | if (goodsinfo.prom_type == 4) { |
821 | if (good.goods_num > prom.limitqty - prom.buy_num) { | 832 | if (good.goods_num > prom.limitqty - prom.buy_num) { |
822 | 833 | ||
@@ -1058,388 +1069,413 @@ Page({ | @@ -1058,388 +1069,413 @@ Page({ | ||
1058 | var item=th.data.orderList[index]; | 1069 | var item=th.data.orderList[index]; |
1059 | th.check_more_order(item); | 1070 | th.check_more_order(item); |
1060 | }, | 1071 | }, |
1061 | - | ||
1062 | - check_more_order:async function(item){ | ||
1063 | - var pickup=null,th=this; | ||
1064 | - wx.showLoading(); | ||
1065 | - //--------获取门店----------- | ||
1066 | - await getApp().request.promiseGet("/api/weshop/pickup/get/" + os.stoid + "/" + item.pickup_id, { | ||
1067 | - | ||
1068 | - }).then(res=>{ | ||
1069 | - pickup = res.data.data; | ||
1070 | - }) | ||
1071 | - | ||
1072 | - //--------获取商品---------- | ||
1073 | - var goods_list=item.order_goods; | ||
1074 | - //--- 返回的内容 --- | ||
1075 | - var back_goods_arr=[]; | ||
1076 | - var err_text=""; | ||
1077 | - for(var i in goods_list){ | ||
1078 | - var g_item=goods_list[i]; | ||
1079 | - //--如果是赠品,不加入购物车-- | ||
1080 | - if(g_item['is_gift']) continue; | ||
1081 | - if(g_item['prom_type']==4 ){ | ||
1082 | - err_text+= g_item['goods_name']+"积分购商品不加入购物车\n"; | ||
1083 | - continue; | ||
1084 | - } | ||
1085 | - if(g_item['prom_type']==5){ | ||
1086 | - err_text+= g_item['goods_name']+"搭配购商品不加入购物车\n"; | ||
1087 | - continue; | ||
1088 | - } | ||
1089 | - if(g_item['prom_type']==6 ){ | ||
1090 | - err_text+= g_item['goods_name']+"拼团商品不加入购物车\n"; | ||
1091 | - continue; | ||
1092 | - } | ||
1093 | 1072 | ||
1094 | - //--获取商品-- | ||
1095 | - var good=null; | ||
1096 | - await getApp().request.promiseGet("/api/weshop/goods/get/" + os.stoid + "/" + g_item.goods_id, { | ||
1097 | 1073 | ||
1098 | - }).then(res=>{ | ||
1099 | - good=res.data.data; | ||
1100 | - }) | ||
1101 | - | ||
1102 | - if(!good){ | ||
1103 | - err_text+= g_item['goods_name']+"未找到商品\n"; | ||
1104 | - continue; | ||
1105 | - } | ||
1106 | - if (good.is_on_sale != 1) { | ||
1107 | - err_text+= g_item['goods_name']+"已经下架\n"; | ||
1108 | - continue; | ||
1109 | - } | 1074 | + check_more_order:async function(item){ |
1075 | + var pickup=null,th=this; | ||
1076 | + var user_id=getApp().globalData.user_id; | ||
1077 | + wx.showLoading(); | ||
1078 | + //--------获取门店----------- | ||
1079 | + await getApp().request.promiseGet("/api/weshop/pickup/get/" + os.stoid + "/" + item.pickup_id, { | ||
1080 | + | ||
1081 | + }).then(res=>{ | ||
1082 | + pickup = res.data.data; | ||
1083 | + }) | ||
1110 | 1084 | ||
1111 | - var timestamp = ut.gettimestamp(); | ||
1112 | - if (good.on_time > timestamp) { | ||
1113 | - err_text+= g_item['goods_name']+"还未上架\n"; | ||
1114 | - continue; | ||
1115 | - } | ||
1116 | - if (good.down_time > 0) { | ||
1117 | - if (good.down_time < timestamp) { | ||
1118 | - err_text+=g_item['goods_name']+"已经下架\n"; | ||
1119 | - continue; | ||
1120 | - } | ||
1121 | - } | 1085 | + //--------获取商品---------- |
1086 | + var goods_list=item.order_goods; | ||
1087 | + //--- 返回的内容 --- | ||
1088 | + var back_goods_arr=[]; | ||
1089 | + var err_text=""; | ||
1090 | + for(var i in goods_list){ | ||
1091 | + var g_item=goods_list[i]; | ||
1092 | + //--如果是赠品,不加入购物车-- | ||
1093 | + if(g_item['is_gift']) continue; | ||
1094 | + if(g_item['prom_type']==4 ){ | ||
1095 | + err_text+= g_item['goods_name']+"积分购商品不加入购物车\n"; | ||
1096 | + continue; | ||
1097 | + } | ||
1098 | + if(g_item['prom_type']==5){ | ||
1099 | + err_text+= g_item['goods_name']+"搭配购商品不加入购物车\n"; | ||
1100 | + continue; | ||
1101 | + } | ||
1102 | + if(g_item['prom_type']==6 ){ | ||
1103 | + err_text+= g_item['goods_name']+"拼团商品不加入购物车\n"; | ||
1104 | + continue; | ||
1105 | + } | ||
1122 | 1106 | ||
1123 | - //如果商品的配送方式和门店不匹配 | ||
1124 | - if(good['distr_type']>0 && pickup['distr_type']>0 && good['distr_type']!=pickup['distr_type'] ){ | ||
1125 | - err_text+= good['goods_name']+"配送方式不一致\n"; | ||
1126 | - continue; | ||
1127 | - } | 1107 | + //--获取商品-- |
1108 | + var good=null; | ||
1109 | + await getApp().request.promiseGet("/api/weshop/goods/get/" + os.stoid + "/" + g_item.goods_id, { | ||
1128 | 1110 | ||
1129 | - var prom=null; | ||
1130 | - var b_item={} | ||
1131 | - b_item.goods_id=g_item.goods_id; | ||
1132 | - b_item.goods_name=g_item.goods_name; | ||
1133 | - b_item.goods_num=g_item.goods_num; | ||
1134 | - b_item.guide_id=g_item.guide_id; | ||
1135 | - b_item.guide_type=g_item.guide_type; | ||
1136 | - b_item.pickup_id=item.pickup_id; | ||
1137 | - b_item.price=good.shop_price; | ||
1138 | - b_item.goods_sn=good.goods_sn; | ||
1139 | - b_item.sku=good.sku; | ||
1140 | - b_item.is_integral_normal=g_item.is_integral_normal; | ||
1141 | - | ||
1142 | - //-- 如果会员是等级卡的时候,同时商品也有设置相应的卡价格 -- | ||
1143 | - var card_field=th.data.card_field; | ||
1144 | - if(card_field && good[card_field]>0){ | ||
1145 | - b_item.price=good[card_field]; | ||
1146 | - } | 1111 | + }).then(res=>{ |
1112 | + good=res.data.data; | ||
1113 | + }) | ||
1147 | 1114 | ||
1148 | - //--判断商品当前的活动情况-- | ||
1149 | - switch(good.prom_type){ | ||
1150 | - //秒杀 | ||
1151 | - case 1: | ||
1152 | - var flash=null; | ||
1153 | - await getApp().request.promiseGet("/api/ms/flash_sale/get/" + os.stoid + "/" + good.prom_id, { | ||
1154 | - }).then(res=>{ | ||
1155 | - if (res.data.code== 0) { | ||
1156 | - flash=res.data.data; | ||
1157 | - } | ||
1158 | - }) | ||
1159 | - //----活动还没有结束----- | ||
1160 | - if (flash && flash.is_end == 0 && flash.end_time>timestamp && flash.start_time<timestamp ) { | ||
1161 | - prom=flash; | ||
1162 | - b_item.price=prom.price; // | ||
1163 | - } | ||
1164 | - break; | ||
1165 | - | ||
1166 | - //拼团 | ||
1167 | - case 6: | ||
1168 | - b_item.is_pd_normal=1; | ||
1169 | - break; | ||
1170 | - //组合购的再来一单 | ||
1171 | - case 7: | ||
1172 | - //如果有组合购 | ||
1173 | - var url="/api/weshop/prom/zhbuy/get/"+os.stoid+"/"+good.prom_id+"/"+getApp().globalData.userInfo.user_id; | ||
1174 | - await getApp().request.promiseGet(url, {}).then(res => { | ||
1175 | - if(res.data.code==0 && res.data.data){ | ||
1176 | - if(res.data.data.is_show==1 && res.data.data.is_end==0 | ||
1177 | - && ut.gettimestamp()<res.data.data.end_time | ||
1178 | - && ut.gettimestamp()>res.data.data.start_time | ||
1179 | - ){ | ||
1180 | - b_item.prom_type=7; | ||
1181 | - b_item.prom_id=res.data.data.id; | ||
1182 | - } | ||
1183 | - } | ||
1184 | - }) | ||
1185 | - break; | ||
1186 | - } | 1115 | + if(!good){ |
1116 | + err_text+= g_item['goods_name']+"未找到商品\n"; | ||
1117 | + continue; | ||
1118 | + } | ||
1119 | + if (good.is_on_sale != 1) { | ||
1120 | + err_text+= g_item['goods_name']+"已经下架\n"; | ||
1121 | + continue; | ||
1122 | + } | ||
1187 | 1123 | ||
1124 | + var timestamp = ut.gettimestamp(); | ||
1125 | + if (good.on_time > timestamp) { | ||
1126 | + err_text+= g_item['goods_name']+"还未上架\n"; | ||
1127 | + continue; | ||
1128 | + } | ||
1129 | + if (good.down_time > 0) { | ||
1130 | + if (good.down_time < timestamp) { | ||
1131 | + err_text+=g_item['goods_name']+"已经下架\n"; | ||
1132 | + continue; | ||
1133 | + } | ||
1134 | + } | ||
1188 | 1135 | ||
1189 | - //如果有优惠促销的时候,要看下商品的优惠活动有没有过期 | ||
1190 | - if(g_item.prom_type==3 || good.prom_type==3){ | ||
1191 | - await getApp().request.promiseGet("/api/weshop/goods/getGoodsPromList/" + os.stoid + "/" + good.goods_id + "/1", {}).then(res => { | ||
1192 | - if (res.data.code == 0) { | ||
1193 | - var r_data = res.data.data; | ||
1194 | - if (r_data.promGoodsLists) { | ||
1195 | - b_item.prom_type=3; | ||
1196 | - b_item.prom_id=r_data.promGoodsLists[0].prom_id; | ||
1197 | - } | ||
1198 | - } | ||
1199 | - }) | ||
1200 | - } | 1136 | + //如果商品的配送方式和门店不匹配 |
1137 | + if(good['distr_type']>0 && pickup['distr_type']>0 && good['distr_type']!=pickup['distr_type'] ){ | ||
1138 | + err_text+= good['goods_name']+"配送方式不一致\n"; | ||
1139 | + continue; | ||
1140 | + } | ||
1201 | 1141 | ||
1202 | - //判断是不是线下库存的购买, 是不是秒杀活动 | ||
1203 | - if(th.data.sales_rules==2 && !prom){ | ||
1204 | - //-- 看一下购物车上有多少商品 -- | ||
1205 | - var cart_num=0; | ||
1206 | - await getApp().request.promiseGet("/api/weshop/cart/page", { | ||
1207 | - data: { | ||
1208 | - store_id: os.stoid, | ||
1209 | - user_id: getApp().globalData.user_id, | ||
1210 | - state:0, is_gift:0, | ||
1211 | - goods_id:good.goods_id, | ||
1212 | - pick_id: b_item.pickup_id | ||
1213 | - } | ||
1214 | - }).then(res=>{ | ||
1215 | - var num = 0; | ||
1216 | - if(res.data.code==0 && res.data.data && res.data.data.pageData) { | ||
1217 | - for (var i = 0; i < res.data.data.pageData.length; i++) { | ||
1218 | - num += res.data.data.pageData[i].goods_num; | ||
1219 | - } | ||
1220 | - } | ||
1221 | - cart_num=num; | ||
1222 | - }) | 1142 | + var prom=null; |
1143 | + var b_item={} | ||
1144 | + b_item.goods_id=g_item.goods_id; | ||
1145 | + b_item.goods_name=g_item.goods_name; | ||
1146 | + b_item.goods_num=g_item.goods_num; | ||
1147 | + b_item.guide_id=g_item.guide_id; | ||
1148 | + b_item.guide_type=g_item.guide_type; | ||
1149 | + b_item.pickup_id=item.pickup_id; | ||
1150 | + b_item.price=good.shop_price; | ||
1151 | + b_item.goods_sn=good.goods_sn; | ||
1152 | + b_item.sku=good.sku; | ||
1153 | + b_item.is_integral_normal=g_item.is_integral_normal; | ||
1154 | + | ||
1155 | + //-- 如果会员是等级卡的时候,同时商品也有设置相应的卡价格 -- | ||
1156 | + var card_field=th.data.card_field; | ||
1157 | + if(card_field && good[card_field]>0){ | ||
1158 | + b_item.price=good[card_field]; | ||
1159 | + } | ||
1223 | 1160 | ||
1224 | - var lock=0,plist=null; | ||
1225 | - | ||
1226 | - if(b_item.prom_type!=7) { | ||
1227 | - //先读取门店的lock, | ||
1228 | - await getApp().request.promiseGet("/api/weshop/order/ware/lock/page", { | ||
1229 | - data: {store_id: os.stoid, wareId: good.goods_id, storageId: b_item.pickup_id, pageSize: 1000} | ||
1230 | - }).then(res => { | ||
1231 | - if (res.data.code == 0 && res.data.data.total > 0) { | ||
1232 | - for (var i in res.data.data.pageData) | ||
1233 | - lock += res.data.data.pageData[i].outQty | ||
1234 | - } | ||
1235 | - }) | ||
1236 | - //---通过接口获取门店的线下库存信息-- | ||
1237 | - await getApp().request.promiseGet("/api/weshop/goods/getWareStorages", { | ||
1238 | - data: { | ||
1239 | - storageNos: pickup.pickup_no, | ||
1240 | - wareIds: encodeURIComponent(good.erpwareid), | ||
1241 | - storeId: os.stoid | ||
1242 | - } | ||
1243 | - }).then(res => { | ||
1244 | - if (res.data.code == 0 && res.data.data.total > 0) { | ||
1245 | - plist = res.data.data.pageData[0]; | ||
1246 | - } | ||
1247 | - }) | ||
1248 | - | ||
1249 | - if (!plist) { | ||
1250 | - err_text += good['goods_name'] + "库存不足\n"; | ||
1251 | - continue; | ||
1252 | - } | ||
1253 | - if (plist.CanOutQty - lock <= 0) { | ||
1254 | - err_text += good['goods_name'] + "库存不足\n"; | ||
1255 | - continue; | ||
1256 | - } | ||
1257 | - if (b_item.goods_num > (plist.CanOutQty - lock)) { | ||
1258 | - b_item.goods_num = plist.CanOutQty - lock; | 1161 | + var url="/api/weshop/activitylist/getGoodActInfo"; |
1162 | + var req_data={ | ||
1163 | + store_id:g_item.store_id,goodsidlist:g_item.goods_id,is_detail:1 | ||
1164 | + }; | ||
1165 | + await getApp().request.promiseGet(url, {data:req_data}).then(res=>{ | ||
1166 | + if(res.data.code==0){ | ||
1167 | + var list = res.data.data; | ||
1168 | + for(let i in list){ | ||
1169 | + let item=list[i]; | ||
1170 | + if(item.prom_type==1){ good.prom_type=1; good.prom_id=item.act_id; } | ||
1259 | } | 1171 | } |
1260 | } | 1172 | } |
1261 | - var req_data={ | ||
1262 | - store_id: os.stoid, | ||
1263 | - user_id: getApp().globalData.user_id, | ||
1264 | - goods_id: good.goods_id, | ||
1265 | - }; | 1173 | + }) |
1266 | 1174 | ||
1267 | - if(b_item.prom_type==7){ | ||
1268 | - req_data.prom_type=7; | ||
1269 | - req_data.prom_id=b_item.prom_id; | ||
1270 | - } | ||
1271 | 1175 | ||
1176 | + if(!prom) { | ||
1177 | + //--判断商品当前的活动情况-- | ||
1178 | + switch (good.prom_type) { | ||
1179 | + case 1: | ||
1180 | + var flash = null; | ||
1181 | + await getApp().request.promiseGet("/api/ms/flash_sale/getNew/" + os.stoid + "/" + user_id + "/" + good.prom_id, {}).then(res => { | ||
1182 | + if (res.data.code == 0) { | ||
1183 | + flash = res.data.data; | ||
1184 | + } | ||
1185 | + }) | ||
1186 | + //----已经结束----- | ||
1187 | + if (flash && flash.is_end == 0 && flash.end_time > timestamp && flash.start_time < timestamp) { | ||
1188 | + prom = flash; | ||
1189 | + prom.price = prom.user_price; | ||
1190 | + b_item.price = prom.user_price; | ||
1191 | + } | ||
1192 | + break; | ||
1193 | + case 6: | ||
1194 | + b_item.is_pd_normal = 1; | ||
1195 | + break; | ||
1196 | + case 7: | ||
1197 | + //如果有组合购 | ||
1198 | + var url = "/api/weshop/prom/zhbuy/get/" + os.stoid + "/" + good.prom_id + "/" + getApp().globalData.userInfo.user_id; | ||
1199 | + await getApp().request.promiseGet(url, {}).then(res => { | ||
1200 | + if (res.data.code == 0 && res.data.data) { | ||
1201 | + if (res.data.data.is_show == 1 && res.data.data.is_end == 0 | ||
1202 | + && ut.gettimestamp() < res.data.data.end_time | ||
1203 | + && ut.gettimestamp() > res.data.data.start_time | ||
1204 | + ) { | ||
1205 | + b_item.prom_type = 7; | ||
1206 | + b_item.prom_id = res.data.data.id; | ||
1207 | + good.prom_type = 7; | ||
1208 | + good.prom_id = prom.b_item.prom_id; | ||
1272 | 1209 | ||
1273 | - var buynum=0; | ||
1274 | - var promnum=0; | ||
1275 | - //---要获得商品,该用户买了多少件,同步应用--- | ||
1276 | - await getApp().request.promiseGet("/api/weshop/ordergoods/getUserBuyGoodsNum", { | ||
1277 | - data: req_data, | ||
1278 | - }).then(res => { | ||
1279 | - if(res.data.code==0){ | ||
1280 | - var buy_num_data = res.data.data; | ||
1281 | - buynum = buy_num_data.goodsbuynum; | ||
1282 | - if(buy_num_data.promgoodsbuynum){ | ||
1283 | - promnum=buy_num_data.promgoodsbuynum; | ||
1284 | - } | ||
1285 | - } | ||
1286 | - }) | 1210 | + } |
1211 | + } | ||
1212 | + }) | ||
1213 | + break; | ||
1214 | + } | ||
1215 | + } | ||
1287 | 1216 | ||
1288 | - //---- 要计算商品的限购 ----- | ||
1289 | - if(good['viplimited']>0){ | ||
1290 | - if(cart_num+buynum>good['viplimited']){ | ||
1291 | - err_text+= good['goods_name']+"超出限购\n"; | ||
1292 | - continue; | ||
1293 | - } | ||
1294 | - good['viplimited']-=(cart_num+buynum); | ||
1295 | - if(b_item.goods_num>good['viplimited']){ | ||
1296 | - b_item.goods_num=good['viplimited']; | ||
1297 | - } | ||
1298 | - } | ||
1299 | - //不算组合购的限购 | ||
1300 | - back_goods_arr.push(b_item); //返回商品元素 | 1217 | + //如果有优惠促销的时候,要看下商品的优惠活动有没有过期 |
1218 | + if(g_item.prom_type==3 || good.prom_type==3){ | ||
1219 | + await getApp().request.promiseGet("/api/weshop/goods/getGoodsPromList/" + os.stoid + "/" + good.goods_id + "/1", {}).then(res => { | ||
1220 | + if (res.data.code == 0) { | ||
1221 | + var r_data = res.data.data; | ||
1222 | + if (r_data.promGoodsLists) { | ||
1223 | + b_item.prom_type=3; | ||
1224 | + b_item.prom_id=r_data.promGoodsLists[0].prom_id; | ||
1225 | + } | ||
1226 | + } | ||
1227 | + }) | ||
1228 | + } | ||
1301 | 1229 | ||
1302 | - }else{ | ||
1303 | 1230 | ||
1304 | - //-- 看一下购物车上有多少商品 -- | ||
1305 | - var cart_num=0; | ||
1306 | - await getApp().request.promiseGet("/api/weshop/cart/page", { | ||
1307 | - data: { | ||
1308 | - store_id: os.stoid, | ||
1309 | - user_id: getApp().globalData.user_id, | ||
1310 | - state:0, is_gift:0, | ||
1311 | - goods_id:good.goods_id | ||
1312 | - } | ||
1313 | - }).then(res=>{ | ||
1314 | - var num = 0; | ||
1315 | - if(res.data.code==0 && res.data.data && res.data.data.pageData) { | ||
1316 | - for (var i = 0; i < res.data.data.pageData.length; i++) { | ||
1317 | - num += res.data.data.pageData[i].goods_num; | ||
1318 | - } | ||
1319 | - } | ||
1320 | - cart_num=num; | ||
1321 | - }) | 1231 | + //判断是不是线下库存的购买, 是不是秒杀活动 |
1232 | + if(th.data.sales_rules==2 && !prom){ | ||
1233 | + | ||
1234 | + //-- 看一下购物车上有多少商品 -- | ||
1235 | + var cart_num=0; | ||
1236 | + await getApp().request.promiseGet("/api/weshop/cart/page", { | ||
1237 | + data: { | ||
1238 | + store_id: os.stoid, | ||
1239 | + user_id: getApp().globalData.user_id, | ||
1240 | + state:0, is_gift:0, | ||
1241 | + goods_id:good.goods_id, | ||
1242 | + pick_id: b_item.pickup_id | ||
1243 | + } | ||
1244 | + }).then(res=>{ | ||
1245 | + var num = 0; | ||
1246 | + if(res.data.code==0 && res.data.data && res.data.data.pageData) { | ||
1247 | + for (var i = 0; i < res.data.data.pageData.length; i++) { | ||
1248 | + num += res.data.data.pageData[i].goods_num; | ||
1249 | + } | ||
1250 | + } | ||
1251 | + cart_num=num; | ||
1252 | + }) | ||
1322 | 1253 | ||
1254 | + var lock=0,plist=null; | ||
1323 | 1255 | ||
1324 | - if(good.store_count<=0){ | ||
1325 | - err_text+= good['goods_name']+"库存不足\n"; | ||
1326 | - continue; | ||
1327 | - } | ||
1328 | - if(b_item.goods_num>good.store_count) | ||
1329 | - b_item.goods_num=good.store_count; | ||
1330 | - | ||
1331 | - var buynum=0; //商品已经购买多少件 | ||
1332 | - var promgoodsbuynum=0; //活动已经购买多少件 | ||
1333 | - var redis_num = 0; //redis库存 | ||
1334 | - | ||
1335 | - var req_data={ | ||
1336 | - store_id: os.stoid, | ||
1337 | - user_id: getApp().globalData.user_id, | ||
1338 | - goods_id: good.goods_id, | ||
1339 | - }; | ||
1340 | - | ||
1341 | - if(prom){ | ||
1342 | - req_data.prom_type= good.prom_type; | ||
1343 | - req_data.prom_id= good.prom_id; | ||
1344 | - b_item.prom_type=good.prom_type; | ||
1345 | - b_item.prom_id=good.prom_id; | ||
1346 | - //------判断活动是否抢光----- | ||
1347 | - await getApp().request.promiseGet("/api/weshop/activitylist/getActLen/" + | ||
1348 | - os.stoid + "/" + good.prom_type + "/" + good.prom_id, { | ||
1349 | - 1: 1 | ||
1350 | - }).then(res => { | ||
1351 | - redis_num = res.data.data; | ||
1352 | - }); | ||
1353 | - if(redis_num<=0){ | ||
1354 | - err_text+= good['goods_name']+"活动不足\n"; | ||
1355 | - continue; | ||
1356 | - } | 1256 | + if(b_item.prom_type!=7) { |
1257 | + //先读取门店的lock, | ||
1258 | + await getApp().request.promiseGet("/api/weshop/order/ware/lock/page", { | ||
1259 | + data: {store_id: os.stoid, wareId: good.goods_id, storageId: b_item.pickup_id, pageSize: 1000} | ||
1260 | + }).then(res => { | ||
1261 | + if (res.data.code == 0 && res.data.data.total > 0) { | ||
1262 | + for (var i in res.data.data.pageData) | ||
1263 | + lock += res.data.data.pageData[i].outQty | ||
1264 | + } | ||
1265 | + }) | ||
1357 | 1266 | ||
1358 | - } | ||
1359 | - | ||
1360 | - //---要获得商品,该用户买了多少件,同步应用--- | ||
1361 | - await getApp().request.promiseGet("/api/weshop/ordergoods/getUserBuyGoodsNum", { | ||
1362 | - data: req_data, | ||
1363 | - }).then(res => { | ||
1364 | - if(res.data.code==0){ | ||
1365 | - var buy_num_data = res.data.data; | ||
1366 | - if (buy_num_data.promgoodsbuynum) promgoodsbuynum = buy_num_data.promgoodsbuynum; | ||
1367 | - buynum = buy_num_data.goodsbuynum; | ||
1368 | - } | ||
1369 | - }) | ||
1370 | - | ||
1371 | - //---- 要计算商品的限购 ----- | ||
1372 | - if(good['viplimited']>0){ | ||
1373 | - if(cart_num+buynum>good['viplimited']){ | ||
1374 | - err_text+= good['goods_name']+"超出限购\n"; | ||
1375 | - continue; | ||
1376 | - } | ||
1377 | - good['viplimited']-=(cart_num+buynum); | ||
1378 | - if(b_item.goods_num>good['viplimited']){ | ||
1379 | - b_item.goods_num=good['viplimited']; | ||
1380 | - } | 1267 | + //---通过接口获取门店的线下库存信息-- |
1268 | + await getApp().request.promiseGet("/api/weshop/goods/getWareStorages", { | ||
1269 | + data: { | ||
1270 | + storageNos: pickup.pickup_no, | ||
1271 | + wareIds: encodeURIComponent(good.erpwareid), | ||
1272 | + storeId: os.stoid | ||
1273 | + } | ||
1274 | + }).then(res => { | ||
1275 | + if (res.data.code == 0 && res.data.data.total > 0) { | ||
1276 | + plist = res.data.data.pageData[0]; | ||
1277 | + } | ||
1278 | + }) | ||
1381 | 1279 | ||
1382 | - } | 1280 | + if (!plist) { |
1281 | + err_text += good['goods_name'] + "库存不足\n"; | ||
1282 | + continue; | ||
1283 | + } | ||
1284 | + if (plist.CanOutQty - lock <= 0) { | ||
1285 | + err_text += good['goods_name'] + "库存不足\n"; | ||
1286 | + continue; | ||
1287 | + } | ||
1288 | + if (b_item.goods_num > (plist.CanOutQty - lock)) { | ||
1289 | + b_item.goods_num = plist.CanOutQty - lock; | ||
1290 | + } | ||
1291 | + } | ||
1292 | + var req_data={ | ||
1293 | + store_id: os.stoid, | ||
1294 | + user_id: getApp().globalData.user_id, | ||
1295 | + goods_id: good.goods_id, | ||
1296 | + }; | ||
1297 | + if(b_item.prom_type==7){ | ||
1298 | + req_data.prom_type=7; | ||
1299 | + req_data.prom_id=b_item.prom_id; | ||
1300 | + } | ||
1383 | 1301 | ||
1384 | - //-- 判断活动的库存 -- | ||
1385 | - if(prom){ | ||
1386 | - if(prom['goods_num']<=prom['buy_num']){ | ||
1387 | - err_text+= good['goods_name']+"超出活动库存\n";continue; | ||
1388 | - } | 1302 | + var buynum=0; |
1303 | + var promnum=0; | ||
1304 | + //---要获得商品,该用户买了多少件,同步应用--- | ||
1305 | + await getApp().request.promiseGet("/api/weshop/ordergoods/getUserBuyGoodsNum", { | ||
1306 | + data: req_data, | ||
1307 | + }).then(res => { | ||
1308 | + if(res.data.code==0){ | ||
1309 | + var buy_num_data = res.data.data; | ||
1310 | + buynum = buy_num_data.goodsbuynum; | ||
1311 | + if(buy_num_data.promgoodsbuynum){ | ||
1312 | + promnum=buy_num_data.promgoodsbuynum; | ||
1313 | + } | ||
1314 | + } | ||
1315 | + }) | ||
1389 | 1316 | ||
1390 | - if(b_item.goods_num>prom['goods_num']-prom['buy_num']){ | ||
1391 | - b_item['goods_num']= b_item['goods_num']-b_item['buy_num']; | ||
1392 | - } | 1317 | + //---- 要计算商品的限购 ----- |
1318 | + if(good['viplimited']>0){ | ||
1319 | + if(cart_num+buynum>good['viplimited']){ | ||
1320 | + err_text+= good['goods_name']+"超出限购\n"; | ||
1321 | + continue; | ||
1322 | + } | ||
1323 | + good['viplimited']-=(cart_num+buynum); | ||
1324 | + if(b_item.goods_num>good['viplimited']){ | ||
1325 | + b_item.goods_num=good['viplimited']; | ||
1326 | + } | ||
1327 | + } | ||
1328 | + //不需要计算组合购的限购 | ||
1393 | 1329 | ||
1394 | - if(b_item.goods_num>redis_num){ | ||
1395 | - b_item.goods_num=redis_num; | ||
1396 | - } | 1330 | + back_goods_arr.push(b_item); //返回商品元素 |
1397 | 1331 | ||
1398 | - if(cart_num+buynum>prom['buy_limit']){ | ||
1399 | - err_text+= good['goods_name']+"超出活动限购\n";continue; | ||
1400 | - } | ||
1401 | - prom['buy_limit'] -= (cart_num+buynum); | ||
1402 | - if(b_item.goods_num>prom['buy_limit']){ | ||
1403 | - b_item.goods_num=prom['buy_limit']; | ||
1404 | - } | 1332 | + }else{ |
1405 | 1333 | ||
1406 | - } | ||
1407 | - back_goods_arr.push(b_item); //返回商品元素 | ||
1408 | - } | ||
1409 | - } | ||
1410 | - | ||
1411 | - //有重新购买的数据是时候,就要重新生成订单 | ||
1412 | - if(back_goods_arr.length>0){ | ||
1413 | - th.setData({back_goods_arr:back_goods_arr}); | ||
1414 | - if(!err_text){ | ||
1415 | - th.more_add_cart(); | ||
1416 | - }else{ | ||
1417 | - // 如果没有获取用户信息 | ||
1418 | - wx.showModal({ | ||
1419 | - title:'确定', | ||
1420 | - content: err_text+',确定要买其他商品码?', | ||
1421 | - success(res) { | ||
1422 | - if (res.confirm) { | ||
1423 | - //跳转到登录页 | ||
1424 | - th.more_add_cart(); | ||
1425 | - }else{ | ||
1426 | - wx.hideLoading(); | 1334 | + //-- 看一下购物车上有多少商品 -- |
1335 | + var cart_num=0; | ||
1336 | + await getApp().request.promiseGet("/api/weshop/cart/page", { | ||
1337 | + data: { | ||
1338 | + store_id: os.stoid, | ||
1339 | + user_id: getApp().globalData.user_id, | ||
1340 | + state:0, is_gift:0, | ||
1341 | + goods_id:good.goods_id | ||
1342 | + } | ||
1343 | + }).then(res=>{ | ||
1344 | + var num = 0; | ||
1345 | + if(res.data.code==0 && res.data.data && res.data.data.pageData) { | ||
1346 | + for (var i = 0; i < res.data.data.pageData.length; i++) { | ||
1347 | + num += res.data.data.pageData[i].goods_num; | ||
1348 | + } | ||
1349 | + } | ||
1350 | + cart_num=num; | ||
1351 | + }) | ||
1352 | + | ||
1353 | + | ||
1354 | + if(good.store_count<=0){ | ||
1355 | + err_text+= good['goods_name']+"库存不足\n"; | ||
1356 | + continue; | ||
1357 | + } | ||
1358 | + if(b_item.goods_num>good.store_count) | ||
1359 | + b_item.goods_num=good.store_count; | ||
1360 | + | ||
1361 | + var buynum=0; //商品已经购买多少件 | ||
1362 | + var promgoodsbuynum=0; //活动已经购买多少件 | ||
1363 | + var redis_num = 0; //redis库存 | ||
1364 | + | ||
1365 | + var req_data={ | ||
1366 | + store_id: os.stoid, | ||
1367 | + user_id: getApp().globalData.user_id, | ||
1368 | + goods_id: good.goods_id, | ||
1369 | + }; | ||
1370 | + | ||
1371 | + if(prom){ | ||
1372 | + req_data.prom_type= good.prom_type; | ||
1373 | + req_data.prom_id= good.prom_id; | ||
1374 | + b_item.prom_type=good.prom_type; | ||
1375 | + b_item.prom_id=good.prom_id; | ||
1376 | + | ||
1377 | + //------判断活动是否抢光----- | ||
1378 | + await getApp().request.promiseGet("/api/weshop/activitylist/getActLen/" + | ||
1379 | + os.stoid + "/" + good.prom_type + "/" + good.prom_id, { | ||
1380 | + 1: 1 | ||
1381 | + }).then(res => { | ||
1382 | + redis_num = res.data.data; | ||
1383 | + }); | ||
1384 | + if(redis_num<=0){ | ||
1385 | + err_text+= good['goods_name']+"活动不足\n"; | ||
1386 | + continue; | ||
1387 | + } | ||
1388 | + | ||
1389 | + } | ||
1390 | + | ||
1391 | + //---要获得商品,该用户买了多少件,同步应用--- | ||
1392 | + await getApp().request.promiseGet("/api/weshop/ordergoods/getUserBuyGoodsNum", { | ||
1393 | + data: req_data, | ||
1394 | + }).then(res => { | ||
1395 | + if(res.data.code==0){ | ||
1396 | + var buy_num_data = res.data.data; | ||
1397 | + if (buy_num_data.promgoodsbuynum) promgoodsbuynum = buy_num_data.promgoodsbuynum; | ||
1398 | + buynum = buy_num_data.goodsbuynum; | ||
1399 | + } | ||
1400 | + }) | ||
1401 | + | ||
1402 | + //---- 要计算商品的限购 ----- | ||
1403 | + if(good['viplimited']>0){ | ||
1404 | + if(cart_num+buynum>good['viplimited']){ | ||
1405 | + err_text+= good['goods_name']+"超出限购\n"; | ||
1406 | + continue; | ||
1407 | + } | ||
1408 | + good['viplimited']-=(cart_num+buynum); | ||
1409 | + if(b_item.goods_num>good['viplimited']){ | ||
1410 | + b_item.goods_num=good['viplimited']; | ||
1411 | + } | ||
1412 | + | ||
1413 | + } | ||
1414 | + | ||
1415 | + //-- 判断活动的库存 -- | ||
1416 | + if(prom) { | ||
1417 | + if (prom['goods_num'] <= prom['buy_num']) { | ||
1418 | + err_text += good['goods_name'] + "超出活动库存\n"; | ||
1419 | + continue; | ||
1420 | + } | ||
1421 | + | ||
1422 | + if (b_item.goods_num > prom['goods_num'] - prom['buy_num']) { | ||
1423 | + b_item['goods_num'] = b_item['goods_num'] - b_item['buy_num']; | ||
1424 | + } | ||
1425 | + | ||
1426 | + if (b_item.goods_num > redis_num) { | ||
1427 | + b_item.goods_num = redis_num; | ||
1428 | + } | ||
1429 | + | ||
1430 | + if (prom['buy_limit'] > 0) { | ||
1431 | + if (cart_num + buynum > prom['buy_limit']) { | ||
1432 | + err_text += good['goods_name'] + "超出活动限购\n"; | ||
1433 | + continue; | ||
1434 | + } | ||
1435 | + prom['buy_limit'] -= (cart_num + buynum); | ||
1436 | + if (b_item.goods_num > prom['buy_limit']) { | ||
1437 | + b_item.goods_num = prom['buy_limit']; | ||
1438 | + } | ||
1439 | + } | ||
1440 | + } | ||
1441 | + | ||
1442 | + | ||
1443 | + back_goods_arr.push(b_item); //返回商品元素 | ||
1444 | + } | ||
1445 | + } | ||
1446 | + | ||
1447 | + //有重新购买的数据是时候,就要重新生成订单 | ||
1448 | + if(back_goods_arr.length>0){ | ||
1449 | + th.setData({back_goods_arr:back_goods_arr}); | ||
1450 | + if(!err_text){ | ||
1451 | + th.more_add_cart(); | ||
1452 | + }else{ | ||
1453 | + wx.hideLoading(); | ||
1454 | + // 如果没有获取用户信息 | ||
1455 | + wx.showModal({ | ||
1456 | + title:'确定', | ||
1457 | + content: err_text+',确定要买其他商品码?', | ||
1458 | + success(res) { | ||
1459 | + if (res.confirm) { | ||
1460 | + //跳转到登录页 | ||
1461 | + th.more_add_cart(); | ||
1462 | + }else{ | ||
1463 | + th.data.moring=0; | ||
1464 | + wx.hideLoading(); | ||
1465 | + } | ||
1466 | + },fail(){ | ||
1427 | th.data.moring=0; | 1467 | th.data.moring=0; |
1468 | + wx.hideLoading(); | ||
1428 | } | 1469 | } |
1429 | - }, | ||
1430 | - fail: function (res) { | ||
1431 | - wx.hideLoading(); | ||
1432 | - th.data.moring=0; | ||
1433 | - },//接口调用失败的回调函数 | ||
1434 | - }); | ||
1435 | - | ||
1436 | - } | ||
1437 | - }else{ | ||
1438 | - wx.hideLoading(); | ||
1439 | - this.data.moring=0; | ||
1440 | - getApp().confirmBox(err_text); | ||
1441 | - } | ||
1442 | - }, | 1470 | + }); |
1471 | + | ||
1472 | + } | ||
1473 | + }else{ | ||
1474 | + th.data.moring=0; | ||
1475 | + wx.hideLoading(); | ||
1476 | + getApp().confirmBox(err_text); | ||
1477 | + } | ||
1478 | + }, | ||
1443 | 1479 | ||
1444 | more_add_cart:async function(){ | 1480 | more_add_cart:async function(){ |
1445 | var back_goods_arr=this.data.back_goods_arr; | 1481 | var back_goods_arr=this.data.back_goods_arr; |
pages/user/order_list/order_list.wxml
@@ -241,7 +241,10 @@ | @@ -241,7 +241,10 @@ | ||
241 | <view class="offline-container" wx:else> | 241 | <view class="offline-container" wx:else> |
242 | <view class="offline-list"> | 242 | <view class="offline-list"> |
243 | <view class="item" wx:for="{{list2}}"> | 243 | <view class="item" wx:for="{{list2}}"> |
244 | - <view class="title"><text class="iconfont icon-order"></text>单号:{{item.No}}</view> | 244 | + <view class="title"> |
245 | + <view><text class="iconfont icon-order"></text>单号:{{item.No}}</view> | ||
246 | + <view>{{item.states}}</view> | ||
247 | + </view> | ||
245 | <view class="subtitle"> | 248 | <view class="subtitle"> |
246 | <text>{{item.BillDate}}</text> | 249 | <text>{{item.BillDate}}</text> |
247 | <view>消费总额:<text class="co-red fs28">¥{{item.Sum}}</text></view> | 250 | <view>消费总额:<text class="co-red fs28">¥{{item.Sum}}</text></view> |
pages/user/order_list/order_list.wxss
@@ -566,6 +566,7 @@ page { | @@ -566,6 +566,7 @@ page { | ||
566 | padding: 20rpx; | 566 | padding: 20rpx; |
567 | font-size: 26rpx; | 567 | font-size: 26rpx; |
568 | display: flex; | 568 | display: flex; |
569 | + justify-content: space-between; | ||
569 | align-items: center; | 570 | align-items: center; |
570 | } | 571 | } |
571 | .icon-order { | 572 | .icon-order { |