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