代码提交

This commit is contained in:
黄少君
2023-11-17 20:55:32 +08:00
parent 35b43ffd97
commit c3e62f8922
73 changed files with 1808 additions and 781 deletions

View File

@ -11,7 +11,7 @@
<view class="background">
<image
class="image"
src="@/static/images/refund-order-bg.png"
src="https://b2c-pro-static-dev.zkthink.com/static/images/refund-order-bg.png"
mode="widthFix"
/>
</view>
@ -23,15 +23,15 @@
{{refundOrderStatus[orderInfoData.state]}}
</view>
</view>
<view class="order-date">
还剩1天20小时自动确认
<view class="order-date" v-if="parseInt(orderInfoData.remainTime) > 0 && ![3,4].includes(orderInfoData.state)">
还剩{{remainTimeStr}}自动确认
</view>
</view>
<!-- <view class="address noBorder">-->
<!-- <view class="address-icon">-->
<!-- <image-->
<!-- class="image"-->
<!-- src="@/static/images/icon-location.png"-->
<!-- src="https://b2c-pro-static-dev.zkthink.com/static/images/icon-location.png"-->
<!-- />-->
<!-- </view>-->
<!-- <view class="address-main">-->
@ -152,7 +152,7 @@
退款金额
</view>
<view class="info-cell-value">
¥{{ orderInfoData.refundAmount }}
¥{{ orderInfoData.refundAmount.toFixed(2) }}
</view>
</view>
@ -243,14 +243,14 @@
<view class="order-actions-btns">
<view
class="order-actions-default"
@tap="handleDelete"
@tap="showModal(0)"
v-if="[3,4].includes(orderInfoData.state)"
>
删除记录
</view>
<view
class="order-actions-default"
@tap="handleRevoke"
@tap="showModal(1)"
v-if="[0,1].includes(orderInfoData.state)"
>
撤销申请
@ -274,12 +274,14 @@
</view>
</layout>
<Modal ref="modalRef" :content="modalTitle" @confirm="confirmModal" />
</template>
<script setup>
import { ref } from 'vue'
import { computed, ref, unref } from 'vue'
import { onLoad } from '@dcloudio/uni-app'
import { useMainStore } from '@/store/store'
import { formatDate } from '@/utils/utils'
import {
orderCancel,
checkForAfterSalesInfo,
@ -291,6 +293,8 @@ import {
import { orderReStatus } from '@/config'
import { useRouter } from "@/hooks/useRouter";
import {useGlobalProperties} from "@/hooks";
import { formatRemainTime } from '@/utils/utils'
import Modal from "@/components/Modal/index.vue";
const {$timeFormat} = useGlobalProperties()
const {getParams,push,goBack} = useRouter()
@ -298,7 +302,9 @@ const {getParams,push,goBack} = useRouter()
const orderInfoData = ref(null)
const orderInfoStatusMsg = ref('')
const expressData = ref(null)
const id = ref(0)
const orderId = ref(0)
const remainTimeStr = ref('')
const refundOrderStatus = ref({
0: '请耐心等待平台审核',
1: '平台已同意退货申请,请尽早退货',
@ -312,54 +318,67 @@ const refundOrderStatus = ref({
const handleOrderInfo = async (option) => {
const res = await checkForAfterSalesInfo(option)
orderInfoData.value = res
remainTimeStr.value = formatRemainTime(orderInfoData.value.remainTime)
}
// 删除记录
const handleDelete = async () => {
uni.showModal({
title: '提示',
content: '确认删除记录',
success: async (res) => {
if (res.confirm) {
await afterSalesOrderDelete({
id: orderId.value,
orderCode: orderInfoData.value.orderId
})
uni.showToast({
title: '已删除',
duration: 2000
});
setTimeout(()=>{
toRefundList()
},2000)
} else if (res.cancel) {
}
}
});
const modalRef = ref()
const modalType = ref(0) // 0删除记录 1撤销申请
const modalTitle = computed(()=>{
const tipsArr = ['确认删除记录吗?','确认撤销申请吗?']
return tipsArr[modalType.value]
})
/**
* 打开弹窗
* @param {number} type 0删除记录 1撤销申请
*/
function showModal(type){
modalType.value = type
unref(modalRef).show()
}
// 撤销申请
const handleRevoke = async () => {
uni.showModal({
title: '提示',
content: '确认撤销申请吗',
success: async (res) => {
if (res.confirm) {
await afterSalesOrderRevoke({
id: orderId.value,
key: orderInfoData.value.orderId
})
uni.showToast({
title: '已撤销',
duration: 2000
});
setTimeout(()=>{
toRefundList()
},2000)
} else if (res.cancel) {
}
}
/**
* 确认弹窗
*/
function confirmModal(){
const funcArr = [doDeleteRequest,doRevoke]
funcArr[modalType.value]()
}
/**
* 确认删除
* @returns {Promise<void>}
*/
async function doDeleteRequest(){
await afterSalesOrderDelete({
id: id.value,
orderCode: orderInfoData.value.orderId
})
uni.showToast({
title: '已删除',
duration: 2000
});
setTimeout(()=>{
toRefundList()
},2000)
}
/**
* 确认撤销
* @returns {Promise<void>}
*/
async function doRevoke(){
await afterSalesOrderRevoke({
id: id.value,
key: orderInfoData.value.orderId
})
uni.showToast({
title: '已撤销',
duration: 2000
});
setTimeout(()=>{
toRefundList()
},2000)
}
// 跳转列表
@ -386,14 +405,15 @@ const toRefund = () => {
goods: orderInfoData.value.cartInfo.map(v=>{
return v.productAttrUnique
}).toString(),
id: orderInfoData.value.id
id: orderId.value
}
})
}
onLoad((options) => {
const params = getParams(options)
orderId.value = params.id
id.value = params.id
orderId.value = params.orderId
handleOrderInfo({
key: params.id
})
@ -431,10 +451,10 @@ onLoad((options) => {
background-position: left center;
background-repeat: no-repeat;
&.order-status-0,&.order-status-1,&.order-status-2,&.order-status-5{
background-image: url("../../static/images/icon-order-info-5.png");
background-image: url("https://b2c-pro-static-dev.zkthink.com/static/images/icon-order-info-5.png");
}
&.order-status-3,&.order-status-4{
background-image: url("../../static/images/icon-order-info-4.png");
background-image: url("https://b2c-pro-static-dev.zkthink.com/static/images/icon-order-info-4.png");
}
.image {
width: 40rpx;