Commit cacf36db by 程南

订阅消息

parent 3f732f13
...@@ -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