index.vue 14 KB

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