Pārlūkot izejas kodu

feat:提交代码,调整店铺跳转

longzhicheng 1 gadu atpakaļ
vecāks
revīzija
62faa63761

+ 18 - 0
src/apis/quickLink.ts

@@ -159,6 +159,24 @@ export function apiGetReProduct(data : any) {
159 159
 		url: API.GET_RE_PRODUCT + params
160 160
 	})
161 161
 }
162
+
163
+
164
+/**
165
+ * 获取店铺商品
166
+ */
167
+/**
168
+ *产品
169
+ */
170
+export function apiGetStoreProductList(id : any,pageNum:number,cate_id:any,keyword:any) {
171
+	let params = `&pageSize=10&mer_id=${id}&pageNum=${pageNum}&keyword=${keyword}`
172
+	if(cate_id){
173
+		params = `&pageSize=10&mer_id=${id}&pageNum=${pageNum}&cate_id=${cate_id}&keyword=${keyword}`
174
+	}
175
+	return defHttp.get({
176
+		url: API.GET_PRODUCT_LIST + params
177
+	})
178
+}
179
+
162 180
 /**
163 181
  * 精彩生活产品列表
164 182
  */

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


+ 3 - 3
src/subPages/pages/quick-fuc/business.vue

@@ -23,7 +23,7 @@
23 23
 			</view>
24 24
 		</view>
25 25
 		<view v-if="goodsList&& goodsList.length!=0" v-for="(item,index) in goodsList" :key="'goods-x-'+index">
26
-			<view class="vip-content" @click="goShopClick(item.mer_id)">
26
+			<view class="vip-content" @click="goShopClick(item)">
27 27
 				<image class="vip-bg" :src="vipBg" mode="aspectFill"></image>
28 28
 				<view class="left-lab-content">
29 29
 					<image class="lab-icon" :src="item.mer_avatar" mode="widthFix"></image>
@@ -128,9 +128,9 @@
128 128
 		getCommerceList()
129 129
 	}
130 130
 
