Browse Source

会员搜索功能ok

dxz1228 2 years ago
parent
commit
ae5b39f962

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

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

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

@@ -6,7 +6,7 @@ const props = defineProps(cellProps)
6 6
 const emit = defineEmits(cellEmits)
7 7
 onLoad(
8 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 41
                  class="w-5 h-5  pl-2 py-1"
42 42
           ></image>
43 43
         <div class="flex flex-1 w-100%">
44
-          <div class="flex-1"></div>
44
+          <div class="flex-1  "></div>
45 45
           <div
46 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 53
       </div>
54 54
 
55 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 57
       userStore.setShareId(res.share_id)
58 58
     }
59 59
   }).catch(message => {
60
-    // console.log(message)
60
+    console.log(message)
61 61
   })
62 62
   userStore.setRedirectPage(`/pages/dacang/list/index`, 'tab')
63 63
   getBannerImg().then(res=>{

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

@@ -1,8 +1,8 @@
1 1
 <script lang="ts" setup>
2
-import {computed, PropType} from "vue";
2
+import { computed, PropType } from "vue";
3 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 6
 // import {useUserStore} from "~/stores/userStore";
7 7
 const userStore = useUserStore()
8 8
 
@@ -66,30 +66,22 @@ function handleShowMessage() {
66 66
     url: '/pages/message/index'
67 67
   })
68 68
 }
69
+function handleClickser() {
70
+  uni.navigateTo({
71
+    url: '/pages/search/index'
72
+  })
73
+}
69 74
 </script>
70 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 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 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 85
           <div class="text-sm" v-else>登录</div>
94 86
           <div class="text-xs" v-if="!isNaN(yanglaojin) && userStore.userInfo">{{ yanglaojin }}元养老金</div>
95 87
           <div v-else class="text-xs">
@@ -98,7 +90,8 @@ function handleShowMessage() {
98 90
         </div>
99 91
 
100 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 95
         <image src="/static/icon/message-dark.png" mode="widthFix" class="w-4 h-4" v-if="exClass"></image>
103 96
         <image src="/static/icon/message.png" mode="widthFix" class="w-4 h-4" v-else></image>
104 97
         <div>消息</div>
@@ -106,10 +99,36 @@ function handleShowMessage() {
106 99
 
107 100
 
108 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 119
     </div>
113 120
 
114 121
   </div>
115 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 95
   menus: ['shareAppMessage', 'shareTimeline']
96 96
 })
