From fb805f6ff1d167951e94198b6e9fc320649e8643 Mon Sep 17 00:00:00 2001 From: zuoxiao <zuoxiao> Date: 星期五, 11 四月 2025 17:57:20 +0800 Subject: [PATCH] Merge branch 'doing' of http://8.140.179.55:20000/r/wm/pipIrr into doing --- pages/openCard/openCard.js | 85 ++++++++++++++++++++++-------------------- 1 files changed, 44 insertions(+), 41 deletions(-) diff --git a/pages/openCard/openCard.js b/pages/openCard/openCard.js index 2a1fdcb..9a85d8f 100644 --- a/pages/openCard/openCard.js +++ b/pages/openCard/openCard.js @@ -11,65 +11,34 @@ data: { intakeId: 0, - allCardPoints: [{ - id: 511111111, - balance: '30', - state: 1 - }, - { - id: 411111111, - balance: '30', - state: 0 - }, - { - id: 31111111111, - balance: '30', - state: 1 - }, - { - id: 2, - balance: '30', - state: 1 - }, - { - id: 1, - balance: '30', - state: 1 - }, - { - id: 0, - balance: '30', - state: 1 - }, - ] // 甯哥敤鍙栨按鍙f暟鎹� + allCardPoints: [] // 鎵�鏈夎櫄鎷熷崱 }, openValva(event) { const { item } = event.currentTarget.dataset; // 鑾峰彇褰撳墠鐐瑰嚮鐨� item - if (item.state === 1) { + if (item.inUse === 0) { // 鍦ㄩ〉闈㈠姞杞芥椂鏄剧ず鍔犺浇鍔ㄧ敾 wx.showLoading({ - title: '姝e湪寮�娉佃绋嶅悗...', // 鍔犺浇鎻愮ず鏂囧瓧 + title: '姝e湪寮�娉佃绋嶅��...', // 鍔犺浇鎻愮ず鏂囧瓧 mask: true // 鏄惁鏄剧ず閫忔槑钂欏眰锛岄槻姝㈣Е鎽哥┛閫忥紝榛樿涓� false }); - this.postOpenValva(); + this.postOpenValva(item.vcId); } }, //寮�娉甸�氫俊 - postOpenValva() { + postOpenValva(vcId) { const app = getApp(); const data = { intakeId: this.data.intakeId, //鍙栨按鍙D - vcId: '2023122618460900006', //铏氭嫙鍗D - userType: 2, //鐢ㄦ埛绫诲瀷1-骞冲彴锛�2-App - operator: app.globalData.sessionId //鎿嶄綔鍛� + vcId: vcId, //铏氭嫙鍗D + operator: app.globalData.operator //鎿嶄綔鍛� }; post({ - url: "comRes/receive", + url: "8087/wx/valve/open_wx", data: data }).then(response => { - + // 澶勭悊鎴愬姛鍝嶅簲 console.log('璇锋眰鎴愬姛:', response); // 鍔犺浇瀹屾垚鍚庨殣钘忓姞杞藉姩鐢� @@ -78,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 // 鎻愮ず鐨勬寔缁椂闂达紝鍗曚綅姣 + }) + } }); }, /** @@ -97,6 +73,7 @@ intakeId }) console.log('intakeId:' + this.data.intakeId); + this.getCardList(); }, /** @@ -146,5 +123,31 @@ */ onShareAppMessage() { + }, + //鑾峰彇铏氭嫙鍗″垪琛� + 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