131
-	function goShopClick(id) {
131
+	function goShopClick(item) {
132 132
 		uni.navigateTo({
133
-			url: `/subPages/pages/store/home/index?id=${id}`
133
+			url: `/subPages/pages/quick-fuc/store?id=${item.mer_id}&title=${item.mer_name}`
134 134
 		})
135 135
 	}
136 136
 

+ 270 - 0
src/subPages/pages/quick-fuc/store.vue

@@ -0,0 +1,270 @@
1
+<template>
2
+
3
+	<div class="flex flex-col gap-3 ">
4
+		<div style="height: 80rpx;">
5
+			<div style="background-color: transparent  " class="overflow-hidden fixed top-0 w-full z-10">
6
+				<nut-searchbar v-model="state.keyword" @search="searchkwd" @clear="clearSearch">
7
+					<template v-slot:rightout>
8
+						<div @tap="searchkwd">
9
+							搜索
10
+						</div>
11
+					</template>
12
+				</nut-searchbar>
13
+			</div>
14
+		</div>
15
+
16
+		<view class="lab-content">
17
+			<scroll-view scroll-x="true" class="lab-item">
18
+				<view class="lab-item-x" v-for="(item,index) in tabList" :key="'lab-item-x-'+index">
19
+					<view class="lab-item-small" @click="onTabClick(index,item.store_category_id)">
20
+						<text :class="currentIndex==index?'lab-title':'lab-default-title'">{{item.cate_name}}</text>
21
+						<view :class="currentIndex==index?'lab-line':'lab-default-line'"></view>
22
+					</view>
23
+				</view>
24
+			</scroll-view>
25
+		</view>
26
+
27
+		<div class="w-screen swiper-height mt-90" v-if='state.banners && state.banners.length!=0'>
28
+			<div class="px-3 swiper-height">
29
+				<swiper v-if="state.banners" :indicator-dots="state.indicatorDots" indicator-active-color="#e93323"
30
+					:autoplay="state.autoplay" :circular="state.circular" :interval="state.interval"
31
+					:duration="state.duration" class="w-full h-full rounded-md overflow-hidden ">
32
+					<swiper-item v-for="(item, index) in state.banners" :key="index">
33
+						<image :src="item.pic" class="w-full h-full object-cover swiper-bg" mode="aspectFill" />
34
+					</swiper-item>
35
+				</swiper>
36
+			</div>
37
+		</div>
38
+		
39
+		<CXBBackTop :Scroll_X="Scroll_X" :isCss="1" />
40
+		
41
+		<ProductList :initType ='1' :list="pageList" v-if="pageList && pageList.length!=0" />
42
+		
43
+        <CXBEmpty v-else></CXBEmpty>
44
+		
45
+	</div>
46
+
47
+</template>
48
+
49
+<script setup lang="ts">
50
+	import FSearch from "~/components/FSearch/FSearch.vue";
51
+	import type CXBBackTop from "~/components/CXBBackTop/CXBBackTop.vue";
52
+	import CXBEmpty from "~/components/CXBEmpty/CXBEmpty.vue";
53
+	import { getProductShare } from "~/apis/common";
54
+	import { useUserStore } from "~/stores/userStore";
55
+	import Cache from "~/utils/cache";
56
+	import { apiGetClassity, apiBanner, apiGetProduct ,apiGetStoreProductList } from '~/apis/quickLink'
57
+	import ProductList from './components/life-product.vue'
58
+	import { IMG_CDN_URL} from '~/config/app.ts'
59
+	import {SHARE_TITLE,SHARE_BANNER,SHARE_ICON} from '~/constants/index'
60
+	const userStore = useUserStore()
61
+	const state = reactive({
62
+		currentPage: 1,
63
+		pageSize: 10,
64
+		page: 1,
65
+		limit: 10,
66
+		cid: 0,
67
+		totalPage: 1,
68
+		banners: [],
69
+		count: 0,
70
+		pageType: 0,
71
+		keyword: '',
72
+		status: 'noMore',
73
+		indicatorDots: true,
74
+		circular: true,
75
+		autoplay: true,
76
+		interval: 5000,
77
+		duration: 500,
78
+		currents: "0",
79
+		title: '',
80
+		mer_id: '',
81
+		cate_id:''
82
+	})
83
+	
84
+	const pageList = ref([])
85
+	const tabList = ref([{ category_name: '测试' }])
86
+	const currentIndex = ref(0)
87
+	const count = ref(1)
88
+	
89
+	onLoad((option) => {
90
+		getClassity()
91
+		getBanner()
92
+		if (option && option.id) {
93
+			state.mer_id = option.id
94
+			uni.setNavigationBarTitle({
95
+				title: option.title || '精品小店' // 设置新的导航栏标题
96
+			});
97
+			getProduct()
98
+		}
99
+	})
100
+	
101
+   
102
+	function getProduct() {
103
+		uni.showLoading()
104
+		apiGetStoreProductList(state.mer_id ,state.page,state.cate_id,state.keyword).then(res => {
105
+			count.value = res.count
106
+			if (state.page === 1) {
107
+				pageList.value = res.list
108
+			} else {
109
+				pageList.value.push(...res.list)
110
+			}
111
+			uni.hideLoading()
112
+		})
113
+	}
114
+
115
+	function getBanner() {
116
+		apiBanner().then(res => {
117
+			state.banners = res
118
+		})
119
+	}
120
+	
121
+	function getClassity() {
122
+		apiGetClassity().then(res => {
123
+			tabList.value = [{ cate_name: '全部' }, ...res]
124
+		})
125
+	}
126
+
127
+	function onTabClick(index:number,store_category_id:any) {
128
+		 if(currentIndex.value == index){
129
+			 return
130
+		 }
131
+		currentIndex.value = index
132
+		state.cate_id = store_category_id
133
+		state.page = 1
134
+		getProduct()
135
+	}
136
+	//搜索全部筛选
137
+	function searchkwd() {
138
+		if (!state.keyword) {
139
+			return uni.showToast({
140
+				title: '请输入搜索关键字',
141
+				icon: 'none'
142
+			})
143
+		}
144
+		state.page = 1
145
+		getProduct()
146
+	}
147
+
148
+	
149
+
150
+	function handleItemClick(item) {
151
+		uni.navigateTo({
152
+			url: `/subPages/pages/store/product/detail?id=${item.product_id}&initType=1`
153
+		})
154
+	}
155
+
156
+	function clearSearch() {
157
+		state.page = 1
158
+		getProduct()
159
+	}
160
+
161
+	onPullDownRefresh(() => {
162
+		state.page = 1
163
+		getClassity()
164
+		getBanner()
165
+		getProduct()
166
+		uni.stopPullDownRefresh()
167
+	})
168
+	
169
+	onReachBottom(() => {
170
+		if(pageList.value.length <count.value){
171
+			state.page += 1
172
+			getProduct()
173
+		}
174
+	})
175
+	// 距离顶部距离
176
+	let Scroll_X = ref(0)
177
+	const headerClass = ref('')
178
+	onPageScroll((page) => {
179
+		Scroll_X.value = Number(page.scrollTop.toFixed())
180
+		// page.scrollTop
181
+		if (page.scrollTop >= 76) {
182
+			headerClass.value = '!bg-primary !text-white'
183
+		} else {
184
+			headerClass.value = ''
185
+		}
186
+	})
187
+</script>
188
+
189
+<route lang="yaml">
190
+style:
191
+  navigationBarTitleText: 精品小店
192
+  enablePullDownRefresh: true
193
+</route>
194
+
195
+<style>
196
+	page {
197
+		background: #f8f8f8;
198
+		--nut-searchbar-background: #fff;
199
+		--nut-searchbar-input-background: #f8f8f8;
200
+		--nut-searchbar-input-box-shadow: none;
201
+	}
202
+</style>
203
+<style scoped lang="scss">
204
+	.mt-90 {
205
+		margin-top: 90rpx;
206
+	}
207
+
208
+	.swiper-height {
209
+		height: 320rpx;
210
+	}
211
+
212
+	.lab-content {
213
+		width: 100%;
214
+		height: 90rpx;
215
+		display: flex;
216
+		flex-direction: row;
217
+		align-items: center;
218
+		position: fixed;
219
+		top: 0;
220
+		margin-top: 80rpx;
221
+		left: 0;
222
+		background-color: #fff;
223
+		z-index: 99999;
224
+
225
+		.lab-item {
226
+			display: flex;
227
+			flex-direction: row;
228
+			white-space: nowrap;
229
+			width: 100%;
230
+		}
231
+
232
+		.lab-item-x {
233
+			display: inline-block;
234
+			margin-right: 10px;
235
+			text-align: center;
236
+		}
237
+
238
+		.lab-item-small {
239
+			display: flex;
240
+			flex-direction: column;
241
+			align-items: center;
242
+			width: 124rpx;
243
+
244
+			.lab-default-title {
245
+				font-size: 28rpx;
246
+				margin-bottom: 10rpx;
247
+			}
248
+
249
+			.lab-title {
250
+				font-size: 32rpx;
251
+				margin-bottom: 10rpx;
252
+				color: #FE0032;
253
+			}
254
+
255
+			.lab-line {
256
+				width: 50rpx;
257
+				height: 6rpx;
258
+				background-color: #FE0032;
259
+				border-radius: 4rpx;
260
+			}
261
+
262
+			.lab-default-line {
263
+				width: 50rpx;
264
+				height: 6rpx;
265
+				border-radius: 4rpx;
266
+			}
267
+
268
+		}
269
+	}
270
+</style>

+ 1 - 0
uni-pages.d.ts

@@ -127,6 +127,7 @@ interface NavigateToOptions {
127 127
        "/subPages/pages/quick-fuc/life" |
128 128
        "/subPages/pages/quick-fuc/repurchase" |
129 129
        "/subPages/pages/quick-fuc/shop" |
130
+       "/subPages/pages/quick-fuc/store" |
130 131
        "/subPages/pages/quick-fuc/vip" |
131 132
        "/subPages/pages/record-detail/detail" |
132 133
        "/subPages/pages/refund/detail" |