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 +++++++-- pages/home/home.json | 7 app.wxss | 18 + pages/rechargeCard/rechargeCard.js | 117 +++++++ images/no_more.svg | 24 + pages/rechargeCard/rechargeCard.json | 3 pages/rechargeCard/rechargeCard.wxml | 56 +++ app.json | 4 /dev/null | 2 pages/rechargeCard/rechargeCard.wxss | 155 ++++++++++ app.js | 1 api/config.js | 2 pages/openCard/openCard.js | 57 +++ api/request.js | 68 +++ pages/openCard/openCard.wxss | 5 pages/openCard/openCard.wxml | 9 pages/rechargeMoney/rechargMoney.wxml | 29 - pages/waterIntake/waterIntake.wxss | 40 ++ pages/waterIntake/waterIntake.js | 85 ++++- pages/waterIntake/waterIntake.wxml | 26 + pages/home/home.wxml | 13 api/env.js | 4 pages/home/home.wxss | 4 pages/rechargeMoney/rechargMoney.wxss | 14 24 files changed, 755 insertions(+), 142 deletions(-) diff --git a/api/config.js b/api/config.js index 2b8d316..1d2541e 100644 --- a/api/config.js +++ b/api/config.js @@ -6,7 +6,7 @@ BASEURL = '' break case 'test': - BASEURL = '' + BASEURL = 'https://44978f7456.imdo.co/remote/' break default: BASEURL = '' diff --git a/api/env.js b/api/env.js index e07c5c9..33a33d0 100644 --- a/api/env.js +++ b/api/env.js @@ -1,5 +1,5 @@ // env.js 鐜閰嶇疆 module.exports = { - ENV: 'production', - // ENV: 'test' + // ENV: 'production', + ENV: 'test' } \ No newline at end of file diff --git a/api/request.js b/api/request.js index 29411f7..62f4b83 100644 --- a/api/request.js +++ b/api/request.js @@ -1,7 +1,9 @@ // 寮曞叆鐘舵�佺爜statusCode const statusCode = require('./statusCode') // 瀹氫箟璇锋眰璺緞, BASEURL: 鏅�氳姹侫PI; CBASEURL: 涓彴API,涓嶄娇鐢ㄤ腑鍙板彲涓嶅紩鍏BASEURL -const { BASEURL } = require('./config') +const { + BASEURL +} = require('./config') // 瀹氫箟榛樿鍙傛暟 const defaultOptions = { data: {}, @@ -17,9 +19,20 @@ * ignoreToken: <Boolean> 鏄惁蹇界暐token楠岃瘉 * form: <Boolean> 鏄惁浣跨敤formData璇锋眰 */ -function request (options) { - let _options = Object.assign(defaultOptions, options) - let { method, url, data, ignoreToken, form } = _options +function request(options) { + // let _options = Object.assign(defaultOptions, options) + let _options = { + ...defaultOptions, + ...options + } + let { + method, + url, + data, + ignoreToken, + form, + isShowLoding + } = _options const app = getApp() // 璁剧疆璇锋眰澶� let header = {} @@ -38,15 +51,34 @@ header.Authorization = `Bearer ${token}` } return new Promise((resolve, reject) => { + console.log("url:" + BASEURL + url); + if (isShowLoding) { + wx.showLoading({ + title: '閫氫俊涓�...', // 鍔犺浇鍔ㄧ敾鏍囬 + mask: true, // 鏄惁鏄剧ず閫忔槑钂欏眰锛岄槻姝㈣Е鎽哥┛閫� + }); + } + let myUrl; + if (url.startsWith('http')) { + myUrl = url; + } else { + myUrl = BASEURL + url; + } wx.request({ - url: BASEURL + url, + url: myUrl, data, header, method, success: (res) => { - let { statusCode: code } = res + let { + statusCode: code + } = res + console.log("success statusCode:" + code); + if (isShowLoding) { + wx.hideLoading(); // 闅愯棌鍔犺浇鍔ㄧ敾 + } if (code === statusCode.SUCCESS) { - if (res.data.code !== 0) { + if (res.data.code !== "0001") { // 缁熶竴澶勭悊璇锋眰閿欒 showToast(res.data.errorMsg) reject(res.data) @@ -58,12 +90,18 @@ showToast(`鐧诲綍杩囨湡, 璇烽噸鏂板埛鏂伴〉闈) reject(res.data) } else { - showToast(`璇锋眰閿欒${url}, CODE: ${code}`) + // showToast(`璇锋眰閿欒${url}, CODE: ${code}`) + console.log("success 璇锋眰閿欒:" + code); reject(res.data) } + console.log("success statusCode:1111111111"); }, fail: (err) => { - console.log('%c err', 'color: red;font-weight: bold', err) + console.log("Error " + err); + if (isShowLoding) { + wx.hideLoading(); // 闅愯棌鍔犺浇鍔ㄧ敾 + } + showToast(err.errMsg) reject(err) } @@ -72,7 +110,7 @@ } // 灏佽toast鍑芥暟 -function showToast (title, icon='none', duration=2500, mask=false) { +function showToast(title, icon = 'none', duration = 2500, mask = false) { wx.showToast({ title: title || '', icon, @@ -81,14 +119,14 @@ }); } -function get (options) { +function get(options) { return request({ method: 'GET', ...options }) } -function post (options) { +function post(options) { // url, data = {}, ignoreToken, form return request({ method: 'POST', @@ -97,5 +135,7 @@ } module.exports = { - request, get, post -} + request, + get, + post +} \ No newline at end of file diff --git a/app.js b/app.js index 9ff2871..910fd81 100644 --- a/app.js +++ b/app.js @@ -14,6 +14,7 @@ }) }, globalData: { + sessionId:'2023111514251400001', userInfo: null, userId:"", userCode:"", diff --git a/app.json b/app.json index ddc4606..e7cc7e4 100644 --- a/app.json +++ b/app.json @@ -9,12 +9,12 @@ "pages/index/index", "pages/logs/logs", "pages/my/my", - "pages/recharge/recharge", "pages/waterIntake/waterIntake", "pages/personCharge/personcharge", "pages/feedback/feedback", "pages/openCard/openCard", - "pages/rechargeMoney/rechargMoney" + "pages/rechargeMoney/rechargMoney", + "pages/rechargeCard/rechargeCard" ], "window": { "navigationBarTextStyle": "white", diff --git a/app.wxss b/app.wxss index 06c6fc9..f076322 100644 --- a/app.wxss +++ b/app.wxss @@ -5,6 +5,22 @@ flex-direction: column; align-items: center; justify-content: space-between; - padding: 200rpx 0; box-sizing: border-box; } +.noMore-View { + display: flex; + justify-content: center; + align-items: center; + height: 100%; + text-align: center; + flex-direction: column; +} + +.noMore-img{ + width: 300rpx; + height: 300rpx; +} + +.noMore-text{ + color:#969494; +} \ No newline at end of file diff --git a/images/home_blue.png b/images/home_blue.png deleted file mode 100644 index 3ccb396..0000000 --- a/images/home_blue.png +++ /dev/null Binary files differ diff --git a/images/home_grey.png b/images/home_grey.png deleted file mode 100644 index 6570f3b..0000000 --- a/images/home_grey.png +++ /dev/null Binary files differ diff --git a/images/login_bg.jpeg b/images/login_bg.jpeg deleted file mode 100644 index 742cd3c..0000000 --- a/images/login_bg.jpeg +++ /dev/null Binary files differ diff --git a/images/my_blue.png b/images/my_blue.png deleted file mode 100644 index 7b33989..0000000 --- a/images/my_blue.png +++ /dev/null Binary files differ diff --git a/images/my_grey.png b/images/my_grey.png deleted file mode 100644 index a804784..0000000 --- a/images/my_grey.png +++ /dev/null Binary files differ diff --git a/images/no_more.svg b/images/no_more.svg new file mode 100644 index 0000000..50327d6 --- /dev/null +++ b/images/no_more.svg @@ -0,0 +1,24 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"> +<svg xmlns="http://www.w3.org/2000/svg" version="1.1" width="300px" height="300px" style="shape-rendering:geometricPrecision; text-rendering:geometricPrecision; image-rendering:optimizeQuality; fill-rule:evenodd; clip-rule:evenodd" xmlns:xlink="http://www.w3.org/1999/xlink"> +<g><path style="opacity:0.245" fill="#bfcadf" d="M 180.5,43.5 C 181.552,43.3505 182.552,43.5172 183.5,44C 186.713,48.2579 190.047,52.4246 193.5,56.5C 190.136,60.6986 186.302,64.3653 182,67.5C 177.833,64.6667 174.333,61.1667 171.5,57C 174.628,52.5742 177.628,48.0742 180.5,43.5 Z"/></g> +<g><path style="opacity:0.991" fill="#c1d1e2" d="M 57.5,51.5 C 61.5586,53.7205 64.8919,56.8872 67.5,61C 64.5,63.5 61.5,66 58.5,68.5C 55.6314,66.4659 53.2981,63.9659 51.5,61C 53.3134,57.6926 55.3134,54.526 57.5,51.5 Z"/></g> +<g><path style="opacity:0.991" fill="#c1d1e2" d="M 101.5,78.5 C 105.559,80.7205 108.892,83.8872 111.5,88C 108.5,90.5 105.5,93 102.5,95.5C 99.6314,93.4659 97.2981,90.9659 95.5,88C 97.3134,84.6926 99.3134,81.526 101.5,78.5 Z"/></g> +<g><path style="opacity:0.355" fill="#c0cddf" d="M 210.5,81.5 C 211.496,81.4142 212.329,81.7476 213,82.5C 214.515,84.6772 216.015,86.8439 217.5,89C 216.037,91.6312 214.037,93.7979 211.5,95.5C 208.963,93.7979 206.963,91.6312 205.5,89C 207.295,86.5742 208.962,84.0742 210.5,81.5 Z"/></g> +<g><path style="opacity:1" fill="#d9e2ee" d="M 195.5,94.5 C 192.443,96.3951 190.277,99.0618 189,102.5C 188.212,108.582 188.379,114.582 189.5,120.5C 189.5,141.833 189.5,163.167 189.5,184.5C 212.696,188.344 235.029,195.01 256.5,204.5C 256.649,205.552 256.483,206.552 256,207.5C 251.328,207.304 246.995,206.97 243,206.5C 242,207.167 241,207.833 240,208.5C 226.713,207.509 213.213,207.509 199.5,208.5C 198.006,208.291 196.839,207.624 196,206.5C 195.374,208.991 194.541,208.991 193.5,206.5C 188.433,207.479 183.599,207.479 179,206.5C 178,207.167 177,207.833 176,208.5C 174.333,208.5 172.667,208.5 171,208.5C 169.933,207.809 168.766,207.309 167.5,207C 168.5,206.167 169.5,205.333 170.5,204.5C 170.376,203.893 170.043,203.56 169.5,203.5C 166.558,199.277 164.391,194.61 163,189.5C 162.393,185.463 162.56,181.463 163.5,177.5C 139.994,177.831 116.661,177.498 93.5,176.5C 95.8333,176.5 98.1667,176.5 100.5,176.5C 100.333,154.497 100.5,132.497 101,110.5C 101.927,102.239 106.427,97.0718 114.5,95C 141.498,94.5 168.498,94.3334 195.5,94.5 Z"/></g> +<g><path style="opacity:1" fill="#ccd9ed" d="M 195.5,94.5 C 200.048,94.1994 203.215,96.1994 205,100.5C 207.128,106.991 207.961,113.658 207.5,120.5C 201.5,120.5 195.5,120.5 189.5,120.5C 188.379,114.582 188.212,108.582 189,102.5C 190.277,99.0618 192.443,96.3951 195.5,94.5 Z"/></g> +<g><path style="opacity:1" fill="#fbfcfd" d="M 121.5,116.5 C 126.989,116.504 128.822,119.171 127,124.5C 122.791,127.596 119.958,126.596 118.5,121.5C 119.092,119.577 120.092,117.911 121.5,116.5 Z"/></g> +<g><path style="opacity:1" fill="#fefefe" d="M 140.5,117.5 C 150.172,117.334 159.839,117.5 169.5,118C 172.167,120.333 172.167,122.667 169.5,125C 159.833,125.667 150.167,125.667 140.5,125C 137.88,122.441 137.88,119.941 140.5,117.5 Z"/></g> +<g><path style="opacity:1" fill="#fcfdfd" d="M 120.5,134.5 C 127.486,134.331 129.153,137.164 125.5,143C 121.229,144.513 118.895,143.013 118.5,138.5C 118.752,136.927 119.418,135.594 120.5,134.5 Z"/></g> +<g><path style="opacity:1" fill="#fcfdfe" d="M 140.5,134.5 C 150.172,134.334 159.839,134.5 169.5,135C 172.167,137.667 172.167,140.333 169.5,143C 159.833,143.667 150.167,143.667 140.5,143C 137.899,140.17 137.899,137.337 140.5,134.5 Z"/></g> +<g><path style="opacity:0.245" fill="#bfcadf" d="M 46.5,145.5 C 47.552,145.351 48.552,145.517 49.5,146C 52.7132,150.258 56.0465,154.425 59.5,158.5C 56.1356,162.699 52.3023,166.365 48,169.5C 43.8333,166.667 40.3333,163.167 37.5,159C 40.6283,154.574 43.6283,150.074 46.5,145.5 Z"/></g> +<g><path style="opacity:1" fill="#fcfdfe" d="M 120.5,152.5 C 127.486,152.331 129.153,155.164 125.5,161C 118.946,160.957 117.279,158.123 120.5,152.5 Z"/></g> +<g><path style="opacity:1" fill="#fefefe" d="M 140.5,152.5 C 150.172,152.334 159.839,152.5 169.5,153C 171.648,155.075 171.982,157.408 170.5,160C 160.167,160.667 149.833,160.667 139.5,160C 138.083,157.257 138.416,154.757 140.5,152.5 Z"/></g> +<g><path style="opacity:0.248" fill="#bfcadf" d="M 238.5,157.5 C 240.39,157.297 241.89,157.963 243,159.5C 246.233,163.063 249.067,166.896 251.5,171C 248.223,175.064 244.39,178.564 240,181.5C 235.833,178.667 232.333,175.167 229.5,171C 232.733,166.611 235.733,162.111 238.5,157.5 Z"/></g> +<g><path style="opacity:1" fill="#ccd9ed" d="M 93.5,176.5 C 116.661,177.498 139.994,177.831 163.5,177.5C 162.56,181.463 162.393,185.463 163,189.5C 164.391,194.61 166.558,199.277 169.5,203.5C 159.833,203.5 150.167,203.5 140.5,203.5C 136.167,203.5 131.833,203.5 127.5,203.5C 118.143,203.832 108.81,203.498 99.5,202.5C 96.2675,198.112 93.6009,193.446 91.5,188.5C 90.9106,184.029 91.5772,180.029 93.5,176.5 Z"/></g> +<g><path style="opacity:0.31" fill="#d9e2ec" d="M 91.5,188.5 C 93.6009,193.446 96.2675,198.112 99.5,202.5C 108.81,203.498 118.143,203.832 127.5,203.5C 122.102,205.74 116.435,207.407 110.5,208.5C 97.4696,207.361 84.4696,207.361 71.5,208.5C 70.0055,208.291 68.8388,207.624 68,206.5C 67.3741,208.991 66.5407,208.991 65.5,206.5C 62.5395,206.865 59.3728,207.532 56,208.5C 51.6667,207.167 47.3333,207.167 43,208.5C 41.6976,207.915 40.531,207.249 39.5,206.5C 56.1876,198.715 73.5209,192.715 91.5,188.5 Z"/></g> +<g><path style="opacity:0.282" fill="#e5ebf2" d="M 39.5,206.5 C 40.531,207.249 41.6976,207.915 43,208.5C 47.3333,207.167 51.6667,207.167 56,208.5C 59.3728,207.532 62.5395,206.865 65.5,206.5C 66.5407,208.991 67.3741,208.991 68,206.5C 68.8388,207.624 70.0055,208.291 71.5,208.5C 84.4696,207.361 97.4696,207.361 110.5,208.5C 103.939,210.424 97.2724,212.424 90.5,214.5C 88.6555,213.062 87.4888,213.396 87,215.5C 86,212.833 85,212.833 84,215.5C 83.6667,214.833 83.3333,214.167 83,213.5C 82.082,215.632 80.7487,216.299 79,215.5C 76.6667,216.167 74.3333,216.833 72,217.5C 71.2588,216.359 70.4255,216.359 69.5,217.5C 68.4593,215.009 67.6259,215.009 67,217.5C 66.3333,216.167 65.3333,215.167 64,214.5C 61.2683,217.807 58.6016,218.141 56,215.5C 55.3741,217.991 54.5407,217.991 53.5,215.5C 49.4792,216.826 45.1458,216.826 40.5,215.5C 38.6803,215.649 37.1803,216.316 36,217.5C 35.3741,215.009 34.5407,215.009 33.5,217.5C 32.4593,215.009 31.6259,215.009 31,217.5C 29.0088,216.008 26.8422,215.008 24.5,214.5C 29.3065,211.595 34.3065,208.928 39.5,206.5 Z"/></g> +<g><path style="opacity:0.272" fill="#e7edf3" d="M 140.5,203.5 C 150.167,203.5 159.833,203.5 169.5,203.5C 170.043,203.56 170.376,203.893 170.5,204.5C 169.5,205.333 168.5,206.167 167.5,207C 168.766,207.309 169.933,207.809 171,208.5C 172.667,208.5 174.333,208.5 176,208.5C 177,207.833 178,207.167 179,206.5C 183.599,207.479 188.433,207.479 193.5,206.5C 194.541,208.991 195.374,208.991 196,206.5C 196.839,207.624 198.006,208.291 199.5,208.5C 213.213,207.509 226.713,207.509 240,208.5C 241,207.833 242,207.167 243,206.5C 246.995,206.97 251.328,207.304 256,207.5C 256.483,206.552 256.649,205.552 256.5,204.5C 266.186,209.007 275.519,214.007 284.5,219.5C 282.085,219.556 279.751,219.889 277.5,220.5C 276.459,218.009 275.626,218.009 275,220.5C 274,217.833 273,217.833 272,220.5C 271.667,219.833 271.333,219.167 271,218.5C 270.333,219.833 269.333,220.833 268,221.5C 267.259,220.359 266.425,220.359 265.5,221.5C 264.402,217.639 263.569,217.639 263,221.5C 262.751,220.376 262.251,219.376 261.5,218.5C 258.833,219.833 256.167,219.833 253.5,218.5C 252.459,220.991 251.626,220.991 251,218.5C 250.333,219.833 249.333,220.833 248,221.5C 243.667,220.167 239.333,220.167 235,221.5C 232.266,220.638 232.099,219.805 234.5,219C 233.5,218.833 232.5,218.667 231.5,218.5C 229.796,219.068 228.296,219.068 227,218.5C 226,219.167 225,219.833 224,220.5C 220.57,220.306 217.07,220.306 213.5,220.5C 212.459,218.009 211.626,218.009 211,220.5C 210,217.833 209,217.833 208,220.5C 207.667,219.833 207.333,219.167 207,218.5C 206.333,219.833 205.333,220.833 204,221.5C 203.259,220.359 202.425,220.359 201.5,221.5C 200.402,217.639 199.569,217.639 199,221.5C 198.751,220.376 198.251,219.376 197.5,218.5C 194.833,219.833 192.167,219.833 189.5,218.5C 188.459,220.991 187.626,220.991 187,218.5C 186.333,219.833 185.333,220.833 184,221.5C 179.667,220.167 175.333,220.167 171,221.5C 168.266,220.638 168.099,219.805 170.5,219C 167.805,218.746 165.305,218.579 163,218.5C 162,219.167 161,219.833 160,220.5C 155.667,219.167 151.333,219.167 147,220.5C 146.833,220.167 146.667,219.833 146.5,219.5C 148.672,218.795 150.672,217.795 152.5,216.5C 150.432,214.055 148.265,211.722 146,209.5C 145.333,210.833 144.667,210.833 144,209.5C 143.667,210.167 143.333,210.833 143,211.5C 142.505,209.01 141.005,207.51 138.5,207C 139.973,206.29 140.64,205.124 140.5,203.5 Z"/></g> +<g><path style="opacity:0.253" fill="#f1f4f8" d="M 127.5,203.5 C 131.833,203.5 136.167,203.5 140.5,203.5C 140.64,205.124 139.973,206.29 138.5,207C 141.005,207.51 142.505,209.01 143,211.5C 143.333,210.833 143.667,210.167 144,209.5C 144.667,210.833 145.333,210.833 146,209.5C 148.265,211.722 150.432,214.055 152.5,216.5C 150.672,217.795 148.672,218.795 146.5,219.5C 146.667,219.833 146.833,220.167 147,220.5C 151.333,219.167 155.667,219.167 160,220.5C 161,219.833 162,219.167 163,218.5C 165.305,218.579 167.805,218.746 170.5,219C 168.099,219.805 168.266,220.638 171,221.5C 175.333,220.167 179.667,220.167 184,221.5C 185.333,220.833 186.333,219.833 187,218.5C 187.626,220.991 188.459,220.991 189.5,218.5C 192.167,219.833 194.833,219.833 197.5,218.5C 198.251,219.376 198.751,220.376 199,221.5C 199.569,217.639 200.402,217.639 201.5,221.5C 202.425,220.359 203.259,220.359 204,221.5C 205.333,220.833 206.333,219.833 207,218.5C 207.333,219.167 207.667,219.833 208,220.5C 209,217.833 210,217.833 211,220.5C 211.626,218.009 212.459,218.009 213.5,220.5C 217.07,220.306 220.57,220.306 224,220.5C 225,219.833 226,219.167 227,218.5C 228.296,219.068 229.796,219.068 231.5,218.5C 232.5,218.667 233.5,218.833 234.5,219C 232.099,219.805 232.266,220.638 235,221.5C 239.333,220.167 243.667,220.167 248,221.5C 249.333,220.833 250.333,219.833 251,218.5C 251.626,220.991 252.459,220.991 253.5,218.5C 256.167,219.833 258.833,219.833 261.5,218.5C 262.251,219.376 262.751,220.376 263,221.5C 263.569,217.639 264.402,217.639 265.5,221.5C 266.425,220.359 267.259,220.359 268,221.5C 269.333,220.833 270.333,219.833 271,218.5C 271.333,219.167 271.667,219.833 272,220.5C 273,217.833 274,217.833 275,220.5C 275.626,218.009 276.459,218.009 277.5,220.5C 279.751,219.889 282.085,219.556 284.5,219.5C 288.3,221.234 291.966,223.234 295.5,225.5C 295.585,226.995 294.919,227.995 293.5,228.5C 291.576,228.894 289.743,228.227 288,226.5C 287.259,227.641 286.425,227.641 285.5,226.5C 284.459,228.991 283.626,228.991 283,226.5C 280.975,228.725 278.642,229.059 276,227.5C 275.667,225.833 275.333,224.167 275,222.5C 274.871,225.003 273.871,227.003 272,228.5C 271.259,227.359 270.425,227.359 269.5,228.5C 268.459,226.009 267.626,226.009 267,228.5C 265.475,227.28 263.641,226.613 261.5,226.5C 258.989,226.288 256.822,226.955 255,228.5C 250.572,228.019 246.572,228.019 243,228.5C 241.676,227.12 240.343,226.786 239,227.5C 237.667,226.833 236.667,225.833 236,224.5C 235.374,226.991 234.541,226.991 233.5,224.5C 232.459,226.991 231.626,226.991 231,224.5C 229.177,228.121 226.843,228.787 224,226.5C 223.259,227.641 222.425,227.641 221.5,226.5C 220.459,228.991 219.626,228.991 219,226.5C 216.975,228.725 214.642,229.059 212,227.5C 211.667,225.833 211.333,224.167 211,222.5C 210.871,225.003 209.871,227.003 208,228.5C 207.259,227.359 206.425,227.359 205.5,228.5C 204.459,226.009 203.626,226.009 203,228.5C 201.475,227.28 199.641,226.613 197.5,226.5C 194.989,226.288 192.822,226.955 191,228.5C 186.572,228.019 182.572,228.019 179,228.5C 177.676,227.12 176.343,226.786 175,227.5C 173.667,226.833 172.667,225.833 172,224.5C 171.374,226.991 170.541,226.991 169.5,224.5C 168.459,226.991 167.626,226.991 167,224.5C 165.177,228.121 162.843,228.787 160,226.5C 159.259,227.641 158.425,227.641 157.5,226.5C 156.459,228.991 155.626,228.991 155,226.5C 152.975,228.725 150.642,229.059 148,227.5C 147.472,220.927 146.638,220.927 145.5,227.5C 144.167,227.833 142.833,228.167 141.5,228.5C 140.459,226.009 139.626,226.009 139,228.5C 138.228,227.151 137.061,226.318 135.5,226C 135.833,225.667 136.167,225.333 136.5,225C 135.167,224.667 133.833,224.333 132.5,224C 132.833,223.667 133.167,223.333 133.5,223C 132.216,222.316 131.049,222.483 130,223.5C 129,222.833 128,222.167 127,221.5C 125.902,222.967 124.402,223.801 122.5,224C 123.337,225.011 123.67,226.178 123.5,227.5C 120.495,227.22 117.661,227.554 115,228.5C 113.676,227.12 112.343,226.786 111,227.5C 109.667,226.833 108.667,225.833 108,224.5C 107.374,226.991 106.541,226.991 105.5,224.5C 104.459,226.991 103.626,226.991 103,224.5C 101.177,228.121 98.8432,228.787 96,226.5C 95.2588,227.641 94.4255,227.641 93.5,226.5C 92.4593,228.991 91.6259,228.991 91,226.5C 88.975,228.725 86.6417,229.059 84,227.5C 83.6667,225.833 83.3333,224.167 83,222.5C 82.8706,225.003 81.8706,227.003 80,228.5C 79.2588,227.359 78.4255,227.359 77.5,228.5C 76.4593,226.009 75.6259,226.009 75,228.5C 73.4747,227.28 71.6413,226.613 69.5,226.5C 66.9886,226.288 64.8219,226.955 63,228.5C 58.5718,228.019 54.5718,228.019 51,228.5C 49.6764,227.12 48.3431,226.786 47,227.5C 45.6667,226.833 44.6667,225.833 44,224.5C 43.3741,226.991 42.5407,226.991 41.5,224.5C 40.4593,226.991 39.6259,226.991 39,224.5C 37.1766,228.121 34.8432,228.787 32,226.5C 31.2588,227.641 30.4255,227.641 29.5,226.5C 28.4593,228.991 27.6259,228.991 27,226.5C 24.975,228.725 22.6417,229.059 20,227.5C 19.6667,225.833 19.3333,224.167 19,222.5C 18.8706,225.003 17.8706,227.003 16,228.5C 15.2588,227.359 14.4255,227.359 13.5,228.5C 12.4593,226.009 11.6259,226.009 11,228.5C 9.17386,226.835 7.00719,225.835 4.5,225.5C 10.8377,221.329 17.5044,217.663 24.5,214.5C 26.8422,215.008 29.0088,216.008 31,217.5C 31.6259,215.009 32.4593,215.009 33.5,217.5C 34.5407,215.009 35.3741,215.009 36,217.5C 37.1803,216.316 38.6803,215.649 40.5,215.5C 45.1458,216.826 49.4792,216.826 53.5,215.5C 54.5407,217.991 55.3741,217.991 56,215.5C 58.6016,218.141 61.2683,217.807 64,214.5C 65.3333,215.167 66.3333,216.167 67,217.5C 67.6259,215.009 68.4593,215.009 69.5,217.5C 70.4255,216.359 71.2588,216.359 72,217.5C 74.3333,216.833 76.6667,216.167 79,215.5C 80.7487,216.299 82.082,215.632 83,213.5C 83.3333,214.167 83.6667,214.833 84,215.5C 85,212.833 86,212.833 87,215.5C 87.4888,213.396 88.6555,213.062 90.5,214.5C 97.2724,212.424 103.939,210.424 110.5,208.5C 116.435,207.407 122.102,205.74 127.5,203.5 Z"/></g> +<g><path style="opacity:0.219" fill="#fafbfd" d="M 295.5,225.5 C 296.833,226.167 298.167,226.833 299.5,227.5C 299.5,228.5 299.5,229.5 299.5,230.5C 199.5,230.5 99.5,230.5 -0.5,230.5C -0.5,229.833 -0.5,229.167 -0.5,228.5C 1.00087,227.248 2.66754,226.248 4.5,225.5C 7.00719,225.835 9.17386,226.835 11,228.5C 11.6259,226.009 12.4593,226.009 13.5,228.5C 14.4255,227.359 15.2588,227.359 16,228.5C 17.8706,227.003 18.8706,225.003 19,222.5C 19.3333,224.167 19.6667,225.833 20,227.5C 22.6417,229.059 24.975,228.725 27,226.5C 27.6259,228.991 28.4593,228.991 29.5,226.5C 30.4255,227.641 31.2588,227.641 32,226.5C 34.8432,228.787 37.1766,228.121 39,224.5C 39.6259,226.991 40.4593,226.991 41.5,224.5C 42.5407,226.991 43.3741,226.991 44,224.5C 44.6667,225.833 45.6667,226.833 47,227.5C 48.3431,226.786 49.6764,227.12 51,228.5C 54.5718,228.019 58.5718,228.019 63,228.5C 64.8219,226.955 66.9886,226.288 69.5,226.5C 71.6413,226.613 73.4747,227.28 75,228.5C 75.6259,226.009 76.4593,226.009 77.5,228.5C 78.4255,227.359 79.2588,227.359 80,228.5C 81.8706,227.003 82.8706,225.003 83,222.5C 83.3333,224.167 83.6667,225.833 84,227.5C 86.6417,229.059 88.975,228.725 91,226.5C 91.6259,228.991 92.4593,228.991 93.5,226.5C 94.4255,227.641 95.2588,227.641 96,226.5C 98.8432,228.787 101.177,228.121 103,224.5C 103.626,226.991 104.459,226.991 105.5,224.5C 106.541,226.991 107.374,226.991 108,224.5C 108.667,225.833 109.667,226.833 111,227.5C 112.343,226.786 113.676,227.12 115,228.5C 117.661,227.554 120.495,227.22 123.5,227.5C 123.67,226.178 123.337,225.011 122.5,224C 124.402,223.801 125.902,222.967 127,221.5C 128,222.167 129,222.833 130,223.5C 131.049,222.483 132.216,222.316 133.5,223C 133.167,223.333 132.833,223.667 132.5,224C 133.833,224.333 135.167,224.667 136.5,225C 136.167,225.333 135.833,225.667 135.5,226C 137.061,226.318 138.228,227.151 139,228.5C 139.626,226.009 140.459,226.009 141.5,228.5C 142.833,228.167 144.167,227.833 145.5,227.5C 146.638,220.927 147.472,220.927 148,227.5C 150.642,229.059 152.975,228.725 155,226.5C 155.626,228.991 156.459,228.991 157.5,226.5C 158.425,227.641 159.259,227.641 160,226.5C 162.843,228.787 165.177,228.121 167,224.5C 167.626,226.991 168.459,226.991 169.5,224.5C 170.541,226.991 171.374,226.991 172,224.5C 172.667,225.833 173.667,226.833 175,227.5C 176.343,226.786 177.676,227.12 179,228.5C 182.572,228.019 186.572,228.019 191,228.5C 192.822,226.955 194.989,226.288 197.5,226.5C 199.641,226.613 201.475,227.28 203,228.5C 203.626,226.009 204.459,226.009 205.5,228.5C 206.425,227.359 207.259,227.359 208,228.5C 209.871,227.003 210.871,225.003 211,222.5C 211.333,224.167 211.667,225.833 212,227.5C 214.642,229.059 216.975,228.725 219,226.5C 219.626,228.991 220.459,228.991 221.5,226.5C 222.425,227.641 223.259,227.641 224,226.5C 226.843,228.787 229.177,228.121 231,224.5C 231.626,226.991 232.459,226.991 233.5,224.5C 234.541,226.991 235.374,226.991 236,224.5C 236.667,225.833 237.667,226.833 239,227.5C 240.343,226.786 241.676,227.12 243,228.5C 246.572,228.019 250.572,228.019 255,228.5C 256.822,226.955 258.989,226.288 261.5,226.5C 263.641,226.613 265.475,227.28 267,228.5C 267.626,226.009 268.459,226.009 269.5,228.5C 270.425,227.359 271.259,227.359 272,228.5C 273.871,227.003 274.871,225.003 275,222.5C 275.333,224.167 275.667,225.833 276,227.5C 278.642,229.059 280.975,228.725 283,226.5C 283.626,228.991 284.459,228.991 285.5,226.5C 286.425,227.641 287.259,227.641 288,226.5C 289.743,228.227 291.576,228.894 293.5,228.5C 294.919,227.995 295.585,226.995 295.5,225.5 Z"/></g> +</svg> diff --git a/images/piping.png b/images/piping.png deleted file mode 100644 index 27defb0..0000000 --- a/images/piping.png +++ /dev/null Binary files differ diff --git a/images/record_blue.png b/images/record_blue.png deleted file mode 100644 index 5d836ee..0000000 --- a/images/record_blue.png +++ /dev/null Binary files differ diff --git a/images/record_grey.png b/images/record_grey.png deleted file mode 100644 index c81f0d0..0000000 --- a/images/record_grey.png +++ /dev/null Binary files differ diff --git a/images/wallet_bg.png b/images/wallet_bg.png deleted file mode 100644 index fe43d4e..0000000 --- a/images/wallet_bg.png +++ /dev/null Binary files differ diff --git a/images/wallet_blue.png b/images/wallet_blue.png deleted file mode 100644 index 28c9a40..0000000 --- a/images/wallet_blue.png +++ /dev/null Binary files differ diff --git a/images/wallet_grey.png b/images/wallet_grey.png deleted file mode 100644 index 4bf2934..0000000 --- a/images/wallet_grey.png +++ /dev/null Binary files differ diff --git a/images/water_intake_blue.png b/images/water_intake_blue.png deleted file mode 100644 index c3aada1..0000000 --- a/images/water_intake_blue.png +++ /dev/null Binary files differ diff --git a/images/water_intake_grey.png b/images/water_intake_grey.png deleted file mode 100644 index 8f621ee..0000000 --- a/images/water_intake_grey.png +++ /dev/null Binary files differ 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 diff --git a/pages/home/home.json b/pages/home/home.json index 0c560da..fe0e2c0 100644 --- a/pages/home/home.json +++ b/pages/home/home.json @@ -2,9 +2,10 @@ "component": true, "usingComponents": { "t-avatar": "tdesign-miniprogram/avatar/avatar", - "t-switch": "tdesign-miniprogram/switch/switch" + "t-switch": "tdesign-miniprogram/switch/switch", + "t-dialog": "tdesign-miniprogram/dialog/dialog" }, "navigationBarTitleText": "澶х鑺傛按", - "navigationBarTextStyle": "white", - "enablePullDownRefresh": true + "navigationBarTextStyle": "white" + } \ No newline at end of file diff --git a/pages/home/home.wxml b/pages/home/home.wxml index ca7bc1b..b0596cb 100644 --- a/pages/home/home.wxml +++ b/pages/home/home.wxml @@ -15,7 +15,7 @@ </view> <view class="center-wrapper"> - <view class="center-view"> + <view class="center-view" bind:tap="recharge"> <image src="/images/wallet.svg" /> <text>鍏呭��</text> </view> @@ -23,11 +23,11 @@ <image src="/images/valva.svg" /> <text>寮�闃�</text> </view> - <view class="center-view"> + <view class="center-view" bind:tap="openValveList"> <image src="/images/record.svg" /> <text>寮�鍏抽榾璁板綍</text> </view> - <view class="center-view"> + <view class="center-view" bind:tap="feedBack"> <image src="/images/question.svg" /> <text>闂鍙嶉</text> </view> @@ -49,14 +49,15 @@ <view class="list-item" wx:for="{{listData}}" wx:for-item="item" wx:for-index="index"> <view class="item-left"> <!-- <image class="item-img" src="/images/pipeline.svg" /> --> - <text>{{item.name}}</text> - <image class="item-img" src="/images/wifi_no.svg" /> + <text>{{item.intakeNum}}</text> + <image class="item-img" src="{{item.isOnLine ? '/images/wifi_no.svg' : '/images/wifi_off.svg'}}" /> </view> <view> - <t-switch class="switch" bindchange="handleChange" value="{{true}}" label="{{['寮�', '鍏�']}}" slot="note" /> + <t-switch wx:if="{{item.isOnLine }}" class="switch" data-item="{{item}}" bindchange="handleChange" value="{{true}}" label="{{['寮�', '鍏�']}}" slot="note" /> </view> </view> </view> </scroll-view> + <t-dialog class="t-dialog" visible="{{showConfirm}}" content="纭鍏抽棴{{waterIntakeName}}鍚楋紵" confirm-btn="{{ { content: '纭', variant: 'base', theme: 'danger' } }}" close-on-overlay-click="false" cancel-btn="鍙栨秷" bind:confirm="confirmDialog" bind:cancel="closeDialog" /> </view> \ No newline at end of file diff --git a/pages/home/home.wxss b/pages/home/home.wxss index a6806c0..336ac99 100644 --- a/pages/home/home.wxss +++ b/pages/home/home.wxss @@ -271,3 +271,7 @@ /* 鏍规嵁闇�瑕佽皟鏁村浘鏍囧ぇ灏� */ margin-left: 20rpx; } +.t-dialog{ + --td-dialog-content-font-size:40rpx; + --td-dialog-content-line-height:50rpx +} \ No newline at end of file diff --git a/pages/openCard/openCard.js b/pages/openCard/openCard.js index 7115e73..2a1fdcb 100644 --- a/pages/openCard/openCard.js +++ b/pages/openCard/openCard.js @@ -1,10 +1,16 @@ -// pages/openCard/openCard.js +// 寮�鍗¢�夋嫨铏氭嫙鍗� +const { + get, + post +} = require('../../api/request.js'); Page({ /** * 椤甸潰鐨勫垵濮嬫暟鎹� */ data: { + intakeId: 0, + allCardPoints: [{ id: 511111111, balance: '30', @@ -47,23 +53,50 @@ title: '姝e湪寮�娉佃绋嶅悗...', // 鍔犺浇鎻愮ず鏂囧瓧 mask: true // 鏄惁鏄剧ず閫忔槑钂欏眰锛岄槻姝㈣Е鎽哥┛閫忥紝榛樿涓� false }); - // 妯℃嫙鍔犺浇鏁版嵁 - setTimeout(() => { - // 鍔犺浇瀹屾垚鍚庨殣钘忓姞杞藉姩鐢� - wx.hideLoading(); - //瀹屾垚鍚庡洖鍒伴椤� - wx.reLaunch({ - url: '/pages/home/home?param=true' // 棣栭〉鐨勮矾寰勶紝鏍规嵁瀹為檯鎯呭喌濉啓 - }); - }, 2000); // 寤舵椂 2 绉掓ā鎷熷姞杞芥暟鎹� + this.postOpenValva(); } - + }, + //寮�娉甸�氫俊 + postOpenValva() { + const app = getApp(); + const data = { + intakeId: this.data.intakeId, //鍙栨按鍙D + vcId: '2023122618460900006', //铏氭嫙鍗D + userType: 2, //鐢ㄦ埛绫诲瀷1-骞冲彴锛�2-App + operator: app.globalData.sessionId //鎿嶄綔鍛� + }; + post({ + url: "comRes/receive", + data: data + }).then(response => { + + // 澶勭悊鎴愬姛鍝嶅簲 + console.log('璇锋眰鎴愬姛:', response); + // 鍔犺浇瀹屾垚鍚庨殣钘忓姞杞藉姩鐢� + wx.hideLoading(); + //瀹屾垚鍚庡洖鍒伴椤� + wx.reLaunch({ + url: '/pages/home/home?param=true' // 棣栭〉鐨勮矾寰勶紝鏍规嵁瀹為檯鎯呭喌濉啓 + }); + + }).catch(error => { + // 鍔犺浇瀹屾垚鍚庨殣钘忓姞杞藉姩鐢� + wx.hideLoading(); + // 澶勭悊閿欒鍝嶅簲 + console.error('璇锋眰澶辫触:', error); + }); }, /** * 鐢熷懡鍛ㄦ湡鍑芥暟--鐩戝惉椤甸潰鍔犺浇 */ onLoad(options) { - + const { + intakeId + } = options; + this.setData({ + intakeId + }) + console.log('intakeId:' + this.data.intakeId); }, /** diff --git a/pages/openCard/openCard.wxml b/pages/openCard/openCard.wxml index 18e5562..478e9d8 100644 --- a/pages/openCard/openCard.wxml +++ b/pages/openCard/openCard.wxml @@ -1,5 +1,5 @@ <!--pages/openCard/openCard.wxml 寮�鍗℃椂鐨勮櫄鎷熷崱--> -<view> +<view class="container"> <scroll-view class="list-container" scroll-y="true" scroll-x="false"> <block wx:for="{{allCardPoints}}" wx:key="index"> @@ -14,10 +14,13 @@ <text class="item-balance-text">{{item.balance}}</text> <text class="item-balance-text-yuan">鍏�</text> </view> - <text class="{{item.state===1?'item-button':'item-button-gray'}}" bind:tap="openValva" data-item="{{item}}">{{item.state === 1 ? '閫夋嫨' : '姝e湪浣跨敤'}}</text> + <text class="{{item.state===1?'item-button':'item-button-gray'}}" bind:tap="openValva" data-item="{{item}}">{{item.state === 1 ? '閫夋嫨' : '浣跨敤涓�'}}</text> </view> - </view> </block> + <view wx:if="{{allCardPoints.length === 0}}" class="noMore-View"> + <image class="noMore-img" src="/images/no_more.svg" /> + <text class="noMore-text">娌℃湁鏁版嵁</text> + </view> </scroll-view> </view> \ No newline at end of file diff --git a/pages/openCard/openCard.wxss b/pages/openCard/openCard.wxss index 7d47420..764d9f5 100644 --- a/pages/openCard/openCard.wxss +++ b/pages/openCard/openCard.wxss @@ -91,4 +91,9 @@ display: flex; align-items: flex-end; /* 搴曢儴瀵归綈 */ +} + +.list-container{ + display: flex; + padding-bottom: 30rpx; } \ No newline at end of file diff --git a/pages/recharge/recharge.wxml b/pages/recharge/recharge.wxml deleted file mode 100644 index 3f2a952..0000000 --- a/pages/recharge/recharge.wxml +++ /dev/null @@ -1,2 +0,0 @@ -<!--pages/recharge/recharge.wxml--> -<text>pages/recharge/recharge.wxml</text> \ No newline at end of file diff --git a/pages/rechargeCard/rechargeCard.js b/pages/rechargeCard/rechargeCard.js new file mode 100644 index 0000000..d0f862a --- /dev/null +++ b/pages/rechargeCard/rechargeCard.js @@ -0,0 +1,117 @@ +// pages/rechargeCard/rechargeCard.js +Page({ + + /** + * 椤甸潰鐨勫垵濮嬫暟鎹� + */ + data: { + currentTab: 0, // 褰撳墠鏄剧ず鐨勮〃鏍硷紝榛樿涓虹涓�涓〃鏍� + allCardPoints: [{ + id: 511111111, + balance: '30000', + state: 1 + },{ + id: 411111111, + balance: '30', + state: 0 + },{ + id: 411111111, + balance: '30', + state: 0 + },{ + id: 411111111, + balance: '30', + state: 0 + }, + { + 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 + }, + ] + }, + // 鍒囨崲 Tabs + switchTab: function (e) { + const tab = parseInt(e.currentTarget.dataset.tab); + this.setData({ + currentTab: tab + }); +}, + /** + * 鐢熷懡鍛ㄦ湡鍑芥暟--鐩戝惉椤甸潰鍔犺浇 + */ + onLoad(options) { + + }, + + /** + * 鐢熷懡鍛ㄦ湡鍑芥暟--鐩戝惉椤甸潰鍒濇娓叉煋瀹屾垚 + */ + onReady() { + + }, + + /** + * 鐢熷懡鍛ㄦ湡鍑芥暟--鐩戝惉椤甸潰鏄剧ず + */ + onShow() { + + }, + + /** + * 鐢熷懡鍛ㄦ湡鍑芥暟--鐩戝惉椤甸潰闅愯棌 + */ + onHide() { + + }, + + /** + * 鐢熷懡鍛ㄦ湡鍑芥暟--鐩戝惉椤甸潰鍗歌浇 + */ + onUnload() { + + }, + + /** + * 椤甸潰鐩稿叧浜嬩欢澶勭悊鍑芥暟--鐩戝惉鐢ㄦ埛涓嬫媺鍔ㄤ綔 + */ + onPullDownRefresh() { + + }, + + /** + * 椤甸潰涓婃媺瑙﹀簳浜嬩欢鐨勫鐞嗗嚱鏁� + */ + onReachBottom() { + + }, + + /** + * 鐢ㄦ埛鐐瑰嚮鍙充笂瑙掑垎浜� + */ + onShareAppMessage() { + + } + + +}) \ No newline at end of file diff --git a/pages/rechargeCard/rechargeCard.json b/pages/rechargeCard/rechargeCard.json new file mode 100644 index 0000000..8835af0 --- /dev/null +++ b/pages/rechargeCard/rechargeCard.json @@ -0,0 +1,3 @@ +{ + "usingComponents": {} +} \ No newline at end of file diff --git a/pages/rechargeCard/rechargeCard.wxml b/pages/rechargeCard/rechargeCard.wxml new file mode 100644 index 0000000..d3d1db7 --- /dev/null +++ b/pages/rechargeCard/rechargeCard.wxml @@ -0,0 +1,56 @@ +<!--pages/rechargeCard/rechargeCard.wxml 鍏呭�肩晫闈�--> +<view class="container"> + <!-- 椤堕儴 Tabs --> + <view class="tabs"> + <view class="tab" bindtap="switchTab" data-tab="0" id="tab0"> + 铏氭嫙鍗� + <view class="indicator" wx:if="{{currentTab === 0}}"></view> + </view> + <view class="tab" bindtap="switchTab" data-tab="1" id="tab1"> + 姘村崱 + <view class="indicator" wx:if="{{currentTab === 1}}"></view> + </view> + </view> + + <!-- 铏氭嫙鍗� --> + <scroll-view class="list-container" wx:if="{{currentTab === 0}}" scroll-y="true" scroll-x="false" style="width: 713rpx; height: 465rpx; display: block; box-sizing: border-box"> + <block wx:for="{{allCardPoints}}" wx:key="index"> + <view class="{{item.state===1?'item':'item-gray'}}"> + <view class="item-card"> + <text>鍗$紪鍙凤細</text> + <text>{{item.id}}</text> + <text wx:if="{{item.state==0}}" class="item-card-state">浣跨敤涓�</text> + </view> + <view class="item-bottom"> + <image class="item-balance-img" src="/images/balance.svg" /> + <view class="item-balance"> + <text class="item-balance-text">{{item.balance}}</text> + <text class="item-balance-text-yuan">鍏�</text> + </view> + <view class="button-view"> + <text wx:if="{{item.state==1}}" class="ruinCard" >閿�鍗�</text> + <text wx:if="{{item.state==1}}" class="recharge">鍏呭��</text> + </view> + </view> + </view> + </block> + </scroll-view> + + <!-- 姘村崱 --> + <view class="all-waterIntake" wx:else> + <view> + <scroll-view class="list-container" scroll-y="true" scroll-x="false"> + <block wx:for="{{allWaterPoints}}" wx:key="index"> + <view class="item"> + <view class="item-left"> + <image class="item-img" src="/images/pipeline.svg" /> --> + <text>{{item}}</text> + <image class="item-img" src="/images/wifi_no.svg" /> + </view> + <text class="item-button" bind:tap="choseCard" data-item="{{item}}">閫夋嫨</text> + </view> + </block> + </scroll-view> + </view> + </view> +</view> \ No newline at end of file diff --git a/pages/rechargeCard/rechargeCard.wxss b/pages/rechargeCard/rechargeCard.wxss new file mode 100644 index 0000000..19f7b8c --- /dev/null +++ b/pages/rechargeCard/rechargeCard.wxss @@ -0,0 +1,155 @@ +/* pages/rechargeCard/rechargeCard.wxss */ +.container { + display: flex; + flex-direction: column; + height: 100vh; + width: 100%; + padding-left: 20rpx; + padding-right: 20rpx; + padding-top: 5rpx; + padding-bottom: 5rpx; + background-color: #fff; +} + +.item { + background-color: #1890FF; + margin-top: 20rpx; + margin-left: 20rpx; + margin-right: 20rpx; + padding: 30rpx; + border-radius: 30rpx; +} + +.item-card { + display: flex; + margin-left: 10rpx; +} + +.item-card text { + font-size: 35rpx; + color: #fff; +} + + +.tab { + font-size: 16px; + padding: 10px; + cursor: pointer; + position: relative; + width: 50%; + /* Tabs 骞冲垎鏁翠釜妯悜灞忓箷 */ + text-align: center; + /* 鏂囧瓧灞呬腑 */ +} + +.tabs { + display: flex; + justify-content: space-around; + position: relative; + width: 100%; + border-bottom: 1px solid #eee; + /* Tabs 鍗犳弧鏁翠釜妯悜灞忓箷 */ +} + +.indicator { + width: 100%; + height: 3px; + background-color: #1890FF; + position: absolute; + bottom: 0; + left: 0; + transform: translateX(0); + /* 鍒濆鍖栦綅缃� */ +} + +.item-bottom { + display: flex; + margin-top: 20rpx; + align-items: center; + + /* 鍨傜洿灞呬腑 */ +} + +.item-balance-img { + width: 60rpx; + height: 50rpx; +} + +.item-balance { + display: flex; + align-items: flex-end; + /* 搴曢儴瀵归綈 */ +} + +.item-balance-text { + color: #fff; + font-size: 50rpx; + margin-left: 10rpx; +} + +.item-balance-text-yuan { + color: white; + margin-left: 10rpx; + margin-bottom: 2rpx; +} + +.item-gray { + background-color: #D3D3D3; + margin-top: 20rpx; + margin-left: 20rpx; + margin-right: 20rpx; + padding: 30rpx; + border-radius: 30rpx; +} + +.item-card-state { + margin-left: auto; + /* 灏嗘寜閽浐瀹氬湪鍙宠竟 */ + display: flex; +} + +.list-container { + flex: 1; + overflow-y: auto; + z-index: 0; +} + +.button-view { + display: flex; + width: 50%; + margin-left: auto; /* 灏嗘寜閽粍鎺ㄥ埌鍙宠竟 */ + justify-content: space-around; + align-items: flex-end; + /* 璁╂寜閽湪瀹瑰櫒涓按骞冲钩鍒嗙┖闂� */ +} + +.ruinCard { + flex: 1; + margin-left: 20rpx; + text-align: center; + /* 鍙��: 浣挎枃鏈眳涓� */ + background-color: #948f8f; + color: white; + margin-left: 40rpx; + margin-top: 10rpx; + padding-bottom: 10rpx; + padding-top: 10rpx; + border-radius: 30rpx; + font-size: 30rpx; + border: none; +} + +.recharge { + flex: 1; + text-align: center; + /* 鍙��: 浣挎枃鏈眳涓� */ + background-color: #32CD32; + color: white; + margin-left: 30rpx; + padding-bottom: 10rpx; + padding-top: 10rpx; + border-radius: 30rpx; + font-size: 30rpx; + border: none; + +} \ No newline at end of file diff --git a/pages/rechargeMoney/rechargMoney.wxml b/pages/rechargeMoney/rechargMoney.wxml index 27006ab..72a4990 100644 --- a/pages/rechargeMoney/rechargMoney.wxml +++ b/pages/rechargeMoney/rechargMoney.wxml @@ -1,37 +1,33 @@ <!--pages/recharge/recharge.wxml--> <view class="base-wrapper"> - <view class="user-wrapper"> + <!-- <view class="user-wrapper"> <view> - <text>{{userName}}</text> - <text>{{userPhone}}</text> - </view> - <view> - <text>鐢ㄦ埛缂栧彿锛�</text> + <text>铏氭嫙鍗$紪鍙凤細</text> <text>{{userCode}}</text> </view> <view> <text>浣欓锛�</text> <text>{{balance}}</text> </view> - </view> + </view> --> <view class="money-base-wrapper"> <view class="row"> <view class="item{{activeIndex === 0 ? 'active' : ''}}" bindtap="handleMoneyWrapperTap" data-index="0"> <view class="money-wrapper"> - <text class="money-number">30</text> + <text class="money-number">100</text> <text class="money-label">鍏�</text> </view> </view> <view class="item{{activeIndex === 1 ? 'active' : ''}}" bindtap="handleMoneyWrapperTap" data-index="1"> <view class="money-wrapper"> - <text class="money-number">50</text> + <text class="money-number">200</text> <text class="money-label">鍏�</text> </view> </view> <view class="item{{activeIndex === 2 ? 'active' : ''}}" bindtap="handleMoneyWrapperTap" data-index="2"> <view class="money-wrapper"> - <text class="money-number">100</text> + <text class="money-number">300</text> <text class="money-label">鍏�</text> </view> </view> @@ -39,19 +35,19 @@ <view class="row"> <view class="item{{activeIndex === 3 ? 'active' : ''}}" bindtap="handleMoneyWrapperTap" data-index="3"> <view class="money-wrapper"> - <text class="money-number">200</text> + <text class="money-number">400</text> <text class="money-label">鍏�</text> </view> </view> <view class="item{{activeIndex === 4 ? 'active' : ''}}" bindtap="handleMoneyWrapperTap" data-index="4"> <view class="money-wrapper"> - <text class="money-number">300</text> + <text class="money-number">500</text> <text class="money-label">鍏�</text> </view> </view> <view class="item{{activeIndex === 5 ? 'active' : ''}}" bindtap="handleMoneyWrapperTap" data-index="5"> <view class="money-wrapper"> - <text class="money-number">500</text> + <text class="money-number">600</text> <text class="money-label">鍏�</text> </view> </view> @@ -62,10 +58,9 @@ <view class="rechage{{activeIndex === -1 ? 'active' : ''}}"> <text >鍏呭��</text> </view> - <view class="rechageList-view"> - <text class="rechageList" bind:tap="moveToRechargeList">鍏呭�艰褰�</text> - </view> + </view> - +<view class="rechageList-view"> + </view> </view> \ No newline at end of file diff --git a/pages/rechargeMoney/rechargMoney.wxss b/pages/rechargeMoney/rechargMoney.wxss index b62d24a..a5ccb6d 100644 --- a/pages/rechargeMoney/rechargMoney.wxss +++ b/pages/rechargeMoney/rechargMoney.wxss @@ -89,7 +89,7 @@ } .rechage-view { - flex-grow: 1; + margin-top: 40rpx; /* 鍗犳嵁鍓╀綑鐨勫叏閮ㄩ珮搴� */ flex-direction: column; display: flex; @@ -97,8 +97,14 @@ align-items: center; width: 100%; } +.rechage-view text { + font-size: 30rpx; + padding-top: 10rpx; + padding-bottom: 10rpx; +} .rechageList-view { + margin-top: 40rpx; width: 50%; background-color: #fff; display: flex; @@ -138,11 +144,7 @@ border-radius: 90px; } -.rechage-view text { - font-size: 30rpx; - padding-top: 10rpx; - padding-bottom: 10rpx; -} + .rechageactive text { color: #fff; diff --git a/pages/waterIntake/waterIntake.js b/pages/waterIntake/waterIntake.js index bcfb618..869e711 100644 --- a/pages/waterIntake/waterIntake.js +++ b/pages/waterIntake/waterIntake.js @@ -1,11 +1,14 @@ // pages/waterIntake/waterIntake.js +const { + get, + post +} = require('../../api/request.js'); Page({ - - data: { currentTab: 0, // 褰撳墠鏄剧ず鐨勮〃鏍硷紝榛樿涓虹涓�涓〃鏍� - commonWaterPoints: [ "甯哥敤鍙栨按鍙�2", "甯哥敤鍙栨按鍙�3"], // 甯哥敤鍙栨按鍙f暟鎹� - allWaterPoints: ["鎵�鏈夊彇姘村彛1", "鎵�鏈夊彇姘村彛2", "鎵�鏈夊彇姘村彛3"], // 鎵�鏈夊彇姘村彛鏁版嵁 + searchQuery:"", + commonWaterPoints: [], // 甯哥敤鍙栨按鍙f暟鎹� + allWaterPoints: [], // 鎵�鏈夊彇姘村彛鏁版嵁 }, // 鍒囨崲 Tabs @@ -15,19 +18,18 @@ currentTab: tab }); }, - onSearch: function() { + onInput(e){ + this.setData({ + searchQuery: e.detail.value // 灏嗚緭鍏ユ鐨勫�煎瓨鍌ㄥ埌 inputValue + }); + }, + onSearch: function () { const query = this.data.searchQuery; if (query) { - wx.showToast({ - title: '鎼滅储: ' + query, - icon: 'success' - }); + this.getallWaterPoints(query) // 鍦ㄨ繖閲岃繘琛屾悳绱㈡搷浣滐紝鏇存柊 allWaterPoints 鏁版嵁 } else { - wx.showToast({ - title: '璇疯緭鍏ユ悳绱㈠唴瀹�', - icon: 'none' - }); + this.getallWaterPoints(query) } }, @@ -35,9 +37,11 @@ * 閫夋嫨铏氭嫙鍗� * @param {} event */ - choseCard(event){ + choseCard(event) { + const intakeId= event.currentTarget.dataset.item.intakeId; + console.log(intakeId); wx.navigateTo({ - url: '/pages/openCard/openCard', + url: '/pages/openCard/openCard?intakeId='+intakeId, }) }, @@ -53,7 +57,8 @@ * 鐢熷懡鍛ㄦ湡鍑芥暟--鐩戝惉椤甸潰鍒濇娓叉煋瀹屾垚 */ onReady() { - + this.getallWaterPoints(); + this.getcommonWaterPoints(); }, /** @@ -97,4 +102,52 @@ onShareAppMessage() { } + , + /** + * 鑾峰彇鎵�鏈夊彇姘村彛 + */ + getallWaterPoints: function (intakeNum) { + let params = { url: 'rtu/get_online_intakes' }; + if (intakeNum) { + params.data = { intakeNum: intakeNum }; + } + + get(params) + .then((data) => { + if(data.success&&data.code==="0001"){ + this.setData({ + allWaterPoints: data.content.obj + }); + }else{ + wx.showToast({ + title: data.msg, + }) + } + console.log('Failed to add item:'); + }) + .catch((error) => { + console.error('Failed to add item:', error); + }); + }, + getcommonWaterPoints(){ + + get({url:'rtu/used_intakes', data: { + operator: getApp().globalData.sessionId + }}) + .then((data) => { + if(data.success&&data.code==="0001"){ + this.setData({ + commonWaterPoints: 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 diff --git a/pages/waterIntake/waterIntake.wxml b/pages/waterIntake/waterIntake.wxml index acb457c..5b19ea4 100644 --- a/pages/waterIntake/waterIntake.wxml +++ b/pages/waterIntake/waterIntake.wxml @@ -14,16 +14,20 @@ <!-- 甯哥敤鍙栨按鍙� --> <scroll-view class="list-container" wx:if="{{currentTab === 0}}" scroll-y="true" scroll-x="false"> - <block wx:for="{{commonWaterPoints}}" wx:key="index"> + <block wx:if="{{commonWaterPoints.length > 0}}" wx:for="{{commonWaterPoints}}" wx:key="index"> <view class="item"> <view class="item-left"> <!-- <image class="item-img" src="/images/pipeline.svg" /> --> - <text>{{item}}</text> - <image class="item-img" src="/images/wifi_no.svg" /> + <text>{{item.intakeNum}}</text> + <image class="item-img" src="{{item.isOnLine ? '/images/wifi_no.svg' : '/images/wifi_off.svg'}}" /> </view> - <text class="item-button" bind:tap="choseCard" data-item="{{item}}">閫夋嫨</text> + <text wx:if="{{item.isOnLine}}" class="item-button" bind:tap="choseCard" data-item="{{item}}">閫夋嫨</text> </view> </block> + <view wx:if="{{commonWaterPoints.length === 0}}" class="noMore-View"> + <image class="noMore-img" src="/images/no_more.svg" /> + <text class="noMore-text">娌℃湁鏁版嵁</text> + </view> </scroll-view> <!-- 鎵�鏈夊彇姘村彛 --> @@ -31,20 +35,24 @@ <view class="search-container"> <input class="search-input" placeholder="璇疯緭鍏ュ彇姘村彛缂栫爜鍚庣偣鍑绘悳绱�" bindinput="onInput" /> <!-- <text class="search-button" >鎼滅储</text> --> - <t-button class="search-button" theme="primary" size="large" icon="search" shape="square" aria-label="鎼滅储" bindtap="onSearch" style="background-color: #1890FF; border: none; height: 80rpx;"></t-button> + <t-button class="search-button" theme="primary" size="large" icon="search" shape="square" aria-label="鎼滅储" bindtap="onSearch" style="background-color: #1890FF; border: none; height: 80rpx;"></t-button> </view> <view> <scroll-view class="list-container" scroll-y="true" scroll-x="false"> - <block wx:for="{{allWaterPoints}}" wx:key="index"> + <block wx:if="{{allWaterPoints.length > 0}}" wx:for="{{allWaterPoints}}" wx:key="index"> <view class="item"> <view class="item-left"> <!-- <image class="item-img" src="/images/pipeline.svg" /> --> - <text>{{item}}</text> - <image class="item-img" src="/images/wifi_no.svg" /> + <text>{{item.intakeNum}}</text> + <image class="item-img" src="{{item.isOnLine ? '/images/wifi_no.svg' : '/images/wifi_off.svg'}}" /> </view> - <text class="item-button" bind:tap="choseCard" data-item="{{item}}">閫夋嫨</text> + <text wx:if="{{item.isOnLine}}" class="item-button" bind:tap="choseCard" data-item="{{item}}">閫夋嫨</text> </view> </block> + <view wx:if="{{allWaterPoints.length === 0}}" class="noMore-View"> + <image class="noMore-img" src="/images/no_more.svg" /> + <text class="noMore-text">娌℃湁鏁版嵁</text> + </view> </scroll-view> </view> </view> diff --git a/pages/waterIntake/waterIntake.wxss b/pages/waterIntake/waterIntake.wxss index 34cfae9..9c65252 100644 --- a/pages/waterIntake/waterIntake.wxss +++ b/pages/waterIntake/waterIntake.wxss @@ -4,6 +4,7 @@ padding-left: 20rpx; padding-right: 20rpx; padding-top: 5rpx; + padding-bottom: 5rpx; background-color: #fff; width: 100%; height: 100vh; @@ -33,16 +34,7 @@ /* 鏂囧瓧灞呬腑 */ } -.indicator { - width: 100%; - height: 3px; - background-color: #1890FF; - position: absolute; - bottom: 0; - left: 0; - transform: translateX(0); - /* 鍒濆鍖栦綅缃� */ -} +list-container .list { margin-top: 20px; @@ -143,4 +135,32 @@ } .item-left text{ font-size: 40rpx; +} +.indicator { + width: 100%; + height: 3px; + background-color: #1890FF; + position: absolute; + bottom: 0; + left: 0; + transform: translateX(0); + /* 鍒濆鍖栦綅缃� */ +} + +.noMore-View { + display: flex; + justify-content: center; + align-items: center; + height: 100%; + text-align: center; + flex-direction: column; +} + +.noMore-img{ + width: 300rpx; + height: 300rpx; +} + +.noMore-text{ + color:#969494; } \ No newline at end of file -- Gitblit v1.8.0