From e46c61eb4af601680a9a834b916d2d7683e9d087 Mon Sep 17 00:00:00 2001
From: xpz2018 <107107461@qq.com>
Date: Wed, 11 Aug 2021 15:35:29 +0800
Subject: [PATCH] no message
---
pages/agent/address/index.js | 27 +++++++++-----
pages/agent/address/index.wxml | 4 +-
pages/agent/edit/index.js | 21 +++++++++--
pages/agent/edit/index.wxml | 2 +-
pages/api/user.js | 6 ++-
pages/home/certificate/index.js | 62 ++++++++++++++++++++++++-------
pages/home/certificate/index.json | 3 +-
pages/home/certificate/index.wxml | 54 ++++++++++++++-------------
pages/home/certificate/index.wxss | 12 +++---
pages/home/index/index.js | 2 +-
pages/home/index/index.wxml | 2 +-
11 files changed, 133 insertions(+), 62 deletions(-)
diff --git a/pages/agent/address/index.js b/pages/agent/address/index.js
index cff3c21..95a3cdb 100644
--- a/pages/agent/address/index.js
+++ b/pages/agent/address/index.js
@@ -13,13 +13,18 @@ Page({
options: regions,
region: [],
form: {},
+ locateCityTag: {},
requesting: false
},
/**
* 生命周期函数--监听页面加载
*/
onLoad: function (options) {
- this.setData({ safeBottom: app.globalData.safeBottom })
+ // var locateCityTag = app.globalData.userInfo.locateCityTag
+ this.setData({
+ safeBottom: app.globalData.safeBottom,
+ ['form.packageFactoryName']: app.globalData.userInfo.packageFactoryName
+ })
},
bindInput: function(e){
this.data.form[e.target.id] = e.detail.value
@@ -31,9 +36,10 @@ Page({
onRegionChange: function (e) {
if (e.detail && e.detail.options) {
this.setData({ ['form.areaStr']: e.detail.options.map((n) => n.label).join(' '), region: e.detail.value })
- this.data.form['locProvinceId'] = e.detail.value[0]
- this.data.form['locCityId'] = e.detail.value[1]
- this.data.form['districtId'] = e.detail.value[2]
+ this.data.locateCityTag['provinceId'] = e.detail.value[0]
+ this.data.locateCityTag['cityId'] = e.detail.value[1]
+ this.data.locateCityTag['districtId'] = e.detail.value[2]
+ this.data.form['locateDistrictTag'] = e.detail.value[2]
}
},
submitForm: function(){
@@ -44,23 +50,26 @@ Page({
util.showToast('请输入工厂全称')
return
}
- if(util.isEmpty(this.data.form.districtId)){
+ if(util.isEmpty(this.data.form.locateDistrictTag)){
util.showToast('请选择所在区域')
return
}
- if(util.isEmpty(this.data.form.details)){
+ if(util.isEmpty(this.data.form.locateDetails)){
util.showToast('请输入详细地址')
return
}
- if(util.isEmpty(this.data.form.phone)){
+ if(util.isEmpty(this.data.form.consignor)){
util.showToast('请输入发货人姓名')
return
}
this.data.requesting = true
wx.showLoading({ title: '处理中', mask: true })
updateUserInfoZtb(this.data.form).then(res => {
- wx.hideLoading()
- util.showBackToast('新增地址成功')
+ wx.hideLoading()
+ app.globalData.userInfo.hasShipmentsInfo = true
+ const channel = this.getOpenerEventChannel()
+ channel.emit('onCallback', { what: 1030 })
+ util.showBackToast('发货信息已填写')
}).catch(err => {
wx.hideLoading()
this.data.requesting = false
diff --git a/pages/agent/address/index.wxml b/pages/agent/address/index.wxml
index b08c1ff..1c837ca 100644
--- a/pages/agent/address/index.wxml
+++ b/pages/agent/address/index.wxml
@@ -23,11 +23,11 @@
详细地址:
-
+
发货人姓名:
-
+
-
+
发货信息:
diff --git a/pages/api/user.js b/pages/api/user.js
index 1b27f6f..aa55118 100644
--- a/pages/api/user.js
+++ b/pages/api/user.js
@@ -25,6 +25,8 @@ const updateUserInfo = (params) => mPost('/uec/user/update/user-info', params, c
const getAuthSession = () => mGet('/uec/create/identity-auth-session', null, config)
const certificateImage = (params) => mPost('/uec/recognize/certificate-img', params, config)
const certificateIdentity = (params) => mPost('/uec/identify/identity', params, config)
+const ocrLicense = (params) => mPost('/uec/recognize/business-license', params, config)
+const checkLicense = (params) => mPost('/uec/identify/enterprise/by-three-keys', params, config)
// ****************************************************************************************************************************************
// /authorize/by-wechat-applet小程序登录
@@ -197,5 +199,7 @@ export {
phoneWechat,
loginWechat,
setPassword,
- modifyMobile
+ modifyMobile,
+ ocrLicense,
+ checkLicense
}
\ No newline at end of file
diff --git a/pages/home/certificate/index.js b/pages/home/certificate/index.js
index 4b5890c..b2ab5f7 100644
--- a/pages/home/certificate/index.js
+++ b/pages/home/certificate/index.js
@@ -1,10 +1,11 @@
// pages/home/authory/index.js
-import { certificateImage } from "../../api/user"
+import { ocrLicense, checkLicense } from "../../api/user"
+import { updateUserInfo } from '../../api/ztb'
const util = require('../../../utils/util')
const app = getApp()
let monthList = [{ text: '1000吨以下', value: 1 }, { text: '1000-2000吨', value: 2 }, { text: '2000吨以上', value: 3 }]
-let expriseList = [{ text: '1年以下', value: 1 }, { text: '1-5年', value: 2 }, { text: '5-10年', value: 3 }, { text: '10年以上', value: 4 }]
+let expriseList = [{ text: '1年以下', value: 1 }, { text: '1-5年', value: 2 }, { text: '5-10年', value: 3 }, { text: '10年以上', value: 4 }]
Page({
/**
* 页面的初始数据
@@ -13,14 +14,15 @@ Page({
form: { },
flag: false, // 是否不可以编辑, false:可编辑;true:不可编辑
disabled: true,
+ fileList: [],
imgList: [null]
},
onLoad: function (options) {
-
+ this.setData({ form: app.globalData.userInfo })
},
bindForm: function (e) {
// var form_data = 'form.' + e.target.id
- this.data.form[e.target.id] = e.detail.value
+ this.data.form[e.currentTarget.id] = e.detail.value
},
showPicker: function (e) {
this.pickerView = this.pickerView || this.selectComponent('#picker-view')
@@ -38,25 +40,59 @@ Page({
}
},
submitForm: function () {
- if (util.isEmpty(this.data.form.frontImg)) {
- util.showToast('请上传身份证正面照片')
+ if (util.isEmpty(this.data.form.businessLicenseUrl)) {
+ util.showToast('请上传营业执照')
return
}
- if (util.isEmpty(this.data.form.backImg)) {
- util.showToast('请上传身份证背面照片')
+ if (util.isEmpty(this.data.form.enterpriseName)) {
+ util.showToast('请输入公司名称')
+ return
+ }
+ if (util.isEmpty(this.data.form.uniformSocialCreditCode)) {
+ util.showToast('请输社会入统一信用代码')
+ return
+ }
+ if (util.isEmpty(this.data.form.legalPersonName)) {
+ util.showToast('请输法人姓名')
return
}
wx.showLoading({ title: '处理中', mask: true })
- certificateImage(this.data.form).then(result => {
- wx.hideLoading()
- var tokenJson = JSON.stringify(result.data)
- wx.setStorageSync('identityAuthToken', tokenJson)
- wx.navigateTo({ url: '/pages/home/authory/index' })
+ checkLicense(this.data.form).then(result => {
+ // 修改个人信息
+ updateUserInfo(this.data.form).then(result => {
+ wx.hideLoading()
+ if(!app.globalData.userInfo.isAuth){
+ wx.redirectTo({ url: '/pages/home/idcard/index' })
+ }
+ }).catch(error => {
+ wx.hideLoading()
+ util.showToast(error)
+ })
}).catch(error => {
wx.hideLoading()
util.showToast(error)
})
},
+ onImageChange: function (e) {
+ if (e.detail) {
+ var list = []
+ e.detail.forEach(element => {
+ if (!util.isEmpty(element.url)) {
+ list.push(element.url)
+ }
+ })
+ if(list.length > 0){
+ this.data.form['businessLicenseUrl'] = list[0]
+ ocrLicense({businessLicenseUrl: list[0]}).then(result => {
+ this.setData({
+ ['form.enterpriseName']: result.data.company,
+ ['form.uniformSocialCreditCode']: result.data.regNum,
+ ['form.legalPersonName']: result.data.legalPerson
+ })
+ })
+ }
+ }
+ },
/*******************************************************图片上传************************************************************/
chooseImage: function(e) {
if (this.data.flag) {
diff --git a/pages/home/certificate/index.json b/pages/home/certificate/index.json
index 1682085..b6c9f20 100644
--- a/pages/home/certificate/index.json
+++ b/pages/home/certificate/index.json
@@ -1,6 +1,7 @@
{
"usingComponents": {
"picker-view": "/components/picker-view/index",
- "wux-button": "/components/button/index"
+ "wux-button": "/components/button/index",
+ "wux-uploader": "/components/uploader/index"
}
}
\ No newline at end of file
diff --git a/pages/home/certificate/index.wxml b/pages/home/certificate/index.wxml
index e21537f..2f40892 100644
--- a/pages/home/certificate/index.wxml
+++ b/pages/home/certificate/index.wxml
@@ -2,65 +2,69 @@
企业认证
-
-
- *请拍摄/上传营业执照
-
+公司信息