Commit b14462e30de0532d3f94a03c6059aab5d9701e6b

Authored by zhiyangdu
1 parent 77baeb9e

取消支付信息获取

src/components/giftGivingItem/giftGivingItem.vue
... ... @@ -44,7 +44,7 @@
44 44 <!-- 按钮 -->
45 45 <div class="btn_list">
46 46 <div class="box">
47   - <div v-on:click.stop="cancelPayment(item)" class="btn">取消支付</div>
  47 + <div v-on:click.stop="$parent.actionSheetShow = true" class="btn">取消支付</div>
48 48 <div v-on:click.stop="jumpToPay(item)" class="active">立即支付</div>
49 49 </div>
50 50 </div>
... ... @@ -69,10 +69,6 @@ export default {
69 69 jumpToPay(item){
70 70 this.$emit('jumpToPay',item)
71 71 },
72   - // 取消支付
73   - cancelPayment(item){
74   - this.$emit('cancelPayment',item)
75   - },
76 72 }
77 73 };
78 74 </script>
... ...
src/pages/myGiftBox/myGiftBox.vue
... ... @@ -35,7 +35,6 @@
35 35 <giftGivingItem
36 36 @onGiftGiving="onGiftGiving"
37 37 @jumpToPay="jumpToPay"
38   - @cancelPayment="cancelPayment"
39 38 v-show="active != 0 && active == 1"
40 39 :giftGivingItem="giftGivingItem"
41 40 >
... ... @@ -45,11 +44,9 @@
45 44 </div>
46 45 </div>
47 46 <!-- 弹出框 -->
48   - <van-action-sheet
49   - v-model="actionSheetShow"
50   - :actions="actions"
51   - @select="onSelect"
52   - />
  47 + <van-popup position="bottom" v-model="actionSheetShow">
  48 + <van-picker :columns="causes" @change="onSelect" />
  49 + </van-popup>
53 50 </div>
54 51 </template>
55 52  
... ... @@ -79,11 +76,7 @@ export default {
79 76 },
80 77 tipText: null, // 是否已加载完
81 78 actionSheetShow: false,
82   - actions: [
83   - // { name: "选项" },
84   - // { name: "选项" },
85   - // { name: "选项", subname: "描述信息" }
86   - ]
  79 + causes: [] // 取消原因
87 80 };
88 81 },
89 82 components: {
... ... @@ -97,6 +90,8 @@ export default {
97 90 this.getorderGiveGiftList();
98 91 // 赠礼规则
99 92 this.orderGiftContent();
  93 + // 取消订单元原因获取
  94 + this.cancelPayment();
100 95 },
101 96 methods: {
102 97 /**
... ... @@ -119,11 +114,9 @@ export default {
119 114 }
120 115 },
121 116 // 取消订单选择框
122   - onSelect(item) {
123   - // 默认情况下点击选项时不会自动收起
124   - // 可以通过 close-on-click-action 属性开启自动收起
  117 + onSelect(picker, value, index) {
125 118 this.actionSheetShow = false;
126   - // Toast(item.name);
  119 + Toast(`当前值:${value}, 当前索引:${index}`);
127 120 },
128 121 /**
129 122 * 下啦滑动加载更多
... ... @@ -425,17 +418,19 @@ export default {
425 418 this.actionSheetShow = true;
426 419 // 解构数据
427 420 let { data: datas } = res;
428   - // this.actions = datas.group;
429   - // 获取到的数组存到this.actions中去
  421 + // 获取到的数组存到this.causes中去
430 422 if (datas.group && datas.group.length > 0) {
431   - for (let i=0; i<datas.group.length; i++) {
432   - var obj = {}
433   - obj.name = datas.group[i]
434   - // push到新数组中
435   - this.actions.push(obj);
436   - }
  423 + this.causes = datas.group;
  424 + // for (let i=0; i<datas.group.length; i++) {
  425 + // var obj = {}
  426 + // obj.name = datas.group[i]
  427 + // // push到新数组中
  428 + // this.causes.push(obj);
  429 + // }
  430 + // // 数组对象去重
  431 + // const newres = new Map();
  432 + // this.causes = this.causes.filter((arr) => !newres.has(arr.name) && newres.set(arr.name, 1))
437 433 }
438   - console.log(this.actions);
439 434 }
440 435 },
441 436 // 跳转原声支付
... ... @@ -446,15 +441,15 @@ export default {
446 441 if (
447 442 window.webkit &&
448 443 window.webkit.messageHandlers &&
449   - window.webkit.messageHandlers.jumpToPay
  444 + window.webkit.messageHandlers.openAppPayment
450 445 ) {
451 446 // App内,iOS销毁WebView
452   - window.webkit.messageHandlers.jumpToPay.postMessage({
453   - body: { orderNumber: item.id }
  447 + window.webkit.messageHandlers.openAppPayment.postMessage({
  448 + body: { orderNumber: item.orderid }
454 449 });
455 450 } else if (window.obj && window.obj.jumpToPay) {
456 451 // App内,Android销毁WebView
457   - window.obj.jumpToPay(item.id);
  452 + window.obj.jumpToPay(item.orderid);
458 453 }
459 454 }
460 455 }
... ... @@ -465,4 +460,4 @@ export default {
465 460 <!-- Add "scoped" attribute to limit CSS to this component only -->
466 461 <style rel="stylesheet/less" lang="less">
467 462 @import "myGiftBox";
468   -</style>
469 463 \ No newline at end of file
  464 +</style>
... ...