瀏覽代碼

优化代码+购物车bug修复

dxz1228 2 年之前
父節點
當前提交
9314bfcca3
共有 4 個文件被更改,包括 23 次插入 和 930 次删除
  1. 1 887
      src/pages.json
  2. 1 1
      src/pages/order-confirm/index.vue
  3. 1 1
      src/pages/order_addcart/index.vue
  4. 20 41
      src/pages/store/product/other.vue

文件差異過大導致無法顯示
+ 1 - 887
src/pages.json


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

@@ -331,7 +331,7 @@ function reTotal() {
331
               </div>
331
               </div>
332
               <div class="flex flex-col w-full">
332
               <div class="flex flex-col w-full">
333
                 <div class="flex flex-col ">
333
                 <div class="flex flex-col ">
334
-                  <div class="line-clamp-2 text-xs">
334
+                  <div class="line-clamp-1 text-xs">
335
                     {{ orderProductItem.product.store_name }}
335
                     {{ orderProductItem.product.store_name }}
336
                   </div>
336
                   </div>
337
                   <div class="text-[11px] text-gray-500">{{ orderProductItem.productAttr.sku }}</div>
337
                   <div class="text-[11px] text-gray-500">{{ orderProductItem.productAttr.sku }}</div>

+ 1 - 1
src/pages/order_addcart/index.vue

@@ -600,7 +600,7 @@ const closeTestLog = () => {
600
             </div>
600
             </div>
601
 
601
 
602
             <div class="flex flex-col gap-1 w-full">
602
             <div class="flex flex-col gap-1 w-full">
603
-              <div @click="handleProductItemClick(goodItem)" class="text-overflow line-clamp-2 text-xs">{{
603
+              <div @click="handleProductItemClick(goodItem)" class="  text-overflow line-clamp-1 text-xs">{{
604
                 goodItem.product.store_name }}</div>
604
                 goodItem.product.store_name }}</div>
605
               <div class="flex flex-col justify-start gap-1">
605
               <div class="flex flex-col justify-start gap-1">
606
                 <div class="text-[10px] text-gray min-w-5  p-1  items-center flex skushadow"
606
                 <div class="text-[10px] text-gray min-w-5  p-1  items-center flex skushadow"

+ 20 - 41
src/pages/store/product/other.vue

@@ -27,7 +27,6 @@ import CXBBackTop from "~/components/CXBBackTop/CXBBackTop.vue";
27
 import { debounce, merge } from "lodash-es";
27
 import { debounce, merge } from "lodash-es";
28
 
28
 
29
 import { useDebounceFn } from '@vueuse/core';
29
 import { useDebounceFn } from '@vueuse/core';
30
-
31
 import dayjs from "dayjs";
30
 import dayjs from "dayjs";
32
 import { decodeBase64 } from "~/utils/http/helper";
31
 import { decodeBase64 } from "~/utils/http/helper";
33
 import { CDN_URL } from "~/config/app";
32
 import { CDN_URL } from "~/config/app";
@@ -71,7 +70,7 @@ const detailclone = ref<IProductDetail>()
71
 onLoad((options: any) => {
70
 onLoad((options: any) => {
72
 
71
 
73
   const data: Partial<IProductDetail> = JSON.parse(decodeBase64(options.params))
72
   const data: Partial<IProductDetail> = JSON.parse(decodeBase64(options.params))
74
-  console.log('我是options数据', data)
73
+  // console.log('我是options数据', data)
75
 
74
 
76
   // if (options.platform && options.id) {
75
   // if (options.platform && options.id) {
77
   uni.showLoading({
76
   uni.showLoading({
@@ -94,18 +93,28 @@ function YouLike() {
94
     limit: 10
93
     limit: 10
95
   }).then(res => {
94
   }).then(res => {
96
     skuInfo.recommendList = res.list
95
     skuInfo.recommendList = res.list
97
-    console.log(skuInfo.recommendList);
96
+    // console.log(skuInfo.recommendList);
98
 
97
 
99
   })
98
   })
100
 }
99
 }
101
 
100
 
101
+//商品不存在详情
102
+function soldOut() {
103
+  isShow.value = true
104
+  uni.setNavigationBarTitle({
105
+    title: '商品下架不存在'
106
+  })
107
+  YouLike()
108
+  uni.hideLoading()
109
+}
110
+
102
 function mergeProductDetail(data: Partial<IProductDetail> = {}) {
111
 function mergeProductDetail(data: Partial<IProductDetail> = {}) {
103
   detailclone.value = merge(detailclone.value, data)
112
   detailclone.value = merge(detailclone.value, data)
104
 
113
 
105
 }
114
 }
106
 function mergeProductDetailclone(data: Partial<IProductDetail> = {}) {
115
 function mergeProductDetailclone(data: Partial<IProductDetail> = {}) {
107
   detail.value = merge(detailclone.value, data)
116
   detail.value = merge(detailclone.value, data)
108
-  console.log(detail.value);
117
+  // console.log(detail.value);
109
 
118
 
110
 }
119
 }
111
 
120
 
@@ -130,12 +139,7 @@ function loadProductDetail(product: Partial<IProductDetail>) {
130
 
139
 
131
         uni.hideLoading()
140
         uni.hideLoading()
132
       } else {
141
       } else {
133
-        isShow.value = true
134
-        uni.setNavigationBarTitle({
135
-          title: '商品下架不存在'
136
-        })
137
-        YouLike()
138
-        uni.hideLoading()
142
+        soldOut()
139
       }
143
       }
140
     })
144
     })
