2020-08-04 19:08:04 +08:00
|
|
|
|
<template>
|
|
|
|
|
<view class="refund">
|
|
|
|
|
<view class="radios-container">
|
|
|
|
|
<u-radio-group v-model="value" @change="radioChange">
|
|
|
|
|
<label class="radio-view" v-for="(item, index) in goodsList" :key="index">
|
|
|
|
|
<view class="radio">
|
2020-08-06 10:48:21 +08:00
|
|
|
|
<u-radio color="#F0AD4E" :name="item.goods_id" active-color="#FF780F" icon-size="24" shape="circle"></u-radio>
|
2020-08-04 19:08:04 +08:00
|
|
|
|
</view>
|
|
|
|
|
<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_pay_price }}</text>
|
|
|
|
|
<text>x{{ item.goods_num }}</text>
|
|
|
|
|
</view>
|
|
|
|
|
</view>
|
|
|
|
|
</view>
|
|
|
|
|
</label>
|
|
|
|
|
</u-radio-group>
|
|
|
|
|
</view>
|
|
|
|
|
<view class="refund-details">
|
|
|
|
|
<view class="goods-number">
|
|
|
|
|
<view>选择数量</view>
|
2020-08-06 10:48:21 +08:00
|
|
|
|
<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>
|
2020-08-04 19:08:04 +08:00
|
|
|
|
</view>
|
|
|
|
|
<view class="refund-price">
|
2020-08-06 10:48:21 +08:00
|
|
|
|
<view class="price">
|
|
|
|
|
<view class="title">退款金额</view>
|
2020-08-06 17:52:25 +08:00
|
|
|
|
<view class="value">¥{{ totalPrice }}</view>
|
2020-08-04 19:08:04 +08:00
|
|
|
|
</view>
|
2020-08-06 17:52:25 +08:00
|
|
|
|
<view class="tips">若退款成功,将退还给您 ¥{{ totalPrice }}</view>
|
2020-08-04 19:08:04 +08:00
|
|
|
|
</view>
|
|
|
|
|
<view class="refund-text">
|
2020-08-06 10:48:21 +08:00
|
|
|
|
<view class="title">申请说明</view>
|
|
|
|
|
<u-input v-model="refundText" type="textarea" placeholder="必填,请详细说明退款理由" />
|
2020-08-04 19:08:04 +08:00
|
|
|
|
</view>
|
|
|
|
|
</view>
|
2020-08-06 17:52:25 +08:00
|
|
|
|
<view class="submit-btn" @click="applyRefund">提交申请</view>
|
|
|
|
|
<u-toast ref="uToast" />
|
2020-08-04 19:08:04 +08:00
|
|
|
|
</view>
|
|
|
|
|
</template>
|
|
|
|
|
<script>
|
|
|
|
|
export default {
|
|
|
|
|
data() {
|
|
|
|
|
return {
|
2020-08-06 17:52:25 +08:00
|
|
|
|
oid: '',
|
2020-08-04 19:08:04 +08:00
|
|
|
|
goodsList: [],
|
2020-08-06 10:48:21 +08:00
|
|
|
|
goods: {
|
|
|
|
|
goods_num: 0,
|
|
|
|
|
goods_pay_price: 0,
|
|
|
|
|
},
|
2020-08-04 19:08:04 +08:00
|
|
|
|
value: '',
|
2020-08-06 10:48:21 +08:00
|
|
|
|
refundText: '',
|
|
|
|
|
num: 0,
|
2020-08-04 19:08:04 +08:00
|
|
|
|
}
|
|
|
|
|
},
|
2020-08-06 17:52:25 +08:00
|
|
|
|
computed: {
|
|
|
|
|
totalPrice() {
|
|
|
|
|
return (this.goods.goods_pay_price * this.num).toFixed(2);
|
|
|
|
|
}
|
|
|
|
|
},
|
2020-08-04 19:08:04 +08:00
|
|
|
|
onLoad(option) {
|
2020-08-06 17:52:25 +08:00
|
|
|
|
this.oid = option.oid;
|
2020-08-04 19:08:04 +08:00
|
|
|
|
this.getOrderInfo(option.oid);
|
|
|
|
|
},
|
|
|
|
|
methods: {
|
|
|
|
|
radioChange(e){
|
2020-08-06 10:48:21 +08:00
|
|
|
|
const goodsList = this.goodsList.filter(goods => {
|
|
|
|
|
return e == goods.goods_id;
|
|
|
|
|
})
|
|
|
|
|
// console.log(goodsList);
|
|
|
|
|
this.goods = goodsList[0];
|
|
|
|
|
console.log(this.goods);
|
2020-08-04 19:08:04 +08:00
|
|
|
|
},
|
|
|
|
|
getOrderInfo(id) {
|
|
|
|
|
this.$u.api.getOrderInfo({
|
|
|
|
|
order_id: id,
|
|
|
|
|
}).then(res => {
|
|
|
|
|
if(res.errCode == 0) {
|
|
|
|
|
// this.orderInfo = res.data;
|
|
|
|
|
this.goodsList = res.data.extend_order_goods;
|
2020-08-06 10:48:21 +08:00
|
|
|
|
// console.log(this.goodsList);
|
2020-08-04 19:08:04 +08:00
|
|
|
|
}
|
|
|
|
|
// uni.stopPullDownRefresh(); // 结束刷新
|
|
|
|
|
})
|
|
|
|
|
},
|
2020-08-06 17:52:25 +08:00
|
|
|
|
verifyParams() {
|
|
|
|
|
if(!this.goods.goods_id) {
|
|
|
|
|
this.$u.toast('请选择退款商品');
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
if(this.num == 0) {
|
|
|
|
|
this.$u.toast('请选择退款数量');
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
if(this.$u.test.isEmpty(this.refundText)) {
|
|
|
|
|
this.$u.toast('退款说明不可为空');
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
return true;
|
|
|
|
|
},
|
2020-08-04 19:08:04 +08:00
|
|
|
|
applyRefund() {
|
2020-08-06 17:52:25 +08:00
|
|
|
|
if(!this.verifyParams()) return false;
|
2020-08-04 19:08:04 +08:00
|
|
|
|
let params = {
|
2020-08-06 17:52:25 +08:00
|
|
|
|
order_id: this.oid,
|
|
|
|
|
goods_id: this.goods.goods_id,
|
|
|
|
|
refund_amount: Number(this.totalPrice),
|
|
|
|
|
reason_info: this.refundText,
|
|
|
|
|
goods_num: this.num,
|
2020-08-04 19:08:04 +08:00
|
|
|
|
}
|
|
|
|
|
this.$u.api.refundOrder(params).then(res => {
|
|
|
|
|
if(res.errCode == 0) {
|
2020-08-06 17:52:25 +08:00
|
|
|
|
this.$refs.uToast.show({
|
|
|
|
|
title: res.message,
|
|
|
|
|
back: true,
|
|
|
|
|
})
|
|
|
|
|
} else {
|
|
|
|
|
this.$refs.uToast.show({
|
|
|
|
|
title: res.message,
|
|
|
|
|
type: 'error'
|
|
|
|
|
})
|
2020-08-04 19:08:04 +08:00
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
},
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
</script>
|
|
|
|
|
<style lang="scss" scoped>
|
|
|
|
|
.refund {
|
|
|
|
|
min-height: calc(100vh - var(--window-top));
|
|
|
|
|
background-color: #EDEDED;
|
|
|
|
|
.radios-container {
|
|
|
|
|
margin-bottom: 20rpx;
|
|
|
|
|
.radio-view {
|
|
|
|
|
background-color: #FFFFFF;
|
|
|
|
|
padding: 26rpx;
|
|
|
|
|
display: flex;
|
|
|
|
|
align-items: center;
|
|
|
|
|
margin-bottom: 1rpx;
|
|
|
|
|
.radio {
|
|
|
|
|
margin-right: 20rpx;
|
|
|
|
|
}
|
|
|
|
|
.store_info {
|
|
|
|
|
display: flex;
|
|
|
|
|
flex-wrap: nowrap;
|
|
|
|
|
width: 100%;
|
|
|
|
|
.info_img{
|
|
|
|
|
>image{
|
|
|
|
|
width: 180rpx;
|
|
|
|
|
height: 160rpx;
|
|
|
|
|
background-color: aqua;
|
|
|
|
|
border-radius: 10rpx;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
.info_txt{
|
|
|
|
|
padding-left: 30rpx;
|
|
|
|
|
padding-right: 30rpx;
|
|
|
|
|
display: flex;
|
|
|
|
|
flex-wrap: wrap;
|
|
|
|
|
width: 100%;
|
|
|
|
|
.content{
|
|
|
|
|
height: 74rpx;
|
|
|
|
|
line-height: 37rpx;
|
|
|
|
|
font-size: 30rpx;
|
|
|
|
|
color:rgba(51,51,51,1);
|
|
|
|
|
}
|
|
|
|
|
.much{
|
|
|
|
|
display: flex;
|
|
|
|
|
justify-content: space-between;
|
|
|
|
|
width: 100%;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
.refund-details {
|
|
|
|
|
background-color: #FFFFFF;
|
2020-08-06 10:48:21 +08:00
|
|
|
|
.goods-number {
|
|
|
|
|
padding: 0 30rpx;
|
|
|
|
|
height: 100rpx;
|
|
|
|
|
background: rgba(255,255,255,1);
|
|
|
|
|
display: flex;
|
|
|
|
|
align-items: center;
|
|
|
|
|
justify-content: space-between;
|
|
|
|
|
margin-bottom: 2rpx;
|
|
|
|
|
/deep/ .u-numberbox {
|
|
|
|
|
border: 1rpx solid rgba(217,215,215,1);
|
|
|
|
|
border-radius:4px;
|
|
|
|
|
.u-icon-minus, .u-icon-plus {
|
|
|
|
|
width: 38rpx;
|
|
|
|
|
}
|
|
|
|
|
.u-number-input {
|
|
|
|
|
margin: 0;
|
|
|
|
|
color: #333 !important;
|
|
|
|
|
border: 1rpx #D9D7D7 solid {
|
|
|
|
|
top: 0px;
|
|
|
|
|
bottom: 0px;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
.refund-price {
|
|
|
|
|
background: rgba(255,255,255,1);
|
|
|
|
|
padding: 36rpx 30rpx;
|
|
|
|
|
margin-bottom: 2rpx;
|
|
|
|
|
.price {
|
|
|
|
|
display: flex;
|
|
|
|
|
align-items: center;
|
|
|
|
|
margin-bottom: 36rpx;
|
|
|
|
|
.title {
|
|
|
|
|
font-size: 30rpx;
|
|
|
|
|
color: rgba(51,51,51,1);
|
|
|
|
|
margin-right: 56rpx;
|
|
|
|
|
}
|
|
|
|
|
.value {
|
|
|
|
|
font-size: 28rpx;
|
|
|
|
|
color: rgba(244,14,14,1);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
.tips {
|
|
|
|
|
font-size: 24rpx;
|
|
|
|
|
color: rgba(153,153,153,1);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
.refund-text {
|
|
|
|
|
background: rgba(255,255,255,1);
|
|
|
|
|
padding: 36rpx 30rpx;
|
|
|
|
|
.title {
|
|
|
|
|
font-size: 30rpx;
|
|
|
|
|
color: rgba(51,51,51,1);
|
|
|
|
|
margin-bottom: 40rpx;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
.submit-btn {
|
|
|
|
|
width: 690rpx;
|
|
|
|
|
height: 98rpx;
|
|
|
|
|
background: rgba(255,120,15,1);
|
|
|
|
|
border-radius: 49rpx;
|
|
|
|
|
font-size: 36rpx;
|
|
|
|
|
color: rgba(255,255,255,1);
|
|
|
|
|
line-height: 98rpx;
|
|
|
|
|
text-align: center;
|
|
|
|
|
margin: 120rpx auto 0;
|
2020-08-04 19:08:04 +08:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
</style>
|