Selaa lähdekoodia

会员搜索功能ok

dxz1228 2 vuotta sitten
vanhempi
commit
ae5b39f962

+ 0 - 1
src/auto-imports.d.ts

@@ -96,7 +96,6 @@ declare global {
96
   const useCustomStyleProp: typeof import('./composables/useProps')['useCustomStyleProp']
96
   const useCustomStyleProp: typeof import('./composables/useProps')['useCustomStyleProp']
97
   const useDacangStore: typeof import('./stores/dacangStore')['useDacangStore']
97
   const useDacangStore: typeof import('./stores/dacangStore')['useDacangStore']
98
   const useDirectionProp: typeof import('./composables/useProps')['useDirectionProp']
98
   const useDirectionProp: typeof import('./composables/useProps')['useDirectionProp']
99
-  const useOrderStore: typeof import('./stores/addressStore')['useOrderStore']
100
   const usePageStore: typeof import('./stores/page')['usePageStore']
99
   const usePageStore: typeof import('./stores/page')['usePageStore']
101
   const usePageStoreWidthOut: typeof import('./stores/page')['usePageStoreWidthOut']
100
   const usePageStoreWidthOut: typeof import('./stores/page')['usePageStoreWidthOut']
102
   const useSizeProp: typeof import('./composables/useProps')['useSizeProp']
101
   const useSizeProp: typeof import('./composables/useProps')['useSizeProp']

+ 1 - 1
src/components/FCell/FCell.vue

@@ -6,7 +6,7 @@ const props = defineProps(cellProps)
6
 const emit = defineEmits(cellEmits)
6
 const emit = defineEmits(cellEmits)
7
 onLoad(
7
 onLoad(
8
   (options)=>{
8
   (options)=>{
9
-    console.log('我是点击options',options);
9
+    // console.log('我是点击options',options);
10
     
10
     
11
   }
11
   }
12
 )
12
 )

+ 5 - 1
src/components/FSearch/FSearch.vue

@@ -41,7 +41,7 @@ function handleClick() {
41
                  class="w-5 h-5  pl-2 py-1"
41
                  class="w-5 h-5  pl-2 py-1"
42
           ></image>
42
           ></image>
43
         <div class="flex flex-1 w-100%">
43
         <div class="flex flex-1 w-100%">
44
-          <div class="flex-1"></div>
44
+          <div class="flex-1  "></div>
45
           <div
45
           <div
46
               class="bg-[#D71608] text-white text-xs w-11 rounded-full text-center p-1.5  mr-0.5 "
46
               class="bg-[#D71608] text-white text-xs w-11 rounded-full text-center p-1.5  mr-0.5 "
47
           >
47
           >
@@ -53,3 +53,7 @@ function handleClick() {
53
       </div>
53
       </div>
54
 
54
 
55
 </template>
55
 </template>
56
+<style scoped>
57
+
58
+
59
+</style>

+ 1 - 1
src/pages/dacang/list/index.vue

@@ -57,7 +57,7 @@ onLoad(async (option) => {
57
       userStore.setShareId(res.share_id)
57
       userStore.setShareId(res.share_id)
58
     }
58
     }
59
   }).catch(message => {
59
   }).catch(message => {
60
-    // console.log(message)
60
+    console.log(message)
61
   })
61
   })
62
   userStore.setRedirectPage(`/pages/dacang/list/index`, 'tab')
62
   userStore.setRedirectPage(`/pages/dacang/list/index`, 'tab')
63
   getBannerImg().then(res=>{
63
   getBannerImg().then(res=>{

+ 45 - 26
src/pages/home/components/header.vue

@@ -1,8 +1,8 @@
1
 <script lang="ts" setup>
1
 <script lang="ts" setup>
2
-import {computed, PropType} from "vue";
2
+import { computed, PropType } from "vue";
3
 import FSearch from "~/components/FSearch/FSearch.vue";
3
 import FSearch from "~/components/FSearch/FSearch.vue";
4
-import type {UserInfoModel} from "~/apis/model/userInfoModel";
5
-import {useUserStore} from "~/stores/userStore";
4
+import type { UserInfoModel } from "~/apis/model/userInfoModel";
5
+import { useUserStore } from "~/stores/userStore";
6
 // import {useUserStore} from "~/stores/userStore";
6
 // import {useUserStore} from "~/stores/userStore";
7
 const userStore = useUserStore()
7
 const userStore = useUserStore()
8
 
8
 
@@ -66,30 +66,22 @@ function handleShowMessage() {
66
     url: '/pages/message/index'
66
     url: '/pages/message/index'
67
   })
67
   })
68
 }
