storeBelieveInLight пре 1 година
родитељ
комит
d556b88889

+ 72 - 1
commit/product.js

@@ -296,9 +296,80 @@ export function addProduct(data) {
296
     })
296
     })
297
 }
297
 }
298
 
298
 
299
-// mer/store/shipping/list
299
+/**
300
+ * 商品详情
301
+ */
302
+export function productDetailApi(data) {
303
+    return myRequestPhp({
304
+        url: `${pre}mer/gong/goods/detail`,
305
+        method: 'POST',
306
+        data,
307
+        apiType
308
+    })
309
+}
310
+
311
+
312
+/** 
313
+ * 在线选品 --- filter
314
+*/
300
 
315
 
316
+export function statusFilterApi(data) {
317
+    return myRequestPhp({
318
+        url: `${pre}mer/gong/goods/status_filter`,
319
+        method: 'GET',
320
+        data,
321
+        apiType
322
+    })
323
+}
324
+/**
325
+ * page: 1
326
+ limit: 12
327
+ * @param {*} data 
328
+ * @returns 
329
+ */
330
+export function categoryFilterApi(data) {
331
+    return myRequestPhp({
332
+        url: `${pre}mer/gong/category`,
333
+        method: 'GET',
334
+        data,
335
+        apiType
336
+    })
337
+}
301
 
338
 
339
+// 在线选品列表
340
+/**
341
+ * page: 1
342
+ limit: 20
343
+ title:
344
+     cate_ids:
345
+     profit:
346
+     price:
347
+     type:
348
+ * @param {*} data 
349
+ * @returns 
350
+ */
351
+export function productSelectListApi(data) {
352
+    return myRequestPhp({
353
+        url: `${pre}mer/gong/goods/lst`,
354
+        method: 'GET',
355
+        data,
356
+        apiType
357
+    })
358
+}
359
+/**
360
+ * @description 商品列表 -- 加入选品库
361
+ */
362
+export function joinselectionlibraryApi(data) {
363
+    return myRequestPhp({
364
+        url: `${pre}mer/gong/goods/join_selection_library`,
365
+        method: 'POST',
366
+        data,
367
+        apiType
368
+    })
369
+}
370
+export function Postjoinselectionlibrary(data) {
371
+    return request.post(``, data)
372
+}
302
 // /**
373
 // /**
303
 //  * @description 配置状态
374
 //  * @description 配置状态
304
 //  */
375
 //  */

+ 3 - 2
commit/requestPhp.js

@@ -5,9 +5,10 @@ export let baseURL = 'http://testshop.hxxfb.com/'
5
 // 请求超出时间
5
 // 请求超出时间
6
 const timeout = 50000
6
 const timeout = 50000
7
 // const token = "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJhcGkuaHh4ZmIuY29tIiwiYXVkIjoiYXBpLmh4eGZiLmNvbSIsImlhdCI6MTc0MDM3MTM1NSwibmJmIjoxNzQwMzcxMzU1LCJleHAiOjE3NTExNzEzNTUsImp0aSI6WzI5OCwibWVyIl19.j2f8VwdwWY4zBpcijHntzUZ9YUms2SxChaVsYf7KnPs"
7
 // const token = "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJhcGkuaHh4ZmIuY29tIiwiYXVkIjoiYXBpLmh4eGZiLmNvbSIsImlhdCI6MTc0MDM3MTM1NSwibmJmIjoxNzQwMzcxMzU1LCJleHAiOjE3NTExNzEzNTUsImp0aSI6WzI5OCwibWVyIl19.j2f8VwdwWY4zBpcijHntzUZ9YUms2SxChaVsYf7KnPs"
8
-// const token = "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJhcGkuaHh4ZmIuY29tIiwiYXVkIjoiYXBpLmh4eGZiLmNvbSIsImlhdCI6MTc0MDM3MTM1NSwibmJmIjoxNzQwMzcxMzU1LCJleHAiOjE3NTExNzEzNTUsImp0aSI6WzI5OCwibWVyIl19.j2f8VwdwWY4zBpcijHntzUZ9YUms2SxChaVsYf7KnPs"
8
+// const token = "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJzaG9wLmh4eGZiLmNvbSIsImF1ZCI6InNob3AuaHh4ZmIuY29tIiwiaWF0IjoxNzQwNTY5NDI3LCJuYmYiOjE3NDA1Njk0MjcsImV4cCI6MTc1MTM2OTQyNywianRpIjpbMzU0LCJtZXIiXX0.aZrICBozUFC0lvqxHgJMKFdhQlDHG1eC9UVAPzDHs5s"
9
 // const token = "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJhcGkuaHh4ZmIuY29tIiwiYXVkIjoiYXBpLmh4eGZiLmNvbSIsImlhdCI6MTc0MDU3MTQ0OCwibmJmIjoxNzQwNTcxNDQ4LCJleHAiOjE3NTEzNzE0NDgsImp0aSI6WzM1NCwibWVyIl19.PVwYv71Gq9RxTxQclUoFMgc8cZt0ju3zQkxk6SGCQJw"
