Commit 8f3c1a5878875fe1596445e3455eecfab3b3d411
1 parent
8e5b6ee2
取消订单操作
Showing
3 changed files
with
92 additions
and
28 deletions
src/components/giftGivingItem/giftGivingItem.vue
| ... | ... | @@ -44,7 +44,7 @@ |
| 44 | 44 | <!-- 按钮 --> |
| 45 | 45 | <div class="btn_list"> |
| 46 | 46 | <div class="box"> |
| 47 | - <div class="btn">取消支付</div> | |
| 47 | + <div @click="cancelPayment(item)" class="btn">取消支付</div> | |
| 48 | 48 | <div @click="jumpToPay(item)" class="active">立即支付</div> |
| 49 | 49 | </div> |
| 50 | 50 | </div> |
| ... | ... | @@ -69,6 +69,10 @@ export default { |
| 69 | 69 | jumpToPay(item){ |
| 70 | 70 | this.$emit('jumpToPay',item) |
| 71 | 71 | }, |
| 72 | + // 取消支付 | |
| 73 | + cancelPayment(item){ | |
| 74 | + this.$emit('cancelPayment',item) | |
| 75 | + }, | |
| 72 | 76 | } |
| 73 | 77 | }; |
| 74 | 78 | </script> | ... | ... |
src/main.js
| ... | ... | @@ -6,7 +6,7 @@ import VueHead from "vue-head"; |
| 6 | 6 | import sha1 from "sha1"; |
| 7 | 7 | import 'mint-ui/lib/style.css'; |
| 8 | 8 | import { Toast, Indicator,InfiniteScroll } from "mint-ui"; |
| 9 | -import { Rate, Popup, Lazyload, Search, PullRefresh, Picker, Image, ImagePreview, Tab, Tabs} from "vant"; | |
| 9 | +import { Rate, Popup, Lazyload, Search, PullRefresh, Picker, Image, ImagePreview, Tab, Tabs, ActionSheet} from "vant"; | |
| 10 | 10 | import App from "./App"; |
| 11 | 11 | import IdCard from './common/IdCard'; |
| 12 | 12 | import VueBus from 'vue-bus'; |
| ... | ... | @@ -24,6 +24,7 @@ Vue.use(ImagePreview); |
| 24 | 24 | Vue.use(VueClipboard) |
| 25 | 25 | Vue.use(Tab); |
| 26 | 26 | Vue.use(Tabs); |
| 27 | +Vue.use(ActionSheet); | |
| 27 | 28 | Vue.use(Lazyload, { |
| 28 | 29 | preload: 90, |
| 29 | 30 | loading: "static/img/x.jpg", | ... | ... |
src/pages/myGiftBox/myGiftBox.vue
| ... | ... | @@ -35,14 +35,21 @@ |
| 35 | 35 | <giftGivingItem |
| 36 | 36 | @onGiftGiving="onGiftGiving" |
| 37 | 37 | @jumpToPay="jumpToPay" |
| 38 | + @cancelPayment="cancelPayment" | |
| 38 | 39 | v-show="active != 0 && active == 1" |
| 39 | 40 | :giftGivingItem="giftGivingItem" |
| 40 | 41 | > |
| 41 | 42 | </giftGivingItem> |
| 42 | 43 | <!-- 没有更多了 --> |
| 43 | - <div class="tip_text">{{this.tipText}}</div> | |
| 44 | + <div class="tip_text">{{ this.tipText }}</div> | |
| 44 | 45 | </div> |
| 45 | 46 | </div> |
| 47 | + <!-- 弹出框 --> | |
| 48 | + <van-action-sheet | |
| 49 | + v-model="actionSheetShow" | |
| 50 | + :actions="actions" | |
| 51 | + @select="onSelect" | |
| 52 | + /> | |
| 46 | 53 | </div> |
| 47 | 54 | </template> |
| 48 | 55 | |
| ... | ... | @@ -58,17 +65,25 @@ export default { |
| 58 | 65 | active: 0, |
| 59 | 66 | receivingGiftsInfo: null, // 收礼列表页数据 |
| 60 | 67 | loading: false, // 判断是否加载 |
| 61 | - receivingGifts: { // 收礼 | |
| 68 | + receivingGifts: { | |
| 69 | + // 收礼 | |
| 62 | 70 | loading: false, // 加载 |
| 63 | 71 | pages: 0 // 分页 |
| 64 | 72 | }, |
| 65 | 73 | giftGivingItem: null, // 送礼列表页数据 |
| 66 | 74 | giftsRuleUrl: null, // 礼物规则URL |
| 67 | - giftGiving: { // 送礼 | |
| 75 | + giftGiving: { | |
| 76 | + // 送礼 | |
| 68 | 77 | loading: false, // 加载 |
| 69 | 78 | pages: 0 // 分页 |
| 70 | 79 | }, |
| 71 | - tipText:null // 是否已加载完 | |
| 80 | + tipText: null, // 是否已加载完 | |
| 81 | + actionSheetShow: false, | |
| 82 | + actions: [ | |
| 83 | + // { name: "选项" }, | |
| 84 | + // { name: "选项" }, | |
| 85 | + // { name: "选项", subname: "描述信息" } | |
| 86 | + ] | |
| 72 | 87 | }; |
| 73 | 88 | }, |
| 74 | 89 | components: { |
| ... | ... | @@ -94,7 +109,7 @@ export default { |
| 94 | 109 | if (active === 1) { |
| 95 | 110 | // 调用im是否显示隐藏1显示im聊天弹窗0不显示 |
| 96 | 111 | this.setGiftBottomVisibleBySwitchTab(1); |
| 97 | - // 送礼订单列表 | |
| 112 | + // 送礼订单列表 | |
| 98 | 113 | this.getorderGiveGiftList(); |
| 99 | 114 | } else { |
| 100 | 115 | // 收礼订单列表 |
| ... | ... | @@ -103,21 +118,28 @@ export default { |
| 103 | 118 | this.setGiftBottomVisibleBySwitchTab(0); |
| 104 | 119 | } |
| 105 | 120 | }, |
| 121 | + // 取消订单选择框 | |
| 122 | + onSelect(item) { | |
| 123 | + // 默认情况下点击选项时不会自动收起 | |
| 124 | + // 可以通过 close-on-click-action 属性开启自动收起 | |
| 125 | + this.actionSheetShow = false; | |
| 126 | + // Toast(item.name); | |
| 127 | + }, | |
| 106 | 128 | /** |
| 107 | 129 | * 下啦滑动加载更多 |
| 108 | 130 | */ |
| 109 | 131 | onInfiniteScroll() { |
| 110 | 132 | if (this.active === 0) { |
| 111 | 133 | // 收礼订单列表 |
| 112 | - this.loading = this.receivingGifts.loading | |
| 134 | + this.loading = this.receivingGifts.loading; | |
| 113 | 135 | this.getorderGiftList(); |
| 114 | 136 | } else { |
| 115 | 137 | // 送礼订单列表 |
| 116 | - this.loading = this.giftGiving.loading | |
| 138 | + this.loading = this.giftGiving.loading; | |
| 117 | 139 | this.getorderGiveGiftList(); |
| 118 | 140 | } |
| 119 | - if(!this.loading){ | |
| 120 | - this.tipText = "已经全部加载完毕" | |
| 141 | + if (!this.loading) { | |
| 142 | + this.tipText = "已经全部加载完毕"; | |
| 121 | 143 | } |
| 122 | 144 | }, |
| 123 | 145 | /** |
| ... | ... | @@ -310,7 +332,10 @@ export default { |
| 310 | 332 | // 隐藏加载圈 |
| 311 | 333 | this.giftGiving.loading = false; |
| 312 | 334 | if (this.giftGiving.pages > 1) { |
| 313 | - this.$set(this, "giftGivingItem",[...this.giftGivingItem,...datas.list]); | |
| 335 | + this.$set(this, "giftGivingItem", [ | |
| 336 | + ...this.giftGivingItem, | |
| 337 | + ...datas.list | |
| 338 | + ]); | |
| 314 | 339 | } else { |
| 315 | 340 | this.$set(this, "giftGivingItem", datas.list); |
| 316 | 341 | } |
| ... | ... | @@ -362,40 +387,73 @@ export default { |
| 362 | 387 | // 判断并调用通用跳转 |
| 363 | 388 | if (typeof this.$parent.gotoDetail === "function") { |
| 364 | 389 | // 临时,设置跳转商品详情参数 |
| 365 | - let item={ | |
| 390 | + let item = { | |
| 366 | 391 | type: "44", |
| 367 | 392 | to: this.giftsRuleUrl, |
| 368 | 393 | shop_type: "" |
| 369 | - } | |
| 370 | - console.log(item) | |
| 394 | + }; | |
| 395 | + console.log(item); | |
| 371 | 396 | this.$parent.gotoDetail(item); |
| 372 | 397 | } |
| 373 | 398 | }, |
| 399 | + // 取消支付 | |
| 400 | + cancelPayment(item) { | |
| 401 | + // 加载中提示 | |
| 402 | + Indicator.open("加载中..."); | |
| 403 | + | |
| 404 | + // 获取送礼礼物列表接口 | |
| 405 | + this.http( | |
| 406 | + "/Api/" + this.getApiVersion().index + "/cancel_order_group", | |
| 407 | + {}, | |
| 408 | + this.cancelPaymentCallback, | |
| 409 | + { | |
| 410 | + method: "get" | |
| 411 | + } | |
| 412 | + ); | |
| 413 | + }, | |
| 414 | + /** | |
| 415 | + * 取消订单回调获取取消原因数据 | |
| 416 | + * @param {object} res [服务器返回数据] | |
| 417 | + * @param {object} ext [扩展参数] | |
| 418 | + */ | |
| 419 | + cancelPaymentCallback(res, ext) { | |
| 420 | + // 加载完成 | |
| 421 | + Indicator.close(); | |
| 422 | + | |
| 423 | + // 返回处理 | |
| 424 | + if (res.code == 200) { | |
| 425 | + this.actionSheetShow = true; | |
| 426 | + // 解构数据 | |
| 427 | + let { data: datas } = res; | |
| 428 | + this.actions = datas.group; | |
| 429 | + // 获取到的数组存到this.actions中去 | |
| 430 | + if (datas.group && datas.group.length > 0) { | |
| 431 | + for (let item in datas.group) { | |
| 432 | + // push到新数组中 | |
| 433 | + this.actions.push({ name: item }); | |
| 434 | + } | |
| 435 | + } | |
| 436 | + } | |
| 437 | + }, | |
| 374 | 438 | // 跳转原声支付 |
| 375 | - jumpToPay(item){ | |
| 376 | - // App内 | |
| 439 | + jumpToPay(item) { | |
| 440 | + // App内 | |
| 377 | 441 | if (this.isCNLive.value) { |
| 378 | 442 | // 调用App,返回按键 |
| 379 | 443 | if ( |
| 380 | 444 | window.webkit && |
| 381 | 445 | window.webkit.messageHandlers && |
| 382 | - window.webkit.messageHandlers | |
| 383 | - .jumpToPay | |
| 446 | + window.webkit.messageHandlers.jumpToPay | |
| 384 | 447 | ) { |
| 385 | 448 | // App内,iOS销毁WebView |
| 386 | - window.webkit.messageHandlers.jumpToPay.postMessage( | |
| 387 | - { body: { orderNumber: item.id } } | |
| 388 | - ); | |
| 389 | - } else if ( | |
| 390 | - window.obj && | |
| 391 | - window.obj.jumpToPay | |
| 392 | - ) { | |
| 449 | + window.webkit.messageHandlers.jumpToPay.postMessage({ | |
| 450 | + body: { orderNumber: item.id } | |
| 451 | + }); | |
| 452 | + } else if (window.obj && window.obj.jumpToPay) { | |
| 393 | 453 | // App内,Android销毁WebView |
| 394 | 454 | window.obj.jumpToPay(item.id); |
| 395 | 455 | } |
| 396 | 456 | } |
| 397 | - | |
| 398 | - | |
| 399 | 457 | } |
| 400 | 458 | } |
| 401 | 459 | }; |
| ... | ... | @@ -404,4 +462,4 @@ export default { |
| 404 | 462 | <!-- Add "scoped" attribute to limit CSS to this component only --> |
| 405 | 463 | <style rel="stylesheet/less" lang="less"> |
| 406 | 464 | @import "myGiftBox"; |
| 407 | 465 | -</style> |
| 466 | +</style> | |
| 408 | 467 | \ No newline at end of file | ... | ... |