jufubao-base 1.0.368 → 1.0.369

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.368",
3
+ "version": "1.0.369",
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"
@@ -957,6 +957,20 @@
957
957
  <view v-if="dialogCode && dialogCode.tips" class="dialog_password"> {{ dialogCode.tips}}</view>
958
958
  <view v-if="dialogPassword" class="dialog_password">{{ dialogPassword }}</view>
959
959
  </xd-dailog>
960
+ <xd-dailog
961
+ :show.sync="showReorderDialog"
962
+ title="提示"
963
+ :showClose="false"
964
+ width="85%"
965
+ @close="showReorderDialog = false"
966
+ >
967
+ <view style="padding: 20rpx 0;">
968
+ <view v-for="(tip, index) in reorderTips" :key="index" style="color: #333; font-size: 28rpx; line-height: 44rpx;">{{ tip }}</view>
969
+ </view>
970
+ <view slot="btn">
971
+ <xd-button type="primary" size="small" @click="handleReorderDlgConfirm">我知道了</xd-button>
972
+ </view>
973
+ </xd-dailog>
960
974
  <XdDownDrawer :isClose="false" height="auto" :show.sync="showSupplement">
961
975
  <view class="supplement">
962
976
  <view class="supplement-title">
@@ -1037,6 +1051,17 @@ export default {
1037
1051
  dialogCode: null,
1038
1052
 
1039
1053
  showApplyAfter: "",
1054
+ actionBtns: [
1055
+ 'view_logistics', //包裹列表
1056
+ 'cancel_unpaid', //取消订单
1057
+ 'delete', //删除订单
1058
+ 'service_process_list', //服务进度
1059
+ 'pay', //支付
1060
+ 'apply_refund', //申请退款
1061
+ 'invoice', //发票申请
1062
+ 'viewInvoice', //查看发票
1063
+ 'reorder' //重新下单
1064
+ ],
1040
1065
 
1041
1066
  //基础
1042
1067
  radius: 0,
@@ -1086,7 +1111,10 @@ export default {
1086
1111
  invoicePath: '',
1087
1112
  isShowInvoice: false,
1088
1113
  invoiceStatus: '',
1089
- viewInvoicePath: ''
1114
+ viewInvoicePath: '',
1115
+ showReorderDialog: false,
1116
+ reorderTips: [],
1117
+ reorderBtnItem: null,
1090
1118
  };
1091
1119
  },
1092
1120
  watch: {
@@ -1391,6 +1419,7 @@ export default {
1391
1419
  if(pay.length === 1) del = []
1392
1420
  res.buttons = del.concat(res.buttons || [])
1393
1421
  }
1422
+ res.buttons = res.buttons.filter(btn => this.actionBtns.includes(btn.action))
1394
1423
 
1395
1424
  if (res.product) {
1396
1425
  try {
@@ -1661,20 +1690,87 @@ export default {
1661
1690
  }).catch(err => {
1662
1691
  this.$xdHideLoading();
1663
1692
  })
1664
- }if (item.action === "invoice") {
1693
+ }else if (item.action === "invoice") {
1665
1694
  this.$xdUniHelper.navigateTo({
1666
1695
  url: `${this.invoicePath}?main_order_id=${this.main_order_id}&pay_order_id=${this.info.pay_info.pay_order_id}`,
1667
1696
  });
1668
- }if (item.action === "viewInvoice") {
1697
+ }else if (item.action === "viewInvoice") {
1669
1698
  this.$xdUniHelper.navigateTo({
1670
1699
  url: `${this.viewInvoicePath}?main_order_id=${this.main_order_id}&pay_order_id=${this.info.pay_info.pay_order_id}`,
1671
1700
  });
1701
+ }else if(item.action === 'reorder'){
1702
+ //再来一单
1703
+ this.$xdShowLoading({});
1704
+ jfbRootExec("reCartOrder", {
1705
+ vm: this,
1706
+ data: {
1707
+ main_order_id: this.main_order_id
1708
+ }
1709
+ }).then(res => {
1710
+ this.$xdHideLoading();
1711
+ if(res.tips && res.tips.length){
1712
+ this.reorderTips = res.tips;
1713
+ this.reorderBtnItem = item;
1714
+ this.showReorderDialog = true;
1715
+ }else{
1716
+ this.reorderNavigate(item);
1717
+ }
1718
+ }).catch(err => {
1719
+ this.$xdHideLoading();
1720
+ })
1672
1721
  }
1673
1722
  else {
1674
1723
  console.error(`item.action=${item.action}, 此action不可用`)
1675
1724
  }
1676
1725
  },
