diff --git a/pages/giftpack/buygiftpack/giftpackbuy.js b/pages/giftpack/buygiftpack/giftpackbuy.js
index 54eeb67..18e779f 100644
--- a/pages/giftpack/buygiftpack/giftpackbuy.js
+++ b/pages/giftpack/buygiftpack/giftpackbuy.js
@@ -1,4 +1,5 @@
var i = require("../../../utils/util.js");
+var com = require("../public/buy_com.js");
var e = getApp(),
a = e.globalData.setting,
os = a,
@@ -27,6 +28,44 @@ Page({
total: 0, //总数量
ad_data: null,
first_leader: e.globalData.first_leader || 0, // 推荐人ID
+
+ //门店相关
+ ismend: 0,
+ is_sec_mend: 0,
+ sto_sele_name: "", //选中的门店名称
+ sto_sele_id: "", //选中的门店id
+ sto_sele_distr: "", //选择的门店的配送方式
+ is_show_sto_cat: 1, //是否显示门店分类
+ only_pk: null,
+ all_sto: null,
+ sec_sto: null, //选择了的门店分类
+ pickpu_list: null, //读出的所有门店list
+ def_pickpu_list: null, //一开始5个门店list
+ sec_pick_index: 0, //第二级门店选择ID
+ fir_pick_index: 0, //第一级门店选择ID
+ all_pick_list: null,//所有的门店先记录起来
+
+ select_store: 0, //选择更多
+ index: 1,
+ more_store: 0, //选择门店
+ sort_store: 0, //门店分类
+ choice_sort_store: 0, //选择分类门店
+ new_user: 0, //新用户
+
+ def_pick_store: null, // 默认的门店
+ fir_def_store: null, //客户默认的门店的
+ lat: null, //维度
+ lon: null, //经度
+
+ is_get_local_ok: 0, //获取坐标是否完成
+ region_name: "门店分类", //区域的名字
+ is_gps: 1,
+ open_ind_store: 0, //哪里打开的门店列表的控制属性
+ default_store: {}, //创建添加默认门店地址的对象
+
+ store:0,
+ openSpecModal:0
+
},
onLoad: function (options) {
this.setData({
@@ -80,6 +119,7 @@ Page({
},
onShow: function () {
getApp().check_can_share();
+ var th=this;
//--先判断会员状态--
getApp().is_Single_page(this, function () {
var user_info = getApp().globalData.userInfo;
@@ -87,170 +127,112 @@ Page({
getApp().goto('/pages/togoin/togoin');
return false;
}
+ com.wait_for_store_config(th);
+ com.set_user_mo_store(th,os);
+
})
this.init();
},
//购买礼包
GetBuyPrice: function (e) {
- var that = this.data;
- var th = this;
- var id = e.currentTarget.dataset.id; //活动id
- var my_confirm = th.selectComponent("#my_confirm"); //组件的id
- var order_sn = e.currentTarget.dataset.order_sn; //订单号
- var money = e.currentTarget.dataset.money; //支付金额
- my_confirm.open(
- "是否确定购买该礼包",
- "取消",
- "确定",
- function () {
- my_confirm.open_cancel(0);
- },
- function () {
- my_confirm.open_cancel(0);
- var json = {
- "actId": '', //活动Id
- "actType": '', //活动类型 1:新人礼、2:评价有礼、3:节日营销、4:生日营销
- "buyType": '2', //1=积分兑换 2=余额购买
- "giftBagId": id, //礼包Id
- "storeId": that.getStorageID, //商家Id
- "userId": that.getUserID, //用户ID
- "buyFrom": 2,
- "first_leader": that.first_leader,
- };
- //-- 分享导购要记录 --
- if (getApp().globalData.guide_id) {
- json.guide_id = getApp().globalData.guide_id;
+ var th = this;
+ var index = e.currentTarget.dataset.index; //活动id
+ var sele_g=th.data.wareCard[index];
+ th.setData({sele_g:sele_g,buyType:2,})
+ if(sele_g.is_pickup){
+ if(sele_g.pickup_list && th.data.def_pick_store){
+ com.check_def_pk(th);
}
-
- var data = JSON.stringify(json);
- var url = that.url + "/api/weshop/marketing/buy/receive/gift/record/insert";
- getApp().request.json_post(url, json,
- function (res) {
- if (res.data.code == 0 && res.data.data) {
- var order_sn = res.data.data.orderSn;
- res = res.data.data.result;
- if (!res) return false;
- var url = "/pages/giftpack/payment/payment?money=" + money + "&order_sn=" + order_sn;
- wx.requestPayment({
- timeStamp: String(res.timeStamp),
- nonceStr: res.nonceStr,
- package: res.packageValue,
- signType: res.signType,
- paySign: res.paySign,
- success: function (res) {
- getApp().goto(url);
- },
- fail: function (res) {
- getApp().my_warnning("取消支付", 0, th);
- }
- });
- } else {
- getApp().my_warnning(res.data.msg, 0, th);
+ com.get_sto(th,os)
+ th.setData({
+ openSpecModal:1
+ })
+ }else{
+ var my_confirm = th.selectComponent("#my_confirm"); //组件的id
+ my_confirm.open(
+ "是否确定购买该礼包",
+ "取消",
+ "确定",
+ function () {
+ my_confirm.open_cancel(0);
+ },
+ function () {
+ my_confirm.open_cancel(0);
+ com.buy_libao(th)
}
- },
- function (res) {
-
- }
)
+ }
- }
- )
},
// 积分兑换
GetBuyIntegral: function (e) {
- var that = this.data;
- var th = this;
- var id = e.currentTarget.dataset.id; //活动id
- var my_confirm = th.selectComponent("#my_confirm"); //组件的id
-
- my_confirm.open(
- "是否确定兑换该礼包",
- "取消",
- "确定",
- function () {
- my_confirm.open_cancel(0);
- },
- function () {
- my_confirm.open_cancel(0);
- var json = {
- "actId": '', //活动Id
- "actType": '', //活动类型 1:新人礼、2:评价有礼、3:节日营销、4:生日营销
- "buyType": '1', //1=积分兑换 2=余额购买 3=免费领取
- "giftBagId": id, //礼包Id
- "storeId": that.getStorageID, //商家Id
- "userId": that.getUserID, //用户ID
- "buyFrom": 2,
- "first_leader": that.first_leader
- };
-
- //-- 分享导购要记录 --
- if (getApp().globalData.guide_id) {
- json.guide_id = getApp().globalData.guide_id;
- }
- console.log(json, 'json');
- var data = JSON.stringify(json);
- var url = that.url + "/api/weshop/marketing/buy/receive/gift/record/insert";
- getApp().request.json_post(url, json,
- function (res) {
- if (res.data.code == 0) {
- getApp().my_warnning("兑换成功!", 1, th);
- } else {
- getApp().my_warnning(res.data.msg, 0, th);
- }
- },
- function (res) { })
-
- })
+ var th = this;
+ var index = e.currentTarget.dataset.index; //活动id
+ var sele_g=th.data.wareCard[index];
+ th.setData({sele_g:sele_g, buyType:1,})
+ if(sele_g.is_pickup){
+ if(sele_g.pickup_list && th.data.def_pick_store){
+ com.check_def_pk(th);
+ }
+ com.get_sto(th,os)
+ th.setData({
+ openSpecModal:1
+ })
+ }else {
+ var my_confirm = th.selectComponent("#my_confirm"); //组件的id
+ my_confirm.open(
+ "是否确定兑换该礼包",
+ "取消",
+ "确定",
+ function () {
+ my_confirm.open_cancel(0);
+ },
+ function () {
+ my_confirm.open_cancel(0);
+ com.buy_libao(th)
+ })
+ }
},
//免费领取
GetFree: function (e) {
- var that = this.data;
- var th = this;
- var id = e.currentTarget.dataset.id; //活动id
- var my_confirm = th.selectComponent("#my_confirm"); //组件的id
- my_confirm.open(
- "是否确定领取该礼包",
- "取消",
- "确定",
- function () {
- my_confirm.open_cancel(0);
- },
- function () {
- my_confirm.open_cancel(0);
- var json = {
- "actId": '', //活动Id
- "actType": '', //活动类型 1:新人礼、2:评价有礼、3:节日营销、4:生日营销
- "buyType": '3', //1=积分兑换 2=余额购买 3=免费领取
- "giftBagId": id, //礼包Id
- "storeId": that.getStorageID, //商家Id
- "userId": that.getUserID, //用户ID
- "buyFrom": 2,
- "first_leader": that.first_leader
- };
- //-- 分享导购要记录 --
- if (getApp().globalData.guide_id) {
- json.guide_id = getApp().globalData.guide_id;
- }
- var data = JSON.stringify(json);
- var url = that.url + "/api/weshop/marketing/buy/receive/gift/record/insert";
- getApp().request.json_post(url, json,
- function (res) {
- if (res.data.code == 0) {
- getApp().my_warnning("领取成功!", 1, th);
- } else {
- getApp().my_warnning(res.data.msg, 0, th);
- }
- },
- function (res) { })
- })
+
+ var th = this;
+ var index = e.currentTarget.dataset.index; //活动id
+ var sele_g=th.data.wareCard[index];
+ th.setData({sele_g:sele_g, buyType:3,})
+
+ if(sele_g.is_pickup){
+ if(sele_g.pickup_list && th.data.def_pick_store){
+ com.check_def_pk(th);
+ }
+ com.get_sto(th,os)
+ th.setData({
+ openSpecModal:1
+ })
+ }else {
+
+
+ var my_confirm = th.selectComponent("#my_confirm"); //组件的id
+ my_confirm.open(
+ "是否确定领取该礼包",
+ "取消",
+ "确定",
+ function () {
+ my_confirm.open_cancel(0);
+ },
+ function () {
+ my_confirm.open_cancel(0);
+ com.buy_libao(th)
+ })
+ }
},
getList: function (e) {
@@ -327,6 +309,7 @@ Page({
},
onShareAppMessage: function (e) {
+ getApp().globalData.no_clear=1;
var curPage = this;
var pagePath = curPage.route; //当前页面url
if (pagePath.indexOf('/') != 0) {
@@ -341,6 +324,7 @@ Page({
// 分享朋友圈
onShareTimeline() {
+ getApp().globalData.no_clear=1;
var curPage = this;
var pagePath = curPage.route; //当前页面url
if (pagePath.indexOf('/') != 0) {
@@ -354,4 +338,271 @@ Page({
}
},
+
+ //--- 设置一下默认库存的数量 ----
+ set_def_storage(ee) {
+ var that = this, th = this;
+ that.data.fir_def_store = ee;
+ that.setData({
+ def_pick_store: ee,
+ sto_sele_name: ee.pickup_name,
+ sto_sele_id: ee.pickup_id,
+ sto_sele_distr: ee.distr_type
+ })
+ },
+ // 选择门店
+ choice_store: function (ee) {
+ var th = this;
+ var ind = ee.currentTarget.dataset.ind;
+ var bconfig = th.data.bconfig;
+
+ if (!th.data.only_pk && !th.data.def_pickpu_list) {
+ getApp().confirmBox("门店库存不足", null, 25000, !1);
+ return false;
+ }
+
+ if (th.data.only_pk && !th.data.only_pk.length) {
+ getApp().confirmBox("门店库存不足", null, 25000, !1);
+ return false;
+ }
+ if (th.data.def_pickpu_list && !th.data.def_pickpu_list.length) {
+ getApp().confirmBox("门店库存不足", null, 25000, !1);
+ return false;
+ }
+
+
+ if (bconfig && bconfig.is_sort_storage) {
+ wx.getLocation({
+ type: 'gcj02',
+ success: function (res) {
+
+ th.data.lat = res.latitude;
+ th.data.lon = res.longitude;
+ th.data.is_get_local_ok = 1;
+ th.setData({
+ is_gps: 1
+ });
+ //th.onShow();
+ com.get_sto(th,os);
+ },
+ fail: function (res) {
+ //th.onShow();
+ th.data.is_get_local_ok = 1;
+ com.get_sto(th,os);
+ if (res.errCode == 2) {
+ th.setData({
+ is_gps: 0
+ });
+ if (th.data.is_gps == 0) {
+ getApp().confirmBox("请开启GPS定位", null, 25000, !1);
+ }
+ } else {
+ th.setData({
+ is_gps: "3"
+ });
+ }
+
+ }
+ })
+ } else {
+ th.data.is_get_local_ok = 1;
+ com.get_sto(th,os);
+ }
+
+ if (ind != undefined && ind != null) {
+ this.setData({
+ open_ind_store: ind,
+ store: 1,
+ openSpecModal: !1,
+ openSpecModal_pt: !1,
+ openSpecModal_flash_normal: !1,
+ })
+ } else {
+ this.setData({
+ store: 1,
+ openSpecModal: !1,
+ openSpecModal_pt: !1,
+ openSpecModal_flash_normal: !1
+
+ })
+ }
+ },
+ //关闭选择门店
+ close_popup: function (e) {
+ var th = this;
+ this.setData({
+ store: 0,
+ choice_sort_store: 0,
+ sort_store: 0,
+ fir_pick_index: 0,
+ sec_pick_index: 0
+ })
+
+ var openindstore = this.data.open_ind_store;
+ if (openindstore == 1) {
+ th.setData({
+ openSpecModal: !0,
+ openSpecModal_ind: openindstore,
+ });
+ } else if (openindstore == 2) {
+ th.setData({
+ openSpecModal: !0,
+ openSpecModal_ind: openindstore,
+ });
+ }
+ else if (openindstore == 4) { //4就是拼团
+ th.setData({
+ openSpecModal_pt: 1, //打开拼团购买界面
+ store: 0, //关闭门店
+ choice_sort_store: 0, //关闭门店2级
+ sort_store: 0, //关闭门店2级
+ });
+ }
+ else {
+ th.setData({
+ store: 0,
+ choice_sort_store: 0,
+ sort_store: 0
+ })
+ }
+
+
+ },
+
+ //选择更多门店
+ more_store: function () {
+ this.setData({
+ sort_store: 1
+ });
+ },
+ // 返回按钮
+ returns: function () {
+ this.setData({
+ sort_store: 0,
+ choice_sort_store: 0
+ });
+ },
+ //---选择分类门店---
+ choice_sort_store: function (e) {
+ var index = e.currentTarget.dataset.index;
+ var region_name = e.currentTarget.dataset.region;
+ var item = this.data.all_sto[index];
+ this.setData({
+ region_name: region_name,
+ sort_store: 0,
+ choice_sort_store: 1,
+ sec_sto: item,
+ sec_pick_index: 0
+ });
+ },
+
+ choose_for_store_fir: function (e) {
+ var index_c = e.currentTarget.dataset.ind;
+ var th = this;
+ th.setData({
+ fir_pick_index: index_c
+ })
+
+ },
+
+ //确定def_pick为选择的门店
+ sure_pick: function (e) {
+ var th = this;
+ var item = null;
+ var openindstore = th.data.open_ind_store;
+
+ if (th.data.choice_sort_store == 0) {
+ var index = th.data.fir_pick_index;
+ if (th.data.is_show_sto_cat == 1) {
+ item = th.data.def_pickpu_list[index];
+ } else {
+ item = th.data.only_pk[index]; //当没有门店分类的时候
+ }
+
+ } else {
+ var index = th.data.sec_pick_index;
+ item = th.data.sec_sto.s_arr[index];
+ }
+
+ if (!th.data.sele_g) return false;
+
+ th.setData({
+ def_pick_store: item,
+ sto_sele_name: item.pickup_name,
+ sto_sele_id: item.pickup_id,
+ sto_sele_distr: item.distr_type,
+ store: 0,
+ choice_sort_store: 0,
+ fir_pick_index: 0,
+ openSpecModal: !0,
+ });
+
+
+ },
+ //---点击二级之后的选择---
+ choose_for_store: function (e) {
+ var index_c = e.currentTarget.dataset.ind;
+ var th = this;
+ th.setData({
+ sec_pick_index: index_c,
+ fir_pick_index: index_c
+ })
+
+ },
+ //把选择的门店设置成默认的门店def_pick
+ set_def_pick: function (e) {
+ var th = this;
+ var item = null;
+ if (th.data.choice_sort_store == 0) {
+ var index = th.data.fir_pick_index;
+ if (th.data.is_show_sto_cat == 1) {
+ item = th.data.def_pickpu_list[index];
+ } else {
+ item = th.data.only_pk[index]; //当没有门店分类的时候
+ }
+ } else {
+ var index = th.data.sec_pick_index;
+ item = th.data.sec_sto.s_arr[index];
+ }
+
+ th.setData({
+ def_pick_store: item,
+ sto_sele_name: item.pickup_name,
+ sto_sele_id: item.pickup_id,
+ sto_sele_distr: item.distr_type,
+ store: 0,
+ choice_sort_store: 0,
+ openSpecModal: !0,
+ });
+
+ var user_id=getApp().globalData.user_id;
+ var def_pickup_id = item.pickup_id;
+ getApp().request.put('/api/weshop/users/update', {
+ data: {
+ user_id: user_id,
+ def_pickup_id: def_pickup_id
+ },
+ success: function (res) {
+ if (res.data.code == 0) {
+ if (th.data.choice_sort_store == 0) th.setData({
+ fir_pick_index: 0
+ });
+ getApp().globalData.pk_store = item;
+ } else {
+ getApp().my_warnning("设置默认门店地址失败", 0, th)
+ }
+
+ }
+ });
+
+
+
+ },
+ closeSpecModal: function () {
+ this.setData({openSpecModal: 0});
+ },
+
+ buy_libao:function () {
+ com.buy_libao(this)
+ }
})
\ No newline at end of file
diff --git a/pages/giftpack/buygiftpack/giftpackbuy.wxml b/pages/giftpack/buygiftpack/giftpackbuy.wxml
index ab4a751..338b8a4 100644
--- a/pages/giftpack/buygiftpack/giftpackbuy.wxml
+++ b/pages/giftpack/buygiftpack/giftpackbuy.wxml
@@ -62,30 +62,30 @@
-
+
-
+
-
+
-
+
-
+
@@ -116,4 +116,6 @@
-
\ No newline at end of file
+
+
+
\ No newline at end of file
diff --git a/pages/giftpack/buygiftpack/giftpackbuy.wxss b/pages/giftpack/buygiftpack/giftpackbuy.wxss
index b9a7391..f77f8bf 100644
--- a/pages/giftpack/buygiftpack/giftpackbuy.wxss
+++ b/pages/giftpack/buygiftpack/giftpackbuy.wxss
@@ -1,9 +1,6 @@
/*引用样式路径*/
@charset "UTF-8";
-
-/* Author XGQ
- * 2019-11-12
- */
+@import '../../goods/goodsInfo/goodsInfo.wxss';
page {
/* background-color: #fb7454; */
diff --git a/pages/giftpack/giftpacklist/giftpacklist.js b/pages/giftpack/giftpacklist/giftpacklist.js
index 548ea43..b37183c 100644
--- a/pages/giftpack/giftpacklist/giftpacklist.js
+++ b/pages/giftpack/giftpacklist/giftpacklist.js
@@ -4,6 +4,7 @@ var e = getApp(),
t = e.request,
d = e.globalData;
var ut = require("../../../utils/util.js");
+var com = require("../public/buy_com.js");
Page({
data: {
@@ -30,6 +31,43 @@ Page({
is_lb: 0, //是否有礼包
default_color: null,
first_leader: e.globalData.first_leader || 0, // 推荐人ID
+
+ //门店相关
+ ismend: 0,
+ is_sec_mend: 0,
+ sto_sele_name: "", //选中的门店名称
+ sto_sele_id: "", //选中的门店id
+ sto_sele_distr: "", //选择的门店的配送方式
+ is_show_sto_cat: 1, //是否显示门店分类
+ only_pk: null,
+ all_sto: null,
+ sec_sto: null, //选择了的门店分类
+ pickpu_list: null, //读出的所有门店list
+ def_pickpu_list: null, //一开始5个门店list
+ sec_pick_index: 0, //第二级门店选择ID
+ fir_pick_index: 0, //第一级门店选择ID
+ all_pick_list: null,//所有的门店先记录起来
+
+ select_store: 0, //选择更多
+ index: 1,
+ more_store: 0, //选择门店
+ sort_store: 0, //门店分类
+ choice_sort_store: 0, //选择分类门店
+ new_user: 0, //新用户
+
+ def_pick_store: null, // 默认的门店
+ fir_def_store: null, //客户默认的门店的
+ lat: null, //维度
+ lon: null, //经度
+
+ is_get_local_ok: 0, //获取坐标是否完成
+ region_name: "门店分类", //区域的名字
+ is_gps: 1,
+ open_ind_store: 0, //哪里打开的门店列表的控制属性
+ default_store: {}, //创建添加默认门店地址的对象
+
+ store:0,
+ openSpecModal:0
},
onLoad: function (options) {
this.setData({
@@ -87,81 +125,36 @@ Page({
GetBuyPrice: function (e) {
var that = this.data;
var th = this;
- // var id = e.currentTarget.dataset.id;//活动id
//如果还没有开始的话
if (th.data.isStart != 1) {
getApp().my_warnning("活动还没有开始", 0, th);
return false;
}
-
- var money = e.currentTarget.dataset.money;
- var my_confirm = th.selectComponent("#my_confirm"); //组件的id
- my_confirm.open(
- "是否确定购买该礼包",
- "取消",
- "确定",
- function () {
- my_confirm.open_cancel(0);
- },
- function () {
- my_confirm.open_cancel(0);
-
- var json = {
- "actId": '', //活动Id
- "actType": '', //活动类型 1:新人礼、2:评价有礼、3:节日营销、4:生日营销
- "buyType": '2', //1=积分兑换 2=余额购买
- "giftBagId": that.getGiftID, //礼包Id
- "storeId": a.stoid, //商家Id
- "userId": d.user_id, //用户ID
- "buyFrom": 2,
- "first_leader": that.first_leader,
- };
-
- //-- 分享导购要记录 --
- if (getApp().globalData.guide_id) {
- json.guide_id = getApp().globalData.guide_id;
- }
-
- var data = JSON.stringify(json);
- var url = that.url + "/api/weshop/marketing/buy/receive/gift/record/insert";
-
- getApp().request.json_post(url, json,
- function (res) {
- if (res.data.code == 0) {
- var res = res.data.data;
- if (!res) return false;
- if (!res.result) return false;
-
- var order_sn = res.orderSn;
- var url = "/pages/giftpack/payment/payment?money=" + money + "&order_sn=" + order_sn;
- wx.requestPayment({
- timeStamp: String(res.result.timeStamp),
- nonceStr: res.result.nonceStr,
- package: res.result.packageValue,
- signType: res.result.signType,
- paySign: res.result.paySign,
- success: function (n) {
- getApp().goto(url);
- },
- fail: function (n) {
- getApp().my_warnning("取消支付", 0, th);
- }
- });
- } else {
- getApp().my_warnning(res.data.msg, 0, th);
+ th.setData({ buyType:2 })
+ if(th.data.sele_g.is_pickup){
+ th.setData({
+ openSpecModal:1
+ })
+ }else{
+ var my_confirm = th.selectComponent("#my_confirm"); //组件的id
+ my_confirm.open(
+ "是否确定购买该礼包",
+ "取消",
+ "确定",
+ function () {
+ my_confirm.open_cancel(0);
+ },
+ function () {
+ my_confirm.open_cancel(0);
+ com.buy_libao(th)
}
- },
- function (res) {
-
- }
)
+ }
- }
- )
},
GetBuyIntegral: function (e) {
@@ -173,48 +166,28 @@ Page({
getApp().my_warnning("活动还没有开始", 0, th);
return false;
}
- // var id = e.currentTarget.dataset.id;//活动id
- var my_confirm = th.selectComponent("#my_confirm"); //组件的id
- my_confirm.open(
- "是否确定兑换该礼包",
- "取消",
- "确定",
- function () {
- my_confirm.open_cancel(0);
- },
- function () {
- my_confirm.open_cancel(0);
- var json = {
- "actId": '', //活动Id
- "actType": '', //活动类型 1:新人礼、2:评价有礼、3:节日营销、4:生日营销
- "buyType": '1', //1=积分兑换 2=余额购买
- "giftBagId": that.getGiftID, //礼包Id
- "storeId": a.stoid, //商家ID
- "userId": d.user_id, //用户ID
- "buyFrom": 2,
- "first_leader": that.first_leader,
- };
- //-- 分享导购要记录 --
- if (getApp().globalData.guide_id) {
- json.guide_id = getApp().globalData.guide_id;
- }
- var data = JSON.stringify(json);
- var url = that.url + "/api/weshop/marketing/buy/receive/gift/record/insert";
- getApp().request.json_post(url, json,
- function (res) {
- if (res.data.code == 0) {
- getApp().my_warnning("兑换成功!", 1, th);
- } else {
- getApp().my_warnning(res.data.msg, 0, th);
- }
- },
- function (res) {
+ th.setData({ buyType:1 });
+ if(th.data.sele_g.is_pickup){
+ th.setData({
+ openSpecModal:1
+ })
+ }else {
+ var my_confirm = th.selectComponent("#my_confirm"); //组件的id
+ my_confirm.open(
+ "是否确定兑换该礼包",
+ "取消",
+ "确定",
+ function () {
+ my_confirm.open_cancel(0);
+ },
+ function () {
+ my_confirm.open_cancel(0);
+ com.buy_libao(th)
+ })
+ }
- }
- )
- })
},
@@ -334,7 +307,20 @@ Page({
actTitle: res.data.data.actTitle,
wareCard: res.data.data.wareCard,
isStart: isStart,
+ sele_g:res.data.data
})
+
+
+ var sele_g=res.data.data;
+ com.wait_for_store_config(_this2);
+ com.set_user_mo_store(_this2,os,function () {
+ if(sele_g.pickup_list && _this2.data.def_pick_store){
+ com.check_def_pk(_this2);
+ }
+ });
+ com.get_sto(_this2,os);
+
+
} else {
getApp().my_warnning(res.data.msg, 0, _this2);
return false;
@@ -421,6 +407,7 @@ Page({
//--- 分享设置 --
onShareAppMessage: function (e) {
+ getApp().globalData.no_clear=1;
var curPage = this;
var pagePath = curPage.route; //当前页面url
if (pagePath.indexOf('/') != 0) {
@@ -443,6 +430,7 @@ Page({
* 用户分享朋友圈
*/
onShareTimeline() {
+ getApp().globalData.no_clear=1;
var curPage = this;
var pagePath = curPage.route; //当前页面url
if (pagePath.indexOf('/') != 0) {
@@ -471,50 +459,298 @@ Page({
getApp().my_warnning("活动还没有开始", 0, th);
return false;
}
- // var id = e.currentTarget.dataset.id;//活动id
- var my_confirm = th.selectComponent("#my_confirm"); //组件的id
- my_confirm.open(
- "是否确定领取该礼包",
- "取消",
- "确定",
- function () {
- my_confirm.open_cancel(0);
- },
- function () {
- my_confirm.open_cancel(0);
- var json = {
- "actId": '', //活动Id
- "actType": '', //活动类型 1:新人礼、2:评价有礼、3:节日营销、4:生日营销
- "buyType": '3', //1=积分兑换 2=余额购买
- "giftBagId": that.getGiftID, //礼包Id
- "storeId": a.stoid, //商家ID
- "userId": d.user_id, //用户ID
- "buyFrom": 2,
- "first_leader": that.first_leader,
- };
-
- //-- 分享导购要记录 --
- if (getApp().globalData.guide_id) {
- json.guide_id = getApp().globalData.guide_id;
+
+ th.setData({ buyType:3 });
+ if(th.data.sele_g.is_pickup){
+ th.setData({
+ openSpecModal:1
+ })
+ }else {
+
+
+ // var id = e.currentTarget.dataset.id;//活动id
+ var my_confirm = th.selectComponent("#my_confirm"); //组件的id
+ my_confirm.open(
+ "是否确定领取该礼包",
+ "取消",
+ "确定",
+ function () {
+ my_confirm.open_cancel(0);
+ },
+ function () {
+ my_confirm.open_cancel(0);
+ com.buy_libao(th)
+ })
+ }
+
+
+ },
+
+ //--- 设置一下默认库存的数量 ----
+ set_def_storage(ee) {
+ var that = this, th = this;
+ that.data.fir_def_store = ee;
+
+ that.setData({
+ def_pick_store: ee,
+ sto_sele_name: ee.pickup_name,
+ sto_sele_id: ee.pickup_id,
+ sto_sele_distr: ee.distr_type
+ })
+ },
+ // 选择门店
+ choice_store: function (ee) {
+ var th = this;
+ var ind = ee.currentTarget.dataset.ind;
+ var bconfig = th.data.bconfig;
+
+ if (!th.data.only_pk && !th.data.def_pickpu_list) {
+ getApp().confirmBox("门店库存不足", null, 25000, !1);
+ return false;
+ }
+
+ if (th.data.only_pk && !th.data.only_pk.length) {
+ getApp().confirmBox("门店库存不足", null, 25000, !1);
+ return false;
+ }
+ if (th.data.def_pickpu_list && !th.data.def_pickpu_list.length) {
+ getApp().confirmBox("门店库存不足", null, 25000, !1);
+ return false;
}
- var data = JSON.stringify(json);
- var url = that.url + "/api/weshop/marketing/buy/receive/gift/record/insert";
- getApp().request.json_post(url, json,
- function (res) {
- if (res.data.code == 0) {
- getApp().my_warnning("领取成功!", 1, th);
+
+ if (bconfig && bconfig.is_sort_storage) {
+ wx.getLocation({
+ type: 'gcj02',
+ success: function (res) {
+
+ th.data.lat = res.latitude;
+ th.data.lon = res.longitude;
+ th.data.is_get_local_ok = 1;
+ th.setData({
+ is_gps: 1
+ });
+ //th.onShow();
+ com.get_sto(th,os);
+ },
+ fail: function (res) {
+ //th.onShow();
+ th.data.is_get_local_ok = 1;
+ com.get_sto(th,os);
+ if (res.errCode == 2) {
+ th.setData({
+ is_gps: 0
+ });
+ if (th.data.is_gps == 0) {
+ getApp().confirmBox("请开启GPS定位", null, 25000, !1);
+ }
+ } else {
+ th.setData({
+ is_gps: "3"
+ });
+ }
+
+ }
+ })
+ } else {
+ th.data.is_get_local_ok = 1;
+ com.get_sto(th,os);
+ }
+
+ if (ind != undefined && ind != null) {
+ this.setData({
+ open_ind_store: ind,
+ store: 1,
+ openSpecModal: !1,
+ openSpecModal_pt: !1,
+ openSpecModal_flash_normal: !1,
+ })
+ } else {
+ this.setData({
+ store: 1,
+ openSpecModal: !1,
+ openSpecModal_pt: !1,
+ openSpecModal_flash_normal: !1
+
+ })
+ }
+ },
+ //关闭选择门店
+ close_popup: function (e) {
+ var th = this;
+ this.setData({
+ store: 0,
+ choice_sort_store: 0,
+ sort_store: 0,
+ fir_pick_index: 0,
+ sec_pick_index: 0
+ })
+
+ var openindstore = this.data.open_ind_store;
+ if (openindstore == 1) {
+ th.setData({
+ openSpecModal: !0,
+ openSpecModal_ind: openindstore,
+ });
+ } else if (openindstore == 2) {
+ th.setData({
+ openSpecModal: !0,
+ openSpecModal_ind: openindstore,
+ });
+ }
+ else if (openindstore == 4) { //4就是拼团
+ th.setData({
+ openSpecModal_pt: 1, //打开拼团购买界面
+ store: 0, //关闭门店
+ choice_sort_store: 0, //关闭门店2级
+ sort_store: 0, //关闭门店2级
+ });
+ }
+ else {
+ th.setData({
+ store: 0,
+ choice_sort_store: 0,
+ sort_store: 0
+ })
+ }
+
+
+ },
+
+ //选择更多门店
+ more_store: function () {
+ this.setData({
+ sort_store: 1
+ });
+ },
+ // 返回按钮
+ returns: function () {
+ this.setData({
+ sort_store: 0,
+ choice_sort_store: 0
+ });
+ },
+ //---选择分类门店---
+ choice_sort_store: function (e) {
+ var index = e.currentTarget.dataset.index;
+ var region_name = e.currentTarget.dataset.region;
+ var item = this.data.all_sto[index];
+ this.setData({
+ region_name: region_name,
+ sort_store: 0,
+ choice_sort_store: 1,
+ sec_sto: item,
+ sec_pick_index: 0
+ });
+ },
+
+ choose_for_store_fir: function (e) {
+ var index_c = e.currentTarget.dataset.ind;
+ var th = this;
+ th.setData({
+ fir_pick_index: index_c
+ })
+
+ },
+
+ //确定def_pick为选择的门店
+ sure_pick: function (e) {
+ var th = this;
+ var item = null;
+ var openindstore = th.data.open_ind_store;
+
+ if (th.data.choice_sort_store == 0) {
+ var index = th.data.fir_pick_index;
+ if (th.data.is_show_sto_cat == 1) {
+ item = th.data.def_pickpu_list[index];
} else {
- getApp().my_warnning(res.data.msg, 0, th);
+ item = th.data.only_pk[index]; //当没有门店分类的时候
}
- },
- function (res) { }
- )
- })
+ } else {
+ var index = th.data.sec_pick_index;
+ item = th.data.sec_sto.s_arr[index];
+ }
+ if (!th.data.sele_g) return false;
+
+ th.setData({
+ def_pick_store: item,
+ sto_sele_name: item.pickup_name,
+ sto_sele_id: item.pickup_id,
+ sto_sele_distr: item.distr_type,
+ store: 0,
+ choice_sort_store: 0,
+ fir_pick_index: 0,
+ openSpecModal: !0,
+ });
+
+
+ },
+ //---点击二级之后的选择---
+ choose_for_store: function (e) {
+ var index_c = e.currentTarget.dataset.ind;
+ var th = this;
+ th.setData({
+ sec_pick_index: index_c,
+ fir_pick_index: index_c
+ })
+
+ },
+ //把选择的门店设置成默认的门店def_pick
+ set_def_pick: function (e) {
+ var th = this;
+ var item = null;
+ if (th.data.choice_sort_store == 0) {
+ var index = th.data.fir_pick_index;
+ if (th.data.is_show_sto_cat == 1) {
+ item = th.data.def_pickpu_list[index];
+ } else {
+ item = th.data.only_pk[index]; //当没有门店分类的时候
+ }
+ } else {
+ var index = th.data.sec_pick_index;
+ item = th.data.sec_sto.s_arr[index];
+ }
+ th.setData({
+ def_pick_store: item,
+ sto_sele_name: item.pickup_name,
+ sto_sele_id: item.pickup_id,
+ sto_sele_distr: item.distr_type,
+ store: 0,
+ choice_sort_store: 0,
+ openSpecModal: !0,
+ });
+
+ var user_id=getApp().globalData.user_id;
+ var def_pickup_id = item.pickup_id;
+ getApp().request.put('/api/weshop/users/update', {
+ data: {
+ user_id: user_id,
+ def_pickup_id: def_pickup_id
+ },
+ success: function (res) {
+ if (res.data.code == 0) {
+ if (th.data.choice_sort_store == 0) th.setData({
+ fir_pick_index: 0
+ });
+ getApp().globalData.pk_store = item;
+ } else {
+ getApp().my_warnning("设置默认门店地址失败", 0, th)
+ }
- },
+ }
+ });
+
+
+ },
+ closeSpecModal: function () {
+ this.setData({openSpecModal: 0});
+ },
+
+ buy_libao:function () {
+ com.buy_libao(this)
+ }
diff --git a/pages/giftpack/giftpacklist/giftpacklist.wxml b/pages/giftpack/giftpacklist/giftpacklist.wxml
index dde865a..560d3cc 100644
--- a/pages/giftpack/giftpacklist/giftpacklist.wxml
+++ b/pages/giftpack/giftpacklist/giftpacklist.wxml
@@ -190,4 +190,6 @@
-
\ No newline at end of file
+
+
+
\ No newline at end of file
diff --git a/pages/giftpack/giftpacklist/giftpacklist.wxss b/pages/giftpack/giftpacklist/giftpacklist.wxss
index 958233b..9fb4397 100644
--- a/pages/giftpack/giftpacklist/giftpacklist.wxss
+++ b/pages/giftpack/giftpacklist/giftpacklist.wxss
@@ -1,8 +1,5 @@
@charset "UTF-8";
-
-/* Author XGQ
- * 2019-12-12
- */
+@import '../../goods/goodsInfo/goodsInfo.wxss';
.box.data-v-3a5b7e36 {
-webkit-align-content: center;
diff --git a/pages/giftpack/public/buy_com.js b/pages/giftpack/public/buy_com.js
new file mode 100644
index 0000000..4b67daa
--- /dev/null
+++ b/pages/giftpack/public/buy_com.js
@@ -0,0 +1,506 @@
+module.exports = {
+ //开启定位
+ wait_for_store_config: function (th) {
+ var t_time = setInterval(function () {
+ if (th.data.bconfig == null) false;
+ var e = th.data.bconfig;
+ if (e && e.is_sort_storage) {
+ wx.getLocation({
+ type: 'gcj02',
+ success: function (res) {
+ th.data.lat = res.latitude;
+ th.data.lon = res.longitude;
+ th.data.is_get_local_ok = 1;
+ },
+ fail: function (res) {
+ if (res.errCode == 2) {
+ th.setData({
+ is_gps: 0
+ });
+ if (th.data.is_gps == 0) {
+ getApp().confirmBox("请开启GPS定位", null, 10000, !1);
+ }
+
+ } else {
+ th.setData({
+ is_gps: "3"
+ });
+ }
+
+ th.data.is_get_local_ok = 1;
+ }
+ })
+ } else {
+ th.data.is_get_local_ok = 1;
+ }
+ clearInterval(t_time);
+ }, 500)
+ },
+ set_user_mo_store(th,os,func){
+ var that=th;
+ //获取用户的默认门店
+ getApp().get_user_store(function (e) {
+ if (!e) {
+ th.data.fir_def_store = {}; //赋值空对象
+ return false;
+ }
+ var ee = JSON.parse(JSON.stringify(e));
+ //--定时器推迟一下--
+ setTimeout(function () {
+ if (th.data.fir_goods) var g_distr_type = th.data.fir_goods.distr_type;
+ //--如果默认门店的配送方式不对,就不能被选择,这里不控制,如果不一样,就说明配送方式不对--
+ if (ee.distr_type != 0 && g_distr_type != 0 && ee.distr_type != g_distr_type) {
+ ee.is_no_dis = 1;
+ }
+
+ var appd = getApp().globalData;
+ var w_time = setInterval(function () {
+ if (that.data.is_get_local_ok == 0) return false;
+ clearInterval(w_time);
+ var distance = null;
+ var e = JSON.parse(JSON.stringify(ee));
+
+ //如果有开启近距离的话,同时距离优不一样了
+ if (that.data.lat != null) {
+ //如果经纬度有变化的话
+ if (e && appd.lat == that.data.lat && appd.lon == that.data.lon && e.distance > 0) {
+ that.set_def_storage(e);
+ if(func) func();
+ } else {
+ //要用接口是获取距离,js的计算不准
+ getApp().request.promiseGet("/api/weshop/pickup/list", {
+ data: {
+ store_id: os.stoid,
+ pickup_id: e.pickup_id,
+ lat: th.data.lat,
+ lon: th.data.lon,
+ isstop: 0,
+ is_pos: 1
+ },
+ }).then(res => {
+ if (res.data.code == 0) {
+ e = res.data.data.pageData[0];
+ if (e) {
+ e.is_no_dis = ee.is_no_dis;
+ appd.pk_store = e;
+ that.set_def_storage(e);
+ }
+
+ }
+ if(func) func();
+ })
+ }
+ //e.distance = distance;
+ appd.lat = that.data.lat;
+ appd.lon = that.data.lon;
+
+ } else {
+ if (e) {
+ e.distance = null;
+ that.set_def_storage(e);
+ }
+ if(func) func();
+ }
+ }, 500)
+ }, 700)
+ })
+
+ },
+
+ //---------拿出门店分类和门店------------
+ get_sto(th,os) {
+ var that = th;
+ var self=this;
+ var timer_get = setInterval(function () {
+ if (th.data.is_get_local_ok == 0) return false;
+ var dd = null;
+
+ dd = {
+ store_id: os.stoid,
+ isstop: 0,
+ is_pos: 1,
+ pageSize: 2000,
+ }
+
+ //如果有距离的话
+ if (th.data.lat != null) {
+ dd.lat = th.data.lat;
+ dd.lon = th.data.lon;
+ }
+
+ if(th.data.sele_g && th.data.sele_g.pickup_list){
+ dd.ids=th.data.sele_g.pickup_list
+ }
+
+ clearInterval(timer_get);
+
+ //如果会员是有默认的门店话
+ if (!th.data.def_pick_store && th.data.fir_def_store) {
+ th.setData({def_pick_store: th.data.fir_def_store});
+ }
+ wx.showLoading({
+ title: '加载中.'
+ });
+ //----------获取门店----------------
+ getApp().request.promiseGet("/api/weshop/pickup/list", {
+ data: dd,
+ }).then(res => {
+ var e = res;
+
+ if (e.data.code == 0 && e.data.data && e.data.data.pageData && e.data.data.pageData.length > 0) {
+
+ var his_cate_num = 0;
+ for (let i in e.data.data.pageData) {
+ let item = e.data.data.pageData[i];
+ if (item.category_id > 0) {
+ his_cate_num = 1;
+ break;
+ }
+ }
+ e.his_cate_num = his_cate_num;
+
+ //如果有开启距离的功能,没有设置默认门店,要用最近的门店作为默认门店
+ if (dd.lat && (!th.data.def_pick_store || JSON.stringify(th.data.def_pick_store) == '{}') && th.data.bconfig && th.data.bconfig.is_sort_storage) {
+ th.setData({
+ def_pick_store: e.data.data.pageData[0],
+ sto_sele_name: e.data.data.pageData[0].pickup_name,
+ sto_sele_id: e.data.data.pageData[0].pickup_id,
+ sto_sele_distr: e.data.data.pageData[0].distr_type
+ });
+ th.data.fir_def_store = e.data.data.pageData[0];
+ }
+
+ //-- 如果有默认选择门店的时候,要把默认门店放在第一位,修改不要配送方式的判断 --
+ if (th.data.def_pick_store && JSON.stringify(th.data.def_pick_store) != '{}') {
+ for (var k = 0; k < e.data.data.pageData.length; k++) {
+ if (e.data.data.pageData[k].pickup_id == th.data.def_pick_store.pickup_id) {
+ e.data.data.pageData.splice(k, 1); //删除
+ break;
+ }
+ }
+ e.data.data.pageData.splice(0, 0, th.data.def_pick_store); //添加
+ }
+
+ th.setData({all_pick_list: e.data.data.pageData});
+
+ setTimeout(function () {
+ self.deal_pickup(e,th,os); //--普通门店排版--
+ }, 800)
+
+ }
+ })
+ }, 200)
+
+ },
+
+ //-- 统一购买 --
+ buy_libao:function (th) {
+ if(th.data.sele_g.is_pickup){
+ if(!th.data.def_pick_store && !th.data.def_pick_store.pickup_id){
+ getApp().my_warnning("请先选择门店", 1, th);
+ return false;
+ }
+
+ if(th.data.def_pick_store.is_no_dis){
+ getApp().my_warnning("门店不匹配,请重新选择", 1, th);
+ return false;
+ }
+ }
+
+ th.setData({submit:1})
+ var id=th.data.sele_g.lbId;
+ var that=th;
+ var json = {
+ "actId": '', //活动Id
+ "actType": '', //活动类型 1:新人礼、2:评价有礼、3:节日营销、4:生日营销
+ "buyType":""+that.data.buyType, //1=积分兑换 2=余额购买
+ "giftBagId": id, //礼包Id
+ "storeId": that.data.getStorageID, //商家Id
+ "userId": that.data.getUserID, //用户ID
+ "buyFrom": 2,
+ };
+
+ if(that.data.first_leader){
+ json.first_leader=that.data.first_leader
+ }
+ if(that.data.guide_id){
+ json.guide_id=that.data.guide_id
+ }
+
+ if(that.data.def_pick_store){
+ json.pickup_id=that.data.def_pick_store.pickup_id;
+ }
+
+ //-- 分享导购要记录 --
+ if (getApp().globalData.guide_id) {
+ json.guide_id = getApp().globalData.guide_id;
+ }
+
+ var url ="/api/weshop/marketing/buy/receive/gift/record/insert";
+ getApp().request.json_post(url, json,
+ function (res) {
+ if (res.data.code == 0 && res.data.data) {
+ switch(that.data.buyType){
+ case 1://立即兑换
+ th.setData({submit:0})
+ getApp().my_warnning("兑换成功!", 1, th);
+ th.closeSpecModal();
+ break;
+ case 2://立即购买
+ var order_sn = res.data.data.orderSn;
+ res = res.data.data.result;
+ if (!res) return false;
+ var money=that.data.payMoney;
+ var url = "/pages/giftpack/payment/payment?money=" + money + "&order_sn=" + order_sn;
+ wx.requestPayment({
+ timeStamp: String(res.timeStamp),
+ nonceStr: res.nonceStr,
+ package: res.packageValue,
+ signType: res.signType,
+ paySign: res.paySign,
+ success: function (res) {
+ th.setData({submit:0})
+ getApp().goto(url);
+ },
+ fail: function (res) {
+ th.setData({submit:0})
+ getApp().my_warnning("取消支付", 0, th);
+ }
+ });
+ break;
+ case 3://立即领取
+ th.setData({submit:0})
+ getApp().my_warnning("领取成功!", 1, th);
+ th.closeSpecModal();
+ break;
+ }
+
+ } else {
+ th.setData({submit:0})
+ getApp().my_warnning(res.data.msg, 0, th);
+ }
+ },
+ function (res) {
+ th.setData({submit:0})
+ }
+ )
+
+ },
+
+ //------------处理门店---------------
+ deal_pickup(e,th,os) {
+
+ if (!th.data.sele_g) return false
+ wx.hideLoading();
+
+ //单总量超出10个的时候,同时门店有分类
+ if (e.data.data.total > 10 && e.his_cate_num) {
+ getApp().request.get("/api/weshop/storagecategory/page", {
+ data: {
+ store_id: os.stoid,
+ pageSize: 1000,
+ orderField: "sort",
+ orderType: 'asc',
+ },
+ success: function (ee) {
+ if (ee.data.code == 0) {
+ var check_all_cate = 0;
+ if (ee.data.data && ee.data.data.pageData && ee.data.data.pageData.length > 0) {
+ for (let i in ee.data.data.pageData) {
+ let item = ee.data.data.pageData[i];
+ if (item.is_show == 1) {
+ check_all_cate = 1;
+ break
+ }
+ }
+ }
+ if (check_all_cate) {
+ var sto_cate = ee.data.data.pageData;
+ var sto_arr = e.data.data.pageData;
+ var newarr = new Array();
+ var qita = new Array();
+
+
+ var is_del_pk = 0;
+ //----要进行门店分组--------
+ for (var i = 0; i < sto_arr.length; i++) {
+ //找一下这个门店有没有在分类数组内
+ var find2 = 0, find2name = "", sort = 0;
+ is_del_pk = 0;
+ for (var m = 0; m < sto_cate.length; m++) {
+ if (sto_arr[i].category_id == sto_cate[m].cat_id) {
+ if (sto_cate[m].is_show != 1) {
+ is_del_pk = 1;
+ sto_arr.splice(i, 1);
+ i--;
+ } else {
+ find2 = sto_cate[m].cat_id;
+ find2name = sto_cate[m].cat_name;
+ sort = sto_cate[m].sort;
+ is_del_pk = 0;
+ }
+ break;
+ }
+ }
+ if (is_del_pk) continue;
+
+ if (newarr.length > 0) {
+ var find = 0;
+ //如果有找到,那门店就在这个分组内,否则,分类就要排在其他
+ if (find2 != 0) {
+ for (var ii = 0; ii < newarr.length; ii++) {
+ if (sto_arr[i].category_id == newarr[ii].cat_id) {
+ newarr[ii].s_arr.push(sto_arr[i]);
+ find = 1;
+ break;
+ }
+ }
+ if (find == 0) {
+ var arr0 = new Array();
+ arr0.push(sto_arr[i]);
+ var item = {
+ cat_id: find2,
+ name: find2name,
+ sort: sort,
+ s_arr: arr0
+ };
+ newarr.push(item);
+ }
+ } else {
+ qita.push(sto_arr[i]);
+ }
+ } else {
+ //如果有找到,那门店就在这个分组内,否则,分类就要排在其他
+ if (find2 != 0) {
+ var arr0 = new Array();
+ arr0.push(sto_arr[i]);
+ var item = {
+ cat_id: find2,
+ name: find2name,
+ sort: sort,
+ s_arr: arr0
+ };
+ newarr.push(item);
+ } else {
+ qita.push(sto_arr[i]);
+ }
+ }
+ }
+
+ var def_arr = new Array();
+ //-- 开始就看10个门店 --
+ for (var k = 0; k < 10; k++) {
+ if (k == sto_arr.length) break;
+ def_arr.push(sto_arr[k]);
+ }
+
+ th.setData({
+ def_pickpu_list: def_arr,
+ pickpu_list: ee.data.data.pageData
+ });
+
+
+ //门店分类要排序下
+ function compare(property) {
+ return function (a, b) {
+ var value1 = a[property];
+ var value2 = b[property];
+ return value1 - value2;
+ }
+ }
+
+ if (newarr.length > 0)
+ newarr.sort(compare("sort"));
+
+
+ //----安排其他的分类-----
+ if (qita.length > 0) {
+ var item = {
+ cat_id: -1,
+ name: "其他",
+ s_arr: qita
+ };
+ newarr.push(item);
+ }
+
+ var sd = {
+ all_sto: newarr,
+ is_show_sto_cat: 1
+ }
+ if (!sto_arr || sto_arr.length <= 10) {
+ sd.is_show_sto_cat = -1;
+ sd.only_pk = sto_arr;
+ }
+ th.setData(sd);
+
+ } else {
+ th.setData({
+ is_show_sto_cat: -1,
+ only_pk: e.data.data.pageData
+ });
+ //-----如果没有默认门店,要取第一个门店作为默认店.此时没有门店分类的情况------
+ if (!th.data.def_pick_store) {
+ th.setData({
+ def_pick_store: e.data.data.pageData[0],
+ sto_sele_name: e.data.data.pageData[0].pickup_name,
+ sto_sele_id: e.data.data.pageData[0].pickup_id,
+ sto_sele_distr: e.data.data.pageData[0].distr_type
+ })
+ }
+ }
+ } else {
+ th.setData({
+ is_show_sto_cat: -1,
+ only_pk: e.data.data.pageData
+ });
+ //-----如果没有默认门店,要取第一个门店作为默认店.此时没有门店分类的情况------
+ if (!th.data.def_pick_store) {
+ th.setData({
+ def_pick_store: e.data.data.pageData[0],
+ sto_sele_name: e.data.data.pageData[0].pickup_name,
+ sto_sele_id: e.data.data.pageData[0].pickup_id,
+ sto_sele_distr: e.data.data.pageData[0].distr_type
+ })
+ }
+
+ }
+ }
+ });
+ } else {
+ th.setData({
+ is_show_sto_cat: 0,
+ only_pk: e.data.data.pageData
+ });
+ //-----如果没有默认门店,要取第一个门店作为默认店------
+ if (!th.data.def_pick_store && th.data.bconfig && th.data.bconfig.is_sort_storage) {
+ th.setData({
+ def_pick_store: e.data.data.pageData[0],
+ sto_sele_name: e.data.data.pageData[0].pickup_name,
+ sto_sele_id: e.data.data.pageData[0].pickup_id,
+ sto_sele_distr: e.data.data.pageData[0].distr_type
+ })
+ }
+ }
+ },
+
+ check_def_pk:function (th) {
+ var def_pick_store=th.data.def_pick_store
+ var sele_g=th.data.sele_g;
+ var arr=sele_g.pickup_list.split(',');
+
+ var idx=arr.findIndex(function (e) {
+ return e==def_pick_store.pickup_id;
+ })
+
+ if(idx==-1){
+ def_pick_store.is_no_dis=1;
+ th.setData({def_pick_store})
+ }
+
+
+ }
+
+
+
+
+}
\ No newline at end of file
diff --git a/pages/giftpack/public/buy_com.wxml b/pages/giftpack/public/buy_com.wxml
new file mode 100644
index 0000000..1e03985
--- /dev/null
+++ b/pages/giftpack/public/buy_com.wxml
@@ -0,0 +1,257 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ {{sele_g.giftTitle}}
+
+
+
+ {{"¥"+sele_g.payMoney}}
+
+
+ /
+
+
+
+ {{sele_g.payIntegral}}
+ 积分
+
+
+
+
+
+
+
+
+ 已售:{{sele_g.giftQty}}
+ 可售:{{sele_g.lbnum-sele_g.giftQty+(sele_g.virtualsales?sele_g.virtualsales:0)}}
+
+
+
+
+
+
+ {{def_pick_store.pickup_name}}
+
+ 距离:{{def_pick_store.distance>1000?filters.toFix(def_pick_store.distance/1000,2)+"km":filters.toFix(def_pick_store.distance,0)+"m"}}
+
+
+
+
+
+ 选择门店
+
+ 更多门店
+
+ (库存不足)
+
+ (库存不足)
+
+ (配送不匹配)
+
+ (库存不足)
+
+
+
+
+ 地址:{{def_pick_store.fulladdress}}
+
+
+
+
+
+
+
+
+
+
+ 未找到门店
+
+
+
+
+
+ 未找到门店
+
+
+
+
+
+ 库存不足
+
+
+
+
+
+ 请先选择门店
+
+
+
+
+
+ 库存不足
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file