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,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 class="btn">取消支付</div> | 47 | + <div @click="cancelPayment(item)" class="btn">取消支付</div> |
| 48 | <div @click="jumpToPay(item)" class="active">立即支付</div> | 48 | <div @click="jumpToPay(item)" class="active">立即支付</div> |
| 49 | </div> | 49 | </div> |
| 50 | </div> | 50 | </div> |
| @@ -69,6 +69,10 @@ export default { | @@ -69,6 +69,10 @@ 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 | + }, | ||
| 72 | } | 76 | } |
| 73 | }; | 77 | }; |
| 74 | </script> | 78 | </script> |
src/main.js
| @@ -6,7 +6,7 @@ import VueHead from "vue-head"; | @@ -6,7 +6,7 @@ import VueHead from "vue-head"; | ||
| 6 | import sha1 from "sha1"; | 6 | import sha1 from "sha1"; |
| 7 | import 'mint-ui/lib/style.css'; | 7 | import 'mint-ui/lib/style.css'; |
| 8 | import { Toast, Indicator,InfiniteScroll } from "mint-ui"; | 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 | import App from "./App"; | 10 | import App from "./App"; |
| 11 | import IdCard from './common/IdCard'; | 11 | import IdCard from './common/IdCard'; |
| 12 | import VueBus from 'vue-bus'; | 12 | import VueBus from 'vue-bus'; |
| @@ -24,6 +24,7 @@ Vue.use(ImagePreview); | @@ -24,6 +24,7 @@ Vue.use(ImagePreview); | ||
| 24 | Vue.use(VueClipboard) | 24 | Vue.use(VueClipboard) |
| 25 | Vue.use(Tab); | 25 | Vue.use(Tab); |
| 26 | Vue.use(Tabs); | 26 | Vue.use(Tabs); |
| 27 | +Vue.use(ActionSheet); | ||
| 27 | Vue.use(Lazyload, { | 28 | Vue.use(Lazyload, { |
| 28 | preload: 90, | 29 | preload: 90, |
| 29 | loading: "static/img/x.jpg", | 30 | loading: "static/img/x.jpg", |
src/pages/myGiftBox/myGiftBox.vue
| @@ -35,14 +35,21 @@ | @@ -35,14 +35,21 @@ | ||
| 35 | <giftGivingItem | 35 | <giftGivingItem |
| 36 | @onGiftGiving="onGiftGiving" | 36 | @onGiftGiving="onGiftGiving" |
| 37 | @jumpToPay="jumpToPay" | 37 | @jumpToPay="jumpToPay" |
| 38 | + @cancelPayment="cancelPayment" | ||
| 38 | v-show="active != 0 && active == 1" | 39 | v-show="active != 0 && active == 1" |
| 39 | :giftGivingItem="giftGivingItem" | 40 | :giftGivingItem="giftGivingItem" |
| 40 | > | 41 | > |
| 41 | </giftGivingItem> | 42 | </giftGivingItem> |
| 42 | <!-- 没有更多了 --> | 43 | <!-- 没有更多了 --> |
| 43 | - <div class="tip_text">{{this.tipText}}</div> | 44 | + <div class="tip_text">{{ this.tipText }}</div> |
| 44 | </div> | 45 | </div> |
| 45 | </div> | 46 | </div> |
| 47 | + <!-- 弹出框 --> | ||
| 48 | + <van-action-sheet | ||
| 49 | + v-model="actionSheetShow" | ||
| 50 | + :actions="actions" | ||
| 51 | + @select="onSelect" | ||
| 52 | + /> | ||
| 46 | </div> | 53 | </div> |
| 47 | </template> | 54 | </template> |
| 48 | 55 | ||
| @@ -58,17 +65,25 @@ export default { | @@ -58,17 +65,25 @@ export default { | ||
| 58 | active: 0, | 65 | active: 0, |
| 59 | receivingGiftsInfo: null, // 收礼列表页数据 | 66 | receivingGiftsInfo: null, // 收礼列表页数据 |
| 60 | loading: false, // 判断是否加载 | 67 | loading: false, // 判断是否加载 |
| 61 | - receivingGifts: { // 收礼 | 68 | + receivingGifts: { |
| 69 | + // 收礼 | ||
| 62 | loading: false, // 加载 | 70 | loading: false, // 加载 |
| 63 | pages: 0 // 分页 | 71 | pages: 0 // 分页 |
| 64 | }, | 72 | }, |
| 65 | giftGivingItem: null, // 送礼列表页数据 | 73 | giftGivingItem: null, // 送礼列表页数据 |
| 66 | giftsRuleUrl: null, // 礼物规则URL | 74 | giftsRuleUrl: null, // 礼物规则URL |
| 67 | - giftGiving: { // 送礼 | 75 | + giftGiving: { |
| 76 | + // 送礼 | ||
| 68 | loading: false, // 加载 | 77 | loading: false, // 加载 |
| 69 | pages: 0 // 分页 | 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 | components: { | 89 | components: { |
| @@ -94,7 +109,7 @@ export default { | @@ -94,7 +109,7 @@ export default { | ||
| 94 | if (active === 1) { | 109 | if (active === 1) { |
| 95 | // 调用im是否显示隐藏1显示im聊天弹窗0不显示 | 110 | // 调用im是否显示隐藏1显示im聊天弹窗0不显示 |
| 96 | this.setGiftBottomVisibleBySwitchTab(1); | 111 | this.setGiftBottomVisibleBySwitchTab(1); |
| 97 | - // 送礼订单列表 | 112 | + // 送礼订单列表 |
| 98 | this.getorderGiveGiftList(); | 113 | this.getorderGiveGiftList(); |
| 99 | } else { | 114 | } else { |
| 100 | // 收礼订单列表 | 115 | // 收礼订单列表 |
| @@ -103,21 +118,28 @@ export default { | @@ -103,21 +118,28 @@ export default { | ||
| 103 | this.setGiftBottomVisibleBySwitchTab(0); | 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 | onInfiniteScroll() { | 131 | onInfiniteScroll() { |
| 110 | if (this.active === 0) { | 132 | if (this.active === 0) { |
| 111 | // 收礼订单列表 | 133 | // 收礼订单列表 |
| 112 | - this.loading = this.receivingGifts.loading | 134 | + this.loading = this.receivingGifts.loading; |
| 113 | this.getorderGiftList(); | 135 | this.getorderGiftList(); |
| 114 | } else { | 136 | } else { |
| 115 | // 送礼订单列表 | 137 | // 送礼订单列表 |
| 116 | - this.loading = this.giftGiving.loading | 138 | + this.loading = this.giftGiving.loading; |
| 117 | this.getorderGiveGiftList(); | 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,7 +332,10 @@ export default { | ||
| 310 | // 隐藏加载圈 | 332 | // 隐藏加载圈 |
| 311 | this.giftGiving.loading = false; | 333 | this.giftGiving.loading = false; |
| 312 | if (this.giftGiving.pages > 1) { | 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 | } else { | 339 | } else { |
| 315 | this.$set(this, "giftGivingItem", datas.list); | 340 | this.$set(this, "giftGivingItem", datas.list); |
| 316 | } | 341 | } |
| @@ -362,40 +387,73 @@ export default { | @@ -362,40 +387,73 @@ export default { | ||
| 362 | // 判断并调用通用跳转 | 387 | // 判断并调用通用跳转 |
| 363 | if (typeof this.$parent.gotoDetail === "function") { | 388 | if (typeof this.$parent.gotoDetail === "function") { |
| 364 | // 临时,设置跳转商品详情参数 | 389 | // 临时,设置跳转商品详情参数 |
| 365 | - let item={ | 390 | + let item = { |
| 366 | type: "44", | 391 | type: "44", |
| 367 | to: this.giftsRuleUrl, | 392 | to: this.giftsRuleUrl, |
| 368 | shop_type: "" | 393 | shop_type: "" |
| 369 | - } | ||
| 370 | - console.log(item) | 394 | + }; |
| 395 | + console.log(item); | ||
| 371 | this.$parent.gotoDetail(item); | 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 | if (this.isCNLive.value) { | 441 | if (this.isCNLive.value) { |
| 378 | // 调用App,返回按键 | 442 | // 调用App,返回按键 |
| 379 | if ( | 443 | if ( |
| 380 | window.webkit && | 444 | window.webkit && |
| 381 | window.webkit.messageHandlers && | 445 | window.webkit.messageHandlers && |
| 382 | - window.webkit.messageHandlers | ||
| 383 | - .jumpToPay | 446 | + window.webkit.messageHandlers.jumpToPay |
| 384 | ) { | 447 | ) { |
| 385 | // App内,iOS销毁WebView | 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 | // App内,Android销毁WebView | 453 | // App内,Android销毁WebView |
| 394 | window.obj.jumpToPay(item.id); | 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,4 +462,4 @@ export default { | ||
| 404 | <!-- Add "scoped" attribute to limit CSS to this component only --> | 462 | <!-- Add "scoped" attribute to limit CSS to this component only --> |
| 405 | <style rel="stylesheet/less" lang="less"> | 463 | <style rel="stylesheet/less" lang="less"> |
| 406 | @import "myGiftBox"; | 464 | @import "myGiftBox"; |
| 407 | -</style> | 465 | -</style> |
| 466 | +</style> | ||
| 408 | \ No newline at end of file | 467 | \ No newline at end of file |