Browse Source

no message

featrue/v4.5
xpz2018 4 years ago
parent
commit
e46c61eb4a
11 changed files with 133 additions and 62 deletions
  1. 27
      pages/agent/address/index.js
  2. 4
      pages/agent/address/index.wxml
  3. 21
      pages/agent/edit/index.js
  4. 2
      pages/agent/edit/index.wxml
  5. 6
      pages/api/user.js
  6. 62
      pages/home/certificate/index.js
  7. 3
      pages/home/certificate/index.json
  8. 54
      pages/home/certificate/index.wxml
  9. 12
      pages/home/certificate/index.wxss
  10. 2
      pages/home/index/index.js
  11. 2
      pages/home/index/index.wxml

27
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

4
pages/agent/address/index.wxml

@ -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="companyAddress" placeholder-style="color:#aaa" placeholder="请输入详细地址" value="{{form.details}}" bindinput="bindInput"></input>
<input id="locateDetails" placeholder-style="color:#aaa" placeholder="请输入详细地址" value="{{form.details}}" bindinput="bindInput"></input>
</view>
<view class="cu-form-group">
<view class="title" style="min-width: 200rpx;">发货人姓名:</view>
<input id="phone" placeholder-style="color:#aaa" placeholder="请输入发货人姓名" value="{{form.phone}}" bindinput="bindInput"></input>
<input id="consignor" placeholder-style="color:#aaa" placeholder="请输入发货人姓名" value="{{form.phone}}" bindinput="bindInput"></input>
</view>
<view class="cu-bar bg-white foot" style="height:{{120 + safeBottom}}rpx;padding: 32rpx 32rpx {{safeBottom + 32}}rpx 32rpx;">

21
pages/agent/edit/index.js

