退款
This commit is contained in:
@@ -1,7 +1,27 @@
|
||||
<template>
|
||||
<view class="refund">
|
||||
<view class="radios-container">
|
||||
<u-radio-group v-model="value" @change="radioChange">
|
||||
<view v-if="type == 2">
|
||||
<label class="radio-view" v-for="(item, index) in goodsList" :key="index">
|
||||
|
||||
<view class="store_info">
|
||||
<view class="info_img">
|
||||
<image :src="item.goods_image" mode="">
|
||||
</view>
|
||||
<view class="info_txt">
|
||||
<view class="content u-line-2">
|
||||
{{ item.goods_name }}
|
||||
</view>
|
||||
<view class="much">
|
||||
<text>¥{{ item.goods_price }}</text>
|
||||
<text>x{{ item.goods_num }}</text>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</label>
|
||||
</view>
|
||||
|
||||
<u-radio-group v-model="value" @change="radioChange" v-else>
|
||||
<label class="radio-view" v-for="(item, index) in goodsList" :key="index">
|
||||
<view class="radio">
|
||||
<u-radio color="#F0AD4E" :name="item.goods_id" active-color="#FF780F" icon-size="24" shape="circle"></u-radio>
|
||||
@@ -15,7 +35,7 @@
|
||||
{{ item.goods_name }}
|
||||
</view>
|
||||
<view class="much">
|
||||
<text>¥{{ item.goods_pay_price }}</text>
|
||||
<text>¥{{ item.goods_price }}</text>
|
||||
<text>x{{ item.goods_num }}</text>
|
||||
</view>
|
||||
</view>
|
||||
@@ -24,9 +44,9 @@
|
||||
</u-radio-group>
|
||||
</view>
|
||||
<view class="refund-details">
|
||||
<view class="goods-number">
|
||||
<view class="goods-number" v-if="type != 2">
|
||||
<view>选择数量</view>
|
||||
<u-number-box :input-width="40" :input-height="38" :size="22" bg-color="#FFFFFF" :disabled-input=true color="#FF780F" :max="goods.goods_num" v-model="num"></u-number-box>
|
||||
<u-number-box :input-width="40" :input-height="38" :size="22" bg-color="#FFFFFF" :disabled-input=true color="#FF780F" :max="goods.goods_num" v-model="num" :disabled="type == 2"></u-number-box>
|
||||
</view>
|
||||
<view class="refund-price">
|
||||
<view class="price">
|
||||
@@ -57,14 +77,26 @@ export default {
|
||||
value: '',
|
||||
refundText: '',
|
||||
num: 0,
|
||||
type:0,
|
||||
sel:true
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
totalPrice() {
|
||||
return (this.goods.goods_pay_price * this.num).toFixed(2);
|
||||
if(this.type == 2){
|
||||
console.log(this.goodsList)
|
||||
let pac = 0;
|
||||
for(let i in this.goodsList){
|
||||
pac += parseFloat(this.goodsList[i].goods_pay_price) * 100 ;
|
||||
}
|
||||
return pac / 100;
|
||||
}else{
|
||||
return this.goods.goods_pay_price;
|
||||
}
|
||||
}
|
||||
},
|
||||
onLoad(option) {
|
||||
this.type = option.type
|
||||
this.oid = option.oid;
|
||||
this.getOrderInfo(option.oid);
|
||||
},
|
||||
@@ -76,7 +108,7 @@ export default {
|
||||
// console.log(goodsList);
|
||||
this.goods = goodsList[0];
|
||||
this.num = this.goods.goods_num;
|
||||
// console.log(this.goods);
|
||||
console.log(this.goods);
|
||||
},
|
||||
getOrderInfo(id) {
|
||||
this.$u.api.getOrderInfo({
|
||||
@@ -106,7 +138,8 @@ export default {
|
||||
return true;
|
||||
},
|
||||
applyRefund() {
|
||||
if(!this.verifyParams()) return false;
|
||||
|
||||
if(this.type !=2 && !this.verifyParams()) return false;
|
||||
let params = {
|
||||
order_id: this.oid,
|
||||
goods_id: this.goods.goods_id,
|
||||
@@ -114,19 +147,38 @@ export default {
|
||||
reason_info: this.refundText,
|
||||
goods_num: this.num,
|
||||
}
|
||||
this.$u.api.refundOrder(params).then(res => {
|
||||
if(res.errCode == 0) {
|
||||
this.$refs.uToast.show({
|
||||
title: res.message,
|
||||
back: true,
|
||||
})
|
||||
} else {
|
||||
this.$refs.uToast.show({
|
||||
title: res.message,
|
||||
type: 'error'
|
||||
})
|
||||
}
|
||||
})
|
||||
console.log(params)
|
||||
if(this.type == 2){
|
||||
this.$u.api.addrefundall(params).then(res => {
|
||||
console.log(JSON.stringify(res))
|
||||
if(res.errCode == 0) {
|
||||
this.$refs.uToast.show({
|
||||
title: res.message,
|
||||
back: true,
|
||||
})
|
||||
} else {
|
||||
this.$refs.uToast.show({
|
||||
title: res.message,
|
||||
type: 'error'
|
||||
})
|
||||
}
|
||||
})
|
||||
}else{
|
||||
this.$u.api.refundOrder(params).then(res => {
|
||||
if(res.errCode == 0) {
|
||||
this.$refs.uToast.show({
|
||||
title: res.message,
|
||||
back: true,
|
||||
})
|
||||
} else {
|
||||
this.$refs.uToast.show({
|
||||
title: res.message,
|
||||
type: 'error'
|
||||
})
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
},
|
||||
}
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user