|
@@ -10,15 +10,6 @@
|
|
|
>
|
|
|
|
|
|
<cy-info-title style="margin: 0px -15px 10px;"> 基础信息 </cy-info-title>
|
|
|
- <el-form-item label="进口商名称" prop="entityName">
|
|
|
- <el-input v-model="ruleForm.entityName" placeholder="请输入" :disabled="disabled" />
|
|
|
- </el-form-item>
|
|
|
- <el-form-item label="注册号" prop="certNo">
|
|
|
- <el-input v-model="ruleForm.certNo" placeholder="请输入" :disabled="disabled" />
|
|
|
- </el-form-item>
|
|
|
- <el-form-item label="税号(VAT Number)" prop="vatNo">
|
|
|
- <el-input v-model="ruleForm.vatNo" placeholder="请输入" :disabled="disabled" />
|
|
|
- </el-form-item>
|
|
|
<el-form-item label="所属区域" prop="region">
|
|
|
<el-select v-model="ruleForm.region" placeholder="请选择" :disabled="disabled">
|
|
|
<el-option
|
|
@@ -44,6 +35,15 @@
|
|
|
/>
|
|
|
</el-select>
|
|
|
</el-form-item>
|
|
|
+ <el-form-item label="进口商名称" prop="entityName">
|
|
|
+ <el-input v-model="ruleForm.entityName" placeholder="请输入" :disabled="disabled" />
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item label="注册号" prop="certNo">
|
|
|
+ <el-input v-model="ruleForm.certNo" placeholder="请输入" :disabled="disabled" />
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item label="税号(VAT Number)" prop="vatNo">
|
|
|
+ <el-input v-model="ruleForm.vatNo" placeholder="请输入" :disabled="disabled" />
|
|
|
+ </el-form-item>
|
|
|
<el-form-item label="经营地址(省 / 州 / 区)" prop="businessProvince">
|
|
|
<el-input v-model="ruleForm.businessProvince" placeholder="请输入" :disabled="disabled" />
|
|
|
</el-form-item>
|
|
@@ -75,6 +75,75 @@
|
|
|
<el-form-item label="企业联系人邮箱" prop="contactEmail">
|
|
|
<el-input v-model="ruleForm.contactEmail" placeholder="请输入有效的邮箱地址" :disabled="disabled" />
|
|
|
</el-form-item>
|
|
|
+
|
|
|
+ <cy-info-title style="margin: 0px -15px 10px;"> 核额信息 </cy-info-title>
|
|
|
+ <el-form-item label="交易品类" prop="businessCategory1">
|
|
|
+ <el-select v-model="ruleForm.businessCategory1" placeholder="请选择" multiple :disabled="disabled">
|
|
|
+ <el-option
|
|
|
+ v-for="item in constant.business_category"
|
|
|
+ :key="item.dictCode"
|
|
|
+ :label="item.dictLabel"
|
|
|
+ :value="item.dictValue"
|
|
|
+ />
|
|
|
+ </el-select>
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item label="交易年限" prop="tradeTime">
|
|
|
+ <div class="select-input-item">
|
|
|
+ <el-input v-model="ruleForm.tradingLife1" placeholder="请输入交易年限" :disabled="disabled" @change="setParams($event, 'tradeTime', 'tradeTimeUnit')" />
|
|
|
+ <el-select v-model="ruleForm.tradeTimeUnit" placeholder="请选择" :disabled="disabled" style="width: 150px;" @change="setParams($event, 'tradeTime', 'tradingLife1')">
|
|
|
+ <el-option
|
|
|
+ v-for="item in [{value: 'M', name: 'Month(s)'}, {value: 'Y', name: 'Year(s)'}]"
|
|
|
+ :key="item.value"
|
|
|
+ :label="item.name"
|
|
|
+ :value="item.value"
|
|
|
+ />
|
|
|
+ </el-select>
|
|
|
+ </div>
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item label="结算账期" prop="settlementPeriod">
|
|
|
+ <el-input v-model="ruleForm.settlementPeriod" placeholder="请输入有效的邮箱地址" :disabled="disabled">
|
|
|
+ <template slot="suffix">Days</template>
|
|
|
+ </el-input>
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item label="过去1年双方交易额" prop="tradeForOneYear">
|
|
|
+ <div class="select-input-item">
|
|
|
+ <el-select v-model="ruleForm.tradingAmountPastYearCurrency" placeholder="请选择" :disabled="disabled" style="width: 150px;" @change="setParams($event, 'tradeForOneYear', 'tradingAmountPastYear')">
|
|
|
+ <el-option
|
|
|
+ v-for="item in constant.currency_code"
|
|
|
+ :key="item.dictCode"
|
|
|
+ :label="item.dictLabel"
|
|
|
+ :value="item.dictValue"
|
|
|
+ />
|
|
|
+ </el-select>
|
|
|
+ <el-input v-model="ruleForm.tradingAmountPastYear" placeholder="请输入交易年限" :disabled="disabled" @change="setParams($event, 'tradeForOneYear', 'tradingAmountPastYearCurrency')" />
|
|
|
+ </div>
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item label="拟申请额度金额" prop="applyMoney">
|
|
|
+ <div class="select-input-item">
|
|
|
+ <el-select v-model="ruleForm.amountToBeAppliedCurrency" placeholder="请选择" :disabled="disabled" style="width: 150px;" @change="setParams($event, 'applyMoney', 'amountToBeApplied')">
|
|
|
+ <el-option
|
|
|
+ v-for="item in constant.currency_code"
|
|
|
+ :key="item.dictCode"
|
|
|
+ :label="item.dictLabel"
|
|
|
+ :value="item.dictValue"
|
|
|
+ />
|
|
|
+ </el-select>
|
|
|
+ <el-input v-model="ruleForm.amountToBeApplied" placeholder="请输入拟申请额度金额" :disabled="disabled" @change="setParams($event, 'applyMoney', 'amountToBeAppliedCurrency')" />
|
|
|
+ </div>
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item label="拟申请额度期限" prop="applyTime">
|
|
|
+ <div class="select-input-item">
|
|
|
+ <el-input v-model="ruleForm.periodToBeApplied1" placeholder="请输入拟申请额度期限" :disabled="disabled" @change="setParams($event, 'applyTime', 'applyTimeUnit')" />
|
|
|
+ <el-select v-model="ruleForm.applyTimeUnit" placeholder="请选择" :disabled="disabled" style="width: 150px;" @change="setParams($event, 'applyTime', 'periodToBeApplied1')">
|
|
|
+ <el-option
|
|
|
+ v-for="item in [{value: 'M', name: 'Month(s)'}, {value: 'Y', name: 'Year(s)'}]"
|
|
|
+ :key="item.value"
|
|
|
+ :label="item.name"
|
|
|
+ :value="item.value"
|
|
|
+ />
|
|
|
+ </el-select>
|
|
|
+ </div>
|
|
|
+ </el-form-item>
|
|
|
</el-form>
|
|
|
|
|
|
<div class="submit-btn">
|
|
@@ -88,7 +157,7 @@
|
|
|
<script>
|
|
|
import { mapGetters } from 'vuex'
|
|
|
import store from '@/store'
|
|
|
-import { getImporterDetails, addImporter } from '@/api/businessManage/tradeRelations'
|
|
|
+import { getImporterDetails, addImporter, updateImporter } from '@/api/businessManage/tradeRelations'
|
|
|
import { validMail } from '@/utils/validate'
|
|
|
export default {
|
|
|
props: {
|
|
@@ -140,7 +209,21 @@ export default {
|
|
|
contactDirectInd: '',
|
|
|
contactName: '',
|
|
|
contactMobile: '',
|
|
|
- contactEmail: ''
|
|
|
+ contactEmail: '',
|
|
|
+ tradeTime: '',
|
|
|
+ tradeTimeUnit: '',
|
|
|
+ tradeForOneYear: '',
|
|
|
+ applyMoney: '',
|
|
|
+ applyTime: '',
|
|
|
+ periodToBeApplied1: '',
|
|
|
+ applyTimeUnit: '',
|
|
|
+ amountToBeApplied: '',
|
|
|
+ amountToBeAppliedCurrency: '',
|
|
|
+ tradingAmountPastYear: '',
|
|
|
+ tradingAmountPastYearCurrency: '',
|
|
|
+ settlementPeriod: '',
|
|
|
+ tradingLife1: '',
|
|
|
+ businessCategory1: []
|
|
|
},
|
|
|
rules: {
|
|
|
entityName: [{ required: true, trigger: 'blur', message: '请输入进口商名称' }],
|
|
@@ -154,7 +237,13 @@ export default {
|
|
|
contactName: [{ required: true, trigger: 'blur', message: '请输入企业联系人姓名' }],
|
|
|
// contactMobile: [{ required: true, validator: validateMobile, trigger: 'blur' }],
|
|
|
contactMobile: [{ required: true, trigger: 'blur', message: '请输入联系电话' }],
|
|
|
- contactEmail: [{ required: true, validator: validContactEmail, trigger: 'blur' }]
|
|
|
+ contactEmail: [{ required: true, validator: validContactEmail, trigger: 'blur' }],
|
|
|
+ tradeTime: [{ required: true, trigger: 'blur', message: '请输入交易年限' }],
|
|
|
+ tradeForOneYear: [{ required: true, trigger: 'blur', message: '请输入过去1年双方交易额' }],
|
|
|
+ applyMoney: [{ required: true, trigger: 'blur', message: '请输入拟申请额度金额' }],
|
|
|
+ applyTime: [{ required: true, trigger: 'blur', message: '请输入拟申请额度期限' }],
|
|
|
+ businessCategory1: [{ required: true, trigger: 'change', message: '请选择交易品类' }],
|
|
|
+ settlementPeriod: [{ required: true, trigger: 'blur', message: '请输入结算账期' }]
|
|
|
},
|
|
|
disabled: false,
|
|
|
countryList: []
|
|
@@ -166,10 +255,12 @@ export default {
|
|
|
},
|
|
|
created() {
|
|
|
this.ruleForm.customerUserId = store.getters.userInfo.id
|
|
|
- this.$store.dispatch('getConstant', ['sys_yes_no', 'district_code', 'countryList'])
|
|
|
- if (this.source === 'view') {
|
|
|
+ this.$store.dispatch('getConstant', ['sys_yes_no', 'district_code', 'countryList', 'business_category', 'currency_code'])
|
|
|
+ if (this.source === 'view' || this.source === 'edit') {
|
|
|
this.getDetailInfo()
|
|
|
- this.disabled = true
|
|
|
+ if (this.source === 'view') {
|
|
|
+ this.disabled = true
|
|
|
+ }
|
|
|
}
|
|
|
},
|
|
|
methods: {
|
|
@@ -182,9 +273,18 @@ export default {
|
|
|
|
|
|
for (const k in this.ruleForm) {
|
|
|
if (data[k] !== '' && data[k] !== null && data[k] !== undefined) {
|
|
|
- this.ruleForm[k] = data[k]
|
|
|
+ this.ruleForm[k] = data[k] === 0 ? '0' : data[k]
|
|
|
}
|
|
|
}
|
|
|
+ this.ruleForm.businessCategory1 = data.businessCategory ? data.businessCategory.split(',') : []
|
|
|
+ if (data.tradingLife) {
|
|
|
+ this.ruleForm.tradingLife1 = data.tradingLife.slice(0, data.tradingLife.length - 1)
|
|
|
+ this.ruleForm.tradeTimeUnit = data.tradingLife.slice(-1)
|
|
|
+ }
|
|
|
+ if (data.periodToBeApplied) {
|
|
|
+ this.ruleForm.periodToBeApplied1 = data.periodToBeApplied.slice(0, data.periodToBeApplied.length - 1)
|
|
|
+ this.ruleForm.applyTimeUnit = data.periodToBeApplied.slice(-1)
|
|
|
+ }
|
|
|
}
|
|
|
})
|
|
|
},
|
|
@@ -194,6 +294,9 @@ export default {
|
|
|
Loading: true,
|
|
|
...this.ruleForm
|
|
|
}
|
|
|
+ if (this.source === 'edit') {
|
|
|
+ params.id = this.$route.params.id
|
|
|
+ }
|
|
|
|
|
|
if (submitType === 'temp') {
|
|
|
params.submitStatus = 0
|
|
@@ -201,6 +304,9 @@ export default {
|
|
|
} else if (submitType === 'submit') {
|
|
|
this.$refs.ruleFormRef.validate(valid => {
|
|
|
if (valid) {
|
|
|
+ params.businessCategory = this.ruleForm.businessCategory1.join(',')
|
|
|
+ params.tradingLife = `${this.ruleForm.tradingLife1}${this.ruleForm.tradeTimeUnit}`
|
|
|
+ params.periodToBeApplied = `${this.ruleForm.periodToBeApplied1}${this.ruleForm.applyTimeUnit}`
|
|
|
this.submit(params, submitType)
|
|
|
} else {
|
|
|
this.$message.warning('必填项不能为空')
|
|
@@ -208,26 +314,47 @@ export default {
|
|
|
})
|
|
|
}
|
|
|
},
|
|
|
- submit(data, submitType) {
|
|
|
- addImporter(data).then((res) => {
|
|
|
- if (res.success) {
|
|
|
- if (submitType === 'submit') {
|
|
|
- this.$message.success('提交成功')
|
|
|
- this.closePage()
|
|
|
- } else {
|
|
|
- this.$message.success('暂存成功')
|
|
|
- this.closePage()
|
|
|
- }
|
|
|
+ async submit(data, submitType) {
|
|
|
+ const res = this.source === 'edit' ? await updateImporter(data).catch(() => {}) : await addImporter(data).catch(() => {})
|
|
|
+ if (!res) return
|
|
|
+ if (res.success) {
|
|
|
+ if (submitType === 'submit') {
|
|
|
+ this.$message.success('提交成功')
|
|
|
+ this.closePage()
|
|
|
} else {
|
|
|
- this.$message.warning(res.msg)
|
|
|
+ this.$message.success('暂存成功')
|
|
|
+ this.closePage()
|
|
|
}
|
|
|
- })
|
|
|
+ } else {
|
|
|
+ this.$message.warning(res.msg)
|
|
|
+ }
|
|
|
+ // addImporter(data).then((res) => {
|
|
|
+ // if (res.success) {
|
|
|
+ // if (submitType === 'submit') {
|
|
|
+ // this.$message.success('提交成功')
|
|
|
+ // this.closePage()
|
|
|
+ // } else {
|
|
|
+ // this.$message.success('暂存成功')
|
|
|
+ // this.closePage()
|
|
|
+ // }
|
|
|
+ // } else {
|
|
|
+ // this.$message.warning(res.msg)
|
|
|
+ // }
|
|
|
+ // })
|
|
|
},
|
|
|
|
|
|
closePage() {
|
|
|
this.$router.push({
|
|
|
name: 'TradeRelations'
|
|
|
})
|
|
|
+ },
|
|
|
+ setParams(val, key, otherKey) {
|
|
|
+ if (val && this.ruleForm[otherKey]) {
|
|
|
+ this.ruleForm[key] = val + this.ruleForm[otherKey]
|
|
|
+ } else {
|
|
|
+ this.ruleForm[key] = ''
|
|
|
+ }
|
|
|
+ this.$refs.ruleFormRef.validateField(key)
|
|
|
}
|
|
|
}
|
|
|
}
|
|
@@ -264,5 +391,10 @@ export default {
|
|
|
color: #ff0000;
|
|
|
margin-right: 5px;
|
|
|
}
|
|
|
+ .select-input-item {
|
|
|
+ display: flex;
|
|
|
+ flex-direction: row;
|
|
|
+ flex-wrap: nowrap;
|
|
|
+ }
|
|
|
}
|
|
|
</style>
|