9
 // const token = "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJhcGkuaHh4ZmIuY29tIiwiYXVkIjoiYXBpLmh4eGZiLmNvbSIsImlhdCI6MTc0MDU3MTQ0OCwibmJmIjoxNzQwNTcxNDQ4LCJleHAiOjE3NTEzNzE0NDgsImp0aSI6WzM1NCwibWVyIl19.PVwYv71Gq9RxTxQclUoFMgc8cZt0ju3zQkxk6SGCQJw"
10
-export const phpToken = uni.getStorageSync('phpToken') || ""
10
+const token = ""
11
+export const phpToken = uni.getStorageSync('phpToken') || token
11
 // 需要修改token,和根据实际修改请求头
12
 // 需要修改token,和根据实际修改请求头
12
 export function myRequestPhp(options) {
13
 export function myRequestPhp(options) {
13
 	let url = options.url;
14
 	let url = options.url;

+ 20 - 4
pages/onlineproductselection/components/detail/DeliveryInfo.vue

@@ -1,16 +1,17 @@
1
 <template>
1
 <template>
2
   <view class="delivery-info">
2
   <view class="delivery-info">
3
+    <view class="title">{{delivery.title}}</view>
3
     <view class="delivery-item">
4
     <view class="delivery-item">
4
       <view class="label">配送至</view>
5
       <view class="label">配送至</view>
5
-      <view class="value">{{ delivery.to }}</view>
6
+      <view class="value"> 全国各地</view>
6
     </view>
7
     </view>
7
     <view class="delivery-item">
8
     <view class="delivery-item">
8
       <view class="label">包邮</view>
9
       <view class="label">包邮</view>
9
-      <view class="value">{{ delivery.freeShipping }}</view>
10
+      <!-- <view class="value">{{ delivery.freeShipping }}</view> -->
10
     </view>
11
     </view>
11
     <view class="delivery-item">
12
     <view class="delivery-item">
12
       <view class="label">起购</view>
13
       <view class="label">起购</view>
13
-      <view class="value">{{ delivery.minPurchase }}</view>
14
+      <view class="value">{{ lowest_num }}</view>
14
     </view>
15
     </view>
15
   </view>
16
   </view>
16
 </template>
17
 </template>
@@ -21,8 +22,18 @@ export default {
21
     delivery: {
22
     delivery: {
22
       type: Object,
23
       type: Object,
23
       required: true
24
       required: true
25
+    },
26
+    skuId_info:{
27
+       type: Object,
28
+      default:()=>{}
29
+    }
30
+  },
31
+    computed:{
32
+    lowest_num(){
33
+       const data = this.skuId_info|| {}
34
+      return data.lowest_num || 0;
35
+    },
24
     }
36
     }
25
-  }
26
 };
37
 };
27
 </script>
38
 </script>
28
 
39
 
@@ -46,4 +57,9 @@ export default {
46
   font-size: 26rpx;
57
   font-size: 26rpx;
47
   color: #333333;
58
   color: #333333;
48
 }
59
 }
60
+.title{
61
+  font-size: 30rpx;
62
+  color: #333333;
63
+  margin-bottom: 30rpx;
64
+}
49
 </style>
65
 </style>

+ 34 - 4
pages/onlineproductselection/components/detail/ProductInfo.vue

@@ -3,20 +3,20 @@
3
     <view class="price-section">
3
     <view class="price-section">
4
       <view class="price-item">
4
       <view class="price-item">
5
         <view class="label">销售价</view>
5
         <view class="label">销售价</view>
6
-        <view class="value">¥{{ product.salePrice }}</view>
6
+        <view class="value">¥{{ market_price }}</view>
7
       </view>
7
       </view>
8
       <view class="price-item">
8
       <view class="price-item">
9
         <view class="label">创客利润</view>
9
         <view class="label">创客利润</view>
10
-        <view class="value">¥{{ product.creatorProfit }}</view>
10
+        <view class="value">¥{{ profit }}</view>
11
       </view>
