From 917252ef3ea2b63c74d162cc67a6fbe103cb9b4d Mon Sep 17 00:00:00 2001
From: zuoxiao <470321431@qq.com>
Date: 星期五, 25 十月 2024 14:06:09 +0800
Subject: [PATCH] 1.开关阀记录界面。2.虚拟卡充值相关。3.问题反馈相关
---
pages/rechargeCard/rechargeCard.js | 157 +++++++++++++++++++++++++++++++++++++---------------
1 files changed, 111 insertions(+), 46 deletions(-)
diff --git a/pages/rechargeCard/rechargeCard.js b/pages/rechargeCard/rechargeCard.js
index 9b634f2..9377c0c 100644
--- a/pages/rechargeCard/rechargeCard.js
+++ b/pages/rechargeCard/rechargeCard.js
@@ -1,4 +1,5 @@
// pages/rechargeCard/rechargeCard.js
+//铏氭嫙鍗″垪琛�
const {
get,
post
@@ -13,69 +14,40 @@
content: '纭'
},
currentTab: 0, // 褰撳墠鏄剧ず鐨勮〃鏍硷紝榛樿涓虹涓�涓〃鏍�
- allCardPoints: [{
- "id": "string",
- "inUse": 0,
- "inUseName": "string",
- "money": 110,
- "vcNum": "200030000000"
- }, {
- "id": "string",
- "inUse": 0,
- "inUseName": "string",
- "money": 110,
- "vcNum": "200030000000"
- }, {
- "id": "string",
- "inUse": 0,
- "inUseName": "string",
- "money": 110,
- "vcNum": "200030000000"
- }, {
- "id": "string",
- "inUse": 0,
- "inUseName": "string",
- "money": 110,
- "vcNum": "200030000000"
- }, {
- "id": "string",
- "inUse": 1,
- "inUseName": "string",
- "money": 110,
- "vcNum": "200030000000"
- }],
+ allCardPoints: [],
allWaterPoints: [{
"id": "string",
"inUse": 1,
"inUseName": "string",
"money": 110,
"vcNum": "200030000000"
- },{
+ }, {
"id": "string",
"inUse": 1,
"inUseName": "string",
"money": 110,
"vcNum": "200030000000"
- },{
+ }, {
"id": "string",
"inUse": 1,
"inUseName": "string",
"money": 110,
"vcNum": "200030000000"
- },{
+ }, {
"id": "string",
"inUse": 1,
"inUseName": "string",
"money": 110,
"vcNum": "200030000000"
- },{
+ }, {
"id": "string",
"inUse": 1,
"inUseName": "string",
"money": 110,
"vcNum": "200030000000"
}],
- showDialog: false
+ showDialog: false,
+ isWXRefreshing: false
},
// 鍒囨崲 Tabs
switchTab: function (e) {
@@ -89,7 +61,7 @@
*/
onLoad(options) {
this.getCardList();
- this.getWaterCardList();
+ // this.getWaterCardList();
},
/**
@@ -124,7 +96,10 @@
* 椤甸潰鐩稿叧浜嬩欢澶勭悊鍑芥暟--鐩戝惉鐢ㄦ埛涓嬫媺鍔ㄤ綔
*/
onPullDownRefresh() {
-
+ this.setData({
+ isWXRefreshing: true
+ })
+ this.getCardList();
},
/**
@@ -148,11 +123,13 @@
}
})
.then((data) => {
+ this.setData({
+ isWXRefreshing: false
+ });
if (data.success && data.code === "0001") {
this.setData({
allCardPoints: data.content
});
- this.updateDisplayText();
} else {
wx.showToast({
title: data.msg,
@@ -161,6 +138,9 @@
console.log('Failed to add item:');
})
.catch((error) => {
+ this.setData({
+ isWXRefreshing: false
+ });
console.error('Failed to add item:', error);
});
},
@@ -187,21 +167,106 @@
console.error('Failed to add item:', error);
});
},
- rechargeCard(item) {
+ rechargeCard(event) {
wx.navigateTo({
- url: '/pages/rechargeMoney/rechargMoney' // 棣栭〉鐨勮矾寰勶紝鏍规嵁瀹為檯鎯呭喌濉啓
+ url: '/pages/rechargeMoney/rechargMoney?vcId='+event.currentTarget.dataset.item.id // 棣栭〉鐨勮矾寰勶紝鏍规嵁瀹為檯鎯呭喌濉啓
});
},
- ruinCard() {
- this.setData({
- showDialog: true
- })
+ ruinCard(item) {
+ const mItem = item.currentTarget.dataset.item;
+
+ if (mItem.money > 0) {
+ //閲戦澶т簬0涓嶈兘閿�鍗�
+ this.setData({
+ showDialog: true
+ })
+ } else {
+ //閲戦绛変簬0鎵嶅彲閿�鍗�
+ this.deleteID(mItem.id);
+ }
},
closeDialog() {
this.setData({
showDialog: false
})
- }
+ },
+ //娣诲姞铏氭嫙鍗�
+ handleClick() {
+ wx.showLoading({
+ title: '姝e湪娣诲姞璇风◢鍊�...', // 鍔犺浇鎻愮ず鏂囧瓧
+ mask: true // 鏄惁鏄剧ず閫忔槑钂欏眰锛岄槻姝㈣Е鎽哥┛閫忥紝榛樿涓� false
+ });
+ const data = {
+ clientId: getApp().globalData.clientId, //涓存椂鐧诲綍鍑瘉
+ };
+ post({
+ url: "wx/virtual_card/add_vc",
+ data: data,
+ }).then(response => {
+ // 澶勭悊鎴愬姛鍝嶅簲
+ console.log('璇锋眰鎴愬姛:', response);
+ // 鍔犺浇瀹屾垚鍚庨殣钘忓姞杞藉姩鐢�
+ wx.hideLoading();
+ if (response.code === "0001") {
+ wx.showToast({
+ title: '娣诲姞鎴愬姛',
+ icon: 'success',
+ duration: 3000
+ })
+ this.getCardList();
+ }
+ }).catch(error => {
+ // 鍔犺浇瀹屾垚鍚庨殣钘忓姞杞藉姩鐢�
+ wx.hideLoading();
+ // 澶勭悊閿欒鍝嶅簲
+ console.error('璇锋眰澶辫触:', error);
+ wx.showToast({
+ title: '娣诲姞澶辫触',
+ icon: 'error',
+ duration: 2000
+ })
+ });
+ },
+ //娉ㄩ攢铏氭嫙鍗�
+ deleteID(vcId) {
+ wx.showLoading({
+ title: '姝e湪閿�鍗¤绋嶅��...', // 鍔犺浇鎻愮ず鏂囧瓧
+ mask: true // 鏄惁鏄剧ず閫忔槑钂欏眰锛岄槻姝㈣Е鎽哥┛閫忥紝榛樿涓� false
+ });
+ const data = {
+ clientId: getApp().globalData.clientId, //涓存椂鐧诲綍鍑瘉
+ vcId: vcId //铏氭嫙鍗d
+ };
+ post({
+ url: "wx/virtual_card/cancel",
+ data: data,
+ }).then(response => {
+ // 澶勭悊鎴愬姛鍝嶅簲
+ console.log('璇锋眰鎴愬姛:', response);
+ // 鍔犺浇瀹屾垚鍚庨殣钘忓姞杞藉姩鐢�
+ wx.hideLoading();
+ if (response.code === "0001") {
+ wx.showToast({
+ title: '閿�鍗℃垚鍔�',
+ icon: 'success',
+ duration: 3000
+ })
+ this.getCardList();
+ }
+ }).catch(error => {
+ // 鍔犺浇瀹屾垚鍚庨殣钘忓姞杞藉姩鐢�
+ wx.hideLoading();
+ // 澶勭悊閿欒鍝嶅簲
+ console.error('璇锋眰澶辫触:', error);
+ wx.showToast({
+ title: '娉ㄩ攢澶辫触',
+ icon: 'error',
+ duration: 2000
+ })
+ });
+ },
+
+
})
\ No newline at end of file
--
Gitblit v1.8.0