Pārlūkot izejas kodu

增加鼎盛联盟页面,修改首页滋补养生位置,隐藏学生,修改首页大仓为精品大仓

许雷 2 gadi atpakaļ
vecāks
revīzija
2b94b46ebb

+ 3 - 2
src/apis/common.ts

@@ -47,6 +47,7 @@ enum API {
47 47
     HOT_KEYWORD = '/api/common/hot_keyword',
48 48
 
49 49
     HOME_BANNER = '/api/newhome/nologin/banner/home_banner_new',
50
+	BANNER = '/api/newhome/nologin/banner/',
50 51
 
51 52
     GET_PRODUCT_SHARE = '/api/get_product_share',
52 53
     // /api/get_product_share
@@ -61,9 +62,9 @@ export function getProductShare() {
61 62
 /**
62 63
  * 获取首页轮播图
63 64
  */
64
-export function getHomeBanner() {
65
+export function getHomeBanner(type="home_banner_new") {
65 66
     return defHttp.get({
66
-        url: API.HOME_BANNER,
67
+        url: API.BANNER+type,
67 68
     })
68 69
 }
69 70
 

+ 23 - 4
src/apis/merchant.ts

@@ -14,7 +14,9 @@ enum API {
14 14
     // 产品推荐列表
15 15
     GET_PRODUCT_RECOMMEND_LIST = '/api/store/product/recommend/lst',
16 16
     // 会员产商品
17
-    GET_VIP_AREA_LIST = '/api/store/merchant/product/lst/324'
17
+    GET_VIP_AREA_LIST = '/api/store/merchant/product/lst/324',
18
+	
19
+	GET_TYPE_PRODUCT_LIST = '/api/store/merchant/product/type_lst.html'
18 20
 }
19 21
 
20 22
 /**
@@ -62,12 +64,12 @@ export function getMerchantCategory(id: string): Promise<Array<MerchantCategoryM
62 64
  * 滋补保健
63 65
  * @param id
64 66
  */
65
-export function getProductList(id: string): Promise<ZibubaojianResult> {
67
+export function getProductList(id: string,page=1,limit=10): Promise<ZibubaojianResult> {
66 68
     return defHttp.get({
67 69
         url: API.GET_PRODUCT_LIST + `/${id}`,
68 70
         params: {
69
-            page: 1,
70
-            limit: 10
71
+            'page': page,
72
+            'limit': limit
71 73
         }
72 74
     })
73 75
 }
@@ -112,4 +114,21 @@ export function getVipAreaList(pageParams: PageModel): Promise<VipAreaResult> {
112 114
             // limit: pageParams.limit === undefined ? 20 : pageParams.limit
113 115
         }
114 116
     })
117
+}
118
+
119
+
120
+/**
121
+ * 获取鼎盛联盟商品
122
+ * @param pageParams
123
+ */
124
+export function getTypeProductList(pageParams: PageModel): Promise<VipAreaResult> {
125
+
126
+    return defHttp.get({
127
+        url: API.GET_TYPE_PRODUCT_LIST,
128
+        params: {
129
+            ...pageParams
130
+            // page: pageParams.page === undefined ? 1 : pageParams.page,
131
+            // limit: pageParams.limit === undefined ? 20 : pageParams.limit
132
+        }
133
+    })
115 134
 }

Failā izmaiņas netiks attēlotas, jo tās ir par lielu
+ 1 - 1
src/pages.json


+ 37 - 12
src/pages/home/components/navs.vue

@@ -6,8 +6,8 @@ import {CDN_URL} from "~/config/app";
6 6
 
7 7
 const navList = ref([{
8 8
   image: CDN_URL + '/static/home-nav/home_dacang_220614.png',
9
-  title: '大仓',
10
-  key: PLATFORM_NAME.DC
9
+  title: '精品大仓',
10
+  key: 'jingpin'
11 11
 }, {
12 12
   image: CDN_URL + '/static/home-nav/home_xianshimiaosha_220614.png',
13 13
   title: '限时秒杀',
@@ -18,9 +18,9 @@ const navList = ref([{
18 18
   key: PLATFORM_NAME.JD
19 19
 }, {
20 20
   image: '',
21
-  title: '滋补保健',
22
-  key: 'zibu',
23
-  categoryId: '430'
21
+  title: '鼎盛联盟',
22
+  key: 'dingsheng',
23
+  // categoryId: '430'
24 24
   // 测试库
25 25
   // categoryId: '149'
26 26
 },{
@@ -52,12 +52,23 @@ const navList = ref([{
52 52
   title: '老年专区',
53 53
   key: PLATFORM_NAME.DC,
54 54
   categoryId: '571'
55
-}, {
56
-  image: CDN_URL + '/static/home-nav/the_student_zone_220920.png',
57
-  title: '学生专区',
58
-  key: PLATFORM_NAME.DC,
59
-  categoryId: '576'
60
-}, {
55
+}, 
56
+ {
57
+  image: '',
58
+  title: '滋补保健',
59
+  key: 'zibu',
60
+  categoryId: '430'
61
+  // 测试库
62
+  // categoryId: '149'
63
+},
64
+
65
+// {
66
+//   image: CDN_URL + '/static/home-nav/the_student_zone_220920.png',
67
+//   title: '学生专区',
68
+//   key: PLATFORM_NAME.DC,
69
+//   categoryId: '576'
70
+// }, 
71
+{
61 72
   image: CDN_URL + '/static/home-nav/vip_img.png',
62 73
   title: '会员专区',
63 74
   key: 'member',
@@ -78,7 +89,9 @@ const navList = ref([{
78 89
 onBeforeMount(() => {
79 90
   getHomeQuickLink().then(res => {
80 91
     if (res) {
81
-      navList.value[3] = res[0]
92
+		navList.value[11] = res[0]
93
+		navList.value[3] = res[1]
94
+		// navList.value[3] = res[0]
82 95
       // console.log(res)
83 96
     }
84 97
   })
@@ -122,6 +135,18 @@ function handleItemClick(item: any) {
122 135
       })
123 136
       break;
124 137
     }
138
+	case 'dingsheng': {
139
+	  uni.navigateTo({
140
+	    url: `/pages/product/dingshenglianmeng?type=`+item.key
141
+	  })
142
+	  break;
143
+	}
144
+	case 'jingpin': {
145
+	  uni.navigateTo({
146
+	    url: `/pages/product/dingshenglianmeng?type=`+item.key
147
+	  })
148
+	  break;
149
+	}
125 150
     // 积分通兑
126 151
     case 'integral': {
127 152
       uni.navigateTo({

+ 171 - 0
src/pages/product/dingshenglianmeng.vue

@@ -0,0 +1,171 @@
1
+<template>
2
+  <CXBBasePage>
3
+    <scroll-view>
4
+		<div class="h-45">
5
+		  <swiper
6
+		      v-if="state.banners"
7
+		      :indicator-dots="state.indicatorDots"
8
+		      indicator-active-color="#e93323"
9
+		      :autoplay="state.autoplay"
10
+		      :circular="state.circular"
11
+		      :interval="state.interval"
12
+		      :duration="state.duration"
13
+		      class=" h-full"
14
+		  >
15
+		    <swiper-item v-for="(item, index) in state.banners" :key="index">
16
+		      <image :src="item.pic" class="!w-full !h-full" mode="aspectFill"/>
17
+		    </swiper-item>
18
+		  </swiper>
19
+		</div>
20
+      <div class="p-3">
21
+        <div>
22
+          <grid-view type="masonry" cross-axis-count="2" 	cross-axis-gap="10px" main-axis-gap="10px">
23
+            <div v-for="(item, index) in list"
24
+                 @tap="handleItemClick(item)"
25
+                 :key="index"
26
+            >
27
+
28
+              <div class="bg-white rounded-lg">
29
+                <image :src="item.image" mode="widthFix" 	:fade-in="true" class="rounded-t-lg  !w-full aspect-square" />
30
+                <div class="text-sm p-2 flex flex-col gap-2">
31
+                  <div class="line-clamp-2">
32
+                    {{ item.store_name }}
33
+                  </div>
34
+                  <CXBYaojinTag :amount="item.yanglao" />
35
+                  <div class="text-[#fe0032] flex items-end gap-2">
36
+                    <div class="text-[20px]">¥{{ item.price }}</div>
37
+                  </div>
38
+                  <div class="line-through text-xs font-bold text-gray-400 flex ">
39
+                    <div>
40
+                      ¥ {{item.ot_price}}
41
+                    </div>
42
+                  </div>
43
+                </div>
44
+              </div>
45
+            </div>
46
+          </grid-view>
47
+        </div>
48
+      </div>
49
+    </scroll-view>
50
+  </CXBBasePage>
51
+</template>
52
+
53
+<script setup lang="ts">
54
+import CXBBasePage from "~/components/CXBBasePage/CXBBasePage.vue";
55
+import {getTypeProductList} from "~/apis/merchant";
56
+import {getHomeBanner} from "~/apis/common";
57
+
58
+const state = reactive({
59
+  currentPage: 1,
60
+  pageSize: 10,
61
+  totalPage: 1,
62
+  banners: [],
63
+  keyword: '' ,
64
+  status: 'noMore',
65
+  indicatorDots: true,
66
+  circular: true,
67
+  autoplay: true,
68
+  interval: 5000,
69
+  duration: 500,
70
+  currents: "0",
71
+  title:'',
72
+  type:'',
73
+})
74
+const list = ref()
75
+
76
+function handleItemClick(item) {
77
+  uni.navigateTo({
78
+    url: `/pages/store/product/detail?id=`+item.product_id
79
+  })
80
+}
81
+
82
+onLoad((option) => {
83
+	state.type=option.type;	//获取url参数
84
+	if(state.type=='jingpin'){
85
+		state.title='精品大仓'
86
+	}else if(state.type=='dingsheng'){
87
+		state.title='鼎盛联盟'
88
+	}
89
+
90
+
91
+	getHomeBanner(state.type+"_banner").then(res => {
92
+		state.banners = res
93
+	})
94
+	loadList('reload')
95
+	
96
+})
97
+
98
+
99
+function loadList(action: 'page' | 'reload', callback?: (items) => void) {
100
+	if (action === 'reload') {
101
+	  state.currentPage = 1
102
+	}
103
+	
104
+	const params = {
105
+		type :state.type,
106
+		page: state.currentPage,
107
+		limit: state.pageSize
108
+	}
109
+	getTypeProductList({
110
+		...params
111
+	}).then(res => {
112
+		if (res) {
113
+			if (action === 'reload') {
114
+				list.value = res.list
115
+			}else if (action === 'page') {
116
+			  list.value = list.value.concat(res.list)
117
+			}
118
+			state.totalPage = Math.ceil(res.count / state.pageSize);
119
+			state.status = 'more'
120
+			
121
+			if (callback) {
122
+			      callback(res.list)
123
+			}
124
+		}
125
+	})
126
+}
127
+
128
+
129
+
130
+
131
+
132
+function handleScrollToLower() {
133
+  state.status = 'loading';
134
+  state.currentPage += 1;
135
+  // console.log(state.currentPage+"----------"+state.totalPage)
136
+  if (state.currentPage > state.totalPage) {
137
+    state.status = 'noMore';
138
+  } else {
139
+    setTimeout(() => {
140
+      loadList('page')
141
+    }, 300)
142
+  }
143
+}
144
+
145
+onReachBottom(() => {
146
+  console.log('到底了。。。')
147
+  handleScrollToLower()
148
+
149
+})
150
+
151
+onPullDownRefresh(() => {
152
+  loadList('reload', function() {
153
+    setTimeout(() => {
154
+      uni.stopPullDownRefresh()
155
+    }, 300)
156
+  })
157
+})
158
+
159
+onShow(() =>{
160
+    uni.setNavigationBarTitle({
161
+      title: state.title // 设置新的导航栏标题
162
+    });
163
+})
164
+
165
+
166
+</script>
167
+
168
+<route lang="yaml">
169
+style:
170
+  enablePullDownRefresh: true
171
+</route>

+ 81 - 4
src/pages/product/zibuyangsheng.vue

@@ -4,19 +4,96 @@ import ProductCard from "~/components/ProductCard/ProductCard.vue";
4 4
 import CXBBasePage from "~/components/CXBBasePage/CXBBasePage.vue";
5 5
 import {getProductList} from "~/apis/merchant";
6 6
 import CXBYaojinTag from "~/components/CXBYaojinTag/CXBYaojinTag.vue";
7
+const state = reactive({
8
+	currentPage: 1,
9
+	pageSize: 10,
10
+	totalPage: 1,
11
+	status: 'noMore',
12
+	id:''
13
+})
7 14
 const list = ref()
8 15
 onLoad((options) => {
9
-  getProductList(options.id).then(res => {
10
-    list.value = res.list
11
-  })
16
+	state.id=options.id;
17
+	loadList('reload')
12 18
 })
13 19
 
14 20
 function handleItemClick(item) {
15 21
   uni.navigateTo({
16 22
     // url: `/pages/store/product/detail?id=${item.product_id}&mer_id=148`
17
-    url: `/pages/store/product/detail?id=${item.product_id}`
23
+    url: `/pages/store/product/detail?id=`+item.product_id
18 24
   })
19 25
 }
26
+
27
+
28
+
29
+function loadList(action: 'page' | 'reload', callback?: (items) => void) {
30
+	if (action === 'reload') {
31
+		state.currentPage = 1
32
+	}
33
+	
34
+	getProductList(state.id,state.currentPage,state.pageSize).then(res => {
35
+		if (res) {
36
+			if (action === 'reload') {
37
+				list.value = res.list
38
+			}else if (action === 'page') {
39
+			  list.value = list.value.concat(res.list)
40
+			}
41
+			state.totalPage = Math.ceil(res.count / state.pageSize);
42
+			state.status = 'more'
43
+			
44
+			if (callback) {
45
+			      callback(res.list)
46
+			}
47
+		}
48
+	})
49
+}
50
+
51
+
52
+
53
+
54
+
55
+function handleScrollToLower() {
56
+  state.status = 'loading';
57
+  state.currentPage += 1;
58
+  // console.log(state.currentPage+"----------"+state.totalPage)
59
+  if (state.currentPage > state.totalPage) {
60
+    state.status = 'noMore';
61
+  } else {
62
+    setTimeout(() => {
63
+      loadList('page')
64
+    }, 300)
65
+  }
66
+}
67
+
68
+onReachBottom(() => {
69
+  console.log('到底了。。。')
70
+  handleScrollToLower()
71
+
72
+})
73
+
74
+onPullDownRefresh(() => {
75
+  loadList('reload', function() {
76
+    setTimeout(() => {
77
+      uni.stopPullDownRefresh()
78
+    }, 300)
79
+  })
80
+})
81
+
82
+
83
+
84
+
85
+
86
+
87
+
88
+
89
+
90
+
91
+
92
+
93
+
94
+
95
+
96
+
20 97
 </script>
21 98
 <template>
22 99
   <CXBBasePage>

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

@@ -163,7 +163,7 @@ onLoad((option) => {
163 163
   })
164 164
   userStore.setRedirectPage(`/pages/vip/index`, 'page')
165 165
 
166
-  getHomeBanner().then(res => {
166
+  getHomeBanner("user_banner").then(res => {
167 167
     console.log(res)
168 168
     state.banners = res
169 169
   })