Commit 697a0a36 by zhangzhen

功能新增优化

parent 322f48f8
...@@ -15,3 +15,14 @@ export const listSortDistance=(data)=>{ ...@@ -15,3 +15,14 @@ export const listSortDistance=(data)=>{
let url=`/room/roomStatus` let url=`/room/roomStatus`
return http.get(url,data) return http.get(url,data)
} }
export const getList=(data)=>{
let url=`/store/storeList`
return http.get(url,data)
}
export const deviceRun=(data)=>{
let url=`/device/openOrClose`
return http.post(url,data)
}
\ No newline at end of file
...@@ -149,6 +149,12 @@ ...@@ -149,6 +149,12 @@
"navigationBarTitleText": "消费记录", "navigationBarTitleText": "消费记录",
"enablePullDownRefresh" : false "enablePullDownRefresh" : false
} }
},
{
"path": "pages/deviceManage/index",
"style": {
"navigationBarTitleText": "设备控制"
}
} }
], ],
......
<template>
<view class="clean-manage">
<view class="header">
<view class="flex-row title-box">
<!-- <text class="cuIcon-title text-pink text-lg"></text> -->
<text class="text-title text-lg">我的门店</text>
</view>
</view>
<view v-for="(item,index) in list" :key="index" class="card-box">
<view class="store-info">
<view class="flex-row">
<view class="part-left">
<image class="img" :src="hostUrl+item.images" mode="heightFix"></image>
</view>
<view class="flex-col part-right">
<view class="flex-between">
<text class="text-black text-bold text-xl">{{item.name}}</text>
<image :src="assetsPath+'/map_icon.png'" mode="widthFix" @tap="onNavLocation(item)"></image>
</view>
<view class="flex-row">
<image :src="assetsPath+'/location_icon.png'" mode="widthFix"></image>
<view class="">
<text class="text-gray">{{item.address}}</text>
</view>
</view>
</view>
</view>
</view>
<view v-show="item.show" class="room-box">
<view v-for="(val,k) in item.roomVoList" :key='k' class="room-item" @tap='onNavSearch(val)'>
<view class="room-stauts">
<image class="img" :src="hostUrl+val.images[0]" mode="heightFix"></image>
</view>
<view class="part-right">
<view class="room-name">
<text class="text-xxl text-pink">{{val.name}}</text>
<text class="text-sm" :style="{color: colorEnum[val.colorStatus]}">{{statusEnum[val.colorStatus]}}</text>
</view>
<view v-if="val.deviceList" class="flex-col device-list">
<view class="part" v-if="val.deviceList.door" >
<text class="text-title">门禁控制</text>
<view class="">
<button @tap="onDeviceRun(10,val.deviceList.door.devId)" class="cu-btn bg-blue margin-right-sm">开启</button>
<button @tap="onDeviceRun(30,val.deviceList.door.devId)" class="cu-btn bg-blue">关闭</button>
</view>
</view>
<view class="part" v-if="val.deviceList.el">
<text class="text-title">取电开关</text>
<view class="">
<button @tap="onDeviceRun(20,val.deviceList.el.devId)" class="cu-btn bg-blue margin-right-sm">开启</button>
<button @tap="onDeviceRun(40,val.deviceList.el.devId)" class="cu-btn bg-blue">关闭</button>
</view>
</view>
</view>
</view>
</view>
</view>
</view>
</view>
</template>
<script>
import {getListStore,getStarOrder} from "@/api/cleanRoom.js";
import {getList,deviceRun} from "@/api/store.js";
import config from "@/config/index.config"
import {
getDictItem
} from "@/utils/tools.js"
import moment from "@/common/moment";
export default {
data() {
return {
assetsPath:config.assetsPath,
hostUrl:config.hostUrl,
list:[],
statusEnum:{
0:'空闲中',
1:'使用中',
2:'维护中',
3:'待保洁',
4:'保洁中'
},
colorEnum:{
0:"#6fc544",
1:"#e7a646",
2:"#4aa3ff",
3:"#ff494e",
4:"#ff49ef"
},
colorList:[
{
label:"空闲中",
status:0,
color:"#6fc544"
},
{
label:"使用中",
status:1,
color:"#e7a646"
},
{
label:"维护中",
status:2,
color:"#4aa3ff"
},
{
label:"待保洁",
status:3,
color:"#ff494e"
},
{
label:"保洁中",
status:4,
color:"#ff49ef"
}
],
cleanStatusEnum:{},
switchDoor:true,
switchEl:true,
};
},
filters:{
setTime(val){
return moment(val).format("HH:mm")
}
},
onShow() {
this.onGetDicts()
},
methods:{
onGetDicts() {
let dicts = []
if (uni.getStorageSync('dicts')) {
dicts = JSON.parse(uni.getStorageSync('dicts'))
this.cleanStatusEnum = getDictItem(dicts, "clean_records_status");
this.onLoading()
} else {
dictList().then(res => {
dicts = res.data.data;
uni.setStorageSync('dicts', JSON.stringify(res.data.data))
this.cleanStatusEnum = getDictItem(dicts, "clean_records_status");
this.onLoading()
})
}
},
onLoading(){
getList().then(res=>{
if(res.data.code ===200){
let list =res.data.data&&res.data.data.length? res.data.data:[];
this.list = list.map(item=>{
return {
...item,
show:false,
roomVoList: item.roomVoList && item.roomVoList.length ? item.roomVoList.map(val=>{
let deviceList = {}
if(val.deviceList && val.deviceList.length){
val.deviceList.forEach(item=>{
if(item.devType === "CCEE"){
deviceList['door'] = {
devType: item.devType,
devId:item.devId,
}
}else{
deviceList['el'] = {
devType: item.devType,
devId:item.devId,
}
}
})
}else{
deviceList = ""
}
return {
...val,
colorStatus: val.recordsStatus>=0&& val.recordsStatus=== 0? 3: val.recordsStatus >= 0&& val.recordsStatus=== 1? 4: val.status,
images:val.images? val.images.split(","):[],
deviceList
}
}):[]
}
})
console.log(this.list,90909090)
}
})
},
onNavToInfo(){
getStarOrder().then(res=>{
console.log(res,"查询保洁中的订单")
if(res.data.code === 200){
uni.navigateTo({
url:"/pages/cleanOrderInfo/cleanOrderInfo?id="+res.data.data.id
})
}else{
uni.showToast({
icon:'none',
title:res.data.msg
})
}
})
},
onNavLocation(val){
uni.openLocation({
latitude: Number(val.latitude),
longitude: Number(val.longitude),
scale: 18,
name: val.address,
complete: (res) => {
console.log(res)
}
})
},
onNavToList(){
uni.navigateTo({
url:"/pages/cleanRecord/index"
})
},
onNavSearch(val){
if(val.recordsStatus == 0){
uni.navigateTo({
url:"/pages/cleanOrderInfo/cleanOrderInfo?id="+val.recordsId
})
}
},
onDeviceRun(opType,devId){
console.log(opType,devId,989898)
uni.showLoading({
title:"请求中"
})
deviceRun({
opType,
devId
}).then(res =>{
console.log(res)
uni.hideLoading()
if(res.data.code ===200){
uni.showToast({
icon:"success",
title:"操作成功"
})
}
})
}
}
}
</script>
<style lang="scss">
.clean-manage{
display: flex;
flex-direction: column;
align-items: center;
padding-bottom: 30upx;
.header{
display: flex;
width: 94%;
}
.card-box{
display: flex;
flex-direction: column;
border-radius: 20upx;
width: 94%;
margin-top: 30upx;
box-shadow: 0 0 8upx #ff55ff;
}
.title-box{
display: flex;
flex-direction: row;
align-items: center;
margin: 30upx 0 10upx;
}
.item-box{
display: flex;
flex-direction: row;
width: 100%;
height: 150rpx;
background: #FFFFFF;
box-shadow: 0rpx 5rpx 25rpx 0rpx rgba(0,0,0,0.2);
border-radius: 18rpx;
.item{
display: flex;
flex: 1;
flex-direction: column;
align-items: center;
justify-content: center;
.icon-box{
display: flex;
justify-content: center;
align-items: center;
width: 60upx;
margin-bottom: 12upx;
image{
display: block;
width: 100%;
max-height: 124upx;
}
}
}
}
}
.store-info{
display: flex;
flex-direction: column;
width: 100%;
border-bottom: 1px solid rgba(255,85,255,0.6);
padding: 18upx 20upx;
// margin-bottom: 12upx;
border-radius: 20upx 20upx 0 0;
.part-left{
width: 142upx;
height: 128upx;
border-radius: 12upx;
margin-right: 20upx;
overflow: hidden;
.img{
height: 100%;
max-width: 200upx;
}
}
.part-right{
display: flex;
flex: 1;
.flex-between{
display: flex;
justify-content: space-between;
align-items: center;
image{
display: block;
width: 50upx;
max-width: 140upx;
border-radius: 25upx;
}
}
.flex-row{
display: flex;
flex: 1;
flex-direction: row;
align-items: center;
image{
width: 24upx;
max-height: 50upx;
}
}
}
.color-list-box{
margin-top: 12upx;
.flex-row{
display: flex;
flex-direction: row;
justify-content: center;
align-items: center;
.block-box{
display: flex;
width: 12px;
height: 12px;
border-radius: 4upx;
margin-right: 8upx;
}
}
}
}
.bg-white-box{
background-color: #ffffff;
}
.room-box{
display: flex;
flex-direction: column;
width: 100%;
.room-item{
display: flex;
flex-direction: row;
justify-content: center;
width: 100%;
padding: 12upx 1%;
border-bottom: 1px solid rgba(0,0,0,0.2);
.room-stauts{
display: flex;
flex-direction: column;
align-items: center;
max-width: 40%;
height: 200upx;
background: #FFFFFF;
border-radius: 8rpx;
overflow: hidden;
.img{
height: 100%;
}
}
.part-right{
display: flex;
flex: 1;
flex-direction: column;
height: 100%;
.room-name{
display: flex;
justify-content: space-between;
margin: 12upx;
}
.device-list{
.part{
display: flex;
justify-content: space-between;
align-items: center;
margin: 6upx 12upx;
}
}
}
}
.marginLeft{
margin-left: 0;
}
.marginRight{
margin-right: 0;
}
}
.end-time-box{
display: flex;
width: 100%;
justify-content: center;
align-items: center;
height: 32upx;
text{
margin: 0 !important;
padding: 0;
font-size: 24upx;
}
}
</style>
...@@ -82,6 +82,12 @@ ...@@ -82,6 +82,12 @@
<text class="text-title">联系我们</text> <text class="text-title">联系我们</text>
</view> </view>
</view> </view>
<view class="cu-item arrow" @tap="onHandle(5)">
<view class="content">
<image :src="assetsPath+'/my_list_4.png'" class="png" mode="aspectFit"></image>
<text class="text-title">设备控制</text>
</view>
</view>
</view> </view>
</view> </view>
</view> </view>
...@@ -289,6 +295,10 @@ ...@@ -289,6 +295,10 @@
uni.navigateTo({ uni.navigateTo({
url:'/pages/useCouponIllustrate/useCouponIllustrate?keyData=call_us_images' url:'/pages/useCouponIllustrate/useCouponIllustrate?keyData=call_us_images'
}) })
}else if(val === 5){
uni.navigateTo({
url:'/pages/deviceManage/index'
})
} }
}, },
onClose(){ onClose(){
...@@ -533,6 +543,11 @@ ...@@ -533,6 +543,11 @@
.main { .main {
width: 100%; width: 100%;
.content{
display: flex;
flex-direction: row;
align-items: center;
}
} }
} }
.login-out{ .login-out{
......
...@@ -617,7 +617,7 @@ ...@@ -617,7 +617,7 @@
this.dateIntervalList.forEach((val,i)=>{ this.dateIntervalList.forEach((val,i)=>{
if(selectNum>=this.duration){ if(selectNum>=this.duration){
return return
} else if(val.status === 0){ } else if(val.status === 0 || (val.status ==1 && Number(moment(val.endHoldTime).format('mm'))<59)){
selectNum+=1 selectNum+=1
if(t<0){ if(t<0){
t = i t = i
...@@ -880,9 +880,9 @@ ...@@ -880,9 +880,9 @@
}, },
//计算支付金额 //计算支付金额
onComputePrice() { onComputePrice() {
uni.showLoading({ // uni.showLoading({
title: "加载中..." // title: "加载中..."
}) // })
let params = { let params = {
storeId: this.roomInfo.storeId, storeId: this.roomInfo.storeId,
roomId: this.roomInfo.id, roomId: this.roomInfo.id,
...@@ -897,7 +897,7 @@ ...@@ -897,7 +897,7 @@
params.packId = this.packageMode[this.modeIndex].id; params.packId = this.packageMode[this.modeIndex].id;
} }
computePrice(params).then(res => { computePrice(params).then(res => {
uni.hideLoading() // uni.hideLoading()
if (res.data.code == 200) { if (res.data.code == 200) {
this.computePriceInfo = res.data.data; this.computePriceInfo = res.data.data;
} }
...@@ -934,7 +934,7 @@ ...@@ -934,7 +934,7 @@
// this.onSetEndTime(); // this.onSetEndTime();
this.onGetSortDistance(); this.onGetSortDistance();
}, },
async onChangeMode(i) { onChangeMode(i) {
if (this.modeIndex === i) return; if (this.modeIndex === i) return;
this.modeIndex = i; this.modeIndex = i;
...@@ -962,10 +962,9 @@ ...@@ -962,10 +962,9 @@
let showHourUse = false; let showHourUse = false;
this.intervalList = this.intervalList.map((item,index) =>{ this.intervalList = this.intervalList.map((item,index) =>{
let status = item.status; let status = item.status;
if(index>=val && index<= val+duration){ if(index>=val && index<= val+duration){
status = 2 status = 2
if(this.dateIntervalList[index].status === 1 && index !== val ){ if(this.dateIntervalList[index].status === 1 && index !== val){
showHourUse = true showHourUse = true
} }
}else{ }else{
...@@ -979,12 +978,17 @@ ...@@ -979,12 +978,17 @@
if (showHourUse) { if (showHourUse) {
uni.showToast({ uni.showToast({
icon: "none", icon: "none",
title: "选择时段有重复" title: "选择时段有重复",
success: () => {
setTimeout(async ()=>{
this.dateObj =await this.onSetDateTime(this.startTime, this.endTime);
this.onGetUseCoupon()
},1000)
}
}) })
} }
// this.onComputePrice(); // this.onComputePrice();
this.dateObj =await this.onSetDateTime(this.startTime, this.endTime);
this.onGetUseCoupon()
}, },
onDurationChange(i) { onDurationChange(i) {
if (i >= this.distanceMode.length - 1) { if (i >= this.distanceMode.length - 1) {
...@@ -1014,7 +1018,7 @@ ...@@ -1014,7 +1018,7 @@
let n = 0 let n = 0
let t = -1; let t = -1;
res.data.data.forEach((item,k)=>{ res.data.data.forEach((item,k)=>{
if(n<=this.duration&&item.status===0){ if(n<=this.duration && (item.status===0||(item.status ==1 && Number(moment(item.endHoldTime).format('mm'))<59))){
n += 1 n += 1
if(t<0){ if(t<0){
t = k t = k
...@@ -1397,7 +1401,7 @@ ...@@ -1397,7 +1401,7 @@
// obj.startDate = `${this.dateList[this.dateIndex].readDate} ${startTime}:00` // obj.startDate = `${this.dateList[this.dateIndex].readDate} ${startTime}:00`
// } // }
obj.startDate = `${this.dateList[this.dateIndex].readDate} ${startTime}:00` obj.startDate = `${this.dateList[this.dateIndex].readDate} ${startTime}:01`
if ((this.orderType == 1 && Number(endArr[0]) <= Number(startArr[0]))) { if ((this.orderType == 1 && Number(endArr[0]) <= Number(startArr[0]))) {
obj.endDate = obj.endDate =
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment