applyWithdrawal.vue 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153
  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||serviceCharge==0)?toThousands(serviceCharge,2):'--' }}元 </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 { commonMixin } from '@/utils/mixin'
  48. import { saveMerchantCashOut, merchantCashOutDetail } from '@/api/merchant'
  49. export default {
  50. mixins: [commonMixin],
  51. props: {
  52. isOpenModal: {
  53. type: Boolean,
  54. default: false
  55. },
  56. currentData: {
  57. type: Object,
  58. default: function () {
  59. return {}
  60. }
  61. }
  62. },
  63. computed: {
  64. serviceCharge () {
  65. return this.form.amount ? this.form.amount + 0.5 : 0
  66. }
  67. },
  68. data () {
  69. return {
  70. formItemLayout: {
  71. labelCol: { span: 6 },
  72. wrapperCol: { span: 15 }
  73. },
  74. form: {
  75. amount: ''
  76. },
  77. pageInfo: null,
  78. opened: this.isOpenModal,
  79. title: '申请提现',
  80. confirmLoading: false,
  81. spinning: false,
  82. rules: { amount: [{ required: true, message: '请输入提现金额', trigger: 'blur' }] }
  83. }
  84. },
  85. methods: {
  86. getPageInfo () {
  87. this.spinning = true
  88. merchantCashOutDetail({}).then(res => {
  89. console.log(res, '===========')
  90. if (res.status == 200) {
  91. this.pageInfo = res.data
  92. } else {
  93. this.pageInfo = null
  94. }
  95. this.spinning = false
  96. })
  97. },
  98. // 保存
  99. handleSubmit () {
  100. const _this = this
  101. this.$refs.ruleForm.validate(valid => {
  102. if (valid) {
  103. const form = JSON.parse(JSON.stringify(_this.form))
  104. form.serviceCharge = this.serviceCharge
  105. form.merchantType = 'DEALER'
  106. form.merchantSn = _this.pageInfo ? _this.pageInfo.merchantSn : ''
  107. // form.shelfSn = _this.nowData && _this.nowData.shelfSn
  108. _this.spinning = true
  109. saveMerchantCashOut(form).then(res => {
  110. if (res.status == 200) {
  111. _this.$message.success(res.message)
  112. setTimeout(() => {
  113. _this.cancel()
  114. _this.$emit('refresh')
  115. _this.spinning = false
  116. }, 1000)
  117. } else {
  118. _this.spinning = false
  119. }
  120. })
  121. } else {
  122. console.log('error submit!!')
  123. return false
  124. }
  125. })
  126. },
  127. // 取消
  128. cancel () {
  129. this.form.amount = ''
  130. this.$refs.ruleForm.resetFields()
  131. this.$emit('close')
  132. }
  133. },
  134. watch: {
  135. isOpenModal (nVal, oVal) {
  136. this.opened = nVal
  137. // this.getPageInfo()
  138. },
  139. opened (nVal, oVal) {
  140. if (nVal) {
  141. this.getPageInfo()
  142. } else {
  143. this.form.amount = ''
  144. this.$emit('close')
  145. }
  146. }
  147. }
  148. }
  149. </script>
  150. <style>
  151. </style>