jufubao-base 1.0.366-beta101 → 1.0.366-beta3

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-base",
3
- "version": "1.0.366-beta101",
3
+ "version": "1.0.366-beta3",
4
4
  "private": false,
5
5
  "description": "聚福宝业务组件基础插件包",
6
6
  "main": "index.js",
@@ -17,50 +17,48 @@
17
17
  class="jfb-base-chose-company__body"
18
18
  :style="{ minHeight: layoutInfo.bodyMinHeightRpx + 'rpx' }"
19
19
  >
20
- <template v-if="isLoading">
21
- <view :style="[contentPaddingCompStyle]">
22
- <view class="jfb-base-chose-company__body-title"
23
- >企业信息({{ companyList.length }}家)</view
20
+ <view :style="[contentPaddingCompStyle]">
21
+ <view class="jfb-base-chose-company__body-title"
22
+ >企业信息({{ companyList.length }}家)</view
23
+ >
24
+ <view class="jfb-base-chose-company__body-notice">{{ title }}</view>
25
+ <view :style="{ '--main-color': mainColor }">
26
+ <view
27
+ v-for="(item, index) in companyList"
28
+ :key="index"
29
+ @click="handleChoseCompany(item)"
30
+ :style="[listPaddingCompStyle]"
31
+ :class="[
32
+ 'jfb-base-chose-company__body-company',
33
+ item.is_select ? 'active' : '',
34
+ ]"
24
35
  >
25
- <view class="jfb-base-chose-company__body-notice">{{ title }}</view>
26
- <view :style="{ '--main-color': mainColor }">
27
36
  <view
28
- v-for="(item, index) in companyList"
29
- :key="index"
30
- @click="handleChoseCompany(item)"
31
- :style="[listPaddingCompStyle]"
32
- :class="[
33
- 'jfb-base-chose-company__body-company',
34
- item.is_select ? 'active' : '',
35
- ]"
37
+ v-if="item.is_select"
38
+ class="jfb-base-chose-company__body-company-active"
39
+ :style="{
40
+ background: mainColor,
41
+ borderRadius: `0 ${listRadius}rpx 0 30rpx`,
42
+ }"
36
43
  >
37
- <view
38
- v-if="item.is_select"
39
- class="jfb-base-chose-company__body-company-active"
40
- :style="{
41
- background: mainColor,
42
- borderRadius: `0 ${listRadius}rpx 0 30rpx`,
43
- }"
44
- >
45
- <XdFontIcon
46
- size="20"
47
- icon="iconduigou-xian"
48
- color="#fff"
49
- ></XdFontIcon>
50
- </view>
51
- {{ item.company_name }}
52
- </view></view
53
- >
54
- </view>
55
- <view :style="[addCoMpStyle]" class="jfb-base-chose-company__body-add"
56
- >{{ addTitle
57
- }}<view v-if="addCompanyPath" @click="handleToAdd" :style="{color:mainColor}"
58
- >去添加<XdFontIcon
59
- size="28"
60
- icon="iconxiangyou_xian"
61
- ></XdFontIcon></view
62
- ></view>
63
- </template>
44
+ <XdFontIcon
45
+ size="20"
46
+ icon="iconduigou-xian"
47
+ color="#fff"
48
+ ></XdFontIcon>
49
+ </view>
50
+ {{ item.company_name }}
51
+ </view></view
52
+ >
53
+ </view>
54
+ <view :style="[addCoMpStyle]" class="jfb-base-chose-company__body-add"
55
+ >{{ addTitle
56
+ }}<view v-if="addCompanyPath" @click="handleToAdd" :style="{color:mainColor}"
57
+ >去添加<XdFontIcon
58
+ size="28"
59
+ icon="iconxiangyou_xian"
60
+ ></XdFontIcon></view
61
+ ></view>
64
62
  </view>
65
63
  </view>
66
64
  </template>
@@ -95,8 +93,6 @@ export default {
95
93
  addCompanyPath: "",
96
94
  companyList: [],
97
95
  redirect_url: "",
98
-
99
- isLoading: false,//页面加载完成
100
96
  };
101
97
  },
