Pārlūkot izejas kodu

feat:提交代码,完成商贸专区得接口对接

longzhicheng 1 gadu atpakaļ
vecāks
revīzija
df70aa97d9

+ 2 - 1
.env.development

@@ -1 +1,2 @@
1
-VITE_GLOB_API_URL = 'https://test.bjtdba.com'
1
+VITE_GLOB_API_URL = 'https://api.gdjbp.com'
2
+

+ 25 - 6
src/apis/quickLink.ts

@@ -1,16 +1,35 @@
1 1
 import { defHttp } from '~/utils/http'
2
-import type {PageModel} from "~/apis/model/pageModel";
3
-import type {HomeProduct} from "~/apis/model/product.model";
2
+
4 3
 
5 4
 enum API {
6
-    GET_CATEGORY = 'api/store/merchant/category/lst/',
5
+    GET_CATEGORY = '/gateway/wares_service/waresServiceMerchant/selectMerchantSort',
6
+	GET_PRODUCT_TYPE='/gateway/wares_service/waresServiceMerchant/selectMerchant?pageNum=1&pageSize=30',
7
+	GET_PRODUCT_LIST='/gateway/wares_service/waresService/selectProductList?pageNum=1&pageSize=10'
7 8
 }
8 9
 /**
9
- * 店铺分类
10
+ * 头部分类
10 11
  */
11
-export function getCategoryList(id) {
12
+export function apiGetCategoryList() {
12 13
     return defHttp.get({
13 14
         url: API.GET_CATEGORY
14
-    })
15
+    },{withToken:false})
16
+}
17
+
18
+/**
19
+ * 列表分类
20
+ */
21
+export function apiGetProductType(id:any) {
22
+    return defHttp.get({
23
+        url: id?(API.GET_PRODUCT_TYPE+"&category_id="+id):API.GET_PRODUCT_TYPE
24
+    },{withToken:false})
25
+}
26
+
27
+/**
28
+ *产品
29
+ */
30
+export function apiGetProductList(id:any) {
31
+    return defHttp.get({
32
+        url: API.GET_PRODUCT_LIST+"&mer_id="+id
33
+    },{withToken:false,joinTime:false})
15 34
 }
16 35
 

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


+ 2 - 2
src/pages/home/index.vue

@@ -316,8 +316,7 @@
316 316
 			uni.stopPullDownRefresh()
317 317
 			if (state.page === 1) {
318 318
 				state.productList = res
319
-			}
320
-			else {
319
+			}else {
321 320
 				setTimeout(() => {
322 321
 					state.productList.push(...res)
323 322
 				}, 300)
@@ -325,6 +324,7 @@
325 324
 			uni.hideLoading()
326 325
 		}).catch((error) => {
327 326
 			console.error(`${error}->getProduct`)
327
+			uni.hideLoading()
328 328
 		})
329 329
 	}
330 330
 	const homeBanner = `${CDN_URL}/static/assets/home-banner.png`

+ 110 - 27
src/pages/quick-fuc/business.vue

@@ -3,8 +3,8 @@
3 3
 		<view class="lab-content">
4 4
 			<scroll-view scroll-x="true" class="lab-item">
5 5
 				<view class="lab-item-x" v-for="(item,index) in tabList" :key="'lab-item-x-'+index">
6
-					<view class="lab-item-small" @click="onTabClick(index)">
7
-						<text :class="currentIndex==index?'lab-title':'lab-default-title'">111</text>
6
+					<view class="lab-item-small" @click="onTabClick(index,item.merchant_category_id)">
7
+						<text :class="currentIndex==index?'lab-title':'lab-default-title'">{{item.category_name}}</text>
8 8
 						<view :class="currentIndex==index?'lab-line':'lab-default-line'"></view>
9 9
 					</view>
10 10
 				</view>
@@ -15,19 +15,20 @@
15 15
 		</view>
16 16
 
17 17
 		<view class="fuc-content">
18
-			<view class="fuc-item" v-for="(item,index) in MU_TABLE_LIST">
18
+			<view @click="onFucClick" class="fuc-item" v-for="(item,index) in MU_TABLE_LIST" :key="'fuc-item-'+index">
19 19
 				<text class="item-title">{{item.title}}</text>
20 20
 				<text class="item-des">{{item.des}}</text>
21 21
 				<image class="item-img" :src="item.icon" mode=""></image>
22 22
 			</view>
23 23
 		</view>
24 24
 
25
-		<view v-for="(item,index) in goodsList">
26
-			<view class="vip-content">
25
+		<view v-if="goodsList&& goodsList.length!=0" v-for="(item,index) in goodsList" :key="'goods-x-'+index">
26
+			<view class="vip-content" v-if="item.childList&& item.childList.length!=0"
27
+				@click="goShopClick(item.mer_id)">
27 28
 				<image class="vip-bg" src="/static/img/item_smq_bg.png" mode="aspectFill"></image>
28 29
 				<view class="left-lab-content">
