Sfoglia il codice sorgente

feature 代码提交

xiahan 4 mesi fa
parent
commit
d7755cc384

+ 3 - 2
app.js

@@ -88,16 +88,17 @@ App({
     waterCompanys: [],
     // 小程序启动时带的参数
     launchPara: null,
-    // 当前用户所选择的户信息
+    // 当前用户所选择的户信息
     currentAccountInfo:null,
     // 是否刷新主页数据
     refresh:0,
     // 系统接口地址
     interfaceUrls: {
       loginUrl: baseIp+ '/wechat/login', // 登录+获取绑定列表
-      accoundBind: baseIp+ '/wechat/account/bind', // 账号绑定
+      accountBind: baseIp+ '/wechat/account/bind', // 账号绑定
       homePageInfo: baseIp+ '/wechat/account/info/', // 首页获取用水量等信息
       billList: baseIp+ '/wechat/bill/list', // 首页获取用水量等信息
+      accountList: baseIp+ '/wechat/account/list', // 首页获取用水量等信息
     },
     imgPreviewUrl: "http://192.168.0.215:9000/common/sys/sysfile/preview?fileId=",
     // 统一管理图片路径

+ 0 - 1
pages/homepage/homepage.js

@@ -90,7 +90,6 @@ Page({
         success (res) {
           wx.hideLoading();
           let apiReturnData=res.data;
-          debugger;
           _this.setData({
             billInfo:{
               totalAmount:apiReturnData.data.duFees,  // 总计应缴

+ 1 - 1
pages/huhaobangding/huhaobangding.js

@@ -185,7 +185,7 @@ Page({
     });
     // 调用绑定接口
     wx.request({
-      url: app.globalData.interfaceUrls.accoundBind,
+      url: app.globalData.interfaceUrls.accountBind,
       method: 'POST',
       data: {
         bindWaterCompany: this.data.waterCompanyList[this.data.waterCompanyIndex[0]].id,

+ 51 - 51
pages/huhaoguanli/huhaoguanli.js

@@ -1,63 +1,63 @@
+const app = getApp();
 Page({
   /**
    * 页面的初始数据
    */
   data: {
-    huHaoList: [
-      {
-        id: 1,
-        name: '王源',
-        tag: '家',
-        phone: '32018545245104',
-        address: '徐州市丰县***楼102室',
-        deleted: 0
-      },
-      {
-        id: 2,
-        name: '王长江',
-        tag: '父母家',
-        phone: '32018545245104',
-        address: '徐州市泗县***楼502室',
-        deleted: 0
-      },
-      {
-        id: 3,
-        name: '李明',
-        tag: '公司',
-        phone: '32018545245105',
-        address: '徐州市云龙区***路88号',
-        deleted: 0
-      },
-      {
-        id: 4,
-        name: '张伟',
-        tag: '',
-        phone: '32018545245106',
-        address: '徐州市鼓楼区***街道45号',
-        deleted: 0
-      }
-    ],
+    huHaoList: [],
     showUnbindModal: false,
     currentHuHao: null
   },
 
-  onLoad: function(options) {
-    this.filterHuHaoList();
+  onLoad: function (options) {
+    this.getAccountList();
   },
 
   // 过滤户号列表,只显示deleted=0的数据
-  filterHuHaoList: function() {
-    const filteredList = this.data.huHaoList.filter(item => item.deleted === 0);
-    this.setData({
-      huHaoList: filteredList
+  getAccountList: function () {
+    const _this = this;
+    wx.showLoading({
+      title: '获取中...',
+      mask: true,
+    });
+    wx.request({
+      url: app.globalData.interfaceUrls.accountList,
+      method: 'GET',
+      header: {
+        'content-type': 'application/json', // 默认值
+        'token': app.globalData.userWxInfo.token,
+        'source': "wc",
+        '!SAAS_LOGIN_TOKEN_!': app.globalData.currentAccountInfo.dsKey
+      },
+      success(res) {
+        wx.hideLoading();
+        let apiReturnData = res.data;
+        debugger;
+        _this.setData({
+          huHaoList: apiReturnData.data.map(data => {
+            return {
+              id: data.id,
+              name: data.username,
+              tag: data.groupName,
+              phone: data.usernumber,
+              address: data.address,
+              deleted: 0
+            };
+          }),
+        })
+      },
+      fail(error) {
+        wx.hideLoading()
+        utils.simleInfo('登录失败,请稍后再试')
+      }
     });
   },
 
   // 点击解除绑定按钮
-  unbindHuHao: function(e) {
+  unbindHuHao: function (e) {
     const id = e.currentTarget.dataset.id;
     const huHao = this.data.huHaoList.find(item => item.id === id);
-    
+
     this.setData({
       showUnbindModal: true,
       currentHuHao: huHao
@@ -65,7 +65,7 @@ Page({
   },
 
   // 取消解绑
-  cancelUnbind: function() {
+  cancelUnbind: function () {
     this.setData({
       showUnbindModal: false,
       currentHuHao: null
@@ -73,27 +73,27 @@ Page({
   },
 
   // 确认解绑
-  confirmUnbind: function() {
+  confirmUnbind: function () {
     const id = this.data.currentHuHao.id;
-    
+
     // 这里应该调用后端接口,将deleted设为1
     // 模拟接口调用成功后的处理
     const updatedList = this.data.huHaoList.map(item => {
       if (item.id === id) {
-        return {...item, deleted: 1};
+        return { ...item, deleted: 1 };
       }
       return item;
     });
-    
+
     this.setData({
       huHaoList: updatedList,
       showUnbindModal: false,
       currentHuHao: null
     });
-    
+
     // 刷新页面数据
     this.filterHuHaoList();
-    
+
     wx.showToast({
       title: '解绑成功',
       icon: 'success',
@@ -102,7 +102,7 @@ Page({
   },
 
   // 跳转到绑定新户号页面
-  goToBindNewHuHao: function() {
+  goToBindNewHuHao: function () {
     wx.navigateTo({
       url: '/pages/huhaobangding/huhaobangding'
     });
@@ -111,7 +111,7 @@ Page({
   /**
    * 返回上一页
    */
-  goBack: function() {
+  goBack: function () {
     wx.navigateBack();
   },
 })