更新
This commit is contained in:
@@ -1,42 +1,33 @@
|
||||
import request from "utils/axios.js";
|
||||
import request from 'utils/axios.js'
|
||||
// table
|
||||
const getByPage = (params) => {
|
||||
return request.postJson(
|
||||
"/oil-finance/oilCompanyAccountReverse/getByPage",
|
||||
params
|
||||
);
|
||||
};
|
||||
const getByPage = params => {
|
||||
return request.postJson('/oil-finance/oilCompanyAccountReverse/getByPage', params)
|
||||
}
|
||||
//详情
|
||||
const get = (query) => {
|
||||
return request.get(`/oil-finance/oilCompanyAccountReverse/get/${query}`);
|
||||
};
|
||||
const get = query => {
|
||||
return request.get(`/oil-finance/oilCompanyAccountReverse/get/${query}`)
|
||||
}
|
||||
|
||||
//公司财务详情
|
||||
const getByCompanyId = (query) => {
|
||||
return request.get(`/oil-user/oilCompanyFinance/getByCompanyId/${query}`);
|
||||
};
|
||||
const getByCompanyId = query => {
|
||||
return request.get(`/oil-user/oilCompanyFinance/getByCompanyId/${query}`)
|
||||
}
|
||||
// 新增
|
||||
const save = (params) => {
|
||||
return request.postJson("/oil-finance/oilCompanyAccountReverse/save", params);
|
||||
};
|
||||
const save = params => {
|
||||
return request.postJson('/oil-finance/oilCompanyAccountReverse/refineryCustomerRecharge', params)
|
||||
}
|
||||
// 修改
|
||||
const update = (params) => {
|
||||
return request.postPut(
|
||||
"/oil-finance/oilCompanyAccountReverse/update",
|
||||
params
|
||||
);
|
||||
};
|
||||
const update = params => {
|
||||
return request.postPut('/oil-finance/oilCompanyAccountReverse/update', params)
|
||||
}
|
||||
// 级联
|
||||
const getCascaderList = () => {
|
||||
return request.get("/oil-finance/internalCompany/getCascaderList");
|
||||
};
|
||||
return request.get('/oil-finance/internalCompany/getCascaderList')
|
||||
}
|
||||
// 审核
|
||||
const audit = (params) => {
|
||||
return request.postJson(
|
||||
"/oil-finance/oilCompanyAccountReverse/refinery/audit",
|
||||
params
|
||||
);
|
||||
};
|
||||
const audit = params => {
|
||||
return request.postJson('/oil-finance/oilCompanyAccountReverse/refinery/audit', params)
|
||||
}
|
||||
|
||||
//公司 远程搜索
|
||||
// const getLikeByNameSuccess = (params) => {
|
||||
@@ -53,6 +44,6 @@ export default {
|
||||
save,
|
||||
update,
|
||||
getCascaderList,
|
||||
audit,
|
||||
audit
|
||||
// getLikeByNameSuccess,
|
||||
};
|
||||
}
|
||||
|
||||
@@ -34,9 +34,10 @@ export default {
|
||||
// config: {
|
||||
// serveTarget: {}, // 远程搜索接口
|
||||
// autocompleteKey: "", //远程搜索接口参数名
|
||||
// labelKey: "", //接口返回数据label名
|
||||
// labelKey: [] || '', //接口返回数据label
|
||||
// valueKey: "", //接口返回数据id
|
||||
// querykey: "", //查询接口参数名
|
||||
// echoId:'', //
|
||||
// },
|
||||
},
|
||||
data() {
|
||||
@@ -50,6 +51,7 @@ export default {
|
||||
watch: {
|
||||
'config.echoId': {
|
||||
handler(nval, oval) {
|
||||
console.log('nvalnvalnvalnvalnval', nval)
|
||||
this.list = []
|
||||
let type = this.$utils.typeJudgment(this.config.echoName)
|
||||
if (nval && ['String'].includes(type)) {
|
||||
@@ -97,6 +99,7 @@ export default {
|
||||
},
|
||||
// 远程搜索
|
||||
remoteMethod(query) {
|
||||
console.log('query', query)
|
||||
if (query !== '') {
|
||||
this.loading = true
|
||||
let type = this.$utils.typeJudgment(this.config.autocompleteKey)
|
||||
|
||||
@@ -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: this.form.refineryName || "",
|
||||
isDisabled: !!id,
|
||||
};
|
||||
|
||||
Object.assign(this.configAutocomplete, configUpdata);
|
||||
let configUpdata = {
|
||||
echoId: id || '',
|
||||
echoName: companyName || '',
|
||||
isDisabled: !!id
|
||||
}
|
||||
let configUpdata2 = {
|
||||
echoId: refineryCenterAccountId || '',
|
||||
echoName: refineryCenterAccountName || '',
|
||||
isDisabled: !!id
|
||||
}
|
||||
|
||||
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>
|
||||
|
||||
@@ -10,24 +10,11 @@
|
||||
<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="turnType">
|
||||
<el-select
|
||||
:disabled="!!form.id"
|
||||
v-model="form.turnType"
|
||||
placeholder="请选择交易类型"
|
||||
>
|
||||
<el-option
|
||||
v-for="(item, index) in correspondTypeEnum"
|
||||
:key="index"
|
||||
:label="item.label"
|
||||
:value="item.value"
|
||||
/>
|
||||
<el-select :disabled="!!form.id" v-model="form.turnType" placeholder="请选择交易类型">
|
||||
<el-option v-for="(item, index) in correspondTypeEnum" :key="index" :label="item.label" :value="item.value" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
|
||||
@@ -43,17 +30,9 @@
|
||||
<el-descriptions-item>
|
||||
<template slot="label">
|
||||
<i class="el-icon-bank-card"></i>
|
||||
{{
|
||||
correspondTypeEnum.find((item) => item.value == form.turnType)
|
||||
.label
|
||||
}}
|
||||
{{ correspondTypeEnum.find(item => item.value == form.turnType).label }}
|
||||
</template>
|
||||
{{
|
||||
companyInfo[
|
||||
correspondTypeEnum.find((item) => item.value == form.turnType)
|
||||
.valueKey
|
||||
]
|
||||
}}
|
||||
{{ companyInfo[correspondTypeEnum.find(item => item.value == form.turnType).valueKey] }}
|
||||
</el-descriptions-item>
|
||||
<!-- <el-descriptions-item label="赊销余额"></el-descriptions-item>
|
||||
<el-descriptions-item label="充值返利余额"></el-descriptions-item>
|
||||
@@ -61,23 +40,16 @@
|
||||
</el-descriptions>
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item label="炼厂中心账户" prop="refineryCenterAccountId">
|
||||
<autocomplete :params="form" :config="accountNameAutocomplete" />
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item label="圈回金额" prop="transactionAmount">
|
||||
<el-input
|
||||
v-checkNum
|
||||
placeholder="圈回金额"
|
||||
v-model="form.transactionAmount"
|
||||
>
|
||||
</el-input>
|
||||
<el-input v-checkNum placeholder="圈回金额" v-model="form.transactionAmount"> </el-input>
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item label="圈回原因" prop="reverseRemark">
|
||||
<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>
|
||||
@@ -89,17 +61,17 @@
|
||||
</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'
|
||||
|
||||
export default {
|
||||
components: {
|
||||
autocomplete,
|
||||
autocomplete
|
||||
},
|
||||
props: {
|
||||
controlWindows: Object,
|
||||
controlWindows: Object
|
||||
},
|
||||
data() {
|
||||
// let validatorcompanyId = (rule, value, callback) => {
|
||||
@@ -107,55 +79,65 @@ export default {
|
||||
// else callback("请选择公司");
|
||||
// };
|
||||
let validatortransactionAmount = (rule, value, callback) => {
|
||||
let typeTarget = this.correspondTypeEnum.find(
|
||||
(item) => item.value == this.form.turnType
|
||||
);
|
||||
let superiorLimit = this.companyInfo[typeTarget.valueKey];
|
||||
if (value == "") callback("请输入圈回金额");
|
||||
let typeTarget = this.correspondTypeEnum.find(item => item.value == this.form.turnType)
|
||||
let superiorLimit = this.companyInfo[typeTarget.valueKey]
|
||||
if (value == '') callback('请输入圈回金额')
|
||||
if (value > superiorLimit) {
|
||||
callback(`圈回金额不可超过${typeTarget.label}`);
|
||||
callback(`圈回金额不可超过${typeTarget.label}`)
|
||||
}
|
||||
callback();
|
||||
};
|
||||
callback()
|
||||
}
|
||||
let validatorRefineryCenterAccountId = (rule, value, callback) => {
|
||||
if (this.form.refineryCenterAccountId) callback()
|
||||
else callback('请选择炼厂中心账户')
|
||||
}
|
||||
return {
|
||||
companyFinance: {},
|
||||
companyInfo: {},
|
||||
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" },
|
||||
// ],
|
||||
turnType: [
|
||||
{ required: true, message: "请选择交易类型", trigger: "change" },
|
||||
],
|
||||
turnType: [{ required: true, message: '请选择交易类型', trigger: 'change' }],
|
||||
transactionAmount: [
|
||||
{
|
||||
required: true,
|
||||
validator: validatortransactionAmount,
|
||||
trigger: "change",
|
||||
},
|
||||
],
|
||||
reverseRemark: [
|
||||
{ required: true, message: "请输入圈回说明", trigger: "blur" },
|
||||
trigger: 'blur'
|
||||
}
|
||||
],
|
||||
reverseRemark: [{ required: true, message: '请输入圈回说明', trigger: 'blur' }],
|
||||
refineryCenterAccountId: [{ required: true, validator: validatorRefineryCenterAccountId, trigger: 'change' }]
|
||||
},
|
||||
correspondTypeEnum: [
|
||||
{
|
||||
value: 1,
|
||||
label: "充值余额",
|
||||
valueKey: "rechargeBalance",
|
||||
},
|
||||
label: '充值余额',
|
||||
valueKey: 'rechargeBalance'
|
||||
}
|
||||
// {
|
||||
// value: 2,
|
||||
// label: "赊销余额",
|
||||
@@ -171,77 +153,85 @@ export default {
|
||||
// label: "消费返利余额",
|
||||
// valueKey: "consumeRebateBalance",
|
||||
// },
|
||||
],
|
||||
};
|
||||
]
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
correspondingEnum() {},
|
||||
correspondingEnum() {}
|
||||
},
|
||||
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.transactionAmount = Math.abs(this.form.transactionAmount);
|
||||
this.companyChange(this.form.companyId);
|
||||
this.form = JSON.parse(JSON.stringify(this.controlWindows.addInfo))
|
||||
this.form.transactionAmount = Math.abs(this.form.transactionAmount)
|
||||
this.companyChange(this.form.companyId)
|
||||
|
||||
let configUpdata = {
|
||||
echoId: id || '',
|
||||
echoName: companyName || '',
|
||||
isDisabled: !!id
|
||||
}
|
||||
// ? { echoId: id || '', echoName: this.form.refineryName || '', isDisabled: !!id }
|
||||
// : {
|
||||
// echoId: "",
|
||||
// echoName: "",
|
||||
// isDisabled: false,
|
||||
// };
|
||||
let configUpdata2 = {
|
||||
echoId: refineryCenterAccountId || '',
|
||||
echoName: refineryCenterAccountName || '',
|
||||
isDisabled: !!refineryCenterAccountId
|
||||
}
|
||||
Object.assign(this.configAutocomplete, configUpdata)
|
||||
Object.assign(this.accountNameAutocomplete, configUpdata2)
|
||||
console.log('this.accountNameAutocomplete', this.accountNameAutocomplete)
|
||||
}
|
||||
let configUpdata = {
|
||||
echoId: id || "",
|
||||
echoName: this.form.refineryName || "",
|
||||
isDisabled: !!id,
|
||||
};
|
||||
// ? { echoId: id || '', echoName: this.form.refineryName || '', isDisabled: !!id }
|
||||
// : {
|
||||
// echoId: "",
|
||||
// echoName: "",
|
||||
// isDisabled: false,
|
||||
// };
|
||||
Object.assign(this.configAutocomplete, configUpdata);
|
||||
},
|
||||
// 公司财务信息
|
||||
companyChange(id) {
|
||||
if (id) {
|
||||
serve.getByCompanyId(id).then((res) => {
|
||||
this.companyFinance = res.data;
|
||||
this.getByCompanyId(res.data.companyId);
|
||||
});
|
||||
serve.getByCompanyId(id).then(res => {
|
||||
this.companyFinance = res.data
|
||||
this.getByCompanyId(res.data.companyId)
|
||||
})
|
||||
}
|
||||
},
|
||||
//
|
||||
getByCompanyId(id) {
|
||||
commonServe.getByCompanyIdAccount(id).then((res) => {
|
||||
this.companyInfo = res.data;
|
||||
});
|
||||
commonServe.getByCompanyIdAccount(id).then(res => {
|
||||
this.companyInfo = res.data
|
||||
})
|
||||
},
|
||||
|
||||
submit() {
|
||||
this.$refs["form"].validate((valid) => {
|
||||
this.$refs['form'].validate(valid => {
|
||||
if (valid) {
|
||||
let params = { transactionType: "TURN", ...this.form };
|
||||
this.judgeInterface(params).then((res) => {
|
||||
this.$message.success(res.msg);
|
||||
this.closeWindow();
|
||||
});
|
||||
let params = { transactionType: 'TURN', ...this.form }
|
||||
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.controlWindows.addInfo = {};
|
||||
this.$emit('closeWindow')
|
||||
this.form = {}
|
||||
this.controlWindows.addInfo = {}
|
||||
this.$nextTick(() => {
|
||||
this.$refs.form.clearValidate();
|
||||
this.controlWindows.addTurn = false;
|
||||
});
|
||||
},
|
||||
},
|
||||
};
|
||||
this.$refs.form.clearValidate()
|
||||
this.controlWindows.addTurn = false
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
|
||||
Reference in New Issue
Block a user