refund-item.vue 9.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292
  1. <template>
  2. <div class="refund-item">
  3. <!-- Header -->
  4. <div class="refund-header">
  5. <el-checkbox v-model="item.checked" style="margin-right:12px" />
  6. <el-tag type="success" size="small" class="mr-2" effect="plain">
  7. {{ getRefundTypeText(item.refundType) }}
  8. </el-tag>
  9. <span class="mr-4 text-black-600">退款编号: {{ item.refundOrderId }}</span>
  10. <span class="mr-4 text-black-600">原订单编号: {{ item.originOrderId }}</span>
  11. <span class="mr-4 text-black-600">申请时间: {{ item.createTime }}</span>
  12. <span class="mr-4 text-black-600" v-if="item.cancelStatus == 2">
  13. <el-tag type="info" size="small">已撤销</el-tag>
  14. </span>
  15. </div>
  16. <!-- Body -->
  17. <div class="refund-body">
  18. <!-- Product Info (Flex 3) -->
  19. <div class="col-product-wrapper">
  20. <div v-for="(product, idx) in item.detailList" :key="idx" class="product-row">
  21. <div class="product-info">
  22. <el-image :src="product.cover" class="product-img" fit="cover" />
  23. <div class="product-detail">
  24. <div class="product-title">{{ product.bookName }}</div>
  25. <div class="product-isbn">
  26. ISBN: <span class="link">{{ product.isbn }}</span>
  27. <el-icon class="cursor-pointer ml-1" @click="handleCopy(product.isbn)">
  28. <CopyDocument />
  29. </el-icon>
  30. </div>
  31. <div class="product-price">
  32. <span class="mr-2">退回数量: {{ product.refundNum }}</span>
  33. <span>单价: ¥ {{ product.price }}</span>
  34. </div>
  35. </div>
  36. </div>
  37. </div>
  38. </div>
  39. <!-- Refund Amount (Flex 1) -->
  40. <div class="col-merged col-amount">
  41. <div class="amount">申请: ¥ {{ item.refundMoney }}</div>
  42. <div class="final-amount text-green-500" v-if="item.refundMoneyFinal">实退: ¥ {{ item.refundMoneyFinal }}</div>
  43. <div class="money-status text-xs text-gray-400 mt-1">
  44. {{ getMoneyStatusText(item.moneyStatus) }}
  45. </div>
  46. </div>
  47. <!-- Buyer (Flex 1) -->
  48. <div class="col-merged col-buyer">
  49. <div class="buyer-info">
  50. <el-avatar :size="30" :src="item.avatar" />
  51. <div class="buyer-name">{{ item.userNick }}</div>
  52. <div class="buyer-id text-xs text-gray-400">ID: {{ item.userId }}</div>
  53. </div>
  54. </div>
  55. <!-- Reason (Flex 1) -->
  56. <div class="col-merged col-reason">
  57. <div class="font-bold">{{ item.refundReason }}</div>
  58. <div class="text-xs text-gray-500 mt-1">货物状态: {{ getShopStatusText(item.shopStatus) }}</div>
  59. </div>
  60. <!-- Logistics (Flex 1.5) -->
  61. <div class="col-merged col-logistics">
  62. <div class="logistics-row">
  63. <span class="font-bold">{{ getSendTypeText(item.sendType) }}</span>
  64. </div>
  65. <div class="logistics-row" v-if="item.expressName">
  66. <span>{{ item.expressName }}</span>
  67. </div>
  68. <div class="logistics-row" v-if="item.waybillCode">
  69. <span>{{ item.waybillCode }}</span>
  70. <el-icon class="cursor-pointer ml-1" @click="handleCopy(item.waybillCode)">
  71. <CopyDocument />
  72. </el-icon>
  73. </div>
  74. <div class="logistics-row" v-if="item.pickupCode">
  75. <span>取件码: {{ item.pickupCode }}</span>
  76. </div>
  77. </div>
  78. <!-- Status (Flex 1) -->
  79. <div class="col-merged col-status">
  80. <div class="text-red-500 font-bold mb-1">{{ getStatusText(item.status) }}</div>
  81. <el-button link type="primary" size="small" @click="$emit('view-detail', item)">[查看详情]</el-button>
  82. </div>
  83. <!-- Action (Flex 1) -->
  84. <div class="col-merged col-action">
  85. <div class="action-btn text-green-500" @click="$emit('push-sms', item)">[推送短信]</div>
  86. <div class="action-btn text-orange-500" @click="$emit('send-packet', item)">[发红包]</div>
  87. </div>
  88. </div>
  89. </div>
  90. </template>
  91. <script setup>
  92. import { CopyDocument } from '@element-plus/icons-vue';
  93. import { EleMessage } from 'ele-admin-plus/es';
  94. import { useClipboard } from '@vueuse/core';
  95. const props = defineProps({
  96. item: {
  97. type: Object,
  98. required: true
  99. }
  100. });
  101. defineEmits(['push-sms', 'send-packet', 'view-detail']);
  102. const { copy } = useClipboard();
  103. const handleCopy = async (text) => {
  104. try {
  105. await copy(text);
  106. EleMessage.success('复制成功');
  107. } catch (e) {
  108. EleMessage.error('复制失败');
  109. }
  110. };
  111. const getRefundTypeText = (type) => {
  112. const map = {
  113. '0': '极速退款',
  114. '1': '退货退款',
  115. '2': '仅退款'
  116. };
  117. return map[type] || type;
  118. };
  119. const getStatusText = (status) => {
  120. const map = {
  121. '1': '申请退款',
  122. '2': '审核通过',
  123. '3': '审核驳回',
  124. '4': '超时关闭',
  125. '5': '卖家已发货',
  126. '6': '已完成'
  127. };
  128. return map[status] || status;
  129. };
  130. const getShopStatusText = (status) => {
  131. const map = {
  132. '1': '未收到货',
  133. '2': '已收到货'
  134. };
  135. return map[status] || '-';
  136. };
  137. const getSendTypeText = (type) => {
  138. const map = {
  139. '1': '上门取件',
  140. '2': '寄件点自寄',
  141. '3': '自行寄回'
  142. };
  143. return map[type] || '-';
  144. };
  145. const getMoneyStatusText = (status) => {
  146. const map = {
  147. '1': '未退还',
  148. '2': '已退还',
  149. '3': '已到账'
  150. };
  151. return map[status] || '未退还';
  152. };
  153. </script>
  154. <style lang="scss" scoped>
  155. .refund-item {
  156. border: 1px solid #ebeef5;
  157. margin-bottom: 15px;
  158. background: #fff;
  159. .refund-header {
  160. background-color: #f5f7fa;
  161. padding: 8px 15px;
  162. font-size: 13px;
  163. display: flex;
  164. align-items: center;
  165. border-bottom: 1px solid #ebeef5;
  166. }
  167. .refund-body {
  168. display: flex;
  169. align-items: stretch;
  170. .col-product-wrapper {
  171. flex: 3;
  172. display: flex;
  173. flex-direction: column;
  174. border-right: 1px solid #ebeef5;
  175. .product-row {
  176. display: flex;
  177. padding: 15px;
  178. border-bottom: 1px solid #ebeef5;
  179. &:last-child {
  180. border-bottom: none;
  181. }
  182. .product-info {
  183. display: flex;
  184. width: 100%;
  185. .product-img {
  186. width: 80px;
  187. height: 80px;
  188. margin-right: 15px;
  189. border-radius: 4px;
  190. border: 1px solid #eee;
  191. }
  192. .product-detail {
  193. font-size: 13px;
  194. flex: 1;
  195. .product-title {
  196. font-weight: 500;
  197. margin-bottom: 5px;
  198. color: #333;
  199. }
  200. .product-isbn {
  201. color: #666;
  202. margin-bottom: 3px;
  203. font-size: 12px;
  204. .link {
  205. color: #409eff;
  206. }
  207. }
  208. .product-price {
  209. margin-top: 5px;
  210. color: #333;
  211. }
  212. }
  213. }
  214. }
  215. }
  216. .col-merged {
  217. border-right: 1px solid #ebeef5;
  218. display: flex;
  219. flex-direction: column;
  220. justify-content: center;
  221. align-items: center;
  222. padding: 10px;
  223. text-align: center;
  224. font-size: 13px;
  225. &:last-child {
  226. border-right: none;
  227. }
  228. &.col-amount { flex: 1; }
  229. &.col-buyer { flex: 1; }
  230. &.col-reason { flex: 1; }
  231. &.col-logistics {
  232. flex: 1.5;
  233. align-items: flex-start;
  234. padding-left: 15px;
  235. .logistics-row {
  236. display: flex;
  237. align-items: center;
  238. margin-bottom: 4px;
  239. color: #666;
  240. font-size: 12px;
  241. }
  242. }
  243. &.col-status { flex: 1; }
  244. &.col-action { flex: 1; }
  245. }
  246. }
  247. .action-btn {
  248. cursor: pointer;
  249. margin-bottom: 5px;
  250. font-size: 13px;
  251. &:hover {
  252. opacity: 0.8;
  253. }
  254. }
  255. }
  256. </style>