Commit 5e6aa52a by 梁建民

js

parent 4ae6e627
......@@ -12,22 +12,30 @@ Page({
* 页面的初始数据
*/
data: {
authInfo: {},
status: true,
nameText: '公司名称',
companyType: ['贸易商', '代理商', '原厂', '制造商'],
index: 0,
companyType: [{
id: 1,
name: '贸易商'
}, {
id: 2,
name: '代理商'
}, {
id: 3,
name: '原厂'
}, {
id: 4,
name: '制造商'
}],
companyTypeText: '请选择经营性质',
placeholderText: '请输入公司名称',
name: '',
imgSrc: '',
items: [{
name: '企业',
value: 2,
checked: 'true'
},
{
name: '个人',
value: 1
}
]
disabled: false,
loading: false,
checked: 2
},
/**
......@@ -35,6 +43,40 @@ Page({
*/
onLoad: function (options) {
//更新认证信息
if (options.id) {
http.getData(apis.authInfo, 'GET', null, (res) => {
if (res.errcode === 0) {
this.setData({
status: false,
name: res.data.company_type_val,
imgSrc: res.data.auth_img,
checked: res.data.auth_type,
companyTypeText: res.data.company_type_val,
placeholderText:res.data.auth_type == 1 ? '请输入个人名称':'请输入公司名称',
nameText:res.data.auth_type == 1 ? '个人名称':'公司名称',
authInfo: res.data
});
//选中经营性质
for (let i = 0; i < this.data.companyType.length; i++) {
if (res.data.company_type_val == this.data.companyType[i].name) {
this.setData({
index: i
});
}
}
}
}, true, false, true);
}
},
/**
......@@ -129,21 +171,100 @@ Page({
})
},
/**
* 验证字段
*/
calcForm: function (val) {
let company_name = val.company_name;
let company_type = val.company_type;
let auth_img = this.data.imgSrc;
if (!company_name) {
wx.showToast({
title: this.data.placeholderText,
icon: 'none',
duration: 2000
});
return false;
}
if (!company_type) {
wx.showToast({
title: '请选择经营性质',
icon: 'none',
duration: 2000
});
return false;
}
if (!auth_img) {
wx.showToast({
title: '请上传资料',
icon: 'none',
duration: 2000
});
return false;
}
return true;
},
/**
* 认证提交
*/
formSubmit: function (e) {
let company_type=e.detail.value.company_type * 1 +1;
if (this.calcForm(e.detail.value)) {
this.setData({
disabled: true,
loading: true
});
let company_type = e.detail.value.company_type * 1 + 1;
let params = Object.assign({}, e.detail.value, {
company_type:company_type,
company_type: company_type,
auth_img: this.data.imgSrc
});
http.getData(apis.addAuth, 'GET', params, (res) => {
},false,false,true);
if (res.errcode === 0) {
wx.navigateTo({
url: '/pages/person/certification/certificationmanage/index',
success: (result) => {
this.setData({
disabled: false,
loading: false
});
}
});
} else {
this.setData({
disabled: false,
loading: false
});
wx.showToast({
title: res.errmsg,
icon: 'none',
duration: 2000
});
}
}, false, false, true);
}
},
/**
*
......@@ -152,7 +273,7 @@ Page({
bindPickerChange: function (e) {
this.setData({
index: e.detail.value,
companyTypeText: this.data.companyType[e.detail.value]
companyTypeText: this.data.companyType[e.detail.value].name
})
}
})
\ No newline at end of file
......@@ -137,11 +137,11 @@
.btn {
margin: 0 55rpx;
height: 98rpx;
background: rgba(13, 132, 209, 1);
box-shadow: 0px 6rpx 10rpx 0px rgba(97, 160, 242, 0.3);
background: rgba(13, 132, 209, 1) !important;
box-shadow: 0px 6rpx 10rpx 0px rgba(97, 160, 242, 0.3) !important;
border-radius: 8rpx;
font-size: 32rpx;
color: #FFFFFF;
color: #FFFFFF !important;
text-align: center;
line-height: 89rpx;
}
......
......@@ -15,9 +15,13 @@
</view>
<view>
<radio-group class="radio-group" bindchange="radioChange" name="auth_type">
<label class="radio-wrap" wx:for="{{items}}">
<radio value="{{item.value}}" checked="{{item.checked}}" class="radio-text" />
<text class="va-m">{{item.name}}</text>
<label class="radio-wrap">
<radio value="2" checked="{{checked == 2}}" class="radio-text" />
<text class="va-m">企业</text>
</label>
<label class="radio-wrap">
<radio value="1" checked="{{checked == 1}}" class="radio-text" />
<text class="va-m">个人</text>
</label>
</radio-group>
</view>
......@@ -28,7 +32,7 @@
<text class="t1">{{nameText}}</text>
</view>
<view class="flex-b">
<input placeholder="{{placeholderText}}" placeholder-class="placeholderClass" name="company_name" data-type="1" bindinput='bindinputFn' class="inp"></input>
<input value="{{authInfo.company_name}}" placeholder="{{placeholderText}}" placeholder-class="placeholderClass" name="company_name" data-type="1" bindinput='bindinputFn' class="inp"></input>
</view>
</view>
<view class="hr"></view>
......@@ -37,7 +41,7 @@
<text class="t1">经营性质</text>
</view>
<view>
<picker bindchange="bindPickerChange" value="{{index}}" range="{{companyType}}" name="company_type">
<picker bindchange="bindPickerChange" value="{{index}}" range="{{companyType}}" name="company_type" range-key="{{'name'}}">
<text class="t2">{{companyTypeText}}</text>
<text class="icon iconfont iconChevron"></text>
</picker>
......@@ -58,6 +62,6 @@
</block>
<text class="txt">请上传名片/工作,任意材料,证明您的身份信息</text>
</view>
<button class="btn" form-type="submit">提交认证</button>
<button class="btn" form-type="submit" disabled="{{disabled}}" loading="{{loading}}">提交认证</button>
</form>
</view>
\ No newline at end of file
......@@ -110,11 +110,11 @@
.certification .btn {
margin: 0 55rpx;
height: 98rpx;
background: #0d84d1;
box-shadow: 0px 6rpx 10rpx 0px rgba(97, 160, 242, 0.3);
background: #0d84d1 !important;
box-shadow: 0px 6rpx 10rpx 0px rgba(97, 160, 242, 0.3) !important;
border-radius: 8rpx;
font-size: 32rpx;
color: #FFFFFF;
color: #FFFFFF !important;
text-align: center;
line-height: 89rpx;
}
// pages/person/certification/certificationmanage/index.js
const http = require('../../../../utils/util.js');
import {
apis
} from '../../../../utils/api.js';
Page({
/**
* 页面的初始数据
*/
data: {
authinfo: {}
},
/**
......@@ -13,6 +18,17 @@ Page({
*/
onLoad: function (options) {
http.getData(apis.authInfo, 'GET', null, (res) => {
if (res.errcode == 0) {
this.setData({
authInfo: res.data
});
}
}, false, false, true);
},
/**
......@@ -62,5 +78,30 @@ Page({
*/
onShareAppMessage: function () {
},
/**
* 跳转认证信息
*/
toUrl: function (e) {
if(e.target.dataset.type == 1){
wx.navigateTo({
url: e.target.dataset.url+'?id='+e.target.dataset.id,
success: (result)=>{
}
});
}else if(e.target.dataset.type == 2){
wx.navigateTo({
url: e.target.dataset.url,
success: (result)=>{
}
});
}else if(e.target.dataset.type == 3){
wx.switchTab({
url:e.target.dataset.url
});
}
}
})
\ No newline at end of file
......@@ -9,28 +9,52 @@
</view>
</view>
<view class="content">
<text class="time">更新时间:2019-05-10</text>
<text class="time">更新时间:{{authInfo.update_time}}</text>
<view class="status row verCenter rowCenter">
<cover-image src="/res/images/imgs/test.jpg " class="img"></cover-image>
<text class=c"></text>
</view>
<cover-image src="{{authInfo.auth_img}}" class="img"></cover-image>
<block wx:if="{{authInfo.status === 1}}">
<text class="a"></text>
</block>
<block wx:elif="{{authInfo.status === 3}}">
<text class="b"></text>
</block>
<block wx:elif="{{authInfo.status === 2}}">
<text class="c"></text>
</block>
</view>
<block wx:if="{{authInfo.status === 2}}">
<view class="error">
<text class="icon iconfont iconiconxiantiaoshouji1 va-m"></text>
<text class="t1 va-m">驳回理由:上传的资料不清晰,无法确认资质。</text>
<text class="t1 va-m">驳回理由:{{authInfo.reject_reason}}。</text>
</view>
</block>
<view class="txt">
<text class="t1 boxsiz">深圳市猎芯科技有限公司</text>
<text class="t1 boxsiz">{{authInfo.company_name}}</text>
<view class="row verCenter rowCenter mb">
<view>
<text class="t2">资质:</text>
<text class="t3 t3-mr">企业认证</text>
<text class="t3 t3-mr">{{authInfo.auth_type_val}}</text>
</view>
<view>
<text class="t2">性质:</text>
<text class="t3">贸易商</text>
</view>
</view>
</view>
</view>
<button class="btn">更新认证信息</button>
<text class="t3">{{authInfo.company_type_val}}</text>
</view>
</view>
</view>
</view>
<block wx:if="{{authInfo.status === 1}}">
<button class="btn" data-type="1" data-id="{{authInfo.id}}" data-url='/pages/person/certification/addcertification/index' bind:tap="toUrl">
更新认证信息
</button>
</block>
<block wx:elif="{{authInfo.status === 3}}">
<button class="btn" data-type="3" data-id="{{authInfo.id}}" data-url='/pages/tab/home/home' bind:tap="toUrl">
返回会员中心
</button>
</block>
<block wx:elif="{{authInfo.status === 2}}">
<button class="btn" data-type="2" data-id="{{authInfo.id}}" data-url='/pages/person/certification/addcertification/index' bind:tap="toUrl">
重新提交信息
</button>
</block>
</view>
\ No newline at end of file
......@@ -48,7 +48,7 @@
"list": []
},
"miniprogram": {
"current": 5,
"current": 6,
"list": [
{
"id": -1,
......@@ -89,6 +89,13 @@
"id": -1,
"name": "pages/person/auth/index",
"pathName": "pages/person/auth/index",
"query": "",
"scene": null
},
{
"id": -1,
"name": "pages/person/login/index",
"pathName": "pages/person/login/index",
"scene": null
}
]
......
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 sign in to comment