diff --git a/pages/components/HighlightNumberText.vue b/pages/components/HighlightNumberText.vue new file mode 100644 index 00000000..0b00f352 --- /dev/null +++ b/pages/components/HighlightNumberText.vue @@ -0,0 +1,81 @@ + + + + + diff --git a/pages/order/express/log.vue b/pages/order/express/log.vue index c852edc4..a8e6f7ac 100644 --- a/pages/order/express/log.vue +++ b/pages/order/express/log.vue @@ -38,7 +38,11 @@ - {{ item.content }} + + + + + {{ sheep.$helper.timeFormat(item.time, 'yyyy-mm-dd hh:MM:ss') }} @@ -54,6 +58,7 @@ import { onLoad } from '@dcloudio/uni-app'; import { computed, reactive } from 'vue'; import OrderApi from '@/sheep/api/trade/order'; + import HighlightNumber from '@/pages/components/HighlightNumberText.vue'; const state = reactive({ info: [], @@ -74,7 +79,7 @@ async function getExpressDetail(id) { const { data } = await OrderApi.getOrderExpressTrackList(id); - state.tracks = data.reverse(); + state.tracks = data; } async function getOrderDetail(id) { @@ -86,53 +91,117 @@ getExpressDetail(options.id); getOrderDetail(options.id); }); + + function handlePhoneClick(data) { + handleClick(data); + } + + function handleClick(data) { + const phoneNumber = data.phoneNumber; + + if (!phoneNumber) return; + + // 获取当前平台 + const platform = uni.getSystemInfoSync().platform.toLowerCase(); + + if (platform === 'devtools') { + uni.showToast({ title: '真机才可拨打电话', icon: 'none' }); + handleCopy(phoneNumber); + return; + } + + if (platform === 'wechat') { + uni.showToast({ title: '请手动拨打', icon: 'none' }); + handleCopy(phoneNumber); + return; + } + + uni.makePhoneCall({ + phoneNumber: phoneNumber, + success: () => { + console.log('拨打电话成功'); + }, + fail: (err) => { + console.error('拨打电话失败', err); + uni.showToast({ title: '拨号失败,请手动拨打', icon: 'none' }); + handleCopy(phoneNumber); + }, + }); + } + function handleCopy(text) { + uni.setClipboardData({ + data: text, + success: () => { + uni.showToast({ title: '已复制到剪贴板', icon: 'success' }); + }, + fail: () => { + uni.showToast({ title: '复制失败', icon: 'none' }); + }, + }); + }