jufubao-mall 2.0.21 → 2.0.23-beta1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (60) hide show
  1. package/package.json +1 -1
  2. package/src/components/CusProduct/CusProduct.vue +1 -1
  3. package/src/components/JfbMallBrandWall/Attr.js +10 -449
  4. package/src/components/JfbMallBrandWall/JfbMallBrandWall.vue +783 -308
  5. package/src/components/JfbMallBrandWall/cusAttr/advanced.js +61 -0
  6. package/src/components/JfbMallBrandWall/cusAttr/brand.js +341 -0
  7. package/src/components/JfbMallBrandWall/cusAttr/content.js +251 -0
  8. package/src/components/JfbMallBrandWall/cusAttr/style.js +252 -0
  9. package/src/components/JfbMallBrandWall/cusAttr/tab.js +471 -0
  10. package/src/components/JfbMallHomeProductList/JfbMallHomeProductList.vue +3 -1
  11. package/src/components/JfbMallHomeProductList/cusAttr/content.js +1 -2
  12. package/src/components/JfbMallNetworkMedia/Api.js +58 -0
  13. package/src/components/JfbMallNetworkMedia/Attr.js +20 -0
  14. package/src/components/JfbMallNetworkMedia/JfbMallNetworkMedia.vue +84 -0
  15. package/src/components/JfbMallNetworkMedia/JfbMallNetworkMediaLess.less +80 -0
  16. package/src/components/JfbMallNetworkMedia/JfbMallNetworkMediaMixin.js +30 -0
  17. package/src/components/JfbMallNetworkMedia/Mock.js +13 -0
  18. package/src/components/JfbMallNetworkMedia/cusAttr/advanced.js +60 -0
  19. package/src/components/JfbMallNetworkMedia/cusAttr/content.js +125 -0
  20. package/src/components/JfbMallNetworkMedia/cusAttr/filter.js +333 -0
  21. package/src/components/JfbMallNetworkMedia/cusAttr/font.js +114 -0
  22. package/src/components/JfbMallNetworkMedia/cusAttr/icon.js +298 -0
  23. package/src/components/{JfbMallProductList → JfbMallNetworkMedia/cusAttr}/style.js +15 -50
  24. package/src/components/JfbMallProductInfo/JfbMallProductInfo.vue +27 -23
  25. package/src/components/JfbMallProductInfo/cusAttr/content.js +1 -1
  26. package/src/components/JfbMallProductInfoV2/Api.js +1 -1
  27. package/src/components/JfbMallProductInfoV2/Attr.js +134 -41
  28. package/src/components/JfbMallProductInfoV2/JfbMallProductInfoV2.vue +136 -127
  29. package/src/components/JfbMallProductInfoV2/Mock.js +38 -10
  30. package/src/components/JfbMallProductList/Api.js +7 -7
  31. package/src/components/JfbMallProductList/Attr.js +7 -762
  32. package/src/components/JfbMallProductList/ComFilterQuery.vue +950 -0
  33. package/src/components/JfbMallProductList/JfbMallProductList.vue +807 -792
  34. package/src/components/JfbMallProductList/Mock.js +168 -255
  35. package/src/components/JfbMallProductList/XdCateV1.vue +335 -122
  36. package/src/components/JfbMallProductList/XdCateV2.vue +144 -76
  37. package/src/components/JfbMallProductList/XdQueryCommon.vue +189 -0
  38. package/src/components/JfbMallProductList/XdQueryFilter.vue +94 -76
  39. package/src/components/JfbMallProductList/XdQuerySort.vue +100 -109
  40. package/src/components/JfbMallProductList/cateMixins.js +103 -0
  41. package/src/components/JfbMallProductList/{advanced.js → cusAttr/advanced.js} +12 -4
  42. package/src/components/JfbMallProductList/cusAttr/content.js +465 -0
  43. package/src/components/JfbMallProductList/cusAttr/filter.js +333 -0
  44. package/src/components/JfbMallProductList/cusAttr/font.js +114 -0
  45. package/src/components/JfbMallProductList/cusAttr/icon.js +298 -0
  46. package/src/components/JfbMallProductList/cusAttr/style.js +91 -0
  47. package/src/components/JfbMallRecommendProduct/Attr.js +8 -366
  48. package/src/components/JfbMallRecommendProduct/JfbMallRecommendProduct.vue +218 -187
  49. package/src/components/JfbMallRecommendProduct/Mock.js +236 -693
  50. package/src/components/JfbMallRecommendProduct/cusAttr/advanced.js +79 -0
  51. package/src/components/JfbMallRecommendProduct/cusAttr/content.js +202 -0
  52. package/src/components/JfbMallRecommendProduct/cusAttr/style.js +594 -0
  53. package/src/components/JfbMallResourceShopList/Mock.js +4 -6
  54. package/src/components/JfbMallTestNormal/JfbMallTestNormal.vue +23 -2
  55. package/src/components/JfbMallTestNormal/data.js +152 -0
  56. package/src/mixins/componentsMixins.js +1 -0
  57. package/src/mixins/productCompMixins.js +29 -19
  58. package/src/components/JfbMallProductList/PosterAttr.js +0 -327
  59. package/src/components/JfbMallProductList/ProductAttr.js +0 -164
  60. package/src/components/JfbMallProductList/XdQueryBrand.vue +0 -150
@@ -19,110 +19,76 @@
19
19
  </view>
20
20
  <!-- #endif -->
21
21
  <view class="jfb-mall-product-list__body" :style="[bodyStyleComp]">
22
- <!--分类设置-->
23
- <view v-if="!loaded" class="skeleton-cate">
24
- <view class="cate_tab" v-if="showCategory === 'Y'">
25
- <view class="cate_tab_item" v-for="i in 5" :key="i"></view>
26
- </view>
27
- <view class="sub_cate" v-if="showCategory === 'Y'">
28
- <view class="sub_cate_item" v-for="i in 5" :key="i">
29
- <view></view>
30
- <view></view>
22
+ <view style="position: relative; z-index: 10">
23
+ <!--分类设置-->
24
+ <view v-if="!loaded" class="skeleton-cate">
25
+ <view class="cate_tab" v-if="showCategory === 'Y'">
26
+ <view class="cate_tab_item" v-for="i in 5" :key="i"></view>
27
+ </view>
28
+ <view class="sub_cate" v-if="showCategory === 'Y'">
29
+ <view class="sub_cate_item" v-for="i in 5" :key="i">
30
+ <view></view>
31
+ <view></view>
32
+ </view>
31
33
  </view>
32
34
  </view>
35
+ <template v-else>
36
+ <xd-cate-v1
37
+ v-if="loaded && categoryLayout === 'v1' && isShowCategory"
38
+ ref="xdCateV1"
39
+ :layoutInfo="layoutInfo"
40
+ :navList="navList"
41
+ :isShowCategory="isShowCategory"
42
+ :pid="pid"
43
+ :fixedTop.sync="categoryFixedHeight"
44
+ :cateId="cateId"
45
+ :showType="categoryLayout1ShowType"
46
+ :titleColor="titleColor"
47
+ :titleBgcColor="titleBgColor"
48
+ :box-title-border="filterTopBorder"
49
+ :level2BgcColor="level2BgcColor"
50
+ :level2Color="level2Color"
51
+ :mainColor="mainColor"
52
+ :tab-style="tabStyle"
53
+ :style-config="styleV2ConfigComp"
54
+ @onCateChange="handleCateChange"
55
+ ></xd-cate-v1>
56
+ <xd-cate-v2
57
+ v-if="loaded && categoryLayout === 'v2' && isShowCategory"
58
+ :layoutInfo="layoutInfo"
59
+ :navList="navList"
60
+ :pid="pid"
61
+ :cateId="cateId"
62
+ :tab-style="tabStyle"
63
+ :mainColor="mainColor"
64
+ :style-config="styleV2ConfigComp"
65
+ @onCateChange="handleCateChange"
66
+ @on-open="handleCateOpen"
67
+ >
68
+ </xd-cate-v2>
69
+ </template>
70
+ <!--分类设置-->
71
+ <!--搜索条件-->
72
+ <template v-if="loaded">
73
+ <com-filter-query
74
+ ref="filter-query"
75
+ :show-query="showQuery"
76
+ :layout-info="layoutInfo"
77
+ :top-height="cateFixedHeight"
78
+ :cus-menu-style="queryMenuStyleComp"
79
+ :cus-pop-style="filterStyle"
80
+ :menu-items="filterModeData"
81
+ :remote-list="searchFilterList"
82
+ :filter-fields="isFilterMenuForFilterFields"
83
+ :def-sort="sort"
84
+ :def-remote="defMenuValue"
85
+ @on-change="handleFitlerChange"
86
+ ></com-filter-query>
87
+ </template>
88
+ <!--搜索条件-->
33
89
  </view>
34
- <template v-else>
35
- <xd-cate-v1
36
- v-if="loaded && categoryLayout === 'v1'"
37
- ref="xdCateV1"
38
- :layoutInfo="layoutInfo"
39
- :navList="navList"
40
- :isFixed="isFixed"
41
- :isShowCategory="isShowCategory"
42
- :pid="pid"
43
- :cateId="cateId"
44
- :showType="categoryLayout1ShowType"
45
- :titleColor="titleColor"
46
- :titleBgcColor="titleBgColor"
47
- :boxTitleBorder="boxTitleBorder"
48
- :level2BgcColor="level2BgcColor"
49
- :level2Color="level2Color"
50
- :mainColor="mainColor"
51
- :tab-style="tabStyle"
52
- :style-config="styleV2ConfigComp"
53
- @onCateChange="handleCateChange"
54
- ></xd-cate-v1>
55
- <xd-cate-v2
56
- v-if="loaded && categoryLayout === 'v2' && isShowCategory"
57
- :layoutInfo="layoutInfo"
58
- :navList="navList"
59
- :pid="pid"
60
- :cateId="cateId"
61
- :style-config="styleV2ConfigComp"
62
- @onCateChange="handleCateChange"
63
- >
64
- </xd-cate-v2>
65
- </template>
66
- <!--分类设置-->
67
-
68
- <!--搜索条件-->
69
- <view :style="[queryHeightComp]" v-if="showQuery === 'Y' && isFixed"></view>
70
- <view
71
- class="query_wrap"
72
- v-if="showQuery === 'Y'"
73
- :class="{isFixed:isFixed}"
74
- :style="[queryWrapStyle]"
75
- >
76
- <view class="query_item" @click="switchQueryModal('sort')">
77
- <text>{{sortData.label || '综合'}}</text>
78
- <view><xd-font-icon icon="iconxia_down" width="50" :color="filterColor" :size="24"/></view>
79
- </view>
80
- <view v-if="showBrandFilter === 'out' && brandList.length" class="query_item" @click="switchQueryModal('brand')">
81
- <text>品牌</text>
82
- <view><xd-font-icon icon="iconxia_down" width="50" :color="filterColor" :size="24"/></view>
83
- </view>
84
- <view
85
- class="query_item"
86
- @click="switchQueryModal('filter')"
87
- :style="{visibility: searchFilterList.length ? 'visible' : 'hidden'}"
88
- >
89
- <text>筛选</text>
90
- <view><xd-font-icon icon="iconshaixuanbiaoji_mian" width="50" :color="filterColor" :size="28"/></view>
91
- </view>
92
- <view v-show="showQueryModal" class="query_modal">
93
- <xd-query-brand
94
- v-if="!filterStyleIsEmpty"
95
- :filter-style="filterStyle"
96
- v-show="curQueryTab === 'brand'"
97
- :brand_ids="brand_ids"
98
- :brandList="brandList"
99
- @onConfirm="handleQueryBrand"
100
- ></xd-query-brand>
101
- <xd-query-sort
102
- v-if="!filterStyleIsEmpty"
103
- :filter-style="filterStyle"
104
- :sort="sort"
105
- v-show="curQueryTab === 'sort'"
106
- @onConfirm="handleQuerySort"
107
- ></xd-query-sort>
108
- <xd-query-filter
109
- :key="keyFilter"
110
- v-if="!filterStyleIsEmpty"
111
- :filter-style="filterStyle"
112
- v-show="curQueryTab === 'filter'"
113
- :pageParmas="options"
114
- :brand_ids="brand_ids"
115
- :delivery="delivery"
116
- :list="searchFilterList"
117
- :maxHeight="scrollHeight - 180"
118
- @onConfirm="handleQueryFilter"></xd-query-filter>
119
- </view>
120
- </view>
121
- <view v-show="showQueryModal" class="modal" @click="closeQueryModal" @touchmove.stop.prevent="moveHandle"></view>
122
- <!--搜索条件-->
123
-
124
- <view class="list-scroll-top"></view>
125
90
  <!--商品列表-->
