123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256 |
- const app = getApp();
- Page({
- data: {
- xszzyImages:'/image/vehicle1.png',
- xszzyImagesNum: false, //上传图标 显示
- // xszzyimg: true, //上传图片 隐藏
- xszfyImages: '/image/vehicle2.png',
- xszfyImagesNum: false, //上传图标 显示
- // xszzyimg: true, //上传图片 隐藏
- loadingHidden: true, //加载中
- positive: '', //行驶证主页
- opposite: '', //行驶证副页
- SubmissionHidden: true, //提交隐藏显示
-
- },
- /**
- * 生命周期函数--监听页面加载
- */
- onLoad: function (options) {
- var that = this;
- // 获取信息
- let initial_url = 'my/authentication/vehiclechange';
- let initial_data = {
- };
- app.postRequest(initial_url, initial_data, function (res) {
- if (res.code == 201) {
- // console.log(res.data.hold);
- that.setData({
- initial: res.data, // 初始数据
- initialcode: res, //获取未上传状态
- })
- }
- if (res.data.status == 2) { //如果审核通过 隐藏掉提交按钮
- that.setData({
- SubmissionHidden: false
- })
- } else if (res.code != 201) {
- that.setData({
- SubmissionHidden: false
- })
- } else {
- that.setData({
- SubmissionHidden: true
- })
- }
- })
- },
- // 拍摄行驶证主页
- xszzyclick: function (e) {
- var _this = this;
- wx.chooseImage({
- count: 1,
- sizeType: ['original', 'compressed'],
- sourceType: ['album', 'camera'],
- success(res) {
- let tempFilesSize = res.tempFiles[0].size;
- if (tempFilesSize > 1024 * 1024 * 3) {
- wx.showModal({
- title: '提示',
- content: '图片不得超过3MB',
- showCancel: false,
- })
- return;
- }
- // _this.setData({
- // loadingHidden: false
- // });
- wx.showToast({
- title: '上传中...',
- icon: 'loading'
- });
-
- let dt_url = 'my/images/tempimages';
- let dt_filePath = res.tempFilePaths[0];
- app.Multigraph(dt_url, dt_filePath, function (res) {
- if (res.code == 201) {
- // console.log(res.data.img_name);
- _this.setData({
- xszzyImages: dt_filePath,
- xszzyImagesNum: true,
- // scsfzimg: false,
- positive: res.data.img_name, //手持身份证
- });
- wx.showToast({
- title: '上传成功',
- icon: 'none', // 不显示图标
- duration: 2000
- })
- return;
- }
- app.Tips(res.msg);
- });
- }
- })
- },
- // 拍摄行驶证副页
- xszfyclick: function (e) {
- var _this = this;
- wx.chooseImage({
- count: 1,
- sizeType: ['original', 'compressed'],
- sourceType: ['album', 'camera'],
- success(res) {
- let tempFilesSize = res.tempFiles[0].size;
- if (tempFilesSize > 1024 * 1024 * 3) {
- wx.showModal({
- title: '提示',
- content: '图片不得超过3MB',
- showCancel: false,
- })
- return;
- }
- wx.showToast({
- title: '上传中...',
- icon: 'loading'
- });
- let dt_url = 'my/images/tempimages';
- let dt_filePath = res.tempFilePaths[0];
- app.Multigraph(dt_url, dt_filePath, function (res) {
- if (res.code == 201) {
- // console.log(res.data.img_name);
- _this.setData({
- xszfyImages: dt_filePath,
- xszfyImagesNum: true,
- // scsfzimg: false,
- opposite: res.data.img_name, //手持身份证
- loadingHidden: true //加载中
-
- });
- wx.showToast({
- title: '上传成功',
- icon: 'none', // 不显示图标
- duration: 2000
- })
- return;
- }
- app.Tips(res.msg);
- });
- }
- })
- },
- //最后提交认证
- Submission: function (e) {
- console.log(this.data.opposite)
- console.log(this.data.positive)
- var _this =this;
-
- if (this.data.positive == '') {
- var _opposite = '请上传行驶证主页'
- Tips(_opposite)
- } else if (this.data.opposite == '') {
- var _positive = '请上传行驶证副页'
- Tips(_positive)
- }else{
- let income_url = 'my/authentication/vehicle';
- let income_data = {
- positive: this.data.positive, //正面
- opposite: this.data.opposite, //副面
- };
- app.postRequest(income_url, income_data, function (res) {
- console.log(res)
- if (res.code == 201) {
- wx.showToast({
- title: '提交成功',
- icon: 'success',
- duration: 2000
- })
- _this.onLoad();
- return
- }
- var _qrcode = res.msg;
- getApp().Tips(_qrcode);
-
- })
- }
- },
- })
- // 提示框
- function Tips(text) {
- wx.showToast({
- title: text,
- icon: 'none', // 不显示图标
- duration: 2500
- })
- }
|