From b1188a1a4eb11546f3b4558a5d657e7474a5fd2d Mon Sep 17 00:00:00 2001
From: zuoxiao <470321431@qq.com>
Date: 星期五, 30 八月 2024 14:47:52 +0800
Subject: [PATCH] 定时定量开阀相关功能

---
 app.json                         |    4 
 pages/home/home.js               |   20 +
 pages/openCard/openCard.js       |  437 ++++++++++++++++++++++++++++++++++++++++++------
 pages/openCard/openCard.wxss     |    1 
 pages/openCard/openCard.wxml     |   38 ++--
 pages/waterIntake/waterIntake.js |   14 -
 pages/openCard/openCard.json     |    3 
 7 files changed, 425 insertions(+), 92 deletions(-)

diff --git a/app.json b/app.json
index 2fb1657..03e8743 100644
--- a/app.json
+++ b/app.json
@@ -1,6 +1,6 @@
 {
   "pages": [
-    "pages/openCard/openCard",
+  
     "pages/home/home",
     "pages/valveList/valveList",
     "pages/feedback/feedback",
@@ -13,7 +13,7 @@
     "pages/my/my",
     "pages/waterIntake/waterIntake",
     "pages/personCharge/personcharge",
-
+    "pages/openCard/openCard",
     "pages/rechargeMoney/rechargMoney",
     "pages/rechargeCard/rechargeCard"
   ],
diff --git a/pages/home/home.js b/pages/home/home.js
index d0a7f0b..bf07a07 100644
--- a/pages/home/home.js
+++ b/pages/home/home.js
@@ -229,11 +229,20 @@
       // 鍔犺浇瀹屾垚鍚庨殣钘忓姞杞藉姩鐢�
       wx.hideLoading();
       this.getOpenList();
-      wx.showToast({
-        title: '鍏抽榾鎴愬姛',
-        icon: 'success',
-        duration: 3000
-      })
+      if(response.content.data.success){
+        wx.showToast({
+          title: '鍏抽榾鎴愬姛',
+          icon: 'success',
+          duration: 3000
+        })
+      }else{
+        wx.showToast({
+          title: '鍏抽榾澶辫触',
+          icon: 'error',
+          duration: 3000
+        })
+      }
+   
     }).catch(error => {
       wx.hideLoading();
       this.setData({
@@ -243,7 +252,6 @@
       })
       // 澶勭悊閿欒鍝嶅簲
       console.error('璇锋眰澶辫触:', error);
-
     });
   },
   /**
diff --git a/pages/openCard/openCard.js b/pages/openCard/openCard.js
index 9b73d8c..a3f47d4 100644
--- a/pages/openCard/openCard.js
+++ b/pages/openCard/openCard.js
@@ -10,7 +10,7 @@
    */
   data: {
     intakeId: 0,
-    showDialog: true,
+    showDialog: false,
     vcId: "",
     activeIndex: -1,
     datetimeVisible: false,
@@ -21,9 +21,22 @@
     dialog_mode: true,
     dialog_time: false,
     dialog_water: false,
-    group_time: false,
-    openTime: "",
-    isShowOpenTime: "false"
+    group_time: false, //鏄惁鏄剧ず閫夋嫨鍒嗛挓鎴栧皬鏃剁殑鍗曢�夋
+    openTime: "", //璁″垝寮�娉电殑寮�濮嬫椂闂�
+    openTimeText: "",
+    isShowOpenTime: "false",
+    isOpenTiming: false, //鏄惁鏄鍒掑紑闃�鏃堕棿鏍峰紡鐨勫紑闃�
+    postMinutes: 0, //瀹氱亴婧夋椂闀跨殑鏃堕棿
+    showForceConfirm: false,
+    showErrorDialog: false, //閿欒鎻愮ず
+    errorData: "",
+    confirmBtn: {
+      content: '纭'
+    },
+    radioValue: "0", //寮�闃�鏂瑰紡閫変腑鐨勭被鍨�
+    costiomTime: "", //鑷畾涔夌亴婧夋椂闂�
+    waterAmount: 0, //瀹氶噺寮�闃�鐨勬按閲�
+    costiomWater:"",//杈撳叆鐨勮嚜瀹氫箟姘撮噺
   },
   openValva(event) {
     const {
@@ -36,53 +49,14 @@
       })
     } else if (item.inUse === false) {
       // 閫夋嫨铏氭嫙鍗″悗
+      this.initDialogData();
       this.setData({
         vcId: item.vcId,
-        showDialog: true,
-        dialog_mode: true,
-        dialog_time: false,
-        dialog_water: false
       })
     }
   },
   handleAutoIrrigation() {},
