代码提交
This commit is contained in:
@ -1,21 +1,21 @@
|
||||
<template>
|
||||
<layout>
|
||||
<uv-navbar
|
||||
:fixed="false"
|
||||
:title="title"
|
||||
left-arrow
|
||||
@leftClick="$onClickLeft"
|
||||
:fixed="false"
|
||||
:title="title"
|
||||
left-arrow
|
||||
@leftClick="goBack"
|
||||
/>
|
||||
<div v-if="orderInfoData">
|
||||
<div class="mb-20">
|
||||
<card v-for="(item, index) in goodsList">
|
||||
<goods
|
||||
list
|
||||
interval
|
||||
showAction
|
||||
model
|
||||
:price="item.cartInfo.productInfo.price"
|
||||
:data="item.cartInfo.productInfo"
|
||||
list
|
||||
interval
|
||||
showAction
|
||||
model
|
||||
:price="item.cartInfo.truePrice"
|
||||
:data="item.cartInfo.productInfo"
|
||||
>
|
||||
</goods>
|
||||
</card>
|
||||
@ -37,26 +37,57 @@
|
||||
</view>
|
||||
</uv-list-item> -->
|
||||
<uv-list-item
|
||||
border
|
||||
title="退款原因"
|
||||
clickable
|
||||
right-text="请选择"
|
||||
show-arrow
|
||||
@click=""
|
||||
border
|
||||
title="货物状态"
|
||||
clickable
|
||||
right-text="请选择"
|
||||
show-arrow
|
||||
v-if="refundType === 1"
|
||||
>
|
||||
<view class="y-list-content">
|
||||
<view class="y-list-label">退款原因</view>
|
||||
<view class="y-list-label">货物状态</view>
|
||||
<view
|
||||
class="y-list-select-placeholder"
|
||||
@tap="openReasonForApplicationPicker"
|
||||
v-if="!data.reasonForApplication"
|
||||
class="y-list-select-placeholder"
|
||||
@tap="openReceivingStatusPicker"
|
||||
v-if="!data.receivingStatus"
|
||||
>
|
||||
请选择
|
||||
</view>
|
||||
<view
|
||||
class="y-list-select"
|
||||
@tap="openReasonForApplicationPicker"
|
||||
v-if="data.reasonForApplication"
|
||||
class="y-list-select"
|
||||
@tap="openReceivingStatusPicker"
|
||||
v-if="data.receivingStatus"
|
||||
>
|
||||
{{ data.receivingStatus }}
|
||||
</view>
|
||||
</view>
|
||||
<uv-picker
|
||||
ref="receivingStatusPicker"
|
||||
:columns="receivingStatusClumns"
|
||||
@confirm="receivingStatusConfirm"
|
||||
></uv-picker>
|
||||
</uv-list-item>
|
||||
<uv-list-item
|
||||
border
|
||||
title="退款原因"
|
||||
clickable
|
||||
right-text="请选择"
|
||||
show-arrow
|
||||
@click=""
|
||||
>
|
||||
<view class="y-list-content">
|
||||
<view class="y-list-label">退款原因</view>
|
||||
<view
|
||||
class="y-list-select-placeholder"
|
||||
@tap="openReasonForApplicationPicker"
|
||||
v-if="!data.reasonForApplication"
|
||||
>
|
||||
请选择
|
||||
</view>
|
||||
<view
|
||||
class="y-list-select"
|
||||
@tap="openReasonForApplicationPicker"
|
||||
v-if="data.reasonForApplication"
|
||||
>
|
||||
{{ data.reasonForApplication }}
|
||||
</view>
|
||||
@ -64,9 +95,9 @@
|
||||
</uv-list-item>
|
||||
</uv-list>
|
||||
<uv-picker
|
||||
ref="reasonForApplicationPicker"
|
||||
:columns="reasonForApplication"
|
||||
@confirm="reasonForApplicationConfirm"
|
||||
ref="reasonForApplicationPicker"
|
||||
:columns="reasonForApplication"
|
||||
@confirm="reasonForApplicationConfirm"
|
||||
></uv-picker>
|
||||
</view>
|
||||
<view class="y-list">
|
||||
@ -84,9 +115,9 @@
|
||||
<view class="y-list-label">申请说明</view>
|
||||
<view class="y-list-input">
|
||||
<uv-input
|
||||
placeholder="请输入内容"
|
||||
border="none"
|
||||
v-model="data.applicationInstructions"
|
||||
placeholder="请输入内容"
|
||||
border="none"
|
||||
v-model="data.applicationInstructions"
|
||||
></uv-input>
|
||||
</view>
|
||||
</view>
|
||||
@ -105,10 +136,10 @@
|
||||
</div>
|
||||
<div class="form-buttons">
|
||||
<uv-button
|
||||
round
|
||||
block
|
||||
type="primary"
|
||||
@tap="handleApplyForAfterSales"
|
||||
round
|
||||
block
|
||||
type="primary"
|
||||
@tap="handleApplyForAfterSales"
|
||||
>
|
||||
提交
|
||||
</uv-button>
|
||||
@ -118,19 +149,27 @@
|
||||
|
||||
<script setup>
|
||||
|
||||
import { ref, watch, computed } from 'vue'
|
||||
import { applyForAfterSalesInfo, applyForAfterSales } from '@/api/order'
|
||||
import { navigateTo, back } from '@/utils/router'
|
||||
import { computed, ref } from 'vue'
|
||||
import { applyForAfterSales, applyForAfterSalesInfo } from '@/api/order'
|
||||
import { onLoad } from '@dcloudio/uni-app'
|
||||
import { useRouter } from "@/hooks/useRouter";
|
||||
import { useInterface } from "@/hooks/useInterface";
|
||||
|
||||
const {toast} = useInterface()
|
||||
const {getParams, goBack, push} = useRouter()
|
||||
const goodsList = ref([])
|
||||
const goodsSelect = ref([])
|
||||
const totalPrice = ref(0);
|
||||
const orderInfoData = ref(null)
|
||||
const reasonForApplicationPicker = ref(null)
|
||||
const receivingStatusPicker = ref(null)
|
||||
|
||||
const refundType = ref(null)
|
||||
const list = ref([])
|
||||
const receivingStatusClumns = ref([[
|
||||
'未收到货',
|
||||
'已收到货'
|
||||
]])
|
||||
const reasonForApplication = ref([
|
||||
[
|
||||
"收货地址填错了",
|
||||
@ -152,29 +191,42 @@ const data = ref({
|
||||
"applicationInstructions": "",
|
||||
// 申请说明图片
|
||||
"applicationDescriptionPicture": "",
|
||||
"productParamList": []
|
||||
"productParamList": [],
|
||||
receivingStatus: null
|
||||
})
|
||||
|
||||
|
||||
const title = computed(() => {
|
||||
return refundType.value == 0 ? `申请退款` : '申请退货退款';
|
||||
return refundType.value === 0 ? `申请退款` : '申请退货退款';
|
||||
});
|
||||
|
||||
// 打开退款原因窗口
|
||||
const openReasonForApplicationPicker = () => {
|
||||
reasonForApplicationPicker.value.open();
|
||||
}
|
||||
|
||||
// 退款原因窗口确认
|
||||
const reasonForApplicationConfirm = (e) => {
|
||||
data.value.reasonForApplication = e.value[0]
|
||||
reasonForApplicationPicker.value.close();
|
||||
}
|
||||
|
||||
// 打开货物状态窗口
|
||||
const openReceivingStatusPicker = () => {
|
||||
receivingStatusPicker.value.open();
|
||||
}
|
||||
|
||||
// 货物状态窗口确认
|
||||
const receivingStatusConfirm = (e) => {
|
||||
data.value.receivingStatus = e.value[0]
|
||||
receivingStatusPicker.value.close();
|
||||
}
|
||||
|
||||
|
||||
const handleOrderInfo = async (option) => {
|
||||
const res = await applyForAfterSalesInfo(option)
|
||||
orderInfoData.value = res
|
||||
goodsList.value = res.filter(item => goodsSelect.value.includes(item.id))
|
||||
goodsList.value = res.filter(item => goodsSelect.value.includes(item.cartInfo.productAttrUnique))
|
||||
|
||||
let price = 0
|
||||
let productParamList = []
|
||||
@ -182,20 +234,26 @@ const handleOrderInfo = async (option) => {
|
||||
goodsList.value.forEach(item => {
|
||||
price += item.cartInfo.truePrice * item.cartInfo.cartNum
|
||||
productParamList.push({
|
||||
productId: item.id
|
||||
productId: item.productId
|
||||
})
|
||||
})
|
||||
|
||||
totalPrice.value = price
|
||||
data.value.orderId = option.orderId
|
||||
data.value.orderId = res[0].orderId
|
||||
data.value.serviceType = refundType.value
|
||||
data.value.productParamList = productParamList
|
||||
|
||||
}
|
||||
|
||||
|
||||
const handleApplyForAfterSales = async () => {
|
||||
|
||||
if (!data.value.receivingStatus && refundType.value===1) {
|
||||
uni.showToast({
|
||||
icon: "none",
|
||||
title: '请选择货物状态',
|
||||
duration: 2000
|
||||
});
|
||||
return
|
||||
}
|
||||
if (!data.value.reasonForApplication) {
|
||||
uni.showToast({
|
||||
icon: "none",
|
||||
@ -212,32 +270,37 @@ const handleApplyForAfterSales = async () => {
|
||||
});
|
||||
return
|
||||
}
|
||||
|
||||
console.log("--> % handleApplyForAfterSales % data.value:\n", data.value)
|
||||
console.log("gxs --> % handleApplyForAfterSales % list.value:\n", list.value)
|
||||
data.value.receivingStatus = data.value.receivingStatus === '未收到货'?0:1
|
||||
let res = await applyForAfterSales({
|
||||
...data.value,
|
||||
applicationDescriptionPicture: list.value.join(',')
|
||||
applicationDescriptionPicture: list.value.map(v => {
|
||||
return v.url
|
||||
}).join(',')
|
||||
})
|
||||
toast({
|
||||
title: '申请成功,请等待审核'
|
||||
})
|
||||
push({url: '/pages/refundInfo/refundInfo'}, {
|
||||
data: {
|
||||
id: res,
|
||||
}
|
||||
})
|
||||
back()
|
||||
console.log("--> % handleApplyForAfterSales % res:\n", res)
|
||||
}
|
||||
|
||||
onLoad((option) => {
|
||||
handleOrderInfo({
|
||||
key: option.id
|
||||
})
|
||||
goodsSelect.value = option.goods
|
||||
refundType.value = option.refundType
|
||||
|
||||
|
||||
onLoad((options) => {
|
||||
const params = getParams(options)
|
||||
params.key = params.id
|
||||
handleOrderInfo(params)
|
||||
goodsSelect.value = params.goods
|
||||
refundType.value = params.refundType
|
||||
})
|
||||
|
||||
|
||||
</script>
|
||||
|
||||
<style lang="less">
|
||||
.shopping-checkbox {}
|
||||
<style lang="scss">
|
||||
.shopping-checkbox {
|
||||
}
|
||||
|
||||
.shopping-action {
|
||||
padding-left: 34rpx;
|
||||
|
Reference in New Issue
Block a user