|
|
@ -1,40 +1,147 @@ |
|
|
|
<template> |
|
|
|
<view class="refund-operate"> |
|
|
|
<view class="ro-num">订单编号 sc20 0822 0815 6894</view> |
|
|
|
<view class="ro-num">订单编号 {{ orderInfo.order_no || '-' }}</view> |
|
|
|
<view class="ro-box ro-goods-info"> |
|
|
|
<view class="rgi-list" v-if="false"> |
|
|
|
<view class="rl-item" v-for="i in 3" :key="i"> |
|
|
|
<image></image> |
|
|
|
<view>克洛羽毛球…</view> |
|
|
|
<view class="rgi-single" v-if="refundLs.length == 1"> |
|
|
|
<image mode="aspectFill" :src="refundLs[0].product_imgs"></image> |
|
|
|
<view>{{ refundLs[0].product_name || '-' }}</view> |
|
|
|
</view> |
|
|
|
<view class="rgi-list" v-else> |
|
|
|
<view class="rl-item" v-for="(e, i) in refundLs" :key="i"> |
|
|
|
<image mode="aspectFill" :src="e.product_imgs"></image> |
|
|
|
<view>{{ e.product_name || '-' }}</view> |
|
|
|
</view> |
|
|
|
<view class="rgi-single"> |
|
|
|
<image></image> |
|
|
|
<view>克洛斯威羽毛球拍2支装C8正品碳素成人进攻型羽毛球比赛用</view> |
|
|
|
</view> |
|
|
|
<view class="rgi-total"><text>共3件</text><image></image></view> |
|
|
|
|
|
|
|
<view class="rgi-total"> |
|
|
|
<text>共{{ refundLs.length || 0 }}件</text> |
|
|
|
<!-- <image v-if="refundLs.length > 1" mode="aspectFit" src="/subpackage/order/static/images/arrow.png"></image> --> |
|
|
|
</view> |
|
|
|
</view> |
|
|
|
<view class="ro-box ro-refund-info"> |
|
|
|
<view class="rri-txt">最大可退金额 <text>¥179.7</text>(含运费¥0)</view> |
|
|
|
<view class="rri-txt">可退积分:100积分</view> |
|
|
|
<view class="rri-line"> |
|
|
|
<view class="rri-txt">最大可退金额 <text>¥{{ orderInfo.pay_amount || 0 }}</text>(含运费¥{{ orderInfo.product_logistics_price || 0 }})</view> |
|
|
|
<view class="rri-txt">可退积分:{{ orderInfo.deduction_integral || 0 }} 积分</view> |
|
|
|
<!-- 不支持部分退款 --> |
|
|
|
<!-- <view class="rri-line"> |
|
|
|
<view class="rl-name"><text>*</text>退款金额</view> |
|
|
|
<view class="rl-frame"><input /></view> |
|
|
|
<view class="rl-frame"><input v-model="refundAmount" /></view> |
|
|
|
</view> |
|
|
|
<view class="rri-line"> |
|
|
|
<view class="rl-name"><text>*</text>回退积分</view> |
|
|
|
<view class="rl-frame"><input /></view> |
|
|
|
</view> |
|
|
|
<view class="rl-frame"><input v-model="refundIntegral" /></view> |
|
|
|
</view> |
|
|
|
</view> --> |
|
|
|
<view class="ro-bar"> |
|
|
|
<view>确定</view> |
|
|
|
<view @click="confirmRefund">确定</view> |
|
|
|
</view> |
|
|
|
</view> |
|
|
|
</template> |
|
|
|
|
|
|
|
<script> |
|
|
|
import { ORDER_API } from '../../../js/api'; |
|
|
|
import server from '../../../js/server'; |
|
|
|
import util from '../../../../../utils/util'; |
|
|
|
import { servers } from '../../../../../js/server'; |
|
|
|
export default { |
|
|
|
computed: { |
|
|
|
maxAmount(){ |
|
|
|
let { refundLs } = this; |
|
|
|
let _amount = 0; |
|
|
|
refundLs.forEach(ele=>_amount+=(+ele.refundable_amount || 0)); |
|
|
|
return _amount.toFixed(2); |
|
|
|
}, |
|
|
|
maxIntegral(){ |
|
|
|
let { refundLs } = this; |
|
|
|
let _integral = 0; |
|
|
|
refundLs.forEach(ele=>_integral+=(+ele.refundable_integral || 0)); |
|
|
|
return _integral.toFixed(0); |
|
|
|
}, |
|
|
|
refundLs(){ |
|
|
|
let { orderInfo, selectedLs } = this; |
|
|
|
let _selectedArr = selectedLs.split(','); |
|
|
|
let _goodsArr = orderInfo.product_order_goods || []; |
|
|
|
return _goodsArr; |
|
|
|
// 只支持全部退款 |
|
|
|
// return _goodsArr.filter(ele=>{ |
|
|
|
// return _selectedArr.includes((ele.product_id + '')); |
|
|
|
// }) |
|
|
|
}, |
|
|
|
}, |
|
|
|
data(){ |
|
|
|
return { |
|
|
|
orderInfo: {}, |
|
|
|
selectedLs: '', |
|
|
|
refundAmount: '', |
|
|
|
refundIntegral: '', |
|
|
|
} |
|
|
|
}, |
|
|
|
onLoad(options){ |
|
|
|
this.getInfo(options.order_no); |
|
|
|
}, |
|
|
|
methods: { |
|
|
|
confirmRefund: util.debounce(function(){ |
|
|
|
util.showModal({ |
|
|
|
title: '提示', |
|
|
|
content: '确认对该订单进行退款操作吗?', |
|
|
|
showCancel: true, |
|
|
|
confirmText: '确认', |
|
|
|
success: res => { |
|
|
|
let { orderInfo } = this; |
|
|
|
if(res.confirm)this.refundReq({ |
|
|
|
brand_id: orderInfo.brand_id, |
|
|
|
order_no: orderInfo.order_no, |
|
|
|
product_cart_id: orderInfo.product_order_goods.map(ele=>ele.product_cart_id).join(','), |
|
|
|
integral: orderInfo.integral, |
|
|
|
amount: orderInfo.amount, |
|
|
|
}) |
|
|
|
} |
|
|
|
}) |
|
|
|
}, 300, true), |
|
|
|
refundReq({ |
|
|
|
brand_id, |
|
|
|
order_no, |
|
|
|
product_cart_id, |
|
|
|
integral, |
|
|
|
amount, |
|
|
|
}){ |
|
|
|
util.showLoad(); |
|
|
|
servers.post({ |
|
|
|
url: ORDER_API.orderGoodsRefund, |
|
|
|
data: { |
|
|
|
brand_id, |
|
|
|
order_no: order_no, |
|
|
|
product_cart_id: product_cart_id, |
|
|
|
integral: integral, |
|
|
|
amount: amount, |
|
|
|
}, |
|
|
|
isDefaultGet: false |
|
|
|
}) |
|
|
|
.then(res=>{ |
|
|
|
util.hideLoad(); |
|
|
|
if(res.data.code == 0){ |
|
|
|
util.showNone(res.data.message || '操作成功!'); |
|
|
|
setInterval(util.routeTo, 1200); |
|
|
|
}else{ |
|
|
|
util.showNone(res.data.message || '操作失败!'); |
|
|
|
} |
|
|
|
}) |
|
|
|
.catch(util.hideLoad) |
|
|
|
}, |
|
|
|
getInfo(order_no){ |
|
|
|
util.showLoad(); |
|
|
|
server.get({ |
|
|
|
url: ORDER_API.shop2OrderInfo, |
|
|
|
data: { order_no }, |
|
|
|
failMsg: '加载失败!' |
|
|
|
}) |
|
|
|
.then(res=>{ |
|
|
|
util.hideLoad(); |
|
|
|
let _order = res.order || {}; |
|
|
|
this.orderInfo = _order; |
|
|
|
}) |
|
|
|
}, |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
</script> |
|
|
|
|
|
|
@ -71,7 +178,6 @@ export default { |
|
|
|
vertical-align: middle; |
|
|
|
width: 30upx; |
|
|
|
height: 30upx; |
|
|
|
background-color: skyblue; |
|
|
|
} |
|
|
|
} |
|
|
|
.rgi-list{ |
|
|
@ -83,7 +189,6 @@ export default { |
|
|
|
width: 152upx; |
|
|
|
height: 152upx; |
|
|
|
border-radius: 10upx; |
|
|
|
background-color: skyblue; |
|
|
|
|
|
|
|
} |
|
|
|
>view{ |
|
|
|