Commit 7a9b8b0e by zhangzhen

功能优化

parent 5ec478f2
...@@ -19,9 +19,9 @@ ...@@ -19,9 +19,9 @@
</template> </template>
<script> <script>
import { import {
register, login,
register
} from "@/api/index.js"; } from "@/api/index.js";
export default { export default {
...@@ -33,7 +33,28 @@ ...@@ -33,7 +33,28 @@
}, },
methods:{ methods:{
open(){ open(){
this.$refs.popupPhone.open() let that = this;
wx.login({
success: (res) => {
login(res.code).then(res => {
if (res.data.code == 200) {
if (res.data.data.type === "login") {
uni.setStorageSync('tokenHeaders', "Authori-zation")
uni.setStorage({
key: uni.getStorageSync('tokenHeaders'),
data: res.data.data.token
})
that.$emit('success')
} else {
uni.removeStorageSync('tokenHeaders')
this.$refs.popupPhone.open();
}
}
})
}
})
}, },
onCancle(){ onCancle(){
this.$refs.popupPhone.close() this.$refs.popupPhone.close()
......
<template> <template>
<view class="clean-manage"> <view class="clean-manage">
<view class="card-box bg-white-box"> <view class="card-box">
<view class="flex-row title-box"> <view class="flex-row title-box">
<text class="cuIcon-title text-pink text-lg"></text> <!-- <text class="cuIcon-title text-pink text-lg"></text> -->
<text class="text-title text-bold text-xl">我的保洁</text> <text class="text-title text-lg">我的保洁</text>
</view> </view>
<view class="item-box"> <view class="item-box" :style="{background:'url('+assetsPath+'/clean_list_bg.png) 0 0 / 100% 100% no-repeat'}">
<view class="item" @tap="onNavToInfo"> <view class="item" @tap="onNavToInfo">
<view class="icon-box"> <view class="icon-box">
<image :src="assetsPath+'/clean_icon.png'" mode="widthFix"></image> <image :src="assetsPath+'/clean_list_1.png'" mode="widthFix"></image>
</view> </view>
<text class="text-white text-bold text-lg">开始保洁</text> <text class="text-black text-lg">开始保洁</text>
</view> </view>
<view class="item" @tap="onNavToList"> <view class="item" @tap="onNavToList">
<view class="icon-box"> <view class="icon-box">
<image :src="assetsPath+'/order_icon.png'" mode="widthFix"></image> <image :src="assetsPath+'/clean_list_2.png'" mode="widthFix"></image>
</view> </view>
<text class="text-white text-bold text-lg">保洁记录</text> <text class="text-black text-lg">保洁记录</text>
</view> </view>
</view> </view>
</view> </view>
<view class="card-box"> <view class="card-box">
<view class="flex-row title-box"> <view class="flex-row title-box">
<text class="cuIcon-title text-pink text-lg"></text> <!-- <text class="cuIcon-title text-pink text-lg"></text> -->
<text class="text-title text-bold text-xl">负责门店</text> <text class="text-title text-lg">负责门店</text>
</view> </view>
</view> </view>
<view v-for="(item,index) in list" :key="index" class="card-box bg-white-box"> <view v-for="(item,index) in list" :key="index" class="card-box">
<view class="store-info"> <view class="store-info">
<view class="flex-between">
<text class="text-title text-lg">{{item.name}}</text> <view class="flex-row">
<image :src="assetsPath+'/map_icon.png'" mode="widthFix" @tap="onNavLocation(item)"></image> <view class="part-left">
<image class="img" :src="hostUrl+item.images" mode="aspectFill"></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 class="">
<text class="text-gray">{{item.address}}</text> <view class="flex-row color-list-box">
<view v-for="(vals, i) in colorList" :key="i" class="flex-1 flex-row" >
<view class="block-box" :style="{background: vals.color}">
</view>
<text>{{vals.label}}</text>
</view>
</view> </view>
</view> </view>
<view class="room-box"> <view class="room-box">
<view v-for="(val,k) in item.roolList" :key='k' class="room-item" :class="val.status==3?'bg-blue':val.status==2?'bg-red':'bg-gray'" @tap='onNavSearch(val)'> <view v-for="(val,k) in item.roolList" :key='k' class="room-item" :class="{marginLeft: k%4 == 0, marginRight: k%4 == 3}" @tap='onNavSearch(val)'>
<view class="room-stauts">
<text :style="{color: colorEnum[val.colorStatus] }">{{statusEnum[val.colorStatus]}}</text>
<image class="img" :src="assetsPath+'/avatar_no.png'" mode="widthFix"></image>
</view>
<view class="room-name"> <view class="room-name">
<text>{{val.name}}</text> <text>{{val.name}}</text>
</view> </view>
<!-- <view class="room-name">
<text>{{val.roomName}}</text>
</view> -->
<view class="room-stauts margin-top">
<text>{{ [0,1].includes(val.recordsStatus)?cleanStatusEnum[val.recordsStatus]: statusEnum[val.status]}}</text>
</view>
</view> </view>
</view> </view>
...@@ -72,13 +92,49 @@ ...@@ -72,13 +92,49 @@
data() { data() {
return { return {
assetsPath:config.assetsPath, assetsPath:config.assetsPath,
hostUrl:config.hostUrl,
list:[], list:[],
statusEnum:{ statusEnum:{
0:'空闲中', 0:'空闲中',
1:'使用中', 1:'使用中',
2:'待保洁', 2:'维护中',
3:'保洁中' 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:{} cleanStatusEnum:{}
}; };
}, },
...@@ -105,7 +161,18 @@ ...@@ -105,7 +161,18 @@
getListStore().then(res=>{ getListStore().then(res=>{
console.log(res) console.log(res)
if(res.data.code ===200){ if(res.data.code ===200){
this.list =res.data.data&&res.data.data.length? res.data.data:[] let list =res.data.data&&res.data.data.length? res.data.data:[];
this.list = list.map(item=>{
return {
...item,
roolList: item.roolList.length ? item.roolList.map(val=>{
return {
...val,
colorStatus: val.recordsStatus>=0&& val.recordsStatus=== 0? 3: val.recordsStatus >= 0&& val.recordsStatus=== 1? 4: val.status
}
}):[]
}
})
} }
}) })
}, },
...@@ -162,38 +229,38 @@ ...@@ -162,38 +229,38 @@
display: flex; display: flex;
flex-direction: column; flex-direction: column;
border-radius: 20upx; border-radius: 20upx;
width: 94%; width: 92%;
margin-top: 24upx; margin-top: 10upx;
} }
.title-box{ .title-box{
display: flex; display: flex;
flex-direction: row; flex-direction: row;
align-items: center; align-items: center;
margin: 24upx; margin: 10upx 0;
} }
.item-box{ .item-box{
display: flex; display: flex;
flex-direction: row; flex-direction: row;
width: 100%; width: 100%;
padding: 0 1%; height: 150rpx;
background: #FFFFFF;
box-shadow: 0rpx 5rpx 25rpx 0rpx rgba(0,0,0,0.2);
border-radius: 18rpx;
.item{ .item{
display: flex; display: flex;
flex: 1;
flex-direction: column; flex-direction: column;
align-items: center; align-items: center;
width: 23%; justify-content: center;
margin: 10upx 1% 30upx 1%;
background:rgba(255, 72, 255, 0.45);
border-radius: 20upx;
padding: 20upx 0;
.icon-box{ .icon-box{
display: flex; display: flex;
justify-content: center; justify-content: center;
align-items: center; align-items: center;
width: 80%; width: 60upx;
margin-bottom: 12upx; margin-bottom: 12upx;
image{ image{
display: block; display: block;
width: 60%; width: 100%;
max-height: 124upx; max-height: 124upx;
} }
} }
...@@ -204,20 +271,63 @@ ...@@ -204,20 +271,63 @@
display: flex; display: flex;
flex-direction: column; flex-direction: column;
width: 100%; width: 100%;
border-bottom: 1px solid #e5e5e5; border: 1px solid #e5e5e5;
padding: 30upx 20upx; padding: 18upx 20upx;
margin-bottom: 12upx; margin-bottom: 12upx;
.flex-between{ border-radius: 20upx;
.part-left{
width: 142upx;
height: 128upx;
border-radius: 12upx;
margin-right: 20upx;
overflow: hidden;
.img{
height: 100%;
max-width: 200upx;
}
}
.part-right{
display: flex; display: flex;
justify-content: space-between; 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; align-items: center;
image{ .block-box{
display: block; display: flex;
width: 80upx; width: 12px;
max-width: 140upx; height: 12px;
border-radius: 4upx;
margin-right: 8upx;
} }
} }
} }
}
.bg-white-box{ .bg-white-box{
background-color: #ffffff; background-color: #ffffff;
} }
...@@ -225,16 +335,45 @@ ...@@ -225,16 +335,45 @@
display: flex; display: flex;
flex-wrap: wrap; flex-wrap: wrap;
width: 100%; width: 100%;
padding: 0 1%;
.room-item{ .room-item{
display: flex; display: flex;
flex-direction: column; flex-direction: column;
justify-content: center; justify-content: center;
align-items: center; align-items: center;
width: 30%; width: 23.5%;
margin: 12upx 1.6%; margin: 12upx 1%;
padding: 30upx 0; .room-stauts{
border-radius: 20upx; display: flex;
flex-direction: column;
align-items: center;
width: 100%;
// height: 138rpx;
background: #FFFFFF;
border: 1px solid #EEE6E3;
border-radius: 8rpx;
text{
margin: 10upx 0 4upx;
}
.img{
display: block;
width: 64%;
max-height: 240upx;
}
}
.room-name{
margin-top: 20upx;
text{
font-size: 32rpx;
font-weight: bold;
color: #333333;
}
}
}
.marginLeft{
margin-left: 0;
}
.marginRight{
margin-right: 0;
} }
} }
</style> </style>
...@@ -275,15 +275,12 @@ ...@@ -275,15 +275,12 @@
onLoad(option) { onLoad(option) {
// 隐藏原生的tabbar // 隐藏原生的tabbar
uni.hideTabBar(); uni.hideTabBar();
this.onCheckUserLogin(); this.$refs.loginPop.open();
this.onGetDicts() this.onGetDicts()
// this.$refs.popup.open()
// this.$refs.loginPop.open()
}, },
methods: { methods: {
onGetSysConfig(){ onGetSysConfig(){
systemConfig().then(res=>{ systemConfig().then(res=>{
console.log(res,909090)
uni.setStorage({ uni.setStorage({
key:'sysConfig', key:'sysConfig',
data: res.data.rows data: res.data.rows
...@@ -306,26 +303,6 @@ ...@@ -306,26 +303,6 @@
}) })
// } // }
}, },
onCheckUserLogin(){
wx.login({
success: (res) => {
login(res.code).then(res => {
if (res.data.code == 200) {
if (res.data.data.type === "login") {
uni.setStorageSync('tokenHeaders', "Authori-zation")
uni.setStorage({
key: uni.getStorageSync('tokenHeaders'),
data: res.data.data.token
})
} else {
uni.removeStorageSync('tokenHeaders')
this.$refs.loginPop.open();
}
}
})
}
})
},
onLoading() { onLoading() {
// uni.getSetting({ // uni.getSetting({
// complete: (res) => { // complete: (res) => {
...@@ -349,10 +326,10 @@ ...@@ -349,10 +326,10 @@
uni.setStorageSync("latitude", res.latitude) uni.setStorageSync("latitude", res.latitude)
uni.setStorageSync("longitude", res.longitude) uni.setStorageSync("longitude", res.longitude)
} else{ } else{
uni.showToast({ // uni.showToast({
icon: "none", // icon: "none",
title: '获取位置信息失败' // title: '获取位置信息失败'
}) // })
this.$refs.popup.open() this.$refs.popup.open()
} }
uni.removeStorage({ uni.removeStorage({
...@@ -472,8 +449,11 @@ ...@@ -472,8 +449,11 @@
uni.openSetting({ uni.openSetting({
scope:"scope.userLocation", scope:"scope.userLocation",
complete: (res) => { complete: (res) => {
this.onClose(); console.log(res,909090)
this.onLoading() if(res.authSetting['scope.userLocation']){
this.onClose();
this.onLoading()
}
} }
}) })
}, },
......
...@@ -5,9 +5,11 @@ ...@@ -5,9 +5,11 @@
<tki-qrcode ref="qrcode" :cid="cid" :val="text" :size="size" unit="upx" :icon="iconUrl" <tki-qrcode ref="qrcode" :cid="cid" :val="text" :size="size" unit="upx" :icon="iconUrl"
:iconSize="24" :onval="true" :loadMake="loadMake" :showLoading="false" @result="qrR" /> :iconSize="24" :onval="true" :loadMake="loadMake" :showLoading="false" @result="qrR" />
</view> </view>
<view class="info"> <view v-if="orderInfo" class="info">
<view class="room-name"> <view class="room-name">
<text class="text-white text-bold text-xxl">{{orderInfo.name || '一帆风顺(111)[中包]'}}</text> <text class="text-white">{{orderInfo.storeName}}</text>
<text class="text-white text-bold text-xxl">{{orderInfo.roomName}}{{orderInfo.roomTypeName}}</text>
<text class="text-white text-xl">{{orderInfo.consumerName}}-{{orderInfo.consumerPhone}} 预定</text>
</view> </view>
<view class="store-name"> <view class="store-name">
<text class="icon cuIcon-location text-white text-xl"></text> <text class="text text-white text-lg">{{orderInfo.address || '武汉市汉阳区龙阳大道商业街110号'}}</text> <text class="icon cuIcon-location text-white text-xl"></text> <text class="text text-white text-lg">{{orderInfo.address || '武汉市汉阳区龙阳大道商业街110号'}}</text>
...@@ -28,20 +30,23 @@ ...@@ -28,20 +30,23 @@
</view> </view>
</view> </view>
</view> </view>
<LoginPop ref="loginPop" @success="onLoading" />
</view> </view>
</template> </template>
<script> <script>
import LoginPop from "@/components/login/login"
import tkiQrcode from "@/components/tki-qrcode/tki-qrcode" import tkiQrcode from "@/components/tki-qrcode/tki-qrcode"
import { import {
getOrderInfoByNo getOrderInfoByNo
} from "@/api/order.js" } from "@/api/order.js"
import moment from "@/common/moment_zh_cn.js"; import moment from "@/common/moment_zh_cn.js";
import {openDoor} from "@/api/order.js" import {openDoor} from "@/api/order.js";
import iconUrl from "@/static/cart.png" import iconUrl from "@/static/logo_icon.png";
export default { export default {
components: { components: {
tkiQrcode tkiQrcode,
LoginPop
}, },
data() { data() {
return { return {
...@@ -54,7 +59,7 @@ ...@@ -54,7 +59,7 @@
colorDark: '#000000', colorDark: '#000000',
colorLight: '#ffffff', colorLight: '#ffffff',
orderNo: '', orderNo: '',
orderInfo: {}, orderInfo: '',
}; };
}, },
filters:{ filters:{
...@@ -63,6 +68,9 @@ ...@@ -63,6 +68,9 @@
} }
}, },
onLoad(query) { onLoad(query) {
uni.showLoading({
title:'加载中'
})
if(query && query.q){ if(query && query.q){
const q = decodeURIComponent(query.q) // 获取到二维码原始链接内容 const q = decodeURIComponent(query.q) // 获取到二维码原始链接内容
if(q){ if(q){
...@@ -71,7 +79,7 @@ ...@@ -71,7 +79,7 @@
}else{ }else{
this.orderNo = query.orderNo this.orderNo = query.orderNo
} }
this.onLoading(); this.$refs.loginPop.open();
}, },
onShareAppMessage() { onShareAppMessage() {
return { return {
...@@ -83,16 +91,18 @@ ...@@ -83,16 +91,18 @@
methods: { methods: {
onLoading() { onLoading() {
getOrderInfoByNo(this.orderNo).then(res => { getOrderInfoByNo(this.orderNo).then(res => {
console.log(res, 909090) uni.hideLoading()
this.orderInfo = { if(res.data.code == 200){
...res.data.data, this.orderInfo = {
startDate: res.data.data.preStartDate.split(" ")[0], ...res.data.data,
startTime: res.data.data.preStartDate.split(" ")[1], startDate: res.data.data.preStartDate.split(" ")[0],
endDate: res.data.data.preEndDate.split(" ")[0], startTime: res.data.data.preStartDate.split(" ")[1],
endTime: res.data.data.preEndDate.split(" ")[1], endDate: res.data.data.preEndDate.split(" ")[0],
payTime: moment(res.data.data.payTime).format("YYYY-MM-DD HH:mm:ss") endTime: res.data.data.preEndDate.split(" ")[1],
payTime: moment(res.data.data.payTime).format("YYYY-MM-DD HH:mm:ss")
}
this.text = "https://www.coujio.com/wx-share?orderNo="+this.orderNo
} }
this.text = "https://www.coujio.com/wx-share?orderNo="+this.orderNo
}) })
}, },
qrR(r) { qrR(r) {
...@@ -158,9 +168,11 @@ ...@@ -158,9 +168,11 @@
.room-name { .room-name {
display: flex; display: flex;
flex-direction: column;
justify-content: center; justify-content: center;
align-items: center;
width: 100%; width: 100%;
padding: 30upx 0; padding: 20upx 0 10upx;
} }
.store-name { .store-name {
...@@ -169,7 +181,7 @@ ...@@ -169,7 +181,7 @@
justify-content: center; justify-content: center;
align-items: center; align-items: center;
width: 90%; width: 90%;
padding: 30upx 0; padding: 10upx 0 20upx;
.text{ .text{
text-decoration: underline; text-decoration: underline;
} }
......
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