feat: 订单详情用户信息组件优化

This commit is contained in:
duanshuwen 2025-08-01 11:52:47 +08:00
parent 824f3c4901
commit a67659d3db
3 changed files with 48 additions and 14 deletions

View File

@ -37,8 +37,8 @@ defineProps({
createTime: "",
contactName: "",
contactPhone: "",
orderStatus: "0", // pending-, completed-, cancelled-
orderType: undefined, // 0-, 1-, 2-, undefined-
orderStatus: "0", // 0- 1- 2-使 3- 4-退 5-退 6-
orderType: undefined, // 0-, 1-, 2-
}),
},
});

View File

@ -1,13 +1,19 @@
<template>
<view class="user-info mb12">
<view class="user-info mb12" v-if="hasConsumerData">
<view class="user-info-title">{{ infoTitle }}</view>
<view class="user-info-item">
<text class="label">{{ contactLabel }}</text>
<text class="value">{{ orderData.visitorName }}</text>
</view>
<view class="user-info-item">
<text class="label">联系电话</text>
<text class="value">{{ orderData.contactPhone }}</text>
<view
v-for="(item, index) in consumerList"
:key="getConsumerKey(item, index)"
class="user-info-group"
>
<view class="user-info-item">
<text class="label">{{ contactLabel }}</text>
<text class="value">{{ item.visitorName || "未填写" }}</text>
</view>
<view class="user-info-item">
<text class="label">联系电话</text>
<text class="value">{{ formatPhone(item.contactPhone) }}</text>
</view>
</view>
</view>
</template>
@ -40,9 +46,7 @@ const props = defineProps({
required: true,
default: () => ({
createTime: "",
contactName: "",
contactPhone: "",
visitorName: "", //
consumerInfoList: [],
orderStatus: "0", // 0- 1- 2-使 3- 4-退 5- 6-
orderType: "0", // 0-, 1-, 2-
}),
@ -60,6 +64,31 @@ const contactLabel = computed(() => {
const config = INFO_CONFIG[props.orderData.orderType] || INFO_CONFIG.default;
return config.contactLabel;
});
// 使
const consumerList = computed(() => {
return props.orderData.consumerInfoList || [];
});
//
const hasConsumerData = computed(() => {
return consumerList.value.length > 0;
});
// key使
const getConsumerKey = (item, index) => {
return item.id || item.visitorName || `consumer-${index}`;
};
//
const formatPhone = (phone) => {
if (!phone) return "未填写";
// *
if (phone.length === 11) {
return phone.replace(/(\d{3})\d{4}(\d{4})/, "$1****$2");
}
return phone;
};
</script>
<style scoped>

View File

@ -3,7 +3,12 @@
<uni-icons type="left" size="20" color="#fff" @click="goBack" />
<OrderStatusInfo :orderData="orderData" />
<OrderQrcode size="132" unit="px" :val="orderData.orderId" />
<OrderQrcode
v-if="orderData.orderStatus === '2'"
size="132"
unit="px"
:val="orderData.orderId"
/>
<GoodsInfo :orderData="orderData" />
<UserInfo :orderData="orderData" />
<NoticeInfo :orderData="orderData" />