Commit c3ac9059 by zhangzhen

细节优化

parent c5d47917
<template>
<view class="tool-box" >
<view v-for="(item, index) in toolList" :key="index" class="tool-item" :class="{active:!show}" :style="{transitionDuration: dNum+'s' }" @tap.stop="onHandle(item)">
<view class="tool-box">
<view v-for="(item, index) in toolList" :key="index" class="tool-item" :class="{active:!show}"
:style="{transitionDuration: dNum+'s' }" @tap.stop="onHandle(item)">
<!-- <text class="text-white text-bold text-xl">{{item.name}}</text> -->
<image v-if="show" class="image" :src="item.url" mode="scaleToFill"></image>
......@@ -11,71 +12,73 @@
<script>
import config from "@/config/index.config"
import {getOrderByAvailable, openDoor} from "@/api/order.js"
import {
getOrderByAvailable,
openDoor
} from "@/api/order.js"
export default {
name:"toolBox",
props:{
value:{
type:Boolean,
default:true
name: "toolBox",
props: {
value: {
type: Boolean,
default: true
},
storeId:{
storeId: {
type: [String, Number]
}
},
data() {
return {
show:true,
dNum:0.4,
toolList:[
{
name:"验券",
url:config.assetsPath+'/tool_3_v1.png',
imgUrl: config.assetsPath+'/tool_3m_v1.png',
sortName:"验",
routePath:"/pages/couponCheck/couponCheck",
value:1
show: true,
dNum: 0.4,
toolList: [{
name: "验券",
url: config.assetsPath + '/tool_3_v1.png',
imgUrl: config.assetsPath + '/tool_3m_v1.png',
sortName: "验",
routePath: "/pages/couponCheck/couponCheck",
value: 1
},
{
name:"开门",
url:config.assetsPath+'/tool_1_v1.png',
imgUrl: config.assetsPath+'/tool_1m_v1.png',
sortName:"开",
value:2
name: "开门",
url: config.assetsPath + '/tool_1_v1.png',
imgUrl: config.assetsPath + '/tool_1m_v1.png',
sortName: "开",
value: 2
},
{
name:"续单",
url:config.assetsPath+'/tool_2_v1.png',
imgUrl: config.assetsPath+'/tool_2m_v1.png',
sortName:"续",
value:3
name: "续单",
url: config.assetsPath + '/tool_2_v1.png',
imgUrl: config.assetsPath + '/tool_2m_v1.png',
sortName: "续",
value: 3
},
{
name:"咨询",
url:config.assetsPath+'/tool_4_v1.png',
imgUrl: config.assetsPath+'/tool_4m_v1.png',
sortName:"客",
value:4
name: "咨询",
url: config.assetsPath + '/tool_4_v1.png',
imgUrl: config.assetsPath + '/tool_4m_v1.png',
sortName: "客",
value: 4
}
],
timer:null,
orderInfo:{},
servicePhone:'',
timer: null,
orderInfo: {},
servicePhone: '',
};
},
watch:{
value(val){
if(this.timer){
watch: {
value(val) {
if (this.timer) {
clearTimeout(this.timer)
}
if(val){
this.timer = setTimeout(()=>{
if (val) {
this.timer = setTimeout(() => {
this.dNum = 0.8;
this.show = val;
},1500)
}else{
}, 1500)
} else {
this.show = val
}
}
......@@ -83,81 +86,84 @@
mounted() {
},
methods:{
onGetSysConfig(){
methods: {
onGetSysConfig() {
let sysConfigList = uni.getStorageSync('sysConfig')
let s = sysConfigList.find(item=>item.configKey === 'wechat.customer.service.phone')
if(s){
this.servicePhone= s.configValue;
uni.makePhoneCall({
phoneNumber:this.servicePhone
})
let s = sysConfigList.find(item=>item.configKey === 'wechat.service.url')
wx.openCustomerServiceChat({
extInfo: {
url: s? s.configValue : 'https://work.weixin.qq.com/kfid/kfc64ed401ad337a3c8'
},
corpId: 'wwef93286fdc08b2ac',
success(res) {
console.log(res)
}
})
},
onHandle(val){
if(val.value===4){
onHandle(val) {
if (val.value === 4) {
this.onGetSysConfig()
return
};
if([2,3].includes(val.value)){
if ([2, 3].includes(val.value)) {
this.onGetOrderByAvailable(val.value)
return
}
if(val.value===1){
if (val.value === 1) {
uni.navigateTo({
url:val.routePath+'?storeId='+this.storeId
url: val.routePath + '?storeId=' + this.storeId
})
}
},
onGetOrderByAvailable(i){
getOrderByAvailable().then(res=>{
if(res.data.code === 200){
if(res.data.data&&res.data.data.length){
onGetOrderByAvailable(i) {
getOrderByAvailable().then(res => {
if (res.data.code === 200) {
if (res.data.data && res.data.data.length) {
let arr = res.data.data.filter(item => item.status);
if(arr.length && arr.length ==1){
if (arr.length && arr.length == 1) {
this.orderInfo = arr[0];
if( i==3 ){
if (i == 3) {
// 续单
uni.navigateTo({
url:`/pages/order/order?orderNo=${this.orderInfo.orderNo}`
url: `/pages/order/order?orderNo=${this.orderInfo.orderNo}`
})
} else{
} else {
// 开门
this.onOpenDoor()
}
} else if(arr.length && arr.length >1){
} else if (arr.length && arr.length > 1) {
uni.switchTab({
url:"/pages/orderRecord/orderRecord?index=2"
url: "/pages/orderRecord/orderRecord?index=2"
})
}else{
} else {
uni.showToast({
icon:"none",
title:"暂无可用的订单,请先下单预约哦!"
icon: "none",
title: "暂无可用的订单,请先下单预约哦!"
})
}
}else{
} else {
uni.showToast({
icon:"none",
title:"暂无可用的订单,请先下单预约哦!"
icon: "none",
title: "暂无可用的订单,请先下单预约哦!"
})
}
}else{
} else {
uni.showToast({
icon:"none",
title:res.data.msg
icon: "none",
title: res.data.msg
})
}
})
},
onOpenDoor(){
onOpenDoor() {
uni.showLoading({
title:"开门中..."
title: "开门中..."
})
openDoor(this.orderInfo.orderNo).then(res=>{
openDoor(this.orderInfo.orderNo).then(res => {
uni.hideLoading()
uni.showToast({
icon:"none",
title:res.data.msg
icon: "none",
title: res.data.msg
})
})
}
......@@ -166,12 +172,13 @@
</script>
<style lang="scss" scoped>
.tool-box{
.tool-box {
position: fixed;
bottom: 10vh;
right: 0;
z-index: 99;
.tool-item{
.tool-item {
display: flex;
flex-direction: column;
justify-content: center;
......@@ -184,27 +191,30 @@
// border-left: 1px solid #E40583;
// border-bottom: 1px solid #E40583;
margin: 20rpx 0;
transition:width 2s,height 2s;
transition-timing-function:ease;
transition: width 2s, height 2s;
transition-timing-function: ease;
box-shadow: 0rpx 0rpx 28rpx 0rpx rgba(0,0,0,0.6);
box-shadow: 0rpx 0rpx 28rpx 0rpx rgba(0, 0, 0, 0.6);
// opacity: 0.9;
overflow: hidden;
.image{
.image {
width: 100%;
height: 100%;
}
text{
text {
white-space: nowrap;
font-size: 28rpx;
color: #3D3D3D;
}
}
.active{
.active {
width: 40px;
height:40px;
height: 40px;
border-radius: 8px 0 0 8px;
opacity: 0.9;
}
}
}
</style>
\ No newline at end of file
......@@ -1311,10 +1311,10 @@
// return;
// }
let nowDate = moment().valueOf();
let setDate = moment(this.formatAllData.nowDate).valueOf();
let setDate = moment(this.formatAllData.startDateTime).valueOf();
console.log(nowDate,setDate,"时间对比")
// 如果当前时间大于开始时间,则不允许下单
if (this.orderType == 1 && nowDate > setDate ) {
if ( this.orderType == 1 && nowDate > setDate ) {
uni.showToast({
icon: "none",
title: "当前时间晚于预约开始时间,请重新选择预约时间"
......
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