Commit ed23222246a548fd6a4689a5b3886b19771c7757

Authored by yvan.ni
1 parent 8a8c90a3

卡项预售的优化

packageC/pages/presell/cardInfo/goodsInfo.js
... ... @@ -876,7 +876,7 @@ Page({
876 876  
877 877 var e = this, th = e, o = this.data.sele_g, a = o.goods_id;
878 878 //----------添加到购物车时,要判断限购数量,--------
879   - e.get_buy_num(o, function (ee) {
  879 + e.get_buy_num2(o, function (ee) {
880 880 //---判断商品是否超出限购---
881 881 if (th.data.g_buy_num != null && th.data.sele_g.viplimited > 0) {
882 882 if (th.data.goodsInputNum + th.data.g_buy_num.get(th.data.sele_g.goods_id) > th.data.sele_g.viplimited) {
... ... @@ -3420,65 +3420,11 @@ Page({
3420 3420 func(f_more);
3421 3421  
3422 3422 },
3423   -
3424   -
3425   -
3426 3423  
3427 3424  
3428   -
3429   - //-------------获取购买数量的总函数----------------
3430   - get_buy_num: function (gd, func) {
3431   - // var map = this.data.g_buy_num,
3432   - var th = this,
3433   - user_id = getApp().globalData.user_id;
3434   - if (user_id == null) {
3435   - // map.set(gd.goods_id, 0);
3436   - th.setData({
3437   - // g_buy_num: map,
3438   - prom_buy_num: 0,
3439   - });
3440   - "function" == typeof func && func();
3441   - return false;
3442   - }
3443   -
3444   - // if (map.has(gd.goods_id)) {
3445   - // "function" == typeof func && func();
3446   - // } else {
3447   - //----获取商品购买数----
3448   - if (th.data.prom_type == 1) {
3449   - //----获取活动购买数----
3450   - getApp().request.promiseGet("/api/weshop/rechargeServicelist/getUserBuyGoodsNum", {
3451   - data: {
3452   - store_id: os.stoid,
3453   - user_id: user_id,
3454   - card_id: th.data.options.goods_id,
3455   - prom_type: th.data.options.prom_type,
3456   - prom_id: th.data.options.prom_id
3457   - },
3458   - //-----获取-----
3459   - success: function (tt) {
3460   - if (tt.data.code == 0) {
3461   - // map.set(gd.goods_id, g_buy_num);
3462   - th.setData({
3463   - // g_buy_num: map,
3464   - promcardbuynum: tt.data.data.promcardbuynum,
3465   - cardbuynum: tt.data.data.cardbuynum,
3466   - });
3467   - "function" == typeof func && func();
3468   - }
3469   - }
3470   - });
3471   - } else {
3472   - "function" == typeof func && func();
3473   - };
3474   -
3475   - },
3476   -
3477   -
3478 3425 get_buy_num2: async function () {
3479 3426 // var map = this.data.g_buy_num,
3480   - var th = this,
3481   - user_id = getApp().globalData.user_id;
  3427 + var th = this,user_id = getApp().globalData.user_id;
3482 3428 // if (user_id == null) {
3483 3429 // // map.set(gd.goods_id, 0);
3484 3430 // th.setData({
... ...
packageC/pages/presell/cart/cart.js
... ... @@ -2686,6 +2686,13 @@ Page({
2686 2686  
2687 2687 //显示支付选择
2688 2688 show_pay: function () {
  2689 +
  2690 + //-- 服务卡项没有余额支付 --
  2691 + if(this.data.is_fwk){
  2692 + this.to_pay_type(0);
  2693 + return false;
  2694 + }
  2695 +
2689 2696 //不用钱直接支付
2690 2697 if (this.data.order_m <= 0) {
2691 2698 this.to_pay_type(1);
... ...
packageC/pages/presell/cart/cart.wxml
... ... @@ -233,7 +233,7 @@
233 233 {{order.store_prom}}
234 234 </view>
235 235  
236   - <view class="xc-coupon-frame flex-center" data-bn="1" bindtap="open_coupon_list" data-pickid="{{pickup_id}}"
  236 + <view class="xc-coupon-frame flex-center" data-bn="1" bindtap="open_coupon_list" data-pickid="{{pickup_id}}" hidden="{{is_fwk}}"
237 237 wx:if="{{(selected_quan_list && selected_quan_list.length>0) || get_by_quan_list!=null}}">
238 238 <view class="work-frame flex-space-between">
239 239 <view class="work">
... ... @@ -253,7 +253,7 @@
253 253 </view>
254 254 </view>
255 255  
256   - <view class="xc-coupon-frame" wx:if="{{bn_exp_type==0 && !is_default_logistics}}">
  256 + <view class="xc-coupon-frame" wx:if="{{bn_exp_type==0 && !is_default_logistics && !is_fwk}}">
257 257 <view class="flex-space-between" style="padding: 20rpx 25rpx; font-size: 30rpx;">
258 258 <view>选择物流</view>
259 259 <view class="flex-vertical" bindtap="show_wu_arr" data-txt='index' style="margin-right: 12rpx;">
... ... @@ -308,7 +308,7 @@
308 308  
309 309  
310 310 <!-----使用佣金--- 佣金必须要小于尾款的支付的金额 ,同时订单优惠--->
311   - <view class="set-mes bdr_t-14" wx:if="{{goods.use_commission>0 && can_commission && util.get_sum(tail_pay,exp_price,order_prom_amount)>goods.use_commission}}">
  311 + <view class="set-mes bdr_t-14" wx:if="{{!is_fwk && goods.use_commission>0 && can_commission && util.get_sum(tail_pay,exp_price,order_prom_amount)>goods.use_commission}}">
312 312 <view class="use-item" bindtap='set_bn_commission'>
313 313 <icon color="{{bn_use_commission?'red':'gray'}}" size="16" type="success"></icon>
314 314 <view class="yu_er">使用佣金 :¥{{goods.use_commission}} </view>
... ...
packageC/pages/presell/cart/cart2.js
... ... @@ -183,6 +183,12 @@ Page({
183 183 //判断是不是佣金抵扣
184 184 getApp().is_distribut(this);
185 185  
  186 + var gg = to.get_b_now();
  187 + if(gg.fwk){
  188 + this.setData({is_fwk: 1});
  189 + }
  190 +
  191 +
186 192 },
187 193 onUnload: function () {
188 194 this.setData({ isclose: 1 })
... ... @@ -572,7 +578,7 @@ Page({
572 578 bn_goods: t.data.data,
573 579 bn_pickname: gg.pick_name,
574 580 bn_pick: gg.pick_id,
575   - act: act
  581 + act: act,
576 582 });
577 583  
578 584 //计算价格
... ... @@ -1265,7 +1271,7 @@ Page({
1265 1271 };
1266 1272  
1267 1273 //判断是不是购物车购买还是立即购买
1268   - var gg = getApp().globalData.service_now;
  1274 + var gg = th.data.gg;
1269 1275 if (!gg.pick_id) {
1270 1276 getApp().showWarning("未找到门店");
1271 1277 return false;
... ... @@ -1274,17 +1280,14 @@ Page({
1274 1280 'card_id': th.data.bn_goods.id,
1275 1281 'itemid': th.data.bn_goods.erpItemID,
1276 1282 'qty': gg.goods_num,
1277   - 'price': th.data.bn_goods.money,
  1283 + 'price': th.data.bn_goods.shop_price,
1278 1284 // 'price': th.data.formData.order_amount,
1279 1285 'pickup_id': gg.pick_id,
1280 1286 'pickup_keyid': gg.keyid,
1281   - 'prom_type': this.data.postdata.prom_type, //促销活动类型
1282   - 'prom_id': this.data.postdata.prom_id, //促销活动id
  1287 + 'prom_type': 8, //促销活动类型
  1288 + 'prom_id': this.data.act.id, //促销活动id
1283 1289 };
1284 1290  
1285   - if(this.data.postdata.prom_type == 1) {
1286   - goods.price = this.data.postdata.prom_price;
1287   - };
1288 1291  
1289 1292 if(getApp().globalData.skinface_id){
1290 1293 goods.skinface_id=getApp().globalData.skinface_id;
... ... @@ -1408,7 +1411,7 @@ Page({
1408 1411 //--------------------提交订单-----------------------
1409 1412 async submitForm(t) {
1410 1413  
1411   - if(th.data.fwk==1){
  1414 + if(this.data.is_fwk==1){
1412 1415 this.submitForm_card_next();
1413 1416 return false;
1414 1417 }
... ...
packageC/pages/presell/cart/cart2.wxml
... ... @@ -6,7 +6,7 @@
6 6 <view class="container">
7 7  
8 8 <!-- 立即购买的时候 -->
9   - <view class="tab-container" wx:if="{{show_submit && act.goods_type==0}}">
  9 + <view class="tab-container" wx:if="{{show_submit && act.goods_type==0 && !is_fwk}}">
10 10 <view class="tab-wrapper">
11 11 <view hidden="{{bn_t_exp_t==2}}" bindtap='setexptype' data-t='1' class="tab {{bn_exp_type == 1? 'active':''}}"
12 12 data-txt='cartlist[0].exp_type' data-wl_txt='cartlist[0].wind' data-index="{{index}}" >门店自提</view>
... ... @@ -22,7 +22,7 @@
22 22 </view>
23 23  
24 24 <!--要进行判断地址是否显示---->
25   - <view bindtap="enterAddressPage" class="user-mes mgt20" hidden='{{bn_exp_type==1 && is_b_now==1 && act.goods_type==0}}'>
  25 + <view bindtap="enterAddressPage" class="user-mes mgt20" wx:if="{{!is_fwk}}" hidden='{{bn_exp_type==1 && is_b_now==1 && act.goods_type==0}}'>
26 26 <!---默认地址显示------>
27 27 <block wx:if="{{user_addr!=null}}">
28 28 <view class="user-contact">
... ... @@ -150,7 +150,8 @@
150 150 <icon color="#f23030" size="16" type="info"></icon>{{order.store_prom}}
151 151 </view>
152 152  
153   - <view class="xc-coupon-frame flex-center" data-bn="1" bindtap="open_coupon_list" data-pickid="{{bn_pick}}" wx:if="{{(selected_quan_list && selected_quan_list.length>0) || get_by_quan_list!=null}}">
  153 + <view class="xc-coupon-frame flex-center" data-bn="1" bindtap="open_coupon_list" data-pickid="{{bn_pick}}" hidden="{{is_fwk}}"
  154 + wx:if="{{(selected_quan_list && selected_quan_list.length>0) || get_by_quan_list!=null}}">
154 155 <view class="work-frame flex-space-between">
155 156 <view class="work">
156 157 优惠券 <text class="quan_num_show">{{(selected_quan_list?selected_quan_list.length:0)+ (get_by_quan_list?get_by_quan_list.length:0)}}张可用</text>
... ... @@ -166,7 +167,7 @@
166 167 </view>
167 168 </view>
168 169  
169   - <view class="xc-coupon-frame" wx:if="{{bn_exp_type==0 && !is_default_logistics}}">
  170 + <view class="xc-coupon-frame" wx:if="{{bn_exp_type==0 && !is_default_logistics && !is_fwk}}">
170 171 <view class="flex-space-between" style="padding: 20rpx 25rpx; font-size: 30rpx;">
171 172 <view>选择物流</view>
172 173 <view class="flex-vertical" bindtap="show_wu_arr" data-txt='index' style="margin-right: 12rpx;">
... ... @@ -214,7 +215,7 @@
214 215 </view>
215 216  
216 217 <!-----使用佣金------>
217   - <view class="set-mes bdr_t-14" wx:if="{{bn_goods.use_commission>0 && can_commission}}">
  218 + <view class="set-mes bdr_t-14" wx:if="{{bn_goods.use_commission>0 && can_commission && !is_fwk}}">
218 219 <view class="use-item" bindtap='set_bn_commission'>
219 220 <icon color="{{bn_use_commission?'red':'gray'}}" size="16" type="success"></icon>
220 221 <view class="yu_er">使用佣金 :¥{{bn_goods.use_commission}} </view>
... ... @@ -223,7 +224,7 @@
223 224  
224 225  
225 226 <!-----使用余额------>
226   - <view class="set-mes bdr_t-14" wx:if="{{yuer>0}}">
  227 + <view class="set-mes bdr_t-14" wx:if="{{yuer>0 && !is_fwk}}">
227 228 <view class="use-item" bindtap='set_bn_useyuer'>
228 229 <icon color="{{bn_use_money?'red':'gray'}}" size="16" type="success"></icon>
229 230 <view class="yu_er">使用余额 :¥{{yuer}} </view>
... ...
packageC/pages/presell/cart/cart2_pre.js
... ... @@ -944,6 +944,9 @@ Page({
944 944 icon: 'success',
945 945 duration: 2000
946 946 });
  947 +
  948 + var url = "/packageC/pages/presell/cart/cart?order_sn=" + data.data.order_sn;
  949 +
947 950 setTimeout(function () {
948 951 wx.reLaunch({
949 952 url: "/pages/payment/pay_success/pay_success?card=1&order_id=" + th.data.order_id,
... ...
pages/user/order_list/order_list.js
... ... @@ -2843,14 +2843,17 @@ Page({
2843 2843 switch (currentIndex) {
2844 2844 case 0: { // 全部
2845 2845 delete data.order_status;
  2846 + delete data.pay_status;
2846 2847 break;
2847 2848 };
2848 2849 case 1: { // 待支付
2849 2850 data.order_status = 0;
  2851 + delete data.pay_status;
2850 2852 break;
2851 2853 };
2852 2854 case 2: { // 待评价
2853   - data.order_status = 1;
  2855 + data.pay_status = 1;
  2856 + data.order_status=1;
2854 2857 break;
2855 2858 };
2856 2859 };
... ... @@ -2906,6 +2909,7 @@ Page({
2906 2909 var pt_act=null; //-- 拼团活动的优化 --
2907 2910  
2908 2911 for (const it of list) {
  2912 + //秒杀
2909 2913 if (it.prom_type == 1) {
2910 2914 let act_details = null;
2911 2915 let redis_num = 0;
... ... @@ -2993,7 +2997,7 @@ Page({
2993 2997 }
2994 2998  
2995 2999 };
2996   -
  3000 + //拼团
2997 3001 if (it.prom_type == 6) {
2998 3002 let act_details = null;
2999 3003 let redis_num = 0;
... ... @@ -3085,6 +3089,98 @@ Page({
3085 3089 pt_act=act_details;
3086 3090  
3087 3091 }
  3092 + //预售
  3093 + if (it.prom_type == 8) {
  3094 + let act_details = null;
  3095 + let redis_num = 0;
  3096 + let promcardbuynum = 0;
  3097 + let qty = it.qty;
  3098 +
  3099 + await getApp().request.promiseGet("/api/weshop/teamlist/get/" + store_id + "/" + it.prom_id, {}).then(res => {
  3100 +
  3101 + if (res.data.code == 0) {
  3102 +
  3103 + act_details = res.data.data;
  3104 +
  3105 + if (act_details.is_end == 1) {
  3106 + wx.showModal({
  3107 + title: '提示',
  3108 + content: '活动已结束,无法支付,请取消订单!',
  3109 + showCancel: false,
  3110 + });
  3111 + flag = false;
  3112 + return false;
  3113 + }
  3114 +
  3115 + if (act_details.id != it.prom_id) {
  3116 + wx.showModal({
  3117 + title: '提示',
  3118 + content: '活动发生了变化,无法支付,请取消订单,重新购买!',
  3119 + showCancel: false,
  3120 + });
  3121 + flag = false;
  3122 + return false;
  3123 + }
  3124 +
  3125 + var t_now = ut.gettimestamp();
  3126 + if (act_details.is_end == 1 || act_details.start_time > t_now || act_details.end_time < t_now) {
  3127 + wx.showModal({
  3128 + title: '提示',
  3129 + content: '活动发生了变化,无法支付,请取消订单,重新购买!',
  3130 + showCancel: false,
  3131 + });
  3132 + flag = false;
  3133 + return false;
  3134 + }
  3135 +
  3136 + //指定门店的控制
  3137 + if (act_details.pick_up_lists) {
  3138 + var idx0=act_details.pick_up_lists.findIndex(function (e){
  3139 + return e.pickup_id==it.pickup_id;
  3140 + })
  3141 + if(idx0<0){
  3142 + getApp().confirmBox(it.service_name + "拼团活动的门店不可售");
  3143 + th.setData({ paying: 0 });
  3144 + flag = false;
  3145 + return false;
  3146 + }
  3147 + }
  3148 +
  3149 +
  3150 + }
  3151 + });
  3152 +
  3153 + if(act_details.buy_limit>0 && flag){
  3154 + await getApp().request.promiseGet("/api/weshop/rechargeServicelist/getUserBuyGoodsNum", {
  3155 + data: {
  3156 + store_id: store_id,
  3157 + user_id: user_id,
  3158 + card_id: it.card_id,
  3159 + prom_type: it.prom_type,
  3160 + prom_id: it.prom_id,
  3161 + ispay:1
  3162 + }
  3163 + }).then(res => {
  3164 + if (res.data.code == 0) {
  3165 + console.log('已经购买的数量:', res.data.data);
  3166 + promcardbuynum = res.data.data.promcardbuynum;
  3167 + }
  3168 + })
  3169 + let limited = act_details.buy_limit; // 限购数量a
  3170 + let canBuyNum = limited - promcardbuynum; // 自己还可购买的数量c
  3171 +
  3172 + if (canBuyNum < qty ) {
  3173 + wx.showModal({
  3174 + title: '提示',
  3175 + content: '您已超出活动限购数量,无法支付,请取消订单!',
  3176 + showCancel: false,
  3177 + });
  3178 + flag = false;
  3179 + }
  3180 + }
  3181 + pt_act=act_details;
  3182 +
  3183 + }
3088 3184  
3089 3185 }
3090 3186  
... ...
pages/user/order_list/order_list.wxml
... ... @@ -322,7 +322,6 @@
322 322 <!--商品编号 -->
323 323 <text selectable='true'>订单编号:{{item.order_sn}}</text>
324 324  
325   -
326 325 <!-- 这是预售的 -->
327 326 <block wx:if="{{item.presell}}">
328 327 <block wx:if="{{item.order_status==3}}">
... ... @@ -333,6 +332,17 @@
333 332 <text wx:if="{{item.presell.presell_type!=1 && item.presell.deposit_pay_time && !item.presell.tail_pay_state}}">待尾款</text>
334 333 <text wx:if="{{item.presell.presell_type==1 && item.order_status<2 && item.pay_status<1 }}">未支付</text>
335 334 </block>
  335 +
  336 + <view wx:if="{{(item.order_status==1 && item.pay_status==1)}}" class="flex-center">待评价<view class="lin"></view>
  337 + <image src="{{iurl}}miniapp/images/trash.png" bindtap="deleteSerOrderData" data-index="{{index}}" data-order_id="{{item.order_id}}"></image>
  338 + </view>
  339 + <view wx:if="{{item.order_status==2}}" class="flex-center">已评价<view class="lin"></view>
  340 + <image src="{{iurl}}miniapp/images/trash.png" bindtap="deleteSerOrderData" data-index="{{index}}" data-order_id="{{item.order_id}}"></image>
  341 + </view>
  342 + <view wx:if="{{item.order_status==3 && item.pt_status!=6}}" class="flex-center" >已取消<view class="lin"></view>
  343 + <image src="{{iurl}}miniapp/images/trash.png" bindtap="deleteSerOrderData" data-index="{{index}}" data-order_id="{{item.order_id}}"></image>
  344 + </view>
  345 +
336 346 </block>
337 347  
338 348 <block wx:else>
... ... @@ -459,7 +469,7 @@
459 469 </block>
460 470  
461 471  
462   - <block wx:if="{{item.presell && item.order_status<3 && item.presell.deposit_pay_time>0 && item.presell.tail_pay_state==0}}">
  472 + <block wx:if="{{item.presell && item.presell.presell_type==0 && item.order_status<3 && item.presell.deposit_pay_time>0 && item.presell.tail_pay_state==0}}">
463 473 <navigator class="commodity_To_evaluate flex-level comment_go" url="/packageC/pages/presell/cart/cart?order_id={{item.order_id}}&is_fwk=1" data-idx="{{index}}" >支付尾款</navigator>
464 474  
465 475 </block>
... ...
utils/LoadMore.js
... ... @@ -72,7 +72,7 @@ var e = function() {
72 72  
73 73 //格式化
74 74 var glist="";
75   - if(g) {
  75 + if(g && g.length) {
76 76 for (var ii = 0; ii < g.length; ii++) {
77 77 //if(g[i].prom_type == 1 || g[i].prom_type == 2 || g[i].prom_type == 6) {
78 78 if (g[ii].prom_type && g[ii].prom_type == 1) {
... ...