Browse Source

banner修复

dxz1228 2 years ago
parent
commit
397ee4adf5

+ 1 - 0
src/apis/model/dacang.model.ts

@@ -17,6 +17,7 @@ export interface QueryDcHomeParams {
17
 }
17
 }
18
 // 大仓商品
18
 // 大仓商品
19
 export type DcProductModel = {
19
 export type DcProductModel = {
20
+     banner:string
20
      product_id: string
21
      product_id: string
21
      mer_id: string
22
      mer_id: string
22
      image: string//图片
23
      image: string//图片

+ 12 - 1
src/apis/product.ts

@@ -68,9 +68,20 @@ enum API {
68
     // 抖音商品列表搜索
68
     // 抖音商品列表搜索
69
     DY_SEARCH = '/api/dy/get_search',
69
     DY_SEARCH = '/api/dy/get_search',
70
     // 抖音商品详情
70
     // 抖音商品详情
71
-    DY_DETAIL = '/api/dy/get_detail'
71
+    DY_DETAIL = '/api/dy/get_detail',
72
+    //大仓banner展示图片
73
+    DC_BANNER='/api/newhome/nologin/banner/da_cang'
72
 }
74
 }
73
 
75
 
76
+
77
+/**获取大仓banner展示图片 */
78
+export function getBannerImg (){
79
+    return defHttp.get({
80
+        url:API.DC_BANNER
81
+    })
82
+}
83
+
84
+
74
 /**
85
 /**
75
  * 获取分享ID
86
  * 获取分享ID
76
  * @param params
87
  * @param params

+ 2 - 2
src/config/app.ts

@@ -5,8 +5,8 @@ let VUE_APP_WS_URL = `ws://${location.hostname}?type=user`
5
 // 网络接口修改此字符 小程序域名要求https
5
 // 网络接口修改此字符 小程序域名要求https
6
 
6
 
7
 // let httpApi = 'https://mer1.crmeb.net'
7
 // let httpApi = 'https://mer1.crmeb.net'
8
-// let httpApi = 'https://test.bjtdba.com'
9
-let httpApi = 'https://app.bjtdba.com'
8
+let httpApi = 'https://test.bjtdba.com'
9
+// let httpApi = 'https://app.bjtdba.com'
10
 // let httpApi = 'https://test.bjtdba.com'
10
 // let httpApi = 'https://test.bjtdba.com'
11
 
11
 
12
 // let httpApi = 'http://192.168.1.77:8324'
12
 // let httpApi = 'http://192.168.1.77:8324'

+ 32 - 27
src/pages/dacang/list/index.vue

@@ -1,29 +1,30 @@
1
 <script lang="ts" setup>
1
 <script lang="ts" setup>
2
 import FNavBar from "~/components/FNavBar/FNavBar.vue";
2
 import FNavBar from "~/components/FNavBar/FNavBar.vue";
3
-import {getDcProductClassify, getDcProductList} from "~/apis/dacang";
3
+import { getDcProductClassify, getDcProductList } from "~/apis/dacang";
4
 import FTabs from "~/components/FTabs/FTabs.vue";
4
 import FTabs from "~/components/FTabs/FTabs.vue";
5
 import ProductList from "~/components/ProductList/ProductList.vue";
5
 import ProductList from "~/components/ProductList/ProductList.vue";
6
-import type {DcProductModel} from "~/apis/model/dacang.model";
7
-import {useDacangStore} from "~/stores/dacangStore";
8
-import {CDN_URL} from "~/config/app";
6
+import type { DcProductModel } from "~/apis/model/dacang.model";
7
+import { useDacangStore } from "~/stores/dacangStore";
8
+import { CDN_URL } from "~/config/app";
9
 import DacangHeader from "~/pages/dacang/list/components/dacang-header.vue";
9
 import DacangHeader from "~/pages/dacang/list/components/dacang-header.vue";
10
 import CXBBackTop from "~/components/CXBBackTop/CXBBackTop.vue";
10
 import CXBBackTop from "~/components/CXBBackTop/CXBBackTop.vue";
11
-import {getProductShare} from "~/apis/common";
12
-import {useUserStore} from "~/stores/userStore";
11
+import { getProductShare } from "~/apis/common";
12
+import { useUserStore } from "~/stores/userStore";
13
 import Cache from "~/utils/cache";
13
 import Cache from "~/utils/cache";
14
-const headerImage = CDN_URL + `/static/assets/banner-dacang.png`
14
+import { getBannerImg } from '~/apis/product'
15
+import Banner from "./components/banner.vue";
16
+
17
+
15
 const usePageStore = usePageStoreWidthOut()
18
 const usePageStore = usePageStoreWidthOut()
16
 
19
 
17
 
20
 
18
 const state = reactive({
21
 const state = reactive({
19
-  tabs: [{store_category_id: '-1', cate_name: '全部'}],
22
+  tabs: [{ store_category_id: '-1', cate_name: '全部' }],
20
   productList: <Array<DcProductModel>>[],
23
   productList: <Array<DcProductModel>>[],
21
-
22
   currentClassify: '',
24
   currentClassify: '',
23
   keyword: '',
25
   keyword: '',
24
-
25
   status: 'noMore',
26
   status: 'noMore',
26
-
27
+  banner:'',
27
   currentPage: 1,
28
   currentPage: 1,
28
   pageSize: 10,
29
   pageSize: 10,
29
   totalPage: 1
30
   totalPage: 1
@@ -35,14 +36,16 @@ let Scroll_X = ref(0)
35
 const dacangStore = useDacangStore()
36
 const dacangStore = useDacangStore()
36
 const userStore = useUserStore()
37
 const userStore = useUserStore()
37
 
38
 
39
+
38
 onLoad(async (option) => {
40
 onLoad(async (option) => {
39
-  state.tabs = [{store_category_id: '-1', cate_name: '全部'}]
41
+  state.tabs = [{ store_category_id: '-1', cate_name: '全部' }]
40
   const classifyRes = await getDcProductClassify()
42
   const classifyRes = await getDcProductClassify()
43
+
41
   state.tabs.push(...classifyRes)
44
   state.tabs.push(...classifyRes)
42
   usePageStore.setPageConfig({
45
   usePageStore.setPageConfig({
43
     currentPage: {
46
     currentPage: {
44
       type: 'tab',
47
       type: 'tab',
45
-      url:  '/pages/dacang/list/index'
48
+      url: '/pages/dacang/list/index'
46
     }
49
     }
47
   })
50
   })
48
 
51
 
@@ -57,7 +60,12 @@ onLoad(async (option) => {
57
     // console.log(message)
60
     // console.log(message)
58
   })
61
   })
59
   userStore.setRedirectPage(`/pages/dacang/list/index`, 'tab')
62
   userStore.setRedirectPage(`/pages/dacang/list/index`, 'tab')
60
-
63
+  getBannerImg().then(res=>{
64
+    console.log('banner',res);
65
+    state.banner=res[0].pic
66
+    console.log(state.banner);
67
+    
68
+  })
61
 
69
 
62
 })
70
 })
63
 
71
 
@@ -85,26 +93,25 @@ onShow(async (options) => {
85
   usePageStore.setPageConfig({
93
   usePageStore.setPageConfig({
86
     currentPage: {
94
     currentPage: {
87
       type: 'tab',
95
       type: 'tab',
88
-      url:  '/pages/dacang/list/index'
96
+      url: '/pages/dacang/list/index'
89
     }
97
     }
90
   })
98
   })
91
   loadList('reload')
99
   loadList('reload')
92
 })
100
 })
93
 
101
 
94
 function loadList(action: 'page' | 'reload', callback?: (items) => void) {
102
 function loadList(action: 'page' | 'reload', callback?: (items) => void) {
95
-
103
+  console.log(action);
96
   let params: any = {
104
   let params: any = {
97
     page: state.currentPage,
105
     page: state.currentPage,
98
     limit: state.pageSize,
106
     limit: state.pageSize,
99
     keyword: state.keyword
107
     keyword: state.keyword
100
   }
108
   }
109
+  console.log(params);
101
   if (dacangStore.currentClassify !== '-1') {
110
   if (dacangStore.currentClassify !== '-1') {
102
     params.classify = dacangStore.currentClassify
111
     params.classify = dacangStore.currentClassify
103
   }
112
   }
104
 
113
 
105
-  if (action === 'reload') {
106
-    params.page = 1
107
-  }
114
+
108
 
115
 
109
   getDcProductList({
116
   getDcProductList({
110
     ...params
117
     ...params
@@ -136,7 +143,7 @@ const headerClass = ref('')
136
 onPageScroll((page) => {
143
 onPageScroll((page) => {
137
   Scroll_X.value = Number(page.scrollTop.toFixed())
144
   Scroll_X.value = Number(page.scrollTop.toFixed())
138
   // page.scrollTop
145
   // page.scrollTop
139
-  if (page.scrollTop >= 76 ) {
146
+  if (page.scrollTop >= 76) {
140
     headerClass.value = '!bg-primary !text-white'
147
     headerClass.value = '!bg-primary !text-white'
141
   } else {
148
   } else {
142
     headerClass.value = ''
149
     headerClass.value = ''
@@ -150,7 +157,7 @@ onReachBottom(() => {
150
   state.currentPage += 1
157
   state.currentPage += 1
151
   loadList('page', (items) => {
158
   loadList('page', (items) => {
152
     uni.hideLoading()
159
     uni.hideLoading()
153
-    // console.log(items)
160
+    console.log(items)
154
     if (!items.length > 0) {
161
     if (!items.length > 0) {
155
       // console.log('没有更多了')
162
       // console.log('没有更多了')
156
       state.status = 'noMore'
163
       state.status = 'noMore'
@@ -169,12 +176,12 @@ onPullDownRefresh(() => {
169
 </script>
176
 </script>
170
 <template>
177
 <template>
171
   <div class="h-screen">
178
   <div class="h-screen">
172
-    <DacangHeader :ex-class="headerClass" :tabs="state.tabs" @click:item="handleTabItemClick"/>
179
+    <DacangHeader :ex-class="headerClass" :tabs="state.tabs" @click:item="handleTabItemClick" />
173
 
180
 
174
     <div class="flex flex-col gap-2 ">
181
     <div class="flex flex-col gap-2 ">
175
-      <CXBBackTop :Scroll_X="Scroll_X"/>
176
-      <image :src="headerImage" mode="widthFix" class="w-full h-50"></image>
177
-    <ProductList :list="state.productList" />
182
+      <CXBBackTop :Scroll_X="Scroll_X" :isCss="1" />
183
+      <image lazy-load :src="state.banner" mode="widthFix" class="w-full h-50"></image>
184
+      <ProductList :list="state.productList" />
178
       <div class="pb-safe flex justify-center items-center text-[12px] text-gray-500" v-if="state.productList.length > 0">
185
       <div class="pb-safe flex justify-center items-center text-[12px] text-gray-500" v-if="state.productList.length > 0">
179
         <div v-if="state.status === 'loading'">
186
         <div v-if="state.status === 'loading'">
180
           加载中...
187
           加载中...
@@ -195,8 +202,6 @@ page {
195
 .nut-tab-pane {
202
 .nut-tab-pane {
196
   display: none !important;
203
   display: none !important;
197
 }
204
 }
198
-
199
-
200
 </style>
205
 </style>
201
 <route lang="yaml" >
206
 <route lang="yaml" >
202
 style:
207
 style:

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

@@ -102,8 +102,8 @@ function handleConfirm() {
102
       OrderLists: state.orderList,
102
       OrderLists: state.orderList,
103
       type: 'tdbaspzf'
103
       type: 'tdbaspzf'
104
     },
104
     },
105
-    // envVersion: 'trial', // develop(开发版),trial(体验版),release(正式版)
106
-    envVersion: 'release', // develop(开发版),trial(体验版),release(正式版)
105
+    envVersion: 'trial', // develop(开发版),trial(体验版),release(正式版)
106
+    // envVersion: 'release', // develop(开发版),trial(体验版),release(正式版)
107
     success(res) {
107
     success(res) {
108
       // 打开成功
108
       // 打开成功
109
       uni.showToast({
109
       uni.showToast({

+ 55 - 35
src/pages/vip/index.vue

@@ -2,27 +2,27 @@
2
   <!--  <CXBBasePage :show="true" title="">-->
2
   <!--  <CXBBasePage :show="true" title="">-->
3
 
3
 
4
   <div class="flex flex-col gap-3 ">
4
   <div class="flex flex-col gap-3 ">
5
-    <div style="height: 80rpx;" >
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')">
8
-        <!--      <template v-slot:leftout>-->
9
-        <!--        <div @tap="navBack">-->
10
-        <!--          <nut-icon name="left"></nut-icon>-->
11
-        <!--        </div>-->
12
-        <!--      </template>-->
13
-        <template v-slot:rightout>
14
-          <div @tap="loadList('reload')">
15
-            搜索
16
-          </div>
17
-        </template>
18
-      </nut-searchbar>
19
-    </div>
5
+    <div style="height: 80rpx;">
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')">
8
+          <!--      <template v-slot:leftout>-->
9
+          <!--        <div @tap="navBack">-->
10
+          <!--          <nut-icon name="left"></nut-icon>-->
11
+          <!--        </div>-->
12
+          <!--      </template>-->
13
+          <template v-slot:rightout>
14
+            <div @tap="loadList('reload')">
15
+              搜索
16
+            </div>
17
+          </template>
18
+        </nut-searchbar>
19
+      </div>
20
     </div>
20
     </div>
21
-   
22
-    
21
+
22
+
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
       <swiper v-if="state.banners" :indicator-dots="state.indicatorDots" indicator-active-color="#e93323"
26
       <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"
27
         :autoplay="state.autoplay" :circular="state.circular" :interval="state.interval" :duration="state.duration"
28
         class="w-full h-full">
28
         class="w-full h-full">
@@ -45,10 +45,11 @@
45
               <div class="line-clamp-1">
45
               <div class="line-clamp-1">
46
                 {{ item.store_name }}
46
                 {{ item.store_name }}
47
               </div>
47
               </div>
48
-              <div  v-if="item.type!=15" class="border border-solid border-1 border-red rounded flex text-xs items-center text-[#FE0032] w-fit">
48
+              <div v-if="item.type != 15"
49
+                class="border border-solid border-1 border-red rounded flex text-xs items-center text-[#FE0032] w-fit">
49
                 <image src="https://cdn.bjtdba.com/vod/image/2023-09-15/20230915160858609.png" mode="widthFix"
50
                 <image src="https://cdn.bjtdba.com/vod/image/2023-09-15/20230915160858609.png" mode="widthFix"
50
                   class="!w-8 "></image>
51
                   class="!w-8 "></image>
51
-                <div  class="px-2 flex items-center jusitify-center">
52
+                <div class="px-2 flex items-center jusitify-center">
52
                   <div>
53
                   <div>
53
                     养老金 ¥{{ item.yanglao }}
54
                     养老金 ¥{{ item.yanglao }}
54
                   </div>
55
                   </div>
@@ -120,7 +121,7 @@ const state = reactive({
120
   pageSize: 10,
121
   pageSize: 10,
121
   totalPage: 1,
122
   totalPage: 1,
122
   banners: [],
123
   banners: [],
123
-
124
+  count: 0,
124
   keyword: '',
125
   keyword: '',
125
   status: 'noMore',
126
   status: 'noMore',
126
   indicatorDots: true,
127
   indicatorDots: true,
@@ -130,7 +131,8 @@ const state = reactive({
130
   duration: 500,
131
   duration: 500,
131
   currents: "0",
132
   currents: "0",
132
 })
133
 })
133
-const list = ref()
134
+const list = ref([])
135
+const count = ref()
134
 
136
 
135
 onLoad((option) => {
137
 onLoad((option) => {
136
   if (option && option.shareId) {
138
   if (option && option.shareId) {
@@ -179,6 +181,8 @@ onShareTimeline(() => {
179
 
181
 
180
 
182
 
181
 function loadList(action: 'page' | 'reload', callback?: (items) => void) {
183
 function loadList(action: 'page' | 'reload', callback?: (items) => void) {
184
+
185
+
182
   // console.log(state.keyword)
186
   // console.log(state.keyword)
183
   const params = {
187
   const params = {
184
     page: state.currentPage,
188
     page: state.currentPage,
@@ -188,16 +192,25 @@ function loadList(action: 'page' | 'reload', callback?: (items) => void) {
188
     params.keyword = state.keyword
192
     params.keyword = state.keyword
189
   }
193
   }
190
   console.log(params)
194
   console.log(params)
195
+
191
   getVipAreaList({
196
   getVipAreaList({
192
     // page: state.currentPage,
197
     // page: state.currentPage,
193
     // limit: state.pageSize
198
     // limit: state.pageSize
194
     ...params
199
     ...params
195
   }).then(res => {
200
   }).then(res => {
201
+    // console.log(res.count)
196
     // console.log(res.list)
202
     // console.log(res.list)
197
-    console.log(res.list)
198
-    if (res) {
203
+    count.value = res.count
204
+    console.log(action);
205
+    if (action === 'page') {
206
+      list.value = list.value.concat(res.list)
207
+    }
208
+    if (action === 'reload') {
199
       list.value = res.list
209
       list.value = res.list
200
     }
210
     }
211
+    if(callback){
212
+      callback(res)
213
+    }
201
   })
214
   })
202
 }
215
 }
203
 function handleItemClick(item) {
216
 function handleItemClick(item) {
@@ -209,21 +222,28 @@ function handleItemClick(item) {
209
 function handleScrollToLower() {
222
 function handleScrollToLower() {
210
   state.status = 'loading';
223
   state.status = 'loading';
211
   state.currentPage += 1;
224
   state.currentPage += 1;
212
-  console.log(state.totalPage)
213
-  if (state.currentPage > state.totalPage) {
214
-    state.status = 'noMore';
215
-  } else {
216
-    setTimeout(() => {
217
-      loadList('page')
218
-    }, 300)
219
-  }
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) => {
236
+    console.log('items', items);
237
+    if (!items.length > 0) {
238
+      // console.log('没有更多了')
239
+      state.status = 'noMore'
240
+    }
241
+  })
220
 }
242
 }
221
 
243
 
222
 onReachBottom(() => {
244
 onReachBottom(() => {
223
-  console.log('到底了。。。')
224
-
245
+  // console.log('到底了。。。')
225
   handleScrollToLower()
246
   handleScrollToLower()
226
-
227
 })
247
 })
228
 
248
 
229
 onPullDownRefresh(() => {
249
 onPullDownRefresh(() => {

+ 1 - 1
src/stores/userStore.ts

@@ -27,7 +27,7 @@ export const useUserStore = defineStore('userStore', {
27
         yanglao: 0,
27
         yanglao: 0,
28
         shareId: null,
28
         shareId: null,
29
         redirectPage: null,
29
         redirectPage: null,
30
-        permissionList: null // 权限列表
30
+        permissionList: null, // 权限列表
31
     }) as UserStoreState,
31
     }) as UserStoreState,
32
     actions: {
32
     actions: {
33
         // getYanglaojinStatistics().then(res => {
33
         // getYanglaojinStatistics().then(res => {