update:法人申领页面更新

This commit is contained in:
2021-01-24 15:55:30 +08:00
parent 4ef8e150af
commit 08f62e3d8c

View File

@@ -10,7 +10,7 @@
<Row>
<RowCol :span="12">
<FormItem label="企业名称" name="unitName">
<Select v-model:value="form.unitName">
<Select v-model:value="form.unitName" :disabled="disabled">
<Option
v-for="organize in organizeList"
:key="organize.id"
@@ -20,19 +20,19 @@
</Select>
</FormItem>
<FormItem label="统一社会信用代码" name="tydm">
<Input v-model:value="form.tydm" />
<Input v-model:value="form.tydm" :disabled="disabled" />
</FormItem>
<FormItem label="经办人姓名" name="operatorName">
<Input v-model:value="form.operatorName" />
<Input v-model:value="form.operatorName" :disabled="disabled" />
</FormItem>
<FormItem label="经办人身份证号" name="operatorId">
<Input v-model:value="form.operatorId" />
<Input v-model:value="form.operatorId" :disabled="disabled" />
</FormItem>
<FormItem label="经办人手机号" name="operatorPhone">
<Input v-model:value="form.operatorPhone" />
<Input v-model:value="form.operatorPhone" :disabled="disabled" />
</FormItem>
<FormItem label="邮寄地址" name="address">
<Input v-model:value="form.address" />
<Input v-model:value="form.address" :disabled="disabled" />
</FormItem>
<FormItem label="省市区信息" name="code">
<Cascader
@@ -41,6 +41,7 @@
:options="areaOptions"
placeholder="请选择省市区信息"
change-on-select
:disabled="disabled"
/>
</FormItem>
</RowCol>
@@ -53,13 +54,15 @@
>
<input hidden v-model="form[config.name]" />
<Upload
:disabled="disabled"
v-model:fileList="config.defaultFileList"
accept="image/*"
action="/api2/upload/uploadfile"
@change="info => handleChange(config, info)"
:beforeUpload="beforeUpload"
list-type="picture"
>
<Button block :disabled="config.disabled">
<Button block :disabled="disabled || config.disabled">
<UploadOutlined />
点击上传
</Button>
@@ -69,11 +72,45 @@
</Row>
<FormItem :wrapperCol="{ span: 10, offset: 8 }">
<Button type="primary" @click="onSubmit">前往申领</Button>
<Button style="margin-left: 10px">历史申领记录</Button>
<Button
v-if="currentId == 0"
style="margin-left: 10px"
type="primary"
@click="createUnitApply"
>申领登记</Button
>
<Button
v-if="currentId !== 0 && currentStatus == null"
style="margin-left: 10px"
type="primary"
@click="sendUnitApply"
>发起申领</Button
>
<Button
v-if="currentId !== 0 && currentStatus == 0"
style="margin-left: 10px"
type="primary"
@click="queryOrder"
>查询结果</Button
>
<Button style="margin-left: 10px" @click="showDrawer"
>历史申领记录</Button
>
</FormItem>
</Form>
</div>
<Drawer
title="历史申领记录"
placement="right"
:closable="false"
v-model:visible="drawVisible"
>
<p v-for="unitApply in unitApplyList" :key="unitApply.id">
{{
`${unitApply.unitName}-${unitApply.operatorName}-${unitApply.operatorPhone}`
}}
</p>
</Drawer>
</template>
<style lang="less">
.ca_apply {
@@ -93,31 +130,36 @@ import {
Button,
Select,
Row,
Col
Col,
Drawer
} from "ant-design-vue";
import { UploadOutlined } from "@ant-design/icons-vue";
import { get } from "@/services/http";
import { get, post } from "@/services/http";
import regex from "@/services/regex";
const picUploadConfig = [
{
label: "授权委托书照片",
name: "LOAPicId",
disabled: false
name: "loaPicId",
disabled: false,
defaultFileList: []
},
{
label: "身份证正面照片",
name: "idCardFrontPicId",
disabled: false
disabled: false,
defaultFileList: []
},
{
label: "身份证背面照片",
name: "idCardBackPicId",
disabled: false
disabled: false,
defaultFileList: []
},
{
label: "营业执照照片",
name: "businessLicensePicId",
disabled: false
disabled: false,
defaultFileList: []
}
];
async function getAreaOptions(code) {
@@ -143,17 +185,22 @@ export default {
Select,
Option: Select.Option,
Row,
RowCol: Col
RowCol: Col,
Drawer
},
data() {
return {
uploadConfig: picUploadConfig,
labelCol: { span: 8 },
wrapperCol: { span: 14 },
fileList: [],
form: {},
currentId: 0,
currentStatus: null,
unitApplyList: [],
areaOptions: [],
organizeList: [],
drawVisible: false,
disabled: true,
rules: {
operatorId: [
{ required: true, message: "请输入18位身份证号码", trigger: "blur" },
@@ -206,7 +253,7 @@ export default {
transform: v => v && v.join("-")
}
],
LOAPicId: [
loaPicId: [
{
required: true,
message: "请上传授权承诺书照片",
@@ -217,7 +264,7 @@ export default {
idCardFrontPicId: [
{
required: true,
message: "请上传授权承诺书照片",
message: "请上传身份证正面照片",
trigger: "change",
transform: v => v && v.toString()
}
@@ -225,7 +272,7 @@ export default {
idCardBackPicId: [
{
required: true,
message: "请上传授权承诺书照片",
message: "请上传身份证背面照片",
trigger: "change",
transform: v => v && v.toString()
}
@@ -233,7 +280,7 @@ export default {
businessLicensePicId: [
{
required: true,
message: "请上传授权承诺书照片",
message: "请上营业执照照片",
trigger: "change",
transform: v => v && v.toString()
}
@@ -241,21 +288,52 @@ export default {
}
};
},
computed: {
disabled: function() {
return this.fileList.length > 0;
}
},
async created() {
const organizeInfo = await get("/api2/UserInfo/Organize");
const unitApplyList = await get("/api2/CA/UnitApplyList");
this.areaOptions = await getAreaOptions("");
this.organizeList = organizeInfo.data;
const current = unitApplyList.data.find(
d => d.status == null || d.status == 0
);
this.unitApplyList = unitApplyList.data;
if (current) {
//省市信息初始化
const [code0, code1] = current.code;
var option0 = this.areaOptions.find(o => o.value == code0);
option0.children = await getAreaOptions(code0);
var option1 = option0.children.find(o => o.value == code1);
option1.children = await getAreaOptions(code1);
this.form = current;
this.currentId = current.id;
this.currentStatus = current.status;
picUploadConfig[0].defaultFileList.push({
uid: -1,
status: "done",
url: current.loaPicPath
});
picUploadConfig[1].defaultFileList.push({
uid: -1,
status: "done",
url: current.idCardFrontPicPath
});
picUploadConfig[2].defaultFileList.push({
uid: -1,
status: "done",
url: current.idCardBackPicPath
});
picUploadConfig[3].defaultFileList.push({
uid: -1,
status: "done",
url: current.businessLicensePicPath
});
} else {
this.disabled = false;
}
},
methods: {
handleChange(config, info) {
const name = config.name;
// var formValue = this.form[name];
// console.log(name, formValue);
if (info.file.status !== "uploading") {
// console.log(info.file.status,info.file, info.fileList);
}
@@ -284,6 +362,7 @@ export default {
return isJpgOrPng && isLt2M;
},
async loadAreaOptions(selectedOptions) {
console.log(selectedOptions);
const targetOption = selectedOptions[selectedOptions.length - 1];
targetOption.loading = true;
const options = await getAreaOptions(targetOption.value);
@@ -293,9 +372,46 @@ export default {
targetOption.loading = false;
this.areaOptions = [...this.areaOptions];
},
onSubmit() {
this.$refs.ruleForm.validate();
console.log(this.form);
async createUnitApply() {
try {
await this.$refs.ruleForm.validate();
} catch (error) {
console.log("error", error);
return;
}
const resp = await post("/api2/CA/createUnitApply", this.form);
if (resp.errorCode != 0) {
message.error(resp.errorMsg);
} else {
message.success("申请成功");
this.currentId = resp.data;
}
},
async sendUnitApply() {
if (this.currentId && this.currentStatus === null) {
const resp = await get("/api2/CA/SendCreateOrder", {
orderId: this.currentId
});
if (resp.errorCode != 0) {
message.error(resp.errorMsg);
} else {
message.success(resp.errorMsg);
}
}
},
//查询结果
async queryOrder() {
const res = await get("/api2/CA/QueryUnitApplyResult", {
id: this.currentId
});
if (res.errorCode == 0) {
message.success(res.errorMsg);
} else {
message.error(res.errorMsg);
}
},
showDrawer() {
this.drawVisible = true;
}
}
};