Commit 28d6970b956349c1fd0e9dc41d5d7810e33ce7f0

Authored by yvan.ni
1 parent 38709b66

专享礼包门店

pages/giftpack/buygiftpack/giftpackbuy.js
1 1 var i = require("../../../utils/util.js");
  2 +var com = require("../public/buy_com.js");
2 3 var e = getApp(),
3 4 a = e.globalData.setting,
4 5 os = a,
... ... @@ -27,6 +28,44 @@ Page({
27 28 total: 0, //总数量
28 29 ad_data: null,
29 30 first_leader: e.globalData.first_leader || 0, // 推荐人ID
  31 +
  32 + //门店相关
  33 + ismend: 0,
  34 + is_sec_mend: 0,
  35 + sto_sele_name: "", //选中的门店名称
  36 + sto_sele_id: "", //选中的门店id
  37 + sto_sele_distr: "", //选择的门店的配送方式
  38 + is_show_sto_cat: 1, //是否显示门店分类
  39 + only_pk: null,
  40 + all_sto: null,
  41 + sec_sto: null, //选择了的门店分类
  42 + pickpu_list: null, //读出的所有门店list
  43 + def_pickpu_list: null, //一开始5个门店list
  44 + sec_pick_index: 0, //第二级门店选择ID
  45 + fir_pick_index: 0, //第一级门店选择ID
  46 + all_pick_list: null,//所有的门店先记录起来
  47 +
  48 + select_store: 0, //选择更多
  49 + index: 1,
  50 + more_store: 0, //选择门店
  51 + sort_store: 0, //门店分类
  52 + choice_sort_store: 0, //选择分类门店
  53 + new_user: 0, //新用户
  54 +
  55 + def_pick_store: null, // 默认的门店
  56 + fir_def_store: null, //客户默认的门店的
  57 + lat: null, //维度
  58 + lon: null, //经度
  59 +
  60 + is_get_local_ok: 0, //获取坐标是否完成
  61 + region_name: "门店分类", //区域的名字
  62 + is_gps: 1,
  63 + open_ind_store: 0, //哪里打开的门店列表的控制属性
  64 + default_store: {}, //创建添加默认门店地址的对象
  65 +
  66 + store:0,
  67 + openSpecModal:0
  68 +
30 69 },
31 70 onLoad: function (options) {
32 71 this.setData({
... ... @@ -80,6 +119,7 @@ Page({
80 119 },
81 120 onShow: function () {
82 121 getApp().check_can_share();
  122 + var th=this;
83 123 //--先判断会员状态--
84 124 getApp().is_Single_page(this, function () {
85 125 var user_info = getApp().globalData.userInfo;
... ... @@ -87,170 +127,112 @@ Page({
87 127 getApp().goto('/pages/togoin/togoin');
88 128 return false;
89 129 }
  130 + com.wait_for_store_config(th);
  131 + com.set_user_mo_store(th,os);
  132 +
90 133 })
91 134 this.init();
92 135 },
93 136  
94 137 //购买礼包
95 138 GetBuyPrice: function (e) {
96   - var that = this.data;
97   - var th = this;
98   - var id = e.currentTarget.dataset.id; //活动id
99   - var my_confirm = th.selectComponent("#my_confirm"); //组件的id
100   - var order_sn = e.currentTarget.dataset.order_sn; //订单号
101   - var money = e.currentTarget.dataset.money; //支付金额
102   - my_confirm.open(
103   - "是否确定购买该礼包",
104   - "取消",
105   - "确定",
106   - function () {
107   - my_confirm.open_cancel(0);
108   - },
109   - function () {
110   - my_confirm.open_cancel(0);
111   - var json = {
112   - "actId": '', //活动Id
113   - "actType": '', //活动类型 1:新人礼、2:评价有礼、3:节日营销、4:生日营销
114   - "buyType": '2', //1=积分兑换 2=余额购买
115   - "giftBagId": id, //礼包Id
116   - "storeId": that.getStorageID, //商家Id
117   - "userId": that.getUserID, //用户ID
118   - "buyFrom": 2,
119   - "first_leader": that.first_leader,
120   - };
121 139  
122   - //-- 分享导购要记录 --
123   - if (getApp().globalData.guide_id) {
124   - json.guide_id = getApp().globalData.guide_id;
  140 + var th = this;
  141 + var index = e.currentTarget.dataset.index; //活动id
  142 + var sele_g=th.data.wareCard[index];
  143 + th.setData({sele_g:sele_g,buyType:2,})
  144 + if(sele_g.is_pickup){
  145 + if(sele_g.pickup_list && th.data.def_pick_store){
  146 + com.check_def_pk(th);
125 147 }
126   -
127   - var data = JSON.stringify(json);
128   - var url = that.url + "/api/weshop/marketing/buy/receive/gift/record/insert";
129   - getApp().request.json_post(url, json,
130   - function (res) {
131   - if (res.data.code == 0 && res.data.data) {
132   - var order_sn = res.data.data.orderSn;
133   - res = res.data.data.result;
134   - if (!res) return false;
135   - var url = "/pages/giftpack/payment/payment?money=" + money + "&order_sn=" + order_sn;
136   - wx.requestPayment({
137   - timeStamp: String(res.timeStamp),
138   - nonceStr: res.nonceStr,
139   - package: res.packageValue,
140   - signType: res.signType,
141   - paySign: res.paySign,
142   - success: function (res) {
143   - getApp().goto(url);
144   - },
145   - fail: function (res) {
146   - getApp().my_warnning("取消支付", 0, th);
147   - }
148   - });
149   - } else {
150   - getApp().my_warnning(res.data.msg, 0, th);
  148 + com.get_sto(th,os)
  149 + th.setData({
  150 + openSpecModal:1
  151 + })
  152 + }else{
  153 + var my_confirm = th.selectComponent("#my_confirm"); //组件的id
  154 + my_confirm.open(
  155 + "是否确定购买该礼包",
  156 + "取消",
  157 + "确定",
  158 + function () {
  159 + my_confirm.open_cancel(0);
  160 + },
  161 + function () {
  162 + my_confirm.open_cancel(0);
  163 + com.buy_libao(th)
151 164 }
152   - },
153   - function (res) {
154   -
155   - }
156 165  
157 166 )
  167 + }
158 168  
159 169  
160   - }
161 170  
162   - )
163 171  
164 172  
165 173 },
166 174 // 积分兑换
167 175 GetBuyIntegral: function (e) {
168   - var that = this.data;
169   - var th = this;
170   - var id = e.currentTarget.dataset.id; //活动id
171   - var my_confirm = th.selectComponent("#my_confirm"); //组件的id
172   -
173   - my_confirm.open(
174   - "是否确定兑换该礼包",
175   - "取消",
176   - "确定",
177   - function () {
178   - my_confirm.open_cancel(0);
179   - },
180   - function () {
181   - my_confirm.open_cancel(0);
182   - var json = {
183   - "actId": '', //活动Id
184   - "actType": '', //活动类型 1:新人礼、2:评价有礼、3:节日营销、4:生日营销
185   - "buyType": '1', //1=积分兑换 2=余额购买 3=免费领取
186   - "giftBagId": id, //礼包Id
187   - "storeId": that.getStorageID, //商家Id
188   - "userId": that.getUserID, //用户ID
189   - "buyFrom": 2,
190   - "first_leader": that.first_leader
191   - };
192   -
193   - //-- 分享导购要记录 --
194   - if (getApp().globalData.guide_id) {
195   - json.guide_id = getApp().globalData.guide_id;
196   - }
197   - console.log(json, 'json');
198   - var data = JSON.stringify(json);
199   - var url = that.url + "/api/weshop/marketing/buy/receive/gift/record/insert";
200   - getApp().request.json_post(url, json,
201   - function (res) {
202   - if (res.data.code == 0) {
203   - getApp().my_warnning("兑换成功!", 1, th);
204   - } else {
205   - getApp().my_warnning(res.data.msg, 0, th);
206   - }
207   - },
208   - function (res) { })
209   -
210   - })
  176 + var th = this;
  177 + var index = e.currentTarget.dataset.index; //活动id
  178 + var sele_g=th.data.wareCard[index];
  179 + th.setData({sele_g:sele_g, buyType:1,})
  180 + if(sele_g.is_pickup){
  181 + if(sele_g.pickup_list && th.data.def_pick_store){
  182 + com.check_def_pk(th);
  183 + }
  184 + com.get_sto(th,os)
  185 + th.setData({
  186 + openSpecModal:1
  187 + })
  188 + }else {
  189 + var my_confirm = th.selectComponent("#my_confirm"); //组件的id
  190 + my_confirm.open(
  191 + "是否确定兑换该礼包",
  192 + "取消",
  193 + "确定",
  194 + function () {
  195 + my_confirm.open_cancel(0);
  196 + },
  197 + function () {
  198 + my_confirm.open_cancel(0);
  199 + com.buy_libao(th)
  200 + })
  201 + }
211 202  
212 203 },
213 204 //免费领取
214 205 GetFree: function (e) {
215   - var that = this.data;
216   - var th = this;
217   - var id = e.currentTarget.dataset.id; //活动id
218   - var my_confirm = th.selectComponent("#my_confirm"); //组件的id
219   - my_confirm.open(
220   - "是否确定领取该礼包",
221   - "取消",
222   - "确定",
223   - function () {
224   - my_confirm.open_cancel(0);
225   - },
226   - function () {
227   - my_confirm.open_cancel(0);
228   - var json = {
229   - "actId": '', //活动Id
230   - "actType": '', //活动类型 1:新人礼、2:评价有礼、3:节日营销、4:生日营销
231   - "buyType": '3', //1=积分兑换 2=余额购买 3=免费领取
232   - "giftBagId": id, //礼包Id
233   - "storeId": that.getStorageID, //商家Id
234   - "userId": that.getUserID, //用户ID
235   - "buyFrom": 2,
236   - "first_leader": that.first_leader
237   - };
238   - //-- 分享导购要记录 --
239   - if (getApp().globalData.guide_id) {
240   - json.guide_id = getApp().globalData.guide_id;
241   - }
242   - var data = JSON.stringify(json);
243   - var url = that.url + "/api/weshop/marketing/buy/receive/gift/record/insert";
244   - getApp().request.json_post(url, json,
245   - function (res) {
246   - if (res.data.code == 0) {
247   - getApp().my_warnning("领取成功!", 1, th);
248   - } else {
249   - getApp().my_warnning(res.data.msg, 0, th);
250   - }
251   - },
252   - function (res) { })
253   - })
  206 +
  207 + var th = this;
  208 + var index = e.currentTarget.dataset.index; //活动id
  209 + var sele_g=th.data.wareCard[index];
  210 + th.setData({sele_g:sele_g, buyType:3,})
  211 +
  212 + if(sele_g.is_pickup){
  213 + if(sele_g.pickup_list && th.data.def_pick_store){
  214 + com.check_def_pk(th);
  215 + }
  216 + com.get_sto(th,os)
  217 + th.setData({
  218 + openSpecModal:1
  219 + })
  220 + }else {
  221 +
  222 +
  223 + var my_confirm = th.selectComponent("#my_confirm"); //组件的id
  224 + my_confirm.open(
  225 + "是否确定领取该礼包",
  226 + "取消",
  227 + "确定",
  228 + function () {
  229 + my_confirm.open_cancel(0);
  230 + },
  231 + function () {
  232 + my_confirm.open_cancel(0);
  233 + com.buy_libao(th)
  234 + })
  235 + }
254 236 },
255 237  
256 238 getList: function (e) {
... ... @@ -327,6 +309,7 @@ Page({
327 309 },
328 310  
329 311 onShareAppMessage: function (e) {
  312 + getApp().globalData.no_clear=1;
330 313 var curPage = this;
331 314 var pagePath = curPage.route; //当前页面url
332 315 if (pagePath.indexOf('/') != 0) {
... ... @@ -341,6 +324,7 @@ Page({
341 324  
342 325 // 分享朋友圈
343 326 onShareTimeline() {
  327 + getApp().globalData.no_clear=1;
344 328 var curPage = this;
345 329 var pagePath = curPage.route; //当前页面url
346 330 if (pagePath.indexOf('/') != 0) {
... ... @@ -354,4 +338,271 @@ Page({
354 338 }
355 339 },
356 340  
  341 +
  342 + //--- 设置一下默认库存的数量 ----
  343 + set_def_storage(ee) {
  344 + var that = this, th = this;
  345 + that.data.fir_def_store = ee;
  346 + that.setData({
  347 + def_pick_store: ee,
  348 + sto_sele_name: ee.pickup_name,
  349 + sto_sele_id: ee.pickup_id,
  350 + sto_sele_distr: ee.distr_type
  351 + })
  352 + },
  353 + // 选择门店
  354 + choice_store: function (ee) {
  355 + var th = this;
  356 + var ind = ee.currentTarget.dataset.ind;
  357 + var bconfig = th.data.bconfig;
  358 +
  359 + if (!th.data.only_pk && !th.data.def_pickpu_list) {
  360 + getApp().confirmBox("门店库存不足", null, 25000, !1);
  361 + return false;
  362 + }
  363 +
  364 + if (th.data.only_pk && !th.data.only_pk.length) {
  365 + getApp().confirmBox("门店库存不足", null, 25000, !1);
  366 + return false;
  367 + }
  368 + if (th.data.def_pickpu_list && !th.data.def_pickpu_list.length) {
  369 + getApp().confirmBox("门店库存不足", null, 25000, !1);
  370 + return false;
  371 + }
  372 +
  373 +
  374 + if (bconfig && bconfig.is_sort_storage) {
  375 + wx.getLocation({
  376 + type: 'gcj02',
  377 + success: function (res) {
  378 +
  379 + th.data.lat = res.latitude;
  380 + th.data.lon = res.longitude;
  381 + th.data.is_get_local_ok = 1;
  382 + th.setData({
  383 + is_gps: 1
  384 + });
  385 + //th.onShow();
  386 + com.get_sto(th,os);
  387 + },
  388 + fail: function (res) {
  389 + //th.onShow();
  390 + th.data.is_get_local_ok = 1;
  391 + com.get_sto(th,os);
  392 + if (res.errCode == 2) {
  393 + th.setData({
  394 + is_gps: 0
  395 + });
  396 + if (th.data.is_gps == 0) {
  397 + getApp().confirmBox("请开启GPS定位", null, 25000, !1);
  398 + }
  399 + } else {
  400 + th.setData({
  401 + is_gps: "3"
  402 + });
  403 + }
  404 +
  405 + }
  406 + })
  407 + } else {
  408 + th.data.is_get_local_ok = 1;
  409 + com.get_sto(th,os);
  410 + }
  411 +
  412 + if (ind != undefined && ind != null) {
  413 + this.setData({
  414 + open_ind_store: ind,
  415 + store: 1,
  416 + openSpecModal: !1,
  417 + openSpecModal_pt: !1,
  418 + openSpecModal_flash_normal: !1,
  419 + })
  420 + } else {
  421 + this.setData({
  422 + store: 1,
  423 + openSpecModal: !1,
  424 + openSpecModal_pt: !1,
  425 + openSpecModal_flash_normal: !1
  426 +
  427 + })
  428 + }
  429 + },
  430 + //关闭选择门店
  431 + close_popup: function (e) {
  432 + var th = this;
  433 + this.setData({
  434 + store: 0,
  435 + choice_sort_store: 0,
  436 + sort_store: 0,
  437 + fir_pick_index: 0,
  438 + sec_pick_index: 0
  439 + })
  440 +
  441 + var openindstore = this.data.open_ind_store;
  442 + if (openindstore == 1) {
  443 + th.setData({
  444 + openSpecModal: !0,
  445 + openSpecModal_ind: openindstore,
  446 + });
  447 + } else if (openindstore == 2) {
  448 + th.setData({
  449 + openSpecModal: !0,
  450 + openSpecModal_ind: openindstore,
  451 + });
  452 + }
  453 + else if (openindstore == 4) { //4就是拼团
  454 + th.setData({
  455 + openSpecModal_pt: 1, //打开拼团购买界面
  456 + store: 0, //关闭门店
  457 + choice_sort_store: 0, //关闭门店2级
  458 + sort_store: 0, //关闭门店2级
  459 + });
  460 + }
  461 + else {
  462 + th.setData({
  463 + store: 0,
  464 + choice_sort_store: 0,
  465 + sort_store: 0
  466 + })
  467 + }
  468 +
  469 +
  470 + },
  471 +
  472 + //选择更多门店
  473 + more_store: function () {
  474 + this.setData({
  475 + sort_store: 1
  476 + });
  477 + },
  478 + // 返回按钮
  479 + returns: function () {
  480 + this.setData({
  481 + sort_store: 0,
  482 + choice_sort_store: 0
  483 + });
  484 + },
  485 + //---选择分类门店---
  486 + choice_sort_store: function (e) {
  487 + var index = e.currentTarget.dataset.index;
  488 + var region_name = e.currentTarget.dataset.region;
  489 + var item = this.data.all_sto[index];
  490 + this.setData({
  491 + region_name: region_name,
  492 + sort_store: 0,
  493 + choice_sort_store: 1,
  494 + sec_sto: item,
  495 + sec_pick_index: 0
  496 + });
  497 + },
  498 +
  499 + choose_for_store_fir: function (e) {
  500 + var index_c = e.currentTarget.dataset.ind;
  501 + var th = this;
  502 + th.setData({
  503 + fir_pick_index: index_c
  504 + })
  505 +
  506 + },
  507 +
  508 + //确定def_pick为选择的门店
  509 + sure_pick: function (e) {
  510 + var th = this;
  511 + var item = null;
  512 + var openindstore = th.data.open_ind_store;
  513 +
  514 + if (th.data.choice_sort_store == 0) {
  515 + var index = th.data.fir_pick_index;
  516 + if (th.data.is_show_sto_cat == 1) {
  517 + item = th.data.def_pickpu_list[index];
  518 + } else {
  519 + item = th.data.only_pk[index]; //当没有门店分类的时候
  520 + }
  521 +
  522 + } else {
  523 + var index = th.data.sec_pick_index;
  524 + item = th.data.sec_sto.s_arr[index];
  525 + }
  526 +
  527 + if (!th.data.sele_g) return false;
  528 +
  529 + th.setData({
  530 + def_pick_store: item,
  531 + sto_sele_name: item.pickup_name,
  532 + sto_sele_id: item.pickup_id,
  533 + sto_sele_distr: item.distr_type,
  534 + store: 0,
  535 + choice_sort_store: 0,
  536 + fir_pick_index: 0,
  537 + openSpecModal: !0,
  538 + });
  539 +
  540 +
  541 + },
  542 + //---点击二级之后的选择---
  543 + choose_for_store: function (e) {
  544 + var index_c = e.currentTarget.dataset.ind;
  545 + var th = this;
  546 + th.setData({
  547 + sec_pick_index: index_c,
  548 + fir_pick_index: index_c
  549 + })
  550 +
  551 + },
  552 + //把选择的门店设置成默认的门店def_pick
  553 + set_def_pick: function (e) {
  554 + var th = this;
  555 + var item = null;
  556 + if (th.data.choice_sort_store == 0) {
  557 + var index = th.data.fir_pick_index;
  558 + if (th.data.is_show_sto_cat == 1) {
  559 + item = th.data.def_pickpu_list[index];
  560 + } else {
  561 + item = th.data.only_pk[index]; //当没有门店分类的时候
  562 + }
  563 + } else {
  564 + var index = th.data.sec_pick_index;
  565 + item = th.data.sec_sto.s_arr[index];
  566 + }
  567 +
  568 + th.setData({
  569 + def_pick_store: item,
  570 + sto_sele_name: item.pickup_name,
  571 + sto_sele_id: item.pickup_id,
  572 + sto_sele_distr: item.distr_type,
  573 + store: 0,
  574 + choice_sort_store: 0,
  575 + openSpecModal: !0,
  576 + });
  577 +
  578 + var user_id=getApp().globalData.user_id;
  579 + var def_pickup_id = item.pickup_id;
  580 + getApp().request.put('/api/weshop/users/update', {
  581 + data: {
  582 + user_id: user_id,
  583 + def_pickup_id: def_pickup_id
  584 + },
  585 + success: function (res) {
  586 + if (res.data.code == 0) {
  587 + if (th.data.choice_sort_store == 0) th.setData({
  588 + fir_pick_index: 0
  589 + });
  590 + getApp().globalData.pk_store = item;
  591 + } else {
  592 + getApp().my_warnning("设置默认门店地址失败", 0, th)
  593 + }
  594 +
  595 + }
  596 + });
  597 +
  598 +
  599 +
  600 + },
  601 + closeSpecModal: function () {
  602 + this.setData({openSpecModal: 0});
  603 + },
  604 +
  605 + buy_libao:function () {
  606 + com.buy_libao(this)
  607 + }
357 608 })
358 609 \ No newline at end of file
... ...
pages/giftpack/buygiftpack/giftpackbuy.wxml
... ... @@ -62,30 +62,30 @@
62 62 <view class="flex-vertical">
63 63 <block wx:if="{{items.payMoney>0 && items.payIntegral>0}}">
64 64 <block wx:if="{{items.payMoney>0}}">
65   - <view class="flex" bindtap="GetBuyPrice" data-id="{{items.lbId}}" data-money="{{items.payMoney}}">
  65 + <view class="flex" bindtap="GetBuyPrice" data-index="{{index}}">
66 66 <button class="box_button_dui">立即购买</button>
67 67 </view>
68 68 </block>
69 69 <block wx:if="{{items.payIntegral>0}}">
70   - <view class="flex" bindtap="GetBuyIntegral" data-id="{{items.lbId}}">
  70 + <view class="flex" bindtap="GetBuyIntegral" data-index="{{index}}">
71 71 <button class="box_button_dui box_button_buy">立即兑换</button>
72 72 </view>
73 73 </block>
74 74 </block>
75 75 <block wx:else>
76 76 <block wx:if="{{items.payMoney>0}}">
77   - <view class="flex" bindtap="GetBuyPrice" data-id="{{items.lbId}}" data-money="{{items.payMoney}}">
  77 + <view class="flex" bindtap="GetBuyPrice" data-index="{{index}}">
78 78 <button class="box_button_dui box_button_buy">立即购买</button>
79 79 </view>
80 80 </block>
81 81 <block wx:if="{{items.payIntegral>0}}">
82   - <view class="flex" bindtap="GetBuyIntegral" data-id="{{items.lbId}}">
  82 + <view class="flex" bindtap="GetBuyIntegral" data-index="{{index}}">
83 83 <button class="box_button_dui box_button_buy">立即兑换</button>
84 84 </view>
85 85 </block>
86 86 </block>
87 87 <block wx:if="{{!items.payMoney && !items.payIntegral}}">
88   - <view class="flex" bindtap="GetFree" data-id="{{items.lbId}}">
  88 + <view class="flex" bindtap="GetFree" data-index="{{index}}">
89 89 <button class="box_button_dui box_button_buy">免费领取</button>
90 90 </view>
91 91 </block>
... ... @@ -116,4 +116,6 @@
116 116 </view>
117 117 <!-- 引入提示组件 -->
118 118 <warn id="warn"></warn>
119   -<my_confirm id="my_confirm"></my_confirm>
120 119 \ No newline at end of file
  120 +<my_confirm id="my_confirm"></my_confirm>
  121 +
  122 +<include src="../public/buy_com.wxml"></include>
121 123 \ No newline at end of file
... ...
pages/giftpack/buygiftpack/giftpackbuy.wxss
1 1 /*引用样式路径*/
2 2 @charset "UTF-8";
3   -
4   -/* Author XGQ
5   - * 2019-11-12
6   - */
  3 +@import '../../goods/goodsInfo/goodsInfo.wxss';
7 4  
8 5 page {
9 6 /* background-color: #fb7454; */
... ...
pages/giftpack/giftpacklist/giftpacklist.js
... ... @@ -4,6 +4,7 @@ var e = getApp(),
4 4 t = e.request,
5 5 d = e.globalData;
6 6 var ut = require("../../../utils/util.js");
  7 +var com = require("../public/buy_com.js");
7 8  
8 9 Page({
9 10 data: {
... ... @@ -30,6 +31,43 @@ Page({
30 31 is_lb: 0, //是否有礼包
31 32 default_color: null,
32 33 first_leader: e.globalData.first_leader || 0, // 推荐人ID
  34 +
  35 + //门店相关
  36 + ismend: 0,
  37 + is_sec_mend: 0,
  38 + sto_sele_name: "", //选中的门店名称
  39 + sto_sele_id: "", //选中的门店id
  40 + sto_sele_distr: "", //选择的门店的配送方式
  41 + is_show_sto_cat: 1, //是否显示门店分类
  42 + only_pk: null,
  43 + all_sto: null,
  44 + sec_sto: null, //选择了的门店分类
  45 + pickpu_list: null, //读出的所有门店list
  46 + def_pickpu_list: null, //一开始5个门店list
  47 + sec_pick_index: 0, //第二级门店选择ID
  48 + fir_pick_index: 0, //第一级门店选择ID
  49 + all_pick_list: null,//所有的门店先记录起来
  50 +
  51 + select_store: 0, //选择更多
  52 + index: 1,
  53 + more_store: 0, //选择门店
  54 + sort_store: 0, //门店分类
  55 + choice_sort_store: 0, //选择分类门店
  56 + new_user: 0, //新用户
  57 +
  58 + def_pick_store: null, // 默认的门店
  59 + fir_def_store: null, //客户默认的门店的
  60 + lat: null, //维度
  61 + lon: null, //经度
  62 +
  63 + is_get_local_ok: 0, //获取坐标是否完成
  64 + region_name: "门店分类", //区域的名字
  65 + is_gps: 1,
  66 + open_ind_store: 0, //哪里打开的门店列表的控制属性
  67 + default_store: {}, //创建添加默认门店地址的对象
  68 +
  69 + store:0,
  70 + openSpecModal:0
33 71 },
34 72 onLoad: function (options) {
35 73 this.setData({
... ... @@ -87,81 +125,36 @@ Page({
87 125 GetBuyPrice: function (e) {
88 126 var that = this.data;
89 127 var th = this;
90   - // var id = e.currentTarget.dataset.id;//活动id
91 128 //如果还没有开始的话
92 129 if (th.data.isStart != 1) {
93 130 getApp().my_warnning("活动还没有开始", 0, th);
94 131 return false;
95 132 }
96 133  
97   -
98   - var money = e.currentTarget.dataset.money;
99   - var my_confirm = th.selectComponent("#my_confirm"); //组件的id
100   - my_confirm.open(
101   - "是否确定购买该礼包",
102   - "取消",
103   - "确定",
104   - function () {
105   - my_confirm.open_cancel(0);
106   - },
107   - function () {
108   - my_confirm.open_cancel(0);
109   -
110   - var json = {
111   - "actId": '', //活动Id
112   - "actType": '', //活动类型 1:新人礼、2:评价有礼、3:节日营销、4:生日营销
113   - "buyType": '2', //1=积分兑换 2=余额购买
114   - "giftBagId": that.getGiftID, //礼包Id
115   - "storeId": a.stoid, //商家Id
116   - "userId": d.user_id, //用户ID
117   - "buyFrom": 2,
118   - "first_leader": that.first_leader,
119   - };
120   -
121   - //-- 分享导购要记录 --
122   - if (getApp().globalData.guide_id) {
123   - json.guide_id = getApp().globalData.guide_id;
124   - }
125   -
126   - var data = JSON.stringify(json);
127   - var url = that.url + "/api/weshop/marketing/buy/receive/gift/record/insert";
128   -
129   - getApp().request.json_post(url, json,
130   - function (res) {
131   - if (res.data.code == 0) {
132   - var res = res.data.data;
133   - if (!res) return false;
134   - if (!res.result) return false;
135   -
136   - var order_sn = res.orderSn;
137   - var url = "/pages/giftpack/payment/payment?money=" + money + "&order_sn=" + order_sn;
138   - wx.requestPayment({
139   - timeStamp: String(res.result.timeStamp),
140   - nonceStr: res.result.nonceStr,
141   - package: res.result.packageValue,
142   - signType: res.result.signType,
143   - paySign: res.result.paySign,
144   - success: function (n) {
145   - getApp().goto(url);
146   - },
147   - fail: function (n) {
148   - getApp().my_warnning("取消支付", 0, th);
149   - }
150   - });
151   - } else {
152   - getApp().my_warnning(res.data.msg, 0, th);
  134 + th.setData({ buyType:2 })
  135 + if(th.data.sele_g.is_pickup){
  136 + th.setData({
  137 + openSpecModal:1
  138 + })
  139 + }else{
  140 + var my_confirm = th.selectComponent("#my_confirm"); //组件的id
  141 + my_confirm.open(
  142 + "是否确定购买该礼包",
  143 + "取消",
  144 + "确定",
  145 + function () {
  146 + my_confirm.open_cancel(0);
  147 + },
  148 + function () {
  149 + my_confirm.open_cancel(0);
  150 + com.buy_libao(th)
153 151 }
154   - },
155   - function (res) {
156   -
157   - }
158 152  
159 153 )
  154 + }
160 155  
161 156  
162   - }
163 157  
164   - )
165 158  
166 159 },
167 160 GetBuyIntegral: function (e) {
... ... @@ -173,48 +166,28 @@ Page({
173 166 getApp().my_warnning("活动还没有开始", 0, th);
174 167 return false;
175 168 }
176   - // var id = e.currentTarget.dataset.id;//活动id
177   - var my_confirm = th.selectComponent("#my_confirm"); //组件的id
178   - my_confirm.open(
179   - "是否确定兑换该礼包",
180   - "取消",
181   - "确定",
182   - function () {
183   - my_confirm.open_cancel(0);
184   - },
185   - function () {
186   - my_confirm.open_cancel(0);
187   - var json = {
188   - "actId": '', //活动Id
189   - "actType": '', //活动类型 1:新人礼、2:评价有礼、3:节日营销、4:生日营销
190   - "buyType": '1', //1=积分兑换 2=余额购买
191   - "giftBagId": that.getGiftID, //礼包Id
192   - "storeId": a.stoid, //商家ID
193   - "userId": d.user_id, //用户ID
194   - "buyFrom": 2,
195   - "first_leader": that.first_leader,
196   - };
197   - //-- 分享导购要记录 --
198   - if (getApp().globalData.guide_id) {
199   - json.guide_id = getApp().globalData.guide_id;
200   - }
201 169  
202   - var data = JSON.stringify(json);
203   - var url = that.url + "/api/weshop/marketing/buy/receive/gift/record/insert";
204   - getApp().request.json_post(url, json,
205   - function (res) {
206   - if (res.data.code == 0) {
207   - getApp().my_warnning("兑换成功!", 1, th);
208   - } else {
209   - getApp().my_warnning(res.data.msg, 0, th);
210   - }
211   - },
212   - function (res) {
  170 + th.setData({ buyType:1 });
  171 + if(th.data.sele_g.is_pickup){
  172 + th.setData({
  173 + openSpecModal:1
  174 + })
  175 + }else {
  176 + var my_confirm = th.selectComponent("#my_confirm"); //组件的id
  177 + my_confirm.open(
  178 + "是否确定兑换该礼包",
  179 + "取消",
  180 + "确定",
  181 + function () {
  182 + my_confirm.open_cancel(0);
  183 + },
  184 + function () {
  185 + my_confirm.open_cancel(0);
  186 + com.buy_libao(th)
  187 + })
  188 + }
213 189  
214   - }
215 190  
216   - )
217   - })
218 191  
219 192  
220 193 },
... ... @@ -334,7 +307,20 @@ Page({
334 307 actTitle: res.data.data.actTitle,
335 308 wareCard: res.data.data.wareCard,
336 309 isStart: isStart,
  310 + sele_g:res.data.data
337 311 })
  312 +
  313 +
  314 + var sele_g=res.data.data;
  315 + com.wait_for_store_config(_this2);
  316 + com.set_user_mo_store(_this2,os,function () {
  317 + if(sele_g.pickup_list && _this2.data.def_pick_store){
  318 + com.check_def_pk(_this2);
  319 + }
  320 + });
  321 + com.get_sto(_this2,os);
  322 +
  323 +
338 324 } else {
339 325 getApp().my_warnning(res.data.msg, 0, _this2);
340 326 return false;
... ... @@ -421,6 +407,7 @@ Page({
421 407  
422 408 //--- 分享设置 --
423 409 onShareAppMessage: function (e) {
  410 + getApp().globalData.no_clear=1;
424 411 var curPage = this;
425 412 var pagePath = curPage.route; //当前页面url
426 413 if (pagePath.indexOf('/') != 0) {
... ... @@ -443,6 +430,7 @@ Page({
443 430 * 用户分享朋友圈
444 431 */
445 432 onShareTimeline() {
  433 + getApp().globalData.no_clear=1;
446 434 var curPage = this;
447 435 var pagePath = curPage.route; //当前页面url
448 436 if (pagePath.indexOf('/') != 0) {
... ... @@ -471,50 +459,298 @@ Page({
471 459 getApp().my_warnning("活动还没有开始", 0, th);
472 460 return false;
473 461 }
474   - // var id = e.currentTarget.dataset.id;//活动id
475   - var my_confirm = th.selectComponent("#my_confirm"); //组件的id
476   - my_confirm.open(
477   - "是否确定领取该礼包",
478   - "取消",
479   - "确定",
480   - function () {
481   - my_confirm.open_cancel(0);
482   - },
483   - function () {
484   - my_confirm.open_cancel(0);
485   - var json = {
486   - "actId": '', //活动Id
487   - "actType": '', //活动类型 1:新人礼、2:评价有礼、3:节日营销、4:生日营销
488   - "buyType": '3', //1=积分兑换 2=余额购买
489   - "giftBagId": that.getGiftID, //礼包Id
490   - "storeId": a.stoid, //商家ID
491   - "userId": d.user_id, //用户ID
492   - "buyFrom": 2,
493   - "first_leader": that.first_leader,
494   - };
495   -
496   - //-- 分享导购要记录 --
497   - if (getApp().globalData.guide_id) {
498   - json.guide_id = getApp().globalData.guide_id;
  462 +
  463 + th.setData({ buyType:3 });
  464 + if(th.data.sele_g.is_pickup){
  465 + th.setData({
  466 + openSpecModal:1
  467 + })
  468 + }else {
  469 +
  470 +
  471 + // var id = e.currentTarget.dataset.id;//活动id
  472 + var my_confirm = th.selectComponent("#my_confirm"); //组件的id
  473 + my_confirm.open(
  474 + "是否确定领取该礼包",
  475 + "取消",
  476 + "确定",
  477 + function () {
  478 + my_confirm.open_cancel(0);
  479 + },
  480 + function () {
  481 + my_confirm.open_cancel(0);
  482 + com.buy_libao(th)
  483 + })
  484 + }
  485 +
  486 +
  487 + },
  488 +
  489 + //--- 设置一下默认库存的数量 ----
  490 + set_def_storage(ee) {
  491 + var that = this, th = this;
  492 + that.data.fir_def_store = ee;
  493 +
  494 + that.setData({
  495 + def_pick_store: ee,
  496 + sto_sele_name: ee.pickup_name,
  497 + sto_sele_id: ee.pickup_id,
  498 + sto_sele_distr: ee.distr_type
  499 + })
  500 + },
  501 + // 选择门店
  502 + choice_store: function (ee) {
  503 + var th = this;
  504 + var ind = ee.currentTarget.dataset.ind;
  505 + var bconfig = th.data.bconfig;
  506 +
  507 + if (!th.data.only_pk && !th.data.def_pickpu_list) {
  508 + getApp().confirmBox("门店库存不足", null, 25000, !1);
  509 + return false;
  510 + }
  511 +
  512 + if (th.data.only_pk && !th.data.only_pk.length) {
  513 + getApp().confirmBox("门店库存不足", null, 25000, !1);
  514 + return false;
  515 + }
  516 + if (th.data.def_pickpu_list && !th.data.def_pickpu_list.length) {
  517 + getApp().confirmBox("门店库存不足", null, 25000, !1);
  518 + return false;
499 519 }
500 520  
501   - var data = JSON.stringify(json);
502   - var url = that.url + "/api/weshop/marketing/buy/receive/gift/record/insert";
503   - getApp().request.json_post(url, json,
504   - function (res) {
505   - if (res.data.code == 0) {
506   - getApp().my_warnning("领取成功!", 1, th);
  521 +
  522 + if (bconfig && bconfig.is_sort_storage) {
  523 + wx.getLocation({
  524 + type: 'gcj02',
  525 + success: function (res) {
  526 +
  527 + th.data.lat = res.latitude;
  528 + th.data.lon = res.longitude;
  529 + th.data.is_get_local_ok = 1;
  530 + th.setData({
  531 + is_gps: 1
  532 + });
  533 + //th.onShow();
  534 + com.get_sto(th,os);
  535 + },
  536 + fail: function (res) {
  537 + //th.onShow();
  538 + th.data.is_get_local_ok = 1;
  539 + com.get_sto(th,os);
  540 + if (res.errCode == 2) {
  541 + th.setData({
  542 + is_gps: 0
  543 + });
  544 + if (th.data.is_gps == 0) {
  545 + getApp().confirmBox("请开启GPS定位", null, 25000, !1);
  546 + }
  547 + } else {
  548 + th.setData({
  549 + is_gps: "3"
  550 + });
  551 + }
  552 +
  553 + }
  554 + })
  555 + } else {
  556 + th.data.is_get_local_ok = 1;
  557 + com.get_sto(th,os);
  558 + }
  559 +
  560 + if (ind != undefined && ind != null) {
  561 + this.setData({
  562 + open_ind_store: ind,
  563 + store: 1,
  564 + openSpecModal: !1,
  565 + openSpecModal_pt: !1,
  566 + openSpecModal_flash_normal: !1,
  567 + })
  568 + } else {
  569 + this.setData({
  570 + store: 1,
  571 + openSpecModal: !1,
  572 + openSpecModal_pt: !1,
  573 + openSpecModal_flash_normal: !1
  574 +
  575 + })
  576 + }
  577 + },
  578 + //关闭选择门店
  579 + close_popup: function (e) {
  580 + var th = this;
  581 + this.setData({
  582 + store: 0,
  583 + choice_sort_store: 0,
  584 + sort_store: 0,
  585 + fir_pick_index: 0,
  586 + sec_pick_index: 0
  587 + })
  588 +
  589 + var openindstore = this.data.open_ind_store;
  590 + if (openindstore == 1) {
  591 + th.setData({
  592 + openSpecModal: !0,
  593 + openSpecModal_ind: openindstore,
  594 + });
  595 + } else if (openindstore == 2) {
  596 + th.setData({
  597 + openSpecModal: !0,
  598 + openSpecModal_ind: openindstore,
  599 + });
  600 + }
  601 + else if (openindstore == 4) { //4就是拼团
  602 + th.setData({
  603 + openSpecModal_pt: 1, //打开拼团购买界面
  604 + store: 0, //关闭门店
  605 + choice_sort_store: 0, //关闭门店2级
  606 + sort_store: 0, //关闭门店2级
  607 + });
  608 + }
  609 + else {
  610 + th.setData({
  611 + store: 0,
  612 + choice_sort_store: 0,
  613 + sort_store: 0
  614 + })
  615 + }
  616 +
  617 +
  618 + },
  619 +
  620 + //选择更多门店
  621 + more_store: function () {
  622 + this.setData({
  623 + sort_store: 1
  624 + });
  625 + },
  626 + // 返回按钮
  627 + returns: function () {
  628 + this.setData({
  629 + sort_store: 0,
  630 + choice_sort_store: 0
  631 + });
  632 + },
  633 + //---选择分类门店---
  634 + choice_sort_store: function (e) {
  635 + var index = e.currentTarget.dataset.index;
  636 + var region_name = e.currentTarget.dataset.region;
  637 + var item = this.data.all_sto[index];
  638 + this.setData({
  639 + region_name: region_name,
  640 + sort_store: 0,
  641 + choice_sort_store: 1,
  642 + sec_sto: item,
  643 + sec_pick_index: 0
  644 + });
  645 + },
  646 +
  647 + choose_for_store_fir: function (e) {
  648 + var index_c = e.currentTarget.dataset.ind;
  649 + var th = this;
  650 + th.setData({
  651 + fir_pick_index: index_c
  652 + })
  653 +
  654 + },
  655 +
  656 + //确定def_pick为选择的门店
  657 + sure_pick: function (e) {
  658 + var th = this;
  659 + var item = null;
  660 + var openindstore = th.data.open_ind_store;
  661 +
  662 + if (th.data.choice_sort_store == 0) {
  663 + var index = th.data.fir_pick_index;
  664 + if (th.data.is_show_sto_cat == 1) {
  665 + item = th.data.def_pickpu_list[index];
507 666 } else {
508   - getApp().my_warnning(res.data.msg, 0, th);
  667 + item = th.data.only_pk[index]; //当没有门店分类的时候
509 668 }
510   - },
511   - function (res) { }
512 669  
513   - )
514   - })
  670 + } else {
  671 + var index = th.data.sec_pick_index;
  672 + item = th.data.sec_sto.s_arr[index];
  673 + }
515 674  
  675 + if (!th.data.sele_g) return false;
  676 +
  677 + th.setData({
  678 + def_pick_store: item,
  679 + sto_sele_name: item.pickup_name,
  680 + sto_sele_id: item.pickup_id,
  681 + sto_sele_distr: item.distr_type,
  682 + store: 0,
  683 + choice_sort_store: 0,
  684 + fir_pick_index: 0,
  685 + openSpecModal: !0,
  686 + });
  687 +
  688 +
  689 + },
  690 + //---点击二级之后的选择---
  691 + choose_for_store: function (e) {
  692 + var index_c = e.currentTarget.dataset.ind;
  693 + var th = this;
  694 + th.setData({
  695 + sec_pick_index: index_c,
  696 + fir_pick_index: index_c
  697 + })
  698 +
  699 + },
  700 + //把选择的门店设置成默认的门店def_pick
  701 + set_def_pick: function (e) {
  702 + var th = this;
  703 + var item = null;
  704 + if (th.data.choice_sort_store == 0) {
  705 + var index = th.data.fir_pick_index;
  706 + if (th.data.is_show_sto_cat == 1) {
  707 + item = th.data.def_pickpu_list[index];
  708 + } else {
  709 + item = th.data.only_pk[index]; //当没有门店分类的时候
  710 + }
  711 + } else {
  712 + var index = th.data.sec_pick_index;
  713 + item = th.data.sec_sto.s_arr[index];
  714 + }
  715 + th.setData({
  716 + def_pick_store: item,
  717 + sto_sele_name: item.pickup_name,
  718 + sto_sele_id: item.pickup_id,
  719 + sto_sele_distr: item.distr_type,
  720 + store: 0,
  721 + choice_sort_store: 0,
  722 + openSpecModal: !0,
  723 + });
  724 +
  725 + var user_id=getApp().globalData.user_id;
  726 + var def_pickup_id = item.pickup_id;
  727 + getApp().request.put('/api/weshop/users/update', {
  728 + data: {
  729 + user_id: user_id,
  730 + def_pickup_id: def_pickup_id
  731 + },
  732 + success: function (res) {
  733 + if (res.data.code == 0) {
  734 + if (th.data.choice_sort_store == 0) th.setData({
  735 + fir_pick_index: 0
  736 + });
  737 + getApp().globalData.pk_store = item;
  738 + } else {
  739 + getApp().my_warnning("设置默认门店地址失败", 0, th)
  740 + }
516 741  
517   - },
  742 + }
  743 + });
  744 +
  745 +
  746 + },
  747 + closeSpecModal: function () {
  748 + this.setData({openSpecModal: 0});
  749 + },
  750 +
  751 + buy_libao:function () {
  752 + com.buy_libao(this)
  753 + }
518 754  
519 755  
520 756  
... ...
pages/giftpack/giftpacklist/giftpacklist.wxml
... ... @@ -190,4 +190,6 @@
190 190 <!-- 弹出框扫描 -->
191 191 <qr_code id="qc_com"></qr_code>
192 192 <!-- 制作一个圆球导航 -->
193   -<nav_b id="nav_b"></nav_b>
194 193 \ No newline at end of file
  194 +<nav_b id="nav_b"></nav_b>
  195 +
  196 +<include src="../public/buy_com.wxml"></include>
195 197 \ No newline at end of file
... ...
pages/giftpack/giftpacklist/giftpacklist.wxss
1 1 @charset "UTF-8";
2   -
3   -/* Author XGQ
4   - * 2019-12-12
5   - */
  2 +@import '../../goods/goodsInfo/goodsInfo.wxss';
6 3  
7 4 .box.data-v-3a5b7e36 {
8 5 -webkit-align-content: center;
... ...
pages/giftpack/public/buy_com.js 0 → 100644
  1 +module.exports = {
  2 + //开启定位
  3 + wait_for_store_config: function (th) {
  4 + var t_time = setInterval(function () {
  5 + if (th.data.bconfig == null) false;
  6 + var e = th.data.bconfig;
  7 + if (e && e.is_sort_storage) {
  8 + wx.getLocation({
  9 + type: 'gcj02',
  10 + success: function (res) {
  11 + th.data.lat = res.latitude;
  12 + th.data.lon = res.longitude;
  13 + th.data.is_get_local_ok = 1;
  14 + },
  15 + fail: function (res) {
  16 + if (res.errCode == 2) {
  17 + th.setData({
  18 + is_gps: 0
  19 + });
  20 + if (th.data.is_gps == 0) {
  21 + getApp().confirmBox("请开启GPS定位", null, 10000, !1);
  22 + }
  23 +
  24 + } else {
  25 + th.setData({
  26 + is_gps: "3"
  27 + });
  28 + }
  29 +
  30 + th.data.is_get_local_ok = 1;
  31 + }
  32 + })
  33 + } else {
  34 + th.data.is_get_local_ok = 1;
  35 + }
  36 + clearInterval(t_time);
  37 + }, 500)
  38 + },
  39 + set_user_mo_store(th,os,func){
  40 + var that=th;
  41 + //获取用户的默认门店
  42 + getApp().get_user_store(function (e) {
  43 + if (!e) {
  44 + th.data.fir_def_store = {}; //赋值空对象
  45 + return false;
  46 + }
  47 + var ee = JSON.parse(JSON.stringify(e));
  48 + //--定时器推迟一下--
  49 + setTimeout(function () {
  50 + if (th.data.fir_goods) var g_distr_type = th.data.fir_goods.distr_type;
  51 + //--如果默认门店的配送方式不对,就不能被选择,这里不控制,如果不一样,就说明配送方式不对--
  52 + if (ee.distr_type != 0 && g_distr_type != 0 && ee.distr_type != g_distr_type) {
  53 + ee.is_no_dis = 1;
  54 + }
  55 +
  56 + var appd = getApp().globalData;
  57 + var w_time = setInterval(function () {
  58 + if (that.data.is_get_local_ok == 0) return false;
  59 + clearInterval(w_time);
  60 + var distance = null;
  61 + var e = JSON.parse(JSON.stringify(ee));
  62 +
  63 + //如果有开启近距离的话,同时距离优不一样了
  64 + if (that.data.lat != null) {
  65 + //如果经纬度有变化的话
  66 + if (e && appd.lat == that.data.lat && appd.lon == that.data.lon && e.distance > 0) {
  67 + that.set_def_storage(e);
  68 + if(func) func();
  69 + } else {
  70 + //要用接口是获取距离,js的计算不准
  71 + getApp().request.promiseGet("/api/weshop/pickup/list", {
  72 + data: {
  73 + store_id: os.stoid,
  74 + pickup_id: e.pickup_id,
  75 + lat: th.data.lat,
  76 + lon: th.data.lon,
  77 + isstop: 0,
  78 + is_pos: 1
  79 + },
  80 + }).then(res => {
  81 + if (res.data.code == 0) {
  82 + e = res.data.data.pageData[0];
  83 + if (e) {
  84 + e.is_no_dis = ee.is_no_dis;
  85 + appd.pk_store = e;
  86 + that.set_def_storage(e);
  87 + }
  88 +
  89 + }
  90 + if(func) func();
  91 + })
  92 + }
  93 + //e.distance = distance;
  94 + appd.lat = that.data.lat;
  95 + appd.lon = that.data.lon;
  96 +
  97 + } else {
  98 + if (e) {
  99 + e.distance = null;
  100 + that.set_def_storage(e);
  101 + }
  102 + if(func) func();
  103 + }
  104 + }, 500)
  105 + }, 700)
  106 + })
  107 +
  108 + },
  109 +
  110 + //---------拿出门店分类和门店------------
  111 + get_sto(th,os) {
  112 + var that = th;
  113 + var self=this;
  114 + var timer_get = setInterval(function () {
  115 + if (th.data.is_get_local_ok == 0) return false;
  116 + var dd = null;
  117 +
  118 + dd = {
  119 + store_id: os.stoid,
  120 + isstop: 0,
  121 + is_pos: 1,
  122 + pageSize: 2000,
  123 + }
  124 +
  125 + //如果有距离的话
  126 + if (th.data.lat != null) {
  127 + dd.lat = th.data.lat;
  128 + dd.lon = th.data.lon;
  129 + }
  130 +
  131 + if(th.data.sele_g && th.data.sele_g.pickup_list){
  132 + dd.ids=th.data.sele_g.pickup_list
  133 + }
  134 +
  135 + clearInterval(timer_get);
  136 +
  137 + //如果会员是有默认的门店话
  138 + if (!th.data.def_pick_store && th.data.fir_def_store) {
  139 + th.setData({def_pick_store: th.data.fir_def_store});
  140 + }
  141 + wx.showLoading({
  142 + title: '加载中.'
  143 + });
  144 + //----------获取门店----------------
  145 + getApp().request.promiseGet("/api/weshop/pickup/list", {
  146 + data: dd,
  147 + }).then(res => {
  148 + var e = res;
  149 +
  150 + if (e.data.code == 0 && e.data.data && e.data.data.pageData && e.data.data.pageData.length > 0) {
  151 +
  152 + var his_cate_num = 0;
  153 + for (let i in e.data.data.pageData) {
  154 + let item = e.data.data.pageData[i];
  155 + if (item.category_id > 0) {
  156 + his_cate_num = 1;
  157 + break;
  158 + }
  159 + }
  160 + e.his_cate_num = his_cate_num;
  161 +
  162 + //如果有开启距离的功能,没有设置默认门店,要用最近的门店作为默认门店
  163 + if (dd.lat && (!th.data.def_pick_store || JSON.stringify(th.data.def_pick_store) == '{}') && th.data.bconfig && th.data.bconfig.is_sort_storage) {
  164 + th.setData({
  165 + def_pick_store: e.data.data.pageData[0],
  166 + sto_sele_name: e.data.data.pageData[0].pickup_name,
  167 + sto_sele_id: e.data.data.pageData[0].pickup_id,
  168 + sto_sele_distr: e.data.data.pageData[0].distr_type
  169 + });
  170 + th.data.fir_def_store = e.data.data.pageData[0];
  171 + }
  172 +
  173 + //-- 如果有默认选择门店的时候,要把默认门店放在第一位,修改不要配送方式的判断 --
  174 + if (th.data.def_pick_store && JSON.stringify(th.data.def_pick_store) != '{}') {
  175 + for (var k = 0; k < e.data.data.pageData.length; k++) {
  176 + if (e.data.data.pageData[k].pickup_id == th.data.def_pick_store.pickup_id) {
  177 + e.data.data.pageData.splice(k, 1); //删除
  178 + break;
  179 + }
  180 + }
  181 + e.data.data.pageData.splice(0, 0, th.data.def_pick_store); //添加
  182 + }
  183 +
  184 + th.setData({all_pick_list: e.data.data.pageData});
  185 +
  186 + setTimeout(function () {
  187 + self.deal_pickup(e,th,os); //--普通门店排版--
  188 + }, 800)
  189 +
  190 + }
  191 + })
  192 + }, 200)
  193 +
  194 + },
  195 +
  196 + //-- 统一购买 --
  197 + buy_libao:function (th) {
  198 + if(th.data.sele_g.is_pickup){
  199 + if(!th.data.def_pick_store && !th.data.def_pick_store.pickup_id){
  200 + getApp().my_warnning("请先选择门店", 1, th);
  201 + return false;
  202 + }
  203 +
  204 + if(th.data.def_pick_store.is_no_dis){
  205 + getApp().my_warnning("门店不匹配,请重新选择", 1, th);
  206 + return false;
  207 + }
  208 + }
  209 +
  210 + th.setData({submit:1})
  211 + var id=th.data.sele_g.lbId;
  212 + var that=th;
  213 + var json = {
  214 + "actId": '', //活动Id
  215 + "actType": '', //活动类型 1:新人礼、2:评价有礼、3:节日营销、4:生日营销
  216 + "buyType":""+that.data.buyType, //1=积分兑换 2=余额购买
  217 + "giftBagId": id, //礼包Id
  218 + "storeId": that.data.getStorageID, //商家Id
  219 + "userId": that.data.getUserID, //用户ID
  220 + "buyFrom": 2,
  221 + };
  222 +
  223 + if(that.data.first_leader){
  224 + json.first_leader=that.data.first_leader
  225 + }
  226 + if(that.data.guide_id){
  227 + json.guide_id=that.data.guide_id
  228 + }
  229 +
  230 + if(that.data.def_pick_store){
  231 + json.pickup_id=that.data.def_pick_store.pickup_id;
  232 + }
  233 +
  234 + //-- 分享导购要记录 --
  235 + if (getApp().globalData.guide_id) {
  236 + json.guide_id = getApp().globalData.guide_id;
  237 + }
  238 +
  239 + var url ="/api/weshop/marketing/buy/receive/gift/record/insert";
  240 + getApp().request.json_post(url, json,
  241 + function (res) {
  242 + if (res.data.code == 0 && res.data.data) {
  243 + switch(that.data.buyType){
  244 + case 1://立即兑换
  245 + th.setData({submit:0})
  246 + getApp().my_warnning("兑换成功!", 1, th);
  247 + th.closeSpecModal();
  248 + break;
  249 + case 2://立即购买
  250 + var order_sn = res.data.data.orderSn;
  251 + res = res.data.data.result;
  252 + if (!res) return false;
  253 + var money=that.data.payMoney;
  254 + var url = "/pages/giftpack/payment/payment?money=" + money + "&order_sn=" + order_sn;
  255 + wx.requestPayment({
  256 + timeStamp: String(res.timeStamp),
  257 + nonceStr: res.nonceStr,
  258 + package: res.packageValue,
  259 + signType: res.signType,
  260 + paySign: res.paySign,
  261 + success: function (res) {
  262 + th.setData({submit:0})
  263 + getApp().goto(url);
  264 + },
  265 + fail: function (res) {
  266 + th.setData({submit:0})
  267 + getApp().my_warnning("取消支付", 0, th);
  268 + }
  269 + });
  270 + break;
  271 + case 3://立即领取
  272 + th.setData({submit:0})
  273 + getApp().my_warnning("领取成功!", 1, th);
  274 + th.closeSpecModal();
  275 + break;
  276 + }
  277 +
  278 + } else {
  279 + th.setData({submit:0})
  280 + getApp().my_warnning(res.data.msg, 0, th);
  281 + }
  282 + },
  283 + function (res) {
  284 + th.setData({submit:0})
  285 + }
  286 + )
  287 +
  288 + },
  289 +
  290 + //------------处理门店---------------
  291 + deal_pickup(e,th,os) {
  292 +
  293 + if (!th.data.sele_g) return false
  294 + wx.hideLoading();
  295 +
  296 + //单总量超出10个的时候,同时门店有分类
  297 + if (e.data.data.total > 10 && e.his_cate_num) {
  298 + getApp().request.get("/api/weshop/storagecategory/page", {
  299 + data: {
  300 + store_id: os.stoid,
  301 + pageSize: 1000,
  302 + orderField: "sort",
  303 + orderType: 'asc',
  304 + },
  305 + success: function (ee) {
  306 + if (ee.data.code == 0) {
  307 + var check_all_cate = 0;
  308 + if (ee.data.data && ee.data.data.pageData && ee.data.data.pageData.length > 0) {
  309 + for (let i in ee.data.data.pageData) {
  310 + let item = ee.data.data.pageData[i];
  311 + if (item.is_show == 1) {
  312 + check_all_cate = 1;
  313 + break
  314 + }
  315 + }
  316 + }
  317 + if (check_all_cate) {
  318 + var sto_cate = ee.data.data.pageData;
  319 + var sto_arr = e.data.data.pageData;
  320 + var newarr = new Array();
  321 + var qita = new Array();
  322 +
  323 +
  324 + var is_del_pk = 0;
  325 + //----要进行门店分组--------
  326 + for (var i = 0; i < sto_arr.length; i++) {
  327 + //找一下这个门店有没有在分类数组内
  328 + var find2 = 0, find2name = "", sort = 0;
  329 + is_del_pk = 0;
  330 + for (var m = 0; m < sto_cate.length; m++) {
  331 + if (sto_arr[i].category_id == sto_cate[m].cat_id) {
  332 + if (sto_cate[m].is_show != 1) {
  333 + is_del_pk = 1;
  334 + sto_arr.splice(i, 1);
  335 + i--;
  336 + } else {
  337 + find2 = sto_cate[m].cat_id;
  338 + find2name = sto_cate[m].cat_name;
  339 + sort = sto_cate[m].sort;
  340 + is_del_pk = 0;
  341 + }
  342 + break;
  343 + }
  344 + }
  345 + if (is_del_pk) continue;
  346 +
  347 + if (newarr.length > 0) {
  348 + var find = 0;
  349 + //如果有找到,那门店就在这个分组内,否则,分类就要排在其他
  350 + if (find2 != 0) {
  351 + for (var ii = 0; ii < newarr.length; ii++) {
  352 + if (sto_arr[i].category_id == newarr[ii].cat_id) {
  353 + newarr[ii].s_arr.push(sto_arr[i]);
  354 + find = 1;
  355 + break;
  356 + }
  357 + }
  358 + if (find == 0) {
  359 + var arr0 = new Array();
  360 + arr0.push(sto_arr[i]);
  361 + var item = {
  362 + cat_id: find2,
  363 + name: find2name,
  364 + sort: sort,
  365 + s_arr: arr0
  366 + };
  367 + newarr.push(item);
  368 + }
  369 + } else {
  370 + qita.push(sto_arr[i]);
  371 + }
  372 + } else {
  373 + //如果有找到,那门店就在这个分组内,否则,分类就要排在其他
  374 + if (find2 != 0) {
  375 + var arr0 = new Array();
  376 + arr0.push(sto_arr[i]);
  377 + var item = {
  378 + cat_id: find2,
  379 + name: find2name,
  380 + sort: sort,
  381 + s_arr: arr0
  382 + };
  383 + newarr.push(item);
  384 + } else {
  385 + qita.push(sto_arr[i]);
  386 + }
  387 + }
  388 + }
  389 +
  390 + var def_arr = new Array();
  391 + //-- 开始就看10个门店 --
  392 + for (var k = 0; k < 10; k++) {
  393 + if (k == sto_arr.length) break;
  394 + def_arr.push(sto_arr[k]);
  395 + }
  396 +
  397 + th.setData({
  398 + def_pickpu_list: def_arr,
  399 + pickpu_list: ee.data.data.pageData
  400 + });
  401 +
  402 +
  403 + //门店分类要排序下
  404 + function compare(property) {
  405 + return function (a, b) {
  406 + var value1 = a[property];
  407 + var value2 = b[property];
  408 + return value1 - value2;
  409 + }
  410 + }
  411 +
  412 + if (newarr.length > 0)
  413 + newarr.sort(compare("sort"));
  414 +
  415 +
  416 + //----安排其他的分类-----
  417 + if (qita.length > 0) {
  418 + var item = {
  419 + cat_id: -1,
  420 + name: "其他",
  421 + s_arr: qita
  422 + };
  423 + newarr.push(item);
  424 + }
  425 +
  426 + var sd = {
  427 + all_sto: newarr,
  428 + is_show_sto_cat: 1
  429 + }
  430 + if (!sto_arr || sto_arr.length <= 10) {
  431 + sd.is_show_sto_cat = -1;
  432 + sd.only_pk = sto_arr;
  433 + }
  434 + th.setData(sd);
  435 +
  436 + } else {
  437 + th.setData({
  438 + is_show_sto_cat: -1,
  439 + only_pk: e.data.data.pageData
  440 + });
  441 + //-----如果没有默认门店,要取第一个门店作为默认店.此时没有门店分类的情况------
  442 + if (!th.data.def_pick_store) {
  443 + th.setData({
  444 + def_pick_store: e.data.data.pageData[0],
  445 + sto_sele_name: e.data.data.pageData[0].pickup_name,
  446 + sto_sele_id: e.data.data.pageData[0].pickup_id,
  447 + sto_sele_distr: e.data.data.pageData[0].distr_type
  448 + })
  449 + }
  450 + }
  451 + } else {
  452 + th.setData({
  453 + is_show_sto_cat: -1,
  454 + only_pk: e.data.data.pageData
  455 + });
  456 + //-----如果没有默认门店,要取第一个门店作为默认店.此时没有门店分类的情况------
  457 + if (!th.data.def_pick_store) {
  458 + th.setData({
  459 + def_pick_store: e.data.data.pageData[0],
  460 + sto_sele_name: e.data.data.pageData[0].pickup_name,
  461 + sto_sele_id: e.data.data.pageData[0].pickup_id,
  462 + sto_sele_distr: e.data.data.pageData[0].distr_type
  463 + })
  464 + }
  465 +
  466 + }
  467 + }
  468 + });
  469 + } else {
  470 + th.setData({
  471 + is_show_sto_cat: 0,
  472 + only_pk: e.data.data.pageData
  473 + });
  474 + //-----如果没有默认门店,要取第一个门店作为默认店------
  475 + if (!th.data.def_pick_store && th.data.bconfig && th.data.bconfig.is_sort_storage) {
  476 + th.setData({
  477 + def_pick_store: e.data.data.pageData[0],
  478 + sto_sele_name: e.data.data.pageData[0].pickup_name,
  479 + sto_sele_id: e.data.data.pageData[0].pickup_id,
  480 + sto_sele_distr: e.data.data.pageData[0].distr_type
  481 + })
  482 + }
  483 + }
  484 + },
  485 +
  486 + check_def_pk:function (th) {
  487 + var def_pick_store=th.data.def_pick_store
  488 + var sele_g=th.data.sele_g;
  489 + var arr=sele_g.pickup_list.split(',');
  490 +
  491 + var idx=arr.findIndex(function (e) {
  492 + return e==def_pick_store.pickup_id;
  493 + })
  494 +
  495 + if(idx==-1){
  496 + def_pick_store.is_no_dis=1;
  497 + th.setData({def_pick_store})
  498 + }
  499 +
  500 +
  501 + }
  502 +
  503 +
  504 +
  505 +
  506 +}
0 507 \ No newline at end of file
... ...
pages/giftpack/public/buy_com.wxml 0 → 100644
  1 +<!-- 选择门店的弹框,1.1版最新的 -->
  2 +<block wx:if="{{store}}">
  3 + <view class="mongolia-layer" bindtap="close_popup"></view>
  4 + <view class="popup-frame">
  5 + <block wx:if="{{sort_store==0}}">
  6 + <!-- 头部 标题 -->
  7 + <view class="popup-top flex-space-between">
  8 + <text class="fs32 nearby_store">{{choice_sort_store==0?'附近的门店':region_name}}</text>
  9 + <view>
  10 + <view>
  11 + <icon bindtap="close_popup" class="modal-closes" color="black" size="22" type="cancel"></icon>
  12 + </view>
  13 + <view class="felx choose_more" bindtap="more_store" wx:if="{{is_show_sto_cat>0}}">
  14 + <text class="fs26 red-co" >{{choice_sort_store==0?'更多门店':'返回'}}</text> <view class="bg_rights" ></view>
  15 + </view>
  16 + </view>
  17 + </view>
  18 + <!-- 门店列表,最外层的门店列表,一开始 -->
  19 + <view class="store-list">
  20 + <!-- 如果还没有点击更多门店的时候 -->
  21 + <block wx:if="{{choice_sort_store==0}}">
  22 + <!-- 需要for循环 -->
  23 + <block wx:if="{{is_show_sto_cat==1}}">
  24 + <view class="store_choose flex" wx:for="{{def_pickpu_list}}" bindtap="choose_for_store_fir" data-ind="{{index}}">
  25 + <view class="store flex-vertical">
  26 + <!-- 需要点击事件 -->
  27 + <block wx:if="{{index==fir_pick_index}}">
  28 + <view class="circle white xc-hook fs20 red-b">Г</view>
  29 + </block>
  30 + <block wx:else>
  31 + <view class="circle xc-hooks"></view>
  32 + </block>
  33 + <view class="address-frame xc-ash">
  34 + <view class="flex-vertical-between butttem5">
  35 + <view class="flex xc-ash">
  36 + <view class="fs30 xc-black3 address_name">{{item.pickup_name}}</view>
  37 + </view>
  38 + <view>
  39 + <view class="distance fs24 address-val" wx:if="{{item.distance!=null}}">
  40 + 距离:{{item.distance>1000?filters.toFix(item.distance/1000,2)+'km':filters.toFix(item.distance,0)+"m"}}
  41 + </view>
  42 + </view>
  43 + </view>
  44 + <view class="fs24 xc-ash-9f">地址:{{item.fulladdress}}</view>
  45 + </view>
  46 + </view>
  47 + </view>
  48 + </block>
  49 + <block wx:else>
  50 + <view class="store_choose flex" wx:for="{{only_pk}}" bindtap="choose_for_store_fir" data-ind="{{index}}">
  51 + <view class="store flex-vertical">
  52 + <!-- 需要点击事件 -->
  53 + <block wx:if="{{index==fir_pick_index}}">
  54 + <view class="circle white xc-hook fs20 red-b">Г</view>
  55 + </block>
  56 + <block wx:else>
  57 + <view class="circle xc-hooks"></view>
  58 + </block>
  59 + <view class="address-frame xc-ash">
  60 + <view class="flex-vertical-between ">
  61 + <view class="flex xc-ash">
  62 + <view class="fs30 xc-black3 address_name">{{item.pickup_name}}</view>
  63 + </view>
  64 + <view>
  65 + <view class="distance fs24 address-val" wx:if="{{item.distance!=null}}">
  66 + 距离:{{item.distance>1000?filters.toFix(item.distance/1000,2)+"km":filters.toFix(item.distance,0)+"m"}}
  67 + </view>
  68 + </view>
  69 + </view>
  70 + <view class="fs24 xc-ash-9f">地址:{{item.fulladdress}}</view>
  71 + </view>
  72 + </view>
  73 + </view>
  74 + </block>
  75 + </block>
  76 + <block wx:else>
  77 + <!-- 如果是点击选择门店分类后显示分类下的门店 -->
  78 + <view class="store_choose flex" wx:for="{{sec_sto.s_arr}}" data-ind="{{index}}" bindtap="choose_for_store">
  79 + <view class="store flex-vertical">
  80 + <!-- 需要点击事件 -->
  81 + <block wx:if="{{index==sec_pick_index}}">
  82 + <view class="circle white xc-hook fs20 red-b">Г</view>
  83 + </block>
  84 + <block wx:else>
  85 + <view class="circle xc-hooks"></view>
  86 + </block>
  87 + <view class="address-frame xc-ash">
  88 + <view class="flex-vertical-between ">
  89 + <view class="flex xc-ash">
  90 + <view class="fs28 xc-black3 address_name">{{item.pickup_name}}</view>
  91 + </view>
  92 + <view>
  93 + <view class="distance fs24 address-val" wx:if="{{item.distance!=null}}">
  94 + 距离:{{item.distance>1000?filters.toFix(item.distance/1000,2)+"km":filters.toFix(item.distance,0)+"m"}}
  95 + </view>
  96 + </view>
  97 + </view>
  98 + <view class="fs24 xc-ash-9f">地址:{{item.fulladdress}}</view>
  99 + </view>
  100 + </view>
  101 + </view>
  102 + </block>
  103 + </view>
  104 + <!-- 门店列表底部 -->
  105 + <view class="store-bottom-frame">
  106 + <view class="store-bottom flex-vertical-between">
  107 + <view class="determine red-b fs28 white t-c" bindtap="sure_pick" data-openindstore="{{open_ind_store}}">
  108 + 确定
  109 + </view>
  110 + <view class="default t-c fs28" bindtap="set_def_pick" data-openindstore="{{open_ind_store}}">
  111 + 设为默认
  112 + </view>
  113 + </view>
  114 + </view>
  115 + </block>
  116 + <block wx:else>
  117 + <view class="popup-top flex-space-between">
  118 + <text class="fs32 nearby_store">门店分类选择</text>
  119 + <view>
  120 + <view>
  121 + <icon bindtap="close_popup" class="modal-closes" color="black" size="22" type="cancel"></icon>
  122 + </view>
  123 + <view class="felx choose_mores" bindtap="returns">
  124 + <text class="fs26 red-co">返回</text>
  125 + </view>
  126 + </view>
  127 + </view>
  128 + <view class="sort_store_list">
  129 + <view class="sort-store-frame" wx:for="{{all_sto}}" data-index="{{index}}" bindtap="choice_sort_store" data-region="{{item.name}}">
  130 + <view class="sort-store flex-vertical-between">
  131 + <view class="fs30" di>{{item.name}}</view>
  132 + <view class="black_rights-frame">
  133 + <view class="black_rights"></view>
  134 + </view>
  135 + </view>
  136 + </view>
  137 + </view>
  138 + </block>
  139 + </view>
  140 +</block>
  141 +<!-- --弹起来,选择规格数量,普通商品购买和秒杀---- -->
  142 +<view hidden="{{!openSpecModal}}">
  143 + <view bindtap="closeSpecModal" class="cover-layer"></view>
  144 + <view class="spec-model">
  145 + <view class="pding">
  146 + <icon bindtap="closeSpecModal" class="modal-close" color="black" size="22" type="cancel"></icon>
  147 + <view class="spec-goods">
  148 + <image class="wh100 spec-img xc-distance-bottom" bindtap="previewImage" src="{{iurl+(sele_g.cover_img?sele_g.cover_img:sele_g.lbUrl)}}" binderror="pop_err_img" data-errorimg=""></image>
  149 + <view class="spec-goods-info">
  150 + <view class="spec-goods-name ellipsis-2">{{sele_g.giftTitle}}</view>
  151 + <view class="flex ai_end xc-val-money">
  152 + <view class="spec-goods-price">
  153 + <block wx:if="{{sele_g.payMoney>0}}">
  154 + <text>{{"¥"+sele_g.payMoney}}</text>
  155 + </block>
  156 + <block wx:if="{{sele_g.payMoney>0&&sele_g.payIntegral>0}}">
  157 + <text>/</text>
  158 + </block>
  159 + <block wx:if="{{sele_g.payIntegral>0}}">
  160 + <view class="flex">
  161 + <text class="ellipsis-1">{{sele_g.payIntegral}}</text>
  162 + <view>积分</view>
  163 + </view>
  164 + </block>
  165 +
  166 + </view>
  167 + </view>
  168 +
  169 +
  170 + <view class="flex">
  171 + <view class="spec-goods-stock" >已售:{{sele_g.giftQty}}</view>
  172 + <view class="spec-goods-stock">可售:{{sele_g.lbnum-sele_g.giftQty+(sele_g.virtualsales?sele_g.virtualsales:0)}}</view>
  173 + </view>
  174 +
  175 + </view>
  176 + <!-- 选择门店模块 -->
  177 + <view class="flex-space-between address ai_end xc-width ">
  178 + <view class="flex ai_end" wx:if="{{def_pick_store && def_pick_store.pickup_name}}">
  179 + <text class="fs30 xc-black3 shop_name bold">{{def_pick_store.pickup_name}}</text>
  180 + <view class="distance fs24 xc-ash" wx:if="{{def_pick_store.distance!=null}}">
  181 + 距离:{{def_pick_store.distance>1000?filters.toFix(def_pick_store.distance/1000,2)+"km":filters.toFix(def_pick_store.distance,0)+"m"}}
  182 + </view>
  183 + </view>
  184 + <!-- 没有门店的时候 -->
  185 + <view class="flex" bindtap="choice_store" wx:else>
  186 + <image class="stores-img" src="{{iurl}}/miniapp/images/stores.png"></image>
  187 + <view class="fs30" style="color:black;">选择门店</view>
  188 + </view>
  189 + <view class="red-co fs28" bindtap="choice_store">更多门店<text class="right-arrow"></text></view>
  190 + </view>
  191 + <view wx:if="{{only_pk && !only_pk.length}}">(库存不足)</view>
  192 + <block wx:else>
  193 + <view wx:if="{{def_pickpu_list && !def_pickpu_list.length}}">(库存不足)</view>
  194 + <block wx:else>
  195 + <view class="no_store" wx:if="{{def_pick_store.is_no_dis}}">(配送不匹配)</view>
  196 + <view wx:elif="{{def_pick_store && !def_pick_store.CanOutQty && sales_rules==2 && prom_type==0}}">
  197 + (库存不足)
  198 + </view>
  199 + </block>
  200 + </block>
  201 + <view class="fs24 xc-ash-9f xc-distance-top " wx:if="{{def_pick_store && def_pick_store.fulladdress}}">
  202 + 地址:{{def_pick_store.fulladdress}}
  203 + </view>
  204 + </view>
  205 + <!-- 商品的属性项目 -->
  206 +
  207 +
  208 + </view>
  209 + <view class="spec-cart-btns">
  210 + <!-- 根本就找不到门店 -->
  211 + <block wx:if="{{!only_pk && !def_pickpu_list}}">
  212 + <view class="spec-cart-btn fs32" data-action="add" style="background-color: #dcdcdc;color: #999;">
  213 + 未找到门店
  214 + </view>
  215 + </block>
  216 + <block wx:else>
  217 + <block wx:if="{{only_pk && !only_pk.length}}">
  218 + <view class="spec-cart-btn fs32" data-action="add" style="background-color: #dcdcdc;color: #999;">
  219 + 未找到门店
  220 + </view>
  221 + </block>
  222 + <block wx:else>
  223 + <block wx:if="{{def_pickpu_list && !def_pickpu_list.length}}">
  224 + <view class="spec-cart-btn fs32" data-action="add" style="background-color: #dcdcdc;color: #999">
  225 + 库存不足
  226 + </view>
  227 + </block>
  228 + <block wx:else>
  229 + <block wx:if="{{!def_pick_store}}">
  230 + <view class="spec-cart-btn fs32" data-action="add" style="background-color: #dcdcdc;color: #999">
  231 + 请先选择门店
  232 + </view>
  233 + </block>
  234 + <block wx:else>
  235 + <block wx:if="{{sele_g.store_count<=0}}">
  236 + <view class="spec-cart-btn fs32" data-action="add" style="background-color: #dcdcdc;color: #999">
  237 + 库存不足
  238 + </view>
  239 + </block>
  240 + <block wx:else>
  241 + <button bindtap="buy_libao" disabled="{{submit}}" style="display: block" class="spec-cart-btn {{buyType==2?'yellow':'red-b'}} fs32" data-action="add">
  242 + <text wx:if="{{buyType==1}}">立即兑换</text>
  243 + <text wx:if="{{buyType==2}}">立即购买</text>
  244 + <text wx:if="{{buyType==3}}">立即领取</text>
  245 + </button>
  246 + </block>
  247 +
  248 + </block>
  249 + </block>
  250 + </block>
  251 + </block>
  252 +
  253 + </view>
  254 + <view class="clear"></view>
  255 +
  256 + </view>
  257 +</view>
0 258 \ No newline at end of file
... ...