管灌系统农户端微信小程序(嘉峪关应用)
zuoxiao
2024-06-13 5dc54a59184b305a85aaad31dd4cce01b31a8a2d
开关泵定版

开关泵定版
4个文件已删除
1 文件已重命名
25个文件已修改
6个文件已添加
1761 ■■■■■ 已修改文件
api/config.js 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
app.js 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
app.json 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
app.wxss 23 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
images/phone.svg 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
images/tape.svg 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pages/feedback/feedback.js 267 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pages/feedback/feedback.json 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pages/feedback/feedback.wxml 33 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pages/feedback/feedback.wxss 131 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pages/home/home.js 93 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pages/home/home.wxml 12 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pages/home/home.wxss 69 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pages/logs/logs.js 18 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pages/logs/logs.json 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pages/logs/logs.wxml 6 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pages/logs/logs.wxss 16 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pages/openCard/openCard.js 61 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pages/openCard/openCard.wxml 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
pages/openCard/openCard.wxss 4 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
pages/rechargeCard/rechargeCard.js 136 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pages/rechargeCard/rechargeCard.json 4 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
pages/rechargeCard/rechargeCard.wxml 4 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
pages/rechargeCard/rechargeCard.wxss 3 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pages/rechargeMoney/rechargMoney.js 49 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pages/rechargeMoney/rechargMoney.wxml 40 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pages/rechargeMoney/rechargMoney.wxss 333 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pages/valveList/valveList.js 14 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pages/valveList/valveList.json 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pages/valveList/valveList.wxml 30 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pages/valveList/valveList.wxss 29 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pages/waterIntake/waterIntake.js 159 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pages/waterIntake/waterIntake.json 3 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pages/waterIntake/waterIntake.wxml 46 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pages/waterIntake/waterIntake.wxss 147 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
project.private.config.json 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
api/config.js
@@ -6,7 +6,7 @@
    BASEURL = ''
    break
  case 'test':
    BASEURL = 'https://44978f7456.imdo.co/remote/'
    BASEURL = 'https://irrigate.dayuyanjiuyuan.top/'
    break
  default:
    BASEURL = ''
