diff --git a/pages/agent/address/index.js b/pages/agent/address/index.js index 95a3cdb..b39f42f 100644 --- a/pages/agent/address/index.js +++ b/pages/agent/address/index.js @@ -1,5 +1,5 @@ // pages/shop/apply/index.js -import { updateUserInfoZtb } from "../../api/ztb" +import { saveFactory } from "../../api/ztb" const util = require('../../../utils/util') import regions from '../../../utils/region' const app = getApp() @@ -39,7 +39,7 @@ Page({ 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] + this.data.form['locDistrictId'] = e.detail.value[2] } }, submitForm: function(){ @@ -50,11 +50,11 @@ Page({ util.showToast('请输入工厂全称') return } - if(util.isEmpty(this.data.form.locateDistrictTag)){ + if(util.isEmpty(this.data.form.locDistrictId)){ util.showToast('请选择所在区域') return } - if(util.isEmpty(this.data.form.locateDetails)){ + if(util.isEmpty(this.data.form.locDetail)){ util.showToast('请输入详细地址') return } @@ -64,7 +64,7 @@ Page({ } this.data.requesting = true wx.showLoading({ title: '处理中', mask: true }) - updateUserInfoZtb(this.data.form).then(res => { + saveFactory(this.data.form).then(res => { wx.hideLoading() app.globalData.userInfo.hasShipmentsInfo = true const channel = this.getOpenerEventChannel() diff --git a/pages/agent/address/index.wxml b/pages/agent/address/index.wxml index 1c837ca..3b2a6ce 100644 --- a/pages/agent/address/index.wxml +++ b/pages/agent/address/index.wxml @@ -12,7 +12,7 @@ 工厂全称: - + @@ -23,11 +23,11 @@ 详细地址: - + 发货人姓名: - + diff --git a/pages/api/ztb.js b/pages/api/ztb.js index d018372..a2ea044 100644 --- a/pages/api/ztb.js +++ b/pages/api/ztb.js @@ -135,6 +135,8 @@ const getPaperMillOfInformationList = (params) => mGet(`/recycle-service/get/pap //反馈纸厂情报 const feedbackMillInformation = (params) => mPost(`/recycle-service/feedback/mill-information`, params, zconfig) +const identifyEnterprise = (params) => mPost(`/recycle-user-center/save/enterprise-by-identify`, params, zconfig) +const saveFactory = (params) => mPost(`/recycle-user-center/save/factory-by-shipment-info`, params, zconfig) export { @@ -234,5 +236,7 @@ export { updateUserInfoZtb, userPushFollowMill, getPaperMillOfInformationList, - feedbackMillInformation + feedbackMillInformation, + identifyEnterprise, + saveFactory } \ No newline at end of file diff --git a/pages/home/certificate/index.js b/pages/home/certificate/index.js index b2ab5f7..5b429d6 100644 --- a/pages/home/certificate/index.js +++ b/pages/home/certificate/index.js @@ -1,6 +1,6 @@ // pages/home/authory/index.js import { ocrLicense, checkLicense } from "../../api/user" -import { updateUserInfo } from '../../api/ztb' +import { updateUserInfo, identifyEnterprise } from '../../api/ztb' const util = require('../../../utils/util') const app = getApp() @@ -14,11 +14,10 @@ Page({ form: { }, flag: false, // 是否不可以编辑, false:可编辑;true:不可编辑 disabled: true, - fileList: [], - imgList: [null] + fileList: [] }, onLoad: function (options) { - this.setData({ form: app.globalData.userInfo }) + this.setData({ safeBottom: app.globalData.safeBottom, form: app.globalData.userInfo }) }, bindForm: function (e) { // var form_data = 'form.' + e.target.id @@ -40,11 +39,11 @@ Page({ } }, submitForm: function () { - if (util.isEmpty(this.data.form.businessLicenseUrl)) { + if (util.isEmpty(this.data.form.businessLicenseImg)) { util.showToast('请上传营业执照') return } - if (util.isEmpty(this.data.form.enterpriseName)) { + if (util.isEmpty(this.data.form.name)) { util.showToast('请输入公司名称') return } @@ -57,12 +56,31 @@ Page({ return } wx.showLoading({ title: '处理中', mask: true }) - checkLicense(this.data.form).then(result => { + var params = {name: this.data.form.name} + params.uniformSocialCreditCode = this.data.form.uniformSocialCreditCode + params.legalPersonName = this.data.form.legalPersonName + params.packageFactoryArea = this.data.form.packageFactoryArea + params.shipmentPerMonth = this.data.form.shipmentPerMonth + params.numberOfFactoryEmployee = this.data.form.numberOfFactoryEmployee + params.numberOfFactoryPackageMachine = this.data.form.numberOfPackageMachine + params.locDetail = this.data.form.locDetail + params.experienceTag = this.data.form.experienceTag + params.businessLicenseImg = this.data.form.businessLicenseImg + + identifyEnterprise(params).then(result => { // 修改个人信息 - updateUserInfo(this.data.form).then(result => { + var data = { numberOfFactoryPackageMachine: this.data.form.numberOfFactoryPackageMachine } + data.numberOfFactoryEmployee = this.data.form.numberOfFactoryEmployee + data.shipmentPerMonth = this.data.form.shipmentPerMonth + data.packageFactoryArea = this.data.form.packageFactoryArea + data.experienceTag = this.data.form.experienceTag + updateUserInfo(data).then(result => { wx.hideLoading() if(!app.globalData.userInfo.isAuth){ + util.showToast('企业验证成功') wx.redirectTo({ url: '/pages/home/idcard/index' }) + } else { + util.showBackToast('企业验证成功') } }).catch(error => { wx.hideLoading() @@ -82,61 +100,21 @@ Page({ } }) if(list.length > 0){ - this.data.form['businessLicenseUrl'] = list[0] + this.data.form['businessLicenseImg'] = list[0] + wx.showLoading({ title: '识别中', mask: true }) ocrLicense({businessLicenseUrl: list[0]}).then(result => { this.setData({ - ['form.enterpriseName']: result.data.company, - ['form.uniformSocialCreditCode']: result.data.regNum, - ['form.legalPersonName']: result.data.legalPerson + ['form.name']: result.data.name, + ['form.uniformSocialCreditCode']: result.data.uniformSocialCreditCode, + ['form.legalPersonName']: result.data.legalPersonName, + ['form.locDetail']: result.data.locDetail, }) + wx.hideLoading() + }).catch(error => { + wx.hideLoading() + util.showToast(error) }) } } - }, - /*******************************************************图片上传************************************************************/ - chooseImage: function(e) { - if (this.data.flag) { - return - } - var index = e.currentTarget.dataset.index - var that = this - wx.chooseImage({ - count: 1, //默认9 - sizeType: ['original', 'compressed'], //可以指定是原图还是压缩图,默认二者都有 - sourceType: ['album', 'camera'], //从相册选择 - success: (res) => { - that.setData({ ['imgList[' + index + ']']: res.tempFilePaths[0] }) - const fileSystemManager = wx.getFileSystemManager() - var type = that.suffixImage(res.tempFilePaths[0]) - fileSystemManager.readFile({ - filePath: that.data.imgList[index], // 例如图片临时路径 - encoding: 'base64', - success(res) { - let { data } = res // 编码后的数据 - if(index == 0){ - that.data.form.frontImg = {base64: data, type} - - } - } - }) - } - }) - }, - suffixImage: function(path){ - return path.substring(path.lastIndexOf('.') + 1) - }, - viewImage: function(e) { - var urlList = [] - for (var i = 0; i < this.data.imgList.length; i++) { - if (!util.isEmpty(this.data.imgList[i])) { - urlList.push(this.data.imgList[i]) - } - } - wx.previewImage({ urls: urlList, current: e.currentTarget.dataset.url }) - }, - deleteImg: function(e) { - var index = e.currentTarget.dataset.index - this.data.imgList[index] = null; - this.setData({ imgList: this.data.imgList }) } }) \ No newline at end of file diff --git a/pages/home/certificate/index.wxml b/pages/home/certificate/index.wxml index 2f40892..bcde835 100644 --- a/pages/home/certificate/index.wxml +++ b/pages/home/certificate/index.wxml @@ -2,26 +2,26 @@ 企业认证 -公司信息 +公司信息 - *营业执照: + *请拍摄/上传营业执照: *公司名称: - + @@ -69,9 +69,11 @@ - - - 提交认证 + + + + 提交认证 + \ No newline at end of file diff --git a/pages/index/index.js b/pages/index/index.js index 994d4d5..67609b1 100644 --- a/pages/index/index.js +++ b/pages/index/index.js @@ -30,7 +30,7 @@ Page({ } event.on('EventMessage', this, this.onEvent) this.data.inited = true - wx.showLoading({ title: '获取中', mask: true }) + wx.showLoading({ title: '加载中', mask: true }) const fheght = (app.globalData.safeFragmentHeight + app.globalData.statusBarHeight) - 100 this.setData({ fragment: fheght, safeBottom: app.globalData.safeBottom }) var authorization = app.globalData.token || storage.get('Authorization')