Commit 40cb53c39412bfa78f2065561252ad0c2f7d6774

Authored by zhiyangdu
1 parent 46ccd7d1

送礼订单操作

src/pages/myGiftBox/myGiftBox.vue
... ... @@ -45,8 +45,12 @@
45 45 </div>
46 46 </div>
47 47 <!-- 弹出框 -->
48   - <van-popup :style="{ height: '160px' }" position="bottom" v-model="actionSheetShow">
49   - <van-picker :columns="orderOperation.causes" @change="onSelect" />
  48 + <van-popup
  49 + :style="{ height: '160px' }"
  50 + position="bottom"
  51 + v-model="actionSheetShow"
  52 + >
  53 + <van-picker show-toolbar :columns="orderOperation.causes" :default-index="2" @cancel="onCancel" @confirm="confirm"/>
50 54 </van-popup>
51 55 </div>
52 56 </template>
... ... @@ -77,10 +81,11 @@ export default {
77 81 },
78 82 tipText: null, // 是否已加载完
79 83 actionSheetShow: false,
80   - orderOperation: {// 存取取消订单的信息
81   - causes:[],// 取消原因
82   - id:''//订单id
83   - }
  84 + orderOperation: {
  85 + // 存取取消订单的信息
  86 + causes: [], // 取消原因
  87 + item: null //订单id
  88 + }
84 89 };
85 90 },
86 91 components: {
... ... @@ -94,7 +99,7 @@ export default {
94 99 this.getorderGiveGiftList();
95 100 // 赠礼规则
96 101 this.orderGiftContent();
97   - // 取消订单原因获取
  102 + // 取消订单原因获取
98 103 this.cancelPayment();
99 104 },
100 105 methods: {
... ... @@ -418,24 +423,27 @@ export default {
418 423 // 获取到的数组存到this.causes中去
419 424 if (datas.group && datas.group.length > 0) {
420 425 this.orderOperation.causes = datas.group;
421   - console.log(this.orderOperation)
422 426 }
423 427 }
424 428 },
425 429 // 取消支付子组件事件传递
426   - onCancelPayment(item){
  430 + onCancelPayment(item) {
427 431 this.actionSheetShow = true; // 显示底部取消订单原因弹框
428   - this.orderOperation.id = item.id // 获取当前操作订单ID
  432 + this.orderOperation.item = item; // 获取当前操作订单ID
429 433 },
430   - // 取消订单选择框
431   - onSelect(picker, value, index) {
  434 + // 确认,取消订单
  435 + confirm(picker, value, index) {
432 436 this.actionSheetShow = false;
433 437 // Toast(`当前值:${value}, 当前索引:${index}`);
434 438 // 调用取消订单原因填写
435   - this.cancelorder(this.orderOperation.id,value)
  439 + this.cancelorder(this.orderOperation.item, value);
  440 + },
  441 + // 取消,取消订单
  442 + onCancel(){
  443 + this.actionSheetShow = false;
436 444 },
437   - // 取消支付填写原因
438   - cancelorder(orderId,content) {
  445 + // 取消支付填写原因
  446 + cancelorder(item, content) {
439 447 // 加载中提示
440 448 Indicator.open("加载中...");
441 449  
... ... @@ -443,12 +451,13 @@ export default {
443 451 this.http(
444 452 "/Api/" + this.getApiVersion().index + "/cancel_order",
445 453 {
446   - id:orderId, // 订单ID
447   - content:content // 取消订单ID
  454 + id: item.id, // 订单ID
  455 + content: content // 取消订单ID
448 456 },
449 457 this.cancelorderCallback,
450 458 {
451   - method: "post"
  459 + method: "post",
  460 + item
452 461 }
453 462 );
454 463 },
... ... @@ -460,7 +469,11 @@ export default {
460 469 cancelorderCallback(res, ext) {
461 470 // 加载完成
462 471 Indicator.close();
463   -
  472 + // 设置已关注
  473 + if (ext.item.status == "0") {
  474 + // 关注达人
  475 + this.$set(ext.item, "status", "3");
  476 + }
464 477 // 返回处理
465 478 if (res.code == 200) {
466 479 this.actionSheetShow = true;
... ...