141
   }
145
   }
@@ -156,13 +160,7 @@ function loadProductDetail(product: Partial<IProductDetail>) {
156
         })
160
         })
157
         uni.hideLoading()
161
         uni.hideLoading()
158
       } else {
162
       } else {
159
-
160
-        isShow.value = true
161
-        uni.setNavigationBarTitle({
162
-          title: '商品下架不存在'
163
-        })
164
-        YouLike()
165
-        uni.hideLoading()
163
+        soldOut()
166
       }
164
       }
167
 
165
 
168
 
166
 
@@ -176,12 +174,7 @@ function loadProductDetail(product: Partial<IProductDetail>) {
176
       let { status, data } = res
174
       let { status, data } = res
177
       // detail.value = res
175
       // detail.value = res
178
       if (status !== 200) {
176
       if (status !== 200) {
179
-        isShow.value = true
180
-        uni.setNavigationBarTitle({
181
-          title: '商品下架不存在'
182
-        })
183
-        YouLike()
184
-        uni.hideLoading()
177
+        soldOut()
185
       } else {
178
       } else {
186
         mergeProductDetailclone({
179
         mergeProductDetailclone({
187
           spreadUrl: data.pddlink.url,
180
           spreadUrl: data.pddlink.url,
@@ -240,12 +233,7 @@ function loadProductDetail(product: Partial<IProductDetail>) {
240
 
233
 
241
         uni.hideLoading()
234
         uni.hideLoading()
242
       } else {
235
       } else {
243
-        isShow.value = true
244
-        uni.setNavigationBarTitle({
245
-          title: '商品下架不存在'
246
-        })
247
-        YouLike()
248
-        uni.hideLoading()
236
+        soldOut()
249
       }
237
       }
250
 
238
 
251
 
239
 
@@ -265,12 +253,7 @@ function loadProductDetail(product: Partial<IProductDetail>) {
265
         uni.hideLoading()
253
         uni.hideLoading()
266
 
254
 
267
       } else {
255
       } else {
268
-        isShow.value = true
269
-        uni.setNavigationBarTitle({
270
-          title: '商品下架不存在'
271
-        })
272
-        YouLike()
273
-        uni.hideLoading()
256
+        soldOut()
274
       }
257
       }
275
 
258
 
276
     })
259
     })
@@ -289,12 +272,7 @@ function loadProductDetail(product: Partial<IProductDetail>) {
289
 
272
 
290
         uni.hideLoading()
273
         uni.hideLoading()
291
       } else {
274
       } else {
292
-        isShow.value = true
293
-        uni.setNavigationBarTitle({
294
-          title: '商品下架不存在'
295
-        })
296
-        YouLike()
297
-        uni.hideLoading()
275
+        soldOut()
298
       }
276
       }
299
 
277
 
300
 
278
 
@@ -615,6 +593,7 @@ onPageScroll((page) => {
615
 
593
 
616
       </div>
594
       </div>
617
     </div>
595
     </div>
596
+    
618
   </CXBBasePage>
597
   </CXBBasePage>
619
 
598
 
620
   <!-- 下架 -->
599
   <!-- 下架 -->