@ -28,6 +28,7 @@ Page({
plateString: '',
vindex: -1,
picking: false,
hasShipmentsInfo: false,
requesting: false
},
/**
@ -85,7 +86,8 @@ Page({
factoryDetail: result.data,
cateName: this.data.cateName,
form: this.data.form,
safeBottom: app.globalData.safeBottom
safeBottom: app.globalData.safeBottom,
hasShipmentsInfo: app.globalData.userInfo.hasShipmentsInfo
})
wx.hideLoading()
}).catch(err => {
@ -234,8 +236,7 @@ Page({
var events = {}
events.onCallback = function(data){
if (data.what == 1030) {
// that.data.form.factoryCustomerId = data.detail.id
// that.setData({ ['form.factoryCustomerName']: data.detail.name })
that.setData({ hasShipmentsInfo: app.globalData.userInfo.hasShipmentsInfo })
}
}
wx.navigateTo({url: `/pages/agent/address/index`, events})
@ -293,6 +294,20 @@ Page({
util.showToast('请选择货到时间')
return
}
if(!this.data.hasShipmentsInfo){
this.wuxDialog = this.wuxDialog || this.selectComponent('#wux-dialog')
var that = this
this.wuxDialog.open({
resetOnClose: true,
title: '温馨提示',
content: '您还没填写发货信息,请填写发货信息。',
buttons: [
{ text: '取消' },
{ text: '确定', type: 'primary', onTap(e) { that.editAddress() }
}]
})
return
}
var vehicleList = []
for (let index = 0; index < this.data.vehicleList.length; index++) {
const element = this.data.vehicleList[index]

2
pages/agent/edit/index.wxml

@ -56,7 +56,7 @@
</view>
<text class="cuIcon-right text-gray" wx:if="{{!flag}}" style="font-size:32rpx;padding-top:2rpx"></text>
</view>
<view class="cu-item" style="border-bottom: 0rpx solid #ddd" bindtap="editAddress">
<view class="cu-item" style="border-bottom: 0rpx solid #ddd" bindtap="editAddress" wx:if="{{!hasShipmentsInfo}}">
<view class="flex flex-justify content cu-item arrow">
<view class="text-sg" style="min-width:170rpx">发货信息:</view>
<view class="flex" style="text-align:left">

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

62
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) {

3
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"
}
}

54
pages/home/certificate/index.wxml

@ -2,65 +2,69 @@
<cu-custom bgColor="bg-white" isBack="{{true}}">
<view slot="content">企业认证</view>
</cu-custom>
<view class="cu-bar bg-white" style="min-height:90rpx">
<view class="action" style="color:#333333"><text class="text-red must">*</text>请拍摄/上传营业执照</view>
</view>
<view class="text-sg text-gray" style="padding: 18rpx 32rpx;">公司信息</view>
<view class="cu-list menu no-card sm-border">
<view class="cu-item" style="width:100%;padding-bottom:30rpx">
<view class="image-reader-item" bindtap="chooseImage" data-index="0" wx:if="{{!imgList[0]}}">
<!-- <text class="cuIcon-cameraadd md-icon" style="font-size:50rpx" wx:if="{{!flag}}"></text>
<text class="md-hint" wx:if="{{!flag}}">身份证正面</text> -->
<image style="width:100%;height:400rpx" mode="aspectFill" src="https://pic.downk.cc/item/5f34a45714195aa5942df93b.png"></image>
</view>
<view class="image-reader-item" bindtap="viewImage" data-url="{{imgList[0]}}" wx:else>
<image style="width:100%;height: 400rpx" src="{{imgList[0]}}" mode="aspectFill"></image>
<view class="delete" catchtap="deleteImg" data-index="0" wx:if="{{!flag}}">
<text class="cuIcon-close {{pathList[0].status===-1?'text-red':'text-white'}}"></text>
</view>
</view>
<!-- <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>
<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>
<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 maxlength="8" value="{{form.realName}}" class="inputs" disabled="{{disabled}}" placeholder="请输入公司名称" bindinput="bindForm"></input>
<input id="enterpriseName" maxlength="8" value="{{form.enterpriseName}}" class="inputs" placeholder="请输入公司名称" bindinput="bindForm"></input>
</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 value="{{form.certificateNo}}" class="inputs" disabled="{{disabled}}" placeholder="请输社会入统一信用代码" bindinput="bindForm"></input>
<input id="uniformSocialCreditCode" value="{{form.uniformSocialCreditCode}}" class="inputs" placeholder="请输社会入统一信用代码" bindinput="bindForm"></input>
</view>
</view>
<view class="cu-item">
<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="legalPersonName" value="{{form.legalPersonName}}" class="inputs" placeholder="请输法人姓名" bindinput="bindForm"></input>
</view>
</view>
<view class="cu-item margin-top">
<view class="flex content cu-item" style="font-size:28rpx">
<view style="min-width:200rpx">工厂占地面积:</view>
<input id="packageFactoryArea" maxlength="8" value="{{form.realName}}" style="width:65%" placeholder="请输入工厂占地面积(㎡)" bindinput="bindForm"></input>
<input id="packageFactoryArea" maxlength="8" type="digit" value="{{form.packageFactoryArea}}" style="width:65%" placeholder="请输入工厂占地面积(㎡)" bindinput="bindForm"></input>
</view>
</view>
<view class="cu-item">
<view class="flex content cu-item" style="font-size:28rpx">
<view style="min-width:200rpx">工厂人数:</view>
<input id="numberOfEmployee" maxlength="8" value="{{form.realName}}" style="width:65%" placeholder="请输入工厂人数" bindinput="bindForm"></input>
<input id="numberOfEmployee" maxlength="8" type="number" value="{{form.numberOfEmployee}}" style="width:65%" placeholder="请输入工厂人数" bindinput="bindForm"></input>
</view>
</view>
<view class="cu-item">
<view class="flex content cu-item" style="font-size:28rpx">
<view style="min-width:200rpx">工厂打包机数:</view>
<input id="numberOfPackageMachine" maxlength="8" value="{{form.realName}}" style="width:65%" placeholder="请输入工厂打包机数" bindinput="bindForm"></input>
<input id="numberOfPackageMachine" maxlength="8" type="number" value="{{form.numberOfPackageMachine}}" style="width:65%" placeholder="请输入工厂打包机数" bindinput="bindForm"></input>
</view>
</view>
<view id="shipmentPerMonth" class="cu-item" bindtap="showPicker">
<view id="shipmentPerMonth" class="cu-item margin-top" bindtap="showPicker">
<view class="flex content cu-item" style="font-size:28rpx">
<view style="min-width:200rpx">月出货量:</view>
<input maxlength="8" value="{{form.shipmentPerMonth}}" disabled style="width:65%" placeholder="请选择月出货量" bindinput="bindForm"></input>
<input maxlength="8" value="{{form.shipmentPerMonth}}" disabled style="width:65%" placeholder="请选择月出货量"></input>
</view>
<text class="cuIcon-right text-gray"></text>
</view>
<view id="experienceTag" class="cu-item" bindtap="showPicker">
<view class="flex content cu-item" style="font-size:28rpx">
<view style="min-width:200rpx">从业经验:</view>
<input maxlength="8" value="{{form.experienceTag}}" disabled style="width:65%" placeholder="请选择从业年限" bindinput="bindForm"></input>
<input maxlength="8" value="{{form.experienceTag}}" disabled style="width:65%" placeholder="请选择从业年限"></input>
</view>
<text class="cuIcon-right text-gray"></text>
</view>

12
pages/home/certificate/index.wxss

@ -5,15 +5,18 @@
.image-reader-item {
position: relative;
width: 99%;
height: 400rpx;
background-color: #f8f8f8;
width: 120rpx;
height: 120rpx;
box-sizing: border-box;
list-style: none;
background-size: cover;
border-radius: 6rpx;
}
.tspan{
width: 120rpx;height:120rpx;border: 1rpx solid #f3f3f3;margin-left: 24rpx;
}
.image-reader-item .md-icon {
position: absolute;
top: 45%;
@ -45,9 +48,8 @@
top: 0px;
right: 0px;
opacity: 0.8;
border-top-right-radius: 6rpx;
border-bottom-left-radius: 8rpx;
padding: 6rpx 12rpx;
padding: 0rpx 6rpx;
height: auto;
background-color: rgba(0, 0, 0, 0.5);
}

2
pages/home/index/index.js

@ -172,7 +172,7 @@ Component({
if (app.globalData.userInfo.isAuth != 1) {
wx.navigateTo({ url: '/pages/home/idcard/index' })
} else {
wx.navigateTo({ url: '/pages/home/info/index' })
wx.navigateTo({ url: '/pages/home/certificate/index' })
}
},
toAuthor: function () {

2
pages/home/index/index.wxml

@ -4,7 +4,7 @@
<view class="topArea">
<view class="heradImg" style="top:{{CustomBar + 32}}rpx">
<wux-image width="{{78}}" height="{{78}}" wux-class="image" shape="circle" src="{{avatarUrl}}" bindtap="toUserInfo">
<image style="width:156rpx;height:156rpx;border-radio:30px" slot="loading" src="/assets/myinfo/user-icon.png"></image>
<image style="width:156rpx;height:156rpx;border-radius:30px" slot="loading" src="/assets/myinfo/user-icon.png"></image>
</wux-image>
<view class="topText" bindtap="toUserInfo">
<view wx:if="{{userInfo}}" style="height:158rpx">

Loading…
Cancel
Save