Commit bb30d76fddd7e82d878722e5919fac52641b3290

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

服务卡秒杀修改

packageA/pages/goodsInfo/buy_flash_normal.wxml 0 → 100644
  1 +<view bindtap="closeSpecModal_flash_normal" class="cover-layer"></view>
  2 + <view class="spec-model">
  3 + <view class="pding">
  4 + <icon bindtap="closeSpecModal_flash_normal" class="modal-close" color="black" size="22" type="cancel"></icon>
  5 + <view class="spec-goods">
  6 + <image class="wh100 spec-img xc-distance-bottom" bindtap="previewImage" src="{{iurl + (data.image_url ? data.image_url:'miniapp/images/default_g_img.gif')}}" binderror="pop_err_img" data-errorimg="data.img_url"></image>
  7 + <view class="spec-goods-info">
  8 + <view class="spec-goods-name ellipsis-2">{{data.goods_name}}</view>
  9 + <view class="flex ai_end xc-val-money">
  10 + <text class="fs20">¥</text>{{data.shop_price}}
  11 + <!-- 如果是等级会员,且有等级价 -->
  12 + <!-- <block wx:if="{{card_field && sele_g[card_field]>0}}">{{sele_g[card_field]}} </block> -->
  13 + <!-- <block wx:else>{{sele_g.shop_price}}</block> -->
  14 + </view>
  15 +
  16 + <!-- <view class="flex">
  17 + <view class="spec-goods-stock">已售:{{sele_g.sales_sum}}</view>
  18 + <block wx:if="{{sales_rules==2}}">
  19 + <view class="spec-goods-stock" wx:if="{{def_pick_store && def_pick_store.CanOutQty}}">可售:{{def_pick_store.CanOutQty}}</view>
  20 + <view class="spec-goods-stock" wx:else>可售:0</view>
  21 + </block>
  22 + <block wx:else><view class="spec-goods-stock">可售:{{sele_g.store_count}}</view></block>
  23 + </view> -->
  24 +
  25 +
  26 + </view>
  27 +
  28 + <!-- 选择门店模块 -->
  29 + <view class="flex-space-between address ai_end xc-width ">
  30 +
  31 + <view class="flex ai_end" wx:if="{{def_pick_store && def_pick_store.pickup_name}}">
  32 + <text class="fs30 xc-black3 shop_name">{{def_pick_store.pickup_name}}</text>
  33 + <view class="distance fs24 xc-ash"wx:if="{{def_pick_store.distance!=null}}">
  34 + 距离:{{def_pick_store.distance>1000?filters.toFix(def_pick_store.distance/1000,2)+"km":filters.toFix(def_pick_store.distance,0)+"m"}}
  35 +
  36 + </view>
  37 + </view>
  38 +
  39 + <!-- 没有门店的时候 -->
  40 + <view class="flex" bindtap="choice_store" wx:else>
  41 + <image class="stores-img" src="{{iurl}}/miniapp/images/stores.png"></image>
  42 + <view class="fs30" style="color:black;">选择门店</view>
  43 + </view>
  44 +
  45 + <view class="red-co fs28" bindtap="choice_store" >更多门店<text class="right-arrow"></text></view>
  46 + </view>
  47 + <view wx:if="{{only_pk && !only_pk.length}}">(库存不足)</view>
  48 + <block wx:else>
  49 + <view wx:if="{{def_pickpu_list && !def_pickpu_list.length}}">(库存不足)</view>
  50 + <block wx:else>
  51 + <view class="no_store" wx:if="{{def_pick_store.is_no_dis}}">(配送不匹配)</view>
  52 + <view wx:elif="{{def_pick_store && !def_pick_store.CanOutQty && sales_rules==2 && prom_type==0}}">(库存不足)</view>
  53 + </block>
  54 + </block>
  55 + <view class="fs24 xc-ash-9f xc-distance-top "wx:if="{{def_pick_store && def_pick_store.fulladdress}}">地址:{{def_pick_store.fulladdress}}</view>
  56 +
  57 +
  58 + <!--商品的属性项目-->
  59 + <!-- <view class="xc-goods-attribute">
  60 + <view hidden="{{ismend==1}}" class="spec-name">商品规格</view>
  61 + <view hidden="{{ismend==1}}" style="max-height: 120rpx;overflow-y: auto;">
  62 + <view class="spec_bt {{gid==item.goods_id?'act':''}}" bindtap="sele_spec" data-nor="1" data-gid='{{item.goods_id}}' wx:for="{{sku_g_pt}}" wx:key="sku_g">
  63 + {{item.gg}}
  64 + </view>
  65 + </view>
  66 + </view> -->
  67 +
  68 + <view class="b_num">
  69 + <view>购买数量</view>
  70 + <view class="count">
  71 + <view bindtap="{{goodsInputNum <= 1 ? '':'subCartNum'}}" class="sub {{goodsInputNum <= 1 ? 'active':''}}">-</view>
  72 + <input bindblur="inputCartNum" type="number" value="{{goodsInputNum}}"></input>
  73 + <view bindtap="addCartNum" class="add">+</view>
  74 + </view>
  75 + </view>
  76 + </view>
  77 +
  78 +
  79 + <!-- 提示再买多少优惠 -->
  80 + <view style="margin-top: 35rpx;color:#333;font-size:28rpx;" wx:if="{{hui_condition}}">
  81 + 再买{{hui_condition.need}}
  82 + <text wx:if="{{hui_condition.money}}">,免{{hui_condition.money}}元</text>
  83 + <text wx:if="{{hui_condition.sale}}">,打{{hui_condition.sale}}折</text>
  84 + <text wx:if="{{hui_condition.past==1}}">,包邮</text>
  85 + <text wx:if="{{hui_condition.intValue>0}}">,送{{hui_condition.intValue}}积分</text>
  86 + <text wx:if="{{hui_condition.couponId>0}}">,送优惠券</text>
  87 + <text wx:if="{{hui_condition.gift_id>0}}">,送赠品</text>
  88 + <text wx:if="{{hui_condition.lb_id>0}}">,送礼包</text>
  89 + <text wx:if="{{hui_condition.zxlb_id>0}}">,送专享礼包</text>
  90 + </view>
  91 +
  92 +
  93 + <!-- 按钮部分 -->
  94 + <view class="spec-cart-btns">
  95 +
  96 + <!-- 根本就找不到门店 -->
  97 + <block wx:if="{{def_pick_store && def_pick_store.is_no_dis}}">
  98 + <view class="spec-cart-btn fs32" data-action="add" style="background-color: #dcdcdc;color: #999;">配送不匹配</view>
  99 + </block>
  100 + <block wx:else>
  101 + <!-- 根本就找不到门店 -->
  102 + <block wx:if="{{!only_pk && !def_pickpu_list}}">
  103 + <view class="spec-cart-btn fs32" data-action="add" style="background-color: #dcdcdc;color: #999;">库存不足</view>
  104 + </block>
  105 + <block wx:else>
  106 +
  107 +
  108 + <block wx:if="{{only_pk.length && !only_pk.length}}">
  109 + <view class="spec-cart-btn fs32" data-action="add" style="background-color: #dcdcdc;color: #999;">库存不足</view>
  110 + </block>
  111 + <block wx:else>
  112 + <block wx:if="{{def_pickpu_list && !def_pickpu_list.length}}">
  113 + <view class="spec-cart-btn fs32" data-action="add" style="background-color: #dcdcdc;color: #999">库存不足</view>
  114 + </block>
  115 + <block wx:else>
  116 + <block wx:if="{{!def_pick_store}}">
  117 + <view class="spec-cart-btn fs32" data-action="add" style="background-color: #dcdcdc;color: #999">请先选择门店</view>
  118 + </block>
  119 + <block wx:else>
  120 + <block wx:if="{{data.store_count<=0}}">
  121 + <view class="spec-cart-btn fs32" data-action="add" style="background-color: #dcdcdc;color: #999">库存不足</view>
  122 + </block>
  123 + <block wx:else>
  124 + <view class="flex jc_sb">
  125 + <view class="spec-cart-btn spec-buy w40" bindtap="addCart"
  126 + data-action="add" style="background-color: #ffb03f;">加入购物车</view>
  127 + <view class="spec-cart-btn spec-buy w40" bindtap="addCart"
  128 + data-action="buy">立即购买</view>
  129 + </view>
  130 + </block>
  131 +
  132 + </block>
  133 + </block>
  134 + </block>
  135 + </block>
  136 + </block>
  137 + </view>
  138 +
  139 + </view>
  140 + </view>
  141 + <view class="clear"></view>
0 \ No newline at end of file 142 \ No newline at end of file
packageA/pages/goodsInfo/goodsInfo.js
@@ -8,6 +8,7 @@ var t = require(&quot;../../../utils/util.js&quot;), @@ -8,6 +8,7 @@ var t = require(&quot;../../../utils/util.js&quot;),
8 oo = s.globalData, 8 oo = s.globalData,
9 o = s.globalData.setting, 9 o = s.globalData.setting,
10 os = o; 10 os = o;
  11 +
