123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233 |
- // pages/minePages/grxxxg/grxxxg.js
- import {
- xcxPhoneNumber,
- xcxsmbd
- } from "../../../apis/index"
- Page({
- /**
- * 页面的初始数据
- */
- data: {
- checked: false,
- userType: [{
- type: "个人身份",
- value: 0
- }, {
- type: "企业身份",
- value: 1
- }],
- userTypeShow: false,
- enterpriceType: [],
- enterpriceTypeShow: false,
- form: {
- name: "",
- userType: "",
- enterpriceType: "",
- idcard: "",
- phone: ""
- },
- },
- /**
- * 生命周期函数--监听页面加载
- */
- onLoad(options) {
- let that = this
- that.init()
- },
- init() {
- let that = this
- let userInfo = wx.getStorageSync('USERINFO')
- that.setData({
- 'form.name': userInfo.name,
- 'form.idcard': userInfo.idcard,
- 'form.phone': userInfo.phone
- })
- },
- close() {
- let that = this
- that.setData({
- userTypeShow: false,
- enterpriceTypeShow: false
- })
- },
- userType() {
- let that = this
- that.setData({
- userTypeShow: true
- })
- },
- enterpriceType() {
- let that = this
- that.setData({
- enterpriceTypeShow: true
- })
- },
- name(e) {
- let that = this
- let value = e.detail.value
- that.setData({
- 'form.name': value
- })
- },
- selectUserType(e) {
- let that = this
- let item = e.currentTarget.dataset.item
- that.setData({
- 'form.userType': item.type,
- userTypeShow: false,
- enterpriceTypeShow: false
- })
- },
- selectEnterprice(e) {
- let that = this
- let item = e.currentTarget.dataset.item
- that.setData({
- 'form.enterpriceType': item.nsrmc,
- userTypeShow: false,
- enterpriceTypeShow: false
- })
- },
- idcard(e) {
- let that = this
- let value = e.detail.value
- that.setData({
- 'form.idcard': value
- })
- },
- getPhoneNumber(e) {
- let that = this
- if (!e.detail.code) {
- wx.showToast({
- title: '用户拒绝',
- icon: "none",
- duration: 3000
- })
- } else {
- wx.showLoading({
- title: '正在修改...',
- })
- xcxPhoneNumber({
- code: e.detail.code
- }).then((res) => {
- wx.hideLoading()
- if (res.code == 200) {
- that.setData({
- 'form.phone': res.message
- })
- } else {
- wx.showToast({
- title: res.msg || res.message,
- icon: "none",
- duration: 5000
- })
- }
- })
- }
- },
- xiugai() {
- let that = this
- let publicId = wx.getStorageSync('PUBLIC_ID')
- let form = that.data.form
- if (form.name.length > 1 && form.idcard.length == 18) {
- wx.showLoading({
- title: '正在修改...',
- })
- let forms = {
- xcxId: publicId.openid,
- unionid: publicId.unionid,
- sfzjhm: form.idcard,
- sjh: form.phone,
- xm: form.name
- }
- xcxsmbd(forms).then((res) => {
- wx.hideLoading()
- if (res.code == 200) {
- wx.showToast({
- title: res.msg || res.message,
- icon: "none",
- duration: 3000
- })
- let userInfo = wx.getStorageSync('USERINFO')
- userInfo.name = that.data.form.name
- userInfo.idcard = that.data.form.idcard
- userInfo.phone = that.data.form.phone
- wx.setStorageSync('USERINFO', userInfo)
- wx.navigateBack()
- } else {
- wx.showToast({
- title: res.msg || res.message,
- icon: "none",
- duration: 5000
- })
- }
- })
- } else {
- wx.showToast({
- title: '请检查身份证或姓名是否正确',
- icon: "none",
- duration: 5000
- })
- }
- },
- /**
- * 生命周期函数--监听页面初次渲染完成
- */
- onReady() {
- },
- /**
- * 生命周期函数--监听页面显示
- */
- onShow() {
- },
- /**
- * 生命周期函数--监听页面隐藏
- */
- onHide() {
- },
- /**
- * 生命周期函数--监听页面卸载
- */
- onUnload() {
- },
- /**
- * 页面相关事件处理函数--监听用户下拉动作
- */
- onPullDownRefresh() {
- },
- /**
- * 页面上拉触底事件的处理函数
- */
- onReachBottom() {
- },
- /**
- * 用户点击右上角分享
- */
- onShareAppMessage() {
- }
- })
|