Commit 6e385ba6 by zhangzhen

优化各个模块细节

parent 3ca8cbb2
<script> <script>
import Vue from 'vue' import Vue from 'vue'
import {
dictList
} from "@/api/index.js"
export default { export default {
onLaunch: function(e) { onLaunch: function(e) {
// 版本更新机制 // 版本更新机制
const updateManager = wx.getUpdateManager() const updateManager = wx.getUpdateManager()
updateManager.onCheckForUpdate(function (res) { updateManager.onCheckForUpdate(function(res) {
if(!res.hasUpdate){ if (!res.hasUpdate) {
console.log("目前是最新版",res.hasUpdate); console.log("目前是最新版", res.hasUpdate);
} }
}) })
updateManager.onUpdateReady(function () { updateManager.onUpdateReady(function() {
updateManager.applyUpdate() updateManager.applyUpdate()
}) })
...@@ -42,6 +46,20 @@ ...@@ -42,6 +46,20 @@
// #endif // #endif
} }
}) })
dictList().then(res => {
console.log(res, 90909090)
Vue.prototype.dicts = res.data.data;
Vue.prototype.getDictItem = (dictType) => {
let arr = Vue.prototype.dicts.filter(item => item.dictType === dictType)
let obj={};
arr[0].dictDatas.forEach(val => {
obj[val.dictValue] = val.dictLabel
})
return obj
}
})
} }
} }
</script> </script>
...@@ -53,9 +71,11 @@ ...@@ -53,9 +71,11 @@
@import "./colorui/main.css"; @import "./colorui/main.css";
@import "./colorui/icon.css"; @import "./colorui/icon.css";
@import "./colorui/animation.css"; @import "./colorui/animation.css";
page { page {
background-color: #f9f9f9; background-color: #f9f9f9;
} }
// 隐藏滚动条 // 隐藏滚动条
::-webkit-scrollbar { ::-webkit-scrollbar {
width: 0; width: 0;
......
...@@ -29,3 +29,15 @@ export const updateUserInfo=(data)=>{ ...@@ -29,3 +29,15 @@ export const updateUserInfo=(data)=>{
let url=`/consumer/edit` let url=`/consumer/edit`
return http.post(url,data) return http.post(url,data)
} }
// 退出登录操作
export const loginOut=()=>{
let url=`/login/logout`
return http.get(url)
}
// 获取全部字典
export const dictList=()=>{
let url=`/dict/type/optionselect`
return http.get(url)
}
import http from "@/common/vmeitime-http/index.js" import http from "@/common/vmeitime-http/index.js"
// 获取查询我的优惠券 // 用户订单列表
export const orderList=(data)=>{
let url=`/order/list`
return http.get(url,data)
}
// 订单详情
export const getOrderInfo=(id)=>{
let url=`/order/`+id
return http.get(url,data)
}
// 用户下单
export const orderCreate=(data)=>{ export const orderCreate=(data)=>{
let url=`/order/creat` let url=`/order/creat`
return http.post(url,data) return http.post(url,data)
} }
// 计算价格
export const computePrice=(data)=>{
let url=`/order/computed/price`
return http.post(url,data)
}
...@@ -64,15 +64,20 @@ http.interceptor.response = (config) => { ...@@ -64,15 +64,20 @@ http.interceptor.response = (config) => {
} }
let urls = [ let urls = [
/\/appConfig/g, /\/consumer\/info/g,
/\/consumer\/edit/g,
/\/order\/creat/g,
/\/order\/list/g,
/\/consumerCoupon\/list/g,
/\/consumerCoupon\/query/g
] ]
// if (!urls.some(item => item.test(config.config.url)) && config.data.code == 401) { if (urls.some(item => item.test(config.config.url)) && config.data.code == 401) {
// uni.navigateTo({ uni.navigateTo({
// url: '/pages/login/login' url: '/pages/login/login'
// }) })
// } }
if (![401, 200].includes(config.data.code)) { if (![401, 200, 500].includes(config.data.code)) {
uni.showToast({ uni.showToast({
icon: "none", icon: "none",
title: config.data.msg title: config.data.msg
......
...@@ -61,6 +61,9 @@ ...@@ -61,6 +61,9 @@
} }
} }
}, },
mounted() {
this.storeTypeEnum = this.getDictItem("store_type");
},
methods: { methods: {
onLoading() { onLoading() {
this.list = this.value; this.list = this.value;
......
<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' }"> <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">{{show ? item.name:item.sortName}}</text> <text class="text-white text-bold text-xl">{{show ? item.name:item.sortName}}</text>
</view> </view>
</view> </view>
...@@ -55,7 +55,11 @@ ...@@ -55,7 +55,11 @@
mounted() { mounted() {
}, },
methods:{} methods:{
onHandle(val){
console.log(val)
}
}
} }
</script> </script>
......
...@@ -99,6 +99,15 @@ ...@@ -99,6 +99,15 @@
} }
} }
,{
"path" : "pages/orderResult/orderResult",
"style" :
{
"navigationBarTitleText": "下单完成",
"enablePullDownRefresh": false
}
}
], ],
"globalStyle": { "globalStyle": {
"navigationStyle": "default", "navigationStyle": "default",
......
<template> <template>
<view class="home" @touchstart="onTouchStart" @touchend="onTouchEnd"> <view class="home" @touchstart="onTouchStart" @touchmove="onTouchMove" @touchend="onTouchEnd">
<view class="header-content" :style="{height: statusBarHeight + 210+'px',paddingTop:statusBarHeight+'px' }"> <view class="header-content" :style="{height: statusBarHeight + 210+'px',paddingTop:statusBarHeight+'px' }">
<image src="../../static/banner.png" mode="widthFix"></image> <image src="../../static/banner.png" mode="widthFix"></image>
</view> </view>
...@@ -151,7 +151,8 @@ ...@@ -151,7 +151,8 @@
label: "8小时" label: "8小时"
} }
], ],
show:true show:true,
timer:null
} }
}, },
onShow() { onShow() {
...@@ -251,11 +252,25 @@ ...@@ -251,11 +252,25 @@
}) })
}, },
onTouchStart(){ onTouchStart(){
this.show = false this.timer = null;
this.show = true;
},
onTouchMove(){
if(!this.timer){
this.timer = setTimeout(()=>{
this.show = false;
},200)
}
}, },
onTouchEnd(){ onTouchEnd(){
if(this.timer){
clearTimeout(this.timer)
}
if(!this.show){
this.show = true this.show = true
} }
}
}, },
} }
</script> </script>
......
...@@ -119,9 +119,13 @@ import {checkPhone} from "@/utils/tools.js" ...@@ -119,9 +119,13 @@ import {checkPhone} from "@/utils/tools.js"
}, },
//先查看用户有无注册过 //先查看用户有无注册过
onCheckUserLogin(e) { onCheckUserLogin(e) {
uni.showLoading({
title:"查询中"
})
wx.login({ wx.login({
success: (res) => { success: (res) => {
login(res.code).then(res => { login(res.code).then(res => {
uni.hideLoading()
console.log(res, "检查用户是否登录") console.log(res, "检查用户是否登录")
if(res.data.code == 200){ if(res.data.code == 200){
if(res.data.data.type==="login"){ if(res.data.data.type==="login"){
...@@ -145,6 +149,9 @@ import {checkPhone} from "@/utils/tools.js" ...@@ -145,6 +149,9 @@ import {checkPhone} from "@/utils/tools.js"
onRegister(key){ onRegister(key){
wx.login({ wx.login({
success: (res) => { success: (res) => {
uni.showLoading({
title:"注册登录中"
})
register({ register({
code:res.code, code:res.code,
phone:this.phone, phone:this.phone,
...@@ -152,6 +159,7 @@ import {checkPhone} from "@/utils/tools.js" ...@@ -152,6 +159,7 @@ import {checkPhone} from "@/utils/tools.js"
captcha: this.captcha, captcha: this.captcha,
key key
}).then(res => { }).then(res => {
uni.hideLoading()
console.log(res, "为用户注册") console.log(res, "为用户注册")
if(res.data.code == 200){ if(res.data.code == 200){
this.num = 60; this.num = 60;
......
...@@ -76,12 +76,19 @@ ...@@ -76,12 +76,19 @@
</view> </view>
</view> </view>
</view> </view>
<view class="login-out" v-if="loginStatus">
<button class="cu-btn block bg-pink lg round" @tap="onLoginOut">
<text class="cuIcon-exit"></text>退出登录
</button>
</view>
</view> </view>
</template> </template>
<script> <script>
import { import {
getUserInfo getUserInfo,
loginOut
} from "@/api/index.js" } from "@/api/index.js"
import orderIcon from "@/static/order_icon.png"; import orderIcon from "@/static/order_icon.png";
...@@ -168,6 +175,23 @@ import cleanIcon from "@/static/clean_icon.png"; ...@@ -168,6 +175,23 @@ import cleanIcon from "@/static/clean_icon.png";
url:val.routePath url:val.routePath
}) })
} }
},
// 退出登录,解除手机号与当前微信的绑定
onLoginOut(){
uni.showLoading({
title:"加载中"
})
loginOut().then(res=>{
console.log(res)
if(res.data.code == 200){
uni.showToast({
icon:"none",
title:"用户已退出登录"
})
this.loginStatus = false;
uni.clearStorage();
}
})
} }
} }
} }
...@@ -280,4 +304,8 @@ import cleanIcon from "@/static/clean_icon.png"; ...@@ -280,4 +304,8 @@ import cleanIcon from "@/static/clean_icon.png";
margin-top: 30upx; margin-top: 30upx;
} }
} }
.login-out{
width: 94%;
margin-top: 40upx;
}
</style> </style>
\ No newline at end of file
...@@ -137,13 +137,13 @@ ...@@ -137,13 +137,13 @@
<text class="text-title text-lg">套餐优惠</text> <text class="text-title text-lg">套餐优惠</text>
<text class="text-title text-lg text-pink">{{couponList.length?'-¥20.00':'0'}} </text> <text class="text-title text-lg text-pink">{{couponList.length?'-¥20.00':'0'}} </text>
</view> </view>
<view class="flex-between price"> <!-- <view class="flex-between price">
<text class="text-title text-lg">账户余额</text> <text class="text-title text-lg">账户余额</text>
<view class="flex-row text-pink"> <view class="flex-row text-pink">
<text class="text-title text-lg">0.00 元</text> <text class="text-title text-lg">0.00 元</text>
<text class="text-title cuIcon-right "></text> <text class="text-title cuIcon-right "></text>
</view> </view>
</view> </view> -->
</view> </view>
<view class="pay-content-box"> <view class="pay-content-box">
<view class="flex-row"> <view class="flex-row">
...@@ -215,7 +215,8 @@ ...@@ -215,7 +215,8 @@
getUseCoupon getUseCoupon
} from "@/api/coupon" } from "@/api/coupon"
import { import {
orderCreate orderCreate,
computePrice
} from "@/api/order" } from "@/api/order"
export default { export default {
...@@ -231,6 +232,7 @@ ...@@ -231,6 +232,7 @@
} }
return { return {
id: '', id: '',
orderType: 0,
hostUrl: config.hostUrl, hostUrl: config.hostUrl,
roomInfo: { roomInfo: {
images: [] images: []
...@@ -242,17 +244,16 @@ ...@@ -242,17 +244,16 @@
index: 0, index: 0,
orderTypeList: [{ orderTypeList: [{
label: "小时模式", label: "小时模式",
type: "1" type: 1
}, },
{ {
label: "优惠模式", label: "套餐模式",
type: "2" type: 2
} }
], ],
// 时长选择 // 时长选择
distanceIndex: 0, distanceIndex: 0,
distanceMode: [ distanceMode: [{
{
duration: 4 duration: 4
}, },
{ {
...@@ -268,12 +269,14 @@ ...@@ -268,12 +269,14 @@
// 套餐 // 套餐
modeIndex: 0, modeIndex: 0,
packageMode: [{ packageMode: [{
id:'',
label: "", label: "",
duration: 4, duration: 4,
originalPrice: 100, originalPrice: 100,
realPrice: 78 realPrice: 78
}, },
{ {
id:'',
label: "", label: "",
duration: 8, duration: 8,
originalPrice: 200, originalPrice: 200,
...@@ -286,16 +289,19 @@ ...@@ -286,16 +289,19 @@
checkedIndex: [], checkedIndex: [],
checkedDateList: [0, 0], checkedDateList: [0, 0],
durationIndex: [0], durationIndex: [0],
hourList: ["0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12", "13", "14", "15", "16", hourList: ["00", "01", "02", "03", "04", "05", "06", "07", "08", "09", "10", "11", "12", "13", "14", "15", "16",
"17", "18", "19", "20", "21", "22", "23" "17", "18", "19", "20", "21", "22", "23"
], ],
minuteList: ['0', "30"], minuteList: ['00', "30"],
orderTypeEnum: { orderTypeEnum: {
1: "预定", 1: "预定",
2: "续费", 2: "续费",
3: "充值" 3: "充值"
}, },
editDuration: [] editDuration: [],
checkedCouponInfo:{
id:''
}
}; };
}, },
onLoad(option) { onLoad(option) {
...@@ -306,12 +312,38 @@ ...@@ -306,12 +312,38 @@
this.onLoading() this.onLoading()
}, },
methods: { methods: {
//计算支付金额
onComputePrice() {
uni.showLoading({
title:"计算价格中..."
})
let dateObj = this.onSetDateTime(this.startTime,this.endTime);
let params = {
storeId: this.roomInfo.storeId,
roomId: this.roomInfo.id,
buyType: this.orderTypeList[this.index].type,
couponId: this.checkedCouponInfo.id,
orderType: this.orderType,
preStartDate: dateObj.startDate,
preEndDate: dateObj.endDate
}
if(this.index>0){
params.packId = this.packageMode[this.modeIndex].id;
}
computePrice(params).then(res => {
uni.hideLoading()
console.log(res)
})
},
// 获取可用优惠券
onGetUseCoupon() { onGetUseCoupon() {
let dateObj = this.onSetDateTime(this.startTime,this.endTime);
console.log(this.startTime,this.endTime,909090)
getUseCoupon({ getUseCoupon({
storeId: this.roomInfo.storeId, storeId: this.roomInfo.storeId,
roomId: this.roomInfo.id, roomId: this.roomInfo.id,
preStartDate: "2023-10-25 14:00", preStartDate: dateObj.startDate,
preEndDate: "2023-10-25 18:00" preEndDate: dateObj.endDate
}).then(res => { }).then(res => {
if (res.statusCode == 200) { if (res.statusCode == 200) {
if (res.data && res.data.length) { if (res.data && res.data.length) {
...@@ -319,6 +351,7 @@ ...@@ -319,6 +351,7 @@
this.packageMode = res.data; this.packageMode = res.data;
} }
} }
this.onComputePrice();
}) })
}, },
onLoading() { onLoading() {
...@@ -369,7 +402,7 @@ ...@@ -369,7 +402,7 @@
this.onSetEndTime() this.onSetEndTime()
}, },
onDurationChange(i) { onDurationChange(i) {
if(i>= this.distanceMode.length-1){ if (i >= this.distanceMode.length - 1) {
this.onEditDuration(); this.onEditDuration();
return return
} }
...@@ -397,7 +430,8 @@ ...@@ -397,7 +430,8 @@
} else { } else {
num = item num = item
} }
return num
return num>=10 ? num : `0${num}`
}).join(":") }).join(":")
} else { } else {
// 小时模式 // 小时模式
...@@ -413,7 +447,7 @@ ...@@ -413,7 +447,7 @@
} else { } else {
num = item num = item
} }
return num return num>=10 ? num : `0${num}`
}).join(":") }).join(":")
} }
...@@ -446,7 +480,7 @@ ...@@ -446,7 +480,7 @@
}, },
onSelectedDate() { onSelectedDate() {
this.checkedDateList = this.checkedIndex; this.checkedDateList = this.checkedIndex;
this.startTime = `${this.checkedDateList[0]}:${this.minuteList[this.checkedDateList[1]]}`; this.startTime = `${this.hourList[this.checkedDateList[0]]}:${this.minuteList[this.checkedDateList[1]]}`;
console.log(this.startTime, "开始时间") console.log(this.startTime, "开始时间")
//重新设置结束时间 //重新设置结束时间
this.onSetEndTime() this.onSetEndTime()
...@@ -454,7 +488,7 @@ ...@@ -454,7 +488,7 @@
}, },
onEditDuration() { onEditDuration() {
if(this.editDuration.length){ if (this.editDuration.length) {
this.durationIndex = this.editDuration this.durationIndex = this.editDuration
} }
this.$refs.popupDuration.open() this.$refs.popupDuration.open()
...@@ -470,7 +504,7 @@ ...@@ -470,7 +504,7 @@
this.distanceMode[this.distanceIndex] = { this.distanceMode[this.distanceIndex] = {
duration: this.editDuration[0] + 1, duration: this.editDuration[0] + 1,
} }
console.log(this.distanceMode,"1asdasdasd") console.log(this.distanceMode, "1asdasdasd")
this.onHideModal() this.onHideModal()
this.$forceUpdate(); this.$forceUpdate();
...@@ -481,6 +515,9 @@ ...@@ -481,6 +515,9 @@
this.$refs.popupDuration.close() this.$refs.popupDuration.close()
}, },
onOrderCreate() { onOrderCreate() {
uni.showLoading({
title: "下单中..."
})
orderCreate({ orderCreate({
storeId: this.roomInfo.storeId, storeId: this.roomInfo.storeId,
roomId: this.roomInfo.id, roomId: this.roomInfo.id,
...@@ -493,7 +530,42 @@ ...@@ -493,7 +530,42 @@
payFee: 0 payFee: 0
}).then(res => { }).then(res => {
console.log(res, 909090) console.log(res, 909090)
uni.hideLoading()
if(res.data.code == 200){
uni.showToast({
icon: "success",
title: "下单成功",
success: () => {
setTimeout(() => {
uni.navigateTo({
url: "/pages/orderResult/orderResult?orderNo="+res.data.data.orderNo
}) })
}, 1000)
}
})
}else{
uni.showToast({
title: "下单失败"
})
}
})
},
// 将时间转换成完整日期
onSetDateTime(startTime,endTime){
let obj={
startDate:"",
endDate:''
}
let startArr = startTime.split(":")
let endArr = startTime.split(":")
obj.startDate =`${moment().format("YYYY-MM-DD")} ${startTime}:00`
if(Number(endArr[0])>=Number(startArr[0])){
obj.endDate =`${moment().add(1,"days").format("YYYY-MM-DD")} ${endTime}:00`
}else{
obj.endDate =`${moment().format("YYYY-MM-DD")} ${endTime}:00`
}
console.log(obj)
return obj;
} }
} }
} }
......
...@@ -8,15 +8,54 @@ ...@@ -8,15 +8,54 @@
</view> </view>
</view> </view>
</scroll-view> </scroll-view>
<view class="content-box">
<view class="list-content">
<view v-for="(item,index) in list" :key="index" class="list-item">
<view class="flex-between part-1">
<text class="text-title text-bold text-xl">一帆风顺(111)</text>
<text class="text-pink">待使用</text>
</view>
<view class="flex-between part-1">
<view class="">
<text>{{item.payType==1?'微信支付':'余额支付'}}:</text>
<text class="text-black text-bold text-lg">{{item.payPrice}}</text>
</view>
<view class="flex-row">
<text>{{item.orderType==1?'房间预定':'房间续订'}}</text>
</view>
</view>
<view class="flex-between part-1">
<text>优惠券抵扣</text>
<text>四小时75元优惠券</text>
</view>
<view class="flex-row part-1">
<text>订单编号:</text>
<text>{{item.orderNo}}</text>
</view>
<view class="flex-between part-1">
<text>使用时间:</text>
<text>{{item.preStartDate}} - {{item.preEndDate}}</text>
</view>
<view class="flex-between part-1">
<text>下单时间:</text>
<text>{{item.createTime}}</text>
</view>
</view>
</view>
</view>
<u-empty v-if="list.length == 0" text="未查询到相关订单" textColor='#C1C1C1'></u-empty> <u-empty v-if="list.length == 0" text="未查询到相关订单" textColor='#C1C1C1'></u-empty>
<!-- <view v-if="list.length" style="padding: 12px 6% 0;"> <view v-if="list.length" style="padding: 12px 6% 0;">
<u-loadmore :status="status" :icon="true" :line='true' :loading-text="loadingText" <u-loadmore :status="status" :icon="true" :line='true' :loading-text="loadingText"
:loadmore-text="loadmoreText" :nomore-text="nomoreText" /> :loadmore-text="loadmoreText" :nomore-text="nomoreText" />
</view> --> </view>
</view> </view>
</template> </template>
<script> <script>
import {
orderList
} from "@/api/order.js"
export default { export default {
data() { data() {
return { return {
...@@ -46,13 +85,33 @@ ...@@ -46,13 +85,33 @@
label: "退单", label: "退单",
value: "4", value: "4",
} }
] ],
queryParams: {
status: "",
pageNum: 1,
pageSize: 10
},
}; };
}, },
onLoad() { onLoad() {
}, },
onShow() {
this.onLoading()
},
methods: { methods: {
onLoading() {
uni.showLoading({
title: '加载中'
})
orderList(this.queryParams).then(res => {
console.log(res)
uni.hideLoading()
if (res.data.code == 200) {
this.list = res.data.rows
}
})
},
tabSelect(e) { tabSelect(e) {
console.log(e, 99999) console.log(e, 99999)
this.statusIndex = e.currentTarget.dataset.id; this.statusIndex = e.currentTarget.dataset.id;
...@@ -66,5 +125,26 @@ ...@@ -66,5 +125,26 @@
display: flex; display: flex;
flex-direction: column; flex-direction: column;
.content-box {
display: flex;
flex-direction: column;
.list-content{
display: flex;
flex-direction: column;
align-items: center;
.list-item{
width: 94%;
padding: 30upx 20upx;
border-radius: 20upx;
background-color: #ffffff;
margin-top: 30upx;
.part-1{
display: flex;
align-items: center;
padding: 10upx;
}
}
}
}
} }
</style> </style>
\ No newline at end of file
<template>
<view>
</view>
</template>
<script>
export default {
data() {
return {
orderNo:''
};
},
onLoad(option) {
this.orderNo = option.orderNo
},
methods:{
onLoading(){
}
}
}
</script>
<style lang="scss">
</style>
<template> <template>
<view class="room-list" @touchstart="onTouchStart" @touchend="onTouchEnd"> <view class="room-list" @touchstart="onTouchStart" @touchmove="onTouchMove" @touchend="onTouchEnd">
<view class="header-top" :style="{height:CustomBar+50+'px', paddingTop:StatusBar+'px'}"> <view class="header-top" :style="{height:CustomBar+50+'px', paddingTop:StatusBar+'px'}">
<view class="bar-title" :style="{height:CustomBar-StatusBar+'px'}"> <view class="bar-title" :style="{height:CustomBar-StatusBar+'px'}">
<text class="text-lg text-white text-bold">选择门店</text> <text class="text-lg text-white text-bold">选择门店</text>
...@@ -73,14 +73,14 @@ ...@@ -73,14 +73,14 @@
pageNum: 1, pageNum: 1,
pageSize: 20 pageSize: 20
}, },
show:true show:true,
timer:null,
storeTypeEnum:{},
}; };
}, },
onLoad() { onLoad() {
this.onLoading()
this.onLoading()
}, },
methods: { methods: {
onLoading() { onLoading() {
...@@ -150,11 +150,26 @@ ...@@ -150,11 +150,26 @@
}) })
}, },
onTouchStart(){ onTouchStart(){
this.show = false this.timer = null;
this.show = true;
},
onTouchMove(){
if(!this.timer){
this.timer = setTimeout(()=>{
this.show = false;
},200)
}
}, },
onTouchEnd(){ onTouchEnd(){
if(this.timer){
clearTimeout(this.timer)
}
if(!this.show){
this.show = true this.show = true
} }
}
}, },
} }
</script> </script>
......
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