97 97
 onLoad((option: any) => {
98
+  console.log("我是商品详情页");
99
+
98 100
   uni.showLoading({
99 101
     title: '数据加载中',
100 102
     icon: 'none'
@@ -170,7 +172,7 @@ function loadProductDetail() {
170 172
     }
171 173
 
172 174
   }).catch(error => {
173
-    // console.log(error)
175
+    console.log(error)
174 176
     uni.showToast({
175 177
       icon: "none",
176 178
       title: error
@@ -253,7 +255,6 @@ function loadCartCount() {
253 255
       //     url: '/pages/user/login/index?key=4'
254 256
       //   })
255 257
       // }, 500)
256
-
257 258
     }
258 259
   })
259 260
 }
@@ -369,10 +370,23 @@ function handleCreateShopping() {
369 370
     //       })
370 371
     // }
371 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 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 447
 function handleAddshow() {
@@ -457,10 +485,22 @@ function handleAddshow() {
457 485
     //   })
458 486
     // }
459 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 722
             原价 ¥ {{ detail.ot_price }}
683 723
           </div>
684 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 735
             </div>
693 736
           </div>
694 737
         </div>
695 738
 
739
+
696 740
         <div class="flex flex-col gap-2">
697 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 743
               <div class=" h-4 w-4 ">仓</div>
700 744
             </div>
701 745
             <div class=" justify-center items-center" v-html="detail.store_name">

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

@@ -4,14 +4,14 @@
4 4
   <div class="flex flex-col gap-3 ">
5 5
     <div style="height: 80rpx;">
6 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 8
           <!--      <template v-slot:leftout>-->
9 9
           <!--        <div @tap="navBack">-->
10 10
           <!--          <nut-icon name="left"></nut-icon>-->
11 11
           <!--        </div>-->
12 12
           <!--      </template>-->
13 13
           <template v-slot:rightout>
14
-            <div @tap="loadList('reload')">
14
+            <div @tap="searchkwd">
15 15
               搜索
16 16
             </div>
17 17
           </template>
@@ -23,6 +23,7 @@
23 23
     <!--      <image :src="homeBanner" mode="widthFix" class="h-10 w-full "></image>-->
24 24
 
25 25
     <div class="w-screen h-45">
26
+      <CXBBackTop :Scroll_X="Scroll_X" :isCss="1" />
26 27
       <swiper v-if="state.banners" :indicator-dots="state.indicatorDots" indicator-active-color="#e93323"
27 28
         :autoplay="state.autoplay" :circular="state.circular" :interval="state.interval" :duration="state.duration"
28 29
         class="w-full h-full">
@@ -97,6 +98,7 @@
97 98
 import CXBBasePage from "~/components/CXBBasePage/CXBBasePage.vue";
98 99
 import FSearch from "~/components/FSearch/FSearch.vue";
99 100
 import { computed } from "vue";
101
+import type CXBBackTop from "~/components/CXBBackTop/CXBBackTop.vue";
100 102
 import { getVipAreaList } from "~/apis/merchant";
101 103
 import { CDN_URL } from "~/config/app";
102 104
 import CXBEmpty from "~/components/CXBEmpty/CXBEmpty.vue";
@@ -135,6 +137,8 @@ const list = ref([])
135 137
 const count = ref()
136 138
 
137 139
 onLoad((option) => {
140
+  console.log(option.shareId);
141
+
138 142
   if (option && option.shareId) {
139 143
     userStore.setShareId(option.shareId)
140 144
   }
@@ -143,12 +147,17 @@ onLoad((option) => {
143 147
       userStore.setShareId(res.share_id)
144 148
     }
145 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 157
   userStore.setRedirectPage(`/pages/vip/index`, 'page')
149 158
 
150 159
   getHomeBanner("user_banner").then(res => {
151
-    console.log(res)
160
+    console.log("user_banner", res)
152 161
     state.banners = res
153 162
   })
154 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 183
 onShareAppMessage(() => {
161 184
   const shareId = Cache.get('SHARE_ID')
@@ -191,14 +214,12 @@ function loadList(action: 'page' | 'reload', callback?: (items) => void) {
191 214
   if (state.keyword) {
192 215
     params.keyword = state.keyword
193 216
   }
194
-  console.log(params)
217
+  console.log('我是params', params)
195 218
 
196 219
   getVipAreaList({
197
-    // page: state.currentPage,
198
-    // limit: state.pageSize
199 220
     ...params
200 221
   }).then(res => {
201
-    // console.log(res.count)
222
+    console.log(res.count)
202 223
     // console.log(res.list)
203 224
     count.value = res.count
204 225
     console.log(action);
@@ -208,11 +229,12 @@ function loadList(action: 'page' | 'reload', callback?: (items) => void) {
208 229
     if (action === 'reload') {
209 230
       list.value = res.list
210 231
     }
211
-    if(callback){
232
+    if (callback) {
212 233
       callback(res)
213 234
     }
214 235
   })
215 236
 }
237
+
216 238
 function handleItemClick(item) {
217 239
   uni.navigateTo({
218 240
     url: `/pages/store/product/detail?id=${item.product_id}`
@@ -222,16 +244,6 @@ function handleItemClick(item) {
222 244
 function handleScrollToLower() {
223 245
   state.status = 'loading';
224 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 247
   loadList('page', (items) => {
236 248
     console.log('items', items);
237 249
     if (!items.length > 0) {
@@ -246,13 +258,45 @@ onReachBottom(() => {
246 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 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 300
 </script>
257 301
 
258 302
 <route lang="yaml">