Commit c3ac9059 by zhangzhen

细节优化

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