Commit 35a65de2 by 李伟康

售后

1 parent bff42f44
......@@ -126,8 +126,25 @@ module.exports = {
//取消付款
cancelPay(orderCode) {
return api.fetch('scrm.api.shopmall.weapp.order.cancelPay',{
return api.fetch('scrm.api.shopmall.weapp.order.cancelPay', {
orderCode
})
},
/** 申请售后 */
afterSale(data) {
return api.fetch('scrm.api.shopmall.weapp.orderRefund.apply', data)
},
//申请售后待审核的订单取消售后
cancelOrder(orderCode) {
return api.fetch('scrm.api.shopmall.weapp.orderRefund.cancel',{
orderCode
})
},
/** 为售后添加退货快递信息 */
addDelivery(data) {
return api.post({
method: `scrm.api.shopmall.weapp.orderRefund.addDelivery`,
...data
})
},
}
\ No newline at end of file
......@@ -46,8 +46,7 @@ Page({
encoding: 'base64', //编码格式
success(_res) {
wx.p.wxApi.showLoading('上传中...')
wx.p.api.common
.uploadImg({
wx.p.api.commonApi.uploadImg({
file: `${type}@${_res.data}`
})
.then(img => {
......
......@@ -51,9 +51,7 @@ Page({
* 生命周期函数--监听页面加载
*/
onLoad: function (options) {
wx.p.router.getData(orderCode => {
this.getOrderRefundDetail(orderCode)
})
this.getOrderRefundDetail(options.orderCode)
},
getOrderRefundDetail(orderCode) {
wx.p.wxApi.showLoading('加载中...')
......
......@@ -81,8 +81,7 @@ Page({
encoding: 'base64', //编码格式
success(_res) {
wx.p.wxApi.showLoading('上传中...')
commonApi
.uploadImg({
wx.p.api.commonApi.uploadImg({
file: `${type}@${_res.data}`
})
.then(img => {
......@@ -113,7 +112,7 @@ Page({
wx.p.wxApi.showToast('申请成功!')
setTimeout(() => {
wx.p.router.back(prevPage => {
prevPage.clearData()
prevPage.clearData && prevPage.clearData()
}, 2)
}, 1.5 * 1000)
} else {
......
{
"navigationBarTitleText": "申请售后"
"navigationBarTitleText": "申请售后",
"usingComponents": {
"gl-textarea": "/components/GlTextarea/GlTextarea"
}
}
\ No newline at end of file
......@@ -19,7 +19,7 @@
<block wx:if="{{imgUrls.length < 1}}">
<view class="one text-center" bindtap="upLoad">
<view class="icon">
<image webp src="{{IMGURL}}mine/camera.png?v={{img_version}}"></image>
<glsx-image webp src="mine/camera.png"></glsx-image>
</view>
</view>
</block>
......@@ -29,7 +29,7 @@
<image webp src="{{item}}"></image>
<view class="del text-center" catchtap="del" data-index="{{index}}">
<view class="icon">
<image webp src="{{IMGURL}}mine/del.png?v={{img_version}}"></image>
<glsx-image webp src="mine/del.png"></glsx-image>
</view>
</view>
</view>
......@@ -37,7 +37,7 @@
<block wx:if="{{imgUrls.length < 5}}">
<view class="upload-item item text-center" bindtap="upLoad">
<view class="icon">
<image webp src="{{IMGURL}}mine/camera.png?v={{img_version}}"></image>
<glsx-image webp src="mine/camera.png"></glsx-image>
</view>
</view>
</block>
......
......@@ -161,6 +161,7 @@ Page({
* 生命周期函数--监听页面加载
*/
onLoad: function (options) {
console.log(options,'=========')
this.setData({
hasUserInfo: true,
tabIndex: options.tabIndex,
......@@ -451,100 +452,5 @@ Page({
orderCode,
type: 2,
})
},
/**平台商城跳转 */
async jumpPlatformShop(e) {
let {
item,
url
} = e.currentTarget.dataset
if (item.afterSaleStatus && url == 'afterSaleDetail/index' && item.afterSaleStatus == 8) url = 'applySale/index'
if (url == 'applySale/index') {
const res = await this.getReturnCount(item)
if (!res.applyQty) return wx.p.wxApi.showToast('该商品不支持售后')
item.applyQty = res.applyQty
}
wx.p.router.go(`/packageMall/pages/platformShop/${url}`, item)
},
/**平台商城取消订单*/
cancelPlatformOrder(e) {
wx.showModal({
title: '温馨提示',
content: '请问您是否要取消付款',
confirmText: '确定',
cancelText: '取消',
confirmColor: '#F13C3D',
}).then(async res => {
if (res.confirm) {
wx.p.wxApi.showLoading()
try {
const {
orderCode
} = e.currentTarget.dataset, {
code,
message
} = await wx.p.api.shopmallApi.cancelPlatformOrder({
subOrderCode: orderCode
})
wx.hideLoading()
if (code == 0) {
wx.p.wxApi.showToast('取消成功')
setTimeout(() => {
this.getOrderList()
}, 1.5e3)
} else throw message
} catch (error) {
wx.p.wxApi.showToast(error)
}
}
})
},
/**平台商城支付 */
toPayOrder(e) {
wx.p.wxApi.showLoading()
const {
orderCode
} = e.currentTarget.dataset
wx.p.api.shopmallApi.platformGoodsPayOrder({
orderCode,
paymentSource: 1
}).then(res => {
wx.hideLoading()
if (res) {
const {
timeStamp,
nonceStr,
packages,
signType,
paySign
} = res.payParams
wx.requestPayment({
timeStamp: timeStamp,
nonceStr: nonceStr,
package: packages,
signType: signType,
paySign: paySign,
success() {
wx.p.router.go('/packageMine/pages/order/complete/complete', {
success: true
})
},
fail(res) {
if (res.errMsg == 'requestPayment:fail cancel') {
wx.p.wxApi.showToast('取消支付')
}
}
})
}
})
},
/**获取可申请的售后数量 */
getReturnCount(orderInfo) {
const PARAMS = {
subOrderCode: orderInfo.orderCode,
goodsSkuCode: orderInfo.orderGoods[0].goodsSkuCode
}
return wx.p.api.shopmallApi.platformApplyCount(PARAMS)
},
}
})
\ No newline at end of file
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!