jufubao-food 1.0.12 → 1.0.13-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.
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-beta1",
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];
@@ -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,18 @@
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
+ }
310
317
  jfbRootExec("setFoodCartNum", {
311
318
  vm: this,
312
319
  data: {
313
320
  xnamespace: this.xnamespace,
314
321
  shop_id: this.shopInfo.shop_id,
315
322
  consume_mode: this.consume_mode,
316
- product: prod
323
+ product: product
317
324
  }
318
325
  }).then(res => {
319
326
  this.p_getFoodCartCount();
@@ -378,6 +385,7 @@
378
385
  },
379
386
  //获取门店分类信息
380
387
  p_getFoodShopCategory(){
388
+ this.$xdShowLoading({})
381
389
  jfbRootExec("getFoodShopCategory", {
382
390
  vm: this,
383
391
  data: {
@@ -386,6 +394,7 @@
386
394
  consume_mode: this.consume_mode
387
395
  }
388
396
  }).then(res => {
397
+ this.$xdHideLoading();
389
398
  this.categoryList = res.categories.map(item => {
390
399
  item.productList = [];
391
400
  return item;
@@ -458,7 +467,7 @@
458
467
  return new Promise((resolve,reject) => {
459
468
  this.getList(options).then(async res => {
460
469
  this.$xdHideLoading();
461
- if(res.total_size < 3){
470
+ if(res.total_size <= 5){
462
471
  await this.loadNextCateProduct(this.loadCateIndex)
463
472
  }
464
473
  this.$nextTick(() => {
@@ -474,18 +483,17 @@
474
483
  })
475
484
  })
476
485
  },
477
- setCategoryRect(){
478
- console.log("setCategoryRect")
486
+ async setCategoryRect(){
479
487
  const query = uni.createSelectorQuery().in(this);
480
- this.categoryList = this.categoryList.map(cate => {
488
+
489
+ for(let i = 0; i < this.categoryList.length; i++){
490
+ let cate = this.categoryList[i];
481
491
  let id = this.getID(cate);
482
- query.select('#'+id).boundingClientRect(data => {
483
- cate.height = data.height;
484
- }).exec();
485
- return cate;
486
- })
492
+ let cateHeight = await this.syncGetEleHeight('#' + id);
493
+ this.$set(this.categoryList[i], 'height', cateHeight);
494
+ }
495
+
487
496
  query.select(".product_scroll").boundingClientRect(data => {
488
- console.log(data, "product_scroll categoryList");
489
497
  this.scrollBoxHeight = data.height;
490
498
  }).exec();
491
499
 
@@ -496,6 +504,14 @@
496
504
  return item;
497
505
  })
498
506
  },
507
+ syncGetEleHeight(ele){
508
+ return new Promise((resolve, reject) => {
509
+ this.$xdUniHelper.getWindowHeight([ele], this).then(res => {
510
+ console.log(res);
511
+ resolve(res[ele].height);
512
+ })
513
+ })
514
+ },
499
515
  getID(cate) {
500
516
  return `category_${cate.category_id}`;
501
517
  },
@@ -519,7 +535,10 @@
519
535
  handleScroll(e){
520
536
  // console.log(e, 'handleScroll')
521
537
  let scrollTop = e.detail.scrollTop;
522
- this.prodScrollTop = scrollTop;
538
+ if(this.scrollTopTimer) clearTimeout(this.scrollTopTimer);
539
+ this.scrollTopTimer = setTimeout(()=>{
540
+ this.prodScrollTop = scrollTop;
541
+ },50)
523
542
  //手动点击tab定位不触发
524
543
  if(!this.pointerScroll) return false;
525
544
  if(this.lastScrollTop > scrollTop){