Commit 6984e5ef4c2eb97f7debc1d65999346697922d56
1 parent
0525ae00
1、自定义模板的点击跳转
2、服务卡项购买显示已售,限购 3、订单列表显示异常的优化
Showing
11 changed files
with
117 additions
and
100 deletions
components/diy_groupbuy/diy_groupbuy.js
... | ... | @@ -84,7 +84,7 @@ Component({ |
84 | 84 | if(!user_id){ user_id=0;} |
85 | 85 | |
86 | 86 | //--调用接口,读取团购-- |
87 | - app.request.promiseGet("/api/weshop/goods/groupBuy/getGoodsList?store_id=" | |
87 | + app.request.promiseGet("/api/weshop/goods/groupBuy/getGoodsList?isnew=1&store_id=" | |
88 | 88 | + os.stoid + "&aidlist=" + goodsidlist+"&user_id="+user_id, {}).then(res => { |
89 | 89 | console.log(res,100); |
90 | 90 | //如果秒杀的数组为空的时候 |
... | ... | @@ -106,7 +106,7 @@ Component({ |
106 | 106 | if(!user_id){ user_id=0;} |
107 | 107 | var req={ store_id: os.stoid, is_end: 0, is_show: 1, timetype: 2,user_id:user_id}; |
108 | 108 | |
109 | - getApp().request.promiseGet("/api/weshop/goods/groupBuy/page?page=1&pageSize=9", | |
109 | + getApp().request.promiseGet("/api/weshop/goods/groupBuy/page?isnew=1&page=1&pageSize=9", | |
110 | 110 | { isShowLoading: 1, data:req } |
111 | 111 | ).then(res => { |
112 | 112 | if (res.data.code == 0 && res.data.data.pageData && res.data.data.pageData.length > 0) { |
... | ... | @@ -122,15 +122,11 @@ Component({ |
122 | 122 | var newTime = ut.gettimestamp(), all_array = [], th = this; |
123 | 123 | th.setData({ newTime: newTime }); |
124 | 124 | if (g_id) { |
125 | - /*--商品队列按照添加的顺序排列--*/ | |
126 | - g_id.forEach(function (val, ind) { | |
125 | + | |
127 | 126 | goodslist.forEach(function (vy, indy) { |
128 | - if (val.goodsid == vy.goods_id) { | |
129 | - if(!vy.id) vy.id=vy.prom_id; | |
130 | 127 | all_array.push(vy); |
131 | - } | |
132 | 128 | }) |
133 | - }) | |
129 | + | |
134 | 130 | } else { |
135 | 131 | all_array = goodslist; |
136 | 132 | } |
... | ... | @@ -221,11 +217,25 @@ Component({ |
221 | 217 | |
222 | 218 | //跳转到团购列表 |
223 | 219 | go_to_group: function () { |
224 | - | |
225 | 220 | var url="/packageC/pages/group_list/group_list"; |
226 | 221 | getApp().goto(url); |
227 | 222 | |
223 | + }, | |
224 | + | |
225 | + | |
226 | + //跳转到商品详情,要区别商品和服务卡项 | |
227 | + go_group_buy(e){ | |
228 | + let index=e.currentTarget.dataset.index; | |
229 | + let idx=e.currentTarget.dataset.idx; | |
230 | + let aitem=this.data.goods_array[index][idx]; | |
231 | + var url="/pages/goods/goodsInfo/goodsInfo?goods_id="+aitem.goods_id+"&prom_type=2&prom_id="+aitem.prom_id; | |
232 | + //如果是服务卡项的时候 | |
233 | + if(aitem.goods_type==1){ | |
234 | + url="/packageG/pages/group_buy/goodsInfo/goodsInfo?goods_id="+aitem.goods_id+"&prom_id="+aitem.prom_id; | |
235 | + } | |
236 | + getApp().goto(url); | |
228 | 237 | } |
238 | + | |
229 | 239 | |
230 | 240 | |
231 | 241 | ... | ... |
components/diy_groupbuy/diy_groupbuy.wxml
... | ... | @@ -17,7 +17,9 @@ |
17 | 17 | <swiper-item class="s_it" wx:for="{{goods_array}}"> |
18 | 18 | <block wx:for="{{item}}" wx:for-item="aitem" wx:for-index="aind"> |
19 | 19 | <navigator |
20 | - url="/pages/goods/goodsInfo/goodsInfo?goods_id={{aitem.goods_id}}&prom_type=2&prom_id={{aitem.prom_id}}" | |
20 | + bindtap="go_group_buy" | |
21 | + data-index="{{index}}" | |
22 | + data-idx="{{aind}}" | |
21 | 23 | class="s1_gk_a1"> |
22 | 24 | <view class='one'> |
23 | 25 | <view class='sp_top'> |
... | ... | @@ -64,7 +66,9 @@ |
64 | 66 | <block wx:for="{{goods_array}}"> |
65 | 67 | <block wx:for="{{item}}" wx:for-item="aitem" wx:for-index="aind"> |
66 | 68 | <navigator |
67 | - url="/pages/goods/goodsInfo/goodsInfo?goods_id={{aitem.goods_id}}&prom_type=2&prom_id={{aitem.prom_id}}" | |
69 | + bindtap="go_group_buy" | |
70 | + data-index="{{index}}" | |
71 | + data-idx="{{aind}}" | |
68 | 72 | class="s1_gk_a1"> |
69 | 73 | <view class="flex jc_sb" style="padding: 0 20rpx; margin-top: 10rpx;"> |
70 | 74 | <view> | ... | ... |
components/diy_pingd_buy/diy_pingd_buy.js
... | ... | @@ -135,14 +135,12 @@ Component({ |
135 | 135 | var th=this,all_array=[]; |
136 | 136 | if(g_id){ |
137 | 137 | /*--商品队列按照添加的顺序排列--*/ |
138 | - g_id.forEach(function(val, ind) { | |
138 | + | |
139 | 139 | goodslist.forEach(function (vy,indy) { |
140 | - if(val.goodsid==vy.goods_id){ | |
141 | - all_array.push(vy); | |
142 | - //th.setData({goods_array:arr}); | |
143 | - } | |
140 | + all_array.push(vy); | |
141 | + //th.setData({goods_array:arr}); | |
144 | 142 | }) |
145 | - }) | |
143 | + | |
146 | 144 | }else{ |
147 | 145 | all_array=goodslist; |
148 | 146 | } | ... | ... |
components/diy_pregoods/diy_pregoods.js
... | ... | @@ -112,12 +112,11 @@ Component({ |
112 | 112 | var newTime = ut.gettimestamp(),all_array = [],th=this; |
113 | 113 | th.setData({newTime:newTime}); |
114 | 114 | if(g_id){ |
115 | - /*--商品队列按照添加的顺序排列--*/ | |
116 | - g_id.forEach(function(val, ind) { | |
117 | - goodslist.forEach(function (vy,indy) { | |
118 | - if(val.goodsid==vy.goods_id){ all_array.push(vy); } | |
115 | + /*--商品队列按照添加的顺序排列--*/ | |
116 | + goodslist.forEach(function (vy,indy) { | |
117 | + all_array.push(vy); | |
119 | 118 | }) |
120 | - }) | |
119 | + | |
121 | 120 | }else{ |
122 | 121 | all_array=goodslist; |
123 | 122 | } | ... | ... |
components/diy_public/diy_public.js
... | ... | @@ -99,7 +99,7 @@ Component({ |
99 | 99 | if (this.data.prom_type==2) { //团购 |
100 | 100 | this.setData({ |
101 | 101 | prom_text:'已团', |
102 | - nav1:'/pages/goods/goodsInfo/goodsInfo?', | |
102 | + nav1:'/packageG/pages/group_buy/goodsInfo/goodsInfo?', | |
103 | 103 | nav2:'/pages/goods/goodsInfo/goodsInfo?' |
104 | 104 | }) |
105 | 105 | } |
... | ... | @@ -168,7 +168,7 @@ Component({ |
168 | 168 | } |
169 | 169 | |
170 | 170 | if (th.data.prom_type==2) { //团购 |
171 | - gUrl="/api/weshop/goods/groupBuy/getGoodsList?store_id=" | |
171 | + gUrl="/api/weshop/goods/groupBuy/getGoodsList?isnew=1&store_id=" | |
172 | 172 | +os.stoid+"&aidlist="+goodsidlist + "&user_id="+user_id; |
173 | 173 | } |
174 | 174 | |
... | ... | @@ -278,14 +278,13 @@ Component({ |
278 | 278 | var newTime = ut.gettimestamp(), all_array = [], th = this; |
279 | 279 | th.setData({ newTime: newTime }); |
280 | 280 | if (g_id) { |
281 | - /*--商品队列按照添加的顺序排列--*/ | |
282 | - g_id.forEach(function (val, ind) { | |
281 | + | |
283 | 282 | goodslist.forEach(function (vy, indy) { |
284 | - if (val.goodsid == vy.goods_id) { | |
285 | - all_array.push(vy); | |
286 | - } | |
283 | + | |
284 | + all_array.push(vy); | |
285 | + | |
287 | 286 | }) |
288 | - }) | |
287 | + | |
289 | 288 | } else { |
290 | 289 | all_array = goodslist; |
291 | 290 | } | ... | ... |
components/diy_seckill/diy_seckill.js
... | ... | @@ -157,14 +157,11 @@ Component({ |
157 | 157 | var newTime = ut.gettimestamp(), all_array = [], th = this; |
158 | 158 | th.setData({ newTime: newTime }); |
159 | 159 | if (g_id) { |
160 | - /*--商品队列按照添加的顺序排列--*/ | |
161 | - g_id.forEach(function (val, ind) { | |
162 | - goodslist.forEach(function (vy, indy) { | |
163 | - if (val.goodsid == vy.goods_id) { | |
160 | + /*--商品队列按照添加的顺序排列--*/ | |
161 | + goodslist.forEach(function (vy, indy) { | |
164 | 162 | all_array.push(vy); |
165 | - } | |
166 | 163 | }) |
167 | - }) | |
164 | + | |
168 | 165 | } else { |
169 | 166 | all_array = goodslist; |
170 | 167 | } | ... | ... |
packageA/pages/goodsInfo/goodsInfo.js
... | ... | @@ -998,6 +998,19 @@ Page({ |
998 | 998 | await this.getactLen().then(async function(res) { |
999 | 999 | redisNums = res; |
1000 | 1000 | let curNum = th.data.goodsInputNum; |
1001 | + | |
1002 | + if(curNum > res) { // t当前增减的数量 | |
1003 | + // wx.showModal({ | |
1004 | + // title: '超出活动库存', | |
1005 | + // }); | |
1006 | + getApp().my_warnning('超出活动库存', 0, self); | |
1007 | + th.setData({ | |
1008 | + goodsInputNum: res || 1 | |
1009 | + }); | |
1010 | + is_ok=0; | |
1011 | + return false; | |
1012 | + } | |
1013 | + | |
1001 | 1014 | // res: redis可购买数量 |
1002 | 1015 | console.log('当前可以购买的数量:', res); |
1003 | 1016 | if(res <= 0) { |
... | ... | @@ -1028,24 +1041,9 @@ Page({ |
1028 | 1041 | |
1029 | 1042 | if(canBuyNum <= 0) { |
1030 | 1043 | canBuyNum = 0; |
1031 | - }; | |
1032 | - | |
1033 | - if(canBuyNum > res) { | |
1034 | - if(curNum > res) { // t当前增减的数量 | |
1035 | - // wx.showModal({ | |
1036 | - // title: '超出活动库存', | |
1037 | - // }); | |
1038 | - getApp().my_warnning('超出活动库存', 0, self); | |
1039 | - th.setData({ | |
1040 | - goodsInputNum: res || 1 | |
1041 | - }); | |
1042 | - is_ok=0; | |
1043 | - return false; | |
1044 | - }; | |
1045 | - }; | |
1046 | - | |
1047 | - if(canBuyNum <= res) { | |
1048 | - if(curNum > canBuyNum) { | |
1044 | + } | |
1045 | + | |
1046 | + if(curNum > canBuyNum) { | |
1049 | 1047 | // wx.showModal({ |
1050 | 1048 | // title: '超出限购数量', |
1051 | 1049 | // }); |
... | ... | @@ -1055,8 +1053,8 @@ Page({ |
1055 | 1053 | }); |
1056 | 1054 | is_ok=0; |
1057 | 1055 | return false; |
1058 | - } | |
1059 | 1056 | } |
1057 | + | |
1060 | 1058 | }) |
1061 | 1059 | |
1062 | 1060 | } | ... | ... |
packageA/pages/goodsInfo/goodsInfo.wxml
... | ... | @@ -136,8 +136,9 @@ |
136 | 136 | |
137 | 137 | <view class="stock" wx:if="{{prom_act.buy_limit>0}}">限购:{{prom_act.buy_limit}}件</view> |
138 | 138 | <view class="stock" wx:else>限购:不限</view> |
139 | - <view class="sales">已售:{{prom_act.buy_num+prom_act.virtual}}件</view> | |
140 | - | |
139 | + <view wx:if="{{prom_st>0}}" class="sales">已售:{{prom_act.buy_num+prom_act.virtual}}件</view> | |
140 | + <view wx:else class="sales">已售:{{prom_act.buy_num}}件</view> | |
141 | + | |
141 | 142 | <!-- <block wx:if="{{prom_st==0}}"> |
142 | 143 | <view class="sales">已购:0件</view> |
143 | 144 | </block> --> | ... | ... |
packageG/pages/group_buy/goodsInfo/goodsInfo.js
... | ... | @@ -911,14 +911,6 @@ Page({ |
911 | 911 | if (canBuyNum <= 0) { |
912 | 912 | canBuyNum = 0; |
913 | 913 | } |
914 | - if (canBuyNum > res) { | |
915 | - getApp().my_warnning('超出活动库存', 0, self); | |
916 | - th.setData({ | |
917 | - goodsInputNum: res || 1 | |
918 | - }); | |
919 | - is_ok = 0; | |
920 | - return false; | |
921 | - } | |
922 | 914 | |
923 | 915 | if (curNum > canBuyNum) { |
924 | 916 | getApp().my_warnning('超出限购数量', 0, self); |
... | ... | @@ -1100,6 +1092,19 @@ Page({ |
1100 | 1092 | // 如果数量为0,设置和显示已抢光 |
1101 | 1093 | // 否则,进一步判断是否超出限购或超出库存 |
1102 | 1094 | await this.getactLen().then(async function (res) { |
1095 | + | |
1096 | + if (t > res) { // t当前增减的数量 | |
1097 | + // wx.showModal({ | |
1098 | + // title: '超出活动库存', | |
1099 | + // }); | |
1100 | + getApp().my_warnning('超出活动库存', 0, self); | |
1101 | + th.setData({ | |
1102 | + goodsInputNum: res || 1, | |
1103 | + }); | |
1104 | + return false; | |
1105 | + } | |
1106 | + | |
1107 | + | |
1103 | 1108 | // res: redis可购买数量 |
1104 | 1109 | // console.log('当前可以购买的数量:', res); |
1105 | 1110 | if (res <= 0) { |
... | ... | @@ -1123,35 +1128,16 @@ Page({ |
1123 | 1128 | if (canBuyNum <= 0) { |
1124 | 1129 | canBuyNum = 0; |
1125 | 1130 | } |
1126 | - ; | |
1127 | - | |
1128 | - if (limited > res) { | |
1129 | - if (t > res) { // t当前增减的数量 | |
1130 | - // wx.showModal({ | |
1131 | - // title: '超出活动库存', | |
1132 | - // }); | |
1133 | - getApp().my_warnning('超出活动库存', 0, self); | |
1134 | - th.setData({ | |
1135 | - goodsInputNum: res || 1, | |
1136 | - }); | |
1137 | - return false; | |
1138 | - } | |
1139 | - | |
1140 | - } | |
1141 | - | |
1142 | - | |
1143 | - if (limited <= res) { | |
1144 | - if (t > canBuyNum) { | |
1145 | - // wx.showModal({ | |
1146 | - // title: '超出限购数量', | |
1147 | - // }); | |
1148 | - getApp().my_warnning('超出限购数量', 0, self); | |
1149 | - th.setData({ | |
1150 | - goodsInputNum: canBuyNum || 1, | |
1151 | - }); | |
1152 | - return false; | |
1153 | - } | |
1154 | 1131 | |
1132 | + if (t > canBuyNum) { | |
1133 | + // wx.showModal({ | |
1134 | + // title: '超出限购数量', | |
1135 | + // }); | |
1136 | + getApp().my_warnning('超出限购数量', 0, self); | |
1137 | + th.setData({ | |
1138 | + goodsInputNum: canBuyNum || 1, | |
1139 | + }); | |
1140 | + return false; | |
1155 | 1141 | } |
1156 | 1142 | |
1157 | 1143 | ... | ... |
packageG/pages/group_buy/goodsInfo/goodsInfo.wxml
... | ... | @@ -83,8 +83,8 @@ |
83 | 83 | |
84 | 84 | <view class="abs flex fs36" style="align-items:flex-end;color: #fff; margin-top: 34rpx; margin-left: 10rpx; height: 60rpx">¥{{prom_price}} |
85 | 85 | |
86 | - <view wx:if="{{is_retail_price}}" class="word-line fs24 no_line_c" style="margin-left: 10rpx;position: relative;top: -6rpx; color:#fff !important">零售价:¥{{filters.toFix(front_g.market_price,2)}}</view> | |
87 | - <view wx:else class="word-line no_line_x fs24" style="margin-left: 10rpx;position: relative;top: -6rpx;color:#fff !important">¥{{filters.toFix(front_g.shop_price,2)}}</view> | |
86 | + <view wx:if="{{is_retail_price}}" class="word-line fs24 no_line_c" style="margin-left: 10rpx;position: relative;top: -6rpx; color:#fff !important">零售价:¥{{filters.toFix(data.show_price,2)}}</view> | |
87 | + <view wx:else class="word-line no_line_x fs24" style="margin-left: 10rpx;position: relative;top: -6rpx;color:#fff !important">¥{{filters.toFix(data.shop_price,2)}}</view> | |
88 | 88 | </view> |
89 | 89 | |
90 | 90 | <image class="abs" style="width: 120rpx;top: 32rpx; right: 220rpx;" mode="widthFix" src='{{iurl+"/miniapp/images/activity-time.png"}}'></image> |
... | ... | @@ -133,12 +133,28 @@ |
133 | 133 | |
134 | 134 | <view class="stock" wx:if="{{prom_act.buy_limit>0}}">限购:{{prom_act.buy_limit}}件</view> |
135 | 135 | <view class="stock" wx:else>限购:不限</view> |
136 | - <view class="sales">已售:{{prom_act.buy_num+prom_act.virtual}}件</view> | |
136 | + <view wx:if="{{prom_st>0}}" class="sales">已售:{{prom_act.buy_num+prom_act.virtual}}件</view> | |
137 | + <view wx:else class="sales">已售:{{prom_act.buy_num}}件</view> | |
137 | 138 | |
138 | 139 | </block> |
139 | 140 | </view> |
140 | 141 | </block> |
141 | 142 | |
143 | + <block wx:if="{{prom_type==2}}"> | |
144 | + <view class="goods-num"> | |
145 | + <block> | |
146 | + <view class="stock">总数量:{{ prom_act.goods_num+prom_act.virtualNum}}件</view> | |
147 | + | |
148 | + <view class="stock" wx:if="{{prom_act.buy_limit>0}}">限购:{{prom_act.buy_limit}}件</view> | |
149 | + <view class="stock" wx:else>限购:不限</view> | |
150 | + <view wx:if="{{prom_st>0}}" class="sales">已售:{{prom_act.buy_num+prom_act.virtualNum}}件</view> | |
151 | + <view wx:else class="sales">已售:{{prom_act.buy_num}}件</view> | |
152 | + | |
153 | + </block> | |
154 | + </view> | |
155 | + </block> | |
156 | + | |
157 | + | |
142 | 158 | <view class="goods-num" wx:else> |
143 | 159 | <view class="sales">销量:{{data.sales_sum}}</view> |
144 | 160 | <view class="sales">有效天数:{{data.validDays?data.validDays:'不限'}}</view> | ... | ... |
pages/user/order_list/order_list.js
... | ... | @@ -91,14 +91,17 @@ Page({ |
91 | 91 | var startDate = date.getFullYear() + '-' + (date.getMonth() + 1) + '-' + date.getDate(); |
92 | 92 | |
93 | 93 | |
94 | - if (t.index && t.tabindex) { | |
94 | + if (t.index) { | |
95 | + if(t.tabindex) t.tabindex=0; | |
95 | 96 | this.setData({ |
96 | 97 | currentIndex: t.index, |
97 | 98 | tabIndex: t.tabindex, |
98 | 99 | }); |
99 | - this.clickTab(); | |
100 | + //this.clickTab(); | |
100 | 101 | }; |
101 | 102 | |
103 | + | |
104 | + | |
102 | 105 | this.setData({ |
103 | 106 | currentDate: this.currentDate(), |
104 | 107 | startDate: startDate, |
... | ... | @@ -185,8 +188,13 @@ Page({ |
185 | 188 | } |
186 | 189 | }, 1) |
187 | 190 | |
188 | - th.resetData(), th.requestOrderList(th.data.activeCategoryId); | |
189 | - th.clickTab(); | |
191 | + th.resetData(); | |
192 | + if(th.data.currentIndex>0){ | |
193 | + th.clickTab(); | |
194 | + }else{ | |
195 | + th.requestOrderList(th.data.activeCategoryId); | |
196 | + } | |
197 | + | |
190 | 198 | },1500); |
191 | 199 | }, |
192 | 200 | |
... | ... | @@ -2735,6 +2743,7 @@ Page({ |
2735 | 2743 | app.request.promiseGet(url, { |
2736 | 2744 | data: data |
2737 | 2745 | }).then(async res => { |
2746 | + wx.hideLoading(); | |
2738 | 2747 | // 关闭加载状态 |
2739 | 2748 | th.data.is_load2 = 0; |
2740 | 2749 | // 请求成功 | ... | ... |