var util = require('../../../../utils/util.js'); var check = require('../../../../utils/check.js'); var api = require('../../../../config/api.js'); var app = getApp(); Page({ data: { content: '', contentLength: 0, mobile: '', code:'', applyName:'', join:{}, applyType:'请选择', type:'', showPicker:false, applyNid:'',//申请人身份证 columns:['小家政合伙人', '自营门店','阿姨小哥','大客户','公司BD','引荐人'] }, mobileInput: function(e) { this.setData({ mobile: e.detail.value }); }, codeInput:function(e){ this.setData({ code: e.detail.value }); }, applyNameInput:function(e){ this.setData({ applyName: e.detail.value }); }, contentInput: function(e) { this.setData({ contentLength: e.detail.cursor, content: e.detail.value, }); }, clearMobile: function(e) { this.setData({ mobile: '' }); }, clearCode: function(e) { this.setData({ code: '' }); }, getList(){ let that = this; util.request(api.JoinApplyList, { page: that.data.content, limit: that.data.mobile }).then(function(res) { if (res.errno === 0) { console.log(res.data); that.setData({ join: res.data }); } }); }, showPicker(){ this.setData({ showPicker:true }); }, onCancel: function () { this.setData({ showPicker: false, }); }, onConfirm: function (event) { this.setData({ type: event.detail.index, applyType:event.detail.value, showPicker: false, }); }, submitFeedback: function(e) { if (!app.globalData.hasLogin) { wx.navigateTo({ url: "/pages/auth/login/login" }); } let that = this; if (that.data.content == '') { util.showErrorToast('请输入申请理由'); return false; } if (that.data.applyType == '请选择') { util.showErrorToast('请选择申请人类型'); return false; } if (that.data.mobile == '') { util.showErrorToast('请输入手机号码'); return false; } if (that.data.applyName == '') { util.showErrorToast('请输入名称'); return false; } if (!check.isValidPhone(this.data.mobile)) { // this.setData({ // mobile: '' // }); util.showErrorToast('请输入正确的手机号码'); return false; } wx.showLoading({ title: '提交中...', mask: true, success: function() { } }); util.request(api.JoinApply, { mobile: that.data.mobile, content: that.data.content, code:that.data.code, type:that.data.type, applyName:that.data.applyName, applyNid:that.data.applyNid }, 'GET').then(function(res) { wx.hideLoading(); if (res.errno === 0) { wx.showToast({ title: '感谢您的申请!', icon: 'success', duration: 2000, complete: function() { that.setData({ content: '', contentLength: 0, mobile: '', code:"", join:{applyTime:util.formatTime(new Date()),applyStatusText:'处理中',applyStatus:1} }); } }); } else { util.showErrorToast(res.errmsg); } }); }, onLoad: function(options) { }, onReady: function() { }, onShow: function() { this.getList(); }, onHide: function() { // 页面隐藏 }, onUnload: function() { // 页面关闭 } })