QAQ 陈 преди 4 месеца
родител
ревизия
427a05f1cc

+ 2 - 2
app.js

@@ -1,8 +1,8 @@
 // app.js
 const utils = require('/utils/util.js')
 // const baseIp= "http://localhost:9747"
-// const baseIp= "http://61.177.40.178:8000/zhsw"
-const baseIp = "http://192.168.0.215:9000/zhsw"  // 根据实际情况调整端口号
+// const baseIp= "https://www.izilaishui.com:9000/zhsw"
+const baseIp = "http://192.168.0.215:9000/zhsw"
 // 图片预览地址
 
 App({

+ 2 - 1
app.json

@@ -42,7 +42,8 @@
   "window": {
     "backgroundTextStyle": "light",
     "navigationBarBackgroundColor": "#4080FF",
-    "navigationStyle": "custom"
+    "navigationStyle": "custom",
+    "resizable": true
   },
   "componentFramework": "glass-easel",
   "sitemapLocation": "sitemap.json",

+ 37 - 8
pages/huhaobangding/huhaobangding.js

@@ -20,6 +20,7 @@ Page({
     
     huHao: '',
     huMing: '',
+    phone: '',  // 添加手机号字段
     customTag: '',
     tagLength: 0,
     showQueryMethods: false,
@@ -228,6 +229,21 @@ Page({
     });
   },
 
+  // 手机号输入
+  onPhoneInput: function(e) {
+    // 使用正则表达式去除非数字字符
+    const value = e.detail.value.replace(/[^\d]/g, '');
+    this.setData({
+      phone: value
+    });
+  },
+
+  // 验证手机号格式
+  validatePhone: function(phone) {
+    const phoneReg = /^1[3-9]\d{9}$/;
+    return phoneReg.test(phone);
+  },
+
   // 确认绑定
   confirmBinding: function() {
     // 如果已经在处理绑定请求,则直接返回
@@ -259,9 +275,18 @@ Page({
       return;
     }
 
-    if (!this.data.huMing) {
+    if (!this.data.phone) {
       wx.showToast({
-        title: '请输入户名',
+        title: '请输入手机号',
+        icon: 'none'
+      });
+      this.setData({ isBinding: false }); // 重置状态
+      return;
+    }
+
+    if (!this.validatePhone(this.data.phone)) {
+      wx.showToast({
+        title: '请输入正确的手机号',
         icon: 'none'
       });
       this.setData({ isBinding: false }); // 重置状态
@@ -291,6 +316,7 @@ Page({
       bindWaterCompany: this.data.waterCompanyList[this.data.waterCompanyIndex[0]].id,
       accountNum: this.data.huHao,
       accountName: this.data.huMing,
+      phoneNum: this.data.phone,  // 添加手机号字段
       groupType: finalTag,  // 使用处理后的标签值
       openId: app.globalData.userWxInfo.openid,
       otherDsKey: (app.globalData.bindAccountInfo||[]).map(data=>data.dsKey)
@@ -346,13 +372,16 @@ Page({
             });
           },2000)
         }else{
-          wx.showToast({
-            title: apiReturnData.msg,
-            icon: 'error',
-            duration: 4000
-          })
           wx.hideLoading();
-          that.setData({ isBinding: false }); // 重置绑定状态
+          setTimeout(() => {
+            wx.showToast({
+              title: apiReturnData.msg,
+              icon: 'none',
+              duration: 2000,
+              mask: true
+            });
+            that.setData({ isBinding: false }); // 重置绑定状态
+          }, 100);
         }
       },
       fail(error) {

+ 5 - 1
pages/huhaobangding/huhaobangding.wxml

@@ -41,7 +41,11 @@
     </view>
 
     <view class="form-item">
-      <text class="label">户名<text class="required">*</text></text>
+      <text class="label">手机号<text class="required">*</text></text>
+      <input type="number" maxlength="11" placeholder="请输入手机号" placeholder-class="placeholder" bindinput="onPhoneInput" value="{{phone}}" />
+    </view>
+    <view class="form-item">
+      <text class="label">户名<text class="optional"></text></text>
       <input type="text" maxlength="30" placeholder="请输入户名" placeholder-class="placeholder" bindinput="onHuMingInput" value="{{huMing}}" />
     </view>
   </view>

+ 4 - 0
pages/jiaofeixiangqing/jiaofeixiangqing.js

@@ -23,6 +23,10 @@ Page({
                                          this.padZero(date.getDate());
             }
           });
+          // 按抄表日期降序排序
+          billDetail.bills.sort((a, b) => {
+            return new Date(b.thismeterreadingdate) - new Date(a.thismeterreadingdate);
+          });
         }
         // 设置页面数据
         this.setData({

+ 4 - 2
pages/jiaofeixiangqing/jiaofeixiangqing.wxml

@@ -65,8 +65,10 @@
           <view class="bill-header">
             <view class="meter-reading">
               <text class="water-icon">💧</text>
-              <text class="bill-number">{{item.billnumber}}</text>
-              <text class="due-date">抄表日 {{item.thismeterreadingdate}}</text>
+              <view class="bill-info">
+                <text class="bill-number">{{item.billnumber}}</text>
+                <text class="due-date">抄表日 {{item.thismeterreadingdate}}</text>
+              </view>
             </view>
             <view class="payment-status-tag {{item.status === '3' ? 'paid-tag' : 'unpaid-tag'}}">
               {{item.status === '3' ? '已缴费' : '未缴费'}}

+ 10 - 3
pages/jiaofeixiangqing/jiaofeixiangqing.wxss

@@ -120,7 +120,7 @@
 
 /* 创建一个滚动内容区域,但考虑顶部固定区域的高度 */
 .scrollable-content {
-  margin-top: 400rpx;
+  margin-top: 380rpx;
   padding: 0 24rpx;
 }
 
@@ -156,7 +156,7 @@
 
 .meter-reading {
   display: flex;
-  align-items: center;
+  align-items: flex-start;
   flex-wrap: wrap;
 }
 
@@ -164,18 +164,25 @@
   margin-right: 10rpx;
   color: #1890ff;
   font-size: 30rpx;
+  margin-top: 4rpx;
+}
+
+.bill-info {
+  display: flex;
+  flex-direction: column;
+  flex: 1;
 }
 
 .bill-number {
   font-weight: 500;
   color: #333;
   font-size: 28rpx;
+  margin-bottom: 4rpx;
 }
 
 .due-date {
   font-size: 24rpx;
   color: #999;
-  margin-left: 16rpx;
 }
 
 /* 支付状态标签 */

+ 119 - 82
pages/lijijiaofei/lijijiaofei.js

@@ -24,10 +24,13 @@ Page({
       usage: 87
     },
     showKeyboard: false,
-    selectedAmount: null,
+    selectedAmount: 0,
     customAmount: '',
     inputFocus: false,
     zdId:"",
+    amount: 0,
+    actualAmount: 0,
+    balance: 0
   },
   onLoad(options) {
     const _this=this;
@@ -44,11 +47,12 @@ Page({
         wx.hideLoading();
         let apiReturnData = res.data;
         _this.setData({
-          amount: apiReturnData.data.yj, // 默认实缴金额为应缴金额
           actualAmount: apiReturnData.data.yj, // 设置应缴金额
-          balance:  apiReturnData.data.ye,   //余额
-          zdId:  apiReturnData.data.zdId  // 对应的账单记录
+          balance: apiReturnData.data.ye,   //余额
+          zdId: apiReturnData.data.zdId  // 对应的账单记录
         });
+        // 计算默认实缴金额
+        _this.calculateDefaultAmount();
       },
       fail(error) {
         wx.hideLoading();
@@ -81,23 +85,61 @@ Page({
     this.fetchPaymentData();
   },
 
+  // 计算默认实缴金额
+  calculateDefaultAmount: function() {
+    const { actualAmount, balance } = this.data;
+    const difference = actualAmount - balance;
+    
+    if (difference <= 0) {
+      this.setData({
+        amount: 0
+      });
+    } else {
+      this.setData({
+        amount: difference
+      });
+    }
+  },
+
+  // 验证实缴金额
+  validateAmount: function(amount) {
+    const { actualAmount, balance } = this.data;
+    const difference = actualAmount - balance;
+    
+    if (difference <= 0) {
+      return amount > 0;
+    } else {
+      return amount >= difference;
+    }
+  },
+
   // 选择快捷金额
   selectAmount: function(e) {
-    const amount = e.currentTarget.dataset.amount;
+    const amount = parseFloat(e.currentTarget.dataset.amount);
     this.setData({
-      amount: parseFloat(amount),
-      selectedAmount: parseFloat(amount),
-      customAmount: '' // 清空自定义金额
+      selectedAmount: amount,
+      amount: amount,
+      customAmount: ''
     });
   },
 
   // 立即缴费
   payNow: function() {
-    if (this.data.amount <= 0) {
+    const { amount, actualAmount, balance } = this.data;
+    
+    if (amount <= 0) {
       wx.showToast({
         title: '请输入缴费金额',
-        icon: 'none',
-        duration: 2000
+        icon: 'none'
+      });
+      return;
+    }
+
+    if (actualAmount > 0 && amount + balance < actualAmount) {
+      const minPayment = actualAmount - balance;
+      wx.showToast({
+        title: '最低缴费金额:'+ minPayment + '元',
+        icon: 'none'
       });
       return;
     }
@@ -120,7 +162,6 @@ Page({
         dskey: app.globalData.currentAccountInfo.dsKey
       },
       success: res => {
-        debugger
         if(res.data.code === '200'){
           wx.hideLoading();
           console.log('预下单', res);
@@ -149,28 +190,13 @@ Page({
             // const payStatus = parts[1];  
             wx.showToast({
               title: errorMessage,
-              icon: 'none',  // 不显示图标
+              icon: 'none',  
               duration: 2000  // 持续2秒
           });
           }
         }
       }
     })
-    // 模拟支付
-    // setTimeout(() => {
-    //   wx.hideLoading();
-    //   wx.showToast({
-    //     title: '缴费成功',
-    //     icon: 'success',
-    //     duration: 2000,
-    //     success: () => {
-    //       // 支付成功后返回首页
-    //       setTimeout(() => {
-    //         wx.navigateBack();
-    //       }, 2000);
-    //     }
-    //   });
-    // }, 1500);
   },
 
   // 返回上一页
@@ -237,26 +263,78 @@ Page({
     });
   },
 
+  // 自定义金额输入
+  onCustomAmountInput: function(e) {
+    let value = e.detail.value;
+    
+    // 只允许输入数字和小数点
+    value = value.replace(/[^\d.]/g, '');
+    
+    // 处理前导零
+    if (value.startsWith('0')) {
+      // 如果只有一个0,保持不变
+      if (value.length === 1) {
+        // 保持原样
+      } else if (value.startsWith('0.')) {
+        // 如果是0.开头,保持原样
+      } else {
+        // 移除前导零,但保留单个0
+        value = value.replace(/^0+/, '');
+        if (value === '') value = '0';
+      }
+    }
+    
+    // 处理小数点
+    if (value.includes('.')) {
+      const parts = value.split('.');
+      // 只保留第一个小数点
+      if (parts.length > 2) {
+        value = parts[0] + '.' + parts.slice(1).join('');
+      }
+      // 限制小数点后两位
+      if (parts[1].length > 2) {
+        value = parts[0] + '.' + parts[1].substring(0, 2);
+      }
+    }
+    
+    const amount = parseFloat(value) || 0;
+    
+    this.setData({
+      customAmount: value,
+      amount: amount,
+      selectedAmount: 0
+    });
+  },
+
   // 输入数字
   inputNumber: function(e) {
     const number = e.currentTarget.dataset.number;
     let customAmount = this.data.customAmount;
 
     // 处理小数点
-    if (number === '.' && customAmount.includes('.')) {
-      return;
-    }
-
-    // 限制小数点后两位
-    if (customAmount.includes('.') && customAmount.split('.')[1].length >= 2 && number !== '.') {
-      return;
-    }
-
-    // 处理首位为0的情况
-    if (customAmount === '0' && number !== '.') {
-      customAmount = number;
+    if (number === '.') {
+      if (customAmount.includes('.')) {
+        return; // 已经有小数点了,不能再输入
+      }
+      if (customAmount === '') {
+        customAmount = '0.'; // 如果直接输入小数点,前面补0
+      } else {
+        customAmount += '.';
+      }
     } else {
-      customAmount += number;
+      // 处理首位为0的情况
+      if (customAmount === '0' && number !== '.') {
+        customAmount = number;
+      } else {
+        // 限制小数点后两位
+        if (customAmount.includes('.')) {
+          const parts = customAmount.split('.');
+          if (parts[1].length >= 2) {
+            return; // 小数点后已经有两位了,不能再输入
+          }
+        }
+        customAmount += number;
+      }
     }
 
     // 更新金额
@@ -291,47 +369,6 @@ Page({
     });
   },
 
-  // 添加自定义金额输入处理函数
-  onCustomAmountInput: function(e) {
-    let value = e.detail.value;
-
-    // 只允许数字和小数点,且小数点后最多两位
-    if (value) {
-      // 移除非数字和小数点字符
-      value = value.replace(/[^\d.]/g, '');
-
-      // 确保只有一个小数点
-      const parts = value.split('.');
-      if (parts.length > 2) {
-        value = parts[0] + '.' + parts.slice(1).join('');
-      }
-
-      // 处理前导零
-      if (parts[0]) {
-        parts[0] = parts[0].replace(/^0+/, '') || '0';
-      }
-
-      // 限制小数点后最多两位
-      if (parts.length === 2 && parts[1].length > 2) {
-        parts[1] = parts[1].substring(0, 2);
-      }
-
-      // 重新组合数字
-      value = parts.join('.');
-      
-      // 限制总长度小于8位(包含小数点)
-      if (value.length > 7) {
-        value = value.substring(0, 7);
-      }
-    }
-
-    this.setData({
-      customAmount: value,
-      selectedAmount: 0, // 清除其他金额选择
-      amount: value || '0.00' // 更新显示金额
-    });
-  },
-
   // 输入框获得焦点
   onInputFocus: function() {
     this.setData({

+ 8 - 3
pages/lijijiaofei/lijijiaofei.wxml

@@ -1,4 +1,4 @@
-<view class="container">
+<view class="ljcontainer">
   <view bindtap="goBack">
       <image src="/static_file/backcion.png" mode="aspectFit" class="back-icon"></image>
     </view>
@@ -58,8 +58,13 @@
 
   <!-- 温馨提示 - 调整位置 -->
   <view class="tips">
-    <text class="tips-title">温馨提示:</text>
-    <text class="tips-content">若无应缴金额,系统将充值到余额。</text>
+    <view class="tips-header">
+      <text class="tips-title">温馨提示:</text>
+    </view>
+    <view class="tips-body">
+      <text class="tips-content">若无应缴金额,系统将充值到余额。</text>
+      <text class="tips-content">实缴需大于0 且 实缴+余额 需大于应缴。</text>
+    </view>
   </view>
 
   <!-- 缴费按钮 - 调整样式 -->

+ 30 - 16
pages/lijijiaofei/lijijiaofei.wxss

@@ -1,12 +1,12 @@
-.container {
+.ljcontainer {
   display: flex;
   flex-direction: column;
-  background-color: rgba(255, 255, 255, 1);
+  background-color: #f5f5f5;
   min-height: 100vh;
   padding-bottom: 30rpx;
-  position: relative;
-  height: 100vh;
-  overflow: hidden;
+  padding: 0;
+  box-sizing: border-box;
+  width: 100%;
 }
 
 .header {
@@ -278,24 +278,38 @@
   background-color: rgba(30, 144, 255, 0.05);
 }
 
-/* 温馨提示位置调整 */
+/* 温馨提示样式 */
 .tips {
-  font-size: 24rpx;
+  margin: -200rpx 30rpx 20rpx 30rpx;
   color: #999;
-  padding: 20rpx 30rpx;
-  top: -200rpx;
-  text-align: left;
-  border-top: none;
-  position: relative;
-  left: -100rpx;
+  border-radius: 16rpx;
+  padding: 24rpx;
+  width: calc(100% - 60rpx);
+  box-sizing: border-box;
+}
+
+.tips-header {
+  margin-bottom: 16rpx;
 }
 
 .tips-title {
-  color:  rgba(239, 93, 93, 1);
+  color: #EF5D5D;
+  font-size: 28rpx;
+  font-weight: 500;
 }
-tips-content {
-  color:  rgba(104, 108, 128, 1);
+
+.tips-body {
+  display: flex;
+  flex-direction: column;
+  gap: 8rpx;
+}
+
+.tips-content {
+  color: #666666;
+  font-size: 26rpx;
+  line-height: 1.5;
 }
+
 /* 数字键盘样式优化 */
 .keyboard {
   position: fixed;

+ 3 - 4
pages/tongzhiList/tongzhiList.js

@@ -216,7 +216,7 @@ Page({
     
     // 调用获取公告列表API
     wx.request({
-      url: app.globalData.apiUrl + '/api/getNotices', // 根据你的实际API地址调整
+      url: app.globalData.apiUrl + '/api/getNotices', 
       method: 'GET',
       success: (res) => {
         if (res.data.success) {
@@ -239,10 +239,10 @@ Page({
    */
   fetchUserMessages: function() {
     wx.request({
-      url: app.globalData.apiUrl + '/api/getUserMessages', // 根据你的实际API地址调整
+      url: app.globalData.apiUrl + '/api/getUserMessages', 
       method: 'GET',
       data: {
-        userId: app.globalData.userId // 假设全局有用户ID
+        userId: app.globalData.userId 
       },
       success: (res) => {
         if (res.data.success) {
@@ -271,7 +271,6 @@ Page({
   
   // 页面显示时刷新数据
   onShow: function() {
-    // 获取最新消息数据而不是从全局获取
     this.fetchLatestMessages();
   }
 })

+ 12 - 4
pages/zhangdanlist/zhangdanlist.js

@@ -84,10 +84,14 @@ Page({
         success(res) {
           wx.hideLoading();
           let apiReturnData = res.data;
+          // 对账单列表按日期排序
+          const sortedBills = apiReturnData.data.sort((a, b) => {
+            return new Date(b.billDate) - new Date(a.billDate);
+          });
           _this.setData({
-            billList: apiReturnData.data,
+            billList: sortedBills,
           });
-          resolve(apiReturnData.data);
+          resolve(sortedBills);
         },
         fail(error) {
           wx.hideLoading();
@@ -246,9 +250,13 @@ Page({
       success(res) {
         wx.hideLoading();
         let apiReturnData = res.data;
+        // 对账单列表按日期排序
+        const sortedBills = apiReturnData.data.sort((a, b) => {
+          return new Date(b.billDate) - new Date(a.billDate);
+        });
         _this.setData({
-          billList: apiReturnData.data,
-          originalBillList: apiReturnData.data
+          billList: sortedBills,
+          originalBillList: sortedBills
         });
       },
       fail(error) {

+ 1 - 1
project.config.json

@@ -1,6 +1,6 @@
 {
   "compileType": "miniprogram",
-  "libVersion": "trial",
+  "libVersion": "3.3.4",
   "packOptions": {
     "ignore": [],
     "include": []

+ 1 - 1
project.private.config.json

@@ -19,7 +19,7 @@
     "ignoreDevUnusedFiles": true,
     "bigPackageSizeSupport": false
   },
-  "libVersion": "3.7.9",
+  "libVersion": "3.7.11",
   "condition": {
     "miniprogram": {
       "list": [