1677
-
1726
+ handleReorderDlgConfirm(){
1727
+ this.showReorderDialog = false;
1728
+ this.reorderNavigate(this.reorderBtnItem);
1729
+ this.reorderBtnItem = null;
1730
+ },
1731
+ reorderNavigate(item){
1732
+ if(item.extras){
1733
+ let reOrderPath = {};
1734
+ try{
1735
+ let extras = JSON.parse(item.extras);
1736
+ let urlObj = JSON.parse(extras.place_order_url);
1737
+ if(this.$xdUniHelper.checkVarType(urlObj) === 'object'){
1738
+ reOrderPath = {
1739
+ url: urlObj['page_value'],
1740
+ 'jfb-platform': urlObj
1741
+ }
1742
+ }else{
1743
+ throw new Error('不合法的extras');
1744
+ }
1745
+ }catch(err){
1746
+ reOrderPath = {
1747
+ url: item.extras
1748
+ }
1749
+ }
1750
+ this.$xdUniHelper.navigateTo(reOrderPath);
1751
+ }
1752
+ },
1753
+ handleToProduct(item){
1754
+ let productPath = {};
1755
+ if(item.product_detail_url){
1756
+ try{
1757
+ let urlObj = JSON.parse(item.product_detail_url);
1758
+ if(this.$xdUniHelper.checkVarType(urlObj) === 'object'){
1759
+ productPath = {
1760
+ url: urlObj['page_value'] + "?product_id=" + item.product_id,
1761
+ 'jfb-platform': urlObj
1762
+ }
1763
+ }else{
1764
+ throw new Error('不合法的product_detail_url');
1765
+ }
1766
+ }catch(err){
1767
+ productPath = {
1768
+ url: item.product_detail_url
1769
+ }
1770
+ }
1771
+ this.$xdUniHelper.navigateTo(productPath);
1772
+ }
1773
+ },
1678
1774
  handleDeleteOrder(){
1679
1775
  jfbRootExec("deleteBaseOrder", {
1680
1776
  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
  ];
@@ -209,6 +209,20 @@
209
209
  </template>
210
210
 
211
211
  </view>
212
+ <xd-dialog
213
+ :show.sync="showReorderDialog"
214
+ title="提示"
215
+ :showClose="false"
216
+ width="85%"
217
+ @close="showReorderDialog = false"
218
+ >
219
+ <view style="padding: 20rpx 0;">
220
+ <view v-for="(tip, index) in reorderTips" :key="index" style="color: #333; font-size: 28rpx; line-height: 44rpx;">{{ tip }}</view>
221
+ </view>
222
+ <view slot="btn">
223
+ <xd-button type="primary" size="small" @click="handleReorderConfirm">我知道了</xd-button>
224
+ </view>
225
+ </xd-dialog>
212
226
  </view>
213
227
  </template>
214
228
 
@@ -217,6 +231,7 @@ import XdFontIcon from "@/components/XdFontIcon/XdFontIcon";
217
231
  import XdTab from "@/components/XdTab/XdTab";
218
232
  import XdUnit from "@/components/XdUnit/XdUnit";
219
233
  import XdButton from "@/components/XdButton/XdButton";
234
+ import XdDialog from "@/components/XdDailog/XdDailog";
220
235
  import { jfbRootExec } from "@/utils/xd.event";
221
236
  import JfbBaseOrderListMixin from "./JfbBaseOrderListMixin";
222
237
  import componentsMixins from "@/mixins/componentsMixins";
@@ -234,6 +249,7 @@ export default {
234
249
  XdUnit,
235
250
  XdButton,
236
251
  XdTfkOrderItem,
252
+ XdDialog,
237
253
  },
238
254
  mixins: [componentsMixins, extsMixins, JfbBaseOrderListMixin],
239
255
  data() {
@@ -287,6 +303,10 @@ export default {
287
303
  refundFastPath: "",
288
304
 
289
305
  noticeBgc:'',
306
+ actionBtns: ['cancel_unpaid', 'pay', 'apply_refund', 'reorder'],
307
+ showReorderDialog: false,
308
+ reorderTips: [],
309
+ reorderItem: null,
290
310
  };
291
311
  },
292
312
 
@@ -471,8 +491,55 @@ export default {
471
491
  }).catch(err => {
472
492
  this.$xdHideLoading();
473
493
  })
494
+ }else if(action === 'reorder'){
495
+ //重新下单
496
+ this.$xdShowLoading({});
497
+ jfbRootExec("reCartOrder", {
498
+ vm: this,
499
+ data: {
500
+ main_order_id: item.main_order_id
501
+ }
502
+ }).then(res => {
503
+ this.$xdHideLoading();
504
+ if(res.tips && res.tips.length){
505
+ this.reorderTips = res.tips;
506
+ this.reorderItem = item;
507
+ this.showReorderDialog = true;
508
+ }else{
509
+ this.reorderNavigate(item);
510
+ }
474
511
 
475
-
512
+ }).catch(err => {
513
+ this.$xdHideLoading();
514
+ })
515
+ }
516
+ },
517
+ handleReorderConfirm(){
518
+ this.showReorderDialog = false;
519
+ this.reorderNavigate(this.reorderItem);
520
+ this.reorderItem = null;
521
+ },
522
+ reorderNavigate(item){
523
+ let btnReOrder = item.buttons.find(item => item.action === 'reorder');
524
+ if(btnReOrder.extras){
525
+ let reOrderPath = {};
526
+ try{
527
+ let extras = JSON.parse(btnReOrder.extras);
528
+ let urlObj = JSON.parse(extras.place_order_url);
529
+ if(this.$xdUniHelper.checkVarType(urlObj) === 'object'){
530
+ reOrderPath = {
531
+ url: urlObj['page_value'],
532
+ 'jfb-platform': urlObj
533
+ }
534
+ }else{
535
+ throw new Error('不合法的extras');
536
+ }
537
+ }catch(err){
538
+ reOrderPath = {
539
+ url: btnReOrder.extras
540
+ }
541
+ }
542
+ this.$xdUniHelper.navigateTo(reOrderPath);
476
543
  }
477
544
  },
478
545
 
@@ -502,6 +569,7 @@ export default {
502
569
  : "";
503
570
  return prod;
504
571
  });
572
+ item.buttons = item.buttons.filter(btn => this.actionBtns.includes(btn.action));
505
573
  item.buttons = item.buttons.map((btn, i) => {
506
574
  btn["key"] = btn.action + i;
507
575
  return btn;