From a1d7e81859f554f3a53680cc35f0f49bf1f77098 Mon Sep 17 00:00:00 2001
From: wwf <1971391498@qq.com>
Date: 星期四, 14 五月 2026 14:37:02 +0800
Subject: [PATCH] 导入项目

---
 src/views/mall/trade/afterSale/detail/index.vue |  358 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 358 insertions(+), 0 deletions(-)

diff --git a/src/views/mall/trade/afterSale/detail/index.vue b/src/views/mall/trade/afterSale/detail/index.vue
new file mode 100644
index 0000000..4835ee6
--- /dev/null
+++ b/src/views/mall/trade/afterSale/detail/index.vue
@@ -0,0 +1,358 @@
+<template>
+  <ContentWrap>
+    <!-- 璁㈠崟淇℃伅 -->
+    <el-descriptions title="璁㈠崟淇℃伅">
+      <el-descriptions-item label="璁㈠崟鍙�: ">{{ formData.orderNo }}</el-descriptions-item>
+      <el-descriptions-item label="閰嶉�佹柟寮�: ">
+        <dict-tag :type="DICT_TYPE.TRADE_DELIVERY_TYPE" :value="formData.order.deliveryType" />
+      </el-descriptions-item>
+      <el-descriptions-item label="璁㈠崟绫诲瀷: ">
+        <dict-tag :type="DICT_TYPE.TRADE_ORDER_TYPE" :value="formData.order.type" />
+      </el-descriptions-item>
+      <el-descriptions-item label="鏀惰揣浜�: ">
+        {{ formData.order.receiverName }}
+      </el-descriptions-item>
+      <el-descriptions-item label="涔板鐣欒█: ">
+        {{ formData.order.userRemark }}
+      </el-descriptions-item>
+      <el-descriptions-item label="璁㈠崟鏉ユ簮: ">
+        <dict-tag :type="DICT_TYPE.TERMINAL" :value="formData.order.terminal" />
+      </el-descriptions-item>
+      <el-descriptions-item label="鑱旂郴鐢佃瘽: ">
+        {{ formData.order.receiverMobile }}
+      </el-descriptions-item>
+      <el-descriptions-item label="鍟嗗澶囨敞: ">{{ formData.order.remark }}</el-descriptions-item>
+      <el-descriptions-item label="鏀粯鍗曞彿: ">
+        {{ formData.order.payOrderId }}
+      </el-descriptions-item>
+      <el-descriptions-item label="浠樻鏂瑰紡: ">
+        <dict-tag :type="DICT_TYPE.PAY_CHANNEL_CODE" :value="formData.order.payChannelCode" />
+      </el-descriptions-item>
+      <el-descriptions-item label="涔板: ">{{ formData?.user?.nickname }}</el-descriptions-item>
+    </el-descriptions>
+
+    <!-- 鍞悗淇℃伅 -->
+    <el-descriptions title="鍞悗淇℃伅">
+      <el-descriptions-item label="閫�娆剧紪鍙�: ">{{ formData.no }}</el-descriptions-item>
+      <el-descriptions-item label="鐢宠鏃堕棿: ">
+        {{ formatDate(formData.auditTime) }}
+      </el-descriptions-item>
+      <el-descriptions-item label="鍞悗绫诲瀷: ">
+        <dict-tag :type="DICT_TYPE.TRADE_AFTER_SALE_TYPE" :value="formData.type" />
+      </el-descriptions-item>
+      <el-descriptions-item label="鍞悗鏂瑰紡: ">
+        <dict-tag :type="DICT_TYPE.TRADE_AFTER_SALE_WAY" :value="formData.way" />
+      </el-descriptions-item>
+      <el-descriptions-item label="閫�娆鹃噾棰�: ">
+        {{ fenToYuan(formData.refundPrice) }}
+      </el-descriptions-item>
+      <el-descriptions-item label="閫�娆惧師鍥�: ">{{ formData.applyReason }}</el-descriptions-item>
+      <el-descriptions-item label="琛ュ厖鎻忚堪: ">
+        {{ formData.applyDescription }}
+      </el-descriptions-item>
+      <el-descriptions-item label="鍑瘉鍥剧墖: ">
+        <el-image
+          v-for="(item, index) in formData.applyPicUrls"
+          :key="index"
+          :src="item.url"
+          class="mr-10px h-60px w-60px"
+          @click="imagePreview(formData.applyPicUrls)"
+        />
+      </el-descriptions-item>
+    </el-descriptions>
+
+    <!-- 閫�娆剧姸鎬� -->
+    <el-descriptions :column="1" title="閫�娆剧姸鎬�">
+      <el-descriptions-item label="閫�娆剧姸鎬�: ">
+        <dict-tag :type="DICT_TYPE.TRADE_AFTER_SALE_STATUS" :value="formData.status" />
+      </el-descriptions-item>
+      <el-descriptions-item label-class-name="no-colon">
+        <el-button v-if="formData.status === 10" type="primary" @click="agree">鍚屾剰鍞悗</el-button>
+        <el-button v-if="formData.status === 10" type="primary" @click="disagree">
+          鎷掔粷鍞悗
+        </el-button>
+        <el-button v-if="formData.status === 30" type="primary" @click="receive">
+          纭鏀惰揣
+        </el-button>
+        <el-button v-if="formData.status === 30" type="primary" @click="refuse">鎷掔粷鏀惰揣</el-button>
+        <el-button v-if="formData.status === 40" type="primary" @click="refund">纭閫�娆�</el-button>
+      </el-descriptions-item>
+      <el-descriptions-item>
+        <template #label><span style="color: red">鎻愰啋: </span></template>
+        濡傛灉鏈彂璐э紝璇风偣鍑诲悓鎰忛��娆剧粰涔板銆�<br />
+        濡傛灉瀹為檯宸插彂璐э紝璇蜂富鍔ㄤ笌涔板鑱旂郴銆�<br />
+        濡傛灉璁㈠崟鏁翠綋閫�娆惧悗锛屼紭鎯犲埜鍜屼綑棰濅細閫�杩樼粰涔板.
+      </el-descriptions-item>
+    </el-descriptions>
+
+    <!-- 鍟嗗搧淇℃伅 -->
+    <el-descriptions title="鍟嗗搧淇℃伅">
+      <el-descriptions-item labelClassName="no-colon">
+        <el-row :gutter="20">
+          <el-col :span="15">
+            <el-table v-if="formData.orderItem" :data="[formData.orderItem]" border>
+              <el-table-column label="鍟嗗搧" prop="spuName" width="auto">
+                <template #default="{ row }">
+                  {{ row.spuName }}
+                  <el-tag
+                    v-for="property in row.properties"
+                    :key="property.propertyId"
+                    class="mr-10px"
+                  >
+                    {{ property.propertyName }}: {{ property.valueName }}
+                  </el-tag>
+                </template>
+              </el-table-column>
+              <el-table-column label="鍟嗗搧鍘熶环" prop="price" width="150">
+                <template #default="{ row }">{{ fenToYuan(row.price) }} 鍏�</template>
+              </el-table-column>
+              <el-table-column label="鏁伴噺" prop="count" width="100" />
+              <el-table-column label="鍚堣" prop="payPrice" width="150">
+                <template #default="{ row }">{{ fenToYuan(row.payPrice) }} 鍏�</template>
+              </el-table-column>
+            </el-table>
+          </el-col>
+          <el-col :span="10" />
+        </el-row>
+      </el-descriptions-item>
+    </el-descriptions>
+
+    <!-- 鎿嶄綔鏃ュ織 -->
+    <el-descriptions title="鍞悗鏃ュ織">
+      <el-descriptions-item labelClassName="no-colon">
+        <el-timeline>
+          <el-timeline-item
+            v-for="saleLog in formData.logs"
+            :key="saleLog.id"
+            :timestamp="formatDate(saleLog.createTime)"
+            placement="top"
+          >
+            <div class="el-timeline-right-content">
+              <span>{{ saleLog.content }}</span>
+            </div>
+            <template #dot>
+              <span
+                :style="{ backgroundColor: getUserTypeColor(saleLog.userType) }"
+                class="dot-node-style"
+              >
+                {{ getDictLabel(DICT_TYPE.USER_TYPE, saleLog.userType)[0] || '绯�' }}
+              </span>
+            </template>
+          </el-timeline-item>
+        </el-timeline>
+      </el-descriptions-item>
+    </el-descriptions>
+  </ContentWrap>
+
+  <!-- 鍚勭鎿嶄綔鐨勫脊绐� -->
+  <UpdateAuditReasonForm ref="updateAuditReasonFormRef" @success="getDetail" />
+</template>
+<script lang="ts" setup>
+import * as AfterSaleApi from '@/api/mall/trade/afterSale/index'
+import { fenToYuan } from '@/utils'
+import { DICT_TYPE, getDictLabel, getDictObj } from '@/utils/dict'
+import { formatDate } from '@/utils/formatTime'
+import UpdateAuditReasonForm from '@/views/mall/trade/afterSale/form/AfterSaleDisagreeForm.vue'
+import { createImageViewer } from '@/components/ImageViewer'
+import { isArray } from '@/utils/is'
+import { useTagsViewStore } from '@/store/modules/tagsView'
+
+defineOptions({ name: 'TradeAfterSaleDetail' })
+
+const { t } = useI18n() // 鍥介檯鍖�
+const message = useMessage() // 娑堟伅寮圭獥
+const { params } = useRoute() // 鏌ヨ鍙傛暟
+const { push, currentRoute } = useRouter() // 璺敱
+const formData = ref({
+  order: {},
+  logs: []
+})
+const updateAuditReasonFormRef = ref() // 鎷掔粷鍞悗琛ㄥ崟 Ref
+
+/** 鑾峰緱 userType 棰滆壊 */
+const getUserTypeColor = (type: number) => {
+  const dict = getDictObj(DICT_TYPE.USER_TYPE, type)
+  switch (dict?.colorType) {
+    case 'success':
+      return '#67C23A'
+    case 'info':
+      return '#909399'
+    case 'warning':
+      return '#E6A23C'
+    case 'danger':
+      return '#F56C6C'
+  }
+  return '#409EFF'
+}
+
+/** 鑾峰緱璇︽儏 */
+const getDetail = async () => {
+  const id = params.id as unknown as number
+  if (id) {
+    const res = await AfterSaleApi.getAfterSale(id)
+    // 娌℃湁琛ㄥ崟淇℃伅鍒欏叧闂〉闈㈣繑鍥�
+    if (res == null) {
+      message.notifyError('鍞悗璁㈠崟涓嶅瓨鍦�')
+      close()
+    }
+    formData.value = res
+  }
+}
+
+/** 鍚屾剰鍞悗 */
+const agree = async () => {
+  try {
+    // 浜屾纭
+    await message.confirm('鏄惁鍚屾剰鍞悗锛�')
+    await AfterSaleApi.agree(formData.value.id)
+    // 鎻愮ず鎴愬姛
+    message.success(t('common.success'))
+    await getDetail()
+  } catch {}
+}
+
+/** 鎷掔粷鍞悗 */
+const disagree = async () => {
+  updateAuditReasonFormRef.value?.open(formData.value)
+}
+
+/** 纭鏀惰揣 */
+const receive = async () => {
+  try {
+    // 浜屾纭
+    await message.confirm('鏄惁纭鏀惰揣锛�')
+    await AfterSaleApi.receive(formData.value.id)
+    // 鎻愮ず鎴愬姛
+    message.success(t('common.success'))
+    await getDetail()
+  } catch {}
+}
+
+/** 鎷掔粷鏀惰揣 */
+const refuse = async () => {
+  try {
+    // 浜屾纭
+    await message.confirm('鏄惁鎷掔粷鏀惰揣锛�')
+    await AfterSaleApi.refuse(formData.value.id)
+    // 鎻愮ず鎴愬姛
+    message.success(t('common.success'))
+    await getDetail()
+  } catch {}
+}
+
+/** 纭閫�娆� */
+const refund = async () => {
+  try {
+    // 浜屾纭
+    await message.confirm('鏄惁纭閫�娆撅紵')
+    await AfterSaleApi.refund(formData.value.id)
+    // 鎻愮ず鎴愬姛
+    message.success(t('common.success'))
+    await getDetail()
+  } catch {}
+}
+
+/** 鍥剧墖棰勮 */
+const imagePreview = (args) => {
+  const urlList = []
+  if (isArray(args)) {
+    args.forEach((item) => {
+      urlList.push(item.url)
+    })
+  } else {
+    urlList.push(args)
+  }
+  createImageViewer({
+    urlList
+  })
+}
+const { delView } = useTagsViewStore() // 瑙嗗浘鎿嶄綔
+/** 鍏抽棴 tag */
+const close = () => {
+  delView(unref(currentRoute))
+  push({ name: 'TradeAfterSale' })
+}
+onMounted(async () => {
+  await getDetail()
+})
+</script>
+<style lang="scss" scoped>
+:deep(.el-descriptions) {
+  &:not(:nth-child(1)) {
+    margin-top: 20px;
+  }
+
+  .el-descriptions__title {
+    display: flex;
+    align-items: center;
+
+    &::before {
+      display: inline-block;
+      width: 3px;
+      height: 20px;
+      margin-right: 10px;
+      background-color: #409eff;
+      content: '';
+    }
+  }
+
+  .el-descriptions-item__container {
+    margin: 0 10px;
+
+    .no-colon {
+      margin: 0;
+
+      &::after {
+        content: '';
+      }
+    }
+  }
+}
+
+// 鏃堕棿绾挎牱寮忚皟鏁�
+:deep(.el-timeline) {
+  margin: 10px 0 0 160px;
+
+  .el-timeline-item__wrapper {
+    position: relative;
+    top: -20px;
+
+    .el-timeline-item__timestamp {
+      position: absolute !important;
+      top: 10px;
+      left: -150px;
+    }
+  }
+
+  .el-timeline-right-content {
+    display: flex;
+    align-items: center;
+    min-height: 30px;
+    padding: 10px;
+    background-color: var(--app-content-bg-color);
+
+    &::before {
+      position: absolute;
+      top: 10px;
+      left: 13px;
+      border-color: transparent var(--app-content-bg-color) transparent transparent; /* 灏栬棰滆壊锛屽乏渚ф湞鍚� */
+      border-style: solid;
+      border-width: 8px; /* 璋冩暣灏栬澶у皬 */
+      content: '';
+    }
+  }
+
+  .dot-node-style {
+    position: absolute;
+    left: -5px;
+    display: flex;
+    width: 20px;
+    height: 20px;
+    font-size: 10px;
+    color: #fff;
+    border-radius: 50%;
+    justify-content: center;
+    align-items: center;
+  }
+}
+</style>

--
Gitblit v1.8.0