Commit cacf36db by 程南

订阅消息

parent 3f732f13
...@@ -19,9 +19,9 @@ wxService.page({ ...@@ -19,9 +19,9 @@ wxService.page({
trolleySku2Buy: Array, trolleySku2Buy: Array,
currentOrderList: Array, currentOrderList: Array,
isSelect: false, isSelect: false,
selectPrice:'', selectPrice: '',
noSelectPrice:'', noSelectPrice: '',
plusSpread:'', plusSpread: '',
goodsAddress: false, goodsAddress: false,
citys: null, citys: null,
cityView: '', cityView: '',
...@@ -36,16 +36,16 @@ wxService.page({ ...@@ -36,16 +36,16 @@ wxService.page({
defalutCoupon: '', defalutCoupon: '',
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: '',
storeAddress : '', storeAddress: '',
storeCode : '' storeCode: ''
}, },
orderStoreInfo : null, orderStoreInfo: null,
}, },
/** /**
...@@ -54,7 +54,6 @@ wxService.page({ ...@@ -54,7 +54,6 @@ wxService.page({
onLoad: function (options) { onLoad: function (options) {
wx.hideShareMenu(); wx.hideShareMenu();
this.getMyLocationInfo(); this.getMyLocationInfo();
console.log(this.data)
}, },
////获取位置信息并获取附近门店信息 ////获取位置信息并获取附近门店信息
getMyLocationInfo(cb) { getMyLocationInfo(cb) {
...@@ -65,7 +64,7 @@ wxService.page({ ...@@ -65,7 +64,7 @@ wxService.page({
//获取本地缓存的地址信息 //获取本地缓存的地址信息
let myLocation = wx.getStorageSync('myLocation') ? wx.getStorageSync('myLocation') : null; let myLocation = wx.getStorageSync('myLocation') ? wx.getStorageSync('myLocation') : null;
if (!myLocation){ if (!myLocation) {
wx.getLocation({ wx.getLocation({
type: 'wgs84', type: 'wgs84',
success(res) { success(res) {
...@@ -80,15 +79,15 @@ wxService.page({ ...@@ -80,15 +79,15 @@ wxService.page({
} }
}); });
return ; return;
} }
this.getMyStoreInfoByPosition(myLocation.latitude,myLocation.longitude); this.getMyStoreInfoByPosition(myLocation.latitude, myLocation.longitude);
}, },
//获取附近门店信息 //获取附近门店信息
getMyStoreInfoByPosition(latitude, longitude){ getMyStoreInfoByPosition(latitude, longitude) {
wxService.post(`/sale/trade/buyer/getMemberStore?latitude=${latitude}&longitude=${longitude}`).then(res => { wxService.post(`/sale/trade/buyer/getMemberStore?latitude=${latitude}&longitude=${longitude}`).then(res => {
if (res){ if (res) {
if (res.data.result == 0) { if (res.data.result == 0) {
let obj = res.data.data ? res.data.data : null; let obj = res.data.data ? res.data.data : null;
if (obj) { if (obj) {
...@@ -118,10 +117,10 @@ wxService.page({ ...@@ -118,10 +117,10 @@ wxService.page({
}, () => { }, () => {
this.initCitys() this.initCitys()
// 地址列表 // 地址列表
if (this.data.currentType == 'delivery'){ if (this.data.currentType == 'delivery') {
this.getAddressList() this.getAddressList()
} }
else{ else {
// 获取本地选择的门店信息 // 获取本地选择的门店信息
this.getLocalStoreInfo(); this.getLocalStoreInfo();
} }
...@@ -132,7 +131,7 @@ wxService.page({ ...@@ -132,7 +131,7 @@ wxService.page({
}, },
//获取备注信息 //获取备注信息
getLocalRemarkInfo(){ getLocalRemarkInfo() {
this.data.buyerRemark = wx.getStorageSync('orderRemark'); this.data.buyerRemark = wx.getStorageSync('orderRemark');
this.setData({ this.setData({
buyerRemark: this.data.buyerRemark buyerRemark: this.data.buyerRemark
...@@ -140,32 +139,32 @@ wxService.page({ ...@@ -140,32 +139,32 @@ wxService.page({
}, },
//输入备注 //输入备注
onTapInputRemark(){ onTapInputRemark() {
wx.navigateTo({ wx.navigateTo({
url: '/pages/remark/remark', url: '/pages/remark/remark',
}); });
}, },
onUnload(){ onUnload() {
wx.removeStorageSync('orderRemark'); wx.removeStorageSync('orderRemark');
wx.removeStorageSync('choosedStoreInfo'); wx.removeStorageSync('choosedStoreInfo');
}, },
//获取本地选择的门店信息 //获取本地选择的门店信息
getLocalStoreInfo(){ getLocalStoreInfo() {
let storeInfo = wx.getStorageSync('choosedStoreInfo') ? wx.getStorageSync('choosedStoreInfo') : null; let storeInfo = wx.getStorageSync('choosedStoreInfo') ? wx.getStorageSync('choosedStoreInfo') : null;
if (storeInfo){ if (storeInfo) {
this.data.storeInfo.storeId = storeInfo.id; this.data.storeInfo.storeId = storeInfo.id;
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: '',
storeAddress : '', storeAddress: '',
storeCode : '', storeCode: '',
} }
} }
...@@ -182,27 +181,27 @@ wxService.page({ ...@@ -182,27 +181,27 @@ wxService.page({
}, },
//切换tab //切换tab
onTapChangeType(e){ onTapChangeType(e) {
let type = e.currentTarget.dataset.type; let type = e.currentTarget.dataset.type;
this.setData({ this.setData({
currentType : type currentType: type
}); });
if (type == 'delivery'){ if (type == 'delivery') {
this.getAddressList() this.getAddressList()
} }
else{ else {
this.getLocalStoreInfo(); this.getLocalStoreInfo();
} }
}, },
//选择门店去 //选择门店去
onTapSelectStore(){ onTapSelectStore() {
wx.navigateTo({ wx.navigateTo({
url: '/subPackage/page/pages/chooseStore/chooseStore?isFrom=order', url: '/subPackage/page/pages/chooseStore/chooseStore?isFrom=order',
}); });
}, },
//订单备注输入 //订单备注输入
onBuyerRemarkInput(e){ onBuyerRemarkInput(e) {
this.data.buyerRemark = e.detail.value; this.data.buyerRemark = e.detail.value;
this.setData({ this.setData({
buyerRemark: this.data.buyerRemark buyerRemark: this.data.buyerRemark
...@@ -211,19 +210,19 @@ wxService.page({ ...@@ -211,19 +210,19 @@ wxService.page({
// select 传过来 // select 传过来
updateCoupon(e) { updateCoupon(e) {
// faceAmount 抵用多少钱(分) 1 抵用券 2 折扣券 // faceAmount 抵用多少钱(分) 1 抵用券 2 折扣券
if(!e.detail) { if (!e.detail) {
this.setData({ this.setData({
defalutCoupon: 0, defalutCoupon: 0,
couponId: '', couponId: '',
couponSettingId: '', couponSettingId: '',
defalutCouponId: '', defalutCouponId: '',
currentCoupon : 0, currentCoupon: 0,
},() => { }, () => {
this.setPayPrice(); this.setPayPrice();
}); });
return return
} }
const { faceAmount, type, id, couponDiscount,sid } = e.detail const { faceAmount, type, id, couponDiscount, sid } = e.detail
const { defalutCouponId } = this.data const { defalutCouponId } = this.data
const { orderPrice } = this.data const { orderPrice } = this.data
// couponId---id couponSettingId --sid // couponId---id couponSettingId --sid
...@@ -233,7 +232,7 @@ wxService.page({ ...@@ -233,7 +232,7 @@ wxService.page({
this.setData({ this.setData({
defalutCoupon: true, defalutCoupon: true,
defalutCouponId: finCouponId ? '' : defalutCouponId, defalutCouponId: finCouponId ? '' : defalutCouponId,
[finCouponName] : finCouponId, [finCouponName]: finCouponId,
// couponId: id, // couponId: id,
haveCoupon: true, haveCoupon: true,
currentCoupon: `${faceAmount / 100} 元` currentCoupon: `${faceAmount / 100} 元`
...@@ -243,7 +242,7 @@ wxService.page({ ...@@ -243,7 +242,7 @@ wxService.page({
// let spread = Math.round(orderPrice - discounPrice) // let spread = Math.round(orderPrice - discounPrice)
this.setData({ this.setData({
defalutCoupon: true, defalutCoupon: true,
[finCouponName] : finCouponId, [finCouponName]: finCouponId,
defalutCouponId: finCouponId ? '' : defalutCouponId, defalutCouponId: finCouponId ? '' : defalutCouponId,
// couponId: id, // couponId: id,
haveCoupon: true, haveCoupon: true,
...@@ -271,30 +270,30 @@ wxService.page({ ...@@ -271,30 +270,30 @@ wxService.page({
//提交按钮 //提交按钮
formSubmit(e) { formSubmit(e) {
//判断是不是开卡了 //判断是不是开卡了
if (this.data.orderingMustOpenCard){ if (this.data.orderingMustOpenCard) {
let baseInfo = wx.getStorageSync('_baseUserInfo'); let baseInfo = wx.getStorageSync('_baseUserInfo');
if(!baseInfo){ if (!baseInfo) {
wx.showToast({ wx.showToast({
title: '你还未登录,请先去登录', title: '你还未登录,请先去登录',
icon: 'none' icon: 'none'
}); });
return ; return;
} }
let memberActivateStatus = baseInfo.memberActivateStatus; let memberActivateStatus = baseInfo.memberActivateStatus;
if (!memberActivateStatus){ if (!memberActivateStatus) {
wx.showModal({ wx.showModal({
title: '下单开卡提示', title: '下单开卡提示',
content: '对不起,需要您先开卡后才能下单,点击确定去开卡', content: '对不起,需要您先开卡后才能下单,点击确定去开卡',
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) {
} }
} }
...@@ -304,7 +303,7 @@ wxService.page({ ...@@ -304,7 +303,7 @@ wxService.page({
} }
} }
//判断是不是快递配送 //判断是不是快递配送
if (this.data.currentType == 'delivery'){ if (this.data.currentType == 'delivery') {
const { goodsAddress } = this.data const { goodsAddress } = this.data
// 保存地址 && 支付 // 保存地址 && 支付
if (goodsAddress) { if (goodsAddress) {
...@@ -379,7 +378,7 @@ wxService.page({ ...@@ -379,7 +378,7 @@ wxService.page({
this.handelGobuy() this.handelGobuy()
} }
} }
else{ else {
this.handelGobuy() this.handelGobuy()
} }
}, },
...@@ -498,7 +497,7 @@ wxService.page({ ...@@ -498,7 +497,7 @@ wxService.page({
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;
} }
...@@ -548,7 +547,7 @@ wxService.page({ ...@@ -548,7 +547,7 @@ wxService.page({
let skuList = data.tradePreviewSkus let skuList = data.tradePreviewSkus
let sum = 0 let sum = 0
skuList.forEach((item,index) => { skuList.forEach((item, index) => {
// item.price // item.price
sum += skuList[index].price * skuList[index].count; sum += skuList[index].price * skuList[index].count;
}); });
...@@ -557,7 +556,7 @@ wxService.page({ ...@@ -557,7 +556,7 @@ wxService.page({
// 初始化商品价格 // 初始化商品价格
const { isSelect } = this.data const { isSelect } = this.data
if(isSelect){ if (isSelect) {
this.setData({ this.setData({
selectPrice: sum selectPrice: sum
}) })
...@@ -579,7 +578,7 @@ wxService.page({ ...@@ -579,7 +578,7 @@ wxService.page({
let couponSettingId = data && data.couponDiscountPreviews.length && let couponSettingId = data && data.couponDiscountPreviews.length &&
data.couponDiscountPreviews[0] && data.couponDiscountPreviews[0].couponDTOS[0] && data.couponDiscountPreviews[0] && data.couponDiscountPreviews[0].couponDTOS[0] &&
data.couponDiscountPreviews[0].couponDTOS[0].couponSettingId || ''; data.couponDiscountPreviews[0].couponDTOS[0].couponSettingId || '';
data.couponDiscountPreviews = data.couponDiscountPreviews ? data.couponDiscountPreviews :[]; data.couponDiscountPreviews = data.couponDiscountPreviews ? data.couponDiscountPreviews : [];
// id / couponSettingId // id / couponSettingId
this.setData({ this.setData({
currentOrderList: data, currentOrderList: data,
...@@ -607,18 +606,18 @@ wxService.page({ ...@@ -607,18 +606,18 @@ wxService.page({
couponSettingId, couponSettingId,
addressId, addressId,
addressInfo, addressInfo,
defalutCouponId , defalutCouponId,
} = this.data; } = this.data;
let finCouponName,finCouponId let finCouponName, finCouponId
if(!defalutCoupon) { if (!defalutCoupon) {
finCouponName = 'couponId' finCouponName = 'couponId'
finCouponId = '' finCouponId = ''
} else { } else {
// 当前选中 哪一个id couponSettingId // 当前选中 哪一个id couponSettingId
// 默认券存在 id settingId // 默认券存在 id settingId
let currentCouponId // couponId / 第一项 id let currentCouponId // couponId / 第一项 id
if(defalutCouponId) { if (defalutCouponId) {
finCouponId = defalutCouponId finCouponId = defalutCouponId
finCouponName = 'couponId' finCouponName = 'couponId'
} else { } else {
...@@ -632,11 +631,11 @@ wxService.page({ ...@@ -632,11 +631,11 @@ wxService.page({
[finCouponName]: finCouponId, [finCouponName]: finCouponId,
// couponId: couponId? couponId : defalutCouponId, // couponId: couponId? couponId : defalutCouponId,
trolleySku2Buy, trolleySku2Buy,
buyerRemark : this.data.buyerRemark, buyerRemark: this.data.buyerRemark,
} }
//判断是快递下单还是自提下单 //判断是快递下单还是自提下单
if (this.data.currentType == 'delivery'){ if (this.data.currentType == 'delivery') {
params.orderType = 1; params.orderType = 1;
params.addressId = addressId ? addressId : addressInfo.id // 微信地址 or 地址id params.addressId = addressId ? addressId : addressInfo.id // 微信地址 or 地址id
...@@ -649,12 +648,12 @@ wxService.page({ ...@@ -649,12 +648,12 @@ 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;
params.storeName = this.data.storeInfo.storeName; params.storeName = this.data.storeInfo.storeName;
if (!params.storeId){ if (!params.storeId) {
wx.showToast({ wx.showToast({
title: '门店自提需要选择门店', title: '门店自提需要选择门店',
icon: 'none' icon: 'none'
...@@ -672,39 +671,39 @@ wxService.page({ ...@@ -672,39 +671,39 @@ wxService.page({
title: '正在下单..' title: '正在下单..'
}); });
const { isSelect} = this.data; const { isSelect } = this.data;
//增加订单备注信息 //增加订单备注信息
params.buyerRemark = this.data.buyerRemark; params.buyerRemark = this.data.buyerRemark;
//下单之前先做校验 //下单之前先做校验
this.checkOrder(params).then(result => { this.checkOrder(params).then(result => {
if (result){ if (result) {
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];
//每人限购 //每人限购
if (tempObj.limitType == 1){ if (tempObj.limitType == 1) {
tips = `商品"${tempObj.productName}"每人限购${tempObj.limitNum}件`; tips = `商品"${tempObj.productName}"每人限购${tempObj.limitNum}件`;
} }
//每次限购 //每次限购
else if (tempObj.limitType == 2){ else if (tempObj.limitType == 2) {
tips = `商品"${tempObj.productName}"每次限购${tempObj.limitNum}件`; tips = `商品"${tempObj.productName}"每次限购${tempObj.limitNum}件`;
} }
wx.showModal({ wx.showModal({
title: '商品限购提醒', title: '商品限购提醒',
content: tips, content: tips,
confirmText : '好的', confirmText: '好的',
confirmColor: '#cb3c3c', confirmColor: '#cb3c3c',
showCancel: false, showCancel: false,
success(confirm){ success(confirm) {
if (confirm.confirm){ if (confirm.confirm) {
wx.navigateBack({ wx.navigateBack({
delta : 1 delta: 1
}); });
} }
}, },
...@@ -714,12 +713,13 @@ wxService.page({ ...@@ -714,12 +713,13 @@ wxService.page({
}); });
}, },
//下单 //下单
order(isSelect,params){ order(isSelect, params) {
if(this.data.orderStoreInfo){
if (this.data.orderStoreInfo.storeId){ if (this.data.orderStoreInfo) {
if (this.data.orderStoreInfo.storeId) {
params.storeId = this.data.orderStoreInfo.storeId; params.storeId = this.data.orderStoreInfo.storeId;
} }
if (this.data.orderStoreInfo.storeInfo){ if (this.data.orderStoreInfo.storeInfo) {
params.storeInfo = this.data.orderStoreInfo.storeInfo; params.storeInfo = this.data.orderStoreInfo.storeInfo;
} }
} }
...@@ -729,6 +729,7 @@ wxService.page({ ...@@ -729,6 +729,7 @@ wxService.page({
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;
wx.removeStorageSync('choosedStoreInfo'); wx.removeStorageSync('choosedStoreInfo');
wx.removeStorageSync('orderRemark'); wx.removeStorageSync('orderRemark');
if (result == 0) { if (result == 0) {
...@@ -738,15 +739,42 @@ wxService.page({ ...@@ -738,15 +739,42 @@ wxService.page({
success(res) { success(res) {
wx.hideLoading() wx.hideLoading()
// 支付成功页面 // 支付成功页面
let baseUserInfo = wx.getStorageSync('_baseUserInfo');
wxService.post(`${'/merchant/message/wxSubMsgMapping/getListByParams'}`, {
scenarioIds: ['ordersend', 'ordersign'],
sourceFrom: 2,
switchType: 3
}).then(res => {
let tempArr = res.data.data;
let tempids = [];
tempArr.map(item => {
tempids.push(item.templateId);
})
wx.requestSubscribeMessage({
tmplIds: tempids,
success: (res)=>{
for(let i = 0; i < tempArr.length; i++){
wxService.post(`${'/merchant/message/wxSubMsgSubscride/member/subscribe'}`, {
businessId: tradeId,
memberId: baseUserInfo.memberId,
scenarioId:tempArr[i].scenarioId,
templateId: tempArr[i].templateId
}).then(resp => { })
}
},
complete: (res)=>{
wx.redirectTo({ wx.redirectTo({
url: `/subPackage/page/pages/paymentStatus/paymentStatus?status=S&amount=${amount}&type=${_this.data.currentType}`, url: `/subPackage/page/pages/paymentStatus/paymentStatus?status=S&amount=${amount}&type=${_this.data.currentType}`,
}); });
}
})
})
}, },
fail(res) { fail(res) {
wx.hideLoading(); wx.hideLoading();
wx.showToast({ wx.showToast({
title: '支付已取消', title: '支付已取消',
icon : 'none' icon: 'none'
}); });
if (_this.data.currentType == 'delivery') { if (_this.data.currentType == 'delivery') {
wx.redirectTo({ wx.redirectTo({
...@@ -765,14 +793,14 @@ wxService.page({ ...@@ -765,14 +793,14 @@ wxService.page({
}); });
}, },
//校验订单中商品限购情况 //校验订单中商品限购情况
checkOrder(params){ checkOrder(params) {
return wxService.post(`/sale/trade/buyer/bill/before/check`,params); return wxService.post(`/sale/trade/buyer/bill/before/check`, params);
}, },
// 获取地址列表 // 获取地址列表
getAddressList() { getAddressList() {
const { memberId } = wx.getStorageSync('_baseUserInfo'); const { memberId } = wx.getStorageSync('_baseUserInfo');
const { trolleySku2Buy, checkByPremium } = this.data; const { trolleySku2Buy, checkByPremium } = this.data;
let params = {checkByPremium, trolleySku2Buy}; let params = { checkByPremium, trolleySku2Buy };
params.orderType = 1; params.orderType = 1;
wxService.post(`/member/addressManage/getall`, { wxService.post(`/member/addressManage/getall`, {
...@@ -783,7 +811,7 @@ wxService.page({ ...@@ -783,7 +811,7 @@ wxService.page({
let { result, data } = res.data let { result, data } = res.data
if (result == 0) { if (result == 0) {
//看看本地是不是有已经选择的地址了 //看看本地是不是有已经选择的地址了
if (!hasDefalut){ // 无 if (!hasDefalut) { // 无
//看一下地址列表中是不是有默认地址 //看一下地址列表中是不是有默认地址
let defaultInAddressList = null; let defaultInAddressList = null;
data = data ? data : []; data = data ? data : [];
...@@ -794,7 +822,7 @@ wxService.page({ ...@@ -794,7 +822,7 @@ wxService.page({
} }
}); });
if (defaultInAddressList){ if (defaultInAddressList) {
this.data.addressId = defaultInAddressList ? defaultInAddressList.id : ''; this.data.addressId = defaultInAddressList ? defaultInAddressList.id : '';
this.data.addressInfo = defaultInAddressList; this.data.addressInfo = defaultInAddressList;
params.addressId = this.data.addressId; params.addressId = this.data.addressId;
...@@ -806,7 +834,7 @@ wxService.page({ ...@@ -806,7 +834,7 @@ wxService.page({
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;
...@@ -814,7 +842,7 @@ wxService.page({ ...@@ -814,7 +842,7 @@ wxService.page({
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 => {
...@@ -840,7 +868,7 @@ wxService.page({ ...@@ -840,7 +868,7 @@ wxService.page({
this.calPreferentialPrice(params) this.calPreferentialPrice(params)
} }
}).finally(() => {}); }).finally(() => { });
}, },
//获取微信地址 //获取微信地址
chooseWxAddress() { chooseWxAddress() {
...@@ -879,7 +907,7 @@ wxService.page({ ...@@ -879,7 +907,7 @@ wxService.page({
this.setData({ this.setData({
addressId: data, addressId: data,
goodsAddress: true, goodsAddress: true,
},() => { }, () => {
this.getAddressList(); this.getAddressList();
}) })
} }
......
...@@ -10,7 +10,7 @@ ...@@ -10,7 +10,7 @@
data-type="selfPickUp" bindtap="onTapChangeType">门店自提</view> data-type="selfPickUp" bindtap="onTapChangeType">门店自提</view>
</view> </view>
<form bindsubmit="formSubmit"> <form>
<!-- 快递地址 --> <!-- 快递地址 -->
<view class="address-wrap" wx:if="{{currentType == 'delivery'}}"> <view class="address-wrap" wx:if="{{currentType == 'delivery'}}">
<block wx:if="{{goodsAddress}}"> <block wx:if="{{goodsAddress}}">
...@@ -244,7 +244,7 @@ ...@@ -244,7 +244,7 @@
<text class="cost-label">实付款:</text> <text class="cost-label">实付款:</text>
<text class="cost-price">¥{{utils.numberFormat(orderPrice)}}</text> <text class="cost-price">¥{{utils.numberFormat(orderPrice)}}</text>
</view> </view>
<button form-type="submit" class="theme-color">立即购买</button> <button bind:tap="formSubmit" class="theme-color">立即购买</button>
</view> </view>
</form> </form>
</view> </view>
......
...@@ -6,9 +6,6 @@ const envInfo = require('../../config/index').envInfo ...@@ -6,9 +6,6 @@ const envInfo = require('../../config/index').envInfo
wxService.page({ wxService.page({
/**
* 页面的初始数据
*/
data: { data: {
imageDomain: '', imageDomain: '',
refundCreateDto: { refundCreateDto: {
...@@ -49,8 +46,8 @@ wxService.page({ ...@@ -49,8 +46,8 @@ wxService.page({
} }
let skulist = []; let skulist = [];
selectGoods.forEach(item=>{ selectGoods.forEach(item => {
const {skuId,count} = item; const { skuId, count } = item;
skulist.push({ skulist.push({
skuId, skuId,
count count
...@@ -59,7 +56,7 @@ wxService.page({ ...@@ -59,7 +56,7 @@ wxService.page({
this.reFundPreview({ this.reFundPreview({
tradeId: this.data.id, tradeId: this.data.id,
skuList:skulist skuList: skulist
}) })
var refundCreateDto = this.data.refundCreateDto var refundCreateDto = this.data.refundCreateDto
...@@ -77,6 +74,7 @@ wxService.page({ ...@@ -77,6 +74,7 @@ wxService.page({
}, },
//创建退款 //创建退款
handelRequestRefund(params) { handelRequestRefund(params) {
let _self = this;
wx.showLoading({ wx.showLoading({
title: '加载中', title: '加载中',
mask: true mask: true
...@@ -86,6 +84,31 @@ wxService.page({ ...@@ -86,6 +84,31 @@ wxService.page({
const { result, data } = res.data const { result, data } = res.data
if (result == 0) { if (result == 0) {
wx.hideLoading() wx.hideLoading()
let baseUserInfo = wx.getStorageSync('_baseUserInfo');
wxService.post(`${'/merchant/message/wxSubMsgMapping/getListByParams'}`, {
scenarioIds: ['orderrefundfinsh', 'orderrefundcheck'],
sourceFrom: 2,
switchType: 3
}).then(res => {
let tempArr = res.data.data;
let tempids = [];
tempArr.map(item => {
tempids.push(item.templateId);
})
wx.requestSubscribeMessage({
tmplIds: tempids,
success: (res)=>{
for(let i = 0; i < tempArr.length; i++){
wxService.post(`${'/merchant/message/wxSubMsgSubscride/member/subscribe'}`, {
businessId: _self.data.id,
memberId: baseUserInfo.memberId,
scenarioId:tempArr[i].scenarioId,
templateId: tempArr[i].templateId
}).then(resp => { })
}
},
complete: (res)=>{
wx.showToast({ wx.showToast({
title: '申请退款成功', title: '申请退款成功',
}); });
...@@ -93,10 +116,18 @@ wxService.page({ ...@@ -93,10 +116,18 @@ wxService.page({
setTimeout(() => { setTimeout(() => {
// wxService.router(`/pages/order/order`).search({params}) // wxService.router(`/pages/order/order`).search({params})
wx.navigateBack({ wx.navigateBack({
delta : 1 delta: 1
}); });
}, 2000) }, 2000)
} }
})
})
}
} }
}) })
...@@ -115,8 +146,8 @@ wxService.page({ ...@@ -115,8 +146,8 @@ wxService.page({
wx.hideLoading() wx.hideLoading()
let newReasonList = []; let newReasonList = [];
data.forEach((item,index)=>{ data.forEach((item, index) => {
const {reason} = item; const { reason } = item;
newReasonList.push({ newReasonList.push({
name: reason, name: reason,
value: index + 1 value: index + 1
...@@ -149,7 +180,7 @@ wxService.page({ ...@@ -149,7 +180,7 @@ wxService.page({
} }
this.setData({ this.setData({
cartList cartList
},()=>{ }, () => {
this.getReturnPrice() this.getReturnPrice()
}) })
}, },
...@@ -190,15 +221,15 @@ wxService.page({ ...@@ -190,15 +221,15 @@ wxService.page({
var index = e.currentTarget.dataset.index var index = e.currentTarget.dataset.index
var cartList = this.data.cartList var cartList = this.data.cartList
var proNum = cartList[index].count; var proNum = cartList[index].count;
if (proNum < cartList[index].canRefundNum){ if (proNum < cartList[index].canRefundNum) {
proNum++ proNum++
} }
else{ else {
wx.showToast({ wx.showToast({
title: '退单数量不能大于当前商品购买数量', title: '退单数量不能大于当前商品购买数量',
icon : 'none' icon: 'none'
}); });
return ; return;
} }
cartList[index].count = proNum cartList[index].count = proNum
...@@ -235,9 +266,9 @@ wxService.page({ ...@@ -235,9 +266,9 @@ wxService.page({
this.editOk(cartList[index]) //调用完成 this.editOk(cartList[index]) //调用完成
}) })
}, },
editOk(cartPro){ editOk(cartPro) {
let skulist = []; let skulist = [];
const {skuId,count} = cartPro; const { skuId, count } = cartPro;
skulist.push({ skulist.push({
skuId, skuId,
count count
...@@ -245,7 +276,8 @@ wxService.page({ ...@@ -245,7 +276,8 @@ wxService.page({
this.reFundPreview({ this.reFundPreview({
tradeId: this.data.id, tradeId: this.data.id,
skuList:skulist}) // 退款预览 skuList: skulist
}) // 退款预览
}, },
getReturnPrice() { getReturnPrice() {
var cartList = this.data.cartList var cartList = this.data.cartList
...@@ -260,7 +292,7 @@ wxService.page({ ...@@ -260,7 +292,7 @@ wxService.page({
let tempPrice = parseInt(returnPrice * 100); let tempPrice = parseInt(returnPrice * 100);
this.setData({ this.setData({
returnOrder: parseFloat(tempPrice/100).toFixed(2) returnOrder: parseFloat(tempPrice / 100).toFixed(2)
}) })
}, },
...@@ -276,7 +308,7 @@ wxService.page({ ...@@ -276,7 +308,7 @@ wxService.page({
detail.skuVOList.forEach(item => { detail.skuVOList.forEach(item => {
item.checked = false; item.checked = false;
let paySkuPrice = parseInt(item.amount * 100 / item.totalCount); let paySkuPrice = parseInt(item.amount * 100 / item.totalCount);
item.paySkuPrice = (paySkuPrice/100).toFixed(2); item.paySkuPrice = (paySkuPrice / 100).toFixed(2);
}); });
this.setData({ this.setData({
...@@ -304,13 +336,13 @@ wxService.page({ ...@@ -304,13 +336,13 @@ wxService.page({
}, },
//退款prever //退款prever
reFundPreview(cartPro={}) { reFundPreview(cartPro = {}) {
const params = {...cartPro} const params = { ...cartPro }
wx.showLoading({ wx.showLoading({
title: '加载中', title: '加载中',
mask: true mask: true
}) })
wxService.post(`/sale/refund/buyer/preview`,params).then(res => { wxService.post(`/sale/refund/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) {
......
...@@ -43,7 +43,7 @@ ...@@ -43,7 +43,7 @@
"list": [] "list": []
}, },
"miniprogram": { "miniprogram": {
"current": 80, "current": -1,
"list": [ "list": [
{ {
"id": -1, "id": -1,
...@@ -149,7 +149,7 @@ ...@@ -149,7 +149,7 @@
"id": 16, "id": 16,
"name": "商品详情页", "name": "商品详情页",
"pathName": "pages/productDetail/productDetail", "pathName": "pages/productDetail/productDetail",
"query": "id=686861371018723328", "query": "id=647096699302580224",
"scene": null "scene": null
}, },
{ {
......
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