guhongwei il y a 4 ans
Parent
commit
b3bd3be3b5

+ 1 - 1
app.js

@@ -37,5 +37,5 @@ App({
     userInfo: null,
     publicUrl: 'http://192.168.1.119:11000'
   },
-  id: 'wx74f916cbbb2173fa'
+  id: 'wx74f916cbbb2173fa',
 })

+ 106 - 23
pages/card/card.js

@@ -4,44 +4,127 @@ const app = getApp()
 
 Page({
   data: {
-    form: {
-      tjr: '推荐人',
-      tjrPhone: '17319450324'
-    },
+    form: {},
     // 省份
-    provinceList: [
-      { name: '吉林省' },
-      { name: '黑龙江省' },
-      { name: '辽宁省' },
-    ],
+    provinceList: [],
     // 市区
-    cityList: [
-      { name: '长春市' },
-      { name: '榆树市' },
-      { name: '吉林市' },
-    ],
+    cityList: [],
     // 套餐列表
-    mealList: [
-      { name: '169套餐' },
-      { name: '129套餐' },
-    ],
+    setList: [],
   },
   // 选择省份
   provinceChange: function (e) {
-    this.setData({ "form.province": this.data.provinceList[e.detail.value].name })
+    this.setData({ "form.province": this.data.provinceList[e.detail.value].code })
+    // 查询市
+    wx.request({
+      url: app.globalData.publicUrl + '/api/htyd/xzqh',
+      method: "get",
+      data: { pcode: this.data.provinceList[e.detail.value].code },
+      success: (res) => {
+        if (res.data.errcode == '0') {
+          this.setData({ cityList: res.data.data })
+          // 根据查询市,判断查询套餐
+          if (res.data.total === 0) {
+            // 套餐
+            wx.request({
+              url: app.globalData.publicUrl + '/api/htyd/set',
+              method: "get",
+              data: { contact: this.data.provinceList[e.detail.value].code },
+              success: (res) => {
+                if (res.data.errcode == '0') {
+                  this.setData({ setList: res.data.data })
+                } else {
+                  wx.showToast({
+                    title: '查询失败',
+                    icon: 'error',
+                    duration: 2000
+                  })
+                }
+              }
+            })
+          }
+        } else {
+          wx.showToast({
+            title: '查询失败',
+            icon: 'error',
+            duration: 2000
+          })
+        }
+      }
+    })
   },
   // 选择市区
   cityChange: function (e) {
-    this.setData({ "form.city": this.data.cityList[e.detail.value].name })
+    this.setData({ "form.city": this.data.cityList[e.detail.value].code })
+    // 套餐
+    wx.request({
+      url: app.globalData.publicUrl + '/api/htyd/set',
+      method: "get",
+      data: { contact: this.data.cityList[e.detail.value].code },
+      success: (res) => {
+        if (res.data.errcode == '0') {
+          this.setData({ setList: res.data.data })
+        } else {
+          wx.showToast({
+            title: '查询失败',
+            icon: 'error',
+            duration: 2000
+          })
+        }
+      }
+    })
   },
   // 选择套餐
-  mealChange: function (e) {
-    this.setData({ "form.meal": this.data.mealList[e.detail.value].name })
+  setChange: function (e) {
+    this.setData({ "form.set": this.data.setList[e.detail.value].id })
   },
   //事件处理函数
   formSubmit: function (e) {
-    console.log(e.detail.value);
+    const params = e.detail.value;
+    wx.request({
+      url: app.globalData.publicUrl + '/api/htyd/card',
+      method: "post",
+      data: params,
+      success: (res) => {
+        if (res.data.errcode == '0') {
+          wx.showToast({
+            title: '办卡成功',
+            icon: 'success',
+            duration: 2000
+          })
+        } else {
+          wx.showToast({
+            title: '办卡失败',
+            icon: 'error',
+            duration: 2000
+          })
+        }
+      }
+    })
   },
   onLoad: function () {
+    // 获取推荐人信息
+    let data = app.globalData.userInfo;
+    if (data) {
+      this.setData({ "form.recommend": data.name })
+      this.setData({ "form.r_mobile": data.mobile })
+    }
+    // 查询省
+    wx.request({
+      url: app.globalData.publicUrl + '/api/htyd/xzqh',
+      method: "get",
+      data: {},
+      success: (res) => {
+        if (res.data.errcode == '0') {
+          this.setData({ provinceList: res.data.data })
+        } else {
+          wx.showToast({
+            title: '查询失败',
+            icon: 'error',
+            duration: 2000
+          })
+        }
+      }
+    })
   },
 })

+ 8 - 8
pages/card/card.wxml

@@ -6,7 +6,7 @@
     <form bindsubmit="formSubmit" bindreset="formReset">
       <view class="forminput">
         <text class="label">新办理号码</text>
-        <input type='number' name="phone" value="{{form.phone}}" placeholder='请输入新办理号码'></input>
+        <input type='number' name="mobile" value="{{form.mobile}}" placeholder='请输入新办理号码'></input>
       </view>
       <view class="forminput">
         <text class="label">密码</text>
@@ -31,9 +31,9 @@
       </view>
       <view class="formData">
         <text class="label">套餐</text>
-        <picker class="createTime" bindchange="mealChange" name="meal" value="{{form.meal}}" range="{{mealList}}"
-          range-key="{{'name'}}">
-          <view class="picker">{{form.meal||'选择套餐'}}
+        <picker class="createTime" bindchange="setChange" name="set" value="{{form.set}}" range="{{setList}}"
+          range-key="{{'title'}}">
+          <view class="picker">{{form.set||'选择套餐'}}
           </view>
         </picker>
       </view>
@@ -43,19 +43,19 @@
       </view>
       <view class="forminput">
         <text class="label">身份证号</text>
-        <input type='number' name="card" value="{{form.card}}" maxlength="18" placeholder='身份证号'></input>
+        <input type='number' name="id_card" value="{{form.id_card}}" maxlength="18" placeholder='身份证号'></input>
       </view>
       <view class="forminput">
         <text class="label">微信账号</text>
-        <input type='text' name="zfb" value="{{form.zfb}}" placeholder='微信账号'></input>
+        <input type='text' name="wxaccount" value="{{form.wxaccount}}" placeholder='微信账号'></input>
       </view>
       <view class="forminput">
         <text class="label">推荐人</text>
-        <input type='text' name="tjr" value="{{form.tjr}}" placeholder='推荐人' disabled></input>
+        <input type='text' name="recommend" value="{{form.recommend}}" placeholder='推荐人' disabled></input>
       </view>
       <view class="forminput">
         <text class="label">推荐人电话</text>
-        <input type='number' name="tjrPhone" value="{{form.tjrPhone}}" placeholder='推荐人电话' disabled></input>
+        <input type='number' name="r_mobile" value="{{form.r_mobile}}" placeholder='推荐人电话' disabled></input>
       </view>
       <view class="save">
         <button form-type="submit">提交</button>

+ 31 - 4
pages/editPwd/editPwd.js

@@ -14,7 +14,7 @@ Page({
       oldPwd: {
         required: true,
       },
-      newPwd: {
+      password: {
         required: true,
       },
       isnewPwd: {
@@ -29,7 +29,7 @@ Page({
       oldPwd: {
         required: '请输入原密码',
       },
-      newPwd: {
+      password: {
         required: '请输入新密码',
       },
       isnewPwd: {
@@ -51,8 +51,31 @@ Page({
       return false
     } else {
       // 判断新密码,确认新密码是否一致
-      if (params.newPwd === params.isnewPwd) {
-        console.log(params);
+      if (params.password === params.isnewPwd) {
+        wx.request({
+          url: app.globalData.publicUrl + '/api/htyd/card/passwd/' + this.data.form.id,
+          method: "post",
+          data: params,
+          success: (res) => {
+            if (res.data.errcode == '0') {
+              wx.showToast({
+                title: '修改密码成功',
+                icon: 'success',
+                duration: 2000
+              })
+              app.globalData.userInfo = {}
+              wx.redirectTo({
+                url: '/pages/login/login'
+              })
+            } else {
+              wx.showToast({
+                title: '修改失败',
+                icon: 'error',
+                duration: 2000
+              })
+            }
+          }
+        })
       } else {
         wx.showToast({
           title: '新密码与确认密码不一致,请重新输入',
@@ -64,5 +87,9 @@ Page({
   },
   onLoad: function (options) {
     this.initValidate()//验证规则函数
+    let data = app.globalData.userInfo;
+    if (data) {
+      this.setData({ form: data })
+    }
   },
 })

+ 2 - 2
pages/editPwd/editPwd.wxml

@@ -6,7 +6,7 @@
     <form bindsubmit="formSubmit" bindreset="formReset">
       <view class="content">
         <text>手机号</text>
-        <input type='number' name="phone" value="{{form.phone}}" maxlength="11" placeholder='手机号'></input>
+        <input type='number' name="phone" value="{{form.mobile}}" maxlength="11" placeholder='手机号'></input>
       </view>
       <view class="content">
         <text>原密码</text>
@@ -14,7 +14,7 @@
       </view>
       <view class="content">
         <text>新密码</text>
-        <input type='text' name="newPwd" password value="{{form.newPwd}}" maxlength="16" placeholder='新密码'></input>
+        <input type='text' name="password" password value="{{form.password}}" maxlength="16" placeholder='新密码'></input>
       </view>
       <view class="content">
         <text>确认新密码</text>

+ 3 - 1
pages/home/home.js

@@ -5,7 +5,7 @@ const app = getApp()
 Page({
   data: {
     // 个人信息
-    videoUrl: 'https://vd3.bdstatic.com/mda-kar9n2ip1u508ewq/hd/mda-kar9n2ip1u508ewq.mp4?pd=20',
+    videoUrl: 'http://broadcast.waityou24.cn/files/imgpath/20201221103327.mp4',
     userInfo: {}
   },
   //事件处理函数
@@ -37,6 +37,7 @@ Page({
   },
   // 退出登录
   logouBtn: function () {
+    app.globalData.userInfo = {}
     wx.redirectTo({
       url: '/pages/login/login'
     })
@@ -98,6 +99,7 @@ Page({
   },
   onLoad: function () {
     let data = app.globalData.userInfo;
+    console.log(data);
     this.setData({ userInfo: data })
     wx.getUserInfo({
       success: res => {

+ 1 - 2
pages/home/home.wxml

@@ -2,8 +2,7 @@
 <view class="main">
   <van-row>
     <van-col span="24" class="one">
-      <!-- <video src="{{videoUrl}}" autoplay loop show-mute-btn></video> -->
-      视频
+      <video src="{{videoUrl}}" autoplay loop show-mute-btn></video>
     </van-col>
     <van-col span="24" class="personal">
       <image src="{{userInfo.avatarUrl}}"></image>

+ 1 - 1
pages/login/login.js

@@ -45,7 +45,7 @@ Page({
               icon: 'success',
               duration: 2000
             })
-            wx.navigateTo({
+            wx.redirectTo({
               url: '/pages/home/home'
             })
           } else {

+ 44 - 77
pages/perssonal/perssonal.js

@@ -1,79 +1,46 @@
-// pages/perssonal/perssonal.js
-Page({
+//index.js
+//获取应用实例
+const app = getApp()
 
-  /**
-   * 页面的初始数据
-   */
+Page({
   data: {
-    personalInfo: {
-      grade: '业务员',
-      name: '顾红伟',
-      phone: '17319450324',
-      card: '220182199603257019',
-      zfb: '17319450324',
-      type: '支付宝',
-      province: '吉林省',
-      city: '长春市',
-      meal: '169套餐',
-      card_date: '2020-10-10',
-      tjr: '你猜呢',
-      tjrPhone: '17543727325',
-    }
-  },
-
-  /**
-   * 生命周期函数--监听页面加载
-   */
-  onLoad: function (options) {
-
-  },
-
-  /**
-   * 生命周期函数--监听页面初次渲染完成
-   */
-  onReady: function () {
-
-  },
-
-  /**
-   * 生命周期函数--监听页面显示
-   */
-  onShow: function () {
-
-  },
-
-  /**
-   * 生命周期函数--监听页面隐藏
-   */
-  onHide: function () {
-
-  },
-
-  /**
-   * 生命周期函数--监听页面卸载
-   */
-  onUnload: function () {
-
-  },
-
-  /**
-   * 页面相关事件处理函数--监听用户下拉动作
-   */
-  onPullDownRefresh: function () {
-
-  },
-
-  /**
-   * 页面上拉触底事件的处理函数
-   */
-  onReachBottom: function () {
-
-  },
-
-  /**
-   * 用户点击右上角分享
-   */
-  onShareAppMessage: function () {
-
-  }
-})
+    personalInfo: {},
+  },
+  //事件处理函数
+  onLoad: function () {
+    let data = app.globalData.userInfo;
+    if (data) {
+      // 查询省份
+      wx.request({
+        url: app.globalData.publicUrl + '/api/htyd/xzqh',
+        method: "get",
+        data: { code: data.province },
+        success: (res) => {
+          data.province = res.data.data[0].name;
+        }
+      })
+      // 查询市区
+      wx.request({
+        url: app.globalData.publicUrl + '/api/htyd/xzqh',
+        method: "get",
+        data: { pcode: data.province },
+        success: (res) => {
+          let city = res.data.data.find(i => i.code == data.city)
+          if (city) data.city = city.name;
+        }
+      })
+      // 查询套餐
+      wx.request({
+        url: app.globalData.publicUrl + '/api/htyd/set/' + data.set,
+        method: "get",
+        data: {},
+        success: (res) => {
+          if (res.data.errcode === 0) {
+            data.set = res.data.data.title
+            this.setData({ personalInfo: data })
+          }
+        }
+      })
+    } else { }
+  },
+})

+ 8 - 8
pages/perssonal/perssonal.wxml

@@ -4,20 +4,20 @@
   </view>
   <view class="two">
     <view class="twoTop">
-      <text>{{personalInfo.grade}}</text>
+      <text>{{personalInfo.level=='1'?'业务员':personalInfo.level=='2'?'经理':personalInfo.level=='3'?'一星经理':personalInfo.level=='4'?'二星经理':personalInfo.level=='5'?'三星经理':"四星经理"}}</text>
     </view>
     <view class="twoDown">
       <van-cell-group>
         <van-field value="{{ personalInfo.name }}" label="姓名" placeholder="姓名" readonly />
       </van-cell-group>
       <van-cell-group>
-        <van-field value="{{ personalInfo.phone }}" label="手机号" placeholder="手机号" readonly />
+        <van-field value="{{ personalInfo.mobile }}" label="手机号" placeholder="手机号" readonly />
       </van-cell-group>
       <van-cell-group>
-        <van-field value="{{ personalInfo.card }}" label="身份证号" placeholder="身份证号" readonly />
+        <van-field value="{{ personalInfo.id_card }}" label="身份证号" placeholder="身份证号" readonly />
       </van-cell-group>
       <van-cell-group>
-        <van-field value="{{ personalInfo.zfb }}" label="支付宝账号" placeholder="支付宝账号" readonly />
+        <van-field value="{{ personalInfo.wxaccount }}" label="微信账号" placeholder="微信账号" readonly />
       </van-cell-group>
       <van-cell-group>
         <van-field value="{{ personalInfo.province }}" label="省份" placeholder="省份" readonly />
@@ -26,16 +26,16 @@
         <van-field value="{{ personalInfo.city }}" label="市区" placeholder="市区" readonly />
       </van-cell-group>
       <van-cell-group>
-        <van-field value="{{ personalInfo.meal }}" label="套餐" placeholder="套餐" readonly />
+        <van-field value="{{ personalInfo.set }}" label="套餐" placeholder="套餐" readonly />
       </van-cell-group>
       <van-cell-group>
-        <van-field value="{{ personalInfo.card_date }}" label="办卡时间" placeholder="办卡时间" readonly />
+        <van-field value="{{ personalInfo.create_time }}" label="办卡时间" placeholder="办卡时间" readonly />
       </van-cell-group>
       <van-cell-group>
-        <van-field value="{{ personalInfo.tjr }}" label="推荐人" placeholder="推荐人" readonly />
+        <van-field value="{{ personalInfo.recommend }}" label="推荐人" placeholder="推荐人" readonly />
       </van-cell-group>
       <van-cell-group>
-        <van-field value="{{ personalInfo.tjrPhone }}" label="推荐人手机号" placeholder="推荐人手机号" readonly />
+        <van-field value="{{ personalInfo.r_mobile }}" label="推荐人手机号" placeholder="推荐人手机号" readonly />
       </van-cell-group>
     </view>
   </view>

+ 22 - 20
pages/setting/setting.js

@@ -28,9 +28,7 @@ Page({
         url: '/pages/images/template/5.jpg'
       },
     ],
-    form: {
-      phone: '17319450324'
-    },
+    form: {},
     // 二维码
     qrcodeUrl: '/pages/images/qrcode.jpg'
   },
@@ -48,22 +46,26 @@ Page({
   onLoad: function () {
     // 模板默认选择
     this.imageChange();
-    wx.getUserInfo({
-      success: res => {
-        this.setData({
-          userInfo: res.userInfo,
-        })
-      },
-      fail: err => {
-        wx.showToast({
-          title: '没有授权获取微信用户信息',
-          icon: 'error',
-          duration: 2000
-        })
-        wx.redirectTo({
-          url: '/pages/index/index',
-        })
-      }
-    })
+    // let data = app.globalData.userInfo;
+    let data = {
+      avatarUrl: "https://thirdwx.qlogo.cn/mmopen/vi_32/ibzXIKnSribia9qZzSkEokEVfLuxOUEJ8xPAMibU29vB3KS8Pic5fUwUricWsXAEfL8zibZSGjUvPUm6PibxiadY8RAdv1w/132",
+      car_show: false,
+      city: "长春市",
+      create_time: "2021-01-06 16:31:30",
+      id: "5ff575b0a3f2771eb4d03114",
+      id_card: "22010319950601161x",
+      level: 1,
+      mobile: "13089419810",
+      name: "刘睿峰",
+      points: 4100,
+      province: "吉林省",
+      set: "168",
+      stockholder: false,
+      wxaccount: "lrf402788946",
+      _id: "5ff575b0a3f2771eb4d03114",
+    }
+    this.setData({ userInfo: data });
+    // 生成二维码
+    
   },
 })

+ 10 - 10
pages/setting/setting.wxml

@@ -16,23 +16,23 @@
     <image class="image" src="{{form.imgurl}}"></image>
     <view class="userInfo">
       <view class="temOne" wx:if="{{form.imgIndex==0}}">
-        <view class="name">{{userInfo.nickName}}</view>
-        <view class="phone">NO.{{form.phone}}</view>
+        <view class="name">{{userInfo.name}}</view>
+        <view class="phone">NO.{{userInfo.mobile}}</view>
         <image class="qrcode" src="{{qrcodeUrl}}"></image>
         <image class="avatarUrl" src="{{userInfo.avatarUrl}}"></image>
       </view>
       <view class="temTwo" wx:elif="{{form.imgIndex==1}}">
         <image class="qrcode" src="{{qrcodeUrl}}"></image>
         <image class="avatarUrl" src="{{userInfo.avatarUrl}}"></image>
-        <view class="name">{{userInfo.nickName}}</view>
-        <view class="phone">NO.{{form.phone}}</view>
+        <view class="name">{{userInfo.name}}</view>
+        <view class="phone">NO.{{userInfo.mobile}}</view>
       </view>
       <view class="temThr" wx:elif="{{form.imgIndex==2}}">
         <image class="qrcode" src="{{qrcodeUrl}}"></image>
         <image class="avatarUrl" src="{{userInfo.avatarUrl}}"></image>
         <view>
-          <text>{{userInfo.nickName||"顾红伟"}}</text>
-          <text>NO.{{form.phone}}</text>
+          <text>{{userInfo.name}}</text>
+          <text>NO.{{userInfo.mobile}}</text>
         </view>
       </view>
       <view class="temFour" wx:elif="{{form.imgIndex==3}}">
@@ -41,16 +41,16 @@
           <image class="avatarUrl" src="{{userInfo.avatarUrl}}"></image>
         </view>
         <view class="temFourInfo">
-          <text>{{userInfo.nickName||"顾红伟"}}</text>
-          <text>NO.{{form.phone}}</text>
+          <text>{{userInfo.name}}</text>
+          <text>NO.{{userInfo.mobile}}</text>
         </view>
       </view>
       <view class="temFive" wx:elif="{{form.imgIndex==4}}">
         <image class="qrcode" src="{{qrcodeUrl}}"></image>
         <image class="avatarUrl" src="{{userInfo.avatarUrl}}"></image>
         <view>
-          <text>{{userInfo.nickName||"顾红伟"}}</text>
-          <text>NO.{{form.phone}}</text>
+          <text>{{userInfo.name}}</text>
+          <text>NO.{{userInfo.mobile}}</text>
         </view>
       </view>
     </view>

+ 139 - 55
pages/team/team.js

@@ -11,19 +11,15 @@ moment.locale('en', {
 }),
   Page({
     data: {
-      provinceList: [
-        { name: '吉林省' },
-        { name: '黑龙江省' },
-        { name: '辽宁省' },
-      ],
+      // 用户信息
+      userInfo: {},
+      // 省份
+      provinceList: [],
       province: '',
       form: {},
+      searchForm: {},
       // 套餐列表
-      mealList: [
-        { name: '全部' },
-        { name: '169套餐' },
-        { name: '129套餐' },
-      ],
+      setList: [],
       // 时间列表
       dateList: [
         { name: '全部', },
@@ -40,19 +36,33 @@ moment.locale('en', {
     //事件处理函数
     // 选择省份
     provinceChange: function (e) {
-      this.setData({ "province": this.data.provinceList[e.detail.value].name })
+      this.setData({ "form.province": this.data.provinceList[e.detail.value].name })
+      this.setData({ "searchForm.province": this.data.provinceList[e.detail.value].code })
+      // 套餐
+      wx.request({
+        url: app.globalData.publicUrl + '/api/htyd/set/range',
+        method: "get",
+        data: { contact: this.data.provinceList[e.detail.value].code },
+        success: (res) => {
+          if (res.data.errcode == '0') {
+            this.setData({ setList: res.data.data })
+          } else {
+            wx.showToast({
+              title: '查询失败',
+              icon: 'error',
+              duration: 2000
+            })
+          }
+        }
+      })
     },
     // 选择套餐
     mealChange: function (e) {
-      let value = Number(e.detail.value);
-      if (value) {
-        let value = this.data.mealList[e.detail.value].name;
-        this.setData({ "form.meal": value });
-      } else {
-        this.setData({ "form.meal": e.detail.value });
-      }
+      let oneValue = this.data.setList[e.detail.value] ? this.data.setList[e.detail.value] : this.data.setList.find(i => i.title == e.detail.value)
+      if (oneValue) this.setData({ "form.set": oneValue.title });
+      this.setData({ "searchForm.set": oneValue.id });
       // 调用查询方法
-      this.search(this.data.form);
+      this.search(this.data.searchForm);
     },
     // 选择时间
     dateChange: function (e) {
@@ -70,25 +80,72 @@ moment.locale('en', {
       } else if (value == '本年') {
         var start_time = moment().month(moment().month()).startOf('year').format('YYYY-MM-DD hh:mm:ss');
         var end_time = moment().month(moment().month()).endOf('year').format('YYYY-MM-DD hh:mm:ss');
-      }
-      if (start_time && end_time) {
-        this.setData({ "form.start_time": start_time })
-        this.setData({ "form.end_time": end_time })
       } else {
-        this.setData({ "form.start_time": '' })
-        this.setData({ "form.end_time": '' })
+        var start_time = '';
+        var end_time = '';
       }
+      this.setData({ "form.start_time": start_time })
+      this.setData({ "form.end_time": end_time })
+      this.setData({ "searchForm.create_time@start": start_time })
+      this.setData({ "searchForm.create_time@end": end_time })
       // 调用查询方法
-      this.search(this.data.form);
+      this.search(this.data.searchForm);
     },
     // 自主选择时间段
     changeStart: function (e) {
       var start_time = e.detail.value + ' ' + '00:00:00';
       this.setData({ "form.start_time": start_time })
+      this.setData({ "searchForm.create_time@start": start_time })
     },
     changeEnd: function (e) {
       var end_time = e.detail.value + ' ' + '00:00:00';
       this.setData({ "form.end_time": end_time })
+      this.setData({ "searchForm.create_time@end": end_time })
+    },
+    // 确定
+    formSubmit: function (e) {
+      let data = e.detail.value;
+      data = {
+        province: this.data.searchForm.province,
+        set: this.data.searchForm.set,
+        "create_time@start": data.start_time || null,
+        "create_time@end": data.end_time || null,
+      }
+      // 调用查询方法
+      this.search(data);
+      this.setData({ show: false })
+    },
+    // 查询
+    search: function (data) {
+      data.r_mobile = this.data.userInfo.mobile;
+      // 去除对象空属性
+      function deleteObjNull(obj) {
+        let _newPar = {};
+        for (let key in obj) {
+          if ((obj[key] === 0 || obj[key]) && obj[key].toString().replace(/(^\s*)|(\s*$)/g, '') !== '') {
+            _newPar[key] = obj[key];
+          }
+        }
+        //返回对象
+        return _newPar;
+      }
+      data = deleteObjNull(data)
+      wx.request({
+        url: app.globalData.publicUrl + '/api/htyd/card/group',
+        method: "get",
+        data: data,
+        success: (res) => {
+          if (res.data.errcode == '0') {
+            this.setData({ list: res.data.data })
+          } else {
+            wx.showToast({
+              title: '查询失败',
+              icon: 'error',
+              duration: 2000
+            })
+          }
+        }
+      })
     },
     // 弹出层
     showPopup: function () {
@@ -111,36 +168,63 @@ moment.locale('en', {
       this.setData({ chosen: '' });
       this.setData({ form: {} });
     },
-    // 确定
-    formSubmit: function (e) {
-      let data = e.detail.value;
-      // 调用查询方法
-      this.search(data);
-      var that = this;
-      that.setData({ show: false })
-    },
-    // 查询
-    search: function (data) {
-      console.log(data);
-    },
     onLoad: function () {
-      let data = [
-        {
-          name: '顾红伟',
-          phone: '17319450324',
-          create_time: '2020-12-12',
-          meal: '129套餐'
-        },
-        {
-          name: '你猜呢',
-          phone: '17319450324',
-          create_time: '2020-12-12',
-          meal: '169套餐'
-        },
-      ];
-      for (const val of data) {
-        val.danName = val.name.split("")[0]
+      let data = {
+        avatarUrl: "https://thirdwx.qlogo.cn/mmopen/vi_32/ibzXIKnSribia9qZzSkEokEVfLuxOUEJ8xPAMibU29vB3KS8Pic5fUwUricWsXAEfL8zibZSGjUvPUm6PibxiadY8RAdv1w/132",
+        car_show: false,
+        city: "220100",
+        create_time: "2021-01-06 16:31:30",
+        id: "5ff575b0a3f2771eb4d03114",
+        id_card: "22010319950601161x",
+        level: 1,
+        mobile: "13089419810",
+        name: "刘睿峰",
+        points: 4100,
+        province: "220000",
+        set: "168",
+        stockholder: false,
+        wxaccount: "lrf402788946",
+        _id: "5ff575b0a3f2771eb4d03114",
       }
-      this.setData({ list: data })
+      this.setData({ userInfo: data })
+      // 查询省份
+      // 查询省
+      wx.request({
+        url: app.globalData.publicUrl + '/api/htyd/xzqh',
+        method: "get",
+        data: {},
+        success: (res) => {
+          if (res.data.errcode == '0') {
+            this.setData({ provinceList: res.data.data })
+          } else {
+            wx.showToast({
+              title: '查询失败',
+              icon: 'error',
+              duration: 2000
+            })
+          }
+        }
+      })
+      // 查询团队,全部
+      wx.request({
+        url: app.globalData.publicUrl + '/api/htyd/card/group',
+        method: "get",
+        data: { r_mobile: this.data.userInfo.mobile },
+        success: (res) => {
+          if (res.data.errcode == '0') {
+            let data = res.data.data;
+            for (const val of data) {
+              val.danName = val.name.split("")[0]
+            }
+            this.setData({ list: data })
+          } else {
+            wx.showToast({
+              title: '查询失败',
+              icon: 'error',
+              duration: 2000
+            })
+          }
+        }
+      })
     },
   })

+ 10 - 10
pages/team/team.wxml

@@ -7,9 +7,9 @@
       <view class="topOne">
         <view class="topView">号码归属省</view>
         <view class="topView">
-          <picker class="createTime" bindchange="provinceChange" name="province" value="{{province}}"
+          <picker class="createTime" bindchange="provinceChange" name="province" value="{{form.province}}"
             range="{{provinceList}}" range-key="{{'name'}}">
-            <view class="picker">{{province||'归属省'}}
+            <view class="picker">{{form.province||'归属省'}}
               <van-icon name="arrow" />
             </view>
           </picker>
@@ -17,9 +17,9 @@
       </view>
       <view class="topTwo">
         <view class="topTwoView">
-          <picker class="createTime" bindchange="mealChange" name="meal" value="{{form.meal}}" range="{{mealList}}"
-            range-key="{{'name'}}">
-            <view class="picker textOver">{{form.meal||'套餐'}}
+          <picker class="createTime" bindchange="mealChange" name="set" value="{{form.set}}" range="{{setList}}"
+            range-key="{{'title'}}">
+            <view class="picker textOver">{{form.set||'套餐'}}
               <van-icon name="arrow-down" />
             </view>
           </picker>
@@ -48,11 +48,11 @@
           <view class="message">
             <view class="messageTop">
               <text>{{item.name}}</text>
-              <text>{{item.phone}}</text>
+              <text>{{item.mobile}}</text>
             </view>
             <view class="messageDown">
               <text class="textOver">{{item.create_time}}</text>
-              <text class="textOver">{{item.meal}}</text>
+              <text class="textOver">{{item.set}}</text>
             </view>
           </view>
         </view>
@@ -66,9 +66,9 @@
       <view class="one">
         <view class="title">套餐</view>
         <view class="radio">
-          <radio-group name="meal" bindchange="mealChange">
-            <label wx:for="{{mealList}}" wx:key="unique">
-              <radio value="{{item.name}}" color="#ff0000" />{{item.name}}</label>
+          <radio-group name="set" bindchange="mealChange">
+            <label wx:for="{{setList}}" wx:key="unique">
+              <radio value="{{item.title}}" color="#ff0000" />{{item.title}}</label>
           </radio-group>
         </view>
       </view>

+ 2 - 2
pages/team/team.wxss

@@ -140,12 +140,12 @@
 
 .main .two .down .list .message .messageDown text:nth-child(1) {
   float: left;
-  width: 50%;
+  width: 70%;
 }
 
 .main .two .down .list .message .messageDown text:nth-child(2) {
   float: right;
-  width: 50%;
+  width: 30%;
   text-align: right;
 }