app.js
@@ -14,7 +14,7 @@
    })
  },
  globalData: {
    sessionId:'2024042414041300006',
    sessionId:'2024052821300200006',
    userInfo: null,
    userId:"",
    userCode:"",
app.json
@@ -1,17 +1,18 @@
{
  "pages": [
    "pages/home/home",
    "pages/valveList/valveList",
    "pages/feedback/feedback",
    "pages/wxlogin/wxlogin",
    "pages/login/login",
    "pages/wxbind/wxbind",
    "pages/rechargeList/rechargeList",
    "pages/wallet/wallet",
    "pages/index/index",
    "pages/logs/logs",
    "pages/my/my",
    "pages/waterIntake/waterIntake",
    "pages/personCharge/personcharge",
    "pages/feedback/feedback",
    "pages/openCard/openCard",
    "pages/rechargeMoney/rechargMoney",
    "pages/rechargeCard/rechargeCard"
app.wxss
@@ -8,13 +8,18 @@
  box-sizing: border-box;
.noMore-View {
  flex: 1;
  display: flex;
  /* display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  height: 100%;
  text-align: center;
  flex-direction: column;
  height: 100vh;
  width: 100%;
  text-align: center; */
  display: flex;
  flex-direction: column; /* 确保子元素纵向排列 */
  justify-content: center; /* 垂直居中 */
  align-items: center; /* 水平居中 */
  height: 100%; /* 让容器高度占满父元素 */
}
.noMore-img{
@@ -24,4 +29,12 @@
.noMore-text{
  color:#969494;
}
.list-container {
  display: flex;
  flex: 1;
  overflow-y: auto;
  z-index: 0;
  margin-top: 10rpx;
}
images/phone.svg
New file
@@ -0,0 +1,4 @@
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="18.6175537109375" height="18.306396484375" viewBox="0 0 18.6175537109375 18.306396484375" fill="none">
<path d="M14.3121 18.3064C13.4059 18.3064 12.3896 18.135 11.3243 17.8043C8.76513 17.0084 6.24269 15.3431 4.22229 13.1145C1.19781 9.7717 -0.24709 6.44109 0.0345342 3.47782C0.120245 2.74312 0.35291 1.81251 1.45494 1.06558C2.29984 0.379873 3.26719 -0.0119789 4.02635 0.000278951C4.82229 0.0125132 5.09168 0.294138 5.91208 1.4819C7.1733 3.22069 7.25901 4.07782 7.21003 4.56762C7.12432 5.37579 6.6835 5.73089 6.27942 6.04924C6.18147 6.12272 6.0835 6.20843 5.99779 6.28191C5.508 6.9064 4.908 7.77579 7.47942 10.4329C9.67127 12.539 10.859 12.7962 11.361 12.7594C11.7529 12.735 11.8998 12.5268 11.961 12.4533L11.9733 12.4411C12.7937 11.2901 13.0631 11.0084 13.8468 10.886C14.6059 10.7635 14.9978 11.0084 16.6141 12.0248C18.0713 12.9431 18.7447 13.5554 18.5978 14.5227C18.5488 15.5758 17.7406 17.0084 16.8345 17.6574C16.21 18.086 15.3406 18.3064 14.3121 18.3064Z"   fill="#2D8BF7" >
</path>
</svg>
images/tape.svg
New file
@@ -0,0 +1 @@
<?xml version="1.0" encoding="UTF-8"?><svg width="24" height="24" viewBox="0 0 48 48" fill="none" xmlns="http://www.w3.org/2000/svg"><rect x="17" y="4" width="14" height="27" rx="7" fill="none" stroke="#1890FF" stroke-width="4" stroke-linejoin="round"/><path d="M9 23C9 31.2843 15.7157 38 24 38C32.2843 38 39 31.2843 39 23" stroke="#1890FF" stroke-width="4" stroke-linecap="round" stroke-linejoin="round"/><path d="M24 38V44" stroke="#1890FF" stroke-width="4" stroke-linecap="round" stroke-linejoin="round"/></svg>
pages/feedback/feedback.js
@@ -2,20 +2,41 @@
  data: {
    recordingSrc: '',
    isRecording: false,
    isshowVoiceMask: true, //是否显示录音中
    voiceTime: 2, //录音时长
    gridConfig: {
      column: 3,
      width: 160,
      height: 160,
    },
    originFiles: [{
        url: 'https://tdesign.gtimg.com/mobile/demos/example4.png',
        name: 'uploaded1.png',
        type: 'image',
      },
      {
        url: 'https://tdesign.gtimg.com/mobile/demos/example6.png',
        name: 'uploaded2.png',
        type: 'image',
      }
    ]
  },
  onLoad() {
    this.recorderManager = wx.getRecorderManager();
    this.recorderManager.onStart(() => {
      console.log('recorder start');
      this.setData({ isRecording: true });
      this.setData({
        isRecording: true
      });
      this.startWaveformDrawing();
    });
    this.recorderManager.onStop((res) => {
      console.log('recorder stop', res);
      const { tempFilePath } = res;
      const {
        tempFilePath
      } = res;
      this.setData({
        recordingSrc: tempFilePath,
        isRecording: false
@@ -25,73 +46,189 @@
    this.recorderManager.onError((res) => {
      console.error(res);
      this.setData({ isRecording: false });
      this.setData({
        isRecording: false
      });
      this.stopWaveformDrawing();
    });
  },
  startRecording() {
    if (this.data.isRecording) return;
    wx.authorize({
      scope: 'scope.record',
      success: () => {
        const options = {
          duration: 60000,
          sampleRate: 44100,
          numberOfChannels: 1,
          encodeBitRate: 192000,
          format: 'aac',
          frameSize: 50
        };
        this.recorderManager.start(options);
      },
      fail: () => {
        wx.showModal({
          title: '授权失败',
          content: '请授权录音功能',
          showCancel: false
        });
      }
  handleRemove(e) {
    console.log("handleRemove");
    const {
      index
    } = e.detail;
    const {
      originFiles
    } = this.data;
    originFiles.splice(index, 1);
    this.setData({
      originFiles,
    });
  },
  stopRecording() {
    if (!this.data.isRecording) return;
    this.recorderManager.stop();
  handleClick() {
    console.log("handleClick");
  },
  startWaveformDrawing() {
    if (this.waveformInterval) return;
    const canvasContext = wx.createCanvasContext('waveform');
    const drawWaveform = () => {
      if (!this.data.isRecording) return;
      // 生成模拟的音量数据
      const data = new Array(100).fill(0).map(() => Math.random() * 100);
      canvasContext.clearRect(0, 0, 300, 100);
      canvasContext.beginPath();
      canvasContext.moveTo(0, 50);
      for (let i = 0; i < data.length; i++) {
        const x = (i / data.length) * 300;
        const y = 50 - data[i] / 2;
        canvasContext.lineTo(x, y);
      }
      canvasContext.lineTo(300, 50);
      canvasContext.stroke();
      canvasContext.draw();
      this.waveformInterval = setTimeout(drawWaveform, 100);
    };
    drawWaveform();
  handleAdd(e) {
    console.log("handleAdd");
    const {
      files
    } = e.detail;
    const {
      originFiles
    } = this.data;
    this.setData({
      originFiles: [...originFiles, ...files], // 此时设置了 fileList 之后才会展示选择的图片
    });
  },
  /**
   * 上传图片
   */
  onUpload() {
    wx.uploadFile({
      url: 'https://example.weixin.qq.com/upload', // 仅为示例,非真实的接口地址
      filePath: file.url,
      name: 'file',
      formData: {
        user: 'test'
      },
      success: () => {
        this.setData({
          [`fileList[${length}].status`]: 'done',
        });
      },
    });
  },
  //按住按钮
  startHandel () {
    this.setData({
     isShowVoiceMask:true
    })
    console.log("开始录音")
    wx.getRecorderManager().start({
     duration: 0
    })
   },
   //松开按钮
   endHandle () {
    this.setData({
     isShowVoiceMask:false
    })
    console.log("结束")
    const recorderManager = wx.getRecorderManager()
    //录音停止函数
    var that = this;
    wx.getRecorderManager().onStop((res) => {
      const voiceTime =  Math.floor(res.duration/1000)
      console.log('voiceTime',voiceTime);
      that.setData({
        voiceTime
      })
      console.log('res',res);
     const { tempFilePath } = res; //这里松开按钮 会返回录音本地路径
     audio.src = tempFilePath
     console.log(tempFilePath);
     //上传录制的音频到服务器
     // wx.uploadFile({
     //  url: '接口地址' + api.voice, //接口地址
     //  name: 'file', //上传文件名
     //  filePath: tempFilePath,
     //  success: function (res) { //后台返回给前端识别后的文字
     //   var model = res.data
     //   var modeljson = JSON.parse(model)
     //   if (modeljson.status_code == 500) {
     //    wx.showToast({
     //     title: '语音转换失败',
     //     image: '/assets/image/icon/fail@2x.png'
     //    })
     //    return false;
     //   }
     //   if (modeljson.meta.status_code === 200 && !modeljson.data.err_msg) {
     //    var saymessage = modeljson.data.message;
     //    wx.setStorageSync('sayinfo', saymessage)
     //    that.setData({
     //     inpvalue: saymessage
     //    })
     //    setTimeout(() =>{
     //     wx.navigateTo({
     //      url: '../loding/loding'
     //     })
     //    },2000)
     //    setTimeout(() => {
     //     wx.hideLoading();
     //    }, 100)
     //   } else if (modeljson.data.err_msg) {
     //    wx.showToast({
     //     title: '请大声说话',
     //     image: '/assets/image/icon/fail@2x.png'
     //    })
     //    return false;
     //   }
     //  }
     // })
    })
    //触发录音停止
    wx.getRecorderManager().stop()
   },
// 播放
handlePlay(e){
  // 倒计时
  let time = this.data.voiceTime
  audio.play()
  let timer1 = -1,timer2 = -1,timer3 = -1,timer4 = -1,timer5 = -1,timer6 = -1;
  // 第一次播放为0 第二次播放2秒钟
  timer6 = setInterval(()=>{
    console.log('时间',time);
    if(time <= 0){
      this.setData({
        line2Opcity: 1,
        line3Opcity: 1
      })
      clearInterval(timer6)
      clearTimeout(timer2)
      clearTimeout(timer3)
      clearTimeout(timer4)
      clearTimeout(timer5)
      return
    }
    timer2 = setTimeout(()=>{
      console.log('timer2');
      this.setData({
        line2Opcity: 0,
        line3Opcity: 0
      })
    },300)
    timer3 = setTimeout(()=>{
      console.log('timer3');
        this.setData({
          line2Opcity: 1,
          line3Opcity:0
        })
    },600)
    timer4 = setTimeout(()=>{
      console.log('timer4');
        this.setData({
          line2Opcity: 1,
          line3Opcity: 1
      })
    },900)
    timer5 = setTimeout(()=>{
      console.log('timer5');
        this.setData({
          line2Opcity: 0,
          line3Opcity: 0
        })
    },1200)
  },1200)
  // 倒计时
  timer1 = setInterval(()=>{
    time--;
    if(time <= 0){
      clearInterval(timer1)
      return
    }
},1000)
  stopWaveformDrawing() {
    clearTimeout(this.waveformInterval);
    this.waveformInterval = null;
  }
});
}
});
pages/feedback/feedback.json
@@ -1,4 +1,8 @@
{
  "component": true,
  "usingComponents": {
    "t-upload": "tdesign-miniprogram/upload/upload"
  },
  "navigationBarTitleText": "问题反馈",
  "navigationBarTextStyle": "white"
}
pages/feedback/feedback.wxml
@@ -1,9 +1,30 @@
<view class="container">
  <button class="btn" bindtouchstart="startRecording" bindtouchend="stopRecording">
    按住录音
  </button>
  <view wx:if="{{isRecording}}" class="recording-overlay">
    <canvas canvas-id="waveform" style="width: 300px; height: 100px;"></canvas>
  <view class="container-item">
    <text class="fb-text">反馈详情:</text>
    <textarea class="input-class" />
  </view>
  <audio src="{{recordingSrc}}" controls></audio>
  <view class="divider"></view>
  <view class="container-item">
    <text class="img-upload">图片(最多三张):</text>
    <t-upload style="margin-top: 20rpx;" media-type="{{['image']}}" files="{{originFiles}}" gridConfig="{{gridConfig}}" bind:success="handleSuccess" max="3" bind:add="handleAdd" bind:remove="handleRemove" bind:click="handleClick" bind:sort-end="handleSortEnd" />
  </view>
  <view class="divider"></view>
  <view class="container-voice">
    <text class="fb-text">录音:</text>
    <view class="voice_wrapper">
      <image class="voice_img" bindtouchstart='startHandel' bindtouchend='endHandle' src="/images/tape.svg" mode="" />
      <view class="voice_content" bind:tap="handlePlay" wx:if="{{voiceTime}}">
        <view class="left">
          <view class="line"></view>
          <view class="line" style="opacity:{{line2Opcity}}" id="test2"></view>
          <view class="line" style="opacity:{{line3Opcity}}" id="test3"></view>
        </view>
        <view class="right">{{voiceTime}}"</view>
      </view>
    </view>
  </view>
  <!-- 录音中 -->
  <view wx:if="{{isShowVoiceMask}}" class="voice_starting">录音中</view>
  <button class="fb-submit">提交</button>
</view>
pages/feedback/feedback.wxss
@@ -2,10 +2,14 @@
.container {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100vh;
  padding: 20px;
  padding-left: 30rpx;
  padding-right: 30rpx;
  width: calc(100% - 0rpx);
  /* 考虑了左右边距后的实际宽度 */
  background-color: #fff;
  justify-content: flex-start;
  align-items: center;
}
.btn {
@@ -35,3 +39,124 @@
  background-color: rgba(0, 0, 0, 0.7);
  z-index: 9999;
}
.input-class {
  border-radius: 5px;
  border: 2rpx solid #000000;
  height: 20vh;
  width: 100%;
  background-color: #fcfcfc;
}
.img-upload {
  font-size: 35rpx;
  margin-left: 30rpx;
}
.container-item {
  width: 100%;
  display: flex;
  flex-direction: column;
}
.container-voice {
  width: 100%;
  display: flex;
  flex-direction: row;
  align-items: center;
}
.fb-text {
  font-size: 35rpx;
  margin-left: 30rpx;
}
.fb-submit {
  width: 80%;
  background-color: #1890FF;
  font-size: 35rpx;
  color: white;
  margin-top: 50rpx;
}
.voice_img {
  width: 80rpx;
  height: 70rpx;
}
.divider {
  height: 1px;
  /* 设置分割线高度 */
  background-color: #d3d3d3;
  /* 设置分割线颜色 */
  margin: 10px 0;
  /* 设置分割线的上下间距 */
  width: 100%;
}
.voice_wrapper {
  display: flex;
  align-items: center;
  background-color: #fff;
  padding: 10px;
  box-sizing: border-box;
}
.voice_content {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-left: 16rpx;
  padding: 0 6rpx;
  box-sizing: border-box;
  width: 200rpx;
  height: 80rpx;
  border-radius: 15rpx;
  background-color: #1890FF;
}
.voice_content .left {
  display: flex;
  align-items: center;
}
.voice_content .left .line {
  width: 8rpx;
  background-color: white;
  margin-left: 10rpx;
}
.voice_content .left .line:nth-child(1) {
  height: 24rpx;
}
.voice_content .left .line:nth-child(2) {
  height: 36rpx;
}
.voice_content .left .line:nth-child(3) {
  height: 45rpx;
}
.right {
  font-size: 35rpx;
  color: #ffffff;
  margin-right: 20rpx;
}
.voice_starting{
  position: fixed;
  top: 30%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 200rpx;
  height: 200rpx;
  line-height: 200rpx;
  background-color: #787879;
  color: #fff;
  text-align: center;
  border-radius: 100rpx; /* 使其呈现圆形 */
  z-index: 10000;
}
pages/home/home.js
@@ -12,7 +12,7 @@
  data: {
    sessionId: "",
    showConfirm: false,
    myItem:{},
    myItem: {},
    waterIntakeName: "",
    image: "/images/ic_head_bg.jpg",
    userPhone: "158****0723",
@@ -44,7 +44,7 @@
        isRefreshing: true
      });
      this.getOpenList();
    }
  },
@@ -73,14 +73,15 @@
    });
    //当开阀成功后调用刷新
    console.log("onLoad:" + options.param);
    if(options.param){
    if (options.param) {
      wx.showToast({
        title: '开泵成功',
        title: '开阀成功',
        icon: 'success',
        duration: 2000
        duration: 3000
      })
      getOpenList() ;
      this.getOpenList();
    }
    this.getUserDataBySession();
  },
  /**
@@ -158,14 +159,13 @@
    })
  },
  openValveList() {
    wx.showToast({
      title: '正在开发中',
      icon: 'none'
    wx.navigateTo({
      url: '/pages/valveList/valveList',
    })
  },
  feedBack() {
    wx.showToast({
      title: '正在开发中',
      title: '暂未开放',
      icon: 'none'
    })
  },
@@ -175,7 +175,7 @@
    this.setData({
      showConfirm: true,
      waterIntakeName: item.intakeNum,
      myItem:item
      myItem: item
    });
  },
  closeDialog() {
@@ -190,31 +190,46 @@
   * @param {*} vcNum 虚拟卡编号
   */
  postCloseValaue(orderNo, rtuAddr, vcNum) {
    wx.showLoading({
      title: '正在关阀请稍候...', // 加载提示文字
      mask: true // 是否显示透明蒙层,防止触摸穿透,默认为 false
    });
    const app = getApp();
    const data = {
      rtuAddr: rtuAddr,
      rtuAddr: rtuAddr,
      vcNum: vcNum, //虚拟卡ID
      orderNo:orderNo,
      userType: 2, //用户类型1-平台,2-App
      orderNo: orderNo,
      operator: app.globalData.sessionId //操作员
    };
    console.log("postCloseValaue"+data);
    console.log("postCloseValaue" + data);
    post({
      url: "valve/close",
      url: "wx/valve/close_wx",
      data: data,
      isShowLoding:true
      isShowLoding: false
    }).then(response => {
      // 处理成功响应
      console.log('请求成功:', response);
      // 加载完成后隐藏加载动画
      wx.hideLoading();
      //完成后回到首页
      wx.reLaunch({
        url: '/pages/home/home?param=true' // 首页的路径,根据实际情况填写
      });
      this.getOpenList();
      wx.showToast({
        title: '关阀成功',
        icon: 'success',
        duration: 3000
      })
    }).catch(error => {
      wx.hideLoading();
      if (error.code === "1002") {
        wx.showToast({
          title: '关阀失败',
          icon: 'error',
          duration: 3000 // 提示的持续时间,单位毫秒
        })
      }
      // 处理错误响应
      console.error('请求失败:', error);
    });
  },
  /**
@@ -223,7 +238,7 @@
  getOpenList() {
    const app = getApp();
    const params = {
      url: 'valve/get',
      url: 'wx/valve/get',
      data: {
        operator: app.globalData.sessionId
      }
@@ -236,7 +251,6 @@
      })
    }).catch(err => {
      // 错误回调
      this.setData({
        isRefreshing: false, // 将triggered属性设置为false,表示下拉刷新已完成
      })
@@ -246,14 +260,39 @@
   * 确认关闭回调
   * @param {} item 
   */
  confirmDialog(){
  confirmDialog() {
    this.setData({
      showConfirm: false
    });
    this.postCloseValaue(this.data.myItem.orderNo,this.data.myItem.rtuAddr,this.data.myItem.vcNum);
    this.postCloseValaue(this.data.myItem.orderNo, this.data.myItem.rtuAddr, this.data.myItem.vcNum);
  },
  //根据session获取农户信息
  getUserDataBySession() {
    const app = getApp();
    const params = {
      url: 'sell/client/simple_info',
      data: {
        sessionId: app.globalData.sessionId
      }
    };
    get(params).then(data => {
      this.setData({
        userName: data.content.clientName,
        userPhone: this.maskPhoneNumber(data.content.phone)
      })
    }).catch(err => {
      // 错误回调
    })
  },
  maskPhoneNumber(phoneNumber) {
    if (phoneNumber.length !== 11) {
      throw new Error("Phone number must be 11 digits");
    }
    // 使用正则表达式替换中间四位数字为星号
    const maskedPhoneNumber = phoneNumber.replace(/^(\d{3})\d{4}(\d{4})$/, "$1****$2");
    return maskedPhoneNumber;
  }
pages/home/home.wxml
@@ -8,8 +8,8 @@
        <text class="head-bottom">{{userPhone}}</text>
      </view>
      <view class="head-button-wrapper">
        <text class="unbind">解绑</text>
        <text class="head-bottom">联系客服</text>
        <text class="unbind" bind:tap="feedBack">解绑</text>
        <text class="head-bottom" bind:tap="feedBack">联系客服</text>
      </view>
    </view>
  </view>
@@ -38,6 +38,7 @@
    <text class="bottom-title-text">快速关阀</text>
    <text class="refresh-button" bind:tap="startPullDownRefresh">刷新</text>
  </view>
  <view class="divider"></view>
  <!-- refresher-enabled="true" refresher-threshold="50" -->
  <scroll-view class="scroll-view" scroll-x="false" scroll-y="true" refresher-enabled="{{isRefreshing==false?true:false}}" refresher-threshold="50" bindrefresherrefresh="onPullDownRefresh" refresher-triggered="{{isWXRefreshing}}">
    <view wx:if="{{isRefreshing}}" class="refresh-view">
@@ -53,13 +54,14 @@
          <image class="item-img" src="{{item.isOnLine ? '/images/wifi_no.svg' : '/images/wifi_off.svg'}}" />
        </view>
        <view>
          <t-switch wx:if="{{item.isOnLine }}" class="switch" data-item="{{item}}" bindchange="handleChange" value="{{true}}" label="{{['开', '关']}}" slot="note" />
          <!-- <t-switch  class="switch" data-item="{{item}}" bindchange="handleChange" value="{{true}}" label="{{['开', '关']}}" slot="note" /> -->
          <text class="item-button" bind:tap="handleChange" data-item="{{item}}">关阀</text>
        </view>
      </view>
    </view>
    <view wx:if="{{listData.length === 0}}" class="noMore-View">
    <view wx:if="{{listData.length === 0}}" class="noMore-View-home">
      <image class="noMore-img" src="/images/no_more.svg" />
      <text class="noMore-text">没有数据</text>
      <text class="noMore-text">没有开泵记录</text>
    </view>
  </scroll-view>
  <t-dialog class="t-dialog" visible="{{showConfirm}}" content="确认关闭{{waterIntakeName}}吗?" confirm-btn="{{ { content: '确认', variant: 'base', theme: 'danger' } }}" close-on-overlay-click="false" cancel-btn="取消"  bind:confirm="confirmDialog" bind:cancel="closeDialog" />
pages/home/home.wxss
@@ -1,6 +1,6 @@
/* pages/home/home.wxss */
.base-wrapper {
  background-color: #f5f5f5;
  background-color: #ececec;
  width: 100%;
  height: 100vh;
  overflow: hidden;
@@ -76,6 +76,7 @@
.head-text-wrapper text {
  color: #fff;
  font-size: 32rpx;
}
.balance-label {
@@ -148,14 +149,14 @@
.list-item {
  background-color: #fff;
  margin-top: 2rpx;
  margin-bottom: 2rpx;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-left: 30rpx;
  padding-right: 30rpx;
  padding-top: 20rpx;
  padding-bottom: 20rpx;
  padding-top: 30rpx;
  padding-bottom: 30rpx;
  margin-left: 20rpx;
  margin-right: 20rpx;
}
@@ -213,10 +214,10 @@
  /* 去掉按钮边框 */
  border-radius: 5px;
  /* 按钮圆角 */
  padding-left: 20rpx;
  padding-right: 20rpx;
  padding-top: 10rpx;
  padding-bottom: 10rpx;
  padding-left: 25rpx;
  padding-right: 25rpx;
  padding-top: 15rpx;
  padding-bottom: 15rpx;
}
.refresh-view {
@@ -245,14 +246,19 @@
}
@keyframes blink {
  0%, 80%, 100% {
  0%,
  80%,
  100% {
    opacity: 0;
  }
  40% {
    opacity: 1;
  }
}
.switch{
.switch {
  --td-switch-checked-color: #1890FF;
}
@@ -261,9 +267,12 @@
  display: flex;
  align-items: center;
}
.item-left text{
.item-left text {
  font-size: 40rpx;
  min-width: 150rpx;
}
.item-img {
  width: 40rpx;
  /* 根据需要调整图标大小 */
@@ -271,7 +280,39 @@
  /* 根据需要调整图标大小 */
  margin-left: 20rpx;
}
.t-dialog{
  --td-dialog-content-font-size:40rpx;
  --td-dialog-content-line-height:50rpx
.t-dialog {
  --td-dialog-content-font-size: 40rpx;
  --td-dialog-content-line-height: 50rpx
}
.noMore-View-home {
  display: flex;
  flex-direction: column;
  /* 确保子元素纵向排列 */
  justify-content: center;
  /* 垂直居中 */
  align-items: center;
  /* 水平居中 */
  height: 100%;
  /* 让容器高度占满父元素 */
}
.item-button {
  display: flex;
  height: 80rpx;
  padding: 0 60rpx;
  background-color: #1890FF;
  color: white;
  border: none;
  border-radius: 20rpx;
  font-size: 30rpx;
  align-items: center;
  justify-content: center;
}
.divider {
  width: 100%;
  margin-top: 2rpx;
  /* background-color: #e0e0e0; */
}
pages/logs/logs.js
File was deleted
pages/logs/logs.json
File was deleted
pages/logs/logs.wxml
File was deleted
pages/logs/logs.wxss
File was deleted
pages/openCard/openCard.js
@@ -20,7 +20,7 @@
    if (item.inUse === 0) {
      // 在页面加载时显示加载动画
      wx.showLoading({
        title: '正在开泵请稍后...', // 加载提示文字
        title: '正在开泵请稍候...', // 加载提示文字
        mask: true // 是否显示透明蒙层,防止触摸穿透,默认为 false
      });
      this.postOpenValva(item.vcId);
@@ -32,14 +32,13 @@
    const data = {
      intakeId: this.data.intakeId, //取水口ID
      vcId: vcId, //虚拟卡ID
      userType: 2, //用户类型1-平台,2-App
      operator: app.globalData.sessionId //操作员
    };
    post({
      url: "comRes/receive",
      url: "8087/wx/valve/open_wx",
      data: data
    }).then(response => {
      // 处理成功响应
      console.log('请求成功:', response);
      // 加载完成后隐藏加载动画
@@ -48,12 +47,19 @@
      wx.reLaunch({
        url: '/pages/home/home?param=true' // 首页的路径,根据实际情况填写
      });
    }).catch(error => {
      // 加载完成后隐藏加载动画
      wx.hideLoading();
      // 处理错误响应
      console.error('请求失败:', error);
      if (error.code === "1002") {
        wx.showToast({
          title: '开泵失败',
          icon: 'error',
          duration: 3000 // 提示的持续时间,单位毫秒
        })
      }
    });
  },
  /**
@@ -67,7 +73,7 @@
      intakeId
    })
    console.log('intakeId:' + this.data.intakeId);
    this. getCardList();
    this.getCardList();
  },
  /**
@@ -119,24 +125,29 @@
  },
  //获取虚拟卡列表
  getCardList(){
    get({url:'https://d4x9787456.vicp.fun/sell/virtual_card/get', data: {
      operator: getApp().globalData.sessionId
    }})
    .then((data) => {
      if(data.success&&data.code==="0001"){
        this.setData({
          allCardPoints:  data.content
        });
      }else{
        wx.showToast({
          title: data.msg,
        })
      }
      console.log('Failed to add item:');
    })
    .catch((error) => {
      console.error('Failed to add item:', error);
    });
  getCardList() {
    get({
        url: '8084/sell/virtual_card/get',
        data: {
          clientId: getApp().globalData.sessionId
        }
      })
      .then((data) => {
        if (data.success && data.code === "0001") {
          this.setData({
            allCardPoints: data.content
          });
        } else {
          wx.showToast({
            title: data.msg,
          })
        }
        console.log('Failed to add item:');
      })
      .catch((error) => {
        console.error('Failed to add item:', error);
      });
  }
})
pages/openCard/openCard.wxml
@@ -2,7 +2,7 @@
<view class="container">
  <scroll-view class="list-container" scroll-y="true" scroll-x="false">
    <block wx:for="{{allCardPoints}}" wx:key="index">
    <block wx:if="{{allCardPoints.length > 0}}" wx:for="{{allCardPoints}}" wx:key="index">
      <view class="{{item.inUse===0?'item':'item-gray'}}">
        <view class="item-card">
          <text>卡编号:</text>
pages/openCard/openCard.wxss
@@ -93,7 +93,9 @@
  /* 底部对齐 */
}
.list-container{
.list-container {
  display: flex;
  padding-bottom: 30rpx;
  flex: 1;
  height: 100%;
}
pages/rechargeCard/rechargeCard.js
New file
@@ -0,0 +1,136 @@
// pages/rechargeCard/rechargeCard.js
const {
  get,
  post
} = require('../../api/request.js');
Page({
  /**
   * 页面的初始数据
   */
  data: {
    confirmBtn: { content: '确认', variant: 'base' },
    currentTab: 0, // 当前显示的表格,默认为第一个表格
    allCardPoints: [],
    allWaterPoints:[],
    showDialog:false
  },
 // 切换 Tabs
 switchTab: function (e) {
  const tab = parseInt(e.currentTarget.dataset.tab);
  this.setData({
    currentTab: tab
  });
},
  /**
   * 生命周期函数--监听页面加载
   */
  onLoad(options) {
    this.getCardList();
    this.getWaterCardList();
  },
  /**
   * 生命周期函数--监听页面初次渲染完成
   */
  onReady() {
  },
  /**
   * 生命周期函数--监听页面显示
   */
  onShow() {
  },
  /**
   * 生命周期函数--监听页面隐藏
   */
  onHide() {
  },
  /**
   * 生命周期函数--监听页面卸载
   */
  onUnload() {
  },
  /**
   * 页面相关事件处理函数--监听用户下拉动作
   */
  onPullDownRefresh() {
  },
  /**
   * 页面上拉触底事件的处理函数
   */
  onReachBottom() {
  },
  /**
   * 用户点击右上角分享
   */
  onShareAppMessage() {
  },//获取虚拟卡列表
  getCardList(){
    get({url:'https://d4x9787456.vicp.fun/sell/virtual_card/get', data: {
      operator: getApp().globalData.sessionId
    }})
    .then((data) => {
      if(data.success&&data.code==="0001"){
        this.setData({
          allCardPoints:  data.content
        });
      }else{
        wx.showToast({
          title: data.msg,
        })
      }
      console.log('Failed to add item:');
    })
    .catch((error) => {
      console.error('Failed to add item:', error);
    });
  },
  getWaterCardList(){
    get({url:'https://d4x9787456.vicp.fun/sell/virtual_card/get', data: {
      operator: getApp().globalData.sessionId
    }})
    .then((data) => {
      if(data.success&&data.code==="0001"){
        this.setData({
          allWaterPoints:  data.content
        });
      }else{
        wx.showToast({
          title: data.msg,
        })
      }
      console.log('Failed to add item:');
    })
    .catch((error) => {
      console.error('Failed to add item:', error);
    });
  },
  rechargeCard(item){
    wx.navigateTo({
      url: '/pages/rechargeMoney/rechargMoney' // 首页的路径,根据实际情况填写
    });
  },
  ruinCard(){
  },
  closeDialog(){
    this.setData({
      showDialog:false
    })
  }
})
pages/rechargeCard/rechargeCard.json
@@ -1,3 +1,5 @@
{
  "usingComponents": {}
  "usingComponents": {
    "t-dialog": "tdesign-miniprogram/dialog/dialog"
  }
}
pages/rechargeCard/rechargeCard.wxml
@@ -28,16 +28,18 @@
            <text class="item-balance-text-yuan">元</text>
          </view>
          <view class="button-view">
            <text wx:if="{{item.inUse==0}}" class="ruinCard">销卡</text>
            <text wx:if="{{item.inUse==0}}" class="ruinCard" bind:tap="ruinCard">销卡</text>
            <text wx:if="{{item.inUse==0}}" class="recharge" bind:tap="rechargeCard">充值</text>
          </view>
        </view>
      </view>
    </block>
    <view wx:if="{{allCardPoints.length === 0}}" class="noMore-View">
      <image class="noMore-img" src="/images/no_more.svg" />
      <text class="noMore-text">没有数据</text>
    </view>
    <t-dialog visible="{{showDialog}}" content="您还有余额未使用,如需销卡,请先使用完或退款后才可操作。" confirm-btn="{{ confirmBtn }}" bind:confirm="closeDialog" />
  </scroll-view>
  <!-- 水卡 -->
pages/rechargeCard/rechargeCard.wxss
@@ -177,4 +177,5 @@
  padding: 15rpx 30rpx;
  border-radius: 30rpx;
  font-size: 30rpx;
}
}
pages/rechargeMoney/rechargMoney.js
@@ -5,11 +5,28 @@
   * 页面的初始数据
   */
  data: {
    userName: "张三",
    userPhone: "15802220723",
    userCode: "15584236",
    balance: "1025元",
    activeIndex: -1,
    userName: "张三",
    userPhone: "15802220723",
    userCode: "15584236",
    balance: "1025元",
    activeIndex: -1,
    allRechargeList: [{
      time: "2024-05-12:20:20",
      type: "远程",
      morny: "500元"
    }, {
      time: "2024-05-12:20:20",
      type: "远程",
      morny: "500元"
    }, {
      time: "2024-05-12:20:20",
      type: "远程",
      morny: "500元"
    }, {
      time: "2024-05-12:20:20",
      type: "远程",
      morny: "500元"
    }]
  },
  /**
@@ -67,14 +84,16 @@
  onShareAppMessage() {
  },
  handleMoneyWrapperTap: function (e) {
    const index = e.currentTarget.dataset.index;
    console.log(index)
    if (index !== undefined) {
      this.setData({
        activeIndex: parseInt(index),
      });
    }
  },
  handleMoneyWrapperTap: function (e) {
    const index = e.currentTarget.dataset.index;
    console.log(index)
    if (index !== undefined) {
      this.setData({
        activeIndex: parseInt(index),
      });
    }
  },
  onPullDownRefresh() {
    console.log("onPullDownRefresh")
  }
})
pages/rechargeMoney/rechargMoney.wxml
@@ -15,19 +15,19 @@
  <view class="money-base-wrapper">
    <view class="row">
      <view class="item {{activeIndex === 0 ? 'active' : ''}}" bindtap="handleMoneyWrapperTap" data-index="0">
      <view class="item{{activeIndex === 0 ? 'active' : ''}}" bindtap="handleMoneyWrapperTap" data-index="0">
        <view class="money-wrapper">
          <text class="money-number">100</text>
          <text class="money-label">元</text>
        </view>
      </view>
      <view class="item {{activeIndex === 1 ? 'active' : ''}}" bindtap="handleMoneyWrapperTap" data-index="1">
      <view class="item{{activeIndex === 1 ? 'active' : ''}}" bindtap="handleMoneyWrapperTap" data-index="1">
        <view class="money-wrapper">
          <text class="money-number">200</text>
          <text class="money-label">元</text>
        </view>
      </view>
      <view class="item {{activeIndex === 2 ? 'active' : ''}}" bindtap="handleMoneyWrapperTap" data-index="2">
      <view class="item{{activeIndex === 2 ? 'active' : ''}}" bindtap="handleMoneyWrapperTap" data-index="2">
        <view class="money-wrapper">
          <text class="money-number">300</text>
          <text class="money-label">元</text>
@@ -35,19 +35,19 @@
      </view>
    </view>
    <view class="row">
      <view class="item {{activeIndex === 3 ? 'active' : ''}}" bindtap="handleMoneyWrapperTap" data-index="3">
      <view class="item{{activeIndex === 3 ? 'active' : ''}}" bindtap="handleMoneyWrapperTap" data-index="3">
        <view class="money-wrapper">
          <text class="money-number">400</text>
          <text class="money-label">元</text>
        </view>
      </view>
      <view class="item {{activeIndex === 4 ? 'active' : ''}}" bindtap="handleMoneyWrapperTap" data-index="4">
      <view class="item{{activeIndex === 4 ? 'active' : ''}}" bindtap="handleMoneyWrapperTap" data-index="4">
        <view class="money-wrapper">
          <text class="money-number">500</text>
          <text class="money-label">元</text>
        </view>
      </view>
      <view class="item {{activeIndex === 5 ? 'active' : ''}}" bindtap="handleMoneyWrapperTap" data-index="5">
      <view class="item{{activeIndex === 5 ? 'active' : ''}}" bindtap="handleMoneyWrapperTap" data-index="5">
        <view class="money-wrapper">
          <text class="money-number">600</text>
          <text class="money-label">元</text>
@@ -57,12 +57,28 @@
  </view>
  <view class="rechage-view">
    <view class="rechage {{activeIndex === -1 ? 'active' : ''}}">
      <text>充值</text>
    <view class="rechage{{activeIndex === -1 ? 'active' : ''}}">
      <text class="rechage-text">充值</text>
    </view>
  </view>
  <!--
  <view class="rechageList-view">
  </view>
  -->
</view>
    <text class="rechageList-view-head">充值记录</text>
    <scroll-view class="list-container" scroll-y="true" scroll-x="false" refresher-enabled="true" refresher-threshold="50" bindrefresherrefresh="onPullDownRefresh">
      <block wx:if="{{allRechargeList.length > 0}}" wx:for="{{allRechargeList}}" wx:key="index">
        <view class="itemList">
          <text class="item-card-text">{{item.time}}</text>
          <text class="item-card-text">{{item.type}}</text>
          <text class="item-card-text">{{item.morny}}</text>
        </view>
      </block>
      <view wx:if="{{allRechargeList.length === 0}}" class="noMore-View">
        <image class="noMore-img" src="/images/no_more.svg" />
        <text class="noMore-text">没有数据</text>
      </view>
    </scroll-view>
  </view>
</view>
pages/rechargeMoney/rechargMoney.wxss
@@ -1,155 +1,182 @@
/* pages/recharge/recharge.wxss */
.base-wrapper {
  background-color: #f5f5f5;
  width: 100%;
  height: 100vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
.user-wrapper {
  background-color: #1890FF;
  height: 20vh;
  padding-left: 10rpx;
  display: flex;
  flex-direction: column;
  justify-content: space-around;
  padding-top: 20rpx;
  padding-bottom: 30rpx;
}
.user-wrapper text {
  color: #fff;
  margin-left: 30rpx;
}
.money-base-wrapper {
  flex-direction: column;
  height: 20vh;
  display: flex;
  justify-content: space-around;
  margin-top: 20rpx;
}
.row {
  display: flex;
  justify-content: space-around;
}
.item {
  background-color: #fff;
  border-radius: 5px;
  width: 100%;
  height: 10vh;
  margin-left: 20rpx;
  margin-top: 30rpx;
  margin-right: 20rpx;
  display: flex;
  align-items: center;
  justify-content: center;
}
.item text {
  color: #2D8BF7;
}
.money-number {
  font-size: 40rpx;
}
.money-label {
  font-size: 30rpx;
  margin-left: 5rpx;
}
.itemactive {
  background-color: #2D8BF7;
  border-radius: 5px;
  width: 100%;
  height: 10vh;
  margin-top: 30rpx;
  margin-left: 20rpx;
  margin-right: 20rpx;
  display: flex;
  align-items: center;
  justify-content: center;
}
.itemactive text {
  color: #fff;
}
.money-wrapper {
  display: flex;
  align-items: flex-end;
  /* 底部对齐 */
  justify-content: center;
  /* 水平居中 */
}
.rechage-view {
  margin-top: 40rpx;
  /* 占据剩余的全部高度 */
  flex-direction: column;
  display: flex;
  justify-content: center;
  align-items: center;
  width: 100%;
}
.rechage-view text {
  font-size: 30rpx;
  padding-top: 10rpx;
  padding-bottom: 10rpx;
}
.rechageList-view {
  margin-top: 40rpx;
  width: 50%;
  background-color: #fff;
  display: flex;
  margin-left: 20rpx;
  margin-right: 20rpx;
  align-items: center;
  justify-content: center;
  margin-top: 30rpx;
  border-radius: 90px;
  border: 2px solid #2D8BF7;
  /* 添加蓝色的边框 */
  padding-top: 15rpx;
  padding-bottom: 15rpx;
}
.rechage {
  display: flex;
  width: 80%;
  background-color: #2D8BF7;
  align-items: center;
  justify-content: center;
  padding-top: 15rpx;
  padding-bottom: 15rpx;
  border-radius: 90px;
  margin-top: 45rpx;
}
.rechageactive {
  display: flex;
  margin-top: 45rpx;
  align-items: center;
  justify-content: center;
  width: 80%;
  background-color: #bababa;
  padding-top: 15rpx;
  padding-bottom: 15rpx;
  border-radius: 90px;
}
/* pages/recharge/recharge.wxss */
.base-wrapper {
  background-color: #f5f5f5;
  width: 100%;
  height: 100vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
.rechageactive text {
  color: #fff;
}
.rechage text {
  color: #fff;
.user-wrapper {
  background-color: #1890FF;
  height: 20vh;
  padding-left: 10rpx;
  display: flex;
  flex-direction: column;
  justify-content: space-around;
  padding-top: 20rpx;
  padding-bottom: 30rpx;
}
.user-wrapper text {
  color: #fff;
  margin-left: 30rpx;
}
.money-base-wrapper {
  flex-direction: column;
  height: 20vh;
  display: flex;
  justify-content: space-around;
  margin-top: 40rpx;
}
.row {
  display: flex;
  justify-content: space-around;
}
.item {
  background-color: #fff;
  border-radius: 5px;
  width: 100%;
  height: 10vh;
  margin-left: 20rpx;
  margin-top: 10rpx;
  margin-right: 20rpx;
  margin-bottom: 10rpx;
  display: flex;
  align-items: center;
  justify-content: center;
}
.itemactive {
  background-color: #1890FF;
  border-radius: 5px;
  width: 100%;
  height: 10vh;
  margin-left: 20rpx;
  margin-top: 10rpx;
  margin-right: 20rpx;
  margin-bottom: 10rpx;
  display: flex;
  align-items: center;
  justify-content: center;
}
.itemList {
  background-color: #fff;
  border-radius: 5px;
  margin-left: 20rpx;
  margin-top: 10rpx;
  margin-right: 20rpx;
  margin-bottom: 0rpx;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 30rpx 20rpx;
}
.item text {
  color: #1890FF;
}
.money-number {
  font-size: 40rpx;
}
.money-label {
  font-size: 30rpx;
  margin-left: 5rpx;
}
.itemactive text {
  color: #fff;
}
.money-wrapper {
  display: flex;
  align-items: flex-end;
  /* 底部对齐 */
  justify-content: center;
  /* 水平居中 */
}
.rechage-view {
  margin-top: 40rpx;
  /* 占据剩余的全部高度 */
  flex-direction: column;
  display: flex;
  justify-content: center;
  align-items: center;
  width: 100%;
}
.rechage-view text {
  font-size: 30rpx;
  padding-top: 10rpx;
  padding-bottom: 10rpx;
}
.rechageList-view {
  display: flex;
  flex: 1;
  width: 100%;
  flex-direction: column;
  margin-top: 10rpx;
}
.rechage {
  display: flex;
  width: 80%;
  background-color: #1890FF;
  align-items: center;
  justify-content: center;
  padding-top: 15rpx;
  padding-bottom: 15rpx;
  border-radius: 90px;
  margin-top: 45rpx;
}
.rechageactive {
  display: flex;
  margin-top: 45rpx;
  align-items: center;
  justify-content: center;
  width: 80%;
  background-color: #bababa;
  padding-top: 15rpx;
  padding-bottom: 15rpx;
  border-radius: 90px;
}
.rechage-text {
  color: #fff;
  font-size: 40rpx;
}
.rechageList-view-head {
  color: #2D8BF7;
  border-radius: 5px 5px 0 0;
  background-color: #fff;
  display: flex;
  align-items: center;
  /* 垂直方向居中 */
  justify-content: space-between;
  /* 子元素在主轴上的对齐方式 */
  padding: 10px;
  /* 容器的内边距 */
  margin-left: 20rpx;
  margin-right: 20rpx;
  margin-top: 20rpx;
  text-align: center;
  flex-direction: column;
}
.item-card-text {
  font-size: 35rpx;
}
pages/valveList/valveList.js
File was renamed from pages/recharge/recharge.js
@@ -1,11 +1,21 @@
// pages/recharge/recharge.js
// pages/valveList/valveList.js 开关阀记录
Page({
  /**
   * 页面的初始数据
   */
  data: {
    listData: [{
      intakeNum: "1023356646612"
    }, {
      intakeNum: "1023356646612"
    }, {
      intakeNum: "1023356646612"
    }, {
      intakeNum: "1023356646612"
    }, {
      intakeNum: "1023356646612"
    }]
  },
  /**
pages/valveList/valveList.json
New file
@@ -0,0 +1,5 @@
{
  "usingComponents": {},
  "navigationBarTitleText": "开关阀记录",
  "navigationBarTextStyle": "white"
}
pages/valveList/valveList.wxml
New file
@@ -0,0 +1,30 @@
<!--pages/valveList/valveList.wxml 开关阀记录-->
<view>
  <scroll-view class="list-container" scroll-y="true" scroll-x="false">
    <block wx:if="{{listData.length > 0}}" wx:for="{{listData}}" wx:key="index">
      <view class="list-item" wx:for="{{listData}}" wx:for-item="item" wx:for-index="index">
        <!-- <image class="item-img" src="/images/pipeline.svg" /> -->
        <view class="item-time">
          <text class="item-text">消费金额:</text>
          <view>
            <text class="item-morny">50</text>
            <text class="item-text">  元</text>
          </view>
        </view>
        <text class="item-text">虚拟卡编号:{{item.intakeNum}}</text>
        <text class="item-text">取水口编号:</text>
        <text class="item-text">开阀时间:</text>
        <text class="item-text">关阀时间:</text>
        <view class="item-time">
          <text class="item-text">用水时长:120 分钟</text>
          <text class="item-text">用水量:2 m³</text>
        </view>
      </view>
    </block>
    <view wx:if="{{listData.length === 0}}" class="noMore-View">
      <image class="noMore-img" src="/images/no_more.svg" />
      <text class="noMore-text">没有数据</text>
    </view>
  </scroll-view>
</view>
pages/valveList/valveList.wxss
New file
@@ -0,0 +1,29 @@
/* pages/valveList/valveList.wxss */
.list-item {
  display: flex;
  flex-direction: column;
  background-color: #1890FF;
  margin-top: 30rpx;
  margin-left: 30rpx;
  margin-right: 30rpx;
  margin-bottom: 30rpx;
  padding: 20rpx;
  border-radius: 15rpx;
}
.item-text {
  color: #fff;
  font-size: 35rpx;
}
.item-time {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
}
.item-morny {
  color: #FFFF00;
  font-size: 50rpx;
  font-weight: bold;
}
pages/waterIntake/waterIntake.js
@@ -6,9 +6,14 @@
Page({
  data: {
    currentTab: 0, // 当前显示的表格,默认为第一个表格
    searchQuery:"",
    searchQuery: "",
    commonWaterPoints: [], // 常用取水口数据
    allWaterPoints: [], // 所有取水口数据
    isRefreshing_all: false,
    isRefreshing_common: false,
    showConfirm: false,
    waterIntakeName: "",
    choseItem: null
  },
  // 切换 Tabs
@@ -18,7 +23,7 @@
      currentTab: tab
    });
  },
  onInput(e){
  onInput(e) {
    this.setData({
      searchQuery: e.detail.value // 将输入框的值存储到 inputValue
    });
@@ -26,7 +31,7 @@
  onSearch: function () {
    const query = this.data.searchQuery;
    if (query) {
     this.getallWaterPoints(query)
      this.getallWaterPoints(query)
      // 在这里进行搜索操作,更新 allWaterPoints 数据
    } else {
      this.getallWaterPoints(query)
@@ -38,13 +43,56 @@
   * @param {} event 
   */
  choseCard(event) {
   const intakeId= event.currentTarget.dataset.item.intakeId;
   console.log(intakeId);
    wx.navigateTo({
      url: '/pages/openCard/openCard?intakeId='+intakeId,
    this.setData({
      showConfirm: true,
      choseItem: event.currentTarget.dataset.item
    })
  },
    //  console.log(intakeId);
    //   wx.navigateTo({
    //     url: '/pages/openCard/openCard?intakeId='+intakeId,
    //   })
  },
  //开泵通信
  postOpenValva(intakeId) {
    wx.showLoading({
      title: '正在开阀请稍候...', // 加载提示文字
      mask: true // 是否显示透明蒙层,防止触摸穿透,默认为 false
    });
    const app = getApp();
    const data = {
      intakeId: intakeId, //取水口ID
      // vcId: vcId, //虚拟卡ID
      operator: app.globalData.sessionId //操作员
    };
    post({
      url: "wx/valve/open_wx",
      data: data
    }).then(response => {
      // 处理成功响应
      console.log('请求成功:', response);
      // 加载完成后隐藏加载动画
      wx.hideLoading();
      //完成后回到首页
      wx.reLaunch({
        url: '/pages/home/home?param=true' // 首页的路径,根据实际情况填写
      });
    }).catch(error => {
      // 加载完成后隐藏加载动画
      wx.hideLoading();
      // 处理错误响应
      console.error('请求失败:', error);
      if (error.code === "1002") {
        wx.showToast({
          title: '开阀失败',
          icon: 'error',
          duration: 3000 // 提示的持续时间,单位毫秒
        })
      }
    });
  },
  /**
   * 生命周期函数--监听页面加载
@@ -82,12 +130,8 @@
  },
  /**
   * 页面相关事件处理函数--监听用户下拉动作
   */
  onPullDownRefresh() {
  },
  /**
   * 页面上拉触底事件的处理函数
@@ -101,24 +145,29 @@
   */
  onShareAppMessage() {
  }
  ,
  },
  /**
   * 获取所有取水口
   */
  getallWaterPoints: function (intakeNum) {
    let params = { url: 'rtu/get_online_intakes' };
    let params = {
      url: 'project/intake/all_intakes'
    };
    if (intakeNum) {
      params.data = { intakeNum: intakeNum };
      params.data = {
        intakeNum: intakeNum
      };
    }
    get(params)
      .then((data) => {
        if(data.success&&data.code==="0001"){
        this.setData({
          isRefreshing_all: false
        });
        if (data.success && data.code === "0001") {
          this.setData({
            allWaterPoints:  data.content.obj
            allWaterPoints: data.content.obj
          });
        }else{
        } else {
          wx.showToast({
            title: data.msg,
          })
@@ -126,28 +175,66 @@
        console.log('Failed to add item:');
      })
      .catch((error) => {
        this.setData({
          isRefreshing_all: false
        });
        console.error('Failed to add item:', error);
      });
  },
  getcommonWaterPoints(){
    get({url:'rtu/used_intakes', data: {
      operator: getApp().globalData.sessionId
    }})
    .then((data) => {
      if(data.success&&data.code==="0001"){
  //获取常用取水口
  getcommonWaterPoints() {
    get({
        url: 'project/intake/used_intakes',
        data: {
          operator: getApp().globalData.sessionId
        }
      })
      .then((data) => {
        this.setData({
          commonWaterPoints:  data.content
          isRefreshing_common: false
        });
      }else{
        if (data.success && data.code === "0001") {
          this.setData({
            commonWaterPoints: data.content
          });
        } else {
          wx.showToast({
            title: data.msg,
          })
        }
        console.log('Failed to add item:');
      })
      .catch((error) => {
        this.setData({
          isRefreshing_common: false
        });
        wx.showToast({
          title: data.msg,
          title: error.code,
          icon: 'error',
          duration: 3000 // 提示的持续时间,单位毫秒
        })
      }
      console.log('Failed to add item:');
        console.error('Failed to add item:', error);
      });
  },
  /**
   * 页面相关事件处理函数--监听用户下拉动作
   */
  onPullDownRefresh_all() {
    this.getallWaterPoints();
  },
  onPullDownRefresh_common() {
    this.getcommonWaterPoints();
  },
  confirmDialog() {
    this.setData({
      showConfirm:false
    })
    .catch((error) => {
      console.error('Failed to add item:', error);
    });
    this.postOpenValva(this.data.choseItem.intakeId);
  },
  closeDialog() {
    this.setData({
      showConfirm: false
    })
  }
})
pages/waterIntake/waterIntake.json
@@ -3,7 +3,8 @@
  "usingComponents": {
    "t-avatar": "tdesign-miniprogram/avatar/avatar",
    "t-switch": "tdesign-miniprogram/switch/switch",
    "t-button": "tdesign-miniprogram/button/button"
    "t-button": "tdesign-miniprogram/button/button",
    "t-dialog": "tdesign-miniprogram/dialog/dialog"
  },
  "navigationBarTitleText": "取水口",
  "navigationBarTextStyle": "white"
pages/waterIntake/waterIntake.wxml
@@ -1,4 +1,3 @@
<!--pages/waterIntake/waterIntake.wxml取水口列表-->
<view class="container">
  <!-- 顶部 Tabs -->
  <view class="tabs">
@@ -13,15 +12,14 @@
  </view>
  <!-- 常用取水口 -->
  <scroll-view class="list-container" wx:if="{{currentTab === 0}}" scroll-y="true" scroll-x="false">
    <block wx:if="{{commonWaterPoints.length > 0}}" wx:for="{{commonWaterPoints}}" wx:key="index">
  <scroll-view class="list-container" wx:if="{{currentTab === 0}}" scroll-y="true" refresher-enabled="true" refresher-threshold="50" bindrefresherrefresh="onPullDownRefresh_common" refresher-triggered="{{isRefreshing_common}}">
    <block wx:for="{{commonWaterPoints}}" wx:key="index">
      <view class="item">
        <view class="item-left">
          <!-- <image class="item-img" src="/images/pipeline.svg" /> -->
          <text>{{item.intakeNum}}</text>
          <image class="item-img" src="{{item.isOnLine ? '/images/wifi_no.svg' : '/images/wifi_off.svg'}}" />
        </view>
        <text wx:if="{{item.isOnLine}}" class="item-button" bind:tap="choseCard" data-item="{{item}}">选择</text>
        <text  class="item-button" bindtap="choseCard" data-item="{{item}}">开阀</text>
      </view>
    </block>
    <view wx:if="{{commonWaterPoints.length === 0}}" class="noMore-View">
@@ -31,29 +29,27 @@
  </scroll-view>
  <!-- 所有取水口 -->
  <view class="all-waterIntake" wx:else>
  <view class="all-waterIntake" wx:if="{{currentTab === 1}}">
    <view class="search-container">
      <input class="search-input" placeholder="请输入取水口编码后点击搜索" bindinput="onInput" />
      <!-- <text class="search-button" >搜索</text> -->
      <t-button class="search-button" theme="primary" size="large" icon="search" shape="square" aria-label="搜索" bindtap="onSearch" style="background-color: #1890FF; border: none;  height: 80rpx;"></t-button>
      <t-button class="search-button" theme="primary" size="large" icon="search" shape="square" aria-label="搜索" bindtap="onSearch" style="background-color: #1890FF; border: none; height: 80rpx;"></t-button>
    </view>
    <view>
      <scroll-view class="list-container" scroll-y="true" scroll-x="false">
        <block wx:if="{{allWaterPoints.length > 0}}" wx:for="{{allWaterPoints}}" wx:key="index">
          <view class="item">
            <view class="item-left">
              <!-- <image class="item-img" src="/images/pipeline.svg" /> -->
              <text>{{item.intakeNum}}</text>
              <image class="item-img" src="{{item.isOnLine ? '/images/wifi_no.svg' : '/images/wifi_off.svg'}}" />
            </view>
            <text wx:if="{{item.isOnLine}}" class="item-button" bind:tap="choseCard" data-item="{{item}}">选择</text>
    <scroll-view class="list-container" scroll-y="true" refresher-enabled="true" refresher-threshold="50" bindrefresherrefresh="onPullDownRefresh_all" refresher-triggered="{{isRefreshing_all}}">
      <block wx:for="{{allWaterPoints}}" wx:key="index">
        <view class="item">
          <view class="item-left">
            <text>{{item.intakeNum}}</text>
            <image class="item-img" src="{{item.isOnLine ? '/images/wifi_no.svg' : '/images/wifi_off.svg'}}" />
          </view>
        </block>
        <view wx:if="{{allWaterPoints.length === 0}}" class="noMore-View">
          <image class="noMore-img" src="/images/no_more.svg" />
          <text class="noMore-text">没有数据</text>
          <text  class="item-button" bindtap="choseCard" data-item="{{item}}">开阀</text>
        </view>
      </scroll-view>
    </view>
      </block>
      <view wx:if="{{allWaterPoints.length === 0}}" class="noMore-View">
        <image class="noMore-img" src="/images/no_more.svg" />
        <text class="noMore-text">没有数据</text>
      </view>
    </scroll-view>
  </view>
</view>
  <t-dialog class="t-dialog" visible="{{showConfirm}}" content="确认打开{{choseItem.intakeNum}}吗?" confirm-btn="{{ { content: '确认', variant: 'base', theme: 'danger' } }}" close-on-overlay-click="false" cancel-btn="取消"  bind:confirm="confirmDialog" bind:cancel="closeDialog" />
</view>
pages/waterIntake/waterIntake.wxss
@@ -1,106 +1,43 @@
/* pages/waterIntake/waterIntake.wxss */
/* index.wxss */
.container {
  padding-left: 20rpx;
  padding-right: 20rpx;
  padding-top: 5rpx;
  padding-bottom: 5rpx;
  padding: 5rpx 20rpx;
  background-color: #fff;
  width: 100%;
  height: 100vh;
  overflow: hidden;
  /* 防止底部区域滚动 */
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.tabs {
  display: flex;
  justify-content: space-around;
  position: relative;
  width: 100%;
  border-bottom: 1px solid #eee;
  /* Tabs 占满整个横向屏幕 */
}
.tab {
  font-size: 16px;
  padding: 10px;
  cursor: pointer;
  position: relative;
  width: 50%;
  /* Tabs 平分整个横向屏幕 */
  text-align: center;
  /* 文字居中 */
}
list-container
.list {
  margin-top: 20px;
}
.item {
  padding: 10px;
  border-bottom: 1px solid #eee;
}
.search-container {
  display: flex;
  align-items: center;
  padding: 10rpx;
  border-bottom: 1px solid #eee;
}
/* 搜索框 */
.search-input {
  flex: 1;
  height: 80rpx;
  padding: 0 20rpx;
  border: 1px solid #ccc;
  border-radius: 20rpx;
  font-size: 30rpx;
}
/* 搜索按钮 */
.search-button {
  display: flex;
  margin-left: 10rpx;
  height: 60rpx;
  background-color: #1890FF;
  color: white;
  border: none;
  border-radius: 20rpx;
  font-size: 30rpx;
  text-align: center;
  align-items: center;
  position: relative;
}
.list-container {
  flex: 1;
  overflow-y: auto;
  z-index: 0;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  /* 确保内容居上 */
  height: 100%;
}
.all-waterIntake {
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  /* 确保内容居上 */
  height: 100%;
  width: 100%;
  padding-bottom: 20rpx; /* 增加底部填充 */
}
.item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px;
  /* 适当调整间距 */
  padding: 15px 20rpx;
  border-bottom: 1px solid #eee;
}
.item-left {
@@ -108,22 +45,20 @@
  align-items: center;
}
.item-right {
  display: flex;
  align-items: center;
.item-left text{
  font-size: 40rpx;
  min-width: 150rpx;
}
.item-img {
  width: 40rpx;
  /* 根据需要调整图标大小 */
  height: 40rpx;
  /* 根据需要调整图标大小 */
  margin-left: 20rpx;
}
.item-button {
  display: flex;
  height: 60rpx;
  height: 80rpx;
  padding: 0 60rpx;
  background-color: #1890FF;
  color: white;
@@ -133,9 +68,7 @@
  align-items: center;
  justify-content: center;
}
.item-left text{
  font-size: 40rpx;
}
.indicator {
  width: 100%;
  height: 3px;
@@ -143,8 +76,6 @@
  position: absolute;
  bottom: 0;
  left: 0;
  transform: translateX(0);
  /* 初始化位置 */
}
.noMore-View {
@@ -156,11 +87,55 @@
  flex-direction: column;
}
.noMore-img{
.noMore-img {
  width: 300rpx;
  height: 300rpx;
}
.noMore-text{
  color:#969494;
.noMore-text {
  color: #969494;
}
.search-container {
  display: flex;
  align-items: center;
  padding: 10rpx;
  border-bottom: 1px solid #eee;
}
.search-input {
  flex: 1;
  height: 80rpx;
  padding: 0 20rpx;
  border: 1px solid #ccc;
  border-radius: 20rpx;
  font-size: 30rpx;
}
.search-button {
  margin-left: 10rpx;
  height: 60rpx;
  background-color: #1890FF;
  color: white;
  border: none;
  border-radius: 20rpx;
  font-size: 30rpx;
  text-align: center;
  display: flex;
  align-items: center;
  justify-content: center;
}
.all-waterIntake {
  width: 100%;
  flex: 1;
  overflow-y: auto;
  z-index: 0;
  display: flex;
  flex-direction: column;
  padding-bottom: 10rpx; /* 增加底部填充 */
}
.t-dialog{
  --td-dialog-content-font-size:40rpx;
  --td-dialog-content-line-height:50rpx
}
project.private.config.json
@@ -3,6 +3,6 @@
  "projectname": "irrigate_user",
  "setting": {
    "compileHotReLoad": true,
    "urlCheck": false
    "urlCheck": true
  }
}