diff --git a/packageA/pages/goodsInfo/goodsInfo.js b/packageA/pages/goodsInfo/goodsInfo.js
index 70fcde7..1c8778b 100644
--- a/packageA/pages/goodsInfo/goodsInfo.js
+++ b/packageA/pages/goodsInfo/goodsInfo.js
@@ -1201,7 +1201,7 @@ Page({
}
// 以下为当前门店同类商品已经加入到购物车
- var totalNum = th.data.goodsInputNum + item.goods_num;
+ var totalNum = th.data.goodsInputNum + (item?item.goods_num:0);
// 秒杀购物车购买 修正数量
if (th.data.prom_type == 1 && !th.data.is_normal) {
@@ -1225,43 +1225,60 @@ Page({
}
}
- var updata = {
- id: item.id,
- goods_num: totalNum,
- money: th.data.data.shop_price,
- store_id: os.stoid,
- };
-
- // 秒杀:单独购买的情况下,加入购物车显示的是零售价,否则显示秒杀活动价
- if(th.data.options.prom_type == 1) {
- // updata['prom_type'] = th.data.options.prom_type;
- // updata['prom_id'] = th.data.options.prom_id;
- if(th.data.openSpecModal_flash_normal) {
- updata['money'] = th.data.data.shop_price;
- updata['is_pd_normal'] = 1;
- } else {
- updata['money'] = th.data.prom_price;
- };
- };
-
- if (getApp().globalData.guide_id) {
- updata['guide_id'] = getApp().globalData.guide_id;
- updata['guide_type'] = 1;
- }
- if(getApp().globalData.groupchat_id){
- updata['groupchat_id'] = getApp().globalData.groupchat_id;
- }
- getApp().request.put("/api/weshop/cartService/update", {
- data: updata,
- success: function(t) {
- getApp().my_warnning('加入购物车成功', 1, th, 450);
- var c_num = th.data.cartGoodsNum + th.data.goodsInputNum;
- th.setData({
- cartGoodsNum: c_num
- });
- th.closeSpecModal();
- }
- });
+ if(item) {
+ var updata = {
+ id: item.id,
+ goods_num: totalNum,
+ money: th.data.data.shop_price,
+ store_id: os.stoid,
+ };
+
+ // 秒杀:单独购买的情况下,加入购物车显示的是零售价,否则显示秒杀活动价
+ if (th.data.options.prom_type == 1) {
+ // updata['prom_type'] = th.data.options.prom_type;
+ // updata['prom_id'] = th.data.options.prom_id;
+ if (th.data.openSpecModal_flash_normal) {
+ updata['money'] = th.data.data.shop_price;
+ updata['is_pd_normal'] = 1;
+ } else {
+ updata['money'] = th.data.prom_price;
+ }
+
+ }
+
+
+ if (getApp().globalData.guide_id) {
+ updata['guide_id'] = getApp().globalData.guide_id;
+ updata['guide_type'] = 1;
+ }
+ if (getApp().globalData.groupchat_id) {
+ updata['groupchat_id'] = getApp().globalData.groupchat_id;
+ }
+ getApp().request.put("/api/weshop/cartService/update", {
+ data: updata,
+ success: function (t) {
+ getApp().my_warnning('加入购物车成功', 1, th, 450);
+ var c_num = th.data.cartGoodsNum + th.data.goodsInputNum;
+ th.setData({
+ cartGoodsNum: c_num
+ });
+ th.closeSpecModal();
+ }
+ });
+ }else{
+ getApp().request.post("/api/weshop/cartService/save", {
+ data: newd,
+ success: function(t) {
+ getApp().my_warnning('加入购物车成功', 1, th, 450);
+ var c_num = th.data.cartGoodsNum + th.data.goodsInputNum;
+ th.setData({
+ cartGoodsNum: c_num
+ });
+ th.closeSpecModal();
+ }
+ });
+
+ }
} else {
getApp().request.post("/api/weshop/cartService/save", {
data: newd,
diff --git a/packageA/pages/goodsInfo/goodsInfo.wxml b/packageA/pages/goodsInfo/goodsInfo.wxml
index 018d2dc..955bcfd 100644
--- a/packageA/pages/goodsInfo/goodsInfo.wxml
+++ b/packageA/pages/goodsInfo/goodsInfo.wxml
@@ -602,7 +602,6 @@
- {{cartGoodsNum}}
购物车
diff --git a/packageE/pages/user/monthgiftbag/giftpackinfo/giftpackinfo.js b/packageE/pages/user/monthgiftbag/giftpackinfo/giftpackinfo.js
index eb488d5..6cbf12f 100644
--- a/packageE/pages/user/monthgiftbag/giftpackinfo/giftpackinfo.js
+++ b/packageE/pages/user/monthgiftbag/giftpackinfo/giftpackinfo.js
@@ -72,30 +72,30 @@ Page({
openSpecModal: 0,
sto_sele_name_1: '',
- share_goods_img:'', //礼包的分享图
- giftImageCover:null,
- canvasHidden:true,
- is_receive:0,
+ share_goods_img: '', //礼包的分享图
+ giftImageCover: null,
+ canvasHidden: true,
+ is_receive: 0,
screenWidth: 0,
- monthgiftbag:{},
- scene:"",
- keyword:'', //门店搜索
- sec_i:-1,//选中分类门店 下标
+ monthgiftbag: {},
+ scene: "",
+ keyword: '', //门店搜索
+ sec_i: -1,//选中分类门店 下标
},
onLoad: function (options) {
//定义第一次进入
- this.data.fir_in=1;
+ this.data.fir_in = 1;
var th = this;
console.log('分享参数---');
console.log(options);
if (options.lbId && !options.id) {
- options.id=options.lbId
- // options.lbId=options.id
+ options.id = options.lbId
+ // options.lbId=options.id
}
if (options.id) {
- options.lbId=options.id
- // options.lbId=options.id
+ options.lbId = options.id
+ // options.lbId=options.id
}
@@ -105,18 +105,18 @@ Page({
getStorageID: a.stoid,
})
- if(!options.lbId && options.scene){
+ if (!options.lbId && options.scene) {
var gid_str = decodeURIComponent(options.scene);
gid_str = gid_str.split("_");
- options.lbId=gid_str[0];
- options.id=gid_str[0];
- options.first_leader=gid_str[1];
- options.isBuy=1;
+ options.lbId = gid_str[0];
+ options.id = gid_str[0];
+ options.first_leader = gid_str[1];
+ options.isBuy = 1;
}
this.setData({
params: options,
- getGiftID:options.id
+ getGiftID: options.id
})
@@ -125,8 +125,8 @@ Page({
getGiftID: options.lbId,
orderSn: options.orderSn,
flag: options.flag, // 如果从商品详情页的促销处点击专享礼包跳转到此页,则flag为1
- record_list_id:options.record_list_id,
- is_receive:options.is_receive
+ record_list_id: options.record_list_id,
+ is_receive: options.is_receive
})
if (options.lbId) th.data.lbId = options.lbId;
//-- 获取分享人的ID --
@@ -141,7 +141,7 @@ Page({
getApp().request.promiseGet("/api/weshop/shoppingGuide/get/" + os.stoid + "/" + first_leader, {}).then(res => {
if (res.data.code == 0) {
getApp().globalData.guide_id = res.data.data.id;
- getApp().globalData.guide_pick_id= res.data.data.pickup_id
+ getApp().globalData.guide_pick_id = res.data.data.pickup_id
}
})
}
@@ -150,7 +150,7 @@ Page({
getApp().getConfig(function (e) {
- th.setData({sto_sele_name_1: e.store_name})
+ th.setData({ sto_sele_name_1: e.store_name })
})
getApp().getConfig2(function (e) {
@@ -171,10 +171,10 @@ Page({
}
});
- let monthgiftbag=wx.getStorageSync('monthgiftbag')
- let monthgiftba_defpick=wx.getStorageSync('monthgiftba_defpick')
+ let monthgiftbag = wx.getStorageSync('monthgiftbag')
+ let monthgiftba_defpick = wx.getStorageSync('monthgiftba_defpick')
var now = ut.gettimestamp();
- var isStart=0;
+ var isStart = 0;
// var str = res.data.data.starTime;
// if (start < now) isStart = 1;
// start = start / 1000;
@@ -188,32 +188,32 @@ Page({
// }
// this.setData({
- // isStart,
- // monthgiftbag,
- // sele_g:monthgiftbag,
- // def_pick_store:monthgiftba_defpick
+ // isStart,
+ // monthgiftbag,
+ // sele_g:monthgiftbag,
+ // def_pick_store:monthgiftba_defpick
// })
- let scene=wx.getLaunchOptionsSync().scene;
- if (scene==1154) {
+ let scene = wx.getLaunchOptionsSync().scene;
+ if (scene == 1154) {
this.setData({
- scene
+ scene
})
this.getList2()
- }
+ }
},
init() {
- var th=this;
+ var th = this;
//-- 检测一下有没有门店 --
- th.check_guide(function (){
- com.wait_for_store_config(th);
- com.set_user_mo_store(th, os, function () {
- if (th.data.sele_g.pickup_list && th.data.def_pick_store) {
- com.check_def_pk(th);
- }
- });
- com.get_sto(th, os);
- })
+ th.check_guide(function () {
+ com.wait_for_store_config(th);
+ com.set_user_mo_store(th, os, function () {
+ if (th.data.sele_g.pickup_list && th.data.def_pick_store) {
+ com.check_def_pk(th);
+ }
+ });
+ com.get_sto(th, os);
+ })
// this.GetBuyGiftList();
// if (this.data.flag == 1) {
// this.getZxlbDetails();
@@ -227,201 +227,210 @@ Page({
// }
},
- logTab(){
- wx.navigateTo({
- url: '/packageE/pages/togoin/togoin',
- })
+ logTab() {
+ wx.navigateTo({
+ url: '/packageE/pages/togoin/togoin',
+ })
},
getListInfo: function (e) {
- var th = this;
- getApp().request.get(`/api/weshop/marketing/marketingMonthgiftbagForm/get/${a.stoid}/${th.data.params.id}`, {
- isShowLoading: true,
- data: {
- // store_id: a.stoid, //商家ID
- // user_id: d.user_id, //用户ID
- // page: 1,
- // pageSize: 10,
- // is_end:0,
- // timetype:1,
- // id:th.data.params.id
- },
- success: function (res) {
- if (res.data.code == 0) {
- // th.data.curpage++;
- // var arr1 = th.data.wareCard;
- let obj = res.data.data;
- let monthgiftbag={
- remark:obj.remark,
- cover_img:obj.imageurl,
- giftTitle:obj.act_name,
- lbPrice:obj.oldPrice
- }
- let remark=monthgiftbag.remark.replace(/\
0){
- var monthgiftbag =arr2[0];
- var ismore = 0;
- // if (arr3.length == res.data.data.total) ismore = 1
- var isStart=0;
- if (monthgiftbag) {
- var start = monthgiftbag.begindate;
- let remark=monthgiftbag.remark.replace(/\
0) {
+ var monthgiftbag = arr2[0];
+ var ismore = 0;
+ // if (arr3.length == res.data.data.total) ismore = 1
+ var isStart = 0;
+ if (monthgiftbag) {
+ var start = monthgiftbag.begindate;
+ let remark = monthgiftbag.remark.replace(/\
0){
- var monthgiftbag =arr2[0];
- var ismore = 0;
- // if (arr3.length == res.data.data.total) ismore = 1
- var isStart=0;
- if (monthgiftbag) {
- var start = monthgiftbag.begindate;
- let remark=monthgiftbag.remark.replace(/\
0) {
+ var monthgiftbag = arr2[0];
+ var ismore = 0;
+ // if (arr3.length == res.data.data.total) ismore = 1
+ var isStart = 0;
+ if (monthgiftbag) {
+ var start = monthgiftbag.begindate;
+ let remark = monthgiftbag.remark.replace(/\
{
@@ -463,60 +472,63 @@ Page({
})
- if(th.data.back_ord){
+ if (th.data.back_ord) {
- var money=th.data.payMoney;
+ var money = th.data.payMoney;
var bk_url = "/packageE/pages/user/monthgiftbag/payment/payment?money=" + money + "&order_sn=" + th.data.back_ord;
//-- 通联的第三方支付的返回优化 --
- ut.is_pay_ok(th.data.back_ord,bk_url,"none",function (){
- if(!th.data.back_ord) return false;
+ ut.is_pay_ok(th.data.back_ord, bk_url, "none", function () {
+ if (!th.data.back_ord) return false;
getApp().request.promiseGet("/api/weshop/marketing/marketingMonthgiftbagRecord/page",
- {data:{store_id:os.stoid,order_sn:th.data.back_ord,user_id:getApp().globalData.user_id}}).then(res=>{
-
- if(ut.ajax_ok(res)){
- var item=res.data.data.pageData[0];
- if(item.pay_state==1){
- //支付支付,返回首页
- ut.m_toast('支付成功');
- th.data.back_ord=null;
- setTimeout(()=>{
- getApp().goto(bk_url);
- },1000)
-
- }else{
- //支付支付,返回首页
- ut.m_toast('支付失败');
- setTimeout(()=>{
- getApp().goto("/pages/index/index/index");
- },1000)
+ { data: { store_id: os.stoid, order_sn: th.data.back_ord, user_id: getApp().globalData.user_id } }).then(res => {
+
+ if (ut.ajax_ok(res)) {
+ var item = res.data.data.pageData[0];
+ if (item.pay_state == 1) {
+ //支付支付,返回首页
+ ut.m_toast('支付成功');
+ th.data.back_ord = null;
+ setTimeout(() => {
+ getApp().goto(bk_url);
+ }, 1000)
+
+ } else {
+ //支付支付,返回首页
+ ut.m_toast('支付失败');
+ setTimeout(() => {
+ getApp().goto("/pages/index/index/index");
+ }, 1000)
+ }
}
- }
- })
- },null,null,1);
+ })
+ }, null, null, 1);
- th.data.back_ord=null;
+ th.data.back_ord = null;
}
}, 1000)
}
+
+
+
},
GetBuyPrice: function (e) {
var that = this.data;
var th = this;
- let scene=this.data.scene;
- if (scene==1154) {
- wx.navigateTo({
- url: '/packageE/pages/togoin/togoin',
- })
- return
+ let scene = this.data.scene;
+ if (scene == 1154) {
+ wx.navigateTo({
+ url: '/packageE/pages/togoin/togoin',
+ })
+ return
}
- if (!d || !d.user_id ) {
+ if (!d || !d.user_id) {
getApp().my_warnning("请先登录", 0, th);
return false;
-
+
}
//如果还没有开始的话
if (th.data.isStart != 1) {
@@ -525,14 +537,14 @@ Page({
}
this.data.payMoney = th.data.sele_g.payMoney;
- th.setData({buyType: 2})
+ th.setData({ buyType: 2 })
if (th.data.sele_g.is_pickup) {
th.setData({
openSpecModal: 1
})
} else {
- if(this.data.submit) return false;
+ if (this.data.submit) return false;
var my_confirm = th.selectComponent("#my_confirm"); //组件的id
my_confirm.open(
"是否确定购买该礼包",
@@ -553,17 +565,17 @@ Page({
GetBuyIntegral: function (e) {
var that = this.data;
var th = this;
- let scene =this.data.scene;
- if (scene==1154) {
- wx.navigateTo({
- url: '/packageE/pages/togoin/togoin',
- })
- return
+ let scene = this.data.scene;
+ if (scene == 1154) {
+ wx.navigateTo({
+ url: '/packageE/pages/togoin/togoin',
+ })
+ return
}
- if (!d || !d.user_id ) {
+ if (!d || !d.user_id) {
getApp().my_warnning("请先登录", 0, th);
return false;
-
+
}
//如果还没有开始的话
@@ -572,7 +584,7 @@ Page({
return false;
}
- th.setData({buyType: 1});
+ th.setData({ buyType: 1 });
if (th.data.sele_g.is_pickup) {
th.setData({
openSpecModal: 1
@@ -607,17 +619,17 @@ Page({
},
success: function (res) {
if (res.data.code == 0) {
- console.log('商品------++')
- console.log(res)
+ console.log('商品------++')
+ console.log(res)
th.setData({
- giftImage: th.data.iurl + res.data.data.lbUrl,
- giftImageCover: th.data.iurl + (th.data.params.cover_img ? th.data.params.cover_img: res.data.data.lbUrl),
+ giftImage: th.data.iurl + res.data.data.lbUrl,
+ giftImageCover: th.data.iurl + (th.data.params.cover_img ? th.data.params.cover_img : res.data.data.lbUrl),
giftTitle: res.data.data.giftTitle,
default_color: res.data.data.bgcolor
})
if (res.data.data.iswarelbtype == 1) {
- th.setData({iswarelbtype: 1})
+ th.setData({ iswarelbtype: 1 })
}
if (!res.data.data.giftRemark || res.data.data.giftRemark == '') {
@@ -676,7 +688,7 @@ Page({
getApp().request.get("/api/weshop/pickup/get/" + os.stoid + "/" + res.data.data.pickup_id, {
success: function (res) {
if (res.data.code == 0) {
- th.setData({pick_up: res.data.data});
+ th.setData({ pick_up: res.data.data });
}
}
});
@@ -693,26 +705,26 @@ Page({
},
- check_guide(func){
- var first_leader=this.data.first_leader;
- if(!first_leader){
+ check_guide(func) {
+ var first_leader = this.data.first_leader;
+ if (!first_leader) {
func();
return false;
}
- if(this.data.is_geted_guide_pick){
+ if (this.data.is_geted_guide_pick) {
func();
return false;
}
- if(getApp().globalData.guide_pick_id){
+ if (getApp().globalData.guide_pick_id) {
func();
return false;
}
- var th=this;
+ var th = this;
getApp().request.promiseGet("/api/weshop/shoppingGuide/get/" + os.stoid + "/" + first_leader, {}).then(res => {
if (res.data.code == 0) {
- getApp().globalData.guide_pick_id= res.data.data.pickup_id;
+ getApp().globalData.guide_pick_id = res.data.data.pickup_id;
}
- th.data.is_geted_guide_pick=1;
+ th.data.is_geted_guide_pick = 1;
func();
})
},
@@ -730,8 +742,8 @@ Page({
success: function success(res) {
if (res.data.code == 0) {
_this2.setData({
- giftImage: th.iurl + res.data.data.lbUrl,
- giftImageCover: th.iurl + (_this2.data.params.cover_img ? _this2.data.params.cover_img: res.data.data.lbUrl),
+ giftImage: th.iurl + res.data.data.lbUrl,
+ giftImageCover: th.iurl + (_this2.data.params.cover_img ? _this2.data.params.cover_img : res.data.data.lbUrl),
// giftTitle: res.data.data.giftTitle,
giftTitle: res.data.data.lbTitle,
default_color: res.data.data.bgcolor
@@ -774,7 +786,7 @@ Page({
if (!sele_g.is_pickup) return false;
//-- 检测一下有没有门店 --
- _this2.check_guide(function (){
+ _this2.check_guide(function () {
com.wait_for_store_config(_this2);
com.set_user_mo_store(_this2, os, function () {
if (sele_g.pickup_list && _this2.data.def_pick_store) {
@@ -807,7 +819,7 @@ Page({
if (res.data.code == 0) {
th.setData({
giftImage: th.data.iurl + res.data.data.lbUrl,
- giftImageCover: th.data.iurl + (th.data.params.cover_img ? th.data.params.cover_img: res.data.data.lbUrl),
+ giftImageCover: th.data.iurl + (th.data.params.cover_img ? th.data.params.cover_img : res.data.data.lbUrl),
giftTitle: res.data.data.lbTitle,
default_color: res.data.data.bgcolor
})
@@ -951,7 +963,7 @@ Page({
onShareAppMessage: function (e) {
getApp().globalData.no_clear = 1;
- var ee=this;
+ var ee = this;
var curPage = this;
var pagePath = curPage.route; //当前页面url
if (pagePath.indexOf('/') != 0) {
@@ -959,7 +971,7 @@ Page({
}
- pagePath += "?isBuy=1" + "&id=" + this.data.sele_g.id + "&first_leader=" + this.data.getUserID;
+ pagePath += "?isBuy=1" + "&id=" + this.data.sele_g.id + "&first_leader=" + this.data.getUserID;
console.log('分享路径');
console.log(pagePath);
// if (this.data.isBuy == 0) {
@@ -969,7 +981,7 @@ Page({
// }
// console.log('pagePath', pagePath);
- var img =ee.data.iurl+(ee.data.sele_g.cover_img ? ee.data.sele_g.cover_img : ee.data.giftImage);
+ var img = ee.data.iurl + (ee.data.sele_g.cover_img ? ee.data.sele_g.cover_img : ee.data.giftImage);
return {
@@ -985,12 +997,12 @@ Page({
onShareTimeline() {
getApp().globalData.no_clear = 1;
- var ee=this;
+ var ee = this;
var pagePath = "&isBuy=1" + "&id=" + this.data.sele_g.id + "&first_leader=" + this.data.getUserID;
var user_id = getApp().globalData.user_id;
if (!user_id) user_id = 0;
- var img =ee.data.iurl+(ee.data.sele_g.cover_img ? ee.data.sele_g.cover_img : ee.data.giftImage);
+ var img = ee.data.iurl + (ee.data.sele_g.cover_img ? ee.data.sele_g.cover_img : ee.data.giftImage);
return {
title: "礼包详情",
@@ -1008,7 +1020,7 @@ Page({
getApp().my_warnning("活动还没有开始", 0, th);
return false;
}
- th.setData({buyType: 3});
+ th.setData({ buyType: 3 });
if (th.data.sele_g.is_pickup) {
th.setData({
openSpecModal: 1
@@ -1031,145 +1043,145 @@ Page({
},
- //获取搜索门店输入的值
- input_store: function(e) {
- this.setData({
- keyword: e.detail.value
- })
- },
- //搜索门店
- searchfn(){
- let choice_sort_store = this.data.choice_sort_store
- if (choice_sort_store==0) { //全局搜索
- let all_pick_list = this.data.all_pick_list
- let def_pickpu_list = this.data.def_pickpu_list
- let keyword = this.data.keyword
- if (keyword) {
- let arr=all_pick_list.filter( item =>{
- let i = item.pickup_name.indexOf(keyword)
- if (i > -1) {
- return true
- }else{
- return false
- }
- })
- if (arr && arr.length>0) {
- if(this.data.is_show_sto_cat==1){
- this.setData({
- def_pickpu_list:arr
- })
- }else{
- this.setData({
- only_pk:arr
- })
- }
- }else{
- wx.showToast({
- title: '没有搜索到门店',
- icon: 'none',
- duration: 2000
- })
- }
- }else{
- if (this.data.is_show_sto_cat==1) {
- this.setData({
- def_pickpu_list:all_pick_list.slice(0,10)
- })
- }else{
- this.setData({
- only_pk:all_pick_list
- })
- }
-
- }
- }else{ //分类下搜索
- let sec_i=this.data.sec_i
- let all_sto = this.data.all_sto
- let old_all_sto = this.data.old_all_sto
- if (!old_all_sto) {
+ //获取搜索门店输入的值
+ input_store: function (e) {
this.setData({
- old_all_sto:JSON.parse(JSON.stringify(all_sto))
+ keyword: e.detail.value
})
- }
- let sec_sto= this.data.sec_sto
- let sec_arr = this.data.old_all_sto[sec_i].s_arr
- let keyword = this.data.keyword
- let text='sec_sto.s_arr'
- if (keyword) {
- let arr=sec_arr.filter( item =>{
- let i = item.pickup_name.indexOf(keyword)
- if (i > -1) {
- return true
- }else{
- return false
+ },
+ //搜索门店
+ searchfn() {
+ let choice_sort_store = this.data.choice_sort_store
+ if (choice_sort_store == 0) { //全局搜索
+ let all_pick_list = this.data.all_pick_list
+ let def_pickpu_list = this.data.def_pickpu_list
+ let keyword = this.data.keyword
+ if (keyword) {
+ let arr = all_pick_list.filter(item => {
+ let i = item.pickup_name.indexOf(keyword)
+ if (i > -1) {
+ return true
+ } else {
+ return false
+ }
+ })
+ if (arr && arr.length > 0) {
+ if (this.data.is_show_sto_cat == 1) {
+ this.setData({
+ def_pickpu_list: arr
+ })
+ } else {
+ this.setData({
+ only_pk: arr
+ })
+ }
+ } else {
+ wx.showToast({
+ title: '没有搜索到门店',
+ icon: 'none',
+ duration: 2000
+ })
+ }
+ } else {
+ if (this.data.is_show_sto_cat == 1) {
+ this.setData({
+ def_pickpu_list: all_pick_list.slice(0, 10)
+ })
+ } else {
+ this.setData({
+ only_pk: all_pick_list
+ })
+ }
+
}
- })
- if (arr && arr.length>0) {
- this.setData({
- [text]:arr
- })
- }else{
- wx.showToast({
- title: '没有搜索到门店',
- icon: 'none',
- duration: 2000
- })
- }
- }else{
- if(this.data.old_all_sto){
- this.setData({
- [text]: this.data.old_all_sto[sec_i].s_arr
- })
- }else{
- this.setData({
- [text]: all_sto[sec_i].s_arr
- })
- }
+ } else { //分类下搜索
+ let sec_i = this.data.sec_i
+ let all_sto = this.data.all_sto
+ let old_all_sto = this.data.old_all_sto
+ if (!old_all_sto) {
+ this.setData({
+ old_all_sto: JSON.parse(JSON.stringify(all_sto))
+ })
+ }
+ let sec_sto = this.data.sec_sto
+ let sec_arr = this.data.old_all_sto[sec_i].s_arr
+ let keyword = this.data.keyword
+ let text = 'sec_sto.s_arr'
+ if (keyword) {
+ let arr = sec_arr.filter(item => {
+ let i = item.pickup_name.indexOf(keyword)
+ if (i > -1) {
+ return true
+ } else {
+ return false
+ }
+ })
+ if (arr && arr.length > 0) {
+ this.setData({
+ [text]: arr
+ })
+ } else {
+ wx.showToast({
+ title: '没有搜索到门店',
+ icon: 'none',
+ duration: 2000
+ })
+ }
+ } else {
+ if (this.data.old_all_sto) {
+ this.setData({
+ [text]: this.data.old_all_sto[sec_i].s_arr
+ })
+ } else {
+ this.setData({
+ [text]: all_sto[sec_i].s_arr
+ })
+ }
- }
+ }
- }
- },
-
- getGift(){
- var that=this;
-
- var json = {
- // "actId": '', //活动Id
- // "actType": '', //活动类型 1:新人礼、2:评价有礼、3:节日营销、4:生日营销
- // "buyType":""+that.data.buyType, //1=积分兑换 2=余额购买
- // "giftBagId": id, //每月礼包主表id
- // "buyFrom": 2,
- "id":that.data.record_list_id,// "记录Id",
- "storeId": that.data.getStorageID, //商家Id
- "userId": that.data.getUserID, //用户ID
- };
+ }
+ },
+
+ getGift() {
+ var that = this;
+
+ var json = {
+ // "actId": '', //活动Id
+ // "actType": '', //活动类型 1:新人礼、2:评价有礼、3:节日营销、4:生日营销
+ // "buyType":""+that.data.buyType, //1=积分兑换 2=余额购买
+ // "giftBagId": id, //每月礼包主表id
+ // "buyFrom": 2,
+ "id": that.data.record_list_id,// "记录Id",
+ "storeId": that.data.getStorageID, //商家Id
+ "userId": that.data.getUserID, //用户ID
+ };
// var url ="/api/weshop/marketing/buy/receive/gift/record/insert";
// var url ="/api/weshop/marketing/marketingMonthgiftbagRecord/createOrder";
- var url ="/api/weshop/marketing/marketingMonthgiftbagRecord/recordReceive";
+ var url = "/api/weshop/marketing/marketingMonthgiftbagRecord/recordReceive";
getApp().request.json_post(url, json,
function (res) {
- console.log('领取礼包');
- console.log(res);
+ console.log('领取礼包');
+ console.log(res);
if (res.data.code == 0 && res.data.data) {
- that.setData({
- is_receive:1
- })
- getApp().my_warnning("领取成功!", 1, that);
- that.closeSpecModal();
- setTimeout(()=>{
- wx.navigateBack({
- delta: 0,
+ that.setData({
+ is_receive: 1
})
- },500)
+ getApp().my_warnning("领取成功!", 1, that);
+ that.closeSpecModal();
+ setTimeout(() => {
+ wx.navigateBack({
+ delta: 0,
+ })
+ }, 500)
} else {
- that.setData({submit:0})
+ that.setData({ submit: 0 })
getApp().my_warnning(res.data.msg, 0, that);
}
},
function (res) {
- that.setData({submit:0})
+ that.setData({ submit: 0 })
}
)
},
@@ -1189,7 +1201,7 @@ Page({
// 选择门店
choice_store: function (ee) {
this.setData({
- keyword:''
+ keyword: ''
})
//--先判断会员状态--
@@ -1342,7 +1354,7 @@ Page({
region_name: region_name,
sort_store: 0,
choice_sort_store: 1,
- sec_i:index,
+ sec_i: index,
sec_sto: item,
sec_pick_index: 0
});
@@ -1368,7 +1380,7 @@ Page({
if (th.data.is_show_sto_cat == 1) {
item = th.data.def_pickpu_list[index];
} else {
- item = th.data.only_pk?th.data.only_pk[index]:null; //当没有门店分类的时候
+ item = th.data.only_pk ? th.data.only_pk[index] : null; //当没有门店分类的时候
}
} else {
@@ -1376,7 +1388,7 @@ Page({
item = th.data.sec_sto.s_arr[index];
}
- if(!item) return false;
+ if (!item) return false;
if (!th.data.sele_g) return false;
@@ -1412,14 +1424,14 @@ Page({
if (th.data.is_show_sto_cat == 1) {
item = th.data.def_pickpu_list[index];
} else {
- item = th.data.only_pk?th.data.only_pk[index]:null; //当没有门店分类的时候
+ item = th.data.only_pk ? th.data.only_pk[index] : null; //当没有门店分类的时候
}
} else {
var index = th.data.sec_pick_index;
item = th.data.sec_sto.s_arr[index];
}
- if(!item) return false;
+ if (!item) return false;
th.setData({
def_pick_store: item,
@@ -1454,7 +1466,7 @@ Page({
},
closeSpecModal: function () {
- this.setData({openSpecModal: 0});
+ this.setData({ openSpecModal: 0 });
},
buy_libao: function () {
@@ -1496,10 +1508,10 @@ Page({
// }
if (this.data.share_hidden) {
- this.setData({share_hidden: false,});
+ this.setData({ share_hidden: false, });
}
- wx.showLoading({title: '生成中...',})
+ wx.showLoading({ title: '生成中...', })
var that = this, th = that;
//设置画板显示,才能开始绘图
that.setData({
@@ -1639,29 +1651,29 @@ Page({
context.setFontSize(32 * unit);
context.setFillStyle('#DE1117');
- var price_txt="";
- if(price || giftIntegral){
- if(price){
- price_txt='¥' + price;
- if(giftIntegral){
- if(this.data.sele_g.money_type>0){
- price_txt+='+';
- }else{
- price_txt+='或';
- }
- }
- }
- if(giftIntegral) price_txt+=giftIntegral+'积分';
- }else{
- price_txt="免费领取";
+ var price_txt = "";
+ if (price || giftIntegral) {
+ if (price) {
+ price_txt = '¥' + price;
+ if (giftIntegral) {
+ if (this.data.sele_g.money_type > 0) {
+ price_txt += '+';
+ } else {
+ price_txt += '或';
+ }
+ }
+ }
+ if (giftIntegral) price_txt += giftIntegral + '积分';
+ } else {
+ price_txt = "免费领取";
}
context.fillText(price_txt, 54 * unit, 735 * unit);
- var wp= 62 * unit;
- var hp=765 * unit
- this.draw_pos_price(context,wp,hp,this.giftPosPrice,unit);
+ var wp = 62 * unit;
+ var hp = 765 * unit
+ this.draw_pos_price(context, wp, hp, this.giftPosPrice, unit);
// 8.商品标题
context.setFontSize(20 * unit);
@@ -1683,16 +1695,16 @@ Page({
//---市场价划掉---
- draw_pos_price(context,w,h,market_price,unit){
+ draw_pos_price(context, w, h, market_price, unit) {
- if(!this.is_retail_price) return false;
+ if (!this.is_retail_price) return false;
context.setFillStyle("gray")
context.setFontSize(22 * unit)
var pri0 = "¥" + market_price.toFixed(2);
context.fillText(pri0, w, h);
- var c_h=h-6;
+ var c_h = h - 6;
context.setStrokeStyle('gray');
context.setLineWidth(1 * unit);
context.moveTo(w - 5, c_h);
@@ -1708,7 +1720,7 @@ Page({
tt();
return false;
}
- var img_url =ee.data.iurl+(ee.data.sele_g.cover_img ? ee.data.sele_g.cover_img : ee.data.giftImage);
+ var img_url = ee.data.iurl + (ee.data.sele_g.cover_img ? ee.data.sele_g.cover_img : ee.data.giftImage);
//获取商品是分享图信息
wx.getImageInfo({
@@ -1721,8 +1733,8 @@ Page({
fail: function (res) {
//获取默认空白图
wx.getImageInfo({
- src: ee.data.iurl+'/miniapp/images/default_g_img.gif',
- success: function(res) {
+ src: ee.data.iurl + '/miniapp/images/default_g_img.gif',
+ success: function (res) {
ee.data.share_goods_img = res.path; //分享的图片不能用网络的
tt();
}
@@ -1742,13 +1754,39 @@ Page({
},
// 预览海报
previewPoster() {
- getApp().globalData.no_clear=1;
+ getApp().globalData.no_clear = 1;
wx.previewImage({
current: this.data.shareImgPath, // 当前显示图片的http链接
- urls: [this.data.shareImgPath] ,// 需要预览的图片http链接列表
+ urls: [this.data.shareImgPath],// 需要预览的图片http链接列表
});
},
+ //-- 获取从表的信息 --
+ get_lb_list() {
+ let th = this;
+ getApp().request.promiseGet("/api/weshop/marketing/marketingMonthgiftbagList/page", {
+ data: {
+ store_id:os.stoid,
+ form_id:th.data.params.id,
+ pageSize:50
+ },
+ }).then(res => {
+ if(ut.ajax_ok(res)){
+ th.setData({
+ wareCard:res.data.data.pageData
+ })
+ }
+ })
+ },
+
+
+ //不销毁界面跳转
+ navigateTo: function (e) {
+ var url = e.currentTarget.dataset.url;
+ getApp().goto(url);
+ }
+
+
});
\ No newline at end of file
diff --git a/packageE/pages/user/monthgiftbag/giftpackinfo/giftpackinfo.wxml b/packageE/pages/user/monthgiftbag/giftpackinfo/giftpackinfo.wxml
index 2a63c2f..428e49c 100644
--- a/packageE/pages/user/monthgiftbag/giftpackinfo/giftpackinfo.wxml
+++ b/packageE/pages/user/monthgiftbag/giftpackinfo/giftpackinfo.wxml
@@ -78,70 +78,41 @@
-->
-
+
礼包内容
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- {{item.couponName}}
-
-
-
-
-
-
- {{"数量:"+item.num}}
-
-
-
- 已核销
-
-
- 未核销
-
-
-
-
-
+
+
+
-
-
-
+
-
-
-
-
-
-
-
- 奖励已发放
-
+
+
+
+ {{item.lbtitle}}
+
+
+
+ {{"零售价:"+item.oldprice}}
+
+
+
+
+ 第{{index+1}}个月 >
+
+
+
+
-
-
-
+
+