Xiao_123 пре 5 месеци
родитељ
комит
b8cd47a335
3 измењених фајлова са 79 додато и 13 уклоњено
  1. 3 0
      components.d.ts
  2. 2 2
      src/views/mall/pointExchange/index.vue
  3. 74 11
      src/views/mall/user/order/detail.vue

+ 3 - 0
components.d.ts

@@ -70,4 +70,7 @@ declare module 'vue' {
     VerifySlide: typeof import('./src/components/Verifition/Verify/VerifySlide.vue')['default']
     WangEditor: typeof import('./src/components/FormUI/wangEditor/index.vue')['default']
   }
+  export interface ComponentCustomProperties {
+    vLoading: typeof import('element-plus/es')['ElLoadingDirective']
+  }
 }

+ 2 - 2
src/views/mall/pointExchange/index.vue

@@ -101,10 +101,9 @@ const formItems = ref({
       default: [],
       label: '收货地址',
       itemText: 'name',
-      itemValue: 'id',
+      itemValue: 'name',
       required: true,
       clearable: false,
-      disabled: true,
       emitPath: true,
       items: []
     },
@@ -162,6 +161,7 @@ const handleSubmit = async () =>{
   if (obj.type) obj.contactAddress = obj.address.join('') + obj.contactAddress
   delete obj.address 
   if (!obj.contactName) obj.contactName = localStorage.getItem('baseInfo') ? JSON.parse(localStorage.getItem('baseInfo')).name : '--'
+
   await redeemSubmit(obj)
   Snackbar.success('提交成功')
   showDetail.value = false

+ 74 - 11
src/views/mall/user/order/detail.vue

@@ -1,10 +1,64 @@
 <template>
   <div>
     <Navbar class="mb-3" />
-    <v-card class="default-width card-box mb-5 pa-5">
-      <h3 class="mb-3">订单详情</h3>
-      <v-divider></v-divider>
-    </v-card>
+    <div class="default-width pb-5">
+      <v-banner color="primary" :text="formatOrderStatusDescription(order)" style="background-color: #00897B; color: #fff;"></v-banner>
+
+      <v-row no-gutters class="mt-3">
+        <v-col span="6">
+          <!-- 订单信息 -->
+          <v-card class="pa-5">
+            <h3>订单信息</h3>
+            <v-divider class="my-3"></v-divider>
+            <div class="font-size-15 color-666">
+              <p>订单编号:{{ order.no }}</p>
+              <p class="my-3">下单时间:{{ timesTampChange(order.createTime) }}</p>
+              <p>支付时间:{{ timesTampChange(order.payTime) }}</p>
+              <p class="mt-3">支付方式:{{ order.payChannelName }}</p>
+            </div>
+          </v-card>
+        </v-col>
+        <v-col span="6" class="ml-3">
+          <!-- 物流信息 -->
+          <v-card class="pa-5" style="height: 100%">
+            <h3>物流信息</h3>
+            <v-divider class="my-3"></v-divider>
+            <div class="font-size-15 color-666">
+              <p>收货地址:{{ order.receiverName }},{{ order.receiverMobile }},{{ order.receiverAreaName }} {{ order.receiverDetailAddress }}</p>
+              <p class="my-3">物流公司:{{ order.logisticsName }}</p>
+              <p>运单号:{{ order.logisticsNo }}</p>
+            </div>
+          </v-card>
+        </v-col>
+      </v-row>
+
+      <!-- 商品列表 -->
+      <v-card class="my-3 pa-5">
+        <h3 class="mb-3">商品列表</h3>
+        <v-divider></v-divider>
+
+        <CtTable
+          class="mt-3"
+          :items="order.items"
+          :headers="headers"
+          :loading="false"
+          :elevation="0"
+          :isTools="false"
+          :showPage="false"
+          itemKey="id"
+        >
+          <template #picUrl="{ item }">
+            <v-img :src="item.picUrl" width="90" height="90"></v-img>
+          </template>
+          <template #spuName="{ item }">
+            <span class="color-primary cursor-pointer" @click="handleToGoodsDetail(item)">{{ item.spuName }}</span>
+          </template>
+        </CtTable>
+        <div class="text-end color-primary mr-3 mt-5 font-size-20">
+          共{{ order.productCount }}件商品,合计:¥{{ fen2yuan(order.payPrice) }}
+        </div>
+      </v-card>
+    </div>
   </div>
 </template>
 
@@ -15,22 +69,31 @@ import { useRouter } from 'vue-router'
 import { getMallOrderDetail } from '@/api/mall/user'
 import Snackbar from '@/plugins/snackbar'
 import Navbar from '../../components/navbar.vue'
+import { timesTampChange } from '@/utils/date'
+import { fen2yuan, formatOrderStatusDescription } from '@/hooks/web/useGoods'
 
 const router = useRouter()
 const { id } = router.currentRoute.value.params
 const order = ref({})
 
+const headers = [
+  { title: '', key: 'picUrl', sortable: false },
+  { title: '商品名称', key: 'spuName', sortable: false },
+  { title: '规格', key: 'contactAddress', sortable: false, value: item => item.properties.map((property) => property.valueName).join(' ') },
+  { title: '单价', key: 'price', sortable: false, value: item => '¥' + fen2yuan(item.price) },
+  { title: '数量', key: 'count', sortable: false }
+]
+
 onMounted(async () =>{
-  if (!id) {
-    Snackbar.warning('参数错误')
-    setTimeout(() => {
-      router.go(-1)
-    }, 1000)
-    return
-  }
+  if (!id) return Snackbar.error('订单不存在')
   const data = await getMallOrderDetail(id)
   order.value = data
 })
+
+// 跳转商品详情
+const handleToGoodsDetail = (item) => {
+  window.open(`/mall/goodsDetail/${item.spuId}`)
+}
 </script>
 
 <style scoped lang="scss">