代码提交

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

@ -42,7 +42,7 @@
:class="data.state === 3 && 'color-y'"
>{{ data.state === 3 ? '成功退款' : '待平台处理' }}
</text>
<text class="text">{{ data.state === 3 ? '成功' : '' }}退款¥{{data.refundAmount}}</text>
<text class="text">{{ data.state === 3 ? '成功' : '' }}退款¥{{data.refundAmount.toFixed(2)}}</text>
</view>
<view class="order-actions">
@ -52,14 +52,14 @@
<view class="order-actions-btns">
<view
class="order-actions-default"
@tap="handleDelete"
@tap="showModal(0)"
v-if="[3,4].includes(data.state)"
>
删除记录
</view>
<view
class="order-actions-default"
@tap="handleRevoke"
@tap="showModal(1)"
v-if="[0,1].includes(data.state)"
>
撤销申请
@ -88,17 +88,20 @@
</view>
</view>
<Modal ref="modalRef" :content="modalTitle" @confirm="confirmModal" />
</view>
</template>
<script setup>
import { ref } from 'vue';
import { computed, ref, unref } from 'vue';
import { afterSalesOrderDelete, afterSalesOrderRevoke } from '@/api/order'
import Modal from '@/components/Modal/index.vue'
import { useRouter } from "@/hooks/useRouter";
import { refundOrderStatus } from '@/config'
import { useInterface } from "@/hooks/useInterface";
const {push} = useRouter()
const {toast} = useInterface();
const emit = defineEmits(['refresh'])
@ -115,48 +118,54 @@ const couponPrice = ref(props.data.couponPrice)
// 订单总价
const totalPrice = ref(props.data.totalPrice)
// 删除记录
const handleDelete = async () => {
uni.showModal({
title: '提示',
content: '确认删除记录',
success: async (res) => {
if (res.confirm) {
await afterSalesOrderDelete({
id: data.value.id,
orderCode: data.value.orderCode
})
data.value = null
uni.showToast({
title: '已删除',
duration: 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: data.value.id,
key: data.value.orderCode
})
data.value = null
uni.showToast({
title: '已撤销',
duration: 2000
});
} else if (res.cancel) {
}
}
});
/**
* 确认弹窗
*/
function confirmModal(){
const funcArr = [doDeleteRequest,doRevoke]
funcArr[modalType.value]()
}
/**
* 确认删除
* @returns {Promise<void>}
*/
async function doDeleteRequest(){
await afterSalesOrderDelete({
id: data.value.id,
orderCode: data.value.orderCode
})
data.value = null
toast({title: '已删除'});
}
/**
* 确认撤销
* @returns {Promise<void>}
*/
async function doRevoke(){
await afterSalesOrderRevoke({
id: data.value.id,
key: data.value.orderCode
})
data.value = null
toast({title: '已撤销'});
}
// 查看详情
@ -164,6 +173,7 @@ const toOrderInfo = () => {
push({url: '/pages/refundInfo/refundInfo'}, {
data: {
id: data.value.id,
orderId: data.value.orderId
}
})
}
@ -181,7 +191,6 @@ const toAddLogistics = () => {
// 再次申请
const toRefund = () => {
console.log(data.value)
push({url: '/pages/refund/refund'}, {
data: {
refundType: data.value.serviceType,