log.vue 5.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234
  1. <!-- 物流追踪 -->
  2. <template>
  3. <s-layout title="物流追踪">
  4. <view class="log-wrap">
  5. <!-- 商品信息 -->
  6. <view class="log-card ss-flex ss-m-20 ss-r-10" v-if="goodsImages.length > 0">
  7. <uni-swiper-dot :info="goodsImages" :current="state.current" mode="round">
  8. <swiper class="swiper-box">
  9. <swiper-item v-for="(item, index) in goodsImages" :key="index">
  10. <image class="log-card-img" :src="sheep.$url.static(item.image)" />
  11. </swiper-item>
  12. </swiper>
  13. </uni-swiper-dot>
  14. <view class="log-card-msg">
  15. <!-- TODO 芋艿:【物流】优化点:展示状态 -->
  16. <!-- <view class="ss-flex ss-m-b-8">-->
  17. <!-- <view>物流状态:</view>-->
  18. <!-- <view class="warning-color">{{ state.info.status_text }}</view>-->
  19. <!-- </view>-->
  20. <view class="ss-m-b-8">快递单号:{{ state.info.logisticsNo }}</view>
  21. <view>快递公司:{{ state.info.logisticsName }}</view>
  22. </view>
  23. </view>
  24. <!-- 物流轨迹 -->
  25. <view class="log-content ss-m-20 ss-r-10">
  26. <view
  27. class="log-content-box ss-flex"
  28. v-for="(item, index) in state.tracks"
  29. :key="item.title"
  30. >
  31. <view class="log-icon ss-flex-col ss-col-center ss-m-r-20">
  32. <text class="cicon-title" />
  33. <view v-if="state.tracks.length - 1 !== index" class="line" />
  34. </view>
  35. <view class="log-content-msg">
  36. <!-- TODO 芋艿:【物流】优化点:展示状态 -->
  37. <!-- <view class="log-msg-title ss-m-b-20">-->
  38. <!-- {{ item.status_text }}-->
  39. <!-- </view>-->
  40. <!-- <view class="log-msg-desc ss-m-b-16">{{ item.content }}</view>-->
  41. <view class="log-msg-desc ss-m-b-16">
  42. <highlight-number :content="item.content" @phone-click="handlePhoneClick" />
  43. <!-- <rich-text :nodes="item.content"></rich-text>-->
  44. </view>
  45. <view class="log-msg-date ss-m-b-40">
  46. {{ sheep.$helper.timeFormat(item.time, 'yyyy-mm-dd hh:MM:ss') }}
  47. </view>
  48. </view>
  49. </view>
  50. </view>
  51. </view>
  52. </s-layout>
  53. </template>
  54. <script setup>
  55. import sheep from '@/sheep';
  56. import { onLoad } from '@dcloudio/uni-app';
  57. import { computed, reactive } from 'vue';
  58. import OrderApi from '@/sheep/api/trade/order';
  59. import HighlightNumber from '@/pages/components/HighlightNumberText.vue';
  60. const state = reactive({
  61. info: [],
  62. tracks: [],
  63. });
  64. const goodsImages = computed(() => {
  65. let array = [];
  66. if (state.info.items) {
  67. state.info.items.forEach((item) => {
  68. array.push({
  69. image: item.picUrl,
  70. });
  71. });
  72. }
  73. return array;
  74. });
  75. async function getExpressDetail(id) {
  76. const { data } = await OrderApi.getOrderExpressTrackList(id);
  77. state.tracks = data;
  78. }
  79. async function getOrderDetail(id) {
  80. const { data } = await OrderApi.getOrderDetail(id);
  81. state.info = data;
  82. }
  83. onLoad((options) => {
  84. getExpressDetail(options.id);
  85. getOrderDetail(options.id);
  86. });
  87. function handlePhoneClick(data) {
  88. handleClick(data);
  89. }
  90. function handleClick(data) {
  91. const phoneNumber = data.phoneNumber;
  92. if (!phoneNumber) return;
  93. // 获取当前平台
  94. const platform = uni.getSystemInfoSync().platform.toLowerCase();
  95. if (platform === 'devtools') {
  96. uni.showToast({ title: '真机才可拨打电话', icon: 'none' });
  97. handleCopy(phoneNumber);
  98. return;
  99. }
  100. if (platform === 'wechat') {
  101. uni.showToast({ title: '请手动拨打', icon: 'none' });
  102. handleCopy(phoneNumber);
  103. return;
  104. }
  105. uni.makePhoneCall({
  106. phoneNumber: phoneNumber,
  107. success: () => {
  108. console.log('拨打电话成功');
  109. },
  110. fail: (err) => {
  111. console.error('拨打电话失败', err);
  112. uni.showToast({ title: '拨号失败,请手动拨打', icon: 'none' });
  113. handleCopy(phoneNumber);
  114. },
  115. });
  116. }
  117. function handleCopy(text) {
  118. uni.setClipboardData({
  119. data: text,
  120. success: () => {
  121. uni.showToast({ title: '已复制到剪贴板', icon: 'success' });
  122. },
  123. fail: () => {
  124. uni.showToast({ title: '复制失败', icon: 'none' });
  125. },
  126. });
  127. }
  128. </script>
  129. <style lang="scss" scoped>
  130. .highlight {
  131. color: red; /* 高亮颜色 */
  132. font-weight: bold;
  133. }
  134. .swiper-box {
  135. width: 200rpx;
  136. height: 200rpx;
  137. }
  138. .log-card {
  139. border-top: 2rpx solid rgba(#dfdfdf, 0.5);
  140. padding: 20rpx;
  141. background: #fff;
  142. margin-bottom: 20rpx;
  143. .log-card-img {
  144. width: 200rpx;
  145. height: 200rpx;
  146. margin-right: 20rpx;
  147. }
  148. .log-card-msg {
  149. font-size: 28rpx;
  150. font-weight: 500;
  151. width: 490rpx;
  152. color: #333333;
  153. .warning-color {
  154. color: #999;
  155. }
  156. }
  157. }
  158. .log-content {
  159. padding: 34rpx 20rpx 0rpx 20rpx;
  160. background: #fff;
  161. .log-content-box {
  162. align-items: stretch;
  163. }
  164. .log-icon {
  165. height: inherit;
  166. .cicon-title {
  167. color: #ccc;
  168. font-size: 40rpx;
  169. }
  170. .activity-color {
  171. color: #f0c785;
  172. font-size: 40rpx;
  173. }
  174. .info-color {
  175. color: #ccc;
  176. font-size: 40rpx;
  177. }
  178. .line {
  179. width: 1px;
  180. height: 100%;
  181. background: #d8d8d8;
  182. }
  183. }
  184. .log-content-msg {
  185. .log-msg-title {
  186. font-size: 28rpx;
  187. font-weight: bold;
  188. color: #333333;
  189. }
  190. .log-msg-desc {
  191. font-size: 24rpx;
  192. font-weight: 400;
  193. color: #333333;
  194. line-height: 36rpx;
  195. }
  196. .log-msg-date {
  197. font-size: 24rpx;
  198. font-weight: 500;
  199. color: #000000;
  200. }
  201. }
  202. }
  203. </style>