dolphin-weex-bc 0.0.30 → 0.0.33

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": "dolphin-weex-bc",
3
- "version": "0.0.30",
3
+ "version": "0.0.33",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "directories": {
@@ -544,6 +544,8 @@ const MaterialEvent = {
544
544
 
545
545
  productCodeList: [], //存储的商品code
546
546
 
547
+ insufficientArr: [], //不足的耗材
548
+
547
549
  sort: 'hierarchical',
548
550
 
549
551
  //批量查询耗材的情况
@@ -553,8 +555,9 @@ const MaterialEvent = {
553
555
  this.needBackground = options.needBackground
554
556
  this.needOptimize = options.needOptimize
555
557
  this.deviceMaterialList = []
558
+ this.insufficientArr = []
556
559
  this.sort = options.sort
557
- isColmo = params.appId == 12017
560
+ if (!isColmo) isColmo = params.appId == 12017
558
561
  return new Promise(async (resolve, reject) => {
559
562
  try {
560
563
  let homeGroupId = ''
@@ -584,7 +587,7 @@ const MaterialEvent = {
584
587
  this.needBackground = options.needBackground
585
588
  this.deviceMaterialList = []
586
589
  this.sort = options.sort
587
- isColmo = params.appId == 12017
590
+ if (!isColmo) isColmo = params.appId == 12017
588
591
  return new Promise(async (resolve, reject) => {
589
592
  try {
590
593
  let deviceList = []
@@ -803,6 +806,7 @@ const MaterialEvent = {
803
806
  }
804
807
  for (const it of item.consumables) {
805
808
  console.log('consumables===it:1' + JSON.stringify(it))
809
+ if (it.model === 'null' || it.model === '/') it.model = '' //兜底某些数据返回异常字符串
806
810
  if (isColmo) {
807
811
  it.chartData = this.setChartDataColmo(it)
808
812
  continue
@@ -839,7 +843,7 @@ const MaterialEvent = {
839
843
  if (this.sort === 'hierarchical') {
840
844
  this.deviceMaterialList = this.sortHierarchical(JSON.parse(JSON.stringify(this.deviceMaterialList)))
841
845
  }
842
- if (isColmo) return this.handleMaterialSeviceType()
846
+ if (isColmo) return this.handleMaterialSeviceTypeColmo()
843
847
 
844
848
  this.productCodeList = [...new Set(tmpcodeList)]
845
849
 
@@ -860,29 +864,46 @@ const MaterialEvent = {
860
864
  }
861
865
 
862
866
  let skuinfolist = []
867
+ // if (codeList && codeList.length > 20) {
868
+ // let groupNum = Math.ceil(codeList.length / 20)
869
+ // for (let index = 0; index < groupNum; index++) {
870
+ // try {
871
+ // const shopList = await this.getUpkeepShopInfo(codeList.slice(index * 20, (index + 1) * 20))
872
+ // skuinfolist = skuinfolist.concat(shopList)
873
+ // } catch (error) {
874
+ // continue
875
+ // }
876
+ // }
877
+ // } else {
878
+ // try {
879
+ // skuinfolist = await this.getUpkeepShopInfo(codeList)
880
+ // } catch (error) {}
881
+ // }
882
+
863
883
  if (codeList && codeList.length > 20) {
864
884
  let groupNum = Math.ceil(codeList.length / 20)
865
885
  for (let index = 0; index < groupNum; index++) {
866
886
  try {
867
- const shopList = await this.getUpkeepShopInfo(codeList.slice(index * 20, (index + 1) * 20))
868
- skuinfolist = skuinfolist.concat(shopList)
887
+ const resSuccessMap = await this.querySkuIdByItemCodes(codeList.slice(index * 20, (index + 1) * 20))
888
+ this.handleSkuinfolist(skuinfolist, resSuccessMap, codeList)
869
889
  } catch (error) {
870
890
  continue
871
891
  }
872
892
  }
873
893
  } else {
874
894
  try {
875
- skuinfolist = await this.getUpkeepShopInfo(codeList)
895
+ const resSuccessMap = await this.querySkuIdByItemCodes(codeList)
896
+ this.handleSkuinfolist(skuinfolist, resSuccessMap, codeList)
876
897
  } catch (error) {}
877
898
  }
878
899
 
879
900
  console.log('获取到的商品信息:' + JSON.stringify(skuinfolist))
880
901
 
881
902
  if (skuinfolist.length > 0) {
882
- try {
883
- //通过商城编码查询新商品skuId
884
- await this.handleGoodsInfoNewSkuId(skuinfolist)
885
- } catch (error) {}
903
+ // try {
904
+ // //通过商城编码查询新商品skuId
905
+ // await this.handleGoodsInfoNewSkuId(skuinfolist)
906
+ // } catch (error) {}
886
907
  return this.setMaterialGoodInfo(skuinfolist)
887
908
  } else {
888
909
  //此时如果有活动链接就取活动链接
@@ -890,15 +911,40 @@ const MaterialEvent = {
890
911
  }
891
912
  },
892
913
 
914
+ //处理商品信息
915
+ handleSkuinfolist(skuinfolist, resSuccessMap, codeList) {
916
+ if (resSuccessMap.code == '000000') {
917
+ codeList.forEach(item => {
918
+ if (resSuccessMap.data && resSuccessMap.data.successMap) {
919
+ if (resSuccessMap.data.successMap[item] && resSuccessMap.data.successMap[item].skuId) {
920
+ console.log('获取到的图片信息:' + JSON.stringify(resSuccessMap.data.successMap[item].mainPicList))
921
+ if (
922
+ resSuccessMap.data.successMap[item].mainPicList &&
923
+ resSuccessMap.data.successMap[item].mainPicList.length > 0
924
+ ) {
925
+ resSuccessMap.data.successMap[item].mainPicList.forEach(item1 => {
926
+ console.log('获取到的图片信息:' + JSON.stringify(item1))
927
+ if (item1.imageSort == 1) {
928
+ resSuccessMap.data.successMap[item].picInfo = item1.imageUrl
929
+ }
930
+ })
931
+ }
932
+ skuinfolist.push(resSuccessMap.data.successMap[item])
933
+ }
934
+ }
935
+ })
936
+ }
937
+ },
938
+
893
939
  //给商品信息增加新sku
894
940
  async handleGoodsInfoNewSkuId(skuinfolist) {
895
- let itemCodeList = skuinfolist.map(item => item.itemcode)
941
+ let itemCodeList = skuinfolist.map(item => item.itemCode)
896
942
  try {
897
943
  const res = await this.querySkuIdByItemCodes(itemCodeList)
898
944
  if (res.code == '000000') {
899
945
  skuinfolist.forEach(item => {
900
946
  if (res.data && res.data.successMap) {
901
- item.skuId = res.data.successMap[item.itemcode] ? res.data.successMap[item.itemcode].skuId : ''
947
+ item.skuId = res.data.successMap[item.itemCode] ? res.data.successMap[item.itemCode].skuId : ''
902
948
  }
903
949
  })
904
950
  }
@@ -976,14 +1022,14 @@ const MaterialEvent = {
976
1022
  console.log(`商品item==${index}==1` + JSON.stringify(item))
977
1023
  this.deviceMaterialList.forEach((it, i) => {
978
1024
  it.consumables.forEach((itt, index) => {
979
- if (itt.productCode == item.itemcode) {
1025
+ if (itt.productCode == item.itemCode) {
980
1026
  itt.goodsInfo = item
981
1027
  }
982
1028
  //对于清洗服务里面的productCode单独处理
983
1029
  if (
984
1030
  itt.serviceSupport &&
985
1031
  itt.serviceSupport.washingService &&
986
- itt.serviceSupport.washingService.productCode == item.itemcode
1032
+ itt.serviceSupport.washingService.productCode == item.itemCode
987
1033
  ) {
988
1034
  console.log('清洗的哦哦:1' + i + '---' + index)
989
1035
  itt.washingServiceGoodsInfo = item
@@ -1040,6 +1086,24 @@ const MaterialEvent = {
1040
1086
  }
1041
1087
  },
1042
1088
 
1089
+ // COLMO按钮类型 2保养换芯 3售后维修 4清洗服务
1090
+ handleMaterialSeviceTypeColmo() {
1091
+ this.deviceMaterialList.forEach((item, index) => {
1092
+ item.consumables.forEach(it => {
1093
+ if (it.serviceSupport) {
1094
+ if (it.serviceSupport && it.serviceSupport.bookingService && it.serviceSupport.bookingService.enable) {
1095
+ it.btnType = 2
1096
+ if (it.serviceSupport.bookingService && it.serviceSupport.bookingService.serviceType == 2) {
1097
+ it.btnType = 3
1098
+ }
1099
+ } else if (it.serviceSupport && it.serviceSupport.washingService && it.serviceSupport.washingService.enable) {
1100
+ it.btnType = 4
1101
+ }
1102
+ }
1103
+ })
1104
+ })
1105
+ },
1106
+
1043
1107
  // 对每一种设备按照consumables中余量从最少到多排列
1044
1108
  // 排序函数 - 处理 remainingValueType=4的情况
1045
1109
  sortByRemainingValue(a, b) {
@@ -1307,6 +1371,8 @@ const MaterialEvent = {
1307
1371
  ...categorizedDeviceMaterialList.sufficient
1308
1372
  ]
1309
1373
 
1374
+ this.insufficientArr = categorizedDeviceMaterialList.insufficient
1375
+
1310
1376
  //记录每一种情况下的设备数量
1311
1377
  this.deviceTotal = [
1312
1378
  categorizedDeviceMaterialList.insufficient.length,