沙盘演示系统应用的微信小程序
zuoxiao
2024-10-28 f66a9a2c565966e98720be5e20604c6f75030f82
pages/openCard/openCard.js
@@ -14,7 +14,8 @@
    vcId: "",
    activeIndex: -1,
    datetimeVisible: false,
    datetime: new Date().getTime(),
    dateStartTime: new Date().getTime(),
    dateEndTime: new Date().getTime() + 24 * 60 * 60 * 1000,
    datetimeText: '',
    allCardPoints: [], // 所有虚拟卡
    irrigateProfile: [], //获取所选灌溉方式的详细数据
@@ -36,7 +37,9 @@
    radioValue: "0", //开阀方式选中的类型
    costiomTime: "", //自定义灌溉时间
    waterAmount: 0, //定量开阀的水量
    costiomWater:"",//输入的自定义水量
    costiomWater: "", //输入的自定义水量
    isWXRefreshing: false,
    intakeName: "" //扫码开阀从首页传来的取水口名称
  },
  openValva(event) {
    const {
@@ -45,14 +48,20 @@
    if (item.isAlarmValue === true) {
      //金额报警
      wx.navigateTo({
        url: '/pages/rechargeMoney/rechargMoney?vcId=' + item.vcId,
        url: '/pages/rechargeMoney/rechargMoney?vcId=' + item.id,
      })
    } else if (item.inUse === false) {
      // 选择虚拟卡后
      this.initDialogData();
      this.setData({
        vcId: item.vcId,
        vcId: item.id,
      })
      if (this.data.intakeName === "") {
        // 选择虚拟卡后
        this.initDialogData();
      } else {
        //扫码开阀逻辑
        this.postOpenValva(false);
      }
    }
  },
  handleAutoIrrigation() {},
@@ -62,10 +71,12 @@
   */
  onLoad(options) {
    const {
      intakeId
      intakeId,
      intakeName
    } = options;
    this.setData({
      intakeId: intakeId
      intakeId: intakeId,
      intakeName: intakeName
    })
    console.log('intakeId:' + this.data.intakeId);
    this.getCardList();
@@ -103,7 +114,10 @@
   * 页面相关事件处理函数--监听用户下拉动作
   */
  onPullDownRefresh() {
    this.setData({
      isWXRefreshing: true
    });
    this.getCardList();
  },
  /**
@@ -163,7 +177,8 @@
    });
    // 更新列表数据
    this.setData({
      allCardPoints: updatedList
      allCardPoints: updatedList,
      isWXRefreshing: false
    });
  },
  handleClost() {
@@ -198,7 +213,7 @@
      this.data.waterAmount = parseInt(this.data.irrigateProfile[index].defaultValue)
      this.setData({
        activeIndex: parseInt(index),
        costiomWater:""
        costiomWater: ""
      });
    }
  },
@@ -313,6 +328,7 @@
    const data = {
      intakeId: this.data.intakeId, //取水口ID
      vcId: this.data.vcId, //虚拟卡ID
      intakeName: this.data.intakeName, //取水口名称
      operator: app.globalData.sessionId, //操作员
      forceOpen: !!isforce // 使用逻辑非操作符 !! 来确保 isForce 是布尔值  
    };
@@ -431,11 +447,11 @@
    const data = {
      intakeId: this.data.intakeId, //取水口ID
      vcId: this.data.vcId, //虚拟卡ID
      minutes: this.data.waterAmount, //水量
      waterAmount: this.data.waterAmount, //水量
      operator: app.globalData.sessionId //操作员
    };
    post({
      url: "/wx/valve/quantify_close",
      url: "wx/valve/quantify_close",
      data: data
    }).then(response => {
      // 处理成功响应
@@ -472,7 +488,7 @@
      plannedOpenTime: this.data.openTime
    };
    post({
      url: "/wx/valve/planed_open_quantify_close",
      url: "wx/valve/planed_open_quantify_close",
      data: data
    }).then(response => {
      // 处理成功响应
@@ -583,7 +599,7 @@
    }
  },
  //输入自定义水量的监听
  onWaterInputChange(data){
  onWaterInputChange(data) {
    console.log(data.detail.value)
    if (data.detail.value !== "") {
      this.setData({
@@ -597,7 +613,7 @@
    }
  },
  // 定量开泵按钮
  btnOpenOnWater(){
  btnOpenOnWater() {
    if (this.data.waterAmount > 0) {
      if (this.data.isOpenTiming) {
        this.quantifyOpenTime();
@@ -610,7 +626,7 @@
        title: '请选择或输入灌溉时间!',
      })
    }
  }
  },
})