CancelOrder.vue 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133
  1. <template>
  2. <u-popup @close="close" :value="show" :closeable="true" mode="bottom" border-radius="16">
  3. <view class="pop-view">
  4. <view class="title">请选择取消原因</view>
  5. <view style="padding-bottom: 30rpx;">
  6. <view v-for="(item, index) in reason" :key="index" class="reason-li clearfix" @click="resonChange(item)">
  7. <text class="float_left">{{ item }}</text>
  8. <text class="float_right ibonfont primary-color" :class="[cancel_reason === item ? 'ibonxuanze1' : 'ibonweixuanze']"></text>
  9. </view>
  10. </view>
  11. <view class="other-reason" v-if="cancel_reason === '其他原因'"><u-input type="textarea" v-model="other_reason" :border="true" :height="150"></u-input></view>
  12. </view>
  13. <view class="confirm-btn primary-bg" @click="confirm">
  14. <u-loading v-if="loading" mode="circle"></u-loading>
  15. 确定
  16. </view>
  17. </u-popup>
  18. </template>
  19. <script>
  20. export default {
  21. props: {
  22. show: {
  23. type: Boolean,
  24. default: false
  25. },
  26. orderId: {
  27. type: [Number, String],
  28. default: ''
  29. },
  30. cancelbeforeOrderStatus: {
  31. type: [Number, String],
  32. default: ''
  33. },
  34. payStatus: {
  35. type: [Number, String],
  36. default: ''
  37. }
  38. },
  39. computed: {
  40. // 系统是否开启取消订单审核状态
  41. cancelOrderAudit() {
  42. return this.$store.state.baseSet.cancelOrderAudit || 4;
  43. }
  44. },
  45. data() {
  46. return {
  47. other_reason: '',
  48. loading: false,
  49. cancel_reason: '',
  50. reason: ['不想买了', '信息填错了', '买错商品了', '卖家缺货', '其他原因']
  51. };
  52. },
  53. methods: {
  54. resonChange(item) {
  55. this.cancel_reason = item;
  56. },
  57. confirm() {
  58. if (!this.cancel_reason) {
  59. this.$api.msg('请选择取消订单的原因');
  60. return;
  61. }
  62. if (this.cancel_reason === '其他原因' && !this.other_reason) {
  63. this.$api.msg('请输入取消订单的原因');
  64. return;
  65. }
  66. if (this.loading) {
  67. return;
  68. }
  69. let obj = {
  70. orderStatus: this.payStatus === 4 ? 6 : 7,
  71. cancelReason: this.cancel_reason === '其他原因' ? this.other_reason : this.cancel_reason
  72. };
  73. if (this.cancelOrderAudit === 5) {
  74. obj.cancelbeforeOrderStatus = this.cancelbeforeOrderStatus;
  75. }
  76. this.loading = true;
  77. this.$u.api
  78. .updateOrderStatus(this.orderId, obj)
  79. .then(res => {
  80. this.loading = false;
  81. this.$api.msg('取消成功');
  82. this.close();
  83. this.$emit('confirm');
  84. })
  85. .catch(err => {
  86. this.loading = false;
  87. });
  88. },
  89. close() {
  90. this.$emit('close');
  91. }
  92. }
  93. };
  94. </script>
  95. <style lang="scss">
  96. .confirm-btn {
  97. color: #ffffff;
  98. line-height: 90rpx;
  99. text-align: center;
  100. width: 100%;
  101. }
  102. .pop-view {
  103. padding: 0 30rpx;
  104. .title {
  105. font-weight: bold;
  106. line-height: 70rpx;
  107. padding-top: 10rpx;
  108. }
  109. .desc {
  110. color: #6c6c6c;
  111. font-size: 24rpx;
  112. line-height: 60rpx;
  113. padding-bottom: 30rpx;
  114. }
  115. .reason-li {
  116. line-height: 90upx;
  117. padding-right: 30upx;
  118. vertical-align: middle;
  119. border-bottom: 1px solid #f5f5f5;
  120. .ibonxuanze1,
  121. .ibonweixuanze {
  122. margin-right: 0;
  123. padding-left: 0;
  124. font-size: 38upx;
  125. }
  126. }
  127. .other-reason {
  128. padding-bottom: 30rpx;
  129. }
  130. }
  131. </style>