You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
yanzong_qianduan/pages/order/refund/refund.vue

650 lines
14 KiB

<template>
<view class="invoice">
<view class="invoice-goods">
<view class="a">
<image :src="order.goods_image"></image>
</view>
<view class="b">
<view class="l">{{order.goods_name}}</view>
<view class="r">配置套餐<text>x{{ order.total_num }}</text></view>
</view>
</view>
<view class="invoice-info">
<view class="b">
<view class="item">
<view class="l">申请类型</view>
<view class="r">
{{type==1?'我要退货退款':'我要退款(无需退货)'}}
</view>
</view>
<view class="item">
<view class="l">收货状态</view>
<view class="r">
<picker :range="array" @change="bindPickerChange">
<view class="lx" :class="logisticsIndex==-1?'lx-on':''">
{{logisticsIndex==-1?'请选择':array[logisticsIndex]}}
</view>
</picker>
</view>
</view>
<view class="item">
<view class="l">申请原因</view>
<view class="r">
<picker :range="array1" @change="bindPickerChange1">
<view class="lx" :class="applyIndex==-1?'lx-on':''">
{{applyIndex==-1?'点击选择申请原因':array1[applyIndex]}}
</view>
</picker>
</view>
</view>
</view>
</view>
<view class="invoice-money">
<view class="a">申请金额</view>
<view class="b">
<view class="l">
<view class="money" v-if="toggleIndex">{{value}}</view>
<input type="number" :focus="true" @blur="onValue" v-model="value" v-else placeholder-class="box"
placeholder="请输入金额" />
</view>
<view class="r" @click="toggleItem()">
10 months ago
<image :src="$picUrl+'/static/news/icon-edit.png.png'"></image>
修改金额
</view>
</view>
</view>
<view class="invoice-remark">
<view class="a">
<view class="l">申请说明<text>必填</text></view>
<view class="r">您还可以输入{{value?(200-value.length):200}}</view>
</view>
<view class="b">
<u-input v-model="contentNotes" maxlength="200" type="textarea" :height="height"
placeholder="请您详细填写申请说明" />
</view>
9 months ago
<view class="c"
v-if="(deliveryStatus == DeliveryStatusEnum.DELIVERED.value) && (receiptStatus == ReceiptStatusEnum.RECEIVED.value)"
>
<!-- -->
9 months ago
<u-upload :action="action" :header="header" @on-uploaded="onSuccess" @on-remove="onRemove" width="180"
height="180" :file-list="transferList" :custom-btn="true" max-count="6">
9 months ago
<template v-slot:addBtn>
<view class="slot-btn" hover-class="slot-btn__hover" hover-stay-time="150">
<image :src="$picUrl+'/static/news/icon-upload.png'"></image>
<view class="1">上传图片</view>
</view>
</template>
</u-upload>
</view>
</view>
9 months ago
<!-- <view class="invoice-phone">
联系电话<input type="number" placeholder="" v-model="phone" />
9 months ago
</view> -->
9 months ago
<view class="goods-fd">
<view class="btn" @click="toDetail">提交申请</view>
</view>
</view>
</template>
<script>
import * as refundApi from '@/api/refund'
import * as OrderApi from '@/api/order'
10 months ago
import * as UploadApi from '@/api/upload'
import {
OrderTypeEnum,
DeliveryStatusEnum,
DeliveryTypeEnum,
OrderStatusEnum,
PayStatusEnum,
ReceiptStatusEnum
} from '@/common/enum/order'
import {
DeliveryMethodEnum
} from '@/common/enum/order/delivery'
10 months ago
import Config from '@/core/config'
export default {
data() {
return {
// 枚举类
OrderTypeEnum,
DeliveryStatusEnum,
DeliveryTypeEnum,
OrderStatusEnum,
PayStatusEnum,
ReceiptStatusEnum,
DeliveryMethodEnum,
order: '',
orderId: '',
height: 150,
finishImageList: [],
value: "1235",
content: "确认您的发票信息无误后再提交",
toggleIndex: true,
logisticsIndex: -1,
array: ['已收到货', '未收到货'],
applyIndex: -1,
array1: ['不喜欢、效果不好', '不想要了', "外观、型号、参数与描述不符", '货物与描述不符', '商品有划痕或破损', '配件、部件、屏幕问题', '质量问题', '收到商品少件(含少配件)',
'商品破损或污渍', '商家发错货'
],
receiveState: '',
applyState: '',
contentNotes: '',
deliveryStatus: '',
receiptStatus: '',
phone: '',
10 months ago
imageList: [],
maxImageLength: 6,
9 months ago
imagesId: '',
action: '',
header: '',
type: 1,
9 months ago
}
},
onReady() {
this.action = (Config.get('apiUrl') + 'upload/image').replace("index.php?s=/", "")
this.header = {
'Storeid': uni.getStorageSync('Store').storeInfo.store_id,
'Access-Token': uni.getStorageSync('AccessToken'),
'platform': "MP-WEIXIN",
}
},
onLoad(op) {
this.deliveryStatus = op.deliveryStatus;
this.type = op.type;
this.receiptStatus = op.receiptStatus;
this.orderId = op.orderId
10 months ago
this.order = op.order ? JSON.parse(op.order) : '';
this.value = this.order.is_user_grade ? this.order.grade_goods_price : this.order.goods_price;
},
methods: {
9 months ago
//接受上传返回的数据
onSuccess(list) {
if (list.length > 0) {
const {
response
} = list[0];
if (response.status == 200) {
uni.showToast({
title: "上传成功"
})
9 months ago
this.imagesId = this.handleRemove('', list);
}
9 months ago
}
},
9 months ago
onRemove(file, fileList) {
this.imagesId = this.handleRemove(file, fileList);
},
handleRemove: function(file, fileList) {
let idList = []
fileList.forEach(item => {
idList.push(item.response.data.fileInfo.file_id)
});
return idList.join(',')
9 months ago
},
onValue(e) {
if ((Number(e.detail.value) > Number(this.value)) == false) {
this.value = this.order.is_user_grade ? this.order.grade_goods_price : this.order.goods_price
uni.showToast({
title: '输入金额不能大于付款金额',
icon: 'none',
duration: 2000
})
return
} else {
this.value = e.detail.value
}
},
// 获取当前订单信息
toDetail(canReset = false) {
const app = this
if (app.logisticsIndex == -1) {
uni.showToast({
title: '请选择收货状态',
icon: 'none',
duration: 2000
})
return
}
if (app.applyIndex == -1) {
uni.showToast({
title: '请选择申请理由',
icon: 'none',
duration: 2000
})
return
}
if (!app.contentNotes) {
uni.showToast({
title: '请输入申请说明',
icon: 'none',
duration: 2000
})
return
}
9 months ago
if (!app.imagesId && ((app.deliveryStatus == DeliveryStatusEnum.DELIVERED.value) && (app.receiptStatus ==
ReceiptStatusEnum.RECEIVED.value))) {
uni.showToast({
title: '请上传图片',
icon: 'none',
duration: 2000
})
return
}
app.isLoading = true;
let obj = {
type: app.type == 1? 10 : 30,
content: app.contentNotes,
10 months ago
images: app.imagesId,
phone: app.phone,
receiveName: app.receiveState,
applyName: app.applyState,
}
refundApi.apply(app.orderId, obj)
.then(result => {
if (result.status == 200) {
uni.showToast({
title: '申请成功',
icon: 'none',
duration: 2000
})
uni.navigateTo({
url: "/pages/refund/index"
})
} else {
uni.showToast({
title: '申请失败',
icon: 'none',
duration: 2000
})
}
})
// 相应全局事件订阅: 刷新上级页面数据
canReset && uni.$emit('syncRefresh', true, true)
},
onClose() {},
toggleItem(i) {
this.toggleIndex = !this.toggleIndex;
},
bindPickerChange(e) {
this.receiveState = this.array[e.detail.value]
this.logisticsIndex = e.detail.value
},
bindPickerChange1(e) {
this.applyIndex = e.detail.value;
this.applyState = this.array1[e.detail.value]
}
}
}
</script>
<style lang="scss" scoped>
.invoice {
overflow: hidden;
&-goods {
padding: 0 20rpx 0 40rpx;
overflow: hidden;
background-color: #fff;
padding: 30rpx;
box-sizing: border-box;
display: flex;
align-items: center;
.a {
width: 145rpx;
height: 135rpx;
margin-right: 20rpx;
image {
width: 100%;
height: 100%;
border-radius: 10rpx;
}
}
.b {
flex: 1;
overflow: hidden;
.l {
white-space: nowrap;
text-overflow: ellipsis;
font-size: 32rpx;
font-family: PingFang SC, PingFang SC;
font-weight: 500;
color: #262626;
overflow: hidden;
}
.r {
font-size: 30rpx;
font-family: PingFang SC, PingFang SC;
font-weight: 400;
color: #838383;
display: flex;
align-items: center;
justify-content: space-between;
margin-top: 20rpx;
text {
display: block;
font-size: 28rpx;
color: #555;
}
}
}
}
&-info {
margin-top: 20rpx;
background-color: #fff;
overflow: hidden;
.a {
display: flex;
align-items: center;
justify-content: space-between;
padding: 20rpx 30rpx 20rpx 60rpx;
box-sizing: border-box;
border-bottom: 1px solid #F3F3F3;
font-size: 32rpx;
font-weight: 500;
color: #262626;
text {
color: #006AFF;
padding-right: 40rpx;
position: relative;
&::after {
content: "";
width: 16rpx;
height: 16rpx;
border-top: 1px solid #006AFF;
border-left: 1px solid #006AFF;
position: absolute;
right: 0;
top: 14rpx;
z-index: 1;
transform: rotate(135deg);
}
}
}
.b {
padding: 0 30rpx 0 45rpx;
box-sizing: border-box;
overflow: hidden;
.item {
padding: 30rpx 0;
display: flex;
align-items: center;
justify-content: space-between;
box-sizing: border-box;
border-top: 1px solid #F3F3F3;
font-size: 32rpx;
font-weight: 500;
color: #262626;
overflow: hidden;
&:first-child {
border-top-color: #fff;
}
.l {
width: 180rpx;
font-size: 32rpx;
font-weight: 400;
color: #656565;
}
.r {
flex: 1;
display: flex;
align-items: center;
font-size: 32rpx;
font-weight: 400;
color: #262626;
.li {
width: 150rpx;
height: 78rpx;
background: #F3F3F3;
border-radius: 8rpx;
text-align: center;
line-height: 78rpx;
font-size: 32rpx;
font-weight: 400;
color: #262626;
margin-right: 12rpx;
&-on {
background: #FDF4F4;
background: url(/static/invoice/select-active.png) center top no-repeat;
background-size: contain;
}
}
input {
flex: 1;
}
picker {
flex: 1;
.tt {
width: 180rpx;
position: relative;
color: #4894FF;
text-align: right;
&::after {
content: "";
width: 16rpx;
height: 16rpx;
border-top: 1px solid #4894FF;
border-left: 1px solid #4894FF;
position: absolute;
right: -50rpx;
top: 14rpx;
z-index: 1;
transform: rotate(135deg);
}
}
.lx {
width: 100%;
position: relative;
&-on {
color: #B8B8B8;
}
&::after {
content: "";
width: 16rpx;
height: 16rpx;
border-top: 1px solid #B8B8B8;
border-left: 1px solid #B8B8B8;
position: absolute;
right: 20rpx;
top: 14rpx;
z-index: 1;
transform: rotate(135deg);
}
}
}
}
}
}
}
9 months ago
&-money {
width: 100%;
background: #FFFFFF;
margin-top: 20rpx;
padding: 26rpx 26rpx 26rpx 48rpx;
box-sizing: border-box;
overflow: hidden;
.a {
padding-bottom: 10rpx;
font-size: 32rpx;
font-weight: 400;
color: #838383;
}
.b {
display: flex;
align-items: center;
justify-content: space-between;
.l {
font-size: 40rpx;
font-weight: 600;
color: #262626;
display: flex;
align-items: baseline;
input,
.money {
width: 400rpx;
font-size: 52rpx;
color: #212121;
margin-left: 15rpx;
}
.box {
font-size: 26rpx;
color: #B8B8B8;
font-weight: normal;
}
}
.r {
font-size: 28rpx;
font-weight: 400;
color: #C2C2C2;
display: flex;
align-items: center;
image {
width: 36rpx;
height: 36rpx;
margin-right: 10rpx;
}
}
}
}
&-remark {
width: 100%;
background: #FFFFFF;
overflow: hidden;
margin-top: 20rpx;
padding: 26rpx 26rpx 26rpx 48rpx;
box-sizing: border-box;
9 months ago
margin-bottom: 200rpx;
.a {
display: flex;
align-items: center;
justify-content: space-between;
padding: 15rpx 0;
.l {
font-size: 32rpx;
font-family: PingFang SC, PingFang SC;
font-weight: 400;
color: #838383;
text {
font-size: 28rpx;
font-weight: 400;
color: #F55349;
}
}
.r {
font-size: 24rpx;
font-weight: 400;
color: #A8A8A8;
}
}
.c {
padding-bottom: 20rpx;
overflow: hidden;
.slot-btn {
9 months ago
width: 180rpx;
height: 180rpx;
background: #FFFFFF;
border-radius: 10rpx;
border: 1px solid #C0C0C0;
text-align: center;
font-size: 24rpx;
font-weight: 500;
color: #D1D1D1;
image {
width: 50rpx;
height: 50rpx;
9 months ago
margin-top: 35rpx;
}
}
}
}
&-phone {
overflow: hidden;
background-color: #fff;
padding: 30rpx 26rpx 30rpx 48rpx;
box-sizing: border-box;
margin-top: 20rpx;
font-size: 32rpx;
font-weight: 500;
color: #838383;
display: flex;
align-items: center;
justify-content: space-between;
input {
flex: 1;
margin-left: 20rpx;
font-size: 32rpx;
color: #212121;
}
}
}
10 months ago
9 months ago
.goods-fd {
width: 100%;
position: fixed;
left: 0;
bottom: 0;
padding: 0.9375rem;
z-index: 99;
background-color: #fafafa;
box-sizing: border-box;
9 months ago
9 months ago
.btn {
width: 630rpx;
line-height: 88rpx;
background: #F34A40;
border-radius: 88rpx;
text-align: center;
font-size: 28rpx;
font-weight: 500;
color: #FFFFFF;
margin: auto;
10 months ago
}
}
</style>