Browse Source

no message

featrue/v4.5
xpz2018 4 years ago
parent
commit
a042def027
9 changed files with 312 additions and 36 deletions
  1. 33
      app.js
  2. 1
      app.json
  3. 29
      pages/agent/address/index.js
  4. 5
      pages/agent/address/index.wxml
  5. 101
      pages/home/certificate/index.js
  6. 6
      pages/home/certificate/index.json
  7. 103
      pages/home/certificate/index.wxml
  8. 64
      pages/home/certificate/index.wxss
  9. 6
      project.config.json

33
app.js

@ -14,15 +14,30 @@ App({
kg: 0 kg: 0
}, },
onShow: function() { onShow: function() {
const updateManager = wx.getUpdateManager()
updateManager.onCheckForUpdate(function (res) {
// 请求完新版本信息的回调
// console.log('updateManager>>>' + res.hasUpdate)
})
updateManager.onUpdateReady(function () {
// 新的版本已经下载好,调用 applyUpdate 应用新版本并重启
updateManager.applyUpdate()
})
if (wx.canIUse('getUpdateManager')) {
const updateManager = wx.getUpdateManager()
updateManager.onCheckForUpdate(function (res) {
// 请求完新版本信息的回调
if (res.hasUpdate) {
updateManager.onUpdateReady(function () {
// 新的版本已经下载好,调用 applyUpdate 应用新版本并重启
updateManager.applyUpdate()
})
updateManager.onUpdateFailed(function () {
// 新版本下载失败
wx.showModal({
title: '已有新版本',
content: '请您删除小程序,重新搜索进入',
})
})
}
})
} else {
wx.showModal({
title: '溫馨提示',
content: '当前微信版本过低,无法使用该功能,请升级到最新微信版本后重试。'
})
}
if(this.globalData.Custom){ if(this.globalData.Custom){
return return
} }

1
app.json

@ -8,6 +8,7 @@
"pages/home/password/index", "pages/home/password/index",
"pages/home/setting/index", "pages/home/setting/index",
"pages/home/authory/index", "pages/home/authory/index",
"pages/home/certificate/index",
"pages/home/idcard/index", "pages/home/idcard/index",
"pages/home/info/index", "pages/home/info/index",
"pages/home/tab1/index", "pages/home/tab1/index",

29
pages/agent/address/index.js

@ -16,7 +16,6 @@ Page({
receiver:'', receiver:'',
phone:'', phone:'',
details:'', details:'',
isDefault:'',
locProvinceId: '', locProvinceId: '',
locCityId: '', locCityId: '',
districtId: '' districtId: ''
@ -27,24 +26,18 @@ Page({
* 生命周期函数--监听页面加载 * 生命周期函数--监听页面加载
*/ */
onLoad: function (options) { onLoad: function (options) {
this.cascaderView = this.cascaderView || this.selectComponent('#wux-cascader')
this.setData({ safeBottom: app.globalData.safeBottom }) this.setData({ safeBottom: app.globalData.safeBottom })
}, },
bindinput: function(e){
bindInput: function(e){
this.data.form[e.target.id] = e.detail.value this.data.form[e.target.id] = e.detail.value
}, },
showRegion: function(){ showRegion: function(){
if(this.data.disabled){
return
}
this.cascaderView = this.cascaderView || this.selectComponent('#wux-cascader')
this.cascaderView.showPicker(this.data.region) this.cascaderView.showPicker(this.data.region)
}, },
onRegionChange: function (e) { onRegionChange: function (e) {
if (e.detail && e.detail.options) { if (e.detail && e.detail.options) {
this.setData({
['form.areaStr']: e.detail.options.map((n) => n.label).join(' '),
region: e.detail.value
})
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['locProvinceId'] = e.detail.value[0]
this.data.form['locCityId'] = e.detail.value[1] this.data.form['locCityId'] = e.detail.value[1]
this.data.form['districtId'] = e.detail.value[2] this.data.form['districtId'] = e.detail.value[2]
@ -52,25 +45,21 @@ Page({
}, },
submitForm: function(){ submitForm: function(){
if(util.isEmpty(this.data.form.receiver)){ if(util.isEmpty(this.data.form.receiver)){
util.showToast('请输入收货人')
return
}
if(util.isEmpty(this.data.form.phone)){
util.showToast('请输入手机号')
util.showToast('请输入工厂全称')
return return
} }
if(util.isEmpty(this.data.form.districtId)){ if(util.isEmpty(this.data.form.districtId)){
util.showToast('请选择店铺所在区域')
util.showToast('请选择所在区域')
return return
} }
if(util.isEmpty(this.data.form.details)){ if(util.isEmpty(this.data.form.details)){
util.showToast('请输入店铺详细地址')
util.showToast('请输入详细地址')
return return
} }
if(util.isEmpty(this.data.form.isDefault)){
util.showToast('请确定是否默认')
if(util.isEmpty(this.data.form.phone)){
util.showToast('请输入发货人姓名')
return return
}
}
wx.showLoading({ title: '处理中', mask: true }) wx.showLoading({ title: '处理中', mask: true })
createAddress(this.data.form).then(res => { createAddress(this.data.form).then(res => {
wx.hideLoading() wx.hideLoading()

5
pages/agent/address/index.wxml

@ -15,14 +15,13 @@
</view> </view>
<view class="cu-form-group" style="border-top: 1rpx solid #f3f3f3"> <view class="cu-form-group" style="border-top: 1rpx solid #f3f3f3">
<view class="title">详细地址:</view> <view class="title">详细地址:</view>
<input id="details" placeholder-style="color:#aaa" placeholder="请输入详细地址" value="{{form.details}}" bindinput="bindinput"></input>
<input id="details" placeholder-style="color:#aaa" placeholder="请输入详细地址" value="{{form.details}}" bindinput="bindInput"></input>
</view> </view>
<view class="cu-form-group"> <view class="cu-form-group">
<view class="title">发货人姓名:</view> <view class="title">发货人姓名:</view>
<input id="phone" placeholder-style="color:#aaa" placeholder="请输入发货人姓名" value="{{form.phone}}" bindinput="bindinput"></input>
<input id="phone" placeholder-style="color:#aaa" placeholder="请输入发货人姓名" value="{{form.phone}}" bindinput="bindInput"></input>
</view> </view>
<view class="cu-bar bg-white foot" style="height:{{120 + safeBottom}}rpx;padding: 32rpx 32rpx {{safeBottom + 32}}rpx 32rpx;"> <view class="cu-bar bg-white foot" style="height:{{120 + safeBottom}}rpx;padding: 32rpx 32rpx {{safeBottom + 32}}rpx 32rpx;">
<view style="width:100%"> <view style="width:100%">
<wux-button block type="positive" bind:click="submitForm" disabled="{{requesting}}">提交</wux-button> <wux-button block type="positive" bind:click="submitForm" disabled="{{requesting}}">提交</wux-button>

101
pages/home/certificate/index.js

@ -0,0 +1,101 @@
// pages/home/authory/index.js
import { getAuthSession, certificateImage } from "../../api/user"
const util = require('../../../utils/util')
const event = require('../../../utils/event.js')
Page({
/**
* 页面的初始数据
*/
data: {
form: { identityAuthToken: null },
flag: false, // 是否不可以编辑, false:可编辑;true:不可编辑
imgList: [null, null]
},
onLoad: function (options) {
event.on('EventMessage', this, this.onEvent)
wx.showLoading({ title: '加载中', mask: true })
getAuthSession().then(result => {
wx.hideLoading()
this.data.form.identityAuthToken = result.data.token
}).catch(error => {
wx.hideLoading()
})
},
onEvent: function (message) {
if (message.what == 82) {
wx.navigateBack()
}
},
submitForm: function () {
if (util.isEmpty(this.data.form.frontImg)) {
util.showToast('请上传身份证正面照片')
return
}
if (util.isEmpty(this.data.form.backImg)) {
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' })
}).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}
} else {
that.data.form.backImg = {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 })
},
onUnload: function () {
event.remove('EventMessage', this)
}
})

6
pages/home/certificate/index.json

@ -0,0 +1,6 @@
{
"usingComponents": {
"picker-view": "/components/picker-view/index",
"wux-button": "/components/button/index"
}
}

103
pages/home/certificate/index.wxml

@ -0,0 +1,103 @@
<!--pages/home/authory/index.wxml-->
<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="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>
<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" 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" type="idcard" bindblur="inputBlur" 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 maxlength="8" value="{{form.realName}}" disabled="{{disabled}}" 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 maxlength="8" value="{{form.realName}}" disabled="{{disabled}}" 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 maxlength="8" value="{{form.realName}}" disabled="{{disabled}}" 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 maxlength="8" value="{{form.realName}}" disabled="{{disabled}}" 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 maxlength="8" value="{{form.realName}}" disabled="{{disabled}}" style="width:65%" placeholder="请选择从业年限" bindinput="bindForm"></input>
</view>
</view>
</view>
<view class="cu-bar bg-white margin-top" style="min-height:90rpx">
<view class="action" style="color:#333333"><text class="text-red must">*</text>请拍摄/上传本人身份证(国徽面)</view>
</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="1" wx:if="{{!imgList[1]}}">
<!-- <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/5f34a45714195aa5942df939.png"></image>
</view>
<view class="image-reader-item" bindtap="viewImage" data-url="{{imgList[1]}}" wx:else>
<image style="width:100%;height: 400rpx" src="{{imgList[1]}}" mode="aspectFill"></image>
<view class="delete" catchtap="deleteImg" data-index="1" wx:if="{{!flag}}">
<text class="cuIcon-close {{pathList[1].status===-1?'text-red':'text-white'}}"></text>
</view>
<!-- <view class="md-load load-spinner text-white" wx:if="{{pathList[1].status===1}}"/> -->
</view>
</view>
<view class="cu-item">
<view class="flex content cu-item" style="font-size:28rpx">
<view style="min-width:200rpx">真实姓名:</view>
<input maxlength="8" value="{{form.realName}}" disabled="{{disabled}}" 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 disabled="{{disabled}}" value="{{form.certificateNo}}" style="width:65%" type="idcard" bindblur="inputBlur" placeholder="请输入身份证号码" bindinput="bindForm"></input>
</view>
</view>
</view>
<view class="flex flex-direction" style="padding: 32rpx">
<wux-button block type="positive" bind:click="submitForm">提交认证</wux-button>
</view>
<picker-view id="picker-view" bindcustomevent="onPickerChange"></picker-view>

64
pages/home/certificate/index.wxss

@ -0,0 +1,64 @@
/* pages/home/authory/index.wxss */
.margin-top {
margin-top: 18rpx
}
.image-reader-item {
position: relative;
width: 99%;
height: 400rpx;
background-color: #f8f8f8;
box-sizing: border-box;
list-style: none;
background-size: cover;
border-radius: 6rpx;
}
.image-reader-item .md-icon {
position: absolute;
top: 45%;
left: 50%;
transform: translate(-50%, -50%);
opacity: 0.5;
}
.image-reader-item .md-load {
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
}
.image-reader-item .md-hint {
position: absolute;
top: 50%;
left: 0;
width: 100%;
margin-top: 10px;
font-size: 12px;
color: #bababa;
text-align: center;
}
.image-reader-item .delete {
position: absolute;
top: 0px;
right: 0px;
opacity: 0.8;
border-top-right-radius: 6rpx;
border-bottom-left-radius: 8rpx;
padding: 6rpx 12rpx;
height: auto;
background-color: rgba(0, 0, 0, 0.5);
}
.inputs{
width: 65%;
height: 36px;
padding: 10px 0px;
}
.must{
padding-top: 14px;
font-size: 28px;
}

6
project.config.json

@ -30,14 +30,12 @@
"outputPath": "" "outputPath": ""
}, },
"enableEngineNative": false, "enableEngineNative": false,
"bundle": false,
"useIsolateContext": true, "useIsolateContext": true,
"useCompilerModule": true,
"userConfirmedUseCompilerModuleSwitch": true,
"userConfirmedBundleSwitch": false, "userConfirmedBundleSwitch": false,
"packNpmManually": false, "packNpmManually": false,
"packNpmRelationList": [], "packNpmRelationList": [],
"minifyWXSS": true
"minifyWXSS": true,
"showES6CompileOption": false
}, },
"compileType": "miniprogram", "compileType": "miniprogram",
"libVersion": "2.18.1", "libVersion": "2.18.1",

Loading…
Cancel
Save