Browse Source

feat: 订单详情

Basil 3 years ago
parent
commit
e83de22fb1

+ 1 - 1
.env.production

@@ -1 +1 @@
1
-VITE_GLOB_API_URL = 'https://app.bjtdba.com'
1
+VITE_GLOB_API_URL = 'https://test.bjtdba.com'

+ 4 - 4
src/apis/product.ts

@@ -76,10 +76,10 @@ enum API {
76
  */
76
  */
77
 export function getProductDetail(product_id: string): Promise<ProductDetailModel> {
77
 export function getProductDetail(product_id: string): Promise<ProductDetailModel> {
78
     return defHttp.get({
78
     return defHttp.get({
79
-        url: API.GET_PRODUCT_DETAIL,
80
-        data: {
81
-            product_id
82
-        }
79
+        url: API.GET_PRODUCT_DETAIL + `/${product_id}`,
80
+        // data: {
81
+        //     product_id
82
+        // }
83
     })
83
     })
84
 }
84
 }
85
 
85
 

File diff suppressed because it is too large
+ 1 - 1
src/pages.json


+ 11 - 1
src/pages/home/index.vue

@@ -121,6 +121,12 @@ function loadProductList() {
121
   })
121
   })
122
 }
122
 }
123
 const homeBanner = CDN_URL + '/static/assets/home-banner.png'
123
 const homeBanner = CDN_URL + '/static/assets/home-banner.png'
124
+
125
+function handleBannerClick() {
126
+  uni.navigateTo({
127
+    url: '/pages/vip/index'
128
+  })
129
+}
124
 </script>
130
 </script>
125
 <template>
131
 <template>
126
   <div class="h-screen ">
132
   <div class="h-screen ">
@@ -128,7 +134,11 @@ const homeBanner = CDN_URL + '/static/assets/home-banner.png'
128
             :exClass="headerClass"
134
             :exClass="headerClass"
129
     />
135
     />
130
     <div class="flex flex-col gap-3 ">
136
     <div class="flex flex-col gap-3 ">
131
-      <image :src="homeBanner" mode="widthFix" class="h-full w-full "></image>
137
+      <image
138
+          @click="handleBannerClick"
139
+          :src="homeBanner"
140
+             mode="widthFix" class="h-60 w-full "
141
+      ></image>
132
       <Navs/>
142
       <Navs/>
133
 
143
 
134
       <Announcement :list="state.announcementList"/>
144
       <Announcement :list="state.announcementList"/>

+ 1 - 0
src/pages/order-confirm/index.vue