11 let self = null; 12 let self = null;
12 13
13 //评价加载更多 14 //评价加载更多
@@ -50,7 +51,7 @@ Page({ @@ -50,7 +51,7 @@ Page({
50 supportPageScroll: !1, 51 supportPageScroll: !1,
51 address: { 52 address: {
52 address: "", 53 address: "",
53 - district: 0 54 + district: 0,
54 }, 55 },
55 shipping: "", 56 shipping: "",
56 shippingCost: 0, 57 shippingCost: 0,
@@ -199,17 +200,17 @@ Page({ @@ -199,17 +200,17 @@ Page({
199 sales_rules:1, //默认是线上销售 200 sales_rules:1, //默认是线上销售
200 201
201 wait_for_user_store:null, 202 wait_for_user_store:null,
202 - poster:null, //自定义海报  
203 - share_b_img:'', //自定义分享的背景  
204 - showPoster: false,  
205 - hui_condition:null,  
206 - sto_sele_name_1:'',//分享的门店名称 203 + poster:null, //自定义海报
  204 + share_b_img:'', //自定义分享的背景
  205 + showPoster: false,
  206 + hui_condition:null,
  207 + sto_sele_name_1:'',//分享的门店名称
207 208
208 // 秒杀 209 // 秒杀
209 - prom_st: 1, 210 + prom_st: 0,
210 prom_r_null: 0, 211 prom_r_null: 0,
211 212
212 - hiddenCS: true, 213 + hiddenCS: true, //控制客服操作菜单显示和控制
213 }, 214 },
214 215
215 //------初始化加载---------- 216 //------初始化加载----------
@@ -263,10 +264,10 @@ Page({ @@ -263,10 +264,10 @@ Page({
263 first_leader=gid_str[1]; 264 first_leader=gid_str[1];
264 } 265 }
265 //-- 如果有room_id的获取 -- 266 //-- 如果有room_id的获取 --
266 - if(gid_str.length>2 && gid_str[2]){ 267 + if(gid_str.length>2 && gid_str[2]) {
267 room_id=gid_str[2]; 268 room_id=gid_str[2];
268 room_user_share=1; 269 room_user_share=1;
269 - } 270 + };
270 }; 271 };
271 272
272 ee.setData({ gid: gid}); 273 ee.setData({ gid: gid});
@@ -311,7 +312,7 @@ Page({ @@ -311,7 +312,7 @@ Page({
311 is_show_gb: 1 312 is_show_gb: 1
312 }); 313 });
313 } 314 }
314 - console.log(e); 315 + // console.log(e);
315 var json_d = JSON.parse(e.switch_list); 316 var json_d = JSON.parse(e.switch_list);
316 ee.setData({ 317 ee.setData({
317 store_config: e, 318 store_config: e,
@@ -320,6 +321,7 @@ Page({ @@ -320,6 +321,7 @@ Page({
320 is_newsales_rules: json_d.is_newsales_rules 321 is_newsales_rules: json_d.is_newsales_rules
321 }); 322 });
322 ee.init(gid); 323 ee.init(gid);
  324 +
323 //------几人评价------- 325 //------几人评价-------
324 //n.init(th, "", "comments"); 326 //n.init(th, "", "comments");
325 327
@@ -372,7 +374,7 @@ Page({ @@ -372,7 +374,7 @@ Page({
372 374
373 //获取用户的默认门店 375 //获取用户的默认门店
374 getApp().get_user_store(function(e) { 376 getApp().get_user_store(function(e) {
375 - if(!e) { 377 + if(!e) {
376 th.data.fir_def_store={}; //赋值空对象 378 th.data.fir_def_store={}; //赋值空对象
377 return false; 379 return false;
378 } 380 }
@@ -433,7 +435,7 @@ Page({ @@ -433,7 +435,7 @@ Page({
433 appd.lat=that.data.lat; 435 appd.lat=that.data.lat;
434 appd.lon=that.data.lon; 436 appd.lon=that.data.lon;
435 437
436 - }else{ 438 + } else {
437 if (e) { 439 if (e) {
438 e.distance = null; 440 e.distance = null;
439 that.data.fir_def_store=e; 441 that.data.fir_def_store=e;
@@ -458,7 +460,7 @@ Page({ @@ -458,7 +460,7 @@ Page({
458 460
459 setTimeout(()=>{ 461 setTimeout(()=>{
460 wx.createSelectorQuery().selectAll(".showArea, .hideArea").boundingClientRect(res => { 462 wx.createSelectorQuery().selectAll(".showArea, .hideArea").boundingClientRect(res => {
461 - // console.log('node@@@@@@@', res); 463 +
462 if(res.length != 0) { 464 if(res.length != 0) {
463 this.setData({ 465 this.setData({
464 showFold: res[0].height < res[1].height, 466 showFold: res[0].height < res[1].height,
@@ -519,7 +521,9 @@ Page({ @@ -519,7 +521,9 @@ Page({
519 521
520 if(prom_type) { // 进入商品详情页地址传参有带goods_id、prom_type、prom_id参数, 即从秒杀入口进入 522 if(prom_type) { // 进入商品详情页地址传参有带goods_id、prom_type、prom_id参数, 即从秒杀入口进入
521 let prom_id = this.data.options.prom_id; 523 let prom_id = this.data.options.prom_id;
  524 + // 检查活动是否开始
522 this.check_prom(goods_id, prom_type, prom_id); 525 this.check_prom(goods_id, prom_type, prom_id);
  526 +
523 } else { // 从非秒杀入口进入,地址不带prom_type、prom_id参数 527 } else { // 从非秒杀入口进入,地址不带prom_type、prom_id参数
524 getApp().request.promiseGet('/api/weshop/activitylist/getGoodActInfo', { 528 getApp().request.promiseGet('/api/weshop/activitylist/getGoodActInfo', {
525 data: { 529 data: {
@@ -539,20 +543,16 @@ Page({ @@ -539,20 +543,16 @@ Page({
539 let prom_id = result[0].act_id; 543 let prom_id = result[0].act_id;
540 this.setData({ 544 this.setData({
541 'options.prom_type': prom_type, 545 'options.prom_type': prom_type,
  546 + 'options.prom_id': prom_id,
542 }); 547 });
  548 + // 检查活动是否开始
543 this.check_prom(goods_id, prom_type, prom_id); 549 this.check_prom(goods_id, prom_type, prom_id);
544 } else if(resLength > 1) { //如果数组长度大于1,表示当前商品参加多个活动,以列表形式显示多活动 550 } else if(resLength > 1) { //如果数组长度大于1,表示当前商品参加多个活动,以列表形式显示多活动
545 this.setData({ 551 this.setData({
546 actList: res.data.data, 552 actList: res.data.data,
547 }); 553 });
548 }; 554 };
549 -  
550 - // console.log('!!!!!!~~~~~~~~~prom~~~~~~~~~~!!!!!!');  
551 -  
552 - // this.setData({  
553 - // prom,  
554 - // });  
555 - 555 +
556 }; 556 };
557 }); 557 });
558 }; 558 };
@@ -671,8 +671,6 @@ Page({ @@ -671,8 +671,6 @@ Page({
671 671
672 672
673 673
674 -  
675 -  
676 674
677 i.get("/api/weshop/serviceCard/get/" + o.stoid + "/" + ee.data.gid, { 675 i.get("/api/weshop/serviceCard/get/" + o.stoid + "/" + ee.data.gid, {
678 failRollback: !0, 676 failRollback: !0,
@@ -702,6 +700,7 @@ Page({ @@ -702,6 +700,7 @@ Page({
702 that.setData({ 700 that.setData({
703 'data.goods_name': t.data.data.serviceName, 701 'data.goods_name': t.data.data.serviceName,
704 'data.shop_price': t.data.data.money, 702 'data.shop_price': t.data.data.money,
  703 + 'data.show_price': t.data.data.show_price,
705 'data.validDays': t.data.data.validDays, 704 'data.validDays': t.data.data.validDays,
706 'data.serviceContent': t.data.data.serviceContent, 705 'data.serviceContent': t.data.data.serviceContent,
707 'data.image_url': t.data.data.imgUrl, 706 'data.image_url': t.data.data.imgUrl,
@@ -746,6 +745,9 @@ Page({ @@ -746,6 +745,9 @@ Page({
746 }; 745 };
747 } 746 }
748 }); 747 });
  748 +
  749 +
  750 +
749 this.data.enterAddressPage && (this.data.enterAddressPage = !1); 751 this.data.enterAddressPage && (this.data.enterAddressPage = !1);
750 this.get_sto(); 752 this.get_sto();
751 753
@@ -817,15 +819,25 @@ Page({ @@ -817,15 +819,25 @@ Page({
817 activeCategoryId: 1 819 activeCategoryId: 1
818 }); 820 });
819 }, 821 },
820 -  
821 - 822 +
  823 + //获取redis中的数量
  824 + async getactLen(func) {
  825 + var r_num = 0,
  826 + prom_type = this.data.prom_type,
  827 + prom_id = this.data.prom_id;
  828 + await getApp().request.promiseGet("/api/weshop/activitylist/getActLen/" + os.stoid + "/" + prom_type + "/" + prom_id, {
  829 + 1: 1
  830 + }).then(res => {
  831 + var em = res;
  832 + if (em.data.code == 0) {
  833 + r_num = em.data.data;
  834 + }
  835 + })
  836 + func(r_num);
  837 + },
  838 +
822 //------------加入购物车-------------- 839 //------------加入购物车--------------
823 addCart: function(t) { 840 addCart: function(t) {
824 - if(this.data.goodsInputNum == 0) {  
825 - getApp().my_warnning('购买数量不能为0', 1, th, 450);  
826 - return false;  
827 - };  
828 -  
829 var th = this; 841 var th = this;
830 var ind = t.currentTarget.dataset.openSpecModal_ind; 842 var ind = t.currentTarget.dataset.openSpecModal_ind;
831 var action= t.currentTarget.dataset.action; 843 var action= t.currentTarget.dataset.action;
@@ -835,13 +847,10 @@ Page({ @@ -835,13 +847,10 @@ Page({
835 open_ind_store: ind 847 open_ind_store: ind
836 }); 848 });
837 849
838 - if(!th.data.sto_sele_name){ 850 + if(!th.data.sto_sele_name) {
839 getApp().my_warnning('请选择门店', 1, th, 450); 851 getApp().my_warnning('请选择门店', 1, th, 450);
840 return false; 852 return false;
841 } 853 }
842 -  
843 -  
844 -  
845 854
846 855
847 856
@@ -881,7 +890,7 @@ Page({ @@ -881,7 +890,7 @@ Page({
881 }); 890 });
882 891
883 let num = th.data.sele_g.viplimited - gd_buy_num; 892 let num = th.data.sele_g.viplimited - gd_buy_num;
884 - if (num < 0) num = 0; 893 + if (num <= 0) num = 1;
885 th.setData({goodsInputNum: num}); 894 th.setData({goodsInputNum: num});
886 return false; 895 return false;
887 } 896 }
@@ -894,7 +903,6 @@ Page({ @@ -894,7 +903,6 @@ Page({
894 903
895 904
896 905
897 -  
898 906
899 if(action=="buy"){ 907 if(action=="buy"){
900 //--------------此时操作的数据------------ 908 //--------------此时操作的数据------------
@@ -912,12 +920,20 @@ Page({ @@ -912,12 +920,20 @@ Page({
912 newd['prom_type'] = this.data.prom_type; 920 newd['prom_type'] = this.data.prom_type;
913 newd['prom_id'] = this.data.prom_id; 921 newd['prom_id'] = this.data.prom_id;
914 newd['prom_price'] = this.data.prom_price; 922 newd['prom_price'] = this.data.prom_price;
915 - } 923 + };
  924 +
  925 + if(this.data.prom_act.is_shop_buy) {
  926 + newd['prom_type'] = 0;
  927 + newd['prom_price'] = this.data.data.shop_price;
  928 + };
916 929
917 // console.log('newd++++++++', newd); 930 // console.log('newd++++++++', newd);
918 th.buyNow(newd); 931 th.buyNow(newd);
919 } else { 932 } else {
920 - 933 +
  934 +
  935 +
  936 +
921 var newd = { 937 var newd = {
922 service_id: th.data.data.id, 938 service_id: th.data.data.id,
923 service_sn:th.data.data.service_sn, 939 service_sn:th.data.data.service_sn,
@@ -928,7 +944,7 @@ Page({ @@ -928,7 +944,7 @@ Page({
928 store_id:os.stoid, 944 store_id:os.stoid,
929 money:th.data.data.shop_price 945 money:th.data.data.shop_price
930 }; 946 };
931 - if(getApp().globalData.guide_id){ 947 + if(getApp().globalData.guide_id) {
932 newd['guide_id'] = getApp().globalData.guide_id; 948 newd['guide_id'] = getApp().globalData.guide_id;
933 newd['guide_type']=0; 949 newd['guide_type']=0;
934 } 950 }
@@ -988,14 +1004,16 @@ Page({ @@ -988,14 +1004,16 @@ Page({
988 } 1004 }
989 1005
990 1006
  1007 +
  1008 +
991 }, 1009 },
992 1010
993 //----------立即购买----------- 1011 //----------立即购买-----------
994 buyNow: function(e) { 1012 buyNow: function(e) {
995 - getApp().globalData.service_now=e;  
996 - wx.redirectTo({  
997 - url: "/packageA/pages/cart2_ser/cart2_ser",  
998 - }); 1013 + getApp().globalData.service_now=e;
  1014 + wx.redirectTo({
  1015 + url: "/packageA/pages/cart2_ser/cart2_ser",
  1016 + });
999 }, 1017 },
1000 //----------增加购买数量----------- 1018 //----------增加购买数量-----------
1001 addCartNum: function(t) { 1019 addCartNum: function(t) {
@@ -1012,9 +1030,108 @@ Page({ @@ -1012,9 +1030,108 @@ Page({
1012 1030
1013 //------检查数量是不是超出限购------ 1031 //------检查数量是不是超出限购------
1014 checkCartNum: function(t) { 1032 checkCartNum: function(t) {
1015 - if(t<=0) return false;  
1016 - var th = this;  
1017 - th.setData({goodsInputNum:t}) 1033 +
  1034 + var th = this;
  1035 +
  1036 + // if(this.data.prom_act.is_shop_buy && this.data.options.prom_type != 1) {
  1037 + // if(th.data.is_normal) {
  1038 +
  1039 + if(t<=0) return false;
  1040 + th.setData({goodsInputNum:t});
  1041 + // } else {
  1042 +
  1043 + if(this.data.options.prom_type == 1 && !this.data.openSpecModal_flash_normal) {
  1044 +
  1045 + this.get_buy_num(this.data.sele_g, async function () {
  1046 + th.data.sele_g.viplimited = th.data.sele_g.buy_limit;
  1047 +
  1048 + //--判断商品是否超出限购--
  1049 + // if (th.data.g_buy_num != null && th.data.sele_g.viplimited > 0) {
  1050 + if(!th.data.prom_act.is_shop_buy) {
  1051 +
  1052 + if (th.data.sele_g.viplimited > 0) {
  1053 + var gd_buy_num = th.data.sele_g.buy_num;
  1054 +
  1055 + if (t + gd_buy_num> th.data.sele_g.viplimited) {
  1056 + wx.showModal({
  1057 + title: '超出商品限购',
  1058 + });
  1059 +
  1060 + var num = th.data.sele_g.viplimited - gd_buy_num;
  1061 + if (num <= 0) num = 1;
  1062 + th.setData({goodsInputNum: num})
  1063 + return false;
  1064 + }
  1065 + }
  1066 +
  1067 + };
  1068 +
  1069 +
  1070 + //如果是普通购买的情况下
  1071 + if(th.data.openSpecModal_flash_normal) th.data.is_normal=1;
  1072 +
  1073 + //--判断商品是否超出活动限购--
  1074 + if (th.data.prom_buy_num != -1 && th.data.prom_buy_limit > 0 && !th.data.is_normal) {
  1075 + if (t + th.data.prom_buy_num > th.data.prom_buy_limit) {
  1076 + wx.showModal({
  1077 + title: '超出商品活动限购',
  1078 + });
  1079 +
  1080 + var num = th.data.prom_buy_limit - th.data.prom_buy_num;
  1081 + if (num < 0) num = 0;
  1082 + th.setData({goodsInputNum: num})
  1083 + return false;
  1084 + }
  1085 + }
  1086 +
  1087 + if (th.data.sele_g.prom_type == 1 && !th.data.is_normal) {
  1088 + var redis_num = 0;
  1089 + //------判断活动是否抢光-----
  1090 + await getApp().request.promiseGet("/api/weshop/activitylist/getActLen/" +
  1091 + os.stoid + "/" + th.data.sele_g.prom_type + "/" + th.data.sele_g.prom_id, {
  1092 + 1: 1
  1093 + }).then(res => {
  1094 + redis_num = res.data.data;
  1095 + });
  1096 +
  1097 + if (t > redis_num) {
  1098 + wx.showModal({
  1099 + title: '超出商品活动库存',
  1100 + });
  1101 + th.setData({goodsInputNum: redis_num})
  1102 + return false;
  1103 + }
  1104 + }
  1105 + var e = th.data.sele_g.store_count;
  1106 + var p_type = th.data.prom_type; //&& p_type!=1 && p_type!=4
  1107 + 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)) {
  1108 + if (!th.data.def_pick_store) {
  1109 + wx.showModal({title: '请选择门店',});
  1110 + return false;
  1111 + } else {
  1112 + e = th.data.def_pick_store.CanOutQty;
  1113 + }
  1114 + }
  1115 + if (!e) e = 0;
  1116 + //库存不足,不增加
  1117 + if (e < t) {
  1118 + wx.showModal({title: '库存不足',});
  1119 + if (e < 0) e = 0;
  1120 + th.setData({goodsInputNum: e});
  1121 + return false;
  1122 + }
  1123 + t > e || 0 == e ? t = e : t < 1 && (t = 1);
  1124 + th.setData({goodsInputNum: t});
  1125 + // th.is_show_more_buy();
  1126 +
  1127 + })
  1128 +
  1129 + };
  1130 +
  1131 +
  1132 +
  1133 +
  1134 +
1018 }, 1135 },
1019 1136
1020 1137
@@ -1026,7 +1143,6 @@ Page({ @@ -1026,7 +1143,6 @@ Page({
1026 }, 1143 },
1027 1144
1028 openSpecModel: function(t) { 1145 openSpecModel: function(t) {
1029 - // console.log('****ttttttt***', t);  
1030 var th=this; 1146 var th=this;
1031 var open_store = t.currentTarget.dataset.ind; 1147 var open_store = t.currentTarget.dataset.ind;
1032 this.setData({ 1148 this.setData({
@@ -1108,12 +1224,26 @@ Page({ @@ -1108,12 +1224,26 @@ Page({
1108 } 1224 }
1109 } 1225 }
1110 }, 1226 },
1111 -  
1112 //---------联系客服------------ 1227 //---------联系客服------------
1113 contactService: function () { 1228 contactService: function () {
1114 - getApp().com_call(this); 1229 + this.getTel()
  1230 + .then(() => {
  1231 + if(self.data.store_tel) {
  1232 + wx.showModal({
  1233 + title: '联系客服',
  1234 + content: '客服热线:' + self.data.store_tel,
  1235 + confirmText: '拨打',
  1236 + success(res) {
  1237 + if(res.confirm) {
  1238 + wx.makePhoneCall({
  1239 + phoneNumber: self.data.store_tel,
  1240 + })
  1241 + };
  1242 + },
  1243 + });
  1244 + };
  1245 + });
1115 }, 1246 },
1116 -  
1117 // 获取客服电话 1247 // 获取客服电话
1118 getTel() { 1248 getTel() {
1119 return new Promise((resolve, reject) => { 1249 return new Promise((resolve, reject) => {
@@ -1144,8 +1274,6 @@ Page({ @@ -1144,8 +1274,6 @@ Page({
1144 }); 1274 });
1145 }); 1275 });
1146 }, 1276 },
1147 -  
1148 -  
1149 //-------获取购物车数量---------- 1277 //-------获取购物车数量----------
1150 requestCardNum: function() { 1278 requestCardNum: function() {
1151 var t = this; 1279 var t = this;
@@ -1187,7 +1315,6 @@ Page({ @@ -1187,7 +1315,6 @@ Page({
1187 1315
1188 //--点击分享事件--- 1316 //--点击分享事件---
1189 onShareAppMessage: function(t) { 1317 onShareAppMessage: function(t) {
1190 - getApp().globalData.no_clear=1;  
1191 1318
1192 var th = this; 1319 var th = this;
1193 var price = th.data.data.shop_price; 1320 var price = th.data.data.shop_price;
@@ -2641,7 +2768,10 @@ Page({ @@ -2641,7 +2768,10 @@ Page({
2641 }, 2768 },
2642 2769
2643 previewImage() { 2770 previewImage() {
2644 - getApp().pre_img(this.data.shareImgPath); 2771 + wx.previewImage({
  2772 + //将图片预览出来
  2773 + urls: [this.data.shareImgPath]
  2774 + });
2645 }, 2775 },
2646 2776
2647 onShareTimeline() { 2777 onShareTimeline() {
@@ -2665,7 +2795,13 @@ Page({ @@ -2665,7 +2795,13 @@ Page({
2665 2795
2666 //---------联系微信客服------------ 2796 //---------联系微信客服------------
2667 con_weixin:function () { 2797 con_weixin:function () {
2668 - getApp().con_wx(this) 2798 + var url=this.data.sys_switch.weapp_customertype_url;
  2799 + var id=this.data.sys_switch.weapp_customertype_appid;
  2800 + wx.openCustomerServiceChat({
  2801 + extInfo: {url: url},
  2802 + corpId: id,
  2803 + success(res) {}
  2804 + })
2669 }, 2805 },
2670 2806
2671 //评论的调用 2807 //评论的调用
@@ -2862,9 +2998,10 @@ Page({ @@ -2862,9 +2998,10 @@ Page({
2862 // b[i] = this.data.iurl + e[i]; 2998 // b[i] = this.data.iurl + e[i];
2863 // } 2999 // }
2864 this.data.show_prew_img = 1; 3000 this.data.show_prew_img = 1;
2865 - //调用预览图片  
2866 - getApp().pre_img2(b,t);  
2867 - 3001 + wx.previewImage({
  3002 + current: b[t.currentTarget.dataset.id],
  3003 + urls: b
  3004 + });
2868 }, 3005 },
2869 3006
2870 3007
@@ -2988,38 +3125,45 @@ Page({ @@ -2988,38 +3125,45 @@ Page({
2988 }, 3125 },
2989 3126
2990 3127
  3128 + //获取redis中的数量
  3129 + async getactLen(func) {
  3130 + var r_num = 0,
  3131 + prom_type = this.data.prom_type,
  3132 + prom_id = this.data.prom_id;
  3133 + await getApp().request.promiseGet("/api/weshop/activitylist/getActLen/" + os.stoid + "/" + prom_type + "/" + prom_id, {
  3134 + 1: 1
  3135 + }).then(res => {
  3136 + var em = res;
  3137 + if (em.data.code == 0) {
  3138 + r_num = em.data.data;
  3139 + }
  3140 + })
  3141 + func(r_num);
  3142 + },
  3143 +
  3144 +
2991 3145
2992 3146
2993 //--------检查是否活动,活动是否开始,或者是否结束------- 3147 //--------检查是否活动,活动是否开始,或者是否结束-------
2994 async check_prom(gid, prom_type, prom_id) { 3148 async check_prom(gid, prom_type, prom_id) {
2995 - console.log('check_prom');  
2996 var ee = this, th = ee; 3149 var ee = this, th = ee;
2997 var user_id = getApp().globalData.user_id; 3150 var user_id = getApp().globalData.user_id;
2998 if (!user_id) user_id = 0; 3151 if (!user_id) user_id = 0;
  3152 +
  3153 + if (prom_type == 1 && prom_id == 0) {
  3154 + // this.setData({
  3155 + // prom_type: 0, isshow: 1,
  3156 + // });
  3157 +
  3158 + // //获取门店
  3159 + // this.get_sto();
  3160 + // this.get_sku(o.stoid, this.data.data, gid);
  3161 + // this.check_has_flash();
  3162 + // this.data.is_normal = 1;
  3163 + // this.check_is_youhui(gid, 1);
  3164 + // return false;
  3165 + }
2999 3166
3000 - // if (prom_type == 3 || prom_type == 0 || prom_type == 5 || prom_type == 7 || prom_type == 9 || prom_type == 10) {  
3001 - // this.setData({  
3002 - // prom_type: 0, isshow: 1,  
3003 - // });  
3004 - // return false;  
3005 - // }  
3006 -  
3007 -  
3008 -  
3009 - // if (prom_type == 1 && prom_id == 0) {  
3010 - // this.setData({  
3011 - // prom_type: 0, isshow: 1,  
3012 - // });  
3013 -  
3014 - // //获取门店  
3015 - // this.get_sto();  
3016 - // this.get_sku(o.stoid, this.data.data, gid);  
3017 - // this.check_has_flash();  
3018 - // this.data.is_normal = 1;  
3019 - // this.check_is_youhui(gid, 1);  
3020 - // return false;  
3021 - // }  
3022 -  
3023 //if (prom_type != 3 && prom_type!=0){ 3167 //if (prom_type != 3 && prom_type!=0){
3024 //---判断秒杀---- 3168 //---判断秒杀----
3025 if (prom_type == 1 && prom_id > 0) { 3169 if (prom_type == 1 && prom_id > 0) {
@@ -3028,15 +3172,23 @@ Page({ @@ -3028,15 +3172,23 @@ Page({
3028 1: 1 3172 1: 1
3029 }).then(res => { 3173 }).then(res => {
3030 var em = res; 3174 var em = res;
3031 - if (res.data.code == 0) {  
3032 - // console.log('!!!!!!res!!!!', res);  
3033 - if (res.data.data <= 0) ee.setData({  
3034 - prom_r_null: 1  
3035 - }); 3175 + if (em.data.code == 0) {
  3176 +
  3177 + if (em.data.data <= 0) {
  3178 + th.setData({
  3179 + prom_r_null: 1,
  3180 + goodsInputNum: res.data.data,
  3181 + });
  3182 +
  3183 + // th.setData({goodsInputNum: redis_num})
  3184 + };
3036 //拿取价格并且判断时间-- 3185 //拿取价格并且判断时间--
3037 getApp().request.get("/api/ms/flash_sale/getNew/" + os.stoid + "/" + user_id + "/" + prom_id, { 3186 getApp().request.get("/api/ms/flash_sale/getNew/" + os.stoid + "/" + user_id + "/" + prom_id, {
3038 success: function (t) { 3187 success: function (t) {
3039 - // console.log('!!!!!!t!!!!', t); 3188 + th.setData({
  3189 + sele_g: t.data.data,
  3190 + });
  3191 +
3040 if (t.data.code != 0) { 3192 if (t.data.code != 0) {
3041 ee.get_normal(gid); 3193 ee.get_normal(gid);
3042 return false; 3194 return false;
@@ -3063,7 +3215,6 @@ Page({ @@ -3063,7 +3215,6 @@ Page({
3063 var prom_start_time = ut.formatTime(t.data.data.start_time, "yyyy-MM-dd hh:mm:ss"); 3215 var prom_start_time = ut.formatTime(t.data.data.start_time, "yyyy-MM-dd hh:mm:ss");
3064 3216
3065 ee.setData({ 3217 ee.setData({
3066 - 'data.shop_price': t.data.data.user_price,  
3067 prom_price: t.data.data.user_price, 3218 prom_price: t.data.data.user_price,
3068 prom_type: 1, 3219 prom_type: 1,
3069 prom_id: prom_id, 3220 prom_id: prom_id,
@@ -3081,7 +3232,6 @@ Page({ @@ -3081,7 +3232,6 @@ Page({
3081 if (endTime1 > newTime) { 3232 if (endTime1 > newTime) {
3082 ee.setData({ 3233 ee.setData({
3083 prom_time_text: '距秒杀开始还有', 3234 prom_time_text: '距秒杀开始还有',
3084 - prom_st: 0,  
3085 }) 3235 })
3086 ee.countDown(endTime1, 0); 3236 ee.countDown(endTime1, 0);
3087 } else { 3237 } else {
@@ -3095,60 +3245,60 @@ Page({ @@ -3095,60 +3245,60 @@ Page({
3095 } 3245 }
3096 3246
3097 //如果是进行中的话 3247 //如果是进行中的话
3098 - // if (endTime1 < newTime) {  
3099 - // //-- 获取秒杀活动的多少规格 --  
3100 - // ee.get_more_flahs(function (list) {  
3101 - // if (list && list.length > 1) {  
3102 -  
3103 - // var n_item = list[0];  
3104 - // var ind = list.findIndex(function (ele) {  
3105 - // return ele.goods_id == ee.data.data.goods_id;  
3106 - // })  
3107 - // if (ind < 0) return false;  
3108 - // if (ind > 0) {  
3109 - // n_item = JSON.parse(JSON.stringify(list[ind]));  
3110 - // list.splice(ind, 1);  
3111 - // list.unshift(n_item);  
3112 - // }  
3113 -  
3114 - // ee.data.sele_g.viplimited = n_item.viplimited;  
3115 - // ee.data.data.viplimited = n_item.viplimited;  
3116 -  
3117 - // var gb = 1;  
3118 - // //-- 显示多规格 --  
3119 - // for (let i in list) {  
3120 - // let item = list[i];  
3121 - // var gg = "";  
3122 - // if (item.goods_spec == "null" || item.goods_spec == null) item.goods_spec = "";  
3123 - // if (item.goods_color == "null" || item.goods_color == null) item.goods_color = "";  
3124 -  
3125 - // if (item.goods_spec != "" && item.goods_color != "") {  
3126 - // gg = item.goods_spec + "/" + item.goods_color;  
3127 - // } else if (item.goods_spec != "" || item.goods_color != "") {  
3128 - // gg = item.goods_spec + item.goods_color;  
3129 - // } else {  
3130 - // gg = "规格" + gb;  
3131 - // gb++;  
3132 - // }  
3133 - // item.gg = gg;  
3134 - // item.prom_id = item.prom_id;  
3135 - // item.prom_type = 1;  
3136 - // }  
3137 -  
3138 - // ee.setData({  
3139 - // sku_g: list,  
3140 - // });  
3141 -  
3142 - // }  
3143 - // })  
3144 - // } 3248 + if (endTime1 < newTime) {
  3249 + //-- 获取秒杀活动的多少规格 --
  3250 + ee.get_more_flahs(function (list) {
  3251 + if (list && list.length > 1) {
  3252 +
  3253 + var n_item = list[0];
  3254 + var ind = list.findIndex(function (ele) {
  3255 + return ele.goods_id == ee.data.data.goods_id;
  3256 + })
  3257 + if (ind < 0) return false;
  3258 + if (ind > 0) {
  3259 + n_item = JSON.parse(JSON.stringify(list[ind]));
  3260 + list.splice(ind, 1);
  3261 + list.unshift(n_item);
  3262 + }
  3263 +
  3264 + ee.data.sele_g.viplimited = n_item.viplimited;
  3265 + ee.data.data.viplimited = n_item.viplimited;
  3266 +
  3267 + var gb = 1;
  3268 + //-- 显示多规格 --
  3269 + for (let i in list) {
  3270 + let item = list[i];
  3271 + var gg = "";
  3272 + if (item.goods_spec == "null" || item.goods_spec == null) item.goods_spec = "";
  3273 + if (item.goods_color == "null" || item.goods_color == null) item.goods_color = "";
  3274 +
  3275 + if (item.goods_spec != "" && item.goods_color != "") {
  3276 + gg = item.goods_spec + "/" + item.goods_color;
  3277 + } else if (item.goods_spec != "" || item.goods_color != "") {
  3278 + gg = item.goods_spec + item.goods_color;
  3279 + } else {
  3280 + gg = "规格" + gb;
  3281 + gb++;
  3282 + }
  3283 + item.gg = gg;
  3284 + item.prom_id = item.prom_id;
  3285 + item.prom_type = 1;
  3286 + }
  3287 +
  3288 + ee.setData({
  3289 + sku_g: list,
  3290 + });
  3291 +
  3292 + }
  3293 + })
  3294 + }
3145 3295
3146 } 3296 }
3147 }); 3297 });
3148 } 3298 }
3149 }) 3299 })
3150 } 3300 }
3151 - 3301 +
3152 }, 3302 },
3153 3303
3154 3304
@@ -3157,86 +3307,739 @@ Page({ @@ -3157,86 +3307,739 @@ Page({
3157 let prom_type = e.currentTarget.dataset.promtype; 3307 let prom_type = e.currentTarget.dataset.promtype;
3158 let prom_id = e.currentTarget.dataset.promid; 3308 let prom_id = e.currentTarget.dataset.promid;
3159 let goods_id = this.data.data.goods_id; 3309 let goods_id = this.data.data.goods_id;
3160 - let url = `/packageA/pages/goodsInfo/goodsInfo?goods_id=${goods_id}&prom_type=${prom_type}&prom_id=${prom_id}`;  
3161 - // console.log('url~~~~', url); 3310 + let url = `/packageA/pages/goodsInfo/goodsInfo?goods_id=${goods_id}&prom_type=${prom_type}&prom_id=${prom_id}`;s
3162 getApp().goto(url); 3311 getApp().goto(url);
3163 }, 3312 },
3164 3313
3165 3314
3166 3315
3167 -  
3168 - //-- 检验商品的活动情况 --  
3169 - check_gd_prom_new: function (func) {  
3170 - var th = this; 3316 + //获取更多秒杀
  3317 + get_more_flahs: async function (func) {
  3318 + var f_more = false;
3171 var user_id = getApp().globalData.user_id; 3319 var user_id = getApp().globalData.user_id;
3172 if (!user_id) user_id = 0; 3320 if (!user_id) user_id = 0;
3173 3321
3174 - var url = '/api/weshop/activitylist/listGoodActInfo2';  
3175 - var req_d = {  
3176 - "store_id": os.stoid,  
3177 - "goods_id": this.data.gid,  
3178 - "user_id": user_id, 3322 + var url = "/api/weshop/goods/listSkuFlash?store_id=" + os.stoid + "&goods_id=" + this.data.data.goods_id + "&user_id=" + user_id;
  3323 + //获取秒杀的多规格
  3324 + await getApp().request.promiseGet(url, {}).then(res => {
  3325 + if (res.data.code == 0 && res.data.data && res.data.data.length > 0) {
  3326 + f_more = res.data.data;
  3327 + }
  3328 + })
  3329 + if (!f_more) {
  3330 + func(false);
  3331 + return false;
  3332 + }
  3333 + //-- 秒杀的价格要更新 --
  3334 + for (let i in f_more) {
  3335 +
  3336 + let item = f_more[i];
  3337 + f_more[i].prom_id = item.act_id;
  3338 + f_more[i].prom_type = 1;
  3339 + if (item.goods_id == this.data.data.goods_id) {
  3340 + continue;
  3341 + }
  3342 + var url = "/api/ms/flash_sale/getNew/" + os.stoid + "/" + user_id + "/" + item.act_id;
  3343 + await getApp().request.promiseGet(url, {}).then(rs => {
  3344 + if (rs.data.code == 0) {
  3345 + f_more[i].price = rs.data.data.user_price;
  3346 +
  3347 + }
  3348 + })
3179 } 3349 }
3180 - getApp().request.get(url, {  
3181 - data: req_d,  
3182 - success: function (e) {  
3183 - if (e.data.code == 0 && e.data.data && e.data.data.length > 0) {  
3184 - var arr = e.data.data;  
3185 - var arr2 = arr.filter(function (e) {  
3186 - return e.s_time < ut.gettimestamp(); 3350 + func(f_more);
  3351 +
  3352 + },
  3353 +
  3354 +
  3355 +
  3356 +
  3357 +
  3358 +
  3359 + //-------------获取购买数量的总函数----------------
  3360 + get_buy_num: function (gd, func) {
  3361 +
  3362 + var th = this,
  3363 + user_id = getApp().globalData.user_id;
  3364 +
  3365 +
  3366 + //----获取商品购买数----
  3367 + getApp().request.get("/api/weshop/ordergoods/getUserBuyGoodsNum", {
  3368 + data: {
  3369 + store_id: os.stoid,
  3370 + user_id: user_id,
  3371 + goods_id: this.data.gid,
  3372 + },
  3373 + success: function (t) {
  3374 + if (t.data.code == 0) {
  3375 + var g_buy_num = t.data.data.goodsbuynum;
  3376 +
  3377 + // 如果是秒杀的时候
  3378 + // if (th.data.prom_type == 0 && gd.prom_type == 1) {
  3379 + // gd.prom_type = 0;
  3380 + // }
  3381 +
  3382 + //----获取活动购买数----
  3383 + getApp().request.get("/api/weshop/ordergoods/getUserBuyGoodsNum", {
  3384 + data: {
  3385 + store_id: os.stoid,
  3386 + user_id: user_id,
  3387 + goods_id: th.data.gid,
  3388 + prom_type: th.data.prom_type,
  3389 + prom_id: th.data.prom_id
  3390 + },
  3391 + //-----获取-----
  3392 + success: function (tt) {
  3393 + if (tt.data.code == 0) {
  3394 + th.setData({
  3395 + prom_buy_num: tt.data.data.goodsbuynum,
  3396 + });
  3397 + "function" == typeof func && func();
  3398 + }
  3399 + }
  3400 + });
  3401 +
  3402 +
  3403 + }
  3404 + },
  3405 + });
  3406 + },
  3407 +
  3408 +
  3409 +
  3410 +
  3411 +
  3412 + // 促销 -> 送礼包 -> 查看详情
  3413 + viewLbDetails(e) {
  3414 + let id = e.currentTarget.dataset.id; // 获取礼包id
  3415 + let url = `/packageA/pages/myGiftDetails/myGiftDetails?btn=0&index=0&id=${id}`; // btn=0 控制跳转到的页面不显示按钮
  3416 + // console.log('myurl', url);
  3417 + getApp().goto(url);
  3418 + },
  3419 +
  3420 + go_more_ladder: function (e) {
  3421 + var prom_id = e.currentTarget.dataset.id;
  3422 + getApp().goto("/pages/goods/goodsList/goodsList?ladder_id=" + prom_id);
  3423 + },
  3424 +
  3425 + getHistoryBuy() {
  3426 + let _this = this;
  3427 + let req_data = {
  3428 + store_id: os.stoid,
  3429 + goods_id: this.data.gid,
  3430 + pay_status: 1,
  3431 + rndid: 1
  3432 + };
  3433 + getApp().request.promiseGet('/api/weshop/ordergoods/list', {
  3434 + data: req_data,
  3435 + })
  3436 + .then(res => {
  3437 + if (t.ajax_ok(res)) {
  3438 + _this.setData({
  3439 + historyBuyInfo: res.data.data.pageData,
3187 }) 3440 })
3188 - //-- 如果只有一个活动的话 --  
3189 - if (arr.length == 1) {  
3190 - th.data.prom_type = arr[0].prom_type;  
3191 - th.data.prom_id = arr[0].act_id; 3441 + }
  3442 + })
  3443 + },
  3444 +
  3445 +
  3446 +
  3447 + //-- 秒杀的普通购买 --
  3448 + openSpecModel_Nor: function () {
  3449 + this.data.g_buy_num = new Map();
  3450 + var th = this;
  3451 + this.setData({open_ind_store: 5, goodsInputNum: 1});//拼团直接给4
  3452 +
  3453 + this.setData({openSpecModal_flash_normal: 1});
  3454 +
  3455 +
  3456 + // if (th.data.sku_g_pt) {
  3457 + // // this.get_sto(1)
  3458 + // this.setData({openSpecModal_flash_normal: 1});
  3459 + // } else {
  3460 + // th.get_sto(1);
  3461 + // th.get_sku(o.stoid, th.data.data, th.data.gid, 1, function () {
  3462 + // th.setData({
  3463 + // openSpecModal_flash_normal: 1
  3464 + // });
  3465 + // });
  3466 + // }
  3467 + // this.check_is_youhui(th.data.gid, 1);
  3468 + },
  3469 +
  3470 + closeSpecModal_flash_normal: function () {
  3471 + this.setData({openSpecModal_flash_normal: 0});
  3472 + },
  3473 +
  3474 +
  3475 + //打开客服操作菜单
  3476 + openCS() {
  3477 + // csType/在线客服设置:
  3478 + // 0关闭(如果有设置热线电话,则显示拨打热线电话)、
  3479 + // 1小程序客服、
  3480 + // 2企业微信客服
  3481 + let csType = this.data.sys_switch.weapp_customertype;
  3482 + if(csType == 0) {
  3483 + // 获取电话号码
  3484 + this.contactService();
  3485 + } else {
  3486 + this.getTel()
  3487 + .then(() => {
  3488 + self.setData({
  3489 + hiddenCS: false,
  3490 + });
  3491 + });
  3492 +
  3493 + };
  3494 + },
  3495 +
  3496 + //关闭客服操作菜单
  3497 + closeCS() {
  3498 + this.setData({
  3499 + hiddenCS: true,
  3500 + });
  3501 + },
  3502 +
  3503 +
  3504 +
  3505 +
  3506 +
  3507 +
  3508 +
  3509 + //-- 加入购物的函数 --
  3510 + add_cart_func: function (t) {
  3511 + var i = getApp().request;
  3512 + if (oo.user_id == null) {
  3513 + return s.my_warnning("还未登录!", 0, this);
  3514 + }
  3515 +
  3516 + if (!getApp().globalData.userInfo) {
  3517 + return s.my_warnning("还未登录!", 0, this);
  3518 + }
  3519 +
  3520 + var e = this,
  3521 + th = e,
  3522 + a = 0,
  3523 + o = this.data.sele_g;
  3524 + a = o.goods_id;
  3525 +
  3526 + //----------添加到购物车时,要判断限购数量,--------
  3527 + e.get_buy_num(o, function (ee) {
  3528 + //---判断商品是否超出限购---
  3529 + if (th.data.g_buy_num != null && th.data.sele_g.viplimited > 0) {
  3530 + if (th.data.goodsInputNum + th.data.g_buy_num.get(th.data.sele_g.goods_id) > th.data.sele_g.viplimited) {
  3531 + wx.showModal({
  3532 + title: '提示',
  3533 + content: '超出商品限购'
  3534 + });
  3535 + return false;
  3536 + }
  3537 + }
  3538 + //---判断商品是否超出活动限购---
  3539 + if ((th.data.prom_buy_num != -1 && th.data.prom_buy_limit > 0) && !th.data.is_normal) {
  3540 + if (th.data.goodsInputNum + th.data.prom_buy_num > th.data.prom_buy_limit) {
  3541 + wx.showModal({
  3542 + title: '提示',
  3543 + content: '超出商品活动限购'
  3544 + });
  3545 + return false;
  3546 + }
  3547 + }
  3548 +
  3549 + if (th.data.goodsInputNum <= 0) return s.my_warnning("商品数量不能为0", 0, th);
  3550 + if (th.data.sto_sele_name == null || th.data.sto_sele_name == undefined)
  3551 + this.setData({
  3552 + sto_sele_name: ""
  3553 + });
  3554 + if (th.data.sto_sele_name == "") return s.my_warnning("请选择门店", 0, th);
  3555 +
  3556 + //--------------此时操作的数据------------
  3557 + var newd = {
  3558 + goods_id: o.goods_id,
  3559 + goods_num: th.data.goodsInputNum,
  3560 + pick_id: th.data.sto_sele_id,
  3561 + user_id: oo.user_id,
  3562 + store_id: th.data.stoid,
  3563 + goods_price: o.shop_price,
  3564 + member_goods_price: o.shop_price,
  3565 + goods_name: o.goods_name,
  3566 + goods_sn: o.goods_sn,
  3567 + sku: o.sku,
  3568 + prom_id: th.data.sele_g.prom_id,
  3569 + prom_type: th.data.sele_g.prom_type,
  3570 + };
  3571 +
  3572 + //---是不是从收藏夹出来的---
  3573 + if (th.data.c_guide_id) {
  3574 + newd['guide_id'] = th.data.c_guide_id;
  3575 + newd['guide_type'] = 2;
  3576 + if ("add" == t.currentTarget.dataset.action) newd['guide_type'] = 3;
  3577 + } else {
  3578 + if (getApp().globalData.guide_id) {
  3579 + newd['guide_id'] = getApp().globalData.guide_id;
  3580 + newd['guide_type'] = 0;
  3581 + if ("add" == t.currentTarget.dataset.action) newd['guide_type'] = 1;
  3582 + }
  3583 + }
  3584 +
  3585 + //让商品带上房间号
  3586 + //让商品带上房间号
  3587 + if (th.data.sys_switch.is_skuroom_id == 1) {
  3588 + if (th.data.data.goods_id == getApp().globalData.room_goods_id) {
  3589 + newd.room_id = getApp().globalData.room_id;
  3590 + }
  3591 + } else {
  3592 + if (newd.goods_id == getApp().globalData.room_goods_id) newd.room_id = getApp().globalData.room_id;
  3593 + }
  3594 +
  3595 + //如果是积分够,is_integral_normal就要有积分购普通购买字段
  3596 + if (o.prom_type == 4) {
  3597 + newd.is_integral_normal = 1;
  3598 + }
  3599 +
  3600 + //如果有线下取价
  3601 + if (o.offline_price) {
  3602 + newd.offline_price = o.offline_price;
  3603 + newd.pricing_type = o.pricing_type;
  3604 + }
  3605 +
  3606 + //-----如果是秒杀,团购,积分购,拼团-----
  3607 + if (th.data.prom_type == 1 || th.data.prom_type == 2) {
  3608 +
  3609 + if (th.data.openSpecModal_flash_normal) {
  3610 +
  3611 + newd.prom_type = 0;
  3612 + newd.prom_id = 0;
  3613 +
  3614 + //---如果是线下门店销售的时候---
  3615 + if (th.data.sales_rules == 2) {
  3616 + var pick = th.get_pick_from_list(th.data.sto_sele_id)
  3617 + //---通过接口获取门店的线下库存信息--
  3618 + getApp().request.get("/api/weshop/goods/getWareStorages", {
  3619 + data: {
  3620 + storageNos: pick.pickup_no,
  3621 + wareIds: encodeURIComponent(th.data.sele_g.erpwareid),
  3622 + storeId: os.stoid
  3623 + },
  3624 + success: function (res) {
  3625 + if (res.data.code == 0) {
  3626 + if (res.data.data.pageData.length > 0) {
  3627 + var CanOutQty = res.data.data.pageData[0].CanOutQty;
  3628 + if (CanOutQty < e.data.goodsInputNum) {
  3629 + return s.my_warnning("库存不足!", 0, th);
  3630 + }
  3631 + //在调一次接口,读取商品的预出库的数量,lock
  3632 + getApp().request.get("/api/weshop/order/ware/lock/page", {
  3633 + data: {
  3634 + store_id: os.stoid,
  3635 + wareId: th.data.sele_g.goods_id,
  3636 + storageId: pick.pickup_id,
  3637 + pageSize: 1000
  3638 + },
  3639 + success: function (res_data) {
  3640 + if (res_data.data.code == 0 && res_data.data.data.total > 0) {
  3641 +
  3642 + var lock = 0;
  3643 + for (var i in res_data.data.data.pageData) {
  3644 + lock += res_data.data.data.pageData[i].outQty;
  3645 + }
  3646 +
  3647 + if (CanOutQty <= lock) {
  3648 + return s.my_warnning("库存不足!", 0, th);
  3649 + }
  3650 + th.add_cart_next(e, t, a, o, newd, CanOutQty - lock);
  3651 + } else {
  3652 + th.add_cart_next(e, t, a, o, newd, CanOutQty);
  3653 + }
  3654 + }
  3655 + })
  3656 + } else {
  3657 + return s.my_warnning("库存不足!", 0, th);
  3658 + }
  3659 +
  3660 + }
  3661 + }
  3662 + })
  3663 + } else {
  3664 + if (o.store_count <= 0) return s.my_warnning("库存已为空!", 0, th);
  3665 + if (o.store_count < e.data.goodsInputNum) return s.my_warnning("库存不足!", 0, th);
  3666 + th.add_cart_next(e, t, a, o, newd); //加入购物车下一步
  3667 + }
  3668 +
  3669 + return false;
  3670 + }
  3671 +
  3672 +
  3673 + newd.goods_price = th.data.prom_price;
  3674 + newd.member_goods_price = th.data.prom_price,
  3675 + newd.prom_type = th.data.prom_type;
  3676 + newd.prom_id = th.data.prom_id;
  3677 +
  3678 + if (o.store_count <= 0) return s.my_warnning("库存已为空!", 0, th);
  3679 + if (o.store_count < e.data.goodsInputNum) return s.my_warnning("库存不足!", 0, th);
  3680 +
  3681 + th.add_cart_next(e, t, a, o, newd); //加入购物车下一步
  3682 +
  3683 + } else if (o.prom_type == 7) {
  3684 +
  3685 + //判断进行中的活动,是不是要判断线下库存
  3686 + th.check_zh_acting(function (ee) {
  3687 + newd.prom_id = 0;
  3688 + newd.prom_type = 0;
  3689 + if (ee && th.data.sele_g.act) {
  3690 + newd.prom_id = th.data.sele_g.act.id;
  3691 + newd.prom_type = 7;
  3692 + if (o.store_count <= 0) return s.my_warnning("库存已为空!", 0, th);
  3693 + if (o.store_count < e.data.goodsInputNum) return s.my_warnning("库存不足!", 0, th);
  3694 + th.add_cart_next(e, t, a, o, newd); //加入购物车下一步
  3695 + return false;
  3696 + } else {
  3697 + //---如果是线下门店销售的时候---
  3698 + if (th.data.sales_rules == 2) {
  3699 + var pick = th.get_pick_from_list(th.data.sto_sele_id)
  3700 + //---通过接口获取门店的线下库存信息--
  3701 + getApp().request.get("/api/weshop/goods/getWareStorages", {
  3702 + data: {
  3703 + storageNos: pick.pickup_no,
  3704 + wareIds: encodeURIComponent(th.data.sele_g.erpwareid),
  3705 + storeId: os.stoid
  3706 + },
  3707 + success: function (res) {
  3708 + if (res.data.code == 0) {
  3709 + if (res.data.data.pageData.length > 0) {
  3710 + var CanOutQty = res.data.data.pageData[0].CanOutQty;
  3711 + if (CanOutQty < e.data.goodsInputNum) {
  3712 + return s.my_warnning("库存不足!", 0, th);
  3713 + }
  3714 + //在调一次接口,读取商品的预出库的数量,lock
  3715 + getApp().request.get("/api/weshop/order/ware/lock/page", {
  3716 + data: {
  3717 + store_id: os.stoid,
  3718 + wareId: th.data.sele_g.goods_id,
  3719 + storageId: pick.pickup_id,
  3720 + pageSize: 1000
  3721 + },
  3722 + success: function (res_data) {
  3723 + if (res_data.data.code == 0 && res_data.data.data.total > 0) {
  3724 +
  3725 + var lock = 0;
  3726 + for (var i in res_data.data.data.pageData) {
  3727 + lock += res_data.data.data.pageData[i].outQty;
  3728 + }
  3729 +
  3730 + if (CanOutQty <= lock) {
  3731 + return s.my_warnning("库存不足!", 0, th);
  3732 + }
  3733 + th.add_cart_next(e, t, a, o, newd, CanOutQty - lock);
  3734 + } else {
  3735 + th.add_cart_next(e, t, a, o, newd, CanOutQty);
  3736 + }
  3737 + }
  3738 + })
  3739 + } else {
  3740 + return s.my_warnning("库存不足!", 0, th);
  3741 + }
  3742 +
  3743 + }
  3744 + }
  3745 + })
  3746 + } else {
  3747 + if (o.store_count <= 0) return s.my_warnning("库存已为空!", 0, th);
  3748 + if (o.store_count < e.data.goodsInputNum) return s.my_warnning("库存不足!", 0, th);
  3749 + th.add_cart_next(e, t, a, o, newd); //加入购物车下一步
  3750 + }
  3751 + }
  3752 + })
  3753 +
  3754 + }
  3755 + else if (th.data.prom_type == 0 || th.data.prom_type == 3 || th.data.prom_type == 4 || th.data.prom_type == 5 || th.data.prom_type == 10) {
  3756 + newd.prom_type = 0;
  3757 + newd.prom_id = 0;
  3758 +
  3759 + if (th.data.prom_type == 10) {
  3760 + newd.prom_type = th.data.prom_type;
  3761 + newd.prom_id = th.data.prom_id;
  3762 + }
  3763 +
  3764 + //---如果是线下门店销售的时候---
  3765 + if (th.data.sales_rules == 2) {
  3766 + var pick = th.get_pick_from_list(th.data.sto_sele_id)
  3767 + //---通过接口获取门店的线下库存信息--
  3768 + getApp().request.get("/api/weshop/goods/getWareStorages", {
  3769 + data: {
  3770 + storageNos: pick.pickup_no,
  3771 + wareIds: encodeURIComponent(th.data.sele_g.erpwareid),
  3772 + storeId: os.stoid
  3773 + },
  3774 + success: function (res) {
  3775 + if (res.data.code == 0) {
  3776 + if (res.data.data.pageData.length > 0) {
  3777 + var CanOutQty = res.data.data.pageData[0].CanOutQty;
  3778 + if (CanOutQty < e.data.goodsInputNum) {
  3779 + return s.my_warnning("库存不足!", 0, th);
  3780 + }
  3781 + //在调一次接口,读取商品的预出库的数量,lock
  3782 + getApp().request.get("/api/weshop/order/ware/lock/page", {
  3783 + data: {
  3784 + store_id: os.stoid,
  3785 + wareId: th.data.sele_g.goods_id,
  3786 + storageId: pick.pickup_id,
  3787 + pageSize: 1000
  3788 + },
  3789 + success: function (res_data) {
  3790 + if (res_data.data.code == 0 && res_data.data.data.total > 0) {
  3791 +
  3792 + var lock = 0;
  3793 + for (var i in res_data.data.data.pageData) {
  3794 + lock += res_data.data.data.pageData[i].outQty;
  3795 + }
  3796 +
  3797 + if (CanOutQty <= lock) {
  3798 + return s.my_warnning("库存不足!", 0, th);
  3799 + }
  3800 + th.add_cart_next(e, t, a, o, newd, CanOutQty - lock);
  3801 + } else {
  3802 + th.add_cart_next(e, t, a, o, newd, CanOutQty);
  3803 + }
  3804 + }
  3805 + })
  3806 + } else {
  3807 + return s.my_warnning("库存不足!", 0, th);
  3808 + }
  3809 +
  3810 + }
  3811 + }
  3812 + })
  3813 + } else {
  3814 + if (o.store_count <= 0) return s.my_warnning("库存已为空!", 0, th);
  3815 + if (o.store_count < e.data.goodsInputNum) return s.my_warnning("库存不足!", 0, th);
  3816 + th.add_cart_next(e, t, a, o, newd); //加入购物车下一步
  3817 + }
  3818 + }
  3819 + })
  3820 + },
  3821 +
  3822 + //---加入购物车的最后一步---
  3823 + add_cart_next(e, t, a, o, newd, CanOutQty) {
  3824 + var th = this, i = getApp().request;
  3825 + //---如果商品不是积分购和拼团,要判断一个是否要进行等级价的判断------
  3826 + if ((o.prom_type != 1 || o.prom_id <= 0) && ((o.prom_type != 6 && o.prom_type != 4 && o.prom_type != 2 ) || th.data.is_normal)) {
  3827 + var conf = th.data.bconfig;
  3828 + if (conf.switch_list && getApp().globalData.userInfo['card_field'] && getApp().globalData.userInfo['card_expiredate']) {
  3829 + var s_list = JSON.parse(conf.switch_list);
  3830 + var now = ut.gettimestamp();
  3831 +
  3832 +
  3833 + var str = getApp().globalData.userInfo['card_expiredate'].replace(/-/g, '/');
  3834 + var end = new Date(str);
  3835 + end = Date.parse(end) / 1000;
  3836 +
  3837 + //--如果后台有开启等级价的功能,而且会员的等级没有过期的情况下--
  3838 + if (parseInt(s_list.rank_switch) == 2 && end > now) {
  3839 + var card_price = o[getApp().globalData.userInfo['card_field']];
  3840 + //如果会员有等级价
  3841 + if (getApp().globalData.userInfo['card_field'] != undefined && getApp().globalData.userInfo['card_field'] != null
  3842 + && getApp().globalData.userInfo['card_field'] != "" && card_price > 0) {
  3843 + newd.goods_price = card_price;
  3844 + newd.member_goods_price = card_price;
3192 } 3845 }
3193 - //-- 如果只有一个进行中的活动的话 --  
3194 - else if (arr2.length == 1) {  
3195 - th.data.prom_type = arr2[0].prom_type;  
3196 - th.data.prom_id = arr2[0].act_id; 3846 + }
  3847 + }
  3848 + }
  3849 +
  3850 + //if (this.data.data.goods.is_virtual) return this.buyVirtualGoods(d);
  3851 + if ("add" == t.currentTarget.dataset.action) {
  3852 +
  3853 + if (th.data.prom_goods) {
  3854 + newd.prom_type = 3;
  3855 + newd.prom_id = th.data.prom_goods[0].prom_id;
  3856 + }
  3857 +
  3858 + //----先看会员在购物车中是否加入了该商品-----
  3859 + i.get("/api/weshop/cart/page", {
  3860 + data: {
  3861 + store_id: e.data.stoid,
  3862 + user_id: oo.user_id,
  3863 + goods_id: a,
  3864 + pick_id: e.data.sto_sele_id,
  3865 + state: 0
  3866 + },
  3867 + success: function (re) {
  3868 +
  3869 + //-------如果购物车中有相关的数据---------
  3870 + if (re.data.data.total > 0) {
  3871 +
  3872 + var item = re.data.data.pageData[0];
  3873 +
  3874 + //判断数量,要看下购物车中有没有该商品
  3875 + if (CanOutQty) {
  3876 + if (item.goods_num + th.data.goodsInputNum > CanOutQty) {
  3877 + return s.my_warnning("库存不足!", 0, th);
  3878 + }
  3879 + } else {
  3880 + if (item.goods_num + th.data.goodsInputNum > o.store_count) {
  3881 + return s.my_warnning("库存不足!", 0, th);
  3882 + }
  3883 + }
  3884 +
  3885 + var updata = {
  3886 + id: item.id,
  3887 + goods_num: e.data.goodsInputNum + item.goods_num,
  3888 + goods_price: newd.goods_price,
  3889 + member_goods_price: newd.goods_price,
  3890 + store_id: th.data.stoid,
  3891 + };
  3892 +
  3893 + //---是不是从收藏夹出来的---
  3894 + if (th.data.c_guide_id) {
  3895 + updata['guide_id'] = th.data.c_guide_id;
  3896 + updata['guide_type'] = 3; //加入购物车之后就变成了3
  3897 + } else {
  3898 + if (getApp().globalData.guide_id) {
  3899 + updata['guide_id'] = getApp().globalData.guide_id;
  3900 + updata['guide_type'] = 0;
  3901 + }
  3902 + }
  3903 +
  3904 + i.put("/api/weshop/cart/update", {
  3905 + data: updata,
  3906 + success: function (t) {
  3907 + getApp().my_warnning('加入购物车成功', 1, th, 450);
  3908 + var c_num = th.data.cartGoodsNum + th.data.goodsInputNum;
  3909 + th.setData({
  3910 + cartGoodsNum: c_num
  3911 + });
  3912 + th.closeSpecModal();
  3913 + }
  3914 + });
  3915 + } else {
  3916 +
  3917 +
  3918 + i.post("/api/weshop/cart/save", {
  3919 + data: newd,
  3920 + success: function (t) {
  3921 + getApp().my_warnning('加入购物车成功', 1, th, 450);
  3922 + var c_num = th.data.cartGoodsNum + e.data.goodsInputNum;
  3923 + th.setData({
  3924 + cartGoodsNum: c_num
  3925 + });
  3926 + th.closeSpecModal();
  3927 + }
  3928 + });
3197 } 3929 }
3198 } 3930 }
3199 - //-- 调用回调 --  
3200 - func(); 3931 + });
  3932 +
  3933 + }
  3934 + else {
  3935 +
  3936 + //这一步主要是要让立即购买 走 购物车的逻辑 参与活动
  3937 + if (newd.prom_type == 10 || newd.prom_type == 7) {
  3938 + //----先看会员在购物车中是否加入了该商品,立即购买的-----
  3939 + getApp().request.get("/api/weshop/cart/page", {
  3940 + data: {
  3941 + store_id: e.data.stoid,
  3942 + user_id: oo.user_id,
  3943 + state: 1
  3944 + },
  3945 + success: function (res) {
  3946 + //-------如果购物车中有相关的数据---------
  3947 + if (res.data.code == 0 && res.data.data.total > 0) {
  3948 + for (let j in res.data.data.pageData) {
  3949 + let item_j = res.data.data.pageData[j];
  3950 + var url = '/api/weshop/cart/del/' + e.data.stoid + '/' + item_j.id;
  3951 + getApp().request.delete(url, {});
  3952 + }
  3953 + }
  3954 + newd.state = 1;
  3955 + getApp().request.post("/api/weshop/cart/save", {
  3956 + data: newd,
  3957 + success: function (t) {
  3958 + th.closeSpecModal();
  3959 + getApp().goto("/pages/cart/cart2/cart2?state=1");
  3960 + }
  3961 + });
  3962 + }
  3963 + })
  3964 + return false;
3201 } 3965 }
3202 - }); 3966 +
  3967 + if (th.data.prom_goods) {
  3968 + var prom_d = th.data.prom_goods;
  3969 + for (var i in prom_d) {
  3970 + //判断活动有俩种条件,0元 1件
  3971 + var condition_t = prom_d[i].prom_type;
  3972 + switch (condition_t) {
  3973 + case 0: //按钱
  3974 + if (newd.goods_price >= condition_t) {
  3975 + newd.prom_type = 3;
  3976 + newd.prom_id = prom_d[i].prom_id;
  3977 + }
  3978 + break
  3979 + case 1://按购买数量
  3980 + if (newd.goods_num >= condition_t) {
  3981 + newd.prom_type = 3;
  3982 + newd.prom_id = prom_d[i].prom_id;
  3983 + }
  3984 + break;
  3985 + }
  3986 + }
  3987 +
  3988 + }
  3989 +
  3990 + newd['pick_name'] = th.data.sto_sele_name;
  3991 + newd['pick_dis'] = th.data.sto_sele_distr;
  3992 + th.buyNow(newd);
  3993 + }
3203 }, 3994 },
3204 -  
3205 - click_contact:function () {  
3206 - getApp().globalData.no_clear=1;  
3207 - },  
3208 -  
3209 - //打开客服操作菜单  
3210 - openCS() {  
3211 - // csType/在线客服设置:  
3212 - // 0关闭(如果有设置热线电话,则显示拨打热线电话)、  
3213 - // 1小程序客服、  
3214 - // 2企业微信客服  
3215 - let csType = this.data.sys_switch.weapp_customertype;  
3216 - if(csType == 0) {  
3217 - // 获取电话号码  
3218 - this.contactService();  
3219 - } else {  
3220 - this.getTel()  
3221 - .then(() => {  
3222 - self.setData({  
3223 - hiddenCS: false,  
3224 - }); 3995 +
  3996 +
  3997 + click_contact:function () {
  3998 + getApp().globalData.no_clear=1;
  3999 + },
  4000 +
  4001 + //打开客服操作菜单
  4002 + openCS() {
  4003 + // csType/在线客服设置:
  4004 + // 0关闭(如果有设置热线电话,则显示拨打热线电话)、
  4005 + // 1小程序客服、
  4006 + // 2企业微信客服
  4007 + let csType = this.data.sys_switch.weapp_customertype;
  4008 + if(csType == 0) {
  4009 + // 获取电话号码
  4010 + this.contactService();
  4011 + } else {
  4012 + this.getTel()
  4013 + .then(() => {
  4014 + self.setData({
  4015 + hiddenCS: false,
3225 }); 4016 });
3226 -  
3227 - };  
3228 - },  
3229 -  
3230 - //关闭客服操作菜单  
3231 - closeCS() {  
3232 - this.setData({  
3233 - hiddenCS: true,  
3234 }); 4017 });
3235 - }, 4018 +
  4019 + };
  4020 + },
  4021 +
  4022 + //关闭客服操作菜单
  4023 + closeCS() {
  4024 + this.setData({
  4025 + hiddenCS: true,
  4026 + });
  4027 + },
  4028 +
  4029 +
3236 4030
3237 4031
3238 4032
3239 4033
  4034 +
  4035 +
  4036 +
  4037 +
  4038 +
  4039 +
  4040 +
  4041 +
  4042 +
3240 }); 4043 });
3241 4044
3242 4045
packageA/pages/goodsInfo/goodsInfo.wxml
@@ -101,7 +101,8 @@ @@ -101,7 +101,8 @@
101 <!-- 秒杀价 --> 101 <!-- 秒杀价 -->
102 <!-- <view class="co-red" wx:if="{{options.prom_type == 1}}"><text class="rel yuan fs28">¥</text>{{filters.toFix(prom_price,2)}}</view> --> 102 <!-- <view class="co-red" wx:if="{{options.prom_type == 1}}"><text class="rel yuan fs28">¥</text>{{filters.toFix(prom_price,2)}}</view> -->
103 <!-- 手店价 --> 103 <!-- 手店价 -->
104 - <view class="co-red"><text class="rel yuan fs28">¥</text>{{filters.toFix(data.shop_price,2)}}</view> 104 + <view class="co-red" wx:if="{{options.prom_type == 1}}"><text class="rel yuan fs28">¥</text>{{filters.toFix(prom_price,2)}}</view>
  105 + <view class="co-red" wx:else><text class="rel yuan fs28">¥</text>{{filters.toFix(data.shop_price,2)}}</view>
105 <view class="goods-title"> 106 <view class="goods-title">
106 <view class="goods-name elli">{{data.goods_name}}</view> 107 <view class="goods-name elli">{{data.goods_name}}</view>
107 </view> 108 </view>
@@ -506,7 +507,7 @@ @@ -506,7 +507,7 @@
506 <view class="join-cart jc_sb ai_c"> 507 <view class="join-cart jc_sb ai_c">
507 508
508 <view class="flex"> 509 <view class="flex">
509 - <!-- <button wx:if="{{sys_switch.weapp_customertype==1}}" class="custom-service cart-ico new_split pdh20" open-type="contact" bindtap="click_contact" 510 + <!-- <button wx:if="{{sys_switch.weapp_customertype==1}}" class="custom-service cart-ico new_split pdh20" open-type="contact"
510 session-from="wechat|{{userInfo.user_id}}|{{userInfo.nickname}}|{{userInfo.head_pic}}"> 511 session-from="wechat|{{userInfo.user_id}}|{{userInfo.nickname}}|{{userInfo.head_pic}}">
511 <image class="cs-img" src="{{iurl}}/miniapp/images/custom-service.png"></image> 512 <image class="cs-img" src="{{iurl}}/miniapp/images/custom-service.png"></image>
512 <view>客服</view> 513 <view>客服</view>
@@ -523,9 +524,9 @@ @@ -523,9 +524,9 @@
523 <view>客服</view> 524 <view>客服</view>
524 </view> --> 525 </view> -->
525 526
526 - <view class="custom-service cart-ico new_split pdh20" bindtap="openCS" style="text-align: center">  
527 - <image class="cs-img" src="{{iurl}}/miniapp/images/custom-service.png"></image>  
528 - <view>客服</view> 527 + <view class="custom-service cart-ico new_split pdh20" bindtap="openCS">
  528 + <image class="cs-img" src="{{iurl}}/miniapp/images/custom-service.png"></image>
  529 + <view>客服</view>
529 </view> 530 </view>
530 531
531 <view bindtap="collectGoods" class="custom-service cart-ico new_split t-c pdh20"> 532 <view bindtap="collectGoods" class="custom-service cart-ico new_split t-c pdh20">
@@ -547,44 +548,45 @@ @@ -547,44 +548,45 @@
547 <view class="flex f1 btn-group"> 548 <view class="flex f1 btn-group">
548 549
549 <!-- 从“秒杀”入口进入购买商品 --> 550 <!-- 从“秒杀”入口进入购买商品 -->
550 - <!-- <block wx:if="{{options.prom_type == 1}}"> -->  
551 - <block wx:if="{{options.prom_type == 1}}">  
552 - <block wx:if="{{prom_st==1 && !prom_r_null}}">  
553 - <view bindtap="openSpecModel" data-ind="1" class="join-btn cart-btn f1">加入购物车</view>  
554 - <view bindtap="openSpecModel" data-ind="2" class="buy-btn cart-btn f1">立即抢购</view>  
555 - </block>  
556 -  
557 - <block wx:if="{{prom_st == 0 && !prom_r_null}}">  
558 - <!-- 秒杀预热要单独购买 -->  
559 - <block wx:if="{{prom_type==1 && prom_act.is_shop_buy}}">  
560 - <view bindtap="openSpecModel_Nor" data-nor="1" class="join-btn cart-btn f1">单独购买</view>  
561 - <view class="buy-btn cart-btn lanse">即将开始</view>  
562 - </block>  
563 - <block wx:else>  
564 - <view class="buy-btn cart-btn cart-btn-lg lanse set_width f1">即将开始</view>  
565 - </block>  
566 - </block>  
567 - 551 + <block wx:if="{{options.prom_type == 1}}">
  552 + <!-- 活动正在开始,商品还没抢光 -->
  553 + <block wx:if="{{prom_st==1 && !prom_r_null}}">
  554 + <view bindtap="openSpecModel" data-ind="1" class="join-btn cart-btn f1">加入购物车</view>
  555 + <view bindtap="openSpecModel" data-ind="2" class="buy-btn cart-btn f1">立即抢购</view>
  556 + </block>
568 557
569 - <block wx:if="{{prom_r_null}}"> 558 + <!-- 活动还没开始,商品还没抢光 -->
  559 + <block wx:if="{{prom_st == 0 && !prom_r_null}}">
  560 + <!-- 秒杀预热要单独购买 -->
  561 + <!-- is_shop_buy支持以原价购买 -->
  562 + <block wx:if="{{prom_type==1 && prom_act.is_shop_buy}}">
  563 + <view bindtap="openSpecModel_Nor" data-nor="1" class="join-btn cart-btn f1">单独购买</view>
  564 + <view class="buy-btn cart-btn lanse">即将开始</view>
  565 + </block>
  566 + <block wx:else>
  567 + <view class="buy-btn cart-btn cart-btn-lg lanse set_width f1">即将开始</view>
  568 + </block>
  569 + </block>
570 570
571 - <block wx:if="{{prom_type==1 && prom_act.is_shop_buy}}">  
572 - <view bindtap="openSpecModel_Nor" data-nor="1" class="join-btn cart-btn f1">单独购买</view>  
573 - <view class="buy-btn cart-btn huise f1">已抢光</view>  
574 - </block>  
575 - <view wx:else class="buy-btn cart-btn cart-btn-lg huise set_width f1">已抢光</view>  
576 - </block>  
577 -  
578 - <block wx:if="{{prom_st==3 && !prom_r_null}}">  
579 - <block wx:if="{{prom_type==1 && prom_act.is_shop_buy}}">  
580 - <view bindtap="openSpecModel_Nor" data-nor="1" class="join-btn cart-btn f1">单独购买</view>  
581 - <view class="buy-btn cart-btn huise f1">活动已经结束</view>  
582 - </block> 571 + <!-- 商品已被抢光 -->
  572 + <block wx:if="{{prom_r_null}}">
  573 + <block wx:if="{{prom_type==1 && prom_act.is_shop_buy}}">
  574 + <view bindtap="openSpecModel_Nor" data-nor="1" class="join-btn cart-btn f1">单独购买</view>
  575 + <view class="buy-btn cart-btn huise f1">已抢光</view>
  576 + </block>
  577 + <view wx:else class="buy-btn cart-btn cart-btn-lg huise set_width f1">已抢光</view>
  578 + </block>
583 579
584 - <view wx:else class="buy-btn cart-btn cart-btn-lg huise set_width f1">活动已经结束</view>  
585 - </block> 580 + <!-- 活动已经结束,商品还没抢光 -->
  581 + <block wx:if="{{prom_st==3 && !prom_r_null}}">
  582 + <block wx:if="{{prom_type==1 && prom_act.is_shop_buy}}">
  583 + <view bindtap="openSpecModel_Nor" data-nor="1" class="join-btn cart-btn f1">单独购买</view>
  584 + <view class="buy-btn cart-btn huise f1">活动已经结束</view>
  585 + </block>
  586 + <view wx:else class="buy-btn cart-btn cart-btn-lg huise set_width f1">活动已经结束</view>
586 </block> 587 </block>
587 - <!-- </block> --> 588 +
  589 + </block>
588 590
589 591
590 <!-- 从“我的服务”入口进入购买商品 --> 592 <!-- 从“我的服务”入口进入购买商品 -->
@@ -592,15 +594,9 @@ @@ -592,15 +594,9 @@
592 <view bindtap="openSpecModel" data-ind="1" class="join-btn cart-btn f1">加入购物车</view> 594 <view bindtap="openSpecModel" data-ind="1" class="join-btn cart-btn f1">加入购物车</view>
593 <view bindtap="openSpecModel" data-ind="2" class="buy-btn cart-btn f1">立即购买</view> 595 <view bindtap="openSpecModel" data-ind="2" class="buy-btn cart-btn f1">立即购买</view>
594 </block> 596 </block>
595 -  
596 -  
597 - 597 +
598 </view> 598 </view>
599 599
600 -  
601 -  
602 -  
603 -  
604 </view> 600 </view>
605 601
606 <!-- 制作一个圆球导航 --> 602 <!-- 制作一个圆球导航 -->
@@ -620,7 +616,8 @@ @@ -620,7 +616,8 @@
620 <view class="spec-goods-name ellipsis-2">{{data.goods_name}}</view> 616 <view class="spec-goods-name ellipsis-2">{{data.goods_name}}</view>
621 <view class="flex ai_end xc-val-money"> 617 <view class="flex ai_end xc-val-money">
622 <view class="spec-goods-price"><text class="fs20">¥</text> 618 <view class="spec-goods-price"><text class="fs20">¥</text>
623 - <block wx>{{data.shop_price}}</block> 619 + <block wx:if="{{options.prom_type == 1}}">{{prom_price}}</block>
  620 + <block wx:else>{{data.shop_price}}</block>
624 </view> 621 </view>
625 </view> 622 </view>
626 </view> 623 </view>
@@ -908,14 +905,35 @@ @@ -908,14 +905,35 @@
908 </view> 905 </view>
909 </view> 906 </view>
910 907
911 -  
912 <!-- 弹起来,购买预热商品的普通购买 --> 908 <!-- 弹起来,购买预热商品的普通购买 -->
913 <view hidden="{{!openSpecModal_flash_normal}}"> 909 <view hidden="{{!openSpecModal_flash_normal}}">
914 <include src="buy_flash_normal.wxml" /> 910 <include src="buy_flash_normal.wxml" />
915 </view> 911 </view>
916 912
917 913
918 -<include src="../../../components/com_servicer/com_servicer.wxml"/>  
919 -  
920 - 914 +<!-- 联系客服操作菜单 -->
  915 +<view class="action {{!hiddenCS ? 'active':''}}" hidden="{{hiddenCS}}">
  916 + <view class="pd20 t-c pr">
  917 + <text class="bold">联系客服</text>
  918 + <text class="iconfont icon-guan" bindtap="closeCS"></text>
  919 + </view>
  920 + <!-- 客服热线 -->
  921 + <view class="pd20 bdt fs30 btn2" bindtap="contactService">
  922 + <text class="iconfont icon-dianhua"></text>客服热线:
  923 + <text class="c-red">{{store_tel}}</text>
  924 + </view>
  925 + <!-- 小程序客服 -->
  926 + <block wx:if="{{sys_switch.weapp_customertype == 1}}">
  927 + <button class="pd20 bdt fs30 btn2" open-type="contact" session-from="wechat|{{userInfo.user_id}}|{{userInfo.nickname}}|{{userInfo.head_pic}}">
  928 + <text class="iconfont icon-kefu1"></text>在线客服
  929 + </button>
  930 + </block>
  931 + <!-- 微信客服 -->
  932 + <block wx:elif="{{sys_switch.weapp_customertype == 2}}">
  933 + <view class="pd20 bdt fs30 btn2" bindtap="con_weixin">
  934 + <text class="iconfont icon-kefu1"></text>在线客服
  935 + </view>
  936 + </block>
  937 +</view>
921 938
  939 +<view class="mask2" bindtap="closeCS"></view>
packageA/pages/goodsInfo/goodsInfo.wxss
@@ -562,7 +562,7 @@ view.cart-btn-lg { @@ -562,7 +562,7 @@ view.cart-btn-lg {
562 .spec-model { 562 .spec-model {
563 position: fixed; 563 position: fixed;
564 bottom: 0; 564 bottom: 0;
565 - z-index: 20; 565 + z-index: 19;
566 background: white; 566 background: white;
567 width: 100%; 567 width: 100%;
568 /* padding: 0 30rpx; */ 568 /* padding: 0 30rpx; */
@@ -2968,3 +2968,56 @@ button.custom-service::after{ @@ -2968,3 +2968,56 @@ button.custom-service::after{
2968 left: -1000px; 2968 left: -1000px;
2969 top: -1000px; 2969 top: -1000px;
2970 } 2970 }
  2971 +
  2972 +
  2973 +
  2974 +/* 联系客服操作菜单 */
  2975 +.action {
  2976 + position: fixed;
  2977 + bottom: 100rpx;
  2978 + z-index: 1;
  2979 + width: 100%;
  2980 + background-color: white;
  2981 + border-radius: 20rpx 20rpx 0 0;
  2982 +}
  2983 +
  2984 +.action .icon-guan {
  2985 + position: absolute;
  2986 + left: 20rpx !important;
  2987 + right: auto !important;
  2988 +}
  2989 +
  2990 +.action .iconfont {
  2991 + color: #ff7295;
  2992 + margin-right: 10rpx;
  2993 +}
  2994 +
  2995 +.action button {
  2996 + text-align: left;
  2997 + line-height: normal;
  2998 +}
  2999 +
  3000 +.action button::after {
  3001 + border-width: 0;
  3002 +}
  3003 +
  3004 +.action .btn2 {
  3005 + box-sizing: border-box;
  3006 + height: 100rpx;
  3007 + display: flex;
  3008 + align-items: center;
  3009 +}
  3010 +
  3011 +.mask2 {
  3012 + display: none;
  3013 + position: fixed;
  3014 + left: 0;
  3015 + right: 0;
  3016 + top: 0;
  3017 + bottom: 0;
  3018 + background-color: rgba(0,0,0,.5);
  3019 +}
  3020 +
  3021 +.action.active ~ .mask2 {
  3022 + display: block;
  3023 +}