【fix】优化代码

This commit is contained in:
黄少君
2024-02-22 18:37:23 +08:00
parent 17c043348a
commit f8fac0a5bc
246 changed files with 973 additions and 406 deletions

View File

@ -7,7 +7,9 @@
@leftClick="goBackList"
/>
<view v-if="orderInfoData">
<view class="orderInfo-header background-warp" :class="orderInfoData.state === 0 && 'mb-100'">
<view
class="orderInfo-header background-warp"
:class="orderInfoData.state === 0 && 'mb-100'">
<view class="background">
<image
class="image"
@ -17,37 +19,43 @@
</view>
<view class="background-content page-space">
<view class="order-status-info">
<view class="order-status" :class="'order-status-'+ orderInfoData.state">
<view
class="order-status"
:class="'order-status-'+ orderInfoData.state">
<view>
<!-- {{ orderInfoStatusMsg }}-->
{{refundOrderStatus[orderInfoData.state]}}
<!-- {{ orderInfoStatusMsg }}-->
{{ refundOrderStatus[orderInfoData.state] }}
</view>
</view>
<view class="order-date" v-if="parseInt(orderInfoData.remainTime) > 0 && ![3,4].includes(orderInfoData.state)">
{{remainTimeStr}}
<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="https://b2c-pro-static-dev.zkthink.com/static/images/icon-location.png"-->
<!-- />-->
<!-- </view>-->
<!-- <view class="address-main">-->
<!-- <view class="address-header">-->
<!-- <view class="address-name">{{ orderInfoData.realName }}</view>-->
<!-- <view class="address-phone">{{ orderInfoData.userPhone }}</view>-->
<!-- </view>-->
<!-- <view class="address-content">-->
<!-- <view class="address-desc">{{ orderInfoData.userAddress }}</view>-->
<!-- </view>-->
<!-- </view>-->
<!-- </view>-->
<!-- <view class="address noBorder">-->
<!-- <view class="address-icon">-->
<!-- <image-->
<!-- class="image"-->
<!-- src="https://b2c-pro-static-dev.zkthink.com/static/images/icon-location.png"-->
<!-- />-->
<!-- </view>-->
<!-- <view class="address-main">-->
<!-- <view class="address-header">-->
<!-- <view class="address-name">{{ orderInfoData.realName }}</view>-->
<!-- <view class="address-phone">{{ orderInfoData.userPhone }}</view>-->
<!-- </view>-->
<!-- <view class="address-content">-->
<!-- <view class="address-desc">{{ orderInfoData.userAddress }}</view>-->
<!-- </view>-->
<!-- </view>-->
<!-- </view>-->
</view>
</view>
<view class="page-space">
<view class="mb-20 card" v-if="orderInfoData.realName">
<view
class="mb-20 card"
v-if="orderInfoData.realName">
<view class="card-head">
<view class="card-title">
商家收货信息
@ -60,14 +68,16 @@
收货人
</view>
<view class="info-cell-value">
<view class="address-name">{{ orderInfoData.realName }}</view>
<view class="address-phone">{{ orderInfoData.userPhone }}</view>
<view class="address-name">{{ orderInfoData.realName }}</view>
<view class="address-phone">{{ orderInfoData.userPhone }}</view>
</view>
</view>
<view class="info-cell">
<view class="info-cell-label">
<text class="wem1"></text>
<text class="wem1"></text>
</view>
<view class="info-cell-value">
{{ orderInfoData.userAddress }}
@ -77,7 +87,9 @@
</view>
</view>
<view class="mb-20 card" v-if="orderInfoData.deliverySn">
<view
class="mb-20 card"
v-if="orderInfoData.deliverySn">
<view class="card-head">
<view class="card-title">
物流信息
@ -162,7 +174,7 @@
服务类型
</view>
<view class="info-cell-value">
{{ orderInfoData.serviceType===0?'仅退款':'退货退款' }}
{{ orderInfoData.serviceType === 0 ? '仅退款' : '退货退款' }}
</view>
</view>
<view class="info-cell">
@ -279,13 +291,16 @@
</view>
</layout>
<Modal ref="modalRef" :content="modalTitle" @confirm="confirmModal" />
<Modal
ref="modalRef"
:content="modalTitle"
@confirm="confirmModal" />
</template>
<script setup>
import { computed, ref, unref } from 'vue'
import { onShow} from '@dcloudio/uni-app'
import { useMainStore } from '@/store/store'
import { onShow } from '@dcloudio/uni-app'
import { useMainStore } from '@/store/modules/useMainStore'
import { formatDate } from '@/utils/utils'
import {
orderCancel,
@ -297,15 +312,16 @@ import {
} from '@/api/order'
import { orderReStatus } from '@/config'
import { useRouter } from "@/hooks/useRouter";
import {useGlobalProperties} from "@/hooks";
import { useGlobalProperties } from "@/hooks";
import { useShearPlate } from "@/hooks/useShearPlate";
import { formatRemainTime } from '@/utils/utils'
import Modal from "@/components/Modal/index.vue";
import { afterSalesBg } from "@/utils/images";
import config from "@/uni_modules/uv-ui-tools/libs/config/config";
const {$timeFormat} = useGlobalProperties()
const {getUrlParams,push} = useRouter()
const {getUrlParams, push} = useRouter()
const {setData} = useShearPlate();
const orderInfoData = ref(null)
const orderInfoStatusMsg = ref('')
@ -313,7 +329,7 @@ const expressData = ref(null)
const id = ref(0)
const orderId = ref(0)
const remainTimeStr = ref('')
const refundOrderStatus = ref({
const refundOrderStatus = ref({
0: '请耐心等待平台审核',
1: '平台已同意退货申请,请尽早退货',
2: '请耐心等待平台确认收货',
@ -331,8 +347,8 @@ const handleOrderInfo = async (option) => {
const modalRef = ref()
const modalType = ref(0) // 0删除记录 1撤销申请
const modalTitle = computed(()=>{
const tipsArr = ['确认删除记录吗?','确认撤销申请吗?']
const modalTitle = computed(() => {
const tipsArr = ['确认删除记录吗?', '确认撤销申请吗?']
return tipsArr[modalType.value]
})
@ -340,7 +356,7 @@ const modalTitle = computed(()=>{
* 打开弹窗
* @param {number} type 0删除记录 1撤销申请
*/
function showModal(type){
function showModal(type) {
modalType.value = type
unref(modalRef).show()
}
@ -348,15 +364,15 @@ function showModal(type){
/**
* 确认弹窗
*/
function confirmModal(){
const funcArr = [doDeleteRequest,doRevoke]
function confirmModal() {
const funcArr = [doDeleteRequest, doRevoke]
funcArr[modalType.value]()
}
/**
* 确认删除
*/
async function doDeleteRequest(){
async function doDeleteRequest() {
await afterSalesOrderDelete({
id: id.value,
orderCode: orderInfoData.value.orderId
@ -365,15 +381,15 @@ async function doDeleteRequest(){
title: '已删除',
duration: 2000
});
setTimeout(()=>{
setTimeout(() => {
toRefundList()
},2000)
}, 2000)
}
/**
* 确认撤销
*/
async function doRevoke(){
async function doRevoke() {
await afterSalesOrderRevoke({
id: id.value,
key: orderInfoData.value.orderId
@ -382,9 +398,9 @@ async function doRevoke(){
title: '已撤销',
duration: 2000
});
setTimeout(()=>{
setTimeout(() => {
toRefundList()
},2000)
}, 2000)
}
// 跳转列表
@ -408,7 +424,7 @@ const toRefund = () => {
push({url: '/pages/refund/refund'}, {
data: {
refundType: orderInfoData.value.serviceType,
goods: orderInfoData.value.cartInfo.map(v=>{
goods: orderInfoData.value.cartInfo.map(v => {
return v.productAttrUnique
}).toString(),
id: orderId.value
@ -419,11 +435,11 @@ const toRefund = () => {
// 返回列表
const goBackList = () => {
push({url: '/pages/refundList/refundList'}, {
type:"redirectTo"
type: "redirectTo"
})
}
onShow(()=>{
onShow(() => {
const params = getUrlParams()
id.value = params.id
orderId.value = params.orderId
@ -436,11 +452,12 @@ onShow(()=>{
<style lang="scss">
@import "../../style/images";
.orderList {
padding: 20rpx 0;
}
.page-space{
.page-space {
position: relative;
z-index: 2;
}
@ -459,12 +476,15 @@ onShow(()=>{
background-size: 40rpx 40rpx;
background-position: left center;
background-repeat: no-repeat;
&.order-status-0,&.order-status-1,&.order-status-2,&.order-status-5{
&.order-status-0, &.order-status-1, &.order-status-2, &.order-status-5 {
background-image: $orderStateClock;
}
&.order-status-3,&.order-status-4{
&.order-status-3, &.order-status-4 {
background-image: $orderStateFinish;
}
.image {
width: 40rpx;
height: 40rpx;
@ -488,14 +508,15 @@ onShow(()=>{
}
}
.infos{
.info-cell-label{
.wem1{
.infos {
.info-cell-label {
.wem1 {
width: 1em;
display: inline-block;
}
}
.info-cell-value{
.info-cell-value {
display: flex;
}
}