68
 }
69
+function handleClickser() {
70
+  uni.navigateTo({
71
+    url: '/pages/search/index'
72
+  })
73
+}
69
 </script>
74
 </script>
70
 <template>
75
 <template>
71
-  <div class="home-header fixed w-screen text-white z-10"
72
-       :style="navBarStyle"
73
-       :class="exClass"
74
-  >
76
+  <div class="home-header fixed w-screen text-white z-10" :style="navBarStyle" :class="exClass">
75
     <div class="flex">
77
     <div class="flex">
76
-      <div
77
-          @click="handleClick"
78
-          class="flex gap-2 mb-2 pl-2 flex-1"
79
-      >
80
-        <image v-if="userStore && userStore.userInfo && userStore.userInfo.avatar"
81
-               :src="userStore.userInfo.avatar"
82
-               mode="widthFix"
83
-               class="w-9 h-9 rounded-full"
84
-        />
85
-        <image
86
-            v-else
87
-            src="https://app.bjtdba.com/uploads/logo.jpg"
88
-            mode="widthFix"
89
-            class="w-9 h-9 rounded-full"
90
-        />
78
+      <div @click="handleClick" class="flex gap-2 mb-2 pl-2 flex-1">
79
+        <image v-if="userStore && userStore.userInfo && userStore.userInfo.avatar" :src="userStore.userInfo.avatar"
80
+          mode="widthFix" class="w-9 h-9 rounded-full" />
81
+        <image v-else src="https://app.bjtdba.com/uploads/logo.jpg" mode="widthFix" class="w-9 h-9 rounded-full" />
91
         <div class="flex flex-col ">
82
         <div class="flex flex-col ">
92
-          <div class="text-sm" v-if="userStore.userInfo && userStore.userInfo.nickname">{{ userStore.userInfo.nickname ? userStore.userInfo.nickname : '登录'}}</div>
83
+          <div class="text-sm" v-if="userStore.userInfo && userStore.userInfo.nickname">{{ userStore.userInfo.nickname ?
84
+            userStore.userInfo.nickname : '登录' }}</div>
93
           <div class="text-sm" v-else>登录</div>
85
           <div class="text-sm" v-else>登录</div>
94
           <div class="text-xs" v-if="!isNaN(yanglaojin) && userStore.userInfo">{{ yanglaojin }}元养老金</div>
86
           <div class="text-xs" v-if="!isNaN(yanglaojin) && userStore.userInfo">{{ yanglaojin }}元养老金</div>
95
           <div v-else class="text-xs">
87
           <div v-else class="text-xs">
