Commit f5122936 authored by mengwenhao's avatar mengwenhao

feature:金山云上传功能完成

parent 250d7a46
...@@ -70,17 +70,6 @@ exports.getRecordInfo = async ctx => { ...@@ -70,17 +70,6 @@ exports.getRecordInfo = async ctx => {
ctx.body = request; ctx.body = request;
}; };
exports.onUpload = async ctx => {
const url = `${API_INTERNAL_URI}/merchant/lifeinner/upload`;
const opts = {
url,
method: "POST",
json: true,
body: ctx.request.body
};
ctx.body = await req(ctx, opts);
};
// 历史提交审核日志详情页 // 历史提交审核日志详情页
exports.getLog = async ctx => { exports.getLog = async ctx => {
const url = `${API_INTERNAL_URI}/merchant/inner/get_log`; const url = `${API_INTERNAL_URI}/merchant/inner/get_log`;
...@@ -107,7 +96,7 @@ exports.postAudit = async ctx => { ...@@ -107,7 +96,7 @@ exports.postAudit = async ctx => {
// 商户上传营业执照信息 // 商户上传营业执照信息
exports.postBusiness = async ctx => { exports.postBusiness = async ctx => {
const url = `${API_INTERNAL_URI}/merchant/enterprise/business`; const url = `${API_INTERNAL_URI}/merchant/inner/op_business_commit`;
const opts = { const opts = {
url, url,
method: "POST", method: "POST",
......
...@@ -33,7 +33,6 @@ router.post(`${API_VERSION}/get_log`, enterprise.getLog); ...@@ -33,7 +33,6 @@ router.post(`${API_VERSION}/get_log`, enterprise.getLog);
router.post(`${API_VERSION}/audit`, enterprise.postAudit); router.post(`${API_VERSION}/audit`, enterprise.postAudit);
router.post(`${API_VERSION}/business`, enterprise.postBusiness) router.post(`${API_VERSION}/business`, enterprise.postBusiness)
router.post(`${API_VERSION}/op_commit`, enterprise.opCommit); router.post(`${API_VERSION}/op_commit`, enterprise.opCommit);
router.post(`${API_VERSION}/upload`, enterprise.onUpload);
router.get(`${API_VERSION}/image/get_image_id`, image.get_obj_id) router.get(`${API_VERSION}/image/get_image_id`, image.get_obj_id)
router.get(`${API_VERSION}/image/get_bucket`, image.get_bucket) router.get(`${API_VERSION}/image/get_bucket`, image.get_bucket)
......
...@@ -160,9 +160,9 @@ ...@@ -160,9 +160,9 @@
:disabled="!permission.get('audit')" :disabled="!permission.get('audit')"
@click="goAuditPage('AUDIT', scope.row.enterprise_auth_record_id)" @click="goAuditPage('AUDIT', scope.row.enterprise_auth_record_id)"
>审核</el-button> >审核</el-button>
<!-- || scope.row.audit_status !== 30 ? true : false -->
<el-button <el-button
:disabled="!permission.get('edit') " :disabled="!permission.get('edit') || scope.row.audit_status !== 30 ? true : false"
size="mini" size="mini"
type="success" type="success"
@click="goAuditPage('EDIT', scope.row.enterprise_auth_record_id)" @click="goAuditPage('EDIT', scope.row.enterprise_auth_record_id)"
...@@ -344,7 +344,7 @@ export default { ...@@ -344,7 +344,7 @@ export default {
}; };
const res = await checkCode(parasm); const res = await checkCode(parasm);
console.log(res); console.log(res);
// if (res.code !== 0) return this.$message.error(res.reason); if (res.code !== 0) return this.$message.error(res.reason);
this.$message.success("验证码校验成功!"); this.$message.success("验证码校验成功!");
this.$router.push({ this.$router.push({
name: "Audit", name: "Audit",
......
...@@ -33,19 +33,18 @@ ...@@ -33,19 +33,18 @@
prop="businessLicense" prop="businessLicense"
> >
<el-image <el-image
v-if="establishForm.entterprise_image" v-if="establishForm.entterpriseImage"
style="width:100px;height:100px;border-radius:10px" style="width:100px;height:100px;border-radius:10px"
:src="establishForm.entterprise_image" :src="establishForm.entterpriseImage"
fit="cover" fit="cover"
></el-image> ></el-image>
<el-upload <el-upload
:show-file-list="false" :show-file-list="false"
action="http://bp-dev.ini.yidian-inc.com/merchant/lifeinner/upload" :action="domainName"
:limit="1" :limit="1"
:accept="'image/*'" :accept="'image/*'"
auto-upload auto-upload
:on-success="handleSuccess" :on-success="handleEnterpriseSuccess"
:on-error="handleError"
> >
<el-button <el-button
size="small" size="small"
...@@ -67,6 +66,13 @@ ...@@ -67,6 +66,13 @@
> >
<el-input v-model.trim="establishForm.code"></el-input> <el-input v-model.trim="establishForm.code"></el-input>
</el-form-item> </el-form-item>
<!-- 企业代码 -->
<el-form-item
label="用户手机号:"
prop="userMobile"
>
<el-input v-model.trim="establishForm.userMobile"></el-input>
</el-form-item>
<!-- 数据来源 --> <!-- 数据来源 -->
<el-form-item <el-form-item
label="数据来源:" label="数据来源:"
...@@ -98,20 +104,18 @@ ...@@ -98,20 +104,18 @@
prop="front_img" prop="front_img"
> >
<el-image <el-image
v-if="establishForm.front_img" v-if="establishForm.frontImg"
style="width:100px;height:100px;border-radius:10px" style="width:100px;height:100px;border-radius:10px"
:src="establishForm.front_img" :src="establishForm.frontImg"
fit="cover" fit="cover"
></el-image> ></el-image>
<el-upload <el-upload
action="" :show-file-list="false"
multiple :action="domainName"
show-file-list
:limit="1" :limit="1"
:auto-upload="false" :accept="'image/*'"
:file-list="establishForm.idcardFontPhoto" auto-upload
:on-change="onIdPhoneFontChange" :on-success="handleFontSuccess"
:on-remove="onIdPhoneRemove"
> >
<el-button <el-button
size="small" size="small"
...@@ -125,20 +129,18 @@ ...@@ -125,20 +129,18 @@
prop="bak_img" prop="bak_img"
> >
<el-image <el-image
v-if="establishForm.bak_img" v-if="establishForm.bakImg"
style="width:100px;height:100px;border-radius:10px" style="width:100px;height:100px;border-radius:10px"
:src="establishForm.bak_img" :src="establishForm.bakImg"
fit="cover" fit="cover"
></el-image> ></el-image>
<el-upload <el-upload
action="" :show-file-list="false"
multiple :action="domainName"
show-file-list
:limit="1" :limit="1"
:auto-upload="false" :accept="'image/*'"
:file-list="establishForm.idcardBackPhoto" auto-upload
:on-change="onIdPhoneBackChange" :on-success="handleBackSuccess"
:on-remove="onIdPhoneRemove"
> >
<el-button <el-button
size="small" size="small"
...@@ -248,20 +250,36 @@ export default { ...@@ -248,20 +250,36 @@ export default {
callback(); callback();
} }
}; };
// 手机号校验规则 // 法人手机号校验规则
const mobileRules = (rule, value, callback) => { const mobileRules = (rule, value, callback) => {
const phoneReg = /^(13[0-9]|14[01456879]|15[0-35-9]|16[2567]|17[0-8]|18[0-9]|19[0-35-9])\d{8}$/; const phoneReg = /^(13[0-9]|14[01456879]|15[0-35-9]|16[2567]|17[0-8]|18[0-9]|19[0-35-9])\d{8}$/;
const { mobile } = this.establishForm; const { mobile } = this.establishForm;
if (mobile.length === 0) { if (mobile.length === 0) {
callback(new Error("手机号码不可为空")); callback(new Error("法人手机号不可为空!"));
} else if (!phoneReg.test(mobile)) { } else if (!phoneReg.test(mobile)) {
callback(new Error("手机号格式不正确")); callback(new Error("法人手机号格式不正确!"));
}
callback();
};
// 用户手机号
const userMobileRules = (rule, value, callback) => {
const phoneReg = /^(13[0-9]|14[01456879]|15[0-35-9]|16[2567]|17[0-8]|18[0-9]|19[0-35-9])\d{8}$/;
const { userMobile } = this.establishForm;
if (userMobile.length === 0) {
callback(new Error("用户手机号不可为空!"));
} else if (!phoneReg.test(userMobile)) {
callback(new Error("用户手机号格式不正确!"));
} }
// if (!phoneReg.test(legal_mobile)) {
// callback(new Error("手机号格式不正确"));
// }
callback(); callback();
}; };
// 区分测试或正常环境域名
const API_INTERNAL_URI = {
development: "http://bp-dev.ini.yidian-inc.com",
test: "http://bp-test.ini.yidian-inc.com",
production: "http://bp-test.go2yd.com"
};
const env = process.env.NODE_ENV || "development";
const API_INTERNAL_URL = API_INTERNAL_URI[env];
return { return {
// 表单输入项 // 表单输入项
establishForm: { establishForm: {
...@@ -275,13 +293,11 @@ export default { ...@@ -275,13 +293,11 @@ export default {
bak_img: "", // 身份证反面照的尖山云objeid(!) bak_img: "", // 身份证反面照的尖山云objeid(!)
idcard_number: "", // 身份证号(!) idcard_number: "", // 身份证号(!)
userName: "", // 用户姓名(!) userName: "", // 用户姓名(!)
mobile: null, // 用户手机号 mobile: null, // 法人手机号
data_type: null // 企业类型(!) data_type: null, // 企业类型(!)
userMobile: null // 用户手机号
}, },
// 表单回显信息
callbackForm: null,
// 表单校验规则 // 表单校验规则
establishRules: { establishRules: {
// 营业执照 // 营业执照
...@@ -320,10 +336,15 @@ export default { ...@@ -320,10 +336,15 @@ export default {
{ required: true, message: "请填写经营者(法人姓名)", trigger: "blur" } { required: true, message: "请填写经营者(法人姓名)", trigger: "blur" }
], ],
// 法人手机号 // 法人手机号
mobile: [{ required: true, validator: mobileRules, trigger: "blur" }] mobile: [{ required: true, validator: mobileRules, trigger: "blur" }],
/* // 法人手机号 // 用户手机号
legal_mobile: [{ required: true, validator: mobileRules, trigger: "blur" }] */ userMobile: [
} { required: true, validator: userMobileRules, trigger: "blur" }
]
},
// 域名选择
domainName: `${API_INTERNAL_URL}/merchant/lifeinner/upload`
}; };
}, },
...@@ -346,33 +367,31 @@ export default { ...@@ -346,33 +367,31 @@ export default {
this.establishForm.idcard_number = val.legal_id_card; this.establishForm.idcard_number = val.legal_id_card;
this.establishForm.userName = val.legal_person; this.establishForm.userName = val.legal_person;
this.establishForm.mobile = val.mobile; this.establishForm.mobile = val.mobile;
this.establishForm.user_id = val.user_id;
this.establishForm.sensitiveWord = val.sensitiveWord;
} }
}, },
methods: { methods: {
// 上传营业执照时 // 上传营业执照时
handleSuccess (res) { handleEnterpriseSuccess (res) {
if (res.code !== 0) return this.$message.error(res.reason); if (res.code !== 0) return this.$message.error(res.reason);
this.establishForm.entterprise_image = `http://${res.result.file_url}` this.establishForm.entterpriseImage = `http://${res.result.file_url}`;
}, this.establishForm.entterprise_image = res.result.object_id;
handleError (error, file, fileList) {
console.log("error", error);
console.log("file", file);
console.log("fileList", fileList);
}, },
// 身份证正面照片更改时 // 上传身份证前面
onIdPhoneFontChange (file, fileList) { handleFontSuccess (res) {
this.establishForm.idcardFontPhoto = fileList; if (res.code !== 0) return this.$message.error(res.reason);
}, this.establishForm.frontImg = `http://${res.result.file_url}`;
// 身份证照片反面更改时 this.establishForm.front_img = res.result.object_id;
onIdPhoneBackChange (file, fileList) {
this.establishForm.idcardBackPhoto = fileList;
}, },
// 删除上传的身份证照片 // 上传身份证后面
onIdPhoneRemove (file, fileList) { handleBackSuccess (res) {
this.establishForm.idcardFontPhoto = fileList; if (res.code !== 0) return this.$message.error(res.reason);
this.establishForm.bakImg = `http://${res.result.file_url}`;
this.establishForm.bak_img = res.result.object_id;
}, },
// 取消创建表单 // 取消创建表单
...@@ -382,6 +401,8 @@ export default { ...@@ -382,6 +401,8 @@ export default {
// 提交表单 // 提交表单
async handelSubmit () { async handelSubmit () {
if (this.enterpriseId && !this.establishForm.sensitiveWord)
return this.$message.error("您无权限修改信息!!!");
// 企业信息提交参数 // 企业信息提交参数
const { const {
code, code,
...@@ -393,18 +414,34 @@ export default { ...@@ -393,18 +414,34 @@ export default {
bak_img, bak_img,
idcard_number, idcard_number,
userName, userName,
mobile mobile,
userMobile,
user_id
} = this.establishForm; } = this.establishForm;
/**
* 第一步 企业信息提交
* @param enterpriseQuery
*/
// 1.设置提交参数
const enterpriseQuery = { const enterpriseQuery = {
code, code,
name, name,
entterprise_image, entterprise_image,
data_from, data_from,
data_type data_type,
mobile: parseInt(userMobile)
}; };
const res = await postBusiness(enterpriseQuery);
if (res.code !== 0) return this.$message.error(res.reason);
this.establishForm.enterprise_id = res.result.enterprise_auth_record_id
/**
* 第二步 法人(经营者信息提交)
*/
// 法人信息提交参数 // 法人信息提交参数
const legalQuery = { const legalQuery = {
record_id: this.enterpriseId ? this.enterpriseId : "", record_id: this.enterpriseId ? this.enterpriseId : this.establishForm.enterprise_id,
front_img, front_img,
bak_img, bak_img,
front_completeness: 0, front_completeness: 0,
...@@ -413,13 +450,9 @@ export default { ...@@ -413,13 +450,9 @@ export default {
name: userName, name: userName,
mobile, mobile,
data_type, data_type,
user_id: parseInt(this.$store.state.userInfo.userid) user_id: parseInt(user_id)
}; };
const res = await postBusiness(enterpriseQuery);
const result = await opCommit(legalQuery); const result = await opCommit(legalQuery);
console.log("res", res);
console.log("result", result);
if (res.code !== 0) return this.$message.error(res.reason);
if (result.code !== 0) return this.$message.error(result.reason); if (result.code !== 0) return this.$message.error(result.reason);
if (!this.enterpriseId) { if (!this.enterpriseId) {
this.$message.success("企业信息代提交成功!"); this.$message.success("企业信息代提交成功!");
......
...@@ -58,7 +58,7 @@ export async function postAudit (params) { ...@@ -58,7 +58,7 @@ export async function postAudit (params) {
} }
/** /**
* 商户上传营业执照信息 * 414-1商户营业执照代提交(op后台)
* @param query 上传执照参数信息 * @param query 上传执照参数信息
*/ */
export async function postBusiness (query) { export async function postBusiness (query) {
...@@ -67,7 +67,7 @@ export async function postBusiness (query) { ...@@ -67,7 +67,7 @@ export async function postBusiness (query) {
} }
/** /**
* 提交法人信息 * 414-2商户信息代提交(op后台)
* @param params 法人信息 * @param params 法人信息
*/ */
export async function opCommit (params) { export async function opCommit (params) {
...@@ -75,7 +75,3 @@ export async function opCommit (params) { ...@@ -75,7 +75,3 @@ export async function opCommit (params) {
return res; return res;
} }
export async function onUpload (params) {
const res = await axios.post(`/api/v1/upload`, params);
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