91
+ <view class="list-scroll-top"></view>
126
92
  <view class="list-product">
127
93
  <view
128
94
  v-if="prodList === null"
@@ -171,28 +137,31 @@
171
137
  >
172
138
  <template v-if="getItemData(index,prodList).length > 0">
173
139
  <view
140
+ class="product-item"
174
141
  v-for="(item,idx) in getItemData(index,prodList)"
175
142
  :key="item.product_id"
176
- :style="[contProductStyles]"
143
+ :style="[item.is_poster ==='Y'?posterProductStyles:contProductStyles]"
177
144
  >
178
145
  <cus-product
179
146
  v-if="item.is_poster ==='N'"
147
+ :column-one-layout="columnOneLayout"
180
148
  :image-radius="imageRadius"
181
- :brand-color="brandColor"
149
+ :brand-color="brandStyleComp"
182
150
  :height="contProductImageHeight"
183
151
  :cell="column_num"
184
152
  :name-font="itemFontStyle"
185
153
  :product-config="productConfig"
154
+ :isPlus="isGVipSite"
186
155
  :item="item"
187
- :isPlus="is_plus_site"
188
156
  :row-spacing="rowSpacing"
189
157
  :cell-spacing="itemSpacing"
158
+ :color="mainColor"
190
159
  @on-product-detail="toProductInfo"
191
160
  ></cus-product>
192
161
  <view
193
162
  v-else
194
163
  class="poster"
195
- :class="{two:column_num === 2,one:column_num === 1 }"
164
+ :style="[posterSizeComp]"
196
165
  >
197
166
  <cus-poster
198
167
  :key="posterKey"
@@ -214,6 +183,7 @@
214
183
  </template>
215
184
  </view>
216
185
  </view>
186
+ <xd-no-data icon-type="product" :scale-size="2" v-if="prodList && prodList.length === 0">暂无商品</xd-no-data>
217
187
  </view>
218
188
  <!--商品列表-->
219
189
  <xd-to-top :is-preview="isPreview" :mainColor="mainColor" ref="VT" :scrollTop="0"></xd-to-top>
@@ -226,30 +196,30 @@
226
196
  import XdMore from "@/components/XdMore/XdMore";
227
197
  import XdUnit from "@/components/XdUnit/XdUnit"
228
198
  import XdButton from "@/components/XdButton/XdButton"
229
- import XdQueryFilter from "./XdQueryFilter"
230
- import XdQuerySort from "./XdQuerySort"
231
- import XdQueryBrand from "./XdQueryBrand.vue"
199
+ import ComFilterQuery from "./ComFilterQuery.vue";
232
200
  import XdCateV1 from "./XdCateV1"
233
201
  import XdCateV2 from "./XdCateV2"
234
202
  import { jfbRootExec } from "@/utils/xd.event";
235
203
  import JfbMallProductListMixin from "./JfbMallProductListMixin";
236
204
  import componentsMixins from "@/mixins/componentsMixins";
237
205
  import extsMixins from "@/mixins/extsMixins"
238
- import { getContainerPropsValue, toProductDetail } from "@/utils/xd.base";
206
+ import productCompMixins from "@/mixins/productCompMixins";
207
+ import { getContainerPropsValue, toProductDetail,gCPVal } from "@/utils/xd.base";
239
208
  import getServiceUrl from "@/common/getServiceUrl";
240
209
  import XdProductStatus from "@/components/XdProductStatus/XdProductStatus";
241
210
  import Color from "color"
242
211
  import XdToTop from './XdToTop.vue';
243
- import { mapState } from "vuex"
212
+ import { mapState,mapActions } from "vuex"
244
213
  import SkeProduct from "@/components/SkeProduct/SkeProduct.vue";
245
214
  import CusProduct from "@/components/CusProduct/CusProduct.vue";
246
215
  import posterMixins from "@/mixins/posterMixins";
247
216
  import CusPoster from "@/components/CusPoster/CusPoster.vue";
248
-
217
+ import XdNoData from "@/components/XdNoData/XdNoData";
249
218
 
250
219
  export default {
251
220
  name: "JfbMallProductList",
252
221
  components: {
222
+ XdNoData,
253
223
  CusPoster,
254
224
  CusProduct,
255
225
  SkeProduct,
@@ -257,120 +227,110 @@
257
227
  XdMore,
258
228
  XdUnit,
259
229
  XdButton,
260
- XdQueryFilter,
261
- XdQuerySort,
262
- XdQueryBrand,
263
230
  XdProductStatus,
264
231
  XdCateV1,
265
232
  XdCateV2,
266
233
  XdToTop,
234
+ ComFilterQuery
267
235
  },
268
- mixins: [componentsMixins,extsMixins,JfbMallProductListMixin,posterMixins],
236
+ mixins: [componentsMixins,extsMixins,JfbMallProductListMixin,posterMixins,productCompMixins],
269
237
  data() {
270
238
  return {
271
- top:0,
272
- options: {},
239
+ options: {}, //页面参数
273
240
  closeMask: true,
274
241
  isPreview: false,
275
- prodList: null,
276
- navList: [],
277
- keyword: "",
278
- page_token: "1",
279
- page_size: 20,
280
- random_score_seed: parseInt(Math.random() * 10000000),
281
- hasNext: false,
282
- next_page_token: "",
283
- loaded: false,
284
- loadingList: true,
285
- scrollTop: 0,
286
- scrollHeight: 0,
287
- isFirst: true,
288
- isFixed: false,
289
- mainColorAlpha: "",
242
+ prodList: null, //商品列表
243
+ navList: [], //商品分类
244
+ keyword: "", //搜索关键字
245
+ page_token: "1",//当前页码
246
+ page_size: 20, //每页数据条数
247
+ hasNext: false, //是否有下一页
248
+ random_score_seed: parseInt(Math.random() * 10000000),//随机种子
249
+ next_page_token: "", //下一页
250
+ loaded: false, //分类是否加载完成
251
+ isFirst: true, //是否首次加载
252
+ mainColorAlpha: "", //主色进行0.1透明处理的值
253
+ is_plus_site: false, //是否为vip站点
254
+ //loading状态
255
+ initStatus: false, //面板属性加载完成
256
+ onLoadStatus: false, //是否执行到onLoading完成
257
+
290
258
 
259
+ //基础
260
+ column_num: 2,
261
+ columnOneLayout:'H', //H=>水平 V=>垂直
262
+ skeNumber:10,
263
+ listPadding:{},
264
+ contentColor:'',
265
+ filterModeData:[],//菜单数量
266
+ parentId:0, //获取商品分类父级ID
267
+
268
+ //==搜索条件=============
269
+ filterPadding:{},
270
+ filterBgcColor:'',
271
+ filterColor: '',
272
+ filterStyle: {},
273
+ filterTopBorder:'',
274
+ filterTopBorderWidth: 0,
291
275
 
292
276
  //filters
293
- showQueryModal: false,
294
- curQueryTab: "filter",
295
- brand_ids: "",
296
- brand_type: "",
297
- delivery: "",
298
- filter_keys: "",
277
+ isFilterMenuForFilterFields:[],//在筛选时候需要过滤都条件
278
+ searchFilterList: [], //下拉菜单数据
299
279
  sort: "default",
300
- searchFilterList: [],
301
- searchFilterListOrg:[],
302
- sortData: {},
303
- filterData: null,
304
- pid: "", //分类一级
305
- cateId: "", //分类二级
306
- keyFilter: 'keyFilter',
280
+ pid: "", //分类一级(用于是否选中一级分类操作)
281
+ cateId: "", //分类二级(用于是否选中二级分类操作)
282
+ truePid:'',//分类一级(用于是查询商品列表操作)
283
+ trueCateId:'',//分类二级(用于是查询商品列表操作)
284
+ defMenuValue:{}, //菜单选中
285
+ menuSelectParams:null, //null|object null未初始化 object已初始化
286
+ //==搜索条件=============
307
287
 
308
288
  //面板
309
- showCategory: "Y",
310
- showQuery:'Y',
289
+ orgCategory:null,
290
+ showCategory: "Y", //是否线上分类
291
+ showQuery:'Y', //是否线上搜索条件
311
292
  categoryLayout: "v1", //分类布局
312
293
  categoryLayout1ShowType: "all", //分类布局1显示类型
313
294
  showBrandFilter: "in", //品牌展示位置; out:外面单独展示; in:筛选面板中展示
314
- brandList: [],
295
+ categoryFixedHeight:0, //分类高度
315
296
 
316
- //基础
317
- contentColor: '',
297
+ //==分类========
298
+ //分类-基础
318
299
  allName:'全部',
319
300
  allIcon:{},
320
-
321
- //一级分类配置
322
-
323
- //分类名称样式设置
301
+ allIconSize:0,
324
302
  titleBgColor: '',
325
303
  titleColor: '',
326
- titleActColor:'',
327
- tabStyle:{},
328
- titleBorder:{},
329
- titleFontSize: 30,
330
- titleActFontSize:38,
331
- titleFontWeight: 'normal',
332
- titleActFontWeight: 'bold',
304
+ tabStyle:{}, //图标样式
333
305
  level2BgcColor: '',
334
306
  level2Color: '',
335
307
 
336
- //搜索条件
337
- filterBgcColor:'',
338
- filterColor: '',
339
- filterStyle: {},
340
- isShowDelivery:'Y',
308
+ //==分类========
341
309
 
342
- //商品列表
343
- column_num: 1,
344
- skeNumber:10,
310
+ //商品内容样式
345
311
  rowSpacing:20,
346
312
  columnSpacing:20,
347
- listPadding:{},
348
- productConfig:{},
349
313
  itemPadding:{},
314
+ contShadow:'',
350
315
  itemSpacing:20,
351
316
  imageRadius:'0',
352
- brandColor:'',
317
+ radius:'0',
353
318
  itemFontStyle:{},
354
-
319
+ itemBgcColor:'',
320
+ contBorder:'',
321
+ contStyleBorder:0,
355
322
 
356
323
  //高级
357
324
  productInfoPath: "",
358
325
  xnamespace: "",
359
326
  isCityFilter: "N",
327
+ version:'',
360
328
 
361
329
  //广告位置======
362
- isPoster:'N',
363
- posterList:null,
364
- posterNum:1, //使用张数
365
- mode:'round',//直接写死
366
- carouselTime: 0,//轮播图轮播周期
367
- posterKey:'posterKey',
368
- posterIndex:'',
369
330
  isOnloaded: false,
370
331
  //广告位置======
371
332
  need_show_tags: [],
372
- is_plus_site: false,
373
-
333
+ searchTimer:null, //顶部菜单输入截流
374
334
  }
375
335
  },
376
336
  computed: {
@@ -378,36 +338,6 @@
378
338
  stateCity: state => state.cityLocation.city
379
339
  }),
