Commit ec879c13 authored by mengwenhao's avatar mengwenhao

update: 接口的封装

parent 1f52d687
const { LOGIN_URI, API_INTERNAL_URI} = require('../config.js')
const req = require('../utils/request').httpReq
const { LOGIN_URI, API_INTERNAL_URI } = require("../config.js");
const req = require("../utils/request").httpReq;
/**
* 用户登录校验,用于校验是否是公司员工, 目前使用pandora系统的登录验证
......@@ -8,10 +8,10 @@ exports.login = async (ctx, next) => {
const url = `${LOGIN_URI}/api/v1/pandora/auth`;
const opts = {
url,
method: 'POST',
method: "POST",
json: true,
body : ctx.request.body
}
body: ctx.request.body
};
// ctx.body = await req(ctx, opts)
const userInfo = await req(ctx, opts);
......@@ -42,13 +42,10 @@ exports.login = async (ctx, next) => {
// active: true
// }
// }
if (typeof userInfo === 'string') {
ctx.body = {status: 'fail', message: userInfo};
} else {
if (typeof userInfo === "string") {
ctx.body = { status: "fail", message: userInfo };
}
console.log(43444, userInfo, typeof userInfo);
// if userInfo
}
};
......@@ -12,7 +12,7 @@
<h4 style="margin-bottom:20px;">企业信息</h4>
<!-- 审核/查看详情页 -->
<el-table
v-if="pageStatus !=='EDIT' "
v-if="pageStatus !== 'EDIT'"
border
:data="messageList"
>
......@@ -74,7 +74,7 @@
<!-- 修改详情页 -->
<el-form
:rules="detailRules"
:rules="messageLishRules"
label-width="240px"
ref="establish_form"
:model="messageList[0]"
......@@ -90,7 +90,7 @@
show-file-list
:limit="4"
:auto-upload="false"
:file-list="messageList.licenseList"
:file-list="messageList[0].licenseList"
:on-change="onLicenseChange"
:on-remove="onLicenseRemove"
>
......@@ -105,14 +105,14 @@
label="企业注册名称:"
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
label="统一社会信用代码(注册码):"
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
label="经营者(法人)身份证照片:"
......@@ -124,7 +124,7 @@
multiple
show-file-list
:auto-upload="false"
:file-list="establishForm.idcardPhoto"
:file-list="messageList[0].idcardPhoto"
:on-change="onIdPhoneChange"
:on-remove="onIdPhoneRemove"
>
......@@ -139,21 +139,14 @@
label="经营者(法人)姓名:"
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
label="经营者(法人)身份证号:"
prop="idcardNumber"
>
<el-input v-model.trim="establishForm.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-input v-model.trim="messageList[0].idcardNumber"></el-input>
</el-form-item>
</el-form>
</el-card>
......@@ -294,7 +287,6 @@
</el-table-column>
</el-table>
</el-card>
<!-- 查看详情__创建生活号表单 -->
<el-dialog
title="创建生活号"
......@@ -330,8 +322,14 @@
class="edit_button_area"
v-if="pageStatus === 'EDIT'"
>
<el-button type="danger">取消</el-button>
<el-button type="primary">提交审核</el-button>
<el-button
@click="handelCancel('establish_form')"
type="danger"
>取消</el-button>
<el-button
@click="handelSubmit('establish_form')"
type="primary"
>提交审核</el-button>
</div>
</div>
</layout>
......@@ -340,9 +338,9 @@
<style lang="less" src="./index.less" scope></style>
<script>
import Layout from '@/layouts'
import Layout from "@/layouts";
export default {
name: 'Audit',
name: "Audit",
components: { Layout },
beforeRouteEnter (to, from, next) {
to.params.pageStatus && to.params.auditId
......@@ -358,26 +356,52 @@ export default {
},
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 {
pageStatus: null, // 哪个按钮进入
auditId: null, // 传入的企业id
// 审核-企业信息
// 审核/修改详情/查看详情-企业信息
messageList: [
{
status: 1,
id: 1221,
name: "一点资讯",
code: 1221,
picture:
"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",
userName: "蒙文昊",
idNumber: 1232131,
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"
registeredName: "一点资讯", // 企业名称
registrationCode: 1221, // 注册码
licenseList: [], // 营业执照
legalName: "蒙文昊", // 法人姓名
idcardNumber: 150402199704132713, // 法人身份证号
idcardPhoto: [] // 身份证照片
}
],
// 审核-提交信息
submitList: [
{
......@@ -386,7 +410,6 @@ export default {
account: 492148618
}
],
// 审核-提交历史
historyList: [
{
......@@ -398,44 +421,81 @@ export default {
address: "请求通过,可以提交审核"
}
],
// 审核-审核意见
opinionArea: "",
// 创建生活号表单是否弹出
isDialogShow: false,
// 生活号-生活号信息
lifeList: [
{
lifeId: 1,
lifeName: '生活残忍',
adminName: '蒙文昊',
lifeName: "生活残忍",
adminName: "蒙文昊",
adminNumber: 492148618,
adminId: 1111111111
}
],
// 生活号提交表单
// 生活号-提交表单
lifeForm: {
adminName: '蒙文昊',
adminName: "蒙文昊",
adminPhone: 18147683288,
lifeName: '',
lifeAdmin: ''
lifeName: "",
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: {
titleContent () {
if (this.pageStatus === 'AUDIT') {
return '审核详情页'
} else if (this.pageStatus === 'EDIT') {
return '修改详情页'
if (this.pageStatus === "AUDIT") {
return "审核详情页";
} else if (this.pageStatus === "EDIT") {
return "修改详情页";
} else {
return '查看详情页'
return "查看详情页";
}
}
},
},
methods: {
......@@ -443,19 +503,58 @@ export default {
// 审核-拒绝审核
auditRefuse () {
if (this.opinionArea.length === 0) return this.$message.error("请填写拒绝原因");
if (this.opinionArea.length === 0)
return this.$message.error("请填写拒绝原因");
},
// 返回上一页
goBack () {
this.$router.replace({ name: 'Certification' });
this.$router.replace({ name: "Certification" });
},
// 生活号-创建生活号弹框显示
onCreateLife (params) {
console.log(params);
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>
......@@ -148,17 +148,17 @@
<el-button
size="mini"
type="primary"
@click="goAuditPage('AUDIT',scope.row.id)"
@click="goAuditPage('AUDIT', scope.row.id)"
>审核</el-button>
<el-button
size="mini"
type="success"
@click="goAuditPage('EDIT',scope.row.id)"
@click="goAuditPage('EDIT', scope.row.id)"
>修改提交</el-button>
<el-button
size="mini"
type="warning"
@click="goAuditPage('DETAIL',scope.row.id)"
@click="goAuditPage('DETAIL', scope.row.id)"
>查看详情</el-button>
</template>
</el-table-column>
......@@ -171,9 +171,10 @@
<style lang="less" src="./index.less" scope></style>
<script>
import Layout from '@/layouts'
import Layout from "@/layouts";
import { entCheck as entChecked } from "@/service/enterprise";
export default {
name: 'Certification',
name: "Certification",
components: { Layout },
data () {
return {
......@@ -214,10 +215,21 @@ export default {
};
},
created () { },
created () {
this.entCheck();
},
methods: {
// 获取商户认证检查信息
async entCheck () {
try {
const res = await entChecked(510232747179);
console.log(res);
}
catch (error) {
console.log(error);
}
},
// 重置表单
resetForm (formName) {
......@@ -226,20 +238,18 @@ export default {
// 跳转到审核页面
goAuditPage (pageStatus, auditId) {
this.$router.push(
{
this.$router.push({
name: "Audit",
params: {
pageStatus,
auditId
}
}
);
});
},
// 跳转到企业信息提交
goEstablish () {
this.$router.push({ name: 'Establish' })
this.$router.push({ name: "Establish" });
}
}
};
......
/**
* 企业请求
*/
import axios from "../utils/request";
export default {
async getMessage () {
const res = await axios.get()
console.log(res);
export const entCheck = async user_id => {
const res = await axios({
method: "GET",
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