Commit b01256ba by zhangzhen

功能优化

parent 383821af
...@@ -16,5 +16,14 @@ export const couponChecked=(data)=>{ ...@@ -16,5 +16,14 @@ export const couponChecked=(data)=>{
return http.get(url,data) return http.get(url,data)
} }
export const getStoreListByCouponCode=(data)=>{
let url=`/chessCards/queryshop`
return http.get(url,data)
}
export const getCouponByCode=(data)=>{
let url=`/consumerCoupon/queryCode`
return http.get(url,data)
}
<template>
<view class="store-list-content">
<scroll-view class="scroll-view" scroll-y="true">
<view class="store-list">
<view class="flex-col" v-for="(val,i) in list" :key="i" @tap.stop="onNavToHome(val)">
<view class="flex-row">
<view class="room-img-box">
<image :src="val.images[0]" mode="aspectFill" @tap.stop="onPreview(val)"></image>
</view>
<view class="flex-1 part-right">
<view class="part-title">
<view class='cu-tag radius sm bg-pink'>{{storeTypeEnum[val.storeType]}}</view>
<text class="text-title text-lg text-bold">{{val.name}}</text>
</view>
<view class="flex-between">
<view class="flex-row part-title">
<text class="cuIcon-location text-pink margin-right"></text>
<view class="flex-1">
<text class="text-gray text-sm">{{val.address}}</text>
</view>
</view>
<!-- <view class="nav-icon" @tap.stop="onNavToMap(val)">
<image :src="assetsPath+'/map_icon.png'" mode="widthFix"></image>
</view> -->
</view>
<view class="flex-between part-title">
<view class='cu-tag radius line-pink'>距离{{Number(val.distance).toFixed(2)}}km</view>
<view class="location">
<button class="cu-btn bg-pink">选择</button>
</view>
</view>
</view>
</view>
</view>
</view>
</scroll-view>
</view>
</template>
<script>
import config from "@/config/index.config"
import {
getDictItem
} from "@/utils/tools.js"
export default {
name: "storeList",
props: {
value: {
type: Array,
default: []
}
},
data() {
return {
assetsPath: config.assetsPath,
list: [],
storeTypeEnum: {},
};
},
watch: {
value: {
deep: true,
handler(val, oldVal) {
this.onLoading()
}
}
},
mounted() {
let dicts = JSON.parse(uni.getStorageSync('dicts'))
this.storeTypeEnum = getDictItem(dicts, "store_type");
},
methods: {
onLoading() {
this.list = this.value;
},
onNavToHome(val) {
this.$emit("change", val.id)
},
onPreview(item) {
uni.previewImage({
urls: item.images,
current: 0
})
},
onNavToMap(val) {
uni.openLocation({
latitude: Number(val.latitude),
longitude: Number(val.longitude),
scale: 18,
name: val.address,
address: val.address,
success: (res) => {
console.log(res)
},
complete: (res) => {
console.log(res, 909090)
}
})
}
}
}
</script>
<style lang="scss" scoped>
.store-list-content{
width: 100%;
height: 100%;
}
.scroll-view {
position: relative;
width: 100%;
height: 100%;
}
.store-list {
position: absolute;
top: 0;
left: 2%;
display: flex;
flex-direction: column;
width: 96%;
>.flex-col {
display: flex;
flex-direction: column;
width: 100%;
background: #ffffff;
box-shadow: 0 4upx 8upx rgba(0, 0, 0, 0.1);
border-radius: 12upx;
overflow: hidden;
padding: 12upx;
margin: 12upx 0;
.room-img-box {
display: flex;
width: 200upx;
height: 240upx;
border-radius: 12upx;
overflow: hidden;
margin: 0 20upx 0 0;
image {
height: 100%;
}
}
.part-right {
display: flex;
flex-direction: column;
width: 100%;
padding: 0 10upx 0 0;
.part-title {
display: flex;
flex: 1;
align-items: center;
width: 100%;
.margin-right {
margin-right: 6upx;
margin-top: 4upx;
}
.location {
display: flex;
flex-direction: row;
align-items: center;
justify-content: center;
.cu-btn {
padding: 12upx 20upx;
height: auto;
}
}
}
.part-tag-box {
display: flex;
justify-content: space-between;
align-items: center;
width: 100%;
padding: 10upx 12upx;
.part-tag {
display: flex;
flex-wrap: wrap;
width: 96%;
.cu-tag {
margin: 4upx 1%;
}
}
}
}
.part-bottom-box {
display: flex;
width: 100%;
justify-content: space-between;
height: 100upx;
.flex-row {
display: flex;
flex-direction: row;
align-items: center;
margin-left: 20upx;
font-size: 32upx;
}
.nav-use {
display: flex;
align-items: flex-end;
}
}
}
}
.nav-icon {
display: flex;
justify-content: center;
align-items: center;
width: 80upx;
image {
display: block;
width: 100%;
height: auto;
}
}
</style>
\ No newline at end of file
<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,index)"> <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>
...@@ -26,29 +26,34 @@ ...@@ -26,29 +26,34 @@
dNum:0.4, dNum:0.4,
toolList:[ toolList:[
{ {
name:"验券",
url:config.assetsPath+'/tool_3.png',
imgUrl: config.assetsPath+'/scan_code_icon.png',
sortName:"验",
routePath:"/pages/couponCheck/couponCheck",
value:1
},
{
name:"开门", name:"开门",
url:config.assetsPath+'/tool_1.png', url:config.assetsPath+'/tool_1.png',
imgUrl: config.assetsPath+'/open_door_icon.png', imgUrl: config.assetsPath+'/open_door_icon.png',
sortName:"开" sortName:"开",
value:2
}, },
{ {
name:"续单", name:"续单",
url:config.assetsPath+'/tool_2.png', url:config.assetsPath+'/tool_2.png',
imgUrl: config.assetsPath+'/order_2_icon.png', imgUrl: config.assetsPath+'/order_2_icon.png',
sortName:"续" sortName:"续",
}, value:3
{
name:"验券",
url:config.assetsPath+'/tool_3.png',
imgUrl: config.assetsPath+'/scan_code_icon.png',
sortName:"验",
routePath:"/pages/couponCheck/couponCheck"
}, },
{ {
name:"客服", name:"咨询",
url:config.assetsPath+'/tool_4.png', url:config.assetsPath+'/tool_4.png',
imgUrl: config.assetsPath+'/zcpt.png', imgUrl: config.assetsPath+'/zcpt.png',
sortName:"客" sortName:"客",
value:4
} }
], ],
timer:null, timer:null,
...@@ -86,13 +91,13 @@ ...@@ -86,13 +91,13 @@
}) })
} }
}, },
onHandle(val,index){ onHandle(val){
if(index===3){ if(val.value===4){
this.onGetSysConfig() this.onGetSysConfig()
return return
}; };
if([0,1].includes(index)){ if([2,3].includes(val.value)){
this.onGetOrderByAvailable(index) this.onGetOrderByAvailable(val.value)
return return
} }
if(val.routePath){ if(val.routePath){
...@@ -106,7 +111,7 @@ ...@@ -106,7 +111,7 @@
if(res.data.code === 200){ if(res.data.code === 200){
if(res.data.data&&res.data.data.length===1){ if(res.data.data&&res.data.data.length===1){
this.orderInfo = res.data.data[0]; this.orderInfo = res.data.data[0];
if(i === 1){ if(i === 3){
if(this.orderInfo.status ==1){ if(this.orderInfo.status ==1){
// 去续单 // 去续单
uni.navigateTo({ uni.navigateTo({
...@@ -118,8 +123,6 @@ ...@@ -118,8 +123,6 @@
title:"无使用中的订单,无法续单哦!" title:"无使用中的订单,无法续单哦!"
}) })
} }
}else{ }else{
// 去开门 // 去开门
this.onOpenDoor() this.onOpenDoor()
...@@ -131,7 +134,7 @@ ...@@ -131,7 +134,7 @@
if(list.length ===1){ if(list.length ===1){
this.orderInfo = list[0]; this.orderInfo = list[0];
if(i === 1){ if(i === 3){
// 去续单 // 去续单
uni.navigateTo({ uni.navigateTo({
url:`/pages/order/order?roomId=${this.orderInfo.roomId}&orderNo=${this.orderInfo.orderNo}` url:`/pages/order/order?roomId=${this.orderInfo.roomId}&orderNo=${this.orderInfo.orderNo}`
...@@ -187,8 +190,8 @@ ...@@ -187,8 +190,8 @@
flex-direction: column; flex-direction: column;
justify-content: center; justify-content: center;
align-items: center; align-items: center;
width: 50px; width: 60px;
height: 44px; height: 54px;
border-radius: 20upx 0 0 20upx; border-radius: 20upx 0 0 20upx;
background: rgba(255, 255, 255, 0.72); background: rgba(255, 255, 255, 0.72);
// border-top: 1px solid #E40583; // border-top: 1px solid #E40583;
...@@ -210,8 +213,8 @@ ...@@ -210,8 +213,8 @@
} }
} }
.active{ .active{
width: 30px; width: 36px;
height:26px; height:32px;
border-radius: 12upx 0 0 12upx; border-radius: 12upx 0 0 12upx;
opacity: 0.9; opacity: 0.9;
} }
......
...@@ -2,8 +2,8 @@ const CONFIG = { ...@@ -2,8 +2,8 @@ const CONFIG = {
// 开发环境配置 // 开发环境配置
development: { development: {
// assetsPath: 'https://www.coujio.com/wechat_static', // 静态资源路径 // assetsPath: 'https://www.coujio.com/wechat_static', // 静态资源路径
assetsPath: 'https://coujiao.pseer.com/wechat_static', // 静态资源路径 // assetsPath: 'https://coujiao.pseer.com/wechat_static', // 静态资源路径
// assetsPath: 'http://localhost:8211/static', // 静态资源路径 assetsPath: 'http://localhost:8211/static', // 静态资源路径
// baseUrl: 'https://www.coujio.com/front-api', // 后台接口请求地址 // baseUrl: 'https://www.coujio.com/front-api', // 后台接口请求地址
baseUrl: 'https://coujiao.pseer.com/front-api', // 后台接口请求地址 baseUrl: 'https://coujiao.pseer.com/front-api', // 后台接口请求地址
// baseUrl: 'http://10.24.3.185:8883/front-api', // baseUrl: 'http://10.24.3.185:8883/front-api',
......
...@@ -31,6 +31,29 @@ ...@@ -31,6 +31,29 @@
<text>3.核销验券之后的券会进入到我的优惠券当中,可去门店预约时自动抵扣使用,若显示无法使用团购券,请核验团购券的可用门店、可用时间段。团购券过期后自动作废,不退款不更换不延期,请尽快使用。</text> <text>3.核销验券之后的券会进入到我的优惠券当中,可去门店预约时自动抵扣使用,若显示无法使用团购券,请核验团购券的可用门店、可用时间段。团购券过期后自动作废,不退款不更换不延期,请尽快使用。</text>
</view> </view>
</view> </view>
<uni-popup ref="popupStoreList" type="center">
<view class="flex-col pop-store-list">
<!-- <image style="width: 699upx;" :src="assetsPath +'/pop_bg.png'" mode="widthFix"></image> -->
<view class="flex-col absolute">
<view class="content-box">
<view class="title margin-left-lg">
<text style="color: #512C19;" class="text-xl text-bold">温馨提示</text>
</view>
<view class="close-box text-xxl margin-right" @tap="onStoreClose(true)">
<text class="cuIcon-roundclosefill" style="color: #bf9e62;"></text>
</view>
</view>
<view class="tip-text">
<text class="text-title" style="color: #512C19;">当前优惠券适用以下门店,请选择即将预定的门店:</text>
</view>
<!-- 展示所有房间列表 -->
<view class="store-box">
<StoreList style="width: 100%;" v-model="popStoreList" @change="onStoreChage"></StoreList>
</view>
</view>
</view>
</uni-popup>
<uni-popup ref="popup" type="center"> <uni-popup ref="popup" type="center">
<view class="content-box"> <view class="content-box">
<view class="content"> <view class="content">
...@@ -62,12 +85,17 @@ ...@@ -62,12 +85,17 @@
<script> <script>
import config from "@/config/index.config" import config from "@/config/index.config"
import {couponChecked} from "@/api/coupon.js"; import {couponChecked,getStoreListByCouponCode,getCouponByCode} from "@/api/coupon.js";
import moment from "@/common/moment_zh_cn.js"; import moment from "@/common/moment_zh_cn.js";
import StoreList from "@/components/storeList/couponStoreList"
export default { export default {
components: {
StoreList
},
data() { data() {
return { return {
hostUrl: config.hostUrl,
assetsPath:config.assetsPath, assetsPath:config.assetsPath,
code:"", code:"",
openShopUuid:'', openShopUuid:'',
...@@ -81,9 +109,12 @@ ...@@ -81,9 +109,12 @@
name:"抖音" name:"抖音"
} }
], ],
storeId:'',
couponInfo:'', couponInfo:'',
eventChannel:null, eventChannel:null,
orderPage:false orderPage:false,
popStoreList:[],
qrCode:''
}; };
}, },
filters:{ filters:{
...@@ -97,8 +128,10 @@ ...@@ -97,8 +128,10 @@
console.log(data,99999) console.log(data,99999)
if(data.orderPage){ if(data.orderPage){
this.orderPage = true this.orderPage = true
this.storeId = data.storeId
}else{ }else{
this.orderPage = false this.orderPage = false
this.storeId = ''
} }
}) })
}, },
...@@ -112,21 +145,70 @@ ...@@ -112,21 +145,70 @@
}) })
return return
} }
this.qrCode = this.code.split(" ").join("")
if(/http/g.test(this.qrCode)){
this.code = ""
}
uni.showLoading({ uni.showLoading({
title:"券码核验中" title:'加载中...'
}) })
getStoreListByCouponCode({
let qrCode = this.code.split(" ").join("") code: this.qrCode,
if(/http/g.test(qrCode)){ longitude:uni.getStorageSync("longitude"),
this.code = "" latitude:uni.getStorageSync("latitude")
}).then(res=>{
uni.hideLoading();
console.log(res,9999)
if(res.data.code ==200 && res.data.data.length){
this.popStoreList = res.data.data.map(item => {
return {
...item,
images: item.images ? item.images.split(",").map(val => this.hostUrl +
val) : []
}
});
if(this.orderPage){
this.onExchangeCoupon(this.qrCode,this.storeId)
}else{
this.$refs.popupStoreList.open();
}
}else{
uni.showToast({
icon:"none",
title:res.data.msg
})
}
})
},
onStoreChage(val){
console.log(val,90909)
let info = this.popStoreList.find(item=>item.id === val)
if(info.status ==1){
this.$refs.popupStoreList.close();
this.storeId = val;
this.onExchangeCoupon(this.qrCode,this.storeId)
} else{
uni.showToast({
icon:"none",
title:"门店维护中,请选择其他门店"
})
} }
},
onExchangeCoupon(code,storeId){
let that = this;
uni.showLoading({
title:"券码核验中"
})
couponChecked({ couponChecked({
code: qrCode, code,
storeId:uni.getStorageSync('storeId') storeId
}).then(res=>{ }).then(res=>{
uni.hideLoading() uni.hideLoading()
if(res.data.code === 200){ if(res.data.code === 200){
this.couponInfo = res.data.data
uni.showToast({ uni.showToast({
icon:"success", icon:"success",
title:"核验成功", title:"核验成功",
...@@ -134,13 +216,18 @@ ...@@ -134,13 +216,18 @@
setTimeout(()=>{ setTimeout(()=>{
if(that.orderPage){ if(that.orderPage){
that.eventChannel.emit('acceptData', {data: true}); that.eventChannel.emit('acceptData', {data: true});
uni.navigateBack()
}else{
getCouponByCode({
code: that.qrCode
}).then(result =>{
that.couponInfo = res.data.data;
that.$refs.popup.open();
})
} }
uni.navigateBack()
},1000) },1000)
} }
}) })
// this.$refs.popup.open()
}else{ }else{
uni.showToast({ uni.showToast({
icon:"none", icon:"none",
...@@ -162,6 +249,7 @@ ...@@ -162,6 +249,7 @@
}) })
}, },
onNavHome(){ onNavHome(){
uni.setStorageSync("storeId",this.storeId)
uni.switchTab({ uni.switchTab({
url:"/pages/index/index" url:"/pages/index/index"
}) })
...@@ -303,4 +391,41 @@ ...@@ -303,4 +391,41 @@
} }
} }
} }
.pop-store-list {
position: relative;
display: flex;
flex-direction: column;
width: 92vw;
height: 78vh;
background-color: #ffffff;
border-radius: 20upx;
box-shadow: 0 6upx 16upx rgba(255, 0, 255, 0.34);
padding-bottom: 20upx;
overflow: hidden;
.content-box {
display: flex;
flex-direction: row;
justify-content: space-between;
align-items: center;
height: 9%;
width: 100%;
padding-top: 1%;
.close-box {}
}
.tip-text {
width: 90%;
margin: 0 auto 10px;
}
.store-box {
display: flex;
flex: 1;
width: 100%;
overflow-y: auto;
padding: 0 2% 3%;
}
}
</style> </style>
...@@ -664,7 +664,9 @@ ...@@ -664,7 +664,9 @@
} else { } else {
this.duration = Number(this.distanceMode[this.distanceIndex].duration); this.duration = Number(this.distanceMode[this.distanceIndex].duration);
} }
let startDateTime = moment().format("YYYY-MM-DD HH:mm:ss")
this.onTransiteForDate(res.data.data,startDateTime,this.duration)
this.dateIntervalList = res.data.data.map((item, index) => { this.dateIntervalList = res.data.data.map((item, index) => {
return { return {
...item, ...item,
...@@ -1374,7 +1376,10 @@ ...@@ -1374,7 +1376,10 @@
uni.navigateTo({ uni.navigateTo({
url: "/pages/couponCheck/couponCheck?openShopUuid=" + this.roomInfo.openShopUuid, url: "/pages/couponCheck/couponCheck?openShopUuid=" + this.roomInfo.openShopUuid,
success: (res) => { success: (res) => {
res.eventChannel.emit('acceptDataFromOpenerPage', { orderPage:true }) res.eventChannel.emit('acceptDataFromOpenerPage', {
orderPage:true ,
storeId: that.roomInfo.storeId
})
}, },
events: { events: {
// 为指定事件添加一个监听器,获取被打开页面传送到当前页面的数据 // 为指定事件添加一个监听器,获取被打开页面传送到当前页面的数据
...@@ -1485,8 +1490,58 @@ ...@@ -1485,8 +1490,58 @@
} }
return obj; return obj;
}, },
//list(Array):当前日期的时间占用情况
//startDateTime(YYYY-MM-DD HH:mm:ss): 开始时间
//duration(Number||String): 时长,小时或分钟
//durationType(Number) : 时长类型,1:小时,2:分钟
// 返回值
// list,当前日期的时间占用情况,已被预定、已选择、可预定
//startDateTime(YYYY-MM-DD HH:mm:ss): 开始详细时间
//endDateTime(YYYY-MM-DD HH:mm:ss): 结束详细时间
//startTime(HH:mm): 开始时间,显示使用
//endTime(HH:mm): 结束时间,显示使用
//duration(Number): 时长,仅分钟
onTransiteForDate(list=[],startDateTime,duration,durationType=1){
console.log(list,"数据列表")
// 计算出时长,使用分钟计算
let m = duration
if(durationType==1){
m = duration*60
}
// 开始时间的毫秒数
let startStamp = moment(startDateTime).valueOf();
let endStamp = startStamp+ m*60*1000;
console.log(startStamp,endStamp)
console.log(endStamp-startStamp)
// 记录可开始的时间点
let startPoint = '';
let endPoint = ''
list.forEach((item,index)=>{
console.log(item)
// 如果开始时间有,则需要计算可预定的时长
if(startPoint){
if(item.status ===0){
endPoint = moment(item.timeHour).format("YYYY-MM-DD HH:59:59")
}else{
endPoint = moment(item.startHoldTime).format("YYYY-MM-DD HH:mm:ss")
}
}else{
// 如果开始时间没有,则需要赋值开始时间
if(item.status ===0){
startPoint = moment(item.timeHour).format("YYYY-MM-DD HH:mm:ss")
}else{
// 当前小时时间是被占用状态且低于59分钟
let mm = moment(item.endHoldTime).format("mm")
if(mm<59){
startPoint = moment(item.endHoldTime).format("YYYY-MM-DD HH:mm:ss")
}
}
}
})
},
onCheckDate() { onCheckDate() {
// 今天可连续选择的时段 // 今天可连续选择的时段
let selectNum = 0; let selectNum = 0;
//预定节点 //预定节点
......
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