index.vue 8.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243
  1. <template>
  2. <ContentWrap>
  3. <!-- 订单信息 -->
  4. <el-descriptions title="订单信息">
  5. <el-descriptions-item label="订单号: ">{{ formData.orderNo }}</el-descriptions-item>
  6. <el-descriptions-item label="配送方式: ">
  7. <dict-tag :type="DICT_TYPE.TRADE_DELIVERY_TYPE" :value="formData.order.deliveryType" />
  8. </el-descriptions-item>
  9. <!-- TODO 营销活动待实现 -->
  10. <el-descriptions-item label="订单类型: ">
  11. <dict-tag :type="DICT_TYPE.TRADE_ORDER_TYPE" :value="formData.order.type" />
  12. </el-descriptions-item>
  13. <el-descriptions-item label="收货人: ">
  14. {{ formData.order.receiverName }}
  15. </el-descriptions-item>
  16. <el-descriptions-item label="买家留言: ">
  17. {{ formData.order.userRemark }}
  18. </el-descriptions-item>
  19. <el-descriptions-item label="订单来源: ">
  20. <dict-tag :type="DICT_TYPE.TERMINAL" :value="formData.order.terminal" />
  21. </el-descriptions-item>
  22. <el-descriptions-item label="联系电话: ">
  23. {{ formData.order.receiverMobile }}
  24. </el-descriptions-item>
  25. <el-descriptions-item label="商家备注: ">{{ formData.order.remark }}</el-descriptions-item>
  26. <el-descriptions-item label="支付单号: ">
  27. {{ formData.order.payOrderId }}
  28. </el-descriptions-item>
  29. <el-descriptions-item label="付款方式: ">
  30. <dict-tag :type="DICT_TYPE.PAY_CHANNEL_CODE" :value="formData.order.payChannelCode" />
  31. </el-descriptions-item>
  32. <!-- TODO 芋艿:待实现:跳转会员 -->
  33. <!-- <el-descriptions-item label="买家: ">{{ formData.user.nickname }}</el-descriptions-item> -->
  34. </el-descriptions>
  35. <!-- 售后信息 -->
  36. <el-descriptions title="售后信息">
  37. <el-descriptions-item label="退款编号: ">{{ formData.no }}</el-descriptions-item>
  38. <el-descriptions-item label="申请时间: ">
  39. {{ formatDate(formData.auditTime) }}
  40. </el-descriptions-item>
  41. <el-descriptions-item label="售后类型: ">
  42. <dict-tag :type="DICT_TYPE.TRADE_AFTER_SALE_TYPE" :value="formData.type" />
  43. </el-descriptions-item>
  44. <el-descriptions-item label="售后方式: ">
  45. <dict-tag :type="DICT_TYPE.TRADE_AFTER_SALE_WAY" :value="formData.way" />
  46. </el-descriptions-item>
  47. <el-descriptions-item label="退款金额: ">
  48. {{ floatToFixed2(formData.refundPrice) }}
  49. </el-descriptions-item>
  50. <el-descriptions-item label="退款原因: ">{{ formData.applyReason }}</el-descriptions-item>
  51. <el-descriptions-item label="补充描述: ">
  52. {{ formData.applyDescription }}
  53. </el-descriptions-item>
  54. <el-descriptions-item label="凭证图片: ">
  55. <el-image
  56. v-for="(item, index) in formData.applyPicUrls"
  57. :key="index"
  58. :src="item.url"
  59. class="w-60px h-60px mr-10px"
  60. @click="imagePreview(formData.applyPicUrls)"
  61. />
  62. </el-descriptions-item>
  63. </el-descriptions>
  64. <!-- 退款状态 -->
  65. <el-descriptions :column="1" title="退款状态">
  66. <el-descriptions-item label="退款状态: ">
  67. <dict-tag :type="DICT_TYPE.TRADE_AFTER_SALE_STATUS" :value="formData.status" />
  68. </el-descriptions-item>
  69. <el-descriptions-item label-class-name="no-colon">
  70. <el-button v-if="formData.status === 10" type="primary" @click="agree">同意售后</el-button>
  71. <el-button v-if="formData.status === 10" type="primary" @click="disagree">
  72. 拒绝售后
  73. </el-button>
  74. <el-button v-if="formData.status === 30" type="primary" @click="receive">
  75. 确认收货
  76. </el-button>
  77. <el-button v-if="formData.status === 30" type="primary" @click="refuse">拒绝收货</el-button>
  78. <el-button v-if="formData.status === 40" type="primary" @click="refund">确认退款</el-button>
  79. </el-descriptions-item>
  80. <el-descriptions-item>
  81. <template #label><span style="color: red">提醒: </span></template>
  82. 如果未发货,请点击同意退款给买家。<br />
  83. 如果实际已发货,请主动与买家联系。<br />
  84. 如果订单整体退款后,优惠券和余额会退还给买家.
  85. </el-descriptions-item>
  86. </el-descriptions>
  87. <!-- 商品信息 -->
  88. <el-descriptions title="商品信息">
  89. <el-descriptions-item labelClassName="no-colon">
  90. <el-row :gutter="20">
  91. <el-col :span="15">
  92. <el-table :data="formData.items" border>
  93. <el-table-column label="商品" prop="spuName" width="auto">
  94. <template #default="{ row }">
  95. {{ row.spuName }}
  96. <el-tag v-for="property in row.properties" :key="property.propertyId">
  97. {{ property.propertyName }}: {{ property.valueName }}
  98. </el-tag>
  99. </template>
  100. </el-table-column>
  101. <el-table-column label="商品原价" prop="price" width="150">
  102. <template #default="{ row }">{{ floatToFixed2(row.price) }}元</template>
  103. </el-table-column>
  104. <el-table-column label="数量" prop="count" width="100" />
  105. <el-table-column label="合计" prop="payPrice" width="150">
  106. <template #default="{ row }">{{ floatToFixed2(row.payPrice) }}元</template>
  107. </el-table-column>
  108. <el-table-column label="售后状态" prop="afterSaleStatus" width="120">
  109. <template #default="{ row }">
  110. <dict-tag
  111. :type="DICT_TYPE.TRADE_ORDER_ITEM_AFTER_SALE_STATUS"
  112. :value="row.afterSaleStatus"
  113. />
  114. </template>
  115. </el-table-column>
  116. </el-table>
  117. </el-col>
  118. <el-col :span="10" />
  119. </el-row>
  120. </el-descriptions-item>
  121. </el-descriptions>
  122. <!-- 售后信息 TODO @puhui999:需要接入 -->
  123. <el-descriptions title="售后日志" />
  124. </ContentWrap>
  125. <!-- 各种操作的弹窗 -->
  126. <UpdateAuditReasonForm ref="updateAuditReasonFormRef" @success="getDetail" />
  127. </template>
  128. <script lang="ts" setup>
  129. import * as AfterSaleApi from '@/api/mall/trade/afterSale/index'
  130. import { floatToFixed2 } from '@/utils'
  131. import { DICT_TYPE } from '@/utils/dict'
  132. import { formatDate } from '@/utils/formatTime'
  133. import UpdateAuditReasonForm from '@/views/mall/trade/afterSale/form/AfterSaleDisagreeForm.vue'
  134. import { createImageViewer } from '@/components/ImageViewer'
  135. import { isArray } from '@/utils/is'
  136. defineOptions({ name: 'TradeOrderDetailForm' })
  137. const message = useMessage() // 消息弹窗
  138. const { params } = useRoute() // 查询参数
  139. const formData = ref({
  140. order: {}
  141. })
  142. const updateAuditReasonFormRef = ref() // 拒绝售后表单 Ref
  143. /** 获得详情 */
  144. const getDetail = async () => {
  145. const id = params.orderId as unknown as number
  146. if (id) {
  147. formData.value = await AfterSaleApi.getAfterSale(id)
  148. }
  149. }
  150. // TODO @puhui999:操作后,需要提示和刷新哈。
  151. /** 同意售后 */
  152. const agree = () => {
  153. message.confirm('是否同意售后?').then(() => {
  154. AfterSaleApi.agree(formData.value.id)
  155. })
  156. }
  157. /** 拒绝售后 */
  158. const disagree = () => {
  159. updateAuditReasonFormRef.value?.open(formData.value)
  160. }
  161. /** 确认收货 */
  162. const receive = () => {
  163. message.confirm('是否确认收货?').then(() => {
  164. AfterSaleApi.receive(formData.value.id)
  165. })
  166. }
  167. /** 拒绝收货 */
  168. const refuse = () => {
  169. message.confirm('是否拒绝收货?').then(() => {
  170. AfterSaleApi.refuse(formData.value.id)
  171. })
  172. }
  173. /** 确认退款 */
  174. const refund = () => {
  175. message.confirm('是否确认退款?').then(() => {
  176. AfterSaleApi.refund(formData.value.id)
  177. })
  178. }
  179. /** 图片预览 */
  180. const imagePreview = (args) => {
  181. const urlList = []
  182. if (isArray(args)) {
  183. args.forEach((item) => {
  184. urlList.push(item.url)
  185. })
  186. } else {
  187. urlList.push(args)
  188. }
  189. createImageViewer({
  190. urlList
  191. })
  192. }
  193. onMounted(async () => {
  194. await getDetail()
  195. })
  196. </script>
  197. <style lang="scss" scoped>
  198. :deep(.el-descriptions) {
  199. &:not(:nth-child(1)) {
  200. margin-top: 20px;
  201. }
  202. .el-descriptions__title {
  203. display: flex;
  204. align-items: center;
  205. &::before {
  206. display: inline-block;
  207. width: 3px;
  208. height: 20px;
  209. margin-right: 10px;
  210. background-color: #409eff;
  211. content: '';
  212. }
  213. }
  214. .el-descriptions-item__container {
  215. margin: 0 10px;
  216. .no-colon {
  217. margin: 0;
  218. &::after {
  219. content: '';
  220. }
  221. }
  222. }
  223. }
  224. </style>