From 910c37c43eceb27888b90631c868caa08f7eafcc Mon Sep 17 00:00:00 2001
From: zuoxiao <470321431@qq.com>
Date: 星期四, 30 五月 2024 15:36:59 +0800
Subject: [PATCH] 开泵流程相关界面优化
---
pages/home/home.js | 154 ++++++++++++++++++++++++++++++++++++++------------
1 files changed, 116 insertions(+), 38 deletions(-)
diff --git a/pages/home/home.js b/pages/home/home.js
index fb846ac..4bc1a09 100644
--- a/pages/home/home.js
+++ b/pages/home/home.js
@@ -11,39 +11,14 @@
*/
data: {
sessionId: "",
+ showConfirm: false,
+ myItem:{},
+ waterIntakeName: "",
image: "/images/ic_head_bg.jpg",
userPhone: "158****0723",
userName: "寮犱笁",
scrollViewHeight: 0,
- listData: [{
- name: '鍙栨按鍙� 1',
- code: '1055201'
- },
- {
- name: '鍙栨按鍙� 2',
- code: '1055201'
- },
- {
- name: '鍙栨按鍙� 3',
- code: '1055201'
- },
- {
- name: '鍙栨按鍙� 3',
- code: '1055201'
- },
- {
- name: '鍙栨按鍙� 4',
- code: '1055201'
- },
- {
- name: '鍙栨按鍙� 5',
- code: '1055201'
- },
- {
- name: '鍙栨按鍙� 6',
- code: '1055201'
- }
- ],
+ listData: [],
isRefreshing: false,
isWXRefreshing: false
},
@@ -68,12 +43,8 @@
this.setData({
isRefreshing: true
});
- setTimeout(function () {
- self.setData({
- isRefreshing: false, // 灏唗riggered灞炴�ц缃负false锛岃〃绀轰笅鎷夊埛鏂板凡瀹屾垚
- })
- console.log('涓嬫媺鍒锋柊宸插畬鎴�');
- }, 3000);
+ this.getOpenList();
+
}
},
@@ -100,7 +71,11 @@
wx.nextTick(() => {
this.calculateScrollViewHeight();
});
+ //褰撳紑闃�鎴愬姛鍚庤皟鐢ㄥ埛鏂�
console.log("onLoad锛�" + options.param);
+ if(options.param){
+ getOpenList() ;
+ }
},
/**
@@ -113,15 +88,14 @@
this.setData({
sessionId: data
});
- if (sessionId !== "") {
-
- }
+ if (sessionId !== "") {}
}).catch((err) => {
console.error('Failed to load parameter:', err);
});
} else {
console.log('Failed to load parameter:false');
}
+ this.getOpenList();
},
/**
@@ -178,5 +152,109 @@
*/
onShareAppMessage() {
+ },
+ recharge() {
+ wx.navigateTo({
+ url: '/pages/rechargeCard/rechargeCard',
+ })
+ },
+ openValveList() {
+ wx.showToast({
+ title: '姝e湪寮�鍙戜腑',
+ icon: 'none'
+ })
+ },
+ feedBack() {
+ wx.showToast({
+ title: '姝e湪寮�鍙戜腑',
+ icon: 'none'
+ })
+ },
+ handleChange(e) {
+ const item = e.currentTarget.dataset.item;
+ console.log(item);
+ this.setData({
+ showConfirm: true,
+ waterIntakeName: item.intakeNum,
+ myItem:item
+ });
+ },
+ closeDialog() {
+ this.setData({
+ showConfirm: false
+ });
+ },
+ /**
+ * 鍏抽棴闃�闂�
+ * @param {*} orderNo 璁㈠崟鍙�
+ * @param {*} rtuAddr 闃�鎺у櫒鍦板潃
+ * @param {*} vcNum 铏氭嫙鍗$紪鍙�
+ */
+ postCloseValaue(orderNo, rtuAddr, vcNum) {
+ const app = getApp();
+ const data = {
+ rtuAddr: rtuAddr,
+ vcNum: vcNum, //铏氭嫙鍗D
+ orderNo:orderNo,
+ userType: 2, //鐢ㄦ埛绫诲瀷1-骞冲彴锛�2-App
+ operator: app.globalData.sessionId //鎿嶄綔鍛�
+ };
+ console.log("postCloseValaue"+data);
+ post({
+ url: "valve/close",
+ data: data,
+ isShowLoding:true
+ }).then(response => {
+ // 澶勭悊鎴愬姛鍝嶅簲
+ console.log('璇锋眰鎴愬姛:', response);
+ // 鍔犺浇瀹屾垚鍚庨殣钘忓姞杞藉姩鐢�
+ wx.hideLoading();
+ //瀹屾垚鍚庡洖鍒伴椤�
+ wx.reLaunch({
+ url: '/pages/home/home?param=true' // 棣栭〉鐨勮矾寰勶紝鏍规嵁瀹為檯鎯呭喌濉啓
+ });
+ }).catch(error => {
+ // 澶勭悊閿欒鍝嶅簲
+ console.error('璇锋眰澶辫触:', error);
+ });
+ },
+ /**
+ * 鑾峰彇涓哄叧闃�璁板綍
+ */
+ getOpenList() {
+ const app = getApp();
+ const params = {
+ url: 'valve/get',
+ data: {
+ operator: app.globalData.sessionId
+ }
+ };
+ get(params).then(data => {
+ this.setData({
+ listData: data.content,
+ isRefreshing: false, // 灏唗riggered灞炴�ц缃负false锛岃〃绀轰笅鎷夊埛鏂板凡瀹屾垚
+ })
+ }).catch(err => {
+ // 閿欒鍥炶皟
+ console.error('Error:', err);
+ this.setData({
+ isRefreshing: false, // 灏唗riggered灞炴�ц缃负false锛岃〃绀轰笅鎷夊埛鏂板凡瀹屾垚
+ })
+ });
+ },
+ /**
+ * 纭鍏抽棴鍥炶皟
+ * @param {} item
+ */
+ confirmDialog(){
+ this.setData({
+ showConfirm: false
+ });
+ this.postCloseValaue(this.data.myItem.orderNo,this.data.myItem.rtuAddr,this.data.myItem.vcNum);
}
+
+
+
+
+
})
\ No newline at end of file
--
Gitblit v1.8.0