Browse Source

no message

featrue/v4.5
xpz2018 4 years ago
parent
commit
10075d149a
6 changed files with 59 additions and 75 deletions
  1. 10
      pages/agent/address/index.js
  2. 6
      pages/agent/address/index.wxml
  3. 6
      pages/api/ztb.js
  4. 94
      pages/home/certificate/index.js
  5. 16
      pages/home/certificate/index.wxml
  6. 2
      pages/index/index.js

10
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()

6
pages/agent/address/index.wxml

@ -12,7 +12,7 @@
</view>
<view class="cu-form-group">
<view class="title" style="min-width: 200rpx;">工厂全称:</view>
<input id="packageFactoryName" placeholder-style="color:#aaa" placeholder="请输入工厂全称" bindinput="bindInput"></input>
<input id="packageFactoryName" placeholder-style="color:#aaa" value="{{form.packageFactoryName}}" placeholder="请输入工厂全称" bindinput="bindInput"></input>
</view>
<view class="cu-form-group" data-index="1" style="border-top: 1px solid #f3f3f3" bindtap="showRegion">
<view class="flex text-sg">
@ -23,11 +23,11 @@
</view>
<view class="cu-form-group" style="border-top: 1rpx solid #f3f3f3">
<view class="title" style="min-width: 200rpx;">详细地址:</view>
<input id="locateDetails" placeholder-style="color:#aaa" placeholder="请输入详细地址" value="{{form.details}}" bindinput="bindInput"></input>
<input id="locDetail" placeholder-style="color:#aaa" placeholder="请输入详细地址" value="{{form.locDetail}}" bindinput="bindInput"></input>
</view>
<view class="cu-form-group">
<view class="title" style="min-width: 200rpx;">发货人姓名:</view>
<input id="consignor" placeholder-style="color:#aaa" placeholder="请输入发货人姓名" value="{{form.phone}}" bindinput="bindInput"></input>
<input id="consignor" placeholder-style="color:#aaa" placeholder="请输入发货人姓名" value="{{form.consignor}}" bindinput="bindInput"></input>
</view>
<view class="cu-bar bg-white foot" style="height:{{120 + safeBottom}}rpx;padding: 32rpx 32rpx {{safeBottom + 32}}rpx 32rpx;">

6
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
}

94
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 })
}
})

16
pages/home/certificate/index.wxml

@ -2,26 +2,26 @@
<cu-custom bgColor="bg-white" isBack="{{true}}">
<view slot="content">企业认证</view>
</cu-custom>
<view class="text-sg text-gray" style="padding: 18rpx 32rpx;">公司信息</view>
<view class="text-sg text-gray" style="padding: 12rpx 32rpx;">公司信息</view>
<view class="cu-list menu no-card sm-border">
<!-- <view class="cu-item">
<view class="flex content cu-item" style="font-size:28rpx;padding: 32rpx 0rpx">
<view style="min-width:200rpx"><text class="text-red must">*</text>营业执照:</view>
<view style="height: 180rpx;border: 1rpx solid #f3f3f3;flex: 1;justify-content: flex-start;">
<wux-uploader count="1" column="3" fileList="{{fileList}}" bindcustomevent="onImageChange"></wux-uploader>
<view class="md-hint" style="margin-left: 24rpx;">点击上传</view>
</view>
<view class="md-hint" style="margin-left: 24rpx;">点击上传</view>
</view>
</view> -->
<view class="bg-white" style="display:block">
<view class="flex text-sg" style="padding: 18rpx 30rpx 0rpx 30rpx"><text class="text-red" style="font-size: 28px">*</text>营业执照:</view>
<view class="flex text-sg" style="padding: 18rpx 30rpx 0rpx 30rpx"><text class="text-red" style="font-size: 28px">*</text>请拍摄/上传营业执照:</view>
<wux-uploader count="1" column="4" fileList="{{fileList}}" bindcustomevent="onImageChange"></wux-uploader>
<view style="padding: 0rpx 30rpx"><view style="border-top: 1rpx solid #f3f3f3;"></view></view>
</view>
<view class="cu-item">
<view class="flex content cu-item" style="font-size:28rpx">
<view style="min-width:200rpx"><text class="text-red must">*</text>公司名称:</view>
<input id="enterpriseName" maxlength="8" value="{{form.enterpriseName}}" class="inputs" placeholder="请输入公司名称" bindinput="bindForm"></input>
<input id="name" value="{{form.name}}" class="inputs" placeholder="请输入公司名称" bindinput="bindForm"></input>
</view>
</view>
<view class="cu-item">
@ -69,9 +69,11 @@
<text class="cuIcon-right text-gray"></text>
</view>
</view>
<view class="flex flex-direction" style="padding: 32rpx">
<wux-button block type="positive" bind:click="submitForm">提交认证</wux-button>
<view style="height:{{136 + safeBottom}}rpx;"></view>
<view class="cu-bar bg-white foot" style="height:{{120 + safeBottom}}rpx;padding: 32rpx 32rpx {{safeBottom + 32}}rpx 32rpx;">
<view style="width:100%">
<wux-button block type="positive" bind:click="submitForm" disabled="{{requesting}}">提交认证</wux-button>
</view>
</view>
<picker-view id="picker-view" bindcustomevent="onPickerChange"></picker-view>

2
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')

Loading…
Cancel
Save