// pages/main/commercial application/commercial applicantion.js
let merchantName, terminal, address, person, phone, CheckInDate, BusinessLicense, IdentityCardFront, IdentityCardBack
let commercialForm = {}
commercialForm.merchantType = 2
var pages = getCurrentPages();
var currPage = pages[pages.length - 1]; //当前页面
var beforePage = pages[pages.length - 2]; //前一页
Page({
//获取输入框数据
//商家名称
getName(event) {
merchantName = event.detail.value
commercialForm.merchantName = merchantName
console.log(event.detail.value)
},
//详细地址
getAddress(event) {
address = event.detail.value
commercialForm.detailedAddress = address
console.log(event.detail.value)
},
//联系人
getPerson(event) {
person = event.detail.value
commercialForm.contactPerson = person
console.log(event.detail.value)
},
//联系电话
getPhone(event) {
phone = event.detail.value
commercialForm.telephone = phone
console.log(event.detail.value)
},
//营业执照
//图片转base64
getBusinessLicense: function (e) {
var that = this;
wx.chooseImage({
count: 1,
sizeType: ['compressed'],
sourceType: ['album', 'camera'],
success: res => {
var size = res.tempFiles[0].size;
console.log(size)
if (size <= 1 * 1024 * 1024) { //设置图片大小不超过2M
that.setData({
['tempFilePaths[' + e.target.id + ']']: res.tempFilePaths[0]
})
wx.getFileSystemManager().readFile({
filePath: res.tempFilePaths[0], //选择图片返回的相对路径
encoding: 'base64', //编码格式
success: res => { //成功的回调
// console.log('data:image/png;base64,' + res.data)
console.log('======================================')
BusinessLicense = res.data
commercialForm.businessLicense = BusinessLicense
// console.log(BusinessLicense)
}
})
//以下两行注释的是同步方法
//let base64 = wx.getFileSystemManager().readFileSync(res.tempFilePaths[0], 'base64')
//console.log(base64)
} else {
wx.showToast({
duration: 1000, //显示时长
title: '图片不能大于1M',
icon: 'error'
})
}
}
})
},
//法人身份证正面
getIdentityCardFront: function (e) {
var that = this;
wx.chooseImage({
count: 1,
sizeType: ['original', 'compressed'],
sourceType: ['album', 'camera'],
success: res => {
var size = res.tempFiles[0].size;
console.log(size)
if (size <= 1 * 1024 * 1024) { //设置图片大小不超过2M
that.setData({
['tempFilePaths[' + e.target.id + ']']: res.tempFilePaths[0]
})
wx.getFileSystemManager().readFile({
filePath: res.tempFilePaths[0], //选择图片返回的相对路径
encoding: 'base64', //编码格式
success: res => { //成功的回调
// console.log('data:image/png;base64,' + res.data)
console.log('======================================')
IdentityCardFront = res.data
commercialForm.identityCardFront = IdentityCardFront
}
})
} else {
wx.showToast({
duration: 1000, //显示时长
title: '图片不能大于1M',
icon: 'error'
})
}
}
})
},
//法人身份证反面
getIdentityCardBack: function (e) {
var that = this;
wx.chooseImage({
count: 1,
sizeType: ['original', 'compressed'],
sourceType: ['album', 'camera'],
success: res => {
var size = res.tempFiles[0].size;
console.log(size)
if (size <= 1 * 1024 * 1024) { //设置图片大小不超过2M
that.setData({
['tempFilePaths[' + e.target.id + ']']: res.tempFilePaths[0]
})
wx.getFileSystemManager().readFile({
filePath: res.tempFilePaths[0], //选择图片返回的相对路径
encoding: 'base64', //编码格式
success: res => { //成功的回调
// console.log('data:image/png;base64,' + res.data)
console.log('======================================')
IdentityCardBack = res.data
commercialForm.identityCardBack = IdentityCardBack
}
})
} else {
wx.showToast({
duration: 1000, //显示时长
title: '图片不能大于1M',
icon: 'error'
})
}
}
})
},
add() {
this.setData({
disable: true
})
console.log(commercialForm)
let that = this
commercialForm.openId = wx.getStorageSync('openId')
wx.request({
url: 'https://cj.zhouwx.com:8443/wx/addNewApproval',
method: 'POST',
header: {
"content-type": "application/json"
},
data: commercialForm,
success: res => {
console.log("成功", res)
that.setData({
result: res.data
})
// if (res.data != null) {
if (res.data.code === 200) {
this.setData({
disable: true
})
wx.showToast({
duration: 1000, //显示时长
mask: true,
icon: 'success',
title: '提交成功',
success: function () {
setTimeout(function () {
wx.navigateBack({
delta: 1,
})
}, 900)
}
})
} else {
wx.showToast({
icon: "error",
title: '信息不完整',
duration: 1000, //显示时长
})
this.setData({
disable: false
})
}
},
fail(res) {
console.log("失败", res)
}
})
},
/**
* 页面的初始数据
*/
data: {
disable: false,
type: "",
number: "",
date: "",
BusinessLicense: "",
IdentityCardFront: "",
IdentityCardBack: "",
},
changeDate: function (e) {
this.setData({
date: e.detail.value
})
CheckInDate = this.data.date
commercialForm.checkInDate = CheckInDate
console.log(CheckInDate)
},
terminalChange: function (e) {
let that = this;
wx.showActionSheet({
itemList: ['T1航站楼', 'T2航站楼', 'T3航站楼'],
success: function (res) {
if (res.tapIndex == 0) {
that.setData({
["model.terminal"]: 0,
})
commercialForm.terminal = 1
}
if (res.tapIndex == 1) {
that.setData({
["model.terminal"]: 1,
})
commercialForm.terminal = 2
}
if (res.tapIndex == 2) {
that.setData({
["model.terminal"]: 2,
})
commercialForm.terminal = 3
}
console.log("terminal:" + commercialForm.terminal)
}
})
},
// number: function (e) {
// let value = this.validateNumber(e.detail.value)
// console.log(e.detail.value)
// this.setData({
// //parseInt将数字字符串转换成数字
// number: parseInt(value)
// })
// },
/**
* 用户点击右上角分享
*/
onShareAppMessage: function () {
},
/**
* 生命周期函数--监听页面加载
*/
//加载页面显示
onLoad: function (options) {
commercialForm = {}
commercialForm.merchantType = 2
},
})
没有合适的资源?快使用搜索试试~ 我知道了~
微信小程序代码示例展示缴费
共89个文件
png:32个
json:14个
js:13个
需积分: 43 3 下载量 154 浏览量
2022-03-25
18:53:27
上传
评论
收藏 544KB ZIP 举报
温馨提示
小程序代码
资源详情
资源评论
资源推荐
收起资源包目录
kaya-4-2022-2-28.zip (89个子文件)
kaya-4-2022-2-28
app.js 364B
project.private.config.json 320B
resources
photo1.jpg 25KB
3-NoSystem.png 46KB
plane2.jpg 16KB
homepage.png 8KB
arrow.png 4KB
2-NoNetwork.png 46KB
idcardfrot.png 35KB
topay.png 9KB
BusinessLicense.png 5KB
down.png 3KB
load.png 4KB
photo3.jpg 34KB
arrowgray.png 4KB
delete.png 6KB
1-NoMessage.png 44KB
toapply1.png 4KB
myself.png 7KB
idcardback.png 10KB
triangle.png 5KB
photo2.jpg 14KB
date.png 4KB
toapply2.png 9KB
testimg.jpg 6KB
plane1.jpg 26KB
img
photo1.jpg 25KB
homepage.png 8KB
topay.png 9KB
myself_select.png 4KB
down.png 3KB
load.png 4KB
photo3.jpg 34KB
arrowgray.png 4KB
delete.png 6KB
homepage_select.png 3KB
myself.png 7KB
triangle.png 5KB
photo2.jpg 14KB
date.png 4KB
sign.png 4KB
sign.png 4KB
back.png 16KB
project.config.json 2KB
utils
util.js 460B
.eslintrc.js 587B
sitemap.json 191B
pages
pay
pay.json 114B
pay.js 7KB
pay.wxml 3KB
pay.wxss 2KB
netBill
netBill.js 929B
netBill.wxss 646B
netBill.json 71B
netBill.wxml 226B
individual application
individual application.wxss 2KB
individual application.wxml 4KB
individual application.json 120B
individual application.js 6KB
commercial application
commercial applicantion.wxml 5KB
commercial applicantion.js 7KB
commercial applicantion.json 122B
commercial applicantion.wxss 2KB
index
index.wxml 2KB
index.js 7KB
index.wxss 1KB
index.json 108B
record
record.wxss 2KB
record.wxml 2KB
record.json 114B
record.js 3KB
homepage
homepage.json 108B
homepage.wxss 4KB
homepage.js 2KB
homepage.wxml 1KB
applybill
applybill.json 114B
applybill.js 4KB
applybill.wxml 2KB
applybill.wxss 2KB
request
request.js 556B
request.wxml 339B
request.json 114B
request.wxss 536B
myuse
myuse.wxss 2KB
myuse.wxml 2KB
myuse.json 120B
myuse.js 2KB
app.json 1KB
app.wxss 194B
共 89 条
- 1
编程five
- 粉丝: 22
- 资源: 6
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
最新资源
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功
评论0