Commit 7a9b8b0e by zhangzhen

功能优化

parent 5ec478f2
......@@ -19,9 +19,9 @@
</template>
<script>
import {
register,
login,
register
} from "@/api/index.js";
export default {
......@@ -33,7 +33,28 @@
},
methods:{
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(){
this.$refs.popupPhone.close()
......
<template>
<view class="clean-manage">
<view class="card-box bg-white-box">
<view class="card-box">
<view class="flex-row title-box">
<text class="cuIcon-title text-pink text-lg"></text>
<text class="text-title text-bold text-xl">我的保洁</text>
<!-- <text class="cuIcon-title text-pink text-lg"></text> -->
<text class="text-title text-lg">我的保洁</text>
</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="icon-box">
<image :src="assetsPath+'/clean_icon.png'" mode="widthFix"></image>
<image :src="assetsPath+'/clean_list_1.png'" mode="widthFix"></image>
</view>
<text class="text-white text-bold text-lg">开始保洁</text>
<text class="text-black text-lg">开始保洁</text>
</view>
<view class="item" @tap="onNavToList">
<view class="icon-box">
<image :src="assetsPath+'/order_icon.png'" mode="widthFix"></image>
<image :src="assetsPath+'/clean_list_2.png'" mode="widthFix"></image>
</view>
<text class="text-white text-bold text-lg">保洁记录</text>
<text class="text-black text-lg">保洁记录</text>
</view>
</view>
</view>
<view class="card-box">
<view class="flex-row title-box">
<text class="cuIcon-title text-pink text-lg"></text>
<text class="text-title text-bold text-xl">负责门店</text>
<!-- <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 bg-white-box">
<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="aspectFill"></image>
</view>
<view class="flex-col part-right">
<view class="flex-between">
<text class="text-title text-lg">{{item.name}}</text>
<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 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 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">
<text>{{val.name}}</text>
</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>
......@@ -72,13 +92,49 @@
data() {
return {
assetsPath:config.assetsPath,
hostUrl:config.hostUrl,
list:[],
statusEnum:{
0:'空闲中',
1:'使用中',
2:'待保洁',
3:'保洁中'
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:{}
};
},
......@@ -105,7 +161,18 @@
getListStore().then(res=>{
console.log(res)
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 @@
display: flex;
flex-direction: column;
border-radius: 20upx;
width: 94%;
margin-top: 24upx;
width: 92%;
margin-top: 10upx;
}
.title-box{
display: flex;
flex-direction: row;
align-items: center;
margin: 24upx;
margin: 10upx 0;
}
.item-box{
display: flex;
flex-direction: row;
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{
display: flex;
flex: 1;
flex-direction: column;
align-items: center;
width: 23%;
margin: 10upx 1% 30upx 1%;
background:rgba(255, 72, 255, 0.45);
border-radius: 20upx;
padding: 20upx 0;
justify-content: center;
.icon-box{
display: flex;
justify-content: center;
align-items: center;
width: 80%;
width: 60upx;
margin-bottom: 12upx;
image{
display: block;
width: 60%;
width: 100%;
max-height: 124upx;
}
}
......@@ -204,20 +271,63 @@
display: flex;
flex-direction: column;
width: 100%;
border-bottom: 1px solid #e5e5e5;
padding: 30upx 20upx;
border: 1px solid #e5e5e5;
padding: 18upx 20upx;
margin-bottom: 12upx;
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;
flex: 1;
.flex-between{
display: flex;
justify-content: space-between;
align-items: center;
image{
display: block;
width: 80upx;
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;
}
......@@ -225,16 +335,45 @@
display: flex;
flex-wrap: wrap;
width: 100%;
padding: 0 1%;
.room-item{
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
width: 30%;
margin: 12upx 1.6%;
padding: 30upx 0;
border-radius: 20upx;
width: 23.5%;
margin: 12upx 1%;
.room-stauts{
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>
......@@ -275,15 +275,12 @@
onLoad(option) {
// 隐藏原生的tabbar
uni.hideTabBar();
this.onCheckUserLogin();
this.$refs.loginPop.open();
this.onGetDicts()
// this.$refs.popup.open()
// this.$refs.loginPop.open()
},
methods: {
onGetSysConfig(){
systemConfig().then(res=>{
console.log(res,909090)
uni.setStorage({
key:'sysConfig',
data: res.data.rows
......@@ -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() {
// uni.getSetting({
// complete: (res) => {
......@@ -349,10 +326,10 @@
uni.setStorageSync("latitude", res.latitude)
uni.setStorageSync("longitude", res.longitude)
} else{
uni.showToast({
icon: "none",
title: '获取位置信息失败'
})
// uni.showToast({
// icon: "none",
// title: '获取位置信息失败'
// })
this.$refs.popup.open()
}
uni.removeStorage({
......@@ -472,9 +449,12 @@
uni.openSetting({
scope:"scope.userLocation",
complete: (res) => {
console.log(res,909090)
if(res.authSetting['scope.userLocation']){
this.onClose();
this.onLoading()
}
}
})
},
onPreview(val){
......
......@@ -5,9 +5,11 @@
<tki-qrcode ref="qrcode" :cid="cid" :val="text" :size="size" unit="upx" :icon="iconUrl"
:iconSize="24" :onval="true" :loadMake="loadMake" :showLoading="false" @result="qrR" />
</view>
<view class="info">
<view v-if="orderInfo" class="info">
<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 class="store-name">
<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 @@
</view>
</view>
</view>
<LoginPop ref="loginPop" @success="onLoading" />
</view>
</template>
<script>
import LoginPop from "@/components/login/login"
import tkiQrcode from "@/components/tki-qrcode/tki-qrcode"
import {
getOrderInfoByNo
} from "@/api/order.js"
import moment from "@/common/moment_zh_cn.js";
import {openDoor} from "@/api/order.js"
import iconUrl from "@/static/cart.png"
import {openDoor} from "@/api/order.js";
import iconUrl from "@/static/logo_icon.png";
export default {
components: {
tkiQrcode
tkiQrcode,
LoginPop
},
data() {
return {
......@@ -54,7 +59,7 @@
colorDark: '#000000',
colorLight: '#ffffff',
orderNo: '',
orderInfo: {},
orderInfo: '',
};
},
filters:{
......@@ -63,6 +68,9 @@
}
},
onLoad(query) {
uni.showLoading({
title:'加载中'
})
if(query && query.q){
const q = decodeURIComponent(query.q) // 获取到二维码原始链接内容
if(q){
......@@ -71,7 +79,7 @@
}else{
this.orderNo = query.orderNo
}
this.onLoading();
this.$refs.loginPop.open();
},
onShareAppMessage() {
return {
......@@ -83,7 +91,8 @@
methods: {
onLoading() {
getOrderInfoByNo(this.orderNo).then(res => {
console.log(res, 909090)
uni.hideLoading()
if(res.data.code == 200){
this.orderInfo = {
...res.data.data,
startDate: res.data.data.preStartDate.split(" ")[0],
......@@ -93,6 +102,7 @@
payTime: moment(res.data.data.payTime).format("YYYY-MM-DD HH:mm:ss")
}
this.text = "https://www.coujio.com/wx-share?orderNo="+this.orderNo
}
})
},
qrR(r) {
......@@ -158,9 +168,11 @@
.room-name {
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
width: 100%;
padding: 30upx 0;
padding: 20upx 0 10upx;
}
.store-name {
......@@ -169,7 +181,7 @@
justify-content: center;
align-items: center;
width: 90%;
padding: 30upx 0;
padding: 10upx 0 20upx;
.text{
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