@@ -49,6 +49,7 @@ onLoad((options) => {
49
   //     data.addressId = res.list.length > 0 ? res.list[0].address_id : '0'
49
   //     data.addressId = res.list.length > 0 ? res.list[0].address_id : '0'
50
   //   })
50
   //   })
51
   // }
51
   // }
52
+  addressStore.getCurrentAddress()
52
   data.addressInfo = addressStore.address
53
   data.addressInfo = addressStore.address
53
   data.addressId = addressStore.address.address_id
54
   data.addressId = addressStore.address.address_id
54
 
55
 

+ 45 - 33
src/pages/order/components/OrderItem.vue

@@ -13,9 +13,43 @@
13
     </div>
13
     </div>
14
 
14
 
15
 
15
 
16
-    <div v-if="orderItem.orderList">
17
-      <div v-for="(order, index) in orderItem.orderList" :key="index">
18
-        <div v-for="(orderProduct, orderProductIndex) in order.orderProduct" :key="orderProductIndex">
16
+
17
+    <div @tap.stop="handleShowOrderDetail(orderItem)">
18
+      <div v-if="orderItem.orderList">
19
+        <div v-for="(order, index) in orderItem.orderList" :key="index">
20
+          <div v-for="(orderProduct, orderProductIndex) in order.orderProduct" :key="orderProductIndex">
21
+            <div class="flex py-2 gap-3">
22
+              <div class="flex-1 flex gap-2">
23
+                <image :src="orderProduct.cart_info.product.image" class="w-20 h-20" mode="widthFix"></image>
24
+
25
+                <div class="flex flex-col">
26
+                  <div class="line-clamp-2 text-[12px]">
27
+                    {{ orderProduct.cart_info.product.store_name }}
28
+                  </div>
29
+                  <div class="text-gray-500 text-[10px]">
30
+                    {{ orderProduct.cart_info.productAttr.sku }}
31
+                  </div>
32
+                </div>
33
+              </div>
34
+
35
+              <div class="flex flex-col justify-center items-center">
36
+                <FPrice :price="orderProduct.cart_info.product.price" ex-class="font-bold text-[12px] !text-[#000]"></FPrice>
37
+                <div class="text-gray-500 text-[11px]">共{{ orderProduct.product_num }}件</div>
38
+              </div>
39
+
40
+            </div>
41
+            <div class="flex justify-end gap-2">
42
+              <nut-button size="small" type="default" @click="handleCancelOrder">取消订单</nut-button>
43
+              <nut-button size="small" plain type="primary" @click="handlePayment">立即支付</nut-button>
44
+
45
+            </div>
46
+          </div>
47
+        </div>
48
+
49
+      </div>
50
+
51
+      <div v-else>
52
+        <div v-for="(orderProduct, orderProductIndex) in orderItem.orderProduct" :key="orderProductIndex">
19
           <div class="flex py-2 gap-3">
53
           <div class="flex py-2 gap-3">
20
             <div class="flex-1 flex gap-2">
54
             <div class="flex-1 flex gap-2">
21
               <image :src="orderProduct.cart_info.product.image" class="w-20 h-20" mode="widthFix"></image>
55
               <image :src="orderProduct.cart_info.product.image" class="w-20 h-20" mode="widthFix"></image>
@@ -39,41 +73,11 @@
39
           <div class="flex justify-end gap-2">
73
           <div class="flex justify-end gap-2">
40
             <nut-button size="small" type="default" @click="handleCancelOrder">取消订单</nut-button>
74
             <nut-button size="small" type="default" @click="handleCancelOrder">取消订单</nut-button>
41
             <nut-button size="small" plain type="primary" @click="handlePayment">立即支付</nut-button>
75
             <nut-button size="small" plain type="primary" @click="handlePayment">立即支付</nut-button>
42
-
43
           </div>
76
           </div>
44
         </div>
77
         </div>
45
       </div>
78
       </div>
46
-
47
     </div>
79
     </div>
48
 
80
 
49
-    <div v-else>
50
-      <div v-for="(orderProduct, orderProductIndex) in orderItem.orderProduct" :key="orderProductIndex">
51
-        <div class="flex py-2 gap-3">
52
-          <div class="flex-1 flex gap-2">
53
-            <image :src="orderProduct.cart_info.product.image" class="w-20 h-20" mode="widthFix"></image>
54
-
55
-            <div class="flex flex-col">
56
-              <div class="line-clamp-2 text-[12px]">
57
-                {{ orderProduct.cart_info.product.store_name }}
58
-              </div>
59
-              <div class="text-gray-500 text-[10px]">
60
-                {{ orderProduct.cart_info.productAttr.sku }}
61
-              </div>
62
-            </div>
63
-          </div>
64
-
65
-          <div class="flex flex-col justify-center items-center">
66
-            <FPrice :price="orderProduct.cart_info.product.price" ex-class="font-bold text-[12px] !text-[#000]"></FPrice>
67
-            <div class="text-gray-500 text-[11px]">共{{ orderProduct.product_num }}件</div>
68
-          </div>
69
-
70
-        </div>
71
-        <div class="flex justify-end gap-2">
72
-          <nut-button size="small" type="default" @click="handleCancelOrder">取消订单</nut-button>
73
-          <nut-button size="small" plain type="primary" @click="handlePayment">立即支付</nut-button>
74
-        </div>
75
-      </div>
76
-    </div>
77
   </div>
81
   </div>
78
 
82
 
79
 
83
 
@@ -82,6 +86,7 @@
82
 import FPrice from "~/components/FPrice/FPrice.vue";
86
 import FPrice from "~/components/FPrice/FPrice.vue";
83
 import {OrderListModel} from "~/apis/model/order.model";
87
 import {OrderListModel} from "~/apis/model/order.model";
84
 import {cancelOrder} from "~/apis/order.api";
88
 import {cancelOrder} from "~/apis/order.api";
89
+import {encodeBase64} from "~/utils/http/helper";
85
 const props = defineProps({
90
 const props = defineProps({
86
   orderItem: {
91
   orderItem: {
87
     type: Object,
92
     type: Object,
@@ -159,4 +164,11 @@ function handlePayment() {
159
     // url: `/pages/payment/index`
164
     // url: `/pages/payment/index`
160
   })
165
   })
161
 }
166
 }
167
+
168
+function handleShowOrderDetail(order) {
169
+  console.log(order)
170
+  uni.navigateTo({
171
+    url: '/pages/order/detail?detail=' + `${encodeBase64(order)}`
172
+  })
173
+}
162
 </script>
174
 </script>

+ 100 - 0
src/pages/order/components/OtherOrderItem.vue

@@ -0,0 +1,100 @@
1
+<script setup lang="ts">
2
+import FPrice from "~/components/FPrice/FPrice.vue";
3
+import dayjs from "dayjs";
4
+import {getProductDetail} from "~/apis/product";
5
+import {handleProductItemClick} from "~/utils/product-page";
6
+import {encodeBase64} from "~/utils/http/helper";
7
+const props = defineProps({
8
+  item: {
9
+    type: Object,
10
+    required: true
11
+  }
12
+})
13
+const sourceType = computed(() => {
14
+  switch (props.item.source) {
15
+    case '1': {
16
+      return '拼多多'
17
+    }
18
+    case '2': {
19
+      return '唯品会'
20
+    }
21
+    case '3': {
22
+      return '苏宁'
23
+    }
24
+    case '5': {
25
+      return '淘宝'
26
+    }
27
+    case '6': {
28
+      return '京东'
29
+    }
30
+    case '7': {
31
+      return 'App'
32
+    }
33
+  }
34
+})
35
+function navigateToDetail(params) {
36
+  let otherDetailUrl = `/pages/store/product/other`
37
+  return uni.navigateTo({
38
+    url: `${otherDetailUrl}?params=${params}`
39
+  })
40
+}
41
+function handleClick() {
42
+  // uni.navigateTo({
43
+  //   url: '/pages/'
44
+  // })
45
+  const product = props.item
46
+  // handleProductItemClick({
47
+  //   type: product.source,
48
+  //   id: product.goods_id,
49
+  //   featured: [product.goods_img]
50
+  // })
51
+  if (product.source === '6') {
52
+    navigateToDetail(encodeBase64({
53
+      platform: product.source,
54
+      id: product.goods_id
55
+    }))
56
+  }
57
+}
58
+
59
+
60
+</script>
61
+<template>
62
+  <div class="bg-white rounded p-2 flex flex-col gap-2">
63
+    <div class="flex justify-between items-center text-[12px] f-hairline-bottom py-2">
64
+      <div>订单号:{{ item.order_sn }}</div>
65
+      <div class="text-primary">{{ item.other_status_desc }}</div>
66
+    </div>
67
+
68
+    <div class="flex  gap-2">
69
+      <div class="flex">
70
+        <image :src="item.goods_img" mode="widthFix" class="w-16 h-16 rounded"></image>
71
+
72
+      </div>
73
+      <div class="flex items-center">
74
+        <div class="flex flex-col gap-1">
75
+          <div class="bg-primary text-[10px] rounded text-white px-1 w-fit">
76
+            {{ sourceType }}
77
+          </div>
78
+          <div class="text-[12px] line-clamp-2">
79
+            {{ item.goods_name }}
80
+          </div>
81
+        </div>
82
+        <div class="flex text-[11px] w-15 justify-end">{{ 'X' + item.goods_num }}</div>
83
+      </div>
84
+    </div>
85
+    <div class="flex justify-between text-[11px] items-center gap-2 f-hairline-bottom py-3">
86
+      <div class="flex">
87
+        {{ dayjs(item.create_time).format('YYYY-MM-DD')}}
88
+      </div>
89
+      <div class="flex justify-center items-center gap-2">
90
+        <div class="flex items-center">
91
+          补贴养老金:<FPrice :price="item.yanlao"></FPrice>
92
+        </div>
93
+        <div class="border border-solid border-1px border-gray-500 text-gray rounded px-1">{{ item.status_name }}</div>
94
+      </div>
95
+    </div>
96
+    <div class="flex justify-end items-center">
97
+      <nut-button plain type="primary" size="small" @click="handleClick">再次购买</nut-button>
98
+    </div>
99
+  </div>
100
+</template>

File diff suppressed because it is too large
+ 176 - 0
src/pages/order/detail.vue


+ 14 - 7
src/pages/order/index.vue

@@ -2,9 +2,10 @@
2
   <CXBBasePage>
2
   <CXBBasePage>
3
     <nut-tabs v-model="state.tabvalue">
3
     <nut-tabs v-model="state.tabvalue">
4
       <nut-tab-pane title="全部">
4
       <nut-tab-pane title="全部">
5
-        <div v-if="state.allOrderList.length > 0">
5
+        <div v-if="state.allOrderList.length > 0" class="flex flex-col gap-3">
6
           <div v-for="(orderItem, index) in state.allOrderList" :key="index">
6
           <div v-for="(orderItem, index) in state.allOrderList" :key="index">
7
-            <OrderItem :order-item="orderItem" />
7
+            <OrderItem :order-item="orderItem" v-if="orderItem.source == 7"/>
8
+            <OtherOrderItem :item="orderItem" v-else/>
8
           </div>
9
           </div>
9
         </div>
10
         </div>
10
         <CXBEmpty v-else/>
11
         <CXBEmpty v-else/>
@@ -13,7 +14,8 @@
13
       <nut-tab-pane title="待付款">
14
       <nut-tab-pane title="待付款">
14
         <div v-if="state.obligationOrderList.length > 0">
15
         <div v-if="state.obligationOrderList.length > 0">
15
           <div v-for="(orderItem, index) in state.obligationOrderList" :key="index">
16
           <div v-for="(orderItem, index) in state.obligationOrderList" :key="index">
16
-            <OrderItem :order-item="orderItem" />
17
+            <OrderItem :order-item="orderItem" v-if="orderItem.source == 7"/>
18
+            <OtherOrderItem :item="orderItem" v-else/>
17
           </div>
19
           </div>
18
         </div>
20
         </div>
19
         <CXBEmpty v-else/>
21
         <CXBEmpty v-else/>
@@ -21,7 +23,8 @@
21
       <nut-tab-pane title="待发货">
23
       <nut-tab-pane title="待发货">
22
         <div v-if="state.orderList.length > 0">
24
         <div v-if="state.orderList.length > 0">
23
           <div v-for="(orderItem, index) in state.orderList" :key="index">
25
           <div v-for="(orderItem, index) in state.orderList" :key="index">
24
-            <OrderItem :order-item="orderItem" />
26
+            <OrderItem :order-item="orderItem" v-if="orderItem.source == 7"/>
27
+            <OtherOrderItem :item="orderItem" v-else/>
25
           </div>
28
           </div>
26
         </div>
29
         </div>
27
         <CXBEmpty v-else/>
30
         <CXBEmpty v-else/>
@@ -30,7 +33,8 @@
30
       <nut-tab-pane title="待收货">
33
       <nut-tab-pane title="待收货">
31
         <div v-if="state.orderList.length > 0">
34
         <div v-if="state.orderList.length > 0">
32
           <div v-for="(orderItem, index) in state.orderList" :key="index">
35
           <div v-for="(orderItem, index) in state.orderList" :key="index">
33
-            <OrderItem :order-item="orderItem" />
36
+            <OrderItem :order-item="orderItem" v-if="orderItem.source == 7"/>
37
+            <OtherOrderItem :item="orderItem" v-else/>
34
           </div>
38
           </div>
35
         </div>
39
         </div>
36
         <CXBEmpty v-else/>
40
         <CXBEmpty v-else/>
@@ -39,7 +43,8 @@
39
       <nut-tab-pane title="待评价">
43
       <nut-tab-pane title="待评价">
40
         <div v-if="state.orderList.length > 0">
44
         <div v-if="state.orderList.length > 0">
41
           <div v-for="(orderItem, index) in state.orderList" :key="index">
45
           <div v-for="(orderItem, index) in state.orderList" :key="index">
42
-            <OrderItem :order-item="orderItem" />
46
+            <OrderItem :order-item="orderItem" v-if="orderItem.source == 7"/>
47
+            <OtherOrderItem :item="orderItem" v-else/>
43
           </div>
48
           </div>
44
         </div>
49
         </div>
45
         <CXBEmpty v-else/>
50
         <CXBEmpty v-else/>
@@ -60,6 +65,7 @@ import OrderItem from "~/pages/order/components/OrderItem.vue";
60
 import amapWx from "~/libs/amap-wx";
65
 import amapWx from "~/libs/amap-wx";
61
 import CXBEmpty from "~/components/CXBEmpty/CXBEmpty.vue";
66
 import CXBEmpty from "~/components/CXBEmpty/CXBEmpty.vue";
62
 import CXBBasePage from "~/components/CXBBasePage/CXBBasePage.vue";
67
 import CXBBasePage from "~/components/CXBBasePage/CXBBasePage.vue";
68
+import OtherOrderItem from "~/pages/order/components/OtherOrderItem.vue";
63
 
69
 
64
 const state = reactive({
70
 const state = reactive({
65
   tabvalue: '0',
71
   tabvalue: '0',
@@ -87,7 +93,7 @@ onLoad(options => {
87
 })
93
 })
88
 function  	splitArray(list, sp) {
94
 function  	splitArray(list, sp) {
89
   if (typeof list != 'object') return [];
95
   if (typeof list != 'object') return [];
90
-  if (sp === undefined) sp = [];
96
+  if (sp == undefined) sp = [];
91
   for (var i = 0; i < list.length; i++) {
97
   for (var i = 0; i < list.length; i++) {
92
     sp.push(list[i]);
98
     sp.push(list[i]);
93
   }
99
   }
@@ -102,6 +108,7 @@ function loadAllOrderList() {
102
     console.log(res)
108
     console.log(res)
103
     state.allOrderTotal = res.total
109
     state.allOrderTotal = res.total
104
     state.allOrderList = res.list
110
     state.allOrderList = res.list
111
+    console.log(res)
105
   })
112
   })
106
 }
113
 }
107
 watch(() => state.tabvalue, (val) => {
114
 watch(() => state.tabvalue, (val) => {

+ 13 - 3
src/pages/store/product/detail.vue

@@ -76,6 +76,13 @@ function loadCartCount() {
76
   getCartCount().then(res => {
76
   getCartCount().then(res => {
77
     // console.log(res)
77
     // console.log(res)
78
     state.cartCount = res[0].count
78
     state.cartCount = res[0].count
79
+  }).catch(error => {
80
+    console.log(error)
81
+    if (error === '请登录') {
82
+      uni.navigateTo({
83
+        url: '/pages/user/login/index?key=4'
84
+      })
85
+    }
79
   })
86
   })
80
 }
87
 }
81
 // const skuData = computed(() => {
88
 // const skuData = computed(() => {
@@ -152,10 +159,13 @@ function handleCreateShopping() {
152
       }
159
       }
153
     }
160
     }
154
   }).catch(error => {
161
   }).catch(error => {
155
-    uni.showToast({
156
-      title: error,
157
-      icon: 'none'
162
+    uni.navigateTo({
163
+      url: '/pages/user/login/index'
158
     })
164
     })
165
+    // uni.showToast({
166
+    //   title: error,
167
+    //   icon: 'none'
168
+    // })
159
   })
