back-money.vue 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114
  1. <template>
  2. <view class="slot">
  3. <view class="form">
  4. <u-form :model="form" ref="form" label-width="140rpx">
  5. <u-form-item label="退款原因">
  6. <u-input v-model="form.reason" type="select" placeholder="请选择" @click="openReasonPopup" />
  7. </u-form-item>
  8. <u-form-item label="退款说明">
  9. <u-input v-model="form.desc" placeholder="选填" />
  10. </u-form-item>
  11. <u-form-item label="退款金额" :border-bottom="false">
  12. <u-input v-model="totalPrice" disabled placeholder="-" />
  13. </u-form-item>
  14. </u-form>
  15. </view>
  16. <view class="btn">
  17. <u-button type="primary" shape="circle" @click="submit"><text>提交</text></u-button>
  18. </view>
  19. <!-- 原因选择框 -->
  20. <SelectReason ref="SelectReason" title="退款原因" :ops="reasonOps" @change="changeReason"></SelectReason>
  21. </view>
  22. </template>
  23. <script>
  24. var _self;
  25. import SelectReason from '@/components/select-reason.vue';
  26. export default {
  27. name: 'back-money',
  28. components: {
  29. SelectReason
  30. },
  31. props: {
  32. totalPrice:{
  33. type:String|Number,
  34. default:0
  35. },
  36. },
  37. data() {
  38. return {
  39. // 表单
  40. form: {
  41. reasonId: null,
  42. reason: '',
  43. desc: '',
  44. },
  45. // 原因
  46. currentReasonIndex: null,
  47. reasonOps: [{
  48. label: '不喜欢/不想要',
  49. value: '1'
  50. },
  51. {
  52. label: '实物与描述不符合',
  53. value: '2'
  54. },
  55. {
  56. label: '卖家发错商品',
  57. value: '3'
  58. },
  59. {
  60. label: '其他',
  61. value: '-1'
  62. }
  63. ]
  64. };
  65. },
  66. onLoad() {
  67. _self = this;
  68. },
  69. methods: {
  70. // 计算金额,
  71. // 打开原因选择框
  72. openReasonPopup() {
  73. this.$refs.SelectReason.open(this.currentReasonIndex);
  74. },
  75. // 选择原因回调
  76. changeReason(index) {
  77. console.log(index);
  78. this.currentReasonIndex = index;
  79. this.form.reasonId = this.reasonOps[index].value;
  80. this.form.reason = this.reasonOps[index].label;
  81. },
  82. // 提交
  83. submit() {
  84. if (!this.form.reasonId) {
  85. this.$u.toast('请选择退款原因');
  86. return;
  87. }
  88. this.$emit('done',{
  89. refund_type:1,
  90. reason: this.form.reason,
  91. })
  92. }
  93. }
  94. };
  95. </script>
  96. <style lang="scss" scoped>
  97. .form {
  98. background-color: $app-theme-bg-color;
  99. border-radius: 16rpx;
  100. box-shadow: $app-theme-shadow;
  101. padding: 0 30rpx;
  102. }
  103. .btn {
  104. padding: 60rpx 0rpx;
  105. }
  106. </style>