order-item.vue 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437
  1. <template>
  2. <div class="order-item">
  3. <!-- Order Header -->
  4. <div class="order-header">
  5. <el-checkbox v-model="order.checked" style="margin-right: 12px" />
  6. <span class="mr-4"
  7. >订单编号: {{ order.orderId }}
  8. <el-button
  9. link
  10. type="primary"
  11. size="small"
  12. @click="handleCopy(order.orderId)"
  13. >复制</el-button
  14. ></span
  15. >
  16. <span class="urge-tag" v-if="order.urgeStatus == 1">催发货</span>
  17. <span class="mr-4">创建时间: {{ order.createTime }}</span>
  18. <span class="mr-4"
  19. >支付渠道:
  20. <dict-data
  21. v-if="order.payType"
  22. code="shop_order_pay_type"
  23. type="text"
  24. :model-value="order.payType"
  25. />
  26. <span v-else>-</span>
  27. </span>
  28. <span class="mr-4">
  29. 订单来源:
  30. <span v-if="order.orderFrom == 1">微信小程序</span>
  31. <span v-else-if="order.orderFrom == 2">支付宝小程序</span>
  32. <span v-else>商城小程序</span>
  33. <el-image
  34. :src="order.orderFrom == 2 ? alipayIcon : wxIcon"
  35. v-if="order.orderFrom == 1 || order.orderFrom == 2"
  36. style="
  37. width: 16px;
  38. height: 16px;
  39. margin-left: 4px;
  40. vertical-align: text-bottom;
  41. "
  42. />
  43. </span>
  44. <span
  45. class="flag-icon cursor-pointer"
  46. @click="$emit('add-remark', order)"
  47. ><el-icon size="23" :color="order.remarkLabel">
  48. <Flag /> </el-icon
  49. ></span>
  50. </div>
  51. <!-- Order Body -->
  52. <div class="order-body">
  53. <!-- Products Column -->
  54. <div class="col-products-wrapper">
  55. <div
  56. v-for="(product, idx) in order.detailList"
  57. :key="idx"
  58. class="product-row"
  59. >
  60. <div class="col-product product-info mr-2">
  61. <el-image
  62. :src="product.cover"
  63. class="product-img"
  64. fit="cover"
  65. />
  66. <div class="product-detail">
  67. <div class="product-title">{{
  68. product.bookName
  69. }}</div>
  70. <div class="product-isbn"
  71. >ISBN:
  72. <span class="link">{{ product.isbn }}</span>
  73. <el-icon
  74. class="cursor-pointer"
  75. @click="handleCopy(product.isbn)"
  76. >
  77. <CopyDocument />
  78. </el-icon>
  79. (品相:
  80. {{ getConditionText(product.conditionType) }})
  81. </div>
  82. <div class="product-tags">
  83. <span class="tag"
  84. >回收折扣:
  85. <span
  86. style="
  87. color: #67c23a;
  88. font-weight: bold;
  89. "
  90. >{{
  91. product.recycleDiscount || 1
  92. }}折</span
  93. ></span
  94. >
  95. <span class="tag"
  96. >(回收状态:
  97. <span
  98. style="
  99. color: #67c23a;
  100. font-weight: bold;
  101. "
  102. >{{
  103. getRecycleStatusText(
  104. product.recycleStatus
  105. )
  106. }}</span
  107. >)</span
  108. >
  109. </div>
  110. </div>
  111. </div>
  112. <div class="col-price">¥ {{ product.price }}</div>
  113. <div class="col-qty">x{{ product.num }}</div>
  114. <div class="col-aftersales">
  115. <span
  116. class="cursor-pointer"
  117. @click="$emit('view-refund-detail', product)"
  118. :class="{
  119. 'text-blue': product.status === '3',
  120. 'text-red': product.status === '2'
  121. }"
  122. >
  123. {{ getDetailStatusText(product.status) }}
  124. </span>
  125. </div>
  126. </div>
  127. </div>
  128. <!-- Merged Columns -->
  129. <div class="col-merged col-buyer">
  130. <div class="buyer-info">
  131. <el-avatar :size="30" :src="order.avatar" />
  132. <div class="buyer-name">{{ order.userNick }}</div>
  133. <div class="buyer-phone">{{
  134. formatPhone(order.receiverMobile)
  135. }}</div>
  136. </div>
  137. </div>
  138. <div class="col-merged col-payment">
  139. <div class="payment-amount">¥ {{ order.payMoney }}</div>
  140. <div class="shipping-fee"
  141. >(含邮费: ¥ {{ order.expressMoney }})</div
  142. >
  143. </div>
  144. <div class="col-merged col-logistics">
  145. <div>{{ order.expressName }}</div>
  146. <div>{{ order.waybillCode }}</div>
  147. </div>
  148. <div class="col-merged col-status">
  149. <dict-data
  150. code="shop_order_status"
  151. type="text"
  152. :model-value="order.status"
  153. />
  154. <el-button
  155. link
  156. type="primary"
  157. @click="$emit('view-detail', order)"
  158. >[查看详情]</el-button
  159. >
  160. </div>
  161. <div class="col-merged col-action">
  162. <el-button
  163. v-if="order.status == 2"
  164. link
  165. type="primary"
  166. @click="$emit('manual-delivery', order)"
  167. >[手工发货]</el-button
  168. >
  169. <el-button link type="primary" @click="$emit('push-sms', order)"
  170. >[短信记录]</el-button
  171. >
  172. <el-button link type="warning" @click="$emit('refund', order)"
  173. >[缺货退款]</el-button
  174. >
  175. <el-button link type="primary" @click="$emit('view-log', order)"
  176. >[订单日志]</el-button
  177. >
  178. </div>
  179. </div>
  180. <!-- Buyer Note -->
  181. <div class="buyer-note" v-if="order.remark">
  182. <span class="note-label">买家备注:</span>
  183. <span class="note-content">{{ order.remark }}</span>
  184. </div>
  185. </div>
  186. </template>
  187. <script setup>
  188. import { Flag, CopyDocument } from '@element-plus/icons-vue';
  189. import { EleMessage } from 'ele-admin-plus/es';
  190. import { useClipboard } from '@vueuse/core';
  191. import wxIcon from '@/assets/wx.png';
  192. import alipayIcon from '@/assets/alipay.png';
  193. import { formatPhone } from '@/utils/common';
  194. const props = defineProps({
  195. order: {
  196. type: Object,
  197. required: true
  198. }
  199. });
  200. defineEmits([
  201. 'view-detail',
  202. 'view-refund-detail',
  203. 'push-sms',
  204. 'refund',
  205. 'view-log',
  206. 'add-remark',
  207. 'manual-delivery'
  208. ]);
  209. const { copy } = useClipboard();
  210. const handleCopy = async (text) => {
  211. try {
  212. await copy(text);
  213. EleMessage.success('复制成功');
  214. } catch (e) {
  215. EleMessage.error('复制失败');
  216. }
  217. };
  218. const getDetailStatusText = (status) => {
  219. const map = {
  220. 1: '',
  221. 2: '部分退款',
  222. 3: '全部退款'
  223. };
  224. return map[status] || '';
  225. };
  226. const getConditionText = (type) => {
  227. const map = {
  228. 1: '良好',
  229. 2: '中等',
  230. 3: '次品',
  231. 4: '全新'
  232. };
  233. return map[type] || '-';
  234. };
  235. const getRecycleStatusText = (status) => {
  236. const map = {
  237. 1: '正在回收',
  238. 2: '暂停回收',
  239. 3: '未加入回收书单',
  240. 4: '黑名单',
  241. 5: '手动暂停'
  242. };
  243. return map[status] || '-';
  244. };
  245. </script>
  246. <style scoped>
  247. .order-item {
  248. border: 1px solid #e4e7ed;
  249. margin-bottom: 20px;
  250. font-size: 13px;
  251. }
  252. .order-header {
  253. background-color: #f5f7fa;
  254. padding: 10px 20px;
  255. display: flex;
  256. align-items: center;
  257. border-bottom: 1px solid #e4e7ed;
  258. }
  259. .order-body {
  260. display: flex;
  261. align-items: stretch;
  262. }
  263. .col-products-wrapper {
  264. flex: 1;
  265. min-width: 0;
  266. display: flex;
  267. flex-direction: column;
  268. border-right: 1px solid #e4e7ed;
  269. }
  270. .product-row {
  271. display: flex;
  272. align-items: center;
  273. padding: 15px 0;
  274. border-bottom: 1px solid #ebeef5;
  275. }
  276. .product-row:last-child {
  277. border-bottom: none;
  278. }
  279. .col-product {
  280. flex: 1;
  281. min-width: 200px;
  282. padding-left: 20px;
  283. display: flex;
  284. }
  285. .product-img {
  286. width: 60px;
  287. height: 60px;
  288. border-radius: 4px;
  289. margin-right: 10px;
  290. }
  291. .product-detail {
  292. display: flex;
  293. flex-direction: column;
  294. justify-content: space-between;
  295. }
  296. .product-title {
  297. font-weight: 500;
  298. margin-bottom: 4px;
  299. overflow: hidden;
  300. text-overflow: ellipsis;
  301. display: -webkit-box;
  302. -webkit-line-clamp: 2;
  303. -webkit-box-orient: vertical;
  304. }
  305. .col-price {
  306. width: 100px;
  307. flex: none;
  308. text-align: center;
  309. display: flex;
  310. align-items: center;
  311. justify-content: center;
  312. }
  313. .col-qty {
  314. width: 80px;
  315. flex: none;
  316. text-align: center;
  317. display: flex;
  318. align-items: center;
  319. justify-content: center;
  320. }
  321. .col-aftersales {
  322. width: 100px;
  323. flex: none;
  324. text-align: center;
  325. display: flex;
  326. align-items: center;
  327. justify-content: center;
  328. }
  329. .col-merged {
  330. display: flex;
  331. flex-direction: column;
  332. justify-content: center;
  333. align-items: center;
  334. border-right: 1px solid #e4e7ed;
  335. padding: 10px;
  336. text-align: center;
  337. }
  338. .col-merged:last-child {
  339. border-right: none;
  340. }
  341. .col-buyer {
  342. width: 150px;
  343. flex: none;
  344. }
  345. .col-payment {
  346. width: 120px;
  347. flex: none;
  348. }
  349. .col-logistics {
  350. width: 150px;
  351. flex: none;
  352. }
  353. .col-status {
  354. width: 120px;
  355. flex: none;
  356. }
  357. .col-action {
  358. width: 120px;
  359. flex: none;
  360. }
  361. .buyer-note {
  362. background-color: #fef0f0;
  363. padding: 8px 20px;
  364. color: #f56c6c;
  365. border-top: 1px solid #fde2e2;
  366. }
  367. .text-blue {
  368. color: #409eff;
  369. }
  370. .text-red {
  371. color: #f56c6c;
  372. cursor: pointer;
  373. }
  374. .flag-icon {
  375. color: #aaa;
  376. margin-left: 10px;
  377. }
  378. .urge-tag {
  379. background-color: #f56c6c;
  380. color: #fff;
  381. padding: 2px 6px;
  382. border-radius: 4px;
  383. font-size: 13px;
  384. margin-right: 10px;
  385. }
  386. .tag {
  387. padding: 2px 0;
  388. border-radius: 4px;
  389. margin-right: 5px;
  390. font-size: 13px;
  391. font-weight: 400;
  392. }
  393. .tag.success {
  394. background-color: #f0f9eb;
  395. color: #67c23a;
  396. }
  397. </style>