11
       </view>
12
       <view class="price-item">
12
       <view class="price-item">
13
         <view class="label">养老金</view>
13
         <view class="label">养老金</view>
14
-        <view class="value">¥{{ product.pension }}</view>
14
+        <view class="value">¥{{ yanglaojin}}</view>
15
       </view>
15
       </view>
16
     </view>
16
     </view>
17
     <view class="brand-info">
17
     <view class="brand-info">
18
       <view class="label">品牌商</view>
18
       <view class="label">品牌商</view>
19
-      <view class="value">{{ product.brand }}</view>
19
+      <view class="value">{{ product.spuId_info&&product.spuId_info.band_name }}</view>
20
     </view>
20
     </view>
21
   </view>
21
   </view>
22
 </template>
22
 </template>
@@ -27,7 +27,37 @@ export default {
27
     product: {
27
     product: {
28
       type: Object,
28
       type: Object,
29
       required: true
29
       required: true
30
+    },
31
+    skuId_info:{
32
+      type: Object,
33
+      default:()=>{}
30
     }
34
     }
35
+  },
36
+  computed:{
37
+    attribute_json(){
38
+       const data = this.skuId_info || {}
39
+      return data.attribute_json;
40
+    },
41
+     cost_price(){
42
+      const data = this.skuId_info || {}
43
+      return data.cost_price || "0.00"
44
+     }, 
45
+     market_price(){
46
+      const data = this.skuId_info || {}
47
+      return data.market_price || "0.00"
48
+     },
49
+     retail_price(){
50
+      const data = this.skuId_info || {}
51
+      return data.retail_price || "0.00"
52
+     },
53
+     profit(){
54
+      const data = this.skuId_info || {}
55
+      return data.profit || "0.00"
56
+     },
57
+     yanglaojin(){
58
+      const data = this.skuId_info || {}
59
+      return data.yanglaojin
60
+     }, 
31
   }
61
   }
32
 };
62
 };
33
 </script>
63
 </script>

+ 12 - 3
pages/onlineproductselection/components/detail/ProductSpec.vue

@@ -1,9 +1,9 @@
1
 <template>
1
 <template>
2
-  <view class="product-spec">
2
+  <view class="product-spec" v-if="attribute_json">
3
     <view class="spec-header">
3
     <view class="spec-header">
4
       <view class="label">规格</view>
4
       <view class="label">规格</view>
5
     </view>
5
     </view>
6
-    <view class="spec-value">{{ product.spec }}</view>
6
+    <view class="spec-value">{{ attribute_json }}</view>
7
   </view>
7
   </view>
8
 </template>
8
 </template>
9
 
9
 
@@ -13,8 +13,17 @@ export default {
13
     product: {
13
     product: {
14
       type: Object,
14
       type: Object,
15
       required: true
15
       required: true
16
+    },
17
+     skuId_info:{
18
+      type: Object,
19
+      default:()=>{}
16
     }
20
     }
17
-  }
21
+  },
22
+    computed:{
23
+    attribute_json(){
24
+       const data = this.skuId_info || {}
25
+      return data.attribute_json;
26
+    },}
18
 };
27
 };
19
 </script>
28
 </script>
20
 
29
 

+ 1 - 0
pages/onlineproductselection/components/listCard/CategoryNav.vue

