|
|
@@ -41,19 +41,25 @@
|
|
|
<el-form-item :label="$t('finance.rechargeAmount')" prop="applyAmount" required>
|
|
|
<el-input-number v-model.number="form.applyAmount" :min="minAmount" :max="maxAmount" :step="10000" style="width: 100%" clearable />
|
|
|
</el-form-item>
|
|
|
- <el-form-item :label="$t('finance.paymentReference')" prop="bankNo" required>
|
|
|
- <el-input v-model="form.bankNo" type="text" clearable style="width: 100%" />
|
|
|
- </el-form-item>
|
|
|
<el-form-item :label="$t('finance.type')" prop="rechargeType">
|
|
|
<el-select v-model="form.rechargeType" clearable filterable style="width: 100%">
|
|
|
<el-option v-for="(item,key) in typeList" :key="key" :label="item" :value="item" />
|
|
|
</el-select>
|
|
|
</el-form-item>
|
|
|
- <el-form-item :label="$t('finance.bankName')" prop="openBank" required>
|
|
|
+ <el-form-item :label="$t('finance.paymentDate')" prop="payDate" required>
|
|
|
+ <el-date-picker v-model="form.payDate" type="date" value-format="yyyy-MM-dd" placeholder="YYYY-MM-DD" style="width: 100%" />
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item v-if="!isCashType" :label="$t('finance.paymentReference')" prop="bankNo" :required="!isCashType">
|
|
|
+ <el-input v-model="form.bankNo" type="text" clearable style="width: 100%" />
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item v-if="!isCashType" :label="$t('finance.bankName')" prop="openBank" :required="!isCashType">
|
|
|
<el-select v-model="form.openBank" clearable filterable style="width: 100%">
|
|
|
<el-option v-for="(item,key) in bankList" :key="key" :label="item.BANK_NAME" :value="item.BANK_CODE" />
|
|
|
</el-select>
|
|
|
</el-form-item>
|
|
|
+ <el-form-item :label="$t('finance.remark')" prop="rechargeRemark" required>
|
|
|
+ <el-input v-model="form.rechargeRemark" type="textarea" :rows="3" :placeholder="$t('finance.enterRemarkTips')" style="width: 100%" />
|
|
|
+ </el-form-item>
|
|
|
<el-form-item>
|
|
|
<el-button type="warning" size="small" @click="onCancel">{{ $t('table.cancel') }}</el-button>
|
|
|
<el-button type="primary" size="small" @click="onSubmit">{{ $t('table.confirm') }}</el-button>
|
|
|
@@ -120,12 +126,7 @@ export default {
|
|
|
dialog: {
|
|
|
handler(newValue, old){
|
|
|
if(newValue === false){
|
|
|
- this.form = {
|
|
|
- applyAmount: 1,
|
|
|
- bankNo: '',
|
|
|
- openBank: '',
|
|
|
- bankAddress: ''
|
|
|
- }
|
|
|
+ this.resetForm()
|
|
|
this.$forceUpdate()
|
|
|
}
|
|
|
}
|
|
|
@@ -136,9 +137,44 @@ export default {
|
|
|
this.imageUrl = ''
|
|
|
}
|
|
|
}
|
|
|
+ },
|
|
|
+ 'form.rechargeType': {
|
|
|
+ handler(newValue) {
|
|
|
+ if (newValue === 'Cash') {
|
|
|
+ this.form.bankNo = ''
|
|
|
+ this.form.openBank = ''
|
|
|
+ }
|
|
|
+ if (this.$refs.form) {
|
|
|
+ this.$nextTick(() => {
|
|
|
+ this.$refs.form.clearValidate(['bankNo', 'openBank'])
|
|
|
+ })
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
},
|
|
|
data() {
|
|
|
+ const validateBankNo = (rule, value, callback) => {
|
|
|
+ if (this.isCashType) {
|
|
|
+ callback()
|
|
|
+ return
|
|
|
+ }
|
|
|
+ if (!value) {
|
|
|
+ callback(new Error(this.$t('finance.paymentReference') + this.$t('common.require')))
|
|
|
+ return
|
|
|
+ }
|
|
|
+ callback()
|
|
|
+ }
|
|
|
+ const validateOpenBank = (rule, value, callback) => {
|
|
|
+ if (this.isCashType) {
|
|
|
+ callback()
|
|
|
+ return
|
|
|
+ }
|
|
|
+ if (!value) {
|
|
|
+ callback(new Error(this.$t('finance.bankName') + this.$t('common.require')))
|
|
|
+ return
|
|
|
+ }
|
|
|
+ callback()
|
|
|
+ }
|
|
|
return {
|
|
|
tool: tool,
|
|
|
list: [],
|
|
|
@@ -155,14 +191,19 @@ export default {
|
|
|
bankNo: '',
|
|
|
openBank: '',
|
|
|
bankAddress: '',
|
|
|
- rechargeType: ''
|
|
|
+ payDate: '',
|
|
|
+ rechargeRemark: '',
|
|
|
+ rechargeType: 'Cash'
|
|
|
},
|
|
|
minAmount: 1,
|
|
|
maxAmount: 10000000000,
|
|
|
rules: {
|
|
|
applyAmount: [required, integer, range(this.minAmount, this.maxAmount)],
|
|
|
- bankNo: [{ required: true, message: this.$t('finance.paymentReference') + this.$t('common.require'), trigger: 'blur' }],
|
|
|
- openBank: [{ required: true, message: this.$t('finance.bankName') + this.$t('common.require'), trigger: 'blur' }]
|
|
|
+ bankNo: [{ validator: validateBankNo, trigger: 'blur' }],
|
|
|
+ openBank: [{ validator: validateOpenBank, trigger: 'change' }],
|
|
|
+ payDate: [{ required: true, message: this.$t('finance.paymentDate') + ' ' + this.$t('common.require') }],
|
|
|
+ rechargeRemark: [{ required: true, message: this.$t('finance.enterRemarkTips'), trigger: 'blur' }],
|
|
|
+ rechargeType: [{ required: true, message: this.$t('finance.type') + this.$t('common.require'), trigger: 'change' }]
|
|
|
},
|
|
|
bankList: [],
|
|
|
typeList: [],
|
|
|
@@ -188,6 +229,11 @@ export default {
|
|
|
isEdit: false,
|
|
|
}
|
|
|
},
|
|
|
+ computed: {
|
|
|
+ isCashType() {
|
|
|
+ return this.form.rechargeType === 'Cash'
|
|
|
+ }
|
|
|
+ },
|
|
|
created() {
|
|
|
this.getList()
|
|
|
},
|
|
|
@@ -210,16 +256,32 @@ export default {
|
|
|
fetchBankList().then(response => {
|
|
|
this.bankList = response.data.allOpenBank
|
|
|
this.typeList = response.data.type
|
|
|
+ if (!this.form.rechargeType && this.typeList.includes('Cash')) {
|
|
|
+ this.form.rechargeType = 'Cash'
|
|
|
+ }
|
|
|
})
|
|
|
},
|
|
|
+ resetForm() {
|
|
|
+ this.form = {
|
|
|
+ applyAmount: 1,
|
|
|
+ bankNo: '',
|
|
|
+ openBank: '',
|
|
|
+ bankAddress: '',
|
|
|
+ payDate: '',
|
|
|
+ rechargeRemark: '',
|
|
|
+ rechargeType: 'Cash'
|
|
|
+ }
|
|
|
+ },
|
|
|
onSubmit() {
|
|
|
this.$refs['form'].validate((valid) => {
|
|
|
if (valid) {
|
|
|
this.loading = true
|
|
|
let form = {}
|
|
|
- const { applyAmount, bankNo, openBank, bankAddress, ID, rechargeType } = this.form
|
|
|
+ const { applyAmount, bankNo, openBank, bankAddress, ID, rechargeType, payDate, rechargeRemark } = this.form
|
|
|
+ const submitBankNo = this.isCashType ? '' : bankNo
|
|
|
+ const submitOpenBank = this.isCashType ? '' : openBank
|
|
|
if (this.isEdit) {
|
|
|
- form = { applyAmount, bankNo, openBank, bankAddress, id: ID, rechargeType }
|
|
|
+ form = { applyAmount, bankNo: submitBankNo, openBank: submitOpenBank, bankAddress, id: ID, rechargeType, payDate, rechargeRemark }
|
|
|
editApplyRecharge(form).then(response => {
|
|
|
this.$message({
|
|
|
message: response.data,
|
|
|
@@ -242,7 +304,7 @@ export default {
|
|
|
this.loading = false
|
|
|
})
|
|
|
} else {
|
|
|
- form = { applyAmount, bankNo, openBank, bankAddress, rechargeType }
|
|
|
+ form = { applyAmount, bankNo: submitBankNo, openBank: submitOpenBank, bankAddress, rechargeType, payDate, rechargeRemark }
|
|
|
fetchApplyRecharge(form).then(response => {
|
|
|
this.$message({
|
|
|
message: response.data,
|
|
|
@@ -293,13 +355,16 @@ export default {
|
|
|
}, 0.5 * 1000)
|
|
|
},
|
|
|
handleEdit(row){
|
|
|
- let { AMOUNT, BANK_NO, OPEN_BANK, ID, TYPE } = row
|
|
|
+ let { AMOUNT, BANK_NO, OPEN_BANK, ID, TYPE, PAY_DATE, RECHARGE_REMARK } = row
|
|
|
this.form = {
|
|
|
applyAmount: AMOUNT,
|
|
|
bankNo: BANK_NO,
|
|
|
openBank: OPEN_BANK,
|
|
|
ID: ID,
|
|
|
- rechargeType: TYPE
|
|
|
+ rechargeType: TYPE || 'Cash',
|
|
|
+ payDate: PAY_DATE || '',
|
|
|
+ rechargeRemark: RECHARGE_REMARK || '',
|
|
|
+ bankAddress: ''
|
|
|
}
|
|
|
this.isEdit = true
|
|
|
this.dialog = true
|