Commit 1462382812c82757a1b3a122825091ded944456a

Authored by 后端研发-苏泰源
1 parent 75934c51

服务卡项修改

packageA/pages/goodsInfo/goodsInfo.js
... ... @@ -884,8 +884,8 @@ Page({
884 884 // }
885 885 //000000
886 886  
887   -
888   - if(this.data.options.prom_type == 1 && !this.data.prom_act.is_shop_buy) {
  887 + this.data.sele_g.viplimited = this.data.sele_g.buy_limit;
  888 + if(this.data.sele_g.viplimited > 0 && !this.data.is_normal && this.data.prom_type == 1) {
889 889 var t = th.data.goodsInputNum;
890 890 th.data.sele_g.viplimited = th.data.sele_g.buy_limit;
891 891 if (th.data.sele_g.viplimited > 0) {
... ... @@ -954,7 +954,16 @@ Page({
954 954 if(getApp().globalData.guide_id) {
955 955 newd['guide_id'] = getApp().globalData.guide_id;
956 956 newd['guide_type']=0;
957   - }
  957 + };
  958 + // 秒杀:单独购买的情况下,加入购物车显示的是零售价,否则显示秒杀活动价
  959 + if(th.data.options.prom_type == 1) {
  960 + if(th.data.openSpecModal_flash_normal) {
  961 + newd['money'] = th.data.data.shop_price;
  962 + } else {
  963 + newd['money'] = th.data.prom_price;
  964 + };
  965 + };
  966 +
958 967  
959 968 //----先看会员在购物车中是否加入了该商品-----
960 969 getApp().request.get("/api/weshop/cartService/page", {
... ... @@ -975,6 +984,15 @@ Page({
975 984 money: th.data.data.shop_price,
976 985 store_id: os.stoid,
977 986 };
  987 +
  988 + // 秒杀:单独购买的情况下,加入购物车显示的是零售价,否则显示秒杀活动价
  989 + if(th.data.options.prom_type == 1) {
  990 + if(th.data.openSpecModal_flash_normal) {
  991 + updata['money'] = th.data.data.shop_price;
  992 + } else {
  993 + updata['money'] = th.data.prom_price;
  994 + };
  995 + };
978 996  
979 997 if (getApp().globalData.guide_id) {
980 998 updata['guide_id'] = getApp().globalData.guide_id;
... ... @@ -1048,7 +1066,7 @@ Page({
1048 1066 if(t == 0) return false;
1049 1067 // th.setData({goodsInputNum:t});
1050 1068  
1051   - if(this.data.options.prom_type == 1 && !this.data.openSpecModal_flash_normal) {
  1069 + // if(this.data.options.prom_type == 1 && !this.data.openSpecModal_flash_normal) {
1052 1070  
1053 1071 this.get_buy_num(this.data.sele_g, async function () {
1054 1072 th.data.sele_g.viplimited = th.data.sele_g.buy_limit;
... ... @@ -1057,84 +1075,109 @@ Page({
1057 1075 // if (th.data.g_buy_num != null && th.data.sele_g.viplimited > 0) {
1058 1076 // if(!th.data.prom_act.is_shop_buy) {
1059 1077  
1060   - if (th.data.sele_g.viplimited > 0) {
1061   - var gd_buy_num = th.data.sele_g.buy_num;
  1078 + // if (th.data.sele_g.viplimited > 0) {
  1079 + // var gd_buy_num = th.data.sele_g.buy_num;
1062 1080  
1063   - if (t + gd_buy_num> th.data.sele_g.viplimited) {
1064   - wx.showModal({
1065   - title: '超出商品限购',
1066   - });
  1081 + // if (t + gd_buy_num> th.data.sele_g.viplimited) {
  1082 + // wx.showModal({
  1083 + // title: '超出商品限购',
  1084 + // });
1067 1085  
1068   - var num = th.data.sele_g.viplimited - gd_buy_num;
1069   - if (num <= 0) num = 1;
1070   - th.setData({goodsInputNum: num})
1071   - return false;
1072   - }
1073   - };
  1086 + // var num = th.data.sele_g.viplimited - gd_buy_num;
  1087 + // if (num <= 0) num = 1;
  1088 + // th.setData({goodsInputNum: num})
  1089 + // return false;
  1090 + // }
  1091 + // };
1074 1092  
1075   - // };
1076 1093  
  1094 + // 单独购买
  1095 + if(th.data.openSpecModal_flash_normal) th.data.is_normal = 1;
  1096 +
  1097 + // 秒杀:判断活动是否抢光
  1098 + if (th.data.sele_g.prom_type == 1 && !th.data.is_normal) {
  1099 + var redis_num = 0;
  1100 + //------判断活动是否抢光-----
  1101 + await getApp().request.promiseGet("/api/weshop/activitylist/getActLen/" +
  1102 + os.stoid + "/" + th.data.sele_g.prom_type + "/" + th.data.sele_g.prom_id, {
  1103 + 1: 1
  1104 + }).then(res => {
  1105 + redis_num = res.data.data;
  1106 + });
  1107 +
  1108 + if (t > redis_num) {
  1109 + wx.showModal({
  1110 + // title: '超出商品活动库存',
  1111 + title: '来晚了,已被抢光~',
  1112 + });
  1113 + th.setData({goodsInputNum: redis_num})
  1114 + return false;
  1115 + }
  1116 + };
1077 1117  
1078   - //如果是普通购买的情况下
1079   - if(th.data.openSpecModal_flash_normal) th.data.is_normal=1;
1080   -
1081   - //--判断商品是否超出活动限购--
1082   - if (th.data.prom_buy_num != -1 && th.data.prom_buy_limit > 0 && !th.data.is_normal) {
1083   - if (t + th.data.prom_buy_num > th.data.prom_buy_limit) {
1084   - wx.showModal({
1085   - title: '超出商品活动限购',
1086   - });
1087   -
1088   - var num = th.data.prom_buy_limit - th.data.prom_buy_num;
1089   - if (num < 0) num = 0;
1090   - th.setData({goodsInputNum: num})
1091   - return false;
1092   - }
1093   - }
  1118 + //--秒杀:判断商品是否超出活动限购--
  1119 + if (th.data.sele_g.viplimited > 0 && !th.data.is_normal && th.data.prom_type == 1) {
  1120 + var gd_buy_num = th.data.sele_g.buy_num;
  1121 +
  1122 + if (t + gd_buy_num> th.data.sele_g.viplimited) {
  1123 + wx.showModal({
  1124 + title: '超出商品活动限购',
  1125 + });
  1126 +
  1127 + var num = th.data.sele_g.viplimited - gd_buy_num;
  1128 + if (num <= 0) num = 1;
  1129 + th.setData({goodsInputNum: num})
  1130 + return false;
  1131 + }
  1132 + };
1094 1133  
1095   - if (th.data.sele_g.prom_type == 1 && !th.data.is_normal) {
1096   - var redis_num = 0;
1097   - //------判断活动是否抢光-----
1098   - await getApp().request.promiseGet("/api/weshop/activitylist/getActLen/" +
1099   - os.stoid + "/" + th.data.sele_g.prom_type + "/" + th.data.sele_g.prom_id, {
1100   - 1: 1
1101   - }).then(res => {
1102   - redis_num = res.data.data;
1103   - });
  1134 + //--秒杀:判断商品是否超出活动限购--
  1135 + // if (th.data.prom_buy_num != -1 && th.data.prom_buy_limit > 0 && !th.data.is_normal) {
  1136 + // if (t + th.data.prom_buy_num > th.data.prom_buy_limit) {
  1137 + // wx.showModal({
  1138 + // title: '超出商品活动限购',
  1139 + // });
  1140 +
  1141 + // var num = th.data.prom_buy_limit - th.data.prom_buy_num;
  1142 + // if (num < 0) num = 0;
  1143 + // th.setData({goodsInputNum: num})
  1144 + // return false;
  1145 + // };
  1146 + // };
1104 1147  
1105   - if (t > redis_num) {
1106   - wx.showModal({
1107   - title: '超出商品活动库存',
1108   - });
1109   - th.setData({goodsInputNum: redis_num})
1110   - return false;
1111   - }
1112   - }
1113   - var e = th.data.sele_g.goods_num;
  1148 +
  1149 +
  1150 +
  1151 +
  1152 + // var e = th.data.sele_g.goods_num;
1114 1153 var p_type = th.data.prom_type; //&& p_type!=1 && p_type!=4
1115 1154 if (th.data.sales_rules == 2 && (p_type != 1 && p_type != 4 && p_type != 6 || th.data.openSpecModal_inte_normal == 1 || th.data.is_normal == 1)) {
1116 1155 if (!th.data.def_pick_store) {
1117 1156 wx.showModal({title: '请选择门店',});
1118 1157 return false;
1119 1158 } else {
1120   - e = th.data.def_pick_store.CanOutQty;
  1159 + // e = th.data.def_pick_store.CanOutQty;
1121 1160 }
1122 1161 }
1123   - if (!e) e = 0;
1124   - //库存不足,不增加
1125   - if (e < t) {
1126   - wx.showModal({title: '库存不足',});
1127   - if (e < 0) e = 0;
1128   - th.setData({goodsInputNum: e});
1129   - return false;
1130   - }
1131   - t > e || 0 == e ? t = e : t < 1 && (t = 1);
  1162 +
  1163 + // 单独购买时
  1164 + if(th.data.openSpecModal_flash_normal && th.data.prom_type == 1) {
  1165 + // if (!e) e = 0;
  1166 + // //库存不足,不增加
  1167 + // if (e < t) {
  1168 + // wx.showModal({title: '购买数量不能超出库存',});
  1169 + // if (e < 0) e = 0;
  1170 + // th.setData({goodsInputNum: e});
  1171 + // return false;
  1172 + // };
  1173 + // t > e || 0 == e ? t = e : t < 1 && (t = 1);
  1174 + };
  1175 +
1132 1176 th.setData({goodsInputNum: t});
1133   - // th.is_show_more_buy();
1134   -
  1177 +
1135 1178 })
1136 1179  
1137   - };
  1180 + // };
1138 1181  
1139 1182  
1140 1183  
... ... @@ -3386,9 +3429,9 @@ Page({
3386 3429 //----获取商品购买数----
3387 3430 getApp().request.get("/api/weshop/ordergoods/getUserBuyGoodsNum", {
3388 3431 data: {
3389   - store_id: os.stoid,
3390   - user_id: user_id,
3391   - goods_id: gd.goods_id
  3432 + store_id: os.stoid,
  3433 + user_id: user_id,
  3434 + goods_id: gd.goods_id,
3392 3435 },
3393 3436 success: function (t) {
3394 3437 if (t.data.code == 0) {
... ... @@ -3439,7 +3482,8 @@ Page({
3439 3482 "function" == typeof func && func();
3440 3483 };
3441 3484 }
3442   - }
  3485 + },
  3486 +
3443 3487 });
3444 3488 // }
3445 3489 },
... ...
packageA/pages/goodsInfo/goodsInfo.wxml
... ... @@ -16,6 +16,7 @@
16 16 <view class="goods-detail">
17 17 <view class="goods-info" hidden="{{activeCategoryId==0?false:true}}">
18 18  
  19 + <!-- 有视频和图片的情况 -->
19 20 <view id="id" bindtouchstart="handletouchtart" bindtouchmove="handletouchmove" wx:if="{{mapurl}}">
20 21 <view class="xc-videos-picture rel">
21 22 <swiper autoplay="{{false}}" current="{{swiperCurrent}}" class="swiper_box swiperContainer rel" duration="{{1000}}" indicatorDots="{{mapurl?false:true}}" interval="{{3000}}" vertical="{{false}}" bindchange="swiperChange">
... ... @@ -29,10 +30,11 @@
29 30 <video class="xc-videos" src="{{iurl+mapurl}}" id="{{index}}" wx:if="{{_index == index}}"></video>
30 31 </view>
31 32 </swiper-item>
32   - <swiper-item wx:for="{{gallery}}" wx:key="gallery">
33   - <view class="wh100 g_img_box" style="background-image:url({{iurl}}{{data.image_url?data.image_url:'miniapp/images/default_g_img.gif'}});"></view>
  33 + <swiper-item wx:for="{{gallery}}" wx:key="gallery" class="sty">
  34 + <view class="wh100 g_img_box" style="background-image:url({{data.image_url?data.image_url:'miniapp/images/default_g_img.gif'}});"></view>
34 35 </swiper-item>
35 36 </swiper>
  37 +
36 38 <block wx:if="{{mapurl}}">
37 39 <view wx:if="{{hiddenn==1}}">
38 40 <view class="xc-imageCount">{{current}}/{{gallery.length}}</view>
... ... @@ -48,17 +50,18 @@
48 50 </view>
49 51 </view>
50 52 </block>
  53 +
51 54 </view>
52 55 </view>
53 56  
54 57  
55   -
  58 + <!-- 只有图片的情况 -->
56 59 <view id="id" bindtouchstart="handletouchtart" bindtouchmove="handletouchmove" wx:else>
57 60 <view class="xc-videos-picture rel">
58 61 <swiper autoplay="{{false}}" current="{{swiperCurrent}}" class="swiper_box swiperContainer rel" duration="{{1000}}"
59 62 indicatorDots="{{mapurl?false:true}}" interval="{{3000}}" vertical="{{false}}" bindchange="swiperChange">
60   - <swiper-item>
61   - <image class="wh100" src="{{iurl}}{{data.image_url?data.image_url:'miniapp/images/default_g_img.gif'}}"
  63 + <swiper-item class="sty1">
  64 + <image class="wh100" src="{{iurl + (data.image_url?data.image_url:'miniapp/images/default_g_img.gif')}}"
62 65 binderror="bind_bnerr" mode="aspectFit" lazy-load="true" data-errorimg="gallery[{{index}}].image_url"></image>
63 66 </swiper-item>
64 67 </swiper>
... ... @@ -110,26 +113,27 @@
110 113  
111 114 <block wx:if="{{prom_type==1}}">
112 115 <view class="goods-num">
113   - <block wx:if="prom_st>0">
  116 + <block>
114 117 <view class="stock">总数量:{{prom_act.goods_num+prom_act.virtual}}件</view>
115 118  
116 119 <view class="stock" wx:if="{{prom_act.buy_limit>0}}">限购:{{prom_act.buy_limit}}件</view>
117 120 <view class="stock" wx:else>限购:不限</view>
  121 + <view class="sales">已购:{{prom_act.buy_num+prom_act.virtual}}件</view>
118 122  
119   - <block wx:if="{{prom_st==0}}">
  123 + <!-- <block wx:if="{{prom_st==0}}">
120 124 <view class="sales">已购:0件</view>
121   - </block>
  125 + </block> -->
122 126  
123   - <block wx:else>
  127 + <!-- <block wx:else>
124 128 <view class="sales">已购:{{prom_act.buy_num+prom_act.virtual}}件</view>
125   - </block>
  129 + </block> -->
126 130 </block>
127   - <block wx:else>
  131 + <!-- <block wx:else>
128 132 <view class="stock">总数量:{{prom_act.goods_num}}件</view>
129 133 <view class="stock" wx:if="{{prom_act.buy_limit>0}}">限购:{{prom_act.buy_limit}}件</view>
130 134 <view class="stock" wx:else>限购:不限</view>
131 135 <view class="sales">已购:{{prom_act.buy_num}}件</view>
132   - </block>
  136 + </block> -->
133 137 </view>
134 138 </block>
135 139  
... ... @@ -635,7 +639,10 @@
635 639 <view bindtap="closeSpecModal" class="cover-layer"></view>
636 640 <view class="spec-model">
637 641 <view class="pding">
  642 +
638 643 <icon bindtap="closeSpecModal" class="modal-close" color="black" size="22" type="cancel"></icon>
  644 +
  645 +
639 646 <view class="spec-goods">
640 647 <image class="wh100 spec-img" src="{{iurl}}{{data.image_url?data.image_url:'miniapp/images/default_g_img.gif'}}"
641 648 binderror="pop_err_img" data-errorimg="data.image_url" />
... ... @@ -650,14 +657,14 @@
650 657 </view>
651 658 </view>
652 659  
  660 +
  661 +
653 662 <!-- 选择门店模块 -->
654 663 <view class="flex-space-between address ai_end xc-width" style="padding-top: 30rpx;">
655 664 <view class="flex ai_end" wx:if="{{def_pick_store && def_pick_store.pickup_name}}">
656 665 <text class="fs30 xc-black3 shop_name">{{def_pick_store.pickup_name}}</text>
657 666 <view class="distance fs24 xc-ash" wx:if="{{def_pick_store.distance!=null}}">
658   - 距离:{{def_pick_store.distance>1000?filters.toFix(def_pick_store.distance/1000,2)+"km":filters.toFix(def_pick_store.distance,0)+"m"}}
659   -
660   - </view>
  667 + 距离:{{def_pick_store.distance>1000?filters.toFix(def_pick_store.distance/1000,2)+"km":filters.toFix(def_pick_store.distance,0)+"m"}}</view>
661 668 </view>
662 669  
663 670 <!-- 没有门店的时候 -->
... ... @@ -668,6 +675,9 @@
668 675  
669 676 <view class="red-co fs28" bindtap="choice_store">更多门店<text class="right-arrow"></text></view>
670 677 </view>
  678 +
  679 +
  680 +
671 681 <view wx:if="{{only_pk && !only_pk.length}}">(库存不足)</view>
672 682 <block wx:else>
673 683 <view wx:if="{{def_pickpu_list && !def_pickpu_list.length}}">(库存不足)</view>
... ... @@ -722,10 +732,8 @@
722 732 <view class="spec-cart-btn fs32" data-action="add" style="background-color: #dcdcdc;color: #999">库存不足</view>
723 733 </block>
724 734 <block wx:else>
725   - <view wx:if="{{openSpecModal_ind==1}}" bindtap="addCart" data-openSpecModal_ind="{{openSpecModal_ind}}" class="spec-cart-btn yellow fs32"
726   - data-action="add">加入购物车</view>
727   - <view wx:if="{{openSpecModal_ind==2}}" bindtap="addCart" data-openSpecModal_ind="{{openSpecModal_ind}}" class="spec-cart-btn spec-buy"
728   - data-action="buy">
  735 + <view wx:if="{{openSpecModal_ind==1}}" bindtap="addCart" data-openSpecModal_ind="{{openSpecModal_ind}}" class="spec-cart-btn yellow fs32" data-action="add">加入购物车</view>
  736 + <view wx:if="{{openSpecModal_ind==2}}" bindtap="addCart" data-openSpecModal_ind="{{openSpecModal_ind}}" class="spec-cart-btn spec-buy" data-action="buy">
729 737 {{sele_g.offline_price?"券后购买":"立即购买"}}
730 738 </view>
731 739 </block>
... ... @@ -745,13 +753,15 @@
745 753 {{sele_g.offline_price?"券后购买":"立即购买"}}
746 754 </view>
747 755 </block>
  756 +
748 757 <!-- 普通商品 -->
749   - <block wx:else>
  758 + <!-- <block wx:else>
750 759 <view wx:if="{{openSpecModal_ind==2}}" bindtap="addCart" data-openSpecModal_ind="{{openSpecModal_ind}}" class="spec-cart-btn spec-buy {{!sto_sele_name?'gray':''}}"
751 760 data-action="buy">
752 761 {{sele_g.offline_price?"券后购买":"立即购买"}}
753 762 </view>
754   - </block>
  763 + </block> -->
  764 +
755 765 </block>
756 766 </block>
757 767 </block>
... ...