102
98
  watch: {
@@ -131,12 +127,25 @@ export default {
131
127
  },
132
128
  created() {
133
129
  this.init(this.container);
130
+
131
+ //todo
134
132
  },
135
133
  methods: {
136
134
  onJfbLoad(options) {
137
135
  if (options.redirect_url) {
138
136
  this.redirect_url = Base64.decode(options.redirect_url);
139
137
  }
138
+ jfbRootExec("getChoseCompanyList", {
139
+ vm: this,
140
+ data: {},
141
+ }).then((res) => {
142
+ console.log(res, "resgetChoseCompanyList");
143
+ //如果只有一个企业,直接选择该企业
144
+ if(res.list.length === 1) {
145
+ this.handleChoseCompany(res.list[0]);
146
+ }
147
+ this.companyList = res.list;
148
+ });
140
149
 
141
150
  //判断应用是否开启了强制选择企业功能
142
151
  let isCustomer = false;
@@ -146,6 +155,7 @@ export default {
146
155
 
147
156
  //预览模式不显示强制选择企业功能提示
148
157
  if (this.$configProject['isPreview']) isCustomer = true;
158
+
149
159
  if(!isCustomer) {
150
160
  this.$xdAlert({
151
161
  title:'配置错误',
@@ -154,26 +164,7 @@ export default {
154
164
  contentColor: '#333',
155
165
  background: '#fff',
156
166
  });
157
- return
158
167
  }
159
-
160
- jfbRootExec("getChoseCompanyList", {
161
- vm: this,
162
- data: {},
163
- }).then((res) => {
164
- //如果只有一个企业,直接选择该企业(非预览模式)
165
- if(res.list.length === 1) {
166
- if(!this.$configProject["isPreview"]){
167
- this.handleChoseCompany(res.list[0]);
168
- return
169
- }
170
- }
171
-
172
- //多个企业或者预览模式时候处理
173
- this.isLoading = true;
174
- this.companyList = res.list;
175
- });
176
-
177
168
  },
178
169
  /**
179
170
  * @description 监听事件变化
@@ -276,9 +267,8 @@ export default {
276
267
  },
277
268
  handleChoseCompany(item) {
278
269
  if(this.$configProject["isPreview"]){
279
- return;
270
+ return;
280
271
  }
281
-
282
272
  jfbRootExec("switchChoseCompany", {
283
273
  vm: this,
284
274
  data: {
@@ -287,6 +277,7 @@ export default {
287
277
  company_source_from: item.company_source_from,
288
278
  },
289
279
  }).then((res) => {
280
+
290
281
  //#ifdef MP-WEIXIN
291
282
  if (this.jfbAuthorize !== null) {
292
283
  this.jfbAuthorize.setAllToken(res);//只返回用户登陆信息,无卡登陆信息
@@ -299,12 +290,10 @@ export default {
299
290
  real_index_url = jsonData['app']['frontPath'];
300
291
  } catch (error) {
301
292
  real_index_url = item.index_url;
302
- }
293
+ }
303
294
  this.$xdUniHelper.redirectTo({
304
295
  url: this.redirect_url || real_index_url || this.settings.index,
305
296
  });
306
- }).catch(err=>{
307
- console.error(err);
308
297
  });
309
298
  },
310
299
  handleToAdd() {
@@ -312,6 +301,27 @@ export default {
312
301
  url: this.addCompanyPath,
313
302
  });
314
303
  },
304
+ onJfbScroll(options) {
305
+ console.log("event.onJfbScroll", options);
306
+ },
307
+ onJfbReachBottom(options) {
308
+ console.log("event.onJfbReachBottom", options);
309
+ },
310
+ onJfbShow(options) {
311
+ console.log("event.onJfbShow", options);
312
+ },
313
+ onJfbHide(options) {
314
+ console.log("event.onJfbHide", options);
315
+ },
316
+ onJfbBack(options) {
317
+ console.log("event.onJfbBack", options);
318
+ },
319
+ onJfbUpdate(...data) {
320
+ console.log("event.onJfbUpdate", data);
321
+ },
322
+ onJfbCustomEvent(options) {
323
+ console.log("event.onJfbReachBottom", options);
324
+ },
315
325
  },
316
326
  };
317
327
  </script>
@@ -74,4 +74,15 @@ module.exports = [
74
74
  isConsole: true,
75
75
  disabled: true,
76
76
  },
77
+ {
78
+ title: "再来一单",
79
+ path: "/cart/v1/cart/reorder",
80
+ mapFnName: "reCartOrder",
81
+ isRule: false,
82
+ data: {
83
+ main_order_id: ['订单ID', 'String', true],
84
+ },
85
+ isConsole: true,
86
+ disabled: true,
87
+ }
77
88
  ];
@@ -183,7 +183,7 @@
183
183
  v-for="(Sitem, Sindex) in item.products"
184
184
  :key="Sindex"
185
185
  >
186
- <view class="jfb-base-order-detail__body-delivery-content">
186
+ <view class="jfb-base-order-detail__body-delivery-content" @click="handleToProduct(Sitem)">
187
187
  <xd-jfb-image
188
188
  width="200"
189
189
  height="200"
@@ -1037,6 +1037,17 @@ export default {
1037
1037
  dialogCode: null,
1038
1038
 
1039
1039
  showApplyAfter: "",
1040
+ actionBtns: [
1041
+ 'view_logistics', //包裹列表
1042
+ 'cancel_unpaid', //取消订单
1043
+ 'delete', //删除订单
1044
+ 'service_process_list', //服务进度
1045
+ 'pay', //支付
1046
+ 'apply_refund', //申请退款
1047
+ 'invoice', //发票申请
1048
+ 'viewInvoice', //查看发票
1049
+ 'reorder' //重新下单
1050
+ ],
1040
1051
 
1041
1052
  //基础
1042
1053
  radius: 0,
@@ -1391,6 +1402,7 @@ export default {
1391
1402
  if(pay.length === 1) del = []
1392
1403
  res.buttons = del.concat(res.buttons || [])
1393
1404
  }
1405
+ res.buttons = res.buttons.filter(btn => this.actionBtns.includes(btn.action))
1394
1406
 
1395
1407
  if (res.product) {
1396
1408
  try {
@@ -1661,20 +1673,73 @@ export default {
1661
1673
  }).catch(err => {
1662
1674
  this.$xdHideLoading();
1663
1675
  })
1664
- }if (item.action === "invoice") {
1676
+ }else if (item.action === "invoice") {
1665
1677
  this.$xdUniHelper.navigateTo({
1666
1678
  url: `${this.invoicePath}?main_order_id=${this.main_order_id}&pay_order_id=${this.info.pay_info.pay_order_id}`,
1667
1679
  });
1668
- }if (item.action === "viewInvoice") {
1680
+ }else if (item.action === "viewInvoice") {
1669
1681
  this.$xdUniHelper.navigateTo({
1670
1682
  url: `${this.viewInvoicePath}?main_order_id=${this.main_order_id}&pay_order_id=${this.info.pay_info.pay_order_id}`,
1671
1683
  });
1684
+ }else if(item.action === 'reorder'){
1685
+ //再来一单
1686
+ this.$xdShowLoading({});
1687
+ jfbRootExec("reCartOrder", {
1688
+ vm: this,
1689
+ data: {
1690
+ main_order_id: this.main_order_id
1691
+ }
1692
+ }).then(res => {
1693
+ this.$xdHideLoading();
1694
+ if(item.extras){
1695
+ let reOrderPath = {};
1696
+ try{
1697
+ let extras = JSON.parse(item.extras);
1698
+ let urlObj = JSON.parse(extras.place_order_url);
1699
+ if(this.$xdUniHelper.checkVarType(urlObj) === 'object'){
1700
+ reOrderPath = {
1701
+ url: urlObj['page_value'],
1702
+ 'jfb-platform': urlObj
1703
+ }
1704
+ }else{
1705
+ throw new Error('不合法的extras');
1706
+ }
1707
+ }catch(err){
1708
+ reOrderPath = {
1709
+ url: item.extras
1710
+ }
1711
+ }
1712
+ this.$xdUniHelper.navigateTo(reOrderPath);
1713
+ }
1714
+ }).catch(err => {
1715
+ this.$xdHideLoading();
1716
+ })
1672
1717
  }
1673
1718
  else {
1674
1719
  console.error(`item.action=${item.action}, 此action不可用`)
1675
1720
  }
1676
1721
  },
1677
-
1722
+ handleToProduct(item){
1723
+ let productPath = {};
1724
+ if(item.product_detail_url){
1725
+ try{
1726
+ let urlObj = JSON.parse(item.product_detail_url);
1727
+ if(this.$xdUniHelper.checkVarType(urlObj) === 'object'){
1728
+ productPath = {
1729
+ url: urlObj['page_value'] + "?product_id=" + item.product_id,
1730
+ 'jfb-platform': urlObj
1731
+ }
1732
+ }else{
1733
+ throw new Error('不合法的product_detail_url');
1734
+ }
1735
+ }catch(err){
1736
+ productPath = {
1737
+ url: item.product_detail_url
1738
+ }
1739
+ }
1740
+ this.$xdUniHelper.navigateTo(productPath);
1741
+ }
1742
+ },
1678
1743
  handleDeleteOrder(){
1679
1744
  jfbRootExec("deleteBaseOrder", {
1680
1745
  vm: this,
@@ -45,5 +45,16 @@ module.exports = [
45
45
  },
46
46
  isConsole: true,
47
47
  disabled: true,
48
+ },
49
+ {
50
+ title: "再来一单",
51
+ path: "/cart/v1/cart/reorder",
52
+ mapFnName: "reCartOrder",
53
+ isRule: false,
54
+ data: {
55
+ main_order_id: ['订单ID', 'String', true],
56
+ },
57
+ isConsole: true,
58
+ disabled: true,
48
59
  }
49
60
  ];
@@ -287,6 +287,7 @@ export default {
287
287
  refundFastPath: "",
288
288
 
289
289
  noticeBgc:'',
290
+ actionBtns: ['cancel_unpaid', 'pay', 'apply_refund', 'reorder']
290
291
  };
291
292
  },
292
293
 
@@ -471,8 +472,41 @@ export default {
471
472
  }).catch(err => {
472
473
  this.$xdHideLoading();
473
474
  })
475
+ }else if(action === 'reorder'){
476
+ //重新下单
477
+ this.$xdShowLoading({});
478
+ jfbRootExec("reCartOrder", {
479
+ vm: this,
480
+ data: {
481
+ main_order_id: item.main_order_id
482
+ }
483
+ }).then(res => {
484
+ this.$xdHideLoading();
485
+ let btnReOrder = item.buttons.find(item => item.action === 'reorder');
486
+ if(btnReOrder.extras){
487
+ let reOrderPath = {};
488
+ try{
489
+ let extras = JSON.parse(btnReOrder.extras);
490
+ let urlObj = JSON.parse(extras.place_order_url);
491
+ if(this.$xdUniHelper.checkVarType(urlObj) === 'object'){
492
+ reOrderPath = {
493
+ url: urlObj['page_value'],
494
+ 'jfb-platform': urlObj
495
+ }
496
+ }else{
497
+ throw new Error('不合法的extras');
498
+ }
499
+ }catch(err){
500
+ reOrderPath = {
501
+ url: btnReOrder.extras
502
+ }
503
+ }
504
+ this.$xdUniHelper.navigateTo(reOrderPath);
505
+ }
474
506
 
475
-
507
+ }).catch(err => {
508
+ this.$xdHideLoading();
509
+ })
476
510
  }
477
511
  },
478
512
 
@@ -502,6 +536,7 @@ export default {
502
536
  : "";
503
537
  return prod;
504
538
  });
539
+ item.buttons = item.buttons.filter(btn => this.actionBtns.includes(btn.action));
505
540
  item.buttons = item.buttons.map((btn, i) => {
506
541
  btn["key"] = btn.action + i;
507
542
  return btn;
@@ -1,22 +0,0 @@
1
- 'use strict';
2
-
3
- /**
4
- * @description 第三方库
5
- * @param threePackagePath {String} 第三方库所在项目路径存放路径路
6
- * @param packname {String} 包名字
7
- * @returns {string|*}
8
- */
9
- const getPackagePath = (threePackagePath, packname = 'gxd-commands-bussiness')=>{
10
- if(packname === 'gxd-commands-bussiness') {
11
- return `/Users/shiyonggao/Desktop/code/BASE/UNIAPP/xd-commands-bussiness/${threePackagePath}`;
12
- }
13
-
14
- if (packname === 'gxd-uni-library-editx') {
15
- return `/Users/shiyonggao/Desktop/code/BASE/UNIAPP/xd-uni-library-editx/${threePackagePath}`;
16
- }
17
-
18
- };
19
-
20
- module.exports = {
21
- getPackagePath
22
- }