diff --git a/packageA/pages/profile/profile.js b/packageA/pages/profile/profile.js
index 6cee44d..1b90f26 100644
--- a/packageA/pages/profile/profile.js
+++ b/packageA/pages/profile/profile.js
@@ -23,6 +23,7 @@ var date = new Date(timestamp);
// barcode,
// qrcode
// } = require('../../../utils/index.js');
+var regeneratorRuntime = require('../../../utils/runtime.js');
Page({
data: {
@@ -576,114 +577,104 @@ Page({
self = this;
let url1 = '/api/weshop/storeconfig/get/';
- let url3 = '/api/weshop/users/getERPUser/';
+ let url3 = '/api/weshop/users/getErpvipidPickup';
url1 += r.stoid;
- var user=app.globalData.userInfo;
- if(!user) return false;
-
- //-- 赋予默认值 --
- if(user['idcard']) this.data.id=user['idcard'];
- if(user['vipname']) this.data.name=user['vipname'];
- if(user['address']) this.data.address=user['address'];
-
+
+ var uu=getApp().globalData.zc_dd;
+ if(uu){
+ this.setData({head_pic:uu.head_pic,nickname:uu.nickname})
+ }
+
app.request.get(url1, {
- success: function(res) {
- console.log('x-->', res.data.code, res.data.data.reg_type, res.data.data.reg_info);
+ success:async function(res) {
if(res.data.code == 0) {
let reg_type = res.data.data.reg_type;
let reg_info = res.data.data.reg_info;
if(reg_type) { //reg_type为1才显示积分信息
if(reg_info) {
- reg_info = JSON.parse(reg_info);
+ reg_info = JSON.parse(reg_info);
+ var user_id=0;
+
+ //-- 获取会员信息 -
+ await getApp().request.promiseGet("/api/weshop/users/page", {data:{
+ store_id:r.stoid,mobile:uu.mobile
+ }}).then(res=>{
+ if(ut.ajax_ok(res)){
+ user_id=res.data.data.pageData[0].user_id;
+ }
+ })
+
if(reg_info.reginfo_coupon){
//判断有没有领过券
- self.check_is_send_quan(reg_info.reginfo_coupon,user.user_id);
- }
+ self.check_is_send_quan(reg_info.reginfo_coupon,user_id);
+ }
+
+ if(reg_info.reginfo_lb_id){
+ //判断有没有领过礼包
+ self.check_is_send_libao(reg_info.reginfo_lb_id,user_id);
+ }
+
};
};
self.setData({
reg_type,
reg_info,
- user: app.globalData.userInfo,
});
- };
-
+ }
},
});
-
- //获取默认信息
- url3 += r.stoid + "/" +user.user_id;
- app.request.get(url3, {
- success: function(res) {
- if(res.data.code == 0) {
- console.log('url3', res.data.data.birthday);
- let data = res.data.data;
-
- if(data.birthday){
- data.birthday= ut.formar_no_full(data.birthday);
- }
-
- if(user['sex'] && !data.sex){
- data.sex=user['sex'];
- }
- if(user['birthday'] && !data.birthday){
- data.birthday= ut.formar_no_full(user['birthday']);
- }
-
- if(!data.pickup_name){
- data.pickup_name="";
- }
- if(!data.pickup_id){
- data.pickup_id=0;
- }
- //-- 获取门店 --
- if(user['pickup_id'] && !data.pickup_id){
- getApp().promiseGet("/api/weshop/pickup/get/"+r.stoid+"/"+user['pickup_id']).then(res=>{
- if(res.data.code==0 && res.data.data){
- data.pickup_name=res.data.data.pickup_name;
- data.pickup_id=res.data.data.pickup_id;
-
- self.setData({
- isGender: data.sex,
- isLunar: data.islunar,
- datet: data.birthday,
- stoname: data.pickup_name,
- sto_sele_id: data.pickup_id,
- });
- }
- else{
- self.setData({
- isGender: data.sex,
- isLunar: data.islunar,
- datet: data.birthday,
- stoname: data.pickup_name,
- sto_sele_id: data.pickup_id,
- });
- }
- if(!self.data.sto_sele_id){
- self.get_store_set();
- }
- })
- }else{
- self.setData({
- isGender: data.sex,
- isLunar: data.islunar,
- datet: data.birthday,
- stoname: data.pickup_name,
- sto_sele_id: data.pickup_id,
- });
- }
-
- if(!self.data.sto_sele_id){
- self.get_store_set();
- }
- };
- }
- });
-
- if(user){
- self.setData({user:user})
- }
+
+
+ //-- 获取线下会员的情况 --
+ var req_data={
+ stoid:r.stoid,
+ mobile:getApp().globalData.zc_dd.mobile
+ };
+ if(getApp().globalData.zc_dd.first_leade)
+ req_data.first_leader=getApp().globalData.zc_dd.first_leader
+
+ wx.showLoading();
+ getApp().request.promiseGet(url3, {data:req_data}).then(res=>{
+ if(res.data.code==0){
+ var back_data=res.data.data; back_data=JSON.parse(back_data);
+ var set_data={is_fx:0};
+ //-- 如果有包含会员的线下的信息 --
+ if(back_data && back_data.erpviplist){
+ //-- data.data就是门店的数据 --
+ if(back_data.data){
+ back_data.erpviplist.pickup_id=back_data.data.pickup_id;
+ if(!back_data.erpviplist.pick) set_data.is_fx=1;
+ set_data.stoname=back_data.data.pickup_name;
+ set_data.sto_sele_id=back_data.data.pickup_id;
+ }
+
+ //-- 推荐人姓名 --
+ if(back_data.erpviplist.fromuser) {
+ set_data.tjrname=back_data.erpviplist.fromuser;
+ back_data.erpviplist.fromuser_id=back_data.erpviplist.fromuser;
+ }
+ //性别
+ if(back_data.erpviplist.sex) set_data.isGender=back_data.erpviplist.sex;
+ //名称
+ if(back_data.erpviplist.vipname) set_data.name=back_data.erpviplist.vipname;
+ //身份证
+ if(back_data.erpviplist.idcard) set_data.id=back_data.erpviplist.idcard;
+ //地址
+ if(back_data.erpviplist.address) set_data.address=back_data.erpviplist.address;
+ //生日
+ if(back_data.erpviplist.birthday) {
+ set_data.datet=back_data.erpviplist.birthday;
+ set_data.isLunar=back_data.erpviplist.islunar;
+ }
+ set_data.user=back_data.erpviplist;
+ }
+ self.setData(set_data);
+ if(!self.data.sto_sele_id){
+ self.get_store_set();
+ }
+ }
+ wx.hideLoading();
+ })
var is_back=t.is_back;
if(is_back) this.data.is_back=1;
@@ -694,9 +685,7 @@ Page({
getApp().check_can_share();
- var e = this;
if (this.data.is_zy) return false;
- this.wait_for_store_config();
//如果有传值进行跳转的话
var choice_guide=null;
@@ -705,64 +694,108 @@ Page({
getApp().globalData.choice_guide=null;
}
- var req = t;
-
- a.getUserInfo(function(a) {
- var txt = util.formatTime(a.birthday, 'yyyy-M-d'),
- arr = txt.split(' ');
- a.birthday = arr[0];
- var txt2 = util.formatTime(a.reg_time, 'yyyy-M-d'),
- arr2 = txt.split(' ');
- a.reg_time = arr2[0];
- if (a.pickup_id != null) {
- req.get("/api/weshop/pickup/get/" + r.stoid + "/" + a.pickup_id, {
- success: function(da) {
- if(da.data.data){
- //设置门店
- e.setData({
- // stoname: da.data.data.pickup_name
- });
- }
-
- }
- })
- }
-
- }, !0);
},
check_is_send_quan:function(cid,uid){
var self=this;
let url2 = '/api/weshop/prom/coupon/get/';
- //看一下会员有没有领过注册的券
- getApp().promiseGet("/api/weshop/couponList/page",{
- data:{store_id:r.stoid,uid:uid,cid:cid}
- }).then(res=>{
- var is_ling=0;
- if(res.data.code==0 && res.data.data && res.data.data.total>0){
- is_ling=1;
- }
-
- //没有领过券,就显示
- if(!is_ling){
- //获取优惠券
- url2 += cid;
- app.request.get(url2, {
- success: function(r) {
- if(r.data.code == 0) {
- console.log('000res==>', r.data.data.name);
- self.setData({
- couponInfo: r.data.data.name,
- });
- };
- },
- });
- }
-
- })
+ //-- 如果没有会员信息的时候 --
+ if(!uid){
+ //获取优惠券
+ url2 += cid;
+ app.request.get(url2, {
+ success: function(r) {
+ if(r.data.code == 0) {
+ self.setData({
+ couponInfo: r.data.data.name,
+ });
+ };
+ },
+ });
+
+ }else{
+ //看一下会员有没有领过注册的券
+ getApp().promiseGet("/api/weshop/couponList/page",{
+ data:{store_id:r.stoid,uid:uid,cid:cid}
+ }).then(res=>{
+ var is_ling=0;
+ if(res.data.code==0 && res.data.data && res.data.data.total>0){
+ is_ling=1;
+ }
+
+ //没有领过券,就显示
+ if(!is_ling){
+ //获取优惠券
+ url2 += cid;
+ app.request.get(url2, {
+ success: function(r) {
+ if(r.data.code == 0) {
+ console.log('000res==>', r.data.data.name);
+ self.setData({
+ couponInfo: r.data.data.name,
+ });
+ };
+ },
+ });
+ }
+
+ })
+ }
+
+
+
},
+ //-- 有没有送过礼包 --
+ check_is_send_libao:function(lbid,uid){
+ var self=this;
+ let url2 = '/api/weshop/marketing/giftbag/get';
+ if(!uid){
+ //获取礼包
+ app.request.get(url2, {
+ data:{storeId:r.stoid,giftBagId:lbid},
+ success: function(r) {
+ if(r.data.code == 0) {
+ console.log('000res==>', r.data.data.name);
+ self.setData({
+ libao: r.data.data.lbTitle,
+ });
+ }
+ }
+ });
+
+ }else{
+ //看一下会员有没有领过注册的券
+ getApp().promiseGet("/api/weshop/marketing/gift/getgiveone",{
+ data:{store_id:r.stoid,user_id:uid,lbid:lbid,act_type:7}
+ }).then(res=>{
+ var is_ling=0;
+ if(res.data.code==0 && res.data.data && res.data.data.total>0){
+ is_ling=1;
+ }
+ //没有领过礼包,就显示
+ if(!is_ling){
+ //获取礼包
+ app.request.get(url2, {
+ data:{storeId:r.stoid,giftBagId:lbid},
+ success: function(r) {
+ if(r.data.code == 0) {
+ self.setData({
+ libao: r.data.data.lbTitle,
+ });
+ }
+ }
+ });
+ }
+
+ })
+ }
+
+ },
+
+
+
//------卡片的显示和关闭--------
show_tc: function() {
@@ -782,8 +815,6 @@ Page({
tc_hide: true,
});
},
-
-
//地址
address: function(e) {
@@ -854,39 +885,41 @@ Page({
datas.staffId=th.data.user.staffId;
}
- getApp().request.put("/api/weshop/users/updateUserInfo", {
- data: datas,
- success: function(res) {
- if (res.data.code == 0) {
- getApp().my_warnning("修改成功", 1, th);
-
- setTimeout(function () {
- if(th.data.is_back){
- wx.navigateBack({ delta: 1}) //返回上一页
- }else{
- getApp().goto("/pages/user/index/index");
- }
- },1000)
-
- } else {
- getApp().my_warnning("系统繁忙,请稍后再试", 0, th);
- }
- }
- })
+ var post_data={ ...getApp().globalData.zc_dd, ...datas }
+ this.zu_ce(post_data);
},
+
+
+ zu_ce:function (dd) {
+ var th=this;
+ 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);
+ }
+ 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 = s.getFullUrl(a.globalData.userInfo.head_pic);
+ wx.navigateBack({ delta: 1})
+
+ },
+ failStatus: function (t) {
+ return app.my_warnning("授权登入失败,请稍后再试!", 0, that);
+ },
+ fail: function (t) {
+ return i.clearAuth(), i.alertLoginErrorAndGoHome(), !1;
+ }
+ });
+ },
+
//选择地址
goto_address: function() {
// this.setData({ is_zy: 1 });
},
- //更换手机
- // go_phone: function(e) {
- // var url = e.currentTarget.dataset.url;
- // this.setData({
- // is_zy: 1
- // });
- // getApp().goto(url);
- // },
-
+
//--点击分享事件---
onShareAppMessage: function(t) {
getApp().globalData.no_clear=1
@@ -983,9 +1016,8 @@ Page({
this.setData({
datet: e.detail.value,
});
- };
-
- // console.log(this.data.datet, this.data.isCalendar);
+ }
+
},
// 生日判断
@@ -1074,7 +1106,6 @@ Page({
var data = {
store_id: r.stoid,
- user_id: app.globalData.user_id,
};
//-- 需要推荐人 --
@@ -1083,11 +1114,7 @@ Page({
if (tjrname == "" || tjrname == null) {
app.my_warnning("请输入推荐人", 0, this);
return false;
- };
- if(tjrname==user.mobile || tjrname==user.erpvipno ){
- app.my_warnning("推荐人不能是自己", 0, this);
- return false;
- }
+ };
data.tjrname=tjrname;
}
@@ -1119,7 +1146,7 @@ Page({
};
data.birthday=birthday;
- data.islunar=self.data.isLunar;
+ data.islunar=self.data.isLunar?1:0;
}
//-- 需要身份证 --
@@ -1155,97 +1182,19 @@ Page({
app.my_warnning("请您先阅读和勾选指定的内容", 0, this);
return false;
};
-
-
- console.log('data==>', data);
-
- app.request.put("/api/weshop/users/updateInfo", {
- data: data,
- success: function(res) {
- if (res.data.code == 0) {
- getApp().my_warnning("保存成功", 1, self);
- if(th.data.is_back){
- wx.navigateBack({ delta: 1}) //返回上一页
- }else{
- getApp().goto("/pages/user/index/index");
- }
- } else {
- getApp().my_warnning(res.data.msg, 0, self);
- };
- }
- })
+
+
+
+
+ var post_data={ ...getApp().globalData.zc_dd, ...data };
+
+ delete post_data.sessionKey;
+ delete post_data.encryptedData;
+ delete post_data.iv;
+
+ this.zu_ce(post_data);
- // } else {
- // app.my_warnning("请您先阅读和勾选指定的内容", 0, self);
- // };
- // var isstcsp = th.data.isstcsp; //是否启用消费密码
- // var phone = th.data.phone; //手机号码
- // if (phone == "" || phone == null) {
- // getApp().my_warnning("手机不能为空", 0, th);
- // return false;
- // }
- // var consumption = th.data.consumption; //消费密码
- // var isstcsp = th.data.isstcsp;
- // if (isstcsp == 1) {
-
- // if (consumption == null || consumption == "" || consumption == undefined) {
- // getApp().my_warnning("消费密码不能为空", 0, th);
- // return false;
- // }
- // if (consumption.length < 6) {
- // getApp().my_warnning("消费密码不能小于6位", 0, th);
- // return false;
- // }
- // }
- // var sex = th.data.isGender; //性别
-
- // if (sex != "1" && sex != "2") {
- // getApp().my_warnning("请选择性别", 0, th);
- // return false;
- // }
- // var vipname = th.data.user.vipname; //用户姓名
- // if (user_name == "" || user_name == null) {
- // getApp().my_warnning("请输入名字", 0, th);
- // return false;
- // }
- // var identity_card = th.data.identity_card; //身份证
-
- // if (identity_card!=null && identity_card!=undefined && identity_card != "" && !(/(^\d{15}$)|(^\d{18}$)|(^\d{17}(\d|X|x)$)/.test(identity_card))) {
- // getApp().my_warnning("身份证号码错误", 0, th);
- // return false;
- // }
- // var address = th.data.address; //地址
- // var sto_sele_id = self.data.sto_sele_id;
- // var data = {
- // store_id: r.stoid,
- // user_id: app.globalData.user_id,
- // tjrname: self.data.referee, //推荐人
- // vipname: self.data.name, //名称
- // sex: self.data.isGender, //性别
- // birthday: self.data.datet,
- // islunar: self.data.isLunar,
- // idcard: self.data.id,
- // address: self.data.address,
- // pickup_id: sto_sele_id ,//自提门店 所属门店
- // };
-
- // console.log('data==>', data);
- //往上提交美导的ID
- // if(th.data.fir_guide_id!=th.data.user.staffId){
- // datas.staffId=th.data.user.staffId;
- // }
-
- // app.request.put("/api/weshop/users/updateInfo", {
- // data: data,
- // success: function(res) {
- // if (res.data.code == 0) {
- // getApp().my_warnning("保存成功", 1, self);
- // getApp().goto("/pages/user/index/index");
- // } else {
- // getApp().my_warnning("系统繁忙,请稍后再试", 0, self);
- // };
- // }
- // })
+
},
diff --git a/packageA/pages/profile/profile.wxml b/packageA/pages/profile/profile.wxml
index 45b7d0a..e60c1cd 100644
--- a/packageA/pages/profile/profile.wxml
+++ b/packageA/pages/profile/profile.wxml
@@ -7,13 +7,13 @@
-
+
- {{user.nickname}}
+ {{nickname}}
@@ -28,7 +28,9 @@
推荐人:
-
+
+
+
+{{reg_info.introducer}}积分
@@ -41,7 +43,7 @@
姓名:
- +{{reg_info.name}}积分
+ +{{reg_info.name}}积分
+{{reg_info.name}}成长值
@@ -68,8 +70,8 @@
女
-
-
+
+
+{{reg_info.sex}}积分
+{{reg_info.sex}}成长值
@@ -127,7 +129,7 @@
∟
-
+
+{{reg_info.pick}}积分
+{{reg_info.pick}}成长值
@@ -174,6 +176,7 @@
保存
保存成功即可获得一张{{couponInfo}}
+ 保存成功即可获得一个{{libao}}
diff --git a/packageC/pages/luckyGo/luckyGo_cart/luckyGo_cart.js b/packageC/pages/luckyGo/luckyGo_cart/luckyGo_cart.js
index 82fb3dc..dcd404f 100644
--- a/packageC/pages/luckyGo/luckyGo_cart/luckyGo_cart.js
+++ b/packageC/pages/luckyGo/luckyGo_cart/luckyGo_cart.js
@@ -2238,6 +2238,11 @@ Page({
goods.skinface_id=getApp().globalData.skinface_id;
}
+ if(th.data.bn_goods.whsle_id){
+ item.is_whsle=1;
+ goods.is_whsle_goods=1;
+ }
+
//-- 把导购的信息填入--
if (gg.guide_id) {
goods.guide_id = gg.guide_id;
diff --git a/packageC/pages/luckyGo/luckyGo_cart_ct/luckyGo_cart_ct.js b/packageC/pages/luckyGo/luckyGo_cart_ct/luckyGo_cart_ct.js
index 8febce7..61a160b 100644
--- a/packageC/pages/luckyGo/luckyGo_cart_ct/luckyGo_cart_ct.js
+++ b/packageC/pages/luckyGo/luckyGo_cart_ct/luckyGo_cart_ct.js
@@ -495,7 +495,7 @@ Page({
});
},
//---------计算立即购买----------
- calculatePrice2: function () {
+ calculatePrice2: async function () {
console.log('calculatePrice2');
var th = this,
good = this.data.bn_goods;
@@ -506,12 +506,14 @@ Page({
th.setData({
[txt]: allpice,
});
- console.log(th.data.formData);
-
- to.getwuliuprice(async function (rs) {
+ wx.showLoading({
+ title: "处理中.",
+ mask:true
+ })
+ //to.getwuliuprice(async function (rs) {
- var o_shipping_price = 0,
+ var o_shipping_price = 0,
goods_weight = -1,
goods_piece = -1;
var out_of_weight = null; //超出多少重量
@@ -539,8 +541,7 @@ Page({
let item = gd_arr_list[i];
if (back_data && back_data['is_by_all'] && (!back_data.no_free_goods || back_data.no_free_goods.indexOf(item.goods_id) == -1)) {
-
-
+ if (goods_weight < 0) goods_weight = 0;
if (item['exp_sum_type'] == 2) {
goods_weight += item['weight'] * item['buynum'];
cut_good_weight += item['weight'] * item['buynum'];
@@ -581,9 +582,36 @@ Page({
else out_of_weight = -back_data.weight_free * 1000;
var code = th.data.wu_arr[th.data.index].code;
- var shipping_price =
- ut.calculatewuliu(code, o_shipping_price, goods_weight, out_of_weight,
- goods_piece, th.data.user_addr, back_data,rs);
+ var shipping_price =0;
+ // ut.calculatewuliu(code, o_shipping_price, goods_weight, out_of_weight,
+ // goods_piece, th.data.user_addr, back_data,rs);
+
+ var w_data={
+ store_id:os.stoid, code:code,
+ o_shipping_price:o_shipping_price,
+ goods_weight:goods_weight,
+ out_of_weight:out_of_weight,goods_piece:goods_piece,
+ user_addr_province:th.data.user_addr.province,
+ user_addr_city:th.data.user_addr.city,
+ user_addr_district:th.data.user_addr.district,
+ is_by_all:back_data && back_data.is_by_all?1:0,
+ no_free_goods:back_data && back_data.no_free_goods && back_data.no_free_goods.length>0?1:0,
+ }
+
+ var is_ok=0;
+ await getApp().request.promisePost('/api/weshop/order/getOrderWuLiPrice', {data:w_data,is_json:1}).then(res=>{
+ if(res.data.code==0){
+ shipping_price=res.data.data; is_ok=1;
+ }
+ })
+ if(!is_ok){
+ wx.showToast({
+ title: "计算物流错误", icon: 'none',duration: 2000
+ })
+ th.setData({ show_submit:0 });
+ wx.hideLoading();
+ }
+
shipping_price = parseFloat(shipping_price).toFixed(2);
var wl_txt = "formData.shipping_price";
@@ -616,24 +644,27 @@ Page({
if (parseFloat(th.data.yuer) > total_m) {
th.setData({
[txt]: total_m,
- [txt2]: 0
+ [txt2]: 0,
+ is_show_sub:1
})
} else {
order_m = parseFloat(order_m) - parseFloat(th.data.yuer);
order_m = order_m.toFixed(2);
th.setData({
[txt]: th.data.yuer,
- [txt2]: order_m
+ [txt2]: order_m,
+ is_show_sub:1
})
}
} else {
th.setData({
[txt]: 0,
- [txt2]: order_m
+ [txt2]: order_m,
+ is_show_sub:1
})
}
-
- });
+ wx.hideLoading();
+ //});
},
@@ -783,6 +814,12 @@ Page({
if(getApp().globalData.skinface_id){
goods.skinface_id=getApp().globalData.skinface_id;
}
+
+ if(th.data.bn_goods.whsle_id){
+ item.is_whsle=1;
+ goods.is_whsle_goods=1;
+ }
+
//--导购分享过来的id--
if (gg.guide_id) {
goods.guide_id = gg.guide_id;
diff --git a/packageC/pages/luckyGo/luckyGo_cart_ct/luckyGo_cart_ct.wxml b/packageC/pages/luckyGo/luckyGo_cart_ct/luckyGo_cart_ct.wxml
index d8ac4ac..de02a90 100644
--- a/packageC/pages/luckyGo/luckyGo_cart_ct/luckyGo_cart_ct.wxml
+++ b/packageC/pages/luckyGo/luckyGo_cart_ct/luckyGo_cart_ct.wxml
@@ -154,7 +154,7 @@
-
+
应付金额:¥{{formData.order_amount}}
diff --git a/packageC/pages/payForAnother/payForAnother.js b/packageC/pages/payForAnother/payForAnother.js
index 8f220da..f7deb93 100644
--- a/packageC/pages/payForAnother/payForAnother.js
+++ b/packageC/pages/payForAnother/payForAnother.js
@@ -2119,6 +2119,11 @@ Page({
'prom_id': th.data.bn_goods.prom_id, //促销活动id
};
+ if(th.data.bn_goods.whsle_id){
+ item.is_whsle=1;
+ goods.is_whsle_goods=1;
+ }
+
//-- 把导购的信息填入--
if (gg.guide_id) {
goods.guide_id = gg.guide_id;
diff --git a/packageC/pages/presell/cart/cart.js b/packageC/pages/presell/cart/cart.js
index 7fc3c63..addd47c 100644
--- a/packageC/pages/presell/cart/cart.js
+++ b/packageC/pages/presell/cart/cart.js
@@ -1716,9 +1716,9 @@ Page({
//----计算物流的钱----
- calculate_wuliu() {
+ async calculate_wuliu() {
var to = getApp(), th = this;
- to.getwuliuprice(async function (rs) {
+ //to.getwuliuprice(async function (rs) {
var o_shipping_price = 0,
goods_weight = -1,
goods_piece = -1,
@@ -1823,6 +1823,7 @@ Page({
let item = gd_arr_list[i];
if (back_data && back_data['is_by_all'] && (!back_data.no_free_goods || back_data.no_free_goods.indexOf(item.goods_id) == -1)) {
+ if (goods_weight < 0) goods_weight = 0;
if (item['exp_sum_type'] == 2) {
goods_weight += item['weight'] * item['buynum'];
cut_good_weight += item['weight'] * item['buynum'];
@@ -1867,8 +1868,36 @@ Page({
th.data.is_no_by[th.data.bn_pick] = 0;
//--------------开始计算物流------------------
- var shipping_price = ut.calculatewuliu(code, o_shipping_price, goods_weight, out_of_weight,
- goods_piece, th.data.user_addr, back_data, rs);
+ var shipping_price =0;
+
+ //ut.calculatewuliu(code, o_shipping_price, goods_weight, out_of_weight,
+ //goods_piece, th.data.user_addr, back_data, rs);
+ var w_data={
+ store_id:os.stoid, code:code,
+ o_shipping_price:o_shipping_price,
+ goods_weight:goods_weight,
+ out_of_weight:out_of_weight,goods_piece:goods_piece,
+ user_addr_province:th.data.user_addr.province,
+ user_addr_city:th.data.user_addr.city,
+ user_addr_district:th.data.user_addr.district,
+ is_by_all:back_data && back_data.is_by_all?1:0,
+ no_free_goods:back_data && back_data.no_free_goods && back_data.no_free_goods.length>0?1:0,
+ }
+
+ var is_ok=0;
+ await getApp().request.promisePost('/api/weshop/order/getOrderWuLiPrice', {data:w_data,is_json:1}).then(res=>{
+ if(res.data.code==0){
+ shipping_price=res.data.data; is_ok=1;
+ }
+ })
+ if(!is_ok){
+ wx.showToast({
+ title: "计算物流错误", icon: 'none',duration: 2000
+ })
+ th.setData({ show_submit:0 });
+ wx.hideLoading();
+ return false;
+ }
exp_price = parseFloat(shipping_price).toFixed(2);
}
@@ -1876,7 +1905,7 @@ Page({
} else {
th.wuliu_next(allpice, quan_price, exp_price);
}
- });
+ //});
},
//相同的东西统一在一起
wuliu_next(allpice, quan_price, exp_price) {
diff --git a/packageC/pages/presell/cart/cart.wxml b/packageC/pages/presell/cart/cart.wxml
index fcea355..5789681 100644
--- a/packageC/pages/presell/cart/cart.wxml
+++ b/packageC/pages/presell/cart/cart.wxml
@@ -346,6 +346,9 @@
+
+
+
尾款时间{{filters.format_time(act.pay_begindate,1)}} -
@@ -363,7 +366,7 @@
-
+
@@ -371,14 +374,13 @@
取消订单
- 立即付款
+
+ 立即付款
收货确认
删除订单
-
-
查看物流
@@ -401,6 +403,8 @@
+
+
diff --git a/packageC/pages/presell/cart/cart2.js b/packageC/pages/presell/cart/cart2.js
index 82f4374..bdf859f 100644
--- a/packageC/pages/presell/cart/cart2.js
+++ b/packageC/pages/presell/cart/cart2.js
@@ -571,7 +571,7 @@ Page({
//---------计算立即购买----------
- calculatePrice2: function () {
+ calculatePrice2: async function () {
var th = this, good = this.data.bn_goods;
if (!good) return false;
@@ -582,7 +582,7 @@ Page({
}
wx.showLoading({
- title: "处理中."
+ title: "处理中.",mask:true
})
//-----------计算商品总价--------------
var allpice = good.shop_price * good.buynum;
@@ -609,8 +609,8 @@ Page({
}
- to.getConfig2(function (ee) {
- to.getwuliuprice(async function (rs) {
+ // to.getConfig2(function (ee) {
+ // to.getwuliuprice(async function (rs) {
var o_shipping_price = 0, goods_weight = -1, goods_piece = -1;
var out_of_weight = null; //超出多少重量
@@ -699,9 +699,11 @@ Page({
let item = gd_arr_list[i];
if (back_data && back_data['is_by_all'] && (!back_data.no_free_goods || back_data.no_free_goods.indexOf(item.goods_id) == -1)) {
+ if (goods_weight < 0) goods_weight = 0;
if (item['exp_sum_type'] == 2) {
cut_good_weight += item['weight'] * item['buynum'];
goods_weight += item['weight'] * item['buynum'];
+
}
if (back_data.weight_free > 0) {
out_of_weight = (back_data.weight_free * 1000) - cut_good_weight;
@@ -743,9 +745,35 @@ Page({
if (th.data.wu_arr && th.data.wu_arr[th.data.index]) code = th.data.wu_arr[th.data.index].code;
//--------------开始计算物流------------------
- var shipping_price =
- ut.calculatewuliu(code, o_shipping_price, goods_weight, out_of_weight,
- goods_piece, th.data.user_addr, back_data, rs);
+ var shipping_price =0;
+ // ut.calculatewuliu(code, o_shipping_price, goods_weight, out_of_weight,
+ // goods_piece, th.data.user_addr, back_data, rs);
+ var w_data={
+ store_id:os.stoid, code:code,
+ o_shipping_price:o_shipping_price,
+ goods_weight:goods_weight,
+ out_of_weight:out_of_weight,goods_piece:goods_piece,
+ user_addr_province:th.data.user_addr.province,
+ user_addr_city:th.data.user_addr.city,
+ user_addr_district:th.data.user_addr.district,
+ is_by_all:back_data && back_data.is_by_all?1:0,
+ no_free_goods:back_data && back_data.no_free_goods && back_data.no_free_goods.length>0?1:0,
+ }
+
+ var is_ok=0;
+ await getApp().request.promisePost('/api/weshop/order/getOrderWuLiPrice', {data:w_data,is_json:1}).then(res=>{
+ if(res.data.code==0){
+ shipping_price=res.data.data; is_ok=1;
+ }
+ })
+ if(!is_ok){
+ wx.showToast({
+ title: "计算物流错误", icon: 'none',duration: 2000
+ })
+ th.setData({ show_submit:0 });
+ wx.hideLoading();
+ return false;
+ }
if (shipping_price <= 0) {
@@ -914,8 +942,8 @@ Page({
wx.hideLoading();
- });
- });
+ // });
+ // });
},
//--------------------提交订单-----------------------
@@ -1054,6 +1082,11 @@ Page({
goods.skinface_id=getApp().globalData.skinface_id;
}
+ if(th.data.bn_goods.whsle_id){
+ item.is_whsle=1;
+ goods.is_whsle_goods=1;
+ }
+
//-- 把导购的信息填入--
if (gg.guide_id) {
goods.guide_id = gg.guide_id;
diff --git a/packageC/pages/presell/cart/cart2_pre.js b/packageC/pages/presell/cart/cart2_pre.js
index 4a882e4..8772484 100644
--- a/packageC/pages/presell/cart/cart2_pre.js
+++ b/packageC/pages/presell/cart/cart2_pre.js
@@ -542,6 +542,11 @@ Page({
goods.skinface_id=getApp().globalData.skinface_id;
}
+ if(th.data.bn_goods.whsle_id){
+ item.is_whsle=1;
+ goods.is_whsle_goods=1;
+ }
+
//--导购分享过来的id--
if (gg.guide_id) {
goods.guide_id = gg.guide_id;
diff --git a/pages/cart/cart/cart.js b/pages/cart/cart/cart.js
index d095dfc..f67c2a8 100644
--- a/pages/cart/cart/cart.js
+++ b/pages/cart/cart/cart.js
@@ -612,8 +612,8 @@ Page({
}
}
-
- else if(item.prom_type == 0) {
+ //判断不是代发的商品
+ else if(item.prom_type == 0 && !item.whsle_id) {
//如果有优惠活动,要更新活动
await getApp().request.promiseGet("/api/weshop/goods/getGoodsPromList/" + os.stoid + "/" + item.goods_id + "/1"+"/"+getApp().globalData.user_id, {}).then(res => {
@@ -1731,7 +1731,7 @@ Page({
function normal_check(store_count, goodsinfo, wareIds) {
//--- 看一下是不是线下库存 ---
- if (th.data.sales_rules == 2 && goodsinfo.prom_type != 7) {
+ if (th.data.sales_rules == 2 && goodsinfo.prom_type != 7 && !goodsinfo.whsle_id) {
th.check_down_line(t, pitem, item, wareIds);
} else {
if (t.goods_num > store_count) {
@@ -2491,7 +2491,7 @@ Page({
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) {
+ i_arr[j].need_downlow_num) && th.data.sales_rules == 2 && i_arr[j].is_gift != 1 && !i_arr[j].whsle_id) {
//--获取商品的线下商品ID--
var gd = null;
await getApp().request.promiseGet("/api/weshop/goods/get/" + oo.stoid + "/" + i_arr[j].goods_id, {}).then(res => {
diff --git a/pages/cart/cart2/cart2.js b/pages/cart/cart2/cart2.js
index dd7dd02..47c3850 100644
--- a/pages/cart/cart2/cart2.js
+++ b/pages/cart/cart2/cart2.js
@@ -451,8 +451,8 @@ Page({
//如果有购买活动
item1.promgoodsbuynum = promgoodsbuynum;
- //要把优惠活动加入,prom_goods_map中,赠品不要运算
- if (item1.prom_type == 3 && item1.is_gift != 1) {
+ //要把优惠活动加入,prom_goods_map中,赠品不要运算,代发商品不算优惠
+ if (item1.prom_type == 3 && item1.is_gift != 1 && !item1.whsle_id) {
// th.check_is_youhui(item1.goods_id, item1.pick_id);
await th.add_prom_goods_map(item1);
}
@@ -882,6 +882,11 @@ Page({
gd.prom_type = gg.prom_type ? gg.prom_type : 0;
gd.prom_id = gg.prom_id ? gg.prom_id : 0;
+ if(gd.whsle_id>0){
+ gd.prom_type =gg.prom_type=0;
+ gd.prom_id =gg.prom_id=0;
+ }
+
switch (gd.prom_type) {
case 0:
case 3:
@@ -1187,6 +1192,8 @@ Page({
var o_price = 0, q_conditin = 0;
//--------循环计算总价-----------
for (var j = 0; j < ord_goods.length; j++) {
+
+ if(ord_goods[j].whsle_id) continue;
o_price += ord_goods[j].goods_price * ord_goods[j].goods_num;
}
@@ -1232,6 +1239,7 @@ Page({
item_map.gift_weight = get_data.goodsinfo.weight;
item_map.gift_exp_sum_type = get_data.goodsinfo.exp_sum_type;
item_map.uniform_exp_sum = get_data.goodsinfo.uniform_exp_sum;
+ item_map.whsle_id = get_data.goodsinfo.whsle_id;
}
item_map.s_libao = get_data.libao;
@@ -1455,10 +1463,15 @@ Page({
},
//-------------------计算订单价格-------------------
- calculatePrice: function (t, s) {
+ calculatePrice:async function (t, s) {
var th = this;
- to.getwuliuprice(async function (rs) {
- wx.showLoading({ title: "处理中." })
+
+ wx.showLoading({
+ title: "处理中.",
+ mask:true
+ })
+ //-- to.getwuliuprice(async function (rs) { --
+
//是不是区域包邮
th.data.is_area_by = 0;
//当不是区域不包邮的时候,没有不包邮商品的时候
@@ -1491,12 +1504,16 @@ Page({
//调用函数计算每件商品的单价
await th.calc_per(c_arr);
+
//调用函数计算每件组合购商品的单价,
await zh_calc.calc_zh_split_price(c_arr, th);
+
//调用函数计算每件阶梯促销商品的单价,
await ladder_calc.calc_split_price(c_arr, th);
//调用函数计算,优惠券优惠什么商品价格,优惠券优惠什么商品
+
await th.get_cart_quan(c_arr);
+
//---循环购物车---
for (var i in c_arr) {
//因为搭配购买也是再这里计算,搭配购的is_b_now==1
@@ -1555,9 +1572,15 @@ Page({
})
}
+
+ var whsle_goods_price=0;
//--------循环计算总价-----------
for (var j = 0; j < item.length; j++) {
+ if(item.whsle_id>0){
+ whsle_goods_price+=item.goods_price*item.goods_num;
+ }
+
var is_no_zh = 0;
if (item[j].prom_type != 7 && item[j].prom_type != 10) is_no_zh = 1;
@@ -1729,6 +1752,8 @@ Page({
//--------循环计算总价-----------
for (var j = 0; j < item.length; j++) {
+ //如果是一件代发商品,不计算运费
+ if(item[j].whsle_id) continue;
//如果商品本身是包邮了
if(item[j].is_free_shipping == 1) continue;
//如果是优惠活动是包邮,就不用计算包邮的费用了
@@ -1738,8 +1763,8 @@ Page({
continue;
}
- if (back_data && back_data['is_by_all'] && (!back_data.no_free_goods || back_data.no_free_goods.indexOf(item[j].goods_id) == -1)) {
-
+ if (back_data && back_data['is_by_all'] && (!back_data.no_free_goods || back_data.no_free_goods.indexOf(item[j].goods_id) == -1)) {
+ if (goods_weight < 0) goods_weight = 0;
if (item[j]['exp_sum_type'] == 2) {
cut_good_weight += item[j]['weight'] * item[j]['goods_num'];
goods_weight += item[j]['weight'] * item[j]['goods_num'];
@@ -1784,8 +1809,38 @@ Page({
var code = "";
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 =
- ut.calculatewuliu(code, o_shipping_price, goods_weight, out_of_weight,goods_piece, th.data.user_addr, back_data, rs);
+
+ // cart_item.shipping_price =
+ // ut.calculatewuliu(code, o_shipping_price, goods_weight, out_of_weight,goods_piece, th.data.user_addr, back_data, rs);
+
+ var w_data={
+ store_id:os.stoid, code:code,
+ o_shipping_price:o_shipping_price,
+ goods_weight:goods_weight,
+ out_of_weight:out_of_weight,goods_piece:goods_piece,
+ user_addr_province:th.data.user_addr.province,
+ user_addr_city:th.data.user_addr.city,
+ user_addr_district:th.data.user_addr.district,
+ is_by_all:back_data && back_data.is_by_all?1:0,
+ no_free_goods:back_data && back_data.no_free_goods && back_data.no_free_goods.length>0?1:0,
+ }
+
+ var is_ok=1;
+ await getApp().request.promisePost('/api/weshop/order/getOrderWuLiPrice', {data:w_data,is_json:1}).then(res=>{
+ if(res.data.code==0){
+ cart_item.shipping_price=res.data.data;
+ }else{
+ is_ok=0;
+ }
+ })
+
+ if(!is_ok){
+ wx.showToast({
+ title: "计算物流错误", icon: 'none',duration: 2000
+ })
+ th.setData({ show_submit:0 });
+ wx.hideLoading();
+ }
if (!th.data.using_quan[pickid] || th.data.using_quan[pickid].isby != 1) {
if (cart_item.shipping_price == 0) th.data.is_by[pickid] = 1; //已经全场包邮,就不要选择券了
@@ -1812,6 +1867,10 @@ Page({
o_condition = o_price_no_zh - quan_price;
}
+ if(whsle_goods_price>0){
+ o_condition=o_condition-whsle_goods_price;
+ }
+
var order_m = 0;
//---判断是不是有订单优惠---
await getApp().request.promiseGet("/api/weshop/promorder/getOrderPromotion", {
@@ -1935,7 +1994,7 @@ Page({
th.set_can_num();
wx.hideLoading();
- });
+ //});
},
set_can_num: function () {
@@ -1969,7 +2028,7 @@ Page({
//---------计算立即购买----------
- calculatePrice2: function () {
+ calculatePrice2: async function () {
var th = this, good = this.data.bn_goods;
if (!good) return false;
@@ -1981,7 +2040,8 @@ Page({
}
wx.showLoading({
- title: "处理中."
+ title: "处理中.",
+ mask:true
})
//-----------计算商品总价--------------
var allpice = good.shop_price * good.buynum;
@@ -2007,7 +2067,7 @@ Page({
allpice = good.offline_price * good.buynum;
}
- to.getwuliuprice(async function (rs) {
+ //to.getwuliuprice(async function (rs) {
var o_shipping_price = 0, goods_weight = -1, goods_piece = -1;
var out_of_weight = null; //超出多少重量
@@ -2019,7 +2079,8 @@ Page({
quan_no = th.data.using_quan[bn_pick].coupon_no;
if (quan_no) {
- if (th.data.using_quan[bn_pick].isby != 1) {
+ //如果是一件代发就不要找商品
+ if (th.data.using_quan[bn_pick].isby != 1 && !good.whsle_id) {
//---获取优惠券优惠---
await getApp().request.promiseGet("/api/weshop/couponList/getUseCouponPrice", {
data: {
@@ -2043,7 +2104,7 @@ Page({
}
//-----------当地址不为空,且是物流时,计算物流费用,并同时商品不是优惠活动的包邮----------
- if (th.data.user_addr != null && th.data.bn_exp_type == 0 && good.is_free_shipping == 0 && good.is_past != 1) {
+ if (th.data.user_addr != null && th.data.bn_exp_type == 0 && good.is_past != 1) {
//看是不是有调用过包邮券
if (!th.data.isget_by_quan[th.data.bn_pick] && good.is_xz_yh != 1) {
var condition = allpice - cut_price - quan_price;
@@ -2129,8 +2190,14 @@ Page({
var cut_good_weight = 0;
for (let i in gd_arr_list) {
let item = gd_arr_list[i];
-
+
+ if(good.is_free_shipping==1) continue;
+ //-- 代发商品不算运费 --
+ if(good.whsle_id) continue;
+
if (back_data && back_data['is_by_all'] && (!back_data.no_free_goods || back_data.no_free_goods.indexOf(item.goods_id) == -1)) {
+
+ if (goods_weight < 0) goods_weight = 0;
if (item['exp_sum_type'] == 2) {
goods_weight += item['weight'] * item['buynum'];
cut_good_weight += item['weight'] * item['buynum'];
@@ -2177,8 +2244,37 @@ Page({
th.data.is_by[th.data.bn_pick] = 0;
//--------------开始计算物流------------------
- shipping_price = ut.calculatewuliu(code, o_shipping_price, goods_weight, out_of_weight,
- goods_piece, th.data.user_addr, back_data, rs);
+ // shipping_price = ut.calculatewuliu(code, o_shipping_price, goods_weight, out_of_weight,
+ // goods_piece, th.data.user_addr, back_data, rs);
+
+ var w_data={
+ store_id:os.stoid, code:code,
+ o_shipping_price:o_shipping_price,
+ goods_weight:goods_weight,
+ out_of_weight:out_of_weight,goods_piece:goods_piece,
+ user_addr_province:th.data.user_addr.province,
+ user_addr_city:th.data.user_addr.city,
+ user_addr_district:th.data.user_addr.district,
+ is_by_all:back_data && back_data.is_by_all?1:0,
+ no_free_goods:back_data && back_data.no_free_goods && back_data.no_free_goods.length>0?1:0,
+ }
+
+ var is_ok=1;
+ await getApp().request.promisePost('/api/weshop/order/getOrderWuLiPrice', {data:w_data,is_json:1}).then(res=>{
+ if(res.data.code==0){
+ shipping_price=res.data.data;
+ }else{
+ is_ok=0;
+ }
+ })
+
+ if(!is_ok){
+ wx.showToast({
+ title: "计算物流错误", icon: 'none',duration: 2000
+ })
+ th.setData({ show_submit:0 });
+ wx.hideLoading();
+ }
if (shipping_price <= 0) {
th.data.is_by[th.data.bn_pick] = 1; //已经是包邮了,就不要选择包邮券
@@ -2211,6 +2307,10 @@ Page({
}
//--看一下有没有订单优惠--
var o_condition = parseFloat(order_m);
+ if(th.data.bn_goods.whsle_id>0){
+ o_condition=0;
+ }
+
if (o_condition > 0) {
th.check_is_order_prom(o_condition, function () {
var order_prom_amount = 0;
@@ -2372,7 +2472,7 @@ Page({
wx.hideLoading();
- });
+ //});
},
@@ -2522,6 +2622,7 @@ Page({
})
}
+
var goods = {
'goods_id': gg.goods_id,
'goods_name': gg.goods_name,
@@ -2535,6 +2636,11 @@ Page({
'prom_id': th.data.bn_goods.prom_id, //促销活动id
};
+ if(th.data.bn_goods.whsle_id){
+ item.is_whsle=1;
+ goods.is_whsle_goods=1;
+ }
+
if (getApp().globalData.skinface_id) {
goods.skinface_id = getApp().globalData.skinface_id;
}
@@ -2564,7 +2670,7 @@ Page({
if (gg.is_pd_normal) goods.is_pd_normal = 1;
//如果不立即购买或者秒杀,如果是线下库存购买的时候
- if (goods.prom_type != 1 && goods.prom_type != 6 && th.data.sales_rules == 2) {
+ if (goods.prom_type != 1 && goods.prom_type != 6 && goods.prom_type != 2 && th.data.sales_rules == 2 && !th.data.bn_goods.whsle_id) {
var isok = 1;
await th.check_store_num(goods.goods_id, th.data.bn_pick, gg.goods_num, function (res) {
isok = res;
@@ -2681,7 +2787,7 @@ Page({
}
var order_prom_list_cart = th.data.order_prom_list_cart;;
- console.log('xxxxxxxxxxxxxxxx', order_prom_list_cart)
+
//--组装推送数据--
for (var i = 0; i < order_prom_list_cart.length; i++) {
var t_item = order_prom_list_cart[i];
@@ -2806,120 +2912,180 @@ Page({
await th.split_set_goods_quanprice(you_item, t_item);
}
}
- //-------------让商品添加到商品列表--------------------
- for (var k = 0; k < t_item.goods.length; k++) {
- var g_item = t_item.goods[k];
- if (g_item.goods_num <= 0) continue;
- var goods = {
- 'goods_id': g_item.goods_id,
- 'goods_name': g_item.goods_name,
- 'goods_sn': g_item.goods_sn,
- 'goods_num': g_item.goods_num,
- 'market_price': g_item.market_price,
- 'goods_price': g_item.goods_price,
- 'member_goods_price': g_item.goods_price,
- 'store_id': oo.stoid,
- };
- if (getApp().globalData.skinface_id) {
- goods.skinface_id = getApp().globalData.skinface_id;
- }
+ //代发商品的集合
+ var df_goods = [];
+ var df_price = 0;
+ var df_room_ids = "";
+
+ //多个商品才运算
+ if( t_item.goods.length>1) {
+ //-------------让商品添加到商品列表--------------------
+ for (var k = 0; k < t_item.goods.length; k++) {
+ var g_item = t_item.goods[k];
+ if (g_item.goods_num <= 0) continue;
+ var goods = {
+ 'goods_id': g_item.goods_id,
+ 'goods_name': g_item.goods_name,
+ 'goods_sn': g_item.goods_sn,
+ 'goods_num': g_item.goods_num,
+ 'market_price': g_item.market_price,
+ 'goods_price': g_item.goods_price,
+ 'member_goods_price': g_item.goods_price,
+ 'store_id': oo.stoid,
+ };
- //-- 线下取价也要写入,组合购的商品不能去线下价格 --
- if (g_item.offline_price && t_item.is_offline == 1 && g_item.prom_type != 7) {
- goods.goods_price = g_item.offline_price;
- goods.member_goods_price = g_item.offline_price;
- goods.offline_cut = (g_item.goods_price - g_item.offline_price).toFixed(2);
- goods.pricing_type = g_item.pricing_type;
- }
- if (g_item.quan_num) {
- goods.quan_num = g_item.quan_num;
- goods.quan_no = g_item.quan_no;
- }
- //--判断活动的类型--
- switch (g_item.prom_type) {
- case 1:
- case 2:
- case 10:
- goods.prom_type = g_item.prom_type;
- goods.prom_id = g_item.prom_id;
- break;
- case 3:
- goods.prom_type = 3;
- goods.prom_id = g_item.prom_id;
- if (g_item.is_gift) {
- goods.is_gift = g_item.is_gift;
- goods.gift_id = g_item.gift_id;
- }
- break;
- case 5:
- goods.prom_type = 5;
- goods.prom_id = g_item.prom_id;
- if (g_item.is_collocation) {
- goods.is_collocation = g_item.is_collocation;
+ if (getApp().globalData.skinface_id) {
+ goods.skinface_id = getApp().globalData.skinface_id;
+ }
+
+ //-- 线下取价也要写入,组合购的商品不能去线下价格 --
+ if (g_item.offline_price && t_item.is_offline == 1 && g_item.prom_type != 7) {
+ goods.goods_price = g_item.offline_price;
+ goods.member_goods_price = g_item.offline_price;
+ goods.offline_cut = (g_item.goods_price - g_item.offline_price).toFixed(2);
+ goods.pricing_type = g_item.pricing_type;
+ }
+ if (g_item.quan_num) {
+ goods.quan_num = g_item.quan_num;
+ goods.quan_no = g_item.quan_no;
+ }
+ //--判断活动的类型--
+ switch (g_item.prom_type) {
+ case 1:
+ case 2:
+ case 10:
+ goods.prom_type = g_item.prom_type;
+ goods.prom_id = g_item.prom_id;
+ break;
+ case 3:
+ goods.prom_type = 3;
+ goods.prom_id = g_item.prom_id;
+ if (g_item.is_gift) {
+ goods.is_gift = g_item.is_gift;
+ goods.gift_id = g_item.gift_id;
+ }
+ break;
+ case 5:
+ goods.prom_type = 5;
+ goods.prom_id = g_item.prom_id;
+ if (g_item.is_collocation) {
+ goods.is_collocation = g_item.is_collocation;
+ }
+ break
+ case 7:
+ goods.prom_type = 7;
+ goods.prom_id = g_item.prom_id;
+ break
+ default:
+ goods.prom_type = 0;
+ goods.prom_id = 0;
+ }
+
+ //如果不立即购买或者秒杀,如果是线下库存购买的时候
+ if (goods.prom_type == 0 && th.data.sales_rules == 2) {
+ var isok = 1;
+ await th.check_store_num(goods.goods_id, t_item.pickup_id, goods.goods_num, function (res) {
+ isok = res;
+ });
+ if (!isok) {
+ getApp().confirmBox(goods.goods_name + "的门店库存不足");
+ th.data.is_summit_ing = 0;
+ return false;
}
- break
- case 7:
- goods.prom_type = 7;
- goods.prom_id = g_item.prom_id;
- break
- default:
- goods.prom_type = 0;
- goods.prom_id = 0;
- }
+ }
- //如果不立即购买或者秒杀,如果是线下库存购买的时候
- if (goods.prom_type == 0 && th.data.sales_rules == 2) {
- var isok = 1;
- await th.check_store_num(goods.goods_id, t_item.pickup_id, goods.goods_num, function (res) {
- isok = res;
- });
- if (!isok) {
- getApp().confirmBox(goods.goods_name + "的门店库存不足");
- th.data.is_summit_ing = 0;
- return false;
+ //把优惠的平摊结果写进去
+ if (g_item.account >= 0 || (g_item.account_yu != 0 && g_item.account != undefined)) {
+ if (g_item.account >= 0) goods.account = g_item.account;
+ if (g_item.account_yu != 0) goods.account_yu = g_item.account_yu;
+ item.is_discount_amount = 1;
}
- }
- //把优惠的平摊结果写进去
- if (g_item.account >= 0 || (g_item.account_yu != 0 && g_item.account != undefined)) {
- if (g_item.account >= 0) goods.account = g_item.account;
- if (g_item.account_yu != 0) goods.account_yu = g_item.account_yu;
- item.is_discount_amount = 1;
- }
+ //导购ID
+ if (g_item.guide_id) {
+ goods.guide_id = g_item.guide_id;
+ goods.guide_type = g_item.guide_type;
+ //调用接口判断是不是会员
+ await getApp().request.promiseGet("/api/weshop/shoppingGuide/getId/" + oo.stoid + "/" + g_item.guide_id, {}).then(res => {
+ if (res.data.code == 0) {
+ goods.guide_name = res.data.data.salesman;
+ goods.guide_sn = res.data.data.salesman_no;
+ }
+ })
+ }
- //导购ID
- if (g_item.guide_id) {
- goods.guide_id = g_item.guide_id;
- goods.guide_type = g_item.guide_type;
- //调用接口判断是不是会员
- await getApp().request.promiseGet("/api/weshop/shoppingGuide/getId/" + oo.stoid + "/" + g_item.guide_id, {}).then(res => {
- if (res.data.code == 0) {
- goods.guide_name = res.data.data.salesman;
- goods.guide_sn = res.data.data.salesman_no;
+ //如果有阶梯促销
+ if (g_item.ladder_list_id) {
+ goods.ladder_list_id = g_item.ladder_list_id;
+ }
+
+ //-- 如果有代发商品,就要开始拆单 --
+ if (g_item.whsle_id) {
+ df_price += parseFloat(g_item.goods_num * g_item.goods_price);
+ goods.is_whsle_goods = 1;
+ df_goods.push(goods);
+ df_room_ids += g_item.room_id + ",";
+ } else {
+ item.order_goods.push(goods);
+ //如果房间号不为空的时候
+ if (g_item.room_id) {
+ goods.room_id = g_item.room_id;
+ room_ids += g_item.room_id + ",";
}
- })
- }
- //如果房间号不为空的时候
- if (g_item.room_id) {
- goods.room_id = g_item.room_id;
- room_ids += g_item.room_id + ",";
+ }
}
+ }
+
+ //如果房间号不为空的时候
+ if (room_ids != "") item.room_ids = ut.sub_last(room_ids);
+
+
+ //处理代发商品的拆分
+ if(df_goods.length>0){
+ var df_item=JSON.parse(JSON.stringify(item));
+ item.goods_price= parseFloat(item.goods_price-df_price).toFixed(2);
+ item.total_amount= parseFloat(item.total_amount-df_price).toFixed(2);
+
+ df_item.is_whsle=1;
+ df_item.is_discount_amount=0;
+ df_item.goods_price=df_price;
+ df_item.total_amount=df_price;
+ df_item.shipping_price=0; //没有运费
+ if(df_item.order_prom_list) df_item.order_prom_list={};
+
+ //看一下是用余额比较多,还是用钱比较多
+ if(item.order_amount>item.user_money){
+ if(item.order_amount>df_price){
+ item.order_amount=parseFloat(item.order_amount-df_price).toFixed(2);
+ df_item.order_amount=df_price.toFixed(2);
+ }else {
+ var more_p=parseFloat(df_price-item.order_amount).toFixed(2);
+ item.order_amount=0;
+ item.user_money=parseFloat(item.user_money-more_p).toFixed(2);
+ df_item.user_money=more_p;
+ }
+ }else{
+ if(item.user_money>df_price){
+ item.user_money=parseFloat(item.user_money-df_price).toFixed(2);
+ df_item.user_money=df_price.toFixed(2);
+ }else {
+ var more_p=parseFloat(df_price-item.user_money).toFixed(2);
+ item.user_money=0;
+ item.order_amount=parseFloat(item.user_money-more_p).toFixed(2);
+ df_item.order_amount=more_p;
- //如果有阶梯促销
- if (g_item.ladder_list_id) {
- goods.ladder_list_id = g_item.ladder_list_id;
+ }
}
- item.order_goods.push(goods);
+ if (df_room_ids != "") df_item.room_ids = ut.sub_last(df_room_ids);
+ df_item.order_goods=df_goods;
+ pdata.push(df_item);
}
- //如果房间号不为空的时候
- if (room_ids != "") item.room_ids = ut.sub_last(room_ids);
pdata.push(item);
}
-
}
if (pdata.length == 0) return;
@@ -2951,7 +3117,7 @@ Page({
}
var order_amount = 0;
pdata.forEach(function (em, ind) {
- order_amount += em.order_amount;
+ order_amount += parseFloat(em.order_amount);
})
//要进行判断,如果是用微信支付,就要跳转到支付界面
if (order_amount > 0) {
@@ -3757,7 +3923,7 @@ Page({
for (var i in goodlist) {
var gd = goodlist[i];
//--如果是秒杀就跳出,如果是赠品,如果是组合购限制使用优惠券--
- if (gd.prom_type == 1 || gd.is_gift || (gd.prom_type == 7 && gd.act.is_xz_yh) || gd.is_xz_yh == 1) {
+ if (gd.whsle_id==1 || gd.prom_type == 1 || gd.is_gift || (gd.prom_type == 7 && gd.act.is_xz_yh) || gd.is_xz_yh == 1) {
continue;
}
@@ -3865,8 +4031,8 @@ Page({
arr[ind].ckeck_quan_price = ckeck_quan_price - (cut_price ? cut_price : 0);
arr[ind].check_quan_ware_list = check_quan_ware_list;
arr[ind].check_quan_price_list = check_quan_price_list;
- //是否关闭使用优惠券
- if (th.data.is_close_quan != 1) {
+ //-- 是否关闭使用优惠券,循环有找到商品 --
+ if (th.data.is_close_quan != 1 && check_quan_ware_list) {
//--调用接口,获取优惠券的列表,3秒钟内控制接口请求--
var url = "/api/weshop/couponList/getUseCouponList";
await app.request.promiseGet(url, {
@@ -3904,6 +4070,9 @@ Page({
get_buy_now_quan: function () {
var quanlist = null, th = this, frozenQuan = null;
var good = this.data.bn_goods;
+
+ //一件代发商品不使用优惠券
+ if(good.whsle_id) return false;
if (good.prom_price) {
th.data.ckeck_quan_price = good.prom_price; //如果有优惠价,就用优惠价
} else if (good.is_offline) {
@@ -4025,6 +4194,7 @@ Page({
arr.gift_uniform_exp_sum = get_data.goodsinfo.uniform_exp_sum;
arr.gift_limit_num = get_data.limit_num;
arr.gift_storecount = get_data.gift_storecount;
+ arr.whsle_id=get_data.goodsinfo.whsle_id;
}
arr.s_libao = get_data.libao;
arr.s_lb_num = get_data.lb_num;
@@ -4659,6 +4829,11 @@ Page({
goods_color: gf_item.goodsinfo.goods_color,
};
+
+ //-- 如果是代发商品的时候 --
+ if(gf_item.goodsinfo.whsle_id){
+ newd.whsle_id=gf_item.goodsinfo.whsle_id;
+ }
await getApp().request.promisePost("/api/weshop/cart/save", {
data: newd
}).then(res => {
@@ -4714,6 +4889,11 @@ Page({
goods_spec: gf_item.goodsinfo.goods_spec,
goods_color: gf_item.goodsinfo.goods_color,
};
+ //-- 如果是代发商品的时候 --
+ if(gf_item.goodsinfo.whsle_id){
+ newd.whsle_id=gf_item.goodsinfo.whsle_id;
+ }
+
new_pk_list_goods.push(newd);
}
var set_data = this.data.send_gf[th.data.bn_pick][this.data.send_gf_index];
diff --git a/pages/cart/cart2_inte/cart2_inte.js b/pages/cart/cart2_inte/cart2_inte.js
index c62df2c..fe42052 100644
--- a/pages/cart/cart2_inte/cart2_inte.js
+++ b/pages/cart/cart2_inte/cart2_inte.js
@@ -407,9 +407,9 @@ Page({
//---------计算立即购买----------
- calculatePrice2: function () {
+ calculatePrice2:async function () {
var th = this, good = this.data.bn_goods;
- wx.showLoading({ title: "处理中.", })
+ wx.showLoading({ title: "处理中.", mask:true })
//-----------计算商品总价--------------
var allpice = good.shop_price * good.buynum;
var all_integral = good.integral * good.buynum;
@@ -426,7 +426,7 @@ Page({
th.setData({ [c_txt]: cut_price, });
}
- to.getwuliuprice(async function (rs) {
+ //to.getwuliuprice(async function (rs) {
var o_shipping_price = 0, goods_weight = -1, goods_piece = -1;
var out_of_weight = null; //超出多少重量
@@ -453,6 +453,7 @@ Page({
let item = gd_arr_list[i];
if (back_data && back_data['is_by_all'] && (!back_data.no_free_goods || back_data.no_free_goods.indexOf(item.goods_id) == -1) ) {
+ if (goods_weight < 0) goods_weight = 0;
if (item['exp_sum_type'] == 2) {
goods_weight += item['weight'] * item['buynum'];
cut_good_weight += item['weight'] * item['buynum'];
@@ -495,8 +496,38 @@ 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 shipping_price = ut.calculatewuliu(code, o_shipping_price, goods_weight, out_of_weight,
- goods_piece, th.data.user_addr, back_data, rs);
+ var shipping_price=0;
+ // var shipping_price = ut.calculatewuliu(code, o_shipping_price, goods_weight, out_of_weight,
+ // goods_piece, th.data.user_addr, back_data, rs);
+
+ var w_data={
+ store_id:os.stoid, code:code,
+ o_shipping_price:o_shipping_price,
+ goods_weight:goods_weight,
+ out_of_weight:out_of_weight,goods_piece:goods_piece,
+ user_addr_province:th.data.user_addr.province,
+ user_addr_city:th.data.user_addr.city,
+ user_addr_district:th.data.user_addr.district,
+ is_by_all:back_data && back_data.is_by_all?1:0,
+ no_free_goods:back_data && back_data.no_free_goods && back_data.no_free_goods.length>0?1:0,
+ }
+
+ var is_ok=0;
+ await getApp().request.promisePost('/api/weshop/order/getOrderWuLiPrice', {data:w_data,is_json:1}).then(res=>{
+ if(res.data.code==0){
+ shipping_price=res.data.data; is_ok=1;
+ }
+ })
+ if(!is_ok){
+ wx.showToast({
+ title: "计算物流错误", icon: 'none',duration: 2000
+ })
+ th.setData({ show_submit:0 });
+ wx.hideLoading();
+ return false;
+ }
+
+
if (shipping_price <= 0) {
th.data.is_by[th.data.bn_pick] = 1; //已经是包邮了,就不要选择包邮券
}
@@ -547,7 +578,7 @@ Page({
wx.hideLoading();
- });
+ //});
},
@@ -666,6 +697,12 @@ Page({
goods.skinface_id=getApp().globalData.skinface_id;
}
+ if(th.data.bn_goods.whsle_id){
+ item.is_whsle=1;
+ goods.is_whsle_goods=1;
+ }
+
+
//-- 把导购的信息填入--
if (gg.guide_id) {
goods.guide_id = gg.guide_id;
diff --git a/pages/cart/cart2_pt/cart2_pt.js b/pages/cart/cart2_pt/cart2_pt.js
index 99b57cb..db2038f 100644
--- a/pages/cart/cart2_pt/cart2_pt.js
+++ b/pages/cart/cart2_pt/cart2_pt.js
@@ -394,7 +394,13 @@ Page({
});
},
//---------计算立即购买----------
- calculatePrice2: function () {
+ calculatePrice2:async function () {
+
+ wx.showLoading({
+ title: "处理中.",
+ mask:true
+ })
+
var th = this, good = this.data.bn_goods;
//-----------计算商品总价--------------
var allpice = good.shop_price * good.buynum;
@@ -402,9 +408,10 @@ Page({
var txt = "formData.all_price";
th.setData({ [txt]: allpice, });
- to.getwuliuprice(async function (rs) {
+ //to.getwuliuprice(async function (rs) {
console.log('calculatePrice2222');
- console.log(rs);
+ //console.log(rs);
+
var o_shipping_price = 0, goods_weight = -1, goods_piece = -1;
var out_of_weight = null; //超出多少重量
@@ -430,7 +437,8 @@ Page({
let item = gd_arr_list[i];
if (back_data && back_data['is_by_all'] && (!back_data.no_free_goods || back_data.no_free_goods.indexOf(item.goods_id) == -1)) {
- if (item['exp_sum_type'] == 2) {
+ if (goods_weight < 0) goods_weight = 0;
+ if (item['exp_sum_type'] == 2) {
cut_good_weight += item['weight'] * item['buynum'];
goods_weight += item['weight'] * item['buynum'];
}
@@ -473,8 +481,36 @@ Page({
var code = th.data.wu_arr[th.data.index].code;
//--------------开始计算物流------------------
- var shipping_price = ut.calculatewuliu(code, o_shipping_price, goods_weight, out_of_weight,
- goods_piece, th.data.user_addr, back_data, rs);
+ var shipping_price=0;
+ // var shipping_price = ut.calculatewuliu(code, o_shipping_price, goods_weight, out_of_weight,
+ // goods_piece, th.data.user_addr, back_data, rs);
+
+ var w_data={
+ store_id:os.stoid, code:code,
+ o_shipping_price:o_shipping_price,
+ goods_weight:goods_weight,
+ out_of_weight:out_of_weight,goods_piece:goods_piece,
+ user_addr_province:th.data.user_addr.province,
+ user_addr_city:th.data.user_addr.city,
+ user_addr_district:th.data.user_addr.district,
+ is_by_all:back_data && back_data.is_by_all?1:0,
+ no_free_goods:back_data && back_data.no_free_goods && back_data.no_free_goods.length>0?1:0,
+ }
+
+ var is_ok=0;
+ await getApp().request.promisePost('/api/weshop/order/getOrderWuLiPrice', {data:w_data,is_json:1}).then(res=>{
+ if(res.data.code==0){
+ shipping_price=res.data.data; is_ok=1;
+ }
+ })
+ if(!is_ok){
+ wx.showToast({
+ title: "计算物流错误", icon: 'none',duration: 2000
+ })
+ th.setData({ show_submit:0 });
+ wx.hideLoading();
+ return false;
+ }
shipping_price = parseFloat(shipping_price).toFixed(2);
var wl_txt = "formData.shipping_price";
@@ -507,7 +543,9 @@ Page({
th.setData({ [txt]: 0, [txt2]: order_m })
}
- });
+ wx.hideLoading();
+
+ //});
},
//--------------------提交订单-----------------------
@@ -618,6 +656,12 @@ Page({
if(getApp().globalData.skinface_id){
goods.skinface_id=getApp().globalData.skinface_id;
}
+
+ if(th.data.bn_goods.whsle_id){
+ item.is_whsle=1;
+ goods.is_whsle_goods=1;
+ }
+
//--导购分享过来的id--
if (gg.guide_id) {
goods.guide_id = gg.guide_id;
diff --git a/pages/cart/cart_wk/cart_wk.js b/pages/cart/cart_wk/cart_wk.js
index 7e613c2..6dc8685 100644
--- a/pages/cart/cart_wk/cart_wk.js
+++ b/pages/cart/cart_wk/cart_wk.js
@@ -473,9 +473,9 @@ Page({
},
//----计算物流的钱----
- calculate_wuliu() {
+ async calculate_wuliu() {
var to = getApp(), th = this;
- to.getwuliuprice(async function (rs) {
+ //to.getwuliuprice(async function (rs) {
var o_shipping_price = 0, goods_weight = -1, goods_piece = -1, good = th.data.goods;
var out_of_weight = null; //超出多少重量
@@ -505,7 +505,8 @@ Page({
let item = gd_arr_list[i];
if (back_data && back_data['is_by_all'] && (!back_data.no_free_goods || back_data.no_free_goods.indexOf(item.goods_id) == -1)) {
- if (item['exp_sum_type'] == 2) {
+ if (goods_weight < 0) goods_weight = 0;
+ if (item['exp_sum_type'] == 2) {
goods_weight += item['weight'] * item['buynum'];
cut_good_weight += item['weight'] * item['buynum'];
}
@@ -547,8 +548,36 @@ Page({
var code = th.data.wu_arr[th.data.index].code;
//--------------开始计算物流------------------
- var shipping_price = ut.calculatewuliu(code, o_shipping_price, goods_weight, out_of_weight,
- goods_piece, th.data.user_addr, back_data, rs);
+ var shipping_price =0;
+ // ut.calculatewuliu(code, o_shipping_price, goods_weight, out_of_weight,
+ // goods_piece, th.data.user_addr, back_data, rs);
+
+ var w_data={
+ store_id:os.stoid, code:code,
+ o_shipping_price:o_shipping_price,
+ goods_weight:goods_weight,
+ out_of_weight:out_of_weight,goods_piece:goods_piece,
+ user_addr_province:th.data.user_addr.province,
+ user_addr_city:th.data.user_addr.city,
+ user_addr_district:th.data.user_addr.district,
+ is_by_all:back_data && back_data.is_by_all?1:0,
+ no_free_goods:back_data && back_data.no_free_goods && back_data.no_free_goods.length>0?1:0,
+ }
+
+ var is_ok=0;
+ await getApp().request.promisePost('/api/weshop/order/getOrderWuLiPrice', {data:w_data,is_json:1}).then(res=>{
+ if(res.data.code==0){
+ shipping_price=res.data.data; is_ok=1;
+ }
+ })
+ if(!is_ok){
+ wx.showToast({
+ title: "计算物流错误", icon: 'none',duration: 2000
+ })
+ th.setData({ show_submit:0 });
+ wx.hideLoading();
+ return false;
+ }
var exp_price = parseFloat(shipping_price).toFixed(2);
allpice = parseFloat(exp_price) + parseFloat(allpice);
@@ -561,7 +590,7 @@ Page({
allpice = allpice.toFixed(2);
th.setData({ exp_price: 0, allpice: allpice })
}
- });
+ //});
},
diff --git a/pages/goods/goodsInfo/goodsInfo.js b/pages/goods/goodsInfo/goodsInfo.js
index 753ba52..9e23f2c 100644
--- a/pages/goods/goodsInfo/goodsInfo.js
+++ b/pages/goods/goodsInfo/goodsInfo.js
@@ -352,6 +352,10 @@ Page({
getApp().globalData.guide_id = res.data.data.id;
}
})
+
+ if(!getApp().globalData.user_id){
+ ut.new_user_go(os.stoid,first_leader);
+ }
}
//-- 如果有房间号 --
@@ -557,7 +561,7 @@ Page({
var that = this, th = this;
getApp().getConfig2(function (e) {
var sales_rules = e.sales_rules;
- if (sales_rules == 2 && [1,2,4,6,8,9].indexOf(th.data.prom_type)==-1 ) {
+ if (sales_rules == 2 && [1,2,4,6,8,9].indexOf(th.data.prom_type)==-1 && !th.data.sele_g.whsle_id ) {
getApp().waitfor2(that, "wait_for_user_store", "fir_goods", function () {
var lock = 0, plist = null;
var gd = that.data.fir_goods;
@@ -886,7 +890,8 @@ Page({
}
- if (ee.data.prom_type != 1 && ee.data.prom_type != 4 && ee.data.prom_type != 6 && ee.data.prom_type != 2) {
+ //一件代发商品不去计算优惠
+ if (!ee.data.fir_goods.whsle_id && ee.data.prom_type != 1 && ee.data.prom_type != 4 && ee.data.prom_type != 6 && ee.data.prom_type != 2) {
ee.check_is_youhui(ee.data.gid);
}
@@ -1390,6 +1395,13 @@ Page({
prom_type: th.data.sele_g.prom_type,
};
+
+ //-- 代发商品不参加优惠 --
+ if(th.data.sele_g.whsle_id && newd.prom_type==3){
+ newd.prom_type=0;
+ newd.prom_id=0;
+ }
+
//---是不是从收藏夹出来的---
if (th.data.c_guide_id) {
newd['guide_id'] = th.data.c_guide_id;
@@ -1664,7 +1676,7 @@ Page({
}
//---如果是线下门店销售的时候---
- if (th.data.sales_rules == 2) {
+ if (th.data.sales_rules == 2 && !th.data.sele_g.whsle_id ) {
var pick = th.get_pick_from_list(th.data.sto_sele_id)
//---通过接口获取门店的线下库存信息--
getApp().request.get("/api/weshop/goods/getWareStorages", {
@@ -2336,7 +2348,7 @@ Page({
check_is_prom_goods: function (callback) {
var th = this;
var usr = getApp().globalData.userInfo;
- if (this.data.sele_g.prom_type != 0 && this.data.sele_g.prom_type != 3) {
+ if (this.data.sele_g.prom_type != 0 && this.data.sele_g.prom_type != 3 && !this.data.sele_g.whsle_id) {
callback();
} else {
//-- 判断有没有优惠活动 --
@@ -2847,10 +2859,10 @@ Page({
});
- that.check_is_youhui(gid, that.data.is_normal);
+ if(!item.whsle_id) that.check_is_youhui(gid, that.data.is_normal);
//默认门店要拿下门店库存
- if (that.data.sales_rules == 2 && that.data.def_pick_store) {
+ if (that.data.sales_rules == 2 && that.data.def_pick_store && !that.data.sele_g.whsle_id ) {
var lock = 0, plist = null;
//先读取门店的lock,采用链式写法,少用await
getApp().request.promiseGet("/api/weshop/order/ware/lock/page", {
@@ -3077,7 +3089,7 @@ Page({
th.setData({all_pick_list: e.data.data.pageData});
//--获取线下库存,而且不是新的门店规则, 同时是普通购买的时候,或者同时不能是活动,秒杀,拼团,积分购--
- if (th.data.sales_rules == 2 && !th.data.is_newsales_rules && ((th.data.prom_type != 1 && th.data.prom_type != 6 && th.data.prom_type != 4) || is_normal == 1)) {
+ if (th.data.sales_rules == 2 && !th.data.is_newsales_rules && !th.data.sele_g.whsle_id && ((th.data.prom_type != 1 && th.data.prom_type != 6 && th.data.prom_type != 4) || is_normal == 1)) {
setTimeout(function () {
th.deal_pickup_dline(e);
}, 800)
@@ -3619,7 +3631,7 @@ Page({
this.get_sku(o.stoid, this.data.data, gid);
this.check_has_flash();
this.data.is_normal = 1;
- this.check_is_youhui(gid, 1);
+ if(!this.data.data.whsle_id) this.check_is_youhui(gid, 1);
return false;
}
@@ -4262,7 +4274,7 @@ Page({
});
});
}
- th.check_is_youhui(th.data.gid, 1);
+ if(!th.data.sele_g.whsle_id) th.check_is_youhui(th.data.gid, 1);
} else {
if (th.data.is_normal) {
@@ -5981,7 +5993,7 @@ Page({
var lock = 0;
//---如果是活动的时候,同时不是普通购买---
- if ((th.data.prom_type == 1 || th.data.prom_type == 6 || th.data.prom_type == 4) && !th.data.is_normal) {
+ if (th.data.sele_g.whsle_id || (th.data.prom_type == 1 || th.data.prom_type == 6 || th.data.prom_type == 4) && !th.data.is_normal) {
func();
return false;
}
@@ -6637,7 +6649,7 @@ Page({
});
});
}
- this.check_is_youhui(th.data.gid, 1);
+ if(!th.data.sele_g.whsle_id) this.check_is_youhui(th.data.gid, 1);
},
closeSpecModal_inte: function () {
@@ -6845,7 +6857,8 @@ Page({
});
this.get_sku(os.stoid, this.data.data, gid);
this.get_sto();
- this.check_is_youhui(gid, 1);
+ if(!this.data.data.whsle_id)
+ this.check_is_youhui(gid, 1);
this.data.is_normal = 1;
},
@@ -6944,7 +6957,7 @@ Page({
});
});
}
- this.check_is_youhui(th.data.gid, 1);
+ if(!this.data.data.whsle_id) this.check_is_youhui(th.data.gid, 1);
},
closeSpecModal_flash_normal: function () {
diff --git a/pages/goods/goodsInfo/goodsInfo.wxml b/pages/goods/goodsInfo/goodsInfo.wxml
index 77164b7..49eff38 100644
--- a/pages/goods/goodsInfo/goodsInfo.wxml
+++ b/pages/goods/goodsInfo/goodsInfo.wxml
@@ -649,7 +649,7 @@
(配送不匹配)
-
+
(库存不足)
@@ -1254,7 +1254,7 @@
(库存不足)
(配送不匹配)
-
+
(库存不足)
@@ -1326,7 +1326,7 @@
-
+
库存不足
diff --git a/pages/goods/goodsList/goodsList.js b/pages/goods/goodsList/goodsList.js
index 4c10c0b..0135340 100644
--- a/pages/goods/goodsList/goodsList.js
+++ b/pages/goods/goodsList/goodsList.js
@@ -41,6 +41,9 @@ Page({
getApp().globalData.guide_id=res.data.data.id;
}
})
+ if(!getApp().globalData.user_id){
+ ut.new_user_go(oo.stoid,first_leader);
+ }
}
var th=this;
diff --git a/pages/index/index/index.js b/pages/index/index/index.js
index dac0d27..eb378ac 100644
--- a/pages/index/index/index.js
+++ b/pages/index/index/index.js
@@ -173,6 +173,11 @@ Page({
getApp().globalData.guide_id = res.data.data.id;
}
})
+
+ if(!getApp().globalData.user_id){
+ ut.new_user_go(os.stoid,first_leader);
+ }
+
}
// 判断是否有红包活动
diff --git a/pages/index/index/index.wxml b/pages/index/index/index.wxml
index d57483c..9220eef 100644
--- a/pages/index/index/index.wxml
+++ b/pages/index/index/index.wxml
@@ -18,7 +18,6 @@
-
@@ -45,17 +44,11 @@
-
-
-
-
-
-
-
-
-
-
+
+
+
+
@@ -595,3 +588,5 @@
+
+
diff --git a/pages/togoin/togoin.js b/pages/togoin/togoin.js
index bc99d99..7fa1335 100644
--- a/pages/togoin/togoin.js
+++ b/pages/togoin/togoin.js
@@ -187,15 +187,7 @@ Page({
};
//--如果有邀请人的时候--
if(th.data.first_leader){
- //判断一下分享人是不是分享商
- await app.request.promiseGet("/api/weshop/users/get/" + os.stoid+"/"+th.data.first_leader,{}).then(res=>{
- if(res.data.code==0){
- var user= res.data.data;
- if(user.is_distribut==1){
- dd.first_leader=th.data.first_leader;
- }
- }
- })
+ dd.first_leader=th.data.first_leader;
}
//-- 导购会员ID --
if(getApp().globalData.guide_id){
@@ -209,50 +201,70 @@ Page({
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 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;}
- if(!t_user['idcard'] && th.data.idcard_need_go){ need_go=1;}
- if(!t_user['address'] && th.data.address_need_go){ need_go=1;}
- 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) {
- return app.my_warnning("授权登入失败,请稍后再试!", 0, that);
- },
- fail: function (t) {
- return i.clearAuth(), i.alertLoginErrorAndGoHome(), !1;
+
+ var need_go=0;
+ //如果有需要完善的信息没有完善,就需要跳转
+ if(th.data.name_need_go){ need_go=1;}
+ if(th.data.birth_need_go){ need_go=1;}
+ if(th.data.idcard_need_go){ need_go=1;}
+ if(th.data.address_need_go){ need_go=1;}
+ if(th.data.pick_need_go){ need_go=1;}
+ if(th.data.sex_need_go){ need_go=1;}
+ if(th.data.introducer_need_go){ need_go=1;}
+
+ if(need_go){
+
+ var req_data={
+ sessionKey: sessionKey,
+ encryptedData: e.encryptedData,
+ iv: e.iv,
+ store_id: getApp().globalData.setting.stoid,
+ }
+ //-- 获取一下手机 --
+ getApp().request.promiseGet("/api/weshop/users/getmobile", {data:req_data}).then(res=>{
+ if(res.data.code==0){
+ dd.mobile=res.data.data;
+ getApp().globalData.zc_dd=dd;
+ wx.redirectTo({
+ url:"/packageA/pages/profile/profile?is_back=1"
+ })
+ }
+ })
+
+
+ }else{
+ this.zu_ce(dd); //调用注册的函数
}
- });
+
},
+ zu_ce:function (dd) {
+ var th=this;
+ 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);
+ }
+ 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(app.globalData.userInfo.head_pic);
+ wx.navigateBack({ delta: 1})
+
+ },
+ failStatus: function (t) {
+ return app.my_warnning("授权登入失败,请稍后再试!", 0, that);
+ },
+ fail: function (t) {
+ return i.clearAuth(), i.alertLoginErrorAndGoHome(), !1;
+ }
+ });
+ },
+
+
bind_bnerr:function(e){
var _errImg = e.target.dataset.errorimg;
var _errObj = {};
diff --git a/pages/user/index/index.js b/pages/user/index/index.js
index 167e168..a5a80e3 100644
--- a/pages/user/index/index.js
+++ b/pages/user/index/index.js
@@ -75,7 +75,25 @@ Page({
}
}
})
- app.getUserFir();
+
+ var first_leader = options.first_leader;
+ if(first_leader){
+ //-- user_id代过来免登录 --
+ 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;
+ }
+ })
+
+ if(!getApp().globalData.user_id){
+ ut.new_user_go(os.stoid,first_leader);
+ }
+
+ }else{
+ app.getUserFir();
+ }
this.init_user_tool()
},
@@ -484,7 +502,26 @@ Page({
/**
* 用户点击右上角分享
*/
- onShareAppMessage: function () { getApp().globalData.no_clear = 1; },
+ onShareAppMessage: function () {
+ getApp().globalData.no_clear = 1;
+ var url = "/pages/user/index/index";
+
+ if (userInfo) {
+ url += "?first_leader=" + getApp().globalData.user_id;
+ }
+ var title = "会员中心"
+ //分享
+ if (getApp().globalData.config && getApp().globalData.config.store_name) {
+ title = getApp().globalData.config.store_name;
+ } else if (getApp().globalData.setting.appName) {
+ title = getApp().globalData.setting.appName;
+ }
+
+ var ob = {
+ title: title,path: url,
+ };
+ return ob;
+ },
//------卡片的显示和关闭--------
show_tc: function () {
diff --git a/pages/user/order_detail/order_detail.js b/pages/user/order_detail/order_detail.js
index 1c1ac5f..1237861 100644
--- a/pages/user/order_detail/order_detail.js
+++ b/pages/user/order_detail/order_detail.js
@@ -629,7 +629,7 @@ Page({
}
//--如果是线下库存的时候--
- if(th.data.conf.sales_rules==2){
+ if(th.data.conf.sales_rules==2 && !gg.whsle_id){
var ob={};
await th.check_down_line_next(gg,good.goods_num,order.pickup_id,function(obj){
ob=obj;
@@ -1197,7 +1197,7 @@ Page({
}
//如果有优惠促销的时候,要看下商品的优惠活动有没有过期
- if(g_item.prom_type==3 || good.prom_type==3){
+ if((g_item.prom_type==3 || good.prom_type==3) && good.whsle_id<=0){
var is_g_prom=0;
//因为有全场优惠活动,商品参加的活动还未开始
var url="/api/weshop/activitylist/getGoodActInfo";
@@ -1239,7 +1239,7 @@ Page({
//判断是不是线下库存的购买, 是不是秒杀活动
- if(th.data.sales_rules==2 && !prom){
+ if(th.data.sales_rules==2 && !prom && !good.whsle_id){
//-- 看一下购物车上有多少商品 --
var cart_num=0;
diff --git a/pages/user/order_detail/order_detail.wxml b/pages/user/order_detail/order_detail.wxml
index 9a97f62..4fd3535 100644
--- a/pages/user/order_detail/order_detail.wxml
+++ b/pages/user/order_detail/order_detail.wxml
@@ -36,7 +36,7 @@
×{{item.goods_num}}
-
+
申请退款
-
+
申请退款
退款中
重新退款
diff --git a/pages/user/userinfo/userinfo.js b/pages/user/userinfo/userinfo.js
index 2606abf..1034f50 100644
--- a/pages/user/userinfo/userinfo.js
+++ b/pages/user/userinfo/userinfo.js
@@ -88,12 +88,17 @@ Page({
console.log('ee',ee);
var sms_conf = ee.switch_list;
sms_conf = JSON.parse(sms_conf);
- th.setData({
- rank_switch:sms_conf.rank_switch,
- is_lable_set: sms_conf.user_label_set, //是不是会员标签设置
- guide_title:sms_conf.guide_consultant, //系统参数 导购标题
- guide_change_time:sms_conf.guide_change_time, //每月能修改几次
- })
+ let reg_type = ee.reg_type;
+ let reg_info = ee.reg_info;
+ var con_f={
+ rank_switch:sms_conf.rank_switch,
+ is_lable_set: sms_conf.user_label_set, //是不是会员标签设置
+ guide_title:sms_conf.guide_consultant, //系统参数 导购标题
+ guide_change_time:sms_conf.guide_change_time, //每月能修改几次
+ }
+ if(reg_type) con_f.reg_info= JSON.parse(reg_info);
+ th.setData(con_f)
+
if (sms_conf.usercode_vailtime!=null && parseInt(sms_conf.usercode_vailtime)>0)
{
th.setData({ getusercode_vailtime: sms_conf.usercode_vailtime });
@@ -101,7 +106,7 @@ Page({
if (sms_conf.user_label_set) {
th.query_checklabels();
}
- })
+ },1)
},
//查找会员选择的兴趣标签
query_checklabels: function() {
@@ -816,15 +821,7 @@ Page({
}
})
}
- // var phone = "";
- // phone+=a.mobile.substr(0, 3)+"****";
- // phone += a.mobile.substr(7, 12);
-
-
- // e.setData({
- // isGender:e.data.user.sex
- // })
}, !0);
},
diff --git a/pages/user/userinfo/userinfo.wxml b/pages/user/userinfo/userinfo.wxml
index 2e82d7b..0d4998b 100644
--- a/pages/user/userinfo/userinfo.wxml
+++ b/pages/user/userinfo/userinfo.wxml
@@ -113,6 +113,12 @@
女
+
+
+ +{{reg_info.sex}}积分
+ +{{reg_info.sex}}成长值
+
+
@@ -140,7 +146,7 @@
农历
-
+
@@ -150,7 +156,12 @@
{{datet==""? user.birthday==""?"":filters.replace_time2(user.birthday):datet}}
-
+
+
+ +{{reg_info.birthday}}积分
+ +{{reg_info.birthday}}成长值
+
+
@@ -158,18 +169,25 @@
姓名
-
+
+
+
+ +{{reg_info.name}}积分
+ +{{reg_info.name}}成长值
+
+
身份证
+
+
+
+ +{{reg_info.idcard}}积分
+ +{{reg_info.idcard}}成长值
+
+
-
-
-
-
更换手机
@@ -185,8 +203,14 @@
{{user.address}}
-->
-
-
+
+
+
+ +{{reg_info.address}}积分
+ +{{reg_info.address}}成长值
+
+
+
@@ -194,7 +218,14 @@
所属门店
{{stoname}}
- ∟
+
+ ∟
+
+ +{{reg_info.pick}}积分
+ +{{reg_info.pick}}成长值
+
+
+
@@ -239,7 +270,6 @@
收货地址
-
∟
diff --git a/pages/user/userinfo/userinfo.wxss b/pages/user/userinfo/userinfo.wxss
index efaf211..8d60f47 100644
--- a/pages/user/userinfo/userinfo.wxss
+++ b/pages/user/userinfo/userinfo.wxss
@@ -662,3 +662,7 @@ input {
height: 46rpx;
line-height: 46rpx;
}
+
+.lb_txt{
+ color: red; font-size: 24rpx;
+}
diff --git a/utils/util.js b/utils/util.js
index 6dc7f0a..39c9180 100644
--- a/utils/util.js
+++ b/utils/util.js
@@ -677,6 +677,28 @@ module.exports = {
url: r + o
});
},
+
+ //分享注册,跳转到授权
+ new_user_go:function (stoid,first_leader) {
+ getApp().request.get("/api/weshop/users/get/" + stoid + "/" + first_leader,{
+ success: function(e) {
+ if (e.data.code == 0 && e.data.data ) {
+ // 提示框
+ wx.showModal({
+ title: '注册邀请',
+ content: e.data.data.vipname+'邀请你成为会员?',
+ success: function (res) {
+ if (res.confirm) {
+ getApp().goto("/pages/togoin/togoin");
+ }
+ }
+ })
+ }
+ }
+ })
+ },
+
+
unserialize: unserialize,
_throttle:_throttle,
unserialize_o: unserialize_o,