tradeOrderDetail.vue 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352
  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
  40. v-if="order.status !== ''"
  41. :type="DICT_TYPE.TRADE_ORDER_STATUS"
  42. :value="order.status"
  43. />
  44. </el-descriptions-item>
  45. <el-descriptions-item label-class-name="no-colon">
  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-button type="primary" size="small">打印发货单</el-button>
  59. <!-- TODO 芋艿:待实现 -->
  60. <el-button type="primary" size="small">确认收货</el-button>
  61. <!-- TODO 芋艿:待实现 -->
  62. </el-descriptions-item>
  63. <el-descriptions-item>
  64. <template #label><span style="color: red">提醒: </span></template>
  65. 买家付款成功后,货款将直接进入您的商户号(微信、支付宝)<br />
  66. 请及时关注你发出的包裹状态,确保可以配送至买家手中 <br />
  67. 如果买家表示没收到货或货物有问题,请及时联系买家处理,友好协商
  68. </el-descriptions-item>
  69. </el-descriptions>
  70. <!-- 物流信息 TODO -->
  71. <!-- 商品信息 -->
  72. <el-descriptions title="商品信息">
  73. <el-descriptions-item labelClassName="no-colon">
  74. <el-row :gutter="20">
  75. <el-col :span="15">
  76. <el-table :data="order.items" border>
  77. <el-table-column prop="spuName" label="商品" width="auto">
  78. <template #default="{ row }">
  79. {{ row.spuName }}
  80. <el-tag
  81. size="medium"
  82. v-for="property in row.properties"
  83. :key="property.propertyId"
  84. >
  85. {{ property.propertyName }}: {{ property.valueName }}</el-tag
  86. >
  87. </template>
  88. </el-table-column>
  89. <el-table-column prop="price" label="商品原价(元)" width="150">
  90. <template #default="{ row }"> ¥{{ (row.price / 100.0).toFixed(2) }} </template>
  91. </el-table-column>
  92. <el-table-column prop="count" label="数量" width="100" />
  93. <el-table-column prop="payPrice" label="合计(元)" width="150">
  94. <template #default="{ row }"> ¥{{ (row.payPrice / 100.0).toFixed(2) }} </template>
  95. </el-table-column>
  96. <el-table-column prop="afterSaleStatus" label="售后状态" width="auto">
  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. ¥{{ parseFloat((order.totalPrice / 100.0) as unknown as string).toFixed(2) }}
  115. </el-descriptions-item>
  116. <el-descriptions-item label="运费金额: ">
  117. ¥{{ parseFloat((order.deliveryPrice / 100.0) as unknown as string).toFixed(2) }}
  118. </el-descriptions-item>
  119. <el-descriptions-item label="订单调价: ">
  120. ¥{{
  121. parseFloat((order.adjustPrice / 100.0) as unknown as string).toFixed(2)
  122. }}</el-descriptions-item
  123. >
  124. <el-descriptions-item>
  125. <template #label><span style="color: red">商品优惠: </span></template>
  126. <!-- 没理解TODO order.totalPrice - order.totalPrice -->
  127. ¥{{
  128. parseFloat((order.totalPrice - order.totalPrice / 100.0) as unknown as string).toFixed(2)
  129. }}
  130. </el-descriptions-item>
  131. <el-descriptions-item>
  132. <template #label><span style="color: red">订单优惠: </span></template>
  133. ¥{{ parseFloat((order.discountPrice / 100.0) as unknown as string).toFixed(2) }}
  134. </el-descriptions-item>
  135. <el-descriptions-item>
  136. <template #label><span style="color: red">积分抵扣: </span></template>
  137. ¥{{ parseFloat((order.pointPrice / 100.0) as unknown as string).toFixed(2) }}
  138. </el-descriptions-item>
  139. <el-descriptions-item v-for="item in 5" label-class-name="no-colon" :key="item" />
  140. <!-- 占位 -->
  141. <el-descriptions-item label="应付金额: ">
  142. ¥{{ (order.payPrice / 100.0).toFixed(2) }}
  143. </el-descriptions-item>
  144. </el-descriptions>
  145. <div v-for="group in detailGroups" :key="group.title">
  146. <el-descriptions v-bind="group.groupProps" :title="group.title">
  147. <!-- 订单操作日志 -->
  148. <el-descriptions-item v-if="group.key === 'orderLog'" labelClassName="no-colon">
  149. <el-timeline>
  150. <el-timeline-item
  151. v-for="activity in detailInfo[group.key]"
  152. :key="activity.timestamp"
  153. :timestamp="activity.timestamp"
  154. >
  155. {{ activity.content }}
  156. </el-timeline-item>
  157. </el-timeline>
  158. </el-descriptions-item>
  159. <!-- 物流信息 -->
  160. <el-descriptions-item v-if="group.key === 'expressInfo'" labelClassName="no-colon">
  161. <!-- 循环包裹物流信息 -->
  162. <div v-show="(pkgInfo = detailInfo[group.key]) !== null" style="border: 1px dashed">
  163. <!-- 包裹详情 -->
  164. <el-descriptions class="m-5">
  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="数量">{{ goodInfo.count }}</el-descriptions-item>
  187. </el-descriptions>
  188. </div>
  189. </template>
  190. <!-- 包裹物流详情 -->
  191. <template v-else-if="pkgChild.valueKey === 'wlxq'">
  192. <el-row :gutter="10">
  193. <el-col :span="6" :offset="1">
  194. <el-timeline>
  195. <el-timeline-item
  196. v-for="(activity, index) in pkgInfo[pkgChild.valueKey]"
  197. :key="index"
  198. :timestamp="activity.timestamp"
  199. >
  200. {{ activity.content }}
  201. </el-timeline-item>
  202. </el-timeline>
  203. </el-col>
  204. </el-row>
  205. </template>
  206. <template v-else>
  207. {{ pkgInfo[pkgChild.valueKey] }}
  208. </template>
  209. </el-descriptions-item>
  210. </el-descriptions>
  211. </div>
  212. </el-descriptions-item>
  213. </el-descriptions>
  214. </div>
  215. </ContentWrap>
  216. </template>
  217. <script lang="ts" name="TradeOrderDetail" setup>
  218. import { DICT_TYPE } from '@/utils/dict'
  219. import * as TradeOrderApi from '@/api/mall/trade/order'
  220. const message = useMessage() // 消息弹窗
  221. const { query } = useRoute()
  222. const queryParams = reactive({
  223. id: query.id
  224. })
  225. const dialogVisible = ref(false)
  226. const loading = ref(false)
  227. const order = ref<any>({
  228. items: [],
  229. user: {}
  230. }) //详情数据
  231. const detailGroups = ref([
  232. {
  233. title: '物流信息',
  234. key: 'expressInfo',
  235. children: [
  236. { label: '发货时间: ', valueKey: 'fhsj' },
  237. { label: '物流公司: ', valueKey: 'wlgs' },
  238. { label: '运单号: ', valueKey: 'ydh' },
  239. { label: '物流状态: ', valueKey: 'wlzt', childProps: { span: 3 } },
  240. { label: '物流详情: ', valueKey: 'wlxq' }
  241. ]
  242. },
  243. {
  244. title: '订单操作日志',
  245. key: 'orderLog'
  246. }
  247. ])
  248. const detailInfo = ref({
  249. expressInfo:
  250. // 物流信息
  251. {
  252. label: '包裹1',
  253. name: 'bg1',
  254. fhsj: '2022-11-03 16:50:45',
  255. wlgs: '极兔',
  256. ydh: '2132123',
  257. wlzt: '不支持此快递公司',
  258. wlxq: [
  259. {
  260. content: '正在派送途中,请您准备签收(派件人:王涛,电话:13854563814)',
  261. timestamp: '2018-04-15 15:00:16'
  262. },
  263. {
  264. content: '快件到达 【烟台龙口东江村委营业点】',
  265. timestamp: '2018-04-13 14:54:19'
  266. },
  267. {
  268. content: '快件已发车',
  269. timestamp: '2018-04-11 12:55:52'
  270. },
  271. {
  272. content: '快件已发车',
  273. timestamp: '2018-04-11 12:55:52'
  274. },
  275. {
  276. content: '快件已发车',
  277. timestamp: '2018-04-11 12:55:52'
  278. }
  279. ]
  280. },
  281. orderLog: [
  282. // 订单操作日志
  283. {
  284. content: '买家【乌鸦】关闭了订单',
  285. timestamp: '2018-04-15 15:00:16'
  286. },
  287. {
  288. content: '买家【乌鸦】下单了',
  289. timestamp: '2018-04-15 15:00:16'
  290. }
  291. ],
  292. goodsInfo: [] // 商品详情tableData
  293. })
  294. //暂考虑一次性加载详情页面所有数据
  295. const getlist = async () => {
  296. dialogVisible.value = true
  297. loading.value = true
  298. try {
  299. const res = await TradeOrderApi.getOrderDetail(queryParams.id as unknown as number)
  300. order.value = res
  301. console.log(order)
  302. } catch {
  303. message.error('获取详情数据失败')
  304. } finally {
  305. loading.value = false
  306. }
  307. }
  308. onMounted(async () => {
  309. await getlist()
  310. })
  311. const clipboardSuccess = () => {
  312. message.success('复制成功')
  313. }
  314. </script>
  315. <style lang="scss" scoped>
  316. :deep(.el-descriptions) {
  317. &:not(:nth-child(1)) {
  318. margin-top: 20px;
  319. }
  320. .el-descriptions__title {
  321. display: flex;
  322. align-items: center;
  323. &::before {
  324. content: '';
  325. display: inline-block;
  326. margin-right: 10px;
  327. width: 3px;
  328. height: 20px;
  329. background-color: #409eff;
  330. }
  331. }
  332. .el-descriptions-item__container {
  333. margin: 0 10px;
  334. .no-colon {
  335. margin: 0;
  336. &::after {
  337. content: '';
  338. }
  339. }
  340. }
  341. }
  342. </style>