Browse Source

优化代码+购物车bug修复

dxz1228 2 years ago
parent
commit
9314bfcca3

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


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

@@ -331,7 +331,7 @@ function reTotal() {
331 331
               </div>
332 332
               <div class="flex flex-col w-full">
333 333
                 <div class="flex flex-col ">
334
-                  <div class="line-clamp-2 text-xs">
334
+                  <div class="line-clamp-1 text-xs">
335 335
                     {{ orderProductItem.product.store_name }}
336 336
                   </div>
337 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 600
             </div>
601 601
 
602 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 604
                 goodItem.product.store_name }}</div>
605 605
               <div class="flex flex-col justify-start gap-1">
606 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 27
 import { debounce, merge } from "lodash-es";
28 28
 
29 29
 import { useDebounceFn } from '@vueuse/core';
30
-
31 30
 import dayjs from "dayjs";
32 31
 import { decodeBase64 } from "~/utils/http/helper";
33 32
 import { CDN_URL } from "~/config/app";
@@ -71,7 +70,7 @@ const detailclone = ref<IProductDetail>()
71 70
 onLoad((options: any) => {
72 71
 
73 72
   const data: Partial<IProductDetail> = JSON.parse(decodeBase64(options.params))
74
-  console.log('我是options数据', data)
73
+  // console.log('我是options数据', data)
75 74
 
76 75
   // if (options.platform && options.id) {
77 76
   uni.showLoading({
@@ -94,18 +93,28 @@ function YouLike() {
94 93
     limit: 10
95 94
   }).then(res => {
96 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 111
 function mergeProductDetail(data: Partial<IProductDetail> = {}) {
103 112
   detailclone.value = merge(detailclone.value, data)
104 113
 
105 114
 }
106 115
 function mergeProductDetailclone(data: Partial<IProductDetail> = {}) {
107 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 140
         uni.hideLoading()
132 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 161
         uni.hideLoading()
158 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 174
       let { status, data } = res
177 175
       // detail.value = res
178 176
       if (status !== 200) {
179
-        isShow.value = true
180
-        uni.setNavigationBarTitle({
181
-          title: '商品下架不存在'
182
-        })
183
-        YouLike()
184
-        uni.hideLoading()
177
+        soldOut()
185 178
       } else {
186 179
         mergeProductDetailclone({
187 180
           spreadUrl: data.pddlink.url,
@@ -240,12 +233,7 @@ function loadProductDetail(product: Partial<IProductDetail>) {
240 233
 
241 234
         uni.hideLoading()
242 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 253
         uni.hideLoading()
266 254
 
267 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 273
         uni.hideLoading()
291 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 594
       </div>
617 595
     </div>
596
+    
618 597
   </CXBBasePage>
619 598
 
620 599
   <!-- 下架 -->