| | |
| | | |
| | | // 保存信息 |
| | | function setUserInfoApi(submitData) { |
| | | return $$.request({ url: 'paUser/perfectInfo', type: 'post', submitData, service: 'cust' }); |
| | | return $$.request({ |
| | | url: 'paUser/perfectInfo', |
| | | type: 'post', |
| | | submitData, |
| | | service: 'cust' |
| | | }); |
| | | } |
| | | |
| | | Page({ |
| | |
| | | |
| | | // 展示弹出层 |
| | | handleShowPopup(e) { |
| | | this.setData({ popup: e.detail }); |
| | | this.setData({ |
| | | popup: e.detail |
| | | }); |
| | | }, |
| | | |
| | | // 关闭弹出层 |
| | | handleClosePopup() { |
| | | this.data.popup.visible = false; |
| | | this.setData({ popup: this.data.popup }); |
| | | this.setData({ |
| | | popup: this.data.popup |
| | | }); |
| | | }, |
| | | |
| | | // 下拉框确认选择 |
| | | handleConfirmPicker({ detail }) { |
| | | handleConfirmPicker({ |
| | | detail |
| | | }) { |
| | | let type = this.data.popup.type; |
| | | let value = detail.detail.value; |
| | | let arr = []; |
| | |
| | | this.data.submitData[x] = value[t === 0 ? 'value' : 'label']; |
| | | }); |
| | | } |
| | | this.setData({ submitData: this.data.submitData, popup: this.data.popup }); |
| | | this.setData({ |
| | | submitData: this.data.submitData, |
| | | popup: this.data.popup |
| | | }); |
| | | }, |
| | | |
| | | // form的change |
| | | handleChange(e) { |
| | | const { key, value } = e.detail; |
| | | const { |
| | | key, |
| | | value |
| | | } = e.detail; |
| | | this.data.submitData[key] = value; |
| | | this.setData({ submitData: this.data.submitData }); |
| | | this.setData({ |
| | | submitData: this.data.submitData |
| | | }); |
| | | }, |
| | | |
| | | // 修改picker的列时触发 |
| | | handleChangeColumns(e) { |
| | | if (this.data.popup.type === 'location') { |
| | | let selectData = $$.changeLocation(e, this.selectComponent('#personal-data-dom').location, this.data.popup.selectData); |
| | | this.setData({ popup: { ...this.data.popup, selectData } }); |
| | | this.setData({ |
| | | popup: { |
| | | ...this.data.popup, |
| | | selectData |
| | | } |
| | | }); |
| | | } |
| | | }, |
| | | |
| | | // 验证 |
| | | checkSubmitData() { |
| | | if (this.data.submitData.mobile && !$$.mobileRegExp(this.data.submitData.mobile)) { |
| | | $$.showToast({ title: '请输入正确的手机号码' }); |
| | | $$.showToast({ |
| | | title: '请输入正确的手机号码' |
| | | }); |
| | | return false; |
| | | } |
| | | let userInfo = wx.getStorageSync('userInfo'); |
| | |
| | | const res = await setUserInfoApi(this.data.submitData); |
| | | $$.hideLoading(); |
| | | if (res.type) { |
| | | $$.showToast({ title: '操作成功', icon: 'success' }); |
| | | let realStatus = wx.getStorageSync('userInfo')?.realStatus; |
| | | if (realStatus === '99') { |
| | | $$.showModal({ |
| | | title: '实名认证提醒', |
| | | content: '检测到您尚未完成实名认证,认证后您将享受到更加完善的调解服务,是否现在前往认证?', |
| | | cancelText: '暂不认证', |
| | | confirmText: '前往认证', |
| | | success: (res) => { |
| | | if (res.confirm) { |
| | | wx.navigateTo({ |
| | | url: '../../pages/realNameAuthentication/index?backNum=2', |
| | | $$.showToast({ |
| | | title: '操作成功', |
| | | icon: 'success' |
| | | }); |
| | | } else { |
| | | wx.navigateBack({ |
| | | delta: 1, |
| | | }); |
| | | } |
| | | }, |
| | | }); |
| | | } else { |
| | | await $$.sleep(); |
| | | wx.navigateBack({ |
| | | delta: 1, |
| | | }); |
| | | success: function (res) { |
| | | // 返回页面刷新接口 |
| | | wx.emitEvent('getUserInfo', {}); |
| | | } |
| | | }); |
| | | } |
| | | }, |
| | | |
| | |
| | | if (this.isCheck && this.data.submitData.idcardType === '09_00015-1') { |
| | | this.data.submitData.idcard = `${this.data.submitData.idcard?.substring(0, 6)}********${this.data.submitData.idcard?.substring(14)}`; |
| | | } |
| | | this.setData({ submitData: this.data.submitData }); |
| | | this.setData({ |
| | | submitData: this.data.submitData |
| | | }); |
| | | this.copySubmitData = Object.assign({}, this.data.submitData); |
| | | }, |
| | | |
| | |
| | | async handleGetPhoneNumber(e) { |
| | | let phone = await this.selectComponent('#common-page').handleGetPhoneNumber(e.detail); |
| | | this.data.submitData.mobile = phone; |
| | | this.setData({ submitData: this.data.submitData }); |
| | | this.setData({ |
| | | submitData: this.data.submitData |
| | | }); |
| | | }, |
| | | |
| | | /** |
| | | * 生命周期函数--监听页面加载 |
| | | */ |
| | | onLoad: function (options) { |
| | | this.setData({ isCheck: !!options.isCheck, isImproveData: !!options.type }); |
| | | this.setData({ |
| | | isCheck: !!options.isCheck, |
| | | isImproveData: !!options.type |
| | | }); |
| | | this.isCheck = !!options.isCheck; |
| | | }, |
| | | }); |