diff --git a/pages/index.vue b/pages/index.vue index f64a3f3..a42b0b9 100644 --- a/pages/index.vue +++ b/pages/index.vue @@ -87,18 +87,17 @@ - 客流统计 - + 运检食堂 diff --git a/pages/passenger/canteenList.vue b/pages/passenger/canteenList.vue index 8d7416b..e62afcc 100644 --- a/pages/passenger/canteenList.vue +++ b/pages/passenger/canteenList.vue @@ -15,16 +15,35 @@ mode="aspectFill" > - {{ item.canteenName }} + + {{ item.canteenName }} + + {{ item.isOpen ? '营业中' : '休息中' }} + + - 当前客流: {{ item.presentNum }}人 - 营业时间: {{ item.startBusinessTime }} - {{item.endBusinessTime}} + + 拥挤程度: + + + + + + + + + + 畅通 + 拥挤 + + + 营业时间: + {{ item.startBusinessTime }} - {{item.endBusinessTime}} + - - {{ item.isOpen ? '营业中' : '休息中' }} - + @@ -38,10 +57,10 @@ export default { data() { return { fontValue:uni.getStorageSync('fontSize') || 8, - merchantList: [] + merchantList: [{"presentNum":9,"capacity":400,"businessState":2,"canteenName":"sbd工业园食堂","canteenId":"378928314946949120","startBusinessTime":"00:00:00","endBusinessTime":"23:59:59","imgUrl":null,"personRate":3}] } }, - onLoad() { + onLoad() { this.queryNowPresentNum() }, methods: { @@ -50,9 +69,12 @@ export default { let param = { "custId":uni.getStorageSync('custId') } - const res = await queryNowPresentNumApi(param) - console.log('?? ~ getList ~ res:', res) + const res = await queryNowPresentNumApi(param) this.merchantList = res.data; + this.merchantList.forEach(item=>{ + item.personRate = Number(((item.presentNum/item.capacity)*100).toFixed(2)) + }) + console.log('?? ~ getList ~ res:', this.merchantList) this.updateMerchantStatus() } catch (error) { console.log(error) @@ -81,7 +103,8 @@ export default { url: `/pages/passenger/flowDetail?params=${JSON.stringify(item)}` }) } - }, + }, + mounted() { // this.updateMerchantStatus(); // 可以设置一个定时器,定期更新营业状态 @@ -123,8 +146,8 @@ export default { align-items: center; .merchant-avatar { - width: 88rpx; - height: 88rpx; + width: 100rpx; + height: 100rpx; border-radius: 8rpx; margin-right: 20rpx; } @@ -138,6 +161,7 @@ export default { color: #333333; margin-bottom: 16rpx; font-weight: 500; + display: flex; } .merchant-stats { @@ -155,21 +179,36 @@ export default { } .status-box { - max-width: 10%; - width: 36rpx; font-size: 22rpx; color: #999999; - padding: 4rpx 4rpx; + padding: 4rpx 8rpx; + margin-left: 10px; background-color: #f5f5f5; border-radius: 4rpx; - position: absolute; - top: 36rpx; - right: 24rpx; + // position: absolute; + // top: 36rpx; + // right: 24rpx; &.status-open { color: #ff6633; background-color: #fff2ef; } } + + .gl{ + height: 5px; + width:50px; + background-color: #ccc; + margin-right: 4px; + border-radius:4px; + &.gl-red{ + background-color: #ff6633; + } + &.gl-green{ + background-color: #00aa00; + } + } + + } \ No newline at end of file diff --git a/pages/passenger/flowDetail.vue b/pages/passenger/flowDetail.vue index 8367841..ccd4b6b 100644 --- a/pages/passenger/flowDetail.vue +++ b/pages/passenger/flowDetail.vue @@ -8,23 +8,37 @@ - 当前人数: + 拥挤程度: + + + + + + + + + + 畅通 + 拥挤 + + + 当前人数: {{flowData.presentNum}} - 进场人数: + 进场人数: {{flowData.enters}} - 出场人数: + 出场人数: {{flowData.exits}} - 最大容纳人数: + 最大容纳人数: {{flowData.capacity}} - 峰值人数: + 峰值人数: {{flowData.presentFlowVOList[0].peakNum}} @@ -103,11 +117,12 @@ export default { } ], "updateTime": "2025-06-10 10:40:05", - "presentNum": 9, + "presentNum": 200, "enters": 218, "exits": 209, "capacity": 400 }, + personRate:0, chartData:{}, opts: { color: ["#1890FF","#91CB74","#FAC858","#EE6666","#73C0DE","#3CA272","#FC8452","#9A60B4","#ea7ccc"], @@ -135,10 +150,9 @@ export default { options = JSON.parse(options.params) this.canteenItem = options console.log(this.canteenItem) - this.dateList = this.getRecentWeekDates() + this.dateList = this.getRecentWeekDates() }, - onReady() { - // this.initChart() + onReady() { this.queryNowPresentNum(); }, methods: { @@ -161,13 +175,15 @@ export default { let param = { "canteenId":this.canteenItem.canteenId, "periods":1, - "presentDate":this.dateList, + "presentDate":this.dateList } const res = await queryPassengerNumApi(param) console.log('?? ~ getList ~ res:', res) - this.flowData = res.data; - this.initChart() - + this.flowData = res.data; + if(this.flowData.presentNum&&this.flowData.presentNum>0){ + this.personRate = Number(((this.flowData.presentNum/this.flowData.capacity)*100).toFixed(2)) + } + this.initChart() } catch (error) { console.log(error) } @@ -200,6 +216,8 @@ export default { }) } console.log(xData) + console.log(line1) + console.log(line2) var lineData = { categories: xData, series: [ @@ -243,5 +261,17 @@ export default { background-color: #f5f5f5; padding: 20rpx; } - +.gl{ + height: 5px; + width:40px; + background-color: #ccc; + margin-right: 4px; + border-radius:4px; + &.gl-red{ + background-color: #ff6633; + } + &.gl-green{ + background-color: #00aa00; + } + } \ No newline at end of file diff --git a/pages/system.vue b/pages/system.vue index d0f8201..c3c5f69 100644 --- a/pages/system.vue +++ b/pages/system.vue @@ -75,7 +75,7 @@ export default { console.log(index) if (index === 0) { console.log(this.userInfo.custNum.indexOf("@yjst_sbd")) - if(this.userInfo.custNum.indexOf("@yjst_yj")>-1||(this.userInfo.orgId=='378921748080365568'&&this.userInfo.custNum.indexOf("@yjst_sbd")==-1)){ + if(this.userInfo.custNum.indexOf("@yjst_yj")>-1||(this.userInfo.orgId=='999'&&this.userInfo.custNum.indexOf("@yjst_sbd")==-1)){ uni.navigateTo({ url: '/pages/yjCanteen' }); }else{ this.$router.push({ path: '/pages/index' }) @@ -90,7 +90,7 @@ export default { console.log(index) if (index === 0) { console.log(this.userInfo.custNum.indexOf("yjst_sbd")) - if(this.userInfo.custNum.indexOf("@yjst_yj")>-1||(this.userInfo.orgId=='378921748080365568'&&this.userInfo.custNum.indexOf("@yjst_sbd")==-1)){ + if(this.userInfo.custNum.indexOf("@yjst_yj")>-1||(this.userInfo.orgId=='999'&&this.userInfo.custNum.indexOf("@yjst_sbd")==-1)){ uni.navigateTo({ url: '/pages/yjCanteen' }); }else{ this.$router.push({ path: '/pages/index' })