|
|
|
@ -10,36 +10,19 @@ |
|
|
|
|
<div class="add"> |
|
|
|
|
<el-form ref="form" :model="form" :rules="rules" label-width="140px"> |
|
|
|
|
<el-form-item label="公司" prop="companyId"> |
|
|
|
|
<autocomplete |
|
|
|
|
:params="form" |
|
|
|
|
:config="configAutocomplete" |
|
|
|
|
@change="companyChange" |
|
|
|
|
/> |
|
|
|
|
<autocomplete :params="form" :config="configAutocomplete" @change="companyChange" /> |
|
|
|
|
</el-form-item> |
|
|
|
|
<el-form-item label="交易类型" prop="transactionType"> |
|
|
|
|
<el-select |
|
|
|
|
:disabled="!!form.id" |
|
|
|
|
v-model="form.transactionType" |
|
|
|
|
placeholder="请选择交易类型" |
|
|
|
|
@change="changeTransactionType" |
|
|
|
|
> |
|
|
|
|
<el-select :disabled="!!form.id" v-model="form.transactionType" placeholder="请选择交易类型" @change="changeTransactionType"> |
|
|
|
|
<el-option label="充值" value="RECHARGE" /> |
|
|
|
|
<!-- <el-option label="赊销" value="CHARGE_SALES" /> |
|
|
|
|
<el-option label="消费返利" value="CONSUME_REBATE" /> --> |
|
|
|
|
</el-select> |
|
|
|
|
</el-form-item> |
|
|
|
|
|
|
|
|
|
<template |
|
|
|
|
v-if=" |
|
|
|
|
companyFinance.settlementModes === 1 || |
|
|
|
|
companyFinance.settlementModes === 3 |
|
|
|
|
" |
|
|
|
|
> |
|
|
|
|
<template v-if="companyFinance.settlementModes === 1 || companyFinance.settlementModes === 3"> |
|
|
|
|
<el-form-item label="充值返利比例"> |
|
|
|
|
<el-input |
|
|
|
|
disabled |
|
|
|
|
v-model="companyFinance.rechargeRebate" |
|
|
|
|
></el-input> |
|
|
|
|
<el-input disabled v-model="companyFinance.rechargeRebate"></el-input> |
|
|
|
|
</el-form-item> |
|
|
|
|
<el-form-item label="预计充值返利金额"> |
|
|
|
|
<el-input disabled v-model="rechargeRebateAmount"></el-input> |
|
|
|
@ -47,28 +30,20 @@ |
|
|
|
|
</template> |
|
|
|
|
|
|
|
|
|
<el-form-item label="交易金额" prop="transactionAmount"> |
|
|
|
|
<el-input |
|
|
|
|
v-checkNum |
|
|
|
|
v-model="form.transactionAmount" |
|
|
|
|
placeholder="请输入交易金额" |
|
|
|
|
></el-input> |
|
|
|
|
<el-input v-checkNum v-model="form.transactionAmount" placeholder="请输入交易金额"></el-input> |
|
|
|
|
</el-form-item> |
|
|
|
|
|
|
|
|
|
<template v-if="form.transactionType === 'RECHARGE'"> |
|
|
|
|
<el-form-item label="企业收款账户"> |
|
|
|
|
<el-cascader |
|
|
|
|
:options="cascaderList" |
|
|
|
|
v-model="form.companyBankCardArr" |
|
|
|
|
filterable |
|
|
|
|
clearable |
|
|
|
|
></el-cascader> |
|
|
|
|
<el-cascader :options="cascaderList" v-model="form.companyBankCardArr" filterable clearable></el-cascader> |
|
|
|
|
</el-form-item> |
|
|
|
|
|
|
|
|
|
<el-form-item label="炼厂中心账户" prop="refineryCenterAccountId"> |
|
|
|
|
<autocomplete :params="form" :config="accountNameAutocomplete" /> |
|
|
|
|
</el-form-item> |
|
|
|
|
|
|
|
|
|
<el-form-item label="线下汇款公司账户" prop="offlinePaymentCompany"> |
|
|
|
|
<el-input |
|
|
|
|
v-model="form.offlinePaymentCompany" |
|
|
|
|
placeholder="请输入线下汇款公司账户" |
|
|
|
|
></el-input> |
|
|
|
|
<el-input v-model="form.offlinePaymentCompany" placeholder="请输入线下汇款公司账户"></el-input> |
|
|
|
|
</el-form-item> |
|
|
|
|
|
|
|
|
|
<el-form-item label="线下交易发起时间" prop="offlineStartTime"> |
|
|
|
@ -96,20 +71,14 @@ |
|
|
|
|
</el-form-item> |
|
|
|
|
</template> |
|
|
|
|
|
|
|
|
|
<el-form-item |
|
|
|
|
v-if=" |
|
|
|
|
form.transactionType === 'CONSUME_REBATE' || |
|
|
|
|
form.transactionType === 'RECHARGE' |
|
|
|
|
" |
|
|
|
|
label="线下交易凭证" |
|
|
|
|
> |
|
|
|
|
<el-form-item v-if="form.transactionType === 'CONSUME_REBATE' || form.transactionType === 'RECHARGE'" label="线下交易凭证"> |
|
|
|
|
<el-upload |
|
|
|
|
:action="uploadUrl" |
|
|
|
|
:data="{ |
|
|
|
|
ossKey: 'xingyou', |
|
|
|
|
pathKey: 'other', |
|
|
|
|
encrypt: 'PUBLIC', |
|
|
|
|
code: 'A003', |
|
|
|
|
code: 'A003' |
|
|
|
|
}" |
|
|
|
|
list-type="picture-card" |
|
|
|
|
:on-preview="handlePictureCardPreview" |
|
|
|
@ -127,13 +96,7 @@ |
|
|
|
|
</el-form-item> |
|
|
|
|
|
|
|
|
|
<el-form-item label="交易说明"> |
|
|
|
|
<el-input |
|
|
|
|
type="textarea" |
|
|
|
|
:rows="2" |
|
|
|
|
placeholder="请输入交易说明" |
|
|
|
|
v-model="form.reverseRemark" |
|
|
|
|
> |
|
|
|
|
</el-input> |
|
|
|
|
<el-input type="textarea" :rows="2" placeholder="请输入交易说明" v-model="form.reverseRemark"> </el-input> |
|
|
|
|
</el-form-item> |
|
|
|
|
</el-form> |
|
|
|
|
</div> |
|
|
|
@ -145,41 +108,42 @@ |
|
|
|
|
</template> |
|
|
|
|
|
|
|
|
|
<script> |
|
|
|
|
import serve from "api/financialCenter/enterpriseRecharge.js"; |
|
|
|
|
import commonServe from "api/common.js"; |
|
|
|
|
import serve from 'api/financialCenter/enterpriseRecharge.js' |
|
|
|
|
import commonServe from 'api/common.js' |
|
|
|
|
|
|
|
|
|
import autocomplete from "components/autocomplete/index.vue"; |
|
|
|
|
import autocomplete from 'components/autocomplete/index.vue' |
|
|
|
|
|
|
|
|
|
import utils from "utils/encode"; |
|
|
|
|
const JSESSIONID = utils.uuid(); |
|
|
|
|
import utils from 'utils/encode' |
|
|
|
|
const JSESSIONID = utils.uuid() |
|
|
|
|
|
|
|
|
|
export default { |
|
|
|
|
components: { |
|
|
|
|
autocomplete, |
|
|
|
|
autocomplete |
|
|
|
|
}, |
|
|
|
|
props: { |
|
|
|
|
controlWindows: Object, |
|
|
|
|
controlWindows: Object |
|
|
|
|
}, |
|
|
|
|
data() { |
|
|
|
|
let validatorcompanyId = (rule, value, callback) => { |
|
|
|
|
if (this.form.companyId) callback(); |
|
|
|
|
else callback("请选择公司"); |
|
|
|
|
}; |
|
|
|
|
if (this.form.companyId) callback() |
|
|
|
|
else callback('请选择公司') |
|
|
|
|
} |
|
|
|
|
let validatorRefineryCenterAccountId = (rule, value, callback) => { |
|
|
|
|
if (this.form.refineryCenterAccountId) callback() |
|
|
|
|
else callback('请选择炼厂中心账户') |
|
|
|
|
} |
|
|
|
|
// let validatorofflineTransactionProof = (rule, value, callback) => { |
|
|
|
|
// if (this.form.offlineTransactionProof) callback(); |
|
|
|
|
// else callback("请上传凭证"); |
|
|
|
|
// }; |
|
|
|
|
return { |
|
|
|
|
uploadUrl: |
|
|
|
|
process.env.VUE_APP_ENV === "development" |
|
|
|
|
? "/api/oil-oss/obejct/uploadFile" |
|
|
|
|
: "/adminapi/oil-oss/obejct/uploadFile", |
|
|
|
|
uploadUrl: process.env.VUE_APP_ENV === 'development' ? '/api/oil-oss/obejct/uploadFile' : '/adminapi/oil-oss/obejct/uploadFile', |
|
|
|
|
imgDialog: false, |
|
|
|
|
headers: { |
|
|
|
|
dataSources: "WEB", |
|
|
|
|
Authorization: localStorage.getItem("businessToken"), |
|
|
|
|
dataSources: 'WEB', |
|
|
|
|
Authorization: localStorage.getItem('businessToken'), |
|
|
|
|
JSESSIONID: JSESSIONID, |
|
|
|
|
token: utils.bcrypt(JSESSIONID), |
|
|
|
|
token: utils.bcrypt(JSESSIONID) |
|
|
|
|
}, |
|
|
|
|
fileList: [], |
|
|
|
|
cascaderList: [], |
|
|
|
@ -187,179 +151,183 @@ export default { |
|
|
|
|
form: {}, |
|
|
|
|
configAutocomplete: { |
|
|
|
|
serveTarget: commonServe.getRefineryCompanyList, |
|
|
|
|
autocompleteKey: "name", |
|
|
|
|
labelKey: "name", |
|
|
|
|
valueKey: "id", |
|
|
|
|
placeholder: "企业名称", |
|
|
|
|
querykey: "companyId", |
|
|
|
|
echoId: "", |
|
|
|
|
echoName: "", |
|
|
|
|
isDisabled: false, |
|
|
|
|
autocompleteKey: 'name', |
|
|
|
|
labelKey: 'name', |
|
|
|
|
valueKey: 'id', |
|
|
|
|
placeholder: '企业名称', |
|
|
|
|
querykey: 'companyId', |
|
|
|
|
echoId: '', |
|
|
|
|
echoName: '', |
|
|
|
|
isDisabled: false |
|
|
|
|
}, |
|
|
|
|
accountNameAutocomplete: { |
|
|
|
|
serveTarget: commonServe.findByEntity, |
|
|
|
|
autocompleteKey: 'accountName', |
|
|
|
|
labelKey: 'accountName', |
|
|
|
|
valueKey: 'id', |
|
|
|
|
placeholder: '炼厂中心账户', |
|
|
|
|
querykey: 'refineryCenterAccountId', |
|
|
|
|
echoId: '', |
|
|
|
|
echoName: '', |
|
|
|
|
isDisabled: false |
|
|
|
|
}, |
|
|
|
|
rules: { |
|
|
|
|
companyId: [ |
|
|
|
|
{ required: true, validator: validatorcompanyId, trigger: "change" }, |
|
|
|
|
], |
|
|
|
|
transactionType: [ |
|
|
|
|
{ required: true, message: "请选择交易类型", trigger: "change" }, |
|
|
|
|
], |
|
|
|
|
transactionAmount: [ |
|
|
|
|
{ required: true, message: "请输入交易金额", trigger: "blur" }, |
|
|
|
|
], |
|
|
|
|
companyId: [{ required: true, validator: validatorcompanyId, trigger: 'change' }], |
|
|
|
|
transactionType: [{ required: true, message: '请选择交易类型', trigger: 'change' }], |
|
|
|
|
transactionAmount: [{ required: true, message: '请输入交易金额', trigger: 'blur' }], |
|
|
|
|
offlinePaymentCompany: [ |
|
|
|
|
{ |
|
|
|
|
required: true, |
|
|
|
|
message: "请输入线下汇款公司账户", |
|
|
|
|
trigger: "blur", |
|
|
|
|
}, |
|
|
|
|
message: '请输入线下汇款公司账户', |
|
|
|
|
trigger: 'blur' |
|
|
|
|
} |
|
|
|
|
], |
|
|
|
|
offlineStartTime: [ |
|
|
|
|
{ |
|
|
|
|
required: true, |
|
|
|
|
message: "请选择线下交易发起时间", |
|
|
|
|
trigger: "change", |
|
|
|
|
}, |
|
|
|
|
message: '请选择线下交易发起时间', |
|
|
|
|
trigger: 'change' |
|
|
|
|
} |
|
|
|
|
], |
|
|
|
|
offlineCompleteTime: [ |
|
|
|
|
{ |
|
|
|
|
required: true, |
|
|
|
|
message: "请选择线下交易完成时间", |
|
|
|
|
trigger: "change", |
|
|
|
|
}, |
|
|
|
|
message: '请选择线下交易完成时间', |
|
|
|
|
trigger: 'change' |
|
|
|
|
} |
|
|
|
|
], |
|
|
|
|
offlineCompleteTime: [ |
|
|
|
|
{ |
|
|
|
|
required: true, |
|
|
|
|
message: "请选择企业收款账户", |
|
|
|
|
trigger: "change", |
|
|
|
|
}, |
|
|
|
|
message: '请选择企业收款账户', |
|
|
|
|
trigger: 'change' |
|
|
|
|
} |
|
|
|
|
], |
|
|
|
|
}, |
|
|
|
|
}; |
|
|
|
|
refineryCenterAccountId: [{ required: true, validator: validatorRefineryCenterAccountId, trigger: 'change' }] |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
}, |
|
|
|
|
computed: { |
|
|
|
|
rechargeRebateAmount() { |
|
|
|
|
if ( |
|
|
|
|
this.companyFinance.settlementModes === 1 || |
|
|
|
|
this.companyFinance.settlementModes === 3 |
|
|
|
|
) { |
|
|
|
|
return ( |
|
|
|
|
(this.form.transactionAmount || 0) * |
|
|
|
|
this.companyFinance.rechargeRebate |
|
|
|
|
); |
|
|
|
|
} else return this.companyFinance.rechargeRebateAmount; |
|
|
|
|
}, |
|
|
|
|
if (this.companyFinance.settlementModes === 1 || this.companyFinance.settlementModes === 3) { |
|
|
|
|
return (this.form.transactionAmount || 0) * this.companyFinance.rechargeRebate |
|
|
|
|
} else return this.companyFinance.rechargeRebateAmount |
|
|
|
|
} |
|
|
|
|
}, |
|
|
|
|
created() { |
|
|
|
|
this.getCascaderList(); |
|
|
|
|
this.getCascaderList() |
|
|
|
|
}, |
|
|
|
|
methods: { |
|
|
|
|
openDrawer() { |
|
|
|
|
let { id } = this.controlWindows.addInfo; |
|
|
|
|
let { id, companyName, refineryCenterAccountId, refineryCenterAccountName } = this.controlWindows.addInfo |
|
|
|
|
//回显 |
|
|
|
|
if (id) { |
|
|
|
|
this.form = JSON.parse(JSON.stringify(this.controlWindows.addInfo)); |
|
|
|
|
this.form["companyBankCardArr"] = [ |
|
|
|
|
+this.form.internalCompanyId, |
|
|
|
|
this.form.companyBankCardId, |
|
|
|
|
]; |
|
|
|
|
this.form = JSON.parse(JSON.stringify(this.controlWindows.addInfo)) |
|
|
|
|
this.form['companyBankCardArr'] = [+this.form.internalCompanyId, this.form.companyBankCardId] |
|
|
|
|
if (this.form.offlineTransactionProof) { |
|
|
|
|
this.fileList.push({ |
|
|
|
|
url: this.form.offlineTransactionProof, |
|
|
|
|
}); |
|
|
|
|
url: this.form.offlineTransactionProof |
|
|
|
|
}) |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
let configUpdata = { |
|
|
|
|
echoId: id || '', |
|
|
|
|
echoName: companyName || '', |
|
|
|
|
isDisabled: !!id |
|
|
|
|
} |
|
|
|
|
let configUpdata2 = { |
|
|
|
|
echoId: refineryCenterAccountId || '', |
|
|
|
|
echoName: refineryCenterAccountName || '', |
|
|
|
|
isDisabled: !!id |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
let configUpdata = { |
|
|
|
|
echoId: id || "", |
|
|
|
|
echoName: this.form.refineryName || "", |
|
|
|
|
isDisabled: !!id, |
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
Object.assign(this.configAutocomplete, configUpdata); |
|
|
|
|
Object.assign(this.configAutocomplete, configUpdata) |
|
|
|
|
Object.assign(this.accountNameAutocomplete, configUpdata2) |
|
|
|
|
} |
|
|
|
|
}, |
|
|
|
|
// 公司change |
|
|
|
|
companyChange(id) { |
|
|
|
|
if (id) { |
|
|
|
|
serve.getByCompanyId(id).then((res) => { |
|
|
|
|
this.companyFinance = res.data; |
|
|
|
|
}); |
|
|
|
|
serve.getByCompanyId(id).then(res => { |
|
|
|
|
this.companyFinance = res.data |
|
|
|
|
}) |
|
|
|
|
} |
|
|
|
|
}, |
|
|
|
|
// 交易类型 change |
|
|
|
|
changeTransactionType(val) { |
|
|
|
|
if (val === "CHARGE_SALES") { |
|
|
|
|
this.handleRemove(); |
|
|
|
|
if (val === 'CHARGE_SALES') { |
|
|
|
|
this.handleRemove() |
|
|
|
|
} |
|
|
|
|
}, |
|
|
|
|
beforeHandle(file) { |
|
|
|
|
if (file.type.indexOf("image/") === -1) { |
|
|
|
|
this.$message.error("上传的文件不是图片格式!"); |
|
|
|
|
return false; |
|
|
|
|
if (file.type.indexOf('image/') === -1) { |
|
|
|
|
this.$message.error('上传的文件不是图片格式!') |
|
|
|
|
return false |
|
|
|
|
} else if (file.size / 1024 / 1024 > 5) { |
|
|
|
|
this.$message.error("上传图片大小不能超过 5MB!"); |
|
|
|
|
return false; |
|
|
|
|
this.$message.error('上传图片大小不能超过 5MB!') |
|
|
|
|
return false |
|
|
|
|
} |
|
|
|
|
return true; |
|
|
|
|
return true |
|
|
|
|
}, |
|
|
|
|
|
|
|
|
|
//img大图 |
|
|
|
|
handlePictureCardPreview(file) { |
|
|
|
|
this.form.offlineTransactionProof = file.url; |
|
|
|
|
this.imgDialog = true; |
|
|
|
|
this.form.offlineTransactionProof = file.url |
|
|
|
|
this.imgDialog = true |
|
|
|
|
}, |
|
|
|
|
// img remove |
|
|
|
|
handleRemove(file, fileList) { |
|
|
|
|
this.form.offlineTransactionProof = ""; |
|
|
|
|
this.form.offlineTransactionProof = '' |
|
|
|
|
}, |
|
|
|
|
// 上传成功 |
|
|
|
|
handleSuccess(response, file, fileList) { |
|
|
|
|
if (response.code !== 20000) { |
|
|
|
|
this.$message.error(response.msg); |
|
|
|
|
this.fileList = []; |
|
|
|
|
return; |
|
|
|
|
this.$message.error(response.msg) |
|
|
|
|
this.fileList = [] |
|
|
|
|
return |
|
|
|
|
} |
|
|
|
|
console.log("response", response); |
|
|
|
|
this.form.offlineTransactionProof = response.data.publicUrl; |
|
|
|
|
console.log('response', response) |
|
|
|
|
this.form.offlineTransactionProof = response.data.publicUrl |
|
|
|
|
}, |
|
|
|
|
//企业收款账户 |
|
|
|
|
getCascaderList() { |
|
|
|
|
serve.getCascaderList().then((res) => { |
|
|
|
|
this.cascaderList = res.data; |
|
|
|
|
}); |
|
|
|
|
serve.getCascaderList().then(res => { |
|
|
|
|
this.cascaderList = res.data |
|
|
|
|
}) |
|
|
|
|
}, |
|
|
|
|
submit() { |
|
|
|
|
this.$refs["form"].validate((valid) => { |
|
|
|
|
this.$refs['form'].validate(valid => { |
|
|
|
|
if (valid) { |
|
|
|
|
let params = { transactionType: "RECHARGE", ...this.form }; |
|
|
|
|
let params = { transactionType: 'RECHARGE', ...this.form } |
|
|
|
|
if (this.form.companyBankCardArr.length) { |
|
|
|
|
let index = this.form.companyBankCardArr.length - 1; |
|
|
|
|
params["companyBankCardId"] = this.form.companyBankCardArr[index]; |
|
|
|
|
let index = this.form.companyBankCardArr.length - 1 |
|
|
|
|
params['companyBankCardId'] = this.form.companyBankCardArr[index] |
|
|
|
|
} |
|
|
|
|
this.judgeInterface(params).then((res) => { |
|
|
|
|
this.$message.success(res.msg); |
|
|
|
|
this.closeWindow(); |
|
|
|
|
}); |
|
|
|
|
this.judgeInterface(params).then(res => { |
|
|
|
|
this.$message.success(res.msg) |
|
|
|
|
this.closeWindow() |
|
|
|
|
}) |
|
|
|
|
} |
|
|
|
|
}); |
|
|
|
|
}) |
|
|
|
|
}, |
|
|
|
|
judgeInterface(form) { |
|
|
|
|
let { id } = this.controlWindows.addInfo; |
|
|
|
|
if (id) return serve.update(form); |
|
|
|
|
else return serve.save(form); |
|
|
|
|
let { id } = this.controlWindows.addInfo |
|
|
|
|
if (id) return serve.update(form) |
|
|
|
|
else return serve.save(form) |
|
|
|
|
}, |
|
|
|
|
closeWindow() { |
|
|
|
|
this.$emit("closeWindow"); |
|
|
|
|
this.form = {}; |
|
|
|
|
this.companyFinance = {}; |
|
|
|
|
this.fileList = []; |
|
|
|
|
this.controlWindows.addInfo = {}; |
|
|
|
|
this.$emit('closeWindow') |
|
|
|
|
this.form = {} |
|
|
|
|
this.companyFinance = {} |
|
|
|
|
this.fileList = [] |
|
|
|
|
this.controlWindows.addInfo = {} |
|
|
|
|
this.$nextTick(() => { |
|
|
|
|
this.$refs.form.clearValidate(); |
|
|
|
|
this.controlWindows.add = false; |
|
|
|
|
}); |
|
|
|
|
}, |
|
|
|
|
}, |
|
|
|
|
}; |
|
|
|
|
this.$refs.form.clearValidate() |
|
|
|
|
this.controlWindows.add = false |
|
|
|
|
}) |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
</script> |
|
|
|
|
|
|
|
|
|
<style lang="scss" scoped> |
|
|
|
|