169
   })
160
 }
170
 }
161
 
171
 

+ 1 - 0
src/pages/user/address/index.vue

@@ -79,6 +79,7 @@ export default {
79
       // from.value =
79
       // from.value =
80
       getUserAddressList().then(res => {
80
       getUserAddressList().then(res => {
81
         if (res) {
81
         if (res) {
82
+          console.log(res)
82
           data.value = res.list
83
           data.value = res.list
83
         }
84
         }
84
       })
85
       })

+ 7 - 7
src/pages/user/index.vue

@@ -236,19 +236,19 @@ const userType = computed(() => {
236
                 class="w-1/3 flex flex-col justify-center items-center"
236
                 class="w-1/3 flex flex-col justify-center items-center"
237
             >
237
             >
238
               <div>{{ userStore.yanglao.all_yanglao }}</div>
238
               <div>{{ userStore.yanglao.all_yanglao }}</div>
239
-              <div class="text-sm">养老金</div>
239
+              <div class="text-xs">养老金</div>
240
             </div>
240
             </div>
241
             <div
241
             <div
242
                 @tap="handleShowMyInvitation"
242
                 @tap="handleShowMyInvitation"
243
                 class="w-1/3  flex flex-col justify-center items-center">
243
                 class="w-1/3  flex flex-col justify-center items-center">
244
               <div>{{ userStore.userInfo.member_brokerage_price }}</div>
244
               <div>{{ userStore.userInfo.member_brokerage_price }}</div>
245
-              <div class="text-sm">我的佣金</div>
245
+              <div class="text-xs">我的佣金</div>
246
             </div>
246
             </div>
247
             <div
247
             <div
248
                 @tap="handleShowMyIntegral"
248
                 @tap="handleShowMyIntegral"
249
                 class="w-1/3  flex flex-col justify-center items-center">
249
                 class="w-1/3  flex flex-col justify-center items-center">
250
               <div>{{ userStore.userInfo.score }}</div>
250
               <div>{{ userStore.userInfo.score }}</div>
251
-              <div class="text-sm">我的积分</div>
251
+              <div class="text-xs">我的积分</div>
252
             </div>
252
             </div>
253
           </div>
253
           </div>
254
           <div
254
           <div
@@ -256,11 +256,11 @@ const userType = computed(() => {
256
               class="flex">
256
               class="flex">
257
             <div class="w-1/2 flex flex-col justify-center items-center">
257
             <div class="w-1/2 flex flex-col justify-center items-center">
258
               <div>{{ userStore.userInfo.red }}</div>
258
               <div>{{ userStore.userInfo.red }}</div>
259
-              <div class="text-sm">红积分提现</div>
259
+              <div class="text-xs">红积分提现</div>
260
             </div>
260
             </div>
261
             <div class="w-1/2 flex flex-col  justify-center items-center">
261
             <div class="w-1/2 flex flex-col  justify-center items-center">
262
               <div>{{ userStore.userInfo.team_number }}</div>
262
               <div>{{ userStore.userInfo.team_number }}</div>
263
-              <div class="text-sm">团队人数</div>
263
+              <div class="text-xs">团队人数</div>
264
             </div>
264
             </div>
265
           </div>
265
           </div>
266
 
266
 
@@ -268,7 +268,7 @@ const userType = computed(() => {
268
 
268
 
269
       </div>
269
       </div>
270
 
270
 
271
-      <div class="bg-white rounded px-3">
271
+      <div class="bg-white rounded px-3 text-sm">
272
         <div class="flex justify-between pt-4 mb-4">
272
         <div class="flex justify-between pt-4 mb-4">
273
           <div>我的订单</div>
273
           <div>我的订单</div>
274
           <div
274
           <div
@@ -286,7 +286,7 @@ const userType = computed(() => {
286
                    mode="widthFix"
286
                    mode="widthFix"
287
                    class="w-8 h-8 "
287
                    class="w-8 h-8 "
288
             />
288
             />
289
-            <div class="text-sm">{{ item.text }}</div>
289
+            <div class="text-xs">{{ item.text }}</div>
290
           </div>
290
           </div>
291
         </div>
291
         </div>
292
 
292
 

+ 1 - 1
src/utils/product-page.ts

@@ -199,7 +199,7 @@ export function handleProductItemClick(
199
         & VipProductModel
199
         & VipProductModel
200
 ) {
200
 ) {
201
 
201
 
202
-
202
+    console.log(item)
203
     function navigateToDetail(params) {
203
     function navigateToDetail(params) {
204
         let otherDetailUrl = `/pages/store/product/other`
204
         let otherDetailUrl = `/pages/store/product/other`
205
         return uni.navigateTo({
205
         return uni.navigateTo({