jufubao-base 1.0.368 → 1.0.370

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.370",
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: {
@@ -1392,6 +1420,9 @@ export default {
1392
1420
  res.buttons = del.concat(res.buttons || [])
1393
1421
  }
1394
1422
 
1423
+ //需要判断按钮是否存在
1424
+ res.buttons = (res.buttons||[]).filter(btn => this.actionBtns.includes(btn.action))
1425
+
1395
1426
  if (res.product) {
1396
1427
  try {
1397
1428
  jfbRootExec("getBaseProductDetail", {
@@ -1661,20 +1692,87 @@ export default {
1661
1692
  }).catch(err => {
1662
1693
  this.$xdHideLoading();
1663
1694
  })
1664
- }if (item.action === "invoice") {
1695
+ }else if (item.action === "invoice") {
1665
1696
  this.$xdUniHelper.navigateTo({
1666
1697
  url: `${this.invoicePath}?main_order_id=${this.main_order_id}&pay_order_id=${this.info.pay_info.pay_order_id}`,
1667
1698
  });
1668
- }if (item.action === "viewInvoice") {
1699
+ }else if (item.action === "viewInvoice") {
1669
1700
  this.$xdUniHelper.navigateTo({
1670
1701
  url: `${this.viewInvoicePath}?main_order_id=${this.main_order_id}&pay_order_id=${this.info.pay_info.pay_order_id}`,
1671
1702
  });
1703
+ }else if(item.action === 'reorder'){
1704
+ //再来一单
1705
+ this.$xdShowLoading({});
1706
+ jfbRootExec("reCartOrder", {
1707
+ vm: this,
1708
+ data: {
1709
+ main_order_id: this.main_order_id
1710
+ }
1711
+ }).then(res => {
1712
+ this.$xdHideLoading();
1713
+ if(res.tips && res.tips.length){
1714
+ this.reorderTips = res.tips;
1715
+ this.reorderBtnItem = item;
1716
+ this.showReorderDialog = true;
1717
+ }else{
1718
+ this.reorderNavigate(item);
1719
+ }
1720
+ }).catch(err => {
1721
+ this.$xdHideLoading();
1722
+ })
1672
1723
  }
1673
1724
  else {
1674
1725
  console.error(`item.action=${item.action}, 此action不可用`)
1675
1726
  }
1676
1727
  },
1677
-
1728
+ handleReorderDlgConfirm(){
1729
+ this.showReorderDialog = false;
1730
+ this.reorderNavigate(this.reorderBtnItem);
1731
+ this.reorderBtnItem = null;
1732
+ },
1733
+ reorderNavigate(item){
1734
+ if(item.extras){
1735
+ let reOrderPath = {};
1736
+ try{
1737
+ let extras = JSON.parse(item.extras);
1738
+ let urlObj = JSON.parse(extras.place_order_url);
1739
+ if(this.$xdUniHelper.checkVarType(urlObj) === 'object'){
1740
+ reOrderPath = {
1741
+ url: urlObj['page_value'],
1742
+ 'jfb-platform': urlObj
1743
+ }
1744
+ }else{
1745
+ throw new Error('不合法的extras');
1746
+ }
1747
+ }catch(err){
1748
+ reOrderPath = {
1749
+ url: item.extras
1750
+ }
1751
+ }
1752
+ this.$xdUniHelper.navigateTo(reOrderPath);
1753
+ }
1754
+ },
1755
+ handleToProduct(item){
1756
+ let productPath = {};
1757
+ if(item.product_detail_url){
1758
+ try{
1759
+ let urlObj = JSON.parse(item.product_detail_url);
1760
+ if(this.$xdUniHelper.checkVarType(urlObj) === 'object'){
1761
+ productPath = {
1762
+ url: urlObj['page_value'] + "?product_id=" + item.product_id,
1763
+ 'jfb-platform': urlObj
1764
+ }
1765
+ }else{
1766
+ throw new Error('不合法的product_detail_url');
1767
+ }
1768
+ }catch(err){
1769
+ productPath = {
1770
+ url: item.product_detail_url
1771
+ }
1772
+ }
1773
+ this.$xdUniHelper.navigateTo(productPath);
1774
+ }
1775
+ },
1678
1776
  handleDeleteOrder(){
1679
1777
  jfbRootExec("deleteBaseOrder", {
1680
1778
  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;