jufubao-base 1.0.365 → 1.0.366-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-base",
3
- "version": "1.0.365",
3
+ "version": "1.0.366-beta1",
4
4
  "private": false,
5
5
  "description": "聚福宝业务组件基础插件包",
6
6
  "main": "index.js",
@@ -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,72 @@ 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 urlObj = JSON.parse(item.extras);
1698
+ if(this.$xdUniHelper.checkVarType(urlObj) === 'object'){
1699
+ reOrderPath = {
1700
+ url: urlObj['page_value'],
1701
+ 'jfb-platform': urlObj
1702
+ }
1703
+ }else{
1704
+ throw new Error('不合法的extras');
1705
+ }
1706
+ }catch(err){
1707
+ reOrderPath = {
1708
+ url: item.extras
1709
+ }
1710
+ }
1711
+ this.$xdUniHelper.navigateTo(reOrderPath);
1712
+ }
1713
+ }).catch(err => {
1714
+ this.$xdHideLoading();
1715
+ })
1672
1716
  }
1673
1717
  else {
1674
1718
  console.error(`item.action=${item.action}, 此action不可用`)
1675
1719
  }
1676
1720
  },
1677
-
1721
+ handleToProduct(item){
1722
+ let productPath = {};
1723
+ if(item.product_detail_url){
1724
+ try{
1725
+ let urlObj = JSON.parse(item.product_detail_url);
1726
+ if(this.$xdUniHelper.checkVarType(urlObj) === 'object'){
1727
+ productPath = {
1728
+ url: urlObj['page_value'] + "?product_id=" + item.product_id,
1729
+ 'jfb-platform': urlObj
1730
+ }
1731
+ }else{
1732
+ throw new Error('不合法的product_detail_url');
1733
+ }
1734
+ }catch(err){
1735
+ productPath = {
1736
+ url: item.product_detail_url
1737
+ }
1738
+ }
1739
+ this.$xdUniHelper.navigateTo(productPath);
1740
+ }
1741
+ },
1678
1742
  handleDeleteOrder(){
1679
1743
  jfbRootExec("deleteBaseOrder", {
1680
1744
  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,40 @@ 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 urlObj = JSON.parse(btnReOrder.extras);
490
+ if(this.$xdUniHelper.checkVarType(urlObj) === 'object'){
491
+ reOrderPath = {
492
+ url: urlObj['page_value'],
493
+ 'jfb-platform': urlObj
494
+ }
495
+ }else{
496
+ throw new Error('不合法的extras');
497
+ }
498
+ }catch(err){
499
+ reOrderPath = {
500
+ url: btnReOrder.extras
501
+ }
502
+ }
503
+ this.$xdUniHelper.navigateTo(reOrderPath);
504
+ }
474
505
 
475
-
506
+ }).catch(err => {
507
+ this.$xdHideLoading();
508
+ })
476
509
  }
477
510
  },
478
511
 
@@ -502,6 +535,7 @@ export default {
502
535
  : "";
503
536
  return prod;
504
537
  });
538
+ item.buttons = item.buttons.filter(btn => this.actionBtns.includes(btn.action));
505
539
  item.buttons = item.buttons.map((btn, i) => {
506
540
  btn["key"] = btn.action + i;
507
541
  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
- }