liukangdong
2024-09-29 b2d360d9113b6955287108ca9e90d76a1f3c1419
wechat_jiaxuan/pages/design/design.js
@@ -12,12 +12,13 @@
   * 页面的初始数据
   */
  data: {
    guideName: '',
    name: '',
    phone: '',
    phone: '',
    showAreaList: false,
    areaList: [],
    addr: {},
    addrValues:[],
    fieldNames: {
      text: 'name',
      value: 'id',
@@ -30,6 +31,9 @@
  },
  onLoad(options) {
    this.initData()
    if(options.name){
      this.setData({ guideName: options.name })
    }
    qqmapsdk = new QQMapWX({
      key: 'HIDBZ-2QXL4-TAWUD-XET6Q-EKTJE-CCBSQ'
    });
@@ -44,9 +48,16 @@
          areaCode: res.result.ad_info.adcode + '00',
          areaName: res.result.ad_info.district,
        }
        this.setData({ addr })
        this.setData({ addr,addrValues:
          [res.result.ad_info.adcode.slice(0,2) + '0000',
          res.result.ad_info.adcode.slice(0,4) + '00',
          res.result.ad_info.adcode]  })
      }
    })
    const member =  wx.getStorageSync('member')
    this.setData({
      phone: member.phone,
      name: member.name
    })
  }, 
  regionChange(e) {
@@ -69,7 +80,8 @@
    const {
      name,
      phone,
      addr
      addr,
      guideName
    } = this.data
    if (!name) return wx.showToast({
      title: '请输入姓名',
@@ -95,6 +107,7 @@
    saveFreeCustomizationApply({
      name,
      phone,
      username: guideName || null,
      ...addr
    }).then(res => {
      wx.showToast({
@@ -150,37 +163,8 @@
    // getArea({
    //   "level": "",
    //   "pid": ""
    // }).then(res => {
    //   var tl = []
    //   if(res && res.data && res.data.length){
    //       res.data.forEach(element => {
    //           let tc = []
    //           if(element.children &&element.children.length){
    //             element.children.forEach(c => {
    //               let ta = []
    //               if(c.children &&c.children.length){
    //                 c.children.forEach(a => {
    //                   ta.push({
    //                     name: a.name,
    //                     id: a.id
    //                   })
    //                 })
    //               }
    //               tc.push({
    //                 name: c.name,
    //                 id: c.id,
    //                 children:ta,
    //               })
    //             })
    //           }
    //           tl.push({
    //             name: element.name,
    //             id: element.id,
    //             children: tc,
    //           })
    //       });
    //   }
    //   this.setData({areaList: tl})
    // }).then(res => {
    //   this.setData({areaList: res.data})
    //   console.log(this.data.areaList)
    // })
    getDictData({