From d18a0c9fe708dcf58253b54ef2938b5e864b24df Mon Sep 17 00:00:00 2001
From: zuoxiao <zuoxiao>
Date: 星期一, 28 四月 2025 14:39:30 +0800
Subject: [PATCH] 优化水摄入页面的确认弹窗逻辑,调整showConfirm状态的设置位置,并移除不必要的代码注释,提升代码可读性和维护性。
---
pages/openCard/openCard.js | 63 ++++++++++++++++++-------------
1 files changed, 37 insertions(+), 26 deletions(-)
diff --git a/pages/openCard/openCard.js b/pages/openCard/openCard.js
index 0942e8c..9a85d8f 100644
--- a/pages/openCard/openCard.js
+++ b/pages/openCard/openCard.js
@@ -20,7 +20,7 @@
if (item.inUse === 0) {
// 鍦ㄩ〉闈㈠姞杞芥椂鏄剧ず鍔犺浇鍔ㄧ敾
wx.showLoading({
- title: '姝e湪寮�娉佃绋嶅悗...', // 鍔犺浇鎻愮ず鏂囧瓧
+ title: '姝e湪寮�娉佃绋嶅��...', // 鍔犺浇鎻愮ず鏂囧瓧
mask: true // 鏄惁鏄剧ず閫忔槑钂欏眰锛岄槻姝㈣Е鎽哥┛閫忥紝榛樿涓� false
});
this.postOpenValva(item.vcId);
@@ -32,14 +32,13 @@
const data = {
intakeId: this.data.intakeId, //鍙栨按鍙D
vcId: vcId, //铏氭嫙鍗D
- userType: 2, //鐢ㄦ埛绫诲瀷1-骞冲彴锛�2-App
- operator: app.globalData.sessionId //鎿嶄綔鍛�
+ operator: app.globalData.operator //鎿嶄綔鍛�
};
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);
+ });
}
})
\ No newline at end of file
--
Gitblit v1.8.0