Commit b14462e30de0532d3f94a03c6059aab5d9701e6b
1 parent
77baeb9e
取消支付信息获取
Showing
2 changed files
with
25 additions
and
34 deletions
src/components/giftGivingItem/giftGivingItem.vue
| @@ -44,7 +44,7 @@ | @@ -44,7 +44,7 @@ | ||
| 44 | <!-- 按钮 --> | 44 | <!-- 按钮 --> |
| 45 | <div class="btn_list"> | 45 | <div class="btn_list"> |
| 46 | <div class="box"> | 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 | <div v-on:click.stop="jumpToPay(item)" class="active">立即支付</div> | 48 | <div v-on:click.stop="jumpToPay(item)" class="active">立即支付</div> |
| 49 | </div> | 49 | </div> |
| 50 | </div> | 50 | </div> |
| @@ -69,10 +69,6 @@ export default { | @@ -69,10 +69,6 @@ export default { | ||
| 69 | jumpToPay(item){ | 69 | jumpToPay(item){ |
| 70 | this.$emit('jumpToPay',item) | 70 | this.$emit('jumpToPay',item) |
| 71 | }, | 71 | }, |
| 72 | - // 取消支付 | ||
| 73 | - cancelPayment(item){ | ||
| 74 | - this.$emit('cancelPayment',item) | ||
| 75 | - }, | ||
| 76 | } | 72 | } |
| 77 | }; | 73 | }; |
| 78 | </script> | 74 | </script> |
src/pages/myGiftBox/myGiftBox.vue
| @@ -35,7 +35,6 @@ | @@ -35,7 +35,6 @@ | ||
| 35 | <giftGivingItem | 35 | <giftGivingItem |
| 36 | @onGiftGiving="onGiftGiving" | 36 | @onGiftGiving="onGiftGiving" |
| 37 | @jumpToPay="jumpToPay" | 37 | @jumpToPay="jumpToPay" |
| 38 | - @cancelPayment="cancelPayment" | ||
| 39 | v-show="active != 0 && active == 1" | 38 | v-show="active != 0 && active == 1" |
| 40 | :giftGivingItem="giftGivingItem" | 39 | :giftGivingItem="giftGivingItem" |
| 41 | > | 40 | > |
| @@ -45,11 +44,9 @@ | @@ -45,11 +44,9 @@ | ||
| 45 | </div> | 44 | </div> |
| 46 | </div> | 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 | </div> | 50 | </div> |
| 54 | </template> | 51 | </template> |
| 55 | 52 | ||
| @@ -79,11 +76,7 @@ export default { | @@ -79,11 +76,7 @@ export default { | ||
| 79 | }, | 76 | }, |
| 80 | tipText: null, // 是否已加载完 | 77 | tipText: null, // 是否已加载完 |
| 81 | actionSheetShow: false, | 78 | actionSheetShow: false, |
| 82 | - actions: [ | ||
| 83 | - // { name: "选项" }, | ||
| 84 | - // { name: "选项" }, | ||
| 85 | - // { name: "选项", subname: "描述信息" } | ||
| 86 | - ] | 79 | + causes: [] // 取消原因 |
| 87 | }; | 80 | }; |
| 88 | }, | 81 | }, |
| 89 | components: { | 82 | components: { |
| @@ -97,6 +90,8 @@ export default { | @@ -97,6 +90,8 @@ export default { | ||
| 97 | this.getorderGiveGiftList(); | 90 | this.getorderGiveGiftList(); |
| 98 | // 赠礼规则 | 91 | // 赠礼规则 |
| 99 | this.orderGiftContent(); | 92 | this.orderGiftContent(); |
| 93 | + // 取消订单元原因获取 | ||
| 94 | + this.cancelPayment(); | ||
| 100 | }, | 95 | }, |
| 101 | methods: { | 96 | methods: { |
| 102 | /** | 97 | /** |
| @@ -119,11 +114,9 @@ export default { | @@ -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 | this.actionSheetShow = false; | 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,17 +418,19 @@ export default { | ||
| 425 | this.actionSheetShow = true; | 418 | this.actionSheetShow = true; |
| 426 | // 解构数据 | 419 | // 解构数据 |
| 427 | let { data: datas } = res; | 420 | let { data: datas } = res; |
| 428 | - // this.actions = datas.group; | ||
| 429 | - // 获取到的数组存到this.actions中去 | 421 | + // 获取到的数组存到this.causes中去 |
| 430 | if (datas.group && datas.group.length > 0) { | 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,15 +441,15 @@ export default { | ||
| 446 | if ( | 441 | if ( |
| 447 | window.webkit && | 442 | window.webkit && |
| 448 | window.webkit.messageHandlers && | 443 | window.webkit.messageHandlers && |
| 449 | - window.webkit.messageHandlers.jumpToPay | 444 | + window.webkit.messageHandlers.openAppPayment |
| 450 | ) { | 445 | ) { |
| 451 | // App内,iOS销毁WebView | 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 | } else if (window.obj && window.obj.jumpToPay) { | 450 | } else if (window.obj && window.obj.jumpToPay) { |
| 456 | // App内,Android销毁WebView | 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,4 +460,4 @@ export default { | ||
| 465 | <!-- Add "scoped" attribute to limit CSS to this component only --> | 460 | <!-- Add "scoped" attribute to limit CSS to this component only --> |
| 466 | <style rel="stylesheet/less" lang="less"> | 461 | <style rel="stylesheet/less" lang="less"> |
| 467 | @import "myGiftBox"; | 462 | @import "myGiftBox"; |
| 468 | -</style> | ||
| 469 | \ No newline at end of file | 463 | \ No newline at end of file |
| 464 | +</style> |