@@ -98,7 +90,8 @@ function handleShowMessage() {
98
         </div>
90
         </div>
99
 
91
 
100
       </div>
92
       </div>
101
-      <div class=" right-26 flex flex-col text-[10px] justify-center items-center " @tap.stop="handleShowMessage" :style="{marginRight: `${menuButtonInfo.width + 15}px`}">
93
+      <div class=" right-26 flex flex-col text-[10px] justify-center items-center " @tap.stop="handleShowMessage"
94
+        :style="{ marginRight: `${menuButtonInfo.width + 15}px` }">
102
         <image src="/static/icon/message-dark.png" mode="widthFix" class="w-4 h-4" v-if="exClass"></image>
95
         <image src="/static/icon/message-dark.png" mode="widthFix" class="w-4 h-4" v-if="exClass"></image>
103
         <image src="/static/icon/message.png" mode="widthFix" class="w-4 h-4" v-else></image>
96
         <image src="/static/icon/message.png" mode="widthFix" class="w-4 h-4" v-else></image>
104
         <div>消息</div>
97
         <div>消息</div>
@@ -106,10 +99,36 @@ function handleShowMessage() {
106
 
99
 
107
 
100
 
108
     </div>
101
     </div>
109
-    <div class="">
110
-      <FSearch />
102
+    <div class="p_3">
103
+      <!-- 搜索 -->
104
+      <div @click="handleClickser"
105
+        class="w-full bg-white rounded-full flex flex-row justify-between items-center border-solid border-1 border-red h-8">
106
+
107
+        <image src="https://cdn.bjtdba.com/vod/image/2023-02-15/20230215112840149.png" mode="widthFix"
108
+          class="w-5 h-5  pl-2 py-1"></image>
109
+        <div class="flex flex-1 w-100%">
110
+          <div class="flex-1 guand ">输入商品关键字</div>
111
+          <div class="bg-[#D71608] text-white text-xs w-11 rounded-full text-center p-1.5  mr-0.5 ">
112
+            搜索
113
+          </div>
114
+        </div>
115
+
116
+
117
+      </div>
111
 
118
 
112
     </div>
119
     </div>
113
 
120
 
114
   </div>
121
   </div>
115
 </template>
122
 </template>
123
+<style  scoped>
124
+.p_3 {
125
+  padding-left: 24rpx;
126
+  padding-right: 24rpx;
127
+}
128
+
129
+.guand {
130
+  padding-left: 10rpx;
131
+  line-height: 56rpx;
132
+  color: #9ca3af
133
+}
134
+</style>

+ 66 - 22
src/pages/store/product/detail.vue

@@ -95,6 +95,8 @@ uni.showShareMenu({
95
   menus: ['shareAppMessage', 'shareTimeline']
95
   menus: ['shareAppMessage', 'shareTimeline']
96
 })
96
 })
97
 onLoad((option: any) => {
97
 onLoad((option: any) => {
98
+  console.log("我是商品详情页");
99
+
98
   uni.showLoading({
100
   uni.showLoading({
99
     title: '数据加载中',
101
     title: '数据加载中',
100
     icon: 'none'
102
     icon: 'none'
@@ -170,7 +172,7 @@ function loadProductDetail() {
170
     }
172
     }
171
 
173
 
172
   }).catch(error => {
174
   }).catch(error => {
173
-    // console.log(error)
175
+    console.log(error)
174
     uni.showToast({
176
     uni.showToast({
175
       icon: "none",
177
       icon: "none",
176
       title: error
178
       title: error
@@ -253,7 +255,6 @@ function loadCartCount() {
253
       //     url: '/pages/user/login/index?key=4'
255
       //     url: '/pages/user/login/index?key=4'
254
       //   })
256
       //   })
255
       // }, 500)
257
       // }, 500)
256
-
257
     }
258
     }
258
   })
259
   })
259
 }
260
 }
@@ -369,10 +370,23 @@ function handleCreateShopping() {
369
     //       })
370
     //       })
370
     // }
371
     // }
371
     console.log('我是error>>>', error);
372
     console.log('我是error>>>', error);
372
-    uni.showToast({
373
-      title: error,
374
-      icon: 'none'
375
-    })
373
+
374
+    if (error === '请登录') {
375
+      uni.showToast({
376
+        title: '请登录',
377
+        icon: 'none'
378
+      })
379
+      setTimeout(() => {
380
+        uni.navigateTo({
381
+          url: '/pages/user/login/index'
382
+        })
383
+      }, 500)
384
+    } else {
385
+      uni.showToast({
386
+        title: error,
387
+        icon: 'none'
388
+      })
389
+    }
376
 
390
 
377
   })
391
   })
378
 }
392
 }
@@ -410,10 +424,24 @@ function handleBuyshow() {
410
     //   })
424
     //   })
411
     // }
425
     // }
412
     console.log('我是error>>>', error);
426
     console.log('我是error>>>', error);
413
-    uni.showToast({
414
-      title: error,
415
-      icon: 'none'
416
-    })
427
+
428
+    if (error === '请登录') {
429
+      uni.showToast({
430
+        title: '请登录',
431
+        icon: 'none'
432
+      })
433
+      setTimeout(() => {
434
+        uni.navigateTo({
435
+          url: '/pages/user/login/index'
436
+        })
437
+      }, 500)
438
+    } else {
439
+      uni.showToast({
440
+        title: error,
441
+        icon: 'none'
442
+      })
443
+    }
444
+
417
   })
445
   })
418
 }
446
 }
