applyWithdrawal.vue 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150
  1. <template>
  2. <a-modal
  3. v-model="opened"
  4. :title="title"
  5. centered
  6. :maskClosable="false"
  7. :confirmLoading="confirmLoading"
  8. :width="560"
  9. :footer="null"
  10. @cancel="cancel"
  11. >
  12. <a-spin :spinning="spinning" tip="Loading...">
  13. <a-form-model
  14. id="applyWithdrawal-form"
  15. ref="ruleForm"
  16. :model="form"
  17. :rules="rules"
  18. :label-col="formItemLayout.labelCol"
  19. :wrapper-col="formItemLayout.wrapperCol"
  20. >
  21. <a-form-model-item label="申请提现金额" prop="amount">
  22. <a-input-number
  23. v-model="form.amount"
  24. :min="0.1"
  25. style="width: 100%;"
  26. :precision="2"
  27. id="applyWithdrawal"
  28. placeholder="请输入正数(最多两位小数)"
  29. allowClear />
  30. </a-form-model-item>
  31. <a-form-model-item label="实际扣除金额">
  32. <span>{{ serviceCharge }}元 </span><span style="color: #999;">(申请提现金额+提现手续费)</span>
  33. </a-form-model-item>
  34. <a-form-model-item label="提现账户">
  35. <span style="display: block;" v-if="pageInfo">{{ pageInfo.merchantBankAccountEntity?pageInfo.merchantBankAccountEntity.bankAccount:'' }}{{ ' ( '+ pageInfo.dealerName +' ) ' }}</span>
  36. <span v-if="pageInfo">{{ pageInfo.merchantBankAccountEntity?pageInfo.merchantBankAccountEntity.bankCard:"" }}</span>
  37. </a-form-model-item>
  38. <a-form-model-item :wrapper-col="{ span: 12, offset: 6 }" style="text-align: center;">
  39. <a-button type="primary" :loading="confirmLoading" @click="handleSubmit" id="applyWithdrawal-btn-submit">确定</a-button>
  40. <a-button @click="cancel" style="margin-left: 15px" id="applyWithdrawal-btn-back">取消</a-button>
  41. </a-form-model-item>
  42. </a-form-model>
  43. </a-spin>
  44. </a-modal>
  45. </template>
  46. <script>
  47. import { saveMerchantCashOut, merchantCashOutDetail } from '@/api/merchant'
  48. export default {
  49. props: {
  50. isOpenModal: {
  51. type: Boolean,
  52. default: false
  53. },
  54. currentData: {
  55. type: Object,
  56. default: function () {
  57. return {}
  58. }
  59. }
  60. },
  61. computed: {
  62. serviceCharge () {
  63. return this.form.amount ? this.form.amount + 0.5 : 0
  64. }
  65. },
  66. data () {
  67. return {
  68. formItemLayout: {
  69. labelCol: { span: 6 },
  70. wrapperCol: { span: 15 }
  71. },
  72. form: {
  73. amount: ''
  74. },
  75. pageInfo: null,
  76. opened: this.isOpenModal,
  77. title: '申请提现',
  78. confirmLoading: false,
  79. spinning: false,
  80. rules: { amount: [{ required: true, message: '请选择关联客户', trigger: 'blur' }] }
  81. }
  82. },
  83. methods: {
  84. getPageInfo () {
  85. this.spinning = true
  86. merchantCashOutDetail({}).then(res => {
  87. console.log(res, '===========')
  88. if (res.status == 200) {
  89. this.pageInfo = res.data
  90. } else {
  91. this.pageInfo = null
  92. }
  93. this.spinning = false
  94. })
  95. },
  96. // 保存
  97. handleSubmit () {
  98. const _this = this
  99. this.$refs.ruleForm.validate(valid => {
  100. if (valid) {
  101. const form = JSON.parse(JSON.stringify(_this.form))
  102. form.serviceCharge = this.serviceCharge
  103. form.merchantType = 'DEALER'
  104. form.merchantSn = _this.pageInfo ? _this.pageInfo.merchantSn : ''
  105. // form.shelfSn = _this.nowData && _this.nowData.shelfSn
  106. _this.spinning = true
  107. saveMerchantCashOut(form).then(res => {
  108. if (res.status == 200) {
  109. _this.$message.success(res.message)
  110. setTimeout(() => {
  111. _this.cancel()
  112. _this.$emit('refresh')
  113. _this.spinning = false
  114. }, 1000)
  115. } else {
  116. _this.spinning = false
  117. }
  118. })
  119. } else {
  120. console.log('error submit!!')
  121. return false
  122. }
  123. })
  124. },
  125. // 取消
  126. cancel () {
  127. this.form.amount = ''
  128. this.$emit('close')
  129. }
  130. },
  131. watch: {
  132. isOpenModal (nVal, oVal) {
  133. this.opened = nVal
  134. // this.getPageInfo()
  135. },
  136. opend (nVal, oVal) {
  137. if (nVal) {
  138. this.getPageInfo()
  139. } else {
  140. this.form.amount = ''
  141. this.$emit('close')
  142. }
  143. }
  144. }
  145. }
  146. </script>
  147. <style>
  148. </style>