diff --git a/app.js b/app.js
index b0e9e50..f600247 100644
--- a/app.js
+++ b/app.js
@@ -107,59 +107,59 @@ App({
var app = this;
if (!app.globalData.userInfo) {
- var user = wx.getStorageSync("userinfo");
- if (user && user.user_id) {
-
- //--生成会员 --
- app.promiseGet("/api/weshop/users/get/" + user.store_id + "/" + user.user_id, {}).then(res => {
-
- app.globalData.is_get_login=1;
-
- if (res.data.code == 0) {
-
- user = res.data.data;
- //-- 小程序会员被解绑了,就要清空会员 --
- if (user['is_weappuser'] == 0) {
- user = null;
- app.globalData.userInfo = null;
- app.globalData.user_id = 0;
- } else {
- app.globalData.userInfo = user;
- app.globalData.user_id = user.user_id;
-
- //调用接口判断是不是会员
- app.promiseGet("/api/weshop/shoppingGuide/get/" + os.stoid + "/" + user.user_id, {}).then(res => {
- if (res.data.code == 0) {
- getApp().globalData.guide_id = res.data.data.id;
- }
- })
- app.promiseGet("/api/weshop/users/getAndUpdateUser/" +user.store_id + "/" + user.user_id, {})
-
- }
- wx.setStorageSync("userinfo", user);
- } else {
- user = null;
- app.globalData.userInfo = null;
- app.globalData.user_id = 0;
- wx.setStorageSync("userinfo", null);
- }
- })
- }
- else if(app.globalData.user_id){ //-- 启用默认的user_id --
-
- app.promiseGet("/api/weshop/users/get/" + app.globalData.setting.stoid + "/" + app.globalData.user_id,{}).then(res=>{
- app.globalData.is_get_login=1;
- if(res.data.code==0){
- app.globalData.userInfo = res.data.data;
- wx.setStorageSync("userinfo",app.globalData.userInfo);
- //刷一下导购
- app.promiseGet("/api/weshop/users/getAndUpdateUser/" +app.globalData.setting.stoid + "/" + app.globalData.user_id, {})
- }
- })
- }
- else {
- //--拿下code--
- wx.login({
+ // var user = wx.getStorageSync("userinfo");
+ // if (user && user.user_id) {
+ //
+ // //--生成会员 --
+ // app.promiseGet("/api/weshop/users/get/" + user.store_id + "/" + user.user_id, {}).then(res => {
+ //
+ // app.globalData.is_get_login=1;
+ //
+ // if (res.data.code == 0) {
+ //
+ // user = res.data.data;
+ // //-- 小程序会员被解绑了,就要清空会员 --
+ // if (user['is_weappuser'] == 0) {
+ // user = null;
+ // app.globalData.userInfo = null;
+ // app.globalData.user_id = 0;
+ // } else {
+ // app.globalData.userInfo = user;
+ // app.globalData.user_id = user.user_id;
+ //
+ // //调用接口判断是不是会员
+ // app.promiseGet("/api/weshop/shoppingGuide/get/" + os.stoid + "/" + user.user_id, {}).then(res => {
+ // if (res.data.code == 0) {
+ // getApp().globalData.guide_id = res.data.data.id;
+ // }
+ // })
+ // app.promiseGet("/api/weshop/users/getAndUpdateUser/" +user.store_id + "/" + user.user_id, {})
+ //
+ // }
+ // wx.setStorageSync("userinfo", user);
+ // } else {
+ // user = null;
+ // app.globalData.userInfo = null;
+ // app.globalData.user_id = 0;
+ // wx.setStorageSync("userinfo", null);
+ // }
+ // })
+ // }
+ // else if(app.globalData.user_id){ //-- 启用默认的user_id --
+ //
+ // app.promiseGet("/api/weshop/users/get/" + app.globalData.setting.stoid + "/" + app.globalData.user_id,{}).then(res=>{
+ // app.globalData.is_get_login=1;
+ // if(res.data.code==0){
+ // app.globalData.userInfo = res.data.data;
+ // wx.setStorageSync("userinfo",app.globalData.userInfo);
+ // //刷一下导购
+ // app.promiseGet("/api/weshop/users/getAndUpdateUser/" +app.globalData.setting.stoid + "/" + app.globalData.user_id, {})
+ // }
+ // })
+ // }
+ // else {
+ //--拿下code--
+ wx.login({
success: function (o) {
var dd = {
js_code: o.code,
@@ -186,7 +186,8 @@ App({
app.globalData.openid = e.data.data.weapp_openid;
//把会员的信息存在内存
wx.setStorageSync("userinfo", e.data.data);
-
+ //刷一下导购
+ app.promiseGet("/api/weshop/users/getAndUpdateUser/" +app.globalData.setting.stoid + "/" + app.globalData.user_id, {})
//调用接口判断是不是会员
app.promiseGet("/api/weshop/shoppingGuide/get/" + os.stoid + "/" + e.data.data.user_id, {}).then(res => {
if (res.data.code == 0) {
@@ -202,7 +203,7 @@ App({
})
}
})
- }
+ //}
}
diff --git a/packageA/pages/profile/profile.js b/packageA/pages/profile/profile.js
index e6e0813..d376715 100644
--- a/packageA/pages/profile/profile.js
+++ b/packageA/pages/profile/profile.js
@@ -79,6 +79,11 @@ Page({
loading: 0,
oldBirtthDayLength:0, //生日日期个数
oldbirthday:'',//生日日期
+
+ all_pick_list:null, //所有的门店的集合
+ old_all_sto:null,
+ keyword:'', //搜索门店的关键字
+ sec_i:-1
},
//通过路径跳转到其他页面
goto: function (e) {
@@ -267,8 +272,8 @@ Page({
if (e.data.code == 0 && e.data.data && e.data.data.pageData && e.data.data.pageData.length > 0) {
var ishas_cate = 0;
- for (let i in e) {
- let item = e[i];
+ for (let i in e.data.data.pageData) {
+ let item = e.data.data.pageData[i];
if (item.category_id > 0) {
ishas_cate = 1;
break;
@@ -286,6 +291,10 @@ Page({
e.data.data.pageData.splice(0, 0, th.data.def_pick_store); //添加
}
+ th.setData({
+ all_pick_list: e.data.data.pageData
+ });
+
//单总量超出5个的时候
if (e.data.data.total > 10 && ishas_cate) {
i.get("/api/weshop/storagecategory/page", {
@@ -465,7 +474,8 @@ Page({
sort_store: 0,
choice_sort_store: 1,
sec_sto: item,
- sec_pick_index: 0
+ sec_pick_index: 0,
+ sec_i: index,
});
},
// 返回按钮
@@ -1547,5 +1557,106 @@ 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) {
+ 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
+ })
+ }
+ }
+
+
+ }
+ },
+
});
\ No newline at end of file
diff --git a/packageA/pages/profile/profile.wxml b/packageA/pages/profile/profile.wxml
index a479371..fe78c56 100644
--- a/packageA/pages/profile/profile.wxml
+++ b/packageA/pages/profile/profile.wxml
@@ -232,6 +232,14 @@
+
+
+
+
+ 搜索
+
+
+
diff --git a/packageA/pages/profile/profile.wxss b/packageA/pages/profile/profile.wxss
index 66821d4..d402f98 100644
--- a/packageA/pages/profile/profile.wxss
+++ b/packageA/pages/profile/profile.wxss
@@ -723,3 +723,28 @@ checkbox .wx-checkbox-input.wx-checkbox-input-checked::before {
content: '*';
color: #C4182E;
}
+
+
+.searchbar {
+ height: 95rpx;
+ border-bottom: 2rpx solid rgb(238, 238, 238);
+}
+.storeListpadd {
+ padding: 0rpx 31rpx;
+}
+.search {
+ width: 125rpx;
+ height: 45rpx;
+ line-height: 45rpx;
+ background-color: rgb(219, 27, 52);
+ border-radius: 30rpx;
+ color: rgb(255, 255, 255);
+}
+.inputstore {
+ width: 510rpx;
+ height: 43rpx;
+ line-height: 43rpx;
+ border-radius: 30rpx;
+ border: 2rpx solid rgb(238, 238, 238);
+ padding-left: 30rpx;
+}
\ No newline at end of file
diff --git a/packageE/pages/cart/cart2/cart2.js b/packageE/pages/cart/cart2/cart2.js
index 9562563..bb4b3ea 100644
--- a/packageE/pages/cart/cart2/cart2.js
+++ b/packageE/pages/cart/cart2/cart2.js
@@ -186,6 +186,7 @@ Page({
can_use_ord_prom: {},
//存储订单促销的取价,按照门店进行索引
show_ord_prom: {},
+
sameCityExp_off: 0, //未达到起送价
sameCityExp_info: '',//未达到起送价提示信息
first_entry: 0,//进入次数,如果是第一次进入,进行判断是否进行优惠券是否直接使用
@@ -1001,6 +1002,8 @@ Page({
var new_arr = [];
for (var ir = 0; ir < carr.length; ir++) {
+ carr[ir].collocationList = null;
+
var c_ok = 1;
if (old_prom && (carr[ir].prom_type != old_prom.prom_type || carr[ir].prom_id != old_prom.prom_id)) {
c_ok = 0;
@@ -1075,11 +1078,6 @@ Page({
}
}
-
-
- if (is_change) {
- carr[iv].collocationList = null;
- }
}
//-- 对商品的多促销进行判断 ---2024-2-1--
if (dug_cx_arr.length) {
@@ -5614,6 +5612,21 @@ Page({
goods.prom_id = g_item.prom_id;
break;
case 3:
+
+ //判断一个优惠促销商品用户参与的问题
+ let grs= await getApp().request.promiseGet("/api/weshop/promgoods/getUser/" + oo.stoid + "/" + g_item.prom_id+"/"+ getApp().globalData.user_id, {});
+ if(!grs || grs.data.code==-1){
+ let error_ts=goods.goods_name + "未找到优惠促销活动";
+ if(grs && grs.data.msg.indexOf('无权限')>-1){
+ error_ts=goods.goods_name + "无权限参与优惠促销活动";
+ }
+
+ getApp().confirmBox(error_ts);
+ th.data.is_summit_ing = 0;
+ th.setData({ submit: 0 })
+ return false;
+ }
+
goods.prom_type = 3;
goods.prom_id = g_item.prom_id;
if (g_item.is_gift) {
diff --git a/packageG/pages/user/userinfo/userinfo.js b/packageG/pages/user/userinfo/userinfo.js
index b4b0803..afd3a80 100644
--- a/packageG/pages/user/userinfo/userinfo.js
+++ b/packageG/pages/user/userinfo/userinfo.js
@@ -81,6 +81,10 @@ Page({
showvipcode:false,
+ all_pick_list:null, //所有的门店的集合
+ old_all_sto:null,
+ keyword:'', //搜索门店的关键字
+ sec_i:-1
},
//通过路径跳转到其他页面
goto: function(e) {
@@ -350,6 +354,11 @@ Page({
}
e.data.data.pageData.splice(0, 0, th.data.def_pick_store); //添加
}
+
+
+ th.setData({
+ all_pick_list: e.data.data.pageData
+ });
//单总量超出5个的时候
if (e.data.data.total > 10) {
@@ -527,7 +536,8 @@ Page({
sort_store: 0,
choice_sort_store: 1,
sec_sto: item,
- sec_pick_index: 0
+ sec_pick_index: 0,
+ sec_i: index,
});
},
// 返回按钮
@@ -1111,7 +1121,108 @@ 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) {
+ 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
+ })
+ }
+ }
+
+
+ }
+ },
});
\ No newline at end of file
diff --git a/packageG/pages/user/userinfo/userinfo.wxml b/packageG/pages/user/userinfo/userinfo.wxml
index 00744c9..e9724f7 100644
--- a/packageG/pages/user/userinfo/userinfo.wxml
+++ b/packageG/pages/user/userinfo/userinfo.wxml
@@ -344,6 +344,14 @@
+
+
+
+
+ 搜索
+
+
+
diff --git a/packageG/pages/user/userinfo/userinfo.wxss b/packageG/pages/user/userinfo/userinfo.wxss
index 1369b89..99316f2 100644
--- a/packageG/pages/user/userinfo/userinfo.wxss
+++ b/packageG/pages/user/userinfo/userinfo.wxss
@@ -674,4 +674,29 @@ input {
align-items: center;
justify-content: center;
/* margin-top: 20rpx; */
+}
+
+
+.searchbar {
+ height: 95rpx;
+ border-bottom: 2rpx solid rgb(238, 238, 238);
+}
+.storeListpadd {
+ padding: 0rpx 31rpx;
+}
+.search {
+ width: 125rpx;
+ height: 45rpx;
+ line-height: 45rpx;
+ background-color: rgb(219, 27, 52);
+ border-radius: 30rpx;
+ color: rgb(255, 255, 255);
+}
+.inputstore {
+ width: 510rpx;
+ height: 43rpx;
+ line-height: 43rpx;
+ border-radius: 30rpx;
+ border: 2rpx solid rgb(238, 238, 238);
+ padding-left: 30rpx;
}
\ No newline at end of file
diff --git a/pages/activity/pind_list/pind_list.js b/pages/activity/pind_list/pind_list.js
index 55ee6dd..e08081e 100644
--- a/pages/activity/pind_list/pind_list.js
+++ b/pages/activity/pind_list/pind_list.js
@@ -120,25 +120,50 @@ Page({
var o = endTimeList[i];
var endTime = o.end_time;
if(th.data.type==0) endTime = o.start_time;
- let obj = null;
- // 如果活动未结束,对时间进行处理
- if (endTime - newTime > 0){
- let time = (endTime - newTime);
- // 获取天、时、分、秒
- let day = parseInt(time / (60 * 60 * 24));
- let hou = parseInt(time % (60 * 60 * 24) / 3600);
- let min = parseInt(time % (60 * 60 * 24) % 3600 / 60);
- let sec = parseInt(time % (60 * 60 * 24) % 3600 % 60);
- obj = {
- day: this.timeFormat(day), hou: this.timeFormat(hou), min: this.timeFormat(min), sec: this.timeFormat(sec),hide:1
+
+ // 创建查询对象
+ let query = wx.createSelectorQuery();
+ // 获取目标元素,并获取目标元素的信息
+ query.select("#kill-item"+i).boundingClientRect();
+ // 获取视口,并获取视口信息
+ query.selectViewport().boundingClientRect();
+ //-- 执行查询,元素要在显示中的才显示定时器 --
+ query.exec(([target, view]) => {
+
+ if (!th.data.is_timer) return;
+ if (!target) return;
+ if (!target.id) return;
+ let idx= target.id.replace('kill-item','');
+ // 条件1:当目标顶部距离视口顶部距离小于视口的高度时
+ // 条件2:当目标底部距离视口顶部距离大于0时
+ // 当以上两个条件同时成立时,目标元素在视口中
+ if (target.top < view.height && target.bottom > 0) {
+
+ let obj = null;
+ // 如果活动未结束,对时间进行处理
+ if (endTime - newTime > 0) {
+ let time = (endTime - newTime);
+ // 获取天、时、分、秒
+ let day = parseInt(time / (60 * 60 * 24));
+ let hou = parseInt(time % (60 * 60 * 24) / 3600);
+ let min = parseInt(time % (60 * 60 * 24) % 3600 / 60);
+ let sec = parseInt(time % (60 * 60 * 24) % 3600 % 60);
+ obj = {
+ day: this.timeFormat(day),
+ hou: this.timeFormat(hou),
+ min: this.timeFormat(min),
+ sec: this.timeFormat(sec),
+ hide: 1
+ }
+ } else {
+ //活动已结束,全部设置为'00'
+ obj = {day: '00', hou: '00', min: '00', sec: '00'}
}
- }else{
- //活动已结束,全部设置为'00'
- obj = { day: '00', hou: '00', min: '00', sec: '00' }
- }
- var txt ="goodlist["+i+"].djs";
- th.setData({ [txt]: obj});
- }
+ var txt = "goodlist[" + idx + "].djs";
+ th.setData({[txt]: obj});
+ }
+ });
+ }
},
//读取数据
diff --git a/pages/activity/pind_list/pind_list.wxml b/pages/activity/pind_list/pind_list.wxml
index ecf2ad0..685bd2e 100644
--- a/pages/activity/pind_list/pind_list.wxml
+++ b/pages/activity/pind_list/pind_list.wxml
@@ -28,7 +28,7 @@
-
+
diff --git a/pages/cart/cart/cart.js b/pages/cart/cart/cart.js
index 5f81db5..be71a7f 100644
--- a/pages/cart/cart/cart.js
+++ b/pages/cart/cart/cart.js
@@ -497,7 +497,6 @@ Page({
th.setData({
requestData: [],
all_num: 0,
- is_load: 1,
is_edit: 0,
checkAllToggle:0
}),wx.stopPullDownRefresh();
@@ -1038,7 +1037,7 @@ Page({
//获取秒杀
if(item.prom_type==1) {
await getApp().request.promiseGet('/api/ms/flash_sale/getNew/' + os.stoid + '/' + user_id + '/' + item.prom_id, {}).then(res => {
- if (res.data.code == 0) {
+ if (res.data.code == 0 && res.data.data) {
prom = res.data.data;
prom.price = prom.user_price;
}
@@ -1085,7 +1084,7 @@ Page({
}
})
}
- if (msNum && (msNum >= prom.buy_limit)) {
+ if (msNum && (msNum >= prom.buy_limit && prom.buy_limit>0)) {
console.log('秒杀限购')
th.disInvalid({
...item,
@@ -2102,7 +2101,7 @@ Page({
//判断多门店,优惠促销次数的控制
async multiple_stores_pro(pitems, item) {
- if(!this.data.requestData || !this.data.requestData[pitems]) return false
+ if(!this.data.requestData || !this.data.requestData[pitems] || !this.data.requestData[pitems].goods) return false
let a = this.data.requestData[pitems].goods[item];
let th = this
@@ -2317,7 +2316,7 @@ Page({
// return false;
// }
- var txt0 = "requestData[" + pitems + "].show_can_cx";
+ var txt0 = "requestData[" + pitems + "].show_can_cx1";
e.setData({
[txt0]: {},
});
@@ -2348,6 +2347,7 @@ Page({
title: the_res.msg,
icon: 'none',
});
+ th.clear_clicking();
}
})
@@ -2624,7 +2624,6 @@ Page({
[txt]: prom_goodsbuynum
});
-
}
}
if (item[c].prom_type == 10) {
@@ -2702,11 +2701,6 @@ Page({
-
-
-
-
-
//总的价格,把组合商品的价格拿出来
var zh_calc_res = zh_calc.calculate_zh(car, a, th);
console.log('.组合价-----------')
@@ -3179,7 +3173,7 @@ Page({
var buylimit = 0
if(t.prom_type==1) {
await getApp().request.promiseGet("/api/ms/flash_sale/getNew/" + t.store_id + "/" + getApp().globalData.user_id + "/" + t.prom_id, {}).then(res => {
- if (res.data.code == 0) {
+ if (res.data.code == 0 && res.data.data) {
th.data.sele_g = res.data.data;
th.data.sele_g.viplimited = res.data.data.buy_limit;
buylimit = !res.data.data.buy_limit ? 0 : res.data.data.buy_limit;
@@ -3812,6 +3806,7 @@ Page({
var et= {"prom_type":i_arr[j].prom_type,"prom_id":i_arr[j].prom_id,"goods_id":i_arr[j].goods_id};
glist.push(et);
}
+
ab = 1;
//-- 获取促销活动是不是有参与 --
@@ -4278,7 +4273,6 @@ Page({
var ky=val.goods_id + "-"+val.prom_type + "-"+val.prom_id;
var obj = map_limit.get(ky);
if (obj){
- obj.g_num+=val.goods_num;
continue;
}
var promgoodsbuynum =val.promgoodsbuynum || 0;
@@ -4293,8 +4287,7 @@ Page({
//try {
for (var ind in ddata) {
var val = ddata[ind];
- var num = map.get(val.goods_id + "");
-
+
var ky=val.goods_id + "-"+val.prom_type + "-"+val.prom_id;
var ky2=val.prom_type + "-"+val.prom_id;
@@ -4313,7 +4306,7 @@ Page({
if (val.prom_type == 1 || val.prom_type == 2) {
var s_num=num;
- if(th.data.sales_rules> 1) s_num=buyed;
+ //if(th.data.sales_rules> 1) s_num=buyed;
if (s_num > val.store_count) {
isok = 0;
gname = val.goods_name;
@@ -4328,7 +4321,7 @@ Page({
break;
}
- if(cur_buyed && buyed.g_num > val.goods_num - val.buy_num && val.goods_num) {
+ if(cur_buyed && cur_buyed.g_num > val.goods_num - val.buy_num && val.goods_num) {
isok = 0;
gname = val.goods_name;
err="超出活动库存";
diff --git a/pages/goods/goodsInfo/goodsInfo.js b/pages/goods/goodsInfo/goodsInfo.js
index 11201db..fea68a2 100644
--- a/pages/goods/goodsInfo/goodsInfo.js
+++ b/pages/goods/goodsInfo/goodsInfo.js
@@ -403,8 +403,8 @@ Page({
//判断活动
if (prom_type) {
- this.data.prom_type = prom_type;
- this.data.prom_id = prom_id;
+ this.data.prom_type = parseInt(prom_type);
+ this.data.prom_id = parseInt(prom_id);
//-- 基础的活动类型 --
this.data.base_nor_prom_type = prom_type;
@@ -5095,9 +5095,9 @@ Page({
if (em.data.data <= 0) ee.setData({
prom_r_null: 1
});
- //拿取价格并且判断时间--
- getApp().request.get("/api/weshop/teamlist/get/" +
- os.stoid + "/" + prom_id, {
+ //拿取价格并且判断时间,并判断会员的身分--
+ getApp().request.get("/api/weshop/teamlist/getUser/" +
+ os.stoid + "/" + prom_id+"/"+getApp().globalData.user_id, {
success: async function (t) {
if (t.data.code != 0) {
ee.get_normal(gid);
@@ -5140,27 +5140,27 @@ Page({
}
//判断拼团的---会员身份--
- await getApp().request.promiseGet("/api/weshop/teamlist/pageteam/2", {
- data: {
- store_id: os.stoid,
- is_end: 0,
- is_show: 1,
- user_id: getApp().globalData.user_id,
- pageSize: 1000
- }
- }).then(res => {
- let pd_list = res.data.data.pageData;
- if (res.data.code == 0 && pd_list.length > 0) {
- flag = pd_list.some(pd => {
- return pd.goods_id == gid
- })
- }
- })
- if (!flag) {
- ee.get_normal(gid);
- return false;
+ // await getApp().request.promiseGet("/api/weshop/teamlist/pageteam/2", {
+ // data: {
+ // store_id: os.stoid,
+ // is_end: 0,
+ // is_show: 1,
+ // user_id: getApp().globalData.user_id,
+ // pageSize: 1000
+ // }
+ // }).then(res => {
+ // let pd_list = res.data.data.pageData;
+ // if (res.data.code == 0 && pd_list.length > 0) {
+ // flag = pd_list.some(pd => {
+ // return pd.goods_id == gid
+ // })
+ // }
+ // })
+ // if (!flag) {
+ // ee.get_normal(gid);
+ // return false;
+ // }
- }
//-------查看自己是不是有买过该团的商品,并还为支付,或者在进行中-------
await getApp().request.promiseGet("/api/weshop/order/page", {
data: {
@@ -5770,7 +5770,7 @@ Page({
});
// s.my_warnning('超出商品限购', 0, th);
- var num = 0;//th.data.prom_buy_limit - th.data.prom_buy_num;
+ var num = th.data.sele_g.viplimited - th.data.g_buy_num.get(th.data.sele_g.goods_id);
if (num <= 0) num = 1;
th.setData({
goodsInputNum: num
diff --git a/pages/goods/goodsList/goodsList.js b/pages/goods/goodsList/goodsList.js
index 1d139b6..d69db67 100644
--- a/pages/goods/goodsList/goodsList.js
+++ b/pages/goods/goodsList/goodsList.js
@@ -45,9 +45,12 @@ Page({
gr_fir:0, //分组第一次
share_imgurl:'', //分享图片
add_purchase:false,
+
+ pro_good:null, //优惠促销活动
+ pro_good_err:null, //优惠促销活动
},
- onLoad: function(t) {
+ onLoad: async function(t) {
//----------商品分组自定义分享图片----------
if (t.gid || t.group_id) {
let id = t.gid || t.group_id
@@ -75,31 +78,29 @@ Page({
var th=this;
var url = this.data.baseUrl;
- //优惠活动的凑单
- if(t.prom_type==3){
- if (0 != t.prom_id && t.prom_id != undefined) { url += "&prom_id=" + t.prom_id; }
- if (0 != t.prom_type && t.prom_type != undefined) { url += "&prom_type=" + t.prom_type; }
- //-- 获取 --
- getApp().request.promiseGet("/api/weshop/promgoodslist/list",{
- data:{prom_id:t.prom_id }
- }).then(res=>{
- if(res.data.code==0){
- var arr= res.data.data;
- th.set_prom_list(arr);
- }
- })
- if (t.prom_id) {
- this.getprom(t.prom_id)
- }
- }
+ if (0 != t.prom_id && t.prom_id != undefined) { url += "&prom_id=" + t.prom_id; }
+ if (0 != t.prom_type && t.prom_type != undefined) { url += "&prom_type=" + t.prom_type; }
//先查看一下是不是系统会员
- getApp().waitfor_login(()=> {
+ getApp().waitfor_login(async ()=> {
if (!getApp().globalData.user_id) {
ut.new_user_go(oo.stoid, first_leader);
}
+ await th.get_prom_act(t);
+ if(t.prom_type==3 && !th.data.pro_good){
+ if(th.data.pro_good_err.indexOf("无权限")>-1){
+ ut.m_toast('您无权限参与优惠促销活动');
+ }else{
+ ut.m_toast('未找到优惠促销活动');
+ }
+ setTimeout(()=>{
+ getApp().goto('/pages/index/index/index');
+ },1500)
+ return false
+ }
+
this.data.is_new=t.is_new;
this.data.is_hot=t.is_hot;
if (0 != t.cat_id && t.cat_id != undefined) {
@@ -257,6 +258,31 @@ Page({
})
},
+
+ async get_prom_act(t){
+ var th=this;
+ //优惠活动的凑单
+ if(t.prom_type==3){
+ if (t.prom_id) {
+ await this.getprom(t.prom_id);
+ if(!th.data.pro_good){
+ return false;
+ }
+ }
+
+ //-- 获取 --
+ getApp().request.promiseGet("/api/weshop/promgoodslist/list",{
+ data:{prom_id:t.prom_id }
+ }).then(res=>{
+ if(res.data.code==0){
+ var arr= res.data.data;
+ th.set_prom_list(arr);
+ }
+ })
+
+ }
+ },
+
onShow:function () {
getApp().check_can_share();
},
@@ -274,14 +300,20 @@ Page({
},
//获取优惠活动
async getprom(prom_id){
- await getApp().request.promiseGet("/api/weshop/promgoods/get/" + oo.stoid + "/" + prom_id, {}).then(res => {
+ let th=this;
+ var uid=getApp().globalData.user_id || 0;
+ await getApp().request.promiseGet("/api/weshop/promgoods/getUser/" + oo.stoid + "/" + prom_id+"/"+uid, {}).then(res => {
if (res.data.code == 0) {
let prom = res.data.data;
+ th.data.pro_good=prom;
let limit_num =prom.limit_num
this.setData({
limit_num
})
+ }else{
+ th.data.pro_good_err=res.data.msg;
}
+
})
},
//设置优惠券的
diff --git a/pages/user/order_list/order_list.js b/pages/user/order_list/order_list.js
index 8d3b471..f73b709 100644
--- a/pages/user/order_list/order_list.js
+++ b/pages/user/order_list/order_list.js
@@ -137,6 +137,10 @@ Page({
onShow: function () {
wx.showLoading();
var th=this;
+ th.setData({
+ cardList:[],
+ list2:[]
+ });
//-- 读取会员的信息先 --,再app.js中有
this.check_user_storage(()=> {
//在界面显示
@@ -989,7 +993,7 @@ Page({
}
if (!r_data.promGoodsLists && good.prom_type == 3) {
- var content = good.goods_name + '未找到活动,请取消订单重新购买';
+ var content = good.goods_name + '未找到活动或您无权限参与该活动,请取消订单重新购买';
th.toast(content);
p_ok = 0;
}else if(r_data.promGoodsLists && good.prom_type == 3){