419
 function handleAddshow() {
447
 function handleAddshow() {
@@ -457,10 +485,22 @@ function handleAddshow() {
457
     //   })
485
     //   })
458
     // }
486
     // }
459
     console.log('我是error>>>', error);
487
     console.log('我是error>>>', error);
460
-    uni.showToast({
461
-      title: error,
462
-      icon: 'none'
463
-    })
488
+    if (error === '请登录') {
489
+      uni.showToast({
490
+        title: '请登录',
491
+        icon: 'none'
492
+      })
493
+      setTimeout(() => {
494
+        uni.navigateTo({
495
+          url: '/pages/user/login/index'
496
+        })
497
+      }, 500)
498
+    } else {
499
+      uni.showToast({
500
+        title: error,
501
+        icon: 'none'
502
+      })
503
+    }
464
   })
504
   })
465
 }
505
 }
466
 // 规格显示双按钮
506
 // 规格显示双按钮
@@ -682,20 +722,24 @@ onPageScroll((page) => {
682
             原价 ¥ {{ detail.ot_price }}
722
             原价 ¥ {{ detail.ot_price }}
683
           </div>
723
           </div>
684
         </div>
724
         </div>
685
-        <div v-if="!is148Merchant"
686
-          class="border border-solid border-1 border-red rounded flex text-xs items-center text-[#FE0032] w-fit">
687
-          <image src="https://cdn.bjtdba.com/vod/image/2023-09-15/20230915160858609.png" mode="widthFix" class="!w-8 h-4">
688
-          </image>
689
-          <div class="px-2 flex items-center jusitify-center" v-if="detail.yanglao">
690
-            <div>
691
-              养老金 ¥{{ detail.yanglao }}
725
+        <div v-if="detail.type != 15">
726
+          <div v-if="!is148Merchant"
727
+            class="border border-solid border-1 border-red rounded flex text-xs items-center text-[#FE0032] w-fit">
728
+            <image src="https://cdn.bjtdba.com/vod/image/2023-09-15/20230915160858609.png" mode="widthFix"
729
+              class="!w-8 h-4">
730
+            </image>
731
+            <div class="px-2 flex items-center jusitify-center" v-if="detail.yanglao">
732
+              <div>
733
+                养老金 ¥{{ detail.yanglao }}
734
+              </div>
692
             </div>
735
             </div>
693
           </div>
736
           </div>
694
         </div>
737
         </div>
695
 
738
 
739
+
696
         <div class="flex flex-col gap-2">
740
         <div class="flex flex-col gap-2">
697
           <div class="flex font-bold flex items-center gap-1" v-if="detail && detail.store_name">
741
           <div class="flex font-bold flex items-center gap-1" v-if="detail && detail.store_name">
698
-            <div class="flex bg-primary text-white rounded text-[10px] text-center">
742
+            <div class="flex bg-primary text-white rounded text-[10px] text-center" v-if="detail.type == 5">
699
               <div class=" h-4 w-4 ">仓</div>
743
               <div class=" h-4 w-4 ">仓</div>
700
             </div>
744
             </div>
701
             <div class=" justify-center items-center" v-html="detail.store_name">
745
             <div class=" justify-center items-center" v-html="detail.store_name">

+ 67 - 23
src/pages/vip/index.vue

@@ -4,14 +4,14 @@
4
   <div class="flex flex-col gap-3 ">
4
   <div class="flex flex-col gap-3 ">
5
     <div style="height: 80rpx;">
5
     <div style="height: 80rpx;">
6
       <div style="background-color: transparent  " class="overflow-hidden fixed top-0 w-full z-10">
6
       <div style="background-color: transparent  " class="overflow-hidden fixed top-0 w-full z-10">
7
-        <nut-searchbar v-model="state.keyword" @search="loadList('reload')" @clear="loadList('reload')">
7
+        <nut-searchbar v-model="state.keyword" @search="searchkwd" @clear="clearSearch">
8
           <!--      <template v-slot:leftout>-->
8
           <!--      <template v-slot:leftout>-->
9
           <!--        <div @tap="navBack">-->
9
           <!--        <div @tap="navBack">-->
10
           <!--          <nut-icon name="left"></nut-icon>-->
10
           <!--          <nut-icon name="left"></nut-icon>-->
11
           <!--        </div>-->
11
           <!--        </div>-->
12
           <!--      </template>-->
12
           <!--      </template>-->
13
           <template v-slot:rightout>
13
           <template v-slot:rightout>
14
-            <div @tap="loadList('reload')">
14
+            <div @tap="searchkwd">
15
               搜索
15
               搜索
16
             </div>
16
             </div>
17
           </template>
17
           </template>
@@ -23,6 +23,7 @@
23
     <!--      <image :src="homeBanner" mode="widthFix" class="h-10 w-full "></image>-->
23
     <!--      <image :src="homeBanner" mode="widthFix" class="h-10 w-full "></image>-->
24
 
24
 
25
     <div class="w-screen h-45">
25
     <div class="w-screen h-45">
26
+      <CXBBackTop :Scroll_X="Scroll_X" :isCss="1" />
26
       <swiper v-if="state.banners" :indicator-dots="state.indicatorDots" indicator-active-color="#e93323"
27
       <swiper v-if="state.banners" :indicator-dots="state.indicatorDots" indicator-active-color="#e93323"
27
         :autoplay="state.autoplay" :circular="state.circular" :interval="state.interval" :duration="state.duration"
28
         :autoplay="state.autoplay" :circular="state.circular" :interval="state.interval" :duration="state.duration"
28
         class="w-full h-full">
29
         class="w-full h-full">
@@ -97,6 +98,7 @@
97
 import CXBBasePage from "~/components/CXBBasePage/CXBBasePage.vue";
98
 import CXBBasePage from "~/components/CXBBasePage/CXBBasePage.vue";
98
 import FSearch from "~/components/FSearch/FSearch.vue";
99
 import FSearch from "~/components/FSearch/FSearch.vue";
99
 import { computed } from "vue";
100
 import { computed } from "vue";
101
+import type CXBBackTop from "~/components/CXBBackTop/CXBBackTop.vue";
100
 import { getVipAreaList } from "~/apis/merchant";
102
 import { getVipAreaList } from "~/apis/merchant";
101
 import { CDN_URL } from "~/config/app";
103
 import { CDN_URL } from "~/config/app";
102
 import CXBEmpty from "~/components/CXBEmpty/CXBEmpty.vue";
104
 import CXBEmpty from "~/components/CXBEmpty/CXBEmpty.vue";
@@ -135,6 +137,8 @@ const list = ref([])
135
 const count = ref()
137
 const count = ref()
136
 
138
 
137
 onLoad((option) => {
139
 onLoad((option) => {
140
+  console.log(option.shareId);
141
+
138
   if (option && option.shareId) {
142
   if (option && option.shareId) {
139
     userStore.setShareId(option.shareId)
143
     userStore.setShareId(option.shareId)
140
   }
144
   }
@@ -143,12 +147,17 @@ onLoad((option) => {
143
       userStore.setShareId(res.share_id)
147
       userStore.setShareId(res.share_id)
144
     }
148
     }
145
   }).catch(message => {
149
   }).catch(message => {
146
-    // console.log(message)
150
+    console.log(message)
151
+    // if (message == '请登录') {
152
+    //   uni.navigateTo({
153
+    //     url: '/pages/user/login/index'
154
+    //   })
155
+    // }
147
   })
156
   })
148
   userStore.setRedirectPage(`/pages/vip/index`, 'page')
157
   userStore.setRedirectPage(`/pages/vip/index`, 'page')
149
 
158
 
150
   getHomeBanner("user_banner").then(res => {
159
   getHomeBanner("user_banner").then(res => {
151
-    console.log(res)
160
+    console.log("user_banner", res)
152
     state.banners = res
161
     state.banners = res
153
   })
162
   })
154
   loadList('reload')
163
   loadList('reload')
@@ -156,6 +165,20 @@ onLoad((option) => {
156
 
165
 
157
 })
166
 })
