jufubao-food 1.0.12 → 1.0.13-beta2

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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "jufubao-food",
3
- "version": "1.0.12",
3
+ "version": "1.0.13-beta2",
4
4
  "private": false,
5
5
  "description": "聚福宝业务组件餐饮插件包",
6
6
  "main": "index.js",
@@ -177,6 +177,7 @@
177
177
  return style;
178
178
  },
179
179
  productShowPrice(){
180
+ if(this.curSku && this.curSku.show_prices) return this.curSku.show_prices;
180
181
  let originPrice = JSON.parse(JSON.stringify(this.baseInfo.show_prices));
181
182
  return originPrice.map(item => {
182
183
  let p = item.p + this.specsPrice;
@@ -146,7 +146,7 @@ export default {
146
146
  let isExt = true;
147
147
  let standards = item.standards;
148
148
  checkedList.forEach((o1,ii) => {
149
- let standItem = standards[ii];
149
+ let standItem = standards.find(stand => stand.name === o1.name);
150
150
  if(o1.value != standItem.value){
151
151
  isExt = false;
152
152
  }
@@ -157,6 +157,7 @@ export default {
157
157
  this.currSku = rtList[0];
158
158
  }
159
159
  },
160
+
160
161
  checkHasProduct(i, ii){
161
162
  let curSku = this.skuList[i];
162
163
  let curStands = curSku.values[ii];
@@ -70,7 +70,7 @@
70
70
  <view style="display:flex;align-items:center">
71
71
  <CusPrice :isPlus="is_plus_site" :isShowIcon="false" salePriceFontSize="32" :showPrice="item.show_prices"></CusPrice>
72
72
  </view>
73
- <view style="font-size: 28rpx;color:#999">
73
+ <view class="p_r" style="font-size: 28rpx;color:#999">
74
74
  <view v-if="item.has_choose" class="chose_spu" @click="toProductDetail(item)">
75
75
  选规格
76
76
  <view v-if="item.num" class="cart_edg">{{ item.num }}</view>
@@ -107,7 +107,8 @@
107
107
  <xd-unit :price="cartPrice" :isOld="false"></xd-unit>
108
108
  </view>
109
109
  <view>
110
- <xd-button width="170rpx" size="small" type="primary" :disabled="!cartProductList.length" @click="handleSubmitCart">选好了</xd-button>
110
+ <xd-button v-if="cartProductList.length" width="170rpx" size="small" type="primary" @click="handleSubmitCart">选好了</xd-button>
111
+ <xd-button v-else width="170rpx" size="small" type="primary" :disabled="true">选好了</xd-button>
111
112
  </view>
112
113
  </view>
113
114
  <view class="cart_product_modal" v-if="cartProductShow">
@@ -137,7 +138,7 @@
137
138
  <CusPrice :isPlus="is_plus_site" type="order" :showPrice="prod.show_prices"></CusPrice>
138
139
  </view>
139
140
  <view style="font-size: 28rpx;color:#999">
140
- <xd-number v-model="prod.num" @change="val => handleCartNumChange(val, prod)"></xd-number>
141
+ <xd-number circle v-model="prod.num" @change="val => handleCartNumChange(val, prod)"></xd-number>
141
142
  </view>
142
143
  </view>
143
144
  </view>
@@ -211,6 +212,7 @@
211
212
  cartPrice: 0,
212
213
  cartCount: 0,
213
214
  cartProductShow: false,
215
+ scrollTopTimer: null,
214
216
 
215
217
  //商品列表
216
218
  column_num: 1,
@@ -307,13 +309,20 @@
307
309
  },
308
310
  handleCartNumChange(val, prod){
309
311
  console.log("handleCartNumChange", val, prod)
312
+ let product = {
313
+ product_id: prod.product_id,
314
+ num: val,
315
+ category_id: prod.category_id
316
+ }
317
+ if(prod.product_sku) product.product_sku = prod.product_sku;
318
+ if(prod.specs) product.specs = prod.specs;
310
319
  jfbRootExec("setFoodCartNum", {
311
320
  vm: this,
312
321
  data: {
313
322
  xnamespace: this.xnamespace,
314
323
  shop_id: this.shopInfo.shop_id,
315
324
  consume_mode: this.consume_mode,
316
- product: prod
325
+ product: product
317
326
  }
318
327
  }).then(res => {
319
328
  this.p_getFoodCartCount();
@@ -335,7 +344,7 @@
335
344
  },
336
345
  handleSwitchShop(){
337
346
  this.$xdUniHelper.navigateTo({
338
- url: this.switchStorePath + "?brand_id=" + this.shopInfo.brand_id,
347
+ url: this.switchStorePath + "?brand_id=" + this.shopInfo.brand_id + "&resource_shop_id=" + this.resource_shop_id,
339
348
  })
340
349
  },
341
350
  p_getFoodShopDetail(){
@@ -378,6 +387,7 @@
378
387
  },
379
388
  //获取门店分类信息
380
389
  p_getFoodShopCategory(){
390
+ this.$xdShowLoading({})
381
391
  jfbRootExec("getFoodShopCategory", {
382
392
  vm: this,
383
393
  data: {
@@ -386,6 +396,7 @@
386
396
  consume_mode: this.consume_mode
387
397
  }
388
398
  }).then(res => {
399
+ this.$xdHideLoading();
389
400
  this.categoryList = res.categories.map(item => {
390
401
  item.productList = [];
391
402
  return item;
@@ -458,7 +469,7 @@
458
469
  return new Promise((resolve,reject) => {
459
470
  this.getList(options).then(async res => {
460
471
  this.$xdHideLoading();
461
- if(res.total_size < 3){
472
+ if(res.total_size <= 5){
462
473
  await this.loadNextCateProduct(this.loadCateIndex)
463
474
  }
464
475
  this.$nextTick(() => {
@@ -474,18 +485,17 @@
474
485
  })
475
486
  })
476
487
  },
477
- setCategoryRect(){
478
- console.log("setCategoryRect")
488
+ async setCategoryRect(){
479
489
  const query = uni.createSelectorQuery().in(this);
480
- this.categoryList = this.categoryList.map(cate => {
490
+
491
+ for(let i = 0; i < this.categoryList.length; i++){
492
+ let cate = this.categoryList[i];
481
493
  let id = this.getID(cate);
482
- query.select('#'+id).boundingClientRect(data => {
483
- cate.height = data.height;
484
- }).exec();
485
- return cate;
486
- })
494
+ let cateHeight = await this.syncGetEleHeight('#' + id);
495
+ this.$set(this.categoryList[i], 'height', cateHeight);
496
+ }
497
+
487
498
  query.select(".product_scroll").boundingClientRect(data => {
488
- console.log(data, "product_scroll categoryList");
489
499
  this.scrollBoxHeight = data.height;
490
500
  }).exec();
491
501
 
@@ -496,6 +506,14 @@
496
506
  return item;
497
507
  })
498
508
  },
509
+ syncGetEleHeight(ele){
510
+ return new Promise((resolve, reject) => {
511
+ this.$xdUniHelper.getWindowHeight([ele], this).then(res => {
512
+ console.log(res);
513
+ resolve(res[ele].height);
514
+ })
515
+ })
516
+ },
499
517
  getID(cate) {
500
518
  return `category_${cate.category_id}`;
501
519
  },
@@ -519,7 +537,10 @@
519
537
  handleScroll(e){
520
538
  // console.log(e, 'handleScroll')
521
539
  let scrollTop = e.detail.scrollTop;
522
- this.prodScrollTop = scrollTop;
540
+ if(this.scrollTopTimer) clearTimeout(this.scrollTopTimer);
541
+ this.scrollTopTimer = setTimeout(()=>{
542
+ this.prodScrollTop = scrollTop;
543
+ },50)
523
544
  //手动点击tab定位不触发
524
545
  if(!this.pointerScroll) return false;
525
546
  if(this.lastScrollTop > scrollTop){
@@ -928,6 +949,13 @@
928
949
  display: flex;
929
950
  align-items: flex-end;
930
951
  justify-content: space-between;
952
+ position: relative;
953
+
954
+ .p_r{
955
+ position: absolute;
956
+ right: 0;
957
+ bottom: 0;
958
+ }
931
959
 
932
960
  .icon_add_cart{
933
961
  background-color: var(--main-color);