order-base-info.vue 5.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153
  1. <template>
  2. <div class="base-info">
  3. <ele-data-table ref="tableRef" row-key="userId" :columns="columns" :data="datasource" :tools="false"
  4. :pagination="false">
  5. <template #orderTime="{ row }">
  6. <div class="common-text">
  7. <el-text>建单:</el-text>
  8. <el-text>{{ row.createTime }}</el-text>
  9. </div>
  10. <div class="common-text">
  11. <el-text>提交:</el-text>
  12. <el-text>{{ row.orderTime || '-' }}</el-text>
  13. </div>
  14. </template>
  15. <template #status="{ row }">
  16. <el-tag effect="dark" :type="row.status < 5 ? 'warning' : 'success'">{{ row.status < 5 ? '未发货' : '已发货'
  17. }}</el-tag>
  18. <el-tag style="margin-left: 15px" effect="dark"
  19. :type="row.status < 8 ? 'warning' : 'success'">{{ row.status < 8 ? '未收货' : '已收货' }}</el-tag>
  20. <el-tag style="margin-left: 15px" effect="dark"
  21. :type="row.status == 11 ? ' success' : 'warning'">{{ row.status == 11
  22. ? '已支付' : '未支付' }}</el-tag>
  23. </template>
  24. </ele-data-table>
  25. <el-row :gutter="12" style="padding: 16px 10px; padding-bottom: 0">
  26. <el-col :span="8">
  27. <div class="common-text">
  28. <el-text>物流类型:</el-text>
  29. <el-text>平台物流</el-text>
  30. </div>
  31. <div class="common-text">
  32. <el-text>快递单号:</el-text>
  33. <el-text>{{ detail.waybillCode }}</el-text>
  34. </div>
  35. <div class="common-text">
  36. <el-text>快递公司:</el-text>
  37. <el-text>{{ finalExpressText }}</el-text>
  38. </div>
  39. <div class="common-text">
  40. <el-text>预约时间:</el-text>
  41. <el-text>{{ formatTime }}</el-text>
  42. </div>
  43. </el-col>
  44. <el-col :span="8">
  45. <div class="common-text">
  46. <el-text>发件人:</el-text>
  47. <el-text>{{ formatName(detail.sendName) }}(ID:{{ detail.userId }})</el-text>
  48. </div>
  49. <div class="common-text">
  50. <el-text>电 话:</el-text>
  51. <el-text>{{ formatPhone(detail.sendMobile) }}</el-text>
  52. </div>
  53. <div class="common-text">
  54. <el-text>地 址:</el-text>
  55. <el-text>{{ detail.sendAddress }}</el-text>
  56. </div>
  57. <div class="common-text">
  58. <el-text>备 注:</el-text>
  59. <el-text>{{ detail.userExpress || '暂无信息' }}</el-text>
  60. </div>
  61. </el-col>
  62. <el-col :span="8">
  63. <div class="common-text">
  64. <el-text>收货仓库:</el-text>
  65. <el-text>{{ detail.recipientGodown }}-{{ detail.recipientName }}</el-text>
  66. </div>
  67. <div class="common-text">
  68. <el-text>收 件 人:</el-text>
  69. <el-text>{{ detail.recipientName || '-' }}</el-text>
  70. </div>
  71. <div class="common-text">
  72. <el-text>电  话:</el-text>
  73. <el-text>{{ detail.recipientMobile || '-' }}</el-text>
  74. </div>
  75. <div class="common-text">
  76. <el-text>地  址:</el-text>
  77. <el-text>{{ detail.recipientAddress || '-' }}</el-text>
  78. </div>
  79. </el-col>
  80. </el-row>
  81. </div>
  82. </template>
  83. <script setup>
  84. import { formatName, formatPhone } from '@/utils/common';
  85. import { ref, reactive, watch } from 'vue';
  86. const props = defineProps({
  87. detail: { type: Object, default: () => ({}) }
  88. });
  89. import { useDictData } from '@/utils/use-dict-data';
  90. /** 字典数据 */
  91. const [expressDicts, orderFormDicts] = useDictData([
  92. 'final_express',
  93. 'order_form'
  94. ]);
  95. const finalExpressText = computed(() => {
  96. if (props.detail.finalExpress == '0' || !props.detail.finalExpress) {
  97. return '暂无信息';
  98. }
  99. return (
  100. expressDicts.value.find((d) => d.dictValue == props.detail.finalExpress)
  101. ?.dictLabel || '暂无信息'
  102. );
  103. });
  104. const formatTime = computed(() => {
  105. if (!props.detail.schedulePickupStartTime) return '-';
  106. return (
  107. props.detail.schedulePickupStartTime +
  108. '-' +
  109. props.detail.schedulePickupEndTime.split(' ')[1]
  110. );
  111. });
  112. const datasource = ref([]);
  113. watch(
  114. () => props.detail,
  115. (newVal) => {
  116. console.log(newVal, 'newVal');
  117. datasource.value = newVal ? [newVal] : [];
  118. console.log(datasource.value);
  119. },
  120. { immediate: true, deep: true }
  121. );
  122. const columns = ref([
  123. { label: '订单编号', prop: 'orderId' },
  124. {
  125. label: '订单来源',
  126. prop: 'orderFrom',
  127. formatter: (row) =>
  128. orderFormDicts.value.find((d) => d.dictValue == row.orderFrom)
  129. ?.dictLabel
  130. },
  131. { label: '用户', prop: 'userNick' },
  132. {
  133. label: '预估书款',
  134. prop: 'expectMoney',
  135. formatter: (row) => '¥' + row.expectMoney
  136. },
  137. {
  138. label: '审核书款',
  139. prop: 'finalMoney',
  140. formatter: (row) => row.finalMoney ? '¥' + row.finalMoney : '待核算'
  141. },
  142. { label: '下单时间', prop: 'orderTime', slot: 'orderTime', width: 200 },
  143. { label: '交易状态', prop: 'status', slot: 'status', width: 240 }
  144. ]);
  145. </script>