From 451fb7c3862ed7051cbe09ef777ee58e5efdd12e Mon Sep 17 00:00:00 2001 From: "liujw155@outlook.com" Date: Fri, 23 Aug 2024 18:27:03 +0800 Subject: [PATCH] add md0726 api logic --- src/components/kv_line.vue | 10 +- src/pages.json | 12 ++ src/subpackage/shower/components/number_edit.vue | 90 ++++++++++++++ .../shower/components/popup/deduction.vue | 95 +++++++++++++++ .../shower/components/popup/recharge.vue | 84 +++++++++++++ .../shower/components/popup/template.vue | 72 ++++++++++++ src/subpackage/shower/js/api.js | 12 ++ src/subpackage/shower/js/server.js | 10 ++ src/subpackage/shower/pages/card/detail.vue | 43 ++++++- src/subpackage/shower/pages/card/manage.vue | 110 ++++++++++++++--- src/subpackage/shower/pages/card/use_record.vue | 95 ++++++++++++++- src/subpackage/shower/pages/device/use_detail.vue | 106 +++++++++++++++++ src/subpackage/shower/pages/device/use_record.vue | 130 +++++++++++++++++++++ src/subpackage/shower/static/images/arrow.png | Bin 0 -> 258 bytes src/subpackage/shower/static/images/close.png | Bin 0 -> 256 bytes 15 files changed, 849 insertions(+), 20 deletions(-) create mode 100644 src/subpackage/shower/components/number_edit.vue create mode 100644 src/subpackage/shower/components/popup/deduction.vue create mode 100644 src/subpackage/shower/components/popup/recharge.vue create mode 100644 src/subpackage/shower/components/popup/template.vue create mode 100644 src/subpackage/shower/js/api.js create mode 100644 src/subpackage/shower/js/server.js create mode 100644 src/subpackage/shower/pages/device/use_detail.vue create mode 100644 src/subpackage/shower/pages/device/use_record.vue create mode 100644 src/subpackage/shower/static/images/arrow.png create mode 100644 src/subpackage/shower/static/images/close.png diff --git a/src/components/kv_line.vue b/src/components/kv_line.vue index dd1cdc5..19c2dc8 100644 --- a/src/components/kv_line.vue +++ b/src/components/kv_line.vue @@ -1,8 +1,10 @@ @@ -32,5 +34,9 @@ export default { @include flcw(28upx, 48upx, #1A1A1A); @include tHide; } + .kl-right{ + flex-grow: 1; + flex-shrink: 0; + } } \ No newline at end of file diff --git a/src/pages.json b/src/pages.json index 1486b78..522ff4b 100644 --- a/src/pages.json +++ b/src/pages.json @@ -910,6 +910,18 @@ "style" : { "navigationBarTitleText": "使用记录" } + }, + { + "path": "pages/device/use_record", + "style" : { + "navigationBarTitleText": "水阀使用记录" + } + }, + { + "path": "pages/device/use_detail", + "style" : { + "navigationBarTitleText": "水阀使用详情" + } } ] } diff --git a/src/subpackage/shower/components/number_edit.vue b/src/subpackage/shower/components/number_edit.vue new file mode 100644 index 0000000..edcc564 --- /dev/null +++ b/src/subpackage/shower/components/number_edit.vue @@ -0,0 +1,90 @@ + + + + + \ No newline at end of file diff --git a/src/subpackage/shower/components/popup/deduction.vue b/src/subpackage/shower/components/popup/deduction.vue new file mode 100644 index 0000000..6e84e0e --- /dev/null +++ b/src/subpackage/shower/components/popup/deduction.vue @@ -0,0 +1,95 @@ + + + + + \ No newline at end of file diff --git a/src/subpackage/shower/components/popup/recharge.vue b/src/subpackage/shower/components/popup/recharge.vue new file mode 100644 index 0000000..1554ea5 --- /dev/null +++ b/src/subpackage/shower/components/popup/recharge.vue @@ -0,0 +1,84 @@ + + + + + \ No newline at end of file diff --git a/src/subpackage/shower/components/popup/template.vue b/src/subpackage/shower/components/popup/template.vue new file mode 100644 index 0000000..791596b --- /dev/null +++ b/src/subpackage/shower/components/popup/template.vue @@ -0,0 +1,72 @@ + + + + + \ No newline at end of file diff --git a/src/subpackage/shower/js/api.js b/src/subpackage/shower/js/api.js new file mode 100644 index 0000000..5886ee0 --- /dev/null +++ b/src/subpackage/shower/js/api.js @@ -0,0 +1,12 @@ +import { ORIGIN } from '../../../js/api'; + +export const SHOWER_API = { + CardList:`${ORIGIN}/admin/stadiumWaterCard/list`, // 后台-水卡-列表 + CardDetails:`${ORIGIN}/admin/stadiumWaterCard/details`, // 后台-水卡-详情 + CardRecharge:`${ORIGIN}/admin/stadiumWaterCard/recharge`, // 后台-水卡-充值 + CardFeeDeduction:`${ORIGIN}/admin/stadiumWaterCard/feeDeduction`, // 后台-水卡-扣费 + // CardList:`${ORIGIN}/admin/stadiumWaterCardUseRecord/list`, // 后台-水卡使用记录-列表 + // CardListOfCard:`${ORIGIN}/admin/stadiumWaterCardUseRecord/listOfCard`, // 后台-水卡使用记录-(某张水卡的)列表 +} + +export default SHOWER_API; \ No newline at end of file diff --git a/src/subpackage/shower/js/server.js b/src/subpackage/shower/js/server.js new file mode 100644 index 0000000..9245726 --- /dev/null +++ b/src/subpackage/shower/js/server.js @@ -0,0 +1,10 @@ +import { Server } from '../../../js/server'; + +class DeviceServer extends Server { + constructor(props){ + super(props) + } +} + + +export default new DeviceServer(); \ No newline at end of file diff --git a/src/subpackage/shower/pages/card/detail.vue b/src/subpackage/shower/pages/card/detail.vue index 500f30d..5bc0f2c 100644 --- a/src/subpackage/shower/pages/card/detail.vue +++ b/src/subpackage/shower/pages/card/detail.vue @@ -25,15 +25,56 @@ 小程序 + + + diff --git a/src/subpackage/shower/pages/card/manage.vue b/src/subpackage/shower/pages/card/manage.vue index 15f4058..99c70fd 100644 --- a/src/subpackage/shower/pages/card/manage.vue +++ b/src/subpackage/shower/pages/card/manage.vue @@ -2,23 +2,24 @@ - + - 欧轩智能羽毛球馆(永泰店) - 使用中 + {{ e.stadium_name || '-' }} + {{ e.status_text || '' }} - 智能浴室用水卡 - 20195171564566 - 18316553478 - yiming - 100分00秒 + {{ e.water_card_no || '-' }} + {{ e.water_card_name || '-' }} + {{ e.mobile || '-' }} + {{ e.nick_name || '-' }} + {{ e.valid_duration_text || '-' }} @@ -36,6 +37,9 @@ import periodModal from "@/components/filter/period_modal.vue"; import filterModal from "@/components/filter/filter_modal.vue"; import kv_line from "@/components/kv_line.vue"; +import { SHOWER_API } from "../../js/api"; +import server from "../../js/server"; +import { routeTo, showLoad, hideLoad, showNone, formatDate } from "@/utils/util"; export default { components: { 'order-filter': orderFilter, @@ -43,18 +47,56 @@ export default { 'filter-modal': filterModal, 'kv-line': kv_line }, + watch: { + condition: { + handler(nVal, oVal){ + this.cardOrderList = []; + this.page = 1; + let { brand_id } = this; + this.getCardList({ + brand_id: brand_id || '', + ...nVal, + }) + }, + deep: true + } + }, data(){ return { + brand_id: '', condition: { - start_time: '2024-08-20', - end_time: '2024-08-20', - } + stadium_id: '', // 场馆id + start_time: '2020-08-20', + end_time: '2025-08-20', + status: '', // 0: 未激活 1: 已激活 + }, + cardOrderList: [], + page: 1 } }, + onReachBottom(){ + let { brand_id, condition, page } = this; + this.getCardList({ brand_id, page: ++page, ...condition }); + }, onLoad(options){ - this.$refs.orderFilter.initStadiumSelect(options?.brand_id); + let _bid = options?.brand_id || ''; + this.brand_id = _bid; + this.$refs.orderFilter.initStadiumSelect(_bid); + // this.getCardList({ brand_id: _bid }); + this.initDate(); // watch 监听触发 }, methods: { + toDetail(e){ + routeTo(`/subpackage/shower/pages/card/detail?id=${e?.id || ''}`, 'nT') + }, + // 默认显示三个月内的水阀卡数据 + initDate(){ + let _Date = new Date(); + let _timeStamp = _Date.getTime(); + let _start = _timeStamp - 90 * 24 * 60 * 60 * 1000; + this.condition.start_time = formatDate({ date: _start }); + this.condition.end_time = formatDate({ date: _timeStamp }); + }, showPeriodModal(){ let { start_time, end_time } = this.condition; this.$refs.periodModal.init({ @@ -67,8 +109,48 @@ export default { }); }, showFilterModal(){ - this.$refs.filterModal.show(); - } + this.$refs.filterModal.init({ + title: '订单状态', + list: [ + { label: '全部', value: '' }, + { label: '使用中', value: '1' }, + { label: '待激活', value: '0' }, + ], + curValue: this.condition.status, + success: res=>{ + this.condition.status = res.value; + } + }); + }, + /** + * @param {String} number 卡号或者手机号 + * */ + getCardList({ + brand_id = '', stadium_id = '', + start_time = '', end_time = '', number = '', status = '', + page = 1, page_size = 10 + }){ + showLoad(); + return server.get({ + url: SHOWER_API.CardList, + data: { brand_id, stadium_id, start_time, end_time, number, status, page, page_size }, + failMsg: '获取用水卡列表失败' + }) + .then(res => { + hideLoad(); + let _ls = res?.list || []; + if(page === 1)return this.cardOrderList = _ls; + if(!_ls.length)return showNone('没有更多!'); + this.page = page; + return this.cardOrderList = [...this.cardOrderList, ..._ls]; + + }) + .catch(err => { + hideLoad(); + console.warn('manage getCardList err --->', err); + // return Promise.reject(err); + }) + }, } } diff --git a/src/subpackage/shower/pages/card/use_record.vue b/src/subpackage/shower/pages/card/use_record.vue index 970076b..08170ef 100644 --- a/src/subpackage/shower/pages/card/use_record.vue +++ b/src/subpackage/shower/pages/card/use_record.vue @@ -2,22 +2,111 @@ - 9989 + + + 消费时长 + 充值时长 + + 正在计时 + + -{{ e.deduction_duration || '-' }} + +{{ e.recharge_duration || '-' }}分钟 + 剩余:{{ e.total_duration_text || '-' }} + + + + + {{ e.stadium_name || '-' }} + {{ e.start_time || '-' }} + + {{ e.hardware_name || '-' }} + {{ e.end_time || '-' }} + {{ e.settle_duration_text || '-' }} + + + + \ No newline at end of file diff --git a/src/subpackage/shower/pages/device/use_detail.vue b/src/subpackage/shower/pages/device/use_detail.vue new file mode 100644 index 0000000..74d609f --- /dev/null +++ b/src/subpackage/shower/pages/device/use_detail.vue @@ -0,0 +1,106 @@ + + + + + \ No newline at end of file diff --git a/src/subpackage/shower/pages/device/use_record.vue b/src/subpackage/shower/pages/device/use_record.vue new file mode 100644 index 0000000..e1d732c --- /dev/null +++ b/src/subpackage/shower/pages/device/use_record.vue @@ -0,0 +1,130 @@ + + + + + \ No newline at end of file diff --git a/src/subpackage/shower/static/images/arrow.png b/src/subpackage/shower/static/images/arrow.png new file mode 100644 index 0000000000000000000000000000000000000000..0d85a534e3cc7f6d3a5952f47be60dd00905aec5 GIT binary patch literal 258 zcmeAS@N?(olHy`uVBq!ia0vp^G9b*s3?yAI>n{UR_5nU2u0VR$thuvi&jX{mKrny) zqFJ+mT&UojIUojD&Fq;oXM!0(k-2l`%m=cK_13fijSwjb@(X78I47h)U+m$ruJoym zfvQ|5_N3S=FCxz@ z6^u$t>`xLDf!vinYVbdrdI#n;k)^mRbKZtWvAok3f_IrGnG+&VdAtr h|L!!7b;tkN#a+wgh`Vp~y9j6#gQu&X%Q~loCIH8AZN&fp literal 0 HcmV?d00001 diff --git a/src/subpackage/shower/static/images/close.png b/src/subpackage/shower/static/images/close.png new file mode 100644 index 0000000000000000000000000000000000000000..20f26c8aa08915bfc24dec31d1fcbedef2d4f676 GIT binary patch literal 256 zcmeAS@N?(olHy`uVBq!ia0vp^N+8U_3?xrvihTr9asfUeu0VR$thuvi1JOJnW9H1c zbLPwgvggmA59Cf~` zMjUERoGrbJSPnIEC~FFNw`e(PG-(2{hGWB#nZ`#YK6ERTB+lx|v|h$-SljqA_{@a^ tJcc<7yCgr&*w`%DJY!?eOd$gXh8!M;-djhOTLaz1;OXk;vd$@?2>^0US`z>O literal 0 HcmV?d00001