代码提交

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/order-info-bg.png"
src="https://b2c-pro-static-dev.zkthink.com/static/images/order-info-bg.png"
mode="widthFix"
/>
</view>
@ -23,12 +23,12 @@
>
<!-- <image
class="image"
src="@/static/images/kjzq.png"
src="https://b2c-pro-static-dev.zkthink.com/static/images/kjzq.png"
/> -->
<view>{{ orderInfoStatusMsg }}</view>
<view>{{ orderInfoData._status._title }}</view>
</view>
<view class="order-date">
{{ orderInfoData._status._msg }}
{{orderInfoData._status._type === "2"?`${remainTimeStr}`:orderInfoData._status._msg }}
</view>
</view>
<view class="address noBorder">
@ -36,7 +36,7 @@
<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">
@ -58,7 +58,7 @@
<view class="order-logo">
<image
class="image"
src="@/static/images/flashKilling.png"
src="https://b2c-pro-static-dev.zkthink.com/static/images/flashKilling.png"
alt=""
/>
</view>
@ -142,7 +142,7 @@
</view>
<view
class="info-cell"
v-if="orderInfoData.status > 0"
v-if="orderInfoData.status > 0 && orderInfoData.payTime"
>
<view class="info-cell-label">
付款时间
@ -210,7 +210,7 @@
<view class="order-actions-btns">
<view
class="order-actions-delete"
@tap="handleCancel"
@tap="showModal(1)"
>
取消订单
</view>
@ -255,7 +255,7 @@
</view>
<view
class="order-actions-primary"
@tap="handleOrderTake"
@tap="showModal(2)"
>
确认收货
</view>
@ -296,7 +296,7 @@
<view class="order-actions-btns">
<view
class="order-actions-delete"
@tap="handleDelete"
@tap="showModal(0)"
>
删除订单
</view>
@ -357,12 +357,16 @@
<!-- 支付弹窗 -->
<PayPopup
ref="payPopupRef"
@confrim="paySucess"
@confrim="paySuccess"
/>
<Modal ref="modalRef" :content="modalTitle" @confirm="confirmModal" />
</template>
<script setup>
import { ref, unref } from 'vue'
import { computed, ref, unref } from 'vue'
import { onLoad } from '@dcloudio/uni-app'
import { orderCancel, orderDelete, orderExpress, orderInfo, orderTake } from '@/api/order'
import { orderReStatus } from '@/config'
@ -370,14 +374,20 @@ import { useRouter } from "@/hooks/useRouter";
import { useShearPlate } from "@/hooks/useShearPlate";
import { useGlobalProperties } from "@/hooks";
import PayPopup from "@/components/PayPopup/index.vue";
import Modal from "@/components/Modal/index.vue";
import { useInterface } from "@/hooks/useInterface";
import {formatRemainTime} from "@/utils/utils";
const {$timeFormat} = useGlobalProperties()
const {getParams, push, goBack} = useRouter()
const {toast} = useInterface();
const orderInfoData = ref(null)
const orderInfoStatusMsg = ref('')
const expressData = ref(null)
const remainTimeStr = ref('')
const {setData} = useShearPlate();
@ -387,7 +397,11 @@ const handleOrderInfo = async (option) => {
orderInfoData.value = res
res.status = res.paid === 1 && res.status === 0 ? 99 : res.status
handleMsg(res.status)
if (res._status._type > 1) {
if (parseInt(res._status._type) > 1) {
console.log(parseInt(res._status._type),'parseInt(res._status._type)')
if(parseInt(res._status._type) === 2){
remainTimeStr.value = formatRemainTime(res._status._payRemainTime)
}
const express = await orderExpress({
orderCode: orderInfoData.value.orderId,
shipperCode: orderInfoData.value.deliverySn,
@ -398,41 +412,10 @@ const handleOrderInfo = async (option) => {
}
const handleOrderTake = async () => {
uni.showModal({
title: '提示',
content: '确认收货',
success: async (res) => {
if (res.confirm) {
let option = {
uni: orderInfoData.value.orderId,
}
const res = await orderTake(option)
uni.showToast({
title: '收货成功',
duration: 2000
});
handleOrderInfo({
key: option.uni
})
} else if (res.cancel) {
}
}
});
}
const handlePay = () => {
openPay(orderInfoData.value.orderId)
// push({url: '/pages/selectPlay/selectPlay'}, {
// data: {
// key: orderInfoData.value.unique,
// orderId: orderInfoData.value.orderId,
// }
// })
}
// 返回列表
@ -454,7 +437,8 @@ const goList = ()=>{
push({url: '/pages/orderList/orderList'}, {
data: {
type: status
}
},
timeout:2000
})
}
@ -463,7 +447,8 @@ const toEvaluate = (item) => {
push({url: '/pages/evaluate/evaluate'}, {
data: {
unique: item.unique,
}
},
type:'redirectTo'
})
}
@ -482,50 +467,59 @@ const handleMsg = (status) => {
}
const handleDelete = async () => {
uni.showModal({
title: '提示',
content: '确认删除订单',
success: async (res) => {
if (res.confirm) {
await orderDelete({
uni: orderInfoData.value.orderId
})
uni.showToast({
title: '已删除',
duration: 2000
});
setTimeout(()=>{
goList()
},2000)
} else if (res.cancel) {
}
}
});
const modalRef = ref()
const modalType = ref(0) // 0删除 1取消 2确认收货
const modalTitle = computed(()=>{
const tipsArr = ['确认删除订单吗?','确认取消订单吗?','确认要确认收货吗?']
return tipsArr[modalType.value]
})
/**
* 打开弹窗
* @param {number} type 0删除记录 1撤销申请 2确认收货
*/
function showModal(type){
modalType.value = type
unref(modalRef).show()
}
const handleCancel = async () => {
uni.showModal({
title: '提示',
content: '确认取消订单',
success: async (res) => {
if (res.confirm) {
await orderCancel({
id: orderInfoData.value.orderId
})
uni.showToast({
title: '已取消',
duration: 2000
});
setTimeout(()=>{
goList()
},2000)
} else if (res.cancel) {
}
}
});
/**
* 确认弹窗
*/
function confirmModal(){
const funcArr = [doDeleteRequest,doCancelRequest,doTakeRequest]
funcArr[modalType.value]()
}
async function doDeleteRequest(){
await orderDelete({
uni: orderInfoData.value.orderId
})
toast({title: '删除成功'});
goList()
}
async function doCancelRequest(){
await orderCancel({
id: orderInfoData.value.orderId
})
toast({title: '取消成功'});
goList()
}
async function doTakeRequest(){
let option = {
uni: orderInfoData.value.orderId,
}
await orderTake(option)
toast({title: '收货成功'});
await handleOrderInfo({
key: option.uni
})
}
// ============================== 支付相关 ===============================
const payPopupRef = ref()
@ -579,16 +573,16 @@ onLoad((options) => {
margin-right: 10rpx;
}
&.order-status-0,&.order-status--1 {
background-image: url("../../static/images/icon-order-info-1.png");
&.order-status-0,&.order-status--1,&.order-status-4,&.order-status-5,&.order-status-6,&.order-status-7 {
background-image: url("https://b2c-pro-static-dev.zkthink.com/static/images/icon-order-info-1.png");
}
&.order-status-1, &.order-status-99 {
background-image: url("../../static/images/icon-order-info-2.png");
background-image: url("https://b2c-pro-static-dev.zkthink.com/static/images/icon-order-info-2.png");
}
&.order-status-2, &.order-status-3 {
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");
}
}