380
340
 
381
- posterSize(){
382
- let dw = 670, dh= 200;
383
- if(this.column_num === 2) {
384
- dw = 316;
385
- dh = 540;
386
- }
387
- if(this.poster && this.poster.size) {
388
- let {width, height} = this.poster.size
389
- let size = { width: dw, height: dh }
390
- if(width) size['width'] = Number(width || dw);
391
- if(height) size['height'] = Number(height || dh);
392
- return size;
393
- }
394
- return {
395
- width: dw,
396
- height: dh,
397
- }
398
- },
399
-
400
- queryHeightComp(){
401
- let str = '100rpx'
402
- if(this.filterStyle && typeof this.filterStyle.filterTopBorder === 'string') {
403
- let arr = this.filterStyle.filterTopBorder.split(' ');
404
- if(arr.length > 0) {
405
- str = `${parseInt(arr[0]) + 100}rpx`;
406
- }
407
- }
408
- return {height: str};
409
- },
410
-
411
341
  bodyStyleComp(){
412
342
  return {
413
343
  background: this.contentColor,
@@ -421,7 +351,8 @@
421
351
  return {
422
352
  backgroundColor: this.titleBgColor,
423
353
  titleStyleLv1: this.tabStyle,
424
- titleStyleLv2: {}
354
+ titleStyleLv2: {},
355
+ version: this.version
425
356
  }
426
357
  },
427
358
 
@@ -431,38 +362,6 @@
431
362
  }
432
363
  },
433
364
 