29
-					<image class="lab-icon" src="" mode=""></image>
30
-					<text class="lab-title">会员专区</text>
30
+					<image class="lab-icon" :src="item.mer_avatar" mode="widthFix"></image>
31
+					<text class="lab-title">{{item.mer_name}}</text>
31 32
 					<view class="small-lab">补充养老</view>
32 33
 				</view>
33 34
 
@@ -39,24 +40,22 @@
39 40
 
40 41
 			<view class="goods-scoll-content">
41 42
 				<scroll-view scroll-x="true" class="goods-scoll-item">
42
-					<view class="goods-scoll-item-x" v-for="(item,index) in goodsList"
43
-						:key="'goods-scoll-item-x-'+index">
43
+					<view @click="onDetailClick(childItem.product_id)" class="goods-scoll-item-x"
44
+						v-for="(childItem,childIndex) in item.childList" :key="'goods-scoll-item-x-'+childIndex">
44 45
 						<view class="goods-item">
45
-							<image class="goods-img" src="" mode="aspectFill"></image>
46
-							<text class="goods-title">11</text>
46
+							<image class="goods-img" :src="childItem.image" mode="aspectFill"></image>
47
+							<text class="goods-title">{{childItem.store_name}}</text>
47 48
 							<view class="price-content">
48
-								<text class="goods-des">20</text>
49
-								<text class="goods-des">pv:0</text>
49
+								<text class="goods-des">{{childItem.price}}</text>
50
+								<text class="goods-des">pv:{{childItem.pv?childItem.pv:0}}</text>
50 51
 							</view>
51 52
 						</view>
52 53
 					</view>
53 54
 				</scroll-view>
54 55
 			</view>
55 56
 		</view>
56
-
57
-
58
-
59
-
57
+		
58
+		<CXBEmpty v-else />
60 59
 	</view>
61 60
 </template>
62 61
 
@@ -64,14 +63,47 @@
64 63
 	import {
65 64
 		MU_TABLE_LIST
66 65
 	} from "./constants.js"
67
-	import {  getCategoryList } from '~/apis/quickLink'
66
+	import {
67
+		apiGetCategoryList,
68
+		apiGetProductType,
69
+		apiGetProductList
70
+	} from '~/apis/quickLink'
71
+	import { getProductShare } from "~/apis/common";
68 72
 	const currentIndex = ref(0)
69
-	const tabList = ref([1, 1, 1, 1])
70
-	const goodsList = ref([1, 1, 1, 1, 1, 1])
73
+	const tabList = ref([])
74
+	const goodsList = ref([])
71 75
 
72 76
 
73 77
 	onLoad((option) => {
74
-		console.log("===onLoad");
78
+		console.log();
79
+		getCategoryList()
80
+		getProductType()
81
+		
82
+		if (option && option.shareId) {
83
+		  userStore.setShareId(option.shareId)
84
+		}
85
+		getProductShare().then(res => {
86
+		  if (res) userStore.setShareId(res.share_id)
87
+		}).catch(message => {
88
+		})
89
+	})
90
+
91
+	onShareAppMessage(() => {
92
+		const shareId = Cache.get('SHARE_ID')
93
+		return {
94
+			title: `消费储蓄 保障未来`,
95
+			path: `/pages/vip/index?shareId=${shareId}`,
96
+			imageUrl: 'https://cdn.bjtdba.com/vod/image/2023-10-09/20231009202402136.png'
97
+		}
98
+	})
99
+
100
+	onShareTimeline(() => {
101
+		const shareId = Cache.get('SHARE_ID')
102
+		return {
103
+			title: `消费储蓄 保障未来`,
104
+			query: `from=share&shareId=${shareId}`,
105
+			imageUrl: 'https://cdn.bjtdba.com/vod/image/2023-10-11/20231011062523504.png'
106
+		}
75 107
 	})
76 108
 
77 109
 	onReachBottom(() => {
@@ -82,15 +114,67 @@
82 114
 		uni.stopPullDownRefresh()
83 115
 	})
84 116
 
