Browse Source

🎈 perf: 优化了部分细节

Pchen. 9 months ago
parent
commit
a825d4378c

+ 20 - 20
src/pages/store/orders/orderDetail/index.vue

@@ -14,8 +14,8 @@
           v-if="data?.state === 0 && payData != {}">立即支付</a-button>
 
       </a-card>
-      <a-card class="general-card">
-        <a-descriptions style="margin-top: 20px" :data="orderData" size="large" title="订单详情" :column="1"/>
+      <a-card class="general-card" title="订单详情">
+        <a-descriptions :data="orderData" size="large" :column="1" />
       </a-card>
       <a-card class="general-card" title="商品详情">
         <div v-html="content"></div>
@@ -31,7 +31,7 @@ import { orderDeatil } from '@/api/order'
 import { useRoute } from 'vue-router'
 import { Notification } from '@arco-design/web-vue'
 import { Message } from '@arco-design/web-vue'
-import { IconQq,IconWechatpay, IconAlipayCircle } from '@arco-design/web-vue/es/icon'
+import { IconQq, IconWechatpay, IconAlipayCircle } from '@arco-design/web-vue/es/icon'
 
 const route = useRoute()
 const { id } = route.params
@@ -57,7 +57,7 @@ const stramptoTime = (time) => {
 }
 
 function getPayType(type) {
-  switch(type) {
+  switch (type) {
     case 'alipay':
       return [h(IconAlipayCircle), ' 支付宝']
     case 'qqpay':
@@ -79,20 +79,20 @@ const getOrderDeatil = async () => {
     content.value = decodeURI(atob(res.data.content || ''))
 
     let detail = []
-    if(res.data.name)
-      detail.push({label: '商品名称', value: res.data.name})
-    if(res.data.price)
-      detail.push({label: '支付价格', value: res.data.price})
-    if(res.data.pay_type)
-      detail.push({label: '支付方式', value: getPayType(res.data.pay_type)})
-    if(res.data.orderId)
-      detail.push({label: '平台订单号', value: res.data.orderId})
-    if(res.data.pay_id)
-      detail.push({label: '支付平台订单号', value: res.data.pay_id})
-    if(res.data.create_time)
-      detail.push({label: '下单时间', value: stramptoTime(res.data.create_time)})
-    if(res.data.pay_time)
-      detail.push({label: '支付时间', value: stramptoTime(res.data.pay_time)})
+    if (res.data.name)
+      detail.push({ label: '商品名称', value: res.data.name })
+    if (res.data.price)
+      detail.push({ label: '支付价格', value: '¥' + res.data.price })
+    if (res.data.pay_type)
+      detail.push({ label: '支付方式', value: getPayType(res.data.pay_type) })
+    if (res.data.orderId)
+      detail.push({ label: '平台订单号', value: res.data.orderId })
+    if (res.data.pay_id)
+      detail.push({ label: '支付平台订单号', value: res.data.pay_id })
+    if (res.data.create_time)
+      detail.push({ label: '下单时间', value: stramptoTime(res.data.create_time) })
+    if (res.data.pay_time)
+      detail.push({ label: '支付时间', value: stramptoTime(res.data.pay_time) })
 
     orderData.value = detail
 
@@ -142,7 +142,7 @@ onUnmounted(() => {
 
 function getOrderState() {
   if (data.value) {
-    
+
     switch (data.value.state) {
       case 0:
         current.value = 1
@@ -181,7 +181,7 @@ function getPaymentStatus(timestamp) {
   const diffMs = now - timestamp; // 毫秒差值
   const diffSeconds = Math.floor(diffMs / 1000); // 秒差值
 
-  const timeout = 300; 
+  const timeout = 300;
 
   if (diffSeconds > timeout) {
     oneDes.value = "支付超时";

+ 1 - 18
src/pages/store/orders/orderList/index.vue

@@ -1,7 +1,7 @@
 <template>
 
   <div class="container">
-    <Breadcrumb :items="['Forge商城', '我的订单']" />
+    <Breadcrumb :items="['商城', '我的订单']" />
     <a-card title="我的订单">
       <a-table :data="data" stripe hoverable column-resizable class="table" :loading="loading"
         :pagination="{ showPageSize: true, showJumper: true, defaultPageSize: 15 }">
@@ -131,23 +131,6 @@ function getPayType(type) {
   }
 }
 
-function getOrderState(state) {
-  switch (state) {
-    case 0:
-      return '待支付'
-
-    case 1:
-      return '待处理'
-
-    case 2:
-      return '已完成'
-
-    case 3:
-      return '状态异常'
-  }
-
-}
-
 GetMyOrder()
 </script>