Commit 33b100b85758e70b0abfa89ba1e4bf25e025e03d

Authored by WXD-SEASON\season
2 parents 1499ef36 cc9ae391

Merge branch 'dev' of http://git.vipzhuang.cn/wxd/MShopWeApp into test

Showing 51 changed files with 2543 additions and 1361 deletions
@@ -494,6 +494,17 @@ App({ @@ -494,6 +494,17 @@ App({
494 "/pages/cart/cart/cart", "/pages/user/index/index", 494 "/pages/cart/cart/cart", "/pages/user/index/index",
495 "/pages/distribution/distribution"]; 495 "/pages/distribution/distribution"];
496 496
  497 + //因为地址有参数
  498 + for(var i in arr_tabbar){
  499 + var ck_url=arr_tabbar[i];
  500 + if (("/"+url).indexOf(ck_url) != -1) {
  501 + if (url.indexOf("categoryList?type=1") != -1) this.globalData.cat_type = 1;
  502 + if (url.indexOf("categoryList?type=2") != -1) this.globalData.cat_type = 2;
  503 + wx.reLaunch({ url: url, }) //跳到tabbar页
  504 + return;
  505 + }
  506 + }
  507 +
497 if (arr_tabbar.indexOf(url) != -1) { 508 if (arr_tabbar.indexOf(url) != -1) {
498 if (url.indexOf("categoryList?type=1") != -1) this.globalData.cat_type = 1; 509 if (url.indexOf("categoryList?type=1") != -1) this.globalData.cat_type = 1;
499 if (url.indexOf("categoryList?type=2") != -1) this.globalData.cat_type = 2; 510 if (url.indexOf("categoryList?type=2") != -1) this.globalData.cat_type = 2;
app.wxss
@@ -1220,7 +1220,10 @@ background: #ffe3e2; @@ -1220,7 +1220,10 @@ background: #ffe3e2;
1220 1220
1221 1221
1222 /* 保障服务样式,多使用 */ 1222 /* 保障服务样式,多使用 */
1223 -.bz_view { 1223 +
  1224 +
  1225 +
  1226 +.bz_view22 {
1224 /* height:100rpx; padding: 0 34rpx 0 13rpx; */ 1227 /* height:100rpx; padding: 0 34rpx 0 13rpx; */
1225 color: #333; 1228 color: #333;
1226 font-size: 28rpx; 1229 font-size: 28rpx;
@@ -1230,20 +1233,32 @@ background: #ffe3e2; @@ -1230,20 +1233,32 @@ background: #ffe3e2;
1230 /* border-bottom: 3rpx solid #eee; */ 1233 /* border-bottom: 3rpx solid #eee; */
1231 /* border-top: 3rpx solid #eee; */ 1234 /* border-top: 3rpx solid #eee; */
1232 } 1235 }
1233 -.bzfu_img { 1236 +
  1237 +.bz_view22 view {
  1238 + width: 470rpx;
  1239 + word-break: break-all;
  1240 + /* max-height: 70rpx; */
  1241 + /* overflow: hidden; */
  1242 +}
  1243 +
  1244 +.bzfu_img22 {
1234 width: 164rpx; 1245 width: 164rpx;
1235 - height: 34rpx;  
1236 - min-width: 35%; 1246 + height: 34rpx;
1237 /* margin-right: 18rpx; margin-left: 12rpx */ 1247 /* margin-right: 18rpx; margin-left: 12rpx */
1238 } 1248 }
1239 -.bz-content {  
1240 - padding: 0 0 0 20rpx;  
1241 - text-align: right;  
1242 - width: 100%;  
1243 - 1249 +
  1250 +.bz-content22 {
  1251 + padding: 0 0 0 20rpx;
  1252 +}
  1253 +
  1254 +
  1255 +.hideArea22 {
  1256 + position: absolute;
  1257 + left: -1000px;
  1258 + top: -1000px;
1244 } 1259 }
1245 1260
1246 -.bg_jj { 1261 +.bg_jj22 {
1247 width: 14rpx; 1262 width: 14rpx;
1248 height: 14rpx; 1263 height: 14rpx;
1249 border-top: 2rpx solid #d70026; 1264 border-top: 2rpx solid #d70026;
@@ -1252,10 +1267,15 @@ background: #ffe3e2; @@ -1252,10 +1267,15 @@ background: #ffe3e2;
1252 display: inline-block; 1267 display: inline-block;
1253 margin-bottom: 3rpx; 1268 margin-bottom: 3rpx;
1254 } 1269 }
1255 -.bg_jj.down { 1270 +.bg_jj22.down22 {
1256 transform: rotateZ(135deg); 1271 transform: rotateZ(135deg);
1257 } 1272 }
1258 -.cx-obtain-coupon { 1273 +.bg_jj22.up22 {
  1274 + transform: rotateZ(-45deg);
  1275 + margin-top: 6rpx;
  1276 +}
  1277 +
  1278 +.cx-obtain-coupon22 {
1259 /* width: 65rpx; 1279 /* width: 65rpx;
1260 height: 100%; 1280 height: 100%;
1261 padding-left:15rpx; */ 1281 padding-left:15rpx; */
@@ -1265,21 +1285,21 @@ background: #ffe3e2; @@ -1265,21 +1285,21 @@ background: #ffe3e2;
1265 /* position: absolute; 1285 /* position: absolute;
1266 right: 5rpx; */ 1286 right: 5rpx; */
1267 } 1287 }
1268 -.wsize { 1288 +.wsize22 {
1269 font-size: 32rpx 1289 font-size: 32rpx
1270 } 1290 }
1271 -.arrow { 1291 +.arrow22 {
1272 width: auto !important; 1292 width: auto !important;
1273 position: absolute; 1293 position: absolute;
1274 - right: 0; 1294 + right: 10rpx;
1275 top: 50%; 1295 top: 50%;
1276 transform: translateY(-50%); 1296 transform: translateY(-50%);
1277 } 1297 }
1278 -.xc-coupon-frame .rel:not(:first-child) { 1298 +.xc-coupon-frame22 .rel22:not(:first-child) {
1279 margin-top: 20rpx; 1299 margin-top: 20rpx;
1280 } 1300 }
1281 1301
1282 -.xc-coupon-frame .coupon { 1302 +.xc-coupon-frame22 .coupon22 {
1283 width: 100%; 1303 width: 100%;
1284 height: 168rpx; 1304 height: 168rpx;
1285 border-radius: 25rpx; 1305 border-radius: 25rpx;
@@ -1290,3 +1310,31 @@ background: #ffe3e2; @@ -1290,3 +1310,31 @@ background: #ffe3e2;
1290 1310
1291 } 1311 }
1292 1312
  1313 +
  1314 +.up22 {
  1315 + animation: up .7s;
  1316 +}
  1317 +
  1318 +.down22 {
  1319 + animation: down 1s;
  1320 +}
  1321 +
  1322 +@keyframes up22 {
  1323 + 0% {
  1324 + transform: translateY(550rpx);
  1325 + }
  1326 +
  1327 + 100% {
  1328 + transform: translateY(0);
  1329 + }
  1330 +}
  1331 +
  1332 +@keyframes down22 {
  1333 + 0% {
  1334 + transform: translateY(0);
  1335 + }
  1336 +
  1337 + 100% {
  1338 + transform: translateY(550rpx);
  1339 + }
  1340 +}
1293 \ No newline at end of file 1341 \ No newline at end of file
components/diy_seckill/diy_seckill.wxml
@@ -441,13 +441,13 @@ @@ -441,13 +441,13 @@
441 </block> 441 </block>
442 <block wx:else> 442 <block wx:else>
443 <!--秒杀--> 443 <!--秒杀-->
444 - <view class='top' bindtap="go_to_skill"> 444 + <view class='top' bindtap="go_to_skill" style="font-size:32rpx;">
445 <view class="flex"> 445 <view class="flex">
446 <view class='t_left'></view> 446 <view class='t_left'></view>
447 <view class='t_ms'>秒杀</view> 447 <view class='t_ms'>秒杀</view>
448 </view> 448 </view>
449 - <view class='right_k'>  
450 - <image src="{{imghost}}/miniapp/images/icon-arrowdown.png" lazy-load="true"></image> 449 + <view style="width: 30rpx;">
  450 + <image src="{{imghost}}/miniapp/images/icon-arrowdown.png" lazy-load="true" style="width: 30rpx;height: 30rpx;"></image>
451 </view> 451 </view>
452 </view> 452 </view>
453 <!--商品展示--> 453 <!--商品展示-->
@@ -523,7 +523,7 @@ @@ -523,7 +523,7 @@
523 </view> 523 </view>
524 524
525 <view class="o1_right"> 525 <view class="o1_right">
526 - <view class="sp_wzi ellipsis-2">{{aitem.title}}</view> 526 + <view class="sp_wzi ellipsis-2">{{aitem.goods_name}}</view>
527 <view class="o1_sj_kill"> 527 <view class="o1_sj_kill">
528 <text>{{aitem.djs.day}}</text> 天 528 <text>{{aitem.djs.day}}</text> 天
529 <text>{{aitem.djs.hou}}</text> : 529 <text>{{aitem.djs.hou}}</text> :
components/promate_pop/promate_pop.js
  1 +const ut = require("../../utils/util.js");
1 Component({ 2 Component({
2 /*** 页面的初始数据***/ 3 /*** 页面的初始数据***/
3 data: { 4 data: {
@@ -8,7 +9,9 @@ Component({ @@ -8,7 +9,9 @@ Component({
8 }, 9 },
9 methods: { 10 methods: {
10 //-- 初始化弹出框 -- 11 //-- 初始化弹出框 --
11 - set_init(type,cx_prom_group,is_cart){ 12 + set_init(type,cx_prom_group0,is_cart){
  13 +
  14 + var cx_prom_group=JSON.parse(JSON.stringify(cx_prom_group0));
12 if(!type) type=0; 15 if(!type) type=0;
13 if(!is_cart) is_cart=0; 16 if(!is_cart) is_cart=0;
14 17
@@ -18,6 +21,32 @@ Component({ @@ -18,6 +21,32 @@ Component({
18 if(fd==-1){ 21 if(fd==-1){
19 cx_prom_group[0].sele=1; 22 cx_prom_group[0].sele=1;
20 } 23 }
  24 +
  25 + //-- 优惠促销要重新组装 --
  26 + var yh_index=cx_prom_group.findIndex(function (p_time){
  27 + return p_time.prom_type==3;
  28 + })
  29 + if(yh_index>-1){
  30 + var prom_list=cx_prom_group[yh_index].promGoodsListsDtos;
  31 + //规格参数
  32 + cx_prom_group[yh_index].more=ut.format_yh_act(prom_list[0]);
  33 + cx_prom_group[yh_index].yh_index=0; //优惠阶梯
  34 +
  35 +
  36 + if(prom_list.length){
  37 + for(var i=1;i<prom_list.length;i++){
  38 + var copy_obj=JSON.parse(JSON.stringify(cx_prom_group[yh_index]));
  39 + delete copy_obj.promGoodsListsDtos
  40 + copy_obj.more=ut.format_yh_act(prom_list[i]);
  41 + copy_obj.is_no_sele=1;
  42 + copy_obj.condition=prom_list[i].condition + (prom_list[i].prom_type == 1 ? '件' : '元'),
  43 + copy_obj.yh_index=i; //优惠阶梯
  44 + cx_prom_group.splice(yh_index+i,0,copy_obj);
  45 + }
  46 + }
  47 +
  48 + }
  49 +
21 this.setData({ 50 this.setData({
22 type:type,pro_pop:1,cx_prom_group,is_cart:is_cart 51 type:type,pro_pop:1,cx_prom_group,is_cart:is_cart
23 }) 52 })
@@ -27,10 +56,10 @@ Component({ @@ -27,10 +56,10 @@ Component({
27 close_pro_pop: async function (e) { 56 close_pro_pop: async function (e) {
28 this.setData({pro_pop: 0}); 57 this.setData({pro_pop: 0});
29 if(!this.data.type) return false; 58 if(!this.data.type) return false;
30 - var idx=this.data.cx_prom_group.findIndex(function (e){ 59 + var obj=this.data.cx_prom_group.find(function (e){
31 return e.sele==1; 60 return e.sele==1;
32 }) 61 })
33 - this.triggerEvent('sure_cx_group',{sele_idx:idx},{bubbles: true}); 62 + this.triggerEvent('sure_cx_group',{sele_prom_type:obj.prom_type},{bubbles: true});
34 }, 63 },
35 64
36 go_the_url:function (e){ 65 go_the_url:function (e){
@@ -38,6 +67,9 @@ Component({ @@ -38,6 +67,9 @@ Component({
38 var item=this.data.cx_prom_group[index]; 67 var item=this.data.cx_prom_group[index];
39 68
40 var prom_id = item.prom_id; 69 var prom_id = item.prom_id;
  70 + if(!prom_id) prom_id=item.id;
  71 +
  72 +
41 var prom_type = item.prom_type; 73 var prom_type = item.prom_type;
42 var url=''; 74 var url='';
43 switch (parseInt(prom_type)){ 75 switch (parseInt(prom_type)){
@@ -70,7 +102,32 @@ Component({ @@ -70,7 +102,32 @@ Component({
70 else cx_prom_group[idx].sele=1; 102 else cx_prom_group[idx].sele=1;
71 } 103 }
72 this.setData({cx_prom_group}) 104 this.setData({cx_prom_group})
73 - } 105 + },
  106 +
  107 + // 促销 -> 送礼包 -> 查看详情
  108 + viewLbDetails(e) {
  109 + let id = e.currentTarget.dataset.id; // 获取礼包id
  110 + let flag = e.currentTarget.dataset.flag;
  111 + let url = '';
  112 + if (flag == 2) { // flag =1 控制跳转到专享礼包
  113 + url = `/packageE/pages/user/monthgiftbag/giftpackinfo/giftpackinfo?isBuy=1&id=${id}&is_act=1`;
  114 + // url = `/pages/giftpack/giftpacklist/giftpacklist?lbId=${id}&flag=1`;
  115 + } else if (flag == 1) { // flag =1 控制跳转到专享礼包
  116 + url = `/pages/giftpack/giftpacklist/giftpacklist?lbId=${id}&flag=1`;
  117 + } else {
  118 + url = `/packageA/pages/myGiftDetails/myGiftDetails?btn=0&index=0&id=${id}`; // btn=0 控制跳转到的页面不显示按钮
  119 + };
  120 + // console.log('myurl', url);
  121 + getApp().goto(url);
  122 + },
  123 +
  124 + //显示多赠品
  125 + show_zp: function (e) {
  126 + var prom_id = e.currentTarget.dataset.prom;
  127 + var index = e.currentTarget.dataset.index;
  128 + getApp().goto("/packageD/pages/gift/gift?prom_id=" + prom_id + "&index=" + index);
  129 + },
  130 +
74 131
75 } 132 }
76 }) 133 })
77 \ No newline at end of file 134 \ No newline at end of file
components/promate_pop/promate_pop.wxml
@@ -29,7 +29,28 @@ @@ -29,7 +29,28 @@
29 {{item.show_time}} 29 {{item.show_time}}
30 </view> 30 </view>
31 <view wx:else class="fs22" style="max-width: 430rpx; color: #b9b6b6"> 31 <view wx:else class="fs22" style="max-width: 430rpx; color: #b9b6b6">
32 - <text wx:for="{{item.more}}" wx:for-item="bm" class="tick pdr20" >{{bm}}</text> 32 + <block wx:for="{{item.more}}" wx:for-item="bm">
  33 + <text wx:if="{{bm.is_fir}}" class="tick pdr20" >{{bm.text}}</text>
  34 + <view class="tick pdr20" wx:if="{{bm.is_quan}}">{{bm.text}}</view>
  35 + <view class="tick pdr20 ellipsis-1x lh2 {{!bm.is_no_goto?'details':'' }} " wx:if="{{bm.is_gift}}"
  36 + bindtap="show_zp"
  37 + data-is_no_goto="{{is_no_goto}}"
  38 + data-index="{{item.yh_index}}"
  39 + data-prom="{{bm.prom_id}}" >{{bm.text}}</view>
  40 +
  41 + <!-- 旧礼包 -->
  42 + <view class="tick pdr20 ellipsis-1x lh2 details" wx:if="{{bm.lb_id}}"
  43 + data-id="{{bm.lb_id}}" bindtap="viewLbDetails">{{bm.text}}</view>
  44 + <!-- 专享礼包 -->
  45 + <view class="tick pdr20 ellipsis-1x lh2 details" wx:if="{{bm.zxlb_id}}"
  46 + data-id="{{bm.zxlb_id}}" data-flag="1" bindtap="viewLbDetails">{{bm.text}}</view>
  47 + <!-- 月礼包 -->
  48 + <view class="tick pdr20 ellipsis-1x lh2 details" wx:if="{{bm.monthgiftbag_id}}"
  49 + data-id="{{bm.monthgiftbag_id}}" data-flag="2" bindtap="viewLbDetails">{{bm.text}}</view>
  50 +
  51 + </block>
  52 +
  53 +
33 </view> 54 </view>
34 </view> 55 </view>
35 56
@@ -37,7 +58,7 @@ @@ -37,7 +58,7 @@
37 <view class="r_item_pro"> 58 <view class="r_item_pro">
38 <view style="text-align: center"> 59 <view style="text-align: center">
39 <!-- 如果是弹出框进行选择的时候 --> 60 <!-- 如果是弹出框进行选择的时候 -->
40 - <block wx:if="{{type==1}}"> 61 + <block wx:if="{{type==1 && !item.is_no_sele}}">
41 <view wx:if="{{item.sele}}" class="circle white xc-hook on"> 62 <view wx:if="{{item.sele}}" class="circle white xc-hook on">
42 <text>Γ</text> 63 <text>Γ</text>
43 </view> 64 </view>
components/promate_pop/promate_pop.wxss
@@ -24,6 +24,8 @@ @@ -24,6 +24,8 @@
24 display: flex; 24 display: flex;
25 justify-content: center; 25 justify-content: center;
26 overflow: hidden; */ 26 overflow: hidden; */
  27 + max-height: 580rpx;
  28 + overflow-y: auto;
27 } 29 }
28 30
29 .xc-top-content { 31 .xc-top-content {
@@ -174,7 +176,7 @@ @@ -174,7 +176,7 @@
174 } 176 }
175 177
176 .item_pro{ 178 .item_pro{
177 - background-color: #fceeee;height: 170rpx; position: relative; 179 + background-color: #fceeee;min-height: 170rpx; position: relative;padding: 10rpx 0;
178 } 180 }
179 181
180 .item_pro~.item_pro{ 182 .item_pro~.item_pro{
@@ -199,13 +201,28 @@ @@ -199,13 +201,28 @@
199 display: inline-block; 201 display: inline-block;
200 vertical-align: middle; 202 vertical-align: middle;
201 margin-top: -4rpx; 203 margin-top: -4rpx;
202 - margin-right: 8rpx; 204 + margin-right: 12rpx;
203 width: 22rpx; 205 width: 22rpx;
204 height: 22rpx; 206 height: 22rpx;
205 background: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABYAAAAWCAMAAADzapwJAAAABGdBTUEAALGPC/xhBQAAAAFzUkdCAK7OHOkAAABCUExURUdwTPInDPInDPgoDfMnDPYqEvInDPInDPInDP87NPUoDv8vEvMoDPInDPIoDPMnDvInDPInDPInDPIoDPQoDfInDEON4KMAAAAVdFJOUwD45yawG4zz3gQ0DmLOfECQZpPlS54kMQ4AAAC0SURBVBjTbZFREoMgDERDS0xQQNHu/a/alEGtaIYfHrBhs0S1pujVifo40VkhC+BUHSDzQTlBhjHY8bjogXmDZ+orJKwXwMUeUoa/0PeGbH8Q4Y5CJopYOjosiOQxdpRGk1UXOkrBKdkimtN8UrKrJBVXdzsllSYSjR/0J9JaGn81WluWtonYKQ0op51P3M2L2bmZN9n8MKoVqTph/RsseyjfYxAkfgot/82CpuJVLOLSIv4Cd5AJ37BgpFwAAAAASUVORK5CYII=) no-repeat; 207 background: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABYAAAAWCAMAAADzapwJAAAABGdBTUEAALGPC/xhBQAAAAFzUkdCAK7OHOkAAABCUExURUdwTPInDPInDPgoDfMnDPYqEvInDPInDPInDP87NPUoDv8vEvMoDPInDPIoDPMnDvInDPInDPInDPIoDPQoDfInDEON4KMAAAAVdFJOUwD45yawG4zz3gQ0DmLOfECQZpPlS54kMQ4AAAC0SURBVBjTbZFREoMgDERDS0xQQNHu/a/alEGtaIYfHrBhs0S1pujVifo40VkhC+BUHSDzQTlBhjHY8bjogXmDZ+orJKwXwMUeUoa/0PeGbH8Q4Y5CJopYOjosiOQxdpRGk1UXOkrBKdkimtN8UrKrJBVXdzsllSYSjR/0J9JaGn81WluWtonYKQ0op51P3M2L2bmZN9n8MKoVqTph/RsseyjfYxAkfgot/82CpuJVLOLSIv4Cd5AJ37BgpFwAAAAASUVORK5CYII=) no-repeat;
206 background-size: 22rpx auto; 208 background-size: 22rpx auto;
207 } 209 }
208 210
  211 +.details::after {
  212 + content: '';
  213 + position: absolute;
  214 + right: 0;
  215 + top: 0;
  216 + bottom: 0;
  217 + margin: auto;
  218 + display: inline-block;
  219 + width: 40rpx;
  220 + height: 40rpx;
  221 + background-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACgAAAAoBAMAAAB+0KVeAAAABGdBTUEAALGPC/xhBQAAAAFzUkdCAK7OHOkAAAAVUExURUdwTIyMjCYmJiYmJi0tLY+PjyYmJidnOsIAAAAGdFJOUwDt6aYcSSEXj/YAAAA8SURBVCjPY2AYBTQBLEbKDhiCTmlpKggeq2AAiDJLS0tGcBkFBUActbS0JAY4F6sgVu1YLcLnpFFAFQAATwgLKVhjC9UAAAAASUVORK5CYII=);
  222 + background-repeat: no-repeat;
  223 + background-size: 40rpx auto;
  224 +}
  225 +
209 .r_item_pro{ 226 .r_item_pro{
210 position: absolute; 227 position: absolute;
211 right: 18rpx; 228 right: 18rpx;
@@ -246,6 +263,18 @@ @@ -246,6 +263,18 @@
246 background-color: #d60021; 263 background-color: #d60021;
247 } 264 }
248 265
  266 +@import '../../app.wxss';
249 267
  268 +.tick:before {
  269 + content: '';
  270 + display: inline-block;
  271 + vertical-align: middle;
  272 + margin-top: -4rpx;
  273 + margin-right: 12rpx;
  274 + width: 22rpx;
  275 + height: 22rpx;
  276 + background: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABYAAAAWCAMAAADzapwJAAAABGdBTUEAALGPC/xhBQAAAAFzUkdCAK7OHOkAAABCUExURUdwTPInDPInDPgoDfMnDPYqEvInDPInDPInDP87NPUoDv8vEvMoDPInDPIoDPMnDvInDPInDPInDPIoDPQoDfInDEON4KMAAAAVdFJOUwD45yawG4zz3gQ0DmLOfECQZpPlS54kMQ4AAAC0SURBVBjTbZFREoMgDERDS0xQQNHu/a/alEGtaIYfHrBhs0S1pujVifo40VkhC+BUHSDzQTlBhjHY8bjogXmDZ+orJKwXwMUeUoa/0PeGbH8Q4Y5CJopYOjosiOQxdpRGk1UXOkrBKdkimtN8UrKrJBVXdzsllSYSjR/0J9JaGn81WluWtonYKQ0op51P3M2L2bmZN9n8MKoVqTph/RsseyjfYxAkfgot/82CpuJVLOLSIv4Cd5AJ37BgpFwAAAAASUVORK5CYII=) no-repeat;
  277 + background-size: 22rpx auto;
  278 +}
250 279
251 -@import '../../app.wxss'; 280 +.lh2 { line-height: 2; }
packageA/pages/prom_list/prom_list.js
@@ -510,7 +510,7 @@ Page({ @@ -510,7 +510,7 @@ Page({
510 goods_sn: o.goods_sn, 510 goods_sn: o.goods_sn,
511 sku: o.sku, 511 sku: o.sku,
512 prom_type: 5, 512 prom_type: 5,
513 - prom_id:o.prom_id 513 + prom_id:th.data.collocationGoods.id
514 }; 514 };
515 515
516 //---是不是从收藏夹出来的--- 516 //---是不是从收藏夹出来的---
@@ -648,8 +648,8 @@ Page({ @@ -648,8 +648,8 @@ Page({
648 } 648 }
649 } 649 }
650 650
651 - newd['pick_name'] = th.data.sto_sele_name;  
652 - newd['pick_dis'] = th.data.sto_sele_distr; 651 + //newd['pick_name'] = th.data.sto_sele_name;
  652 + //newd['pick_dis'] = th.data.sto_sele_distr;
653 653
654 this.check_sele_collocation(function (collocationGoods) { 654 this.check_sele_collocation(function (collocationGoods) {
655 var is_ok = 1; 655 var is_ok = 1;
@@ -674,20 +674,84 @@ Page({ @@ -674,20 +674,84 @@ Page({
674 th.setData({lding:0}) 674 th.setData({lding:0})
675 return false; 675 return false;
676 } 676 }
677 -  
678 - newd["collocation_goods"] = collocationGoods;  
679 - newd["is_coupon"] = th.data.is_coupon;  
680 - th.buyNow(newd); 677 + //newd["collocation_goods"] = collocationGoods;
  678 + //newd["is_coupon"] = th.data.is_coupon;
  679 + th.buyNow(newd,collocationGoods);
681 }) 680 })
682 681
683 }, 682 },
684 683
685 //----------立即购买----------- 684 //----------立即购买-----------
686 - buyNow: function(e) {  
687 - s.set_b_now(e);  
688 - wx.redirectTo({  
689 - url: "/packageE/pages/cart/cart2/cart2?is_bnow=1&goods_id=" + e.goods_id,  
690 - }); 685 + buyNow:async function(e,collocationGoods) {
  686 + //s.set_b_now(e);
  687 + // wx.redirectTo({
  688 + // url: "/packageE/pages/cart/cart2/cart2?is_bnow=1&goods_id=" + e.goods_id,
  689 + // });
  690 + console.log(1111);
  691 + console.log(e);
  692 + console.log(collocationGoods);
  693 + var th=this;
  694 +
  695 + //----其他就按照公众号的购物车立即购买形式来修改,先看会员在购物车中是否加入了该商品,立即购买的-----
  696 + var res=await getApp().request.promiseGet("/api/weshop/cart/page", {
  697 + data: {
  698 + store_id: os.stoid,
  699 + user_id: oo.user_id,
  700 + state: 1
  701 + }
  702 + })
  703 +
  704 + //-------如果购物车中有相关的数据---------
  705 + if (res.data.code == 0 && res.data.data.total > 0) {
  706 + for (let j in res.data.data.pageData) {
  707 + let item_j = res.data.data.pageData[j];
  708 + var url = '/api/weshop/cart/del/' + os.stoid + '/' + item_j.id;
  709 + getApp().request.delete(url, {});
  710 + }
  711 + }
  712 +
  713 + //-- 推迟一下,因为删除没有那么快 --
  714 + setTimeout(async () => {
  715 + e.state = 1;
  716 + e.selected=1;
  717 + var dp_rs= await getApp().request.promisePost("/api/weshop/cart/save", {
  718 + data: e,
  719 + });
  720 +
  721 + if(!dp_rs || dp_rs.data.code!=0){
  722 + return false;
  723 + }
  724 +
  725 + for (let j = 0; j <collocationGoods.length ; j++) {
  726 + var c_gd=collocationGoods[j];
  727 + var save_data = {
  728 + goods_id: c_gd.goods_id,
  729 + goods_num: th.data.goodsInputNum,
  730 + pick_id: th.data.sto_sele_id,
  731 + user_id: oo.user_id,
  732 + store_id: th.data.stoid,
  733 + goods_price: c_gd.goods_price,
  734 + member_goods_price: c_gd.goods_price,
  735 + goods_name: c_gd.goods_name,
  736 + goods_sn: c_gd.goods_sn,
  737 + sku: c_gd.sku,
  738 + prom_type: 5,
  739 + prom_id:e.prom_id,
  740 + is_collocation:1,
  741 + state:1,
  742 + selected:1
  743 + };
  744 + await getApp().request.promisePost("/api/weshop/cart/save", {
  745 + data: save_data,
  746 + });
  747 + }
  748 + setTimeout(()=>{ th.setData({lding:0}) },500);
  749 +
  750 + getApp().goto("/packageE/pages/cart/cart2/cart2?state=1");
  751 +
  752 +
  753 +
  754 + }, 500)
691 }, 755 },
692 756
693 //----------增加购买数量----------- 757 //----------增加购买数量-----------
@@ -1407,7 +1471,8 @@ Page({ @@ -1407,7 +1471,8 @@ Page({
1407 data: { 1471 data: {
1408 store_id: os.stoid, 1472 store_id: os.stoid,
1409 user_id: user_id, 1473 user_id: user_id,
1410 - goods_id: gd.goods_id 1474 + goods_id: gd.goods_id,
  1475 + isnew:1
1411 }, 1476 },
1412 success: function(t) { 1477 success: function(t) {
1413 if (t.data.code == 0) { 1478 if (t.data.code == 0) {
@@ -1420,7 +1485,8 @@ Page({ @@ -1420,7 +1485,8 @@ Page({
1420 user_id: user_id, 1485 user_id: user_id,
1421 goods_id: gd.goods_id, 1486 goods_id: gd.goods_id,
1422 prom_type: gd.prom_type, 1487 prom_type: gd.prom_type,
1423 - prom_id: gd.prom_id 1488 + prom_id: gd.prom_id,
  1489 + isnew:1
1424 }, 1490 },
1425 //-----获取----- 1491 //-----获取-----
1426 success: function(tt) { 1492 success: function(tt) {
packageA/pages/serviceCard_pd/cart/cart.js
@@ -63,7 +63,31 @@ Page({ @@ -63,7 +63,31 @@ Page({
63 show_card: null, //显示的等级卡 63 show_card: null, //显示的等级卡
64 card_name: '', //显示的卡的名称 64 card_name: '', //显示的卡的名称
65 card_cut_price: null,//减价多少钱 65 card_cut_price: null,//减价多少钱
66 - bconfig: null, 66 + bconfig: null,
  67 + showFold:true,
  68 + },
  69 +
  70 +
  71 +
  72 + onReady() {
  73 +
  74 + setTimeout(() => {
  75 + wx.createSelectorQuery().selectAll(".showArea, .hideArea").boundingClientRect(res => {
  76 + if (res.length != 0) {
  77 + this.setData({
  78 + showFold: res[0].height < res[1].height,
  79 + });
  80 + };
  81 +
  82 + }).exec();
  83 + }, 1000);
  84 +
  85 + },
  86 +
  87 + clickCollapse() {
  88 + this.setData({
  89 + flag: !this.data.flag,
  90 + })
67 }, 91 },
68 onLoad: function (t) { 92 onLoad: function (t) {
69 console.log("onLoad_pt_cart"); 93 console.log("onLoad_pt_cart");
packageA/pages/serviceCard_pd/cart/cart.wxml
@@ -113,12 +113,16 @@ @@ -113,12 +113,16 @@
113 113
114 </view> 114 </view>
115 <!-- 保障服务 --> 115 <!-- 保障服务 -->
116 - <view class="bz_view flex bdt16" wx:if="{{bconfig.service_bz}}">  
117 - <image class="bzfu_img" src="{{imgUrl}}/miniapp/images/bzfu_w.png"></image>  
118 - <view class="flex f1 rel" style="position: relative;" bindtap="{{showFold ? 'clickCollapse':''}}">  
119 - <view class="bz-content showArea {{flag ? '':'ellipsis-1x'}}">{{bconfig.service_bz}}</view> 116 +<view class="bz_view22 flex bdt16 ai_c" wx:if="{{bconfig.service_bz}}">
  117 + <image class="bzfu_img22" src="{{imgUrl}}/miniapp/images/bzfu_w.png"></image>
  118 + <view class="flex f1 ai_c rel22" style="position: relative;" bindtap="{{showFold ? 'clickCollapse':''}}">
  119 + <view class="bz-content22 showArea22 {{flag ? '':'ellipsis-1x'}}">{{bconfig.service_bz}}</view>
  120 + <view class="bz-content22 hideArea22">{{bconfig.service_bz}}</view>
  121 + <view class="cx-obtain-coupon22 wsize22 arrow22" wx:if="{{showFold}}">
  122 + <text class="bg_jj22 down22 {{flag ? 'up22':''}}"></text>
  123 + </view>
120 </view> 124 </view>
121 - </view> 125 + </view>
122 126
123 <view class="coupon-mes flex-vertical"> 127 <view class="coupon-mes flex-vertical">
124 <view>留言</view> 128 <view>留言</view>
packageA/pages/serviceCard_pd/team_show/team_show.js
@@ -301,8 +301,8 @@ Page({ @@ -301,8 +301,8 @@ Page({
301 user_id: user_id, 301 user_id: user_id,
302 goods_id: gd.goods_id, 302 goods_id: gd.goods_id,
303 prom_type: gd.prom_type, 303 prom_type: gd.prom_type,
304 - prom_id: gd.prom_id  
305 - 304 + prom_id: gd.prom_id,
  305 + isnew:1
306 }, 306 },
307 }).then(res=>{ 307 }).then(res=>{
308 var buy_num_data=res.data.data; 308 var buy_num_data=res.data.data;
packageB/pages/zuhegou/index/index.js
@@ -186,9 +186,8 @@ Page({ @@ -186,9 +186,8 @@ Page({
186 "color": "#333", 186 "color": "#333",
187 "width": "250px", 187 "width": "250px",
188 "top": "820px", 188 "top": "820px",
189 - "fontSize": "26px",  
190 - "fontWeight": "normal",  
191 - "maxLines": "1", 189 + "fontSize": "22px",
  190 + "maxLines": "2",
192 "left": "60px", 191 "left": "60px",
193 } 192 }
194 }, 193 },
@@ -430,9 +429,8 @@ Page({ @@ -430,9 +429,8 @@ Page({
430 "color": "#333", 429 "color": "#333",
431 "width": "250px", 430 "width": "250px",
432 "top": "820px", 431 "top": "820px",
433 - "fontSize": "26px",  
434 - "fontWeight": "normal",  
435 - "maxLines": "1", 432 + "fontSize": "22px",
  433 + "maxLines": "2",
436 "left": "60px", 434 "left": "60px",
437 } 435 }
438 }, 436 },
@@ -649,6 +647,7 @@ Page({ @@ -649,6 +647,7 @@ Page({
649 } else { 647 } else {
650 //获取头像的分享 648 //获取头像的分享
651 th.get_head_temp(function () { 649 th.get_head_temp(function () {
  650 + var imgDraw = th.data.imgDraw;
652 var txt = th.data.act.zhprice + "元" + th.data.act.zhbuyqty + "件"; 651 var txt = th.data.act.zhprice + "元" + th.data.act.zhbuyqty + "件";
653 imgDraw.views[0].url = th.data.share_head; 652 imgDraw.views[0].url = th.data.share_head;
654 imgDraw.views[1].text = userInfo.nickname; 653 imgDraw.views[1].text = userInfo.nickname;
@@ -2336,7 +2335,8 @@ Page({ @@ -2336,7 +2335,8 @@ Page({
2336 user_id: user_id, 2335 user_id: user_id,
2337 goods_id: gd.goods_id, 2336 goods_id: gd.goods_id,
2338 prom_type: 7, 2337 prom_type: 7,
2339 - prom_id: th.data.act.id 2338 + prom_id: th.data.act.id,
  2339 + isnew:1
2340 }, 2340 },
2341 }).then(res2 => { 2341 }).then(res2 => {
2342 var g_buy_num = 0; 2342 var g_buy_num = 0;
@@ -2825,7 +2825,8 @@ Page({ @@ -2825,7 +2825,8 @@ Page({
2825 user_id: user_id, 2825 user_id: user_id,
2826 goods_id: item_j.goods_id, 2826 goods_id: item_j.goods_id,
2827 prom_type: 7, 2827 prom_type: 7,
2828 - prom_id: th.data.act.id 2828 + prom_id: th.data.act.id,
  2829 + isnew:1
2829 }, 2830 },
2830 }).then(res2 => { 2831 }).then(res2 => {
2831 if (res2.data.code == 0) { 2832 if (res2.data.code == 0) {
@@ -2901,7 +2902,8 @@ Page({ @@ -2901,7 +2902,8 @@ Page({
2901 user_id: oo.user_id, 2902 user_id: oo.user_id,
2902 goods_id: item_j.goods_id, 2903 goods_id: item_j.goods_id,
2903 prom_type: 7, 2904 prom_type: 7,
2904 - prom_id: th.data.act.id 2905 + prom_id: th.data.act.id,
  2906 + isnew:1
2905 }, 2907 },
2906 }).then(res2 => { 2908 }).then(res2 => {
2907 if (res2.data.code == 0) { 2909 if (res2.data.code == 0) {
packageB/pages/zuhegou/index/index.wxml
@@ -146,7 +146,7 @@ @@ -146,7 +146,7 @@
146 <view class="t-r pdb20 white2"> 146 <view class="t-r pdb20 white2">
147 <text class="iconfont icon-close fs40" bindtap="closePoster"></text> 147 <text class="iconfont icon-close fs40" bindtap="closePoster"></text>
148 </view> 148 </view>
149 - <image src="{{myimg}}" class="poster" show-menu-by-longpress></image> 149 + <image src="{{myimg}}" class="{{act.share_imgurl?'poster333':'poster'}}" show-menu-by-longpress></image>
150 <view class="pdt10 fs26 white2"> 150 <view class="pdt10 fs26 white2">
151 <text class="iconfont icon-zhiwen"></text> 151 <text class="iconfont icon-zhiwen"></text>
152 长按图片保存至相册 152 长按图片保存至相册
packageB/pages/zuhegou/index/index.wxss
@@ -194,7 +194,14 @@ page { @@ -194,7 +194,14 @@ page {
194 194
195 .poster { 195 .poster {
196 width: 650rpx; 196 width: 650rpx;
197 - height: 943rpx; 197 + height: 843rpx;
  198 + border-radius: 16rpx;
  199 + margin: 0 auto;
  200 +}
  201 +
  202 +.poster333 {
  203 + width: 650rpx;
  204 + height: 1088rpx;
198 border-radius: 16rpx; 205 border-radius: 16rpx;
199 margin: 0 auto; 206 margin: 0 auto;
200 } 207 }
packageB/pages/zuhegou/preindex/index.js
@@ -1744,7 +1744,8 @@ Page({ @@ -1744,7 +1744,8 @@ Page({
1744 user_id: user_id, 1744 user_id: user_id,
1745 goods_id: gd.goods_id, 1745 goods_id: gd.goods_id,
1746 prom_type: 7, 1746 prom_type: 7,
1747 - prom_id: th.data.act.id 1747 + prom_id: th.data.act.id,
  1748 + isnew:1
1748 }, 1749 },
1749 }).then(res2 => { 1750 }).then(res2 => {
1750 var g_buy_num = 0; 1751 var g_buy_num = 0;
@@ -2120,7 +2121,8 @@ Page({ @@ -2120,7 +2121,8 @@ Page({
2120 user_id: user_id, 2121 user_id: user_id,
2121 goods_id: item_j.goods_id, 2122 goods_id: item_j.goods_id,
2122 prom_type: 7, 2123 prom_type: 7,
2123 - prom_id: th.data.act.id 2124 + prom_id: th.data.act.id,
  2125 + isnew:1
2124 }, 2126 },
2125 }).then(res2 => { 2127 }).then(res2 => {
2126 if (res2.data.code == 0) { 2128 if (res2.data.code == 0) {
@@ -2196,7 +2198,8 @@ Page({ @@ -2196,7 +2198,8 @@ Page({
2196 user_id: oo.user_id, 2198 user_id: oo.user_id,
2197 goods_id: item_j.goods_id, 2199 goods_id: item_j.goods_id,
2198 prom_type: 7, 2200 prom_type: 7,
2199 - prom_id: th.data.act.id 2201 + prom_id: th.data.act.id,
  2202 + isnew:1
2200 }, 2203 },
2201 }).then(res2 => { 2204 }).then(res2 => {
2202 if (res2.data.code == 0) { 2205 if (res2.data.code == 0) {
packageC/pages/luckyGo/luckyGo_cart/luckyGo_cart.js
@@ -125,8 +125,32 @@ Page({ @@ -125,8 +125,32 @@ Page({
125 hid_inp: 1, 125 hid_inp: 1,
126 user_note: {}, 126 user_note: {},
127 zuhe_map_good: {}, 127 zuhe_map_good: {},
128 - bconfig:null  
129 - }, 128 + bconfig:null,
  129 + showFold:true,
  130 + },
  131 +
  132 +
  133 +
  134 + onReady() {
  135 +
  136 + setTimeout(() => {
  137 + wx.createSelectorQuery().selectAll(".showArea, .hideArea").boundingClientRect(res => {
  138 + if (res.length != 0) {
  139 + this.setData({
  140 + showFold: res[0].height < res[1].height,
  141 + });
  142 + };
  143 +
  144 + }).exec();
  145 + }, 1000);
  146 +
  147 + },
  148 +
  149 + clickCollapse() {
  150 + this.setData({
  151 + flag: !this.data.flag,
  152 + })
  153 + },
130 154
131 onLoad: function (t) { 155 onLoad: function (t) {
132 wx.setNavigationBarTitle({ title: "填写订单", }) 156 wx.setNavigationBarTitle({ title: "填写订单", })
@@ -449,7 +473,8 @@ Page({ @@ -449,7 +473,8 @@ Page({
449 user_id: getApp().globalData.user_id, 473 user_id: getApp().globalData.user_id,
450 goods_id: item1.goods_id, 474 goods_id: item1.goods_id,
451 prom_type: item1.prom_type, 475 prom_type: item1.prom_type,
452 - prom_id: item1.prom_id 476 + prom_id: item1.prom_id,
  477 + isnew:1
453 }, 478 },
454 }).then(res => { 479 }).then(res => {
455 var buy_num_data = res.data.data; 480 var buy_num_data = res.data.data;
packageC/pages/luckyGo/luckyGo_cart/luckyGo_cart.wxml
@@ -375,12 +375,16 @@ @@ -375,12 +375,16 @@
375 </view> 375 </view>
376 376
377 <!-- 保障服务 --> 377 <!-- 保障服务 -->
378 - <view class="bz_view flex bdt16" wx:if="{{bconfig.service_bz}}">  
379 - <image class="bzfu_img" src="{{imgUrl}}/miniapp/images/bzfu_w.png"></image>  
380 - <view class="flex f1 rel" style="position: relative;" bindtap="{{showFold ? 'clickCollapse':''}}">  
381 - <view class="bz-content showArea {{flag ? '':'ellipsis-1x'}}">{{bconfig.service_bz}}</view> 378 +<view class="bz_view22 flex bdt16 ai_c" wx:if="{{bconfig.service_bz}}">
  379 + <image class="bzfu_img22" src="{{imgUrl}}/miniapp/images/bzfu_w.png"></image>
  380 + <view class="flex f1 ai_c rel22" style="position: relative;" bindtap="{{showFold ? 'clickCollapse':''}}">
  381 + <view class="bz-content22 showArea22 {{flag ? '':'ellipsis-1x'}}">{{bconfig.service_bz}}</view>
  382 + <view class="bz-content22 hideArea22">{{bconfig.service_bz}}</view>
  383 + <view class="cx-obtain-coupon22 wsize22 arrow22" wx:if="{{showFold}}">
  384 + <text class="bg_jj22 down22 {{flag ? 'up22':''}}"></text>
  385 + </view>
382 </view> 386 </view>
383 - </view> 387 + </view>
384 <!-- 留言 --> 388 <!-- 留言 -->
385 <view class="coupon-mes flex-vertical"> 389 <view class="coupon-mes flex-vertical">
386 <view>留言</view> 390 <view>留言</view>
packageC/pages/luckyGo/luckyGo_cart_ct/luckyGo_cart_ct.js
@@ -78,9 +78,32 @@ Page({ @@ -78,9 +78,32 @@ Page({
78 act:null, //幸运购的活动 78 act:null, //幸运购的活动
79 79
80 same_ok:1, //同城配送的控制,默认ok 80 same_ok:1, //同城配送的控制,默认ok
81 - bconfig:null 81 + bconfig:null,
  82 + showFold:true,
82 }, 83 },
83 84
  85 +
  86 +
  87 + onReady() {
  88 +
  89 + setTimeout(() => {
  90 + wx.createSelectorQuery().selectAll(".showArea, .hideArea").boundingClientRect(res => {
  91 + if (res.length != 0) {
  92 + this.setData({
  93 + showFold: res[0].height < res[1].height,
  94 + });
  95 + };
  96 +
  97 + }).exec();
  98 + }, 1000);
  99 +
  100 + },
  101 +
  102 + clickCollapse() {
  103 + this.setData({
  104 + flag: !this.data.flag,
  105 + })
  106 + },
84 onLoad: function (t) { 107 onLoad: function (t) {
85 108
86 // console.log('收到的传参', t); 109 // console.log('收到的传参', t);
packageC/pages/luckyGo/luckyGo_cart_ct/luckyGo_cart_ct.wxml
@@ -124,12 +124,16 @@ @@ -124,12 +124,16 @@
124 </view> 124 </view>
125 125
126 <!-- 保障服务 --> 126 <!-- 保障服务 -->
127 - <view class="bz_view flex bdt16" wx:if="{{bconfig.service_bz}}">  
128 - <image class="bzfu_img" src="{{imgUrl}}/miniapp/images/bzfu_w.png"></image>  
129 - <view class="flex f1 rel" style="position: relative;" bindtap="{{showFold ? 'clickCollapse':''}}">  
130 - <view class="bz-content showArea {{flag ? '':'ellipsis-1x'}}">{{bconfig.service_bz}}</view> 127 + <view class="bz_view22 flex bdt16 ai_c" wx:if="{{bconfig.service_bz}}">
  128 + <image class="bzfu_img22" src="{{imgUrl}}/miniapp/images/bzfu_w.png"></image>
  129 + <view class="flex f1 ai_c rel22" style="position: relative;" bindtap="{{showFold ? 'clickCollapse':''}}">
  130 + <view class="bz-content22 showArea22 {{flag ? '':'ellipsis-1x'}}">{{bconfig.service_bz}}</view>
  131 + <view class="bz-content22 hideArea22">{{bconfig.service_bz}}</view>
  132 + <view class="cx-obtain-coupon22 wsize22 arrow22" wx:if="{{showFold}}">
  133 + <text class="bg_jj22 down22 {{flag ? 'up22':''}}"></text>
  134 + </view>
131 </view> 135 </view>
132 - </view> 136 + </view>
133 137
134 <view class="coupon-mes flex-vertical"> 138 <view class="coupon-mes flex-vertical">
135 <view>留言</view> 139 <view>留言</view>
packageC/pages/luckyGo/luckyGo_goodsInfo/luckyGo_goodsInfo.js
@@ -4377,7 +4377,8 @@ Page({ @@ -4377,7 +4377,8 @@ Page({
4377 data: { 4377 data: {
4378 store_id: os.stoid, 4378 store_id: os.stoid,
4379 user_id: user_id, 4379 user_id: user_id,
4380 - goods_id: gd.goods_id 4380 + goods_id: gd.goods_id,
  4381 + isnew:1
4381 }, 4382 },
4382 success: function (t) { 4383 success: function (t) {
4383 if (t.data.code == 0) { 4384 if (t.data.code == 0) {
@@ -4396,7 +4397,8 @@ Page({ @@ -4396,7 +4397,8 @@ Page({
4396 user_id: user_id, 4397 user_id: user_id,
4397 goods_id: gd.goods_id, 4398 goods_id: gd.goods_id,
4398 prom_type: gd.prom_type, 4399 prom_type: gd.prom_type,
4399 - prom_id: gd.prom_id 4400 + prom_id: gd.prom_id,
  4401 + isnew:1
4400 }, 4402 },
4401 //-----获取----- 4403 //-----获取-----
4402 success: function (tt) { 4404 success: function (tt) {
packageC/pages/payForAnother/payForAnother.js
@@ -446,7 +446,8 @@ Page({ @@ -446,7 +446,8 @@ Page({
446 user_id: getApp().globalData.user_id, 446 user_id: getApp().globalData.user_id,
447 goods_id: item1.goods_id, 447 goods_id: item1.goods_id,
448 prom_type: item1.prom_type, 448 prom_type: item1.prom_type,
449 - prom_id: item1.prom_id 449 + prom_id: item1.prom_id,
  450 + isnew:1
450 }, 451 },
451 }).then(res => { 452 }).then(res => {
452 var buy_num_data = res.data.data; 453 var buy_num_data = res.data.data;
packageC/pages/presell/cart/cart.js
@@ -120,8 +120,32 @@ Page({ @@ -120,8 +120,32 @@ Page({
120 paying:0, 120 paying:0,
121 121
122 same_ok:1 , //同城配送按钮控制 122 same_ok:1 , //同城配送按钮控制
123 - bconfig:null  
124 - }, 123 + bconfig:null,
  124 + showFold:true,
  125 + },
  126 +
  127 +
  128 +
  129 + onReady() {
  130 +
  131 + setTimeout(() => {
  132 + wx.createSelectorQuery().selectAll(".showArea, .hideArea").boundingClientRect(res => {
  133 + if (res.length != 0) {
  134 + this.setData({
  135 + showFold: res[0].height < res[1].height,
  136 + });
  137 + };
  138 +
  139 + }).exec();
  140 + }, 1000);
  141 +
  142 + },
  143 +
  144 + clickCollapse() {
  145 + this.setData({
  146 + flag: !this.data.flag,
  147 + })
  148 + },
125 onLoad: function (t) { 149 onLoad: function (t) {
126 150
127 if (t.order_id) this.data.order_id = t.order_id; 151 if (t.order_id) this.data.order_id = t.order_id;
@@ -2634,7 +2658,8 @@ Page({ @@ -2634,7 +2658,8 @@ Page({
2634 user_id: getApp().globalData.user_id, 2658 user_id: getApp().globalData.user_id,
2635 goods_id: good.goods_id, 2659 goods_id: good.goods_id,
2636 prom_type: good.prom_type, 2660 prom_type: good.prom_type,
2637 - prom_id: good.prom_id 2661 + prom_id: good.prom_id,
  2662 + isnew:1
2638 }, 2663 },
2639 }).then(res => { 2664 }).then(res => {
2640 var buy_num_data = res.data.data; 2665 var buy_num_data = res.data.data;
packageC/pages/presell/cart/cart.wxml
@@ -265,12 +265,16 @@ @@ -265,12 +265,16 @@
265 </view> 265 </view>
266 266
267 <!-- 保障服务 --> 267 <!-- 保障服务 -->
268 - <view class="bz_view flex bdt16" wx:if="{{bconfig.service_bz}}">  
269 - <image class="bzfu_img" src="{{imgUrl}}/miniapp/images/bzfu_w.png"></image>  
270 - <view class="flex f1 rel" style="position: relative;" bindtap="{{showFold ? 'clickCollapse':''}}">  
271 - <view class="bz-content showArea {{flag ? '':'ellipsis-1x'}}">{{bconfig.service_bz}}</view> 268 + <view class="bz_view22 flex bdt16 ai_c" wx:if="{{bconfig.service_bz}}">
  269 + <image class="bzfu_img22" src="{{imgUrl}}/miniapp/images/bzfu_w.png"></image>
  270 + <view class="flex f1 ai_c rel22" style="position: relative;" bindtap="{{showFold ? 'clickCollapse':''}}">
  271 + <view class="bz-content22 showArea22 {{flag ? '':'ellipsis-1x'}}">{{bconfig.service_bz}}</view>
  272 + <view class="bz-content22 hideArea22">{{bconfig.service_bz}}</view>
  273 + <view class="cx-obtain-coupon22 wsize22 arrow22" wx:if="{{showFold}}">
  274 + <text class="bg_jj22 down22 {{flag ? 'up22':''}}"></text>
  275 + </view>
272 </view> 276 </view>
273 - </view> 277 + </view>
274 <!-- 留言 --> 278 <!-- 留言 -->
275 <view class="coupon-mes flex-vertical"> 279 <view class="coupon-mes flex-vertical">
276 <view>留言</view> 280 <view>留言</view>
packageC/pages/presell/cart/cart2.js
@@ -131,9 +131,32 @@ Page({ @@ -131,9 +131,32 @@ Page({
131 same_ok:1, 131 same_ok:1,
132 appoint_pick_keyid: '', 132 appoint_pick_keyid: '',
133 133
134 - bconfig:null  
135 -  
136 - }, 134 + bconfig:null,
  135 + showFold:true,
  136 + },
  137 +
  138 +
  139 +
  140 + onReady() {
  141 +
  142 + setTimeout(() => {
  143 + wx.createSelectorQuery().selectAll(".showArea, .hideArea").boundingClientRect(res => {
  144 + if (res.length != 0) {
  145 + this.setData({
  146 + showFold: res[0].height < res[1].height,
  147 + });
  148 + };
  149 +
  150 + }).exec();
  151 + }, 1000);
  152 +
  153 + },
  154 +
  155 + clickCollapse() {
  156 + this.setData({
  157 + flag: !this.data.flag,
  158 + })
  159 + },
137 onLoad: function (t) { 160 onLoad: function (t) {
138 wx.setNavigationBarTitle({ title: "填写订单", }) 161 wx.setNavigationBarTitle({ title: "填写订单", })
139 var th = this; 162 var th = this;
packageC/pages/presell/cart/cart2.wxml
@@ -178,12 +178,16 @@ @@ -178,12 +178,16 @@
178 </view> 178 </view>
179 179
180 <!-- 保障服务 --> 180 <!-- 保障服务 -->
181 - <view class="bz_view flex bdt16" wx:if="{{bconfig.service_bz}}">  
182 - <image class="bzfu_img" src="{{imgUrl}}/miniapp/images/bzfu_w.png"></image>  
183 - <view class="flex f1 rel" style="position: relative;" bindtap="{{showFold ? 'clickCollapse':''}}">  
184 - <view class="bz-content showArea {{flag ? '':'ellipsis-1x'}}">{{bconfig.service_bz}}</view> 181 + <view class="bz_view22 flex bdt16 ai_c" wx:if="{{bconfig.service_bz}}">
  182 + <image class="bzfu_img22" src="{{imgUrl}}/miniapp/images/bzfu_w.png"></image>
  183 + <view class="flex f1 ai_c rel22" style="position: relative;" bindtap="{{showFold ? 'clickCollapse':''}}">
  184 + <view class="bz-content22 showArea22 {{flag ? '':'ellipsis-1x'}}">{{bconfig.service_bz}}</view>
  185 + <view class="bz-content22 hideArea22">{{bconfig.service_bz}}</view>
  186 + <view class="cx-obtain-coupon22 wsize22 arrow22" wx:if="{{showFold}}">
  187 + <text class="bg_jj22 down22 {{flag ? 'up22':''}}"></text>
  188 + </view>
185 </view> 189 </view>
186 - </view> 190 + </view>
187 <!-- 留言 --> 191 <!-- 留言 -->
188 <view class="coupon-mes flex-vertical"> 192 <view class="coupon-mes flex-vertical">
189 <view>留言</view> 193 <view>留言</view>
packageC/pages/presell/cart/cart2_pre.js
@@ -55,7 +55,28 @@ Page({ @@ -55,7 +55,28 @@ Page({
55 yuer: 0, 55 yuer: 0,
56 agree_no_ref: 0, 56 agree_no_ref: 0,
57 is_pre_cut:0, //是否可以使用预存 0是不可以1的可以 57 is_pre_cut:0, //是否可以使用预存 0是不可以1的可以
58 - bconfig:null 58 + bconfig:null,
  59 + showFold:true,
  60 + },
  61 +
  62 + onReady() {
  63 + setTimeout(() => {
  64 + wx.createSelectorQuery().selectAll(".showArea, .hideArea").boundingClientRect(res => {
  65 + if (res.length != 0) {
  66 + this.setData({
  67 + showFold: res[0].height < res[1].height,
  68 + });
  69 + };
  70 +
  71 + }).exec();
  72 + }, 1000);
  73 +
  74 + },
  75 +
  76 + clickCollapse() {
  77 + this.setData({
  78 + flag: !this.data.flag,
  79 + })
59 }, 80 },
60 onLoad: function (t) { 81 onLoad: function (t) {
61 wx.setNavigationBarTitle({ 82 wx.setNavigationBarTitle({
packageC/pages/presell/cart/cart2_pre.wxml
@@ -112,12 +112,16 @@ @@ -112,12 +112,16 @@
112 </view> 112 </view>
113 113
114 <!-- 保障服务 --> 114 <!-- 保障服务 -->
115 - <view class="bz_view flex bdt16" wx:if="{{bconfig.service_bz}}">  
116 - <image class="bzfu_img" src="{{imgUrl}}/miniapp/images/bzfu_w.png"></image>  
117 - <view class="flex f1 rel" style="position: relative;" bindtap="{{showFold ? 'clickCollapse':''}}">  
118 - <view class="bz-content showArea {{flag ? '':'ellipsis-1x'}}">{{bconfig.service_bz}}</view> 115 + <view class="bz_view22 flex bdt16 ai_c" wx:if="{{bconfig.service_bz}}">
  116 + <image class="bzfu_img22" src="{{imgUrl}}/miniapp/images/bzfu_w.png"></image>
  117 + <view class="flex f1 ai_c rel22" style="position: relative;" bindtap="{{showFold ? 'clickCollapse':''}}">
  118 + <view class="bz-content22 showArea22 {{flag ? '':'ellipsis-1x'}}">{{bconfig.service_bz}}</view>
  119 + <view class="bz-content22 hideArea22">{{bconfig.service_bz}}</view>
  120 + <view class="cx-obtain-coupon22 wsize22 arrow22" wx:if="{{showFold}}">
  121 + <text class="bg_jj22 down22 {{flag ? 'up22':''}}"></text>
  122 + </view>
119 </view> 123 </view>
120 - </view> 124 + </view>
121 125
122 <view class="coupon-mes flex-vertical"> 126 <view class="coupon-mes flex-vertical">
123 <view>留言</view> 127 <view>留言</view>
packageC/pages/presell/goodsInfo/goodsInfo.js
@@ -1095,11 +1095,11 @@ Page({ @@ -1095,11 +1095,11 @@ Page({
1095 //---判断商品是否超出活动限购--- 1095 //---判断商品是否超出活动限购---
1096 if (th.data.prom_buy_num != -1 && th.data.prom_buy_limit > 0) { 1096 if (th.data.prom_buy_num != -1 && th.data.prom_buy_limit > 0) {
1097 if (th.data.goodsInputNum + th.data.prom_buy_num > th.data.prom_buy_limit) { 1097 if (th.data.goodsInputNum + th.data.prom_buy_num > th.data.prom_buy_limit) {
1098 - wx.showModal({  
1099 - title: '提示',  
1100 - content: '超出商品活动限购'  
1101 - });  
1102 - return false; 1098 + wx.showModal({
  1099 + title: '提示',
  1100 + content: '超出商品活动限购'
  1101 + });
  1102 + return false;
1103 } 1103 }
1104 } 1104 }
1105 1105
@@ -2764,6 +2764,7 @@ Page({ @@ -2764,6 +2764,7 @@ Page({
2764 store_id: os.stoid, 2764 store_id: os.stoid,
2765 user_id: user_id, 2765 user_id: user_id,
2766 goods_id: gd.goods_id, 2766 goods_id: gd.goods_id,
  2767 + isnew:1
2767 }, 2768 },
2768 success: function (t) { 2769 success: function (t) {
2769 if (t.data.code == 0) { 2770 if (t.data.code == 0) {
packageC/pages/presell/pregoodsInfo/goodsInfo.js
@@ -2568,6 +2568,7 @@ Page({ @@ -2568,6 +2568,7 @@ Page({
2568 store_id: os.stoid, 2568 store_id: os.stoid,
2569 user_id: user_id, 2569 user_id: user_id,
2570 goods_id: gd.goods_id, 2570 goods_id: gd.goods_id,
  2571 + isnew:1
2571 }, 2572 },
2572 success: function (t) { 2573 success: function (t) {
2573 if (t.data.code == 0) { 2574 if (t.data.code == 0) {
packageE/pages/cart/cart2/cart2.js
@@ -134,7 +134,6 @@ Page({ @@ -134,7 +134,6 @@ Page({
134 in_zhact_gdmap: {}, //不同门店参与同一活动的限购,这些都是map表,很 134 in_zhact_gdmap: {}, //不同门店参与同一活动的限购,这些都是map表,很
135 in_zhact:{}, //组合购活动在列表中的显示 135 in_zhact:{}, //组合购活动在列表中的显示
136 in_yhact:{}, //优惠活动在列表中的显示 136 in_yhact:{}, //优惠活动在列表中的显示
137 -  
138 in_zh_gd_buy_map:{}, //就是商品在组合购中的 137 in_zh_gd_buy_map:{}, //就是商品在组合购中的
139 138
140 in_zhact_gdmap_new: {}, //不同门店参与同一活动的限购,这些都是map表,是多促销互动专用,不能和in_zhact_gdmap重叠 139 in_zhact_gdmap_new: {}, //不同门店参与同一活动的限购,这些都是map表,是多促销互动专用,不能和in_zhact_gdmap重叠
@@ -167,9 +166,32 @@ Page({ @@ -167,9 +166,32 @@ Page({
167 166
168 same_ok:1, //同城配送的控制,默认ok 167 same_ok:1, //同城配送的控制,默认ok
169 168
170 - bconfig:null 169 + bconfig:null,
  170 + showFold:true,
  171 + },
  172 +
  173 +
  174 +
  175 + onReady() {
  176 +
  177 + setTimeout(() => {
  178 + wx.createSelectorQuery().selectAll(".showArea, .hideArea").boundingClientRect(res => {
  179 + if (res.length != 0) {
  180 + this.setData({
  181 + showFold: res[0].height < res[1].height,
  182 + });
  183 + };
  184 +
  185 + }).exec();
  186 + }, 1000);
171 187
172 }, 188 },
  189 +
  190 + clickCollapse() {
  191 + this.setData({
  192 + flag: !this.data.flag,
  193 + })
  194 + },
173 195
174 onLoad: function (t) { 196 onLoad: function (t) {
175 197
@@ -214,6 +236,27 @@ Page({ @@ -214,6 +236,27 @@ Page({
214 onUnload: function () { 236 onUnload: function () {
215 this.setData({ isclose: 1 }) 237 this.setData({ isclose: 1 })
216 }, 238 },
  239 +
  240 + onReady() {
  241 +
  242 + setTimeout(() => {
  243 + wx.createSelectorQuery().selectAll(".showArea, .hideArea").boundingClientRect(res => {
  244 + if (res.length != 0) {
  245 + this.setData({
  246 + showFold: res[0].height < res[1].height,
  247 + });
  248 + };
  249 +
  250 + }).exec();
  251 + }, 1000);
  252 +
  253 + },
  254 +
  255 + clickCollapse() {
  256 + this.setData({
  257 + flag: !this.data.flag,
  258 + })
  259 + },
217 onHide: function () { 260 onHide: function () {
218 this.setData({ 261 this.setData({
219 isget_by_quan: {}, 262 isget_by_quan: {},
@@ -227,6 +270,7 @@ Page({ @@ -227,6 +270,7 @@ Page({
227 270
228 //----------子页返回父页触发---------- 271 //----------子页返回父页触发----------
229 onShow: function () { 272 onShow: function () {
  273 +
230 //富友支付取消支付强行回去 274 //富友支付取消支付强行回去
231 var fy=ut.fy_back("/pages/user/order_list/order_list",1); 275 var fy=ut.fy_back("/pages/user/order_list/order_list",1);
232 if(fy) return false; 276 if(fy) return false;
@@ -240,7 +284,6 @@ Page({ @@ -240,7 +284,6 @@ Page({
240 wx.navigateTo({ 284 wx.navigateTo({
241 url: "/pages/index/index/index" 285 url: "/pages/index/index/index"
242 }) 286 })
243 -  
244 } else { 287 } else {
245 this.getuser_addr(function (ie) { 288 this.getuser_addr(function (ie) {
246 console.log("getuser_addr") 289 console.log("getuser_addr")
@@ -638,7 +681,7 @@ Page({ @@ -638,7 +681,7 @@ Page({
638 681
639 }, 682 },
640 683
641 - //-- 获取搭配购商品 -- 684 + //-- 获取搭配购商品gd是商品 arr是购物车商品列表(某个门店的) --
642 async set_collection(gd, arr, index) { 685 async set_collection(gd, arr, index) {
643 var th = this; 686 var th = this;
644 var user_id = getApp().globalData.user_id; 687 var user_id = getApp().globalData.user_id;
@@ -706,6 +749,17 @@ Page({ @@ -706,6 +749,17 @@ Page({
706 } 749 }
707 750
708 if (arr) { 751 if (arr) {
  752 +
  753 + //-- 看一下增品是不是已经在购物车列表中 --
  754 + for(var ig=0;ig<new_arr.length;ig++){
  755 + var f_coll=arr.find(function (em){
  756 + return em.goods_id==new_arr[ig].goods_id && em.is_collocation==1 && new_arr[ig].prom_id==em.prom_id
  757 + })
  758 + if(f_coll){
  759 + new_arr[ig].selected=1;
  760 + }
  761 + }
  762 +
709 arr[index].collocationList = new_arr; 763 arr[index].collocationList = new_arr;
710 } 764 }
711 else th.setData({ 765 else th.setData({
@@ -754,7 +808,8 @@ Page({ @@ -754,7 +808,8 @@ Page({
754 a.get("/api/weshop/cart/list", { 808 a.get("/api/weshop/cart/list", {
755 data: { 809 data: {
756 user_id: to.globalData.user_id, selected: 1, state: state, 810 user_id: to.globalData.user_id, selected: 1, state: state,
757 - store_id: oo.stoid, pageSize: 600 811 + store_id: oo.stoid, pageSize: 600,
  812 + isorder:1
758 }, 813 },
759 success: async function (su) { 814 success: async function (su) {
760 815
@@ -777,7 +832,7 @@ Page({ @@ -777,7 +832,7 @@ Page({
777 } 832 }
778 }) 833 })
779 834
780 - th.data.cartlist_y = carr; //存储原始购物车列表 835 + th.data.cartlist_y =JSON.parse(JSON.stringify(carr)); //存储原始购物车列表
781 836
782 wx.showLoading(); 837 wx.showLoading();
783 838
@@ -789,16 +844,23 @@ Page({ @@ -789,16 +844,23 @@ Page({
789 844
790 845
791 //-- is_change是有没有切换活动的意思 -- 846 //-- is_change是有没有切换活动的意思 --
792 - async get_cart_next(carr,is_change){ 847 + async get_cart_next(carr,is_change,old_prom){
793 848
794 //--- 切换的时候一定要把赠品去掉 --- 849 //--- 切换的时候一定要把赠品去掉 ---
795 if(is_change){ 850 if(is_change){
796 851
797 - carr=this.data.cartlist_y; 852 + carr=JSON.parse(JSON.stringify(this.data.cartlist_y));
798 //-- 剔除赠品的数据,等到确定活动是优惠促销的时候,在显示赠品, 赠品直接删除 -- 853 //-- 剔除赠品的数据,等到确定活动是优惠促销的时候,在显示赠品, 赠品直接删除 --
799 var new_arr=[]; 854 var new_arr=[];
800 for (var ir = 0; ir < carr.length; ir++) { 855 for (var ir = 0; ir < carr.length; ir++) {
801 - if(carr[ir].is_gift && carr[ir].id) { 856 +
  857 + var c_ok=1;
  858 + if(old_prom && (carr[ir].prom_type!=old_prom.prom_type || carr[ir].prom_id!=old_prom.prom_id) ){
  859 + c_ok=0;
  860 + }
  861 +
  862 + if(carr[ir].is_gift && carr[ir].id && c_ok) {
  863 +
802 var url = '/api/weshop/cart/del/' + oo.stoid + '/' + carr[ir].id; 864 var url = '/api/weshop/cart/del/' + oo.stoid + '/' + carr[ir].id;
803 getApp().request.delete(url, { 865 getApp().request.delete(url, {
804 success: function (t) {} 866 success: function (t) {}
@@ -808,6 +870,8 @@ Page({ @@ -808,6 +870,8 @@ Page({
808 } 870 }
809 new_arr.push(carr[ir]); 871 new_arr.push(carr[ir]);
810 } 872 }
  873 +
  874 + this.data.cartlist_y=JSON.parse(JSON.stringify(new_arr));
811 carr=new_arr; 875 carr=new_arr;
812 876
813 //-- map cy_cx属性要删除 -- 877 //-- map cy_cx属性要删除 --
@@ -852,7 +916,8 @@ Page({ @@ -852,7 +916,8 @@ Page({
852 user_id: getApp().globalData.user_id, 916 user_id: getApp().globalData.user_id,
853 goods_id: item1.goods_id, 917 goods_id: item1.goods_id,
854 prom_type: item1.prom_type, 918 prom_type: item1.prom_type,
855 - prom_id: item1.prom_id 919 + prom_id: item1.prom_id,
  920 + isnew:1
856 }, 921 },
857 }).then(res => { 922 }).then(res => {
858 var buy_num_data = res.data.data; 923 var buy_num_data = res.data.data;
@@ -869,7 +934,7 @@ Page({ @@ -869,7 +934,7 @@ Page({
869 item1.is_post_temp=1; 934 item1.is_post_temp=1;
870 935
871 //如果是秒杀,团购的时候 936 //如果是秒杀,团购的时候
872 - if([1,2,6].indexOf(item1.prom_type)>-1){ 937 + if([1,2,3,6].indexOf(item1.prom_type)>-1){
873 var url= "/api/weshop/activitylist/getSJGoodsPriceNew/" + os.stoid 938 var url= "/api/weshop/activitylist/getSJGoodsPriceNew/" + os.stoid
874 + "/" + item1.goods_id + "/"+item1.prom_type+"/" + item1.prom_id + "/" + app.globalData.user_id; 939 + "/" + item1.goods_id + "/"+item1.prom_type+"/" + item1.prom_id + "/" + app.globalData.user_id;
875 await app.request.promiseGet(url,{}).then(res=>{ 940 await app.request.promiseGet(url,{}).then(res=>{
@@ -1109,7 +1174,8 @@ Page({ @@ -1109,7 +1174,8 @@ Page({
1109 var c_item = arr[k]; 1174 var c_item = arr[k];
1110 if(!is_change){ 1175 if(!is_change){
1111 //-- 要进行归类一下活动 -- 1176 //-- 要进行归类一下活动 --
1112 - await m_cx.cart_cx_group(th,arr[k].goods,c_item,0,1,(show_can_cx)=>{ 1177 + await m_cx.cart_cx_group(th,arr[k].goods,c_item,0,0,(show_can_cx)=>{
  1178 +
1113 arr[k].show_can_cx=show_can_cx; 1179 arr[k].show_can_cx=show_can_cx;
1114 }) 1180 })
1115 }else{ 1181 }else{
@@ -1145,12 +1211,13 @@ Page({ @@ -1145,12 +1211,13 @@ Page({
1145 } 1211 }
1146 } 1212 }
1147 //-- 如果组合购的总数量不足的处理 -- 1213 //-- 如果组合购的总数量不足的处理 --
1148 - if(no_zh_num[item1.prom_id] && item1.prom_type == 7){  
1149 - item1.prom_type = 0;  
1150 - item1.prom_type1 = 0;  
1151 - item1.prom_id = 0;  
1152 - item1.prom_id1 = 0  
1153 - } 1214 + // if(no_zh_num[item1.prom_id] && item1.prom_type == 7){
  1215 + // item1.prom_type = 0;
  1216 + // item1.prom_type1 = 0;
  1217 + // item1.prom_id = 0;
  1218 + // item1.prom_id1 = 0
  1219 + // }
  1220 +
1154 //要把组合购的东西拿出来算一下,同时组合购的总数量要有存在 1221 //要把组合购的东西拿出来算一下,同时组合购的总数量要有存在
1155 if (item1.prom_type == 7) { 1222 if (item1.prom_type == 7) {
1156 if (!th.data.zuhe_map_good[item1.prom_id]) { 1223 if (!th.data.zuhe_map_good[item1.prom_id]) {
@@ -1175,10 +1242,10 @@ Page({ @@ -1175,10 +1242,10 @@ Page({
1175 store_count_ok = 0; 1242 store_count_ok = 0;
1176 no_zh_num[item1.prom_id]=1; 1243 no_zh_num[item1.prom_id]=1;
1177 //-- 清理一下活动的状态 -- 1244 //-- 清理一下活动的状态 --
1178 - item1.prom_type = 0;  
1179 - item1.prom_type1 = 0;  
1180 - item1.prom_id = 0;  
1181 - item1.prom_id1 = 0 1245 + // item1.prom_type = 0;
  1246 + // item1.prom_type1 = 0;
  1247 + // item1.prom_id = 0;
  1248 + // item1.prom_id1 = 0
1182 1249
1183 }else{ 1250 }else{
1184 th.data.zhhe_act_map[item1.prom_id] = res.data.data; 1251 th.data.zhhe_act_map[item1.prom_id] = res.data.data;
@@ -1953,6 +2020,11 @@ Page({ @@ -1953,6 +2020,11 @@ Page({
1953 async buy_pro_group(item1, is_state) { 2020 async buy_pro_group(item1, is_state) {
1954 //-- 代发商品不参与任何活动 -- 2021 //-- 代发商品不参与任何活动 --
1955 if (item1.whsle_id) return false; 2022 if (item1.whsle_id) return false;
  2023 + if (item1.is_gift) return false;
  2024 + if (item1.is_collocation) return false;
  2025 + if (item1.is_ld_split) return false; //是阶梯
  2026 + if (item1.is_zh_split) return false;
  2027 +
1956 //-- 购物车的秒杀和团购不计算 -- 2028 //-- 购物车的秒杀和团购不计算 --
1957 var p_type=parseInt(item1.prom_type); 2029 var p_type=parseInt(item1.prom_type);
1958 if([1,2].indexOf(p_type)>-1) return false; 2030 if([1,2].indexOf(p_type)>-1) return false;
@@ -2072,42 +2144,67 @@ Page({ @@ -2072,42 +2144,67 @@ Page({
2072 cart_add_gift(item_map,pickid,i,ord_goods,get_data){ 2144 cart_add_gift(item_map,pickid,i,ord_goods,get_data){
2073 2145
2074 var th=this; 2146 var th=this;
2075 - var pos=this.find_pro_last(ord_goods,3,item_map.prom_id);  
2076 var is_has_gift=this.is_has_gift(ord_goods,item_map.prom_id) 2147 var is_has_gift=this.is_has_gift(ord_goods,item_map.prom_id)
2077 - //-- 没有赠品的时候才添加,避免购物车重复出现 --  
2078 - if(pos>-1 && !is_has_gift){  
2079 2148
2080 - var newd = {  
2081 - goods_id: get_data.goods_id,  
2082 - goods_num: get_data.bs * get_data.zp_num, //是赠品的翻倍  
2083 - pick_id: pickid,  
2084 - user_id: app.globalData.user_id,  
2085 - store_id: os.stoid,  
2086 - goods_price: 0,  
2087 - member_goods_price: 0,  
2088 - goods_name: get_data.goods_name,  
2089 - goods_sn: get_data.goodsinfo.goods_sn,  
2090 - sku: get_data.goodsinfo.sku,  
2091 - is_gift: 1,  
2092 - prom_id: item_map.prom_id,  
2093 - prom_type: 3,  
2094 - selected: 1,  
2095 - gift_id: get_data.gift_id,  
2096 - original_img: th.data.imgUrl + get_data.goodsinfo.original_img  
2097 - };  
2098 - var fd_gd=ord_goods[pos]  
2099 -  
2100 - newd.guide_id=fd_gd.guide_id;  
2101 - newd.guide_type=fd_gd.guide_type;  
2102 - newd.distr_type=fd_gd.distr_type; 2149 + //-- 没有赠品的时候才添加,避免购物车重复出现 --
  2150 + if(!is_has_gift){
  2151 +
  2152 + //看一下要插入的位置
  2153 + var pos=this.find_pro_last(ord_goods,3,item_map.prom_id);
  2154 + var pos2=this.find_pro_last(th.data.old_cartlist[i].goods,3,item_map.prom_id);
  2155 +
  2156 + if(pos>-1){
  2157 + var newd = {
  2158 + goods_id: get_data.goods_id,
  2159 + goods_num: get_data.bs * get_data.zp_num, //是赠品的翻倍
  2160 + pick_id: pickid,
  2161 + user_id: app.globalData.user_id,
  2162 + store_id: os.stoid,
  2163 + goods_price: 0,
  2164 + member_goods_price: 0,
  2165 + goods_name: get_data.goods_name,
  2166 + goods_sn: get_data.goodsinfo.goods_sn,
  2167 + sku: get_data.goodsinfo.sku,
  2168 + is_gift: 1,
  2169 + prom_id: item_map.prom_id,
  2170 + prom_type: 3,
  2171 + selected: 1,
  2172 + gift_id: get_data.gift_id,
  2173 + original_img: th.data.imgUrl + get_data.goodsinfo.original_img
  2174 + };
  2175 + var fd_gd=ord_goods[pos]
2103 2176
2104 - ord_goods.splice(1,0,newd); 2177 + newd.guide_id=fd_gd.guide_id;
  2178 + newd.guide_type=fd_gd.guide_type;
  2179 + newd.distr_type=fd_gd.distr_type;
2105 2180
  2181 + ord_goods.splice(pos+1,0,newd);
  2182 + th.data.old_cartlist[i].goods.splice(pos2+1,0,newd);
  2183 + }
2106 2184
2107 } 2185 }
2108 2186
2109 }, 2187 },
2110 2188
  2189 + //-- 其他门店赠品的总和 --
  2190 + get_other_gift(c_arr,gift_id,pickid){
  2191 + var num=0;
  2192 + for (var i in c_arr) {
  2193 + var cart_item = c_arr[i]; //就是每一单的意思
  2194 + var pickid0 = cart_item.pickup_id;
  2195 + //相同门店不用统计
  2196 + if(pickid0==pickid) continue;
  2197 + var ord_goods = cart_item.goods; //就是每一单的从表的意思
  2198 + var fd=ord_goods.find(function (er){
  2199 + return er.is_gift && er.gift_id==gift_id
  2200 + })
  2201 + if(fd){
  2202 + num+=fd.goods_num;
  2203 + }
  2204 + }
  2205 + return num;
  2206 + },
  2207 +
2111 calc_per: async function (c_arr) { 2208 calc_per: async function (c_arr) {
2112 2209
2113 var send_gf = {}; 2210 var send_gf = {};
@@ -2124,7 +2221,6 @@ Page({ @@ -2124,7 +2221,6 @@ Page({
2124 var o_price = 0, q_conditin = 0; 2221 var o_price = 0, q_conditin = 0;
2125 //--------循环计算总价----------- 2222 //--------循环计算总价-----------
2126 for (var j = 0; j < ord_goods.length; j++) { 2223 for (var j = 0; j < ord_goods.length; j++) {
2127 -  
2128 if (ord_goods[j].whsle_id) continue; 2224 if (ord_goods[j].whsle_id) continue;
2129 o_price += ord_goods[j].goods_price * ord_goods[j].goods_num; 2225 o_price += ord_goods[j].goods_price * ord_goods[j].goods_num;
2130 } 2226 }
@@ -2159,11 +2255,20 @@ Page({ @@ -2159,11 +2255,20 @@ Page({
2159 item_map.s_coupon_num = get_data.coupon_num; 2255 item_map.s_coupon_num = get_data.coupon_num;
2160 item_map.lbtitle = get_data.lbtitle; 2256 item_map.lbtitle = get_data.lbtitle;
2161 item_map.zxlbtitle = get_data.zxlbtitle; 2257 item_map.zxlbtitle = get_data.zxlbtitle;
2162 - //每月礼包  
2163 - item_map.monthlbtitle = get_data.monthlbtitle; 2258 +
  2259 + var rule=JSON.parse(get_data.rule);
  2260 + if(rule.is_monthgiftbag && parseFloat(rule.is_monthgiftbag )>0){
  2261 + //每月礼包
  2262 + item_map.monthlbtitle = get_data.monthlbtitle;
  2263 + }
  2264 +
  2265 + //-- 其他门店赠品的总和 --
  2266 + var other_gift=0;
  2267 + other_gift=th.get_other_gift(c_arr,get_data.gift_id,pickid);
  2268 +
2164 //------end------- 2269 //------end-------
2165 if (get_data.gift_id && parseInt(get_data.zp_mode) != 1 2270 if (get_data.gift_id && parseInt(get_data.zp_mode) != 1
2166 - && get_data.zp_num * item_map.bs <= get_data.limit_num 2271 + && get_data.zp_num * item_map.bs <= get_data.limit_num-other_gift
2167 && get_data.zp_num * item_map.bs <= get_data.gift_storecount 2272 && get_data.zp_num * item_map.bs <= get_data.gift_storecount
2168 ) { 2273 ) {
2169 2274
@@ -2191,8 +2296,10 @@ Page({ @@ -2191,8 +2296,10 @@ Page({
2191 item_map.zx_libao = get_data.zxlibao; 2296 item_map.zx_libao = get_data.zxlibao;
2192 item_map.zx_lb_num = get_data.zxlb_num; 2297 item_map.zx_lb_num = get_data.zxlb_num;
2193 //每月礼包 2298 //每月礼包
2194 - item_map.monthlibao = get_data.monthlibao;  
2195 - item_map.monthlb_num = get_data.monthlb_num; 2299 + if(rule.is_monthgiftbag && parseFloat(rule.is_monthgiftbag )>0) {
  2300 + item_map.monthlibao = get_data.monthlibao;
  2301 + item_map.monthlb_num = get_data.monthlb_num;
  2302 + }
2196 //------end------- 2303 //------end-------
2197 2304
2198 if (parseInt(get_data.zp_mode) == 1) { 2305 if (parseInt(get_data.zp_mode) == 1) {
@@ -2836,12 +2943,7 @@ Page({ @@ -2836,12 +2943,7 @@ Page({
2836 }) 2943 })
2837 } 2944 }
2838 2945
2839 -  
2840 -  
2841 -  
2842 -  
2843 -  
2844 - 2946 +
2845 //-- 如果没有订单优惠,或者订单优惠中有勾选包邮模板 -- 2947 //-- 如果没有订单优惠,或者订单优惠中有勾选包邮模板 --
2846 if (!ord_prom || ord_prom.is_post_temp) { 2948 if (!ord_prom || ord_prom.is_post_temp) {
2847 var user_addr = th.data.user_addr; 2949 var user_addr = th.data.user_addr;
@@ -4716,6 +4818,8 @@ Page({ @@ -4716,6 +4818,8 @@ Page({
4716 'store_id': oo.stoid, 4818 'store_id': oo.stoid,
4717 }; 4819 };
4718 4820
  4821 +
  4822 +
4719 if (getApp().globalData.skinface_id) { 4823 if (getApp().globalData.skinface_id) {
4720 goods.skinface_id = getApp().globalData.skinface_id; 4824 goods.skinface_id = getApp().globalData.skinface_id;
4721 } 4825 }
@@ -4731,6 +4835,21 @@ Page({ @@ -4731,6 +4835,21 @@ Page({
4731 goods.quan_num = g_item.quan_num; 4835 goods.quan_num = g_item.quan_num;
4732 goods.quan_no = g_item.quan_no; 4836 goods.quan_no = g_item.quan_no;
4733 } 4837 }
  4838 +
  4839 + //如果活动一样,那么商品的活动就要清理成0
  4840 + var sh_can_cx=t_item.show_can_cx;
  4841 + if(sh_can_cx && !g_item.is_zh_split){
  4842 + for (let kh in sh_can_cx) {
  4843 + var cur=sh_can_cx[kh]?sh_can_cx[kh].cur_act:null;
  4844 + if(cur && cur.is_no_ok){
  4845 + //如果活动一样,那么商品的活动就要清理成0
  4846 + if(g_item.prom_type==cur.prom_type && g_item.prom_id==cur.prom_id){
  4847 + g_item.prom_type=0;
  4848 + }
  4849 + }
  4850 + }
  4851 + }
  4852 +
4734 //--判断活动的类型-- 4853 //--判断活动的类型--
4735 switch (g_item.prom_type) { 4854 switch (g_item.prom_type) {
4736 case 1: 4855 case 1:
@@ -4762,10 +4881,11 @@ Page({ @@ -4762,10 +4881,11 @@ Page({
4762 default: 4881 default:
4763 goods.prom_type = 0; 4882 goods.prom_type = 0;
4764 goods.prom_id = 0; 4883 goods.prom_id = 0;
  4884 +
4765 } 4885 }
4766 4886
4767 var txt = goods.prom_id + ',' + goods.prom_type + ',' + goods.goods_id + ',' + goods.is_gift; 4887 var txt = goods.prom_id + ',' + goods.prom_type + ',' + goods.goods_id + ',' + goods.is_gift;
4768 - //--赠品的时候,阶梯促销会右重复的情况 -- 4888 + //--赠品的时候,阶梯促销会右重复的情况,还有组合购的时候拆分出去的 --
4769 if (check_map[txt] && goods.prom_type != 10) { 4889 if (check_map[txt] && goods.prom_type != 10) {
4770 getApp().confirmBox(goods.goods_name + "计算金额错误,请重新刷新"); 4890 getApp().confirmBox(goods.goods_name + "计算金额错误,请重新刷新");
4771 return false; 4891 return false;
@@ -4881,7 +5001,6 @@ Page({ @@ -4881,7 +5001,6 @@ Page({
4881 zhlist.push(ite); 5001 zhlist.push(ite);
4882 5002
4883 } 5003 }
4884 -  
4885 item.zhlist=zhlist; 5004 item.zhlist=zhlist;
4886 } 5005 }
4887 5006
@@ -4984,7 +5103,7 @@ Page({ @@ -4984,7 +5103,7 @@ Page({
4984 // debugger 5103 // debugger
4985 var str = JSON.stringify(pdata); 5104 var str = JSON.stringify(pdata);
4986 console.log(str,'aaaaaaaaaaaaaaa'); 5105 console.log(str,'aaaaaaaaaaaaaaa');
4987 - // return false; 5106 + //return false;
4988 5107
4989 wx.showLoading({ title: "加载中" }); 5108 wx.showLoading({ title: "加载中" });
4990 th.setData({ submit: 1, }) 5109 th.setData({ submit: 1, })
@@ -5005,7 +5124,7 @@ Page({ @@ -5005,7 +5124,7 @@ Page({
5005 //如果是购物车结算,还要删除购物车 5124 //如果是购物车结算,还要删除购物车
5006 if (th.data.is_b_now == 0) { 5125 if (th.data.is_b_now == 0) {
5007 console.log(th.data.cartlist_y); 5126 console.log(th.data.cartlist_y);
5008 - var list = th.data.cartlist_y; 5127 + var list =JSON.parse(JSON.stringify(th.data.cartlist_y));
5009 for (var i = 0; i < list.length; i++) { 5128 for (var i = 0; i < list.length; i++) {
5010 //删除购物车 5129 //删除购物车
5011 a.delete("/api/weshop/cart/del/" + oo.stoid + "/" + list[i].id, {}); 5130 a.delete("/api/weshop/cart/del/" + oo.stoid + "/" + list[i].id, {});
@@ -7652,17 +7771,28 @@ Page({ @@ -7652,17 +7771,28 @@ Page({
7652 //--- 选择回来时候的选择 --- 7771 //--- 选择回来时候的选择 ---
7653 sure_cx_group:function(e){ 7772 sure_cx_group:function(e){
7654 var th=this; 7773 var th=this;
7655 - var sele_idx=e.detail.sele_idx; 7774 + //选中的活动类型
  7775 + var sele_prom_type=e.detail.sele_prom_type;
  7776 + //-- 获取到当前的show_can_cx--
7656 var idx=this.data.sele_cx_group_cidx; 7777 var idx=this.data.sele_cx_group_cidx;
7657 var gd_key= this.data.cx_group_gd_key; 7778 var gd_key= this.data.cx_group_gd_key;
7658 - //-- 获取到--  
7659 var cx_prom_group=this.data.cartlist[idx].show_can_cx[gd_key].act_arr; 7779 var cx_prom_group=this.data.cartlist[idx].show_can_cx[gd_key].act_arr;
7660 var pk=this.data.cartlist[idx].pickup_id; 7780 var pk=this.data.cartlist[idx].pickup_id;
7661 7781
  7782 + th.setData({
  7783 + send_lb:{},
  7784 + month_lb:{},
  7785 + send_gf:{}
  7786 + })
  7787 +
  7788 + th.data.prom_goods_map={};
  7789 +
  7790 + //-- 获取第一次选中的 --
7662 var fir_sele=0; 7791 var fir_sele=0;
7663 for(var dx=0;dx<cx_prom_group.length;dx++){ 7792 for(var dx=0;dx<cx_prom_group.length;dx++){
7664 if(cx_prom_group[dx].sele) fir_sele=dx; 7793 if(cx_prom_group[dx].sele) fir_sele=dx;
7665 - if(dx!=sele_idx) cx_prom_group[dx].sele=0; 7794 + //如果活动不是选择的
  7795 + if(cx_prom_group[dx].prom_type!=sele_prom_type) cx_prom_group[dx].sele=0;
7666 else cx_prom_group[dx].sele=1; 7796 else cx_prom_group[dx].sele=1;
7667 } 7797 }
7668 //选择后就要把活动确定下来 7798 //选择后就要把活动确定下来
@@ -7671,12 +7801,21 @@ Page({ @@ -7671,12 +7801,21 @@ Page({
7671 return el.sele; 7801 return el.sele;
7672 }) 7802 })
7673 7803
7674 -  
7675 this.cx_check_ok2(function (ck_res){ 7804 this.cx_check_ok2(function (ck_res){
7676 7805
7677 if(ck_res.code==0){ 7806 if(ck_res.code==0){
7678 th.data.cartlist[idx].show_can_cx[gd_key].sele_prom_type=ck_prom_type.prom_type; 7807 th.data.cartlist[idx].show_can_cx[gd_key].sele_prom_type=ck_prom_type.prom_type;
7679 - var goods= th.data.cartlist_y 7808 + th.data.cartlist[idx].show_can_cx[gd_key].cur_act=ck_prom_type;
  7809 +
  7810 +
  7811 + var goods0= JSON.parse(JSON.stringify(th.data.cartlist_y));
  7812 + var goods=[];
  7813 + for(var ik=0;ik<goods0.length;ik++){
  7814 + var item_c=goods0[ik];
  7815 + if(item_c.pick_id==pk && item_c.is_collocation) continue;
  7816 + goods.push(item_c);
  7817 + }
  7818 +
7680 //-- 此时要把购物车中的商品确定活动 -- 7819 //-- 此时要把购物车中的商品确定活动 --
7681 for (var b=0; b<ck_prom_type.goods.length;b++){ 7820 for (var b=0; b<ck_prom_type.goods.length;b++){
7682 //-- 开始查找 -- 7821 //-- 开始查找 --
@@ -7695,6 +7834,9 @@ Page({ @@ -7695,6 +7834,9 @@ Page({
7695 th.data.cartlist[idx].goods[ik].prom_id= goods[fg].prom_id; 7834 th.data.cartlist[idx].goods[ik].prom_id= goods[fg].prom_id;
7696 } 7835 }
7697 } 7836 }
  7837 +
  7838 + //原始数据要有深拷贝不能有地址的牵连
  7839 + th.data.cartlist_y=JSON.parse(JSON.stringify(goods))
7698 } 7840 }
7699 } 7841 }
7700 7842
@@ -7703,7 +7845,7 @@ Page({ @@ -7703,7 +7845,7 @@ Page({
7703 mask: true 7845 mask: true
7704 }) 7846 })
7705 //-- 重新计算一下价格 -- 7847 //-- 重新计算一下价格 --
7706 - th.get_cart_next(null,1); 7848 + th.get_cart_next(null,1,cx_prom_group[fir_sele]);
7707 }else{ 7849 }else{
7708 wx.showToast({ 7850 wx.showToast({
7709 title: ck_res.msg, 7851 title: ck_res.msg,
@@ -7791,6 +7933,12 @@ Page({ @@ -7791,6 +7933,12 @@ Page({
7791 func({'code': -1, 'msg': '超出组合购活动总数量'}); 7933 func({'code': -1, 'msg': '超出组合购活动总数量'});
7792 return false; 7934 return false;
7793 } 7935 }
  7936 +
  7937 + if (zh && zh['buy_limit'] > 0 && num0+buyed > zh['buy_limit']) {
  7938 + func({'code': -1, 'msg': '超出超出组合购活动的限购'});
  7939 + return false;
  7940 + }
  7941 +
7794 } 7942 }
7795 } 7943 }
7796 7944
@@ -7807,7 +7955,7 @@ Page({ @@ -7807,7 +7955,7 @@ Page({
7807 var promgoodsbuynum = 0; 7955 var promgoodsbuynum = 0;
7808 var rq = { 7956 var rq = {
7809 'store_id': os.stoid, 'user_id': getApp().globalData.user_id, 'goods_id': gid, 7957 'store_id': os.stoid, 'user_id': getApp().globalData.user_id, 'goods_id': gid,
7810 - 'prom_type': 7, 'prom_id': pid 7958 + 'prom_type': 7, 'prom_id': pid, isnew:1
7811 }; 7959 };
7812 7960
7813 var res = await getApp().request.promiseGet("/api/weshop/ordergoods/getUserBuyGoodsNum", {data: rq}); 7961 var res = await getApp().request.promiseGet("/api/weshop/ordergoods/getUserBuyGoodsNum", {data: rq});
packageE/pages/cart/cart2/cart2.wxml
@@ -114,11 +114,13 @@ @@ -114,11 +114,13 @@
114 </view> 114 </view>
115 </navigator> 115 </navigator>
116 </view> 116 </view>
117 - <!-- 验证活动是不是多个,要不要显示切换 -->  
118 - <!-- 新增促销多活动的排版 -->  
119 117
  118 +
  119 + <!-- 验证活动是不是多个,要不要显示切换 -->
  120 + <!-- 新增促销多活动的排版,单商品的时候 -->
120 <block wx:if="{{(util.is_more_act(items,item.show_can_cx) && item.show_can_cx[items.goods_id] && item.show_can_cx[items.goods_id].act_arr.length>1)}}"> 121 <block wx:if="{{(util.is_more_act(items,item.show_can_cx) && item.show_can_cx[items.goods_id] && item.show_can_cx[items.goods_id].act_arr.length>1)}}">
121 - <view class="bdb16" wx:if="{{util.check_show(items,item.show_can_cx[items.goods_id].sele_prom_type)}}"> 122 + <view class="bdb16" wx:if="{{util.check_show(items,item.show_can_cx[items.goods_id].cur_act.prom_type)}}">
  123 +
122 <view bindtap="switch_cx_group" 124 <view bindtap="switch_cx_group"
123 data-index="{{pidx}}" 125 data-index="{{pidx}}"
124 data-gd_key="{{items.goods_id}}" 126 data-gd_key="{{items.goods_id}}"
@@ -126,10 +128,10 @@ @@ -126,10 +128,10 @@
126 <view class="cx-sizs fs30">促销</view> 128 <view class="cx-sizs fs30">促销</view>
127 <view class="flex ai_c f1 pdh20"> 129 <view class="flex ai_c f1 pdh20">
128 <view class="xc-coupon-fram" wx:for="{{item.show_can_cx[items.goods_id].act_arr}}" > 130 <view class="xc-coupon-fram" wx:for="{{item.show_can_cx[items.goods_id].act_arr}}" >
129 - <view wx:if="{{item.prom_type==3}}" class="xc-coupon t-c four-level-word">优惠促销</view>  
130 - <view wx:if="{{item.prom_type==5}}" class="xc-coupon t-c four-level-word">搭配促销</view>  
131 - <view wx:if="{{item.prom_type==7}}" class="xc-coupon t-c four-level-word">组合购</view>  
132 - <view wx:if="{{item.prom_type==10}}" class="xc-coupon t-c four-level-word">阶梯促销</view> 131 + <view wx:if="{{item.prom_type==3}}" class="xc-coupon t-c four-level-word {{!item.sele?'gray':'' }} ">优惠促销</view>
  132 + <view wx:if="{{item.prom_type==5}}" class="xc-coupon t-c four-level-word {{!item.sele?'gray':'' }} ">搭配促销</view>
  133 + <view wx:if="{{item.prom_type==7}}" class="xc-coupon t-c four-level-word {{!item.sele?'gray':'' }} ">组合购</view>
  134 + <view wx:if="{{item.prom_type==10}}" class="xc-coupon t-c four-level-word {{!item.sele?'gray':'' }} ">阶梯促销</view>
133 </view> 135 </view>
134 </view> 136 </view>
135 <view class="cx-obtain-coupon wsize"> 137 <view class="cx-obtain-coupon wsize">
@@ -139,34 +141,89 @@ @@ -139,34 +141,89 @@
139 </view> 141 </view>
140 </block> 142 </block>
141 143
  144 + <!--此时是多个商品参与活动的切换 验证活动是不是多个,要不要显示切换,同时要最后一个商品显示 -->
  145 + <!-- 新增促销多活动的排版,多商品的时候 -->
  146 + <block wx:if="{{item.show_can_cx}}">
  147 + <block wx:for="{{item.show_can_cx}}" wx:for-item="pitem">
  148 +
  149 + <block wx:if="{{ pitem.sele_prom_type==7 || pitem.sele_prom_type==10 }}">
  150 +
  151 +
  152 + <view class="bdb16" wx:if="{{pitem.is_duo_gd && pitem.act_arr.length>1 && items.is_act_last}}" >
  153 +
  154 + <view bindtap="switch_cx_group"
  155 + data-index="{{pidx}}"
  156 + data-gd_key="{{index}}"
  157 + class="cx-frame flex" style="position: relative">
  158 + <view class="cx-sizs fs30">促销</view>
  159 + <view class="flex ai_c f1 pdh20">
  160 + <view class="xc-coupon-fram" wx:for="{{pitem.act_arr}}" >
  161 + <view wx:if="{{item.prom_type==3}}" class="xc-coupon t-c four-level-word {{!item.sele?'gray':'' }} ">优惠促销</view>
  162 + <view wx:if="{{item.prom_type==5}}" class="xc-coupon t-c four-level-word {{!item.sele?'gray':'' }} ">搭配促销</view>
  163 + <view wx:if="{{item.prom_type==7}}" class="xc-coupon t-c four-level-word {{!item.sele?'gray':'' }} ">组合购</view>
  164 + <view wx:if="{{item.prom_type==10}}" class="xc-coupon t-c four-level-word {{!item.sele?'gray':'' }} ">阶梯促销</view>
  165 + </view>
  166 + </view>
  167 + <view class="cx-obtain-coupon wsize">
  168 + <text class="bg_jj"></text>
  169 + </view>
  170 + </view>
  171 + </view>
  172 + </block>
  173 + <block wx:else>
  174 + <view class="bdb16" wx:if="{{pitem.is_duo_gd && pitem.act_arr.length>1 && util.check_is_last(index,items.goods_id,items.is_act_last) }}" >
  175 + <view bindtap="switch_cx_group"
  176 + data-index="{{pidx}}"
  177 + data-gd_key="{{index}}"
  178 + class="cx-frame flex" style="position: relative">
  179 + <view class="cx-sizs fs30">促销</view>
  180 + <view class="flex ai_c f1 pdh20">
  181 + <view class="xc-coupon-fram" wx:for="{{pitem.act_arr}}" >
  182 + <view wx:if="{{item.prom_type==3}}" class="xc-coupon t-c four-level-word {{!item.sele?'gray':'' }} ">优惠促销</view>
  183 + <view wx:if="{{item.prom_type==5}}" class="xc-coupon t-c four-level-word {{!item.sele?'gray':'' }} ">搭配促销</view>
  184 + <view wx:if="{{item.prom_type==7}}" class="xc-coupon t-c four-level-word {{!item.sele?'gray':'' }} ">组合购</view>
  185 + <view wx:if="{{item.prom_type==10}}" class="xc-coupon t-c four-level-word {{!item.sele?'gray':'' }} ">阶梯促销</view>
  186 + </view>
  187 + </view>
  188 + <view class="cx-obtain-coupon wsize">
  189 + <text class="bg_jj"></text>
  190 + </view>
  191 + </view>
  192 + </view>
  193 + </block>
  194 +
  195 + </block>
  196 + </block>
142 197
143 </block> 198 </block>
144 199
145 <!--此时是多个商品参与活动的切换 验证活动是不是多个,要不要显示切换 --> 200 <!--此时是多个商品参与活动的切换 验证活动是不是多个,要不要显示切换 -->
146 <!-- 新增促销多活动的排版 --> 201 <!-- 新增促销多活动的排版 -->
147 - <block wx:if="{{item.show_can_cx}}">  
148 - <block wx:for="{{item.show_can_cx}}" wx:for-item="pitem">  
149 - <view class="bdb16" wx:if="{{pitem.is_duo_gd && pitem.act_arr.length>1}}" >  
150 - <view bindtap="switch_cx_group"  
151 - data-index="{{pidx}}"  
152 - data-gd_key="{{index}}"  
153 - class="cx-frame flex" style="position: relative">  
154 - <view class="cx-sizs fs30">促销</view>  
155 - <view class="flex ai_c f1 pdh20">  
156 - <view class="xc-coupon-fram" wx:for="{{pitem.act_arr}}" >  
157 - <view wx:if="{{item.prom_type==3}}" class="xc-coupon t-c four-level-word">优惠促销</view>  
158 - <view wx:if="{{item.prom_type==5}}" class="xc-coupon t-c four-level-word">搭配促销</view>  
159 - <view wx:if="{{item.prom_type==7}}" class="xc-coupon t-c four-level-word">组合购</view>  
160 - <view wx:if="{{item.prom_type==10}}" class="xc-coupon t-c four-level-word">阶梯促销</view>  
161 - </view>  
162 - </view>  
163 - <view class="cx-obtain-coupon wsize">  
164 - <text class="bg_jj"></text>  
165 - </view>  
166 - </view>  
167 - </view>  
168 - </block>  
169 - </block> 202 +<!-- <block wx:if="{{item.show_can_cx}}">-->
  203 +<!-- <block wx:for="{{item.show_can_cx}}" wx:for-item="pitem">-->
  204 +<!-- <view class="bdb16" wx:if="{{pitem.is_duo_gd && pitem.act_arr.length>1}}" >-->
  205 +<!-- <view bindtap="switch_cx_group"-->
  206 +<!-- data-index="{{pidx}}"-->
  207 +<!-- data-gd_key="{{index}}"-->
  208 +<!-- class="cx-frame flex" style="position: relative">-->
  209 +<!-- <view class="cx-sizs fs30">促销</view>-->
  210 +<!-- <view class="flex ai_c f1 pdh20">-->
  211 +<!-- <view class="xc-coupon-fram" wx:for="{{pitem.act_arr}}" >-->
  212 +<!-- <view wx:if="{{item.prom_type==3}}" class="xc-coupon t-c four-level-word {{!item.sele?'gray':'' }} ">优惠促销</view>-->
  213 +<!-- <view wx:if="{{item.prom_type==5}}" class="xc-coupon t-c four-level-word {{!item.sele?'gray':'' }} ">搭配促销</view>-->
  214 +<!-- <view wx:if="{{item.prom_type==7}}" class="xc-coupon t-c four-level-word {{!item.sele?'gray':'' }} ">组合购</view>-->
  215 +<!-- <view wx:if="{{item.prom_type==10}}" class="xc-coupon t-c four-level-word {{!item.sele?'gray':'' }} ">阶梯促销</view>-->
  216 +<!-- </view>-->
  217 +<!-- </view>-->
  218 +<!-- <view class="cx-obtain-coupon wsize">-->
  219 +<!-- <text class="bg_jj"></text>-->
  220 +<!-- </view>-->
  221 +<!-- </view>-->
  222 +<!-- </view>-->
  223 +<!-- </block>-->
  224 +<!-- </block>-->
  225 +
  226 +
170 227
171 <!-- 使用搭配 --> 228 <!-- 使用搭配 -->
172 <cart_collect_temp id="col{{pidx}}" 229 <cart_collect_temp id="col{{pidx}}"
@@ -327,12 +384,16 @@ @@ -327,12 +384,16 @@
327 </view> 384 </view>
328 385
329 <!-- 保障服务 --> 386 <!-- 保障服务 -->
330 - <view class="bz_view flex bdt16" wx:if="{{bconfig.service_bz}}">  
331 - <image class="bzfu_img" src="{{imgUrl}}/miniapp/images/bzfu_w.png"></image>  
332 - <view class="flex f1 rel" style="position: relative;" bindtap="{{showFold ? 'clickCollapse':''}}">  
333 - <view class="bz-content showArea {{flag ? '':'ellipsis-1x'}}">{{bconfig.service_bz}}</view> 387 + <view class="bz_view22 flex bdt16 ai_c" wx:if="{{bconfig.service_bz}}">
  388 + <image class="bzfu_img22" src="{{imgUrl}}/miniapp/images/bzfu_w.png"></image>
  389 + <view class="flex f1 ai_c rel22" style="position: relative;" bindtap="{{showFold ? 'clickCollapse':''}}">
  390 + <view class="bz-content22 showArea22 {{flag ? '':'ellipsis-1x'}}">{{bconfig.service_bz}}</view>
  391 + <view class="bz-content22 hideArea22">{{bconfig.service_bz}}</view>
  392 + <view class="cx-obtain-coupon22 wsize22 arrow22" wx:if="{{showFold}}">
  393 + <text class="bg_jj22 down22 {{flag ? 'up22':''}}"></text>
  394 + </view>
334 </view> 395 </view>
335 - </view> 396 + </view>
336 397
337 398
338 399
@@ -588,12 +649,16 @@ @@ -588,12 +649,16 @@
588 </view> 649 </view>
589 650
590 <!-- 保障服务 --> 651 <!-- 保障服务 -->
591 - <view class="bz_view flex bdt16" wx:if="{{bconfig.service_bz}}">  
592 - <image class="bzfu_img" src="{{imgUrl}}/miniapp/images/bzfu_w.png"></image>  
593 - <view class="flex f1 rel" style="position: relative;" bindtap="{{showFold ? 'clickCollapse':''}}">  
594 - <view class="bz-content showArea {{flag ? '':'ellipsis-1x'}}">{{bconfig.service_bz}}</view> 652 + <view class="bz_view22 flex bdt16 ai_c" wx:if="{{bconfig.service_bz}}">
  653 + <image class="bzfu_img22" src="{{imgUrl}}/miniapp/images/bzfu_w.png"></image>
  654 + <view class="flex f1 ai_c rel22" style="position: relative;" bindtap="{{showFold ? 'clickCollapse':''}}">
  655 + <view class="bz-content22 showArea22 {{flag ? '':'ellipsis-1x'}}">{{bconfig.service_bz}}</view>
  656 + <view class="bz-content22 hideArea22">{{bconfig.service_bz}}</view>
  657 + <view class="cx-obtain-coupon22 wsize22 arrow22" wx:if="{{showFold}}">
  658 + <text class="bg_jj22 down22 {{flag ? 'up22':''}}"></text>
  659 + </view>
595 </view> 660 </view>
596 - </view> 661 + </view>
597 662
598 <!-- 留言 --> 663 <!-- 留言 -->
599 <view class="coupon-mes flex-vertical"> 664 <view class="coupon-mes flex-vertical">
packageE/pages/cart/cart2/cart2.wxss
@@ -1180,6 +1180,9 @@ margin-left: 20rpx; @@ -1180,6 +1180,9 @@ margin-left: 20rpx;
1180 padding: 6rpx 16rpx; 1180 padding: 6rpx 16rpx;
1181 1181
1182 } 1182 }
  1183 +.xc-coupon-fram .xc-coupon.gray{
  1184 + background-color: #bbb;
  1185 +}
1183 1186
1184 .xc-coupon-fram .xc-circular { 1187 .xc-coupon-fram .xc-circular {
1185 width: 16rpx; 1188 width: 16rpx;
packageE/pages/cart/cart2/filter.wxs
@@ -16,13 +16,43 @@ function is_more_act(items,show_can_cx){ @@ -16,13 +16,43 @@ function is_more_act(items,show_can_cx){
16 16
17 function check_show(items,sele_prom_type){ 17 function check_show(items,sele_prom_type){
18 if([7,10].indexOf(sele_prom_type)>-1){ 18 if([7,10].indexOf(sele_prom_type)>-1){
19 - if(!items.is_act_last) return false; 19 + if(items.is_act_last==0) return false;
20 } 20 }
21 return true; 21 return true;
22 } 22 }
23 23
  24 +
  25 +//goods_id 商品的id
  26 +//index多活动的索引
  27 +//is_act_last 是不是最后一个
  28 +
  29 +function check_is_last(index,goods_id,is_act_last){
  30 + var gd_arr=index.split(',');
  31 + var idx=-1;
  32 + //-- 判断有没有包含商品 --
  33 + for(var i=0;i<gd_arr.length;i++){
  34 + var ch=gd_arr[i];
  35 + if(parseFloat(ch)==parseFloat(goods_id)){
  36 + idx=i;
  37 + break
  38 + }
  39 + }
  40 + if(idx<0){
  41 + return false;
  42 + }
  43 + //-- 判断是不是活动的最后一个商品 --
  44 + if(idx==gd_arr.length-1){
  45 + return true;
  46 + }
  47 + return false;
  48 +
  49 +}
  50 +
  51 +
  52 +
24 module.exports = { 53 module.exports = {
25 format: format, 54 format: format,
26 is_more_act:is_more_act, 55 is_more_act:is_more_act,
27 - check_show:check_show 56 + check_show:check_show,
  57 + check_is_last:check_is_last
28 } 58 }
packageE/pages/cart/cart2/ladder_calculate.js
@@ -115,6 +115,7 @@ module.exports = { @@ -115,6 +115,7 @@ module.exports = {
115 new_g.goods_num = num; 115 new_g.goods_num = num;
116 new_g.prom_type = 0; 116 new_g.prom_type = 0;
117 new_g.prom_id = 0; 117 new_g.prom_id = 0;
  118 + new_g.is_ld_split=1;
118 goods.push(new_g); 119 goods.push(new_g);
119 //goods.splice(idx, 1); 120 //goods.splice(idx, 1);
120 } 121 }
packageE/pages/cart/cart2/zh_calculate.js
@@ -253,6 +253,10 @@ module.exports = { @@ -253,6 +253,10 @@ module.exports = {
253 } 253 }
254 } 254 }
255 255
  256 +
  257 +
  258 + //-- 暂存的数组 --
  259 + var temp_arr=[];
256 if (Object.keys(goods_map).length) { 260 if (Object.keys(goods_map).length) {
257 //这里就开始拆分提交订单时的列表 261 //这里就开始拆分提交订单时的列表
258 for (let j in goods_map) { 262 for (let j in goods_map) {
@@ -264,11 +268,14 @@ module.exports = { @@ -264,11 +268,14 @@ module.exports = {
264 }) 268 })
265 goods[idx].goods_num -= num; 269 goods[idx].goods_num -= num;
266 let new_g = JSON.parse(JSON.stringify(goods[idx])); 270 let new_g = JSON.parse(JSON.stringify(goods[idx]));
  271 +
  272 + if(new_g.more_cx) delete new_g.more_cx;
267 new_g.goods_num = num; 273 new_g.goods_num = num;
268 new_g.prom_type = 0; 274 new_g.prom_type = 0;
269 new_g.prom_id = 0; 275 new_g.prom_id = 0;
270 - goods.push(new_g);  
271 - 276 + new_g.is_zh_split = 1; //-- 是组合购拆分出去的 --
  277 + //暂时存储一下
  278 + temp_arr.push(new_g);
272 //如果商品的数量已经为空了 279 //如果商品的数量已经为空了
273 if (goods[idx].goods_num <= 0) { 280 if (goods[idx].goods_num <= 0) {
274 goods.splice(idx, 1); 281 goods.splice(idx, 1);
@@ -276,18 +283,26 @@ module.exports = { @@ -276,18 +283,26 @@ module.exports = {
276 } 283 }
277 } 284 }
278 285
279 - 286 + var ls=-1;
280 //-- 只统计是参与活动的商品 -- 287 //-- 只统计是参与活动的商品 --
281 for (var ij in goods) { 288 for (var ij in goods) {
282 - goods[ij].is_act_last=0;  
283 var iter = goods[ij]; 289 var iter = goods[ij];
284 if (iter.prom_type != 7 || iter.prom_id != act.id) { 290 if (iter.prom_type != 7 || iter.prom_id != act.id) {
285 continue; 291 continue;
286 } 292 }
  293 + goods[ij].is_act_last=0;
287 all_price0 += iter.goods_num * iter.goods_price; 294 all_price0 += iter.goods_num * iter.goods_price;
  295 + ls= parseInt(ij);
288 } 296 }
289 -  
290 - goods[goods.length-1].is_act_last=1; 297 + //-- 要在特定的位置插入商品 --
  298 + if(temp_arr){
  299 + for(var gh=0;gh<temp_arr.length;gh++){
  300 + var idx=gh+ls+1;
  301 + goods.splice(idx, 0,temp_arr[gh]);
  302 + }
  303 + ls+=temp_arr.length;
  304 + }
  305 + goods[ls].is_act_last=1;
291 306
292 //-- 活动的条件已经满足 -- 307 //-- 活动的条件已经满足 --
293 c_item.zh_prom_goods[act.id].is_has_zh = 1; 308 c_item.zh_prom_goods[act.id].is_has_zh = 1;
@@ -305,6 +320,9 @@ module.exports = { @@ -305,6 +320,9 @@ module.exports = {
305 320
306 321
307 } else { 322 } else {
  323 +
  324 + goods[goods.length-1].is_act_last=1;
  325 +
308 for (let ii in goods) { 326 for (let ii in goods) {
309 let item = goods[ii]; 327 let item = goods[ii];
310 if (item.prom_type != 7) continue; 328 if (item.prom_type != 7) continue;
packageE/pages/cart/cart2_inte/cart2_inte.js
@@ -83,7 +83,31 @@ Page({ @@ -83,7 +83,31 @@ Page({
83 is_pre_cut:0, //是否可以使用预存 0是不可以1的可以 83 is_pre_cut:0, //是否可以使用预存 0是不可以1的可以
84 84
85 same_ok:1, //同城配送的控制,默认ok 85 same_ok:1, //同城配送的控制,默认ok
86 - bconfig:null 86 + bconfig:null,
  87 + showFold:true,
  88 + },
  89 +
  90 +
  91 +
  92 + onReady() {
  93 +
  94 + setTimeout(() => {
  95 + wx.createSelectorQuery().selectAll(".showArea, .hideArea").boundingClientRect(res => {
  96 + if (res.length != 0) {
  97 + this.setData({
  98 + showFold: res[0].height < res[1].height,
  99 + });
  100 + };
  101 +
  102 + }).exec();
  103 + }, 1000);
  104 +
  105 + },
  106 +
  107 + clickCollapse() {
  108 + this.setData({
  109 + flag: !this.data.flag,
  110 + })
87 }, 111 },
88 onLoad: function (t) { 112 onLoad: function (t) {
89 wx.setNavigationBarTitle({ title: "填写订单", }) 113 wx.setNavigationBarTitle({ title: "填写订单", })
packageE/pages/cart/cart2_inte/cart2_inte.wxml
@@ -125,12 +125,16 @@ @@ -125,12 +125,16 @@
125 </view> 125 </view>
126 126
127 <!-- 保障服务 --> 127 <!-- 保障服务 -->
128 - <view class="bz_view flex bdt16" wx:if="{{bconfig.service_bz}}">  
129 - <image class="bzfu_img" src="{{imgUrl}}/miniapp/images/bzfu_w.png"></image>  
130 - <view class="flex f1 rel" style="position: relative;" bindtap="{{showFold ? 'clickCollapse':''}}">  
131 - <view class="bz-content showArea {{flag ? '':'ellipsis-1x'}}">{{bconfig.service_bz}}</view> 128 + <view class="bz_view22 flex bdt16 ai_c" wx:if="{{bconfig.service_bz}}">
  129 + <image class="bzfu_img22" src="{{imgUrl}}/miniapp/images/bzfu_w.png"></image>
  130 + <view class="flex f1 ai_c rel22" style="position: relative;" bindtap="{{showFold ? 'clickCollapse':''}}">
  131 + <view class="bz-content22 showArea22 {{flag ? '':'ellipsis-1x'}}">{{bconfig.service_bz}}</view>
  132 + <view class="bz-content22 hideArea22">{{bconfig.service_bz}}</view>
  133 + <view class="cx-obtain-coupon22 wsize22 arrow22" wx:if="{{showFold}}">
  134 + <text class="bg_jj22 down22 {{flag ? 'up22':''}}"></text>
  135 + </view>
132 </view> 136 </view>
133 - </view> 137 + </view>
134 138
135 <view class="coupon-mes flex-vertical"> 139 <view class="coupon-mes flex-vertical">
136 <view>留言</view> 140 <view>留言</view>
packageE/pages/user/monthgiftbag/giftpackbuy/giftpackbuy.js
@@ -492,7 +492,7 @@ Page({ @@ -492,7 +492,7 @@ Page({
492 } 492 }
493 pagePath += "?first_leader=" + this.data.getUserID; 493 pagePath += "?first_leader=" + this.data.getUserID;
494 return { 494 return {
495 - title: "专享礼包", 495 + title: "每月礼包",
496 path: pagePath, 496 path: pagePath,
497 } 497 }
498 }, 498 },
@@ -505,7 +505,7 @@ Page({ @@ -505,7 +505,7 @@ Page({
505 if(!user_id) user_id=0; 505 if(!user_id) user_id=0;
506 506
507 return { 507 return {
508 - title: '专享礼包', 508 + title: '每月礼包',
509 imageUrl: this.data.ad_data.ad_code, 509 imageUrl: this.data.ad_data.ad_code,
510 query: 'first_leader='+user_id 510 query: 'first_leader='+user_id
511 } 511 }
packageE/pages/user/monthgiftbag/monthgiftbag.js
@@ -203,7 +203,7 @@ Page({ @@ -203,7 +203,7 @@ Page({
203 } 203 }
204 pagePath += "?first_leader=" + this.data.getUserID; 204 pagePath += "?first_leader=" + this.data.getUserID;
205 return { 205 return {
206 - title: "专享礼包", 206 + title: "每月礼包",
207 path: pagePath, 207 path: pagePath,
208 } 208 }
209 }, 209 },
@@ -211,7 +211,7 @@ Page({ @@ -211,7 +211,7 @@ Page({
211 onShareTimeline() { 211 onShareTimeline() {
212 getApp().globalData.no_clear=1; 212 getApp().globalData.no_clear=1;
213 return { 213 return {
214 - title: '专享礼包', 214 + title: '每月礼包',
215 imageUrl: this.data.ad_data.ad_code, 215 imageUrl: this.data.ad_data.ad_code,
216 query: "first_leader=" + this.data.getUserID 216 query: "first_leader=" + this.data.getUserID
217 } 217 }
pages/cart/cart/cart.js
@@ -67,6 +67,7 @@ Page({ @@ -67,6 +67,7 @@ Page({
67 async buy_pro_group(item1, is_state) { 67 async buy_pro_group(item1, is_state) {
68 //-- 代发商品不参与任何活动 -- 68 //-- 代发商品不参与任何活动 --
69 if (item1.whsle_id) return false; 69 if (item1.whsle_id) return false;
  70 + if (item1.is_gift) return false;
70 71
71 var th = this; 72 var th = this;
72 var req_d = { 73 var req_d = {
@@ -1151,7 +1152,7 @@ Page({ @@ -1151,7 +1152,7 @@ Page({
1151 var th = this; 1152 var th = this;
1152 1153
1153 if (a = isNaN(t.detail.value) || t.detail.value < 1 ? 1 : parseInt(t.detail.value)) { 1154 if (a = isNaN(t.detail.value) || t.detail.value < 1 ? 1 : parseInt(t.detail.value)) {
1154 - this.clear_req(); 1155 + //this.clear_req();
1155 1156
1156 var s = { 1157 var s = {
1157 goods_num: a, 1158 goods_num: a,
@@ -1163,7 +1164,9 @@ Page({ @@ -1163,7 +1164,9 @@ Page({
1163 } 1164 }
1164 }, 1165 },
1165 1166
1166 - //-------------加数量--------------------- 1167 + //-------------加减数量的时候,要把show_can_cx清理掉,
  1168 + // 同时应该记录一下当前是什么活动那个,如果切换后的活动有跟切换前的活动一样是,就要让切换后的活动的值匹配选中-------------
  1169 +
1167 clear_req: function () { 1170 clear_req: function () {
1168 var carr = this.data.requestData; 1171 var carr = this.data.requestData;
1169 for (var i = 0; i < carr.length; i++) { 1172 for (var i = 0; i < carr.length; i++) {
@@ -1215,7 +1218,7 @@ Page({ @@ -1215,7 +1218,7 @@ Page({
1215 } 1218 }
1216 } 1219 }
1217 1220
1218 - this.clear_req(); 1221 + //this.clear_req();
1219 1222
1220 var e = { 1223 var e = {
1221 goods_num: a.goods_num + add_num, 1224 goods_num: a.goods_num + add_num,
@@ -1244,7 +1247,7 @@ Page({ @@ -1244,7 +1247,7 @@ Page({
1244 } 1247 }
1245 1248
1246 if (1 != a.goods_num) { 1249 if (1 != a.goods_num) {
1247 - this.clear_req(); 1250 + //this.clear_req();
1248 var add_num = 1; 1251 var add_num = 1;
1249 if ([0, 3, 5, 7, 10].indexOf(a.prom_type) > -1) { 1252 if ([0, 3, 5, 7, 10].indexOf(a.prom_type) > -1) {
1250 var cx_arr = await getApp().get_has_cx_act(a.goods_id); 1253 var cx_arr = await getApp().get_has_cx_act(a.goods_id);
@@ -1437,7 +1440,6 @@ Page({ @@ -1437,7 +1440,6 @@ Page({
1437 [txt0]: {}, 1440 [txt0]: {},
1438 }); 1441 });
1439 1442
1440 -  
1441 if (e.data.checkAllToggle) { 1443 if (e.data.checkAllToggle) {
1442 var txt = "requestData[" + i + "].selected"; 1444 var txt = "requestData[" + i + "].selected";
1443 e.setData({ 1445 e.setData({
@@ -1678,6 +1680,12 @@ Page({ @@ -1678,6 +1680,12 @@ Page({
1678 fir = 0, 1680 fir = 0,
1679 iarr = item; 1681 iarr = item;
1680 1682
  1683 + //清空-- 多个促销的切换 --
  1684 + var txt0 = "requestData[" + pitems + "].show_can_cx";
  1685 + e.setData({
  1686 + [txt0]: {},
  1687 + });
  1688 +
1681 if (!sele) { 1689 if (!sele) {
1682 var check_is_service_selected = 0; 1690 var check_is_service_selected = 0;
1683 for (var ii in garr) { 1691 for (var ii in garr) {
@@ -1809,11 +1817,15 @@ Page({ @@ -1809,11 +1817,15 @@ Page({
1809 sele_arr[i] = !sele; 1817 sele_arr[i] = !sele;
1810 } 1818 }
1811 1819
  1820 + th.data.pitems=-1;
  1821 + if (!sele) {
  1822 + th.data.pitems=pitems;
  1823 + }
  1824 +
  1825 +
1812 //-- 回调判断活动有没有冲突 -- 1826 //-- 回调判断活动有没有冲突 --
1813 this.cx_check_ok(pitems, sele_arr, function (the_res) { 1827 this.cx_check_ok(pitems, sele_arr, function (the_res) {
1814 if (the_res.code == 0) { 1828 if (the_res.code == 0) {
1815 -  
1816 -  
1817 //-- 门店是所有的商品都要选择 -- 1829 //-- 门店是所有的商品都要选择 --
1818 for (var i = 0; i < item.length; i++) { 1830 for (var i = 0; i < item.length; i++) {
1819 var txt0 = "requestData[" + pitems + "].goods[" + i + "].selected"; 1831 var txt0 = "requestData[" + pitems + "].goods[" + i + "].selected";
@@ -1830,8 +1842,6 @@ Page({ @@ -1830,8 +1842,6 @@ Page({
1830 1842
1831 th.doCheckAll(async function () { 1843 th.doCheckAll(async function () {
1832 1844
1833 -  
1834 -  
1835 e.data.duo_zp_num_arr = {}; 1845 e.data.duo_zp_num_arr = {};
1836 if (sele) { 1846 if (sele) {
1837 await e.check_prom_activity(pitems); 1847 await e.check_prom_activity(pitems);
@@ -2038,17 +2048,11 @@ Page({ @@ -2038,17 +2048,11 @@ Page({
2038 }); 2048 });
2039 //要先处理了,再来判断要不要显示凑单 2049 //要先处理了,再来判断要不要显示凑单
2040 th.doCheckAll(async function () { 2050 th.doCheckAll(async function () {
2041 - if (a.prom_type == 3) {  
2042 - e.data.duo_zp_num_arr = {};  
2043 - if (!a.selected) {  
2044 - await e.check_prom_activity(pitems);  
2045 - } 2051 + th.data.duo_zp_num_arr={};
2046 //判断商品是不是优惠活动 2052 //判断商品是不是优惠活动
2047 for (var i in e.data.requestData) { 2053 for (var i in e.data.requestData) {
2048 - if (!a.selected && i == pitems) continue;  
2049 await e.check_prom_activity(i); 2054 await e.check_prom_activity(i);
2050 } 2055 }
2051 - }  
2052 2056
2053 }); 2057 });
2054 } else { 2058 } else {
@@ -2148,7 +2152,7 @@ Page({ @@ -2148,7 +2152,7 @@ Page({
2148 this.doCheckAll(); 2152 this.doCheckAll();
2149 }, 2153 },
2150 2154
2151 - //----------检查是否全选--------- 2155 + //----------检查是否全选,同时检验各种活动---------
2152 doCheckAll: async function (func, n_ok) { 2156 doCheckAll: async function (func, n_ok) {
2153 var th = this, 2157 var th = this,
2154 tfeel = 0, 2158 tfeel = 0,
@@ -2191,6 +2195,7 @@ Page({ @@ -2191,6 +2195,7 @@ Page({
2191 2195
2192 if(car.length>1 && c_ind>-1){ 2196 if(car.length>1 && c_ind>-1){
2193 var ite2 = car[c_ind].goods; 2197 var ite2 = car[c_ind].goods;
  2198 + //检验和设置商品的最终是以 取用什么活动,因为多促销
2194 await m_cx.cart_cx_group(th, ite2, car[c_ind], 0, n_ok, (show_can_cx) => { 2199 await m_cx.cart_cx_group(th, ite2, car[c_ind], 0, n_ok, (show_can_cx) => {
2195 rd_arr[c_ind]=show_can_cx; 2200 rd_arr[c_ind]=show_can_cx;
2196 }) 2201 })
@@ -2203,15 +2208,37 @@ Page({ @@ -2203,15 +2208,37 @@ Page({
2203 car[a].zh_map = null; 2208 car[a].zh_map = null;
2204 car[a].ladder_map = null; 2209 car[a].ladder_map = null;
2205 2210
  2211 + //-- 这里是清理了组合购的去凑单 --
  2212 + var txt = "requestData[" + a + "].need_list";
  2213 + //car[a].need_list = [];
  2214 + th.setData({[txt]:[]});
  2215 + //-- 这里清理赠品 --
  2216 + var txt2 = "requestData[" + a + "].send_gift_arr";
  2217 + //car[a].need_list = [];
  2218 + th.setData({[txt2]:[]});
  2219 + //-- 这里是清理了优惠的去凑单 --
  2220 + var rq_text2 = "requestData[" + a + "].make_up_arr";
  2221 + this.setData({
  2222 + [rq_text2]: null,
  2223 + })
  2224 +
  2225 + var item = car[a].goods,is_s_sele = 1;
2206 2226
2207 - var item = car[a].goods,  
2208 - is_s_sele = 1;  
2209 //-- 先批量判断一下活动的类型,同时要同步跟新 -- 2227 //-- 先批量判断一下活动的类型,同时要同步跟新 --
2210 -  
2211 var offline_price = 0; 2228 var offline_price = 0;
2212 var offline_num = 0; 2229 var offline_num = 0;
2213 for (var c = 0; c < item.length; c++) { 2230 for (var c = 0; c < item.length; c++) {
2214 - if (item[c].is_gift) continue; 2231 + //清理一下赠品
  2232 + if (item[c].is_gift) {
  2233 + var url = '/api/weshop/cart/del/' + oo.stoid + '/' + item[c].id;
  2234 + //getApp().request.delete(url, {});
  2235 + await getApp().request.promiseDelete(url, {}) // 要用同步让赠品删除
  2236 + item.splice(c, 1);
  2237 + //索引要回退一下
  2238 + --c;
  2239 + continue;
  2240 + }
  2241 +
2215 all_num += item[c].goods_num; 2242 all_num += item[c].goods_num;
2216 2243
2217 if (item[c].prom_type == 7) { 2244 if (item[c].prom_type == 7) {
@@ -2242,7 +2269,6 @@ Page({ @@ -2242,7 +2269,6 @@ Page({
2242 2269
2243 } else { 2270 } else {
2244 2271
2245 -  
2246 if (item[c].prom_type == 7) { 2272 if (item[c].prom_type == 7) {
2247 //先把商品放入组合计算的专用的区域 2273 //先把商品放入组合计算的专用的区域
2248 console.log('是组合商品---') 2274 console.log('是组合商品---')
@@ -2287,8 +2313,10 @@ Page({ @@ -2287,8 +2313,10 @@ Page({
2287 }); 2313 });
2288 2314
2289 var txt1 = "requestData[" + a + "].show_can_cx"; 2315 var txt1 = "requestData[" + a + "].show_can_cx";
  2316 + var txt_g = "requestData[" + a + "].goods";
2290 th.setData({ 2317 th.setData({
2291 - [txt1]: show_can_cx 2318 + [txt1]: show_can_cx,
  2319 + [txt_g]:item
2292 }); 2320 });
2293 2321
2294 //-- var et={show_can_cx:show_can_cx}; 2322 //-- var et={show_can_cx:show_can_cx};
@@ -2385,7 +2413,8 @@ Page({ @@ -2385,7 +2413,8 @@ Page({
2385 user_id: user_id, 2413 user_id: user_id,
2386 goods_id: goodsinfo.goods_id, 2414 goods_id: goodsinfo.goods_id,
2387 prom_type: goodsinfo.prom_type, 2415 prom_type: goodsinfo.prom_type,
2388 - prom_id: goodsinfo.prom_id 2416 + prom_id: goodsinfo.prom_id,
  2417 + isnew:1
2389 }, 2418 },
2390 }).then(res => { 2419 }).then(res => {
2391 var buy_num_data = res.data.data; 2420 var buy_num_data = res.data.data;
@@ -3081,18 +3110,20 @@ Page({ @@ -3081,18 +3110,20 @@ Page({
3081 getApp().request.put("/api/weshop/cart/update", { 3110 getApp().request.put("/api/weshop/cart/update", {
3082 data: t, 3111 data: t,
3083 success: async function (ee) { 3112 success: async function (ee) {
3084 - var txt = "requestData[" + pitem + "].goods[" + item + "].goods_num";  
3085 3113
  3114 + //-- 要先跟新一下商品的数量,在来计算商品价格 --
  3115 + var txt = "requestData[" + pitem + "].goods[" + item + "].goods_num";
3086 e.setData({ 3116 e.setData({
3087 [txt]: t.goods_num, 3117 [txt]: t.goods_num,
3088 }); 3118 });
3089 3119
3090 - e.data.duo_zp_num_arr = {};  
3091 - //await e.check_prom_activity(pitem)  
3092 - for (var i in e.data.requestData) {  
3093 - await e.check_prom_activity(i)  
3094 - }  
3095 - e.doCheckAll(); 3120 + e.doCheckAll(async function (){
  3121 + e.data.duo_zp_num_arr = {};
  3122 + //await e.check_prom_activity(pitem)
  3123 + for (var i in e.data.requestData) {
  3124 + await e.check_prom_activity(i)
  3125 + }
  3126 + });
3096 getApp().requestCardNum(e); 3127 getApp().requestCardNum(e);
3097 } 3128 }
3098 }); 3129 });
@@ -3141,6 +3172,9 @@ Page({ @@ -3141,6 +3172,9 @@ Page({
3141 } 3172 }
3142 var garr = this.data.requestData; 3173 var garr = this.data.requestData;
3143 var check_is_goods_selected = 0; 3174 var check_is_goods_selected = 0;
  3175 +
  3176 + var th=this;
  3177 +
3144 if (garr) { 3178 if (garr) {
3145 for (var ii in garr) { 3179 for (var ii in garr) {
3146 for (var ij in garr[ii].goods) { 3180 for (var ij in garr[ii].goods) {
@@ -3153,25 +3187,23 @@ Page({ @@ -3153,25 +3187,23 @@ Page({
3153 } 3187 }
3154 //-- 如果是商品的结算 -- 3188 //-- 如果是商品的结算 --
3155 if (check_is_goods_selected) { 3189 if (check_is_goods_selected) {
3156 - var glist = ""; //用逗号隔开的 3190 + var glist = []; //商品数组
3157 var map = new Map(); //使用map值键进行运算 3191 var map = new Map(); //使用map值键进行运算
3158 - var map_limit = new Map(); //使用map值键进行存储限购 3192 +
3159 var g_arr = new Array(); //已选的商品列表 3193 var g_arr = new Array(); //已选的商品列表
3160 var user_id = getApp().globalData.user_id; 3194 var user_id = getApp().globalData.user_id;
3161 - var th = this; 3195 +
3162 //用于判断是不是积分购的普通购买 3196 //用于判断是不是积分购的普通购买
3163 var normal_arr = {}; 3197 var normal_arr = {};
3164 var ab = 0; //选中 3198 var ab = 0; //选中
3165 wx.showLoading(); 3199 wx.showLoading();
3166 let checkArr7 = []; //组合购选中的数据 3200 let checkArr7 = []; //组合购选中的数据
3167 -  
3168 let checkObj3 = {}; //优惠促销次数判断 3201 let checkObj3 = {}; //优惠促销次数判断
3169 3202
3170 var zh_buyed_m={}; 3203 var zh_buyed_m={};
3171 var zh_limit_m={} 3204 var zh_limit_m={}
3172 var zh_all_ck={}; 3205 var zh_all_ck={};
3173 3206
3174 -  
3175 // let checkOff=false 3207 // let checkOff=false
3176 for (var i = 0; i < this.data.requestData.length; i++) { 3208 for (var i = 0; i < this.data.requestData.length; i++) {
3177 var i_arr = this.data.requestData[i].goods; 3209 var i_arr = this.data.requestData[i].goods;
@@ -3239,6 +3271,16 @@ Page({ @@ -3239,6 +3271,16 @@ Page({
3239 checkObj3[i_arr[j].prom_id] = [i]; 3271 checkObj3[i_arr[j].prom_id] = [i];
3240 } 3272 }
3241 } 3273 }
  3274 +
  3275 + //如果是普通购买的时候。
  3276 + if(i_arr[j].is_integral_normal || i_arr[j].is_pd_normal ){
  3277 + //-- 四大促销 --
  3278 + if([3,5,7,10].indexOf(i_arr[j].prom_tyoe)==-1){
  3279 + i_arr[j].prom_id=0;
  3280 + i_arr[j].prom_type=0;
  3281 + }
  3282 + }
  3283 +
3242 //map 的key是不会重复,会覆盖,, 3284 //map 的key是不会重复,会覆盖,,
3243 var ie = { 3285 var ie = {
3244 goods_id: i_arr[j].goods_id, 3286 goods_id: i_arr[j].goods_id,
@@ -3262,7 +3304,12 @@ Page({ @@ -3262,7 +3304,12 @@ Page({
3262 } else { 3304 } else {
3263 map.set(i_arr[j].goods_id + "", i_arr[j].goods_num); 3305 map.set(i_arr[j].goods_id + "", i_arr[j].goods_num);
3264 } 3306 }
3265 - glist += i_arr[j].goods_id + ","; 3307 + //glist += i_arr[j].goods_id + ",";
  3308 +
  3309 + if(!i_arr[j].is_gift){
  3310 + var et= {"prom_type":i_arr[j].prom_type,"prom_id":i_arr[j].prom_id,"goods_id":i_arr[j].goods_id};
  3311 + glist.push(et);
  3312 + }
3266 ab = 1; 3313 ab = 1;
3267 3314
3268 //-- 获取促销活动是不是有参与 -- 3315 //-- 获取促销活动是不是有参与 --
@@ -3416,7 +3463,7 @@ Page({ @@ -3416,7 +3463,7 @@ Page({
3416 var ky=zh_ck_arr[xg]; 3463 var ky=zh_ck_arr[xg];
3417 var zh_buyed=zh_buyed_m[ky]?zh_buyed_m[ky]:0; 3464 var zh_buyed=zh_buyed_m[ky]?zh_buyed_m[ky]:0;
3418 var zh_limit=zh_limit_m[ky]?zh_limit_m[ky]:0; 3465 var zh_limit=zh_limit_m[ky]?zh_limit_m[ky]:0;
3419 - var zh_all=zh_all_ck[ky]?zh_all_ck[ky]:0; 3466 + var zh_all=zh_all_ck[ky]?zh_all_ck[ky].length:0;
3420 if(zh_limit<=0) continue; 3467 if(zh_limit<=0) continue;
3421 3468
3422 if(zh_all+zh_buyed>zh_limit){ 3469 if(zh_all+zh_buyed>zh_limit){
@@ -3469,172 +3516,10 @@ Page({ @@ -3469,172 +3516,10 @@ Page({
3469 return false; 3516 return false;
3470 } 3517 }
3471 3518
3472 - glist = glist.substring(0, glist.length - 1);  
3473 - //--取一下商品的限购 以及活动的限购,redis数量--  
3474 - rq.get("/api/weshop/goods/getGoodsListNum", {  
3475 - data: {  
3476 - goodsidlist: glist,  
3477 - store_id: oo.stoid  
3478 - },  
3479 - async success(ee) {  
3480 - console.log(ee);  
3481 - if (ee.data.code == 0) {  
3482 - var ddata = ee.data.data,  
3483 - isok = 1,  
3484 - gname = "",  
3485 - err = "";  
3486 - //--组装--  
3487 - for (var ij = 0; ij < ddata.length; ij++) {  
3488 - var val = ddata[ij];  
3489 - var obj = map_limit.get(val.goods_id + "");  
3490 - if (obj) continue;  
3491 -  
3492 - var promgoodsbuynum = 0;  
3493 - var goodsbuynum = 0;  
3494 -  
3495 - //--要获得商品,该用户买了多少件,同步应用--  
3496 - await getApp().request.promiseGet("/api/weshop/ordergoods/getUserBuyGoodsNum", {  
3497 - data: {  
3498 - store_id: oo.stoid,  
3499 - user_id: user_id,  
3500 - goods_id: val.goods_id,  
3501 - prom_type: val.prom_type,  
3502 - prom_id: val.prom_id  
3503 - },  
3504 - }).then(res => {  
3505 - var buy_num_data = res.data.data;  
3506 - if (buy_num_data.promgoodsbuynum) promgoodsbuynum = buy_num_data.promgoodsbuynum;  
3507 - goodsbuynum = buy_num_data.goodsbuynum;  
3508 - })  
3509 - var ie = {  
3510 - promgoodsbuynum: promgoodsbuynum,  
3511 - goodsbuynum: goodsbuynum  
3512 - };  
3513 - map_limit.set(val.goods_id + "", ie);  
3514 - } 3519 + //进行到下一步
  3520 + th.cart_buy_next(glist,map,g_arr,checkArr7)
3515 3521
3516 - try {  
3517 - for (var ind in ddata) {  
3518 - var val = ddata[ind];  
3519 - var num = map.get(val.goods_id + "");  
3520 - if (num <= 0) {  
3521 - isok = 0;  
3522 - gname = val.goods_name;  
3523 - throw "购买数量不能为0";  
3524 - return false;  
3525 - }  
3526 -  
3527 - if (val.prom_type == 1 || val.prom_type == 6) {  
3528 - if (num > val.store_count) {  
3529 - isok = 0;  
3530 - gname = val.goods_name;  
3531 - throw "超出库存";  
3532 - return false;  
3533 - }  
3534 - }  
3535 -  
3536 - if (th.data.sales_rules == 1) {  
3537 - if (num > val.store_count) {  
3538 - isok = 0;  
3539 - gname = val.goods_name;  
3540 - throw "超出库存";  
3541 - return false;  
3542 - }  
3543 - }  
3544 - if (num > val.redisnum && val.redisnum && !normal_arr[val.goods_id]) {  
3545 - isok = 0;  
3546 - gname = val.goods_name;  
3547 - throw "超出活动库存";  
3548 - return false;  
3549 - }  
3550 - if (num > val.goods_num - val.buy_num && val.goods_num && !normal_arr[val.goods_id]) {  
3551 - isok = 0;  
3552 - gname = val.goods_name;  
3553 - throw "超出活动库存";  
3554 - return false;  
3555 - }  
3556 -  
3557 - var buyed = map_limit.get(val.goods_id + "");  
3558 - if (num + buyed.goodsbuynum > val.viplimited && val.viplimited > 0) {  
3559 - isok = 0;  
3560 - gname = val.goods_name;  
3561 - throw "超出商品限购";  
3562 - return false;  
3563 - }  
3564 -  
3565 - if (num + buyed.promgoodsbuynum > val.buy_limit && val.buy_limit > 0 && !normal_arr[val.goods_id]) {  
3566 - isok = 0;  
3567 - gname = val.goods_name;  
3568 - throw "超出活动限购";  
3569 - return false;  
3570 - }  
3571 -  
3572 - var card_field = th.data.card_field;  
3573 - for (var i = 0; i < g_arr.length; i++) {  
3574 -  
3575 - if (g_arr[i].goods_id == val.goods_id) {  
3576 -  
3577 - //如果会员是等级会员,商品有等级价,且不是活动商品  
3578 - if (card_field && val[card_field] > 0 &&  
3579 - ((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 || val.prom_type == 10 || normal_arr[val.goods_id])) {  
3580 - if (g_arr[i].goods_price != val[card_field]) {  
3581 - isok = 0;  
3582 - gname = val.goods_name;  
3583 - throw "商品价格已经变化";  
3584 - }  
3585 - } else {  
3586 - if (g_arr[i].goods_price != val.shop_price && g_arr[i].goods_price != val.prom_price && val.prom_price > 0) {  
3587 - isok = 0;  
3588 - gname = val.goods_name;  
3589 - throw "商品价格已经变化";  
3590 - }  
3591 - }  
3592 -  
3593 - //-- 数据的更新 --  
3594 - var data = {  
3595 - id: g_arr[i].id,  
3596 - selected: 1,  
3597 - store_id: oo.stoid,  
3598 - prom_type: g_arr[i].prom_type,  
3599 - prom_id: g_arr[i].prom_id,  
3600 - };  
3601 - let gitem = checkArr7.find(item => item.goods_id == g_arr[i].goods_id)  
3602 - if (gitem) {  
3603 - data.prom_type = 0  
3604 - data.prom_id = 0  
3605 - }  
3606 - //-- 如果有线下取价的时候 --  
3607 - if (g_arr[i].is_offline) {  
3608 - data.pricing_type = g_arr[i].pricing_type;  
3609 - data.offline_price = g_arr[i].offline_price;  
3610 - }  
3611 - rq.put("/api/weshop/cart/update", {  
3612 - data: data,  
3613 - success: function (ee) {  
3614 - console.log(ee);  
3615 - }  
3616 - });  
3617 - }  
3618 - }  
3619 -  
3620 - }  
3621 - } catch (e) {  
3622 - err = e;  
3623 - }  
3624 - if (isok == 0) {  
3625 - t.confirmBox(gname + ":" + err);  
3626 - wx.hideLoading();  
3627 - return false;  
3628 - }  
3629 3522
3630 -  
3631 - wx.hideLoading();  
3632 - wx.navigateTo({  
3633 - url: "/packageE/pages/cart/cart2/cart2"  
3634 - });  
3635 - }  
3636 - }  
3637 - });  
3638 } else if (res.cancel) { 3523 } else if (res.cancel) {
3639 wx.hideLoading(); 3524 wx.hideLoading();
3640 console.log('用户点击取消') 3525 console.log('用户点击取消')
@@ -3663,166 +3548,9 @@ Page({ @@ -3663,166 +3548,9 @@ Page({
3663 return false; 3548 return false;
3664 } 3549 }
3665 3550
3666 - glist = glist.substring(0, glist.length - 1);  
3667 - //--取一下商品的限购 以及活动的限购,redis数量--  
3668 - rq.get("/api/weshop/goods/getGoodsListNum", {  
3669 - data: {  
3670 - goodsidlist: glist,  
3671 - store_id: oo.stoid  
3672 - },  
3673 - async success(ee) {  
3674 - console.log(ee);  
3675 - if (ee.data.code == 0) {  
3676 - var ddata = ee.data.data,  
3677 - isok = 1,  
3678 - gname = "",  
3679 - err = "";  
3680 - //--组装--  
3681 - for (var ij = 0; ij < ddata.length; ij++) {  
3682 - var val = ddata[ij];  
3683 - var obj = map_limit.get(val.goods_id + "");  
3684 - if (obj) continue;  
3685 -  
3686 - var promgoodsbuynum = 0;  
3687 - var goodsbuynum = 0;  
3688 -  
3689 - //--要获得商品,该用户买了多少件,同步应用--  
3690 - await getApp().request.promiseGet("/api/weshop/ordergoods/getUserBuyGoodsNum", {  
3691 - data: {  
3692 - store_id: oo.stoid,  
3693 - user_id: user_id,  
3694 - goods_id: val.goods_id,  
3695 - prom_type: val.prom_type,  
3696 - prom_id: val.prom_id  
3697 - },  
3698 - }).then(res => {  
3699 - var buy_num_data = res.data.data;  
3700 - if (buy_num_data.promgoodsbuynum) promgoodsbuynum = buy_num_data.promgoodsbuynum;  
3701 - goodsbuynum = buy_num_data.goodsbuynum;  
3702 - })  
3703 - var ie = {  
3704 - promgoodsbuynum: promgoodsbuynum,  
3705 - goodsbuynum: goodsbuynum  
3706 - };  
3707 - map_limit.set(val.goods_id + "", ie);  
3708 - } 3551 + //进行到下一步
  3552 + th.cart_buy_next(glist,map,g_arr,checkArr7)
3709 3553
3710 - try {  
3711 - for (var ind in ddata) {  
3712 - var val = ddata[ind];  
3713 - var num = map.get(val.goods_id + "");  
3714 - if (num <= 0) {  
3715 - isok = 0;  
3716 - gname = val.goods_name;  
3717 - throw "购买数量不能为0";  
3718 - return false;  
3719 - }  
3720 -  
3721 - if (val.prom_type == 1 || val.prom_type == 6) {  
3722 - if (num > val.store_count) {  
3723 - isok = 0;  
3724 - gname = val.goods_name;  
3725 - throw "超出库存";  
3726 - return false;  
3727 - }  
3728 - }  
3729 -  
3730 - if (th.data.sales_rules == 1) {  
3731 - if (num > val.store_count) {  
3732 - isok = 0;  
3733 - gname = val.goods_name;  
3734 - throw "超出库存";  
3735 - return false;  
3736 - }  
3737 - }  
3738 - if (num > val.redisnum && val.redisnum && !normal_arr[val.goods_id]) {  
3739 - isok = 0;  
3740 - gname = val.goods_name;  
3741 - throw "超出活动库存";  
3742 - return false;  
3743 - }  
3744 - if (num > val.goods_num - val.buy_num && val.goods_num && !normal_arr[val.goods_id]) {  
3745 - isok = 0;  
3746 - gname = val.goods_name;  
3747 - throw "超出活动库存";  
3748 - return false;  
3749 - }  
3750 -  
3751 - var buyed = map_limit.get(val.goods_id + "");  
3752 - if (num + buyed.goodsbuynum > val.viplimited && val.viplimited > 0) {  
3753 - isok = 0;  
3754 - gname = val.goods_name;  
3755 - throw "超出商品限购";  
3756 - return false;  
3757 - }  
3758 -  
3759 - if (num + buyed.promgoodsbuynum > val.buy_limit && val.buy_limit > 0 && !normal_arr[val.goods_id]) {  
3760 - isok = 0;  
3761 - gname = val.goods_name;  
3762 - throw "超出活动限购";  
3763 - return false;  
3764 - }  
3765 -  
3766 - var card_field = th.data.card_field;  
3767 - for (var i = 0; i < g_arr.length; i++) {  
3768 -  
3769 - if (g_arr[i].goods_id == val.goods_id) {  
3770 -  
3771 - //如果会员是等级会员,商品有等级价,且不是活动商品  
3772 - if (card_field && val[card_field] > 0 &&  
3773 - ((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 || val.prom_type == 10 || normal_arr[val.goods_id])) {  
3774 - if (g_arr[i].goods_price != val[card_field]) {  
3775 - isok = 0;  
3776 - gname = val.goods_name;  
3777 - throw "商品价格已经变化";  
3778 - }  
3779 - } else {  
3780 - if (g_arr[i].goods_price != val.shop_price && g_arr[i].goods_price != val.prom_price && val.prom_price > 0) {  
3781 - isok = 0;  
3782 - gname = val.goods_name;  
3783 - throw "商品价格已经变化";  
3784 - }  
3785 - }  
3786 -  
3787 - //-- 数据的更新 --  
3788 - var data = {  
3789 - id: g_arr[i].id,  
3790 - selected: 1,  
3791 - store_id: oo.stoid,  
3792 - prom_type: g_arr[i].prom_type,  
3793 - prom_id: g_arr[i].prom_id,  
3794 - };  
3795 -  
3796 - //-- 如果有线下取价的时候 --  
3797 - if (g_arr[i].is_offline) {  
3798 - data.pricing_type = g_arr[i].pricing_type;  
3799 - data.offline_price = g_arr[i].offline_price;  
3800 - }  
3801 - rq.put("/api/weshop/cart/update", {  
3802 - data: data,  
3803 - success: function (ee) {  
3804 - console.log(ee);  
3805 - }  
3806 - });  
3807 - }  
3808 - }  
3809 -  
3810 - }  
3811 - } catch (e) {  
3812 - err = e;  
3813 - }  
3814 - if (isok == 0) {  
3815 - t.confirmBox(gname + ":" + err);  
3816 - wx.hideLoading();  
3817 - return false;  
3818 - }  
3819 - wx.hideLoading();  
3820 - wx.navigateTo({  
3821 - url: "/packageE/pages/cart/cart2/cart2"  
3822 - });  
3823 - }  
3824 - }  
3825 - });  
3826 } 3554 }
3827 } else { 3555 } else {
3828 3556
@@ -3858,6 +3586,192 @@ Page({ @@ -3858,6 +3586,192 @@ Page({
3858 } 3586 }
3859 }, 3587 },
3860 3588
  3589 +
  3590 + cart_buy_next(glist,map,g_arr,checkArr7){
  3591 + var th=this;
  3592 + var map_limit = new Map(); //使用map值键进行存储限购
  3593 + //--取一下商品的限购 以及活动的限购,redis数量--
  3594 + getApp().request.promisePost("/api/weshop/goods/listGoodsListNumNew", {
  3595 + is_json:1,
  3596 + data: {
  3597 + listNumNewDtos: glist,
  3598 + store_id: oo.stoid
  3599 + }
  3600 + }).then(async ee=>{
  3601 + if (ee.data.code == 0) {
  3602 + var ddata = ee.data.data,
  3603 + isok = 1,
  3604 + gname = "",
  3605 + err = "";
  3606 + //--组装--
  3607 + for (var ij = 0; ij < ddata.length; ij++) {
  3608 + var val = ddata[ij];
  3609 +
  3610 + var ky=val.goods_id + "-"+val.prom_type + "-"+val.prom_id;
  3611 + var obj = map_limit.get(ky);
  3612 + if (obj) continue;
  3613 +
  3614 + var promgoodsbuynum = 0;
  3615 + var goodsbuynum = 0;
  3616 +
  3617 + //--要获得商品,该用户买了多少件,同步应用--
  3618 + await getApp().request.promiseGet("/api/weshop/ordergoods/getUserBuyGoodsNum", {
  3619 + data: {
  3620 + store_id: oo.stoid,
  3621 + user_id:getApp().globalData.user_id,
  3622 + goods_id: val.goods_id,
  3623 + prom_type: val.prom_type,
  3624 + prom_id: val.prom_id,
  3625 + isnew:1
  3626 + },
  3627 + }).then(res => {
  3628 + var buy_num_data = res.data.data;
  3629 + if (buy_num_data.promgoodsbuynum) promgoodsbuynum = buy_num_data.promgoodsbuynum;
  3630 + goodsbuynum = buy_num_data.goodsbuynum;
  3631 + })
  3632 + var ie = {
  3633 + promgoodsbuynum: promgoodsbuynum,
  3634 + goodsbuynum: goodsbuynum
  3635 + };
  3636 + map_limit.set(ky, ie);
  3637 + }
  3638 +
  3639 + //try {
  3640 + for (var ind in ddata) {
  3641 + var val = ddata[ind];
  3642 + var num = map.get(val.goods_id + "");
  3643 +
  3644 + var ky=val.goods_id + "-"+val.prom_type + "-"+val.prom_id;
  3645 + var buyed = map_limit.get(ky);
  3646 +
  3647 + if (num <= 0) {
  3648 + isok = 0;
  3649 + gname = val.goods_name;
  3650 + throw "购买数量不能为0";
  3651 + return false;
  3652 + }
  3653 +
  3654 + if (val.prom_type == 1 || val.prom_type == 2) {
  3655 +
  3656 + var s_num=num;
  3657 + if(th.data.sales_rules> 1) s_num=buyed;
  3658 + if (s_num > val.store_count) {
  3659 + isok = 0;
  3660 + gname = val.goods_name;
  3661 + throw "超出库存";
  3662 + return false;
  3663 + }
  3664 +
  3665 + if (buyed > val.redisnum && val.redisnum) {
  3666 + isok = 0;
  3667 + gname = val.goods_name;
  3668 + err="超出活动库存";
  3669 + break;
  3670 + }
  3671 + if (buyed > val.goods_num - val.buy_num && val.goods_num) {
  3672 + isok = 0;
  3673 + gname = val.goods_name;
  3674 + err="超出活动库存";
  3675 + break;
  3676 + }
  3677 +
  3678 + }
  3679 +
  3680 + if (th.data.sales_rules == 1) {
  3681 + if (num > val.store_count) {
  3682 + isok = 0;
  3683 + gname = val.goods_name;
  3684 + err="超出库存";
  3685 + break;
  3686 + }
  3687 + }
  3688 +
  3689 +
  3690 +
  3691 + if (num + buyed.goodsbuynum > val.viplimited && val.viplimited > 0) {
  3692 + isok = 0;
  3693 + gname = val.goods_name;
  3694 + err="超出商品限购";
  3695 + break;
  3696 + }
  3697 +
  3698 + if (num + buyed.promgoodsbuynum > val.buy_limit && val.buy_limit > 0) {
  3699 + isok = 0;
  3700 + gname = val.goods_name;
  3701 + err="超出活动限购";
  3702 + break;
  3703 + }
  3704 +
  3705 + var card_field = th.data.card_field;
  3706 + for (var i = 0; i < g_arr.length; i++) {
  3707 + if (g_arr[i].goods_id == val.goods_id) {
  3708 +
  3709 + //如果会员是等级会员,商品有等级价,且不是活动商品
  3710 + if (card_field && val[card_field] > 0 &&
  3711 + ((val.prom_type == 0 && g_arr[i].prom_type == 0) || g_arr[i].prom_type == 3 || g_arr[i].prom_type == 5 || g_arr[i].prom_type == 7 || g_arr[i].prom_type == 10)) {
  3712 + if (g_arr[i].goods_price != val[card_field]) {
  3713 + isok = 0;
  3714 + gname = val.goods_name;
  3715 + err="商品价格已经变化";
  3716 + break;
  3717 + }
  3718 + } else {
  3719 + if (g_arr[i].goods_price != val.shop_price && g_arr[i].goods_price != val.prom_price && val.prom_price > 0) {
  3720 + isok = 0;
  3721 + gname = val.goods_name;
  3722 + err="商品价格已经变化";
  3723 + break;
  3724 + }
  3725 + }
  3726 +
  3727 + //-- 数据的更新 --
  3728 + var data = {
  3729 + id: g_arr[i].id,
  3730 + selected: 1,
  3731 + store_id: oo.stoid,
  3732 + prom_type: g_arr[i].prom_type,
  3733 + prom_id: g_arr[i].prom_id,
  3734 + };
  3735 + let gitem = checkArr7.find(item => item.goods_id == g_arr[i].goods_id)
  3736 + if (gitem) {
  3737 + data.prom_type = 0
  3738 + data.prom_id = 0
  3739 + }
  3740 + //-- 如果有线下取价的时候 --
  3741 + if (g_arr[i].is_offline) {
  3742 + data.pricing_type = g_arr[i].pricing_type;
  3743 + data.offline_price = g_arr[i].offline_price;
  3744 + }
  3745 + rq.put("/api/weshop/cart/update", {
  3746 + data: data,
  3747 + success: function (ee) {
  3748 + console.log(ee);
  3749 + }
  3750 + });
  3751 + }
  3752 + }
  3753 +
  3754 + if(!isok) break;
  3755 +
  3756 + }
  3757 + // } catch (e) {
  3758 + // err = e;
  3759 + // }
  3760 + if (isok == 0) {
  3761 + t.confirmBox(gname + ":" + err);
  3762 + wx.hideLoading();
  3763 + return false;
  3764 + }
  3765 +
  3766 +
  3767 + wx.hideLoading();
  3768 + wx.navigateTo({
  3769 + url: "/packageE/pages/cart/cart2/cart2"
  3770 + });
  3771 + }
  3772 + })
  3773 + },
  3774 +
3861 //结算到最后一个商品 3775 //结算到最后一个商品
3862 set_last: function (ab, isok, gname) { 3776 set_last: function (ab, isok, gname) {
3863 if (isok == 0) { 3777 if (isok == 0) {
@@ -4056,6 +3970,7 @@ Page({ @@ -4056,6 +3970,7 @@ Page({
4056 this.setData({ 3970 this.setData({
4057 [gift_text]: null, 3971 [gift_text]: null,
4058 }) 3972 })
  3973 +
4059 return false; 3974 return false;
4060 } 3975 }
4061 //-- 循环判断活动 -- 3976 //-- 循环判断活动 --
@@ -4148,7 +4063,6 @@ Page({ @@ -4148,7 +4063,6 @@ Page({
4148 continue; 4063 continue;
4149 } 4064 }
4150 4065
4151 -  
4152 //-- 只有在单赠品的时候,才要进行计算 -- 4066 //-- 只有在单赠品的时候,才要进行计算 --
4153 await getApp().request.promiseGet("/api/weshop/goods/getDiscount", { 4067 await getApp().request.promiseGet("/api/weshop/goods/getDiscount", {
4154 data: { 4068 data: {
@@ -4163,7 +4077,6 @@ Page({ @@ -4163,7 +4077,6 @@ Page({
4163 }) 4077 })
4164 4078
4165 if (discount) { 4079 if (discount) {
4166 -  
4167 if (!discount.zp_num || parseInt(discount.zp_num) == 0) discount.zp_num = 1; 4080 if (!discount.zp_num || parseInt(discount.zp_num) == 0) discount.zp_num = 1;
4168 //判断一下赠品的模式 4081 //判断一下赠品的模式
4169 if (parseInt(discount.zp_mode) == 1) { 4082 if (parseInt(discount.zp_mode) == 1) {
@@ -4176,7 +4089,7 @@ Page({ @@ -4176,7 +4089,7 @@ Page({
4176 } 4089 }
4177 4090
4178 var t_zp_num = parseInt(discount.zp_num) * parseInt(discount.bs); 4091 var t_zp_num = parseInt(discount.zp_num) * parseInt(discount.bs);
4179 - if (th.data.duo_zp_num_arr[prom.id]) { 4092 + if (th.data.duo_zp_num_arr && th.data.duo_zp_num_arr[prom.id]) {
4180 t_zp_num += th.data.duo_zp_num_arr[prom.id]; 4093 t_zp_num += th.data.duo_zp_num_arr[prom.id];
4181 } 4094 }
4182 4095
@@ -4185,6 +4098,7 @@ Page({ @@ -4185,6 +4098,7 @@ Page({
4185 json.prom_id = prom.id; 4098 json.prom_id = prom.id;
4186 json.prom_name = prom.name; 4099 json.prom_name = prom.name;
4187 send_gift_arr.push(json); 4100 send_gift_arr.push(json);
  4101 + if(!th.data.duo_zp_num_arr) th.data.duo_zp_num_arr={};
4188 th.data.duo_zp_num_arr[prom.id] = t_zp_num; 4102 th.data.duo_zp_num_arr[prom.id] = t_zp_num;
4189 } 4103 }
4190 4104
@@ -4309,6 +4223,7 @@ Page({ @@ -4309,6 +4223,7 @@ Page({
4309 } 4223 }
4310 return user_pre_buynum 4224 return user_pre_buynum
4311 }, 4225 },
  4226 +
4312 async all_check_prom_activity() { 4227 async all_check_prom_activity() {
4313 this.data.duo_zp_num_arr = {}; 4228 this.data.duo_zp_num_arr = {};
4314 for (var i in this.data.requestData) { 4229 for (var i in this.data.requestData) {
@@ -4675,21 +4590,34 @@ Page({ @@ -4675,21 +4590,34 @@ Page({
4675 return false; 4590 return false;
4676 } 4591 }
4677 4592
4678 - var url = "/api/weshop/activitylist/getGoodActInfo";  
4679 - var req_data = {  
4680 - store_id: os.stoid,  
4681 - goodsidlist: gd,  
4682 - is_detail: 1,  
4683 - user_id: user_id  
4684 - }; 4593 + // var url = "/api/weshop/activitylist/getGoodActInfo";
  4594 + // var req_data = {
  4595 + // store_id: os.stoid,
  4596 + // goodsidlist: gd,
  4597 + // is_detail: 1,
  4598 + // user_id: user_id
  4599 + // };
  4600 + var url = '/api/weshop/activitylist/listGoodActInfo2New';
  4601 + var req_d = {
  4602 + "store_id": os.stoid,
  4603 + "goods_id": gd,
  4604 + "user_id": user_id,
  4605 + }
4685 4606
4686 - //获取秒杀的多规格 4607 + //获取秒杀的多规格
4687 getApp().request.promiseGet(url, { 4608 getApp().request.promiseGet(url, {
4688 - data: req_data 4609 + data: req_d
4689 }).then(res => { 4610 }).then(res => {
4690 if (res.data.code == 0 && res.data.data) { 4611 if (res.data.code == 0 && res.data.data) {
4691 - if (res.data.data.length == 1) {  
4692 - var item = res.data.data[0]; 4612 +
  4613 + var arr = res.data.data;
  4614 + //-- 预热也要计算 --
  4615 + var arr2 = arr.filter(function (e) {
  4616 + return e.s_time < ut.gettimestamp() || (e.warm_uptime && e.warm_uptime < ut.gettimestamp())
  4617 + })
  4618 +
  4619 + if (arr2.length == 1) {
  4620 + var item =arr2[0];
4693 switch (item.prom_type) { 4621 switch (item.prom_type) {
4694 case 9: 4622 case 9:
4695 good_url = '/packageC/pages/luckyGo/luckyGo_goodsInfo/luckyGo_goodsInfo?goods_id=' + gd + '&group_id=' + item.act_id; 4623 good_url = '/packageC/pages/luckyGo/luckyGo_goodsInfo/luckyGo_goodsInfo?goods_id=' + gd + '&group_id=' + item.act_id;
@@ -4752,26 +4680,26 @@ Page({ @@ -4752,26 +4680,26 @@ Page({
4752 //--- 选择回来时候的选择 --- 4680 //--- 选择回来时候的选择 ---
4753 sure_cx_group: function (e) { 4681 sure_cx_group: function (e) {
4754 var th = this; 4682 var th = this;
4755 - var sele_idx = e.detail.sele_idx; 4683 + var sele_prom_type=e.detail.sele_prom_type;
  4684 + //-- 获取到当前的 show_can_cx--
4756 var idx = this.data.sele_cx_group_cidx; 4685 var idx = this.data.sele_cx_group_cidx;
4757 var gd_key = this.data.cx_group_gd_key; 4686 var gd_key = this.data.cx_group_gd_key;
4758 - //-- 获取到--  
4759 var cx_prom_group = this.data.requestData[idx].show_can_cx[gd_key].act_arr; 4687 var cx_prom_group = this.data.requestData[idx].show_can_cx[gd_key].act_arr;
4760 4688
4761 var fir_sele = 0; 4689 var fir_sele = 0;
4762 -  
4763 for (var dx = 0; dx < cx_prom_group.length; dx++) { 4690 for (var dx = 0; dx < cx_prom_group.length; dx++) {
4764 if (cx_prom_group[dx].sele) fir_sele = dx; 4691 if (cx_prom_group[dx].sele) fir_sele = dx;
4765 - if (dx != sele_idx) cx_prom_group[dx].sele = 0; 4692 + if (cx_prom_group[dx].prom_type!= sele_prom_type) cx_prom_group[dx].sele = 0;
4766 else cx_prom_group[dx].sele = 1; 4693 else cx_prom_group[dx].sele = 1;
4767 } 4694 }
4768 4695
  4696 + // -- 判断 --
4769 this.cx_check_ok2(async function (the_rs) { 4697 this.cx_check_ok2(async function (the_rs) {
4770 if (the_rs.code == 0) { 4698 if (the_rs.code == 0) {
4771 th.data.change_act = 1; 4699 th.data.change_act = 1;
4772 4700
4773 -  
4774 th.doCheckAll(async function () { 4701 th.doCheckAll(async function () {
  4702 + th.data.duo_zp_num_arr={};
4775 for (var i in th.data.requestData) { 4703 for (var i in th.data.requestData) {
4776 await th.check_prom_activity(i) 4704 await th.check_prom_activity(i)
4777 } 4705 }
@@ -4929,7 +4857,7 @@ Page({ @@ -4929,7 +4857,7 @@ Page({
4929 'user_id': getApp().globalData.user_id, 4857 'user_id': getApp().globalData.user_id,
4930 'goods_id': gid, 4858 'goods_id': gid,
4931 'prom_type': 7, 4859 'prom_type': 7,
4932 - 'prom_id': pid 4860 + 'prom_id': pid, isnew:1
4933 }; 4861 };
4934 4862
4935 var res = await getApp().request.promiseGet("/api/weshop/ordergoods/getUserBuyGoodsNum", { 4863 var res = await getApp().request.promiseGet("/api/weshop/ordergoods/getUserBuyGoodsNum", {
pages/cart/cart/cart.wxml
@@ -141,10 +141,10 @@ @@ -141,10 +141,10 @@
141 <view class="cx-sizs fs30">可参促销</view> 141 <view class="cx-sizs fs30">可参促销</view>
142 <view class="flex ai_c f1 pdh20"> 142 <view class="flex ai_c f1 pdh20">
143 <view class="xc-coupon-fram" wx:for="{{item.show_can_cx[items.goods_id].act_arr}}" > 143 <view class="xc-coupon-fram" wx:for="{{item.show_can_cx[items.goods_id].act_arr}}" >
144 - <view wx:if="{{item.prom_type==3}}" class="xc-coupon t-c four-level-word">优惠促销</view>  
145 - <view wx:if="{{item.prom_type==5}}" class="xc-coupon t-c four-level-word">搭配促销</view>  
146 - <view wx:if="{{item.prom_type==7}}" class="xc-coupon t-c four-level-word">组合购</view>  
147 - <view wx:if="{{item.prom_type==10}}" class="xc-coupon t-c four-level-word">阶梯促销</view> 144 + <view wx:if="{{item.prom_type==3}}" class="xc-coupon t-c four-level-word {{!item.sele?'gray':'' }}">优惠促销</view>
  145 + <view wx:if="{{item.prom_type==5}}" class="xc-coupon t-c four-level-word {{!item.sele?'gray':'' }} ">搭配促销</view>
  146 + <view wx:if="{{item.prom_type==7}}" class="xc-coupon t-c four-level-word {{!item.sele?'gray':'' }} ">组合购</view>
  147 + <view wx:if="{{item.prom_type==10}}" class="xc-coupon t-c four-level-word {{!item.sele?'gray':'' }}">阶梯促销</view>
148 </view> 148 </view>
149 </view> 149 </view>
150 <view class="cx-obtain-coupon wsize"> 150 <view class="cx-obtain-coupon wsize">
@@ -170,10 +170,10 @@ @@ -170,10 +170,10 @@
170 <view class="cx-sizs fs30">可参促销</view> 170 <view class="cx-sizs fs30">可参促销</view>
171 <view class="flex ai_c f1 pdh20"> 171 <view class="flex ai_c f1 pdh20">
172 <view class="xc-coupon-fram" wx:for="{{pitem.act_arr}}" > 172 <view class="xc-coupon-fram" wx:for="{{pitem.act_arr}}" >
173 - <view wx:if="{{item.prom_type==3}}" class="xc-coupon t-c four-level-word">优惠促销</view>  
174 - <view wx:if="{{item.prom_type==5}}" class="xc-coupon t-c four-level-word">搭配促销</view>  
175 - <view wx:if="{{item.prom_type==7}}" class="xc-coupon t-c four-level-word">组合购</view>  
176 - <view wx:if="{{item.prom_type==10}}" class="xc-coupon t-c four-level-word">阶梯促销</view> 173 + <view wx:if="{{item.prom_type==3}}" class="xc-coupon t-c four-level-word {{!item.sele?'gray':'' }} ">优惠促销</view>
  174 + <view wx:if="{{item.prom_type==5}}" class="xc-coupon t-c four-level-word {{!item.sele?'gray':'' }} ">搭配促销</view>
  175 + <view wx:if="{{item.prom_type==7}}" class="xc-coupon t-c four-level-word {{!item.sele?'gray':'' }}">组合购</view>
  176 + <view wx:if="{{item.prom_type==10}}" class="xc-coupon t-c four-level-word {{!item.sele?'gray':'' }}">阶梯促销</view>
177 </view> 177 </view>
178 </view> 178 </view>
179 <view class="cx-obtain-coupon wsize"> 179 <view class="cx-obtain-coupon wsize">
pages/cart/cart/cart.wxss
@@ -435,9 +435,13 @@ page { @@ -435,9 +435,13 @@ page {
435 /* margin:0 auto; */ 435 /* margin:0 auto; */
436 color: #fff; 436 color: #fff;
437 padding: 6rpx 20rpx; 437 padding: 6rpx 20rpx;
  438 +}
438 439
  440 +.xc-coupon-fram .xc-coupon.gray{
  441 + background-color: #bbb;
439 } 442 }
440 443
  444 +
441 .xc-coupon-fram .xc-circular { 445 .xc-coupon-fram .xc-circular {
442 width: 16rpx; 446 width: 16rpx;
443 height: 16rpx; 447 height: 16rpx;
pages/cart/cart2_pt/cart2_pt.js
@@ -75,7 +75,31 @@ Page({ @@ -75,7 +75,31 @@ Page({
75 75
76 same_ok:1, //同城配送的控制,默认ok 76 same_ok:1, //同城配送的控制,默认ok
77 77
78 - bconfig:null 78 + bconfig:null,
  79 + showFold:true,
  80 + },
  81 +
  82 +
  83 +
  84 + onReady() {
  85 +
  86 + setTimeout(() => {
  87 + wx.createSelectorQuery().selectAll(".showArea, .hideArea").boundingClientRect(res => {
  88 + if (res.length != 0) {
  89 + this.setData({
  90 + showFold: res[0].height < res[1].height,
  91 + });
  92 + };
  93 +
  94 + }).exec();
  95 + }, 1000);
  96 +
  97 + },
  98 +
  99 + clickCollapse() {
  100 + this.setData({
  101 + flag: !this.data.flag,
  102 + })
79 }, 103 },
80 onLoad: function (t) { 104 onLoad: function (t) {
81 console.log("onLoad_pt_cart"); 105 console.log("onLoad_pt_cart");
pages/cart/cart2_pt/cart2_pt.wxml
@@ -125,12 +125,16 @@ @@ -125,12 +125,16 @@
125 </view> 125 </view>
126 126
127 <!-- 保障服务 --> 127 <!-- 保障服务 -->
128 - <view class="bz_view flex bdt16" wx:if="{{bconfig.service_bz}}">  
129 - <image class="bzfu_img" src="{{imgUrl}}/miniapp/images/bzfu_w.png"></image>  
130 - <view class="flex f1 rel" style="position: relative;" bindtap="{{showFold ? 'clickCollapse':''}}">  
131 - <view class="bz-content showArea {{flag ? '':'ellipsis-1x'}}">{{bconfig.service_bz}}</view> 128 + <view class="bz_view22 flex bdt16 ai_c" wx:if="{{bconfig.service_bz}}">
  129 + <image class="bzfu_img22" src="{{imgUrl}}/miniapp/images/bzfu_w.png"></image>
  130 + <view class="flex f1 ai_c rel22" style="position: relative;" bindtap="{{showFold ? 'clickCollapse':''}}">
  131 + <view class="bz-content22 showArea22 {{flag ? '':'ellipsis-1x'}}">{{bconfig.service_bz}}</view>
  132 + <view class="bz-content22 hideArea22">{{bconfig.service_bz}}</view>
  133 + <view class="cx-obtain-coupon22 wsize22 arrow22" wx:if="{{showFold}}">
  134 + <text class="bg_jj22 down22 {{flag ? 'up22':''}}"></text>
  135 + </view>
132 </view> 136 </view>
133 - </view> 137 + </view>
134 138
135 139
136 <view class="coupon-mes flex-vertical"> 140 <view class="coupon-mes flex-vertical">
pages/goods/goodsInfo/goodsInfo.js
@@ -267,10 +267,11 @@ Page({ @@ -267,10 +267,11 @@ Page({
267 base_nor_prom_type: 0, 267 base_nor_prom_type: 0,
268 base_nor_prom_id: 0, 268 base_nor_prom_id: 0,
269 base_nor_goods_id: 0, 269 base_nor_goods_id: 0,
270 - user_pre_buynum: 0, //用户优惠促销参与次数 270 + user_pre_buynum: 0, //用户优惠促销参与次数,这个字段只针对优惠促销
271 keyword: '', //门店搜索 271 keyword: '', //门店搜索
272 sec_i: -1, //选中分类门店 下标 272 sec_i: -1, //选中分类门店 下标
273 cx_prom_group: [], //促销活动,用于显示和判断默认要用什么促销活动 273 cx_prom_group: [], //促销活动,用于显示和判断默认要用什么促销活动
  274 + showFold:true,
274 }, 275 },
275 276
276 //------初始化加载---------- 277 //------初始化加载----------
@@ -908,6 +909,10 @@ Page({ @@ -908,6 +909,10 @@ Page({
908 909
909 getApp().check_can_share(this); 910 getApp().check_can_share(this);
910 911
  912 + //-- 要清空,因为有回退。优惠促的数组,购买数量要清理成1 --
  913 + this.data.cx_prom_group=[];
  914 + this.data.goodsInputNum=1;
  915 +
911 var goods_list = null, 916 var goods_list = null,
912 th = this, 917 th = this,
913 that = this; 918 that = this;
@@ -1822,8 +1827,8 @@ Page({ @@ -1822,8 +1827,8 @@ Page({
1822 }) 1827 })
1823 } 1828 }
1824 1829
1825 - //要包含积分购的普通购买0 3,5,7,10  
1826 - else if ([0, 3, 5, 7, 10].indexOf(th.data.prom_type) > -1 || prom.prom_type == 7) { 1830 + //要包含积分购的普通购买0 3,5,7,10, is_integral_normal积分普通购买字段
  1831 + else if ([0, 3, 5, 7, 10].indexOf(th.data.prom_type) > -1 || newd.is_integral_normal) {
1827 newd.prom_type = 0; 1832 newd.prom_type = 0;
1828 newd.prom_id = 0; 1833 newd.prom_id = 0;
1829 1834
@@ -2061,152 +2066,14 @@ Page({ @@ -2061,152 +2066,14 @@ Page({
2061 }); 2066 });
2062 2067
2063 } else { 2068 } else {
2064 -  
2065 - //-- 这一步主要是要让立即购买 走 购物车的逻辑 参与活动,如果有zh_act就强制组合购购买 --  
2066 - if (th.data.zh_act &&  
2067 - th.data.zh_act.zhbuyqty <= th.data.goodsInputNum && (!th.data.zh_act.zh_num || th.data.zh_act.zh_buy_num < th.data.zh_act.zh_num)) {  
2068 - wx.hideLoading();  
2069 -  
2070 - if ((th.data.zh_act.buy_limit != 0 && th.data.zh_act.buy_limit <= th.data.userbuynum)) {  
2071 - wx.showModal({  
2072 - title: '提示',  
2073 - // content: `商品${str},组合购活动,购买次数已超,将以普通商品购买?`,  
2074 - content: `${th.data.data.goods_name}超出组合购限购次数,将以普通商品购买`,  
2075 - success: res => {  
2076 - if (res.confirm) {  
2077 - console.log('用户点击确定')  
2078 - //----先看会员在购物车中是否加入了该商品,立即购买的-----  
2079 - getApp().request.get("/api/weshop/cart/page", {  
2080 - data: {  
2081 - store_id: os.stoid,  
2082 - user_id: oo.user_id,  
2083 - state: 1  
2084 - },  
2085 - success: function (res) {  
2086 - //-------如果购物车中有相关的数据---------  
2087 - if (res.data.code == 0 && res.data.data.total > 0) {  
2088 - for (let j in res.data.data.pageData) {  
2089 - let item_j = res.data.data.pageData[j];  
2090 - var url = '/api/weshop/cart/del/' + e.data.stoid + '/' + item_j.id;  
2091 - getApp().request.delete(url, {});  
2092 - }  
2093 - }  
2094 - newd.state = 1;  
2095 - newd.prom_type = 0;  
2096 - newd.prom_id = 0  
2097 - getApp().request.post("/api/weshop/cart/save", {  
2098 - data: newd,  
2099 - success: function (t) {  
2100 - th.closeSpecModal();  
2101 - getApp().goto("/packageE/pages/cart/cart2/cart2?state=1");  
2102 - }  
2103 - });  
2104 - }  
2105 - })  
2106 - } else if (res.cancel) {  
2107 -  
2108 - console.log('用户点击取消')  
2109 - }  
2110 - }  
2111 - })  
2112 - } else {  
2113 -  
2114 -  
2115 - //----先看会员在购物车中是否加入了该商品,立即购买的-----  
2116 - getApp().request.get("/api/weshop/cart/page", {  
2117 - data: {  
2118 - store_id: os.stoid,  
2119 - user_id: oo.user_id,  
2120 - state: 1  
2121 - },  
2122 - success: function (res) {  
2123 - //-------如果购物车中有相关的数据,先清理掉---------  
2124 - if (res.data.code == 0 && res.data.data.total > 0) {  
2125 - for (let j in res.data.data.pageData) {  
2126 - let item_j = res.data.data.pageData[j];  
2127 - var url = '/api/weshop/cart/del/' + e.data.stoid + '/' + item_j.id;  
2128 - getApp().request.delete(url, {});  
2129 - }  
2130 - }  
2131 -  
2132 - newd.state = 1;  
2133 - newd.prom_type = 7;  
2134 - newd.prom_id = th.data.zh_act.id;  
2135 - getApp().request.post("/api/weshop/cart/save", {  
2136 - data: newd,  
2137 - success: function (t) {  
2138 - th.closeSpecModal();  
2139 - getApp().goto("/packageE/pages/cart/cart2/cart2?state=1");  
2140 - }  
2141 - });  
2142 -  
2143 - }  
2144 - })  
2145 - }  
2146 -  
2147 -  
2148 - return false  
2149 - } else {  
2150 - //----先看会员在购物车中是否加入了该商品,立即购买的-----  
2151 - getApp().request.get("/api/weshop/cart/page", {  
2152 - data: {  
2153 - store_id: os.stoid,  
2154 - user_id: oo.user_id,  
2155 - state: 1  
2156 - },  
2157 - success: function (res) {  
2158 - //-------如果购物车中有相关的数据---------  
2159 - if (res.data.code == 0 && res.data.data.total > 0) {  
2160 - for (let j in res.data.data.pageData) {  
2161 - let item_j = res.data.data.pageData[j];  
2162 - var url = '/api/weshop/cart/del/' + e.data.stoid + '/' + item_j.id;  
2163 - getApp().request.delete(url, {});  
2164 - }  
2165 - }  
2166 -  
2167 - }  
2168 - })  
2169 -  
2170 - }  
2171 -  
2172 - if (th.data.prom_goods && newd.prom_type != 4 && newd.prom_type != 6) {  
2173 - var prom_d = th.data.prom_goods;  
2174 - for (var i in prom_d) {  
2175 - //判断活动有俩种条件,0元 1件  
2176 - var condition_t = prom_d[i].prom_type;  
2177 - switch (condition_t) {  
2178 - case 0: //按钱  
2179 - if (newd.goods_price >= condition_t) {  
2180 - newd.prom_type = 3;  
2181 - newd.prom_id = prom_d[i].prom_id;  
2182 - }  
2183 - break  
2184 - case 1: //按购买数量  
2185 - if (newd.goods_num >= condition_t) {  
2186 - newd.prom_type = 3;  
2187 - newd.prom_id = prom_d[i].prom_id;  
2188 - }  
2189 - break;  
2190 - }  
2191 - }  
2192 - }  
2193 - //如果有阶梯促销的时候  
2194 - if (th.data.jieti_prom && (newd.prom_type == 10 || newd.prom_type == 0)) {  
2195 - newd.prom_type = 10;  
2196 - newd.prom_id = th.data.ladder_act_id;  
2197 - } else {  
2198 - //-- 优惠促销的商品,立即购买就判断了,就直接购买 --  
2199 - if ([1, 2, 4, 6].indexOf(newd.prom_type) == -1) {  
2200 - newd.prom_type = 0;  
2201 - newd.id = 0;  
2202 - }  
2203 - } 2069 + newd.prom_type = 0;
  2070 + newd.id = 0;
2204 2071
2205 newd['pick_name'] = th.data.sto_sele_name; 2072 newd['pick_name'] = th.data.sto_sele_name;
2206 newd['pick_dis'] = th.data.sto_sele_distr; 2073 newd['pick_dis'] = th.data.sto_sele_distr;
2207 th.buyNow(newd); 2074 th.buyNow(newd);
2208 - }  
2209 - }, 2075 + }
  2076 + },
2210 2077
2211 //因为在购物车 普通商品和 优惠促销,搭配购,组合购 阶梯购是一样的 2078 //因为在购物车 普通商品和 优惠促销,搭配购,组合购 阶梯购是一样的
2212 check_is_like(e, newd, idx) { 2079 check_is_like(e, newd, idx) {
@@ -2671,9 +2538,7 @@ Page({ @@ -2671,9 +2538,7 @@ Page({
2671 }, 2538 },
2672 2539
2673 openSpecModel: function (t) { 2540 openSpecModel: function (t) {
2674 -  
2675 -  
2676 - 2541 +
2677 var th = this; 2542 var th = this;
2678 var open_store = t.currentTarget.dataset.ind; 2543 var open_store = t.currentTarget.dataset.ind;
2679 2544
@@ -2768,10 +2633,10 @@ Page({ @@ -2768,10 +2633,10 @@ Page({
2768 var th = this; 2633 var th = this;
2769 var usr = getApp().globalData.userInfo; 2634 var usr = getApp().globalData.userInfo;
2770 if (this.data.sele_g.prom_type != 0 && this.data.sele_g.prom_type != 3 && !this.data.sele_g.whsle_id) { 2635 if (this.data.sele_g.prom_type != 0 && this.data.sele_g.prom_type != 3 && !this.data.sele_g.whsle_id) {
2771 - callback(); 2636 + callback();
2772 } else { 2637 } else {
2773 - //-- 判断有没有优惠活动 --  
2774 - getApp().request.promiseGet("/api/weshop/goods/getGoodsPromListNew1/" + os.stoid + "/" + th.data.sele_g.goods_id + "/0" + "/" + usr.user_id, {}).then(async res => { 2638 + //-- 判断有没有优惠活动 --
  2639 + getApp().request.promiseGet("/api/weshop/goods/getGoodsPromListNew1/" + os.stoid + "/" + th.data.sele_g.goods_id + "/0" + "/" + usr.user_id, {}).then(async res => {
2775 if (res.data.code == 0) { 2640 if (res.data.code == 0) {
2776 2641
2777 var r_data = res.data.data; 2642 var r_data = res.data.data;
@@ -2823,7 +2688,6 @@ Page({ @@ -2823,7 +2688,6 @@ Page({
2823 } 2688 }
2824 }, 2689 },
2825 2690
2826 -  
2827 //----获取线下价格------- 2691 //----获取线下价格-------
2828 get_off_price() { 2692 get_off_price() {
2829 var th = this; 2693 var th = this;
@@ -4984,7 +4848,7 @@ Page({ @@ -4984,7 +4848,7 @@ Page({
4984 data: { 4848 data: {
4985 store_id: os.stoid, 4849 store_id: os.stoid,
4986 user_id: user_id, 4850 user_id: user_id,
4987 - goods_id: gd.goods_id 4851 + goods_id: gd.goods_id, isnew:1
4988 }, 4852 },
4989 success: function (t) { 4853 success: function (t) {
4990 if (t.data.code == 0) { 4854 if (t.data.code == 0) {
@@ -5012,7 +4876,7 @@ Page({ @@ -5012,7 +4876,7 @@ Page({
5012 user_id: user_id, 4876 user_id: user_id,
5013 goods_id: gd.goods_id, 4877 goods_id: gd.goods_id,
5014 prom_type: gd.prom_type, 4878 prom_type: gd.prom_type,
5015 - prom_id: gd.prom_id 4879 + prom_id: gd.prom_id, isnew:1
5016 }, 4880 },
5017 //-----获取----- 4881 //-----获取-----
5018 success: function (tt) { 4882 success: function (tt) {
@@ -7515,6 +7379,12 @@ Page({ @@ -7515,6 +7379,12 @@ Page({
7515 7379
7516 //普通购买的时候,重新算一下组合购有没有 7380 //普通购买的时候,重新算一下组合购有没有
7517 if (is_nor || is_spec) { 7381 if (is_nor || is_spec) {
  7382 +
  7383 +
  7384 + th.setData({
  7385 + cx_prom_group: []
  7386 + })
  7387 +
7518 var arr3 = null; 7388 var arr3 = null;
7519 var url = '/api/weshop/activitylist/listGoodActInfo2New'; 7389 var url = '/api/weshop/activitylist/listGoodActInfo2New';
7520 var req_d = { 7390 var req_d = {
@@ -7616,39 +7486,97 @@ Page({ @@ -7616,39 +7486,97 @@ Page({
7616 if (r_data.promGoodsLists) { 7486 if (r_data.promGoodsLists) {
7617 7487
7618 var fir_act = r_data.promGoodsLists[0]; 7488 var fir_act = r_data.promGoodsLists[0];
  7489 + var is_yh_out_limit=0;
  7490 +
  7491 +
7619 //-- 计算一下限购,满足限购数才显示 -- 7492 //-- 计算一下限购,满足限购数才显示 --
7620 - await this.getUserBuyPromNum_pre(fir_act.prom_id);  
7621 -  
7622 - if (!fir_act.limit_num || th.data.user_pre_buynum < fir_act.limit_num) {  
7623 - var more_arr = [];  
7624 - //减价  
7625 - if (fir_act.money > 0) more_arr.push('减价' + fir_act.money + '元');  
7626 - if (fir_act.sale > 0) more_arr.push('打' + fir_act.sale + '折');  
7627 - if (fir_act.past == 1) more_arr.push('包邮');  
7628 - if (fir_act.intValue > 0) more_arr.push('送' + fir_act.intValue + '积分');  
7629 - if (fir_act.couponId > 0) more_arr.push('送' + fir_act.couponMoney + '元优惠券');  
7630 - if (fir_act.gift_id) {  
7631 - var is_more_gf = fir_act.gift_id.split(',')  
7632 - if (is_more_gf.length > 1) {  
7633 - more_arr.push('送赠品');  
7634 - } else {  
7635 - more_arr.push('送' + fir_act.goods_name + ' x' + fir_act.zp_num);  
7636 - } 7493 + if (fir_act.limit_num ) {
  7494 + await this.getUserBuyPromNum_pre(fir_act.prom_id);
  7495 + if(th.data.user_pre_buynum >= fir_act.limit_num){
  7496 + is_yh_out_limit=1;
7637 } 7497 }
7638 - if (fir_act.lb_id) more_arr.push('送' + fir_act.lbtitle);  
7639 - if (fir_act.zxlb_id) more_arr.push('送' + fir_act.zxlbtitle);  
7640 - if (fir_act.monthgiftbag_id) more_arr.push('送' + fir_act.monthgiftbag_title);  
7641 7498
  7499 + }
  7500 + // var more_arr = [];
  7501 + // //减价
  7502 + // if (fir_act.money > 0){
  7503 + //
  7504 + // more_arr.push({
  7505 + // text:'减价' + fir_act.money + '元',
  7506 + // is_fir:1
  7507 + // });
  7508 + // }
  7509 + // if (fir_act.sale > 0) {
  7510 + // more_arr.push({
  7511 + // text:'打' + fir_act.sale + '折',
  7512 + // is_fir:1
  7513 + // });
  7514 + // }
  7515 + // if (fir_act.past == 1) {
  7516 + // more_arr.push({
  7517 + // text:'包邮',
  7518 + // is_fir:1
  7519 + // });
  7520 + // }
  7521 + // if (fir_act.intValue > 0){
  7522 + // more_arr.push({
  7523 + // text:'送' + fir_act.intValue + '积分',
  7524 + // is_fir:1
  7525 + // });
  7526 + // }
  7527 + // if (fir_act.couponId > 0) {
  7528 + // more_arr.push({
  7529 + // text:'送' + fir_act.couponMoney + '元优惠券',
  7530 + // is_quan:1
  7531 + // });
  7532 + // }
  7533 + //
  7534 + // if (fir_act.gift_id) {
  7535 + // var is_more_gf = fir_act.gift_id.split(',')
  7536 + // if (is_more_gf.length > 1) {
  7537 + // more_arr.push({
  7538 + // text:'送赠品',
  7539 + // is_gift:1,
  7540 + // prom_id:fir_act.prom_id
  7541 + // });
  7542 + // } else {
  7543 + // more_arr.push({
  7544 + // text:'送' + fir_act.goods_name + ' x' + fir_act.zp_num,
  7545 + // is_gift:1,
  7546 + // prom_id:fir_act.prom_id
  7547 + // });
  7548 + // }
  7549 + // }
  7550 + // if (fir_act.lb_id){
  7551 + // more_arr.push({
  7552 + // text:'送' + fir_act.lbtitle,
  7553 + // lb_id:fir_act.lb_id
  7554 + // });
  7555 + // }
  7556 + // if (fir_act.zxlb_id){
  7557 + // more_arr.push({
  7558 + // text:'送' + fir_act.zxlbtitle,
  7559 + // zxlb_id:fir_act.zxlb_id
  7560 + // });
  7561 + // }
  7562 + // if (fir_act.monthgiftbag_id){
  7563 + // more_arr.push({
  7564 + // text:'送' + fir_act.monthgiftbag_title,
  7565 + // monthgiftbag_id:fir_act.monthgiftbag_id
  7566 + // });
  7567 + // }
  7568 + var more_arr=ut.format_yh_act(fir_act);
7642 //-- 开始组装数据 -- 7569 //-- 开始组装数据 --
7643 th.add_cx_prom_group({ 7570 th.add_cx_prom_group({
7644 id: fir_act.prom_id, 7571 id: fir_act.prom_id,
7645 condition: fir_act.condition + (fir_act.prom_type == 1 ? '件' : '元'), 7572 condition: fir_act.condition + (fir_act.prom_type == 1 ? '件' : '元'),
7646 limit: '每人' + (fir_act.limit_num ? '限参与' + fir_act.limit_num + '次' : '参与不限次'), 7573 limit: '每人' + (fir_act.limit_num ? '限参与' + fir_act.limit_num + '次' : '参与不限次'),
7647 more: more_arr, 7574 more: more_arr,
7648 - prom_type: 3  
7649 - 7575 + prom_type: 3,
  7576 + promGoodsListsDtos:r_data.promGoodsLists,
  7577 + is_yh_out_limit:is_yh_out_limit
7650 }); 7578 });
7651 - } 7579 + //}
7652 7580
7653 } 7581 }
7654 7582
@@ -7663,7 +7591,7 @@ Page({ @@ -7663,7 +7591,7 @@ Page({
7663 prom_goods: r_data.promGoodsLists, 7591 prom_goods: r_data.promGoodsLists,
7664 }) 7592 })
7665 } 7593 }
7666 - th.is_show_more_buy(); 7594 +
7667 7595
7668 } 7596 }
7669 }) 7597 })
@@ -7715,6 +7643,8 @@ Page({ @@ -7715,6 +7643,8 @@ Page({
7715 }) 7643 })
7716 } 7644 }
7717 7645
  7646 + th.is_show_more_buy();
  7647 +
7718 //-- 如果有促销活动也算是有参与活动,参与活动的也统一不进行计算起订的数量 -- 7648 //-- 如果有促销活动也算是有参与活动,参与活动的也统一不进行计算起订的数量 --
7719 this.data.is_act = 0; 7649 this.data.is_act = 0;
7720 if (this.data.zh_act || this.data.prom_goods || this.data.jieti_prom || this.data.collocationGoods) { 7650 if (this.data.zh_act || this.data.prom_goods || this.data.jieti_prom || this.data.collocationGoods) {
@@ -7784,16 +7714,22 @@ Page({ @@ -7784,16 +7714,22 @@ Page({
7784 id: 0 7714 id: 0
7785 }; 7715 };
7786 } 7716 }
  7717 +
7787 var prom = null; 7718 var prom = null;
7788 - //-- 看有没有选中的活动 --  
7789 - var fd = this.data.cx_prom_group.findIndex(function (a) {  
7790 - return a.sele == 1;  
7791 - }) 7719 + prom = JSON.parse(JSON.stringify(this.data.cx_prom_group[0]));
  7720 +
  7721 + //-- 要判断有没有超出限购 --
  7722 + if(prom.prom_type==3 && prom.is_yh_out_limit){
  7723 + if(this.data.cx_prom_group.length>1){
  7724 + prom=this.data.cx_prom_group[1];
  7725 + }else{
  7726 + prom.prom_type=0;
  7727 + prom.id=0;
  7728 + }
  7729 + }
7792 7730
7793 - prom = this.data.cx_prom_group[0];  
7794 - if (fd > -1) prom = this.data.cx_prom_group[fd];  
7795 if (ind) { 7731 if (ind) {
7796 - return prom.prom_type; 7732 + return prom.prom_type;
7797 } 7733 }
7798 return prom; 7734 return prom;
7799 }, 7735 },
@@ -7826,6 +7762,7 @@ Page({ @@ -7826,6 +7762,7 @@ Page({
7826 if (this.data.card_field && this.data.sele_g[this.data.card_field] > 0) { 7762 if (this.data.card_field && this.data.sele_g[this.data.card_field] > 0) {
7827 per_price = this.data.sele_g[this.data.card_field]; 7763 per_price = this.data.sele_g[this.data.card_field];
7828 } 7764 }
  7765 +
7829 var all_price = per_price * this.data.goodsInputNum; 7766 var all_price = per_price * this.data.goodsInputNum;
7830 var con = null; 7767 var con = null;
7831 for (var i in prom_goods) { 7768 for (var i in prom_goods) {
pages/goods/goodsInfo/goodsInfo.wxss
@@ -1642,7 +1642,8 @@ view.cart-btn-lg { @@ -1642,7 +1642,8 @@ view.cart-btn-lg {
1642 } 1642 }
1643 1643
1644 .bz_view view { 1644 .bz_view view {
1645 - max-width: 65%; 1645 + width: 520rpx;
  1646 + word-break: break-all;
1646 /* max-height: 70rpx; */ 1647 /* max-height: 70rpx; */
1647 /* overflow: hidden; */ 1648 /* overflow: hidden; */
1648 } 1649 }
@@ -3372,10 +3373,10 @@ margin: auto; */ @@ -3372,10 +3373,10 @@ margin: auto; */
3372 3373
3373 .store-list { 3374 .store-list {
3374 width: 95%; 3375 width: 95%;
3375 - min-height: 300rpx; 3376 + min-height: 700rpx;
3376 overflow-y: scroll; 3377 overflow-y: scroll;
3377 margin: auto; 3378 margin: auto;
3378 - max-height: 610rpx; 3379 + max-height: 700rpx;
3379 } 3380 }
3380 3381
3381 .store-list .store_choose { 3382 .store-list .store_choose {
@@ -3459,7 +3460,8 @@ margin: auto; */ @@ -3459,7 +3460,8 @@ margin: auto; */
3459 3460
3460 /* 门店分类列表 */ 3461 /* 门店分类列表 */
3461 .sort_store_list { 3462 .sort_store_list {
3462 - max-height: 700rpx; 3463 + max-height: 700rpx;
  3464 + min-height: 700rpx;
3463 overflow: hidden; 3465 overflow: hidden;
3464 overflow-y: scroll; 3466 overflow-y: scroll;
3465 width: 95%; 3467 width: 95%;
pages/goods/goodsList/goodsList.wxml
@@ -7,11 +7,11 @@ @@ -7,11 +7,11 @@
7 <view class="fs30 ellipsis-1" style="padding: 20rpx 30rpx"> 7 <view class="fs30 ellipsis-1" style="padding: 20rpx 30rpx">
8 满{{item.condition}}<text space="{{true}}" wx:if="{{item.prom_type==0}}">元 </text> <text space="{{true}}" wx:else>件 </text> 8 满{{item.condition}}<text space="{{true}}" wx:if="{{item.prom_type==0}}">元 </text> <text space="{{true}}" wx:else>件 </text>
9 <text space="{{true}}" wx:if="{{item.content.is_money && item.content.is_money!='0'}}">减{{item.content.money}}元 </text> 9 <text space="{{true}}" wx:if="{{item.content.is_money && item.content.is_money!='0'}}">减{{item.content.money}}元 </text>
10 - <text space="{{true}}" wx:if="{{item.content.past && item.content.past!='0'}}">包邮</text> 10 + <text space="{{true}}" wx:if="{{item.content.past && item.content.past!='0'}}">包邮 </text>
11 <text space="{{true}}" wx:if="{{item.content.is_sale && item.content.is_sale!='0'}}">打{{item.content.sale}}折 </text> 11 <text space="{{true}}" wx:if="{{item.content.is_sale && item.content.is_sale!='0'}}">打{{item.content.sale}}折 </text>
12 <text space="{{true}}" wx:if="{{item.content.is_int && item.content.is_int!='0'}}">送{{item.content.int}}积分 </text> 12 <text space="{{true}}" wx:if="{{item.content.is_int && item.content.is_int!='0'}}">送{{item.content.int}}积分 </text>
13 <text space="{{true}}" wx:if="{{item.content.is_coupon && item.content.is_coupon!='0'}}">送{{item.content.coupon}}元优惠券 </text> 13 <text space="{{true}}" wx:if="{{item.content.is_coupon && item.content.is_coupon!='0'}}">送{{item.content.coupon}}元优惠券 </text>
14 - <text space="{{true}}" wx:if="{{item.content.is_gift && item.content.is_gift!='0'}}">送{{item.content.gift_name}} </text> 14 + <text space="{{true}}" wx:if="{{item.content.is_gift && item.content.is_gift!='0'}}">送{{item.content.zp_mode==1?'多赠品':item.content.gift_name}} </text>
15 <text space="{{true}}" wx:if="{{item.content.is_libao && item.content.is_libao!='0'}}">送{{item.content.lb_name}} </text> 15 <text space="{{true}}" wx:if="{{item.content.is_libao && item.content.is_libao!='0'}}">送{{item.content.lb_name}} </text>
16 </view> 16 </view>
17 </block> 17 </block>
pages/team/team_show/team_show.js
@@ -303,7 +303,7 @@ Page({ @@ -303,7 +303,7 @@ Page({
303 user_id: user_id, 303 user_id: user_id,
304 goods_id: gd.goods_id, 304 goods_id: gd.goods_id,
305 prom_type: gd.prom_type, 305 prom_type: gd.prom_type,
306 - prom_id: gd.prom_id 306 + prom_id: gd.prom_id, isnew:1
307 307
308 }, 308 },
309 }).then(res=>{ 309 }).then(res=>{
pages/user/order_detail/order_detail.js
@@ -350,101 +350,140 @@ Page({ @@ -350,101 +350,140 @@ Page({
350 url: "/pages/team/team_confirm/team_confirm?orderSn=" + this.data.order.order_sn + "&orderPay=true" 350 url: "/pages/team/team_confirm/team_confirm?orderSn=" + this.data.order.order_sn + "&orderPay=true"
351 }) 351 })
352 var order=this.data.order; 352 var order=this.data.order;
  353 +
353 var order_goods=order.order_goods; 354 var order_goods=order.order_goods;
354 var user_id=order.user_id; 355 var user_id=order.user_id;
355 -  
356 - var wlist="";  
357 - for(var i in order_goods){  
358 - var good=order_goods[i];  
359 - //线下取价功能已经关闭或者过期  
360 - if(!th.data.is_open_offline && good.offline_cut>0){  
361 - wx.showModal({  
362 - title: '提示',  
363 - content: '线下取价功能已经关闭或者过期!'  
364 - });  
365 - th.setData({paying:0});  
366 - return false;  
367 - }  
368 -  
369 - //要每件每件的商品进行检查,看有么有超出库存,超出限购  
370 - var good= order_goods[i],goodsbuynum=0,promgoodsbuynum=0,gg=null;  
371 - //获取单品的现在的活动状态  
372 - await getApp().request.promiseGet("/api/weshop/goods/get/" + os.stoid + "/" + good.goods_id, {  
373 - }).then(res=>{  
374 - gg=res.data.data;  
375 - })  
376 - var limit = gg.viplimited;  
377 - var store_count = gg.store_count;  
378 - good.erpwareid=gg.erpwareid;  
379 -  
380 - //---要获得商品,该用户买了多少件,同步应用---  
381 - await getApp().request.promiseGet("/api/weshop/ordergoods/getUserBuyGoodsNum", {  
382 - data: {  
383 - store_id: os.stoid,  
384 - user_id: getApp().globalData.user_id,  
385 - goods_id: good.goods_id,  
386 - prom_type: good.prom_type,  
387 - prom_id: good.prom_id  
388 - },  
389 - }).then(res => {  
390 - var buy_num_data = res.data.data;  
391 - if (buy_num_data.promgoodsbuynum) promgoodsbuynum = buy_num_data.promgoodsbuynum;  
392 - goodsbuynum = buy_num_data.goodsbuynum;  
393 - })  
394 -  
395 - var buyed_mum2=goodsbuynum+good.goods_num;  
396 - if (buyed_mum2 > limit && limit > 0) {  
397 -  
398 - var content=gg.goods_name+'购买数量超出商品限购,请取消订单';  
399 - th.toast(content);  
400 - th.setData({paying:0});  
401 - return false;  
402 - } 356 +
  357 +
  358 + //如果使用预存的话,要重新效验下预存金额是否足够
  359 + if(order.pre_cut && order.pre_json){
  360 + let pickup_id=order.pickup_id
  361 + let res = await r.promiseGet('/api/weshop/pickup/get/' + os.stoid + '/' + pickup_id, {})
  362 + let keyid = res.data.data.keyid
  363 + let resdata = await th.vipadvancesum(keyid,order.pre_cut,order.pre_json)
  364 + if(resdata.code !=0){
  365 + let msg=resdata.msg || "预存金额不足"
  366 + getApp().confirmBox(msg);
  367 + th.setData({ paying: 0 });
  368 + return false;
  369 + }
  370 + }
  371 + // 幸运购检查库存量 api/weshop/activitylist/getActLen/{store_id}/{prom_type}/{prom_id}
  372 + if (parseInt(order_goods['0']['prom_type']) == 9) {
  373 + var aid = order_goods['0']['prom_id'];
  374 + var knum = 0;
  375 + await r.promiseGet('/api/weshop/activitylist/getActLen/' + os.stoid + '/9/' + aid, {
  376 + }).then(res => {
  377 + if (res.data.code == 0) {
  378 + knum = res.data.data;
  379 + }
  380 + });
  381 +
  382 + if (knum <= 0) {
  383 + getApp().confirmBox("库存为0,支付失败");
  384 + th.setData({ paying: 0 });
  385 + return false;
  386 + }
  387 +
  388 + }
  389 +
  390 + var wlist = "";
  391 + for (var i in order_goods) {
  392 + var good = order_goods[i];
  393 +
  394 +
  395 + //线下取价功能已经关闭或者过期
  396 + if (!th.data.is_open_offline && good.offline_cut > 0) {
  397 + wx.showModal({
  398 + title: '提示',
  399 + content: '线下取价功能已经关闭或者过期!'
  400 + });
  401 + th.setData({ paying: 0 });
  402 + return false;
  403 + }
  404 +
  405 + //要每件每件的商品进行检查,看有么有超出库存,超出限购
  406 + var good = order_goods[i], goodsbuynum = 0, promgoodsbuynum = 0, gg = null, presellList = null;
  407 +
  408 + //获取单品的现在的活动状态
  409 + await getApp().request.promiseGet("/api/weshop/goods/get/" + os.stoid + "/" + good.goods_id, {}).then(res => {
  410 + gg = res.data.data;
  411 + })
  412 +
  413 + var limit = gg.viplimited;
  414 + var store_count = gg.store_count;
  415 + good.erpwareid = gg.erpwareid;
  416 +
  417 + //---要获得商品,该用户买了多少件,同步应用---
  418 + await getApp().request.promiseGet("/api/weshop/ordergoods/getUserBuyGoodsNum", {
  419 + data: {
  420 + store_id: os.stoid,
  421 + user_id: user_id,
  422 + goods_id: good.goods_id,
  423 + prom_type: good.prom_type,
  424 + prom_id: good.prom_id
  425 + },
  426 + }).then(res => {
  427 + var buy_num_data = res.data.data;
  428 + if (buy_num_data.promgoodsbuynum) promgoodsbuynum = buy_num_data.promgoodsbuynum;
  429 + goodsbuynum = buy_num_data.goodsbuynum;
  430 + })
  431 +
  432 + var buyed_mum2 = goodsbuynum + good.goods_num;
  433 + if (buyed_mum2 > limit && limit > 0) {
  434 + var content = gg.goods_name + '购买数量超出商品限购,请取消订单';
  435 + th.toast(content);
  436 + th.setData({ paying: 0 });
  437 + return false;
  438 + }
  439 +
403 //当是组合优惠的时候 440 //当是组合优惠的时候
404 - if(good.prom_type==7){ 441 + if (good.prom_type == 7) {
405 //如果有组合购 442 //如果有组合购
406 var isok = 1; 443 var isok = 1;
  444 + var url = "/api/weshop/prom/zhbuy/get/" + os.stoid + "/" + good.prom_id + "/" + getApp().globalData.userInfo.user_id;
407 let zh_buy_info=null 445 let zh_buy_info=null
408 - var url="/api/weshop/prom/zhbuy/get/"+os.stoid+"/"+good.prom_id+"/"+getApp().globalData.userInfo.user_id;  
409 await getApp().request.promiseGet(url, {}).then(res => { 446 await getApp().request.promiseGet(url, {}).then(res => {
410 - if(res.data.code==0 && res.data.data){  
411 - zh_buy_info = res.data.data  
412 - if(res.data.data.is_show!=1){  
413 - isok=0; 447 + if (res.data.code == 0 && res.data.data) {
  448 + zh_buy_info = res.data.data
  449 + if (res.data.data.is_show != 1) {
  450 + isok = 0;
414 } 451 }
415 //如果活动已经结束 452 //如果活动已经结束
416 - if(res.data.data.is_end==1){  
417 - isok=0; 453 + if (res.data.data.is_end == 1) {
  454 + isok = 0;
418 } 455 }
419 //已经结束 456 //已经结束
420 - if(ut.gettimestamp()>res.data.data.end_time){  
421 - isok=0; 457 + if (ut.gettimestamp() > res.data.data.end_time) {
  458 + isok = 0;
422 } 459 }
423 //还未开始 460 //还未开始
424 - if(ut.gettimestamp()<res.data.data.start_time){  
425 - isok=0; 461 + if (ut.gettimestamp() < res.data.data.start_time) {
  462 + isok = 0;
426 } 463 }
427 464
428 - }else{ 465 +
  466 + } else {
429 //未找到商品的活动 467 //未找到商品的活动
430 isok = 0; 468 isok = 0;
431 } 469 }
432 470
433 }) 471 })
434 - if (!isok){  
435 - var content=gg.goods_name+'活动已经结束,请取消订单'; 472 + if (!isok) {
  473 + var content = gg.goods_name + '活动已经结束,请取消订单';
436 th.toast(content); 474 th.toast(content);
437 - th.setData({paying:0});  
438 - return false; 475 + th.setData({ paying: 0 });
  476 + return false;
439 } 477 }
440 478
441 //增加组合购次数判断 479 //增加组合购次数判断
442 - let userbuynum = await th.getUserBuyPromNum(good.prom_id) 480 + let userbuynum = await th.getUserBuyPromNum(good.prom_id,1)
  481 +
443 if (zh_buy_info.buy_limit !=0 && zh_buy_info && userbuynum >= zh_buy_info.buy_limit) { 482 if (zh_buy_info.buy_limit !=0 && zh_buy_info && userbuynum >= zh_buy_info.buy_limit) {
444 - var content = gg.goods_name + '超出组合购限购次数,请取消订单';  
445 - th.toast(content);  
446 - th.setData({ paying: 0 });  
447 - return false; 483 + var content = gg.goods_name + '超出组合购限购次数,请取消订单';
  484 + th.toast(content);
  485 + th.setData({ paying: 0 });
  486 + return false;
448 } 487 }
449 488
450 var url1 = "/api/weshop/prom/zhbuyGoods/page"; 489 var url1 = "/api/weshop/prom/zhbuyGoods/page";
@@ -453,380 +492,611 @@ Page({ @@ -453,380 +492,611 @@ Page({
453 pageSize: 1, 492 pageSize: 1,
454 store_id: os.stoid, 493 store_id: os.stoid,
455 zh_id: good.prom_id, 494 zh_id: good.prom_id,
456 - goods_id:good.goods_id 495 + goods_id: good.goods_id
457 } 496 }
458 await getApp().request.promiseGet(url1, { 497 await getApp().request.promiseGet(url1, {
459 data: req_data 498 data: req_data
460 }).then(res => { 499 }).then(res => {
461 if (ut.ajax_ok(res)) { 500 if (ut.ajax_ok(res)) {
462 var gdlist = res.data.data.pageData[0]; 501 var gdlist = res.data.data.pageData[0];
463 - good.buyqty=gdlist.buyqty; 502 + good.buyqty = gdlist.buyqty;
464 } 503 }
465 }) 504 })
466 505
467 - var num=good['buyqty'];  
468 - console.log(1111);  
469 - console.log(num); 506 + var num = good['buyqty'];
470 //---- 要计算商品的限购 ----- 507 //---- 要计算商品的限购 -----
471 - if(good['buyqty']>0){  
472 - if(good.goods_num+promgoodsbuynum>good['buyqty']){ 508 + if (good['buyqty'] > 0) {
  509 + if (good.goods_num + promgoodsbuynum > good['buyqty']) {
  510 + var content = good['goods_name'] + "超出活动限购\n";
  511 + th.toast(content);
  512 + th.setData({ paying: 0 });
  513 + return false;
  514 + }
  515 + }
  516 + }
  517 + //如果是预售的时候,
  518 + if (good.prom_type == 8) {
  519 + await getApp().request.promiseGet("/api/weshop/order/orderPresell/countBuyGoodsSum", {
  520 + data: { store_id: os.stoid, user_id: user_id, goods_id: good.goods_id, prom_id: good.prom_id },
  521 + }).then(e => {
  522 + if (e.data.code == 0) {
  523 + promgoodsbuynum = e.data.data.sumgoodsnum;
  524 + }
  525 + })
  526 +
  527 + var presell_id = good.prom_id;
  528 + var url = "/api/weshop/marketing/marketingPresellList/list"
  529 + var rd = {
  530 + store_id: os.stoid,
  531 + presell_id: presell_id,
  532 + goods_id: good.goods_id
  533 + }
  534 + //------获取预售从表----------
  535 + await getApp().request.promiseGet(url, {
  536 + data: rd
  537 + }).then(res => {
  538 + if (res.data.code == 0 && res.data.data && res.data.data.length > 0) {
  539 + var arr = res.data.data[0];
  540 + presellList = arr
  541 + }
  542 + })
473 543
474 - var content= good['goods_name']+"超出活动限购\n"; 544 + if (presellList) {
  545 +
  546 + if (good.goods_num > presellList.presell_sumqty - presellList.buy_goodnum) {
  547 + var content = good.goods_name + '购买数量超出商品库存,请取消订单';
  548 + th.toast(content);
  549 + th.setData({ paying: 0 });
  550 + return false;
  551 + }
  552 + var buyed_mum3 = promgoodsbuynum + good.goods_num;
  553 + if (buyed_mum3 > presellList.vip_butyqty && presellList.vip_butyqty > 0) {
  554 + var content = good.goods_name + '购买数量超出商品限购,请取消订单';
475 th.toast(content); 555 th.toast(content);
476 - th.setData({paying:0}); 556 + th.setData({ paying: 0 });
477 return false; 557 return false;
478 } 558 }
  559 +
479 } 560 }
480 } 561 }
481 562
482 //如果优惠促销和搭配购的时候 563 //如果优惠促销和搭配购的时候
483 - if((good.prom_type==3 || good.prom_type==5) && good.is_collocation!=1 && good.is_gift!=1){  
484 - var p_ok = 1,is_g_prom=0;  
485 - //因为有全场优惠活动,商品参加的活动还未开始  
486 - var url="/api/weshop/activitylist/getGoodActInfo";  
487 - var req_data={  
488 - store_id:os.stoid,goodsidlist:good.goods_id,is_detail:1,user_id:user_id  
489 - };  
490 - await getApp().request.promiseGet(url, {data:req_data}).then(async function (res) {  
491 - if(res.data.code==0 && res.data.data && res.data.data.length){  
492 - for(let i in res.data.data){  
493 - let item=res.data.data[i];  
494 - if(item.prom_type==3 || item.prom_type==5) {  
495 - is_g_prom=1; break;  
496 - } 564 + if ((good.prom_type == 3 || good.prom_type == 5 || good.prom_type == 10) && good.is_gift != 1 && good.is_collocation != 1) {
  565 + var p_ok = 1, is_g_prom = 0;
  566 + //只读优化促销和阶梯促销
  567 + await getApp().request.promiseGet("/api/weshop/goods/getGoodsPromListNew1/" + os.stoid + "/" + good.goods_id+"/0/"+user_id, {}).then(res => {
  568 + if (res.data.code == 0) {
  569 + var r_data = res.data.data;
  570 + if (!r_data.collocationPromList && good.prom_type == 5) {
  571 + var content = good.goods_name + '未找到活动,请取消订单重新购买';
  572 + th.toast(content)
  573 + p_ok = 0;
497 } 574 }
  575 + if (!r_data.promGoodsLists && good.prom_type == 3) {
  576 + var content = good.goods_name + '未找到活动,请取消订单重新购买';
  577 + th.toast(content);
  578 + p_ok = 0;
  579 + }
  580 + if (!r_data.ladderLists && good.prom_type == 10) {
  581 + var content = good.goods_name + '未找到活动,请取消订单重新购买';
  582 + th.toast(content);
  583 + p_ok = 0;
  584 + }
  585 + } else {
  586 +
  587 + var content = good.goods_name + '未找到活动,请取消订单重新购买'
  588 + th.toast(content);
  589 + p_ok = 0;
498 } 590 }
499 }) 591 })
500 - if(is_g_prom){  
501 - await getApp().request.promiseGet("/api/weshop/goods/getGoodsPromList/" + os.stoid + "/" + good.goods_id + "/0"+"/"+getApp().globalData.user_id, {}).then(res => {  
502 - if (res.data.code == 0) {  
503 - var r_data = res.data.data;  
504 - if (!r_data.collocationPromList && good.prom_type == 5) {  
505 -  
506 - var content = good.goods_name + '未找到活动,请取消订单重新购买';  
507 - th.toast(content)  
508 - p_ok = 0;  
509 - }  
510 - if (!r_data.promGoodsLists && good.prom_type == 3) { 592 + if (!p_ok) {
  593 + th.setData({ paying: 0 });
  594 + return false;
  595 + }
  596 + }
511 597
512 - var content = good.goods_name + '未找到活动,请取消订单重新购买';  
513 - th.toast(content);  
514 - p_ok = 0;  
515 - }  
516 - } else { 598 + //-- 商品的普通购买 ,不要进行判断 --
  599 + if ((good.prom_type == 1 || good.prom_type == 2 || good.prom_type == 6 || good.prom_type == 4 || good.prom_type == 8 || good.prom_type == 9)
  600 + && !good.is_gift && !good.is_collocation && !good.is_integral_normal && !good.is_pd_normal) {
517 601
518 - var content = good.goods_name + '未找到活动,请取消订单重新购买'  
519 - th.toast(content);  
520 - th.setData({paying:0});  
521 - p_ok = 0; 602 + } else {
  603 +
  604 + //因为商品的prom_type=0,所以商品的实际活动要重新获取
  605 + var url = '/api/weshop/activitylist/listGoodActInfo2New';
  606 + var req_d = {
  607 + "store_id": os.stoid,
  608 + "goods_id": good.goods_id,
  609 + "user_id": user_id,
  610 + }
  611 + await getApp().request.promiseGet(url, {
  612 + data: req_d
  613 + }).then(res => {
  614 + if (res.data.code == 0 && res.data.data) {
  615 + var arr = res.data.data;
  616 + //-- 预热也要计算 --
  617 + var arr2 = arr.filter(function (e) {
  618 + return e.s_time < ut.gettimestamp() || (e.warm_uptime && e.warm_uptime < ut.gettimestamp())
  619 + })
  620 + if (arr2.length == 1) {
  621 + gg.prom_type=arr2[0].prom_type;
  622 + gg.prom_id=arr2[0].act_id;
522 } 623 }
523 - })  
524 - }else{  
525 - await getApp().request.promiseGet("/api/weshop/goods/getGoodsPromNormal/" + os.stoid + "/" + good.goods_id, {}).then(res => {  
526 - if (res.data.code == 0) {  
527 - var r_data = res.data.data;  
528 - if (!r_data.collocationPromList && good.prom_type == 5) { 624 + }
  625 + })
529 626
530 - var content = good.goods_name + '未找到活动,请取消订单重新购买';  
531 - th.toast(content)  
532 627
533 - p_ok = 0; 628 + if ((gg.prom_type == 1 || gg.prom_type == 2 || gg.prom_type == 4 || gg.prom_type == 6 || gg.prom_type == 8 || gg.prom_type == 9)
  629 + && !good.is_collocation && !good.is_gift && !good.is_integral_normal && !good.is_pd_normal) {
  630 + var prom = null;
  631 + //---如果是活动的时候---
  632 + var prom = null, th = this;
  633 + if (gg.prom_type == 1) {
  634 + await getApp().request.promiseGet("/api/ms/flash_sale/getNew/" + os.stoid + "/" + user_id + "/" + gg.prom_id, {}).then(res => {
  635 + if (res.data.code == 0) {
  636 + prom = res.data.data;
  637 + prom.price = prom.user_price;
534 } 638 }
535 - if (!r_data.promGoodsLists && good.prom_type == 3) {  
536 -  
537 - var content = good.goods_name + '未找到活动,请取消订单重新购买';  
538 - th.toast(content);  
539 - p_ok = 0; 639 + })
  640 + }
  641 + if (gg.prom_type == 2) {
  642 + await getApp().request.promiseGet("/api/weshop/goods/groupBuy/getActInfo/" + os.stoid + "/" + gg.goods_id + "/" + gg.prom_id, {}).then(res => {
  643 + if (res.data.code == 0) {
  644 + prom = res.data.data;
  645 + prom.price = prom.price;
  646 + }
  647 + })
  648 + }
  649 + if (gg.prom_type == 6) {
  650 + await getApp().request.promiseGet("/api/weshop/teamlist/get/" + os.stoid + "/" + gg.prom_id, {}).then(res => {
  651 + if (res.data.code == 0) {
  652 + prom = res.data.data;
  653 + }
  654 + })
  655 + }
  656 + if (gg.prom_type == 4) {
  657 + await getApp().request.promiseGet("/api/weshop/integralbuy/pageIntegralBuyGoodsList?stype=1&stypeup=1&timetype=2", {
  658 + data: { store_id: os.stoid, goods_id: gg.goods_id,user_id: getApp().globalData.user_id, }
  659 + }).then(res => {
  660 + if (res.data.code == 0 && res.data.data && res.data.data.pageData) {
  661 + prom = res.data.data.pageData[0];
540 } 662 }
541 - } else { 663 + })
  664 + }
  665 + if (prom) {
  666 + var t_now = ut.gettimestamp();
  667 + if (prom.is_end == 0 && prom.start_time < t_now && prom.end_time > t_now) {
542 668
543 - var content = good.goods_name + '未找到活动,请取消订单重新购买' 669 + var content = gg.goods_name + '商品的活动发生了变化,请取消订单重新购买';
544 th.toast(content); 670 th.toast(content);
545 - p_ok = 0; 671 + th.setData({ paying: 0 });
  672 + return false;
546 } 673 }
  674 + }
  675 +
  676 + //-- 幸运购的时候 --
  677 + if(gg.prom_type==8 || gg.prom_type==9){
  678 + var content = gg.goods_name + '商品的活动发生了变化,请取消订单重新购买';
  679 + th.toast(content);
  680 + th.setData({ paying: 0 });
  681 + return false;
  682 + }
  683 +
  684 + }
  685 + else {
  686 + var t_ok = 1;
  687 + //-- 如果是普通购买的时候,此时计算的一定是商品的prom_type==0了, (组合购在普通购买的时候,就不判断了,因为组合购本身就可以普通购买)---
  688 + if(!good.is_collocation && !good.is_gift && good.is_pd_normal!=2 && gg.prom_type!=7 ){
  689 +
  690 + var promgoodsbuynum0=0;
  691 + //---要获得商品,该用户买了多少件,同步应用---
  692 + await getApp().request.promiseGet("/api/weshop/ordergoods/getUserBuyGoodsNum", {
  693 + data: {
  694 + store_id: os.stoid,
  695 + user_id: user_id,
  696 + goods_id: good.goods_id,
  697 + prom_type: gg.prom_type,
  698 + prom_id: gg.prom_id
  699 + },
  700 + }).then(res => {
  701 + var buy_num_data = res.data.data;
  702 + if (buy_num_data.promgoodsbuynum) promgoodsbuynum = buy_num_data.promgoodsbuynum;
  703 + })
  704 +
  705 +
  706 + if(good.prom_type != gg.prom_type && good.prom_id != gg.prom_id){
  707 + //如果商品有单独的活动的是偶
  708 + switch (gg.prom_type){
  709 + case 5:
  710 + case 10:
  711 + var content = gg.goods_name + '商品的活动发生了变化,请取消订单重新购买';
  712 + th.toast(content);
  713 + t_ok = 0;
  714 + break;
  715 + //-- 优惠促销是有限购的 --
  716 + case 3:
  717 + var prom=null;
  718 + var yh_check=1;
  719 + await getApp().request.promiseGet("/api/weshop/promgoods/get/" + os.stoid + "/" + gg.prom_id, {}).then(res => {
  720 + if (res.data.code == 0) { prom = res.data.data; }
  721 + })
  722 + if (prom && prom.limit_num) {
  723 + var limit_num = prom.limit_num;
  724 + var user_pre_buynum = await this.getUserBuyPromNum_pre(prom.id)
  725 + if (limit_num>0 && user_pre_buynum >= limit_num) {
  726 + yh_check=0;
  727 + }
  728 + }
  729 + //-- 优惠促销活动没有超出限购的话 --
  730 + if(yh_check){
  731 + var content = gg.goods_name + '商品的活动发生了变化,请取消订单重新购买';
  732 + th.toast(content);
  733 + t_ok = 0;
  734 + break;
  735 + }
  736 +
  737 + break
  738 + case 7:
  739 + //获取组合购活动
  740 + var url = "/api/weshop/prom/zhbuy/get/" + os.stoid + "/" + gg.prom_id + "/" + getApp().globalData.userInfo.user_id;
  741 + let zh_buy_info=null
  742 + await getApp().request.promiseGet(url, {}).then(res => {
  743 + if (res.data.code == 0 && res.data.data) {
  744 + zh_buy_info = res.data.data
  745 + }
  746 + })
  747 + //判断活动超出限购
  748 + var is_act_ok=1;
  749 + let userbuynum = await th.getUserBuyPromNum(gg.prom_id)
  750 + if (zh_buy_info.buy_limit !=0 && zh_buy_info && userbuynum >= zh_buy_info.buy_limit) {
  751 + is_act_ok=0;
  752 + }
  753 +
  754 + //判断活动商品超出限购,在从表
  755 + var url1 = "/api/weshop/prom/zhbuyGoods/page";
  756 + var req_data = {
  757 + page: 1,
  758 + pageSize: 1,
  759 + store_id: os.stoid,
  760 + zh_id: gg.prom_id,
  761 + goods_id: gg.goods_id
  762 + }
  763 + await getApp().request.promiseGet(url1, {
  764 + data: req_data
  765 + }).then(res => {
  766 + if (ut.ajax_ok(res)) {
  767 + var gdlist = res.data.data.pageData[0];
  768 + gg.buyqty = gdlist.buyqty;
  769 + }
  770 + })
  771 + var num = gg['buyqty'];
  772 + //---- 要计算商品的限购 -----
  773 + if (gg['buyqty'] > 0) {
  774 + if (gg.goods_num + promgoodsbuynum0 > gg['buyqty']) {
  775 + is_act_ok=0;
  776 + }
  777 + }
  778 + if(is_act_ok){
  779 + var content = gg.goods_name + '商品的活动发生了变化,请取消订单重新购买';
  780 + th.toast(content);
  781 + t_ok = 0;
  782 + break;
  783 + }
  784 + }
  785 + }
  786 + }
  787 + //-- 判断活动是不是OK --
  788 + if (!t_ok) {
  789 + th.setData({ paying: 0 }); return false;
  790 + }
  791 +
  792 + // if (!good.is_gift && good.prom_type != 3) {
  793 + // var t_ok = 1;
  794 + // await getApp().request.promiseGet("/api/weshop/goods/getGoodsPromList/" + os.stoid + "/" + good.goods_id + "/0" + "/" + getApp().globalData.user_id, {}).then(res => {
  795 + // if (res.data.code == 0) {
  796 + // var r_data = res.data.data;
  797 + // //-- 参加了全局的优惠活动 --
  798 + // if (r_data.promGoodsLists) {
  799 + // var content = gg.goods_name + '商品的活动发生了变化,请取消订单重新购买';
  800 + // th.toast(content);
  801 + // t_ok = 0;
  802 + // }
  803 + // }
  804 + // })
  805 + // if (!t_ok) {
  806 + // th.setData({ paying: 0 }); return false;
  807 + // }
  808 + // }
  809 + //-- 如果有参加线下取价 --
  810 + if (good.offline_cut > 0) wlist += encodeURIComponent(gg.erpwareid) + ",";
  811 + }
  812 + //赠品和搭配购不判断商品金额
  813 + var isok = 1;
  814 + var card_field = th.data.card_field;
  815 +
  816 + //-- 如果会员是等级会员,商品有等级价,且不是活动商品,同时线下取价的要放在最后来判断 --
  817 + if (!good.is_gift && !good.is_collocation && gg.prom_type != 9) {
  818 + if (card_field && gg[card_field] > 0) {
  819 + if (good.goods_price != gg[card_field] && good.offline_cut <= 0) isok = 0;
  820 + if (good.goods_price > gg[card_field] && good.offline_cut > 0) isok = 0; //如果线下价格比较贵,则不通过
  821 +
  822 + } else {
  823 + if (good.goods_price != gg.shop_price && good.offline_cut <= 0) isok = 0;
  824 + if (good.goods_price > gg.shop_price && good.offline_cut > 0) isok = 0; //如果线下价格比较贵,则不通过
  825 + }
  826 + var is_h = 0;
  827 + if (!isok) {
  828 +
  829 + var content = gg.goods_name + '商品的价格发生了变化,请取消订单重新购买1'
  830 + th.toast(content);
  831 + th.setData({ paying: 0 });
  832 + return false;
  833 + }
  834 + }
  835 +
  836 + //--如果是线下库存的时候--
  837 + if (th.data.conf.sales_rules >= 2 && !gg.whsle_id) {
  838 + var ob = {};
  839 + await th.check_down_line_next(gg, good.goods_num, order.pickup_id, function (obj) {
  840 + ob = obj;
547 }) 841 })
  842 + if (ob.code == -1) {
  843 + var content = gg.goods_name + '门店库存不足,请取消订单';
  844 + th.toast(content);
  845 + th.setData({ paying: 0 });
  846 + return false;
  847 + }
  848 +
  849 + } else {
  850 + if (good.goods_num > store_count) {
  851 +
  852 + var content = gg.goods_name + '商品的库存不足,请取消订单';
  853 + th.toast(content);
  854 + th.setData({ paying: 0 });
  855 + return false;
  856 + }
548 857
549 } 858 }
550 - if (!p_ok){  
551 - th.setData({paying:0});return false; 859 + }
  860 +
  861 + //---如果是活动的时候---
  862 + var prom = null, goodsinfo = good, th = this;
  863 + if (goodsinfo.prom_type == 1) {
  864 + await getApp().request.promiseGet("/api/ms/flash_sale/getNew/" + os.stoid + "/" + user_id + "/" + goodsinfo.prom_id, {}).then(res => {
  865 + if (res.data.code == 0) {
  866 + prom = res.data.data;
  867 + prom.price = prom.user_price;
  868 + }
  869 + })
  870 + }
  871 + if (goodsinfo.prom_type == 2) {
  872 + await getApp().request.promiseGet("/api/weshop/goods/groupBuy/getActInfo/" + os.stoid + "/" + good.goods_id + "/" + goodsinfo.prom_id, {}).then(res => {
  873 + if (res.data.code == 0) {
  874 + prom = res.data.data;
  875 + prom.price = prom.price;
  876 + }
  877 + })
  878 + }
  879 +
  880 + if (goodsinfo.prom_type == 6 && !good.is_pd_normal) {
  881 + await getApp().request.promiseGet("/api/weshop/teamlist/get/" + os.stoid + "/" + goodsinfo.prom_id, {}).then(res => {
  882 + if (res.data.code == 0) {
  883 + prom = res.data.data;
  884 + }
  885 + })
  886 + }
  887 +
  888 + if (goodsinfo.prom_type == 4 && !good.is_integral_normal) {
  889 + await getApp().request.promiseGet("/api/weshop/integralbuy/pageIntegralBuyGoodsList?stype=1&stypeup=1&timetype=2", {
  890 + data: { store_id: os.stoid, goods_id: goodsinfo.goods_id,user_id: getApp().globalData.user_id, }
  891 + }).then(res => {
  892 + if (res.data.code == 0 && res.data.data && res.data.data.pageData) {
  893 + prom = res.data.data.pageData[0];
  894 + }
  895 + })
  896 + }
  897 + //----------如果有活动,并且在进行中,就不计算线下库存---------------
  898 + if (prom) {
  899 + var now = ut.gettimestamp();
  900 + if (prom.is_end == 1 && prom.end_time < now) {
  901 + var content = goodsinfo.goods_name + '商品的活动已经结束,请取消订单'
  902 + th.toast(content);
  903 + th.setData({ paying: 0 });
  904 + return false;
552 } 905 }
553 - }  
554 906
  907 + buyed_mum2 = promgoodsbuynum + good.goods_num;
  908 + if (buyed_mum2 > prom.buy_limit && prom.buy_limit > 0) {
555 909
556 - //商品的普通购买 ,不要进行判断  
557 - if((good.prom_type==1 || good.prom_type==2 || good.prom_type==6 || good.prom_type==4) && !good.is_gift && !good.is_collocation && !good.is_integral_normal && !good.is_pd_normal){ 910 + var content = goodsinfo.goods_name + '购买数量超出商品活动限购,请取消订单'
  911 + th.toast(content);
  912 + th.setData({ paying: 0 });
  913 + return false;
  914 + }
558 915
559 - }else{  
560 - if((gg.prom_type==1 || gg.prom_type==3 || gg.prom_type==5 || gg.prom_type==6 || gg.prom_type==4)  
561 - && !good.is_collocation && !good.is_gift && !good.is_integral_normal && !good.is_pd_normal) {  
562 - var prom=null;  
563 - //---如果是活动的时候---  
564 - var prom=null,th=this;  
565 - if(gg.prom_type==1){  
566 - await getApp().request.promiseGet("/api/ms/flash_sale/getNew/"+os.stoid+"/"+user_id+"/"+gg.prom_id,{  
567 - }).then(res=>{  
568 - if(res.data.code==0){  
569 - prom=res.data.data;  
570 - prom.price=prom.user_price;  
571 - }  
572 - })  
573 - }  
574 -  
575 - if (gg.prom_type == 2) {  
576 - await getApp().request.promiseGet("/api/weshop/goods/groupBuy/getActInfo/" + os.stoid + "/"+ gg.goods_id + "/" + gg.prom_id, {}).then(res => {  
577 - if (res.data.code == 0) {  
578 - prom = res.data.data;  
579 - prom.price=prom.price;  
580 - }  
581 - })  
582 - }  
583 -  
584 -  
585 - if(gg.prom_type==6){  
586 - await getApp().request.promiseGet("/api/weshop/teamlist/get/"+os.stoid+"/"+gg.prom_id,{  
587 - }).then(res=>{  
588 - if(res.data.code==0){  
589 - prom=res.data.data;  
590 - }  
591 - })  
592 - }  
593 -  
594 - if(gg.prom_type==4){  
595 - await getApp().request.promiseGet("/api/weshop/integralbuy/pageIntegralBuyGoodsList?stype=1&stypeup=1&timetype=2",{  
596 - data:{store_id:os.stoid,goods_id:gg.goods_id,user_id: getApp().globalData.user_id,}  
597 - }).then(res=>{  
598 - if(res.data.code==0 && res.data.data && res.data.data.pageData && res.data.data.pageData.length){  
599 - prom=res.data.data.pageData[0];  
600 - }  
601 - })  
602 - }  
603 -  
604 - if(prom){  
605 - var t_now=ut.gettimestamp();  
606 - if(prom.is_end==0 && prom.start_time<t_now && prom.end_time>t_now){  
607 -  
608 - var content=gg.goods_name+'商品的活动发生了变化,请取消订单重新购买';  
609 - th.toast(content);  
610 - th.setData({paying:0});  
611 - return false;  
612 - }  
613 - }  
614 - }else{  
615 - //不是赠品的时候  
616 - if(!good.is_gift && good.prom_type!=3 && !good.is_collocation ){  
617 - var t_ok=1;  
618 - await getApp().request.promiseGet("/api/weshop/goods/getGoodsPromList/" + os.stoid+"/"+good.goods_id+"/0"+"/"+getApp().globalData.user_id, {}).then(res => {  
619 - if(res.data.code==0){  
620 - var r_data=res.data.data;  
621 - //-- 参加了全局的优惠活动 --  
622 - if(r_data.promGoodsLists){  
623 -  
624 - var content=gg.goods_name+'商品的活动发生了变化,请取消订单重新购买';  
625 - th.toast(content);  
626 - t_ok=0;  
627 - }  
628 - }  
629 - })  
630 - if(!t_ok) {  
631 - th.setData({paying:0});return false;  
632 - }  
633 - } 916 + // --看一下会员的秒杀价格是不是发生了变化,因为会员的身份发生了变化
  917 + if (goodsinfo.prom_type == 1 && goodsinfo.goods_price != prom.price) {
  918 + var content = goodsinfo.goods_name + '秒杀活动的价格发生了变化';
  919 + th.toast(content);
  920 + th.setData({ paying: 0 });
  921 + return false;
  922 + }
634 923
635 - //-- 如果有参加线下取价 --  
636 - if(good.offline_cut>0) wlist+=encodeURIComponent(gg.erpwareid)+",";  
637 - }  
638 - //赠品和搭配购不判断商品金额  
639 - var isok=1;  
640 - var card_field=th.data.card_field; // 会员等级  
641 - //如果会员是等级会员,商品有等级价,且不是活动商品  
642 - if(!good.is_gift && !good.is_collocation) {  
643 - if (card_field && gg[card_field] > 0) {  
644 - if (good.goods_price != gg[card_field] && good.offline_cut<=0) isok = 0;  
645 - if (good.goods_price >gg[card_field] && good.offline_cut>0) isok = 0; //如果线下价格比较贵,则不通过  
646 -  
647 - } else {  
648 - if (good.goods_price != gg.shop_price && good.offline_cut<=0) isok = 0;  
649 - if (good.goods_price> gg.shop_price && good.offline_cut>0) isok = 0; //如果线下价格比较贵,则不通过  
650 - }  
651 - var is_h=0;  
652 - if (!isok) {  
653 -  
654 - var content=gg.goods_name + '商品的价格发生了变化,请取消订单重新购买22';  
655 - th.toast(content);  
656 - th.setData({paying:0});  
657 - return false;  
658 - }  
659 - }  
660 -  
661 - //--如果是线下库存的时候--  
662 - if(th.data.conf.sales_rules>=2 && !gg.whsle_id){  
663 - var ob={};  
664 - await th.check_down_line_next(gg,good.goods_num,order.pickup_id,function(obj){  
665 - ob=obj;  
666 - })  
667 - if(ob.code==-1){  
668 - var content=gg.goods_name+'门店库存不足,请取消订单';  
669 - th.toast(content);  
670 - th.setData({paying:0});  
671 - return false;  
672 - }  
673 -  
674 - }else{  
675 - if(good.goods_num>store_count){  
676 -  
677 - var content=gg.goods_name+'商品的库存不足,请取消订单';  
678 - th.toast(content);  
679 - th.setData({paying:0});  
680 - return false;  
681 - }  
682 -  
683 - }  
684 - }  
685 -  
686 - console.log("------------------------------------");  
687 - //---如果是活动的时候---  
688 - var prom=null,goodsinfo=good,th=this;  
689 - if(goodsinfo.prom_type==1){  
690 - await getApp().request.promiseGet("/api/ms/flash_sale/getNew/"+os.stoid+"/"+user_id+"/"+goodsinfo.prom_id,{  
691 - }).then(res=>{  
692 - if(res.data.code==0){  
693 - prom=res.data.data;  
694 - prom.price=prom.user_price;  
695 - }  
696 - })  
697 - }  
698 -  
699 - if (goodsinfo.prom_type == 2) {  
700 - await getApp().request.promiseGet("/api/weshop/goods/groupBuy/getActInfo/" + os.stoid + "/"+ good.goods_id + "/" + goodsinfo.prom_id, {}).then(res => {  
701 - if (res.data.code == 0) {  
702 - prom = res.data.data;  
703 - prom.price=prom.price;  
704 - }  
705 - })  
706 - }  
707 -  
708 -  
709 - if(goodsinfo.prom_type==6 && !good.is_pd_normal){  
710 - await getApp().request.promiseGet("/api/weshop/teamlist/get/"+os.stoid+"/"+goodsinfo.prom_id,{  
711 - }).then(res=>{  
712 - if(res.data.code==0){  
713 - prom=res.data.data;  
714 - }  
715 - })  
716 - }  
717 -  
718 - if(goodsinfo.prom_type==4 && !good.is_integral_normal){  
719 - await getApp().request.promiseGet("/api/weshop/integralbuy/pageIntegralBuyGoodsList?stype=1&stypeup=1&timetype=2",{  
720 - data:{store_id:os.stoid,goods_id:goodsinfo.goods_id,user_id: getApp().globalData.user_id,}  
721 - }).then(res=>{  
722 - if(res.data.code==0 && res.data.data && res.data.data.pageData && res.data.data.pageData.length){  
723 - prom=res.data.data.pageData[0];  
724 - }  
725 - })  
726 - }  
727 -  
728 - //----------如果有活动,并且在进行中,就不计算线下库存---------------  
729 - if(prom){  
730 - var now=ut.gettimestamp();  
731 - if(prom.is_end==1 && prom.end_time<now){  
732 -  
733 - var content=goodsinfo.goods_name+'商品的活动已经结束,请取消订单重新购买';  
734 - th.toast(content);  
735 - th.setData({paying:0});  
736 - return false;  
737 - }  
738 -  
739 - buyed_mum2=promgoodsbuynum+good.goods_num;  
740 - if (buyed_mum2 > prom.buy_limit && prom.buy_limit > 0) {  
741 - var content=goodsinfo.goods_name+'购买数量超出商品活动限购,请取消订单重新购买';  
742 - th.toast(content);  
743 - th.setData({paying:0});  
744 - return false;  
745 - }  
746 - //看一下会员的秒杀价格是不是发生了变化  
747 - if(goodsinfo.prom_type==1 && goodsinfo.goods_price!=prom.price){  
748 - var content=goodsinfo.goods_name+'秒杀活动的价格发生了变化';  
749 - th.toast(content);  
750 - th.setData({paying:0});  
751 - return false;  
752 - }  
753 -  
754 - //看一下会员的团购价格是不是发生了变化  
755 - if(goodsinfo.prom_type==2 && goodsinfo.goods_price!=prom.price){  
756 - var content=goodsinfo.goods_name+'秒杀活动的价格发生了变化';  
757 - th.toast(content);  
758 - th.setData({paying:0});  
759 - return false;  
760 - } 924 + // --看一下会员的团购价格是不是发生了变化
  925 + if (goodsinfo.prom_type == 2 && goodsinfo.goods_price != prom.price) {
  926 + var content = goodsinfo.goods_name + '秒杀活动的价格发生了变化';
  927 + th.toast(content);
  928 + th.setData({ paying: 0 });
  929 + return false;
  930 + }
  931 +
  932 + if (goodsinfo.prom_type == 4) {
  933 + if (good.goods_num > prom.limitqty - prom.buy_num) {
  934 +
  935 + var content = goodsinfo.goods_name + '购买数量超出商品活动库存,请取消订单'
  936 + th.toast(content);
  937 + th.setData({ paying: 0 });
  938 + return false;
  939 + }
  940 + } else if (goodsinfo.prom_type == 1 || goodsinfo.prom_type == 2 || goodsinfo.prom_type == 6) {
  941 + if (order.add_time + 5 * 60 < ut.gettimestamp()) {
  942 + var content = gg.goods_name + '该订单已经超时无法支付,请取消订单';
  943 + th.toast(content);
  944 + th.setData({ paying: 0 });
  945 + return false;
  946 + }
  947 + }
761 948
762 - if(goodsinfo.prom_type==4){  
763 - if (good.goods_num > prom.limitqty-prom.buy_num) {  
764 -  
765 - var content=goodsinfo.goods_name+'购买数量超出商品活动库存,请取消订单';  
766 - th.toast(content);  
767 - th.setData({paying:0});  
768 - return false;  
769 - }  
770 - }else if(goodsinfo.prom_type == 1 || goodsinfo.prom_type == 2 || goodsinfo.prom_type == 6 ) {  
771 - if(order.add_time+5*60<ut.gettimestamp()) {  
772 - var content = gg.goods_name + '该订单已经超时无法支付,请取消订单';  
773 - th.toast(content);  
774 - th.setData({paying:0});  
775 - return false;  
776 - }  
777 - }  
778 -  
779 - }  
780 -  
781 - }  
782 -  
783 - //-- 要判断一下线下取价价格是不是发生改变 --  
784 - if(wlist!="" && th.data.is_open_offline && th.data.is_open_offline>0){  
785 - wlist=ut.sub_last(wlist);  
786 - var keyid=order.pickup_id;  
787 - var user_info=getApp().globalData.userInfo;  
788 - if(!keyid) {  
789 - th.setData({paying:0});return false;  
790 } 949 }
791 - var offarr=null;  
792 - await getApp().request.promiseGet("/api/weshop/goods/listWarePrice", {  
793 - data:{  
794 - VIPId:encodeURIComponent(user_info.erpvipid),  
795 - store_id:os.stoid,  
796 - PickupId:keyid,  
797 - WareIds:wlist},  
798 - },  
799 - ).then(res=>{  
800 - if(res.data.code==0 && res.data.data && res.data.data.length>0){  
801 - offarr=res.data.data;  
802 - }  
803 - })  
804 - if(!offarr && offarr.length<=0 ){  
805 - wx.showModal({ title: '获取线下取价失败',});  
806 - }  
807 - var newarr=ut.convert_arr_key(offarr,'WareId');  
808 - //-- 循环判断线下的价格 --  
809 - for(var k in order_goods){  
810 - var good=order_goods[k];  
811 - //判断线下取价是不是一样  
812 - if(newarr[good.erpwareid] &&  
813 - parseFloat(newarr[good.erpwareid].WarePrice)!=parseFloat(good.goods_price)){  
814 -  
815 - var content=good.goods_name + '商品的价格发生了变化,请取消订单重新购买';  
816 - th.toast(content);  
817 - th.setData({paying:0});  
818 - return false;  
819 - }  
820 - }  
821 -  
822 - }  
823 950
824 - /*---  
825 - o.jumpToCart4({  
826 - order_sn: this.data.order.order_sn,  
827 - order_amount: this.data.order.order_amount,  
828 - type: 1 //正常单  
829 - }, 1);--*/ 951 + //-- 预售和幸运购要单独计算 --
  952 + if (goodsinfo.prom_type == 8) {
  953 + var presell_id= goodsinfo.prom_id;
  954 + //------获取预售主表,判断预售活动是不是到期不可以使用了----------
  955 + var res= await getApp().request.promiseGet(`/api/weshop/marketing/marketingPresellForm/get/${os.stoid}/${presell_id}`, {})
  956 + if (res.data.code == 0 && res.data.data) {
  957 + var act_data = res.data.data;
  958 + if (act_data.is_end) {
  959 + wx.showToast({ title: "活动已经结束", icon: 'none', duration: 3000 });
  960 + return false;
  961 + }
  962 + if (act_data.isuse == 0) {
  963 + wx.showToast({ title: "活动未启用", icon: 'none', duration: 3000 });
  964 + return false;
  965 + }
  966 +
  967 + var err_txt = "活动定金时间已经结束";
  968 + var end_time = act_data.end_time;
  969 + if (act_data.presell_type == 1) {
  970 + err_txt = "活动时间已经结束";
  971 + }
  972 + if (end_time < ut.gettimestamp()) {
  973 + wx.showToast({ title: err_txt, icon: 'none', duration: 3000 });
  974 + return false;
  975 + }
  976 +
  977 + if (act_data.presell_type == 0) {
  978 + end_time = act_data.pay_enddate;
  979 + err_txt = "活动尾款时间已经结束";
  980 + }
  981 + if (end_time < ut.gettimestamp()) {
  982 + wx.showToast({ title: err_txt, icon: 'none', duration: 3000 });
  983 + return false;
  984 + }
  985 + }
  986 +
  987 + var all_pre_goods=null;
  988 + var userInfo = getApp().globalData.userInfo;
  989 + var pre_data = { store_id: os.stoid, is_end: 0, timetype: 1, isuse: 1, goods_id: goodsinfo.goods_id };
  990 + if (userInfo) {
  991 + pre_data.user_id = userInfo.user_id;
  992 + }
  993 + var rs_pre= await getApp().request.promiseGet("/api/weshop/marketing/marketingPresellList/page", {
  994 + data: pre_data,
  995 + })
  996 + if (rs_pre.data.code == 0 && rs_pre.data.data.pageData && rs_pre.data.data.pageData.length > 0) {
  997 + all_pre_goods = rs_pre.data.data.pageData;
  998 + }
  999 +
  1000 + if(!all_pre_goods){
  1001 + wx.showToast({ title: "未找到活动商品", icon: 'none', duration: 3000 });
  1002 + return false;
  1003 + }
  1004 + var idx = all_pre_goods.findIndex(function (ele) {
  1005 + return ele.goods_id == goodsinfo.goods_id;
  1006 + })
  1007 +
  1008 + if(idx==-1){
  1009 + wx.showToast({ title: "未找到活动商品", icon: 'none', duration: 3000 });
  1010 + return false;
  1011 + }
  1012 + var pre_arr = all_pre_goods[idx];
  1013 + var prom_buy_limit = pre_arr.vip_butyqty;
  1014 +
  1015 + if (goods.goods_num > th.data.pre_arr.presell_sumqty - th.data.pre_arr.buy_goodnum) {
  1016 + wx.showToast({ title: "超出活动商品库存", icon: 'none', duration: 3000 });
  1017 + return false;
  1018 + }
  1019 + //--判断商品是否超出活动限购--
  1020 + if (promgoodsbuynum0 && prom_buy_limit > 0) {
  1021 + wx.showToast({ title: "超出活动商品库存", icon: 'none', duration: 3000 });
  1022 + return false;
  1023 + }
  1024 +
  1025 + }
  1026 + //幸运购的时候
  1027 + if (goodsinfo.prom_type == 9 && !good.is_pt_normal) {
  1028 +
  1029 + var lk_act=null;
  1030 + //获取单个活动成团信息
  1031 + var lk_rs= await getApp().request.promiseGet('/api/weshop/prom/luckyActivity/page', {
  1032 + data: {
  1033 + store_id: os.stoid,
  1034 + is_end: 0,
  1035 + timetype: 1,
  1036 + id: goodsinfo.prom_id,
  1037 + }
  1038 + });
  1039 +
  1040 + if(lk_rs && ut.ajax_ok(lk_rs)){
  1041 + lk_act= lk_rs.data.data.pageData[0];
  1042 + }
  1043 + if(!lk_act){
  1044 + wx.showToast({ title: "未找到活动,或者活动已结束", icon: 'none', duration: 3000 });
  1045 + th.setData({ paying: 0 });
  1046 + return false;
  1047 + }
  1048 + // 检查幸运购活动商品库存
  1049 + var lk_redis=await getApp().request.promiseGet("/api/weshop/activitylist/getActLen/" + os.stoid + "/9/" + goodsinfo.prom_id,{});
  1050 + if(!lk_redis || lk_redis<goodsinfo.goods_num ){
  1051 + wx.showToast({ title: "活动商品库存不足", icon: 'none', duration: 3000 });
  1052 + th.setData({ paying: 0 });
  1053 + return false;
  1054 + }
  1055 + }
  1056 +
  1057 + }
  1058 +
  1059 + //-- 要判断一下线下取价价格是不是发生改变 --
  1060 + if (wlist != "" && th.data.is_open_offline && th.data.is_open_offline > 0) {
  1061 + wlist = ut.sub_last(wlist);
  1062 + var keyid = order.pickup_id;
  1063 + var user_info = getApp().globalData.userInfo;
  1064 + if (!keyid) {
  1065 + th.setData({ paying: 0 }); return false;
  1066 + }
  1067 + var offarr = null;
  1068 + await getApp().request.promiseGet("/api/weshop/goods/listWarePrice", {
  1069 + data: {
  1070 + VIPId: encodeURIComponent(user_info.erpvipid),
  1071 + store_id: os.stoid,
  1072 + PickupId: keyid,
  1073 + WareIds: wlist
  1074 + },
  1075 + },
  1076 + ).then(res => {
  1077 + if (res.data.code == 0 && res.data.data && res.data.data.length > 0) {
  1078 + offarr = res.data.data;
  1079 + }
  1080 + })
  1081 + if (!offarr && offarr.length <= 0) {
  1082 + th.toast('获取线下取价失败');
  1083 + }
  1084 + var newarr = ut.convert_arr_key(offarr, 'WareId');
  1085 + //-- 循环判断线下的价格 --
  1086 + for (var k in order_goods) {
  1087 + var good = order_goods[k];
  1088 + //判断线下取价是不是一样
  1089 + if (newarr[good.erpwareid] &&
  1090 + parseFloat(newarr[good.erpwareid].WarePrice) != parseFloat(good.goods_price)) {
  1091 +
  1092 + var content = good.goods_name + '商品的价格发生了变化,请取消订单重新购买';
  1093 + th.toast(content);
  1094 + th.setData({ paying: 0 });
  1095 + return false;
  1096 + }
  1097 + }
  1098 + }
  1099 +
830 1100
831 py.pay(this.data.order.order_sn, function() { 1101 py.pay(this.data.order.order_sn, function() {
832 th.setData({paying:0}); 1102 th.setData({paying:0});
@@ -836,8 +1106,10 @@ Page({ @@ -836,8 +1106,10 @@ Page({
836 th.setData({paying:0}); 1106 th.setData({paying:0});
837 },os.stoid,1); 1107 },os.stoid,1);
838 1108
839 -  
840 }, 1109 },
  1110 +
  1111 +
  1112 +
841 checkTeam: function() { 1113 checkTeam: function() {
842 wx.navigateTo({ 1114 wx.navigateTo({
843 url: "/pages/team/team_detail/team_detail?foundId=" + this.data.order.orderTeamFound.found_id 1115 url: "/pages/team/team_detail/team_detail?foundId=" + this.data.order.orderTeamFound.found_id
pages/user/order_list/order_list.js
@@ -611,7 +611,8 @@ Page({ @@ -611,7 +611,8 @@ Page({
611 } 611 }
612 }); 612 });
613 }, 613 },
614 - //预存款判断 614 +
  615 + //-- 预存款判断 --
615 async vipadvancesum(keyid,pre_cut,pre_json){ 616 async vipadvancesum(keyid,pre_cut,pre_json){
616 let pre=JSON.parse(pre_json) 617 let pre=JSON.parse(pre_json)
617 let listform=[] 618 let listform=[]
@@ -637,6 +638,7 @@ Page({ @@ -637,6 +638,7 @@ Page({
637 }) 638 })
638 return res.data 639 return res.data
639 }, 640 },
  641 +
640 /*----------跳转支付-----------*/ 642 /*----------跳转支付-----------*/
641 async jumpToCart4(t) { 643 async jumpToCart4(t) {
642 644
@@ -675,7 +677,6 @@ Page({ @@ -675,7 +677,6 @@ Page({
675 if (res.data.code == 0) { 677 if (res.data.code == 0) {
676 knum = res.data.data; 678 knum = res.data.data;
677 } 679 }
678 -  
679 }); 680 });
680 681
681 if (knum <= 0) { 682 if (knum <= 0) {
@@ -708,6 +709,7 @@ Page({ @@ -708,6 +709,7 @@ Page({
708 await getApp().request.promiseGet("/api/weshop/goods/get/" + os.stoid + "/" + good.goods_id, {}).then(res => { 709 await getApp().request.promiseGet("/api/weshop/goods/get/" + os.stoid + "/" + good.goods_id, {}).then(res => {
709 gg = res.data.data; 710 gg = res.data.data;
710 }) 711 })
  712 +
711 var limit = gg.viplimited; 713 var limit = gg.viplimited;
712 var store_count = gg.store_count; 714 var store_count = gg.store_count;
713 good.erpwareid = gg.erpwareid; 715 good.erpwareid = gg.erpwareid;
@@ -773,9 +775,9 @@ Page({ @@ -773,9 +775,9 @@ Page({
773 th.setData({ paying: 0 }); 775 th.setData({ paying: 0 });
774 return false; 776 return false;
775 } 777 }
776 - //增加组合购次数判断  
777 -  
778 - let userbuynum = await th.getUserBuyPromNum(good.prom_id) 778 +
  779 + //增加组合购次数判断
  780 + let userbuynum = await th.getUserBuyPromNum(good.prom_id,1)
779 781
780 if (zh_buy_info.buy_limit !=0 && zh_buy_info && userbuynum >= zh_buy_info.buy_limit) { 782 if (zh_buy_info.buy_limit !=0 && zh_buy_info && userbuynum >= zh_buy_info.buy_limit) {
781 var content = gg.goods_name + '超出组合购限购次数,请取消订单'; 783 var content = gg.goods_name + '超出组合购限购次数,请取消订单';
@@ -812,7 +814,6 @@ Page({ @@ -812,7 +814,6 @@ Page({
812 } 814 }
813 } 815 }
814 } 816 }
815 -  
816 //如果是预售的时候, 817 //如果是预售的时候,
817 if (good.prom_type == 8) { 818 if (good.prom_type == 8) {
818 await getApp().request.promiseGet("/api/weshop/order/orderPresell/countBuyGoodsSum", { 819 await getApp().request.promiseGet("/api/weshop/order/orderPresell/countBuyGoodsSum", {
@@ -860,64 +861,23 @@ Page({ @@ -860,64 +861,23 @@ Page({
860 } 861 }
861 862
862 //如果优惠促销和搭配购的时候 863 //如果优惠促销和搭配购的时候
863 - if ((good.prom_type == 3 || good.prom_type == 5) && good.is_gift != 1 && good.is_collocation != 1) { 864 + if ((good.prom_type == 3 || good.prom_type == 5 || good.prom_type == 10) && good.is_gift != 1 && good.is_collocation != 1) {
864 var p_ok = 1, is_g_prom = 0; 865 var p_ok = 1, is_g_prom = 0;
865 - //因为有全场优惠活动,商品参加的活动还未开始  
866 - var url = "/api/weshop/activitylist/getGoodActInfo";  
867 - var req_data = {  
868 - store_id: os.stoid, goodsidlist: good.goods_id, is_detail: 1, user_id: user_id  
869 - };  
870 - await getApp().request.promiseGet(url, { data: req_data }).then(async function (res) {  
871 - if (res.data.code == 0 && res.data.data && res.data.data.length) {  
872 - for (let i in res.data.data) {  
873 - let item = res.data.data[i];  
874 - if (item.prom_type == 3 || item.prom_type==5) {  
875 - is_g_prom = 1; break;  
876 - }  
877 - }  
878 - }  
879 - })  
880 -  
881 - if (is_g_prom) {  
882 -  
883 - // await getApp().request.promiseGet("/api/weshop/goods/getGoodsPromList/" + os.stoid + "/" + good.goods_id + "/0" + "/" + getApp().globalData.user_id, {}).then(res => {  
884 - await getApp().request.promiseGet("/api/weshop/goods/getGoodsPromListNew1/" + os.stoid + "/" + good.goods_id + "/0" + "/" + getApp().globalData.user_id, {}).then(res => {  
885 - 866 + //只读优化促销和阶梯促销
  867 + await getApp().request.promiseGet("/api/weshop/goods/getGoodsPromListNew1/" + os.stoid + "/" + good.goods_id+"/0/"+user_id, {}).then(res => {
886 if (res.data.code == 0) { 868 if (res.data.code == 0) {
887 var r_data = res.data.data; 869 var r_data = res.data.data;
888 if (!r_data.collocationPromList && good.prom_type == 5) { 870 if (!r_data.collocationPromList && good.prom_type == 5) {
889 -  
890 - var content = good.goods_name + '未找到活动,请取消订单重新购买';  
891 - th.toast(content)  
892 - p_ok = 0; 871 + var content = good.goods_name + '未找到活动,请取消订单重新购买';
  872 + th.toast(content)
  873 + p_ok = 0;
893 } 874 }
894 if (!r_data.promGoodsLists && good.prom_type == 3) { 875 if (!r_data.promGoodsLists && good.prom_type == 3) {
895 -  
896 var content = good.goods_name + '未找到活动,请取消订单重新购买'; 876 var content = good.goods_name + '未找到活动,请取消订单重新购买';
897 th.toast(content); 877 th.toast(content);
898 p_ok = 0; 878 p_ok = 0;
899 } 879 }
900 - } else {  
901 -  
902 - var content = good.goods_name + '未找到活动,请取消订单重新购买'  
903 - th.toast(content);  
904 - p_ok = 0;  
905 - }  
906 - })  
907 - } else {  
908 - //只读优化促销和阶梯促销  
909 - await getApp().request.promiseGet("/api/weshop/goods/getGoodsPromNormal/" + os.stoid + "/" + good.goods_id, {}).then(res => {  
910 - if (res.data.code == 0) {  
911 - var r_data = res.data.data;  
912 - if (!r_data.collocationPromList && good.prom_type == 5) {  
913 -  
914 - var content = good.goods_name + '未找到活动,请取消订单重新购买';  
915 - th.toast(content)  
916 -  
917 - p_ok = 0;  
918 - }  
919 - if (!r_data.promGoodsLists && good.prom_type == 3) {  
920 - 880 + if (!r_data.ladderLists && good.prom_type == 10) {
921 var content = good.goods_name + '未找到活动,请取消订单重新购买'; 881 var content = good.goods_name + '未找到活动,请取消订单重新购买';
922 th.toast(content); 882 th.toast(content);
923 p_ok = 0; 883 p_ok = 0;
@@ -929,92 +889,225 @@ Page({ @@ -929,92 +889,225 @@ Page({
929 p_ok = 0; 889 p_ok = 0;
930 } 890 }
931 }) 891 })
932 -  
933 - }  
934 if (!p_ok) { 892 if (!p_ok) {
935 th.setData({ paying: 0 }); 893 th.setData({ paying: 0 });
936 return false; 894 return false;
937 } 895 }
938 } 896 }
939 897
940 - //商品的普通购买 ,不要进行判断  
941 - if ((good.prom_type == 1 || good.prom_type == 2 || good.prom_type == 6 || good.prom_type == 4 || good.prom_type == 8) 898 + //-- 商品的普通购买 ,不要进行判断 --
  899 + if ((good.prom_type == 1 || good.prom_type == 2 || good.prom_type == 6 || good.prom_type == 4 || good.prom_type == 8 || good.prom_type == 9)
942 && !good.is_gift && !good.is_collocation && !good.is_integral_normal && !good.is_pd_normal) { 900 && !good.is_gift && !good.is_collocation && !good.is_integral_normal && !good.is_pd_normal) {
943 901
944 } else { 902 } else {
945 - if ((gg.prom_type == 1 || good.prom_type == 2 || gg.prom_type == 3 || gg.prom_type == 5 || gg.prom_type == 6 || gg.prom_type == 4)  
946 - && !good.is_collocation && !good.is_gift && !good.is_integral_normal && !good.is_pd_normal) {  
947 - var prom = null;  
948 - //---如果是活动的时候---  
949 - var prom = null, th = this;  
950 - if (gg.prom_type == 1) {  
951 - await getApp().request.promiseGet("/api/ms/flash_sale/getNew/" + os.stoid + "/" + user_id + "/" + gg.prom_id, {}).then(res => {  
952 - if (res.data.code == 0) {  
953 - prom = res.data.data;  
954 - prom.price = prom.user_price;  
955 - }  
956 - })  
957 - }  
958 903
959 - if (gg.prom_type == 2) {  
960 - await getApp().request.promiseGet("/api/weshop/goods/groupBuy/getActInfo/" + os.stoid + "/" + gg.goods_id + "/" + gg.prom_id, {}).then(res => {  
961 - if (res.data.code == 0) {  
962 - prom = res.data.data;  
963 - prom.price = prom.price; 904 + //因为商品的prom_type=0,所以商品的实际活动要重新获取
  905 + var url = '/api/weshop/activitylist/listGoodActInfo2New';
  906 + var req_d = {
  907 + "store_id": os.stoid,
  908 + "goods_id": good.goods_id,
  909 + "user_id": user_id,
  910 + }
  911 + await getApp().request.promiseGet(url, {
  912 + data: req_d
  913 + }).then(res => {
  914 + if (res.data.code == 0 && res.data.data) {
  915 + var arr = res.data.data;
  916 + //-- 预热也要计算 --
  917 + var arr2 = arr.filter(function (e) {
  918 + return e.s_time < ut.gettimestamp() || (e.warm_uptime && e.warm_uptime < ut.gettimestamp())
  919 + })
  920 + if (arr2.length == 1) {
  921 + gg.prom_type=arr2[0].prom_type;
  922 + gg.prom_id=arr2[0].act_id;
964 } 923 }
965 - })  
966 } 924 }
  925 + })
967 926
968 927
969 - if (gg.prom_type == 6) {  
970 - await getApp().request.promiseGet("/api/weshop/teamlist/get/" + os.stoid + "/" + gg.prom_id, {}).then(res => {  
971 - if (res.data.code == 0) {  
972 - prom = res.data.data;  
973 - }  
974 - })  
975 - } 928 + if ((gg.prom_type == 1 || gg.prom_type == 2 || gg.prom_type == 4 || gg.prom_type == 6 || gg.prom_type == 8 || gg.prom_type == 9)
  929 + && !good.is_collocation && !good.is_gift && !good.is_integral_normal && !good.is_pd_normal) {
  930 + var prom = null;
  931 + //---如果是活动的时候---
  932 + var prom = null, th = this;
  933 + if (gg.prom_type == 1) {
  934 + await getApp().request.promiseGet("/api/ms/flash_sale/getNew/" + os.stoid + "/" + user_id + "/" + gg.prom_id, {}).then(res => {
  935 + if (res.data.code == 0) {
  936 + prom = res.data.data;
  937 + prom.price = prom.user_price;
  938 + }
  939 + })
  940 + }
  941 + if (gg.prom_type == 2) {
  942 + await getApp().request.promiseGet("/api/weshop/goods/groupBuy/getActInfo/" + os.stoid + "/" + gg.goods_id + "/" + gg.prom_id, {}).then(res => {
  943 + if (res.data.code == 0) {
  944 + prom = res.data.data;
  945 + prom.price = prom.price;
  946 + }
  947 + })
  948 + }
  949 + if (gg.prom_type == 6) {
  950 + await getApp().request.promiseGet("/api/weshop/teamlist/get/" + os.stoid + "/" + gg.prom_id, {}).then(res => {
  951 + if (res.data.code == 0) {
  952 + prom = res.data.data;
  953 + }
  954 + })
  955 + }
  956 + if (gg.prom_type == 4) {
  957 + await getApp().request.promiseGet("/api/weshop/integralbuy/pageIntegralBuyGoodsList?stype=1&stypeup=1&timetype=2", {
  958 + data: { store_id: os.stoid, goods_id: gg.goods_id,user_id: getApp().globalData.user_id, }
  959 + }).then(res => {
  960 + if (res.data.code == 0 && res.data.data && res.data.data.pageData) {
  961 + prom = res.data.data.pageData[0];
  962 + }
  963 + })
  964 + }
  965 + if (prom) {
  966 + var t_now = ut.gettimestamp();
  967 + if (prom.is_end == 0 && prom.start_time < t_now && prom.end_time > t_now) {
976 968
977 - if (gg.prom_type == 4) {  
978 - await getApp().request.promiseGet("/api/weshop/integralbuy/pageIntegralBuyGoodsList?stype=1&stypeup=1&timetype=2", {  
979 - data: { store_id: os.stoid, goods_id: gg.goods_id,user_id: getApp().globalData.user_id, }  
980 - }).then(res => {  
981 - if (res.data.code == 0 && res.data.data && res.data.data.pageData) {  
982 - prom = res.data.data.pageData[0]; 969 + var content = gg.goods_name + '商品的活动发生了变化,请取消订单重新购买';
  970 + th.toast(content);
  971 + th.setData({ paying: 0 });
  972 + return false;
983 } 973 }
984 - })  
985 - }  
986 -  
987 - if (prom) {  
988 - var t_now = ut.gettimestamp();  
989 - if (prom.is_end == 0 && prom.start_time < t_now && prom.end_time > t_now) { 974 + }
990 975
  976 + //-- 幸运购的时候 --
  977 + if(gg.prom_type==8 || gg.prom_type==9){
991 var content = gg.goods_name + '商品的活动发生了变化,请取消订单重新购买'; 978 var content = gg.goods_name + '商品的活动发生了变化,请取消订单重新购买';
992 th.toast(content); 979 th.toast(content);
993 th.setData({ paying: 0 }); 980 th.setData({ paying: 0 });
994 return false; 981 return false;
995 } 982 }
996 - } 983 +
997 } 984 }
998 else { 985 else {
999 - if (!good.is_gift && good.prom_type != 3) {  
1000 var t_ok = 1; 986 var t_ok = 1;
1001 - await getApp().request.promiseGet("/api/weshop/goods/getGoodsPromList/" + os.stoid + "/" + good.goods_id + "/0" + "/" + getApp().globalData.user_id, {}).then(res => {  
1002 - if (res.data.code == 0) {  
1003 - var r_data = res.data.data;  
1004 - //-- 参加了全局的优惠活动 --  
1005 - if (r_data.promGoodsLists) {  
1006 - var content = gg.goods_name + '商品的活动发生了变化,请取消订单重新购买';  
1007 - th.toast(content);  
1008 - t_ok = 0;  
1009 - }  
1010 - }  
1011 - }) 987 + //-- 如果是普通购买的时候,此时计算的一定是商品的prom_type==0了, (组合购在普通购买的时候,就不判断了,因为组合购本身就可以普通购买)---
  988 + if(!good.is_collocation && !good.is_gift && good.is_pd_normal!=2 && gg.prom_type!=7 ){
  989 +
  990 + var promgoodsbuynum0=0;
  991 + //---要获得商品,该用户买了多少件,同步应用---
  992 + await getApp().request.promiseGet("/api/weshop/ordergoods/getUserBuyGoodsNum", {
  993 + data: {
  994 + store_id: os.stoid,
  995 + user_id: user_id,
  996 + goods_id: good.goods_id,
  997 + prom_type: gg.prom_type,
  998 + prom_id: gg.prom_id
  999 + },
  1000 + }).then(res => {
  1001 + var buy_num_data = res.data.data;
  1002 + if (buy_num_data.promgoodsbuynum) promgoodsbuynum = buy_num_data.promgoodsbuynum;
  1003 + })
  1004 +
  1005 +
  1006 + if(good.prom_type != gg.prom_type && good.prom_id != gg.prom_id){
  1007 + //如果商品有单独的活动的是偶
  1008 + switch (gg.prom_type){
  1009 + case 5:
  1010 + case 10:
  1011 + var content = gg.goods_name + '商品的活动发生了变化,请取消订单重新购买';
  1012 + th.toast(content);
  1013 + t_ok = 0;
  1014 + break;
  1015 + //-- 优惠促销是有限购的 --
  1016 + case 3:
  1017 + var prom=null;
  1018 + var yh_check=1;
  1019 + await getApp().request.promiseGet("/api/weshop/promgoods/get/" + os.stoid + "/" + gg.prom_id, {}).then(res => {
  1020 + if (res.data.code == 0) { prom = res.data.data; }
  1021 + })
  1022 + if (prom && prom.limit_num) {
  1023 + var limit_num = prom.limit_num;
  1024 + var user_pre_buynum = await this.getUserBuyPromNum_pre(prom.id)
  1025 + if (limit_num>0 && user_pre_buynum >= limit_num) {
  1026 + yh_check=0;
  1027 + }
  1028 + }
  1029 + //-- 优惠促销活动没有超出限购的话 --
  1030 + if(yh_check){
  1031 + var content = gg.goods_name + '商品的活动发生了变化,请取消订单重新购买';
  1032 + th.toast(content);
  1033 + t_ok = 0;
  1034 + break;
  1035 + }
  1036 +
  1037 + break
  1038 + case 7:
  1039 + //获取组合购活动
  1040 + var url = "/api/weshop/prom/zhbuy/get/" + os.stoid + "/" + gg.prom_id + "/" + getApp().globalData.userInfo.user_id;
  1041 + let zh_buy_info=null
  1042 + await getApp().request.promiseGet(url, {}).then(res => {
  1043 + if (res.data.code == 0 && res.data.data) {
  1044 + zh_buy_info = res.data.data
  1045 + }
  1046 + })
  1047 + //判断活动超出限购
  1048 + var is_act_ok=1;
  1049 + let userbuynum = await th.getUserBuyPromNum(gg.prom_id)
  1050 + if (zh_buy_info.buy_limit !=0 && zh_buy_info && userbuynum >= zh_buy_info.buy_limit) {
  1051 + is_act_ok=0;
  1052 + }
  1053 +
  1054 + //判断活动商品超出限购,在从表
  1055 + var url1 = "/api/weshop/prom/zhbuyGoods/page";
  1056 + var req_data = {
  1057 + page: 1,
  1058 + pageSize: 1,
  1059 + store_id: os.stoid,
  1060 + zh_id: gg.prom_id,
  1061 + goods_id: gg.goods_id
  1062 + }
  1063 + await getApp().request.promiseGet(url1, {
  1064 + data: req_data
  1065 + }).then(res => {
  1066 + if (ut.ajax_ok(res)) {
  1067 + var gdlist = res.data.data.pageData[0];
  1068 + gg.buyqty = gdlist.buyqty;
  1069 + }
  1070 + })
  1071 + var num = gg['buyqty'];
  1072 + //---- 要计算商品的限购 -----
  1073 + if (gg['buyqty'] > 0) {
  1074 + if (gg.goods_num + promgoodsbuynum0 > gg['buyqty']) {
  1075 + is_act_ok=0;
  1076 + }
  1077 + }
  1078 + if(is_act_ok){
  1079 + var content = gg.goods_name + '商品的活动发生了变化,请取消订单重新购买';
  1080 + th.toast(content);
  1081 + t_ok = 0;
  1082 + break;
  1083 + }
  1084 + }
  1085 + }
  1086 + }
  1087 + //-- 判断活动是不是OK --
1012 if (!t_ok) { 1088 if (!t_ok) {
1013 - th.setData({ paying: 0 }); return false; 1089 + th.setData({ paying: 0 }); return false;
1014 } 1090 }
1015 - }  
1016 - //-- 如果有参加线下取价 --  
1017 - if (good.offline_cut > 0) wlist += encodeURIComponent(gg.erpwareid) + ","; 1091 +
  1092 + // if (!good.is_gift && good.prom_type != 3) {
  1093 + // var t_ok = 1;
  1094 + // await getApp().request.promiseGet("/api/weshop/goods/getGoodsPromList/" + os.stoid + "/" + good.goods_id + "/0" + "/" + getApp().globalData.user_id, {}).then(res => {
  1095 + // if (res.data.code == 0) {
  1096 + // var r_data = res.data.data;
  1097 + // //-- 参加了全局的优惠活动 --
  1098 + // if (r_data.promGoodsLists) {
  1099 + // var content = gg.goods_name + '商品的活动发生了变化,请取消订单重新购买';
  1100 + // th.toast(content);
  1101 + // t_ok = 0;
  1102 + // }
  1103 + // }
  1104 + // })
  1105 + // if (!t_ok) {
  1106 + // th.setData({ paying: 0 }); return false;
  1107 + // }
  1108 + // }
  1109 + //-- 如果有参加线下取价 --
  1110 + if (good.offline_cut > 0) wlist += encodeURIComponent(gg.erpwareid) + ",";
1018 } 1111 }
1019 //赠品和搭配购不判断商品金额 1112 //赠品和搭配购不判断商品金额
1020 var isok = 1; 1113 var isok = 1;
@@ -1047,11 +1140,10 @@ Page({ @@ -1047,11 +1140,10 @@ Page({
1047 ob = obj; 1140 ob = obj;
1048 }) 1141 })
1049 if (ob.code == -1) { 1142 if (ob.code == -1) {
1050 -  
1051 - var content = gg.goods_name + '门店库存不足,请取消订单';  
1052 - th.toast(content);  
1053 - th.setData({ paying: 0 });  
1054 - return false; 1143 + var content = gg.goods_name + '门店库存不足,请取消订单';
  1144 + th.toast(content);
  1145 + th.setData({ paying: 0 });
  1146 + return false;
1055 } 1147 }
1056 1148
1057 } else { 1149 } else {
@@ -1076,7 +1168,6 @@ Page({ @@ -1076,7 +1168,6 @@ Page({
1076 } 1168 }
1077 }) 1169 })
1078 } 1170 }
1079 -  
1080 if (goodsinfo.prom_type == 2) { 1171 if (goodsinfo.prom_type == 2) {
1081 await getApp().request.promiseGet("/api/weshop/goods/groupBuy/getActInfo/" + os.stoid + "/" + good.goods_id + "/" + goodsinfo.prom_id, {}).then(res => { 1172 await getApp().request.promiseGet("/api/weshop/goods/groupBuy/getActInfo/" + os.stoid + "/" + good.goods_id + "/" + goodsinfo.prom_id, {}).then(res => {
1082 if (res.data.code == 0) { 1173 if (res.data.code == 0) {
@@ -1086,7 +1177,6 @@ Page({ @@ -1086,7 +1177,6 @@ Page({
1086 }) 1177 })
1087 } 1178 }
1088 1179
1089 -  
1090 if (goodsinfo.prom_type == 6 && !good.is_pd_normal) { 1180 if (goodsinfo.prom_type == 6 && !good.is_pd_normal) {
1091 await getApp().request.promiseGet("/api/weshop/teamlist/get/" + os.stoid + "/" + goodsinfo.prom_id, {}).then(res => { 1181 await getApp().request.promiseGet("/api/weshop/teamlist/get/" + os.stoid + "/" + goodsinfo.prom_id, {}).then(res => {
1092 if (res.data.code == 0) { 1182 if (res.data.code == 0) {
@@ -1104,7 +1194,6 @@ Page({ @@ -1104,7 +1194,6 @@ Page({
1104 } 1194 }
1105 }) 1195 })
1106 } 1196 }
1107 -  
1108 //----------如果有活动,并且在进行中,就不计算线下库存--------------- 1197 //----------如果有活动,并且在进行中,就不计算线下库存---------------
1109 if (prom) { 1198 if (prom) {
1110 var now = ut.gettimestamp(); 1199 var now = ut.gettimestamp();
@@ -1158,6 +1247,113 @@ Page({ @@ -1158,6 +1247,113 @@ Page({
1158 } 1247 }
1159 1248
1160 } 1249 }
  1250 +
  1251 + //-- 预售和幸运购要单独计算 --
  1252 + if (goodsinfo.prom_type == 8) {
  1253 + var presell_id= goodsinfo.prom_id;
  1254 + //------获取预售主表,判断预售活动是不是到期不可以使用了----------
  1255 + var res= await getApp().request.promiseGet(`/api/weshop/marketing/marketingPresellForm/get/${os.stoid}/${presell_id}`, {})
  1256 + if (res.data.code == 0 && res.data.data) {
  1257 + var act_data = res.data.data;
  1258 + if (act_data.is_end) {
  1259 + wx.showToast({ title: "活动已经结束", icon: 'none', duration: 3000 });
  1260 + return false;
  1261 + }
  1262 + if (act_data.isuse == 0) {
  1263 + wx.showToast({ title: "活动未启用", icon: 'none', duration: 3000 });
  1264 + return false;
  1265 + }
  1266 +
  1267 + var err_txt = "活动定金时间已经结束";
  1268 + var end_time = act_data.end_time;
  1269 + if (act_data.presell_type == 1) {
  1270 + err_txt = "活动时间已经结束";
  1271 + }
  1272 + if (end_time < ut.gettimestamp()) {
  1273 + wx.showToast({ title: err_txt, icon: 'none', duration: 3000 });
  1274 + return false;
  1275 + }
  1276 +
  1277 + if (act_data.presell_type == 0) {
  1278 + end_time = act_data.pay_enddate;
  1279 + err_txt = "活动尾款时间已经结束";
  1280 + }
  1281 + if (end_time < ut.gettimestamp()) {
  1282 + wx.showToast({ title: err_txt, icon: 'none', duration: 3000 });
  1283 + return false;
  1284 + }
  1285 + }
  1286 +
  1287 + var all_pre_goods=null;
  1288 + var userInfo = getApp().globalData.userInfo;
  1289 + var pre_data = { store_id: os.stoid, is_end: 0, timetype: 1, isuse: 1, goods_id: goodsinfo.goods_id };
  1290 + if (userInfo) {
  1291 + pre_data.user_id = userInfo.user_id;
  1292 + }
  1293 + var rs_pre= await getApp().request.promiseGet("/api/weshop/marketing/marketingPresellList/page", {
  1294 + data: pre_data,
  1295 + })
  1296 + if (rs_pre.data.code == 0 && rs_pre.data.data.pageData && rs_pre.data.data.pageData.length > 0) {
  1297 + all_pre_goods = rs_pre.data.data.pageData;
  1298 + }
  1299 +
  1300 + if(!all_pre_goods){
  1301 + wx.showToast({ title: "未找到活动商品", icon: 'none', duration: 3000 });
  1302 + return false;
  1303 + }
  1304 + var idx = all_pre_goods.findIndex(function (ele) {
  1305 + return ele.goods_id == goodsinfo.goods_id;
  1306 + })
  1307 +
  1308 + if(idx==-1){
  1309 + wx.showToast({ title: "未找到活动商品", icon: 'none', duration: 3000 });
  1310 + return false;
  1311 + }
  1312 + var pre_arr = all_pre_goods[idx];
  1313 + var prom_buy_limit = pre_arr.vip_butyqty;
  1314 +
  1315 + if (goods.goods_num > th.data.pre_arr.presell_sumqty - th.data.pre_arr.buy_goodnum) {
  1316 + wx.showToast({ title: "超出活动商品库存", icon: 'none', duration: 3000 });
  1317 + return false;
  1318 + }
  1319 + //--判断商品是否超出活动限购--
  1320 + if (promgoodsbuynum0 && prom_buy_limit > 0) {
  1321 + wx.showToast({ title: "超出活动商品库存", icon: 'none', duration: 3000 });
  1322 + return false;
  1323 + }
  1324 +
  1325 + }
  1326 + //幸运购的时候
  1327 + if (goodsinfo.prom_type == 9 && !good.is_pt_normal) {
  1328 +
  1329 + var lk_act=null;
  1330 + //获取单个活动成团信息
  1331 + var lk_rs= await getApp().request.promiseGet('/api/weshop/prom/luckyActivity/page', {
  1332 + data: {
  1333 + store_id: os.stoid,
  1334 + is_end: 0,
  1335 + timetype: 1,
  1336 + id: goodsinfo.prom_id,
  1337 + }
  1338 + });
  1339 +
  1340 + if(lk_rs && ut.ajax_ok(lk_rs)){
  1341 + lk_act= lk_rs.data.data.pageData[0];
  1342 + }
  1343 + if(!lk_act){
  1344 + wx.showToast({ title: "未找到活动,或者活动已结束", icon: 'none', duration: 3000 });
  1345 + th.setData({ paying: 0 });
  1346 + return false;
  1347 + }
  1348 + // 检查幸运购活动商品库存
  1349 + var lk_redis=await getApp().request.promiseGet("/api/weshop/activitylist/getActLen/" + os.stoid + "/9/" + goodsinfo.prom_id,{});
  1350 + if(!lk_redis || lk_redis<goodsinfo.goods_num ){
  1351 + wx.showToast({ title: "活动商品库存不足", icon: 'none', duration: 3000 });
  1352 + th.setData({ paying: 0 });
  1353 + return false;
  1354 + }
  1355 + }
  1356 +
1161 } 1357 }
1162 1358
1163 //-- 要判断一下线下取价价格是不是发生改变 -- 1359 //-- 要判断一下线下取价价格是不是发生改变 --
@@ -1200,6 +1396,7 @@ Page({ @@ -1200,6 +1396,7 @@ Page({
1200 } 1396 }
1201 } 1397 }
1202 } 1398 }
  1399 +
1203 th.pay_next(e, o_index); 1400 th.pay_next(e, o_index);
1204 }, 1401 },
1205 1402
@@ -2081,9 +2278,14 @@ Page({ @@ -2081,9 +2278,14 @@ Page({
2081 } 2278 }
2082 }, 2279 },
2083 //获取用户参与组合购的次数 2280 //获取用户参与组合购的次数
2084 - async getUserBuyPromNum(prom_id){ 2281 + async getUserBuyPromNum(prom_id,is_buy){
2085 var userInfo = getApp().globalData.userInfo; 2282 var userInfo = getApp().globalData.userInfo;
2086 - var url = `/api/weshop/ordergoods/getUserBuyPromNum?store_id=${os.stoid}&user_id=${userInfo.user_id}&prom_type=7&prom_id=${prom_id}`; 2283 +
  2284 + var url = `/api/weshop/ordergoods/getUserBuyPromNum?is_all=1&store_id=${os.stoid}&user_id=${userInfo.user_id}&prom_type=7&prom_id=${prom_id}`;
  2285 + if(is_buy){
  2286 + url = `/api/weshop/ordergoods/getUserBuyPromNum?store_id=${os.stoid}&user_id=${userInfo.user_id}&prom_type=7&prom_id=${prom_id}`;
  2287 + }
  2288 +
2087 let res = await getApp().request.promiseGet(url, { 2289 let res = await getApp().request.promiseGet(url, {
2088 data:{} 2290 data:{}
2089 }); 2291 });
@@ -2846,10 +3048,24 @@ Page({ @@ -2846,10 +3048,24 @@ Page({
2846 //-- 查看物流 -- 3048 //-- 查看物流 --
2847 go_wuliu:function (e) { 3049 go_wuliu:function (e) {
2848 getApp().go_wuliu(e); 3050 getApp().go_wuliu(e);
2849 - }  
2850 -  
2851 - 3051 + },
2852 3052
  3053 + //优惠促销用户参与次数,is_buy=1,表示只获取支付了的
  3054 + async getUserBuyPromNum_pre(prom_id,is_buy) {
  3055 + var userInfo = getApp().globalData.userInfo;
  3056 + var url = `/api/weshop/ordergoods/getUserBuyPromNum?is_all=1&store_id=${os.stoid}&user_id=${userInfo.user_id}&prom_type=3&prom_id=${prom_id}`;
  3057 + if(is_buy){
  3058 + url = `/api/weshop/ordergoods/getUserBuyPromNum?store_id=${os.stoid}&user_id=${userInfo.user_id}&prom_type=3&prom_id=${prom_id}`;
  3059 + }
  3060 + let res = await getApp().request.promiseGet(url, {
  3061 + data: {}
  3062 + });
  3063 + let user_pre_buynum = 0
  3064 + if (res.data.code == 0 && res.data.data) {
  3065 + user_pre_buynum = res.data.data.userbuynum
  3066 + }
  3067 + return user_pre_buynum
  3068 + },
2853 3069
2854 3070
2855 }); 3071 });
2856 \ No newline at end of file 3072 \ No newline at end of file
utils/more_cx.js
@@ -55,11 +55,16 @@ module.exports = { @@ -55,11 +55,16 @@ module.exports = {
55 need_ck=th.data.in_zhact_new[aid]?th.data.in_zhact_new[aid]:0; 55 need_ck=th.data.in_zhact_new[aid]?th.data.in_zhact_new[aid]:0;
56 } 56 }
57 if(need_ck+act.zh_buy_num>=act.zh_num ){ 57 if(need_ck+act.zh_buy_num>=act.zh_num ){
58 - return false; 58 + if(!need_ok) {
  59 + item_act_map.is_no_ok = 1;
  60 + }else{
  61 + return false;
  62 + }
59 }else{ 63 }else{
60 min_can_buy= act.zh_num-act.zh_buy_num-need_ck; 64 min_can_buy= act.zh_num-act.zh_buy_num-need_ck;
61 } 65 }
62 } 66 }
  67 +
63 //-- 判断组合购的限购是不是到了 -- 68 //-- 判断组合购的限购是不是到了 --
64 if(act.buy_limit>0){ 69 if(act.buy_limit>0){
65 var need_ck0=0; 70 var need_ck0=0;
@@ -67,8 +72,14 @@ module.exports = { @@ -67,8 +72,14 @@ module.exports = {
67 need_ck0=th.data.in_zhact_new[aid]?th.data.in_zhact_new[aid]:0; 72 need_ck0=th.data.in_zhact_new[aid]?th.data.in_zhact_new[aid]:0;
68 } 73 }
69 var min_can_buy0=0; 74 var min_can_buy0=0;
70 - if(need_ck+item_act_map.buyed>=act.buy_limit ){  
71 - return false; 75 + if(need_ck+item_act_map.buyed>=act.buy_limit){
  76 + if(!need_ok) {
  77 + item_act_map.is_no_ok = 1;
  78 + }else{
  79 + return false;
  80 + }
  81 +
  82 +
72 }else{ 83 }else{
73 min_can_buy0=act.buy_limit-item_act_map.buyed-need_ck; 84 min_can_buy0=act.buy_limit-item_act_map.buyed-need_ck;
74 } 85 }
@@ -554,7 +565,7 @@ module.exports = { @@ -554,7 +565,7 @@ module.exports = {
554 user_id: getApp().globalData.user_id, 565 user_id: getApp().globalData.user_id,
555 goods_id: zh_goods[h].goods_id, 566 goods_id: zh_goods[h].goods_id,
556 prom_type: 7, 567 prom_type: 7,
557 - prom_id: item_act_map.prom_id 568 + prom_id: item_act_map.prom_id, isnew:1
558 }, 569 },
559 }) 570 })
560 if(res.data.code==0 && res.data.data && res.data.data.promgoodsbuynum){ 571 if(res.data.code==0 && res.data.data && res.data.data.promgoodsbuynum){
@@ -612,7 +623,7 @@ module.exports = { @@ -612,7 +623,7 @@ module.exports = {
612 can_calc_cx[p].goods.map(function (gd){ 623 can_calc_cx[p].goods.map(function (gd){
613 ch_map.push(gd.goods_id); 624 ch_map.push(gd.goods_id);
614 }) 625 })
615 - ch_map.sort(); 626 + //ch_map.sort();
616 //-- 先找一下,有没有参与的商品一模一样的 -- 627 //-- 先找一下,有没有参与的商品一模一样的 --
617 var fd=show_can_cx[ch_map.join()]; 628 var fd=show_can_cx[ch_map.join()];
618 if(fd){ 629 if(fd){
@@ -670,6 +681,7 @@ module.exports = { @@ -670,6 +681,7 @@ module.exports = {
670 k_item.act_arr[ij].sele=1; 681 k_item.act_arr[ij].sele=1;
671 ck_prom_type= k_item.act_arr[ij]; 682 ck_prom_type= k_item.act_arr[ij];
672 k_item.cur_act=ck_prom_type; 683 k_item.cur_act=ck_prom_type;
  684 + k_item.sele_prom_type=ck_prom_type.prom_type;
673 } 685 }
674 } 686 }
675 } 687 }
@@ -681,6 +693,7 @@ module.exports = { @@ -681,6 +693,7 @@ module.exports = {
681 k_item.act_arr[0].sele=1; 693 k_item.act_arr[0].sele=1;
682 //-- 把当前活动进行赋值 -- 694 //-- 把当前活动进行赋值 --
683 k_item.cur_act=ck_prom_type; 695 k_item.cur_act=ck_prom_type;
  696 + k_item.sele_prom_type=ck_prom_type.prom_type;
684 } 697 }
685 698
686 //-- 如果是要控制数量的时候,也就是全选的时候,或者加减号的时候 -- 699 //-- 如果是要控制数量的时候,也就是全选的时候,或者加减号的时候 --
utils/util.js
@@ -799,6 +799,81 @@ module.exports = { @@ -799,6 +799,81 @@ module.exports = {
799 return false 799 return false
800 }, 800 },
801 801
  802 + //优惠促销的数据的格式话
  803 + format_yh_act(fir_act){
  804 + var more_arr = [];
  805 + if(fir_act){
  806 + //减价
  807 + if (fir_act.money > 0){
  808 +
  809 + more_arr.push({
  810 + text:'减价' + fir_act.money + '元',
  811 + is_fir:1
  812 + });
  813 + }
  814 + if (fir_act.sale > 0) {
  815 + more_arr.push({
  816 + text:'打' + fir_act.sale + '折',
  817 + is_fir:1
  818 + });
  819 + }
  820 + if (fir_act.past == 1) {
  821 + more_arr.push({
  822 + text:'包邮',
  823 + is_fir:1
  824 + });
  825 + }
  826 + if (fir_act.intValue > 0){
  827 + more_arr.push({
  828 + text:'送' + fir_act.intValue + '积分',
  829 + is_fir:1
  830 + });
  831 + }
  832 + if (fir_act.couponId > 0) {
  833 + more_arr.push({
  834 + text:'送' + fir_act.couponMoney + '元优惠券',
  835 + is_quan:1
  836 + });
  837 + }
  838 +
  839 + if (fir_act.gift_id) {
  840 + var is_more_gf = fir_act.gift_id.split(',')
  841 + if (is_more_gf.length > 1) {
  842 + more_arr.push({
  843 + text:'送赠品',
  844 + is_gift:1,
  845 + prom_id:fir_act.prom_id
  846 + });
  847 + } else {
  848 + more_arr.push({
  849 + text:'送' + fir_act.goods_name + ' x' + fir_act.zp_num,
  850 + is_gift:1,
  851 + prom_id:fir_act.prom_id,
  852 + is_no_goto:1,//不进行跳转的意思
  853 + });
  854 + }
  855 + }
  856 + if (fir_act.lb_id){
  857 + more_arr.push({
  858 + text:'送' + fir_act.lbtitle,
  859 + lb_id:fir_act.lb_id
  860 + });
  861 + }
  862 + if (fir_act.zxlb_id){
  863 + more_arr.push({
  864 + text:'送' + fir_act.zxlbtitle,
  865 + zxlb_id:fir_act.zxlb_id
  866 + });
  867 + }
  868 + if (fir_act.monthgiftbag_id){
  869 + more_arr.push({
  870 + text:'送' + fir_act.monthgiftbag_title,
  871 + monthgiftbag_id:fir_act.monthgiftbag_id
  872 + });
  873 + }
  874 + }
  875 + return more_arr
  876 + },
802 877
803 unserialize: unserialize, 878 unserialize: unserialize,
804 _throttle:_throttle, 879 _throttle:_throttle,