-  //绔嬪嵆寮�娉�
-  postOpenValva() {
-    const app = getApp();
-    const data = {
-      intakeId: this.data.intakeId, //鍙栨按鍙D
-      vcId: this.data.vcId, //铏氭嫙鍗D
-      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 // 鎻愮ず鐨勬寔缁椂闂达紝鍗曚綅姣
-        })
-      }
-    });
-  },
-  postTimeOpen() {},
   /**
    * 鐢熷懡鍛ㄦ湡鍑芥暟--鐩戝惉椤甸潰鍔犺浇
    */
@@ -91,7 +65,7 @@
       intakeId
     } = options;
     this.setData({
-      intakeId
+      intakeId: intakeId
     })
     console.log('intakeId:' + this.data.intakeId);
     this.getCardList();
@@ -108,7 +82,7 @@
    * 鐢熷懡鍛ㄦ湡鍑芥暟--鐩戝惉椤甸潰鏄剧ず
    */
   onShow() {
-
+    console.log("onShow>>>>" + this.data.isShowOpenTime)
   },
 
   /**
@@ -197,12 +171,34 @@
       showDialog: false
     })
   },
-  handleMoneyWrapperTap: function (e) {
+  //閫夋嫨鏃堕棿鍚庣殑澶勭悊
+  handleTimeWrapperTap(e) {
     const index = e.currentTarget.dataset.index;
     console.log(index)
     if (index !== undefined) {
+      let minutes;
+      if (this.data.irrigateProfile[index].unit === "1") {
+        minutes = this.hourToMinutes(this.data.irrigateProfile[index].defaultValue)
+      } else {
+        minutes = this.data.irrigateProfile[index].defaultValue;
+      }
       this.setData({
         activeIndex: parseInt(index),
+        postMinutes: minutes,
+        costiomTime: "",
+        group_time: false,
+      });
+    }
+  },
+  // 閫夋嫨姘撮噺鍚庣殑澶勭悊
+  handleWaterWrapperTap(e) {
+    const index = e.currentTarget.dataset.index;
+    console.log(index)
+    if (index !== undefined) {
+      this.data.waterAmount = parseInt(this.data.irrigateProfile[index].defaultValue)
+      this.setData({
+        activeIndex: parseInt(index),
+        costiomWater:""
       });
     }
   },
@@ -243,36 +239,57 @@
   handleSetDuration() {
     this.getIrrigateProfileData(1);
   },
-  onGroupChange(event) {
+  onGroupOpenTimeChange(event) {
     const {
       value
     } = event.detail;
-    console.log('Failed to add item:' + value);
+    console.log('onGroupOpenTimeChange:' + value);
     if (value == 1) {
       this.showPicker();
+      this.setData({
+        isOpenTiming: true,
+        radioValue: value,
+      })
     } else {
       this.setData({
-        isShowOpenTime: false
+        isShowOpenTime: false,
+        isOpenTiming: false,
+        radioValue: value,
       })
     }
   },
+  //鏄剧ず鏃堕棿閫夋嫨鍣�
   showPicker(e) {
     this.setData({
+      datetime: new Date().getTime(),
       datetimeVisible: true,
       isShowOpenTime: true
     });
   },
-  onTimeInputChange() {
-    this.setData({
-      group_time: true
-    })
+  onTimeInputChange(data) {
+    console.log(data.detail.value)
+    if (data.detail.value !== "") {
+      this.setData({
+        group_time: true,
+        activeIndex: -1,
+        postMinutes: parseInt(data.detail.value)
+      })
+    } else {
+      this.setData({
+        group_time: false,
+        postMinutes: 0,
+      })
+    }
+
   },
   onConfirm(e) {
     const {
       value
     } = e?.detail;
+    console.log(value);
     this.setData({
-      openTime: "寮�闃�鏃堕棿锛�" + value
+      openTime: value,
+      openTimeText: "璁″垝寮�闃�鏃堕棿锛�" + value
     })
   },
   handleSetWaterVolume() {
@@ -285,5 +302,315 @@
       dialog_mode: true,
       group_time: false
     })
+  },
+  //绔嬪嵆寮�娉�
+  postOpenValva(isforce) {
+    wx.showLoading({
+      title: '姝e湪寮�闃�璇风◢鍊�...', // 鍔犺浇鎻愮ず鏂囧瓧
+      mask: true // 鏄惁鏄剧ず閫忔槑钂欏眰锛岄槻姝㈣Е鎽哥┛閫忥紝榛樿涓� false
+    });
+    const app = getApp();
+    const data = {
+      intakeId: this.data.intakeId, //鍙栨按鍙D
+      vcId: this.data.vcId, //铏氭嫙鍗D
+      operator: app.globalData.sessionId, //鎿嶄綔鍛�
+      forceOpen: !!isforce // 浣跨敤閫昏緫闈炴搷浣滅 !! 鏉ョ‘淇� isForce 鏄竷灏斿��  
+    };
+    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 === "10005") {
+      //   this.setData({
+      //     showDialog: false,
+      //     showForceConfirm: true
+      //   })
+      // } else {
+      this.setData({
+        showErrorDialog: true,
+        errorData: error.msg
+      })
+      // }
+    });
+  },
+  //瀹氭椂鍏抽榾寮忓紑闃�
+  timeClose() {
+    const app = getApp();
+    wx.showLoading({
+      title: '姝e湪寮�闃�璇风◢鍊�...', // 鍔犺浇鎻愮ず鏂囧瓧
+      mask: true // 鏄惁鏄剧ず閫忔槑钂欏眰锛岄槻姝㈣Е鎽哥┛閫忥紝榛樿涓� false
+    });
+    const data = {
+      intakeId: this.data.intakeId, //鍙栨按鍙D
+      vcId: this.data.vcId, //铏氭嫙鍗D
+      minutes: this.data.postMinutes, //鍒嗛挓
+      operator: app.globalData.sessionId //鎿嶄綔鍛�
+    };
+    post({
+      url: "wx/valve/timed_close",
+      data: data
+    }).then(response => {
+      // 澶勭悊鎴愬姛鍝嶅簲
+      console.log('璇锋眰鎴愬姛:', response);
+      // 鍔犺浇瀹屾垚鍚庨殣钘忓姞杞藉姩鐢�
+      wx.hideLoading();
+      //瀹屾垚鍚庡洖鍒伴椤�
+      wx.reLaunch({
+        url: '/pages/home/home?param=true' // 棣栭〉鐨勮矾寰勶紝鏍规嵁瀹為檯鎯呭喌濉啓
+      });
+    }).catch(error => {
+      // 鍔犺浇瀹屾垚鍚庨殣钘忓姞杞藉姩鐢�
+      wx.hideLoading();
+      // 澶勭悊閿欒鍝嶅簲
+      console.error('璇锋眰澶辫触:', error);
+      this.setData({
+        showErrorDialog: true,
+        errorData: error.msg
+      })
+    });
+  },
+  //瀹氭椂鍏抽榾寮忚鍒掑紑闃�
+  timeClosePlaned() {
+    const app = getApp();
+    wx.showLoading({
+      title: '姝e湪閫氫俊璇风◢鍊�...', // 鍔犺浇鎻愮ず鏂囧瓧
+      mask: true // 鏄惁鏄剧ず閫忔槑钂欏眰锛岄槻姝㈣Е鎽哥┛閫忥紝榛樿涓� false
+    });
+    const data = {
+      intakeId: this.data.intakeId, //鍙栨按鍙D
+      vcId: this.data.vcId, //铏氭嫙鍗D
+      minutes: this.data.postMinutes, //鍒嗛挓
+      operator: app.globalData.sessionId, //鎿嶄綔鍛�
+      plannedOpenTime: this.data.openTime
+    };
+    post({
+      url: "wx/valve/timed_close",
+      data: data
+    }).then(response => {
+      // 澶勭悊鎴愬姛鍝嶅簲
+      console.log('璇锋眰鎴愬姛:', response);
+      // 鍔犺浇瀹屾垚鍚庨殣钘忓姞杞藉姩鐢�
+      wx.hideLoading();
+      //瀹屾垚鍚庡洖鍒伴椤�
+      wx.reLaunch({
+        url: '/pages/home/home?param=true' // 棣栭〉鐨勮矾寰勶紝鏍规嵁瀹為檯鎯呭喌濉啓
+      });
+    }).catch(error => {
+      // 鍔犺浇瀹屾垚鍚庨殣钘忓姞杞藉姩鐢�
+      wx.hideLoading();
+      // 澶勭悊閿欒鍝嶅簲
+      console.error('璇锋眰澶辫触:', error);
+      this.setData({
+        showErrorDialog: true,
+        errorData: error.msg
+      })
+    });
+  },
+  //瀹氶噺寮�闃�
+  quantifyOpen() {
+    const app = getApp();
+    wx.showLoading({
+      title: '姝e湪寮�闃�璇风◢鍊�...', // 鍔犺浇鎻愮ず鏂囧瓧
+      mask: true // 鏄惁鏄剧ず閫忔槑钂欏眰锛岄槻姝㈣Е鎽哥┛閫忥紝榛樿涓� false
+    });
+    const data = {
+      intakeId: this.data.intakeId, //鍙栨按鍙D
+      vcId: this.data.vcId, //铏氭嫙鍗D
+      minutes: this.data.waterAmount, //姘撮噺
+      operator: app.globalData.sessionId //鎿嶄綔鍛�
+    };
+    post({
+      url: "/wx/valve/quantify_close",
+      data: data
+    }).then(response => {
+      // 澶勭悊鎴愬姛鍝嶅簲
+      console.log('璇锋眰鎴愬姛:', response);
+      // 鍔犺浇瀹屾垚鍚庨殣钘忓姞杞藉姩鐢�
+      wx.hideLoading();
+      //瀹屾垚鍚庡洖鍒伴椤�
+      wx.reLaunch({
+        url: '/pages/home/home?param=true' // 棣栭〉鐨勮矾寰勶紝鏍规嵁瀹為檯鎯呭喌濉啓
+      });
+    }).catch(error => {
+      // 鍔犺浇瀹屾垚鍚庨殣钘忓姞杞藉姩鐢�
+      wx.hideLoading();
+      // 澶勭悊閿欒鍝嶅簲
+      console.error('璇锋眰澶辫触:', error);
+      this.setData({
+        showErrorDialog: true,
+        errorData: error.msg
+      })
+    });
+  },
+  //瀹氶噺寮�闃�寮忚鍒掑紑闃�
+  quantifyOpenTime() {
+    const app = getApp();
+    wx.showLoading({
+      title: '姝e湪閫氫俊璇风◢鍊�...', // 鍔犺浇鎻愮ず鏂囧瓧
+      mask: true // 鏄惁鏄剧ず閫忔槑钂欏眰锛岄槻姝㈣Е鎽哥┛閫忥紝榛樿涓� false
+    });
+    const data = {
+      intakeId: this.data.intakeId, //鍙栨按鍙D
+      vcId: this.data.vcId, //铏氭嫙鍗D
+      waterAmount: this.data.waterAmount, //姘撮噺
+      operator: app.globalData.sessionId, //鎿嶄綔鍛�
+      plannedOpenTime: this.data.openTime
+    };
+    post({
+      url: "/wx/valve/planed_open_quantify_close",
+      data: data
+    }).then(response => {
+      // 澶勭悊鎴愬姛鍝嶅簲
+      console.log('璇锋眰鎴愬姛:', response);
+      // 鍔犺浇瀹屾垚鍚庨殣钘忓姞杞藉姩鐢�
+      wx.hideLoading();
+      //瀹屾垚鍚庡洖鍒伴椤�
+      wx.reLaunch({
+        url: '/pages/home/home?param=true' // 棣栭〉鐨勮矾寰勶紝鏍规嵁瀹為檯鎯呭喌濉啓
+      });
+    }).catch(error => {
+      // 鍔犺浇瀹屾垚鍚庨殣钘忓姞杞藉姩鐢�
+      wx.hideLoading();
+      // 澶勭悊閿欒鍝嶅簲
+      console.error('璇锋眰澶辫触:', error);
+      this.setData({
+        showErrorDialog: true,
+        errorData: error.msg
+      })
+    });
+  },
+  // 閫氳繃灏忔椂杞崲鎴愬垎閽�
+  hourToMinutes(hours) {
+    // 妫�鏌ヨ緭鍏ユ槸鍚﹀悎娉�
+    if (isNaN(hours) || hours < 0) {
+      console.error('璇疯緭鍏ユ湁鏁堢殑灏忔椂鏁�');
+      return null;
+    }
+    // 灏嗗皬鏃惰浆鎹负鍒嗛挓
+    const minutes = hours * 60;
+    return minutes;
+  },
+  minutesToHours(minutes) {
+    // 妫�鏌ヨ緭鍏ユ槸鍚﹀悎娉�
+    if (isNaN(minutes) || hours < 0) {
+      console.error('璇疯緭鍏ユ湁鏁堢殑灏忔椂鏁�');
+      return null;
+    }
+    // 灏嗗皬鏃惰浆鎹负鍒嗛挓
+    const hours = minutes / 60;
+    return hours;
+  },
+  //瀹氭椂寮�娉垫寜閽�
+  btnOpenOnTime() {
+    if (this.data.postMinutes > 0) {
+      if (this.data.isOpenTiming) {
+        this.timeClosePlaned();
+      } else {
+        this.timeClose();
+      }
+    } else {
+      wx.showToast({
+        icon: 'error',
+        title: '璇烽�夋嫨鎴栬緭鍏ョ亴婧夋椂闂达紒',
+      })
+    }
+
+  },
+  cancelDialog() {
+    this.setData({
+      showForceConfirm: false
+    });
+  },
+  //寮哄埗寮�闃�
+  confirmForceDialog() {
+    this.postOpenValva(this.data.forceIntakeId, true);
+  },
+  //鍏抽棴閿欒鎻愮ず
+  closeErrorDialog() {
+    this.setData({
+      showErrorDialog: false
+    })
+  },
+  hidePicker() {
+    this.setData({
+      isShowOpenTime: false,
+      isOpenTiming: false,
+      radioValue: "0"
+    })
+  },
+  //鍒濆鍖栨墍鏈夊紑娉电殑鍙傛暟
+  initDialogData() {
+    this.setData({
+      isShowOpenTime: "false",
+      isOpenTiming: false, //鏄惁鏄鍒掑紑闃�鏃堕棿鏍峰紡鐨勫紑闃�
+      postMinutes: 0, //瀹氱亴婧夋椂闀跨殑鏃堕棿
+      showForceConfirm: false,
+      showErrorDialog: false, //閿欒鎻愮ず
+      showDialog: true,
+      dialog_mode: true,
+      dialog_time: false,
+      dialog_water: false,
+      openTimeText: "",
+      openTime: ""
+    })
+  },
+  //瀹氱亴婧夋椂闀胯嚜瀹氫箟杈撳叆鏃堕棿鏃朵慨鏀规椂闂村崟浣�0锛氬垎閽燂紝1锛氬皬鏃�
+  onGroupOpenTimeTypeChange(event) {
+    let value = event.detail.value;
+    if (value === "1") {
+      this.setData({
+        postMinutes: this.hourToMinutes(this.data.postMinutes)
+      })
+    } else {
+      this.setData({
+        postMinutes: this.minutesToHours(this.data.postMinutes)
+      })
+    }
+  },
+  //杈撳叆鑷畾涔夋按閲忕殑鐩戝惉
+  onWaterInputChange(data){
+    console.log(data.detail.value)
+    if (data.detail.value !== "") {
+      this.setData({
+        activeIndex: -1,
+        waterAmount: parseInt(data.detail.value)
+      })
+    } else {
+      this.setData({
+        waterAmount: 0,
+      })
+    }
+  },
+  // 瀹氶噺寮�娉垫寜閽�
+  btnOpenOnWater(){
+    if (this.data.waterAmount > 0) {
+      if (this.data.isOpenTiming) {
+        this.quantifyOpenTime();
+      } else {
+        this.quantifyOpen();
+      }
+    } else {
+      wx.showToast({
+        icon: 'error',
+        title: '璇烽�夋嫨鎴栬緭鍏ョ亴婧夋椂闂达紒',
+      })
+    }
   }
+
+
 })
\ No newline at end of file
diff --git a/pages/openCard/openCard.json b/pages/openCard/openCard.json
index 848ecbf..fe43965 100644
--- a/pages/openCard/openCard.json
+++ b/pages/openCard/openCard.json
@@ -5,6 +5,7 @@
     "t-input": "tdesign-miniprogram/input/input",
     "t-radio": "tdesign-miniprogram/radio/radio",
     "t-radio-group": "tdesign-miniprogram/radio-group/radio-group",
-    "t-date-time-picker": "tdesign-miniprogram/date-time-picker/date-time-picker"
+    "t-date-time-picker": "tdesign-miniprogram/date-time-picker/date-time-picker",
+    "t-dialog": "tdesign-miniprogram/dialog/dialog"
   }
 }
\ No newline at end of file
diff --git a/pages/openCard/openCard.wxml b/pages/openCard/openCard.wxml
index ab44610..0299a1b 100644
--- a/pages/openCard/openCard.wxml
+++ b/pages/openCard/openCard.wxml
@@ -30,7 +30,7 @@
     <image class="close" src="/images/close.svg" bindtap="handleClost"></image>
     <view class="dialog-content" wx:if="{{dialog_mode}}">
       <view class="dialog-title">璇烽�夋嫨鐏屾簤妯″紡</view>
-      <button bindtap="handleAutoIrrigation">鑷鐏屾簤</button>
+      <button bindtap="postOpenValva">鑷鐏屾簤</button>
       <button bindtap="handleSetDuration">瀹氱亴婧夋椂闀�</button>
       <button bindtap="handleSetWaterVolume">瀹氱亴婧夋按閲�</button>
     </view>
@@ -41,13 +41,13 @@
       </view>
       <view>
         <view class="row">
-          <view class="choseitem{{activeIndex === 0 ? 'active' : ''}}" bindtap="handleMoneyWrapperTap" data-index="0">
+          <view class="choseitem{{activeIndex === 0 ? 'active' : ''}}" bindtap="handleTimeWrapperTap" data-index="0">
             <view class="chose-wrapper">
               <text class="chose-number">{{irrigateProfile[0].defaultValue}}</text>
               <text class="chose-label">{{irrigateProfile[0].unitText}}</text>
             </view>
           </view>
-          <view class="choseitem{{activeIndex === 1 ? 'active' : ''}}" bindtap="handleMoneyWrapperTap" data-index="1">
+          <view class="choseitem{{activeIndex === 1 ? 'active' : ''}}" bindtap="handleTimeWrapperTap" data-index="1">
             <view class="chose-wrapper">
               <text class="chose-number">{{irrigateProfile[1].defaultValue}}</text>
               <text class="chose-label">{{irrigateProfile[1].unitText}}</text>
@@ -55,13 +55,13 @@
           </view>
         </view>
         <view class="row">
-          <view class="choseitem{{activeIndex === 2 ? 'active' : ''}}" bindtap="handleMoneyWrapperTap" data-index="2">
+          <view class="choseitem{{activeIndex === 2 ? 'active' : ''}}" bindtap="handleTimeWrapperTap" data-index="2">
             <view class="chose-wrapper">
               <text class="chose-number">{{irrigateProfile[2].defaultValue}}</text>
               <text class="chose-label">{{irrigateProfile[2].unitText}}</text>
             </view>
           </view>
-          <view class="choseitem{{activeIndex === 3 ? 'active' : ''}}" bindtap="handleMoneyWrapperTap" data-index="3">
+          <view class="choseitem{{activeIndex === 3 ? 'active' : ''}}" bindtap="handleTimeWrapperTap" data-index="3">
             <view class="chose-wrapper">
               <text class="chose-number">{{irrigateProfile[3].defaultValue}}</text>
               <text class="chose-label">{{irrigateProfile[3].unitText}}</text>
@@ -69,18 +69,18 @@
           </view>
         </view>
         <view>
-          <t-input label="" placeholder="鎴栧湪姝よ緭鍏ヨ嚜瀹氫箟鏃堕棿" bind:change="onTimeInputChange">
+          <t-input label="" value="{{costiomTime}}" placeholder="鎴栧湪姝よ緭鍏ヨ嚜瀹氫箟鏃堕棿"  type="number" bind:change="onTimeInputChange">
           </t-input>
-          <t-radio-group wx:if="{{group_time}}" default-value="0" borderless t-class="box">
+          <t-radio-group bind:change="onGroupOpenTimeTypeChange" wx:if="{{group_time}}" default-value="0" borderless t-class="box">
             <t-radio block="{{false}}" label="鍒嗛挓" value="0" />
             <t-radio block="{{false}}" label="灏忔椂" value="1" />
           </t-radio-group>
-          <t-radio-group bind:change="onGroupChange" default-value="0" borderless t-class="box">
+          <t-radio-group bind:change="onGroupOpenTimeChange" value="{{radioValue}}" default-value="0" borderless t-class="box">
             <t-radio block="{{false}}" label="鐜板湪寮�闃�" value="0" />
             <t-radio block="{{false}}" label="璁″垝寮�闃�鏃堕棿" value="1" />
           </t-radio-group>
-          <text class="open-time" wx:if="{{isShowOpenTime}}">{{openTime}}</text>
-          <button bindtap="handleSetWaterVolume">寮�闃�</button>
+          <text class="open-time" wx:if="{{isShowOpenTime}}">{{openTimeText}}</text>
+          <button bindtap="btnOpenOnTime">寮�闃�</button>
         </view>
       </view>
     </view>
@@ -91,13 +91,13 @@
       </view>
       <view>
         <view class="row">
-          <view class="choseitem{{activeIndex === 0 ? 'active' : ''}}" bindtap="handleMoneyWrapperTap" data-index="0">
+          <view class="choseitem{{activeIndex === 0 ? 'active' : ''}}" bindtap="handleWaterWrapperTap" data-index="0">
             <view class="chose-wrapper">
               <text class="chose-number">{{irrigateProfile[0].defaultValue}}</text>
               <text class="chose-label">{{irrigateProfile[0].unitText}}</text>
             </view>
           </view>
-          <view class="choseitem{{activeIndex === 1 ? 'active' : ''}}" bindtap="handleMoneyWrapperTap" data-index="1">
+          <view class="choseitem{{activeIndex === 1 ? 'active' : ''}}" bindtap="handleWaterWrapperTap" data-index="1">
             <view class="chose-wrapper">
               <text class="chose-number">{{irrigateProfile[1].defaultValue}}</text>
               <text class="chose-label">{{irrigateProfile[1].unitText}}</text>
@@ -105,13 +105,13 @@
           </view>
         </view>
         <view class="row">
-          <view class="choseitem{{activeIndex === 2 ? 'active' : ''}}" bindtap="handleMoneyWrapperTap" data-index="2">
+          <view class="choseitem{{activeIndex === 2 ? 'active' : ''}}" bindtap="handleWaterWrapperTap" data-index="2">
             <view class="chose-wrapper">
               <text class="chose-number">{{irrigateProfile[2].defaultValue}}</text>
               <text class="chose-label">{{irrigateProfile[2].unitText}}</text>
             </view>
           </view>
-          <view class="choseitem{{activeIndex === 3 ? 'active' : ''}}" bindtap="handleMoneyWrapperTap" data-index="3">
+          <view class="choseitem{{activeIndex === 3 ? 'active' : ''}}" bindtap="handleWaterWrapperTap" data-index="3">
             <view class="chose-wrapper">
               <text class="chose-number">{{irrigateProfile[3].defaultValue}}</text>
               <text class="chose-label">{{irrigateProfile[3].unitText}}</text>
@@ -119,18 +119,20 @@
           </view>
         </view>
         <view>
-          <t-input label=""   suffix="鍏�" align="right" type="number" placeholder="鎴栧湪姝よ緭鍏ヨ嚜瀹氫箟姘撮噺锛堢珛鏂圭背锛�" bind:change="onWaterInputChange">
+          <t-input label="" value="{{costiomWater}}"    suffix="绔嬫柟绫�" align="right" type="number" placeholder="鎴栧湪姝よ緭鍏ヨ嚜瀹氫箟姘撮噺" bind:change="onWaterInputChange">
           </t-input>
-          <t-radio-group bind:change="onGroupChange" default-value="0" borderless t-class="box">
+          <t-radio-group bind:change="onGroupOpenTimeChange" value="{{radioValue}}" default-value="0" borderless t-class="box">
             <t-radio block="{{false}}" label="鐜板湪寮�闃�" value="0" />
             <t-radio block="{{false}}" label="璁″垝寮�闃�鏃堕棿" value="1" />
           </t-radio-group>
-          <text class="open-time" wx:if="{{isShowOpenTime}}">{{openTime}}</text>
-          <button bindtap="handleSetWaterVolume">寮�闃�</button>
+          <text class="open-time" wx:if="{{isShowOpenTime}}">{{openTimeText}}</text>
+          <button bindtap="btnOpenOnWater">寮�闃�</button>
         </view>
       </view>
     </view>
   </view>
   <!-- 骞存湀鏃ユ椂鍒� -->
   <t-date-time-picker title="閫夋嫨鏃ユ湡鍜屾椂闂�" visible="{{datetimeVisible}}" mode="minute" value="{{datetime}}" format="YYYY-MM-DD HH:mm" bindchange="onConfirm" bindpick="onColumnChange" bindcancel="hidePicker" start="{{datetime}}"/>
+  <!-- <t-dialog visible="{{showForceConfirm}}" content="褰撳墠铏氭嫙鍗¤鍗犵敤锛屾槸鍚﹀己鍒跺紑闃�锛�" confirm-btn="{{ { content: '寮哄埗寮�闃�', variant: 'base', theme: 'danger' } }}" cancel-btn="鍙栨秷" bind:confirm="confirmForceDialog" bind:cancel="cancelDialog" /> -->
+  <t-dialog class="error-dialog"  title="寮�闃�閿欒" visible="{{showErrorDialog}}" content="{{errorData}}" confirm-btn="{{ confirmBtn }}" bind:confirm="closeErrorDialog" />
 </view>
\ No newline at end of file
diff --git a/pages/openCard/openCard.wxss b/pages/openCard/openCard.wxss
index b825b8e..7b21435 100644
--- a/pages/openCard/openCard.wxss
+++ b/pages/openCard/openCard.wxss
@@ -268,4 +268,5 @@
   justify-content: center;
   display: flex;
   margin-bottom: 20rpx;
+  font-size: 30rpx;
 }
\ No newline at end of file
diff --git a/pages/waterIntake/waterIntake.js b/pages/waterIntake/waterIntake.js
index 912fe64..a80b9b1 100644
--- a/pages/waterIntake/waterIntake.js
+++ b/pages/waterIntake/waterIntake.js
@@ -64,11 +64,6 @@
       choseItem: event.currentTarget.dataset.item,
       allWaterPoints: []
     })
-    //  console.log(intakeId);
-    //   wx.navigateTo({
-    //     url: '/pages/openCard/openCard?intakeId='+intakeId,
-    //   })
-
   },
   //寮�娉甸�氫俊
   /**
@@ -270,10 +265,9 @@
     this.getcommonWaterPoints();
   },
   confirmDialog() {
-    // this.setData({
-    //   showConfirm: false
-    // })
-    // this.postOpenValva(this.data.choseItem.intakeId);
+    this.setData({
+      showConfirm: false
+    })
     this.toOpenCard();
   },
   closeDialog() {
@@ -303,7 +297,7 @@
   },
   toOpenCard(){
     wx.navigateTo({
-      url: '/pages/openCard/openCard',
+      url: '/pages/openCard/openCard?intakeId='+this.data.choseItem.intakeId,
     })
   }
 })
\ No newline at end of file

--
Gitblit v1.8.0