沙盘演示系统应用的微信小程序
zuoxiao
2024-12-18 ffe748f8069aeeaf0ffae846f7c09210ce64da4b
pages/openCard/openCard.js
@@ -1,4 +1,4 @@
// 开卡选择虚拟卡
// 开阀选择虚拟卡
const {
  get,
  post
@@ -38,7 +38,8 @@
    costiomTime: "", //自定义灌溉时间
    waterAmount: 0, //定量开阀的水量
    costiomWater: "", //输入的自定义水量
    isWXRefreshing:false,
    isWXRefreshing: false,
    intakeName: "" //扫码开阀从首页传来的取水口名称
  },
  openValva(event) {
    const {
@@ -47,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.id,
      })
      if (this.data.intakeName) {
        //扫码开阀逻辑
        this.postOpenValva(false);
      } else {
        // 选择虚拟卡后
        this.initDialogData();
      }
    }
  },
  handleAutoIrrigation() {},
@@ -64,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();
@@ -169,7 +178,7 @@
    // 更新列表数据
    this.setData({
      allCardPoints: updatedList,
      isWXRefreshing:false
      isWXRefreshing: false
    });
  },
  handleClost() {
@@ -255,6 +264,7 @@
      this.setData({
        isOpenTiming: true,
        radioValue: value,
        dateStartTime: new Date().getTime()
      })
    } else {
      this.setData({
@@ -306,7 +316,8 @@
      dialog_time: false,
      dialog_water: false,
      dialog_mode: true,
      group_time: false
      group_time: false,
      activeIndex: -1
    })
  },
  //立即开泵
@@ -319,7 +330,8 @@
    const data = {
      intakeId: this.data.intakeId, //取水口ID
      vcId: this.data.vcId, //虚拟卡ID
      operator: app.globalData.sessionId, //操作员
      intakeName: this.data.intakeName, //取水口名称
      operator: app.globalData.clientId, //操作员
      forceOpen: !!isforce // 使用逻辑非操作符 !! 来确保 isForce 是布尔值  
    };
    post({
@@ -333,7 +345,7 @@
      wx.hideLoading();
      //完成后回到首页
      wx.reLaunch({
        url: '/pages/home/home?param=true' // 首页的路径,根据实际情况填写
        url: '/pages/home/home?param=1' // 首页的路径,根据实际情况填写
      });
    }).catch(error => {
@@ -365,7 +377,7 @@
      intakeId: this.data.intakeId, //取水口ID
      vcId: this.data.vcId, //虚拟卡ID
      minutes: this.data.postMinutes, //分钟
      operator: app.globalData.sessionId //操作员
      operator: app.globalData.clientId //操作员
    };
    post({
      url: "wx/valve/timed_close",
@@ -377,7 +389,7 @@
      wx.hideLoading();
      //完成后回到首页
      wx.reLaunch({
        url: '/pages/home/home?param=true' // 首页的路径,根据实际情况填写
        url: '/pages/home/home?param=1' // 首页的路径,根据实际情况填写
      });
    }).catch(error => {
      // 加载完成后隐藏加载动画
@@ -401,11 +413,11 @@
      intakeId: this.data.intakeId, //取水口ID
      vcId: this.data.vcId, //虚拟卡ID
      minutes: this.data.postMinutes, //分钟
      operator: app.globalData.sessionId, //操作员
      operator: app.globalData.clientId, //操作员
      plannedOpenTime: this.data.openTime
    };
    post({
      url: "wx/valve/timed_close",
      url: "wx/valve/planed_open_timed_close",
      data: data
    }).then(response => {
      // 处理成功响应
@@ -414,7 +426,7 @@
      wx.hideLoading();
      //完成后回到首页
      wx.reLaunch({
        url: '/pages/home/home?param=true' // 首页的路径,根据实际情况填写
        url: '/pages/home/home?param=2' // 首页的路径,根据实际情况填写
      });
    }).catch(error => {
      // 加载完成后隐藏加载动画
@@ -438,7 +450,7 @@
      intakeId: this.data.intakeId, //取水口ID
      vcId: this.data.vcId, //虚拟卡ID
      waterAmount: this.data.waterAmount, //水量
      operator: app.globalData.sessionId //操作员
      operator: app.globalData.clientId //操作员
    };
    post({
      url: "wx/valve/quantify_close",
@@ -450,7 +462,7 @@
      wx.hideLoading();
      //完成后回到首页
      wx.reLaunch({
        url: '/pages/home/home?param=true' // 首页的路径,根据实际情况填写
        url: '/pages/home/home?param=1' // 首页的路径,根据实际情况填写
      });
    }).catch(error => {
      // 加载完成后隐藏加载动画
@@ -474,7 +486,7 @@
      intakeId: this.data.intakeId, //取水口ID
      vcId: this.data.vcId, //虚拟卡ID
      waterAmount: this.data.waterAmount, //水量
      operator: app.globalData.sessionId, //操作员
      operator: app.globalData.clientId, //操作员
      plannedOpenTime: this.data.openTime
    };
    post({
@@ -487,7 +499,7 @@
      wx.hideLoading();
      //完成后回到首页
      wx.reLaunch({
        url: '/pages/home/home?param=true' // 首页的路径,根据实际情况填写
        url: '/pages/home/home?param=2' // 首页的路径,根据实际情况填写
      });
    }).catch(error => {
      // 加载完成后隐藏加载动画