Commit 4d84cc0b by 谢中龙

抵用券优惠之后金额为负数

parent 2029db4c
...@@ -23,10 +23,10 @@ wxService.page({ ...@@ -23,10 +23,10 @@ wxService.page({
noSelectPrice: '', noSelectPrice: '',
plusSpread: '', plusSpread: '',
goodsAddress: false, goodsAddress: false,
uAddress : { uAddress: {
name : '', name: '',
phone : '', phone: '',
address : '', address: '',
}, },
citys: null, citys: null,
cityView: '', cityView: '',
...@@ -43,8 +43,8 @@ wxService.page({ ...@@ -43,8 +43,8 @@ wxService.page({
defalutCouponId: '', // 默认第一项 defalutCouponId: '', // 默认第一项
addressId: '', // 收货地址id addressId: '', // 收货地址id
totalGoodsPrice: 0, totalGoodsPrice: 0,
buyerRemark: '',//备注信息 buyerRemark: '', //备注信息
currentType: 'delivery',//delivery 快递 selfPickUp 门店自提 currentType: 'delivery', //delivery 快递 selfPickUp 门店自提
storeInfo: { storeInfo: {
storeName: '', storeName: '',
storeId: '', storeId: '',
...@@ -52,18 +52,18 @@ wxService.page({ ...@@ -52,18 +52,18 @@ wxService.page({
storeCode: '' storeCode: ''
}, },
orderStoreInfo: null, orderStoreInfo: null,
couponDiscountPreviews : [], couponDiscountPreviews: [],
}, },
/** /**
* 生命周期函数--监听页面加载 * 生命周期函数--监听页面加载
*/ */
onLoad: function (options) { onLoad: function(options) {
wx.hideShareMenu(); wx.hideShareMenu();
this.getMyLocationInfo(); this.getMyLocationInfo();
}, },
//输入 //输入
onInput(e){ onInput(e) {
let key = e.target.dataset.name; let key = e.target.dataset.name;
let value = e.detail.value; let value = e.detail.value;
this.data.uAddress[key] = value; this.data.uAddress[key] = value;
...@@ -116,10 +116,12 @@ wxService.page({ ...@@ -116,10 +116,12 @@ wxService.page({
/** /**
* 生命周期函数--监听页面显示 * 生命周期函数--监听页面显示
*/ */
onShow: function () { onShow: function() {
let pages = getCurrentPages(); let pages = getCurrentPages();
let currPage = pages[pages.length - 1]; let currPage = pages[pages.length - 1];
const { trolleySku2Buy } = this.options; const {
trolleySku2Buy
} = this.options;
let tradeDto = { let tradeDto = {
trolleySku2Buy: JSON.parse(trolleySku2Buy) trolleySku2Buy: JSON.parse(trolleySku2Buy)
} }
...@@ -132,8 +134,7 @@ wxService.page({ ...@@ -132,8 +134,7 @@ wxService.page({
// 地址列表 // 地址列表
if (this.data.currentType == 'delivery') { if (this.data.currentType == 'delivery') {
this.getAddressList() this.getAddressList()
} } else {
else {
// 获取本地选择的门店信息 // 获取本地选择的门店信息
this.getLocalStoreInfo(); this.getLocalStoreInfo();
} }
...@@ -171,8 +172,7 @@ wxService.page({ ...@@ -171,8 +172,7 @@ wxService.page({
this.data.storeInfo.storeName = storeInfo.name; this.data.storeInfo.storeName = storeInfo.name;
this.data.storeInfo.storeAddress = storeInfo.storeFullAddress; this.data.storeInfo.storeAddress = storeInfo.storeFullAddress;
this.data.storeInfo.storeCode = storeInfo.code; this.data.storeInfo.storeCode = storeInfo.code;
} } else {
else {
this.data.storeInfo = { this.data.storeInfo = {
storeName: '', storeName: '',
storeId: '', storeId: '',
...@@ -185,9 +185,17 @@ wxService.page({ ...@@ -185,9 +185,17 @@ wxService.page({
storeInfo: this.data.storeInfo storeInfo: this.data.storeInfo
}); });
const { memberId } = wx.getStorageSync('_baseUserInfo'); const {
const { trolleySku2Buy, checkByPremium } = this.data; memberId
let params = { checkByPremium, trolleySku2Buy }; } = wx.getStorageSync('_baseUserInfo');
const {
trolleySku2Buy,
checkByPremium
} = this.data;
let params = {
checkByPremium,
trolleySku2Buy
};
params.orderType = 4; params.orderType = 4;
params.storeId = this.data.storeInfo.storeId; params.storeId = this.data.storeInfo.storeId;
this.calPreferentialPrice(params) this.calPreferentialPrice(params)
...@@ -202,8 +210,7 @@ wxService.page({ ...@@ -202,8 +210,7 @@ wxService.page({
if (type == 'delivery') { if (type == 'delivery') {
this.getAddressList() this.getAddressList()
} } else {
else {
this.getLocalStoreInfo(); this.getLocalStoreInfo();
} }
}, },
...@@ -225,7 +232,7 @@ wxService.page({ ...@@ -225,7 +232,7 @@ wxService.page({
// faceAmount 抵用多少钱(分) 1 抵用券 2 折扣券 3 定额券 // faceAmount 抵用多少钱(分) 1 抵用券 2 折扣券 3 定额券
if (!e.detail) { if (!e.detail) {
this.setData({ this.setData({
useNotUserCoupon : true, useNotUserCoupon: true,
defalutCoupon: 0, defalutCoupon: 0,
couponId: '', couponId: '',
couponSettingId: '', couponSettingId: '',
...@@ -237,9 +244,19 @@ wxService.page({ ...@@ -237,9 +244,19 @@ wxService.page({
}); });
return return
} }
const { faceAmount, type, id, couponDiscount, sid } = e.detail const {
const { defalutCouponId } = this.data faceAmount,
const { orderPrice } = this.data type,
id,
couponDiscount,
sid
} = e.detail
const {
defalutCouponId
} = this.data
const {
orderPrice
} = this.data
// couponId---id couponSettingId --sid // couponId---id couponSettingId --sid
let finCouponId = id ? id : sid let finCouponId = id ? id : sid
let finCouponName = id ? 'couponId' : 'couponSettingId'; let finCouponName = id ? 'couponId' : 'couponSettingId';
...@@ -252,7 +269,7 @@ wxService.page({ ...@@ -252,7 +269,7 @@ wxService.page({
// couponId: id, // couponId: id,
haveCoupon: true, haveCoupon: true,
currentCoupon: `${parseFloat(faceAmount/10/10).toFixed(2)} 元` currentCoupon: `${parseFloat(faceAmount/10/10).toFixed(2)} 元`
},() => { }, () => {
this.reCallPreview(); this.reCallPreview();
}) })
} else if (type == 2) { } else if (type == 2) {
...@@ -266,11 +283,10 @@ wxService.page({ ...@@ -266,11 +283,10 @@ wxService.page({
// couponId: id, // couponId: id,
haveCoupon: true, haveCoupon: true,
currentCoupon: `${couponDiscount} 元` currentCoupon: `${couponDiscount} 元`
},() => { }, () => {
this.reCallPreview(); this.reCallPreview();
}); });
} } else if (type == 3) { //定额券
else if(type == 3){ //定额券
this.setData({ this.setData({
defalutCoupon: true, defalutCoupon: true,
...@@ -279,7 +295,7 @@ wxService.page({ ...@@ -279,7 +295,7 @@ wxService.page({
[finCouponName]: finCouponId, [finCouponName]: finCouponId,
haveCoupon: true, haveCoupon: true,
currentCoupon: `${couponDiscount} 元` currentCoupon: `${couponDiscount} 元`
},() => { }, () => {
this.reCallPreview(); this.reCallPreview();
}) })
} }
...@@ -288,17 +304,24 @@ wxService.page({ ...@@ -288,17 +304,24 @@ wxService.page({
this.setPayPrice(); this.setPayPrice();
}, },
setPayPrice() { setPayPrice() {
const { currentCoupon, orderInitPrice, isSelect, plusMemberPrice, defalutCoupon } = this.data const {
currentCoupon,
orderInitPrice,
isSelect,
plusMemberPrice,
defalutCoupon
} = this.data
let newCurrentCoupon = currentCoupon ? currentCoupon : 0 let newCurrentCoupon = currentCoupon ? currentCoupon : 0
let orderCoupon = parseFloat(newCurrentCoupon) // 优惠券价格 let orderCoupon = parseFloat(newCurrentCoupon) // 优惠券价格
let plusPrice = isSelect ? plusMemberPrice : 0 // plus let plusPrice = isSelect ? plusMemberPrice : 0 // plus
let calCouponPrice = orderCoupon ? orderCoupon : defalutCoupon let calCouponPrice = orderCoupon ? orderCoupon : defalutCoupon
//获取计算优惠后的价格
let promotionPrice = (orderInitPrice - calCouponPrice) > 0 ? (orderInitPrice - calCouponPrice) : 0;
// 实际价格 - 优惠价 + plus // 实际价格 - 优惠价 + plus
this.setData({ this.setData({
// orderPrice: Math.round(orderInitPrice - orderCoupon) // orderPrice: Math.round(orderInitPrice - orderCoupon)
// orderPrice: orderInitPrice - orderCoupon + plusPrice // orderPrice: orderInitPrice - orderCoupon + plusPrice
orderPrice: orderInitPrice - calCouponPrice + plusPrice orderPrice: promotionPrice + plusPrice
}) })
}, },
//提交按钮 //提交按钮
...@@ -322,12 +345,11 @@ wxService.page({ ...@@ -322,12 +345,11 @@ wxService.page({
showCancel: true, showCancel: true,
confirmText: '确定', confirmText: '确定',
confirmColor: '#cb3c3c', confirmColor: '#cb3c3c',
success: function (res) { success: function(res) {
if (res.confirm) { if (res.confirm) {
//跳去开卡 //跳去开卡
wxService.openCard(); wxService.openCard();
} } else if (res.cancel) {
else if (res.cancel) {
} }
} }
...@@ -338,7 +360,9 @@ wxService.page({ ...@@ -338,7 +360,9 @@ wxService.page({
} }
//判断是不是快递配送 //判断是不是快递配送
if (this.data.currentType == 'delivery') { if (this.data.currentType == 'delivery') {
const { goodsAddress } = this.data const {
goodsAddress
} = this.data
// 保存地址 && 支付 // 保存地址 && 支付
if (goodsAddress) { if (goodsAddress) {
if (!this.data.uAddress.name) { if (!this.data.uAddress.name) {
...@@ -370,7 +394,9 @@ wxService.page({ ...@@ -370,7 +394,9 @@ wxService.page({
return false; return false;
} }
const { memberId } = wx.getStorageSync('_baseUserInfo') const {
memberId
} = wx.getStorageSync('_baseUserInfo')
this.setData({ this.setData({
params: { params: {
userId: memberId, userId: memberId,
...@@ -389,7 +415,9 @@ wxService.page({ ...@@ -389,7 +415,9 @@ wxService.page({
}); });
wxService.post(`/member/addressManage/save`, this.data.params).then(res => { wxService.post(`/member/addressManage/save`, this.data.params).then(res => {
const { result } = res.data const {
result
} = res.data
if (result == 0) { if (result == 0) {
wx.hideLoading() wx.hideLoading()
wx.showToast({ wx.showToast({
...@@ -411,8 +439,7 @@ wxService.page({ ...@@ -411,8 +439,7 @@ wxService.page({
// 调起支付 // 调起支付
this.handelGobuy() this.handelGobuy()
} }
} } else {
else {
this.handelGobuy() this.handelGobuy()
} }
}, },
...@@ -422,8 +449,7 @@ wxService.page({ ...@@ -422,8 +449,7 @@ wxService.page({
if (envInfo.brandId == 2010) { if (envInfo.brandId == 2010) {
//由于地址框太大了,现在先用热风的一个 //由于地址框太大了,现在先用热风的一个
cityData = city.default; cityData = city.default;
} } else {
else {
cityData = city.default; cityData = city.default;
} }
...@@ -511,7 +537,9 @@ wxService.page({ ...@@ -511,7 +537,9 @@ wxService.page({
this.setData({ this.setData({
isSelect: !this.data.isSelect isSelect: !this.data.isSelect
}, () => { }, () => {
const { isSelect } = this.data const {
isSelect
} = this.data
this.setData({ this.setData({
checkByPremium: isSelect, checkByPremium: isSelect,
defalutCoupon: 0, defalutCoupon: 0,
...@@ -532,7 +560,10 @@ wxService.page({ ...@@ -532,7 +560,10 @@ wxService.page({
}) })
wxService.get(`/sale/premium/getDefault`).then(res => { wxService.get(`/sale/premium/getDefault`).then(res => {
if (res) { if (res) {
const { result, data } = res.data const {
result,
data
} = res.data
if (result == 0) { if (result == 0) {
wx.hideLoading() wx.hideLoading()
this.setData({ this.setData({
...@@ -552,7 +583,12 @@ wxService.page({ ...@@ -552,7 +583,12 @@ wxService.page({
}, },
//拼接字段重新调用preview //拼接字段重新调用preview
reCallPreview() { reCallPreview() {
const { trolleySku2Buy, checkByPremium, addressId, addressInfo } = this.data const {
trolleySku2Buy,
checkByPremium,
addressId,
addressInfo
} = this.data
let params = { let params = {
checkByPremium, checkByPremium,
...@@ -563,8 +599,7 @@ wxService.page({ ...@@ -563,8 +599,7 @@ wxService.page({
if (this.data.currentType == 'delivery') { if (this.data.currentType == 'delivery') {
params.addressId = addressId ? addressId : addressInfo.id // 微信地址 or 地址id params.addressId = addressId ? addressId : addressInfo.id // 微信地址 or 地址id
params.orderType = 1; params.orderType = 1;
} } else {
else {
params.orderType = 4; params.orderType = 4;
params.storeId = this.data.storeInfo.storeId; params.storeId = this.data.storeInfo.storeId;
} }
...@@ -580,13 +615,16 @@ wxService.page({ ...@@ -580,13 +615,16 @@ wxService.page({
}); });
//如果有couponId需要在预览接口传过去 //如果有couponId需要在预览接口传过去
if (this.data.couponId){ if (this.data.couponId) {
params.couponId = this.data.couponId; params.couponId = this.data.couponId;
} }
wxService.post(`/sale/trade/buyer/preview`, params).then(res => { wxService.post(`/sale/trade/buyer/preview`, params).then(res => {
if (res) { if (res) {
const { result, data } = res.data const {
result,
data
} = res.data
if (result == 0) { if (result == 0) {
wx.hideLoading() wx.hideLoading()
let skuList = data.tradePreviewSkus; let skuList = data.tradePreviewSkus;
...@@ -598,7 +636,9 @@ wxService.page({ ...@@ -598,7 +636,9 @@ wxService.page({
this.data.totalGoodsPrice = sum; this.data.totalGoodsPrice = sum;
// 初始化商品价格 // 初始化商品价格
const { isSelect } = this.data const {
isSelect
} = this.data
if (isSelect) { if (isSelect) {
this.setData({ this.setData({
...@@ -611,7 +651,7 @@ wxService.page({ ...@@ -611,7 +651,7 @@ wxService.page({
} }
//如果没有couponId则认为是第一次进来没有自己选择优惠券 //如果没有couponId则认为是第一次进来没有自己选择优惠券
if (!this.data.couponId) { if (!this.data.couponId) {
if(!this.data.useNotUserCoupon){ if (!this.data.useNotUserCoupon) {
//获取优惠券信息 //获取优惠券信息
let defalutCoupon = data && data.couponDiscountPreviews.length && let defalutCoupon = data && data.couponDiscountPreviews.length &&
data.couponDiscountPreviews[0].couponSettingDTO.type == 1 ? data.couponDiscountPreviews[0].couponSettingDTO.type == 1 ?
...@@ -642,7 +682,7 @@ wxService.page({ ...@@ -642,7 +682,7 @@ wxService.page({
}) })
} }
//用户取消使用优惠券 //用户取消使用优惠券
else{ else {
this.setData({ this.setData({
currentOrderList: data, currentOrderList: data,
orderInitPrice: data.amount, orderInitPrice: data.amount,
...@@ -652,8 +692,7 @@ wxService.page({ ...@@ -652,8 +692,7 @@ wxService.page({
this.setPayPrice() this.setPayPrice()
}) })
} }
} } else {
else{
//重新调用之后 不刷新优惠券列表 //重新调用之后 不刷新优惠券列表
this.setData({ this.setData({
currentOrderList: data, currentOrderList: data,
...@@ -723,8 +762,7 @@ wxService.page({ ...@@ -723,8 +762,7 @@ wxService.page({
}) })
return; return;
} }
} } else {
else {
params.orderType = 4; params.orderType = 4;
params.storeId = this.data.storeInfo.storeId; params.storeId = this.data.storeInfo.storeId;
params.storeCode = this.data.storeInfo.storeCode; params.storeCode = this.data.storeInfo.storeCode;
...@@ -747,7 +785,9 @@ wxService.page({ ...@@ -747,7 +785,9 @@ wxService.page({
title: '正在下单..' title: '正在下单..'
}); });
const { isSelect } = this.data; const {
isSelect
} = this.data;
//增加订单备注信息 //增加订单备注信息
params.buyerRemark = this.data.buyerRemark; params.buyerRemark = this.data.buyerRemark;
//下单之前先做校验 //下单之前先做校验
...@@ -756,8 +796,7 @@ wxService.page({ ...@@ -756,8 +796,7 @@ wxService.page({
let data = result.data.data ? result.data.data : []; let data = result.data.data ? result.data.data : [];
if (data.length == 0) { if (data.length == 0) {
this.order(isSelect, params); this.order(isSelect, params);
} } else {
else {
//有商品限购了,组织提示语 //有商品限购了,组织提示语
let tips = '根据限购规则以下商品限购:\r\n'; let tips = '根据限购规则以下商品限购:\r\n';
let tempObj = data[0]; let tempObj = data[0];
...@@ -803,14 +842,17 @@ wxService.page({ ...@@ -803,14 +842,17 @@ wxService.page({
let url = isSelect ? '/sale/payment/merged/buyer/bill' : '/sale/trade/buyer/bill' let url = isSelect ? '/sale/payment/merged/buyer/bill' : '/sale/trade/buyer/bill'
wxService.post(`${url}`, params).then(res => { wxService.post(`${url}`, params).then(res => {
if (res) { if (res) {
const { result, data } = res.data const {
result,
data
} = res.data
let tradeId = data.tradeId; let tradeId = data.tradeId;
wx.removeStorageSync('choosedStoreInfo'); wx.removeStorageSync('choosedStoreInfo');
wx.removeStorageSync('orderRemark'); wx.removeStorageSync('orderRemark');
if (result == 0) { if (result == 0) {
delete data.appId delete data.appId
let amount = data.amount || 0; let amount = data.amount || 0;
if(amount > 0){ if (amount > 0) {
wx.requestPayment(Object.assign({ wx.requestPayment(Object.assign({
success(res) { success(res) {
wx.hideLoading() wx.hideLoading()
...@@ -823,11 +865,11 @@ wxService.page({ ...@@ -823,11 +865,11 @@ wxService.page({
}).then(res => { }).then(res => {
let tempArr = res.data.data ? res.data.data : []; let tempArr = res.data.data ? res.data.data : [];
let currentType = _this.data.currentType; let currentType = _this.data.currentType;
if (tempArr.length == 0){ if (tempArr.length == 0) {
wx.redirectTo({ wx.redirectTo({
url: `/subPackage/page/pages/paymentStatus/paymentStatus?status=S&amount=${amount}&type=${currentType}`, url: `/subPackage/page/pages/paymentStatus/paymentStatus?status=S&amount=${amount}&type=${currentType}`,
}); });
return ; return;
} }
let tempids = []; let tempids = [];
...@@ -837,17 +879,17 @@ wxService.page({ ...@@ -837,17 +879,17 @@ wxService.page({
wx.requestSubscribeMessage({ wx.requestSubscribeMessage({
tmplIds: tempids, tmplIds: tempids,
success: (res)=>{ success: (res) => {
for(let i = 0; i < tempArr.length; i++){ for (let i = 0; i < tempArr.length; i++) {
wxService.post(`${'/merchant/message/wxSubMsgSubscride/member/subscribe'}`, { wxService.post(`${'/merchant/message/wxSubMsgSubscride/member/subscribe'}`, {
businessId: tradeId, businessId: tradeId,
memberId: baseUserInfo.memberId, memberId: baseUserInfo.memberId,
scenarioId:tempArr[i].scenarioId, scenarioId: tempArr[i].scenarioId,
templateId: tempArr[i].templateId templateId: tempArr[i].templateId
}).then(resp => {}); }).then(resp => {});
} }
}, },
complete: (res)=>{ complete: (res) => {
wx.redirectTo({ wx.redirectTo({
url: `/subPackage/page/pages/paymentStatus/paymentStatus?status=S&amount=${amount}&type=${currentType}`, url: `/subPackage/page/pages/paymentStatus/paymentStatus?status=S&amount=${amount}&type=${currentType}`,
}); });
...@@ -870,22 +912,19 @@ wxService.page({ ...@@ -870,22 +912,19 @@ wxService.page({
wx.redirectTo({ wx.redirectTo({
url: '/pages/order/order', url: '/pages/order/order',
}); });
} } else {
else {
wx.redirectTo({ wx.redirectTo({
url: '/subPackage/page/pages/selfPickUpOrderList/selfPickUpOrderList', url: '/subPackage/page/pages/selfPickUpOrderList/selfPickUpOrderList',
}); });
} }
} }
}, data.wxParams)); }, data.wxParams));
} } else {
else{
if (_this.data.currentType == 'delivery') { if (_this.data.currentType == 'delivery') {
wx.redirectTo({ wx.redirectTo({
url: '/pages/order/order', url: '/pages/order/order',
}); });
} } else {
else {
wx.redirectTo({ wx.redirectTo({
url: '/subPackage/page/pages/selfPickUpOrderList/selfPickUpOrderList', url: '/subPackage/page/pages/selfPickUpOrderList/selfPickUpOrderList',
}); });
...@@ -901,9 +940,17 @@ wxService.page({ ...@@ -901,9 +940,17 @@ wxService.page({
}, },
// 获取地址列表 // 获取地址列表
getAddressList() { getAddressList() {
const { memberId } = wx.getStorageSync('_baseUserInfo'); const {
const { trolleySku2Buy, checkByPremium } = this.data; memberId
let params = { checkByPremium, trolleySku2Buy }; } = wx.getStorageSync('_baseUserInfo');
const {
trolleySku2Buy,
checkByPremium
} = this.data;
let params = {
checkByPremium,
trolleySku2Buy
};
params.orderType = 1; params.orderType = 1;
wxService.post(`/member/addressManage/getall`, { wxService.post(`/member/addressManage/getall`, {
...@@ -911,7 +958,10 @@ wxService.page({ ...@@ -911,7 +958,10 @@ wxService.page({
}).then(res => { }).then(res => {
if (!res) return false; if (!res) return false;
let hasDefalut = wx.getStorageSync('_defalutAddress'); let hasDefalut = wx.getStorageSync('_defalutAddress');
let { result, data } = res.data let {
result,
data
} = res.data
if (result == 0) { if (result == 0) {
//看看本地是不是有已经选择的地址了 //看看本地是不是有已经选择的地址了
if (!hasDefalut) { // 无 if (!hasDefalut) { // 无
...@@ -936,16 +986,14 @@ wxService.page({ ...@@ -936,16 +986,14 @@ wxService.page({
addressId: this.data.addressId, addressId: this.data.addressId,
goodsAddress: params.addressId ? false : true, goodsAddress: params.addressId ? false : true,
}); });
} } else { // 有已经选择的地址了
else { // 有已经选择的地址了
let defaultInAddressList = null; let defaultInAddressList = null;
//判断地址列表中是不是已经把这个地址删除了 //判断地址列表中是不是已经把这个地址删除了
let id = hasDefalut.id; let id = hasDefalut.id;
let filterArr = data.filter(item => item.id == id); let filterArr = data.filter(item => item.id == id);
if (filterArr.length > 0) { if (filterArr.length > 0) {
defaultInAddressList = hasDefalut defaultInAddressList = hasDefalut
} } else { // 无
else { // 无
//此时已经没有 看看是不是有默认地址 有则默认选中 //此时已经没有 看看是不是有默认地址 有则默认选中
data = data ? data : []; data = data ? data : [];
data.forEach(item => { data.forEach(item => {
...@@ -975,11 +1023,13 @@ wxService.page({ ...@@ -975,11 +1023,13 @@ wxService.page({
this.calPreferentialPrice(params) this.calPreferentialPrice(params)
} }
}).finally(() => { }); }).finally(() => {});
}, },
//获取微信地址 //获取微信地址
chooseWxAddress() { chooseWxAddress() {
const { memberId } = wx.getStorageSync('_baseUserInfo') const {
memberId
} = wx.getStorageSync('_baseUserInfo')
wx.chooseAddress({ wx.chooseAddress({
success: (res) => { success: (res) => {
res.name = res.userName res.name = res.userName
...@@ -1006,7 +1056,10 @@ wxService.page({ ...@@ -1006,7 +1056,10 @@ wxService.page({
}); });
wxService.post(`/member/addressManage/save`, this.data.params).then(res => { wxService.post(`/member/addressManage/save`, this.data.params).then(res => {
const { result, data } = res.data const {
result,
data
} = res.data
if (result == 0) { if (result == 0) {
wx.hideLoading(); wx.hideLoading();
this.data.addressInfo.fullArea = this.data.addressInfo.provinceName + ' ' + this.data.addressInfo.fullArea = this.data.addressInfo.provinceName + ' ' +
...@@ -1025,7 +1078,7 @@ wxService.page({ ...@@ -1025,7 +1078,7 @@ wxService.page({
wx.hideLoading() wx.hideLoading()
}) })
}, },
fail: function (err) { fail: function(err) {
console.log(err) console.log(err)
} }
}) })
...@@ -1038,29 +1091,27 @@ wxService.page({ ...@@ -1038,29 +1091,27 @@ wxService.page({
}) })
}, },
//校验地址库 原因是地址库发生过改变 老用户之前维护过地址 但是地址可能对不上影响邮费 若发现地址不对这里强制提示用户去更新 //校验地址库 原因是地址库发生过改变 老用户之前维护过地址 但是地址可能对不上影响邮费 若发现地址不对这里强制提示用户去更新
validateAddress(){ validateAddress() {
if (this.data.addressId){ if (this.data.addressId) {
let province = this.data.addressInfo.province, let province = this.data.addressInfo.province,
cityName = this.data.addressInfo.city, cityName = this.data.addressInfo.city,
district = this.data.addressInfo.district; district = this.data.addressInfo.district;
let defaultCities = city.default; let defaultCities = city.default;
//先处理省份 //先处理省份
let filterProvince = defaultCities.filter(item => item.value == province); let filterProvince = defaultCities.filter(item => item.value == province);
if(filterProvince.length == 0){ if (filterProvince.length == 0) {
//省份地址维护不对 提示用户去改 //省份地址维护不对 提示用户去改
this.showEditAddressModal(this.data.addressId); this.showEditAddressModal(this.data.addressId);
} } else {
else{
//檢查市 //檢查市
let filterCity = filterProvince[0].children.filter(item => item.value == cityName); let filterCity = filterProvince[0].children.filter(item => item.value == cityName);
if (filterCity.length == 0){ if (filterCity.length == 0) {
//市维护的地址不对 提示用户去修改 //市维护的地址不对 提示用户去修改
this.showEditAddressModal(this.data.addressId); this.showEditAddressModal(this.data.addressId);
} } else {
else{
//检查区是否正确 //检查区是否正确
let filterDistinct = filterCity[0].children.filter(item => item.value == district); let filterDistinct = filterCity[0].children.filter(item => item.value == district);
if (filterDistinct.length == 0){ if (filterDistinct.length == 0) {
//区维护的地址不对 提示用户去修改 //区维护的地址不对 提示用户去修改
this.showEditAddressModal(this.data.addressId); this.showEditAddressModal(this.data.addressId);
} }
...@@ -1069,7 +1120,7 @@ wxService.page({ ...@@ -1069,7 +1120,7 @@ wxService.page({
} }
}, },
//展示地址修改弹框 //展示地址修改弹框
showEditAddressModal(addressId){ showEditAddressModal(addressId) {
wx.showModal({ wx.showModal({
title: '地址更改提示', title: '地址更改提示',
content: `您好,因地址库的修改,您当前的收货地址需要重新编辑才可下单,请先编辑此地址。感谢您的配合~`, content: `您好,因地址库的修改,您当前的收货地址需要重新编辑才可下单,请先编辑此地址。感谢您的配合~`,
......
...@@ -4,10 +4,8 @@ ...@@ -4,10 +4,8 @@
<view class="page-confirm-order"> <view class="page-confirm-order">
<!-- 选择方式 --> <!-- 选择方式 -->
<view class="deliveryType" wx:if="{{isOpenSelfMention}}"> <view class="deliveryType" wx:if="{{isOpenSelfMention}}">
<view class="de-type-item {{currentType == 'delivery' ? 'active' : ''}}" <view class="de-type-item {{currentType == 'delivery' ? 'active' : ''}}" data-type="delivery" bindtap="onTapChangeType">快递配送</view>
data-type="delivery" bindtap="onTapChangeType">快递配送</view> <view class="de-type-item {{currentType == 'selfPickUp' ? 'active' : ''}}" data-type="selfPickUp" bindtap="onTapChangeType">门店自提</view>
<view class="de-type-item {{currentType == 'selfPickUp' ? 'active' : ''}}"
data-type="selfPickUp" bindtap="onTapChangeType">门店自提</view>
</view> </view>
<form> <form>
...@@ -15,55 +13,29 @@ ...@@ -15,55 +13,29 @@
<view class="address-wrap" wx:if="{{currentType == 'delivery'}}"> <view class="address-wrap" wx:if="{{currentType == 'delivery'}}">
<block wx:if="{{goodsAddress}}"> <block wx:if="{{goodsAddress}}">
<view class="address-section"> <view class="address-section">
<input class="address-input" name="name" <input class="address-input" name="name" data-name="name" value='{{uAddress.name}}' bindinput='onInput' placeholder="请输入收货人姓名" />
data-name="name" value='{{uAddress.name}}' <input class="address-input" name="phone" data-name="phone" bindinput='onInput' value='{{uAddress.phone}}' placeholder="请输入手机号码" />
bindinput='onInput'
placeholder="请输入收货人姓名" />
<input class="address-input" name="phone"
data-name="phone"
bindinput='onInput'
value='{{uAddress.phone}}'
placeholder="请输入手机号码" />
</view> </view>
<view class="address-section"> <view class="address-section">
<picker <picker class="address-input address-picker" mode="multiSelector" bindchange="bindMultiPickerChange" bindcolumnchange="bindMultiPickerColumnChange" value="{{multiIndex}}" range="{{citys}}">
class="address-input address-picker"
mode="multiSelector"
bindchange="bindMultiPickerChange"
bindcolumnchange="bindMultiPickerColumnChange"
value="{{multiIndex}}"
range="{{citys}}"
>
<view class="form-picker" style="padding-top: 8rpx;" wx:if="{{cityView}}"> <view class="form-picker" style="padding-top: 8rpx;" wx:if="{{cityView}}">
{{cityView}} {{cityView}}
</view> </view>
<view wx:if="{{!cityView}}"> <view wx:if="{{!cityView}}">
<input <input class='form-input' placeholder-class="placeholder-picker" style="padding-top: 8rpx;" type="text" disabled placeholder="所在区域" />
class='form-input'
placeholder-class="placeholder-picker"
style="padding-top: 8rpx;"
type="text"
disabled
placeholder="所在区域"
/>
</view> </view>
</picker> </picker>
</view> </view>
<view class="address-section"> <view class="address-section">
<input class="address-input address-detail" <input class="address-input address-detail" name="address" bindinput='onInput' data-name="address" value='{{uAddress.address}}' placeholder="请输入路名门牌号" />
name="address"
bindinput='onInput'
data-name="address"
value='{{uAddress.address}}'
placeholder="请输入路名门牌号" />
</view> </view>
</block> </block>
<block wx:if="{{!goodsAddress}}"> <block wx:if="{{!goodsAddress}}">
<view class="address-list" bindtap="selectAddress"> <view class="address-list" bindtap="selectAddress">
<view class="address-info"> <view class="address-info">
<view> <view>
<image class="defalut-add-img" <image class="defalut-add-img" src="{{addressInfo.type == 1 ? 'https://img3.bigaka.com/prd/3001/202003/20200309/3001f7a6186d-6882-422c-a77c-61b8291c091a.png' : 'https://img3.bigaka.com/prd/3001/202003/20200309/300129705d0a-bf5c-4b2f-aedd-0c3fc9f78ba1.png'}}"
src="{{addressInfo.type == 1 ? 'https://img3.bigaka.com/prd/3001/202003/20200309/3001f7a6186d-6882-422c-a77c-61b8291c091a.png' : 'https://img3.bigaka.com/prd/3001/202003/20200309/300129705d0a-bf5c-4b2f-aedd-0c3fc9f78ba1.png'}}" /> />
<text class="user-name">{{addressInfo.name}}</text> <text class="user-name">{{addressInfo.name}}</text>
<text class="phone-number">{{addressInfo.phone}}</text> <text class="phone-number">{{addressInfo.phone}}</text>
</view> </view>
...@@ -133,8 +105,7 @@ ...@@ -133,8 +105,7 @@
<view class="vip-info" wx:if="{{!isVip && plusIsOpen}}"> <view class="vip-info" wx:if="{{!isVip && plusIsOpen}}">
<view class="vip-left"> <view class="vip-left">
<view class="left-top"> <view class="left-top">
<image class="top-image" <image class="top-image" src="https://img3.bigaka.com/prd/3001/202003/20200309/3001a3933408-de10-4029-861f-f8fb5de26092.png" />
src="https://img3.bigaka.com/prd/3001/202003/20200309/3001a3933408-de10-4029-861f-f8fb5de26092.png" />
<text>现在勾选成为vip,享受更多优惠</text> <text>现在勾选成为vip,享受更多优惠</text>
</view> </view>
<view class="left-bottom"> <view class="left-bottom">
...@@ -147,7 +118,8 @@ ...@@ -147,7 +118,8 @@
<image class="check-status-img" src="{{isSelect ? '/assets/imgs/7_1_0/08_22/trade-success.png' : '/assets/imgs/7_1_0/08_22/trade-unsel.png'}}" /> <image class="check-status-img" src="{{isSelect ? '/assets/imgs/7_1_0/08_22/trade-success.png' : '/assets/imgs/7_1_0/08_22/trade-unsel.png'}}" />
</view> </view>
<view class="right-check-tips {{isSelect? 'tip-check' : 'tip-un-check'}}"> <view class="right-check-tips {{isSelect? 'tip-check' : 'tip-un-check'}}">
<image class="select-check-open {{isSelect? 'tip-check' : 'tip-un-check'}}" src="{{isSelect ? 'https://img3.bigaka.com/prd/3001/202003/20200309/3001ab6df057-e550-446c-a641-c5dcd8dbb51e.png' : 'https://img3.bigaka.com/prd/3001/202003/20200309/3001e6e3414a-3f8e-4100-b9da-7f852d842235.png'}}" /> <image class="select-check-open {{isSelect? 'tip-check' : 'tip-un-check'}}" src="{{isSelect ? 'https://img3.bigaka.com/prd/3001/202003/20200309/3001ab6df057-e550-446c-a641-c5dcd8dbb51e.png' : 'https://img3.bigaka.com/prd/3001/202003/20200309/3001e6e3414a-3f8e-4100-b9da-7f852d842235.png'}}"
/>
</view> </view>
</view> </view>
</view> </view>
...@@ -175,7 +147,7 @@ ...@@ -175,7 +147,7 @@
<!-- class='coupon-items' --> <!-- class='coupon-items' -->
<view bindtap="selectCoupon"> <view bindtap="selectCoupon">
<text class="price-label">优惠券</text> <text class="price-label">优惠券</text>
<view class="select-coupon" > <view class="select-coupon">
<text class="{{defalutCoupon ? 'coupon-price' : 'no-coupon'}}">{{defalutCoupon ? (currentCoupon ? '-' + currentCoupon : '-' + defalutCoupon): (currentOrderList.couponDiscountPreviews.length == 0 ? '无可使用优惠券' : '选择优惠券')}}</text> <text class="{{defalutCoupon ? 'coupon-price' : 'no-coupon'}}">{{defalutCoupon ? (currentCoupon ? '-' + currentCoupon : '-' + defalutCoupon): (currentOrderList.couponDiscountPreviews.length == 0 ? '无可使用优惠券' : '选择优惠券')}}</text>
<image class="arrow-right" src="/assets/imgs/7_1_0/arrow-right.png" /> <image class="arrow-right" src="/assets/imgs/7_1_0/arrow-right.png" />
</view> </view>
...@@ -262,9 +234,5 @@ ...@@ -262,9 +234,5 @@
</view> </view>
<!--goHome--> <!--goHome-->
<go-home/> <go-home/>
<floatNav bind:getAuth="_getUserInfo" bind:updatePage="updatePage"/> <floatNav bind:getAuth="_getUserInfo" bind:updatePage="updatePage" />
<select-coupon <select-coupon show="{{showSelectCoupon}}" bind:updateCoupon="updateCoupon" coupon-list="{{couponDiscountPreviews}}" />
show="{{showSelectCoupon}}" \ No newline at end of file
bind:updateCoupon="updateCoupon"
coupon-list="{{couponDiscountPreviews}}"/>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment