diff --git a/components/diy_goodsGroup/diy_goodsGroup.js b/components/diy_goodsGroup/diy_goodsGroup.js
index 4bee7f0..202374c 100644
--- a/components/diy_goodsGroup/diy_goodsGroup.js
+++ b/components/diy_goodsGroup/diy_goodsGroup.js
@@ -45,6 +45,7 @@ Component({
nav_list:null,
title_index:0,
swiper_hei:0,
+ title_class:"",
},
ready: function () {},
@@ -96,7 +97,17 @@ Component({
if(this.data.object.goodsprice) hei+=80;
if(this.data.object.goodsnum) hei+=80;
- this.setData({swiper_hei:hei});
+ if(this.data.object.title_color){
+ this.data.title_class=`color:${this.data.object.title_color};`
+ }
+
+ if(this.data.object.title_font_size){
+ this.data.title_class=this.data.title_class.concat(`font-size:${this.data.object.title_font_size}px;`)
+ }
+ this.setData({
+ swiper_hei:hei,
+ title_class:this.data.title_class,
+ });
if (nav_item && nav_item.goodsclass == 1) {
this.data.is_recommend = 1
diff --git a/components/diy_goodsGroup/diy_goodsGroup.wxml b/components/diy_goodsGroup/diy_goodsGroup.wxml
index 34e1241..4541684 100644
--- a/components/diy_goodsGroup/diy_goodsGroup.wxml
+++ b/components/diy_goodsGroup/diy_goodsGroup.wxml
@@ -6,7 +6,7 @@
- {{item.title}}
+ {{item.title}}
diff --git a/packageA/pages/quan_pro/quan_pro.js b/packageA/pages/quan_pro/quan_pro.js
index ae34bb5..08981c6 100644
--- a/packageA/pages/quan_pro/quan_pro.js
+++ b/packageA/pages/quan_pro/quan_pro.js
@@ -128,9 +128,16 @@ Page({
},
go_quan:function(){
- //跳转到券列表
+ //跳转到券列表
+ this.setData({
+ show_success:0
+ })
getApp().goto("/pages/user/coupons/coupons");
- }
-
+ },
+ close_show(){
+ this.setData({
+ show_success:0
+ })
+ },
});
diff --git a/packageA/pages/quan_pro/quan_pro.wxml b/packageA/pages/quan_pro/quan_pro.wxml
index d8c4f98..0789a3e 100644
--- a/packageA/pages/quan_pro/quan_pro.wxml
+++ b/packageA/pages/quan_pro/quan_pro.wxml
@@ -7,42 +7,39 @@
-
-
-
-
- {{q_data.name}}
- 不存在此微券或数量已领取完
-
-
-
-
-
-
- 全场通用
- 仅限{{q_data.useobjectname}}使用
-
-
-
- {{q_data.coupon_remark}}
-
+
+
+
+ {{q_data.name}}
+ 不存在此微券或数量已领取完
-
- ¥{{filters.toFix(q_data.money,2)}}
- 满{{filters.toFix(q_data.condition,2)}}可用
+
+
+
+
+ 全场通用
+ 仅限{{q_data.useobjectname}}使用
+
+
+
+ ¥{{filters.toFix(q_data.money,2)}}
+ 满{{filters.toFix(q_data.condition,2)}}可用
+
+ {{q_data.coupon_remark}}
-
+
有效期
- {{filters.format_time(getcurday+3600*24*q_data.startdays)}}
+ {{filters.format_time(getcurday+3600*24*q_data.startdays)}}
{{filters.format_time(q_data.use_start_time)}}至
{{filters.format_time(q_data.use_end_time)}}不限
有效期
- {{filters.format_time(getcurday+3600*24*q_data.startdays)}}
- {{filters.format_time(getcurday)}}至
- {{filters.format_time(getcurday+3600*24*q_data.days)}}不限
+ {{filters.format_time(getcurday+3600*24*q_data.startdays)}}
+ {{filters.format_time(getcurday)}}至
+ {{filters.format_time(getcurday+3600*24*q_data.days)}}不限
+
@@ -58,7 +55,7 @@
- 猜你喜欢
+ 猜你喜欢
@@ -83,6 +80,4 @@
-
-
-
+
\ No newline at end of file
diff --git a/packageA/pages/quan_pro/quan_pro.wxss b/packageA/pages/quan_pro/quan_pro.wxss
index 90cdbc8..440eb21 100644
--- a/packageA/pages/quan_pro/quan_pro.wxss
+++ b/packageA/pages/quan_pro/quan_pro.wxss
@@ -7,10 +7,10 @@ page{background-color: #f8f8f8;}
.img_part{ padding: 0 20rpx; position: relative}
.btn{ width: 90%; height: 72rpx; border-radius: 10rpx; background-color: #ff6c6c; color: #fff;}
.love{ width: 60rpx; height: 50rpx}
-.q_content{ position: absolute;top: 0; left: 0; width: 100%; height: 450rpx;padding: 0 20rpx; }
+.q_content{ position: absolute;top: 0; left: 0; width: calc(100% - 40rpx); height: 450rpx;padding: 0 20rpx; }
.upper{ height:330rpx;}
.lower{ height: 120rpx; line-height: 170rpx;color:#7a668f}
-
+.quan_box {display: flex;flex-direction: column;justify-content: flex-start; box-sizing: border-box;}
.upper .left{ margin-left:30rpx; margin-top: 30rpx }
.t_circle{ width: 10rpx; height: 10rpx; border-radius: 50%; background-color: #fff; margin-right: 8rpx}
diff --git a/packageB/pages/zuhegou/index/index.js b/packageB/pages/zuhegou/index/index.js
index 806135f..ce91880 100644
--- a/packageB/pages/zuhegou/index/index.js
+++ b/packageB/pages/zuhegou/index/index.js
@@ -10,8 +10,7 @@ let imgDraw = {
"width": "650px",
"height": "843px",
"background": "https://mshopimg.yolipai.net/miniapp/images/zhg/bg-zuhegou.jpg",
- "views": [
- { // 头像
+ "views": [{ // 头像
"type": "image",
"url": "https://desk-fd.zol-img.com.cn/t_s960x600c5/g5/M00/0F/08/ChMkJlauzXWIDrXBAAdCg2xP7oYAAH9FQOpVAIAB0Kb342.jpg",
"css": {
@@ -64,7 +63,7 @@ let imgDraw = {
"textAlign": "center"
}
},
- { // 码
+ { // 码
"type": "image",
"url": "https://desk-fd.zol-img.com.cn/t_s960x600c5/g5/M00/0F/08/ChMkJlauzXWIDrXBAAdCg2xP7oYAAH9FQOpVAIAB0Kb342.jpg",
"css": {
@@ -102,64 +101,62 @@ Page({
showNum: false,
haveAdded: false,
//imgDraw: imgDraw, 分享内容
- id: 0, //获得活动id
- page: 1, //第一页
- no_more: 0, //没有更多
- loading: 0, //加载中
- list:null, //商品列表的显示
- act: null, //组合活动
+ id: 0, //获得活动id
+ page: 1, //第一页
+ no_more: 0, //没有更多
+ loading: 0, //加载中
+ list: null, //商品列表的显示
+ act: null, //组合活动
all_price: 0, //合计价格
- all_num: 0, //全部数量
+ all_num: 0, //全部数量
sele_pick_id: 0, //默认选择门店,当用户什么商品都没有选,sele_pick_id=0
- def_store: null, //用户默认的门店
- sele_store: 0, //是不是选择了门店
+ def_store: null, //用户默认的门店
+ sele_store: 0, //是不是选择了门店
more_store: 0, //选择门店
sort_store: 0, //门店分类
choice_sort_store: 0, //选择分类门店
- fir_pick_index: 0, //门店选择的下标
- sec_pick_index: 0 //门店选择的下标,地区选择之后的内页
+ fir_pick_index: 0, //门店选择的下标
+ sec_pick_index: 0 //门店选择的下标,地区选择之后的内页
},
/**
* 生命周期函数--监听页面加载
*/
onLoad: function (options) {
-
- console.log(options,111);
-
+ console.log(options, 111);
self = this;
var the_id = options.id;
- if(options.title) {
- wx.setNavigationBarTitle({
- title: options.title,
- });
- };
- var first_leader=options.first_leader;
+ if (options.title) {
+ wx.setNavigationBarTitle({
+ title: options.title,
+ });
+ };
+ var first_leader = options.first_leader;
//--如果tg_id是空的话,分享回来--
if (the_id == undefined || the_id == null || the_id == "") {
- var gid_str = decodeURIComponent(options.scene);
- gid_str=gid_str.split("_");
- the_id=gid_str[0];
- if(gid_str.length>1){
- first_leader=gid_str[1];
+ var gid_str = decodeURIComponent(options.scene);
+ gid_str = gid_str.split("_");
+ the_id = gid_str[0];
+ if (gid_str.length > 1) {
+ first_leader = gid_str[1];
}
}
- this.data.id=the_id;
- if(first_leader){
- getApp().globalData.first_leader=first_leader;
+ this.data.id = the_id;
+ if (first_leader) {
+ getApp().globalData.first_leader = first_leader;
//调用接口判断是不是会员
- 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().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;
}
})
}
//如果有会员的时候
var userInfo = getApp().globalData.userInfo;
- if(!userInfo){
+ if (!userInfo) {
getApp().goto("/pages/togoin/togoin");
return false;
}
@@ -169,40 +166,51 @@ Page({
* 生命周期函数--监听页面显示
*/
onShow: function () {
- var th = this, that = this, ee = this;
+ var th = this,
+ that = this,
+ ee = this;
this.data.is_timer = 1;
if (this.data.act) this.countDown();
//如果有会员的时候
var userInfo = getApp().globalData.userInfo;
if (userInfo) {
- if(!th.data.is_get_act){
+ if (!th.data.is_get_act) {
//获取活动信息
- var url = "/api/weshop/prom/zhbuy/get/" + os.stoid + "/" + th.data.id+"/"+userInfo.user_id;
+ var url = "/api/weshop/prom/zhbuy/get/" + os.stoid + "/" + th.data.id + "/" + userInfo.user_id;
getApp().request.get(url, {
success: function (e) {
- th.data.is_get_act=1;
+ th.data.is_get_act = 1;
if (e.data.code == 0 && e.data.data) {
- self.setData({act: e.data.data});
- if(e.data.data.is_show!=1){
- th.setData({error:'活动未开启'});
+ self.setData({
+ act: e.data.data
+ });
+ if (e.data.data.is_show != 1) {
+ th.setData({
+ error: '活动未开启'
+ });
return false;
}
- if(ut.gettimestamp()=th.data.act.end_time ) {
+ if (th.data.act.is_end == 10 || ut.gettimestamp() >= th.data.act.end_time) {
return false;
}
//获取头像的分享
@@ -241,7 +249,9 @@ Page({
success: function (res) {
var vpath = res.path;
imgDraw.views[4].url = vpath;
- th.setData({imgDraw: imgDraw})
+ th.setData({
+ imgDraw: imgDraw
+ })
}
})
})
@@ -254,13 +264,13 @@ Page({
}
-
+
var ee = JSON.parse(JSON.stringify(e));
var appd = getApp().globalData;
//-- 等待定位系统的开启 --
th.waitfor2(15, 'is_get_local_ok', function () {
- if(!th.data.is_get_local_ok) return false;
+ if (!th.data.is_get_local_ok) return false;
var e = JSON.parse(JSON.stringify(ee));
//如果有开启近距离的话,同时距离优不一样了
@@ -325,10 +335,14 @@ Page({
var sw_arr = JSON.parse(swithc_list);
//---如果后台又开等级卡的开关---
if (sw_arr.rank_switch && sw_arr.rank_switch == "2") {
- th.setData({rank_switch: true});
+ th.setData({
+ rank_switch: true
+ });
//---回调卡的列表---
th.getPlusCardType(function (ob) {
- th.setData({card_list: ob.card_list});
+ th.setData({
+ card_list: ob.card_list
+ });
var user = getApp().globalData.userInfo;
if (!user) return false;
if (user.card_field && user['card_expiredate']) {
@@ -350,7 +364,7 @@ Page({
th.get_cart_val(e);
})
- }else{
+ } else {
//获取购物车的内容
th.get_cart_val(e);
}
@@ -359,9 +373,6 @@ Page({
})
}
-
-
-
},
onHide: function () {
@@ -386,33 +397,43 @@ Page({
data: req_data,
success: function (res) {
th.data.loading = 0;
- th.setData({is_get: 1})
+ th.setData({
+ is_get: 1
+ })
if (ut.ajax_ok(res)) {
th.data.page++;
var list = th.data.list;
- if(!list) list=[];
+ if (!list) list = [];
//当是下拉刷新的时候
- if(th.data.page>1 && th.data.cart_list){
+ if (th.data.page > 1 && th.data.cart_list) {
//下拉之后也要重新计算一下金额
- th.calc_more(res.data.data.pageData,function (list1) {
+ th.calc_more(res.data.data.pageData, function (list1) {
for (var i in list1) {
list.push(list1[i]);
}
- th.setData({list: list});
+ th.setData({
+ list: list
+ });
th.re_sum_price();
})
- }else{
+ } else {
for (var i in res.data.data.pageData) {
list.push(res.data.data.pageData[i]);
}
- th.setData({list: list});
+ th.setData({
+ list: list
+ });
if (res.data.data.total <= 10) {
- th.setData({no_more: 1});
+ th.setData({
+ no_more: 1
+ });
}
}
} else {
- th.setData({no_more: 1});
+ th.setData({
+ no_more: 1
+ });
}
}
})
@@ -428,34 +449,34 @@ Page({
*/
onShareAppMessage: function () {
var title = this.data.act.name;
- var url= "/packageB/pages/zuhegou/index/index?id="+this.data.act.id;
+ var url = "/packageB/pages/zuhegou/index/index?id=" + this.data.act.id;
if (getApp().globalData.user_id) {
url += "&first_leader=" + getApp().globalData.user_id;
}
var ob = {
- title:title,
+ title: title,
path: url,
};
- if(this.data.act.img_url)
- ob.imageUrl=this.data.iurl+this.data.act.img_url;
+ if (this.data.act.img_url)
+ ob.imageUrl = this.data.iurl + this.data.act.img_url;
return ob;
},
/**
* 用户分享朋友圈
*/
- onShareTimeline(){
+ onShareTimeline() {
var title = this.data.act.name;
- var url= "/packageB/pages/zuhegou/index/index?id="+this.data.act.id;
+ var url = "/packageB/pages/zuhegou/index/index?id=" + this.data.act.id;
if (getApp().globalData.user_id) {
url += "&first_leader=" + getApp().globalData.user_id;
}
var ob = {
- title:title,
+ title: title,
path: url,
};
- if(this.data.act.img_url)
- ob.imageUrl=this.data.iurl+this.data.act.img_url;
+ if (this.data.act.img_url)
+ ob.imageUrl = this.data.iurl + this.data.act.img_url;
return ob;
},
/**
@@ -505,7 +526,7 @@ Page({
this.data.sele_index = index;
let title = '';
self = this;
- th.data.s_cart_num=0;
+ th.data.s_cart_num = 0;
//说明是加入购物车是时候
this.data.is_zuhe_addcart = 1;
@@ -527,7 +548,7 @@ Page({
wx.showModal({
title: '温馨提示',
content: '该商品的物流配送方式和默认门店不匹配,是否要切换门店?',
- success (res) {
+ success(res) {
if (res.confirm) {
//物流的配送方式不一样
th.get_sto();
@@ -544,7 +565,9 @@ Page({
}
return false;
} else {
- th.setData({is_no_pipei: 0});
+ th.setData({
+ is_no_pipei: 0
+ });
th.check_is_in_cart(function () {
th.add_cart_func();
})
@@ -559,10 +582,10 @@ Page({
wx.showModal({
title: '温馨提示',
content: "确定取消该商品参与活动?",
- success (res) {
+ success(res) {
if (res.confirm) {
console.log('用户点击确定');
- if(th.data.sele_g.cart_num && th.data.sele_g.cart_num - th.data.sele_g.num>0){
+ if (th.data.sele_g.cart_num && th.data.sele_g.cart_num - th.data.sele_g.num > 0) {
var updata = {
id: th.data.sele_g.cart_id,
@@ -571,8 +594,8 @@ Page({
}
getApp().request.put("/api/weshop/cart/update", {
data: updata,
- success:function (rs) {
- if(rs.data.code==0) {
+ success: function (rs) {
+ if (rs.data.code == 0) {
title = '取消成功';
th.setData({
[txt1]: 0,
@@ -588,12 +611,12 @@ Page({
}
})
- }else{
- var url = '/api/weshop/cart/del/' + os.stoid + '/' + th.data.sele_g.cart_id;
- getApp().request.delete(url, {
- success:function (res) {
+ } else {
+ var url = '/api/weshop/cart/del/' + os.stoid + '/' + th.data.sele_g.cart_id;
+ getApp().request.delete(url, {
+ success: function (res) {
- if(res.data.code==0) {
+ if (res.data.code == 0) {
title = '取消成功';
th.setData({
[txt1]: 0,
@@ -635,14 +658,14 @@ Page({
return false;
}
- if(this.data.changing) return false;
- this.data.changing=1;
+ if (this.data.changing) return false;
+ this.data.changing = 1;
var index = e.currentTarget.dataset.index;
this.data.sele_g = this.data.list[index];
- this.data.sele_index=index;
+ this.data.sele_index = index;
th.data.goodsInputNum = this.data.sele_g.num + 1;
- if(this.data.sele_g.cart_num){
+ if (this.data.sele_g.cart_num) {
th.data.s_cart_num = this.data.sele_g.cart_num + 1;
}
th.add_cart_func();
@@ -661,7 +684,7 @@ Page({
var th = this;
var index = e.currentTarget.dataset.index;
var item = this.data.list[index];
- this.data.sele_g=item;
+ this.data.sele_g = item;
let num = item.num;
th.data.s_cart_num = item.cart_num - 1;
@@ -677,8 +700,8 @@ Page({
return false;
}
- if(th.data.changing) return false;
- th.data.changing=1;
+ if (th.data.changing) return false;
+ th.data.changing = 1;
th.data.sele_g = item;
th.data.sele_index = index;
th.data.goodsInputNum = check_num;
@@ -694,19 +717,19 @@ Page({
wx.showModal({
title: '温馨提示',
content: '确定取消该商品参与活动?',
- success (res) {
+ success(res) {
if (res.confirm) {
- if(th.data.s_cart_num){
+ if (th.data.s_cart_num) {
var updata = {
id: th.data.sele_g.cart_id,
- goods_num:th.data.s_cart_num ,
+ goods_num: th.data.s_cart_num,
store_id: os.stoid
}
getApp().request.put("/api/weshop/cart/update", {
data: updata,
- success:function (rs) {
- if(rs.data.code==0) {
+ success: function (rs) {
+ if (rs.data.code == 0) {
var title = '取消成功';
th.setData({
[txt1]: 0,
@@ -721,7 +744,7 @@ Page({
}
}
})
- }else {
+ } else {
var url = '/api/weshop/cart/del/' + os.stoid + '/' + item.cart_id;
getApp().request.delete(url, {
success: function (res) {
@@ -736,7 +759,7 @@ Page({
title: title,
icon: 'success',
});
- th.re_sum_price();//重新统计数量和总金额
+ th.re_sum_price(); //重新统计数量和总金额
}
}
});
@@ -911,11 +934,11 @@ Page({
//-- 加入购物的函数 --
add_cart_func: function () {
if (oo.user_id == null) {
- this.data.changing=0;
+ this.data.changing = 0;
return getApp().my_warnning("还未登录!", 0, this);
}
if (!getApp().globalData.userInfo) {
- this.data.changing=0;
+ this.data.changing = 0;
return getApp().my_warnning("还未登录!", 0, this);
}
@@ -933,16 +956,16 @@ Page({
title: '提示',
content: '超出商品限购'
});
- th.data.changing=0;
+ th.data.changing = 0;
return false;
}
- if(th.data.s_cart_num){
+ if (th.data.s_cart_num) {
if (th.data.s_cart_num + th.data.g_buy_num.get(th.data.sele_g.goods_id).gd_buynum > th.data.sele_g.viplimited) {
wx.showModal({
title: '提示',
content: '超出商品限购'
});
- th.data.changing=0;
+ th.data.changing = 0;
return false;
}
}
@@ -950,25 +973,27 @@ Page({
}
//---判断商品是否超出活动限购---
if (th.data.sele_g.buyqty > 0) {
- if (th.data.goodsInputNum+ th.data.g_buy_num.get(th.data.sele_g.goods_id).prom_buybum > th.data.sele_g.buyqty) {
+ if (th.data.goodsInputNum + th.data.g_buy_num.get(th.data.sele_g.goods_id).prom_buybum > th.data.sele_g.buyqty) {
wx.showModal({
title: '提示',
content: '超出商品活动限购'
});
- th.data.changing=0;
+ th.data.changing = 0;
return false;
}
}
- if (th.data.goodsInputNum <= 0){
- this.data.changing=0;return s.my_warnning("商品数量不能为0", 0, th);
+ if (th.data.goodsInputNum <= 0) {
+ this.data.changing = 0;
+ return s.my_warnning("商品数量不能为0", 0, th);
}
if (th.data.sto_sele_name == null || th.data.sto_sele_name == undefined)
this.setData({
sto_sele_name: ""
});
if (th.data.sto_sele_name == "") {
- th.data.changing=0;return s.my_warnning("请选择门店", 0, th);
+ th.data.changing = 0;
+ return s.my_warnning("请选择门店", 0, th);
}
//--------------此时操作的数据------------
@@ -984,8 +1009,8 @@ Page({
goods_sn: o.goods_sn,
};
- if(th.data.s_cart_num){
- newd.goods_num=th.data.s_cart_num;
+ if (th.data.s_cart_num) {
+ newd.goods_num = th.data.s_cart_num;
}
//---是不是从收藏夹出来的---
@@ -1010,19 +1035,21 @@ Page({
if (newd.goods_id == getApp().globalData.room_goods_id) newd.room_id = getApp().globalData.room_id;
}
- if (o.store_count <= 0){
- th.data.changing=0;return getApp().my_warnning("库存已为空!", 0, th);
+ if (o.store_count <= 0) {
+ th.data.changing = 0;
+ return getApp().my_warnning("库存已为空!", 0, th);
}
- if (o.store_count < e.data.goodsInputNum){
- th.data.changing=0;return getApp().my_warnning("库存不足!", 0, th);
+ if (o.store_count < e.data.goodsInputNum) {
+ th.data.changing = 0;
+ return getApp().my_warnning("库存不足!", 0, th);
}
- th.add_cart_next(o, newd); //加入购物车下一步
+ th.add_cart_next(o, newd); //加入购物车下一步
})
},
//---加入购物车的最后一步---
- add_cart_next(o, newd){
+ add_cart_next(o, newd) {
var th = this;
//如果会员有等级价
if (th.data.card_field) {
@@ -1052,12 +1079,12 @@ Page({
th.data.adding = 0;
return getApp().my_warnning("库存不足!", 0, th);
}
- if (th.data.goodsInputNum+ th.data.g_buy_num.get(th.data.sele_g.goods_id).prom_buybum > o.buyqty && o.buyqty>0) {
+ if (th.data.goodsInputNum + th.data.g_buy_num.get(th.data.sele_g.goods_id).prom_buybum > o.buyqty && o.buyqty > 0) {
th.data.adding = 0;
return getApp().my_warnning("超出商品活动限购!", 0, th);
}
- if (th.data.goodsInputNum + th.data.g_buy_num.get(th.data.sele_g.goods_id).prom_buybum > th.data.sele_g.viplimited
- && th.data.sele_g.viplimited > 0
+ if (th.data.goodsInputNum + th.data.g_buy_num.get(th.data.sele_g.goods_id).prom_buybum > th.data.sele_g.viplimited &&
+ th.data.sele_g.viplimited > 0
) {
th.data.adding = 0;
return getApp().my_warnning("超出商品限购!", 0, th);
@@ -1071,13 +1098,13 @@ Page({
member_goods_price: newd.goods_price,
store_id: os.stoid,
};
- if(th.data.s_cart_num){
- updata.goods_num=th.data.s_cart_num;
+ if (th.data.s_cart_num) {
+ updata.goods_num = th.data.s_cart_num;
}
//---是不是从收藏夹出来的---
if (th.data.c_guide_id) {
updata['guide_id'] = th.data.c_guide_id;
- updata['guide_type'] = 3; //加入购物车之后就变成了3
+ updata['guide_type'] = 3; //加入购物车之后就变成了3
} else {
if (getApp().globalData.guide_id) {
updata['guide_id'] = getApp().globalData.guide_id;
@@ -1096,12 +1123,14 @@ Page({
th.data.adding = 0;
th.data.sele_store = 1;
- if(th.data.s_cart_num){
+ if (th.data.s_cart_num) {
var txt_temp = "list[" + index + "].cart_num";
- th.setData({[txt_temp]:th.data.s_cart_num})
+ th.setData({
+ [txt_temp]: th.data.s_cart_num
+ })
}
- th.re_sum_price();//重新统计数量和总金额
+ th.re_sum_price(); //重新统计数量和总金额
}
});
} else {
@@ -1121,7 +1150,7 @@ Page({
th.data.adding = 0;
th.data.sele_store = 1;
- th.re_sum_price();//重新统计数量和总金额
+ th.re_sum_price(); //重新统计数量和总金额
}
}
});
@@ -1182,14 +1211,17 @@ Page({
list.push(plusCard[i]);
}
- var ob = {"card_list": list, "name_map": card_name_map};
+ var ob = {
+ "card_list": list,
+ "name_map": card_name_map
+ };
func(ob);
})
},
//--- 设置一下默认库存的数量 ----
- set_def_storage(ee){
+ set_def_storage(ee) {
var that = this;
that.data.fir_def_store = ee;
that.setData({
@@ -1206,8 +1238,8 @@ Page({
this.waitfor2(15, 'is_get_local_ok', function () {
//if (!th.data.sele_g) return false;
var dd = null;
- var g_distr_type =0;
- if(th.data.sele_g) g_distr_type=th.data.sele_g.distr_type;
+ var g_distr_type = 0;
+ if (th.data.sele_g) g_distr_type = th.data.sele_g.distr_type;
if (g_distr_type != 0) {
dd = {
store_id: os.stoid,
@@ -1233,7 +1265,9 @@ Page({
//如果会员是有默认的门店话
if (!th.data.def_pick_store && th.data.fir_def_store) {
- th.setData({def_pick_store: th.data.fir_def_store});
+ th.setData({
+ def_pick_store: th.data.fir_def_store
+ });
}
wx.showLoading({
@@ -1246,14 +1280,15 @@ Page({
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;
+ 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;
+ 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) {
@@ -1277,14 +1312,16 @@ Page({
e.data.data.pageData.splice(0, 0, th.data.def_pick_store); //添加
}
- th.setData({all_pick_list: e.data.data.pageData});
+ th.setData({
+ all_pick_list: e.data.data.pageData
+ });
th.deal_pickup(e);
}
})
})
},
//------------处理门店---------------
- deal_pickup(e){
+ deal_pickup(e) {
var th = this;
wx.hideLoading();
//单总量超出5个的时候
@@ -1299,12 +1336,13 @@ Page({
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
+ 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
}
}
}
@@ -1316,12 +1354,14 @@ Page({
var newarr = new Array();
var qita = new Array();
- var is_del_pk=0;
+ var is_del_pk = 0;
//----要进行门店分组--------
for (var i = 0; i < sto_arr.length; i++) {
//找一下这个门店有没有在分类数组内
- var find2 = 0, find2name = "", sort = 0;
- is_del_pk=0;
+ 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) {
@@ -1337,7 +1377,7 @@ Page({
break;
}
}
- if(is_del_pk) continue;
+ if (is_del_pk) continue;
if (newarr.length > 0) {
var find = 0;
@@ -1416,13 +1456,13 @@ Page({
}
- var sd={
+ var sd = {
all_sto: newarr,
- is_show_sto_cat:1
+ is_show_sto_cat: 1
}
- if(!sto_arr || sto_arr.length<=10){
- sd.is_show_sto_cat=-1;
- sd.only_pk=sto_arr;
+ if (!sto_arr || sto_arr.length <= 10) {
+ sd.is_show_sto_cat = -1;
+ sd.only_pk = sto_arr;
}
th.setData(sd);
@@ -1433,7 +1473,9 @@ Page({
});
//-----如果没有默认门店,要取第一个门店作为默认店.此时没有门店分类的情况------
if (!th.data.def_pick_store) {
- th.setData({def_pick_store: e.data.data.pageData[0]})
+ th.setData({
+ def_pick_store: e.data.data.pageData[0]
+ })
}
}
} else {
@@ -1443,7 +1485,9 @@ Page({
});
//-----如果没有默认门店,要取第一个门店作为默认店.此时没有门店分类的情况------
if (!th.data.def_pick_store) {
- th.setData({def_pick_store: e.data.data.pageData[0]})
+ th.setData({
+ def_pick_store: e.data.data.pageData[0]
+ })
}
}
}
@@ -1508,7 +1552,7 @@ Page({
}
//判断门店的配送方式是不是匹配
- var g_distr_type=0;
+ var g_distr_type = 0;
if (th.data.sele_g)
g_distr_type = th.data.sele_g.distr_type;
if (item.distr_type != 0 && g_distr_type != 0 && item.distr_type != g_distr_type) {
@@ -1609,7 +1653,7 @@ Page({
sto_sele_distr: item.distr_type,
store: 0,
choice_sort_store: 0,
- sort_store: 0, //关闭门店2级
+ sort_store: 0, //关闭门店2级
});
th.add_cart_func();
@@ -1643,7 +1687,8 @@ Page({
//-------------获取购买数量的总函数----------------
get_buy_num: function (gd, func) {
var map = this.data.g_buy_num,
- th = this, user_id = getApp().globalData.user_id;
+ th = this,
+ user_id = getApp().globalData.user_id;
if (user_id == null) {
getApp().goto("/pages/togoin/togoin");
@@ -1652,7 +1697,7 @@ Page({
if (map && map.has(gd.goods_id)) {
"function" == typeof func && func();
} else {
- var res1=null;
+ var res1 = null;
//----获取商品购买数----
getApp().request.promiseGet("/api/weshop/ordergoods/getUserBuyGoodsNum", {
data: {
@@ -1662,9 +1707,9 @@ Page({
prom_type: 7,
prom_id: th.data.act.id
},
- }).then(res2=>{
- var g_buy_num=0;
- var promgoodsbuynum=0;
+ }).then(res2 => {
+ var g_buy_num = 0;
+ var promgoodsbuynum = 0;
if (res2.data.code == 0) {
var buy_num_data = res2.data.data;
if (buy_num_data.promgoodsbuynum) promgoodsbuynum = buy_num_data.promgoodsbuynum;
@@ -1672,9 +1717,9 @@ Page({
}
if (!map) map = new Map();
- var ob={
- gd_buynum:g_buy_num,
- prom_buybum:promgoodsbuynum,
+ var ob = {
+ gd_buynum: g_buy_num,
+ prom_buybum: promgoodsbuynum,
}
map.set(gd.goods_id, ob);
th.setData({
@@ -1686,7 +1731,7 @@ Page({
},
//-- 当是减数量的调用 --
- sub_updata_cart(){
+ sub_updata_cart() {
var th = this;
var index = this.data.sele_index;
var txt = "list[" + index + "].haveAdded";
@@ -1704,14 +1749,14 @@ Page({
store_id: os.stoid,
};
- if(th.data.s_cart_num){
- updata.goods_num=th.data.s_cart_num;
+ if (th.data.s_cart_num) {
+ updata.goods_num = th.data.s_cart_num;
}
//---是不是从收藏夹出来的---
if (th.data.c_guide_id) {
updata['guide_id'] = th.data.c_guide_id;
- updata['guide_type'] = 3; //加入购物车之后就变成了3
+ updata['guide_type'] = 3; //加入购物车之后就变成了3
} else {
if (getApp().globalData.guide_id) {
updata['guide_id'] = getApp().globalData.guide_id;
@@ -1729,12 +1774,14 @@ Page({
});
th.data.adding = 0;
th.data.sele_store = 1;
- if(th.data.s_cart_num){
+ if (th.data.s_cart_num) {
var txt_temp = "list[" + index + "].cart_num";
- th.setData({[txt_temp]:th.data.s_cart_num})
+ th.setData({
+ [txt_temp]: th.data.s_cart_num
+ })
}
- th.re_sum_price();//重新统计数量和总金额
+ th.re_sum_price(); //重新统计数量和总金额
}
});
},
@@ -1776,24 +1823,24 @@ Page({
success: function (re) {
if (re.data.data.total > 0) {
var item = re.data.data.pageData[0];
- th.get_buy_num(th.data.sele_g,function () {
+ th.get_buy_num(th.data.sele_g, function () {
//当前的价格要更新进去
var cur_price = th.data.sele_g.shop_price;
if (th.data.card_field && th.data.sele_g[th.data.card_field]) {
cur_price = th.data.sele_g[th.data.card_field];
}
- var prom_buybum=0;
- var gd_buynum=0;
+ var prom_buybum = 0;
+ var gd_buynum = 0;
//加入也要控制一下限购
- var check_obj=th.data.g_buy_num.get(th.data.sele_g.goods_id);
- if(check_obj.gd_buynum && check_obj.gd_buynum>0) gd_buynum=check_obj.gd_buynum;
- if(check_obj.prom_buybum && check_obj.prom_buybum>0) prom_buybum=check_obj.prom_buybum;
-
- if(check_obj){
- if(check_obj.prom_buybum && check_obj.prom_buybum>=th.data.sele_g.buyqty &&
- th.data.sele_g.buyqty>0
- ){
+ var check_obj = th.data.g_buy_num.get(th.data.sele_g.goods_id);
+ if (check_obj.gd_buynum && check_obj.gd_buynum > 0) gd_buynum = check_obj.gd_buynum;
+ if (check_obj.prom_buybum && check_obj.prom_buybum > 0) prom_buybum = check_obj.prom_buybum;
+
+ if (check_obj) {
+ if (check_obj.prom_buybum && check_obj.prom_buybum >= th.data.sele_g.buyqty &&
+ th.data.sele_g.buyqty > 0
+ ) {
wx.showToast({
title: "您的已购数量超出活动的限购",
icon: 'none',
@@ -1801,9 +1848,9 @@ Page({
});
return false;
}
- if(check_obj.gd_buynum && check_obj.gd_buynum>=th.data.sele_g.viplimited &&
- th.data.sele_g.viplimited>0
- ){
+ if (check_obj.gd_buynum && check_obj.gd_buynum >= th.data.sele_g.viplimited &&
+ th.data.sele_g.viplimited > 0
+ ) {
wx.showToast({
title: "您的已购数量超出商品的限购",
icon: 'none',
@@ -1813,17 +1860,17 @@ Page({
}
}
- item.cbuy='no';
- var cbuy=th.data.sele_g.viplimited>0?th.data.sele_g.viplimited-gd_buynum:'no';
- if(cbuy!='no') item.cbuy=cbuy;
- var cbuy2=th.data.sele_g.buyqty>0?th.data.sele_g.buyqty-prom_buybum:'no';
- if(cbuy2!='no'){
- if(item.cbuy=='no' || item.cbuy>cbuy2) item.cbuy=cbuy2;
+ item.cbuy = 'no';
+ var cbuy = th.data.sele_g.viplimited > 0 ? th.data.sele_g.viplimited - gd_buynum : 'no';
+ if (cbuy != 'no') item.cbuy = cbuy;
+ var cbuy2 = th.data.sele_g.buyqty > 0 ? th.data.sele_g.buyqty - prom_buybum : 'no';
+ if (cbuy2 != 'no') {
+ if (item.cbuy == 'no' || item.cbuy > cbuy2) item.cbuy = cbuy2;
}
- var num=item.goods_num;
- if(item.cbuy>-1 && item.cbuy -1 && item.cbuy < item.goods_num) {
+ num = item.cbuy;
}
th.setData({
[txt1]: num,
@@ -1848,11 +1895,10 @@ Page({
getApp().request.put("/api/weshop/cart/update", {
data: updata,
- success: function (t) {
- }
+ success: function (t) {}
});
th.re_sum_price();
- })
+ })
} else {
func();
@@ -1863,12 +1909,12 @@ Page({
//-- 计算统计之后的金额 --
re_sum_price: function () {
- var all_num = 0; //商品数量之和
+ var all_num = 0; //商品数量之和
var all_price = 0;
var need_to_buy = 0;
var data = this.data.list;
- var all_zhqty = 0; //所有商品要求起购数之后
-
+ var all_zhqty = 0; //所有商品要求起购数之后
+ var zhqty_bz=[]; //超量
var no_in_arr = [];
for (var i in data) {
var item = data[i];
@@ -1877,18 +1923,25 @@ Page({
all_price += item.num * item.current_price;
//当有起购数的控制的时候
if (item.zhqty) {
+ zhqty_bz.push(item);
all_zhqty += item.zhqty;
if (item.num < item.zhqty) {
need_to_buy += item.zhqty - item.num;
}
if (item.num > item.zhqty) {
for (var i = 0; i < item.num - item.zhqty; i++) {
- no_in_arr.push({price: item.current_price,goods_id:item.goods_id});
+ no_in_arr.push({
+ price: item.current_price,
+ goods_id: item.goods_id
+ });
}
}
} else {
for (var j = 0; j < item.num; j++) {
- no_in_arr.push({price: item.current_price,goods_id:item.goods_id});
+ no_in_arr.push({
+ price: item.current_price,
+ goods_id: item.goods_id
+ });
}
}
} else {
@@ -1901,23 +1954,49 @@ Page({
function sortData(a, b) {
return a.price - b.price
}
- if(no_in_arr.length) no_in_arr.sort(sortData);
+ if (no_in_arr.length) no_in_arr.sort(sortData);
var aprice = this.data.act.zhprice;
if (this.data.act.zhbuyqty > all_zhqty) {
- for (var n = 0; n < this.data.act.zhbuyqty-all_zhqty; n++) {
+ for (var n = 0; n < this.data.act.zhbuyqty - all_zhqty; n++) {
no_in_arr.pop();
}
}
//看一下剩下的数量有没有满足组合购的要求,以及要不要倍增
if (this.data.act.is_bz && no_in_arr.length >= this.data.act.zhbuyqty) {
- //看一下是几倍
+ let zhqty_map=new map();
+ //看一下是几倍
var be = parseInt(no_in_arr.length / this.data.act.zhbuyqty);
- aprice += be * aprice;
- for (var m = 0; m < be * this.data.act.zhbuyqty; m++) {
- no_in_arr.pop();
+ if(this.data.act.is_bzyh && zhqty_bz.length > 0 ){
+ for(let i=0;i 0) {
- item_j.current_price=card_price;
+ item_j.current_price = card_price;
}
}
- if(map[item_j.goods_id]){
- var cart_num=map[item_j.goods_id].goods_num;
- item_j.num=cart_num;
- item_j.cart_num=cart_num;
- item_j.cart_id=map[item_j.goods_id].id;
- if(item_j.buyqty>0){
- var g_buy_num=0;
- var promgoodsbuynum=0;
- //----获取商品购买数----
- await getApp().request.promiseGet("/api/weshop/ordergoods/getUserBuyGoodsNum", {
- data: {
- store_id: os.stoid,
- user_id: user_id,
- goods_id: item_j.goods_id,
- prom_type: 7,
- prom_id: th.data.act.id
- },
- }).then(res2=>{
- if (res2.data.code == 0) {
- var buy_num_data = res2.data.data;
- if (buy_num_data.promgoodsbuynum) promgoodsbuynum = buy_num_data.promgoodsbuynum;
- g_buy_num = buy_num_data.goodsbuynum;
- }
- })
-
- if(item_j.viplimited>0){
- var cby=item_j.viplimited-g_buy_num;
- if(cby<=0) continue;//不能买就continue下一个
- item_j.num=cby>item_j.num?item_j.num:cby;
- }
- if(item_j.buyqty>0){
- var cby=item_j.buyqty-promgoodsbuynum;
- if(cby<=0) continue;//不能买就continue下一个
- item_j.num=cby>item_j.num?item_j.num:cby;
- }
- }
-
- item_j.haveAdded=1;
- item_j.showNum=true;
+ if (map[item_j.goods_id]) {
+ var cart_num = map[item_j.goods_id].goods_num;
+ item_j.num = cart_num;
+ item_j.cart_num = cart_num;
+ item_j.cart_id = map[item_j.goods_id].id;
+ if (item_j.buyqty > 0) {
+ var g_buy_num = 0;
+ var promgoodsbuynum = 0;
+ //----获取商品购买数----
+ await getApp().request.promiseGet("/api/weshop/ordergoods/getUserBuyGoodsNum", {
+ data: {
+ store_id: os.stoid,
+ user_id: user_id,
+ goods_id: item_j.goods_id,
+ prom_type: 7,
+ prom_id: th.data.act.id
+ },
+ }).then(res2 => {
+ if (res2.data.code == 0) {
+ var buy_num_data = res2.data.data;
+ if (buy_num_data.promgoodsbuynum) promgoodsbuynum = buy_num_data.promgoodsbuynum;
+ g_buy_num = buy_num_data.goodsbuynum;
+ }
+ })
+
+ if (item_j.viplimited > 0) {
+ var cby = item_j.viplimited - g_buy_num;
+ if (cby <= 0) continue; //不能买就continue下一个
+ item_j.num = cby > item_j.num ? item_j.num : cby;
+ }
+ if (item_j.buyqty > 0) {
+ var cby = item_j.buyqty - promgoodsbuynum;
+ if (cby <= 0) continue; //不能买就continue下一个
+ item_j.num = cby > item_j.num ? item_j.num : cby;
+ }
+ }
+
+ item_j.haveAdded = 1;
+ item_j.showNum = true;
}
}
- th.setData({list:th.data.list});
+ th.setData({
+ list: th.data.list
+ });
th.re_sum_price();
}
- }
- });
+ }
+ });
},
//滚动加载跟多的时候的计算
- async calc_more(list,func){
- var th=this;
- var map={};
- var mlist=this.data.cart_list;
- for(let i in mlist){
- let item=mlist[i];
- if(item.prom_type!=7) continue;
- if(item.prom_id!=th.data.act.id) continue;
- map[item.goods_id]=item;
+ async calc_more(list, func) {
+ var th = this;
+ var map = {};
+ var mlist = this.data.cart_list;
+ for (let i in mlist) {
+ let item = mlist[i];
+ if (item.prom_type != 7) continue;
+ if (item.prom_id != th.data.act.id) continue;
+ map[item.goods_id] = item;
}
- for(let j in list){
- let item_j=list[j];
- item_j.current_price=item_j.shop_price;
+ for (let j in list) {
+ let item_j = list[j];
+ item_j.current_price = item_j.shop_price;
- var card_price=0;
+ var card_price = 0;
//如果会员有等级价
if (th.data.card_field) {
card_price = item_j[th.data.card_field];
if (card_price > 0) {
- item_j.current_price=card_price;
+ item_j.current_price = card_price;
}
}
- if(map[item_j.goods_id]){
- var cart_num=map[item_j.goods_id].goods_num;
- item_j.num=cart_num;
- item_j.cart_num=cart_num;
- item_j.cart_id=map[item_j.goods_id].id;
- if(item_j.buyqty>0){
- var g_buy_num=0;
- var promgoodsbuynum=0;
+ if (map[item_j.goods_id]) {
+ var cart_num = map[item_j.goods_id].goods_num;
+ item_j.num = cart_num;
+ item_j.cart_num = cart_num;
+ item_j.cart_id = map[item_j.goods_id].id;
+ if (item_j.buyqty > 0) {
+ var g_buy_num = 0;
+ var promgoodsbuynum = 0;
//----获取商品购买数----
await getApp().request.promiseGet("/api/weshop/ordergoods/getUserBuyGoodsNum", {
data: {
@@ -2078,7 +2159,7 @@ Page({
prom_type: 7,
prom_id: th.data.act.id
},
- }).then(res2=>{
+ }).then(res2 => {
if (res2.data.code == 0) {
var buy_num_data = res2.data.data;
if (buy_num_data.promgoodsbuynum) promgoodsbuynum = buy_num_data.promgoodsbuynum;
@@ -2086,23 +2167,23 @@ Page({
}
})
- if(item_j.viplimited>0){
- var cby=item_j.viplimited-g_buy_num;
- if(cby<=0) continue;//不能买就continue下一个
- item_j.num=cby>item_j.num?item_j.num:cby;
+ if (item_j.viplimited > 0) {
+ var cby = item_j.viplimited - g_buy_num;
+ if (cby <= 0) continue; //不能买就continue下一个
+ item_j.num = cby > item_j.num ? item_j.num : cby;
}
- if(item_j.buyqty>0){
- var cby=item_j.buyqty-promgoodsbuynum;
- if(cby<=0) continue;//不能买就continue下一个
- item_j.num=cby>item_j.num?item_j.num:cby;
+ if (item_j.buyqty > 0) {
+ var cby = item_j.buyqty - promgoodsbuynum;
+ if (cby <= 0) continue; //不能买就continue下一个
+ item_j.num = cby > item_j.num ? item_j.num : cby;
}
}
- item_j.haveAdded=1;
- item_j.showNum=true;
+ item_j.haveAdded = 1;
+ item_j.showNum = true;
}
}
- if(func) func(list)
+ if (func) func(list)
}
diff --git a/packageB/pages/zuhegou/list/list.wxml b/packageB/pages/zuhegou/list/list.wxml
index bf1780c..73f7b78 100644
--- a/packageB/pages/zuhegou/list/list.wxml
+++ b/packageB/pages/zuhegou/list/list.wxml
@@ -23,19 +23,15 @@
-
-
-
-
@@ -47,78 +43,16 @@
组合数量: {{item.zhbuyqty}}
活动时间: {{filters.format_time(item.start_time) + '至' + filters.format_time(item.end_time)}}
-
¥
{{item.zhprice}}
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
没有相关内容
diff --git a/packageC/pages/luckyGo/luckyGo_cart/luckyGo_cart.js b/packageC/pages/luckyGo/luckyGo_cart/luckyGo_cart.js
index 6fbbaae..7e4956c 100644
--- a/packageC/pages/luckyGo/luckyGo_cart/luckyGo_cart.js
+++ b/packageC/pages/luckyGo/luckyGo_cart/luckyGo_cart.js
@@ -1272,9 +1272,10 @@ Page({
var all_cutprice = 0; //所有的优惠减
var all_zh_cutprice = 0; //所有的组合优惠减
var all_order_prom = 0; //所有的订单优惠
-
+ var out_of_weight=0; //超出多少重量
var umoney = th.data.userinfo.user_money - th.data.txmon - (th.data.userinfo.frozen_money ? th.data.userinfo.frozen_money : 0);
var freight_free = ee.freight_free; //全场满多少包邮
+ var weight_free = ee.weight_free; //多少kg内包邮
var no_ex_id = ee.no_ex_id;
var no_ex_good = null;
var by_qc = {};
@@ -1371,6 +1372,16 @@ Page({
o_price_no_zh += item[j].goods_price * item[j].goods_num;
}
o_price += item[j].goods_price * item[j].goods_num;
+
+ //判断是否有设置限制重量包邮
+ if(weight_free){
+ if( item[j]['exp_sum_type']==2 ){
+ if (goods_weight < 0) goods_weight = 0;
+ //累积商品重量 每种商品的重量 * 数量
+ goods_weight += item[j]['weight'] * item[j]['goods_num'];
+ out_of_weight = (weight_free*1000) - goods_weight;
+ }
+ }
}
//判断是不是有组合购的金额
var f_o_price = o_price;
@@ -1410,7 +1421,7 @@ Page({
//--有不包邮区域,且不免运费,全场的计算,要减到优惠金额 和券的金额--
- if (no_ex_id && freight_free > 0 && (o_price - quan_price) >= freight_free && cart_item.exp_type == 0 && (by_qc.region_list || by_qc.goods_list)) {
+ if (no_ex_id && freight_free > 0 && (o_price - quan_price) >= freight_free && cart_item.exp_type == 0 && (by_qc.region_list || by_qc.goods_list) && out_of_weight > 0) {
//如果有设置不包邮区域的时候
if (by_qc.region_list != "" && by_qc.region_list != null && by_qc.region_list != undefined) {
if (th.check_by_area(by_qc.region_list)) {
@@ -1533,13 +1544,13 @@ Page({
//统一运费
o_shipping_price += item[j]['uniform_exp_sum'];
break;
- case 2:
- +''
- if (goods_weight < 0) goods_weight = 0;
- //累积商品重量 每种商品的重量 * 数量
- goods_weight += item[j]['weight'] * item[j]['goods_num'];
-
- break;
+ // case 2: //1464行已计算 不必重复计算 注释为:判断是否有设置限制重量包邮
+ // +''
+ // if (goods_weight < 0) goods_weight = 0;
+ // //累积商品重量 每种商品的重量 * 数量
+ // goods_weight += item[j]['weight'] * item[j]['goods_num'];
+ // out_of_weight = (weight_free*1000) - goods_weight;
+ // break;
case 3:
if (goods_piece < 0) goods_piece = 0;
//累积商品数量
@@ -1548,6 +1559,11 @@ Page({
}
}
+ }else{
+ if(goods_weight && out_of_weight !== 0){
+ goods_weight=-1;
+ out_of_weight=0;
+ }
}
}
@@ -1558,7 +1574,7 @@ Page({
if (th.data.wu_arr && th.data.wu_arr[cart_item.wind])
code = th.data.wu_arr[cart_item.wind].code;
cart_item.shipping_price =
- th.calculatewuliu(code, o_shipping_price, goods_weight,
+ th.calculatewuliu(code, o_shipping_price, goods_weight,out_of_weight,
goods_piece, th.data.user_addr, freight_free, o_price - quan_price, rs);
if (!th.data.using_quan[pickid] || th.data.using_quan[pickid].isby != 1) {
@@ -1777,7 +1793,10 @@ Page({
to.getwuliuprice(async function (rs) {
var o_shipping_price = 0, goods_weight = -1, goods_piece = -1;
-
+ var out_of_weight=null; //超出多少重量
+ var freight_free = ee.freight_free; //全场满多少包邮
+ var weight_free = ee.weight_free; //多少kg内包邮
+ var no_ex_id = ee.no_ex_id;
//---如果有选择优惠券的情况下---
var quan_price = 0, bn_pick = th.data.bn_pick;
var quan_no = null;
@@ -1844,6 +1863,7 @@ Page({
if (goods_weight < 0) goods_weight = 0;
//累积商品重量 每种商品的重量 * 数量
goods_weight += good['weight'] * good['buynum'];
+ out_of_weight = (weight_free * 1000 ) - goods_weight;
break;
case 3:
if (goods_piece < 0) goods_piece = 0;
@@ -1854,8 +1874,7 @@ Page({
var code = "";
if (th.data.wu_arr && th.data.wu_arr[th.data.index]) code = th.data.wu_arr[th.data.index].code;
- var freight_free = ee.freight_free; //全场满多少包邮
- var no_ex_id = ee.no_ex_id;
+
th.data.is_no_by[th.data.bn_pick] = 0;
var no_by_data = null;
@@ -1891,12 +1910,12 @@ Page({
th.data.is_by[th.data.bn_pick] = 0;
//--------------开始计算物流------------------
var shipping_price =
- th.calculatewuliu(code, o_shipping_price, goods_weight,
+ th.calculatewuliu(code, o_shipping_price, goods_weight,out_of_weight,
goods_piece, th.data.user_addr, freight_free, parseFloat(allpice) - cut_price - quan_price, rs);
//如果有赠品的时候,也要计算赠品的物流费用
if (th.data.buy_now_gift_goods) {
- shipping_price = th.get_now_gift_goods_wuliu(code, o_shipping_price, th.data.user_addr, gift_freight_free,
+ shipping_price = th.get_now_gift_goods_wuliu(code, o_shipping_price, th.data.user_addr, gift_freight_free,out_of_weight,
parseFloat(allpice) - cut_price - quan_price, rs, shipping_price, no_by_data, goods_weight, goods_piece);
}
@@ -2832,12 +2851,12 @@ Page({
th.calculatePrice();
},
//-------------------计算物流---------------
- calculatewuliu: function (code, o_shipping_price, goods_weight,
+ calculatewuliu: function (code, o_shipping_price, goods_weight,out_of_weight,
goods_piece, user_addr, freight_free, o_price, rs) {
var price = 0, th = this;
price += parseFloat(o_shipping_price);
//如果是包邮
- if (freight_free > 0 && o_price >= freight_free) {
+ if (freight_free > 0 && o_price >= freight_free && out_of_weight > 0) {
return 0;
}
if (user_addr == null) {
@@ -2855,7 +2874,7 @@ Page({
item = item.config;
if (item == null) return o_shipping_price;
//------按重量----------
- if (goods_weight >= 0 && item['money']) {
+ if (goods_weight >= 0 && item['money'] && out_of_weight > 0) {
fw_price = parseFloat(item['money']);
if (goods_weight > item['first_weight']) {
var fw = goods_weight - item['first_weight'];
@@ -2863,6 +2882,13 @@ Page({
fw_price = fw_price + n * parseFloat(item['add_money']);
}
}
+ //------超出重量----------
+ if(out_of_weight < 0){
+ fw_price = parseFloat(item['money']);
+ var out_of_weight = Math.abs(out_of_weight);
+ var n = Math.ceil(out_of_weight / item['second_weight'])
+ fw_price = fw_price + n * parseFloat(item['add_money']);
+ }
//------按件数----------
if (goods_piece > 0 && item['piecemoney']) {
fp_price = parseFloat(item['piecemoney']);
@@ -3718,7 +3744,7 @@ Page({
},
//计算立即购买赠品的物流费用
- get_now_gift_goods_wuliu: function (code, o_shipping_price, user_addr, gift_freight_free, allpice, rs, shipping_price, no_by_data, goods_weight1, goods_piece1) {
+ get_now_gift_goods_wuliu: function (code, o_shipping_price, user_addr, gift_freight_free,gift_weight_free, allpice, rs, shipping_price, no_by_data, goods_weight1, goods_piece1) {
var good = this.data.buy_now_gift_goods;
var goods_weight = -1, goods_piece = -1;
var gift_shipping_price = 0;
@@ -3735,6 +3761,7 @@ Page({
goods_weight += good['weight'] * good['buynum'];
if (goods_weight1 > 0) {
goods_weight += goods_weight1;
+ out_of_weight = (gift_weight_free*1000) - goods_weight;
}
break;
case 3:
diff --git a/packageC/pages/presell/cart/cart2.js b/packageC/pages/presell/cart/cart2.js
index 150f762..0572787 100644
--- a/packageC/pages/presell/cart/cart2.js
+++ b/packageC/pages/presell/cart/cart2.js
@@ -612,7 +612,10 @@ Page({
to.getwuliuprice(async function (rs) {
var o_shipping_price = 0, goods_weight = -1, goods_piece = -1;
-
+ var out_of_weight=null; //超出多少重量
+ var freight_free = ee.freight_free; //全场满多少包邮
+ var weight_free = ee.weight_free; //多少kg内包邮
+ var no_ex_id = ee.no_ex_id;
//---如果有选择优惠券的情况下---
var quan_price = 0, bn_pick = th.data.bn_pick;
var quan_no = null;
@@ -679,6 +682,7 @@ Page({
if (goods_weight < 0) goods_weight = 0;
//累积商品重量 每种商品的重量 * 数量
goods_weight += good['weight'] * good['buynum'];
+ out_of_weight = (weight_free * 1000 ) - goods_weight;
break;
case 3:
if (goods_piece < 0) goods_piece = 0;
@@ -689,8 +693,7 @@ Page({
var code = "";
if (th.data.wu_arr && th.data.wu_arr[th.data.index]) code = th.data.wu_arr[th.data.index].code;
- var freight_free = ee.freight_free; //全场满多少包邮
- var no_ex_id = ee.no_ex_id;
+
th.data.is_no_by[th.data.bn_pick] = 0;
var no_by_data = null;
@@ -726,12 +729,12 @@ Page({
th.data.is_by[th.data.bn_pick] = 0;
//--------------开始计算物流------------------
var shipping_price =
- th.calculatewuliu(code, o_shipping_price, goods_weight,
+ th.calculatewuliu(code, o_shipping_price, goods_weight,out_of_weight,
goods_piece, th.data.user_addr, freight_free, parseFloat(allpice) - cut_price - quan_price, rs);
//如果有赠品的时候,也要计算赠品的物流费用
if (th.data.buy_now_gift_goods) {
- shipping_price = th.get_now_gift_goods_wuliu(code, o_shipping_price, th.data.user_addr, gift_freight_free,
+ shipping_price = th.get_now_gift_goods_wuliu(code, o_shipping_price, th.data.user_addr, gift_freight_free,gift_weight_free,
parseFloat(allpice) - cut_price - quan_price, rs, shipping_price, no_by_data, goods_weight, goods_piece);
}
@@ -1665,12 +1668,12 @@ Page({
th.calculatePrice();
},
//-------------------计算物流---------------
- calculatewuliu: function (code, o_shipping_price, goods_weight,
+ calculatewuliu: function (code, o_shipping_price, goods_weight,out_of_weight,
goods_piece, user_addr, freight_free, o_price, rs) {
var price = 0, th = this;
price += parseFloat(o_shipping_price);
//如果是包邮
- if (freight_free > 0 && o_price >= freight_free) {
+ if (freight_free > 0 && o_price >= freight_free && out_of_weight > 0) {
return 0;
}
if (user_addr == null) {
@@ -1688,7 +1691,7 @@ Page({
item = item.config;
if (item == null) return o_shipping_price;
//------按重量----------
- if (goods_weight >= 0 && item['money']) {
+ if (goods_weight >= 0 && item['money'] && out_of_weight > 0) {
fw_price = parseFloat(item['money']);
if (goods_weight > item['first_weight']) {
var fw = goods_weight - item['first_weight'];
@@ -1696,6 +1699,14 @@ Page({
fw_price = fw_price + n * parseFloat(item['add_money']);
}
}
+
+ //------超出重量----------
+ if(out_of_weight < 0){
+ fw_price = parseFloat(item['money']);
+ var out_of_weight = Math.abs(out_of_weight);
+ var n = Math.ceil(out_of_weight / item['second_weight'])
+ fw_price = fw_price + n * parseFloat(item['add_money']);
+ }
//------按件数----------
if (goods_piece > 0 && item['piecemoney']) {
fp_price = parseFloat(item['piecemoney']);
@@ -2527,7 +2538,7 @@ Page({
},
//计算立即购买赠品的物流费用
- get_now_gift_goods_wuliu: function (code, o_shipping_price, user_addr, gift_freight_free, allpice, rs, shipping_price, no_by_data, goods_weight1, goods_piece1) {
+ get_now_gift_goods_wuliu: function (code, o_shipping_price, user_addr, gift_freight_free,gift_weight_free, allpice, rs, shipping_price, no_by_data, goods_weight1, goods_piece1) {
var good = this.data.buy_now_gift_goods;
var goods_weight = -1, goods_piece = -1;
var gift_shipping_price = 0;
@@ -2544,6 +2555,7 @@ Page({
goods_weight += good['weight'] * good['buynum'];
if (goods_weight1 > 0) {
goods_weight += goods_weight1;
+ out_of_weight = (gift_weight_free*1000) - goods_weight;
}
break;
case 3:
diff --git a/packageC/pages/presell/goodsInfo/goodsInfo.wxml b/packageC/pages/presell/goodsInfo/goodsInfo.wxml
index b5d9f66..10c8c60 100644
--- a/packageC/pages/presell/goodsInfo/goodsInfo.wxml
+++ b/packageC/pages/presell/goodsInfo/goodsInfo.wxml
@@ -16,6 +16,22 @@
+
+
+
+
+
+
+
+
+
+
+ abson下单成功
+
+
+
+
+
diff --git a/pages/activity/pind_list/pind_list.js b/pages/activity/pind_list/pind_list.js
index 254970d..82fb069 100644
--- a/pages/activity/pind_list/pind_list.js
+++ b/pages/activity/pind_list/pind_list.js
@@ -1,95 +1,109 @@
-var e = getApp(),
-i = e.request,
- a = e.globalData.setting,
- os=a,ut = require("../../../utils/util.js");
+var e = getApp(),
+ i = e.request,
+ a = e.globalData.setting,
+ os = a,
+ ut = require("../../../utils/util.js");
var regeneratorRuntime = require('../../../utils/runtime.js');
-Page({
- data: {
- url: a.imghost,
- killtime: null,
- currentPage: 1,
- goodlist: null,
- type:1,
- timer:null,
- ismore:1,
- isshow:0,
- iurl: os.imghost,
- ad_data:null,
- max_sw_height:200,
- },
-
- //------初始化加载----------
- onLoad: function(t) {
- wx.setNavigationBarTitle({ title: "天天拼单",})
- var first_leader = t.first_leader;
- var th=this;
-
- console.log("------------");
- console.log(first_leader);
- getApp().getConfig();
-
- if (first_leader) {
- getApp().globalData.first_leader = first_leader;
- //调用接口判断是不是会员
- 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;
- }
- })
+Page({
+ data: {
+ url: a.imghost,
+ killtime: null,
+ currentPage: 1,
+ goodlist: [],
+ type: 1,
+ timer: null,
+ ismore: 1,
+ isshow: 0,
+ iurl: os.imghost,
+ ad_data: null,
+ max_sw_height: 200,
+ },
+
+ //------初始化加载----------
+ onLoad: function (t) {
+ wx.setNavigationBarTitle({
+ title: "天天拼单",
+ })
+ var first_leader = t.first_leader;
+ var th = this;
+
+ console.log("------------");
+ console.log(first_leader);
+ getApp().getConfig();
+
+ if (first_leader) {
+ getApp().globalData.first_leader = first_leader;
+ //调用接口判断是不是会员
+ 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().request.promiseGet("/api/weshop/ad/page?pid=801&store_id=" + os.stoid, {
- data: {
- enabled: 1
- }
- }).then(res => {
- if(res.data.code==0 && res.data.data && res.data.data.pageData && res.data.data.pageData.length>0){
- var a = res.data.data.pageData;
- var narr=[];
- for(var i in a){
- var tt = {
- 'ad_code': os.imghost + a[i].ad_code,
- 'media_link': '',
- 'ad_weapplink':a[i].ad_weapplink
- };
- narr.push(tt);
- }
-
- th.setData({ad_data:narr});
- }
- })
- },
-
- onShow: function(t) {
-
- this.data.is_timer=1;
- this.data.currentPage=1;
- this.data.ismore=1;
- this.setData({goodlist:null});
- var th=this;
- this.requestSalelist();
- //设置全局定时器
- th.data.timer=setInterval(function () {
- th.countDown();
- },1000);
- },
-
- onHide:function(){
- //--清理定时器--
- clearInterval(this.timer);
- this.setData({isshow:0});
- },
-
- //---小于10的格式化函数----
- timeFormat(param) {
- return param < 10 ? '0' + param : param;
- },
+ })
+ }
+
+ getApp().request.promiseGet("/api/weshop/ad/page?pid=801&store_id=" + os.stoid, {
+ data: {
+ enabled: 1
+ }
+ }).then(res => {
+ if (res.data.code == 0 && res.data.data && res.data.data.pageData && res.data.data.pageData.length > 0) {
+ var a = res.data.data.pageData;
+ var narr = [];
+ for (var i in a) {
+ var tt = {
+ 'ad_code': os.imghost + a[i].ad_code,
+ 'media_link': '',
+ 'ad_weapplink': a[i].ad_weapplink
+ };
+ narr.push(tt);
+ }
+
+ th.setData({
+ ad_data: narr
+ });
+ }
+ })
+
+ },
+
+ onShow: function (t) {
+
+ this.data.is_timer = 1;
+ this.data.currentPage = 1;
+ this.data.ismore = 1;
+ var th = this;
+ var userInfo = wx.getStorageSync('userinfo');
+ console.log(userInfo,30000);
+ if (userInfo && th.data.goodlist.length==0) {
+ //调用列表
+ this.requestSalelist(userInfo.user_id);
+ } else {
+ getApp().goto("/pages/togoin/togoin");
+ }
+ //设置全局定时器
+ th.data.timer = setInterval(function () {
+ th.countDown();
+ }, 1000);
+ },
+
+ onHide: function () {
+ //--清理定时器--
+ clearInterval(this.timer);
+ this.setData({
+ isshow: 0
+ });
+ },
+
+ //---小于10的格式化函数----
+ timeFormat(param) {
+ return param < 10 ? '0' + param : param;
+ },
//----倒计时函数-----
- countDown() {
- if(!this.data.goodlist) return false;
- var th=this;
+ countDown() {
+ if (!this.data.goodlist) return false;
+ var th = this;
// 获取当前时间,同时得到活动结束时间数组
var newTime = ut.gettimestamp();
var endTimeList = this.data.goodlist;
@@ -119,119 +133,138 @@ Page({
}
},
- //读取数据
- async requestSalelist(){
- if(!this.data.ismore) return false;
- var e = this,th=e,i = "/api/weshop/teamlist/pageteam/"+th.data.type+"?page=" + e.data.currentPage;
- var plist=null,alllist=th.data.goodlist;
- if(!alllist) alllist=[];
-
- await getApp().request.promiseGet(i,
- {isShowLoading:1,data:{store_id:os.stoid,is_end:0,is_show:1}}
- ).then(res=>{
- if(ut.ajax_ok(res)) plist=res.data.data.pageData;
- });
+ //读取数据
+ async requestSalelist(user_id) {
+ if (!this.data.ismore) return false;
+ var e = this,
+ th = e,
+ i = "/api/weshop/teamlist/pageteam/" + th.data.type + "?page=" + e.data.currentPage;
+ var plist = null,
+ alllist = th.data.goodlist;
+ if (!alllist) alllist = [];
+ await getApp().request.promiseGet(i, {
+ isShowLoading: 1,
+ data: {
+ store_id: os.stoid,
+ is_end: 0,
+ is_show: 1,
+ user_id,
+ }
+ }).then(res => {
+ plist = res.data.data.pageData;
+ });
- if(!plist || plist.length<=0){
- getApp().showWarning("没有更多数据");
- th.data.ismore=0;
- return false;
- }
- //--循环读取接口---
- for(var i=0;i{
- if(res.data.code==0){
- plist[i].status=1;
- if(res.data.data<=0) plist[i].status=3;
- }
- });
- alllist.push(plist[i]);
- }
- e.data.currentPage++;
-
- th.setData({goodlist:alllist,isshow:1});
- },
-
- onPullDownRefresh: function() {
- this.reloadGoodList();
- },
- reloadGoodList: function() {
- this.data.goodlist = null, this.data.currentPage = 1, this.requestSalelist();
- },
- onReachBottom: function() {
- this.requestSalelist();
- },
-
- //点击tab事件
- tip:function(e){
- var a=e.currentTarget.dataset.ty,th=this; th.data.ismore=1;th.data.currentPage=1;
- this.setData({type:a,goodlist:null});
- this.reloadGoodList();
- },
-
-
-
- //---------分享配置--------
- onShareAppMessage: function (e) {
- var curPage=this;
- var pagePath = curPage.route; //当前页面url
- if (pagePath.indexOf('/') != 0) {
- pagePath = '/' + pagePath;
+ if (plist.length <= 0) {
+ getApp().showWarning("没有更多数据");
+ th.data.ismore = 0;
+ }
+ //--循环读取接口---
+ for (var i = 0; i < plist.length; i++) {
+ var prom_id = plist[i].id;
+ await getApp().request.promiseGet("/api/weshop/activitylist/getActLen/" +
+ os.stoid + "/6/" + prom_id, {}).then(res => {
+ if (res.data.code == 0) {
+ plist[i].status = 1;
+ if (res.data.data <= 0) plist[i].status = 3;
}
- if(getApp().globalData.user_id){
+ });
+ alllist.push(plist[i]);
+ }
+ e.data.currentPage++;
- if(pagePath.indexOf("?")>0){
- pagePath+="&first_leader="+getApp().globalData.user_id;
- }else{
- pagePath+="?first_leader="+getApp().globalData.user_id;
- }
- }
+ th.setData({
+ goodlist: alllist,
+ isshow: 1,
+ ismore:0,
+ });
+ },
- console.log("11"+pagePath);
+ onPullDownRefresh: function () {
+ this.reloadGoodList();
+ },
+ reloadGoodList: function () {
+ this.data.goodlist = null, this.data.currentPage = 1, this.requestSalelist();
+ },
+ onReachBottom: function () {
+ this.requestSalelist();
+ },
- return {
- title: "限时团购",
- path:pagePath,
- }
- },
-
-
-
-
- //图片失败,默认图片
- bind_bnerr2: function (e) {
- var _errImg = e.target.dataset.errorimg;
- var val = e.target.dataset.val;
- if(val!="/public/images/default_goods_image_240.gif"){
- var _errObj = {};
- _errObj[_errImg] = "/public/images/default_goods_image_240.gif";
- this.setData(_errObj) //注意这里的赋值方式,只是将数据列表中的此项图片路径值替换掉 ;
- }
- },
-
- imageLoad:function(e){
- var imgwidth = e.detail.width;
- var imgheight = e.detail.height;
- //宽高比
- var ratio = imgwidth / imgheight;
- //计算的高度值
- var viewHeight = 750 / ratio;
- var hei=this.data.max_sw_height;
-
- if (hei< viewHeight) {
- this.setData({ max_sw_height: viewHeight });
- }
- },
-
- onShareTimeline() {
- var store_name=getApp().globalData.config?getApp().globalData.config.store_name:'';
- if(!store_name)
- store_name=getApp().globalData.setting.appName;
- return {
- title: '秒杀活动-' + store_name,
- }
- },
-
-});
+ //点击tab事件
+ tip: function (e) {
+ var a = e.currentTarget.dataset.ty,
+ th = this;
+ th.data.ismore = 1;
+ th.data.currentPage = 1;
+ this.setData({
+ type: a,
+ goodlist: []
+ });
+ this.reloadGoodList();
+ },
+
+
+
+ //---------分享配置--------
+ onShareAppMessage: function (e) {
+ var curPage = this;
+ var pagePath = curPage.route; //当前页面url
+ if (pagePath.indexOf('/') != 0) {
+ pagePath = '/' + pagePath;
+ }
+ if (getApp().globalData.user_id) {
+
+ if (pagePath.indexOf("?") > 0) {
+ pagePath += "&first_leader=" + getApp().globalData.user_id;
+ } else {
+ pagePath += "?first_leader=" + getApp().globalData.user_id;
+ }
+ }
+
+ console.log("11" + pagePath);
+
+ return {
+ title: "限时团购",
+ path: pagePath,
+ }
+ },
+
+
+
+
+ //图片失败,默认图片
+ bind_bnerr2: function (e) {
+ var _errImg = e.target.dataset.errorimg;
+ var val = e.target.dataset.val;
+ if (val != "/public/images/default_goods_image_240.gif") {
+ var _errObj = {};
+ _errObj[_errImg] = "/public/images/default_goods_image_240.gif";
+ this.setData(_errObj) //注意这里的赋值方式,只是将数据列表中的此项图片路径值替换掉 ;
+ }
+ },
+
+ imageLoad: function (e) {
+ var imgwidth = e.detail.width;
+ var imgheight = e.detail.height;
+ //宽高比
+ var ratio = imgwidth / imgheight;
+ //计算的高度值
+ var viewHeight = 750 / ratio;
+ var hei = this.data.max_sw_height;
+
+ if (hei < viewHeight) {
+ this.setData({
+ max_sw_height: viewHeight
+ });
+ }
+ },
+
+ onShareTimeline() {
+ var store_name = getApp().globalData.config ? getApp().globalData.config.store_name : '';
+ if (!store_name)
+ store_name = getApp().globalData.setting.appName;
+ return {
+ title: '秒杀活动-' + store_name,
+ }
+ },
+
+});
\ No newline at end of file
diff --git a/pages/activity/pind_list/pind_list.wxml b/pages/activity/pind_list/pind_list.wxml
index 4346863..388283d 100644
--- a/pages/activity/pind_list/pind_list.wxml
+++ b/pages/activity/pind_list/pind_list.wxml
@@ -104,7 +104,7 @@
-没有相关内容
+没有相关内容
diff --git a/pages/cart/cart/cart.js b/pages/cart/cart/cart.js
index b847d39..3573ece 100644
--- a/pages/cart/cart/cart.js
+++ b/pages/cart/cart/cart.js
@@ -1,7 +1,7 @@
var t = getApp(),
a = t.request,
oo = t.globalData.setting,
- os=oo,
+ os = oo,
app = getApp(),
rq = t.request,
ut = require("../../../utils/util.js"),
@@ -9,6 +9,7 @@ var t = getApp(),
ladder_calc = require("ladder_calculate.js");
var regeneratorRuntime = require('../../../utils/runtime.js');
+
Page({
data: {
url: t.globalData.setting.url,
@@ -41,33 +42,35 @@ Page({
in_zhact_gdmap:{}, //不同门店参与同一活动的限购
ladder_map:{}, //阶梯促销需要的map
+
},
- onLoad: function() {
- var a = this,ee=a;
+ onLoad: function () {
+ var a = this,
+ ee = a;
//----获取系统参数-----
- getApp().getConfig2(function(e) {
- ee.setData({
- bconfig: e,
- sales_rules:e.sales_rules
- });
- })
+ // getApp().getConfig2(function (e) {
+ // ee.setData({
+ // bconfig: e,
+ // sales_rules: e.sales_rules
+ // });
+ // })
wx.setNavigationBarTitle({
title: "购物车",
})
//判断是否有登录
- t.auth.hadAuth() && t.getUserInfo(function() {
+ t.auth.hadAuth() && t.getUserInfo(function () {
//a.getCardList();
});
},
- onShow: function() {
+ onShow: function () {
//每次显示都清空
- this.data.in_zhact_gdmap={};
+ this.data.in_zhact_gdmap = {};
if (typeof this.getTabBar === 'function' && this.getTabBar()) {
- var index=getApp().getPageIndex(this);
+ var index = getApp().getPageIndex(this);
this.getTabBar().setData({
active: index //数字是当前页面在tabbar的索引
})
@@ -76,7 +79,10 @@ Page({
}
var th = this;
- this.setData({requestData:null,is_load:0});
+ this.setData({
+ requestData: null,
+ is_load: 0
+ });
//调用底部导航
//t.editTabBar(th,getApp().globalData.setting.stoid,getApp().globalData.url);
//----获取系统参数-----
@@ -84,7 +90,10 @@ Page({
var json_d = JSON.parse(e.switch_list);
var is_open_offline=json_d.is_pricing_open;
th.setData({
- bconfig: e,sales_rules:e.sales_rules
+ bconfig: e,
+ freight_free:e.freight_free,
+ weight_free:e.weight_free,
+ sales_rules:e.sales_rules,
});
getApp().request.promiseGet("/store/storemoduleendtime/page?store_id=" +os.stoid + "&type=6",{}).then(res=>{
//未购买
@@ -131,58 +140,60 @@ Page({
is_end: 0,
is_show: 1,
pageSize: 1,
- user_id:user_id
+ user_id: user_id
}
- //--获取是否又秒杀活动--
- getApp().request.promiseGet("/api/ms/flash_sale/spikepage", {
- data:req_d,
- }).then(res => {
- if (res.data.code == 0 && res.data.data && res.data.data.pageData.length > 0) {
- th.setData({
- is_has_flash: 1
- })
- }
- });
- }
- })
-
-
+ //--获取是否又秒杀活动--
+ getApp().request.promiseGet("/api/ms/flash_sale/spikepage", {
+ data: req_d,
+ }).then(res => {
+ if (res.data.code == 0 && res.data.data && res.data.data.pageData.length > 0) {
+ th.setData({
+ is_has_flash: 1
+ })
+ }
+ });
+ }
+ })
+
+
},
- onHide(){
- this.data.zuhe_map={};
+ onHide() {
+ this.data.zuhe_map = {};
},
- onUnLoad(){
- getApp().globalData.cart_zh_act=null;
+ onUnLoad() {
+ getApp().globalData.cart_zh_act = null;
},
//-------------获取购物车列表,要安装门店进行分类订单-----------
- getCardList: function() {
-
+ getCardList: function () {
+
var th = this;
//要获取会员是不是等级会员
- getApp().getConfig2(function(conf){
+ getApp().getConfig2(function (conf) {
//--- 看后台是不是有开通等级卡 ---
- if(conf.switch_list){
- var s_list=JSON.parse(conf.switch_list);
- var user=getApp().globalData.userInfo;
+ if (conf.switch_list) {
+ var s_list = JSON.parse(conf.switch_list);
+ var user = getApp().globalData.userInfo;
//如果后台有开启等级价的功能
- if(user && parseInt(s_list.rank_switch)==2 && user['card_expiredate']){
+ if (user && parseInt(s_list.rank_switch) == 2 && user['card_expiredate']) {
var str = user['card_expiredate'].replace(/-/g, '/');
var end = new Date(str);
end = Date.parse(end) / 1000;
var now = ut.gettimestamp();
//--- 判断是等级会员,且在有效期范围内 ---
- if(user.card_field && now0) {
- var g_arr=[];
+ if (carr && carr.length > 0) {
+ var g_arr = [];
for (var i = 0; i < carr.length; i++) {
- if(g_arr.length==0) g_arr.push(carr[i].goods_id);
- else{
- var ind=g_arr.findIndex(function (ele) {
- return ele.goods_id==carr[i].goods_id
- })
- if(ind>-1) continue;
- g_arr.push(carr[i].goods_id)
- }
+ if (g_arr.length == 0) g_arr.push(carr[i].goods_id);
+ else {
+ var ind = g_arr.findIndex(function (ele) {
+ return ele.goods_id == carr[i].goods_id
+ })
+ if (ind > -1) continue;
+ g_arr.push(carr[i].goods_id)
+ }
}
- var by_map=null;
+ var by_map = null;
//--要获得商品,该用户买了多少件,同步应用--
await getApp().request.promiseGet("/api/weshop/ordergoods/listUserBuyGoodsNum", {
data: {
@@ -253,11 +263,11 @@ Page({
},
}).then(res => {
- if(res.data.code==0 && res.data.data && res.data.data.length>0){
- by_map={};
- for(let i in res.data.data){
- let item=res.data.data[i];
- by_map[item.goods_id]=item;
+ if (res.data.code == 0 && res.data.data && res.data.data.length > 0) {
+ by_map = {};
+ for (let i in res.data.data) {
+ let item = res.data.data[i];
+ by_map[item.goods_id] = item;
}
}
})
@@ -265,11 +275,10 @@ Page({
for (var i = 0; i < carr.length; i++) {
var item = carr[i];
var good = item;
- if(item.is_gift){
+ if (item.is_gift) {
var url = '/api/weshop/cart/del/' + oo.stoid + '/' + item.id;
getApp().request.delete(url, {
- success: function (t) {
- }
+ success: function (t) {}
});
//商品已经下架
continue;
@@ -280,77 +289,92 @@ Page({
if ((good.down_time > 0 && good.down_time < tt) || good.is_on_sale == 0) {
var url = '/api/weshop/cart/del/' + oo.stoid + '/' + item.id;
getApp().request.delete(url, {
- success: function (t) {
- }
+ success: function (t) {}
});
//商品已经下架
continue;
}
- var goodsbuynum=0,promgoodsbuynum=0,limit=0;
- if(by_map && by_map[good.goods_id]){
- goodsbuynum=by_map[good.goods_id].goodsbuynum;
- promgoodsbuynum=by_map[good.goods_id].promgoodsbuynum;
+ var goodsbuynum = 0,
+ promgoodsbuynum = 0,
+ limit = 0;
+ if (by_map && by_map[good.goods_id]) {
+ goodsbuynum = by_map[good.goods_id].goodsbuynum;
+ promgoodsbuynum = by_map[good.goods_id].promgoodsbuynum;
}
- limit=good.viplimited;
+ limit = good.viplimited;
//判断商品的限购
- if(item.goods_num+goodsbuynum>limit && limit>0){
- var cbuy=limit-goodsbuynum;
- if(cbuy<=0){
+ if (item.goods_num + goodsbuynum > limit && limit > 0) {
+ var cbuy = limit - goodsbuynum;
+ if (cbuy <= 0) {
var url = '/api/weshop/cart/del/' + oo.stoid + '/' + item.id;
a.delete(url, {});
continue;
}
//-- 购物车更新 --
- var updata1={id: item.id,goods_num:cbuy,store_id:os.stoid,user_id:getApp().globalData.userInfo.user_id };
+ var updata1 = {
+ id: item.id,
+ goods_num: cbuy,
+ store_id: os.stoid,
+ user_id: getApp().globalData.userInfo.user_id
+ };
getApp().request.put("/api/weshop/cart/update", {
data: updata1,
})
- item.goods_num=cbuy;
+ item.goods_num = cbuy;
}
//如果秒杀活动都去掉了,或者结束了,那么这个商品也没有必要留着
if (item.prom_type == 1) {
var prom = null;
var now = ut.gettimestamp();
- await getApp().request.promiseGet("/api/ms/flash_sale/getNew/" + os.stoid +'/'+user_id+ "/" + item.prom_id, {}).then(res => {
- if (res.data.code == 0){
+ await getApp().request.promiseGet("/api/ms/flash_sale/getNew/" + os.stoid + '/' + user_id + "/" + item.prom_id, {}).then(res => {
+ if (res.data.code == 0) {
prom = res.data.data;
- prom.price=prom.user_price;
+ prom.price = prom.user_price;
}
})
//---如果互动都已经过期,或者还未开始,或者无活动
if (!prom || prom.is_end == 1 || prom.end_time < now || prom.start_time > now) {
var url = '/api/weshop/cart/del/' + oo.stoid + '/' + item.id;
a.delete(url, {
- success: function (t) {
- }
+ success: function (t) {}
});
//商品已经下架
continue;
}
//判断秒杀的限购
- if(item.goods_num+promgoodsbuynum>prom.buy_limit && prom.buy_limit>0){
- var cbuy=prom.buy_limit-promgoodsbuynum;
- if(cbuy<=0){
+ if (item.goods_num + promgoodsbuynum > prom.buy_limit && prom.buy_limit > 0) {
+ var cbuy = prom.buy_limit - promgoodsbuynum;
+ if (cbuy <= 0) {
var url = '/api/weshop/cart/del/' + oo.stoid + '/' + item.id;
a.delete(url, {});
continue;
}
//-- 购物车更新 --
- var updata1={id: item.id,goods_num:cbuy,store_id:os.stoid,user_id:getApp().globalData.userInfo.user_id };
+ var updata1 = {
+ id: item.id,
+ goods_num: cbuy,
+ store_id: os.stoid,
+ user_id: getApp().globalData.userInfo.user_id
+ };
getApp().request.put("/api/weshop/cart/update", {
data: updata1,
})
- item.goods_num=cbuy;
+ item.goods_num = cbuy;
}
//价格不对,就要更新一下
- if(good.goods_price!=prom.price){
- good.goods_price=prom.price;
+ if (good.goods_price != prom.price) {
+ good.goods_price = prom.price;
//-- 购物车更新秒杀价格 --
- var updata1={id: item.id,goods_price:prom.price,store_id:os.stoid,user_id:getApp().globalData.userInfo.user_id };
+ var updata1 = {
+ id: item.id,
+ goods_price: prom.price,
+ store_id: os.stoid,
+ user_id: getApp().globalData.userInfo.user_id
+ };
getApp().request.put("/api/weshop/cart/update", {
data: updata1,
})
@@ -371,13 +395,12 @@ Page({
let item=res.data.data[i];
if(item.prom_type==3) {
is_g_prom=1; break;
-
}
}
}
})
- if(is_g_prom){
+ if (is_g_prom) {
await getApp().request.promiseGet("/api/weshop/goods/getGoodsPromList/" + os.stoid + "/" + item.goods_id + "/1", {}).then(res => {
if (res.data.code == 0) {
var r_data = res.data.data;
@@ -386,9 +409,9 @@ Page({
getApp().request.delete(url, {});
//商品已经无活动
isok = 0;
- }else{
+ } else {
//如果活动的ID不一样,说明原先的活动已经没有参与了或者过期了
- if(item.prom_id!=r_data.promGoodsLists[0].prom_id ){
+ if (item.prom_id != r_data.promGoodsLists[0].prom_id) {
var url = '/api/weshop/cart/del/' + oo.stoid + '/' + item.id;
getApp().request.delete(url, {});
//商品已经下架
@@ -404,7 +427,7 @@ Page({
}
})
- }else{
+ } else {
await getApp().request.promiseGet("/api/weshop/goods/getGoodsPromNormal/" + os.stoid + "/" + item.goods_id, {}).then(res => {
if (res.data.code == 0) {
var r_data = res.data.data;
@@ -413,9 +436,9 @@ Page({
getApp().request.delete(url, {});
//商品已经无活动
isok = 0;
- }else{
+ } else {
//如果活动的ID不一样,说明原先的活动已经没有参与了或者过期了
- if(item.prom_id!=r_data.promGoodsLists[0].prom_id ){
+ if (item.prom_id != r_data.promGoodsLists[0].prom_id) {
var url = '/api/weshop/cart/del/' + oo.stoid + '/' + item.id;
getApp().request.delete(url, {});
//商品已经下架
@@ -434,47 +457,47 @@ Page({
}
if (!isok) continue;
-
}
else if (item.prom_type == 7) {
if(!th.data.zuhe_map[item.prom_id]){
+
//如果有组合购
var isok = 1;
- var is_flag=1;
- var act=null;
- var url="/api/weshop/prom/zhbuy/get/"+os.stoid+"/"+item.prom_id+"/"+getApp().globalData.userInfo.user_id;
+ var is_flag = 1;
+ var act = null;
+ var url = "/api/weshop/prom/zhbuy/get/" + os.stoid + "/" + item.prom_id + "/" + getApp().globalData.userInfo.user_id;
await getApp().request.promiseGet(url, {}).then(res => {
- console.log(res,1000);
- if(res.data.code==0 && res.data.data){
- if(res.data.data.is_show!=1){
- isok=0;
- }
- //如果活动已经结束
- if(res.data.data.is_end==1){
- isok=0;
- }
- //已经结束
- if(ut.gettimestamp()>res.data.data.end_time){
- isok=0;
- }
- //还未开始
- if(ut.gettimestamp() res.data.data.end_time) {
+ isok = 0;
+ }
+ //还未开始
+ if (ut.gettimestamp() < res.data.data.start_time) {
+ isok = 0;
+ }
+ act = res.data.data;
+
+ } else {
+ //未找到商品的活动
+ is_flag = 0;
+ }
})
- if (!isok){
+ if (!isok) {
var url = '/api/weshop/cart/del/' + oo.stoid + '/' + item.id;
getApp().request.delete(url, {});
- th.data.zuhe_map[item.prom_id]=-1;
+ th.data.zuhe_map[item.prom_id] = -1;
continue;
}
- th.data.zuhe_map[item.prom_id]=act;
+ th.data.zuhe_map[item.prom_id] = act;
var url1 = "/api/weshop/prom/zhbuyGoods/page";
var req_data = {
page: 1,
@@ -485,37 +508,37 @@ Page({
await getApp().request.promiseGet(url1, {
data: req_data
}).then(res => {
- console.log(res,2000);
+ console.log(res, 2000);
if (ut.ajax_ok(res)) {
var gdlist = res.data.data.pageData;
- gdlist.forEach(i=>{
- if(item.goods_id==i.goods_id&&!is_flag){
- item.prom_type=0;
- item.prom_type1=0;
- item.prom_id=0;
- item.prom_id1=0
+ gdlist.forEach(i => {
+ if (item.goods_id == i.goods_id && !is_flag) {
+ item.prom_type = 0;
+ item.prom_type1 = 0;
+ item.prom_id = 0;
+ item.prom_id1 = 0
}
})
- th.data.zuhe_map_good[item.prom_id]=gdlist;
+ th.data.zuhe_map_good[item.prom_id] = gdlist;
}
})
}
- if(th.data.zuhe_map[item.prom_id] && th.data.zuhe_map[item.prom_id]!=-1 ){
- var gdlist=th.data.zuhe_map_good[item.prom_id];
- var t_item=gdlist.find(function (ele) {
- return ele.goods_id==item.goods_id
+ if (th.data.zuhe_map[item.prom_id] && th.data.zuhe_map[item.prom_id] != -1) {
+ var gdlist = th.data.zuhe_map_good[item.prom_id];
+ var t_item = gdlist.find(function (ele) {
+ return ele.goods_id == item.goods_id
})
- if(!t_item){
+ if (!t_item) {
var url = '/api/weshop/cart/del/' + oo.stoid + '/' + item.id;
getApp().request.delete(url, {});
- th.data.zuhe_map[item.prom_id]=-1;
+ th.data.zuhe_map[item.prom_id] = -1;
continue;
}
- item.buyqty=t_item.buyqty;
- item.zh_b_num=promgoodsbuynum;
- item.act=th.data.zuhe_map[item.prom_id];
- }//else{
+ item.buyqty = t_item.buyqty;
+ item.zh_b_num = promgoodsbuynum;
+ item.act = th.data.zuhe_map[item.prom_id];
+ } //else{
// var url = '/api/weshop/cart/del/' + oo.stoid + '/' + item.id;
// getApp().request.delete(url, {});
// th.data.zuhe_map[item.prom_id]=-1;
@@ -524,7 +547,7 @@ Page({
}
else if (item.prom_type == 10) {
if(!th.data.ladder_map[item.prom_id]){
- //如果有组合购
+ //如果有阶梯购
var isok = 1;
var is_flag=1;
var act=null;
@@ -585,6 +608,7 @@ Page({
}
else if(item.prom_type == 0) {
+
//如果有优惠活动,要更新活动
await getApp().request.promiseGet("/api/weshop/goods/getGoodsPromList/" + os.stoid + "/" + item.goods_id + "/1", {}).then(res => {
if (res.data.code == 0) {
@@ -592,7 +616,12 @@ Page({
if (r_data.promGoodsLists) {
var url = '/api/weshop/cart/update';
getApp().request.put(url, {
- data:{id:item.id,store_id:oo.stoid,prom_type:3,prom_id:r_data.promGoodsLists[0].prom_id}
+ data: {
+ id: item.id,
+ store_id: oo.stoid,
+ prom_type: 3,
+ prom_id: r_data.promGoodsLists[0].prom_id
+ }
});
item.prom_type=3;
item.prom_id=r_data.promGoodsLists[0].prom_id;
@@ -681,19 +710,27 @@ Page({
all_num += item.goods_num;
item.original_img = oo.imghost + item.original_img;
item.selected = 0;
- item.erpwareid=good.erpwareid; //要同步下线商品的id
- item.shop_price=good.shop_price; //要同步下线商品的id
+ item.erpwareid = good.erpwareid; //要同步下线商品的id
+ item.shop_price = good.shop_price; //要同步下线商品的id
//当商品要计算等级价的售
- if(item.prom_type == 0 || item.prom_type == 3 || item.prom_type == 5 || item.prom_type == 7){
- if(th.data.card_field && good[th.data.card_field]){
- item.goods_price=good[th.data.card_field]; //要同步下线商品的id
- }else{
- item.goods_price=good.shop_price;
+ if (item.prom_type == 0 || item.prom_type == 3 || item.prom_type == 5 || item.prom_type == 7) {
+ if (th.data.card_field && good[th.data.card_field]) {
+ item.goods_price = good[th.data.card_field]; //要同步下线商品的id
+ } else {
+ item.goods_price = good.shop_price;
}
- var t={id:item.id,store_id:os.stoid,user_id:getApp().globalData.userInfo.user_id,goods_price:item.goods_price}
- getApp().request.put("/api/weshop/cart/update", {isShowLoading:0,data: t,})
+ var t = {
+ id: item.id,
+ store_id: os.stoid,
+ user_id: getApp().globalData.userInfo.user_id,
+ goods_price: item.goods_price
+ }
+ getApp().request.put("/api/weshop/cart/update", {
+ isShowLoading: 0,
+ data: t,
+ })
}
@@ -733,20 +770,20 @@ Page({
}
}
- if(th.data.is_open_offline && th.data.is_open_offline>0 && th.data.sales_rules==2){
- //-- 此时要实时更新线下取价价格 --
- for(var i=0;i 0 && th.data.sales_rules == 2) {
+ //-- 此时要实时更新线下取价价格 --
+ for (var i = 0; i < arr.length; i++) {
+ //每个门店都去看下线下取价
+ var list = arr[i];
+ await th.set_offline(list);
+ }
+ } else {
//-- 此时要实时更新线下取价价格 --
- for(var ij in arr){
+ for (var ij in arr) {
//每个门店都去看下线下取价
- var list=arr[ij];
- for(var i in list.goods){
- list.goods[i].offline_price=0
+ var list = arr[ij];
+ for (var i in list.goods) {
+ list.goods[i].offline_price = 0
}
}
}
@@ -779,7 +816,7 @@ Page({
},
//-----真的获取购物车--------
- get_ser_cart: function() {
+ get_ser_cart: function () {
var th = this;
var rd = Math.random().toString(36).substr(2, 15);
getApp().request.get("/api/weshop/cartService/page", {
@@ -787,27 +824,26 @@ Page({
user_id: app.globalData.user_id,
rd: rd,
store_id: oo.stoid,
- pageSize: 600,
+ pageSize: 600,
},
- success:async function(su) {
+ success: async function (su) {
//按门店分类的数组
var arr = new Array(),
carr = su.data.data.pageData;
var all_num = 0;
-
- if(carr && carr.length>0) {
+
+ if (carr && carr.length > 0) {
for (var i = 0; i < carr.length; i++) {
var item = carr[i];
var good = null;
-
+
await getApp().request.promiseGet("/api/weshop/serviceCard/get/" + oo.stoid + "/" + item.service_id, {}).then(res => {
good = res.data.data;
})
- if(!good){
+ if (!good) {
var url = '/api/weshop/cart/del/' + oo.stoid + '/' + item.id;
getApp().request.delete(url, {
- success: function (t) {
- }
+ success: function (t) {}
});
continue;
}
@@ -816,8 +852,7 @@ Page({
if (good.is_show == 0) {
var url = '/api/weshop/cart/del/' + oo.stoid + '/' + item.id;
getApp().request.delete(url, {
- success: function (t) {
- }
+ success: function (t) {}
});
//商品已经下架
continue;
@@ -826,7 +861,7 @@ Page({
all_num += item.goods_num;
item.img_url = oo.imghost + good.imgUrl;
item.selected = 0;
-
+
var pcid = item.pick_id;
var find = 0;
@@ -840,7 +875,7 @@ Page({
}
}
}
-
+
//------如果没有找到-----
if (find == 0) {
var pikname = '';
@@ -863,75 +898,74 @@ Page({
}
}
}
-
- // console.log('BBBBBB', all_num);
+
+ // console.log('BBBBBB', all_num);
th.setData({
- service_data: arr,
- all_num2: all_num,
- is_edit: 0
- }),
- th.doCheckAll(), wx.stopPullDownRefresh();
-
+ service_data: arr,
+ all_num2: all_num,
+ is_edit: 0
+ }),
+ th.doCheckAll(), wx.stopPullDownRefresh();
+
}
});
},
-
-
+
+
//设置莫个门店的所有线下价格
- async set_offline(list){
- var th=this;
- var userInfo=getApp().globalData.userInfo;
+ async set_offline(list) {
+ var th = this;
+ var userInfo = getApp().globalData.userInfo;
//组织一下商品,然后进行线下价格的赋值
- var wlist="";
- for(var i in list.goods){
+ var wlist = "";
+ for (var i in list.goods) {
//如果商品有促销活动
- if(list.goods[i].prom_type>0 && list.goods[i].prom_type!=7) continue;
- wlist+= encodeURIComponent(list.goods[i].erpwareid)+",";
+ if (list.goods[i].prom_type > 0 && list.goods[i].prom_type != 7) continue;
+ wlist += encodeURIComponent(list.goods[i].erpwareid) + ",";
}
- wlist=ut.sub_last(wlist);
+ wlist = ut.sub_last(wlist);
//调用接口进行赋值
- await getApp().request.promiseGet("/api/weshop/goods/listWarePrice", {
- data:{
- store_id:os.stoid,
- PickupId:list.pid,
- WareIds:wlist,
- VIPId:encodeURIComponent(userInfo.erpvipid)
+ await getApp().request.promiseGet("/api/weshop/goods/listWarePrice", {
+ data: {
+ store_id: os.stoid,
+ PickupId: list.pid,
+ WareIds: wlist,
+ VIPId: encodeURIComponent(userInfo.erpvipid)
}
}).then(res => {
- if(res.data.code==0 && res.data.data && res.data.data.length>0){
- for(var e in res.data.data){
- th.set_cart_offline_price(res.data.data[e],list.goods);
+ if (res.data.code == 0 && res.data.data && res.data.data.length > 0) {
+ for (var e in res.data.data) {
+ th.set_cart_offline_price(res.data.data[e], list.goods);
}
}
})
},
//-- 设置购物车线下 --
- set_cart_offline_price:function(data,glist)
- {
- for(var i in glist) {
- if(glist[i].erpwareid==data.WareId && (glist[i].prom_type==0 || glist[i].prom_type==7)){
- if(glist[i].goods_price>=data.WarePrice){
- glist[i].is_offline=1;
- glist[i].offline_price=data.WarePrice;
- glist[i].pricing_type=data.PriceType;
+ set_cart_offline_price: function (data, glist) {
+ for (var i in glist) {
+ if (glist[i].erpwareid == data.WareId && (glist[i].prom_type == 0 || glist[i].prom_type == 7)) {
+ if (glist[i].goods_price >= data.WarePrice) {
+ glist[i].is_offline = 1;
+ glist[i].offline_price = data.WarePrice;
+ glist[i].pricing_type = data.PriceType;
}
}
}
},
//删除商品
- delete_th_item: function(t) {
+ delete_th_item: function (t) {
var e = this;
var a = rq;
console.log(a);
wx.showModal({
title: "确定删除?",
- success: function(s) {
+ success: function (s) {
if (s.confirm) {
var r = t.currentTarget.dataset.cartid;
var url = '/api/weshop/cart/del/' + oo.stoid + '/' + r;
a.delete(url, {
- success: function(t) {
+ success: function (t) {
e.getCardList();
}
});
@@ -941,19 +975,19 @@ Page({
},
//-----------------点击输入修改商品数量---------------
- valueToNum: function(t) {
- if(!this.data.is_load) return false;
+ valueToNum: function (t) {
+ if (!this.data.is_load) return false;
//控制住,避免事件响应冲突,只有input有输入的时候,才刷新
- if(this.data.btn_click){
+ if (this.data.btn_click) {
return false;
}
- this.data.btn_click=1;
+ this.data.btn_click = 1;
var a = t.currentTarget.dataset.item;
var b = t.currentTarget.dataset.pitems;
a = this.data.requestData[b].goods[a];
var e = a;
- var th=this;
+ var th = this;
if (a = isNaN(t.detail.value) || t.detail.value < 1 ? 1 : parseInt(t.detail.value)) {
var s = {
@@ -967,24 +1001,24 @@ Page({
},
//-------------加数量---------------------
- addNum: function(t) {
- if(!this.data.is_load) return false;
+ addNum: function (t) {
+ if (!this.data.is_load) return false;
if (this.data.up_dating == 1) return false;
this.data.up_dating = 1;
var a = t.currentTarget.dataset.item;
var b = t.currentTarget.dataset.pitems;
a = this.data.requestData[b].goods[a];
-
- console.log('add+');
- if (a.goods_num0
- && e.data.service_data && e.data.service_data.length>0){
+ if (e.data.requestData && e.data.requestData.length > 0 &&
+ e.data.service_data && e.data.service_data.length > 0) {
wx.showModal({
title: '提示',
content: '服务卡项目不能和商品一起选择'
@@ -1112,19 +1147,19 @@ Page({
return false;
}
- this.data.btn_click=1;
+ this.data.btn_click = 1;
- var offline_price=0;
- var offline_num=0;
- th.data.in_zhact_gdmap={};
+ var offline_price = 0;
+ var offline_num = 0;
+ th.data.in_zhact_gdmap = {};
- if(dda && dda.length>0){
+ if (dda && dda.length > 0) {
for (var i = 0; i < dda.length; i++) {
var item = dda[i].goods;
-
+
if (e.data.checkAllToggle) {
var txt = "requestData[" + i + "].selected";
e.setData({
@@ -1143,6 +1178,7 @@ Page({
if(obj.prom_type==10)
ladder_calc.remove_ladder_prom(dda,i,obj);
+
if (fir == 0) {
fir = item[j].distr_type;
} else {
@@ -1160,27 +1196,27 @@ Page({
if(obj.prom_type==7) zh_calc.add_zhprom(dda,i,obj);
//加入阶梯促销计算
if(obj.prom_type==10) ladder_calc.add_ladder_prom(dda,i,obj);
-
e.setData({
+
[txt]: !e.data.checkAllToggle,
})
-
+
if (!e.data.checkAllToggle) {
//组合购的金额要另外算
if(item[j].prom_type!=7 && item[j].prom_type!=10)
tfeel += item[j].goods_num * item[j].goods_price;
- t_num += item[j].goods_num;
+ t_num += item[j].goods_num;
}
//-- 如果这个商品是线下取价的时候 --
- if(item[j].is_offline && item[j].prom_type!=7){
- offline_price+= (item[j].goods_price-item[j].offline_price)*item[j].goods_num;
- offline_num+=item[j].goods_num;
+ if (item[j].is_offline && item[j].prom_type != 7) {
+ offline_price += (item[j].goods_price - item[j].offline_price) * item[j].goods_num;
+ offline_num += item[j].goods_num;
}
- }
- }
+ }
+ }
if (text_arr != "") {
@@ -1191,7 +1227,7 @@ Page({
return false;
} else {
- for (var i = 0; i < dda.length; i++) {
+ for (var i = 0; i < dda.length; i++) {
if (!e.data.checkAllToggle) {
var txt = "requestData[" + i + "].selected";
@@ -1200,11 +1236,11 @@ Page({
});
}
- //总的价格,把组合商品的价格拿出来
- var zh_calc_res=zh_calc.calculate_zh(dda,i,this);
- tfeel+=zh_calc_res.tfeel;
- offline_price+=zh_calc_res.offline_price;
- offline_num+=zh_calc_res.offline_num;
+ //总的价格,把组合商品的价格拿出来
+ var zh_calc_res = zh_calc.calculate_zh(dda, i, this);
+ tfeel += zh_calc_res.tfeel;
+ offline_price += zh_calc_res.offline_price;
+ offline_num += zh_calc_res.offline_num;
//总的价格,把阶梯促销的商品的价格拿出来
var ladder_calc_res=ladder_calc.calculate_ladder(dda,i,this);
@@ -1213,24 +1249,24 @@ Page({
offline_num+=ladder_calc_res.offline_num;
//当有线下取价的时候
- if(offline_price){
- var txt1= "requestData[" + i + "].offline_price";
- var txt2= "requestData[" + i+ "].offline_num";
+ if (offline_price) {
+ var txt1 = "requestData[" + i + "].offline_price";
+ var txt2 = "requestData[" + i + "].offline_num";
th.setData({
[txt1]: offline_price.toFixed(2),
[txt2]: offline_num,
});
- }else{
- if(dda[i].offline_price>0){
- var txt1= "requestData[" + i + "].offline_price";
- var txt2= "requestData[" + i + "].offline_num";
+ } else {
+ if (dda[i].offline_price > 0) {
+ var txt1 = "requestData[" + i + "].offline_price";
+ var txt2 = "requestData[" + i + "].offline_num";
th.setData({
[txt1]: 0,
[txt2]: 0
});
}
}
- }
+ }
e.setData({
checkAllToggle: !e.data.checkAllToggle,
@@ -1238,13 +1274,13 @@ Page({
total_num: t_num,
});
- for(var i in e.data.requestData){
+ for (var i in e.data.requestData) {
e.check_prom_activity(i)
}
}
}
- if(sdda && sdda.length>0){
+ if (sdda && sdda.length > 0) {
for (var i = 0; i < sdda.length; i++) {
var item = sdda[i].goods;
if (e.data.checkAllToggle) {
@@ -1274,30 +1310,30 @@ Page({
},
//------门店全选按钮,要判断是否门店的匹配方式一致---------
- check_th_all_item:async function(ele) {
+ check_th_all_item: async function (ele) {
var e = this,
pitems = ele.currentTarget.dataset.pitems,
item = this.data.requestData[pitems].goods,
sele = this.data.requestData[pitems].selected;
- this.data.btn_click=1;
- var garr=e.data.service_data;
+ this.data.btn_click = 1;
+ var garr = e.data.service_data;
var isok = 1,
fir = 0,
iarr = item;
- if(!sele){
- var check_is_service_selected=0;
- for (var ii in garr){
- for (var ij in garr[ii].goods){
- if( garr[ii].goods[ij].selected){
- check_is_service_selected=1;
+ if (!sele) {
+ var check_is_service_selected = 0;
+ for (var ii in garr) {
+ for (var ij in garr[ii].goods) {
+ if (garr[ii].goods[ij].selected) {
+ check_is_service_selected = 1;
break;
}
}
}
- if(check_is_service_selected){
+ if (check_is_service_selected) {
wx.showModal({
title: '提示',
content: '服务卡项目不能和商品一起选择'
@@ -1308,7 +1344,7 @@ Page({
if (!sele && item.length > 0) {
for (var i = 0; i < iarr.length; i++) {
- if(iarr[i].is_gift==1) continue;
+ if (iarr[i].is_gift == 1) continue;
if (iarr[i].distr_type != 0) {
if (fir == 0) {
fir = iarr[i].distr_type;
@@ -1340,23 +1376,24 @@ Page({
e.setData({
[txt]: Number(!sele),
});
-
- await e.check_prom_activity(pitems);
- for(var i in e.data.requestData){
- if(i!=pitems) await e.check_prom_activity(i);
- }
+
+ await e.check_prom_activity(pitems);
+ for (var i in e.data.requestData) {
+ if (i != pitems) await e.check_prom_activity(i);
+ }
this.doCheckAll();
},
//---------------单选,也要判断门店的配送方式是否一致--------------
- check_th_item: async function(t) {
+ check_th_item: async function (t) {
var e = this,
item = t.currentTarget.dataset.item,
pitems = t.currentTarget.dataset.pitems;
a = this.data.requestData[pitems].goods[item];
- var isok = 1,fir = 0;
+ var isok = 1,
+ fir = 0;
var iarr = e.data.requestData[pitems].goods;
- this.data.btn_click=1;
- var garr= e.data.service_data;
+ this.data.btn_click = 1;
+ var garr = e.data.service_data;
if (!a.selected) {
var check_is_service_selected = 0;
@@ -1381,7 +1418,7 @@ Page({
if (iarr.length > 1 && !a.selected) {
for (var i = 0; i < iarr.length; i++) {
- if(iarr[i].is_gift==1) continue;
+ if (iarr[i].is_gift == 1) continue;
//---当不是本身选择项目----
var sel = iarr[i].selected;
if (iarr[i].distr_type != 0 && (sel || iarr[i].id == a.id)) {
@@ -1407,42 +1444,42 @@ Page({
[txt]: Number(!a.selected),
});
- if(a.prom_type==3){
-
- await e.check_prom_activity(pitems);
+ if (a.prom_type == 3) {
+
+ await e.check_prom_activity(pitems);
//判断商品是不是优惠活动
- for(var i in e.data.requestData){
- if(i!=pitems) await e.check_prom_activity(i);
- }
+ for (var i in e.data.requestData) {
+ if (i != pitems) await e.check_prom_activity(i);
+ }
}
this.doCheckAll();
}
},
//------门店全选按钮,要判断是否门店的匹配方式一致---------
- check_th_all_item_ser:async function(ele) {
+ check_th_all_item_ser: async function (ele) {
var e = this,
pitems = ele.currentTarget.dataset.pitems,
item = this.data.service_data[pitems].goods,
sele = this.data.service_data[pitems].selected;
- this.data.btn_click=1;
- var garr= e.data.requestData;
+ this.data.btn_click = 1;
+ var garr = e.data.requestData;
var isok = 1,
fir = 0,
iarr = item;
- if(!sele){
- var check_is_goods_selected=0;
- for (var ii in garr){
- for (var ij in garr[ii].goods){
- if( garr[ii].goods[ij].selected){
- check_is_goods_selected=1;
+ if (!sele) {
+ var check_is_goods_selected = 0;
+ for (var ii in garr) {
+ for (var ij in garr[ii].goods) {
+ if (garr[ii].goods[ij].selected) {
+ check_is_goods_selected = 1;
break;
}
}
}
- if(check_is_goods_selected){
+ if (check_is_goods_selected) {
wx.showModal({
title: '提示',
content: '服务卡项目不能和商品一起选择'
@@ -1464,29 +1501,30 @@ Page({
this.doCheckAll();
},
//---------------单选,也要判断门店的配送方式是否一致--------------
- check_th_item_ser: async function(t) {
+ check_th_item_ser: async function (t) {
var e = this,
item = t.currentTarget.dataset.item,
pitems = t.currentTarget.dataset.pitems;
a = this.data.service_data[pitems].goods[item];
- var isok = 1,fir = 0;
+ var isok = 1,
+ fir = 0;
var iarr = e.data.service_data[pitems].goods;
- this.data.btn_click=1;
+ this.data.btn_click = 1;
- var garr= e.data.requestData;
+ var garr = e.data.requestData;
- if(!a.selected){
- var check_is_goods_selected=0;
- for (var ii in garr){
- for (var ij in garr[ii].goods){
- if( garr[ii].goods[ij].selected){
- check_is_goods_selected=1;
+ if (!a.selected) {
+ var check_is_goods_selected = 0;
+ for (var ii in garr) {
+ for (var ij in garr[ii].goods) {
+ if (garr[ii].goods[ij].selected) {
+ check_is_goods_selected = 1;
break;
}
}
}
- if(check_is_goods_selected){
+ if (check_is_goods_selected) {
wx.showModal({
title: '提示',
content: '服务卡项目不能和商品一起选择'
@@ -1503,7 +1541,7 @@ Page({
},
//----------检查是否全选---------
- doCheckAll: function() {
+ doCheckAll: function () {
var th = this,
tfeel = 0,
t_num = 0,
@@ -1513,28 +1551,27 @@ Page({
all_num = 0;
//-- 购物车 --
- if(car && car.length>0){
- th.data.in_zhact_gdmap={};
+ if (car && car.length > 0) {
+ th.data.in_zhact_gdmap = {};
for (var a = 0; a < car.length; a++) {
var item = car[a].goods,is_s_sele = 1;
var offline_price=0;
var offline_num=0;
for (var c = 0; c < item.length; c++) {
- if(item[c].is_gift) continue;
+ if (item[c].is_gift) continue;
all_num += item[c].goods_num;
//不管怎么样都要移出去
var obj=JSON.parse(JSON.stringify(item[c]));
-
zh_calc.remove_zhprom(car,a,obj);
ladder_calc.remove_ladder_prom(car,a,obj);
if (item[c].selected == 0) {
ischeck = 0;
is_s_sele = 0;
- if(item[c].prom_type==7) {
- obj.goods_num=0;
- zh_calc.add_zhprom(car,a,obj);
+ if (item[c].prom_type == 7) {
+ obj.goods_num = 0;
+ zh_calc.add_zhprom(car, a, obj);
}
if(item[c].prom_type==10) {
obj.goods_num=0;
@@ -1556,9 +1593,9 @@ Page({
}
//-- 如果这个商品是线下取价的时候 --
- if(item[c].is_offline && item[c].prom_type!=7){
- offline_price+= (item[c].goods_price-item[c].offline_price)*item[c].goods_num;
- offline_num+=item[c].goods_num;
+ if (item[c].is_offline && item[c].prom_type != 7) {
+ offline_price += (item[c].goods_price - item[c].offline_price) * item[c].goods_num;
+ offline_num += item[c].goods_num;
}
}
@@ -1581,35 +1618,36 @@ Page({
});
//当有线下取价的时候
- if(offline_price){
- var txt1= "requestData[" + a + "].offline_price";
- var txt2= "requestData[" + a + "].offline_num";
+ if (offline_price) {
+ var txt1 = "requestData[" + a + "].offline_price";
+ var txt2 = "requestData[" + a + "].offline_num";
th.setData({
[txt1]: offline_price.toFixed(2),
[txt2]: offline_num,
});
- }else{
- if(car[a].offline_price>0){
- var txt1= "requestData[" + a + "].offline_price";
- var txt2= "requestData[" + a + "].offline_num";
- th.setData({
- [txt1]: 0,
- [txt2]: 0
- });
- }
+ } else {
+ if (car[a].offline_price > 0) {
+ var txt1 = "requestData[" + a + "].offline_price";
+ var txt2 = "requestData[" + a + "].offline_num";
+ th.setData({
+ [txt1]: 0,
+ [txt2]: 0
+ });
+ }
}
}
}
//-- 服务卡 --
- if(car2 && car2.length>0){
+ if (car2 && car2.length > 0) {
for (var a = 0; a < car2.length; a++) {
- var c_item=car2[a];
- var item = car2[a].goods, is_s_sele = 1;
+ var c_item = car2[a];
+ var item = car2[a].goods,
+ is_s_sele = 1;
for (var c = 0; c < item.length; c++) {
- if(item[c].is_gift) continue;
+ if (item[c].is_gift) continue;
all_num += item[c].goods_num;
if (item[c].selected == 0) {
ischeck = 0;
@@ -1637,28 +1675,31 @@ Page({
},
//----------------------更新购物数量,加减,调用接口---------------------
- postCardList: function(t, item, pitem) {
- var e = this,th=e,user_id = getApp().globalData.user_id;
- function normal_check(store_count,goodsinfo,wareIds) {
- //--- 看一下是不是线下库存 ---
- if(th.data.sales_rules==2 && goodsinfo.prom_type!=7){
- th.check_down_line(t, pitem, item,wareIds);
- }else{
- if (t.goods_num > store_count) {
- wx.showModal({
- title: '提示',
- content: '购买数量超出商品库存'
- });
- var txt = "requestData[" + pitem + "].goods[" + item + "].goods_num";
- e.setData({
- [txt]: store_count
- });
- e.doCheckAll();
- t.goods_num=store_count;
- }
- e.update_cart(t, pitem, item);
- }
- }
+ postCardList: function (t, item, pitem) {
+ var e = this,
+ th = e,
+ user_id = getApp().globalData.user_id;
+
+ function normal_check(store_count, goodsinfo, wareIds) {
+ //--- 看一下是不是线下库存 ---
+ if (th.data.sales_rules == 2 && goodsinfo.prom_type != 7) {
+ th.check_down_line(t, pitem, item, wareIds);
+ } else {
+ if (t.goods_num > store_count) {
+ wx.showModal({
+ title: '提示',
+ content: '购买数量超出商品库存'
+ });
+ var txt = "requestData[" + pitem + "].goods[" + item + "].goods_num";
+ e.setData({
+ [txt]: store_count
+ });
+ e.doCheckAll();
+ t.goods_num = store_count;
+ }
+ e.update_cart(t, pitem, item);
+ }
+ }
// console.log('update');
// console.log('9995959595959',t);
@@ -1688,8 +1729,10 @@ Page({
var buy_num_data = res.data.data;
if (buy_num_data.promgoodsbuynum) {
promgoodsbuynum = buy_num_data.promgoodsbuynum;
- var txt="requestData[" + pitem + "].goods[" + item + "].zh_b_num";
- th.setData({[txt]:promgoodsbuynum});
+ var txt = "requestData[" + pitem + "].goods[" + item + "].zh_b_num";
+ th.setData({
+ [txt]: promgoodsbuynum
+ });
}
goodsbuynum = buy_num_data.goodsbuynum;
@@ -1710,19 +1753,19 @@ Page({
});
e.doCheckAll();
- t.goods_num=cbuy > 0 ? cbuy : 0,
+ t.goods_num = cbuy > 0 ? cbuy : 0,
e.update_cart(t, pitem, item);
return false;
}
- switch (goodsinfo.prom_type){
- case 1:
+ switch (goodsinfo.prom_type) {
+ case 1:
//读取秒杀
rq.get("/api/ms/flash_sale/getFlashSaleOne/" + oo.stoid + "/" + goodsinfo.prom_id, {
isShowLoading: 0,
- success: function(res_d) {
- if(res_d.data.code==0 && res_d.data.data){
+ success: function (res_d) {
+ if (res_d.data.code == 0 && res_d.data.data) {
if (t.goods_num > store_count) {
wx.showModal({
title: '提示',
@@ -1734,7 +1777,7 @@ Page({
});
e.doCheckAll();
- t.goods_num=store_count;
+ t.goods_num = store_count;
e.update_cart(t, pitem, item);
return false;
@@ -1753,7 +1796,7 @@ Page({
});
e.doCheckAll();
- t.goods_num=false_data.goods_num - false_data.buy_num;
+ t.goods_num = false_data.goods_num - false_data.buy_num;
e.update_cart(t, pitem, item);
return false;
@@ -1771,7 +1814,7 @@ Page({
});
e.doCheckAll();
- t.goods_num=false_data.redisnum;
+ t.goods_num = false_data.redisnum;
e.update_cart(t, pitem, item);
return false;
}
@@ -1787,110 +1830,110 @@ Page({
[txt]: false_data.buy_limit
});
e.doCheckAll();
- t.goods_num=(false_data.buy_limit-promgoodsbuynum)?false_data.buy_limit-promgoodsbuynum:0;
+ t.goods_num = (false_data.buy_limit - promgoodsbuynum) ? false_data.buy_limit - promgoodsbuynum : 0;
e.update_cart(t, pitem, item);
return false;
}
e.update_cart(t, pitem, item);
- }else{
- normal_check(store_count,goodsinfo,wareIds);
+ } else {
+ normal_check(store_count, goodsinfo, wareIds);
}
}
})
- break;
- case 2:
- getApp().request.promiseGet("/api/weshop/goods/groupBuy/getActInfo/" + os.stoid + "/" + goodsinfo.goods_id + "/" + goodsinfo.prom_id, {
- }).then(res => {
- if(res.data.code==0 && res.data.data){
- if (t.goods_num > store_count) {
- wx.showModal({
- title: '提示',
- content: '购买数量超出商品库存'
- });
- var txt = "requestData[" + pitem + "].goods[" + item + "].goods_num";
- e.setData({
- [txt]: store_count
- });
- e.doCheckAll();
-
- t.goods_num=store_count;
- e.update_cart(t, pitem, item);
-
- return false;
- }
-
- var gr_data = res.data.data;
- //--判断库存--
- if (t.goods_num > gr_data.goods_num - gr_data.buy_num) {
- wx.showModal({
- title: '提示',
- content: '购买数量超出活动库存'
- });
- var txt = "requestData[" + pitem + "].goods[" + item + "].goods_num";
- e.setData({
- [txt]: gr_data.goods_num - gr_data.buy_num
- });
- e.doCheckAll();
-
- t.goods_num=gr_data.goods_num - gr_data.buy_num;
- e.update_cart(t, pitem, item);
-
- return false;
- }
-
- //--判断redis数量是否已经超出--
- if (t.goods_num > gr_data.redisnum) {
- wx.showModal({
- title: '提示',
- content: '购买数量超出商品库存'
- });
- var txt = "requestData[" + pitem + "].goods[" + item + "].goods_num";
- e.setData({
- [txt]: gr_data.redisnum
- });
- e.doCheckAll();
-
- t.goods_num=gr_data.redisnum;
- e.update_cart(t, pitem, item);
- return false;
- }
-
- //--活动的限购是不是要判断--
- if (t.goods_num + promgoodsbuynum > gr_data.buy_limit && gr_data.buy_limit > 0) {
- wx.showModal({
- title: '提示',
- content: '购买数量超出团购限购'
- });
- var txt = "requestData[" + pitem + "].goods[" + item + "].goods_num";
- e.setData({
- [txt]: gr_data.buy_limit
- });
- e.doCheckAll();
-
- t.goods_num=(gr_data.buy_limit-promgoodsbuynum)?gr_data.buy_limit-promgoodsbuynum:0;
- e.update_cart(t, pitem, item);
- return false;
- }
- e.update_cart(t, pitem, item);
-
- }else{
- normal_check(store_count,goodsinfo,wareIds);
- }
+ break;
+ case 2:
+ getApp().request.promiseGet("/api/weshop/goods/groupBuy/getActInfo/" + os.stoid + "/" + goodsinfo.goods_id + "/" + goodsinfo.prom_id, {}).then(res => {
+ if (res.data.code == 0 && res.data.data) {
+ if (t.goods_num > store_count) {
+ wx.showModal({
+ title: '提示',
+ content: '购买数量超出商品库存'
+ });
+ var txt = "requestData[" + pitem + "].goods[" + item + "].goods_num";
+ e.setData({
+ [txt]: store_count
+ });
+ e.doCheckAll();
+
+ t.goods_num = store_count;
+ e.update_cart(t, pitem, item);
+
+ return false;
+ }
+
+ var gr_data = res.data.data;
+ //--判断库存--
+ if (t.goods_num > gr_data.goods_num - gr_data.buy_num) {
+ wx.showModal({
+ title: '提示',
+ content: '购买数量超出活动库存'
+ });
+ var txt = "requestData[" + pitem + "].goods[" + item + "].goods_num";
+ e.setData({
+ [txt]: gr_data.goods_num - gr_data.buy_num
+ });
+ e.doCheckAll();
+
+ t.goods_num = gr_data.goods_num - gr_data.buy_num;
+ e.update_cart(t, pitem, item);
+
+ return false;
+ }
+
+ //--判断redis数量是否已经超出--
+ if (t.goods_num > gr_data.redisnum) {
+ wx.showModal({
+ title: '提示',
+ content: '购买数量超出商品库存'
+ });
+ var txt = "requestData[" + pitem + "].goods[" + item + "].goods_num";
+ e.setData({
+ [txt]: gr_data.redisnum
+ });
+ e.doCheckAll();
+
+ t.goods_num = gr_data.redisnum;
+ e.update_cart(t, pitem, item);
+ return false;
+ }
+
+ //--活动的限购是不是要判断--
+ if (t.goods_num + promgoodsbuynum > gr_data.buy_limit && gr_data.buy_limit > 0) {
+ wx.showModal({
+ title: '提示',
+ content: '购买数量超出团购限购'
+ });
+ var txt = "requestData[" + pitem + "].goods[" + item + "].goods_num";
+ e.setData({
+ [txt]: gr_data.buy_limit
+ });
+ e.doCheckAll();
+
+ t.goods_num = (gr_data.buy_limit - promgoodsbuynum) ? gr_data.buy_limit - promgoodsbuynum : 0;
+ e.update_cart(t, pitem, item);
+ return false;
+ }
+ e.update_cart(t, pitem, item);
+
+ } else {
+ normal_check(store_count, goodsinfo, wareIds);
+ }
})
- break;
- default:
- normal_check(store_count,goodsinfo,wareIds);
- break
- }
+ break;
+ default:
+ normal_check(store_count, goodsinfo, wareIds);
+ break
+ }
}
});
},
//----------------------更新购物数量,加减,调用接口---------------------
- postCardList_ser: function(t, item, pitem) {
- var e = this,th=e;
+ postCardList_ser: function (t, item, pitem) {
+ var e = this,
+ th = e;
var user_id = getApp().globalData.user_id;
var txt = "service_data[" + pitem + "].goods[" + item + "].goods_num";
e.setData({
@@ -1899,17 +1942,18 @@ Page({
e.doCheckAll();
e.update_cart_ser(t, pitem, item);
},
-
+
//---检验线下库存的数量---
- async check_down_line(t, pitem, item,erpwareid){
- var ob={},th=this;
- await this.check_down_line_next(t, pitem, item,erpwareid,function(res){
- ob=res;
+ async check_down_line(t, pitem, item, erpwareid) {
+ var ob = {},
+ th = this;
+ await this.check_down_line_next(t, pitem, item, erpwareid, function (res) {
+ ob = res;
});
- var log=0;
- if(ob.code==-1){
+ var log = 0;
+ if (ob.code == -1) {
wx.showModal({
title: '提示',
content: '购买数量超出商品库存'
@@ -1919,31 +1963,41 @@ Page({
[txt]: ob.CanOutQty
});
th.doCheckAll();
- t.goods_num=ob.CanOutQty;
+ t.goods_num = ob.CanOutQty;
}
this.update_cart(t, pitem, item);
},
//---检验线下库存的数量的子函数---
- async check_down_line_next(t, pitem, item,erpwareid,func){
+ async check_down_line_next(t, pitem, item, erpwareid, func) {
var goodsinfo = this.data.requestData[pitem].goods[item];
- var lock=0,pick_no,plist;
+ var lock = 0,
+ pick_no, plist;
//先读取门店的lock
- await getApp().request.promiseGet("/api/weshop/order/ware/lock/page",{
- data:{store_id:os.stoid,wareId:t.goods_id,storageId:goodsinfo.pick_id,pageSize:1000}
- }).then(res=>{
- if(res.data.code==0 && res.data.data.total>0){
- for(var i in res.data.data.pageData)
- lock+=res.data.data.pageData[i].outQty;
+ await getApp().request.promiseGet("/api/weshop/order/ware/lock/page", {
+ data: {
+ store_id: os.stoid,
+ wareId: t.goods_id,
+ storageId: goodsinfo.pick_id,
+ pageSize: 1000
+ }
+ }).then(res => {
+ if (res.data.code == 0 && res.data.data.total > 0) {
+ for (var i in res.data.data.pageData)
+ lock += res.data.data.pageData[i].outQty;
}
})
//先获取门店的编号
- await getApp().request.promiseGet("/api/weshop/pickup/get/"+os.stoid+"/"+goodsinfo.pick_id,{
- data:{storeId:os.stoid,goodsId:t.goods_id,pickupId:goodsinfo.pick_id}
- }).then(res=>{
- if(res.data.code==0){
- pick_no=res.data.data.pickup_no;
+ await getApp().request.promiseGet("/api/weshop/pickup/get/" + os.stoid + "/" + goodsinfo.pick_id, {
+ data: {
+ storeId: os.stoid,
+ goodsId: t.goods_id,
+ pickupId: goodsinfo.pick_id
+ }
+ }).then(res => {
+ if (res.data.code == 0) {
+ pick_no = res.data.data.pickup_no;
}
})
//读取线下的门店库存
@@ -1954,40 +2008,44 @@ Page({
plist=res.data.data.pageData[0];
}
})
- var ob={}; ob.code=1;
+ var ob = {};
+ ob.code = 1;
- if(!plist){
- ob.code=-1;ob.CanOutQty=0;func(ob); return false;
+ if (!plist) {
+ ob.code = -1;
+ ob.CanOutQty = 0;
+ func(ob);
+ return false;
}
- var c_num=t.goods_num;
- if(t.need_downlow_num) c_num=t.need_downlow_num;
+ var c_num = t.goods_num;
+ if (t.need_downlow_num) c_num = t.need_downlow_num;
- if( c_num>plist.CanOutQty-lock){
- ob.code=-1;
- ob.CanOutQty=plist.CanOutQty-lock
- if(ob.CanOutQty<0) ob.CanOutQty=0;
+ if (c_num > plist.CanOutQty - lock) {
+ ob.code = -1;
+ ob.CanOutQty = plist.CanOutQty - lock
+ if (ob.CanOutQty < 0) ob.CanOutQty = 0;
}
func(ob)
},
//--更新购物车---
- update_cart: function(t, pitem, item) {
+ update_cart: function (t, pitem, item) {
var e = this;
getApp().request.put("/api/weshop/cart/update", {
data: t,
- success:async function(ee) {
+ success: async function (ee) {
var txt = "requestData[" + pitem + "].goods[" + item + "].goods_num";
e.setData({
[txt]: t.goods_num,
});
-
- await e.check_prom_activity(pitem)
- for(var i in e.data.requestData){
- if(i!=pitem) await e.check_prom_activity(i)
+
+ await e.check_prom_activity(pitem)
+ for (var i in e.data.requestData) {
+ if (i != pitem) await e.check_prom_activity(i)
}
e.doCheckAll();
getApp().requestCardNum(e);
@@ -1996,11 +2054,11 @@ Page({
},
//--更新购物车---
- update_cart_ser: function(t, pitem, item) {
+ update_cart_ser: function (t, pitem, item) {
var e = this;
getApp().request.put("/api/weshop/cartService/update", {
data: t,
- success:async function(ee) {
+ success: async function (ee) {
var txt = "service_data[" + pitem + "].goods[" + item + "].goods_num";
e.setData({
[txt]: t.goods_num,
@@ -2013,22 +2071,22 @@ Page({
//-------下拉刷新---------
- onPullDownRefresh: function(t) {
+ onPullDownRefresh: function (t) {
this.getCardList();
},
//--------------去结算------------
async checkout() {
- if(!this.data.total_num || this.data.total_num<=0) return false;
- if(!this.data.is_load) return false;
- if(this.data.up_dating) {
+ if (!this.data.total_num || this.data.total_num <= 0) return false;
+ if (!this.data.is_load) return false;
+ if (this.data.up_dating) {
wx.showLoading({
- title:"计算中"
+ title: "计算中"
})
}
- var garr=this.data.requestData;
- var check_is_goods_selected=0;
- if(garr) {
+ var garr = this.data.requestData;
+ var check_is_goods_selected = 0;
+ if (garr) {
for (var ii in garr) {
for (var ij in garr[ii].goods) {
if (garr[ii].goods[ij].selected) {
@@ -2039,7 +2097,7 @@ Page({
}
}
//-- 如果是商品的结算 --
- if(check_is_goods_selected) {
+ if (check_is_goods_selected) {
var glist = ""; //用逗号隔开的
var map = new Map(); //使用map值键进行运算
var map_limit = new Map(); //使用map值键进行存储限购
@@ -2055,7 +2113,7 @@ Page({
for (var j = 0; j < i_arr.length; j++) {
if (i_arr[j].selected && i_arr[j].is_gift != 1) {
- if (i_arr[j].is_pd_normal || i_arr[j].prom_type==0 || i_arr[j].prom_type==3) {
+ if (i_arr[j].is_pd_normal || i_arr[j].prom_type == 0 || i_arr[j].prom_type == 3) {
normal_arr[i_arr[j].goods_id] = 1;
}
@@ -2083,8 +2141,8 @@ Page({
glist += i_arr[j].goods_id + ",";
ab = 1;
//--普通商品,如果有开启线下库存的功能,要调用线下库存进行计算,赠品不要进行调用线下库存---
- if ((i_arr[j].prom_type == 0 || i_arr[j].prom_type == 3 || i_arr[j].prom_type == 5
- || i_arr[j].need_downlow_num ) && th.data.sales_rules == 2 && i_arr[j].is_gift != 1) {
+ if ((i_arr[j].prom_type == 0 || i_arr[j].prom_type == 3 || i_arr[j].prom_type == 5 ||
+ i_arr[j].need_downlow_num) && th.data.sales_rules == 2 && i_arr[j].is_gift != 1) {
//--获取商品的线下商品ID--
var gd = null;
await getApp().request.promiseGet("/api/weshop/goods/get/" + oo.stoid + "/" + i_arr[j].goods_id, {}).then(res => {
@@ -2254,7 +2312,7 @@ Page({
throw "商品价格已经变化";
}
} else {
- if (g_arr[i].goods_price != val.shop_price && g_arr[i].goods_price != val.prom_price && val.prom_price>0) {
+ if (g_arr[i].goods_price != val.shop_price && g_arr[i].goods_price != val.prom_price && val.prom_price > 0) {
isok = 0;
gname = val.goods_name;
throw "商品价格已经变化";
@@ -2297,7 +2355,7 @@ Page({
}
}
});
- }else{
+ } else {
//-- 开始服务卡的购物车购买 --
for (var i = 0; i < this.data.service_data.length; i++) {
var i_arr = this.data.service_data[i].goods;
@@ -2319,7 +2377,7 @@ Page({
},
//结算到最后一个商品
- set_last: function(ab, isok, gname) {
+ set_last: function (ab, isok, gname) {
if (isok == 0) {
t.my_warnning(gname + "商品超出库存", 0, this);
} else {
@@ -2331,7 +2389,7 @@ Page({
//图片失败,默认图片
- bind_bnerr2: function(e) {
+ bind_bnerr2: function (e) {
var _errImg = e.target.dataset.errorimg;
var _errurl = e.target.dataset.url;
var ii = _errurl.indexOf(oo.imghost);
@@ -2342,13 +2400,13 @@ Page({
}
},
//设置点击按钮为true或者false
- radio_chick: function(checked, num) {
+ radio_chick: function (checked, num) {
var th = this;
var requestData = th.data.requestData;
},
//点击编辑后的效果
- edit_cart: function(e) {
+ edit_cart: function (e) {
var type = parseFloat(e.currentTarget.dataset.type);
this.setData({
is_edit: type
@@ -2356,13 +2414,14 @@ Page({
},
//--多个删除购物车商品---
- check_del: function() {
- var glist = "",slist=''; //用逗号隔开的
+ check_del: function () {
+ var glist = "",
+ slist = ''; //用逗号隔开的
var user_id = getApp().globalData.user_id;
var th = this;
var ab = 0; //选中
- var abc=0; //
+ var abc = 0; //
for (var i = 0; i < this.data.requestData.length; i++) {
var i_arr = this.data.requestData[i].goods;
for (var j = 0; j < i_arr.length; j++) {
@@ -2383,104 +2442,112 @@ Page({
}
}
- if (ab == 0 && abc==0) {
+ if (ab == 0 && abc == 0) {
t.my_warnning("未选择商品或者服务卡", 0, th);
return false;
}
- if(ab){
+ if (ab) {
glist = glist.substring(0, glist.length - 1);
//要删除购物车中的商品
var url = '/api/weshop/cart/delIds/' + oo.stoid + '/' + user_id + "/" + glist;
getApp().request.delete(url, {
- success: function(t) {
- // console.log('del done1111111111');
+ success: function (t) {
+ // console.log('del done1111111111');
th.getCardList();
- getApp().requestCardNum(th);
- // console.log('all================', th.data.all_num);
- // getApp().globalData.cartGoodsNum =
+ getApp().requestCardNum(th);
+ // console.log('all================', th.data.all_num);
+ // getApp().globalData.cartGoodsNum =
}
});
}
- if(abc){
+ if (abc) {
slist = slist.substring(0, slist.length - 1);
//要删除购物车中的商品
var url = '/api/weshop/cartService/delIds/' + oo.stoid + '/' + user_id + "/" + slist;
getApp().request.delete(url, {
- success: function(t) {
+ success: function (t) {
th.getCardList();
- getApp().requestCardNum(th);
- console.log('all2================', th.data.all_num);
+ getApp().requestCardNum(th);
+ console.log('all2================', th.data.all_num);
}
});
}
-
+
},
//跳到首页
- goto: function(e) {
- var url='/pages/index/index/index';
- getApp().goto(url);
+ goto: function (e) {
+ var url = '/pages/index/index/index';
+ getApp().goto(url);
},
//---加载更多是靠这个函数----
- onReachBottom: function() {
- if(this.data.requestData && this.data.requestData.length==0) {
+ onReachBottom: function () {
+ if (this.data.requestData && this.data.requestData.length == 0) {
var goods_list = this.selectComponent("#goods_list"); //组件的id
if (goods_list) goods_list.get_list();
}
},
//检查莫个门店下的商品是不是优惠活动,有的话,看要不要送礼品,同时有没有倍增
- check_prom_activity:async function (cindex) {
- var make_up_arr=new Array();
- var th=this;
- var map=new Map();
- var list= JSON.parse(JSON.stringify(this.data.requestData[cindex]));
+ check_prom_activity: async function (cindex) {
+ var make_up_arr = new Array();
+ var th = this;
+ var map = new Map();
+ var list = JSON.parse(JSON.stringify(this.data.requestData[cindex]));
//循环处理活动,看活动商品的数量,用map来出来存储,key为活动id,值是数量
-
- //-- 所有的购物车的数据,要用拷贝的赖进行计算 --
- var alllist= JSON.parse(JSON.stringify(this.data.requestData));
- var list2=alllist[cindex];
- var no_gift_arr=[];
-
- //主要判断有没有促销活动
- var is_sele_prom=0;
- var is_gift_del=0;
- for(var i=0;i {
- if(res.data.code==0){
- prom=res.data.data;
+ var t_prom_list = new Array();
+ for (let p_item of map.entries()) {
+ var prom = null;
+ await getApp().request.promiseGet("/api/weshop/promgoods/get/" + os.stoid + "/" + p_item[0], {}).then(res => {
+ if (res.data.code == 0) {
+ prom = res.data.data;
}
})
//如果活动已经结束
- if(!prom || prom.is_end || prom.end_time{
- if(res.data.code==0) discount=res.data.data;
+ }).then(res => {
+ if (res.data.code == 0) discount = res.data.data;
})
//---如果有打折的信息,赠送的信息,赠送的时候要判断是不是限购数量---
- if(discount && discount['goods_id'] && discount.limit_num>=discount.bs && discount.gift_storecount>=discount.bs){
- //如果这礼品超了情况下
- if(no_gift_arr.indexOf(discount.gift_id)!=-1) continue;
- var o=discount.goodsinfo;
+ if (discount && discount['goods_id'] && discount.limit_num >= discount.bs && discount.gift_storecount >= discount.bs) {
+ //如果这礼品超了情况下
+ if (no_gift_arr.indexOf(discount.gift_id) != -1) continue;
+ var o = discount.goodsinfo;
var newd = {
goods_id: o.goods_id,
goods_num: discount.bs,
@@ -2547,88 +2615,107 @@ Page({
user_id: app.globalData.user_id,
store_id: os.stoid,
goods_price: 0,
+ guide_id:ob.guide_id?ob.guide_id:0,
+ guide_type:ob.guide_type?ob.guide_type:0,
member_goods_price: 0,
goods_name: o.goods_name,
goods_sn: o.goods_sn,
sku: o.sku,
is_gift: 1,
- prom_id:p_item[0],
- prom_type:3,
- selected:1,
- gift_id:discount.gift_id,
- original_img:th.data.imgUrl+o.original_img
+ prom_id: p_item[0],
+ prom_type: 3,
+ selected: 1,
+ gift_id: discount.gift_id,
+ original_img: th.data.imgUrl + o.original_img
};
-
- list2.goods.push(newd);
- var all_num=0;
- var all_limit_num=0;
-
- for(var i in alllist){
- var list_item=alllist[i];
- for(var j in list_item.goods){
- //如果赠品的ID一样,要进行统计数量
- if(list_item.goods[j].is_gift==1 && list_item.goods[j].gift_id==newd.gift_id){
- all_num+= list_item.goods[j].goods_num;
- }
- if(list_item.goods[j].is_gift==1 && list_item.goods[j].gift_id==newd.gift_id && list_item.goods[j].prom_id==p_item[0]){
- all_limit_num+= list_item.goods[j].goods_num;
- }
-
- }
- }
-
- //-- 赠品的数量超出库存数量和会员的限制,这里是保证所有的赠品部会超出 --
- if(discount.gift_storecount{
- if(res.data.code==0){
- add_data=res.data.data;
+ var add_data = null;
+ await getApp().request.promisePost("/api/weshop/cart/save", {
+ data: newd
+ }).then(res => {
+ if (res.data.code == 0) {
+ add_data = res.data.data;
}
})
- if(add_data){
- newd.id=add_data.id;
+ if (add_data) {
+ newd.id = add_data.id;
list.goods.push(newd);
- }
+ }
}
}
//--更新购物车的前台渲染--
- var rq_text="requestData["+cindex+"]";
- this.setData({[rq_text]:list});
+ var rq_text = "requestData[" + cindex + "]";
+ this.setData({
+ [rq_text]: list
+ });
- if(!t_prom_list || t_prom_list.length==0 ) return false;
+ if (!t_prom_list || t_prom_list.length == 0) return false;
//-- 提示凑单的,放在最后显示 --
- for(let prid in t_prom_list){
- var prom=t_prom_list[prid];
+ for (let prid in t_prom_list) {
+ var prom = t_prom_list[prid];
//-- 获取凑单提示 --
- await getApp().request.promiseGet("/api/weshop/promgoodslist/list",{
- data:{prom_id:prom.id}
- }).then(res=>{
- if(res.data.code==0){
- var list=res.data.data;
- for(var i in list){
- var item=list[i];
- if(item.prom_type==0){
- if(ob.price {
+ if (res.data.code == 0) {
+ var list = res.data.data;
+ for (var i in list) {
+ var item = list[i];
+ if (item.prom_type == 0) {
+ if (ob.price < item.condition) {
+ var elem = {
+ prom_id: prom.id,
+ diff_type: item.prom_type,
+ diff: (item.condition - ob.price).toFixed(2),
+ content: JSON.parse(item.preferential_type)
+ }
+ make_up_arr.push(elem);
+ break;
}
- }else{
- if(ob.num0){
- this.setData({[diff_text]:make_up_arr});
- }else{
- this.setData({[diff_text]:null});
+ if (make_up_arr.length > 0) {
+ this.setData({
+ [diff_text]: make_up_arr
+ });
+ } else {
+ this.setData({
+ [diff_text]: null
+ });
}
},
//去凑单
- go_cou_dang:function (e) {
- var prom_id=e.currentTarget.dataset.prom_id;
- var url="/pages/goods/goodsList/goodsList?prom_type=3&prom_id="+prom_id;
+ go_cou_dang: function (e) {
+ var prom_id = e.currentTarget.dataset.prom_id;
+ var url = "/pages/goods/goodsList/goodsList?prom_type=3&prom_id=" + prom_id;
getApp().goto(url);
},
//导航跳转
- nav_goto:function(e){
- var url=e.currentTarget.dataset.url;
- if(!url || url=='') return;
- if(url[0]!='/') url='/'+url;
+ nav_goto: function (e) {
+ var url = e.currentTarget.dataset.url;
+ if (!url || url == '') return;
+ if (url[0] != '/') url = '/' + url;
getApp().goto(url);
},
- refresh_input:function(){
- this.data.btn_click=0;
+ refresh_input: function () {
+ this.data.btn_click = 0;
+ },
+
+ imageLoad: function (e) {
+ var imgwidth = e.detail.width;
+ var imgheight = e.detail.height;
+ //宽高比
+ var ratio = imgwidth / imgheight;
+ //计算的高度值
+ var viewHeight = 715 / ratio;
+ var hei = this.data.max_sw_height;
+
+ if (hei < viewHeight) {
+ this.setData({
+ max_sw_height: viewHeight
+ });
+ }
},
-
- imageLoad:function(e){
- var imgwidth = e.detail.width;
- var imgheight = e.detail.height;
- //宽高比
- var ratio = imgwidth / imgheight;
- //计算的高度值
- var viewHeight = 715 / ratio;
- var hei=this.data.max_sw_height;
-
- if (hei< viewHeight) {
- this.setData({ max_sw_height: viewHeight });
- }
- },
-
- go_url(e){
- var url=e.currentTarget.dataset.url;
+
+ go_url(e) {
+ var url = e.currentTarget.dataset.url;
getApp().goto(url);
},
@@ -2713,10 +2806,10 @@ Page({
}
getApp().goto(good_url);
- }else{
- getApp().goto(good_url);
+ } else {
+ getApp().goto(good_url);
}
})
}
-
+
});
\ No newline at end of file
diff --git a/pages/cart/cart/cart.wxml b/pages/cart/cart/cart.wxml
index 8329100..f2760de 100644
--- a/pages/cart/cart/cart.wxml
+++ b/pages/cart/cart/cart.wxml
@@ -43,6 +43,7 @@
总数量:
{{all_num}}
+ 再买{{freight_free - total_fee}}元可享包邮({{weight_free}}kg内);
编辑
完成
diff --git a/pages/cart/cart/cart.wxss b/pages/cart/cart/cart.wxss
index a977424..9519427 100644
--- a/pages/cart/cart/cart.wxss
+++ b/pages/cart/cart/cart.wxss
@@ -234,6 +234,12 @@ radio {
margin-left: 13rpx;
}
+.login-in .weight_free {
+ font-size: 26rpx;
+ line-height: 48rpx;
+ margin-left: 30rpx;
+}
+
.allradio {
width: 600rpx;
height: 100%;
diff --git a/pages/cart/cart/zh_calculate.js b/pages/cart/cart/zh_calculate.js
index f02e370..517f016 100644
--- a/pages/cart/cart/zh_calculate.js
+++ b/pages/cart/cart/zh_calculate.js
@@ -1,6 +1,6 @@
module.exports = {
//辅助数组添加元素功能
- find_in_add: function(list, ele) {
+ find_in_add: function (list, ele) {
for (var i in list) {
var item = list[i];
if (item.goods_id == ele.goods_id) {
@@ -10,7 +10,7 @@ module.exports = {
list.push(ele);
},
//辅助数组添加元素功能
- find_in_remove: function(list, ele) {
+ find_in_remove: function (list, ele) {
for (var i in list) {
var item = list[i];
if (item.goods_id == ele.goods_id) {
@@ -20,7 +20,7 @@ module.exports = {
},
//主要是把组合购的商品分离出来
- add_zhprom: function(car, a, ele) {
+ add_zhprom: function (car, a, ele) {
var point = car[a];
if (point.zh_map) {
if (point.zh_map[ele.prom_id]) {
@@ -42,7 +42,7 @@ module.exports = {
}
},
//未选中的商品,要从中剔除
- remove_zhprom: function(car, a, ele) {
+ remove_zhprom: function (car, a, ele) {
var point = car[a];
if (point.zh_map) {
if (point.zh_map[ele.prom_id]) {
@@ -52,14 +52,14 @@ module.exports = {
},
//把组合购的商品价格计算出来,同时每个会员都有购买组合商品的上限!zh_b_num是已经购买了多少件
- calculate_zh: function(car, a, th) {
+ calculate_zh: function (car, a, th) {
var car_item = car[a];
var tfeel = 0,
offline_price = 0,
offline_num = 0;
var txt = "requestData[" + a + "].need_list";
- //活动的列表都存储在这里面,可以快速查询
- var zh_prom_goods=car_item.zh_prom_goods;
+ //活动的列表都存储在这里面,可以快速查询
+ var zh_prom_goods = car_item.zh_prom_goods;
if (!car_item.zh_map || !zh_prom_goods) {
var res = {
tfeel: tfeel,
@@ -71,7 +71,7 @@ module.exports = {
});
return res;
}
-
+
//因为可能有多个组合购的活动
for (var i in car_item.zh_map) {
var bitem = car_item.zh_map[i];
@@ -81,14 +81,13 @@ module.exports = {
var need_to_buy = 0;
var all_zhqty = 0; //所有商品要求起购数之和
var no_in_arr = []; //剩余的未加入组合购
- var out_arr=[]; //超出活动限购的商品放入
-
- var title =""; //提示语;
+ var out_arr = []; //超出活动限购的商品放入
+ var zhqty_bz = []; //超量
+ var title = ""; //提示语;
//var goods = bitem.goods;
var goods = zh_prom_goods[act.id];
-
- for (let v3 in car_item.goods) {
- car_item.goods[v3].need_downlow_num=0;
+ for (let v3 in car_item.goods) {
+ car_item.goods[v3].need_downlow_num = 0;
}
//寻找一下
@@ -102,71 +101,76 @@ module.exports = {
return 0;
}
- //寻找一下
- function get_num2(ite) {
- for (let v2 in car_item.goods) {
- var vh = car_item.goods[v2];
- if (vh.goods_id == ite.goods_id) {
- return vh;
- }
- }
- return 0;
- }
+ //寻找一下
+ function get_num2(ite) {
+ for (let v2 in car_item.goods) {
+ var vh = car_item.goods[v2];
+ if (vh.goods_id == ite.goods_id) {
+ return vh;
+ }
+ }
+ return 0;
+ }
for (var i in goods) {
var item = goods[i];
- item.goods_price=get_num(item).goods_price;
- item.offline_price=get_num(item).offline_price;
- var cart_num=get_num(item).goods_num;
- var zh_b_num=get_num2(item).zh_b_num;
- if(!cart_num) {
- if (item.zhqty) {
- title="必买商品未加购,下单立享【"+act.zhprice+"元任选"+act.zhbuyqty+"件】";
- need_to_buy += item.zhqty;
- }
- continue;
+ item.goods_price = get_num(item).goods_price;
+ item.offline_price = get_num(item).offline_price;
+ var cart_num = get_num(item).goods_num;
+ var zh_b_num = get_num2(item).zh_b_num;
+ if (!cart_num) {
+ if (item.zhqty) {
+ title = "必买商品未加购,下单立享【" + act.zhprice + "元任选" + act.zhbuyqty + "件】";
+ need_to_buy += item.zhqty;
+ }
+ continue;
}
- item.cart_num =cart_num;
- //-- 当商品有购买的时候,以及有限购的时候 --
- if(item.buyqty>0){
-
- console.log(111,th.data.in_zhact_gdmap);
-
- var cbuy=item.buyqty-zh_b_num;
- var key=item.goods_id+""+act.id;
- if(th.data.in_zhact_gdmap[key]){
- var cbuy=item.buyqty-zh_b_num-th.data.in_zhact_gdmap[key];
- }
- //当可买的数量为0
- if(cbuy<=0){
- item.num=0;
- out_arr.push({
- price: item.goods_price,offline_price:item.offline_price,goods_id:item.goods_id,num:cart_num
- })
- }else{
- if(cbuy>=cart_num) item.num =cart_num;
- else{
- item.num =cbuy;
- out_arr.push({
- price: item.goods_price,offline_price:item.offline_price,goods_id:item.goods_id,num:cart_num-cbuy
- })
- }
- }
-
- }else{
- item.num =cart_num;
+ item.cart_num = cart_num;
+ //-- 当商品有购买的时候,以及有限购的时候 --
+ if (item.buyqty > 0) {
+ console.log(111, th.data.in_zhact_gdmap);
+ var cbuy = item.buyqty - zh_b_num;
+ var key = item.goods_id + "" + act.id;
+ if (th.data.in_zhact_gdmap[key]) {
+ var cbuy = item.buyqty - zh_b_num - th.data.in_zhact_gdmap[key];
+ }
+ //当可买的数量为0
+ if (cbuy <= 0) {
+ item.num = 0;
+ out_arr.push({
+ price: item.goods_price,
+ offline_price: item.offline_price,
+ goods_id: item.goods_id,
+ num: cart_num
+ })
+ } else {
+ if (cbuy >= cart_num) item.num = cart_num;
+ else {
+ item.num = cbuy;
+ out_arr.push({
+ price: item.goods_price,
+ offline_price: item.offline_price,
+ goods_id: item.goods_id,
+ num: cart_num - cbuy
+ })
+ }
+ }
+
+ } else {
+ item.num = cart_num;
}
- item.goods_price=get_num(item).goods_price;
- item.offline_price=get_num(item).offline_price;
- if(item.cart_num){
- all_price += item.cart_num * item.goods_price;
+ item.goods_price = get_num(item).goods_price;
+ item.offline_price = get_num(item).offline_price;
+ if (item.cart_num) {
+ all_price += item.cart_num * item.goods_price;
}
if (item.num) {
all_num += item.num;
//当有起购数的控制的时候
if (item.zhqty) {
+ zhqty_bz.push(item);
all_zhqty += item.zhqty;
if (item.num < item.zhqty) {
need_to_buy += item.zhqty - item.num;
@@ -174,20 +178,24 @@ module.exports = {
if (item.num > item.zhqty) {
for (var i = 0; i < item.num - item.zhqty; i++) {
no_in_arr.push({
- price: item.goods_price,offline_price:item.offline_price,goods_id:item.goods_id
+ price: item.goods_price,
+ offline_price: item.offline_price,
+ goods_id: item.goods_id
})
}
}
} else {
for (var j = 0; j < item.num; j++) {
no_in_arr.push({
- price: item.goods_price,offline_price:item.offline_price,goods_id:item.goods_id
+ price: item.goods_price,
+ offline_price: item.offline_price,
+ goods_id: item.goods_id
})
}
}
} else {
- if (item.zhqty) {
- title="必买商品未加购,下单立享【"+act.zhprice+"元任选"+act.zhbuyqty+"件】";
+ if (item.zhqty) {
+ title = "必买商品未加购,下单立享【" + act.zhprice + "元任选" + act.zhbuyqty + "件】";
need_to_buy += item.zhqty;
}
}
@@ -195,83 +203,97 @@ module.exports = {
//当满足组合的要求:总数要满足,起购数要满足
if (all_num >= act.zhbuyqty && !need_to_buy) {
- //商品的列表
- for (var u in goods) {
- var ite=goods[u];
- if(ite.buyqty>0 && ite.num>0){
-
- console.log(222,th.data.in_zhact_gdmap);
-
- var key=ite.goods_id+""+act.id;
- if(th.data.in_zhact_gdmap[key]){
- th.data.in_zhact_gdmap[key]+=ite.num;
- }else{
- th.data.in_zhact_gdmap[key]=ite.num;
- }
- }
+ //商品的列表
+ for (var u in goods) {
+ var ite = goods[u];
+ if (ite.buyqty > 0 && ite.num > 0) {
+
+ console.log(222, th.data.in_zhact_gdmap);
+
+ var key = ite.goods_id + "" + act.id;
+ if (th.data.in_zhact_gdmap[key]) {
+ th.data.in_zhact_gdmap[key] += ite.num;
+ } else {
+ th.data.in_zhact_gdmap[key] = ite.num;
+ }
+ }
}
- function sortData(a, b) {
- return a.price - b.price
- }
- if(no_in_arr.length>0) no_in_arr.sort(sortData);
+ function sortData(a, b) {
+ return a.price - b.price
+ }
+ if (no_in_arr.length > 0) no_in_arr.sort(sortData);
var aprice = act.zhprice;
if (act.zhbuyqty > all_zhqty) {
- for (var n = 0; n < act.zhbuyqty-all_zhqty; n++) {
+ for (var n = 0; n < act.zhbuyqty - all_zhqty; n++) {
no_in_arr.pop();
}
}
//看一下剩下的数量有没有满足组合购的要求,以及要不要倍增
if (act.is_bz && no_in_arr.length >= act.zhbuyqty) {
//看一下是几倍
+ let num = 0;
+ let bz_num = 0;
var be = parseInt(no_in_arr.length / act.zhbuyqty);
- aprice += be * act.zhprice;
- for (var m = 0; m < be * act.zhbuyqty; m++) {
- no_in_arr.pop();
+ if (act.is_bzyh && zhqty_bz.length > 0) {
+ for (let i = 0; i < zhqty_bz.length; i++) {
+ let item = zhqty_bz[i];
+ bz_num = be * item.zhqty;
+ for (let j = 0; j < no_in_arr.length; j++) {
+ let i = no_in_arr[j];
+ if (item.goods_id === i.goods_id) {
+ num++
+ }
+ }
+ }
+ }
+ if (bz_num <= num) {
+ aprice += be * act.zhprice;
+ for (var m = 0; m < be * act.zhbuyqty; m++) {
+ no_in_arr.pop();
+ }
}
}
//算一下剩余的钱
if (no_in_arr.length) {
for (var ii in no_in_arr) {
var item = no_in_arr[ii];
- var gitem=get_num2(item);
- if(gitem) {
- if (!gitem.need_downlow_num) {
- gitem.need_downlow_num = 1;
- }
- else {
- gitem.need_downlow_num++;
- }
- aprice += item.price;
- if (item.offline_price) {
- offline_price += gitem.goods_price - gitem.offline_price;
- offline_num += 1;
- }
- }
+ var gitem = get_num2(item);
+ if (gitem) {
+ if (!gitem.need_downlow_num) {
+ gitem.need_downlow_num = 1;
+ } else {
+ gitem.need_downlow_num++;
+ }
+ aprice += item.price;
+ if (item.offline_price) {
+ offline_price += gitem.goods_price - gitem.offline_price;
+ offline_num += 1;
+ }
+ }
}
}
//超量的部分也要计算一下
- if(out_arr.length){
- for (var m in out_arr) {
- var item = out_arr[m];
- var gitem=get_num2(item);
- if(gitem) {
- if (!gitem.need_downlow_num) {
- gitem.need_downlow_num = item.num;
- }
- else {
- gitem.need_downlow_num+=item.num;
- }
- aprice += item.price*item.num;
- if (item.offline_price && th.data.sales_rules==2) {
- offline_price += (gitem.goods_price - gitem.offline_price)*item.num;
- offline_num += item.num;
- }
+ if (out_arr.length) {
+ for (var m in out_arr) {
+ var item = out_arr[m];
+ var gitem = get_num2(item);
+ if (gitem) {
+ if (!gitem.need_downlow_num) {
+ gitem.need_downlow_num = item.num;
+ } else {
+ gitem.need_downlow_num += item.num;
+ }
+ aprice += item.price * item.num;
+ if (item.offline_price && th.data.sales_rules == 2) {
+ offline_price += (gitem.goods_price - gitem.offline_price) * item.num;
+ offline_num += item.num;
+ }
}
- }
+ }
}
@@ -291,16 +313,16 @@ module.exports = {
} else {
for (var ii in goods) {
var item = goods[ii];
- var gitem=get_num2(item);
- if(gitem && gitem.selected) {
+ var gitem = get_num2(item);
+ if (gitem && gitem.selected) {
- gitem.need_downlow_num = gitem.goods_num;
+ gitem.need_downlow_num = gitem.goods_num;
- if (item.offline_price && th.data.sales_rules==2) {
- offline_price += (item.goods_price - item.offline_price) * gitem.goods_num;
- offline_num += gitem.goods_num;
- }
- }
+ if (item.offline_price && th.data.sales_rules == 2) {
+ offline_price += (item.goods_price - item.offline_price) * gitem.goods_num;
+ offline_num += gitem.goods_num;
+ }
+ }
}
if (act.zhbuyqty - all_num > need_to_buy) {
need_to_buy = act.zhbuyqty - all_num;
@@ -317,8 +339,8 @@ module.exports = {
}
} else {
var index = this.find_need_to(need_to, act);
- if(title=='')
- title = "再买" + need_to_buy + "件,下单立享【" + act.zhprice + "元任选" + act.zhbuyqty + "件】";
+ if (title == '')
+ title = "再买" + need_to_buy + "件,下单立享【" + act.zhprice + "元任选" + act.zhbuyqty + "件】";
if (index != -1) {
need_to[index].title = title;
} else {
@@ -339,7 +361,7 @@ module.exports = {
tfeel += all_price;
}
- console.log('nyf111');
+ console.log('nyf111');
console.log(car_item);
var res = {
@@ -352,7 +374,7 @@ module.exports = {
},
- find_need_to: function(list, iter) {
+ find_need_to: function (list, iter) {
if (!list || list.length <= 0) return -1;
for (var i in list) {
var item = list[i];
@@ -364,30 +386,31 @@ module.exports = {
},
//筛选组合购,纯粹的数组按活动id分组
- find_split: function(arr) {
+ find_split: function (arr) {
//过滤只有团购的商品
- var oarr = arr.goods.filter(function(ele) {
+ var oarr = arr.goods.filter(function (ele) {
return ele.prom_type == 7
})
- if(!oarr || oarr.length==0) return null;
+ if (!oarr || oarr.length == 0) return null;
//看一下有多少个不同的团购
- var map = {},dest = [];
+ var map = {},
+ dest = [];
for (var i = 0; i < oarr.length; i++) {
var ai = oarr[i];
- var index=map[ai.prom_id]
- if (!index) {
+ var index = map[ai.prom_id]
+ if (!index) {
dest.push({
prom_id: ai.prom_id,
data: [ai]
});
- map[ai.prom_id]=dest.length; //存储下标
- } else {
- var dj = dest[index-1];
- dj.data.push(ai);
+ map[ai.prom_id] = dest.length; //存储下标
+ } else {
+ var dj = dest[index - 1];
+ dj.data.push(ai);
}
}
return dest;
}
-}
+}
\ No newline at end of file
diff --git a/pages/cart/cart2/cart2.js b/pages/cart/cart2/cart2.js
index 736f9e2..f06ec07 100644
--- a/pages/cart/cart2/cart2.js
+++ b/pages/cart/cart2/cart2.js
@@ -146,12 +146,20 @@ Page({
}
});
- //阶梯购的立即购买
+ //阶梯购 或者 组合购的立即购买
if(t.state){
th.data.state=1;
}
-
-
+ getApp().promiseGet("/api/wx/weappSendlist/page", {
+ data: {
+ store_id: os.stoid,
+ typeid: "1001"
+ }}).then(res=>{
+ if (res.data.code == 0 && res.data.data.pageData.length > 0) {
+ var template_id = res.data.data.pageData[0].template_id;
+ th.setData({template_id:template_id});
+ }
+ })
},
onUnload: function () {
this.setData({isclose: 1})
@@ -883,7 +891,6 @@ Page({
}
}
-
gd.prom_type=gg.prom_type?gg.prom_type:0;
gd.prom_id=gg.prom_id?gg.prom_id:0;
@@ -1025,7 +1032,7 @@ Page({
th.data.old_cartlist = cart_arr;
}
th.setData({
- bn_goods: t.data.data, bn_pickname: gg.pick_name, index: m_wind,
+ bn_goods: gd, bn_pickname: gg.pick_name, index: m_wind,
bn_pick: gg.pick_id, bn_t_exp_t: distr_t, bn_exp_type: et
});
@@ -1333,7 +1340,7 @@ Page({
},
//-------------------计算订单价格-------------------
- calculatePrice: function (t, s) {
+ calculatePrice : function (t, s) {
var th = this;
to.getConfig2(function (ee) {
to.getwuliuprice(async function (rs) {
@@ -1353,10 +1360,11 @@ Page({
var umoney = th.data.userinfo.user_money - th.data.txmon - (th.data.userinfo.frozen_money ? th.data.userinfo.frozen_money : 0);
var freight_free = ee.freight_free; //全场满多少包邮
+ var weight_free = ee.weight_free; //多少kg内包邮
var no_ex_id = ee.no_ex_id;
var no_ex_good = null;
var by_qc = {};
-
+ var out_of_weight=0; //超出多少重量
if (no_ex_id && freight_free > 0) {
//-----------获取不包邮区域,不包邮商品-------
await getApp().request.promiseGet("/api/weshop/areaFeemail/getAreaGoods", {
@@ -1466,6 +1474,16 @@ Page({
o_price_no_zh += item[j].goods_price * item[j].goods_num;
}
o_price += item[j].goods_price * item[j].goods_num;
+
+ //判断是否有设置限制重量包邮
+ if(weight_free){
+ if( item[j]['exp_sum_type']==2 ){
+ if (goods_weight < 0) goods_weight = 0;
+ //累积商品重量 每种商品的重量 * 数量
+ goods_weight += item[j]['weight'] * item[j]['goods_num'];
+ out_of_weight = (weight_free*1000) - goods_weight;
+ }
+ }
}
//判断是不是有组合购的金额
var f_o_price = o_price;
@@ -1515,9 +1533,8 @@ Page({
//计算物流费用
cart_item.shipping_price = 0;
-
//--有不包邮区域,且不免运费,全场的计算,要减到优惠金额 和券的金额--
- if (no_ex_id && freight_free > 0 && (o_price - quan_price) >= freight_free && cart_item.exp_type == 0 && (by_qc.region_list || by_qc.goods_list)) {
+ if (no_ex_id && freight_free > 0 && (o_price - quan_price) >= freight_free && cart_item.exp_type == 0 && (by_qc.region_list || by_qc.goods_list) && out_of_weight > 0) {
//如果有设置不包邮区域的时候
if (by_qc.region_list != "" && by_qc.region_list != null && by_qc.region_list != undefined) {
if (th.check_by_area(by_qc.region_list)) {
@@ -1640,13 +1657,13 @@ Page({
//统一运费
o_shipping_price += item[j]['uniform_exp_sum'];
break;
- case 2:
- +''
- if (goods_weight < 0) goods_weight = 0;
- //累积商品重量 每种商品的重量 * 数量
- goods_weight += item[j]['weight'] * item[j]['goods_num'];
-
- break;
+ // case 2: //1464行已计算 不必重复计算 注释为:判断是否有设置限制重量包邮
+ // +''
+ // if (goods_weight < 0) goods_weight = 0;
+ // //累积商品重量 每种商品的重量 * 数量
+ // goods_weight += item[j]['weight'] * item[j]['goods_num'];
+ // out_of_weight = (weight_free*1000) - goods_weight;
+ // break;
case 3:
if (goods_piece < 0) goods_piece = 0;
//累积商品数量
@@ -1655,6 +1672,11 @@ Page({
}
}
+ }else{
+ if(goods_weight && out_of_weight !==0){
+ goods_weight=-1;
+ out_of_weight=0;
+ }
}
}
@@ -1665,7 +1687,7 @@ Page({
if (th.data.wu_arr && th.data.wu_arr[cart_item.wind])
code = th.data.wu_arr[cart_item.wind].code;
cart_item.shipping_price =
- th.calculatewuliu(code, o_shipping_price, goods_weight,
+ th.calculatewuliu(code, o_shipping_price, goods_weight,out_of_weight,
goods_piece, th.data.user_addr, freight_free, o_price - quan_price, rs);
if (!th.data.using_quan[pickid] || th.data.using_quan[pickid].isby != 1) {
@@ -1851,7 +1873,7 @@ Page({
//---------计算立即购买----------
- calculatePrice2: function () {
+ calculatePrice2 : function () {
var th = this, good = this.data.bn_goods;
if (!good) return false;
@@ -1893,7 +1915,11 @@ Page({
to.getConfig2(function (ee) {
to.getwuliuprice(async function (rs) {
- var o_shipping_price = 0, goods_weight = -1, goods_piece = -1;
+ var o_shipping_price = 0,goods_weight = -1,goods_piece = -1;
+ var out_of_weight=null; //超出多少重量
+ var freight_free = ee.freight_free; //全场满多少包邮
+ var weight_free = ee.weight_free; //多少kg内包邮
+ var no_ex_id = ee.no_ex_id;
//---如果有选择优惠券的情况下---
var quan_price = 0, bn_pick = th.data.bn_pick;
@@ -1959,8 +1985,10 @@ Page({
break;
case 2:
if (goods_weight < 0) goods_weight = 0;
+ //dw
//累积商品重量 每种商品的重量 * 数量
goods_weight += good['weight'] * good['buynum'];
+ out_of_weight = (weight_free * 1000 ) - goods_weight;
break;
case 3:
if (goods_piece < 0) goods_piece = 0;
@@ -1971,8 +1999,7 @@ Page({
var code = "";
if (th.data.wu_arr && th.data.wu_arr[th.data.index]) code = th.data.wu_arr[th.data.index].code;
- var freight_free = ee.freight_free; //全场满多少包邮
- var no_ex_id = ee.no_ex_id;
+
th.data.is_no_by[th.data.bn_pick] = 0;
var no_by_data = null;
@@ -2008,12 +2035,12 @@ Page({
th.data.is_by[th.data.bn_pick] = 0;
//--------------开始计算物流------------------
var shipping_price =
- th.calculatewuliu(code, o_shipping_price, goods_weight,
+ th.calculatewuliu(code, o_shipping_price, goods_weight,out_of_weight,
goods_piece, th.data.user_addr, freight_free, parseFloat(allpice) - cut_price - quan_price, rs);
//如果有赠品的时候,也要计算赠品的物流费用
if (th.data.buy_now_gift_goods) {
- shipping_price = th.get_now_gift_goods_wuliu(code, o_shipping_price, th.data.user_addr, gift_freight_free,
+ shipping_price = th.get_now_gift_goods_wuliu(code, o_shipping_price, th.data.user_addr, gift_freight_free,out_of_weight,
parseFloat(allpice) - cut_price - quan_price, rs, shipping_price, no_by_data, goods_weight, goods_piece);
}
@@ -2186,10 +2213,26 @@ Page({
});
},
- //--------------------提交订单-----------------------
- async submitForm(t){
- var sub_value = t;
+ requestSubscribe(){
+ const th=this;
+ const template_id = this.data.template_id;
+ wx.getSetting({
+ withSubscriptions:true,
+ success(res){
+ let itemSettings=res.subscriptionsSetting.itemSettings;
+ if(itemSettings && itemSettings[template_id]=="accept"){
+ th.submit_func();
+ }else{
+ th.sendsm(function(){
+ th.submit_func();
+ })
+ }
+ }
+ })
+ },
+ //--------------------提交订单-----------------------
+ async submit_func(){
if (this.data.is_summit_ing == 1) return false; //--提交中退出--
this.data.is_summit_ing = 1;
var th = this, pdata = new Array();
@@ -2233,7 +2276,7 @@ Page({
'user_money': th.data.formData.user_money, //使用余额
'total_amount': th.data.formData.total_amount, //订单总价
'order_amount': th.data.formData.order_amount, //应付
- 'user_note': t.detail.value.user_note, //用户备注
+ 'user_note': th.data.user_note, //用户备注
'store_id': oo.stoid, //商家
'pickup_id': th.data.bn_pick, //门店
'exp_type': th.data.bn_exp_type, //配送方式
@@ -2432,7 +2475,7 @@ Page({
var addr = th.data.user_addr;
if (th.data.is_all_zt == 1) addr = null;
- var val_arr = t.detail.value;
+ var val_arr = th.data.user_note;
if (th.data.is_all_zt != 1)
if (th.data.wu_arr == null || th.data.wu_arr.length <= 0) {
@@ -2465,7 +2508,7 @@ Page({
'user_money': t_item.user_money, //使用余额
'total_amount': t_item.total_amount, //订单总价
'order_amount': t_item.order_amount, //应付
- 'user_note': val_arr['user_note_' + t_item.pickup_id], //用户备注
+ 'user_note': val_arr[i], //用户备注
'store_id': oo.stoid, //商家
'pickup_id': t_item.pickup_id, //门店
'exp_type': t_item.exp_type, //配送方式
@@ -2774,7 +2817,7 @@ Page({
} else if (res.confirm) {
th.data.is_continue = 1;
th.data.is_summit_ing = 0; //是否提交中
- th.submitForm(sub_value);
+ th.submit_func();
}
}
})
@@ -2966,12 +3009,12 @@ Page({
th.calculatePrice();
},
//-------------------计算物流---------------
- calculatewuliu: function (code, o_shipping_price, goods_weight,
+ calculatewuliu: function (code, o_shipping_price, goods_weight,out_of_weight,
goods_piece, user_addr, freight_free, o_price, rs) {
var price = 0, th = this;
price += parseFloat(o_shipping_price);
//如果是包邮
- if (freight_free > 0 && o_price >= freight_free) {
+ if (freight_free > 0 && o_price >= freight_free && out_of_weight>0) {
return 0;
}
if (user_addr == null) {
@@ -2989,7 +3032,7 @@ Page({
item = item.config;
if (item == null) return o_shipping_price;
//------按重量----------
- if (goods_weight >= 0 && item['money']) {
+ if (goods_weight >= 0 && item['money'] && out_of_weight > 0) {
fw_price = parseFloat(item['money']);
if (goods_weight > item['first_weight']) {
var fw = goods_weight - item['first_weight'];
@@ -2997,6 +3040,13 @@ Page({
fw_price = fw_price + n * parseFloat(item['add_money']);
}
}
+ //------超出重量----------
+ if(out_of_weight < 0){
+ fw_price = parseFloat(item['money']);
+ var out_of_weight = Math.abs(out_of_weight);
+ var n = Math.ceil(out_of_weight / item['second_weight'])
+ fw_price = fw_price + n * parseFloat(item['add_money']);
+ }
//------按件数----------
if (goods_piece > 0 && item['piecemoney']) {
fp_price = parseFloat(item['piecemoney']);
@@ -3875,7 +3925,7 @@ Page({
},
//计算立即购买赠品的物流费用
- get_now_gift_goods_wuliu: function (code, o_shipping_price, user_addr, gift_freight_free, allpice, rs, shipping_price, no_by_data, goods_weight1, goods_piece1) {
+ get_now_gift_goods_wuliu: function (code, o_shipping_price, user_addr, gift_freight_free,gift_weight_free, allpice, rs, shipping_price, no_by_data, goods_weight1, goods_piece1) {
var good = this.data.buy_now_gift_goods;
var goods_weight = -1, goods_piece = -1;
var gift_shipping_price = 0;
@@ -3892,6 +3942,7 @@ Page({
goods_weight += good['weight'] * good['buynum'];
if (goods_weight1 > 0) {
goods_weight += goods_weight1;
+ out_of_weight = (gift_weight_free*1000) - goods_weight;
}
break;
case 3:
@@ -3921,7 +3972,7 @@ Page({
}
var t_shipping_price =
- this.calculatewuliu(code, gift_shipping_price, goods_weight,
+ this.calculatewuliu(code, gift_shipping_price, goods_weight,out_of_weight,
goods_piece, user_addr, gift_freight_free, allpice, rs);
return t_shipping_price;
@@ -4042,17 +4093,17 @@ Page({
});
},
- set_hid_inp:function (e) {
- var index = e.currentTarget.dataset.index;
- var txt = "cartlist[" + index + "].focus";
- this.setData({[txt]:1})
- },
-
- clear_hid_inp:function (e) {
- var index = e.currentTarget.dataset.index;
- var txt = "cartlist[" + index + "].focus";
- this.setData({[txt]:0})
- },
+ // set_hid_inp:function (e) {
+ // var index = e.currentTarget.dataset.index;
+ // var txt = "cartlist[" + index + "].focus";
+ // this.setData({[txt]:1})
+ // },
+ //
+ // clear_hid_inp:function (e) {
+ // var index = e.currentTarget.dataset.index;
+ // var txt = "cartlist[" + index + "].focus";
+ // this.setData({[txt]:0})
+ // },
go_url:function (e) {
var url = e.currentTarget.dataset.url;
@@ -4124,7 +4175,23 @@ Page({
}
}
}
- }
+ },
+ //订阅消息提醒
+ sendsm:function(func)
+ {
+ var template_id = this.data.template_id;
+ // //授权订阅
+ wx.requestSubscribeMessage({
+ tmplIds: [template_id],
+ success(res) {
+ func();
+ },
+ fail(res) {
+ func();
+ }
+ })
+
+ },
});
diff --git a/pages/cart/cart2/cart2.wxml b/pages/cart/cart2/cart2.wxml
index 95bea2b..e9bb202 100644
--- a/pages/cart/cart2/cart2.wxml
+++ b/pages/cart/cart2/cart2.wxml
@@ -2,38 +2,38 @@
-
@@ -671,9 +671,9 @@
店铺优惠
- 优惠¥{{show_off_price}}
+ 优惠¥{{show_off_price}}
- 不用优惠
+ 不用优惠
diff --git a/pages/cart/cart2/zh_calculate.js b/pages/cart/cart2/zh_calculate.js
index c23727e..8fa478a 100644
--- a/pages/cart/cart2/zh_calculate.js
+++ b/pages/cart/cart2/zh_calculate.js
@@ -2,15 +2,18 @@ var regeneratorRuntime = require('../../../utils/runtime.js');
module.exports = {
//主要的作用,就是把组合购多余的商品进行拆分,
//如果没有达成组合购的要求,所有的商品都打回原价购买
- fir_set_arr: function (c_item,th) {
+ fir_set_arr: function (c_item, th) {
//组合活动,以及组合活动从表的商品
let zh_prom_goods = c_item.zh_prom_goods;
- let goods = c_item.goods; //一个门店中所有的商品
- let tfeel = 0,cut_price=0, offline_price = 0, offline_num = 0;
+ let goods = c_item.goods; //一个门店中所有的商品
+ let tfeel = 0,
+ cut_price = 0,
+ offline_price = 0,
+ offline_num = 0;
let txt_ite = c_item.need_list;
//多个活动要拿来循环一下
for (let i in zh_prom_goods) {
- let title = ""; //提示语;
+ let title = ""; //提示语;
//其中的一个活动
let act_item = zh_prom_goods[i];
let act_goos = act_item.gdlist;
@@ -19,12 +22,12 @@ module.exports = {
let all_num = 0; //商品数量之和
let all_price0 = 0; //商品数量之和
- let aprice=0; //达到活动条件的购买价格
+ let aprice = 0; //达到活动条件的购买价格
let need_to_buy = 0;
let all_zhqty = 0; //所有商品要求起购数之和
let no_in_arr = []; //剩余的未加入组合购
- let out_arr=[]; //超出活动限购的商品放入
-
+ let out_arr = []; //超出活动限购的商品放入
+ let zhqty_bz = []; //超量
//-- 寻找一下 --
function get_num2(ite) {
for (let v2 in goods) {
@@ -39,35 +42,42 @@ module.exports = {
for (let j in act_goos) {
let item = act_goos[j];
let item_j = goods.find(function (ele) {
+ console.log('ele',ele);
return ele.goods_id == act_goos[j].goods_id;
})
//-- 如果有找到的话 --
if (item_j) {
act_goos[j].num = item_j.goods_num;
act_goos[j].goods_price = item_j.goods_price;
- var cart_num=item.cart_num =item_j.goods_num;
- var zh_b_num=item_j.promgoodsbuynum;
- if(item.buyqty>0){
-
- var key=item.goods_id+""+act.id;
- var cbuy=item.buyqty-zh_b_num;
- if(th.data.in_zhact_gdmap[key]){
- var cbuy=item.buyqty-zh_b_num-th.data.in_zhact_gdmap[key];
+ var cart_num = item.cart_num = item_j.goods_num;
+ var zh_b_num = item_j.promgoodsbuynum;
+ if (item.buyqty > 0) {
+
+ var key = item.goods_id + "" + act.id;
+ var cbuy = item.buyqty - zh_b_num;
+ if (th.data.in_zhact_gdmap[key]) {
+ var cbuy = item.buyqty - zh_b_num - th.data.in_zhact_gdmap[key];
}
//当可买的数量为0
- if(cbuy<=0){
- item.num=0;
+ if (cbuy <= 0) {
+ item.num = 0;
out_arr.push({
- price: item.goods_price,offline_price:item.offline_price,goods_id:item.goods_id,num:cart_num
+ price: item.goods_price,
+ offline_price: item.offline_price,
+ goods_id: item.goods_id,
+ num: cart_num
})
- }else{
- if(cbuy>=cart_num) item.num =cart_num;
- else{
- item.num =cbuy;
+ } else {
+ if (cbuy >= cart_num) item.num = cart_num;
+ else {
+ item.num = cbuy;
out_arr.push({
- price: item.goods_price,offline_price:item.offline_price,goods_id:item.goods_id,num:cart_num-cbuy
+ price: item.goods_price,
+ offline_price: item.offline_price,
+ goods_id: item.goods_id,
+ num: cart_num - cbuy
})
}
}
@@ -76,6 +86,7 @@ module.exports = {
all_num += item.num;
//当有起购数的控制的时候
if (item.zhqty) {
+ zhqty_bz.push(item);
all_zhqty += item.zhqty;
if (item.num < item.zhqty) {
need_to_buy += item.zhqty - item.num;
@@ -83,14 +94,18 @@ module.exports = {
if (item.num > item.zhqty) {
for (let i = 0; i < item.num - item.zhqty; i++) {
no_in_arr.push({
- price: item.goods_price, goods_id: item.goods_id, offline_price: item_j.offline_price
+ price: item.goods_price,
+ goods_id: item.goods_id,
+ offline_price: item_j.offline_price
})
}
}
} else {
for (let j = 0; j < item.num; j++) {
no_in_arr.push({
- price: item.goods_price, goods_id: item.goods_id, offline_price: item_j.offline_price
+ price: item.goods_price,
+ goods_id: item.goods_id,
+ offline_price: item_j.offline_price
})
}
}
@@ -105,47 +120,58 @@ module.exports = {
//当满足组合的要求:总数要满足,起购数要满足
if (act && all_num >= act.zhbuyqty && !need_to_buy) {
-
//商品的列表
for (var u in act_goos) {
- var ite=act_goos[u];
- if(ite.buyqty>0 && ite.num>0){
- var key=ite.goods_id+""+act.id;
- if(th.data.in_zhact_gdmap[key]){
- th.data.in_zhact_gdmap[key]+=ite.num;
- }else{
- th.data.in_zhact_gdmap[key]=ite.num;
+ var ite = act_goos[u];
+ if (ite.buyqty > 0 && ite.num > 0) {
+ var key = ite.goods_id + "" + act.id;
+ if (th.data.in_zhact_gdmap[key]) {
+ th.data.in_zhact_gdmap[key] += ite.num;
+ } else {
+ th.data.in_zhact_gdmap[key] = ite.num;
}
}
}
-
-
function sortData(a, b) {
return a.price - b.price
}
-
- if(no_in_arr.length>0) no_in_arr.sort(sortData);
-
+ if (no_in_arr.length > 0) no_in_arr.sort(sortData);
aprice = act.zhprice;
if (act.zhbuyqty > all_zhqty) {
- for (let n = 0; n < act.zhbuyqty-all_zhqty; n++) {
+ for (let n = 0; n < act.zhbuyqty - all_zhqty; n++) {
no_in_arr.pop();
}
}
//看一下剩下的数量有没有满足组合购的要求,以及要不要倍增
if (act.is_bz && no_in_arr.length >= act.zhbuyqty) {
//看一下是几倍
- let be = parseInt(no_in_arr.length / act.zhbuyqty);
- aprice += be * act.zhprice;
- for (let m = 0; m < be * act.zhbuyqty; m++) {
- no_in_arr.pop();
- }
+ let num = 0;
+ let bz_num = 0;
+ let be = parseInt(no_in_arr.length / act.zhbuyqty);
+ if (act.is_bzyh && zhqty_bz.length > 0) {
+ for (let i = 0; i < zhqty_bz.length; i++) {
+ let item = zhqty_bz[i];
+ bz_num = be * item.zhqty;
+ for (let j = 0; j < no_in_arr.length; j++) {
+ let i = no_in_arr[j];
+ if (item.goods_id === i.goods_id) {
+ num++
+ }
+ }
+ }
+ }
+ if (bz_num <= num) {
+ aprice += be * act.zhprice;
+ for (var m = 0; m < be * act.zhbuyqty; m++) {
+ no_in_arr.pop();
+ }
+ }
+
}
-
let goods_map = {};
//算一下剩余的商品
- if(no_in_arr.length) {
+ if (no_in_arr.length) {
for (let ii in no_in_arr) {
let item = no_in_arr[ii];
if (item.offline_price) {
@@ -162,24 +188,24 @@ module.exports = {
}
//超量的部分也要计算一下
- if(out_arr.length){
+ if (out_arr.length) {
for (var m in out_arr) {
var item = out_arr[m];
if (item.offline_price) {
- offline_price += (item.price - item.offline_price)*item.num;
+ offline_price += (item.price - item.offline_price) * item.num;
offline_num += item.num;
}
if (goods_map[item.goods_id]) {
var num = goods_map[item.goods_id];
- num+=item.num
- goods_map[item.goods_id] =num;
+ num += item.num
+ goods_map[item.goods_id] = num;
} else {
goods_map[item.goods_id] = item.num;
}
}
}
- if(Object.keys(goods_map).length) {
+ if (Object.keys(goods_map).length) {
//这里就开始拆分提交订单时的列表
for (let j in goods_map) {
//map中存的就是商品的数量
@@ -196,24 +222,26 @@ module.exports = {
goods.push(new_g);
//如果商品的数量已经为空了
- if(goods[idx].goods_num<=0){
- goods.splice(idx,1);
+ if (goods[idx].goods_num <= 0) {
+ goods.splice(idx, 1);
}
}
}
//-- 只统计是参与活动的商品 --
- for(var ij in goods){
- var iter=goods[ij];
- if(iter.prom_type!=7 || iter.prom_id!=act.id){ continue; }
- all_price0+=iter.goods_num*iter.goods_price;
+ for (var ij in goods) {
+ var iter = goods[ij];
+ if (iter.prom_type != 7 || iter.prom_id != act.id) {
+ continue;
+ }
+ all_price0 += iter.goods_num * iter.goods_price;
}
//-- 活动的条件已经满足 --
c_item.zh_prom_goods[act.id].is_has_zh = 1;
c_item.is_has_zh = 1;
c_item.zh_prom_goods[act.id].actual_price = aprice;
- c_item.zh_prom_goods[act.id].cut_price =all_price0-aprice;
+ c_item.zh_prom_goods[act.id].cut_price = all_price0 - aprice;
//-- 设置还需要购买多少件,享受活动,前段显示 --
let need_to = c_item.need_list;
@@ -257,7 +285,7 @@ module.exports = {
txt_ite = need_to;
}
tfeel += aprice;
- cut_price+=all_price0-aprice;;
+ cut_price += all_price0 - aprice;;
}
c_item.zh_all_price = tfeel;
@@ -315,10 +343,10 @@ module.exports = {
calc_zh_split_price: async function (c_arr, th) {
//-- 循环处理 --
for (var k in c_arr) {
- var cart_item = c_arr[k]; //就是每一单的意思
- var ord_goods = c_arr[k].goods; //就是每一单的从表的意思
+ var cart_item = c_arr[k]; //就是每一单的意思
+ var ord_goods = c_arr[k].goods; //就是每一单的从表的意思
- var zh_prom_goods = cart_item.zh_prom_goods; //一单中所有的组合购的集合
+ var zh_prom_goods = cart_item.zh_prom_goods; //一单中所有的组合购的集合
var item_map = {};
for (let i in zh_prom_goods) {
let item = zh_prom_goods[i];
@@ -330,14 +358,14 @@ module.exports = {
return ele.prom_type == 7 && ele.prom_id == i;
})
var all_good_price = 0;
- var post_gd=[];
+ var post_gd = [];
for (let j in glist) {
let item = glist[j];
all_good_price += item.goods_price * item.goods_num;
- var gitem={
- goods_id:item.goods_id,
- goods_num:item.goods_num,
- goods_price:item.goods_price
+ var gitem = {
+ goods_id: item.goods_id,
+ goods_num: item.goods_num,
+ goods_price: item.goods_price
}
post_gd.push(gitem);
}
@@ -365,7 +393,7 @@ module.exports = {
'goods': post_gd
}
var pt_res = null;
- await getApp().request.promisePost("/api/weshop/order/getGoodsSplit", {
+ await getApp().request.promisePost("/api/weshop/order/getGoodsSplit", {
is_json: 1,
data: pt_data
}).then(res => {
@@ -376,7 +404,7 @@ module.exports = {
if (pt_res) {
for (var io in glist) {
var goods_id = glist[io].goods_id;
- item_map[goods_id]={};
+ item_map[goods_id] = {};
//平摊赋值
item_map[goods_id].account_fir = th.arr_get_goods(goods_id, pt_res).fisrt_account;
item_map[goods_id].account_yu_fir = th.arr_get_goods(goods_id, pt_res).fisrt_account_yu;
@@ -404,4 +432,4 @@ module.exports = {
}
-}
+}
\ No newline at end of file
diff --git a/pages/giftpack/birthdaygift/birthdaygift.js b/pages/giftpack/birthdaygift/birthdaygift.js
index 688561f..590c300 100644
--- a/pages/giftpack/birthdaygift/birthdaygift.js
+++ b/pages/giftpack/birthdaygift/birthdaygift.js
@@ -119,7 +119,7 @@ Page({
var th = this;
th.setData({
getActId: options.actId,
- giftID: options.giftBagId
+ giftID: options.giftBagId,
})
},
@@ -131,6 +131,7 @@ Page({
return false;
}
this.GetList();
+ this.is_birthdayInfo()
},
GetReceive: function() {
@@ -175,6 +176,29 @@ Page({
}
},
+ //获取生日有礼信息
+ is_birthdayInfo: function(e) {
+ var th = this;
+ var url = `/api/weshop/marketing/get/${a.stoid}/${th.data.getActId}`;
+ console.log(th.data.getActId);
+ getApp().request.promiseGet(url, {
+
+ }).then(res => {
+ console.log(res,20000);
+ if (res.data.code == 0) {
+ let birthdayStyle=`
+ --bg-color:${res.data.data.actBgColor};
+ --color:${res.data.data.actFontColor};
+ `
+ th.setData({
+ bimg: res.data.data.actBoundImg,
+ birthdayStyle,
+ // actFontColor: res.data.actFontColor, //字体颜色
+ // actBgColor: res.data.actBgColor, //背景颜色
+ })
+ }
+ })
+ },
//界面跳转
goto: function(e) {
var url = e.currentTarget.dataset.url;
diff --git a/pages/giftpack/birthdaygift/birthdaygift.wxml b/pages/giftpack/birthdaygift/birthdaygift.wxml
index 1aa6519..ec36d55 100644
--- a/pages/giftpack/birthdaygift/birthdaygift.wxml
+++ b/pages/giftpack/birthdaygift/birthdaygift.wxml
@@ -1,6 +1,6 @@
-
+
-
+
diff --git a/pages/giftpack/birthdaygift/birthdaygift.wxss b/pages/giftpack/birthdaygift/birthdaygift.wxss
index b2b445a..24a7647 100644
--- a/pages/giftpack/birthdaygift/birthdaygift.wxss
+++ b/pages/giftpack/birthdaygift/birthdaygift.wxss
@@ -246,7 +246,7 @@
}
.top_box_image button {
margin: 15rpx 95rpx 0rpx 95rpx;
- background: #fe6a6a;
+ background: var(--color);
border-radius: 50rpx;
line-height: 60rpx;
height: 60rpx;
@@ -275,7 +275,7 @@
}
.button {
margin: 0 30rpx;
- background: #61d3dd;
+ background:var(--bg-color);
border-radius: 50rpx;
line-height: 80rpx;
height: 80rpx;
@@ -308,7 +308,7 @@
width: 100%;
}
.foot_button_buy {
- background: #e4010c;
+ background:var(--color);
color: #FFFFFF;
width: 400rpx;
height: 70rpx;
@@ -351,4 +351,9 @@ button::after {
width: 20rpx;
height: 90rpx;
z-index: 5;
+}
+
+.font_and_bg {
+ background-color: var(--bg-color);
+ color:var(--color);
}
\ No newline at end of file
diff --git a/pages/goods/goodsInfo/buy_pt.wxml b/pages/goods/goodsInfo/buy_pt.wxml
index 662f1f3..cb72777 100644
--- a/pages/goods/goodsInfo/buy_pt.wxml
+++ b/pages/goods/goodsInfo/buy_pt.wxml
@@ -144,7 +144,7 @@
{{sec_sto.name}}
- {{item.pickup_name}}
+ {{item.pickup_name}}
diff --git a/pages/goods/goodsInfo/goodsInfo.js b/pages/goods/goodsInfo/goodsInfo.js
index 1be1ca1..d5c8dec 100644
--- a/pages/goods/goodsInfo/goodsInfo.js
+++ b/pages/goods/goodsInfo/goodsInfo.js
@@ -254,7 +254,6 @@ Page({
//------初始化加载----------
onLoad: function (t) {
-
var ee = this,
that = ee,
th = ee,
@@ -408,7 +407,6 @@ Page({
var user = getApp().globalData.userInfo;
if (!user) return false;
clearInterval(ti);
-
if (user.card_field && user['card_expiredate']) {
var str = user['card_expiredate'].replace(/-/g, '/');
var end = new Date(str);
@@ -691,7 +689,7 @@ Page({
mapurl_f_img = res1.data.data.video_img;
}
})
-
+ this.getHistoryBuy(); //获取历史购买
ee.setData({
gallery: gallery,
is_collect: is_collect,
@@ -707,7 +705,6 @@ Page({
//---展示---
onShow: function () {
- // console.log('djfijsaoifjoisadjfoij');
var goods_list = null, th = this, that = this;
var show_prew_img = this.data.show_prew_img
if (show_prew_img) {
@@ -1525,38 +1522,36 @@ Page({
}
else {
- if(newd.prom_type==10){
- //----先看会员在购物车中是否加入了该商品,立即购买的-----
- getApp().request.get("/api/weshop/cart/page", {
- data: {
- store_id: e.data.stoid,
- user_id: oo.user_id,
- state:1
- },
- success: function (res) {
- //-------如果购物车中有相关的数据---------
- if (res.data.code==0 && res.data.data.total > 0) {
- for(let j in res.data.data.pageData){
- let item_j=res.data.data.pageData[j];
- var url = '/api/weshop/cart/del/' +e.data.stoid+ '/' + item_j.id;
- getApp().request.delete(url, {});
- }
+ //这一步主要是要让立即购买 走 购物车的逻辑 参与活动
+ if(newd.prom_type==10 || newd.prom_type==7){
+ //----先看会员在购物车中是否加入了该商品,立即购买的-----
+ getApp().request.get("/api/weshop/cart/page", {
+ data: {
+ store_id: e.data.stoid,
+ user_id: oo.user_id,
+ state:1
+ },
+ success: function (res) {
+ //-------如果购物车中有相关的数据---------
+ if (res.data.code==0 && res.data.data.total > 0) {
+ for(let j in res.data.data.pageData){
+ let item_j=res.data.data.pageData[j];
+ var url = '/api/weshop/cart/del/' +e.data.stoid+ '/' + item_j.id;
+ getApp().request.delete(url, {});
}
- newd.state=1;
- getApp().request.post("/api/weshop/cart/save", {
- data: newd,
- success: function (t) {
- th.closeSpecModal();
- getApp().goto("/pages/cart/cart2/cart2?state=1");
- }
- });
-
-
- }
- })
- return false;
- }
-
+ }
+ newd.state=1;
+ getApp().request.post("/api/weshop/cart/save", {
+ data: newd,
+ success: function (t) {
+ th.closeSpecModal();
+ getApp().goto("/pages/cart/cart2/cart2?state=1");
+ }
+ });
+ }
+ })
+ return false;
+ }
if (th.data.prom_goods) {
var prom_d = th.data.prom_goods;
@@ -2414,9 +2409,9 @@ Page({
}
},
- //-----------选择属性的按钮事件----------
+ //-----------选择属性的按钮事件----------
sele_spec: function (e) {
- var that = this, ee = this, th = this;
+ var that = this;
var gid = e.currentTarget.dataset.gid;
var nor = e.currentTarget.dataset.nor;
@@ -2435,25 +2430,33 @@ Page({
break
}
}
+ console.log(item,2000);
+ var cur_price = item.shop_price;
+ if (getApp().globalData.userInfo && getApp().globalData.userInfo.card_field) {
+ var cfile = getApp().globalData.userInfo.card_field;
+ console.log('cfile',cfile);
+ if (item[cfile]) {
+ cur_price =item[cfile];
+ }
+ }
+ var txt = (cur_price / item.market_price * 10).toFixed(2).toString();
+ txt = parseFloat(txt);
+ item['disc'] = txt;
if (item) this.setData({
sele_g: item,
- gid: gid
+ gid: gid,
+ data:item,
});
-
-
that.check_is_youhui(gid, that.data.is_normal);
- this.get_sto(that.data.is_normal);
-
-
//默认门店要拿下门店库存
if (that.data.sales_rules == 2 && that.data.def_pick_store) {
var lock = 0, plist = null;
//先读取门店的lock,采用链式写法,少用await
getApp().request.promiseGet("/api/weshop/order/ware/lock/page", {
- data: { store_id: os.stoid, wareId: ee.data.sele_g.goods_id, storageId: that.data.def_pick_store.pickup_id, pageSize: 1000 }
+ data: { store_id: os.stoid, wareId: that.data.sele_g.goods_id, storageId: that.data.def_pick_store.pickup_id, pageSize: 1000 }
}).then(res => {
if (res.data.code == 0 && res.data.data.total > 0) {
for (var i in res.data.data.pageData)
@@ -2461,7 +2464,7 @@ Page({
}
//---通过接口获取门店的线下库存信息--
return getApp().request.promiseGet("/api/weshop/goods/getWareStorages", {
- data: { storageNos: that.data.def_pick_store.pickup_no, wareIds: encodeURIComponent(th.data.sele_g.erpwareid), storeId: os.stoid }
+ data: { storageNos: that.data.def_pick_store.pickup_no, wareIds: encodeURIComponent(that.data.sele_g.erpwareid), storeId: os.stoid }
})
}).then(res => {
if (res.data.code == 0 && res.data.data.total > 0) {
@@ -2473,11 +2476,9 @@ Page({
that.data.def_pick_store.CanOutQty = 0;
}
//--给门店赋值线下库存--
- th.setData({ def_pick_store: that.data.def_pick_store });
+ that.setData({ def_pick_store: that.data.def_pick_store });
})
}
-
-
this.sele_spec_chech_activity();
},
@@ -2581,6 +2582,7 @@ Page({
//---------拿出门店分类和门店------------
get_sto(e) {
+ console.log('get_sto')
var th = this, that = this;
var is_normal = e;
@@ -3103,6 +3105,7 @@ Page({
//--------检查是否活动,活动是否开始,或者是否结束-------
async check_prom(gid, prom_type, prom_id) {
+ console.log('check_prom');
var ee = this,th = ee;
var user_id=getApp().globalData.user_id;
if(!user_id) user_id=0;
@@ -3383,8 +3386,8 @@ Page({
await getApp().request.promiseGet("/api/weshop/activitylist/getActLen/" + os.stoid + "/" + prom_type + "/" + prom_id, {
1: 1
}).then(res => {
- console.log(res,3114);
var em = res;
+ var flag=null;
if (em.data.code == 0) {
if (em.data.data <= 0) ee.setData({
prom_r_null: 1
@@ -3392,8 +3395,7 @@ Page({
//拿取价格并且判断时间--
getApp().request.get("/api/weshop/teamlist/get/" +
os.stoid + "/" + prom_id, {
- success: function (t) {
- console.log(t,3124);
+ success: async function (t) {
if (t.data.code != 0) {
ee.get_normal(gid);
return false;
@@ -3432,25 +3434,40 @@ Page({
}
});
return false
- ee.setData({
- prom_type: 0,
- isshow: 1,
- });
- ee.get_sku(os.stoid, ee.data.data, gid);
- ee.get_sto();
- return false;
}
+ await getApp().request.promiseGet("/api/weshop/teamlist/pageteam/1",{
+ 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;
+
+ }
//-------查看自己是不是有买过该团的商品,并还为支付,或者在进行中-------
- getApp().request.get("/api/weshop/order/page", {
+ await getApp().request.promiseGet("/api/weshop/order/page", {
data: {
pt_prom_id: prom_id,
user_id: oo.user_id,
store_id: os.stoid,
pageSize: 1,
page: 1
- },
- success: function (e) {
+ }
+ }).then(e=>{
if (e.data.code == 0 && e.data.data.pageData.length > 0) {
var odr = e.data.data.pageData[0];
th.data.buy_order = odr;
@@ -3496,8 +3513,7 @@ Page({
th.data.wk_order_id = odr.order_id;
}
}
- },
- });
+ })
//----------查看阶梯团------------
if (t.data.data.ct_rylist != "null" && t.data.data.ct_rylist != "" && t.data.data.ct_rylist != null && t.data.data.ct_rylist != undefined) {
@@ -5782,7 +5798,7 @@ Page({
//调用接口判断订单优惠,
getApp().request.get("/api/weshop/goods/getGoodsPromList/" + os.stoid + "/" + gid + "/0", {
success: function (res) {
- console.log(res);
+
if (res.data.code == 0 && res.data.data) {
var r_data = res.data.data;
var max = 0, min = 0;
@@ -5940,11 +5956,11 @@ Page({
})
},
- previewImage() {
+ previewImage(e) {
this.data.show_prew_img = 1;
wx.previewImage({
//将图片预览出来
- urls: [this.data.shareImgPath]
+ urls: [this.data.sele_g.original_img]
});
},
@@ -6226,9 +6242,25 @@ Page({
go_more_ladder:function (e) {
var prom_id=e.currentTarget.dataset.id;
getApp().goto("/pages/goods/goodsList/goodsList?ladder_id="+prom_id);
- }
-
-
-
+ },
+ getHistoryBuy() {
+ let _this=this;
+ let req_data = {
+ store_id:os.stoid,
+ goods_id:this.data.gid,
+ pay_status:1,
+ rndid:1
+ };
+ getApp().request.promiseGet('/api/weshop/ordergoods/list',{
+ data:req_data,
+ })
+ .then(res=>{
+ if(t.ajax_ok(res)){
+ _this.setData({
+ historyBuyInfo:res.data.data.pageData,
+ })
+ }
+ })
+ }
});
diff --git a/pages/goods/goodsInfo/goodsInfo.wxml b/pages/goods/goodsInfo/goodsInfo.wxml
index 6824c01..2af28f2 100644
--- a/pages/goods/goodsInfo/goodsInfo.wxml
+++ b/pages/goods/goodsInfo/goodsInfo.wxml
@@ -7,12 +7,30 @@
-
+
{{item.name}}
-
+
+
+
+
+
+
+
+
+
+
+
+ {{item.nickname}}下单成功
+
+
+
+
+
+
+
@@ -219,71 +237,7 @@
-
-
-
-
-
- 已参团4人,还差1人成团
-
- 查看奖励
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- *5人成团,5人得商品,5人全额退款并获得惊喜礼品!
-
-
-
-
+
@@ -328,12 +282,10 @@
-
-
-
+
@@ -571,7 +523,7 @@
领券
-
+
满{{item.condition}}减{{item.money}}
@@ -1197,7 +1149,7 @@
-
+
{{sele_g.goods_name}}
@@ -1403,7 +1355,7 @@
{{sec_sto.name}}
-
+
{{item.pickup_name}}
@@ -1428,7 +1380,7 @@
优惠信息
-
+
{{item.title}}
@@ -1495,7 +1447,7 @@
- 订单金额满{{item.condition}}元可用
+ {{item.name}}
{{filters.replace_time2(item.start)}} 至 {{filters.replace_time2(item.end)}}
diff --git a/pages/goods/goodsInfo/goodsInfo.wxss b/pages/goods/goodsInfo/goodsInfo.wxss
index 107174b..88fede6 100644
--- a/pages/goods/goodsInfo/goodsInfo.wxss
+++ b/pages/goods/goodsInfo/goodsInfo.wxss
@@ -3884,3 +3884,49 @@ button.custom-service::after {
.jie_show{ display: inline-block; width: 40rpx; height: 40rpx; background-color:#ff0505;border-radius:50%;color: #fff;text-align: center; margin: 0 20rpx }
+.jie_show{ display: inline-block; width: 40rpx; height: 40rpx; background-color:#ff0505;border-radius:50%;color: #fff;text-align: center; margin: 0 20rpx }
+/* 历史购买 */
+.swiper-container {
+ position: absolute;
+ top: 0;
+ left: 0;
+ padding: 20rpx 10rpx;
+ width: 100%;
+ box-sizing: border-box;
+ z-index: 98;
+}
+
+.swiper {
+ height: 60rpx;
+ color: white;
+ font-size: 26rpx;
+}
+
+.swiper-item {
+ /* width: auto !important;
+ background-color: rgba(0,0,0,.4);
+ border-radius: 60rpx; */
+ position: relative;
+}
+
+.swiper-item .item {
+ position: absolute;
+}
+
+.item {
+ /* position: absolute; */
+ display: flex;
+ align-items: center;
+ /* justify-content: center; */
+ border-radius: 60rpx;
+ background-color: rgba(0,0,0,.4);
+ /* position: absolute; */
+}
+
+.avatar-container {
+ width: 60rpx;
+ height: 60rpx;
+ border-radius: 50%;
+ overflow: hidden;
+ flex-shrink: 0;
+}
diff --git a/pages/goods/search/search.js b/pages/goods/search/search.js
index 51a6ddb..fa3aab4 100644
--- a/pages/goods/search/search.js
+++ b/pages/goods/search/search.js
@@ -186,6 +186,28 @@ Page({
break;
case 6:
url = "/api/weshop/teamlist/get/" + oo.stoid + "/" + prom_id;
+ await getApp().request.promiseGet("/api/weshop/teamlist/pageteam/1",{
+ data:{
+ store_id: oo.stoid,
+ is_end: 0,
+ is_show: 1,
+ user_id: getApp().globalData.user_id,
+ pageSize:1000,
+ }
+ }).then(pd=>{
+ let pd_list=pd.data.data.pageData;
+ if(res.data.code==0 && pd_list.length>0){
+ var flag = pd_list.some(pd=>{
+ return pd.goods_id==item.goods_id
+ })
+
+ if(!flag){
+ item.prom_type=0;
+ item.prom_id=0;
+ item.prom_price=null;
+ }
+ }
+ })
break;
case 8:
var presell_id = prom_id;
@@ -212,7 +234,6 @@ Page({
if(url!=null && url!=''){
await getApp().request.promiseGet(url, {}).then(async res => {
var prom =null;
- var flag=null;
if(res.data.code==0 && res.data.data){
prom=res.data.data;
diff --git a/pages/index/index/index.js b/pages/index/index/index.js
index a5bb279..66e466b 100644
--- a/pages/index/index/index.js
+++ b/pages/index/index/index.js
@@ -73,7 +73,7 @@ Page({
max_sw_height: 0, //banner的最大高度
is_disgraceful: 0, //是否显示新人广告
new_image: "", //新人有礼弹窗图片
- new_nav: "", //新人页面跳转地址
+ new_nav: "", //新人页面跳转地址
w_holiday_pop: 0,
showHongbao: false,
@@ -176,7 +176,7 @@ Page({
})
}
- // 判断是否有红包活动
+ // 判断是否有红包活动
getApp().request.promiseGet('/api/weshop/redmoney/redConfig/get/' + getApp().globalData.setting.stoid, {
data: {}
}).then(function (data) {
@@ -194,7 +194,7 @@ Page({
});
- // console.log(9090909);
+ // console.log(9090909);
//看一下商家是否开通了权益
//--初始化是否有打勾--
getApp().request.promiseGet("/api/weshop/users/grade/vip/init/get", {
@@ -458,7 +458,7 @@ Page({
getApp().globalData.isLoad_ad = 1;
}
}, 1500)
-
+
},
//当隐藏的时候就关闭计时器
@@ -536,6 +536,7 @@ Page({
wx.stopPullDownRefresh();
}
})
+ let user_id=getApp().globalData.user_id;
//----拼单-----
await getApp().request.promiseGet("/api/weshop/teamlist/pageteam/2", {
@@ -543,7 +544,8 @@ Page({
store_id: os.stoid,
is_end: 0,
is_show: 1,
- pageSize: 6
+ pageSize: 6,
+ user_id,
}
}).then(res => {
var e = res;
@@ -747,7 +749,7 @@ Page({
}
console.log("---首页---分享--");
var title = "商城首页"
- //分享
+ //分享
if (getApp().globalData.config && getApp().globalData.config.store_name) {
title = getApp().globalData.config.store_name;
} else if (getApp().globalData.setting.appName) {
@@ -1182,7 +1184,7 @@ Page({
var url=e.currentTarget.dataset.url;
getApp().goto(url);
},
-
-});
\ No newline at end of file
+
+});
diff --git a/pages/team/team_ping/team_ping.js b/pages/team/team_ping/team_ping.js
index 0ccecc4..590cf9c 100644
--- a/pages/team/team_ping/team_ping.js
+++ b/pages/team/team_ping/team_ping.js
@@ -114,7 +114,7 @@ Page({
}).then(res => {
order_goods = res.data.data.pageData;
order[i].order_goods = order_goods;
- order[i].gimage = ee.data.imageurl + order_goods[0].original_img;
+ order[i].gimage = ee.data.imageurl + order_goods[0]?.original_img;
})
diff --git a/pages/team/team_ping/team_ping.wxml b/pages/team/team_ping/team_ping.wxml
index dbb2400..cdcc57d 100644
--- a/pages/team/team_ping/team_ping.wxml
+++ b/pages/team/team_ping/team_ping.wxml
@@ -1,5 +1,5 @@
-
+
全部
@@ -10,113 +10,114 @@
-
-
-
-
-
- 订单编号:{{item.order_sn}}
-
-
-
-
-
-
-
-
-
- {{item.order_goods[0].goods_name}}
+
+
+
+
+
+ 订单编号:{{item.order_sn}}
+
-
-
-
-
- ¥
- {{item.order_goods[0].goods_price}}
- 零售价:¥{{item.order_goods[0].market_price}}
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+ {{item.order_goods[0].goods_name}}
+
-
-
- 还差{{item.ct_num-item.tx.length}}人成团
-
-
- 还差{{item.max_ct_num-item.tx.length}}人享受最价
- 您已经可以享受最低价
-
+
+
+ ¥
+ {{item.order_goods[0].goods_price}}
+ 零售价:¥{{item.order_goods[0].market_price}}
+
+
+
+
+
+
+
+
+
+
+
+ 还差{{item.ct_num-item.tx.length}}人成团
+
+
+ 还差{{item.max_ct_num-item.tx.length}}人享受最价
+ 您已经可以享受最低价
+
+
-
-
-
-
-
-
-
-
-
-
- 金额:¥
-
-
-
-
+
+
-
+
+ 金额:¥
+
+
+
+
+ 退款时间:{{filters.format_time(item.is_back_time,1)}}
-
- 邀请好友
- 查看详情
- 支付尾款失败
+
-
+
+
+
+
+ 剩余:
+ {{item.djs.day}}天
+ {{item.djs.hou}}时
+ {{item.djs.min}}分
+ {{item.djs.sec}}秒
-
-
-
-
- 剩余:
- {{item.djs.day}}天
- {{item.djs.hou}}时
- {{item.djs.min}}分
- {{item.djs.sec}}秒
-
-
-
diff --git a/pages/team/team_ping/team_ping.wxss b/pages/team/team_ping/team_ping.wxss
index be11cc6..34db240 100644
--- a/pages/team/team_ping/team_ping.wxss
+++ b/pages/team/team_ping/team_ping.wxss
@@ -191,11 +191,15 @@ height:222rpx;
}
.foot-left{
-
- margin-left:19rpx;
- min-width: 360rpx;
- line-height: 100rpx;
- font-size:26rpx;
+ margin-left:19rpx;
+ min-width: 360rpx;
+ height: 100rpx;
+ line-height: 100rpx;
+ font-size:26rpx;
+}
+.foot-left .jietitun {
+ height: 50rpx;
+ line-height: 50rpx;
}
.foot-right{
@@ -211,6 +215,7 @@ height:222rpx;
}
+
.foot-right-wz{
padding: 6rpx 20rpx;
diff --git a/pages/togoin/togoin.js b/pages/togoin/togoin.js
index 77c8f4c..ccc0545 100644
--- a/pages/togoin/togoin.js
+++ b/pages/togoin/togoin.js
@@ -1,4 +1,4 @@
-var t = require("../../utils/common.js");
+var t = require("../../utils/common.js");
const app=getApp();
var os = app.globalData.setting;
var regeneratorRuntime = require('../../utils/runtime.js');
@@ -18,53 +18,86 @@ Page({
canIUseGetUserProfile: true
})
}
-
- getApp().globalData.isLoad_ad=1;
+
+ getApp().globalData.isLoad_ad=1;
//--判断是否有接受到邀请人的ID--
if(options.first_leader){
this.setData({first_leader:options.first_leader});
}else if(getApp().globalData.first_leader){
- this.setData({first_leader:getApp().globalData.first_leader});
- }
+ this.setData({first_leader:getApp().globalData.first_leader});
+ }
var th=this;
app.getConfig(function (e) {
- var logo=th.data.imghots+e.store_logo;
+ var logo=th.data.imghots+e.store_logo;
th.setData({ store: e,store_logo:logo});
- })
-
- //判断注册的条件
+ })
+
+ //判断注册的条件
app.getConfig2(function (e) {
- if(e.reg_type==1){
- var arr=JSON.parse(e.reg_info);
+ if(e.reg_type==1){
+ var arr=JSON.parse(e.reg_info);
if(arr['name_state']==1) th.data.name_need_go=1;
if(arr['birthday_state']==1) th.data.birth_need_go=1;
if(arr['idcard_state']==1) th.data.idcard_need_go=1;
if(arr['address_state']==1) th.data.address_need_go=1;
if(arr['pick_state']==1) th.data.pick_need_go=1;
if(arr['sex_state']==1) th.data.sex_need_go=1;
- if(arr['introducer_state']==1) th.data.introducer_need_go=1;
- }
- },1)
+ if(arr['introducer_state']==1) th.data.introducer_need_go=1;
+ }
+ },1)
+
+ getApp().promiseGet("/api/wx/weappSendlist/page", {
+ data: {
+ store_id: os.stoid,
+ typeid: "1007"
+ }}).then(res=>{
+ if (res.data.code == 0 && res.data.data.pageData.length > 0) {
+ var template_id = res.data.data.pageData[0].template_id;
+ th.setData({template_id:template_id});
+ }
+ })
},
+
+
//绑定手机号
getphone:function (e) {
//接下来写业务代码登录
e=e.detail;
- if (e.encryptedData==undefined){
+ if (e.encryptedData==undefined){
this.setData({show_bind:0})
return app.my_warnning("登录需要授权手机号码!", 0, this);
return false;
- }
- var th=this;
+ }
+ var th=this;
var sessionKey = getApp().globalData.sessionKey;
var openid = getApp().globalData.openid;
- var r=getApp().globalData.getu;
- th.save_the_data(r,e,sessionKey,openid)
+ var r=getApp().globalData.getu;
+
+ if(e){
+ wx.showModal({
+ title: '授权通知',
+ content:'是否接受注册成功通知',
+ success(res){
+ if(res.confirm){
+ th.sendsm(function (){
+ th.save_the_data(r,e,sessionKey,openid)
+ })
+ }else if(res.cancel){
+ th.save_the_data(r,e,sessionKey,openid)
+ }
+ }
+
+ })
+ }
+
+
},
+ requestSubscribe(){
+
+ },
//-- 会员授权 --
bindGetUserInfo: function(ee) {
-
if(!this.data.isAgree) {
wx.showToast({
title: '请您先阅读和勾选指定的内容',
@@ -83,27 +116,27 @@ Page({
js_code:o.code,
store_id: os.stoid,
nickname: app.clear_word(app.globalData.getu.nickName),
- head_pic: app.clear_word(app.globalData.getu.avatarUrl)
- };
+ head_pic: app.clear_word(app.globalData.getu.avatarUrl)
+ };
//-- 导购会员ID --
if(getApp().globalData.guide_id){
dd.guide_id=getApp().globalData.guide_id;
}
-
+
getApp().request.get("/api/weshop/users/openidandkey", {
data: dd,
success: function (e) {
- if(e.data.code==0){
- that.setData({user:user})
+ if(e.data.code==0){
+ that.setData({user:user})
//如果有会员的话,没有sessionKey
if(!e.data.data.sessionKey){
getApp().showWarning("登录成功");
getApp().globalData.userInfo=e.data.data;
getApp().globalData.user_id=e.data.data.user_id;
getApp().globalData.openid = e.data.data.weapp_openid;
- //把会员的信息存在内存
+ //把会员的信息存在内存
wx.setStorageSync("userinfo",e.data.data);
-
+
setTimeout(function () {
getApp().globalData.login_back=1;
wx.navigateBack({ delta: 1}) //返回上一页
@@ -111,45 +144,48 @@ Page({
}else{
getApp().globalData.sessionKey=e.data.data.sessionKey;
getApp().globalData.openid=e.data.data.openid;
- that.setData({show_bind:1});
+ that.setData({show_bind:1});
}
}else{
- getApp().confirmBox(e.data.msg);
+ getApp().confirmBox(e.data.msg);
}
}
});
}
- })
-
- })
+ })
+
+ })
},
-
+
//-- 调整后的获取会员信息 --
getUserProfile:function(func){
- var that=this;
+ var that=this;
wx.getUserProfile({
desc:'获取用户相关信息',
success:res=>{
console.log("getUserProfile",res);
//此处授权得到userInfo
- getApp().globalData.getu = res.userInfo;
- func(res.userInfo);
+ getApp().globalData.getu = res.userInfo;
+ func(res.userInfo);
}
- });
+ });
},
-
+
//暂不登录,返回上一页
cancle_bind:function () {
wx.navigateBack({ delta: 1})
},
-
+
close_pop:function(){
this.setData({show_bind:0})
},
show_bind_mobile:function(){
- this.setData({show_bind:1})
+ let th=this;
+ th.sendsm(function (){
+ th.setData({show_bind:1})
+ })
},
-
+
save_the_data: async function (r,e,sessionKey,openid) {
var app=getApp(),a=app,th=this;
var dd = {
@@ -174,39 +210,39 @@ Page({
dd.first_leader=th.data.first_leader;
}
}
- })
- }
+ })
+ }
//-- 导购会员ID --
if(getApp().globalData.guide_id){
dd.guide_id=getApp().globalData.guide_id;
}
-
+
//门店的扫描识别码
if(getApp().globalData.store_number){
dd.SunCode=encodeURIComponent(getApp().globalData.store_number.trim());
}
-
- console.log("-----会员注册的信息-------");
+
+ console.log("-----会员注册的信息-------");
console.log(dd);
app.request.get("/api/weshop/users/thirdLogin", {
data: dd,
success: function (e) {
-
+
if (e.data.code == 0) {
app.globalData.user_id = e.data.data.user_id;
} else {
return app.showWarning("授权登入失败!"+e.data.msg);
}
-
-
- var need_go=0;
+
+
+ var need_go=0;
var t_user=e.data.data;
getApp().globalData.login_back=1;
wx.setStorageSync("userinfo",e.data.data);
wx.setStorageSync("isAuth", !0), app.globalData.userInfo = e.data.data, app.globalData.userInfo.head_pic = t.getFullUrl(a.globalData.userInfo.head_pic);
-
+
//如果有需要完善的信息没有完善,就需要跳转
if(!t_user['vipname'] && th.data.name_need_go){ need_go=1;}
if(!t_user['birthday'] && th.data.birth_need_go){ need_go=1;}
@@ -215,15 +251,15 @@ Page({
if(!t_user['pickup_id'] && th.data.pick_need_go){ need_go=1;}
if(!t_user['sex'] && th.data.sex_need_go){ need_go=1;}
if(!t_user['fromuser_id'] && th.data.introducer_need_go){ need_go=1;}
-
+
if(need_go){
getApp().goto("/packageA/pages/profile/profile");
}else{
wx.navigateBack({ delta: 1})
}
-
+
},
- failStatus: function (t) {
+ failStatus: function (t) {
return app.my_warnning("授权登入失败,请稍后再试!", 0, that);
},
fail: function (t) {
@@ -238,14 +274,14 @@ Page({
_errObj[_errImg] = this.data.imghots+"/miniapp/images/logo.png";
this.setData(_errObj) //注意这里的赋值方式,只是将数据列表中的此项图片路径值替换掉 ;
},
-
+
//-- 会员授权 --
bindUserInfo: function(ee) {
var that = this;
var user=ee.detail.userInfo;
//此处授权得到userInfo
getApp().globalData.getu = user;
-
+
//--拿下code--
wx.login({
success: function (o) {
@@ -253,27 +289,27 @@ Page({
js_code:o.code,
store_id: os.stoid,
nickname: app.clear_word(app.globalData.getu.nickName),
- head_pic: app.clear_word(app.globalData.getu.avatarUrl)
- };
+ head_pic: app.clear_word(app.globalData.getu.avatarUrl)
+ };
//-- 导购会员ID --
if(getApp().globalData.guide_id){
dd.guide_id=getApp().globalData.guide_id;
}
-
+
getApp().request.get("/api/weshop/users/openidandkey", {
data: dd,
success: function (e) {
- if(e.data.code==0){
- that.setData({user:user})
+ if(e.data.code==0){
+ that.setData({user:user})
//如果有会员的话,没有sessionKey
if(!e.data.data.sessionKey){
getApp().showWarning("登录成功");
getApp().globalData.userInfo=e.data.data;
getApp().globalData.user_id=e.data.data.user_id;
getApp().globalData.openid = e.data.data.weapp_openid;
- //把会员的信息存在内存
+ //把会员的信息存在内存
wx.setStorageSync("userinfo",e.data.data);
-
+
setTimeout(function () {
getApp().globalData.login_back=1;
wx.navigateBack({ delta: 1}) //返回上一页
@@ -281,26 +317,26 @@ Page({
}else{
getApp().globalData.sessionKey=e.data.data.sessionKey;
getApp().globalData.openid=e.data.data.openid;
- that.setData({show_bind:1});
+ that.setData({show_bind:1});
}
}else{
- getApp().confirmBox(e.data.msg);
+ getApp().confirmBox(e.data.msg);
}
}
});
}
- })
-
-
+ })
+
+
},
-
-
+
+
close_pop_back:function(){
this.close_pop();
wx.navigateBack({ delta: 1})
},
-
-
+
+
// 是否同意协议
isAgree(e) {
let isAgree = null;
@@ -308,22 +344,37 @@ Page({
isAgree = true;
} else {
isAgree = false;
- };
+ };
// this.data.isAgree = isAgree;
this.setData({
isAgree,
});
},
-
-
+
+
//通过路径跳转到其他页面
goto: function(e) {
console.log('xxxx', e);
var url = e.currentTarget.dataset.url;
getApp().goto(url);
},
-
-
-
-
+
+ //订阅消息提醒
+ sendsm:function(func)
+ {
+ var template_id = this.data.template_id;
+ // //授权订阅
+ wx.requestSubscribeMessage({
+ tmplIds: [template_id],
+ success(res) {
+ func();
+ },
+ fail(res) {
+ func();
+ }
+ })
+
+ },
+
+
})
diff --git a/pages/togoin/togoin.wxml b/pages/togoin/togoin.wxml
index 8b6ebf5..7ec704c 100644
--- a/pages/togoin/togoin.wxml
+++ b/pages/togoin/togoin.wxml
@@ -14,45 +14,45 @@
-
+
我已阅读同意 《用户使用协议》与《隐私政策》
-
-
+
+
-
+
-
+
+
-
-
+
+
-
-
-
+
+
+
+
+
- 暂不登录
+ 暂不登录
@@ -60,14 +60,14 @@
-
-
+
+
登录手机号,同步会员信息以及订单记录
- 暂不授权
+ 暂不授权
diff --git a/pages/user/index/index.js b/pages/user/index/index.js
index 0f68d0e..0ce9fbe 100644
--- a/pages/user/index/index.js
+++ b/pages/user/index/index.js
@@ -58,7 +58,6 @@ Page({
* 生命周期函数--监听页面加载
*/
onLoad: function(options) {
-
var th=this;
//-- 读取会员中心按钮列表 --
getApp().request.get("/api/weshop/userTool/page?pageSize=100", {
@@ -99,9 +98,6 @@ Page({
* 生命周期函数--监听页面显示
*/
onShow: function() {
- this.getTabBar().setData({
- cartGoodsNum: getApp().globalData.cartGoodsNum,
- })
//看一下小程序是不是过期了
getApp().getConfig2(function(config2){
if(config2 && config2.is_overdue==1){
@@ -739,8 +735,6 @@ Page({
}
})
-
-
},
clike_banne: function() {
var th = this;
@@ -755,6 +749,7 @@ Page({
getApp().showWarning("请稍后重试");
}
},
+
// 判断助力活动是不是存在
is_assistance: function() {
var th = this,r=Math.random()*100;
diff --git a/utils/util.js b/utils/util.js
index 54e556a..a4560f7 100644
--- a/utils/util.js
+++ b/utils/util.js
@@ -13,7 +13,22 @@ function trim(str) { return str.replace(/(^s*)|(s*$)/g, "");}
function e(e) {
var r = ""; for (var t in e) r += (r ? "&" : "") + t + "=" + e[t]; return r;
}
-
+//节流
+let _throttle =function (fn, interval) {
+ var enterTime = 0;//触发的时间
+ console.log(1);
+
+ var gapTime = interval || 300 ;//间隔时间,如果interval不传,则默认300ms
+ return function() {
+ console.log(2);
+ var context = this;
+ var backTime = new Date();//第一次函数return即触发的时间
+ if (backTime - enterTime > gapTime) {
+ fn.call(context,arguments);
+ enterTime = backTime;//赋值给第一次触发的时间,这样就保存了第二次触发的时间
+ }
+ };
+}.bind(this);
function utf16to8(str) {
var out, i, len, c; out = ""; len = str.length;
for (i = 0; i < len; i++) {
@@ -577,6 +592,7 @@ module.exports = {
});
},
unserialize: unserialize,
+ _throttle:_throttle,
unserialize_o: unserialize_o,
trim: trim, //去空格
isEmptyObject: isEmptyObject, //判断空对象
diff --git a/utils/wxParse/wxParse.wxml b/utils/wxParse/wxParse.wxml
index 90aa270..b08065e 100644
--- a/utils/wxParse/wxParse.wxml
+++ b/utils/wxParse/wxParse.wxml
@@ -1,7 +1,7 @@
@@ -16,7 +16,7 @@
-
+