Commit 1087880b91a83aaffc706906ebd6592c12b9b1d7

Authored by yvan.ni
1 parent 26945329

秒杀规则优化

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>
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);
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/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 },
@@ -2263,6 +2253,9 @@ Page({ @@ -2263,6 +2253,9 @@ Page({
2263 }) 2253 })
2264 break 2254 break
2265 2255
  2256 + case 8:
  2257 + continue;
  2258 +
2266 } 2259 }
2267 2260
2268 2261
@@ -2344,10 +2337,8 @@ Page({ @@ -2344,10 +2337,8 @@ Page({
2344 }); 2337 });
2345 2338
2346 2339
2347 -  
2348 that.check_is_youhui(gid, that.data.is_normal); 2340 that.check_is_youhui(gid, that.data.is_normal);
2349 2341
2350 - var ty = 0;  
2351 this.get_sto(that.data.is_normal); 2342 this.get_sto(that.data.is_normal);
2352 2343
2353 2344
@@ -2388,11 +2379,14 @@ Page({ @@ -2388,11 +2379,14 @@ Page({
2388 async sele_spec_chech_activity() { 2379 async sele_spec_chech_activity() {
2389 //---如果是活动的时候--- 2380 //---如果是活动的时候---
2390 var prom = null, goodsinfo = this.data.sele_g, th = this; 2381 var prom = null, goodsinfo = this.data.sele_g, th = this;
  2382 + var user_id=getApp().globalData.user_id;
  2383 + if(!user_id) user_id=0;
2391 if (goodsinfo.prom_type == 1) { 2384 if (goodsinfo.prom_type == 1) {
2392 - await getApp().request.promiseGet("/api/ms/flash_sale/get/" + os.stoid + "/" + goodsinfo.prom_id, { 2385 + await getApp().request.promiseGet("/api/ms/flash_sale/getNew/" + os.stoid + "/" +user_id+"/"+ goodsinfo.prom_id, {
2393 }).then(res => { 2386 }).then(res => {
2394 if (res.data.code == 0) { 2387 if (res.data.code == 0) {
2395 - prom = res.data.data; 2388 + prom = res.data.data;
  2389 + prom.price=prom.user_price;
2396 } 2390 }
2397 }) 2391 })
2398 } 2392 }
@@ -2417,16 +2411,53 @@ Page({ @@ -2417,16 +2411,53 @@ Page({
2417 //----------如果有活动,并且在进行中,就不计算线下库存--------------- 2411 //----------如果有活动,并且在进行中,就不计算线下库存---------------
2418 var now = ut.gettimestamp(); 2412 var now = ut.gettimestamp();
2419 if (prom) { 2413 if (prom) {
2420 - if (prom.is_end == 0 && prom.end_time > now && prom.start_time < now) { 2414 +
  2415 + var t1=prom.start_time;
  2416 + var prom_st=1;
  2417 + if(prom.show_time){
  2418 + t1=prom.show_time;
  2419 + if(prom.start_time>now) prom_st=0;
  2420 + }
  2421 + if (prom.is_end == 0 && prom.end_time > now && t1 < now) {
2421 th.setData({ 2422 th.setData({
2422 prom_type: goodsinfo.prom_type, 2423 prom_type: goodsinfo.prom_type,
2423 prom_price: prom.price, 2424 prom_price: prom.price,
2424 prom_buy_limit: prom.buy_limit, 2425 prom_buy_limit: prom.buy_limit,
2425 prom_end_time: prom.end_time, 2426 prom_end_time: prom.end_time,
2426 prom_start_time: prom.start_time, 2427 prom_start_time: prom.start_time,
2427 - prom_st: 1, 2428 + prom_st: prom_st,
  2429 + prom_act: prom,
  2430 + prom_id:prom.id
2428 }) 2431 })
2429 - return false; 2432 +
  2433 + //却换图片
  2434 + th.init(goodsinfo.goods_id);
  2435 + var newTime = ut.gettimestamp();
  2436 + var endTime2 = prom.end_time;
  2437 + var endTime1 = prom.start_time;
  2438 +
  2439 + this.data.is_timer=0;
  2440 +
  2441 + setTimeout(function () {
  2442 + th.data.is_timer=1;
  2443 + if (endTime1 > newTime) {
  2444 + th.setData({
  2445 + prom_time_text: '距秒杀开始还有'
  2446 + })
  2447 + th.countDown(endTime1, 0);
  2448 + } else {
  2449 + if (endTime2 > newTime) {
  2450 + th.setData({
  2451 + prom_time_text: '距秒杀结束还有',
  2452 + prom_st: 1
  2453 + })
  2454 + th.countDown(endTime2);
  2455 + }
  2456 + }
  2457 +
  2458 + },1000)
  2459 +
  2460 + return false;
2430 } 2461 }
2431 } 2462 }
2432 //---设置普通商品--- 2463 //---设置普通商品---
@@ -2484,13 +2515,6 @@ Page({ @@ -2484,13 +2515,6 @@ Page({
2484 if (!th.data.def_pick_store && th.data.fir_def_store) { 2515 if (!th.data.def_pick_store && th.data.fir_def_store) {
2485 th.setData({ def_pick_store: th.data.fir_def_store }); 2516 th.setData({ def_pick_store: th.data.fir_def_store });
2486 } 2517 }
2487 -  
2488 - /*--最新的,不用这里筛选配送方式  
2489 - 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 ){  
2490 - th.setData({def_pick_store:null});  
2491 - }--*/  
2492 -  
2493 -  
2494 wx.showLoading({ 2518 wx.showLoading({
2495 title: '加载中.' 2519 title: '加载中.'
2496 }); 2520 });
@@ -2856,9 +2880,7 @@ Page({ @@ -2856,9 +2880,7 @@ Page({
2856 2880
2857 //------隐藏取货门店2级---- 2881 //------隐藏取货门店2级----
2858 hide_sec_mend: function () { 2882 hide_sec_mend: function () {
2859 - this.setData({  
2860 - is_sec_mend: 0,  
2861 - }); 2883 + this.setData({ is_sec_mend: 0, });
2862 }, 2884 },
2863 2885
2864 //评论的调用 2886 //评论的调用
@@ -2872,7 +2894,7 @@ Page({ @@ -2872,7 +2894,7 @@ Page({
2872 parent_id: 0, goods_id: th.data.gid, commenttype: tp, 2894 parent_id: 0, goods_id: th.data.gid, commenttype: tp,
2873 } 2895 }
2874 if (getApp().globalData.userInfo) { 2896 if (getApp().globalData.userInfo) {
2875 - req_where.userId = getApp().globalData.userInfo.user_id; 2897 + req_where.userId = getApp().globalData.user_id;
2876 } 2898 }
2877 2899
2878 var rs_data = null; 2900 var rs_data = null;
@@ -2940,12 +2962,13 @@ Page({ @@ -2940,12 +2962,13 @@ Page({
2940 2962
2941 //--------检查是否活动,活动是否开始,或者是否结束------- 2963 //--------检查是否活动,活动是否开始,或者是否结束-------
2942 async check_prom(gid, prom_type, prom_id) { 2964 async check_prom(gid, prom_type, prom_id) {
2943 - var ee = this,  
2944 - th = ee; 2965 + var ee = this,th = ee;
  2966 + var user_id=getApp().globalData.user_id;
  2967 + if(!user_id) user_id=0;
  2968 +
2945 if (prom_type == 3 || prom_type == 0 || prom_type == 2 || prom_type == 5 || prom_type == 7) { 2969 if (prom_type == 3 || prom_type == 0 || prom_type == 2 || prom_type == 5 || prom_type == 7) {
2946 this.setData({ 2970 this.setData({
2947 - prom_type: 0,  
2948 - isshow: 1, 2971 + prom_type: 0,isshow: 1,
2949 }); 2972 });
2950 return false; 2973 return false;
2951 } 2974 }
@@ -2964,8 +2987,7 @@ Page({ @@ -2964,8 +2987,7 @@ Page({
2964 prom_r_null: 1 2987 prom_r_null: 1
2965 }); 2988 });
2966 //拿取价格并且判断时间-- 2989 //拿取价格并且判断时间--
2967 - getApp().request.get("/api/ms/flash_sale/get/" +  
2968 - os.stoid + "/" + prom_id, { 2990 + getApp().request.get("/api/ms/flash_sale/getNew/" +os.stoid + "/" +user_id+"/"+ prom_id, {
2969 success: function (t) { 2991 success: function (t) {
2970 if (t.data.code != 0) { 2992 if (t.data.code != 0) {
2971 ee.setData({ 2993 ee.setData({
@@ -3012,7 +3034,7 @@ Page({ @@ -3012,7 +3034,7 @@ Page({
3012 var prom_start_time = ut.formatTime(t.data.data.start_time, "yyyy-MM-dd hh:mm:ss"); 3034 var prom_start_time = ut.formatTime(t.data.data.start_time, "yyyy-MM-dd hh:mm:ss");
3013 3035
3014 ee.setData({ 3036 ee.setData({
3015 - prom_price: t.data.data.price, 3037 + prom_price: t.data.data.user_price,
3016 prom_type: 1, 3038 prom_type: 1,
3017 prom_id: prom_id, 3039 prom_id: prom_id,
3018 prom_buy_limit: t.data.data.buy_limit, 3040 prom_buy_limit: t.data.data.buy_limit,
@@ -3023,17 +3045,9 @@ Page({ @@ -3023,17 +3045,9 @@ Page({
3023 }); 3045 });
3024 3046
3025 ee.get_sto(); 3047 ee.get_sto();
3026 -  
3027 -  
3028 var newTime = ut.gettimestamp(); 3048 var newTime = ut.gettimestamp();
3029 var endTime2 = t.data.data.end_time; 3049 var endTime2 = t.data.data.end_time;
3030 var endTime1 = t.data.data.start_time; 3050 var endTime1 = t.data.data.start_time;
3031 -  
3032 - //---苹果机不兼容---  
3033 - /*----  
3034 - var endTime2 = new Date(prom_end_time).getTime();  
3035 - var endTime1 = new Date(prom_start_time).getTime();----*/  
3036 -  
3037 if (endTime1 > newTime) { 3051 if (endTime1 > newTime) {
3038 ee.setData({ 3052 ee.setData({
3039 prom_time_text: '距秒杀开始还有' 3053 prom_time_text: '距秒杀开始还有'
@@ -3048,6 +3062,56 @@ Page({ @@ -3048,6 +3062,56 @@ Page({
3048 ee.countDown(endTime2); 3062 ee.countDown(endTime2);
3049 } 3063 }
3050 } 3064 }
  3065 +
  3066 + //如果是进行中的话
  3067 + if (endTime1 < newTime) {
  3068 + //-- 获取秒杀活动的多少规格 --
  3069 + ee.get_more_flahs(function (list) {
  3070 + if (list && list.length > 1) {
  3071 +
  3072 + var n_item = list[0];
  3073 + var ind = list.findIndex(function (ele) {
  3074 + return ele.goods_id == ee.data.data.goods_id;
  3075 + })
  3076 + if (ind < 0) return false;
  3077 + if (ind > 0) {
  3078 + n_item = JSON.parse(JSON.stringify(list[ind]));
  3079 + list.splice(ind, 1);
  3080 + list.unshift(n_item);
  3081 + }
  3082 +
  3083 + ee.data.sele_g.viplimited = n_item.viplimited;
  3084 + ee.data.data.viplimited = n_item.viplimited;
  3085 +
  3086 + var gb = 1;
  3087 + //-- 显示多规格 --
  3088 + for (let i in list) {
  3089 + let item = list[i];
  3090 + var gg = "";
  3091 + if (item.goods_spec == "null" || item.goods_spec == null) item.goods_spec = "";
  3092 + if (item.goods_color == "null" || item.goods_color == null) item.goods_color = "";
  3093 +
  3094 + if (item.goods_spec != "" && item.goods_color != "") {
  3095 + gg = item.goods_spec + "/" + item.goods_color;
  3096 + } else if (item.goods_spec != "" || item.goods_color != "") {
  3097 + gg = item.goods_spec + item.goods_color;
  3098 + } else {
  3099 + gg = "规格" + gb;
  3100 + gb++;
  3101 + }
  3102 + item.gg = gg;
  3103 + item.prom_id = item.prom_id;
  3104 + item.prom_type = 1;
  3105 + }
  3106 +
  3107 + ee.setData({
  3108 + sku_g: list,
  3109 + });
  3110 +
  3111 + }
  3112 + })
  3113 + }
  3114 +
3051 } 3115 }
3052 }); 3116 });
3053 } 3117 }
@@ -3103,7 +3167,6 @@ Page({ @@ -3103,7 +3167,6 @@ Page({
3103 3167
3104 } 3168 }
3105 3169
3106 -  
3107 //---判断拼单---- 3170 //---判断拼单----
3108 if (prom_type == 6) { 3171 if (prom_type == 6) {
3109 //-------判断活动是否抢光--------- 3172 //-------判断活动是否抢光---------
@@ -4125,9 +4188,7 @@ Page({ @@ -4125,9 +4188,7 @@ Page({
4125 } 4188 }
4126 4189
4127 if (this.data.share_hidden) { 4190 if (this.data.share_hidden) {
4128 - this.setData({  
4129 - share_hidden: false,  
4130 - }); 4191 + this.setData({ share_hidden: false,});
4131 }; 4192 };
4132 4193
4133 //类型 0普通商品 1秒杀商品 2商家和会员团 3阶梯团 4阶梯团 4194 //类型 0普通商品 1秒杀商品 2商家和会员团 3阶梯团 4阶梯团
@@ -4135,11 +4196,8 @@ Page({ @@ -4135,11 +4196,8 @@ Page({
4135 if (type == 6) type = 2; 4196 if (type == 6) type = 2;
4136 if (this.data.prom_act && this.data.prom_act.kttype == 3) type = 3; 4197 if (this.data.prom_act && this.data.prom_act.kttype == 3) type = 3;
4137 4198
4138 - wx.showLoading({  
4139 - title: '生成中...',  
4140 - })  
4141 - var that = this,  
4142 - th = that; 4199 + wx.showLoading({ title: '生成中...',})
  4200 + var that = this, th = that;
4143 //设置画板显示,才能开始绘图 4201 //设置画板显示,才能开始绘图
4144 that.setData({ 4202 that.setData({
4145 canvasHidden: false 4203 canvasHidden: false
@@ -4149,6 +4207,10 @@ Page({ @@ -4149,6 +4207,10 @@ Page({
4149 var unit = that.data.screenWidth / 750 * 1.35; //基础单位, 4207 var unit = that.data.screenWidth / 750 * 1.35; //基础单位,
4150 var path2 = that.data.data.original_img; 4208 var path2 = that.data.data.original_img;
4151 var scene = th.data.gid + ""; 4209 var scene = th.data.gid + "";
  4210 +
  4211 + if(th.data.sele_g.prom_type==1){
  4212 + scene+="."+th.data.sele_g.prom_type+"."+th.data.sele_g.prom_id;
  4213 + }
4152 var user_id = getApp().globalData.user_id ? getApp().globalData.user_id : 0; 4214 var user_id = getApp().globalData.user_id ? getApp().globalData.user_id : 0;
4153 if (user_id > 0) { 4215 if (user_id > 0) {
4154 scene += "_" + user_id; 4216 scene += "_" + user_id;
@@ -5537,9 +5599,6 @@ Page({ @@ -5537,9 +5599,6 @@ Page({
5537 this.add_cart_func_inte(t); 5599 this.add_cart_func_inte(t);
5538 }, 5600 },
5539 5601
5540 -  
5541 -  
5542 -  
5543 onShareTimeline() { 5602 onShareTimeline() {
5544 var store_name = getApp().globalData.config ? getApp().globalData.config.store_name : ''; 5603 var store_name = getApp().globalData.config ? getApp().globalData.config.store_name : '';
5545 if (!store_name) 5604 if (!store_name)
@@ -5599,7 +5658,7 @@ Page({ @@ -5599,7 +5658,7 @@ Page({
5599 check_zh_acting: function (func) { 5658 check_zh_acting: function (func) {
5600 var isok = 1, item = this.data.sele_g; 5659 var isok = 1, item = this.data.sele_g;
5601 //如果有组合购 5660 //如果有组合购
5602 - var url = "/api/weshop/prom/zhbuy/get/" + os.stoid + "/" + item.prom_id + "/" + getApp().globalData.userInfo.user_id; 5661 + var url = "/api/weshop/prom/zhbuy/get/" + os.stoid + "/" + item.prom_id + "/" + getApp().globalData.user_id;
5603 getApp().request.promiseGet(url, {}).then(res => { 5662 getApp().request.promiseGet(url, {}).then(res => {
5604 if (res.data.code == 0 && res.data.data) { 5663 if (res.data.code == 0 && res.data.data) {
5605 if (res.data.data.is_show != 1) { 5664 if (res.data.data.is_show != 1) {
@@ -5625,5 +5684,76 @@ Page({ @@ -5625,5 +5684,76 @@ Page({
5625 item.act = res.data.data; 5684 item.act = res.data.data;
5626 func(isok); 5685 func(isok);
5627 }) 5686 })
5628 - } 5687 + },
  5688 +
  5689 + //获取更多秒杀
  5690 + get_more_flahs: async function (func) {
  5691 + var f_more=false;
  5692 + var user_id=getApp().globalData.user_id;
  5693 + if(!user_id) user_id=0;
  5694 +
  5695 + var url="/api/weshop/goods/listSkuFlash?store_id="+os.stoid+"&goods_id="+this.data.data.goods_id+"&user_id="+user_id;
  5696 + //获取秒杀的多规格
  5697 + await getApp().request.promiseGet(url, {}).then(res=>{
  5698 + if(res.data.code==0 && res.data.data && res.data.data.length>0){
  5699 + f_more=res.data.data;
  5700 + }
  5701 + })
  5702 + if(!f_more) {
  5703 + func(false);
  5704 + return false;
  5705 + }
  5706 + //-- 秒杀的价格要更新 --
  5707 + for(let i in f_more){
  5708 +
  5709 + let item=f_more[i];
  5710 + f_more[i].prom_id=item.act_id;
  5711 + f_more[i].prom_type=1;
  5712 + if(item.goods_id==this.data.data.goods_id){
  5713 + continue;
  5714 + }
  5715 + var url="/api/ms/flash_sale/getNew/"+os.stoid+"/"+user_id+"/"+item.act_id;
  5716 + await getApp().request.promiseGet(url, {}).then(rs=>{
  5717 + if(rs.data.code==0){
  5718 + f_more[i].price=rs.data.data.user_price;
  5719 +
  5720 + }
  5721 + })
  5722 + }
  5723 + func(f_more);
  5724 +
  5725 + },
  5726 +
  5727 + //-- 判断是否有秒杀 --
  5728 + check_has_flash:function () {
  5729 + var th=this;
  5730 + var url="/api/weshop/activitylist/getGoodActInfo";
  5731 + var req_data={
  5732 + store_id:os.stoid,goodsidlist:this.data.data.goods_id,is_detail:1
  5733 + };
  5734 + //获取秒杀的多规格
  5735 + getApp().request.promiseGet(url, {data:req_data}).then(res=>{
  5736 + if(res.data.code==0 && res.data.data){
  5737 + th.setData({more_flash:res.data.data});
  5738 + }else{
  5739 + func(false);
  5740 + }
  5741 + })
  5742 + },
  5743 +
  5744 + //-- 跳转到秒杀商品详情页 --
  5745 + go_more_flash:function (e) {
  5746 + var prom_id=e.currentTarget.dataset.id;
  5747 + var goods_id=this.data.data.goods_id;
  5748 + var url="/pages/goods/goodsInfo/goodsInfo?goods_id="+goods_id+"&prom_id="+prom_id+"&prom_type=1";
  5749 + getApp().goto(url);
  5750 + },
  5751 +
  5752 + close_pop_more:function () {
  5753 + this.setData({is_pop_more:0})
  5754 + }
  5755 +
  5756 +
  5757 +
  5758 +
5629 }); 5759 });
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 暂时注释 -->
@@ -538,6 +532,29 @@ @@ -538,6 +532,29 @@
538 </view> 532 </view>
539 </view> 533 </view>
540 </block> 534 </block>
  535 + <!-- 判断是不是有秒杀 -->
  536 + <block wx:if="{{more_flash}}">
  537 +
  538 + <block wx:for="{{more_flash}}">
  539 +
  540 + <view class="cx-frame flex" style="position: relative; height: auto" wx:if="{{item.prom_type==1}}" >
  541 + <view class="cx-sizs wsize" style="width: 144rpx">秒杀</view>
  542 + <!-- 中间显示层 -->
  543 + <view class="flex ai-center jc_sb" style="width: 570rpx" bindtap="go_more_flash" data-id="{{item.act_id}}">
  544 + <view class="flex">
  545 + <view class="miao_lab">秒</view>
  546 + <view class="order_hui">
  547 + <view class="fs28 ellipsis-1">{{item.act_name}}</view>
  548 + <view class="fs26">
  549 + (活动时间:{{tool.format_tt(item.s_time)}} - {{tool.format_tt(item.e_time)}})
  550 + </view>
  551 + </view>
  552 + </view>
  553 + <view><text class="bg_jj is_more_cx" style="position: relative;top:-10rpx"></text></view>
  554 + </view>
  555 + </view>
  556 + </block>
  557 + </block>
541 <view class="bz_view flex bdt16" wx:if="{{bconfig}}" style=""> 558 <view class="bz_view flex bdt16" wx:if="{{bconfig}}" style="">
542 <image class="bzfu_img" src="{{iurl}}/miniapp/images/bzfu_w.png"></image> 559 <image class="bzfu_img" src="{{iurl}}/miniapp/images/bzfu_w.png"></image>
543 <view class="flex f1 ai_c rel"> 560 <view class="flex f1 ai_c rel">
@@ -629,13 +646,6 @@ @@ -629,13 +646,6 @@
629 </view> 646 </view>
630 <!-- 图文详情 --> 647 <!-- 图文详情 -->
631 <view class="bdt16"> 648 <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"> 649 <view class="t_g_info">
640 <view class="red_shu"></view> 650 <view class="red_shu"></view>
641 <view class="fs30 bold">商品详情</view> 651 <view class="fs30 bold">商品详情</view>
@@ -1518,4 +1528,27 @@ @@ -1518,4 +1528,27 @@
1518 </view> 1528 </view>
1519 </view> 1529 </view>
1520 </view> 1530 </view>
1521 -</view>  
1522 \ No newline at end of file 1531 \ No newline at end of file
  1532 +</view>
  1533 +
  1534 +<!-- 商品要加入购物车 -->
  1535 +<view class="pop_more_act" wx:if="{{is_pop_more}}">
  1536 + <view class="cover-layer" bindtap="close_pop_more"></view>
  1537 + <view class="content">
  1538 + <view class="main pd20">
  1539 + <view class="t-c fs36" style="color: #c3172d">提示</view>
  1540 +
  1541 + <block wx:for="{{more_flash}}">
  1542 + <view bindtap="go_more_flash" data-id="{{item.act_id}}" class="flex jc_sb fs28 mt20" wx:if="{{item.prom_type==1}}">
  1543 + <view class="ellipsis-2" style="max-width: 80%">该商品有参与{{item.act_name}} {{tool.act_type(item.prom_type)}} 活动</view>
  1544 + <view class="fs26 c-7b">去参与
  1545 + <text class="bg_jj is_more_cx"></text>
  1546 + </view>
  1547 + </view>
  1548 + </block>
  1549 +
  1550 + <view style="margin-top: 30rpx" bindtap="open_next">
  1551 + <button class="p_btn">继续加入购物车</button>
  1552 + </view>
  1553 + </view>
  1554 + </view>
  1555 +</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/index/index/index.js
@@ -331,6 +331,49 @@ Page({ @@ -331,6 +331,49 @@ Page({
331 }) 331 })
332 332
333 333
  334 + //-----秒杀-----
  335 + var flash_data = null;
  336 + var f_req={
  337 + store_id: os.stoid,
  338 + timetype: 2,
  339 + is_end: 0,
  340 + is_show: 1,
  341 + pageSize: 9,
  342 + user_id:0
  343 + };
  344 + if(user_id) f_req.user_id=user_id;
  345 + //--获取活动--
  346 + await getApp().request.promiseGet("/api/ms/flash_sale/spikepage", {
  347 + data:f_req ,
  348 + }).then(res => {
  349 + var e = res;
  350 + if (e.data.code == 0) {
  351 + flash_data = e.data.data.pageData;
  352 + if (flash_data == null || flash_data.length <= 0) return false;
  353 +
  354 + //当前时间戳
  355 + var nt = ut.gettimestamp();
  356 +
  357 + flash_data.forEach(function (val, ind) {
  358 +
  359 + if(val.user_price) val.price=val.user_price;
  360 + if (val.start_time > nt) flash_data[ind].status = 0;
  361 + else if (val.end_time > nt) flash_data[ind].status = 1;
  362 + if (val.buy_num >= val.goods_num) flash_data[ind].status = 2;
  363 + });
  364 +
  365 + var arr = new Array();
  366 + //--三个三个一组---
  367 + for (var i = 0; i < flash_data.length; i += 3) {
  368 + arr.push(flash_data.slice(i, i + 3));
  369 + }
  370 + th.setData({
  371 + saleGoods: arr
  372 + });
  373 + }
  374 + });
  375 +
  376 +
334 377
335 //优惠券要实时更新 378 //优惠券要实时更新
336 getApp().getConfig2(function (e) { 379 getApp().getConfig2(function (e) {
@@ -454,45 +497,6 @@ Page({ @@ -454,45 +497,6 @@ Page({
454 } 497 }
455 }) 498 })
456 499
457 - //-----秒杀-----  
458 - var flash_data = null;  
459 - //--获取活动--  
460 - await getApp().request.promiseGet("/api/ms/flash_sale/spikepage", {  
461 - data: {  
462 - store_id: os.stoid,  
463 - timetype: 2,  
464 - is_end: 0,  
465 - is_show: 1,  
466 - pageSize: 9  
467 - },  
468 - }).then(res => {  
469 - var e = res;  
470 - if (e.data.code == 0) {  
471 - flash_data = e.data.data.pageData;  
472 - if (flash_data == null || flash_data.length <= 0) return false;  
473 -  
474 - //当前时间戳  
475 - var nt = ut.gettimestamp();  
476 -  
477 - flash_data.forEach(function (val, ind) {  
478 - if (val.start_time > nt) flash_data[ind].status = 0;  
479 - else if (val.end_time > nt) flash_data[ind].status = 1;  
480 - if (val.buy_num >= val.goods_num) flash_data[ind].status = 2;  
481 - });  
482 -  
483 - var arr = new Array();  
484 - //--三个三个一组---  
485 - for (var i = 0; i < flash_data.length; i += 3) {  
486 - arr.push(flash_data.slice(i, i + 3));  
487 - }  
488 - th.setData({  
489 - saleGoods: arr  
490 - });  
491 - //th.countDown();  
492 - }  
493 - });  
494 -  
495 -  
496 //----拼单----- 500 //----拼单-----
497 await getApp().request.promiseGet("/api/weshop/teamlist/pageteam/2", { 501 await getApp().request.promiseGet("/api/weshop/teamlist/pageteam/2", {
498 data: { 502 data: {
pages/index/index/index.wxml
@@ -155,7 +155,7 @@ @@ -155,7 +155,7 @@
155 <view class="seckill-list"> 155 <view class="seckill-list">
156 <swiper class="s_prom" indicator-dots="{{false}}" bindchange="flashSwiperChange" next-margin="105rpx"> 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;"> 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"> 158 + <navigator 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: 70rpx;">{{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/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
@@ -497,7 +497,7 @@ Page({ @@ -497,7 +497,7 @@ Page({
497 await getApp().request.promiseGet("/api/weshop/ordergoods/getUserBuyGoodsNum", { 497 await getApp().request.promiseGet("/api/weshop/ordergoods/getUserBuyGoodsNum", {
498 data: { 498 data: {
499 store_id: os.stoid, 499 store_id: os.stoid,
500 - user_id: getApp().globalData.user_id, 500 + user_id: user_id,
501 goods_id: good.goods_id, 501 goods_id: good.goods_id,
502 prom_type: good.prom_type, 502 prom_type: good.prom_type,
503 prom_id: good.prom_id 503 prom_id: good.prom_id
@@ -567,12 +567,9 @@ Page({ @@ -567,12 +567,9 @@ Page({
567 }) 567 })
568 568
569 var num = good['buyqty']; 569 var num = good['buyqty'];
570 - console.log(1111);  
571 - console.log(num);  
572 //---- 要计算商品的限购 ----- 570 //---- 要计算商品的限购 -----
573 if (good['buyqty'] > 0) { 571 if (good['buyqty'] > 0) {
574 if (good.goods_num + promgoodsbuynum > good['buyqty']) { 572 if (good.goods_num + promgoodsbuynum > good['buyqty']) {
575 -  
576 var content = good['goods_name'] + "超出活动限购\n"; 573 var content = good['goods_name'] + "超出活动限购\n";
577 th.toast(content); 574 th.toast(content);
578 return false; 575 return false;
@@ -658,7 +655,7 @@ Page({ @@ -658,7 +655,7 @@ Page({
658 //商品的普通购买 ,不要进行判断 655 //商品的普通购买 ,不要进行判断
659 if ((good.prom_type == 1 || good.prom_type == 6 || good.prom_type == 4 || good.prom_type == 8) 656 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) { 657 && !good.is_gift && !good.is_collocation && !good.is_integral_normal && !good.is_pd_normal) {
661 - if (gg.prom_type != good.prom_type) { 658 + if (gg.prom_type != good.prom_type && gg.prom_type>0) {
662 var content = gg.goods_name + '商品的活动发生了变化,请取消订单重新购买'; 659 var content = gg.goods_name + '商品的活动发生了变化,请取消订单重新购买';
663 th.toast(content); 660 th.toast(content);
664 return false; 661 return false;
@@ -671,9 +668,10 @@ Page({ @@ -671,9 +668,10 @@ Page({
671 //---如果是活动的时候--- 668 //---如果是活动的时候---
672 var prom = null, th = this; 669 var prom = null, th = this;
673 if (gg.prom_type == 1) { 670 if (gg.prom_type == 1) {
674 - await getApp().request.promiseGet("/api/ms/flash_sale/get/" + os.stoid + "/" + gg.prom_id, {}).then(res => { 671 + await getApp().request.promiseGet("/api/ms/flash_sale/getNew/" + os.stoid + "/"+ user_id + "/" + gg.prom_id, {}).then(res => {
675 if (res.data.code == 0) { 672 if (res.data.code == 0) {
676 prom = res.data.data; 673 prom = res.data.data;
  674 + prom.price=prom.user_price;
677 } 675 }
678 }) 676 })
679 } 677 }
@@ -771,13 +769,13 @@ Page({ @@ -771,13 +769,13 @@ Page({
771 } 769 }
772 } 770 }
773 771
774 - console.log("------------------------------------");  
775 //---如果是活动的时候--- 772 //---如果是活动的时候---
776 var prom = null, goodsinfo = good, th = this; 773 var prom = null, goodsinfo = good, th = this;
777 if (goodsinfo.prom_type == 1) { 774 if (goodsinfo.prom_type == 1) {
778 - await getApp().request.promiseGet("/api/ms/flash_sale/get/" + os.stoid + "/" + goodsinfo.prom_id, {}).then(res => { 775 + await getApp().request.promiseGet("/api/ms/flash_sale/getNew/" + os.stoid + "/"+ user_id + "/" + goodsinfo.prom_id, {}).then(res => {
779 if (res.data.code == 0) { 776 if (res.data.code == 0) {
780 prom = res.data.data; 777 prom = res.data.data;
  778 + prom.price=prom.user_price;
781 } 779 }
782 }) 780 })
783 } 781 }
@@ -803,7 +801,6 @@ Page({ @@ -803,7 +801,6 @@ Page({
803 if (prom) { 801 if (prom) {
804 var now = ut.gettimestamp(); 802 var now = ut.gettimestamp();
805 if (prom.is_end == 1 && prom.end_time < now) { 803 if (prom.is_end == 1 && prom.end_time < now) {
806 -  
807 var content = goodsinfo.goods_name + '商品的活动已经结束,请取消订单' 804 var content = goodsinfo.goods_name + '商品的活动已经结束,请取消订单'
808 th.toast(content); 805 th.toast(content);
809 return false; 806 return false;
@@ -817,6 +814,13 @@ Page({ @@ -817,6 +814,13 @@ Page({
817 return false; 814 return false;
818 } 815 }
819 816
  817 + // --看一下会员的秒杀价格是不是发生了变化,因为会员的身份发生了变化
  818 + if(goodsinfo.prom_type==1 && goodsinfo.goods_price!=prom.price){
  819 + var content=goodsinfo.goods_name+'秒杀活动的价格发生了变化';
  820 + th.toast(content);
  821 + return false;
  822 + }
  823 +
820 if (goodsinfo.prom_type == 4) { 824 if (goodsinfo.prom_type == 4) {
821 if (good.goods_num > prom.limitqty - prom.buy_num) { 825 if (good.goods_num > prom.limitqty - prom.buy_num) {
822 826
@@ -1058,388 +1062,413 @@ Page({ @@ -1058,388 +1062,413 @@ Page({
1058 var item=th.data.orderList[index]; 1062 var item=th.data.orderList[index];
1059 th.check_more_order(item); 1063 th.check_more_order(item);
1060 }, 1064 },
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 -  
1094 - //--获取商品--  
1095 - var good=null;  
1096 - await getApp().request.promiseGet("/api/weshop/goods/get/" + os.stoid + "/" + g_item.goods_id, {  
1097 1065
1098 - }).then(res=>{  
1099 - good=res.data.data;  
1100 - })  
1101 1066
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 - } 1067 + check_more_order:async function(item){
  1068 + var pickup=null,th=this;
  1069 + var user_id=getApp().globalData.user_id;
  1070 + wx.showLoading();
  1071 + //--------获取门店-----------
  1072 + await getApp().request.promiseGet("/api/weshop/pickup/get/" + os.stoid + "/" + item.pickup_id, {
  1073 +
  1074 + }).then(res=>{
  1075 + pickup = res.data.data;
  1076 + })
1110 1077
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 - } 1078 + //--------获取商品----------
  1079 + var goods_list=item.order_goods;
  1080 + //--- 返回的内容 ---
  1081 + var back_goods_arr=[];
  1082 + var err_text="";
  1083 + for(var i in goods_list){
  1084 + var g_item=goods_list[i];
  1085 + //--如果是赠品,不加入购物车--
  1086 + if(g_item['is_gift']) continue;
  1087 + if(g_item['prom_type']==4 ){
  1088 + err_text+= g_item['goods_name']+"积分购商品不加入购物车\n";
  1089 + continue;
  1090 + }
  1091 + if(g_item['prom_type']==5){
  1092 + err_text+= g_item['goods_name']+"搭配购商品不加入购物车\n";
  1093 + continue;
  1094 + }
  1095 + if(g_item['prom_type']==6 ){
  1096 + err_text+= g_item['goods_name']+"拼团商品不加入购物车\n";
  1097 + continue;
  1098 + }
1122 1099
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 - } 1100 + //--获取商品--
  1101 + var good=null;
  1102 + await getApp().request.promiseGet("/api/weshop/goods/get/" + os.stoid + "/" + g_item.goods_id, {
1128 1103
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 - } 1104 + }).then(res=>{
  1105 + good=res.data.data;
  1106 + })
1147 1107
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 - } 1108 + if(!good){
  1109 + err_text+= g_item['goods_name']+"未找到商品\n";
  1110 + continue;
  1111 + }
  1112 + if (good.is_on_sale != 1) {
  1113 + err_text+= g_item['goods_name']+"已经下架\n";
  1114 + continue;
  1115 + }
1187 1116
  1117 + var timestamp = ut.gettimestamp();
  1118 + if (good.on_time > timestamp) {
  1119 + err_text+= g_item['goods_name']+"还未上架\n";
  1120 + continue;
  1121 + }
  1122 + if (good.down_time > 0) {
  1123 + if (good.down_time < timestamp) {
  1124 + err_text+=g_item['goods_name']+"已经下架\n";
  1125 + continue;
  1126 + }
  1127 + }
1188 1128
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 - } 1129 + //如果商品的配送方式和门店不匹配
  1130 + if(good['distr_type']>0 && pickup['distr_type']>0 && good['distr_type']!=pickup['distr_type'] ){
  1131 + err_text+= good['goods_name']+"配送方式不一致\n";
  1132 + continue;
  1133 + }
1201 1134
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 - }) 1135 + var prom=null;
  1136 + var b_item={}
  1137 + b_item.goods_id=g_item.goods_id;
  1138 + b_item.goods_name=g_item.goods_name;
  1139 + b_item.goods_num=g_item.goods_num;
  1140 + b_item.guide_id=g_item.guide_id;
  1141 + b_item.guide_type=g_item.guide_type;
  1142 + b_item.pickup_id=item.pickup_id;
  1143 + b_item.price=good.shop_price;
  1144 + b_item.goods_sn=good.goods_sn;
  1145 + b_item.sku=good.sku;
  1146 + b_item.is_integral_normal=g_item.is_integral_normal;
  1147 +
  1148 + //-- 如果会员是等级卡的时候,同时商品也有设置相应的卡价格 --
  1149 + var card_field=th.data.card_field;
  1150 + if(card_field && good[card_field]>0){
  1151 + b_item.price=good[card_field];
  1152 + }
1223 1153
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; 1154 + var url="/api/weshop/activitylist/getGoodActInfo";
  1155 + var req_data={
  1156 + store_id:g_item.store_id,goodsidlist:g_item.goods_id,is_detail:1
  1157 + };
  1158 + await getApp().request.promiseGet(url, {data:req_data}).then(res=>{
  1159 + if(res.data.code==0){
  1160 + var list = res.data.data;
  1161 + for(let i in list){
  1162 + let item=list[i];
  1163 + if(item.prom_type==1){ good.prom_type=1; good.prom_id=item.act_id; }
1259 } 1164 }
1260 } 1165 }
1261 - var req_data={  
1262 - store_id: os.stoid,  
1263 - user_id: getApp().globalData.user_id,  
1264 - goods_id: good.goods_id,  
1265 - }; 1166 + })
1266 1167
1267 - if(b_item.prom_type==7){  
1268 - req_data.prom_type=7;  
1269 - req_data.prom_id=b_item.prom_id;  
1270 - }  
1271 1168
  1169 + if(!prom) {
  1170 + //--判断商品当前的活动情况--
  1171 + switch (good.prom_type) {
  1172 + case 1:
  1173 + var flash = null;
  1174 + await getApp().request.promiseGet("/api/ms/flash_sale/getNew/" + os.stoid + "/" + user_id + "/" + good.prom_id, {}).then(res => {
  1175 + if (res.data.code == 0) {
  1176 + flash = res.data.data;
  1177 + }
  1178 + })
  1179 + //----已经结束-----
  1180 + if (flash && flash.is_end == 0 && flash.end_time > timestamp && flash.start_time < timestamp) {
  1181 + prom = flash;
  1182 + prom.price = prom.user_price;
  1183 + b_item.price = prom.user_price;
  1184 + }
  1185 + break;
  1186 + case 6:
  1187 + b_item.is_pd_normal = 1;
  1188 + break;
  1189 + case 7:
  1190 + //如果有组合购
  1191 + var url = "/api/weshop/prom/zhbuy/get/" + os.stoid + "/" + good.prom_id + "/" + getApp().globalData.userInfo.user_id;
  1192 + await getApp().request.promiseGet(url, {}).then(res => {
  1193 + if (res.data.code == 0 && res.data.data) {
  1194 + if (res.data.data.is_show == 1 && res.data.data.is_end == 0
  1195 + && ut.gettimestamp() < res.data.data.end_time
  1196 + && ut.gettimestamp() > res.data.data.start_time
  1197 + ) {
  1198 + b_item.prom_type = 7;
  1199 + b_item.prom_id = res.data.data.id;
  1200 + good.prom_type = 7;
  1201 + good.prom_id = prom.b_item.prom_id;
1272 1202
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 - }) 1203 + }
  1204 + }
  1205 + })
  1206 + break;
  1207 + }
  1208 + }
1287 1209
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); //返回商品元素 1210 + //如果有优惠促销的时候,要看下商品的优惠活动有没有过期
  1211 + if(g_item.prom_type==3 || good.prom_type==3){
  1212 + await getApp().request.promiseGet("/api/weshop/goods/getGoodsPromList/" + os.stoid + "/" + good.goods_id + "/1", {}).then(res => {
  1213 + if (res.data.code == 0) {
  1214 + var r_data = res.data.data;
  1215 + if (r_data.promGoodsLists) {
  1216 + b_item.prom_type=3;
  1217 + b_item.prom_id=r_data.promGoodsLists[0].prom_id;
  1218 + }
  1219 + }
  1220 + })
  1221 + }
1301 1222
1302 - }else{  
1303 1223
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 - }) 1224 + //判断是不是线下库存的购买, 是不是秒杀活动
  1225 + if(th.data.sales_rules==2 && !prom){
1322 1226
  1227 + //-- 看一下购物车上有多少商品 --
  1228 + var cart_num=0;
  1229 + await getApp().request.promiseGet("/api/weshop/cart/page", {
  1230 + data: {
  1231 + store_id: os.stoid,
  1232 + user_id: getApp().globalData.user_id,
  1233 + state:0, is_gift:0,
  1234 + goods_id:good.goods_id,
  1235 + pick_id: b_item.pickup_id
  1236 + }
  1237 + }).then(res=>{
  1238 + var num = 0;
  1239 + if(res.data.code==0 && res.data.data && res.data.data.pageData) {
  1240 + for (var i = 0; i < res.data.data.pageData.length; i++) {
  1241 + num += res.data.data.pageData[i].goods_num;
  1242 + }
  1243 + }
  1244 + cart_num=num;
  1245 + })
1323 1246
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 - } 1247 + var lock=0,plist=null;
1357 1248
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 - } 1249 + if(b_item.prom_type!=7) {
  1250 + //先读取门店的lock,
  1251 + await getApp().request.promiseGet("/api/weshop/order/ware/lock/page", {
  1252 + data: {store_id: os.stoid, wareId: good.goods_id, storageId: b_item.pickup_id, pageSize: 1000}
  1253 + }).then(res => {
  1254 + if (res.data.code == 0 && res.data.data.total > 0) {
  1255 + for (var i in res.data.data.pageData)
  1256 + lock += res.data.data.pageData[i].outQty
  1257 + }
  1258 + })
1381 1259
1382 - } 1260 + //---通过接口获取门店的线下库存信息--
  1261 + await getApp().request.promiseGet("/api/weshop/goods/getWareStorages", {
  1262 + data: {
  1263 + storageNos: pickup.pickup_no,
  1264 + wareIds: encodeURIComponent(good.erpwareid),
  1265 + storeId: os.stoid
  1266 + }
  1267 + }).then(res => {
  1268 + if (res.data.code == 0 && res.data.data.total > 0) {
  1269 + plist = res.data.data.pageData[0];
  1270 + }
  1271 + })
1383 1272
1384 - //-- 判断活动的库存 --  
1385 - if(prom){  
1386 - if(prom['goods_num']<=prom['buy_num']){  
1387 - err_text+= good['goods_name']+"超出活动库存\n";continue;  
1388 - } 1273 + if (!plist) {
  1274 + err_text += good['goods_name'] + "库存不足\n";
  1275 + continue;
  1276 + }
  1277 + if (plist.CanOutQty - lock <= 0) {
  1278 + err_text += good['goods_name'] + "库存不足\n";
  1279 + continue;
  1280 + }
  1281 + if (b_item.goods_num > (plist.CanOutQty - lock)) {
  1282 + b_item.goods_num = plist.CanOutQty - lock;
  1283 + }
  1284 + }
  1285 + var req_data={
  1286 + store_id: os.stoid,
  1287 + user_id: getApp().globalData.user_id,
  1288 + goods_id: good.goods_id,
  1289 + };
  1290 + if(b_item.prom_type==7){
  1291 + req_data.prom_type=7;
  1292 + req_data.prom_id=b_item.prom_id;
  1293 + }
1389 1294
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 - } 1295 + var buynum=0;
  1296 + var promnum=0;
  1297 + //---要获得商品,该用户买了多少件,同步应用---
  1298 + await getApp().request.promiseGet("/api/weshop/ordergoods/getUserBuyGoodsNum", {
  1299 + data: req_data,
  1300 + }).then(res => {
  1301 + if(res.data.code==0){
  1302 + var buy_num_data = res.data.data;
  1303 + buynum = buy_num_data.goodsbuynum;
  1304 + if(buy_num_data.promgoodsbuynum){
  1305 + promnum=buy_num_data.promgoodsbuynum;
  1306 + }
  1307 + }
  1308 + })
1393 1309
1394 - if(b_item.goods_num>redis_num){  
1395 - b_item.goods_num=redis_num;  
1396 - } 1310 + //---- 要计算商品的限购 -----
  1311 + if(good['viplimited']>0){
  1312 + if(cart_num+buynum>good['viplimited']){
  1313 + err_text+= good['goods_name']+"超出限购\n";
  1314 + continue;
  1315 + }
  1316 + good['viplimited']-=(cart_num+buynum);
  1317 + if(b_item.goods_num>good['viplimited']){
  1318 + b_item.goods_num=good['viplimited'];
  1319 + }
  1320 + }
  1321 + //不需要计算组合购的限购
1397 1322
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 - } 1323 + back_goods_arr.push(b_item); //返回商品元素
1405 1324
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(); 1325 + }else{
  1326 +
  1327 + //-- 看一下购物车上有多少商品 --
  1328 + var cart_num=0;
  1329 + await getApp().request.promiseGet("/api/weshop/cart/page", {
  1330 + data: {
  1331 + store_id: os.stoid,
  1332 + user_id: getApp().globalData.user_id,
  1333 + state:0, is_gift:0,
  1334 + goods_id:good.goods_id
  1335 + }
  1336 + }).then(res=>{
  1337 + var num = 0;
  1338 + if(res.data.code==0 && res.data.data && res.data.data.pageData) {
  1339 + for (var i = 0; i < res.data.data.pageData.length; i++) {
  1340 + num += res.data.data.pageData[i].goods_num;
  1341 + }
  1342 + }
  1343 + cart_num=num;
  1344 + })
  1345 +
  1346 +
  1347 + if(good.store_count<=0){
  1348 + err_text+= good['goods_name']+"库存不足\n";
  1349 + continue;
  1350 + }
  1351 + if(b_item.goods_num>good.store_count)
  1352 + b_item.goods_num=good.store_count;
  1353 +
  1354 + var buynum=0; //商品已经购买多少件
  1355 + var promgoodsbuynum=0; //活动已经购买多少件
  1356 + var redis_num = 0; //redis库存
  1357 +
  1358 + var req_data={
  1359 + store_id: os.stoid,
  1360 + user_id: getApp().globalData.user_id,
  1361 + goods_id: good.goods_id,
  1362 + };
  1363 +
  1364 + if(prom){
  1365 + req_data.prom_type= good.prom_type;
  1366 + req_data.prom_id= good.prom_id;
  1367 + b_item.prom_type=good.prom_type;
  1368 + b_item.prom_id=good.prom_id;
  1369 +
  1370 + //------判断活动是否抢光-----
  1371 + await getApp().request.promiseGet("/api/weshop/activitylist/getActLen/" +
  1372 + os.stoid + "/" + good.prom_type + "/" + good.prom_id, {
  1373 + 1: 1
  1374 + }).then(res => {
  1375 + redis_num = res.data.data;
  1376 + });
  1377 + if(redis_num<=0){
  1378 + err_text+= good['goods_name']+"活动不足\n";
  1379 + continue;
  1380 + }
  1381 +
  1382 + }
  1383 +
  1384 + //---要获得商品,该用户买了多少件,同步应用---
  1385 + await getApp().request.promiseGet("/api/weshop/ordergoods/getUserBuyGoodsNum", {
  1386 + data: req_data,
  1387 + }).then(res => {
  1388 + if(res.data.code==0){
  1389 + var buy_num_data = res.data.data;
  1390 + if (buy_num_data.promgoodsbuynum) promgoodsbuynum = buy_num_data.promgoodsbuynum;
  1391 + buynum = buy_num_data.goodsbuynum;
  1392 + }
  1393 + })
  1394 +
  1395 + //---- 要计算商品的限购 -----
  1396 + if(good['viplimited']>0){
  1397 + if(cart_num+buynum>good['viplimited']){
  1398 + err_text+= good['goods_name']+"超出限购\n";
  1399 + continue;
  1400 + }
  1401 + good['viplimited']-=(cart_num+buynum);
  1402 + if(b_item.goods_num>good['viplimited']){
  1403 + b_item.goods_num=good['viplimited'];
  1404 + }
  1405 +
  1406 + }
  1407 +
  1408 + //-- 判断活动的库存 --
  1409 + if(prom) {
  1410 + if (prom['goods_num'] <= prom['buy_num']) {
  1411 + err_text += good['goods_name'] + "超出活动库存\n";
  1412 + continue;
  1413 + }
  1414 +
  1415 + if (b_item.goods_num > prom['goods_num'] - prom['buy_num']) {
  1416 + b_item['goods_num'] = b_item['goods_num'] - b_item['buy_num'];
  1417 + }
  1418 +
  1419 + if (b_item.goods_num > redis_num) {
  1420 + b_item.goods_num = redis_num;
  1421 + }
  1422 +
  1423 + if (prom['buy_limit'] > 0) {
  1424 + if (cart_num + buynum > prom['buy_limit']) {
  1425 + err_text += good['goods_name'] + "超出活动限购\n";
  1426 + continue;
  1427 + }
  1428 + prom['buy_limit'] -= (cart_num + buynum);
  1429 + if (b_item.goods_num > prom['buy_limit']) {
  1430 + b_item.goods_num = prom['buy_limit'];
  1431 + }
  1432 + }
  1433 + }
  1434 +
  1435 +
  1436 + back_goods_arr.push(b_item); //返回商品元素
  1437 + }
  1438 + }
  1439 +
  1440 + //有重新购买的数据是时候,就要重新生成订单
  1441 + if(back_goods_arr.length>0){
  1442 + th.setData({back_goods_arr:back_goods_arr});
  1443 + if(!err_text){
  1444 + th.more_add_cart();
  1445 + }else{
  1446 + wx.hideLoading();
  1447 + // 如果没有获取用户信息
  1448 + wx.showModal({
  1449 + title:'确定',
  1450 + content: err_text+',确定要买其他商品码?',
  1451 + success(res) {
  1452 + if (res.confirm) {
  1453 + //跳转到登录页
  1454 + th.more_add_cart();
  1455 + }else{
  1456 + th.data.moring=0;
  1457 + wx.hideLoading();
  1458 + }
  1459 + },fail(){
1427 th.data.moring=0; 1460 th.data.moring=0;
  1461 + wx.hideLoading();
1428 } 1462 }
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 - }, 1463 + });
  1464 +
  1465 + }
  1466 + }else{
  1467 + th.data.moring=0;
  1468 + wx.hideLoading();
  1469 + getApp().confirmBox(err_text);
  1470 + }
  1471 + },
1443 1472
1444 more_add_cart:async function(){ 1473 more_add_cart:async function(){
1445 var back_goods_arr=this.data.back_goods_arr; 1474 var back_goods_arr=this.data.back_goods_arr;