434
- filterStyleIsEmpty(){
435
- return this.$xdUniHelper.isEmpty(this.filterStyle);
436
- },
437
-
438
- //骨架
439
- skeletonImageHeight(){
440
- return parseInt(this.skeletonStyle.width);
441
- },
442
-
443
- skeletonStyle(){
444
- return this.getContentStyle('ske')
445
- },
446
- //骨架
447
-
448
- contProductImageHeight(){
449
- return parseInt(this.contProductStyles.width);
450
- },
451
-
452
- contProductStyles(){
453
- return {
454
- ...this.getContentStyle(),
455
- boxShadow: this.contShadow,
456
- border: this.contBorder,
457
- backgroundColor: this.itemBgcColor,
458
- }
459
- },
460
-
461
- boxTitleBorder() {
462
- if (this.is_title_border === 'Y') return `${this.is_title_border_w}rpx solid ${this.is_title_border_c}`;
463
- else return '0';
464
- },
465
-
466
365
  getAllCategory(){
467
366
  let icon = getServiceUrl('/common/all.png','size3');
468
367
  if(this.$xdUniHelper.checkVarType(this.allIcon) === 'object'&& this.allIcon.url) {
@@ -481,28 +380,19 @@
481
380
  isShowCategory(){
482
381
  return this.showCategory === 'Y' && !!this.navList.length
483
382
  },
484
-
485
383
  //分类展示的固定高度
486
384
  cateFixedHeight(){
487
- if(!this.isShowCategory) return 0;
488
- if(this.categoryLayout === 'v2') return 100; //v2布局固定高度
489
- if(this.categoryLayout === 'v1') {
490
- console.log(this.filterStyle.filterTopBorder);
491
- // debugger
492
- //如果展示父级分类
493
- if(this.$refs['xdCateV1'] && this.$refs['xdCateV1'].showParent) return 104;
494
- else return 0;
495
- }
385
+ if(this.categoryLayout ==='v1') return this.categoryFixedHeight;
386
+ else if(this.categoryLayout ==='v2') return 108;
387
+ return 0
496
388
  },
497
- queryWrapStyle(){
498
- let top = 0;
499
- if(this.isFixed) top = (this.layoutInfo.top + this.cateFixedHeight) + 'rpx';
500
- return{
501
- zIndex: this.showQueryModal ? 1002 : 1,
502
- background: this.filterBgcColor,
389
+ queryMenuStyleComp(){
390
+ return {
391
+ backgroundColor: this.filterBgcColor,
503
392
  color: this.filterColor,
504
- top,
505
- borderTop: this.filterStyle.filterTopBorder
393
+ borderTopWidth: this.filterTopBorderWidth,
394
+ padding: this.getMarginAndPadding(this.filterPadding, 0),
395
+ paddingTb: Number(this.getPMValue(this.filterPadding, 'TB',0))
506
396
  }
507
397
  },
508
398
  },
@@ -510,306 +400,576 @@
510
400
  container(value,oldValue) {
511
401
  if(JSON.stringify(value) === JSON.stringify(oldValue)) return;
512
402
  if (this.$configProject['isPreview']){
513
- this.getList()
514
- this.init(value)
403
+ this.init(value);
404
+ this.clearProductData()
405
+ this.handleInit()
515
406
  }
516
407
  },
517
408
  stateCity(n, o) {
518
409
  if(n && JSON.stringify(n) !== JSON.stringify(o)){
519
- console.warn('stateCity');
520
- this.getList();
521
- this.isFixed = false;
410
+ this.clearProductData()
411
+ this.handleInit()
522
412
  }
523
413
  },
524
- isShowDelivery(value){
525
- this.searchFilterList = this.$xdUniHelper.cloneDeep(this.searchFilterListOrg).filter(item=>{
526
- if(item.title==='配送方式') {
527
- return value === 'Y'
528
- }
529
- else return true
530
- });
531
- this.keyFilter = Date.now()
532
- },
533
- categoryLayout(){
534
- if(this.isPreview) this.isFixed = false;
535
- },
536
414
 
537
415
  allIcon(){
538
416
  this.handleAllChange()
539
417
  },
418
+
540
419
  allName(){
541
420
  this.handleAllChange()
542
421
  },
543
422
 
544
- //==poster=========
545
- isPoster(n, o){
423
+ showCategory(val){
546
424
  if(this.$configProject.isPreview) {
547
- if(this.isOnloaded === false) return;
548
- this.prodList = null;
549
- this.page_token = '1';
550
- this.getList();
425
+ if(val === 'Y') this.getCategoryList();
426
+ else this.navList = [];
551
427
  }
552
428
  },
553
- posterIndex(){
429
+
430
+ parentId(){
554
431
  if(this.$configProject.isPreview) {
555
- if(this.isOnloaded === false) return;
556
- this.prodList = null;
557
- this.page_token = '1';
558
- this.getList();
432
+ this.getCategoryList();
559
433
  }
560
434
  },
561
- column_num(){
562
- if(this.$configProject.isPreview) {
563
- if(this.isOnloaded === false) return;
564
- if(this.isPoster === 'Y' && this.column_num < 3 ){
565
- this.$xdConfirm({
566
- title: '温馨提示',
567
- content: '已设置显示广告内容并切换商品显示列数时,别忘记切换对应的广告位置哦!',
568
- cancel:false,
569
- confirmText: '我知道了',
570
- width: '85%',
571
- isTitle: true,
572
- success: (res) => {
573
- }
574
- });
575
- }
576
435
 
577
- this.prodList = null;
578
- this.page_token = '1';
579
- this.posterList = null;
436
+ need_show_tags(value,oldValue) {
437
+ if(JSON.stringify(value) === JSON.stringify(oldValue)) return;
438
+ if (this.$configProject['isPreview']){
580
439
  this.getList();
581
- this.getPosterList()
582
440
  }
583
441
  },
584
- carouselTime(){
585
- if(this.isPreview) {
586
- this.posterKey = Date.now()
587
- }
588
- },
589
- mode(){
590
- if(this.isPreview) {
591
- this.posterKey = Date.now()
592
- }
442
+
443
+ //记载完成
444
+ initStatus(){
445
+ if(this.initStatus && this.onLoadStatus) this.handleInit();
593
446
  },
594
- posterNum(){
595
- this.onJfbUpdate()
447
+ onLoadStatus(){
448
+ if(this.initStatus && this.onLoadStatus) this.handleInit();
596
449
  },
597
- //==poster=========
598
- need_show_tags(value,oldValue) {
599
- if(JSON.stringify(value) === JSON.stringify(oldValue)) return;
600
- if (this.$configProject['isPreview']){
601
- this.getList();
450
+
451
+ filterModeData(){
452
+ if(this.$configProject.isPreview) {
453
+ this.$refs['filter-query'].hideSelectMenu();//隐藏菜单
602
454
  }
603
- }
455
+ },
456
+
604
457
  },
605
458
  created() {
606
459
  this.isPreview = this.$configProject.isPreview;
607
- const { footerHeight, topHeight } = this.layoutInfo;
608
- const { safeAreaInsets, windowHeight } = uni.getSystemInfoSync();
609
- this.scrollHeight = windowHeight - safeAreaInsets.top - safeAreaInsets.bottom - (footerHeight + topHeight) * this.$rpxNum;
610
460
  this.mainColorAlpha = Color(this.mainColor).alpha(0.1).toString();
611
- this.is_plus_site = this.projectAttr.headers['X-Site-Group']==="vip";
461
+ this.is_plus_site = this.isGVipSite
612
462
  this.init(this.container);
613
463
  },
614
464
  methods: {
465
+
466
+ onJfbLoad(options) {
467
+ //设置业务请求代码
468
+ this.setNameSpace(options);
469
+ this.options = options;
470
+ let defMenuValue = {};
471
+ if( options.keyword) this.keyword = options.keyword;
472
+ if( options.pid) this.pid = Number(options.pid);
473
+ if( options.cateId || options.cateid) this.cateId = Number(options.cateId||options.cateid);
474
+ if( options.brand_id) {
475
+ defMenuValue['brand'] = options.brand_id.split(',');
476
+ this.brand_ids = options.brand_id;
477
+ }
478
+ if( options.delivery) {
479
+ defMenuValue['delivery_method'] = options.delivery.split(',');
480
+ this.delivery = options.delivery;
481
+ }
482
+ if( options.brand_type) this.brand_type = options.brand_type;
483
+
484
+ //预览模式设置默认值
485
+ if(this.isPreview) {
486
+ this.brand_ids = '100451';
487
+ this.delivery = 'logistics';
488
+ }
489
+ this.defMenuValue = defMenuValue;
490
+ this.onLoadStatus = true;
491
+ },
492
+
493
+ getProductListParams(){
494
+ let data = {
495
+ xnamespace: this.xnamespace,
496
+ random_score_seed: this.random_score_seed,
497
+ page_token: this.page_token,
498
+ page_size: this.page_size,
499
+ need_show_tags: this.need_show_tags.join(),
500
+ }
501
+
502
+ if(this.keyword) data['keyword'] = this.keyword;
503
+ if(this.isCityFilter === "Y") {
504
+ if(this.stateCity.city_code) data['city_code'] = this.stateCity.city_code
505
+ }
506
+
507
+ //第一次初始化
508
+ if(this.menuSelectParams === null){
509
+ if(this.brand_ids) data['brand_ids'] = this.brand_ids;
510
+ if(this.sort) data['sort'] = this.sort;
511
+ if(this.delivery) data['delivery_method'] = this.delivery;
512
+ }
513
+ else {
514
+ data = {...data, ...this.menuSelectParams};
515
+ }
516
+
517
+ //设置分类
518
+ if(this.trueCateId || this.truePid) {
519
+ data['custom_category_id'] = this.trueCateId || this.truePid;
520
+ }
521
+
522
+ //自定义父分类的时候,选择全部使用parentId的全部
523
+ if(Number(this.parentId) > 0) {
524
+ if(!data['custom_category_id']) data['custom_category_id'] = Number(this.parentId);
525
+ }
526
+
527
+ //设置是否展示划线价格
528
+ if(this.productConfig.isShowDiscount==='Y') data.is_show_uprice = this.$xdUniHelper.multiplyFloatNumber(this.productConfig.differ,100)
529
+ else data.is_show_uprice = -1
530
+
531
+ //设置产品类型
532
+ if(this.brand_type === 'code') {
533
+ data['product_types'] = 'card';
534
+ }
535
+ //console.log('getProductListParams',JSON.stringify(data));
536
+ return data
537
+ },
538
+ getFilterListParams(){
539
+ let data = {
540
+ xnamespace: this.xnamespace,
541
+ is_need_delivery_method: 'Y'
542
+ }
543
+
544
+ if(this.brand_ids) data['brand_ids'] = this.brand_ids
545
+ if(this.keyword) data['keyword'] = this.keyword;
546
+ if(this.isCityFilter === "Y") {
547
+ if(this.stateCity.city_code) data['city_code'] = this.stateCity.city_code
548
+ }
549
+ if(this.brand_type === 'code') data['product_types'] = 'card';
550
+ if(this.trueCateId || this.truePid) data['custom_category_id'] = this.trueCateId || this.truePid;
551
+
552
+ //自定义父分类的时候,选择全部使用parentId的全部
553
+ if(Number(this.parentId) > 0) {
554
+ if(!data['custom_category_id']) data['custom_category_id'] = Number(this.parentId);
555
+ }
556
+
557
+ return data;
558
+ },
559
+
560
+ async handleInit(){
561
+ //获取分类数据
562
+ await this.getCategoryList();
563
+
564
+ //广告数据加载
565
+ await this.getPosterList();
566
+
567
+ this.getList();
568
+ this.getSearchFilterList();
569
+ },
570
+
571
+
615
572
  /**
616
573
  * @description 监听事件变化
617
574
  * @param container {object} 业务组件对象自己
618
575
  */
619
576
  init(container) {
620
- debugger
621
- this.column_num = getContainerPropsValue(container, "content.row_num", 1);
622
- if( this.column_num === 1) {
577
+ //基础
578
+ this.sort = gCPVal(container, "sort", "default");
579
+ this.version = gCPVal(container, 'version', '');
580
+ let categoryParentType = gCPVal(container, 'categoryParentType', 'root');
581
+ if(categoryParentType === 'root') this.parentId = 0;
582
+ else {
583
+ let categoryParent = gCPVal(container, 'categoryParent', '');
584
+ if(!categoryParent) this.parentId = 0;
585
+ else this.parentId = categoryParent;
586
+ }
587
+ this.xnamespace = gCPVal(container, 'xnamespace', this.projectAttr.business_code||this.xnamespace);
588
+ this.listPadding = gCPVal(container,'listPadding', [{top:16, left:16, right:16,bottom:16},20], {sKey:'listPaddingStatus',fields:['listPadding'],isPMR: true});
589
+ this.contentColor = gCPVal(container,'contentColor', ['#f8f8f8','#fafafa'], {sKey:'contentColorStatus',fields:['contentColor']});
590
+ let column_num = gCPVal(container, 'row_num', 2);
591
+ this.column_num = column_num;
592
+ //一列垂直
593
+ if(column_num === 4) {
594
+ this.column_num = 1;
595
+ this.columnOneLayout = 'V';
623
596
  this.skeNumber = 10;
624
597
  this.page_size = 20;
625
598
  }
626
- if( this.column_num === 2){
599
+ //一列水平
600
+ if( column_num === 1) {
601
+ this.skeNumber = 10;
602
+ this.page_size = 20;
603
+ this.columnOneLayout = 'H';
604
+ }
605
+ if( column_num === 2) {
627
606
  this.skeNumber = 5;
628
607
  this.page_size = 20;
629
608
  }
630
- if( this.column_num === 3) {
609
+ if(column_num === 3) {
631
610
  this.skeNumber = 6;
632
611
  this.page_size = 21;
633
612
  }
634
613
 
635
- //广告位置
636
- this.isPoster = getContainerPropsValue(container, 'content.isPoster', 'N');
637
- this.poster = getContainerPropsValue(container, 'content.poster', {});
638
- this.posterNum = getContainerPropsValue(container, 'content.posterNum', 1);
639
- this.carouselTime = Number(getContainerPropsValue(container, 'content.carouselTime', 5)) * 1000;
640
- this.mode = getContainerPropsValue(container, 'content.dot_type','round');
641
- this.posterIndex = getContainerPropsValue(container, 'content.posterIndex','');
642
- if(this.column_num === 2 && this.isPoster === 'Y') {
643
- this.page_size = 19;
644
- }
645
-
646
- this.showCategory = getContainerPropsValue(container, 'content.showCategory', "Y");
647
- this.showQuery = getContainerPropsValue(container, "content.showQuery", 'Y');
648
- this.sort = getContainerPropsValue(container, "content.sort", "default");
649
- this.categoryLayout = getContainerPropsValue(container, "content.categoryLayout", "v1");
650
- this.categoryLayout1ShowType = getContainerPropsValue(container, "content.categoryLayout1ShowType", "all");
651
- this.showBrandFilter = getContainerPropsValue(container, "content.showBrandFilter", "in");
652
614
 
653
- //基础
654
- this.contentColor = getContainerPropsValue(container, 'content.contentColor', '#fafafa');
655
- this.allName = getContainerPropsValue(container, 'content.allName', "全部");
656
- this.allIcon = getContainerPropsValue(container, "content.allIcon", {});
657
-
658
- //标题
659
- this.titleBgColor = getContainerPropsValue(container, 'content.titleBgColor', '#fff');
660
- this.titleColor = getContainerPropsValue(container, 'content.titleColor', '#333');
661
- let titleBorder = this.getXdBorder({width:2,color:'rgba(0,0,0,0)'},getContainerPropsValue(container, 'content.subTitleBorder', {}));
662
- let titleStyle = getContainerPropsValue(container, "content.titleStyle", {});
663
- let titleColor = titleStyle.color || this.titleColor || '#333';
664
- let titleActColor = titleStyle.actColor || this.mainColor;
665
- let titleFontSize = titleStyle.fontSize ? parseInt(titleStyle.fontSize) : 30;
666
- let titleActFontSize = titleStyle.actFontSize ? parseInt(titleStyle.actFontSize) : 38;
667
- let titleFontWeight = titleStyle.fontWeight || 'normal';
668
- let titleActFontWeight = titleStyle.actFontWeight|| 'bold';
669
- let subTitleRadius = getContainerPropsValue(container, 'content.subTitleRadius', '50%');
670
- let subTitleIconBorder = this.getXdBorder({width:2,color:'#ccc'},getContainerPropsValue(container, 'content.subTitleIconBorder', {}));
671
- let subTitleIconShadow = this.getXdShadow({width:20, color:'rgba(0,0,0,0)'},getContainerPropsValue(container, 'content.subTitleIconShadow', {}))
672
- //v1
673
- this.tabStyle = {subTitleIconShadow,titleColor,titleActColor,titleFontSize,
674
- titleActFontSize,titleFontWeight,titleActFontWeight,titleBorder,subTitleRadius,subTitleIconBorder,
675
- allNameKey: Date.now()
615
+ //广告位置
616
+ this.isPoster = gCPVal(container, 'isPoster', 'N');
617
+ this.poster = gCPVal(container, 'poster', {});
618
+ this.posterNum = gCPVal(container, 'posterNum', 1);
619
+ this.carouselTime = Number(gCPVal(container, 'carouselTime', 5)) * 1000;
620
+ this.mode = gCPVal(container, 'dot_type','round');
621
+ this.posterIndex = gCPVal(container, 'posterIndex','');
622
+
623
+
624
+ //==过滤区域============
625
+ let categoryLayout = gCPVal(container, "categoryLayout", "v1");
626
+ let categoryLayout1ShowType = gCPVal(container, "categoryLayout1ShowType", "all");
627
+ let showCategory = gCPVal(container, 'showCategory', "Y");
628
+ //数据兼容处理
629
+ if(categoryLayout && categoryLayout === 'v1') {
630
+ if(categoryLayout1ShowType === 'child') categoryLayout = 'v3'
676
631
  }
677
-
678
- //内容
679
- this.columnSpacing = getContainerPropsValue(container, 'content.columnSpacing', 20)
680
- this.rowSpacing = getContainerPropsValue(container, 'content.rowSpacing', 20);
681
- this.listPadding = getContainerPropsValue(container, 'content.listPadding', {});
682
- this.itemPadding = getContainerPropsValue(container, 'content.itemPadding', {})
683
- this.itemSpacing = getContainerPropsValue(container, 'content.itemSpacing', 20);
684
- this.brandColor = getContainerPropsValue(container, 'content.brandColor', '')
685
- this.itemBgcColor = getContainerPropsValue(container, 'content.itemBgcColor', '#fff');
686
- this.radius = getContainerPropsValue(container, 'content.radius', 0);
687
- this.imageRadius = getContainerPropsValue(container, 'content.imageRadius', '10')
688
- let is_border = getContainerPropsValue(container, 'content.is_border', 'N');
689
- let is_border_c = getContainerPropsValue(container, 'content.is_border_c', '#fff');
690
- let is_border_w = getContainerPropsValue(container, 'content.is_border_w', '2');
691
- this.contBorder = this.getBorderCompatibleOldStyle(getContainerPropsValue(container,'content.contBorder',{}), {
692
- type: is_border,
693
- width: is_border_w,
694
- color: is_border_c
695
- })
696
- let is_shadow = getContainerPropsValue(container, 'content.is_shadow', 'N');
697
- let is_shadow_bg = getContainerPropsValue(container, 'content.is_shadow_bg', '#fff');
698
- let is_shadow_w = getContainerPropsValue(container, 'content.is_shadow_w', '10');
699
- this.contShadow = this.getShadowCompatibleOldStyle(getContainerPropsValue(container,'content.contShadow',{}),{
700
- type: is_shadow,
701
- width: is_shadow_w,
702
- color: is_shadow_bg
703
- })
704
- this.itemFontStyle = this.getFontAndBgcStyle(
705
- getContainerPropsValue(container, 'content.contStyle', {}),
706
- {
707
- fontSize:'28rpx',
708
- color: '#333',
709
- fontWeight: 'normal',
632
+ if(showCategory === 'N') categoryLayout = 'none';
633
+ let category = gCPVal(container, 'category',categoryLayout);
634
+
635
+ //是否显示过滤菜单
636
+ let showQuery = gCPVal(container, "showQuery", 'Y');
637
+
638
+ //是否筛选菜单里面过滤配送方式
639
+ let isShowDelivery = gCPVal(container, "isShowDelivery", 'Y');
640
+ if(isShowDelivery === 'Y') this.isFilterMenuForFilterFields = ['delivery_method','配送方式']
641
+ else this.isFilterMenuForFilterFields = [];
642
+ //是否显示品牌菜单
643
+ let showBrandFilter = gCPVal(container, "showBrandFilter", "in");
644
+ //菜单设置
645
+ let filterMode = [];
646
+ if(showQuery === 'Y') {
647
+ let filterModeArr = gCPVal(container, "filterMode", '');
648
+
649
+ //未设置菜单设置默认菜单
650
+ if(typeof filterModeArr === "string" && filterModeArr === '') {
651
+ filterMode.push('common');
652
+ if(showBrandFilter === 'out') filterMode.push('brand');
653
+ filterMode.push('filter');
710
654
  }
711
- );
712
-
713
- //商品设置
714
- this.productConfig = this.getProductConfig(container);
715
-
716
-
717
- //搜索条件
718
- this.filterBgcColor = getContainerPropsValue(container, 'content.filterBgcColor', '#fff');
719
- this.filterColor = getContainerPropsValue(container, 'content.filterColor', '#999');
720
- this.isShowDelivery = getContainerPropsValue(container, 'content.isShowDelivery','Y')
721
- let filterPadding = getContainerPropsValue(container, 'content.filterPadding', {});
722
- let filterRowSpacing = Number(getContainerPropsValue(container, 'content.filterRowSpacing', 20));
723
- let filterListColor = getContainerPropsValue(container, 'content.filterListColor', '#f9f9f9');
724
- let filterFontStyle = getContainerPropsValue(container,'content.filterFontStyle', {});
655
+ //已经设置
656
+ else filterMode = this.$xdUniHelper.cloneDeep(filterModeArr);
657
+
658
+ //设置条件
659
+ if(filterMode.length <= 4 && filterMode.length >=2) {
660
+ filterMode = filterMode.map(item=>{
661
+ if(['common','price','hot'].includes(item)) return item
662
+ else {
663
+ if(item === 'brand') return {value: item, label: '品牌'};
664
+ if(item === 'delivery_method') return {value: item, label: '配送方式'};
665
+ if(item === 'filter') return {value: item, label: '筛选'};
666
+ }
667
+ })
668
+ }
669
+ else {
670
+ filterMode = []
671
+ }
672
+ }
673
+ this.showQuery = showQuery;
674
+ this.filterModeData = this.$xdUniHelper.cloneDeep(filterMode)
675
+
676
+
677
+ //横向菜单样式区域
678
+ this.filterPadding = gCPVal(container,'filterPadding', [16], {sKey:'filterPaddingStatus',fields:['filterPadding'],isPMR: true});
679
+ let defFilterBgcColor = '#fff';
680
+ if( category ==='v4') defFilterBgcColor = this.pageAttr.background;
681
+ this.filterBgcColor = gCPVal(container, 'filterBgcColor', [defFilterBgcColor,'#fff'], {sKey: 'filterBgcColorStatus',fields:['filterBgcColor']});
682
+ this.filterColor = gCPVal(container, 'filterColor', ['#333'], {sKey: 'filterColorStatus',fields:['filterColor']});
683
+ this.filterTopBorder = gCPVal(container, 'filterTopBorder', [{ color: '#f8f8f8', width: '2', style: 'solid'},{ color: '#f8f8f8', width: '0', style: 'solid'}], {isBorder:true});
684
+ this.filterTopBorderWidth = gCPVal(container, 'filterTopBorder', [{ color: '#f8f8f8', width: '2', style: 'solid'},{ color: '#f8f8f8', width: '0', style: 'solid'}], {isBorder:true, isBsWidth: true});
685
+
686
+ //下拉菜单样式
687
+ let filterListPadding = gCPVal(container, 'filterListPadding', [{top: 32, bottom: 32, left: 48, right: 48},20], {sKey: 'filterListPaddingStatus',fields:['filterListPadding'],isPMR: true});
688
+ let filterRowSpacing = gCPVal(container, 'filterRowSpacing', [16,20], {sKey: 'filterRowSpacingStatus',fields:['filterRowSpacing']});
689
+ let filterListColor = gCPVal(container, 'filterListColor', ['#fff','#f8f8f8'], {sKey: 'filterListColorStatus',fields:['filterListColor']});
690
+ let filterListRadius = gCPVal(container, 'filterListRadius', ['4','60'], {sKey: 'filterListRadiusStatus',fields:['filterListRadius']})||0;
691
+ let filterFontStyle = gCPVal(container,'filterFontStyle', {
692
+ color: '#666',
693
+ fontSize:'24rpx',
694
+ actFontSize:'24rpx',
695
+ actColor: this.mainColor,
696
+ }, {sKey: 'filterFontStyleStatus',fields:['filterFontStyle']});
725
697
  let filterTopBorder = this.getXdBorder({width:2,color:'#F8F8F8',type:'D'},
726
698
  getContainerPropsValue(container, 'content.filterTopBorder', {})
727
699
  );
728
700
  this.filterStyle = {
729
- filterPadding:this.getMarginAndPadding(filterPadding,20),
701
+ filterPadding: this.getMarginAndPadding(filterListPadding, 0),
702
+ filterPaddingRL:this.getPMValue(filterListPadding, 'RL', 0),
730
703
  filterRowSpacing,
731
704
  filterListColor,
705
+ filterListRadius,
732
706
  filterFontStyle:this.getFontAndBgcStyle(filterFontStyle,{
733
- fontSize: '26px',
734
- color: '#333',
735
- fontWeight: 'normal',
736
- bgColor: 'rgba(0,0,0,0)'
707
+ fontSize: '24rpx',
708
+ color: '#666',
737
709
  }),
738
710
  filterActFontStyle:this.getFontAndBgcStyle(filterFontStyle,{
739
- fontSize: '26px',
711
+ fontSize: '24rpx',
740
712
  color: this.mainColor,
741
- fontWeight: 'normal',
742
- bgColor: 'rgba(0,0,0,0)'
743
713
  },'act'),
744
714
  filterTopBorder
745
715
  }
716
+ //==过滤区域============
717
+
718
+ //==分类区域============
719
+
720
+ //分类-基础
721
+ this.allName = gCPVal(container, 'allName', "全部");
722
+ this.allIcon = gCPVal(container, "allIcon", {});
723
+ this.allIconSize = 128 - Number(gCPVal(container, "iconWdith", 128));
724
+
725
+ //兼容数据
726
+
727
+
728
+
729
+ // //兼容分类操作
730
+ // let category = 'v1';
731
+ // //老数据已设置
732
+ // if(data['categoryLayout']) {
733
+ // category = data['categoryLayout'];
734
+ // //设置v1项
735
+ // if(data['categoryLayout'] === 'v1') {
736
+ // if(data['categoryLayout1ShowType'] === 'child') {
737
+ // category = 'v3';
738
+ // }
739
+ // }
740
+ // }
741
+ // //分类已设置隐藏(设置隐藏项)
742
+ // if(data['showCategory'] === 'N') {
743
+ // category = 'none';
744
+ // }
745
+ // //新数据已设置值
746
+ // if(data['category'] !== undefined) {
747
+ // category = data['category'] ;
748
+ // }
749
+
750
+ //分类 - 功能设置
751
+ if(category) {
752
+ if(category === 'none'){
753
+ showCategory = 'N';
754
+ categoryLayout = 'none';
755
+ categoryLayout1ShowType = 'none';
756
+ }
757
+ else if(category === 'v5'){
758
+ categoryLayout = 'v1';
759
+ categoryLayout1ShowType = 'parent';
760
+ showCategory = 'Y';
761
+ }
762
+ else if(category === 'v4'){
763
+ categoryLayout = 'v1';
764
+ categoryLayout1ShowType = 'parentNew';
765
+ showCategory = 'Y';
766
+ }
767
+ else if(category === 'v3') {
768
+ categoryLayout = 'v1';
769
+ categoryLayout1ShowType = 'child';
770
+ showCategory = 'Y';
771
+ }
772
+ else if(category === 'v2') {
773
+ categoryLayout = 'v2';
774
+ showCategory = 'Y';
775
+ categoryLayout1ShowType = 'v2';
776
+ }
777
+ else if(category === 'v1') {
778
+ categoryLayout = 'v1';
779
+ categoryLayout1ShowType = 'all';
780
+ showCategory = 'Y';
781
+ }
782
+ }
783
+ this.orgCategory = category;
784
+ this.showCategory = showCategory;
785
+ this.categoryLayout = categoryLayout;
786
+ this.categoryLayout1ShowType = categoryLayout1ShowType;
787
+ let defNewTitleStyle = {
788
+ color: '#333',
789
+ actColor: this.mainColor,
790
+ fontSize: '32',
791
+ actFontSize: '32',
792
+ fontWeight:'400',
793
+ actFontWeight: '500',
794
+ bgColor: '#f8f8f8',
795
+ actBgColor: Color(this.mainColor).alpha(0.15).toString()
796
+ }
797
+ let defTitleStyle = {
798
+ color: gCPVal(container, 'titleColor', '',{}) || '#333',
799
+ actColor: this.mainColor,
800
+ fontSize: '30',
801
+ actFontSize: '30',
802
+ fontWeight:'normal',
803
+ actFontWeight: 'normal',
804
+ bgColor: '#f8f8f8',
805
+ actBgColor: Color(this.mainColor).alpha(0.15).toString()
806
+ }
807
+
808
+ if(this.categoryLayout === 'v2') {
809
+ defTitleStyle['fontSize'] = '36';
810
+ defTitleStyle['actFontSize'] = '36';
811
+ }
812
+
746
813
 
814
+ //分类-文字标题
815
+ this.titleBgColor = gCPVal(container, 'titleBgColor', '#fff',{sKey:'titleBgColorStatus', fields:['titleBgColor']});
816
+ const titleStyle = gCPVal(container, 'titleStyle', [defNewTitleStyle, defTitleStyle],{sKey:'titleStyleStatus', fields:['titleStyle','titleColor'],isMerge: true});
817
+ const titleColor = titleStyle.color;
818
+ const titleActColor = titleStyle.actColor;
819
+ const titleFontSize = titleStyle.fontSize;
820
+ const titleActFontSize = titleStyle.actFontSize;
821
+ const titleFontWeight = titleStyle.fontWeight;
822
+ const titleActFontWeight = titleStyle.actFontWeight;
823
+ const titleBgColor = titleStyle.bgColor;
824
+ const titleActBgColor = titleStyle.actBgColor;
747
825
 
748
826
  //二级导航文字颜色
749
- this.level2BgcColor = getContainerPropsValue(container, 'content.level2BgcColor', '#fafafa');
750
- this.level2Color = getContainerPropsValue(container, 'content.level2Color', '#333');
751
- this.showActivityPrice = getContainerPropsValue(container, 'content.showActivityPrice', 'N');
827
+ this.level2BgcColor = gCPVal(container, 'level2BgcColor', ['#fff','#f8f8f8'],{sKey:'level2BgcColorStatus', fields:['level2BgcColor']});
752
828
 
753
- //高级属性
754
- this.productInfoPath = getContainerPropsValue(container, 'content.productInfoPath', {value: ""}).value;
755
- this.xnamespace = getContainerPropsValue(container, "content.xnamespace", this.projectAttr.business_code);
756
- this.isCityFilter = getContainerPropsValue(container, "content.isCityFilter", "N");
757
- let compConfig = getContainerPropsValue(container, "content.compConfig", null);
758
- let tagsKeys= this.getProductTagsKeys(compConfig,container)
759
- this.need_show_tags = this.getProductTagsParams(compConfig,tagsKeys)
760
- if(this.isPreview){
761
- this.getSearchFilterList();
829
+ let color = gCPVal(container, 'level2Color', '') || '#333',
830
+ actColor= this.mainColor , bgColor='',bgActColor='';
831
+ if(categoryLayout1ShowType === 'parentNew') {
832
+ actColor = '#fff';
833
+ bgActColor = this.mainColor;
762
834
  }
763
- },
764
835
 
765
- getPosterList(){
766
- jfbRootExec('getMallProductListPoster', {
767
- vm: this,
768
- data: {
769
- page_id: this.pageAttr['page_id'], //页面ID
770
- container_id: this.containerId, //组件ID
771
- page_size: this.posterNum //可以不传
772
- },
773
- })
774
- .then(res => {
775
- let posterList = res.list.map((item,index) => {
776
- return {
777
- ...item,
778
- image_background_url: item.image_background_url?getServiceUrl(item.image_background_url):'',
779
- image_url: item.image_url?getServiceUrl(item.image_url):''
780
- }
781
- });
782
- this.posterList = this.posterFilterNoUseData(posterList);
783
- })
784
- .catch(err=>{
785
- console.error(err);
786
- })
787
- },
836
+ let defOldLvel2Name = {
837
+ fontSize: '24',
838
+ actFontSize: '24',
839
+ color: color,
840
+ actColor:actColor,
841
+ bgColor:bgColor,
842
+ actBgColor:bgActColor,
843
+ fontWeight: 'normal',
844
+ actFontWeight: 'normal',
845
+ }
846
+ let defNewLvel2Name = {
847
+ fontSize: '24',
848
+ actFontSize: '24',
849
+ color: '#333',
850
+ actColor: actColor,
851
+ bgColor:bgColor,
852
+ actBgColor:bgActColor,
853
+ fontWeight: 'normal',
854
+ actFontWeight: 'normal',
855
+ }
856
+ const level2Name = gCPVal(container, 'level2Name', [defNewLvel2Name,defOldLvel2Name],{sKey:'level2NameStatus', fields:['level2Name','level2Color'],isMerge: true});
857
+ const subTitleRadius = gCPVal(container, 'subTitleRadius', ['40rpx'],{sKey:'subTitleRadiusStatus', fields:['subTitleRadius']})||0;
858
+ const subTitleIconShadow = gCPVal(container, 'subTitleIconShadow', [this.gStyleValue.shadow,'none'], {isShadow:true});
859
+ const subTitleIconBorder = gCPVal(container, 'subTitleIconBorder', [{style:'solid', width: '2', color: this.mainColor},'0'], {isBorder:true});
860
+ let navStyle = gCPVal(container, 'navStyle', 'line-6-8-s');
861
+ if(navStyle.indexOf('line-') === 0) navStyle = 'line-6-8-s';
862
+ const iconWdith = gCPVal(container, 'iconWdith', [96],{sKey:'iconWdithStatus', fields:['iconWdith']});
863
+ const iconImageSp = gCPVal(container, 'iconImageSp', [16],{sKey:'iconImageSpStatus', fields:['iconImageSp']});
864
+ const iconBgColor = gCPVal(container, 'iconBgColor', [100],{sKey:'iconBgColorStatus', fields:['iconBgColor']});
865
+
866
+ this.tabStyle = {
867
+ titleColor,
868
+ titleActColor,
869
+ titleFontSize,
870
+ titleActFontSize,
871
+ subTitleRadius,
872
+ titleFontWeight,
873
+ titleActFontWeight,
874
+ subTitleIconShadow,
875
+ subTitleIconBorder,
876
+ iconWdith,
877
+ iconImageSp,
878
+ iconBgColor,
879
+ titleBgColor,
880
+ titleActBgColor,
881
+ level2Name,
882
+ filterBgcColor: this.filterBgcColor,
883
+ allNameKey: Date.now(),
884
+ navStyle,
885
+ level2BgcColor: this.level2BgcColor
886
+ }
887
+ //==分类区域============
888
+
889
+ //==商品区域============
890
+ //商品样式内容
891
+ this.rowSpacing = Number(gCPVal(container,'rowSpacing', [16,20], {sKey:'columnRowStatus',fields:['rowSpacing','columnSpacing']}));
892
+ this.columnSpacing = Number(gCPVal(container,'columnSpacing', [16,20], {sKey:'columnRowStatus',fields:['rowSpacing','columnSpacing']}));
893
+ let radius = gCPVal(container,'radius', '');
894
+ let imageRadius = gCPVal(container,'imageRadius', '');
895
+ let radiusNew = gCPVal(container,'radiusNew', [this.gStyleValue.radius,'-123456'], {sKey:'radiusStatus',isEmpty:true,fields:['radius','radiusNew']});
896
+ let imageRadiusNew = gCPVal(container,'imageRadiusNew', [this.gStyleValue.radius/2,'-123456'], {sKey:'imageRadiusStatus',isEmpty:true,fields:['imageRadius','imageRadiusNew']});
897
+ if(['','-123456'].includes(radiusNew)) radiusNew = radius;
898
+ if(['','-123456'].includes(imageRadiusNew)) imageRadiusNew = imageRadius;
899
+ if(radiusNew === null) radiusNew = '0';
900
+ if(imageRadiusNew === null) imageRadiusNew = '0';
901
+ this.radius = radiusNew;
902
+ this.imageRadius = imageRadiusNew;
903
+
904
+
905
+ this.itemPadding = gCPVal(container,'itemPadding', [16,20], {sKey:'itemPaddingStatus',fields:['itemPadding'],isPMR: true});
906
+ this.contShadow = gCPVal(container, 'contShadow', [this.gStyleValue.shadow,'none'], {isShadow:true, bsOld:['is_shadow','is_shadow_w','is_shadow_bg']});
907
+ this.itemSpacing = gCPVal(container,'itemSpacing', [16,20], {sKey:'contStyleStatus',fields:['itemSpacing','contStyle']});
908
+ this.itemFontStyle = this.getFontAndBgcStyle(
909
+ gCPVal(container,'contStyle', {}, {sKey:'contStyleStatus',fields:['itemSpacing','contStyle']}),
910
+ {fontSize: '28rpx', color: '#000', fontWeight: 'normal'},
911
+ )
912
+
913
+ //商品样式关联属性
914
+ const sValue = "{\"border\":0,\"backgroundColor\":\"#fff\"}";
915
+ let itemBgcColoStyle = this.getRelationStatus(container,'productStyle',{ itemBgcColorStatus:['itemBgcColor'],bgBorder:['contBorder', 'bs']},sValue);
916
+ this.itemBgcColor = gCPVal(container, 'itemBgcColor', ['#fff'], {sKey: 'itemBgcColorStatus', cusFields: ['productStyle','backgroundColor',itemBgcColoStyle]});
917
+ this.contBorder = gCPVal(container, 'contBorder', [{color: '#eee',width: '0',style: 'solid'},{color: 'rgba(0,0,0,0)',width: '0',style: 'solid'}], {isBorder: true, bsOld:['is_border','is_border_w','is_border_c'], cusFields: ['productStyle','border',itemBgcColoStyle]});
918
+ this.contStyleBorder = gCPVal(container, 'contBorder', [{color: '#eee',width: '0',style: 'solid'},{color: 'rgba(0,0,0,0)',width: '0',style: 'solid'}], {isBorder: true, isBsWidth: true, bsOld:['is_border','is_border_w','is_border_c'], cusFields: ['productStyle','border',itemBgcColoStyle]});
919
+
920
+ //品牌样式
921
+ this.brandColor = gCPVal(container,'brandColor', '#999', {sKey:'brandStatus',fields:['brandColor','brandBgColor','brandBorColor']});
922
+ this.brandBgColor = gCPVal(container,'brandBgColor', '', {sKey:'brandStatus',fields:['brandColor','brandBgColor','brandBorColor']});
923
+ this.brandBorColor = gCPVal(container,'brandBorColor', '', {sKey:'brandStatus',fields:['brandColor','brandBgColor','brandBorColor']});
788
924
 
789
- onJfbLoad(options) {
790
- //设置业务请求代码
791
- this.setNameSpace(options);
925
+ //商品设置
926
+ this.productConfig = this.getProductConfig(container,{cartStyle:'icongouwuche-01'});
927
+ let compConfig = gCPVal(container, "compConfig", null);
928
+ let tagsKeys= this.getProductTagsKeys(compConfig,container)
929
+ this.need_show_tags = this.getProductTagsParams(compConfig,tagsKeys);
792
930
 
793
- this.options = options;
794
- this.keyword = options.keyword;
795
- this.pid = options.pid;
796
- this.cateId = options.cateId;
797
- this.brand_ids = options.brand_id;
798
- this.delivery = options.delivery;
799
- this.brand_type = options.brand_type;
800
- this.getList();
801
- this.getPosterList();
802
- this.isOnloaded = true;
803
- this.getSearchFilterList();
931
+ //==商品区域============
804
932
 
805
- if(this.showCategory==="Y"){
806
- this.getCategoryList();
807
- }else{
808
- this.loaded = true;
809
- }
933
+ //高级属性
934
+ this.productInfoPath = gCPVal(container, 'content.productInfoPath', {value: ""}).value;
935
+ this.isCityFilter = gCPVal(container, "content.isCityFilter", "N");
936
+
937
+ //记载完成
938
+ this.initStatus = true;
939
+ },
810
940
 
941
+ //=====广告数据,商品列表, 分类数据,过滤条件===========
942
+ //广告列表
943
+ getPosterList(){
944
+ return new Promise((resolve,reject)=>{
945
+ jfbRootExec('getMallProductListPoster', {
946
+ vm: this,
947
+ data: {
948
+ page_id: this.pageAttr['page_id'], //页面ID
949
+ container_id: this.containerId, //组件ID
950
+ page_size: this.posterNum //可以不传
951
+ },
952
+ })
953
+ .then(res => {
954
+ let posterList = res.list.map((item,index) => {
955
+ return {
956
+ ...item,
957
+ image_background_url: item.image_background_url?getServiceUrl(item.image_background_url):'',
958
+ image_url: item.image_url?getServiceUrl(item.image_url):''
959
+ }
960
+ });
961
+ this.posterList = this.posterFilterNoUseData(posterList);
962
+ resolve()
963
+ })
964
+ .catch(err=>{
965
+ this.posterList = [];
966
+ console.error(err);
967
+ resolve();
968
+ })
969
+ })
811
970
  },
812
971
 
972
+ //分列处理(1,2,3列)
813
973
  getItemData(cellIndex,data){
814
974
  let list = this.$xdUniHelper.cloneDeep(data);
815
975
  return list.filter((it,index) => {
@@ -817,111 +977,31 @@
817
977
  })
818
978
  },
819
979
 
820
-
821
- getContentStyle(type='cont'){
822
- //总宽度
823
- let outerWidht = uni.getSystemInfoSync().safeArea.width * this.$pxNum;
824
-
825
- //外边距
826
- let outMargin = 0
827
-
828
- //列表填充
829
- let outPadding = this.getPMValue(this.listPadding, 'RL', 20)
830
-
831
- //间距设置
832
- if(this.$xdUniHelper.checkVarType(this.columnSpacing) === 'string') this.columnSpacing = Number(this.columnSpacing);
833
- let columnSpacing = Math.floor((this.columnSpacing * (this.column_num-1))); //公式:列数量 * 边距 + 边距
834
-
835
- //item内容填充
836
- let paddinRL = this.getPMValue(this.itemPadding, 'RL', 20) * this.column_num;
837
-
838
- //边框
839
- let borderRL = 0;
840
- if(typeof this.contBorder === 'string') {
841
- let borderArr = this.contBorder.split(' ');
842
- if(borderArr.length === 3) {
843
- borderRL = parseInt(borderArr[0]);
844
- }
845
- }
846
- if(type === 'ske') borderRL = 0;
847
- borderRL = borderRL * this.column_num;
848
-
849
- let str = this.getMarginAndPadding(this.itemPadding,20);
850
-
851
- return {
852
- marginBottom: this.rowSpacing + 'rpx',
853
- width: Math.floor((outerWidht - (outMargin + outPadding + columnSpacing + paddinRL + borderRL))/this.column_num) + 'rpx',
854
- borderRadius: this.radius + 'rpx',
855
- boxShadow: '0 0 10rpx rgba(0,0,0,.08)',
856
- padding: str,
857
- backgroundColor: 'rgba(255,255,255,.8)'
858
- };
859
- },
860
-
861
- handleAllChange(){
862
- if(this.$configProject['isPreview']){
863
- this.navList = this.navList.map(item=>{
864
- if(item.category_id === -1) return this.getAllCategory;
865
- else return item;
866
- })
867
- }
868
- },
869
-
870
- /**
871
- * @replace true: 手动点击分类
872
- */
873
- getList(replace = false){
874
- let product_types = '';
875
- if(this.brand_type === 'code') product_types = 'card'
876
- let data = {
877
- xnamespace: this.xnamespace,
878
- random_score_seed: this.random_score_seed,
879
- page_token: this.page_token,
880
- page_size: this.page_size,
881
- keyword: this.keyword,
882
- brand_ids: this.brand_ids,
883
- delivery_method: this.delivery,
884
- filter_keys: this.filter_keys,
885
- sort: this.sort,
886
- custom_category_id: this.cateId || this.pid,
887
- city_code: this.isCityFilter === "Y" ? this.stateCity.city_code : "",
888
- need_show_tags: this.need_show_tags.join()
889
- }
890
- if(this.productConfig.isShowDiscount==='Y'){
891
- data.is_show_uprice=this.$xdUniHelper.multiplyFloatNumber(this.productConfig.differ,100)
892
- } else {
893
- data.is_show_uprice=-1
894
- }
895
- if(product_types) {
896
- data['product_types'] = product_types;
897
- }
898
-
899
-
980
+ //商品列表
981
+ getList(){
982
+ let data = this.getProductListParams();
900
983
  if(!this.isFirst) this.$xdShowLoading({});
901
984
  this.isFirst = false;
902
985
  clearTimeout(this.timer);
903
986
  this.timer = setTimeout(() => {
904
- jfbRootExec("getMallProductList", {
987
+ jfbRootExec("getNewMallProductList", {
905
988
  vm: this,
906
989
  data: this.$xdUniHelper.deleteParamEmptyKey(data)
907
990
  })
908
991
  .then(res => {
909
- this.loadingList = false;
910
992
  if (!this.isFirst) this.$xdHideLoading();
911
993
 
912
994
  let list = this.$xdUniHelper.cloneDeep(res.list||[]).map((item,index) => {
913
995
  item['thumb'] = item.thumb ? getServiceUrl(item['thumb'], "size3") : "";
914
996
  item['key'] = item['product_id'] || index;
915
997
  item['is_poster'] = 'N';
916
-
917
998
  return item;
918
999
  });
1000
+
919
1001
  //插入广告位置
920
- if(this.isPoster === 'Y'
921
- && Number(this.page_token) === 1
922
- ) {
1002
+ if(this.isOpenPoster && Number(this.page_token) === 1) {
923
1003
  let posterIndex = 0;
924
- if(this.column_num === 1) posterIndex = 3;
1004
+ if(this.column_num === 1 && this.columnOneLayout === 'H') posterIndex = 3;
925
1005
  if(this.column_num === 2) posterIndex = 1;
926
1006
  if(this.posterIndex) {
927
1007
  let n = Number(this.posterIndex);
@@ -930,7 +1010,8 @@
930
1010
  posterIndex = n - 1;
931
1011
  }
932
1012
 
933
- if(this.column_num === 1 || this.column_num === 2) {
1013
+ //一列水平与二列边界处理
1014
+ if(this.columnOneLayout === 'H' || this.column_num === 2) {
934
1015
  //边界,列表大于设定等显示广告
935
1016
  if(list.length === 0) {
936
1017
  list.push({is_poster: 'Y'});
@@ -942,213 +1023,183 @@
942
1023
  list.splice(posterIndex,0,{is_poster: 'Y'})
943
1024
  }
944
1025
  }
945
-
946
1026
  }
947
1027
 
948
- let next_page_token = res.next_page_token;
949
- this.next_page_token = next_page_token;
950
- this.hasNext = !!next_page_token;
951
1028
 
952
- if(this.page_token === '1'){
953
- this.$nextTick(() => {
954
- uni.pageScrollTo({
955
- scrollTop: 0,
956
- duration: 0
957
- });
958
- })
959
- }
1029
+ //预览模式
960
1030
  if(this.$configProject['isPreview']){
961
- this.prodList = list;
962
- this.prodList = this.prodList.map(item=>{
1031
+ this.prodList = list.map(item=>{
963
1032
  if(this.productConfig.isPrice==='N'){
964
1033
  item.show_prices=[]
965
1034
  }
1035
+
966
1036
  if(this.productConfig.isShowDiscount==='N'){
967
1037
  item.show_prices=item.show_prices.filter(item=>item.t!=='U')
968
1038
  }
969
- if(item.tags&&item.tags.length>0){
970
- item.tags = item.tags.filter(
971
- tag=>{
972
- return this.need_show_tags.includes(tag.type)
973
- }
974
- )
1039
+
1040
+ if(item.tags && item.tags.length>0){
1041
+ let fiterTags = this.$xdUniHelper.cloneDeep(this.need_show_tags);
1042
+ item.tags = item.tags.filter(tag=>{
1043
+ return fiterTags.includes(tag.type)
1044
+ })
975
1045
  }
976
1046
  return item;
977
1047
  })
978
- }else{
1048
+ }
1049
+ else{
979
1050
  this.prodList = (this.prodList||[]).concat(list);
980
1051
  }
1052
+
1053
+ let next_page_token = res.next_page_token;
1054
+ this.next_page_token = next_page_token;
1055
+ this.hasNext = !!next_page_token;
1056
+
1057
+ if(this.page_token === '1'){
1058
+ this.$nextTick(() => {
1059
+ uni.pageScrollTo({
1060
+ scrollTop: 0,
1061
+ duration: 0
1062
+ });
1063
+ })
1064
+ }
981
1065
  })
982
1066
  .catch(err => {
983
1067
  if (!this.isFirst) this.$xdHideLoading();
984
1068
  this.$xdLog.catch(err);
1069
+ this.prodList = [];
985
1070
  })
986
1071
  }, 10)
987
1072
  },
988
1073
 
1074
+ //分类数据
989
1075
  getCategoryList(){
990
- jfbRootExec("getMallCategoryTree", {
991
- vm: this,
992
- data: {
993
- xnamespace: this.xnamespace,
994
- parent_id: 0,
995
- level: 2,
996
- need_rec: this.options.need_rec
1076
+ return new Promise((resolve)=>{
1077
+ if(this.showCategory==="Y") {
1078
+ jfbRootExec("getNewMallCategoryTree", {
1079
+ vm: this,
1080
+ data: {
1081
+ xnamespace: this.xnamespace,
1082
+ root_category_id: Number(this.parentId),
1083
+ level:['all','v2','parentNew'].includes(this.categoryLayout1ShowType)?2:1,
1084
+ }
1085
+ })
1086
+ .then(res => {
1087
+ let truePid = '';
1088
+ let trueCateId = '';
1089
+ //是否需要坚持第二层
1090
+ let isLevelTwo = !['child','parent'].includes(this.categoryLayout1ShowType);
1091
+ let navList = res.items.map(item => {
1092
+ item['name'] = item.category_name;
1093
+ item['id'] = item.category_id;
1094
+ //页面传参中的一级分类否分存在
1095
+ if(this.pid && Number(this.pid) === item.category_id) truePid = item.category_id;
1096
+ item['category_icon'] = getServiceUrl(item['category_icon'], 'size3');
1097
+ item.children = item.children.map(child => {
1098
+ //页面传参中的二级分类否分存在
1099
+ if(truePid && isLevelTwo && this.cateId && Number(this.cateId) === child.category_id) trueCateId = child.category_id;
1100
+ child['category_icon'] = getServiceUrl(child['category_icon'], 'size3');
1101
+ return child;
1102
+ });
1103
+ return item;
1104
+ });
1105
+ if(navList.length > 0) {
1106
+ this.navList = [this.getAllCategory].concat(navList);
1107
+ }
1108
+ else this.navList = [];
1109
+ this.truePid = truePid;
1110
+ this.trueCateId = trueCateId;
1111
+ this.loaded = true;
1112
+ resolve()
1113
+ })
1114
+ .catch(err => {
1115
+ this.$xdLog.catch(err);
1116
+ this.loaded = true;
1117
+ resolve()
1118
+ })
997
1119
  }
998
- }).then(res => {
999
- let navList = res.items.map(item => {
1000
- item['name'] = item.category_name;
1001
- item['id'] = item.category_id;
1002
- item['category_icon'] = getServiceUrl(item['category_icon'], 'size3');
1003
- item.children = item.children.map(child => {
1004
- child['category_icon'] = getServiceUrl(child['category_icon'], 'size3');
1005
- return child;
1006
- });
1007
- return item;
1008
- });
1009
- if(navList.length > 0) {
1010
- this.navList = [this.getAllCategory].concat(navList);
1120
+ else {
1121
+ this.navList = [];
1122
+ this.loaded = true;
1123
+ resolve()
1011
1124
  }
1012
- else this.navList = [];
1013
- this.loaded = true;
1014
- }).catch(err => {
1015
- this.$xdLog.catch(err);
1125
+
1016
1126
  })
1017
1127
  },
1018
1128
 
1129
+ //过滤条件
1019
1130
  getSearchFilterList(){
1020
- let product_types='';
1021
- if(this.brand_type === 'code') product_types = 'card'
1022
- let data = {
1023
- xnamespace: this.xnamespace,
1024
- keyword: this.keyword,
1025
- brand_ids: this.options.brand_id,
1026
- city_code: this.isCityFilter === "Y" ? this.stateCity.city_code : "",
1027
- custom_category_id: this.cateId || this.pid,
1028
- is_need_delivery_method: this.isShowDelivery
1029
- }
1030
- if(product_types) {
1031
- data['product_types'] = product_types;
1032
- }
1033
- jfbRootExec("getSearchFilterList", {
1131
+ let data = this.getFilterListParams();
1132
+ jfbRootExec("getNewSearchFilterList", {
1034
1133
  vm: this,
1035
1134
  data: data
1036
1135
  }).then(res => {
1037
- // if(this.delivery) {
1038
- // res.items = res.items.map((item=>{
1039
- // if(item.title==='配送方式') {
1040
- // item.options = item.options.filter((Sitem=>{
1041
- // return Sitem.value === this.delivery
1042
- // }))
1043
- // }
1044
- // return item
1045
- // }))
1046
- // }
1047
- let filterItems = res.items;
1048
- this.searchFilterListOrg = this.$xdUniHelper.cloneDeep(filterItems);
1049
- if(this.showBrandFilter === 'in'){
1050
- this.searchFilterList = filterItems;
1051
- }else if(this.showBrandFilter === 'out'){
1052
- this.searchFilterList = filterItems.filter(item=>{
1053
- return item.title !== '品牌'
1054
- })
1055
- let haveBrand = filterItems.find(item=>item.title==='品牌');
1056
- if(haveBrand) this.brandList = haveBrand.options;
1057
- }
1058
- // this.searchFilterList = res.items;
1059
- // this.searchFilterListOrg = this.$xdUniHelper.cloneDeep(res.items);
1136
+ this.searchFilterList = this.$xdUniHelper.cloneDeep(res.items)
1137
+ .map(item=>{
1138
+ if(item.title === '口味') item['multiple'] = false;
1139
+ if(item.title === '配送方式') item['multiple'] = false;
1140
+ return item
1141
+ });
1142
+
1143
+
1060
1144
  }).catch(err => {
1061
1145
  this.$xdHideLoading();
1062
1146
  this.$xdLog.catch(err);
1063
1147
  })
1064
1148
  },
1065
1149
 
1066
- handleQuerySort(sortData){
1067
- if(this.sort === sortData.value) return false;
1068
- this.sortData = sortData;
1069
- this.sort = sortData.value;
1070
- this.clearProductData();
1071
- this.getList();
1072
- this.showQueryModal = false;
1073
- },
1074
- handleQueryBrand(brand_ids){
1075
- console.log('handleQueryBrand', brand_ids);
1076
- let brands = brand_ids.join(",");
1077
- this.showQueryModal = false;
1078
- if(this.brand_ids === brands) return false;
1079
- this.brand_ids = brands;
1080
- this.clearProductData();
1081
- this.getList();
1082
- },
1083
- handleQueryFilter(filterData){
1084
- if(JSON.stringify(this.filterData) === JSON.stringify(filterData)) {
1085
- this.showQueryModal = false;
1086
- return false;
1087
- }
1088
- this.filterData = filterData;
1089
- let brand = filterData.find(item=>item.key==='品牌')
1090
- let delivery = filterData.find(item=>item.key==='配送方式')
1091
- let filters = filterData.filter(item=>item.key!=='品牌'&&item.key!=='配送方式')
1092
-
1093
- try {
1094
- if(brand&&brand.value) {
1095
- this.brand_ids = brand.value.join(",");
1096
- }
1097
- if(delivery&&delivery.value) {
1098
- this.delivery = delivery.value.join(",");
1099
- }
1100
- this.filter_keys = filters.reduce((pre,next) => pre.concat(next.value), []).join(",");
1101
- } catch (error) {
1102
- }
1103
- this.clearProductData();
1104
- this.getList();
1105
- this.showQueryModal = false;
1150
+ clearProductData(){
1151
+ this.prodList = null;
1152
+ this.page_token = '1';
1153
+ this.next_page_token = '';
1106
1154
  },
1107
1155
 
1108
- switchQueryModal(curQueryTab){
1109
- //"filter"
1110
- if(this.curQueryTab === curQueryTab) {
1111
- this.showQueryModal = !this.showQueryModal;
1156
+ //选择分类处理
1157
+ handleCateChange(options){
1158
+ if(options.pid === -1) {
1159
+ this.truePid = '';
1160
+ this.trueCateId = '';
1112
1161
  }
1113
- //"sort"
1114
- else{
1115
- this.curQueryTab = curQueryTab
1116
- this.showQueryModal = true;
1162
+ else {
1163
+ if(options.pid) this.truePid = options.pid;
1164
+ if(options.cateId) this.trueCateId = options.cateId;
1117
1165
  }
1166
+ //关闭选中菜单
1167
+ this.$refs['filter-query'].hideSelectMenu();//隐藏菜单
1168
+ this.$refs['filter-query'].clearFitlerMenu();//清除过滤条件处理
1169
+ this.clearProductData(); //清除商品列表数据
1170
+ this.getSearchFilterList();
1118
1171
  },
1119
1172
 
1120
- closeQueryModal(){
1121
- this.showQueryModal = false;
1173
+ //分类样式二操作分类显示时候关键过滤条件选择框(当前过滤条件框开启时候)
1174
+ handleCateOpen(){
1175
+ this.$refs['filter-query'].hideSelectMenu();//隐藏菜单
1122
1176
  },
1123
1177
 
1124
- moveHandle(){},
1125
-
1126
- //分类change处理
1127
- handleCateChange(options){
1128
- let pid = '';
1129
- if(options.pid !== -1) pid = options.pid;
1130
- this.pid = pid;
1131
- this.cateId = options.cateId || "";
1132
- this.handleOnCate();
1133
- this.getList();
1178
+ handleAllChange(){
1179
+ if(this.$configProject['isPreview']){
1180
+ this.navList = this.navList.map(item=>{
1181
+ if(item.category_id === -1) return this.getAllCategory;
1182
+ else return item;
1183
+ })
1184
+ }
1134
1185
  },
1135
1186
 
1136
- //一级、二级分类共同处理
1137
- handleOnCate(){
1138
- this.brand_ids = "";
1139
- this.brand_type = "";
1140
- this.delivery = "";
1141
- this.filter_keys = "";
1142
- //点击分类时,触发重置筛选条件
1143
- this.getSearchFilterList();
1144
- this.clearProductData();
1145
- },
1187
+ //=====广告数据,商品列表, 分类数据,过滤条件===========
1146
1188
 
1147
- clearProductData(){
1148
- this.prodList = null;
1149
- this.page_token = '1';
1150
- this.next_page_token = '';
1189
+
1190
+ //==菜单相关操作==============
1191
+ handleFitlerChange({params}){
1192
+ let menuSelectParams = {};
1193
+ if(params['brand']) menuSelectParams['brand_ids'] = params['brand'];
1194
+ if(params['sort']) menuSelectParams['sort'] = params['sort'];
1195
+ if(params['delivery_method']) menuSelectParams['delivery_method'] = params['delivery_method'];
1196
+ if(params['filter_keys']) menuSelectParams['filter_keys'] = params['filter_keys'];
1197
+ this.menuSelectParams = menuSelectParams;
1198
+ console.log('getProductListParams',JSON.stringify(this.menuSelectParams));
1199
+ this.clearProductData(); //清除商品列表数据
1200
+ this.getList()
1151
1201
  },
1202
+ //==菜单相关操作==============
1152
1203
 
1153
1204
  toProductInfo(item){
1154
1205
  if (this.$configProject['isPreview'])return;
@@ -1156,18 +1207,9 @@
1156
1207
  },
1157
1208
 
1158
1209
  onJfbScroll({e}){
1159
-
1160
- //#ifdef H5
1161
1210
  if (this.isPreview || this.loading === false) return;
1162
1211
  //调用子组件方法
1163
1212
  this.$refs.VT.topData(e.scrollTop);
1164
- if(this.categoryLayout === 'v1'){
1165
- let fixedTop = this.$refs['xdCateV1'].fixedTop;
1166
- this.isFixed = e.scrollTop > fixedTop;
1167
- }else{
1168
- this.isFixed = true;
1169
- }
1170
- // #endif
1171
1213
  },
1172
1214
 
1173
1215
  onJfbReachBottom(){
@@ -1183,16 +1225,29 @@
1183
1225
 
1184
1226
  onJfbCustomEvent({action, data}){
1185
1227
  if(action === 'baseHeader@search'){
1186
- uni.pageScrollTo({
1187
- scrollTop: 0,
1188
- duration: 0
1189
- });
1190
- this.keyword = data;
1191
- this.clearProductData();
1192
- this.getList();
1228
+ if(this.searchTimer) {
1229
+ clearTimeout(this.searchTimer);
1230
+ this.searchTimer = null;
1231
+ }
1232
+ this.searchTimer = setTimeout(()=>{
1233
+ uni.pageScrollTo({
1234
+ scrollTop: 0,
1235
+ duration: 0
1236
+ });
1237
+ this.keyword = data;
1238
+ this.clearProductData();
1239
+ this.getSearchFilterList();
1240
+ this.getList();
1241
+ },1000)
1193
1242
  }
1194
- console.log('onJfbCustomEvent',action, data);
1195
- }
1243
+
1244
+ },
1245
+
1246
+ onJfbUpdate() {
1247
+ if(this.isPreview){
1248
+ this.getPosterList()
1249
+ }
1250
+ },
1196
1251
  }
1197
1252
  }
1198
1253
 
@@ -1291,51 +1346,6 @@
1291
1346
  height: unit(100, rpx);
1292
1347
  }
1293
1348
 
1294
- .query_wrap{
1295
- display: flex;
1296
- justify-content: space-around;
1297
- background: #FFFFFF;
1298
- position: relative;
1299
- z-index: 101;
1300
- .query_item{
1301
- display: flex;
1302
- font-size: unit(28, rpx);
1303
- line-height: unit(100, rpx);
1304
- justify-content: center;
1305
- align-items: center;
1306
- flex-shrink: 0;
1307
- & > view {
1308
- display: flex;
1309
- justify-content:center;
1310
- align-items: center;
1311
- width: unit(40, rpx);
1312
- height: unit(90, rpx);
1313
- flex-shrink: 0;
1314
- margin-top: unit(1, rpx);
1315
- }
1316
- & > text {
1317
- padding-right: unit(10, rpx);
1318
- flex-shrink: 0;
1319
- }
1320
- }
1321
- .query_modal{
1322
- position: absolute;
1323
- background: #FFFFFF;
1324
- left: 0;
1325
- top: 100rpx;
1326
- z-index: 100;
1327
- border-top: 1px solid #F5F5F5;
1328
- width: 100%;
1329
- }
1330
-
1331
- }
1332
- .scrollY_wrap{
1333
- flex: 1;
1334
- overflow: hidden;
1335
- .scroll_y{
1336
- height: 100%;
1337
- }
1338
- }
1339
1349
  .empty_data{
1340
1350
  text-align: center;
1341
1351
  color: #999999;
@@ -1404,6 +1414,11 @@
1404
1414
  }
1405
1415
  //poster========
1406
1416
 
1417
+ .list-product{
1418
+ position: relative;
1419
+ z-index: 2;
1420
+ }
1421
+
1407
1422
 
1408
1423
  }
1409
1424
  }