Forráskód Böngészése

feature 代码提交

xiahan 4 hónapja
szülő
commit
52532e0a4f

+ 26 - 4
app.js

@@ -1,6 +1,8 @@
 // app.js
 const utils = require('/utils/util.js')
 const baseIp= "http://localhost:9747"
+// 图片预览地址
+
 App({
   onLaunch(options) {
     // 展示本地存储能力
@@ -26,6 +28,7 @@ App({
               dsKey: options.query.deskey
             },
             success(res) {
+              debugger
               wx.hideLoading()
               if (!res.data.code || res.data.code!= "200") {
                 utils.simleInfoWithBack('登录失败,请稍后再试')
@@ -43,13 +46,25 @@ App({
                   // 当前用户所对应的水务公司
                   currentDsKey:""
                 }
+                if(resData.swUserManagementVos.length!=0){
+                  _this.globalData.currentAccountInfo=(resData.swUserManagementVos||[])[0]
+                };
                 _this.globalData.waterCompanys=resData.waterCompany;
-                if (!resData.swUserManagementVos || resData.swUserManagementVos.length == 0) {
+                if (resData.swUserManagementVos.length == 0) {
+                  _this.globalData.refresh=0;
                   wx.navigateTo({
-                    url: '/pages/FirstBangDing/FirstBangDing',
+                    url:  '/pages/FirstBangDing/FirstBangDing',
                   })
                 } else {
-                  // _this.globalData.userBindInfo = groupArr
+                  _this.globalData.refresh=1;
+                  wx.switchTab({
+                    url: '/pages/homepage/homepage',
+                    success:function () {
+                      var page = getCurrentPages().pop();
+                      if (page == undefined || page == null) return;
+                        page.onLoad();   //重新刷新页面
+                      }
+                  })
                 }
               } else {
                 utils.simleInfo('登录失败,请稍后再试')
@@ -68,16 +83,23 @@ App({
   },
   globalData: {
     // 当前用户信息
-    userWxInfo: null,
+    userWxInfo: {},
     // 系统中存在的水务公司
     waterCompanys: [],
     // 小程序启动时带的参数
     launchPara: null,
+    // 当前用户所选择的户号信息
+    currentAccountInfo:null,
+    // 是否刷新主页数据
+    refresh:0,
     // 系统接口地址
     interfaceUrls: {
       loginUrl: baseIp+ '/wechat/login', // 登录+获取绑定列表
       accoundBind: baseIp+ '/wechat/account/bind', // 账号绑定
+      homePageInfo: baseIp+ '/wechat/account/info/', // 首页获取用水量等信息
+      billList: baseIp+ '/wechat/bill/list', // 首页获取用水量等信息
     },
+    imgPreviewUrl: "http://192.168.0.215:9000/common/sys/sysfile/preview?fileId=",
     // 统一管理图片路径
     images: {
       logo: '/static_file/logo.png',

+ 1 - 1
app.json

@@ -1,7 +1,7 @@
 {
   "pages": [
-    "pages/homepage/homepage",
     "pages/FirstBangDing/FirstBangDing",
+    "pages/homepage/homepage",
     "pages/profile/profile",
     "pages/huhaobangding/huhaobangding",
     "pages/lijijiaofei/lijijiaofei",

+ 59 - 34
pages/homepage/homepage.js

@@ -1,24 +1,26 @@
+const app = getApp();
 Page({
   data: {
     images: {
-      logo: '',
-      background: '',
-      card: '',
-      tzd: "",
-      phone: "",
-      yl: "",
-      jcsfcjtzd: ""
+       logo:'/static_file/logo.png',
+        background:'/static_file/background.png',
+        card:'/static_file/card.png',
+        tzd:'/static_file/backgrountzdd.png',
+        phone:'/static_file/phone.png',
+        yl:'/static_file/background.yl',
+        jcsfcjtzd:'/static_file/jcsfcjtzd.png',
+        kapiantubiao:'/static_file/kapiantubiao.png'
     },
     // 用户信息
     userInfo: {
-      name: '王源',
-      accountNumber: '32018545245104',
-      address: '徐州市丰县****楼102室'
+      name: "",
+      accountNumber: "",
+      address: ""
     },
     
     // 账单信息
     billInfo: {
-      totalAmount: 73.28,  // 总计应缴
+      totalAmount: 0,  // 总计应缴
       waterUsage: 0,      // 用水量
       balance: 0       // 账户余额
     },
@@ -59,32 +61,55 @@ Page({
   },
 
   onLoad() {
-    // 页面加载时可以调用获取数据的方法
-    this.getUserInfo()
-    this.getBillInfo()
-    this.setData({
-      images: {
-        logo:'/static_file/logo.png',
-        background:'/static_file/background.png',
-        card:'/static_file/card.png',
-        tzd:'/static_file/backgrountzdd.png',
-        phone:'/static_file/phone.png',
-        yl:'/static_file/background.yl',
-        jcsfcjtzd:'/static_file/jcsfcjtzd.png',
-        kapiantubiao:'/static_file/kapiantubiao.png'
-        
+    debugger;
+    let refresh= app.globalData.refresh;
+    if(refresh==1){
+      wx.showLoading({
+        title: '加载中...',
+      });
+      if(!app.globalData.userWxInfo.token){
+        wx.hideLoading();
+        return;
       }
-    })
-  },
-
-  // 获取用户信息
-  getUserInfo() {
+      const _this = this;
+      debugger;
+      wx.request({
+        url: app.globalData.interfaceUrls.homePageInfo+app.globalData.currentAccountInfo.usernumber,
+        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({
+            billInfo:{
+              totalAmount:apiReturnData.data.duFees,  // 总计应缴
+              waterUsage:apiReturnData.data.waterConsumption,      // 用水量
+              balance: apiReturnData.data.accountbalance   // 账户余额
+            },
+            userInfo:{
+              name: apiReturnData.data.username,
+              accountNumber: apiReturnData.data.usernumber,
+              address: apiReturnData.data.address
+            },
+          })
+        },
+        fail(error) {
+          wx.hideLoading()
+          utils.simleInfo('登录失败,请稍后再试')
+        }
+      })
+    }
   },
-
-  // 获取账单信息
-  getBillInfo() {
+  onShow() {
+   
   },
-
+ 
   // 切换水表
   handleSwitchMeter() {
     wx.navigateTo({

+ 0 - 10
pages/homepage/homepage.wxss

@@ -35,16 +35,6 @@
   z-index: 1;
 }
 
-.user-card {
-  position: relative;
-  background-color: #ffffff;
-  border-radius: 20rpx;
-  overflow: hidden;
-  padding-bottom: 30rpx;
-  top: 70rpx;
-  margin: 30rpx 30rpx 30rpx;
-}
-
 .user-info-section {
   padding: 10rpx;
 }

+ 28 - 22
pages/huhaobangding/huhaobangding.js

@@ -23,27 +23,11 @@ Page({
     customTag: '',
     tagLength: 0,
     showQueryMethods: false,
+    // 水站联系方式
     phoneQueryList: [
-      {
-        id: 1,
-        name: '1、前进西路营业厅',
-        phone: ' 17630145126',
-        time: '8:30-17:30'
-      },
-      {
-        id: 2,
-        name: '2、浦江路营业厅',
-        phone: '0516-17630145126',
-        time: '8:30-17:30'
-      },
-      {
-        id: 3,
-        name: '3、 测试路营业厅',
-        phone: '17630145126-345',
-        time: '8:30-17:30'
-      }
-      // 可以添加更多项,将支持滚动显示
-    ]
+    ],
+    // 户号预览图地址
+    ylt:''
   },
 
   selectTag(e) {
@@ -134,7 +118,17 @@ Page({
     this.setData({
       waterCompanyIndex: this.data.waterCompanyIndex,
       waterCompany: this.data.waterCompanyList[index].name,
-      showWaterCompanyPicker: false
+      showWaterCompanyPicker: false,
+      phoneQueryList:  this.data.waterCompanyList[index].businessPoint.map((data,index)=>{
+        return  {
+          id: index+1,
+          name:  index+1+'、'+data.address,
+          phone: data.cphone,
+          time: data.worktime
+        }
+      }),
+      ylt:app.globalData.imgPreviewUrl+this.data.waterCompanyList[index].swCompanyInfo.overduenoticeimage.split("-;-")[1]
+      
     });
   },
 
@@ -214,10 +208,12 @@ Page({
         if(apiReturnData.code=='200'){
           wx.hideLoading();
           utils.simleInfo('绑定成功')
+          app.globalData.currentAccountInfo=apiReturnData.data[0];
           setTimeout(function(){
+            app.globalData.refresh=1;
             wx.switchTab({
               url: '/pages/homepage/homepage',
-            })
+            });
           },2000)
         }else{
           wx.showToast({
@@ -225,6 +221,7 @@ Page({
             icon: 'error',
             duration: 2000
           })
+          wx.hideLoading();
         }
       },fail(error) {
         wx.hideLoading()
@@ -249,6 +246,15 @@ Page({
         waterCompanyIndex:[app.globalData.waterCompanys.findIndex(data=>data.id==app.globalData.launchPara)],
         waterCompany: app.globalData.waterCompanys.filter(data=>data.id==app.globalData.launchPara)[0].name,
         isChange:false,
+        phoneQueryList: app.globalData.waterCompanys.filter(data=>data.id==app.globalData.launchPara)[0].businessPoint.map((data,index)=>{
+          return  {
+            id: index+1,
+            name: data.address,
+            phone: data.contactphone,
+            time: data.worktime
+          }
+        }),
+        ylt:app.globalData.imgPreviewUrl+app.globalData.waterCompanys.filter(data=>data.id==app.globalData.launchPara)[0].swCompanyInfo.overduenoticeimage.split("-;-")[1]
       });
     }
   },

+ 1 - 1
pages/huhaobangding/huhaobangding.wxml

@@ -127,7 +127,7 @@
 <!-- 修改预览模态框部分 -->
 <view class="preview-modal {{showPreview ? 'show' : ''}}" bindtap="closePreview">
   <view class="preview-content" catchtap="preventBubble">
-    <image class="preview-image" src="/static_file/jcsfcjtzd.jpg" mode="widthFix"></image>
+    <image class="preview-image" src="{{ylt}}" mode="widthFix"></image>
     <view class="close-preview-btn" bindtap="closePreview">关闭</view>
   </view>
 </view>

+ 38 - 136
pages/zhangdanlist/zhangdanlist.js

@@ -1,3 +1,4 @@
+const app = getApp();
 Page({
   data: {
     images: {
@@ -5,19 +6,9 @@ Page({
       water: '/static_file/water.png'
     },
     userInfo: {
-      name: '王源',
-      id: '320185452454104',
-      address: '徐州市丰县****楼102室'
-    },
-    amount: 73.28, //应缴金额
-    actualAmount: 73.28,
-    balance: 0,   // 余额
-    quickAmounts: [10, 30, 50, 100, 200, 500],
-    waterUsage: {
-      lastReading: 2000,
-      currentReading: 2050,
-      nextReading: 3020,
-      usage: 87
+      name: app.globalData.currentAccountInfo.username,
+      id:  app.globalData.currentAccountInfo.usernumber,
+      address: app.globalData.currentAccountInfo.address
     },
     showKeyboard: false,
     selectedAmount: null,
@@ -35,136 +26,47 @@ Page({
         water: '/static_file/water.png'
       }
     });
-    
-    // 获取地址信息
-    if (options.address) {
-      this.setData({
-        address: options.address
-      });
-    }
-    
     // 获取账单列表
     this.getBillList();
   },
   
-  // 返回上一页
-  goBack: function() {
-    wx.navigateBack({
-      delta: 1
+  getBillList:function(){
+    const _this = this;
+    wx.showLoading({
+      title: '获取中...',
+      mask: true,
     });
+      debugger;
+      wx.request({
+        url: app.globalData.interfaceUrls.billList,
+        method: 'POST',
+        data: {
+          accountNum: app.globalData.currentAccountInfo.usernumber,
+          year: new Date().getFullYear()
+        },
+        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({
+            billList:apiReturnData.data,
+          })
+        },
+        fail(error) {
+          wx.hideLoading()
+          utils.simleInfo('登录失败,请稍后再试')
+        }
+      });
   },
-  
-  // 从接口获取账单列表数据
-  getBillList: function() {
-    // 这里应该是从API获取数据,这里用模拟数据
-    const mockData = [
-      {
-        billDate: '2025/01/30',
-        billNumber: '250201100235',
-        amount: '73.28',
-        usage: '87',
-        meterReading: '2000-2025',
-        paymentTime: '2025/01/31 14:39',
-        isPaid: false,
-        currentDate: '2025/01/30',
-        currentReading: '2025',
-        lastDate: '2024/12/30',
-        lastReading: '2000',
-        totalAmount: '85.62',
-        discount: '12.34',
-        lateFee: '0',
-        payableAmount: '73.28'
-      },
-      {
-        billDate: '2024/12/30',
-        billNumber: '250201103521',
-        amount: '127.28',
-        usage: '121',
-        meterReading: '2000-2025',
-        paymentTime: '2025/01/03 09:51',
-        isPaid: true,
-        currentDate: '2024/12/30',
-        currentReading: '2000',
-        lastDate: '2024/11/30',
-        lastReading: '1975',
-        totalAmount: '137.28',
-        discount: '10.00',
-        lateFee: '0',
-        payableAmount: '127.28'
-      },
-      {
-        billDate: '2024/11/30',
-        billNumber: '250201103521',
-        amount: '127.28',
-        usage: '121',
-        meterReading: '2000-2025',
-        paymentTime: '2024/12/03 09:51',
-        isPaid: true,
-        currentDate: '2024/11/30',
-        currentReading: '1975',
-        lastDate: '2024/10/31',
-        lastReading: '1950',
-        totalAmount: '137.28',
-        discount: '10.00',
-        lateFee: '0',
-        payableAmount: '127.28'
-      },
-      {
-        billDate: '2024/11/30',
-        billNumber: '250201103521',
-        amount: '127.28',
-        usage: '121',
-        meterReading: '2000-2025',
-        paymentTime: '2024/12/03 09:51',
-        isPaid: true,
-        currentDate: '2024/11/30',
-        currentReading: '1950',
-        lastDate: '2024/10/31',
-        lastReading: '1925',
-        totalAmount: '137.28',
-        discount: '10.00',
-        lateFee: '0',
-        payableAmount: '127.28'
-      },
-      {
-        billDate: '2024/11/30',
-        billNumber: '250201103521',
-        amount: '127.28',
-        usage: '121',
-        meterReading: '2000-2025',
-        paymentTime: '2024/12/03 09:51',
-        isPaid: true,
-        currentDate: '2024/11/30',
-        currentReading: '1925',
-        lastDate: '2024/10/31',
-        lastReading: '1900',
-        totalAmount: '137.28',
-        discount: '10.00',
-        lateFee: '0',
-        payableAmount: '127.28'
-      },
-      {
-        billDate: '2024/11/30',
-        billNumber: '250201103521',
-        amount: '127.28',
-        usage: '121',
-        meterReading: '2000-2025',
-        paymentTime: '2024/12/03 09:51',
-        isPaid: true,
-        currentDate: '2024/11/30',
-        currentReading: '1900',
-        lastDate: '2024/10/31',
-        lastReading: '1875',
-        totalAmount: '137.28',
-        discount: '10.00',
-        lateFee: '0',
-        payableAmount: '127.28'
-      }
-    ];
+  // 返回上一页
+  goBack: function() {
     
-    this.setData({
-      billList: mockData
-    });
   },
   
   // 点击开发票按钮

+ 1 - 1
pages/zhangdanxiangqing/zdxiangqing.wxml

@@ -60,7 +60,7 @@
   <view class="bill-card">
     <view class="bill-row total">
       <text>应缴费用</text>
-      <text>{{billDetail.payableAmount}}元</text>
+      <text>{{billDetail.amount}}元</text>
     </view>
   </view>
 </view>