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

659 lines
15 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">
{{((deliveryStatus == DeliveryStatusEnum.DELIVERED.value) && (receiptStatus == ReceiptStatusEnum.RECEIVED.value))?'我要退款(需退货)':'我要退款(无需退货)'}}
</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()">
<image src="@/static/news/icon-edit.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>
<view class="c"
v-if="(deliveryStatus == DeliveryStatusEnum.DELIVERED.value) && (receiptStatus == ReceiptStatusEnum.RECEIVED.value)">
<u-upload :fileList="finishImageList" :previewFullImage="true" @afterRead="afterRead" :maxCount="5"
@delete="deletePic" name="1" multiple max-count="5">
<template v-slot:addBtn>
<view class="slot-btn" hover-class="slot-btn__hover" hover-stay-time="150">
<image src="/static/news/icon-upload.png"></image>
<view class="1">上传图片</view>
<view class="1">最多5张</view>
</view>
</template>
</u-upload>
</view>
</view>
<view class="invoice-phone">
联系电话<input type="number" placeholder="" v-model="phone" />
</view>
<view class="invoice-fd" @click="toDetail()">
提交申请
</view>
</view>
</template>
<script>
import * as refundApi from '@/api/refund'
import * as OrderApi from '@/api/order'
import {
OrderTypeEnum,
DeliveryStatusEnum,
DeliveryTypeEnum,
OrderStatusEnum,
PayStatusEnum,
ReceiptStatusEnum
} from '@/common/enum/order'
import {
DeliveryMethodEnum
} from '@/common/enum/order/delivery'
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: '',
};
},
onLoad(op) {
console.log(op)
this.deliveryStatus = op.deliveryStatus;
this.receiptStatus = op.receiptStatus;
this.orderId = op.orderId
this.order = JSON.parse(op.order);
this.value = this.order.is_user_grade ? this.order.grade_goods_price : this.order.goods_price;
},
methods: {
// 新增图片
async afterRead(event) {
// 当设置 multiple 为 true 时, file 为数组格式,否则为对象格式
let lists = [].concat(event.file)
let fileListLen = this[`fileList${event.name}`].length
lists.map((item) => {
this[`fileList${event.name}`].push({
...item,
status: 'uploading',
message: '上传中'
})
})
for (let i = 0; i < lists.length; i++) {
const result = await this.uploadFilePromise(lists[i].url)
if (JSON.parse(result).code == 1) {
let item = this[`fileList${event.name}`][fileListLen]
this[`fileList${event.name}`].splice(fileListLen, 1, Object.assign(item, {
status: 'success',
message: '',
url: result
}))
fileListLen++
} else {
this[`fileList${event.name}`].splice(fileListLen, 1)
}
}
},
//上传照片
uploadFilePromise(url) {
return new Promise((resolve, reject) => {
let a = uni.uploadFile({
url: this.baseUrl + '/api/common/upload', // 仅为示例,非真实的接口地址
filePath: url,
name: 'file',
formData: {
user: 'test',
token: getToken()
},
success: (res) => {
if (JSON.parse(res.data).code == 1) {
setTimeout(() => {
this.finishImageList.push({
url: JSON.parse(res.data).data.fullurl,
path: JSON.parse(res.data).data.url
})
resolve(res.data)
}, 1000)
} else {
uni.$u.toast(JSON.parse(res.data).msg)
resolve(res.data)
}
},
fail: (res) => {
console.log(res, "rrr")
}
});
})
},
//删除图片
deletePic(event) {
console.log(event)
// this[`fileList${event.name}`].splice(event.index, 1)
this.finishImageList.splice(event.index, 1)
},
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
}
app.isLoading = true;
let obj = {
type: (app.deliveryStatus == DeliveryStatusEnum.DELIVERED.value) && (app.receiptStatus ==
ReceiptStatusEnum.RECEIVED.value) ? 20 : 10,
content: app.contentNotes,
images: [],
phone: app.phone,
receiveName: app.receiveState,
applyName: app.applyState,
}
console.log(obj)
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 {
&-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);
}
}
}
}
}
}
}
&-fd {
width: 664rpx;
height: 104rpx;
background: #F55349;
border-radius: 8rpx;
text-align: center;
margin: 0 auto;
margin-top: 60rpx;
font-size: 32rpx;
font-weight: 500;
color: #FFFFFF;
display: flex;
align-items: center;
justify-content: center;
}
&-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;
.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 {
width: 80px;
height: 80px;
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;
margin-top: 20rpx;
}
}
}
}
&-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;
}
}
}
</style>