Commit f1442ebc authored by linwenqing's avatar linwenqing

add:提交证件

parent 8d4291f5
......@@ -2,8 +2,10 @@ const globalUrl = process.uniEnv || {}
const ucenterApiUrl = globalUrl.ucenterUrl.apiUrl
let certApiFun = function(vm){
let getCertList = async (params = {}) => await vm.$u.get(ucenterApiUrl+'/v1/settled/get-cert-list', params);
let submitCert = async (params = {}) => await vm.$u.post(ucenterApiUrl+'/v1/settled/submit-cert', params);
const certApi = {
getCertList
getCertList,
submitCert
}
return certApi
}
......
......@@ -216,6 +216,13 @@
"navigationBarTitleText": "",//证件详情
"navigationStyle":"custom"
}
},
{
"path": "cert/upload",
"style": {
"navigationBarTitleText": "",//证件上传
"navigationStyle":"custom"
}
},
{
"path":"contract/index",
......
......@@ -10,7 +10,7 @@
></u-navbar>
<view class="content-cody">
<view class="title">{{ info.type }}</view>
<view class="content" v-for="item in info.url"><image :src="item" mode=""></image></view>
<view class="content" v-for="item in info.url"><image :src="item" mode="aspectFit"></image></view>
</view>
</view>
</template>
......
......@@ -102,10 +102,7 @@
this.list[key].iconColor = getData.status == 1 ? "#2272FF" : "#999999";
this.list[key].data = getData;
}
console.log(this.list);
console.log(res);
}).catch((err) => {
console.log(err);
});
},
methods: {
......@@ -115,14 +112,17 @@
toDetail(key) {
let data = this.list[key].data;
if(data.status != 1){
return;
wx.navigateTo({
url: '/pages/mine/cert/upload?type=' + data.type_key
});
}else{
wx.navigateTo({
url: '/pages/mine/cert/detail',
success: function(res) {
res.eventChannel.emit('acceptDataFromCert', data)
}
});
}
wx.navigateTo({
url: '/pages/mine/cert/detail',
success: function(res) {
res.eventChannel.emit('acceptDataFromCert', data)
}
});
}
}
}
......
<template>
<view class="cert-page">
<view>
<u-navbar back-icon-color="#000000" :background="background" title-color="#000" :border-bottom="false"
title="证件上传" title-bold="true"></u-navbar>
</view>
<view class="content-body">
<view class="notice-top">
请上传您的:<text class="right">{{ imgList[key].typeName }}</text>
</view>
<view class="notice-two">
请点击上传图片,图片大小不大于3M
</view>
<view class="upload-container">
<view class="img-container" v-for="(item, index) in imgList[key].desc"
:class="{'u-margin-left-30': index>0}" :key="index">
<image class="upload-img" @click="handleClick(type, index)" :src="imgs[index]" mode="aspectFill">
</image>
<text class="img-desc">{{ item }}</text>
</view>
</view>
<view class="notice-bottom">
<image :src="icon" class="icon"></image>
<text class="u-padding-left-10">若无需上传证件反面照,则点击上传正面照即可</text>
</view>
<view class="button-container">
<view class="submit-button" :class="{'is-ok': isOk}" @click="submitCert()">提交</view>
</view>
</view>
</view>
</template>
<script>
import base from '@/components/upload/index';
export default {
mixins: [base],
data() {
return {
icon: process.uniEnv.qn_base_url + "tishi.png",
categories: [],
param: {
url: []
},
key: null,
type: null,
isOk: false,
imgs: [
process.uniEnv.qn_base_url + "sahgnchuanzhaopian.png",
process.uniEnv.qn_base_url + "sahgnchuanzhaopian.png",
],
imgList: [{
typeKey: 'id_card',
typeName: '身份证',
desc: ['上传身份证人像面', '上传身份证国徽面'],
maxImgs: 2
},
{
typeKey: 'electrician_certificate',
typeName: '电工证',
desc: ['上传电工证照片', '无需上传反面照'],
maxImgs: 1
},
{
typeKey: 'driver_license',
typeName: '驾驶证',
desc: ['上传驾驶证照片', '无需上传反面照'],
maxImgs: 1
},
{
typeKey: 'driving_license',
typeName: '行驶证',
desc: ['上传行驶证照片', '无需上传反面照'],
maxImgs: 1
},
{
typeKey: 'vehicle',
typeName: '车辆照',
desc: ['车辆正面/看到车牌', '车辆侧面/看到外观'],
maxImgs: 2
},
{
typeKey: 'high_sky_license',
typeName: '高空证',
desc: ['上传高空证照片', '无需上传反面照'],
maxImgs: 1
},
{
typeKey: 'refrigeration_license',
typeName: '制冷证',
desc: ['上传制冷证照片', '无需上传反面照'],
maxImgs: 1
},
{
typeKey: 'business_license',
typeName: '营业执照',
desc: ['上传营业执照照片', '无需上传反面照'],
maxImgs: 1
}
],
}
},
onLoad(param) {
this.type = param.type
this.key = this.getListKey(this.type);
},
methods: {
getListKey(typeKey) {
let length = this.imgList.length
for (let i = 0; i < length; i++) {
if (this.imgList[i].typeKey == typeKey) {
return i
}
}
},
async handleClick(certType, key) {
if (this.imgList[this.key].desc[key] == '无需上传反面照') {
uni.showToast({
icon: "none",
title: this.imgList[this.key].desc[key],
});
return
}
let self = this
self.uploadType = certType || ''
let attr = {
category: self.categories[1]
}
if (certType == 'id_card_front') {
attr = {
category: self.categories[2]
}
}
let src = await self.chooseImg({
count: 1
})
self.imgs[key] = src[0].path;
self.param.url[key] = src[0].key;
if(self.param.url.length == this.imgList[this.key].maxImgs){
this.isOk = true;
}else{
this.isOk = false;
}
},
submitCert() {
if(!this.isOk){
return;
}
this.param.url = this.param.url.toString();
this.param.type = this.type;
this.$u.api.submitCert(this.param)
.then((res) => {
if(res.status != 200){
uni.showToast({
icon: "none",
title: res.message,
});
}
wx.redirectTo({
url: '/pages/mine/cert/index'
});
})
.catch((err) => {
console.log(err);
});
}
}
}
</script>
<style>
page {
background: #F4F5F7;
}
.cert-page {
height: 70vh;
margin: 20rpx 30rpx 0rpx;
}
.content-body {
padding: 40rpx 30rpx 60rpx;
background-color: #FFF;
border-radius: 12rpx;
}
.notice-top {
width: 290rpx;
height: 32rpx;
font-size: 32rpx;
font-family: PingFang-SC-Bold, PingFang-SC;
font-weight: bold;
color: #333333;
line-height: 32rpx;
}
.right {
color: #2272FF;
}
.notice-two {
height: 28rpx;
font-size: 24rpx;
font-family: PingFang-SC-Regular, PingFang-SC;
font-weight: 400;
color: #666666;
line-height: 28rpx;
margin-top: 18rpx;
}
.notice-bottom {
height: 20rpx;
font-size: 20rpx;
font-family: PingFang-SC-Medium, PingFang-SC;
font-weight: 500;
color: #999999;
line-height: 20rpx;
margin-top: 30rpx;
display: flex;
}
.submit-button {
width: 400rpx;
height: 104rpx;
background: #D1D4D4;
border-radius: 52rpx;
margin-top: 250rpx;
text-align: center;
line-height: 104rpx;
display: inline-block;
color: #FFFFFF;
font-weight: bold;
font-size: 32rpx;
}
.is-ok {
background: #2272FF;
}
.button-container {
text-align: center;
}
.upload-container {
display: flex;
}
.upload-img {
margin-top: 30rpx;
width: 300rpx;
height: 226rpx;
}
.two {
margin-left: 30rpx;
}
.icon {
width: 24rpx;
height: 24rpx;
}
.img-container {
position: relative;
}
.img-desc {
position: absolute;
bottom: 10rpx;
left: 0;
font-size: 20rpx;
color: #c5bfbf;
font-weight: 400;
line-height: 28px;
text-align: center;
width: 100%;
}
</style>
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