85
-
86
-	function onTabClick(position) {
117
+	function onTabClick(position, id) {
87 118
 		currentIndex.value = position
119
+		getProductType(id)
120
+	}
121
+
122
+	function goShopClick(id) {
123
+		uni.navigateTo({
124
+			url: `/pages/store/home/index?id=${id}`
125
+		})
88 126
 	}
89
-	function getategoryCList(){
90
-		getCategoryList().then((res)=>{
91
-			console.log("===res",res);
127
+
128
+	function onDetailClick(id) {
129
+		uni.navigateTo({
130
+			url: `/pages/store/product/detail?id=${id}`
92 131
 		})
93 132
 	}
133
+
134
+	function onFucClick() {
135
+		uni.showToast({
136
+			title: '升级中',
137
+			icon: 'none'
138
+		})
139
+	}
140
+
141
+	function getCategoryList() {
142
+		apiGetCategoryList().then((res) => {
143
+			let _list = new Array()
144
+			_list.push({
145
+				category_name: '全部',
146
+				merchant_category_id: ''
147
+			})
148
+			if (res.merchantCategory && res.merchantCategory.length != 0) {
149
+				_list.push(...res.merchantCategory)
150
+			}
151
+			tabList.value = _list
152
+		})
153
+	}
154
+
155
+	function getProductType(id) {
156
+		uni.showLoading({
157
+			title:'加载中...'
158
+		})
159
+		apiGetProductType(id).then((res) => {
160
+			if (res && res.pageInfo && res.pageInfo.list) {
161
+				goodsList.value = res.pageInfo.list
162
+				dealData()
163
+			}
164
+			uni.hideLoading()
165
+		})
166
+	}
167
+
168
+	function dealData() {
169
+		for (let i = 0; i < goodsList.value.length; i++) {
170
+			let _id = goodsList.value[i].mer_id
171
+			apiGetProductList(_id).then(resx => {
172
+				if (resx.pageInfo.list && resx.pageInfo.list.length != 0) {
173
+					goodsList.value[i].childList = resx.pageInfo.list
174
+				}
175
+			})
176
+		}
177
+	}
94 178
 </script>
95 179
 
96 180
 <style lang="scss" scoped>
@@ -219,7 +303,6 @@
219 303
 				.lab-icon {
220 304
 					width: 30rpx;
221 305
 					height: 30rpx;
222
-					background-color: #333;
223 306
 					margin-left: 10rpx;
224 307
 				}
225 308
 

+ 1 - 0
src/pages/store/product/detail.vue

@@ -111,6 +111,7 @@ uni.showShareMenu({
111 111
 onLoad((option: any) => {
112 112
   // console.log("我是商品详情页");
113 113
   //二维码扫码传id/shareid
114
+  console.log("===option",option);
114 115
   if (option.scene) {
115 116
     let queryString = decodeURIComponent(option.scene)
116 117
     // 将字符串按 '&' 分割成数组

+ 1 - 1
src/utils/http/helper.ts

@@ -11,7 +11,7 @@ export function joinTimestamp(join: boolean, restful = false): string | object {
11 11
 
12 12
     const now = new Date().getTime()
13 13
     if (restful)
14
-        return `?_t=${now}`
14
+        return `&_t=${now}`
15 15
 
16 16
     return { _t: now }
17 17
 }

+ 23 - 20
src/utils/http/http.ts

@@ -33,9 +33,9 @@ export class VRequest {
33 33
             urlPrefix, apiUrl, joinPrefix, joinTime = true, withToken, joinParamsToUrl,
34 34
             isReturnNativeResponse, isTransformResponse,
35 35
         } = optionsTemp
36
-
37 36
         // token header
38 37
         const token = getToken()
38
+		console.log("===token",token);
39 39
         if (token && withToken !== false) {
40 40
             // jwt token
41 41
             Object.assign(configTemp.header, {
@@ -50,28 +50,31 @@ export class VRequest {
50 50
             configTemp.url = `${urlPrefix}${configTemp.url}`
51 51
 
52 52
         const params = configTemp.params || {}
53
-        if (params) {
54
-            if (configTemp.method?.toUpperCase() === RequestEnum.GET) {
55
-                // add timestamp avoid cache
56
-                if (!isString(params)) {
57
-                    configTemp.params = Object.assign(params || {}, joinTimestamp(joinTime, false))
58
-                    if (joinParamsToUrl && configTemp.params) {
59
-                        configTemp.url = setObjToUrlParams(
60
-                            configTemp.url,
61
-                            Object.assign({}, configTemp.params, configTemp.data))
62
-                        configTemp.params = undefined
63
-                    }
64
-                }
65
-                else {
66
-                    // compatible with restful style
67
-                    configTemp.url = `${config.url + params}${joinTimestamp(joinTime, true)}`
68
-                    configTemp.params = undefined
69
-                }
70
-            }
71
-        }
53
+		
54
+		console.log("===params",params);
55
+        // if (params) {
56
+        //     if (configTemp.method?.toUpperCase() === RequestEnum.GET) {
57
+        //         // add timestamp avoid cache
58
+        //         if (!isString(params)) {
59
+        //             configTemp.params = Object.assign(params || {}, joinTimestamp(joinTime, false))
60
+        //             if (joinParamsToUrl && configTemp.params) {
61
+        //                 configTemp.url = setObjToUrlParams(
62
+        //                     configTemp.url,
63
+        //                     Object.assign({}, configTemp.params, configTemp.data))
64
+        //                 configTemp.params = undefined
65
+        //             }
66
+        //         }
67
+        //         else {
68
+        //             // compatible with restful style
69
+        //             configTemp.url = `${config.url + params}${joinTimestamp(joinTime, true)}`
70
+        //             configTemp.params = undefined
71
+        //         }
72
+        //     }
73
+        // }
72 74
 
73 75
         if (apiUrl && isString(apiUrl))
74 76
             configTemp.url = `${apiUrl}${configTemp.url}`
77
+			console.log("=== configTemp.url", configTemp.url);
75 78
 
76 79
         return new Promise((resolve, reject) => {
77 80
             uni.request({