Commit ec879c13 authored by mengwenhao's avatar mengwenhao

update: 接口的封装

parent 1f52d687
const { LOGIN_URI, API_INTERNAL_URI} = require('../config.js') const { LOGIN_URI, API_INTERNAL_URI } = require("../config.js");
const req = require('../utils/request').httpReq const req = require("../utils/request").httpReq;
/** /**
* 用户登录校验,用于校验是否是公司员工, 目前使用pandora系统的登录验证 * 用户登录校验,用于校验是否是公司员工, 目前使用pandora系统的登录验证
...@@ -8,10 +8,10 @@ exports.login = async (ctx, next) => { ...@@ -8,10 +8,10 @@ exports.login = async (ctx, next) => {
const url = `${LOGIN_URI}/api/v1/pandora/auth`; const url = `${LOGIN_URI}/api/v1/pandora/auth`;
const opts = { const opts = {
url, url,
method: 'POST', method: "POST",
json: true, json: true,
body : ctx.request.body body: ctx.request.body
} };
// ctx.body = await req(ctx, opts) // ctx.body = await req(ctx, opts)
const userInfo = await req(ctx, opts); const userInfo = await req(ctx, opts);
...@@ -42,13 +42,10 @@ exports.login = async (ctx, next) => { ...@@ -42,13 +42,10 @@ exports.login = async (ctx, next) => {
// active: true // active: true
// } // }
// } // }
if (typeof userInfo === 'string') { if (typeof userInfo === "string") {
ctx.body = {status: 'fail', message: userInfo}; ctx.body = { status: "fail", message: userInfo };
} else {
} }
console.log(43444, userInfo, typeof userInfo); console.log(43444, userInfo, typeof userInfo);
// if userInfo // if userInfo
};
}
...@@ -12,7 +12,7 @@ ...@@ -12,7 +12,7 @@
<h4 style="margin-bottom:20px;">企业信息</h4> <h4 style="margin-bottom:20px;">企业信息</h4>
<!-- 审核/查看详情页 --> <!-- 审核/查看详情页 -->
<el-table <el-table
v-if="pageStatus !=='EDIT' " v-if="pageStatus !== 'EDIT'"
border border
:data="messageList" :data="messageList"
> >
...@@ -74,7 +74,7 @@ ...@@ -74,7 +74,7 @@
<!-- 修改详情页 --> <!-- 修改详情页 -->
<el-form <el-form
:rules="detailRules" :rules="messageLishRules"
label-width="240px" label-width="240px"
ref="establish_form" ref="establish_form"
:model="messageList[0]" :model="messageList[0]"
...@@ -90,7 +90,7 @@ ...@@ -90,7 +90,7 @@
show-file-list show-file-list
:limit="4" :limit="4"
:auto-upload="false" :auto-upload="false"
:file-list="messageList.licenseList" :file-list="messageList[0].licenseList"
:on-change="onLicenseChange" :on-change="onLicenseChange"
:on-remove="onLicenseRemove" :on-remove="onLicenseRemove"
> >
...@@ -105,14 +105,14 @@ ...@@ -105,14 +105,14 @@
label="企业注册名称:" label="企业注册名称:"
prop="registeredName" prop="registeredName"
> >
<el-input v-model.trim="establishForm.registeredName"></el-input> <el-input v-model.trim="messageList[0].registeredName"></el-input>
</el-form-item> </el-form-item>
<el-form-item <el-form-item
label="统一社会信用代码(注册码):" label="统一社会信用代码(注册码):"
prop="registrationCode" prop="registrationCode"
> >
<el-input v-model.trim="establishForm.registrationCode"></el-input> <el-input v-model.trim="messageList[0].registrationCode"></el-input>
</el-form-item> </el-form-item>
<el-form-item <el-form-item
label="经营者(法人)身份证照片:" label="经营者(法人)身份证照片:"
...@@ -124,7 +124,7 @@ ...@@ -124,7 +124,7 @@
multiple multiple
show-file-list show-file-list
:auto-upload="false" :auto-upload="false"
:file-list="establishForm.idcardPhoto" :file-list="messageList[0].idcardPhoto"
:on-change="onIdPhoneChange" :on-change="onIdPhoneChange"
:on-remove="onIdPhoneRemove" :on-remove="onIdPhoneRemove"
> >
...@@ -139,21 +139,14 @@ ...@@ -139,21 +139,14 @@
label="经营者(法人)姓名:" label="经营者(法人)姓名:"
prop="legalName" prop="legalName"
> >
<el-input v-model.trim="establishForm.legalName"></el-input> <el-input v-model.trim="messageList[0].legalName"></el-input>
</el-form-item> </el-form-item>
<el-form-item <el-form-item
label="经营者(法人)身份证号:" label="经营者(法人)身份证号:"
prop="idcardNumber" prop="idcardNumber"
> >
<el-input v-model.trim="establishForm.idcardNumber"></el-input> <el-input v-model.trim="messageList[0].idcardNumber"></el-input>
</el-form-item>
<el-form-item>
<el-button @click="handelCancel('establish_form')">取消</el-button>
<el-button
@click="handelSubmit('establish_form')"
type="primary"
>提交审核</el-button>
</el-form-item> </el-form-item>
</el-form> </el-form>
</el-card> </el-card>
...@@ -294,7 +287,6 @@ ...@@ -294,7 +287,6 @@
</el-table-column> </el-table-column>
</el-table> </el-table>
</el-card> </el-card>
<!-- 查看详情__创建生活号表单 --> <!-- 查看详情__创建生活号表单 -->
<el-dialog <el-dialog
title="创建生活号" title="创建生活号"
...@@ -330,8 +322,14 @@ ...@@ -330,8 +322,14 @@
class="edit_button_area" class="edit_button_area"
v-if="pageStatus === 'EDIT'" v-if="pageStatus === 'EDIT'"
> >
<el-button type="danger">取消</el-button> <el-button
<el-button type="primary">提交审核</el-button> @click="handelCancel('establish_form')"
type="danger"
>取消</el-button>
<el-button
@click="handelSubmit('establish_form')"
type="primary"
>提交审核</el-button>
</div> </div>
</div> </div>
</layout> </layout>
...@@ -340,9 +338,9 @@ ...@@ -340,9 +338,9 @@
<style lang="less" src="./index.less" scope></style> <style lang="less" src="./index.less" scope></style>
<script> <script>
import Layout from '@/layouts' import Layout from "@/layouts";
export default { export default {
name: 'Audit', name: "Audit",
components: { Layout }, components: { Layout },
beforeRouteEnter (to, from, next) { beforeRouteEnter (to, from, next) {
to.params.pageStatus && to.params.auditId to.params.pageStatus && to.params.auditId
...@@ -358,26 +356,52 @@ export default { ...@@ -358,26 +356,52 @@ export default {
}, },
data () { data () {
// 营业执照校验规则
let businessRules = (rule, value, callback) => {
if (this.messageList[0].licenseList.length === 0) {
callback(new Error("请上传营业执照"));
} else {
callback();
}
};
// 身份证照片校验规则
let idPhotoRules = (rule, value, callback) => {
if (this.messageList[0].idcardPhoto.length === 0) {
callback(new Error("请上传身份证照片"));
} else {
callback();
}
};
// 身份证号校验规则
let idcardNumberRules = (rule, value, callback) => {
let IDRe18 = /^([1-6][1-9]|50)\d{4}(18|19|20)\d{2}((0[1-9])|10|11|12)(([0-2][1-9])|10|20|30|31)\d{3}[0-9Xx]$/;
let IDre15 = /^([1-6][1-9]|50)\d{4}\d{2}((0[1-9])|10|11|12)(([0-2][1-9])|10|20|30|31)\d{3}$/;
let idNumber = this.messageList[0].idcardNumber;
if (idNumber.length === 0) {
callback(new Error("身份证号不可为空"));
} else if (!(IDRe18.test(idNumber) || IDre15.test(idNumber))) {
callback(new Error("身份证号格式不正确"));
} else {
callback();
}
};
return { return {
pageStatus: null, // 哪个按钮进入 pageStatus: null, // 哪个按钮进入
auditId: null, // 传入的企业id auditId: null, // 传入的企业id
// 审核-企业信息 // 审核/修改详情/查看详情-企业信息
messageList: [ messageList: [
{ {
status: 1, status: 1,
id: 1221, id: 1221,
name: "一点资讯", registeredName: "一点资讯", // 企业名称
code: 1221, registrationCode: 1221, // 注册码
picture: licenseList: [], // 营业执照
"https://gimg2.baidu.com/image_search/src=http%3A%2F%2F1812.img.pp.sohu.com.cn%2Fimages%2Fblog%2F2009%2F11%2F18%2F18%2F8%2F125b6560a6ag214.jpg&refer=http%3A%2F%2F1812.img.pp.sohu.com.cn&app=2002&size=f9999,10000&q=a80&n=0&g=0n&fmt=jpeg?sec=1624586640&t=b27aa012d8ca07eb9ab800ea43c5b218", legalName: "蒙文昊", // 法人姓名
userName: "蒙文昊", idcardNumber: 150402199704132713, // 法人身份证号
idNumber: 1232131, idcardPhoto: [] // 身份证照片
idPicture:
"https://gimg2.baidu.com/image_search/src=http%3A%2F%2F2c.zol-img.com.cn%2Fproduct%2F124_500x2000%2F748%2FceZOdKgDAFsq2.jpg&refer=http%3A%2F%2F2c.zol-img.com.cn&app=2002&size=f9999,10000&q=a80&n=0&g=0n&fmt=jpeg?sec=1624586640&t=a1036d947c1c60f17b178a52d1f8c3f7"
} }
], ],
// 审核-提交信息 // 审核-提交信息
submitList: [ submitList: [
{ {
...@@ -386,7 +410,6 @@ export default { ...@@ -386,7 +410,6 @@ export default {
account: 492148618 account: 492148618
} }
], ],
// 审核-提交历史 // 审核-提交历史
historyList: [ historyList: [
{ {
...@@ -398,44 +421,81 @@ export default { ...@@ -398,44 +421,81 @@ export default {
address: "请求通过,可以提交审核" address: "请求通过,可以提交审核"
} }
], ],
// 审核-审核意见 // 审核-审核意见
opinionArea: "", opinionArea: "",
// 创建生活号表单是否弹出 // 创建生活号表单是否弹出
isDialogShow: false, isDialogShow: false,
// 生活号-生活号信息 // 生活号-生活号信息
lifeList: [ lifeList: [
{ {
lifeId: 1, lifeId: 1,
lifeName: '生活残忍', lifeName: "生活残忍",
adminName: '蒙文昊', adminName: "蒙文昊",
adminNumber: 492148618, adminNumber: 492148618,
adminId: 1111111111 adminId: 1111111111
} }
], ],
// 生活号-提交表单
// 生活号提交表单
lifeForm: { lifeForm: {
adminName: '蒙文昊', adminName: "蒙文昊",
adminPhone: 18147683288, adminPhone: 18147683288,
lifeName: '', lifeName: "",
lifeAdmin: '' lifeAdmin: ""
} },
// 修改详情-表单校验规则
messageLishRules: {
// 营业执照
businessLicense: [
{ required: true, validator: businessRules, trigger: "change" }
],
// 企业注册名称
registeredName: [
{ required: true, message: "请输入企业注册名称", trigger: "blur" }
],
// 注册码
registrationCode: [
{
required: true,
message: "请输入统一社会信用代码(注册码)",
trigger: "blur"
}
],
// 法人照片
legalPhoto: [
{ required: true, validator: idPhotoRules, trigger: "change" }
],
// 法人姓名
legalName: [
{
required: true,
message: "请输入经营者(法人)姓名",
trigger: "blur"
}
],
// 法人身份证号
idcardNumber: [
{
required: true,
validator: idcardNumberRules,
trigger: "blur"
}
]
},
}; };
}, },
computed: { computed: {
titleContent () { titleContent () {
if (this.pageStatus === 'AUDIT') { if (this.pageStatus === "AUDIT") {
return '审核详情页' return "审核详情页";
} else if (this.pageStatus === 'EDIT') { } else if (this.pageStatus === "EDIT") {
return '修改详情页' return "修改详情页";
} else { } else {
return '查看详情页' return "查看详情页";
} }
}, }
}, },
methods: { methods: {
...@@ -443,19 +503,58 @@ export default { ...@@ -443,19 +503,58 @@ export default {
// 审核-拒绝审核 // 审核-拒绝审核
auditRefuse () { auditRefuse () {
if (this.opinionArea.length === 0) return this.$message.error("请填写拒绝原因"); if (this.opinionArea.length === 0)
return this.$message.error("请填写拒绝原因");
}, },
// 返回上一页 // 返回上一页
goBack () { goBack () {
this.$router.replace({ name: 'Certification' }); this.$router.replace({ name: "Certification" });
}, },
// 生活号-创建生活号弹框显示 // 生活号-创建生活号弹框显示
onCreateLife (params) { onCreateLife (params) {
console.log(params); console.log(params);
this.isDialogShow = true; this.isDialogShow = true;
} },
// 修改详情-提交审核
handelSubmit (formName) {
this.$refs[formName].validate(valid => {
console.log(valid);
});
},
// 修改详情-取消修改表单
handelCancel () {
this.$router.replace({ name: 'Certification' });
},
// 修改详情-执照列表更改时
onLicenseChange (file, fileList) {
this.messageList[0].licenseList = fileList;
this.$refs["licenseChange"].clearValidate();
console.log("licenseList", this.messageList[0].licenseList);
},
// 修改详情-身份证照片更改时
onIdPhoneChange (file, fileList) {
this.messageList[0].idcardPhoto = fileList;
this.$refs["idcardPhotoChange"].clearValidate();
console.log("idcardPhoto:", this.messageList[0].idcardPhoto);
},
// 修改详情-删除上传的营业执照
onLicenseRemove (file, fileList) {
console.log("file", file);
console.log("fileList", fileList);
this.messageList[0].licenseList = fileList;
console.log("licenseList", this.messageList[0].licenseList);
},
// 修改详情-删除上传的身份证照片
onIdPhoneRemove (file, fileList) {
this.messageList[0].idcardPhoto = fileList;
console.log("idCarPhoto:", this.messageList[0].idcardPhoto);
},
} }
}; };
</script> </script>
...@@ -148,17 +148,17 @@ ...@@ -148,17 +148,17 @@
<el-button <el-button
size="mini" size="mini"
type="primary" type="primary"
@click="goAuditPage('AUDIT',scope.row.id)" @click="goAuditPage('AUDIT', scope.row.id)"
>审核</el-button> >审核</el-button>
<el-button <el-button
size="mini" size="mini"
type="success" type="success"
@click="goAuditPage('EDIT',scope.row.id)" @click="goAuditPage('EDIT', scope.row.id)"
>修改提交</el-button> >修改提交</el-button>
<el-button <el-button
size="mini" size="mini"
type="warning" type="warning"
@click="goAuditPage('DETAIL',scope.row.id)" @click="goAuditPage('DETAIL', scope.row.id)"
>查看详情</el-button> >查看详情</el-button>
</template> </template>
</el-table-column> </el-table-column>
...@@ -171,9 +171,10 @@ ...@@ -171,9 +171,10 @@
<style lang="less" src="./index.less" scope></style> <style lang="less" src="./index.less" scope></style>
<script> <script>
import Layout from '@/layouts' import Layout from "@/layouts";
import { entCheck as entChecked } from "@/service/enterprise";
export default { export default {
name: 'Certification', name: "Certification",
components: { Layout }, components: { Layout },
data () { data () {
return { return {
...@@ -214,10 +215,21 @@ export default { ...@@ -214,10 +215,21 @@ export default {
}; };
}, },
created () { }, created () {
this.entCheck();
},
methods: { methods: {
// 获取商户认证检查信息 // 获取商户认证检查信息
async entCheck () {
try {
const res = await entChecked(510232747179);
console.log(res);
}
catch (error) {
console.log(error);
}
},
// 重置表单 // 重置表单
resetForm (formName) { resetForm (formName) {
...@@ -226,20 +238,18 @@ export default { ...@@ -226,20 +238,18 @@ export default {
// 跳转到审核页面 // 跳转到审核页面
goAuditPage (pageStatus, auditId) { goAuditPage (pageStatus, auditId) {
this.$router.push( this.$router.push({
{ name: "Audit",
name: "Audit", params: {
params: { pageStatus,
pageStatus, auditId
auditId
}
} }
); });
}, },
// 跳转到企业信息提交 // 跳转到企业信息提交
goEstablish () { goEstablish () {
this.$router.push({ name: 'Establish' }) this.$router.push({ name: "Establish" });
} }
} }
}; };
......
/**
* 企业请求
*/
import axios from "../utils/request"; import axios from "../utils/request";
export default { export const entCheck = async user_id => {
async getMessage () { const res = await axios({
const res = await axios.get() method: "GET",
console.log(res); url: "/api/merchant/inner/ent_check",
} params: {
user_id
}
});
return res;
}; };
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment