tradeOrderDetail.vue 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355
  1. <template>
  2. <ContentWrap>
  3. <!-- 订单信息 -->
  4. <el-descriptions title="订单信息">
  5. <el-descriptions-item label="订单号: ">{{ order.no }}</el-descriptions-item>
  6. <el-descriptions-item label="配送方式: ">物流配送</el-descriptions-item>
  7. <!-- TODO 芋艿:待实现 -->
  8. <el-descriptions-item label="营销活动: ">物流配送</el-descriptions-item>
  9. <!-- TODO 芋艿:待实现 -->
  10. <el-descriptions-item label="订单类型: ">
  11. <dict-tag :type="DICT_TYPE.TRADE_ORDER_TYPE" :value="order.type" />
  12. </el-descriptions-item>
  13. <el-descriptions-item label="收货人: ">{{ order.receiverName }}</el-descriptions-item>
  14. <el-descriptions-item label="买家留言: ">{{ order.userRemark }}</el-descriptions-item>
  15. <el-descriptions-item label="订单来源: ">
  16. <dict-tag :type="DICT_TYPE.TERMINAL" :value="order.terminal" />
  17. </el-descriptions-item>
  18. <el-descriptions-item label="联系电话: ">{{ order.receiverMobile }}</el-descriptions-item>
  19. <el-descriptions-item label="商家备注: ">{{ order.remark }}</el-descriptions-item>
  20. <el-descriptions-item label="支付单号: ">{{ order.payOrderId }}</el-descriptions-item>
  21. <el-descriptions-item label="付款方式: ">
  22. <dict-tag :type="DICT_TYPE.PAY_CHANNEL_CODE_TYPE" :value="order.payChannelCode" />
  23. </el-descriptions-item>
  24. <el-descriptions-item label="买家: ">{{ order.user.nickname }}</el-descriptions-item>
  25. <!-- TODO 芋艿:待实现:跳转会员 -->
  26. <el-descriptions-item label="收货地址: ">
  27. {{ order.receiverAreaName }} " "{{ order.receiverDetailAddress }} " "
  28. <el-link
  29. v-clipboard:copy="order.receiverAreaName + ' ' + order.receiverDetailAddress"
  30. v-clipboard:success="clipboardSuccess"
  31. icon="ep:document-copy"
  32. type="primary"
  33. />
  34. </el-descriptions-item>
  35. </el-descriptions>
  36. <!-- 订单状态 -->
  37. <el-descriptions title="订单状态" :column="1">
  38. <el-descriptions-item label="订单状态: ">
  39. <dict-tag :type="DICT_TYPE.TRADE_ORDER_STATUS" :value="order.status" />
  40. </el-descriptions-item>
  41. <el-descriptions-item label-class-name="no-colon">
  42. <el-button type="primary" size="small">调整价格</el-button>
  43. <!-- TODO 芋艿:待实现 -->
  44. <el-button type="primary" size="small">备注</el-button>
  45. <!-- TODO 芋艿:待实现 -->
  46. <el-button type="primary" size="small">发货</el-button>
  47. <!-- TODO 芋艿:待实现 -->
  48. <el-button type="primary" size="small">关闭订单</el-button>
  49. <!-- TODO 芋艿:待实现 -->
  50. <el-button type="primary" size="small">修改地址</el-button>
  51. <!-- TODO 芋艿:待实现 -->
  52. <el-button type="primary" size="small">打印电子面单</el-button>
  53. <!-- TODO 芋艿:待实现 -->
  54. <el-button type="primary" size="small">打印发货单</el-button>
  55. <!-- TODO 芋艿:待实现 -->
  56. <el-button type="primary" size="small">确认收货</el-button>
  57. <!-- TODO 芋艿:待实现 -->
  58. </el-descriptions-item>
  59. <el-descriptions-item>
  60. <template #label><span style="color: red">提醒: </span></template>
  61. 买家付款成功后,货款将直接进入您的商户号(微信、支付宝)<br />
  62. 请及时关注你发出的包裹状态,确保可以配送至买家手中 <br />
  63. 如果买家表示没收到货或货物有问题,请及时联系买家处理,友好协商
  64. </el-descriptions-item>
  65. </el-descriptions>
  66. <!-- 物流信息 TODO -->
  67. <!-- 商品信息 -->
  68. <el-descriptions title="商品信息" column="6">
  69. <el-descriptions-item labelClassName="no-colon">
  70. <el-row :gutter="20">
  71. <el-col :span="10">
  72. <el-table :data="order.items" border>
  73. <el-table-column prop="spuName" label="商品" width="400">
  74. <template #default="{ row }">
  75. {{ row.spuName }}
  76. <el-tag
  77. size="medium"
  78. v-for="property in row.properties"
  79. :key="property.propertyId"
  80. >
  81. {{ property.propertyName }}:{{ property.valueName }}</el-tag
  82. >
  83. </template>
  84. </el-table-column>
  85. <el-table-column prop="originalUnitPrice" label="单价(元)" width="180">
  86. <template #default="{ row }">
  87. ¥{{ (row.originalUnitPrice / 100.0).toFixed(2) }}
  88. </template>
  89. </el-table-column>
  90. <el-table-column prop="count" label="数量" width="100" />
  91. <el-table-column prop="originalPrice" label="小计(元)" width="100">
  92. <template #default="{ row }">
  93. ¥{{ (row.originalPrice / 100.0).toFixed(2) }}
  94. </template>
  95. </el-table-column>
  96. <el-table-column prop="afterSaleStatus" label="退款状态">
  97. <template #default="{ row }">
  98. <dict-tag
  99. :type="DICT_TYPE.TRADE_ORDER_ITEM_AFTER_SALE_STATUS"
  100. :value="row.afterSaleStatus"
  101. />
  102. </template>
  103. </el-table-column>
  104. </el-table>
  105. </el-col>
  106. <el-col :span="10" />
  107. </el-row>
  108. </el-descriptions-item>
  109. <!-- 占位 -->
  110. <!-- <el-descriptions-item v-for="item in 5" label-class-name="no-colon" :key="item" /> -->
  111. </el-descriptions>
  112. <el-descriptions column="6">
  113. <el-descriptions-item label="商品总额: "
  114. >¥{{ (order.originalPrice / 100.0).toFixed(2) }}</el-descriptions-item
  115. >
  116. <el-descriptions-item label="运费金额: "
  117. >¥{{ (order.deliveryPrice / 100.0).toFixed(2) }}</el-descriptions-item
  118. >
  119. <el-descriptions-item label="订单调价: "
  120. >¥{{ (order.adjustPrice / 100.0).toFixed(2) }}</el-descriptions-item
  121. >
  122. <el-descriptions-item>
  123. <template #label><span style="color: red">商品优惠: </span></template>
  124. ¥{{ ((order.originalPrice - order.originalPrice) / 100.0).toFixed(2) }}
  125. </el-descriptions-item>
  126. <el-descriptions-item>
  127. <template #label><span style="color: red">订单优惠: </span></template>
  128. ¥{{ (order.discountPrice / 100.0).toFixed(2) }}
  129. </el-descriptions-item>
  130. <el-descriptions-item>
  131. <template #label><span style="color: red">积分抵扣: </span></template>
  132. ¥{{ (order.pointPrice / 100.0).toFixed(2) }}
  133. </el-descriptions-item>
  134. <el-descriptions-item v-for="item in 5" label-class-name="no-colon" :key="item" />
  135. <!-- 占位 -->
  136. <el-descriptions-item label="应付金额: ">
  137. ¥{{ (order.payPrice / 100.0).toFixed(2) }}
  138. </el-descriptions-item>
  139. </el-descriptions>
  140. <div v-for="group in detailGroups" :key="group.title">
  141. <el-descriptions v-bind="group.groupProps" :title="group.title">
  142. <!-- 订单操作日志 -->
  143. <el-descriptions-item v-if="group.key === 'orderLog'" labelClassName="no-colon">
  144. <el-timeline>
  145. <el-timeline-item
  146. v-for="activity in detailInfo[group.key]"
  147. :key="activity.timestamp"
  148. :timestamp="activity.timestamp"
  149. >
  150. {{ activity.content }}
  151. </el-timeline-item>
  152. </el-timeline>
  153. </el-descriptions-item>
  154. <!-- 物流信息 -->
  155. <el-descriptions-item v-if="group.key === 'expressInfo'" labelClassName="no-colon">
  156. <el-tabs type="card">
  157. <!-- 循环包裹物流信息 -->
  158. <el-tab-pane
  159. v-for="pkgInfo in detailInfo[group.key]"
  160. :key="pkgInfo.label"
  161. :label="pkgInfo.label"
  162. >
  163. <!-- 包裹详情 -->
  164. <el-descriptions>
  165. <el-descriptions-item
  166. v-for="(pkgChild, pkgCIdx) in group.children"
  167. v-bind="pkgChild.childProps"
  168. :key="`pkgChild_${pkgCIdx}`"
  169. :label="pkgChild.label"
  170. >
  171. <!-- 包裹商品列表 -->
  172. <template v-if="pkgChild.valueKey === 'goodsList' && pkgInfo[pkgChild.valueKey]">
  173. <div
  174. v-for="(goodInfo, goodInfoIdx) in pkgInfo[pkgChild.valueKey]"
  175. :key="`goodInfo_${goodInfoIdx}`"
  176. style="display: flex"
  177. >
  178. <el-image
  179. style="width: 100px; height: 100px; flex: none"
  180. :src="goodInfo.imgUrl"
  181. />
  182. <el-descriptions :column="1">
  183. <el-descriptions-item labelClassName="no-colon">{{
  184. goodInfo.name
  185. }}</el-descriptions-item>
  186. <el-descriptions-item label="数量">{{
  187. goodInfo.count
  188. }}</el-descriptions-item>
  189. </el-descriptions>
  190. </div>
  191. </template>
  192. <!-- 包裹物流详情 -->
  193. <template v-else-if="pkgChild.valueKey === 'wlxq'">
  194. <el-row :gutter="10">
  195. <el-col :span="6" :offset="1">
  196. <el-timeline>
  197. <el-timeline-item
  198. v-for="(activity, index) in pkgInfo[pkgChild.valueKey]"
  199. :key="index"
  200. :timestamp="activity.timestamp"
  201. >
  202. {{ activity.content }}
  203. </el-timeline-item>
  204. </el-timeline>
  205. </el-col>
  206. </el-row>
  207. </template>
  208. <template v-else>
  209. {{ pkgInfo[pkgChild.valueKey] }}
  210. </template>
  211. </el-descriptions-item>
  212. </el-descriptions>
  213. </el-tab-pane>
  214. </el-tabs>
  215. </el-descriptions-item>
  216. </el-descriptions>
  217. </div>
  218. </ContentWrap>
  219. </template>
  220. <script lang="ts" name="TradeOrderDetail" setup>
  221. import { DICT_TYPE } from '@/utils/dict'
  222. import * as TradeOrderApi from '@/api/mall/trade/order'
  223. const message = useMessage() // 消息弹窗
  224. const { query } = useRoute()
  225. const queryParams = reactive({
  226. id: query.id
  227. })
  228. const dialogVisible = ref(false)
  229. const loading = ref(false)
  230. const order = ref<any>({
  231. items: [],
  232. user: {}
  233. }) //详情数据
  234. const detailGroups = ref([
  235. {
  236. title: '物流信息',
  237. key: 'expressInfo',
  238. children: [
  239. { label: '发货时间: ', valueKey: 'fhsj' },
  240. { label: '物流公司: ', valueKey: 'wlgs' },
  241. { label: '运单号: ', valueKey: 'ydh' },
  242. { label: '物流状态: ', valueKey: 'wlzt', childProps: { span: 3 } },
  243. { label: '物流详情: ', valueKey: 'wlxq' }
  244. ]
  245. },
  246. {
  247. title: '订单操作日志',
  248. key: 'orderLog'
  249. }
  250. ])
  251. const detailInfo = ref({
  252. expressInfo: [
  253. // 物流信息
  254. {
  255. label: '包裹1',
  256. name: 'bg1',
  257. fhsj: '2022-11-03 16:50:45',
  258. wlgs: '极兔',
  259. ydh: '2132123',
  260. wlzt: '不支持此快递公司',
  261. wlxq: [
  262. {
  263. content: '正在派送途中,请您准备签收(派件人:王涛,电话:13854563814)',
  264. timestamp: '2018-04-15 15:00:16'
  265. },
  266. {
  267. content: '快件到达 【烟台龙口东江村委营业点】',
  268. timestamp: '2018-04-13 14:54:19'
  269. },
  270. {
  271. content: '快件已发车',
  272. timestamp: '2018-04-11 12:55:52'
  273. },
  274. {
  275. content: '快件已发车',
  276. timestamp: '2018-04-11 12:55:52'
  277. },
  278. {
  279. content: '快件已发车',
  280. timestamp: '2018-04-11 12:55:52'
  281. }
  282. ]
  283. }
  284. ],
  285. orderLog: [
  286. // 订单操作日志
  287. {
  288. content: '买家【乌鸦】关闭了订单',
  289. timestamp: '2018-04-15 15:00:16'
  290. },
  291. {
  292. content: '买家【乌鸦】下单了',
  293. timestamp: '2018-04-15 15:00:16'
  294. }
  295. ],
  296. goodsInfo: [] // 商品详情tableData
  297. })
  298. //暂考虑一次性加载详情页面所有数据
  299. const getlist = async () => {
  300. dialogVisible.value = true
  301. loading.value = true
  302. try {
  303. const res = await TradeOrderApi.getOrderDetail(queryParams.id)
  304. order.value = res
  305. } catch {
  306. message.error('获取详情数据失败')
  307. } finally {
  308. loading.value = false
  309. }
  310. }
  311. onMounted(async () => {
  312. await getlist()
  313. })
  314. const clipboardSuccess = () => {
  315. message.success('复制成功')
  316. }
  317. </script>
  318. <style lang="scss" scoped>
  319. :deep(.el-descriptions) {
  320. &:not(:nth-child(1)) {
  321. margin-top: 20px;
  322. }
  323. .el-descriptions__title {
  324. display: flex;
  325. align-items: center;
  326. &::before {
  327. content: '';
  328. display: inline-block;
  329. margin-right: 10px;
  330. width: 3px;
  331. height: 20px;
  332. background-color: #409eff;
  333. }
  334. }
  335. .el-descriptions-item__container {
  336. margin: 0 10px;
  337. .no-colon {
  338. margin: 0;
  339. &::after {
  340. content: '';
  341. }
  342. }
  343. }
  344. }
  345. </style>