158
 
167
 
168
+//搜索全部筛选
169
+function searchkwd() {
170
+  if (!state.keyword) {
171
+    return uni.showToast({
172
+      title: '请输入搜索关键字',
173
+      icon: 'none'
174
+    })
175
+  }
176
+  state.currentPage = 1
177
+  state.pageSize = 10
178
+  state.pageSize = state.count
179
+  console.log("1111111111", state.currentPage, state.pageSize);
180
+  loadList('reload')
181
+}
159
 
182
 
160
 onShareAppMessage(() => {
183
 onShareAppMessage(() => {
161
   const shareId = Cache.get('SHARE_ID')
184
   const shareId = Cache.get('SHARE_ID')
@@ -191,14 +214,12 @@ function loadList(action: 'page' | 'reload', callback?: (items) => void) {
191
   if (state.keyword) {
214
   if (state.keyword) {
192
     params.keyword = state.keyword
215
     params.keyword = state.keyword
193
   }
216
   }
194
-  console.log(params)
217
+  console.log('我是params', params)
195
 
218
 
196
   getVipAreaList({
219
   getVipAreaList({
197
-    // page: state.currentPage,
198
-    // limit: state.pageSize
199
     ...params
220
     ...params
200
   }).then(res => {
221
   }).then(res => {
201
-    // console.log(res.count)
222
+    console.log(res.count)
202
     // console.log(res.list)
223
     // console.log(res.list)
203
     count.value = res.count
224
     count.value = res.count
204
     console.log(action);
225
     console.log(action);
@@ -208,11 +229,12 @@ function loadList(action: 'page' | 'reload', callback?: (items) => void) {
208
     if (action === 'reload') {
229
     if (action === 'reload') {
209
       list.value = res.list
230
       list.value = res.list
210
     }
231
     }
211
-    if(callback){
232
+    if (callback) {
212
       callback(res)
233
       callback(res)
213
     }
234
     }
214
   })
235
   })
215
 }
236
 }
237
+
216
 function handleItemClick(item) {
238
 function handleItemClick(item) {
217
   uni.navigateTo({
239
   uni.navigateTo({
218
     url: `/pages/store/product/detail?id=${item.product_id}`
240
     url: `/pages/store/product/detail?id=${item.product_id}`
@@ -222,16 +244,6 @@ function handleItemClick(item) {
222
 function handleScrollToLower() {
244
 function handleScrollToLower() {
223
   state.status = 'loading';
245
   state.status = 'loading';
224
   state.currentPage += 1;
246
   state.currentPage += 1;
225
-  // console.log(state.currentPage)
226
-  // console.log(state.totalPage)
227
-  // if (count.value > (state.currentPage*state.pageSize)) {
228
-  //   loadList('page')
229
-  // } else {
230
-  //   state.status = 'noMore';
231
-  //   setTimeout(() => {
232
-  //     loadList('page')
233
-  //   }, 300)
234
-  // }
235
   loadList('page', (items) => {
247
   loadList('page', (items) => {
236
     console.log('items', items);
248
     console.log('items', items);
237
     if (!items.length > 0) {
249
     if (!items.length > 0) {
@@ -246,13 +258,45 @@ onReachBottom(() => {
246
   handleScrollToLower()
258
   handleScrollToLower()
247
 })
259
 })
248
 
260
 
261
+//关闭搜索重新加载页面
262
+function clearSearch() {
263
+  console.log(222);
264
+  uni.showLoading()
265
+  state.currentPage = 1
266
+  state.pageSize = 10
267
+  loadList('reload', (items) => {
268
+    uni.hideLoading()
269
+    // uni.stopPullDownRefresh()
270
+  })
271
+
272
+}
273
+
249
 onPullDownRefresh(() => {
274
 onPullDownRefresh(() => {
250
-  loadList('reload', items => {
251
-    setTimeout(() => {
252
-      uni.stopPullDownRefresh()
253
-    }, 300)
275
+  console.log(111);
276
+  uni.showLoading()
277
+  state.currentPage = 1
278
+  state.pageSize = 10
279
+  loadList('reload', (items) => {
280
+    uni.hideLoading()
281
+    uni.stopPullDownRefresh()
254
   })
282
   })
255
 })
283
 })
284
+
285
+
286
+// 距离顶部距离
287
+let Scroll_X = ref(0)
288
+const headerClass = ref('')
289
+onPageScroll((page) => {
290
+  Scroll_X.value = Number(page.scrollTop.toFixed())
291
+  // page.scrollTop
292
+  if (page.scrollTop >= 76) {
293
+    headerClass.value = '!bg-primary !text-white'
294
+  } else {
295
+    headerClass.value = ''
296
+  }
297
+})
298
+
299
+
256
 </script>
300
 </script>
257
 
301
 
258
 <route lang="yaml">
302
 <route lang="yaml">