jufubao-food 1.0.15-beta4 → 1.0.15-beta5

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.15-beta4",
3
+ "version": "1.0.15-beta5",
4
4
  "private": false,
5
5
  "description": "聚福宝业务组件餐饮插件包",
6
6
  "main": "index.js",
@@ -269,7 +269,7 @@
269
269
  scrollTopTimer: null,
270
270
  brand_id: "",
271
271
  shopList: [],
272
- curShopIndex: 0,
272
+ curShopIndex: -1,
273
273
 
274
274
  //商品列表
275
275
  column_num: 1,
@@ -437,7 +437,11 @@
437
437
  this.resource_shop_id = options.resource_shop_id;
438
438
  this.consume_mode = options.consume_mode || 'HDSELF';
439
439
  this.brand_id = options.brand_id;
440
- this.p_getFoodShopList();
440
+ if(this.resource_shop_id){
441
+ this.p_getFoodShopDetail(this.resource_shop_id);
442
+ }else if(this.brand_id){
443
+ this.p_getFoodShopList();
444
+ }
441
445
  },
442
446
  /**
443
447
  * @description 监听事件变化
@@ -538,6 +542,9 @@
538
542
  })
539
543
  },
540
544
  toSwitchShopPage(){
545
+ if(this.shopList.length===0){
546
+ this.p_getFoodShopList(false);
547
+ }
541
548
  this.showTakeoutShop = true;
542
549
  },
543
550
  handleSwitchShop(){
@@ -552,7 +559,7 @@
552
559
  }
553
560
  this.showTakeoutShop = false;
554
561
  },
555
- p_getFoodShopList(){
562
+ p_getFoodShopList(loadFirstShop=true){
556
563
  jfbRootExec("getFoodShopList", {
557
564
  vm: this,
558
565
  data: {
@@ -566,8 +573,13 @@
566
573
  }).then(res => {
567
574
  if(res.list && res.list.length > 0){
568
575
  this.shopList = res.list;
569
- this.curShopIndex = 0;
570
- this.p_getFoodShopDetail();
576
+ if(loadFirstShop){
577
+ this.curShopIndex = 0;
578
+ this.p_getFoodShopDetail();
579
+ }else{
580
+ let findShopIndex = this.shopList.findIndex(item => item.resource_shop_id == this.resource_shop_id);
581
+ this.curShopIndex = findShopIndex;
582
+ }
571
583
  if(!this.$configProject['isPreview']){
572
584
  this.showTakeoutShop = true;
573
585
  }
@@ -576,13 +588,13 @@
576
588
  }
577
589
  })
578
590
  },
579
- p_getFoodShopDetail(){
591
+ p_getFoodShopDetail(resource_shop_id){
580
592
  let curShop = this.shopList[this.curShopIndex];
581
593
  jfbRootExec("getFoodShopDetail", {
582
594
  vm: this,
583
595
  data: {
584
596
  xnamespace: this.xnamespace,
585
- resource_shop_id: curShop.resource_shop_id,
597
+ resource_shop_id: resource_shop_id || curShop.resource_shop_id,
586
598
  consume_mode: this.consume_mode,
587
599
  latitude: this.stateLocation.latitude,
588
600
  longitude: this.stateLocation.longitude,