@@ -93,6 +93,7 @@ export default {
93
   watch: {
93
   watch: {
94
     // swiper与上面选项卡联动
94
     // swiper与上面选项卡联动
95
     currentindex(newval) {
95
     currentindex(newval) {
96
+      
96
       this.isActive = newval;
97
       this.isActive = newval;
97
       this.scrollLeft = 0;
98
       this.scrollLeft = 0;
98
       // 滑动swiper后,每个选项距离其父元素最左侧的距离
99
       // 滑动swiper后,每个选项距离其父元素最左侧的距离

+ 76 - 24
pages/onlineproductselection/components/listCard/ProductCardOnline.vue

@@ -2,11 +2,11 @@
2
   <view class="product-card">
2
   <view class="product-card">
3
     <view class="product-cover">
3
     <view class="product-cover">
4
       <image
4
       <image
5
-        :src="product.image"
5
+        :src="product.img"
6
         @error="handleError"
6
         @error="handleError"
7
         mode="scaleToFill"
7
         mode="scaleToFill"
8
         class="product-img"
8
         class="product-img"
9
-        v-if="!isError && product.image"
9
+        v-if="!isError && product.img"
10
       />
10
       />
11
       <image
11
       <image
12
         src="/static/images/new_ui/kongtu.png"
12
         src="/static/images/new_ui/kongtu.png"
@@ -20,23 +20,34 @@
20
     <view class="product-info">
20
     <view class="product-info">
21
       <view class="product-title">{{ product.title }}</view>
21
       <view class="product-title">{{ product.title }}</view>
22
       <view class="product-price">
22
       <view class="product-price">
23
-        销售价:{{ product.salePrice }} 
23
+        销售价:{{ product.market_price || "0.00" }}
24
       </view>
24
       </view>
25
-       <view class="product-price">
26
-        养老金:{{ product.pension }}
25
+      <view class="product-price">
26
+        养老金:{{ product.pension || "0.00" }}
27
       </view>
27
       </view>
28
-      <view class="product-profit">创客利润:{{ product.creatorProfit }}</view>
29
-      <view class="product-status">状态:{{ product.status }}</view>
28
+      <view class="product-profit">创客利润:{{ product.mer_profit || "0.00" }}</view>
29
+      <view class="product-status"
30
+        >状态:{{ product.status == 1 ? "正常" : "下架" }}</view
31
+      >
30
       <view class="product-desc">{{ product.description }}</view>
32
       <view class="product-desc">{{ product.description }}</view>
31
       <view class="product-actions">
33
       <view class="product-actions">
32
-        <button type="primary"  @click="viewDetails">商品详情</button>
33
-        <button type="primary" class="isjiaru"  @click="addToInventory " >加入商品库</button>
34
+        <button type="primary" @click="handleOperate('detail', product)">
35
+          商品详情
36
+        </button>
37
+        <button
38
+          type="primary"
39
+          :class="[product.is_join == 1 ? 'isjiaru' : '']"
40
+          @click="handleOperate('jiaru', product)"
41
+        >
42
+          加入商品库
43
+        </button>
34
       </view>
44
       </view>
35
     </view>
45
     </view>
36
   </view>
46
   </view>
37
 </template>
47
 </template>
38
 
48
 
39
 <script>
49
 <script>
50
+import { joinselectionlibraryApi } from "@/commit/product.js";
40
 export default {
51
 export default {
41
   props: {
52
   props: {
42
     product: {
53
     product: {
@@ -53,13 +64,55 @@ export default {
53
     handleError() {
64
     handleError() {
54
       this.isError = true;
65
       this.isError = true;
55
     },
66
     },
56
-    viewDetails() {
57
-      // 这里实现查看商品详情的逻辑,例如跳转页面
58
-      console.log("查看商品详情", this.product);
67
+    async handleOperate(type, data) {
68
+      if (type == "detail") {
69
+        console.log("handleOperate", data)
70
+        uni.redirectTo({ url: `/pages/onlineproductselection/onlineDetail?spu_id=${data.spu_id}` })
71
+      } else if (type == "jiaru") {
72
+        if (data.is_join == 1) {
73
+          uni.showModal({
74
+            title: "温馨提示",
75
+            content: "已加入商品库,不可操作",
76
+            showCancel: false,
77
+            success: ({ confirm, cancel }) => {},
78
+          });
79
+          return;
80
+        }
81
+        await this.setJiaruchangp(data);
82
+      }
59
     },
83
     },
60
-    addToInventory() {
61
-      // 这里实现加入商品库的逻辑,例如提交数据
62
-      console.log("加入商品库", this.product);
84
+    async setJiaruchangp(data) {
85
+      uni.showLoading({
86
+        title: "提交中",
87
+        mask: true,
88
+      });
89
+      try {
90
+        const res = await joinselectionlibraryApi({ spu_id: data.spu_id });
91
+        if (res.data.status == 200) {
92
+          uni.showToast({
93
+            title: "提交成功",
94
+            icon: "success",
95
+            duration: 2000,
96
+          });
97
+          this.$emit("success", data);
98
+        } else {
99
+          uni.showToast({
100
+            title: res.data.message,
101
+            icon: "success",
102
+            duration: 2000,
103
+          });
104
+        }
105
+        uni.hideToast();
106
+        uni.hideLoading();
107
+      } catch (error) {
108
+        uni.showToast({
109
+          title: error?.data?.message  || "提交失败",
110
+          icon: "error",
111
+          duration: 2000,
112
+        });
113
+        uni.hideToast();
114
+        uni.hideLoading();
115
+      }
63
     },
116
     },
64
   },
117
   },
65
 };
118
 };
@@ -73,7 +126,7 @@ export default {
73
   box-shadow: 0 2rpx 4rpx rgba(0, 0, 0, 0.1);
126
   box-shadow: 0 2rpx 4rpx rgba(0, 0, 0, 0.1);
74
   margin-bottom: 20rpx;
127
   margin-bottom: 20rpx;
75
   overflow: hidden;
128
   overflow: hidden;
76
-  border: 2rpx solid red;
129
+  // border: 2rpx solid red;
77
 }
130
 }
78
 .product-cover {
131
 .product-cover {
79
   position: relative;
132
   position: relative;
@@ -108,19 +161,18 @@ export default {
108
   color: #999;
161
   color: #999;
109
   margin-bottom: 10rpx;
162
   margin-bottom: 10rpx;
110
 }
163
 }
111
-.product-actions  {
164
+.product-actions {
112
   margin-right: 5rpx;
165
   margin-right: 5rpx;
113
   width: 100%;
166
   width: 100%;
114
   display: flex;
167
   display: flex;
115
   gap: 26rpx;
168
   gap: 26rpx;
116
-  button{
117
-//    width: 45%;
118
-   width: 100%;
119
-   background: #007aff;
120
-  color: white;
121
-
169
+  button {
170
+    //    width: 45%;
171
+    width: 100%;
172
+    background: #007aff;
173
+    color: white;
122
   }
174
   }
123
-  .isjiaru{
175
+  .isjiaru {
124
     background: transparent;
176
     background: transparent;
125
     color: #ff3c00;
177
     color: #ff3c00;
126
   }
178
   }

+ 39 - 26
pages/onlineproductselection/components/listCard/product-item.vue

@@ -3,45 +3,56 @@
3
   <view class="product-card">
3
   <view class="product-card">
4
     <view class="product-header">
4
     <view class="product-header">
5
       <text class="product-name">{{ product.name }}</text>
5
       <text class="product-name">{{ product.name }}</text>
6
-      <text class="product-status" :class="statusClass">{{ product.status }}</text>
6
+      <text class="product-status" :class="statusClass">{{
7
+        product.status
8
+      }}</text>
7
     </view>
9
     </view>
8
 
10
 
9
     <view class="price-info">
11
     <view class="price-info">
10
       <text class="price-label">销售价:</text>
12
       <text class="price-label">销售价:</text>
11
-      <text class="price-value">¥{{ product.price.toFixed(2) }}</text>
13
+      <text class="price-value">¥{{ product.market_price || "0.00" }}</text>
14
+    </view>
15
+    <view class="price-info">
16
+      <text class="price-label">养老金:</text>
17
+      <text class="price-value">¥{{ product.pension || "0.00" }}</text>
12
     </view>
18
     </view>
13
 
19
 
14
     <view class="profit-info">
20
     <view class="profit-info">
15
       <text class="profit-label">创客利润:</text>
21
       <text class="profit-label">创客利润:</text>
16
-      <text class="profit-value">¥{{ product.profit.toFixed(2) }}</text>
22
+      <text class="profit-value">¥{{ product.mer_profit || "0.00" }}</text>
17
     </view>
23
     </view>
18
 
24
 
19
     <view class="action-buttons">
25
     <view class="action-buttons">
20
-      <button class="btn detail" @click="$emit('detail')">商品详情</button>
21
-      <button 
22
-        class="btn add" 
23
-        :class="{ added: product.inLibrary }"
24
-        @tap="$emit('add-to-library', product)"
26
+      <button class="btn detail" @click="handleOperate('detail', product)">
27
+        商品详情
28
+      </button>
29
+      <button
30
+        class="btn add"
31
+        :class="{ added: product.is_join == 1 }"
32
+        @click="handleOperate('jiaru', product)"
25
       >
33
       >
26
-        {{ product.inLibrary ? '已加入' : '加入商品库' }}
34
+        {{ product.is_join == 1 ? "已加入商品库" : "加入商品库" }}
27
       </button>
35
       </button>
28
     </view>
36
     </view>
29
   </view>
37
   </view>
30
 </template>
38
 </template>
31
 <script>
39
 <script>
40
+import { joinselectionlibraryApi } from "@/commit/product.js";
32
 export default {
41
 export default {
33
-    props: {
34
-        product: {
35
-            type: Object,
36
-            default: () => ({})
37
-        }
42
+  props: {
43
+    product: {
44
+      type: Object,
45
+      default: () => {},
38
     },
46
     },
39
-    data(){
40
-        return {
47
+  },
48
+  data() {
49
+    return {};
50
+  },
51
+  methods: {
41
 
52
 
42
-        }
43
-    }
44
-}
53
+  },
54
+
55
+};
45
 </script>
56
 </script>
46
 <style lang="scss" scoped>
57
 <style lang="scss" scoped>
47
 .product-card {
58
 .product-card {
@@ -49,7 +60,7 @@ export default {
49
   border-radius: 16rpx;
60
   border-radius: 16rpx;
50
   padding: 24rpx;
61
   padding: 24rpx;
51
   margin-bottom: 20rpx;
62
   margin-bottom: 20rpx;
52
-  box-shadow: 0 4rpx 12rpx rgba(0,0,0,0.08);
63
+  box-shadow: 0 4rpx 12rpx rgba(0, 0, 0, 0.08);
53
 
64
 
54
   .product-header {
65
   .product-header {
55
     display: flex;
66
     display: flex;
@@ -66,28 +77,30 @@ export default {
66
   .product-status {
77
   .product-status {
67
     font-size: 24rpx;
78
     font-size: 24rpx;
68
     &.normal {
79
     &.normal {
69
-      color: #67C23A;
80
+      color: #67c23a;
70
     }
81
     }
71
   }
82
   }
72
 
83
 
73
-  .price-info, .profit-info {
84
+  .price-info,
85
+  .profit-info {
74
     margin-bottom: 12rpx;
86
     margin-bottom: 12rpx;
75
     display: flex;
87
     display: flex;
76
     align-items: center;
88
     align-items: center;
77
   }
89
   }
78
 
90
 
79
-  .price-label, .profit-label {
91
+  .price-label,
92
+  .profit-label {
80
     font-size: 26rpx;
93
     font-size: 26rpx;
81
     color: #666;
94
     color: #666;
82
   }
95
   }
83
 
96
 
84
   .price-value {
97
   .price-value {
85
-    color: #F56C6C;
98
+    color: #f56c6c;
86
     font-weight: bold;
99
     font-weight: bold;
87
   }
100
   }
88
 
101
 
89
   .profit-value {
102
   .profit-value {
90
-    color: #E6A23C;
103
+    color: #e6a23c;
91
     font-weight: bold;
104
     font-weight: bold;
92
   }
105
   }
93
 
106
 
@@ -110,7 +123,7 @@ export default {
110
       }
123
       }
111
 
124
 
112
       &.add {
125
       &.add {
113
-        background: linear-gradient(90deg, #409EFF, #79BBFF);
126
+        background: linear-gradient(90deg, #409eff, #79bbff);
114
         color: #fff;
127
         color: #fff;
115
 
128
 
116
         &.added {
129
         &.added {

Разлика између датотеке није приказан због своје велике величине
+ 45 - 123
pages/onlineproductselection/onlineDetail.vue


+ 168 - 24
pages/onlineproductselection/onlineproductselection.vue

@@ -10,8 +10,17 @@
10
           placeholder="请输入商品名称"
10
           placeholder="请输入商品名称"
11
           @search="onHandleSearch"
11
           @search="onHandleSearch"
12
         ></searchVue>
12
         ></searchVue>
13
-        <Statistics />
14
-        <CategoryNav />
13
+        <CategoryNav
14
+          :category="quanbuData"
15
+          :curruntActive="curruntActivesd"
16
+          @tabs="tabsCategoryNav"
17
+        />
18
+        <Statistics
19
+          :category="categoryData"
20
+          :curruntActive="curruntActive"
21
+          @tabs="tabsStatistics"
22
+        />
23
+
15
         <!-- <ActionButtons class="mt"/> -->
24
         <!-- <ActionButtons class="mt"/> -->
16
         <!-- <view class="sort-buttons">
25
         <!-- <view class="sort-buttons">
17
       <button type="default" size="mini" @click="sortByPrice">{{ sortBy === 'price'? '销售价 ▲' : '销售价 ▼' }}</button>
26
       <button type="default" size="mini" @click="sortByPrice">{{ sortBy === 'price'? '销售价 ▲' : '销售价 ▼' }}</button>
@@ -21,14 +30,21 @@
21
     </view>
30
     </view>
22
     <view class="online-content">
31
     <view class="online-content">
23
       <view class="product-list">
32
       <view class="product-list">
24
-        <ProductCard
25
-          :product="product"
26
-          v-for="(product, index) in filteredProducts"
27
-          :key="index"
28
-        />
33
+        <template v-if="list.length > 0">
34
+          <ProductCard
35
+            :product="product"
36
+            v-for="(product, index) in list"
37
+            :key="index"
38
+            @success="initData"
39
+          />
40
+        </template>
41
+        <template v-else>
42
+          <emptyDataVue />
43
+        </template>
29
       </view>
44
       </view>
30
       <view
45
       <view
31
         class=""
46
         class=""
47
+        v-if="tihsi == 0 && list.length > 0"
32
         style="margin: 60rpx 0 30rpx 0; color: #999999; font-size: 26rpx"
48
         style="margin: 60rpx 0 30rpx 0; color: #999999; font-size: 26rpx"
33
       >
49
       >
34
         —— 已经到最底部了哦 ——
50
         —— 已经到最底部了哦 ——
@@ -44,6 +60,13 @@ import CategoryNav from "./components/listCard/CategoryNav.vue";
44
 import Statistics from "./components/listCard/Statistics.vue";
60
 import Statistics from "./components/listCard/Statistics.vue";
45
 import ActionButtons from "./components/listCard/ActionButtons.vue";
61
 import ActionButtons from "./components/listCard/ActionButtons.vue";
46
 import ProductCard from "./components/listCard/ProductCardOnline.vue";
62
 import ProductCard from "./components/listCard/ProductCardOnline.vue";
63
+import emptyDataVue from "../../shop/components/emptyData/emptyData.vue";
64
+import {
65
+  statusFilterApi,
66
+  categoryFilterApi,
67
+  productSelectListApi,
68
+  productDetailApi,
69
+} from "@/commit/product.js";
47
 export default {
70
 export default {
48
   components: {
71
   components: {
49
     headersVue,
72
     headersVue,
@@ -52,15 +75,24 @@ export default {
52
     Statistics,
75
     Statistics,
53
     ActionButtons,
76
     ActionButtons,
54
     ProductCard,
77
     ProductCard,
78
+    emptyDataVue,
55
   },
79
   },
56
   data() {
80
   data() {
57
     return {
81
     return {
58
       curruntActive: 0,
82
       curruntActive: 0,
59
-      category: [],
83
+      curruntActivesd: 0,
84
+      categoryData: [],
85
+
86
+      quanbuData: [
87
+        {
88
+          cateIds: "",
89
+          cateName: "全部",
90
+        },
91
+      ],
60
       list: [],
92
       list: [],
61
-      page: 1,
62
-      limit: 10,
93
+
63
       tihsi: "",
94
       tihsi: "",
95
+
64
       is_panudn: true,
96
       is_panudn: true,
65
       products: [
97
       products: [
66
         {
98
         {
@@ -84,31 +116,142 @@ export default {
84
           isChecked: false,
116
           isChecked: false,
85
         },
117
         },
86
       ],
118
       ],
87
-      totalCount: 2,
88
-      joinedCount: 0,
89
-      notJoinedCount: 2,
90
-      sortBy: "",
91
       searchValue: "",
119
       searchValue: "",
120
+      formData: {
121
+        cate_ids: "",
122
+        page: 1,
123
+        limit: 10,
124
+        type: "", //筛选类型
125
+        profit: "", //筛选利润
126
+        title: "", //筛选标题
127
+        price: "", //筛选价格
128
+      },
92
     };
129
     };
93
   },
130
   },
131
+  async onLoad(params) {
132
+    await this.getCategoryFilterApi();
133
+    await this.initData();
134
+     
135
+  },
136
+  onPullDownRefresh() {
137
+    uni.showLoading({
138
+      title: "加载中",
139
+    });
140
+    this.formData.page = 1;
141
+    this.is_panudn = true;
142
+    this.list = [];
143
+    this.getProductList();
144
+  },
145
+  onReachBottom() {
146
+    if (this.is_panudn == true) {
147
+      this.formData.page++;
148
+      this.getProductList();
149
+    } else {
150
+      return;
151
+    }
152
+  },
94
   methods: {
153
   methods: {
154
+    async initData() {
155
+      await this.getStatusFilter();
156
+      await this.getProductList();
157
+    },
158
+    async getStatusFilter() {
159
+      try {
160
+        const res = await statusFilterApi();
161
+        if (res.data.status == 200) {
162
+          this.categoryData = res.data.data || [];
163
+        }
164
+      } catch (error) {}
165
+    },
166
+    async getCategoryFilterApi() {
167
+      try {
168
+        const res = await categoryFilterApi({
169
+          page: 1,
170
+          limit: 12,
171
+        });
172
+        if (res.data.status == 200) {
173
+          let data = res.data.data.data || [];
174
+          this.quanbuData = [
175
+            {
176
+              cateIds: "",
177
+              cateName: "全部",
178
+            },
179
+          ];
180
+          data.forEach((item) => {
181
+            this.quanbuData.push(item);
182
+          });
183
+        }
184
+        console.log(res.data, "9981");
185
+      } catch (error) {}
186
+    },
95
     headerJump() {
187
     headerJump() {
96
       uni.switchTab({ url: "../../shop/productManagementModule/index" });
188
       uni.switchTab({ url: "../../shop/productManagementModule/index" });
97
     },
189
     },
98
     goJump() {
190
     goJump() {
99
-      console.log("fff");
100
       uni.redirectTo({ url: "./onlineDetail" });
191
       uni.redirectTo({ url: "./onlineDetail" });
101
     },
192
     },
102
     onHandleSearch(val) {
193
     onHandleSearch(val) {
103
       console.log(val);
194
       console.log(val);
195
+      this.formData.title = val;
196
+      this.getProductList();
197
+    },
198
+    async getProductList() {
199
+      uni.showLoading({
200
+        title: "加载中",
201
+        mask: true,
202
+      });
203
+      try {
204
+        const res = await productSelectListApi(this.formData);
205
+        uni.stopPullDownRefresh();
206
+        if (res.data.status == 200) {
207
+          this.tihsi = res.data.data.data.lenght || 0;
208
+          if (res.data.data.count > 0) {
209
+            if (this.formData.page == 1) {
210
+              this.list = res.data.data.data;
211
+            } else {
212
+              this.list = this.list.concat(res.data.data.data);
213
+            }
214
+          } else {
215
+            if (this.formData.page == 1) {
216
+              this.list = [];
217
+            }
218
+            this.is_panudn = false;
219
+          }
220
+          uni.hideLoading();
221
+        }
222
+      } catch (error) {
223
+        uni.hideLoading();
224
+      }
104
     },
225
     },
105
-    tabsHandleClick() {},
106
     sortByPrice() {
226
     sortByPrice() {
107
       this.sortBy = this.sortBy === "price" ? "" : "price";
227
       this.sortBy = this.sortBy === "price" ? "" : "price";
108
     },
228
     },
109
     sortByProfit() {
229
     sortByProfit() {
110
       this.sortBy = this.sortBy === "profit" ? "" : "profit";
230
       this.sortBy = this.sortBy === "profit" ? "" : "profit";
111
     },
231
     },
232
+    tabsStatistics({ index, item }) {
233
+      this.curruntActive = index;
234
+      this.formData.type = item.type;
235
+      this.list = [];
236
+      this.formData.page = 1;
237
+      uni.pageScrollTo({
238
+        scrollTop: 0,
239
+        duration: 300,
240
+      });
241
+      this.getProductList();
242
+    },
243
+    tabsCategoryNav({ index, item }) {
244
+      this.curruntActivesd = index;
245
+      this.formData.cate_ids = item.cateIds;
246
+      uni.pageScrollTo({
247
+        scrollTop: 0,
248
+        duration: 300,
249
+      });
250
+      this.list = [];
251
+      this.formData.page = 1;
252
+      this.getStatusFilter();
253
+      this.getProductList();
254
+    },
112
   },
255
   },
113
   computed: {
256
   computed: {
114
     filteredProducts() {
257
     filteredProducts() {
@@ -141,22 +284,23 @@ page {
141
       margin-top: 95rpx;
284
       margin-top: 95rpx;
142
       position: fixed;
285
       position: fixed;
143
       top: 0rpx;
286
       top: 0rpx;
287
+      width: 100%;
144
       z-index: 666;
288
       z-index: 666;
145
     }
289
     }
146
   }
290
   }
147
   .online-content {
291
   .online-content {
148
-	display: flex;
149
-	flex-direction: column;
150
-	align-items: center;
292
+    display: flex;
293
+    flex-direction: column;
294
+    align-items: center;
151
     margin-top: 450rpx;
295
     margin-top: 450rpx;
152
     box-sizing: border-box;
296
     box-sizing: border-box;
153
     padding-bottom: 60rpx;
297
     padding-bottom: 60rpx;
154
-	width: 100%;
298
+    width: 100%;
155
     .product-list {
299
     .product-list {
156
-	width: 100%;
157
-	display: flex;
158
-	flex-direction: column;
159
-	align-items: center;
300
+      width: 100%;
301
+      display: flex;
302
+      flex-direction: column;
303
+      align-items: center;
160
     }
304
     }
161
   }
305
   }
162
 }
306
 }