Commit 6e385ba6 by zhangzhen

优化各个模块细节

parent 3ca8cbb2
<script>
import Vue from 'vue'
import {
dictList
} from "@/api/index.js"
export default {
onLaunch: function(e) {
// 版本更新机制
const updateManager = wx.getUpdateManager()
updateManager.onCheckForUpdate(function (res) {
if(!res.hasUpdate){
console.log("目前是最新版",res.hasUpdate);
updateManager.onCheckForUpdate(function(res) {
if (!res.hasUpdate) {
console.log("目前是最新版", res.hasUpdate);
}
})
updateManager.onUpdateReady(function () {
updateManager.onUpdateReady(function() {
updateManager.applyUpdate()
})
......@@ -42,6 +46,20 @@
// #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>
......@@ -53,9 +71,11 @@
@import "./colorui/main.css";
@import "./colorui/icon.css";
@import "./colorui/animation.css";
page {
background-color: #f9f9f9;
}
// 隐藏滚动条
::-webkit-scrollbar {
width: 0;
......
......@@ -29,3 +29,15 @@ export const updateUserInfo=(data)=>{
let url=`/consumer/edit`
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"
// 获取查询我的优惠券
// 用户订单列表
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)=>{
let url=`/order/creat`
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) => {
}
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) {
// uni.navigateTo({
// url: '/pages/login/login'
// })
// }
if (![401, 200].includes(config.data.code)) {
if (urls.some(item => item.test(config.config.url)) && config.data.code == 401) {
uni.navigateTo({
url: '/pages/login/login'
})
}
if (![401, 200, 500].includes(config.data.code)) {
uni.showToast({
icon: "none",
title: config.data.msg
......
......@@ -61,6 +61,9 @@
}
}
},
mounted() {
this.storeTypeEnum = this.getDictItem("store_type");
},
methods: {
onLoading() {
this.list = this.value;
......
<template>
<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>
</view>
</view>
......@@ -55,7 +55,11 @@
mounted() {
},
methods:{}
methods:{
onHandle(val){
console.log(val)
}
}
}
</script>
......
......@@ -99,6 +99,15 @@
}
}
,{
"path" : "pages/orderResult/orderResult",
"style" :
{
"navigationBarTitleText": "下单完成",
"enablePullDownRefresh": false
}
}
],
"globalStyle": {
"navigationStyle": "default",
......
<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' }">
<image src="../../static/banner.png" mode="widthFix"></image>
</view>
......@@ -151,7 +151,8 @@
label: "8小时"
}
],
show:true
show:true,
timer:null
}
},
onShow() {
......@@ -251,11 +252,25 @@
})
},
onTouchStart(){
this.show = false
this.timer = null;
this.show = true;
},
onTouchMove(){
if(!this.timer){
this.timer = setTimeout(()=>{
this.show = false;
},200)
}
},
onTouchEnd(){
if(this.timer){
clearTimeout(this.timer)
}
if(!this.show){
this.show = true
}
}
},
}
</script>
......
......@@ -119,9 +119,13 @@ import {checkPhone} from "@/utils/tools.js"
},
//先查看用户有无注册过
onCheckUserLogin(e) {
uni.showLoading({
title:"查询中"
})
wx.login({
success: (res) => {
login(res.code).then(res => {
uni.hideLoading()
console.log(res, "检查用户是否登录")
if(res.data.code == 200){
if(res.data.data.type==="login"){
......@@ -145,6 +149,9 @@ import {checkPhone} from "@/utils/tools.js"
onRegister(key){
wx.login({
success: (res) => {
uni.showLoading({
title:"注册登录中"
})
register({
code:res.code,
phone:this.phone,
......@@ -152,6 +159,7 @@ import {checkPhone} from "@/utils/tools.js"
captcha: this.captcha,
key
}).then(res => {
uni.hideLoading()
console.log(res, "为用户注册")
if(res.data.code == 200){
this.num = 60;
......
......@@ -76,12 +76,19 @@
</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>
</template>
<script>
import {
getUserInfo
getUserInfo,
loginOut
} from "@/api/index.js"
import orderIcon from "@/static/order_icon.png";
......@@ -168,6 +175,23 @@ import cleanIcon from "@/static/clean_icon.png";
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";
margin-top: 30upx;
}
}
.login-out{
width: 94%;
margin-top: 40upx;
}
</style>
\ No newline at end of file
......@@ -137,13 +137,13 @@
<text class="text-title text-lg">套餐优惠</text>
<text class="text-title text-lg text-pink">{{couponList.length?'-¥20.00':'0'}} </text>
</view>
<view class="flex-between price">
<!-- <view class="flex-between price">
<text class="text-title text-lg">账户余额</text>
<view class="flex-row text-pink">
<text class="text-title text-lg">0.00 元</text>
<text class="text-title cuIcon-right "></text>
</view>
</view>
</view> -->
</view>
<view class="pay-content-box">
<view class="flex-row">
......@@ -215,7 +215,8 @@
getUseCoupon
} from "@/api/coupon"
import {
orderCreate
orderCreate,
computePrice
} from "@/api/order"
export default {
......@@ -231,6 +232,7 @@
}
return {
id: '',
orderType: 0,
hostUrl: config.hostUrl,
roomInfo: {
images: []
......@@ -242,17 +244,16 @@
index: 0,
orderTypeList: [{
label: "小时模式",
type: "1"
type: 1
},
{
label: "优惠模式",
type: "2"
label: "套餐模式",
type: 2
}
],
// 时长选择
distanceIndex: 0,
distanceMode: [
{
distanceMode: [{
duration: 4
},
{
......@@ -268,12 +269,14 @@
// 套餐
modeIndex: 0,
packageMode: [{
id:'',
label: "",
duration: 4,
originalPrice: 100,
realPrice: 78
},
{
id:'',
label: "",
duration: 8,
originalPrice: 200,
......@@ -286,16 +289,19 @@
checkedIndex: [],
checkedDateList: [0, 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"
],
minuteList: ['0', "30"],
minuteList: ['00', "30"],
orderTypeEnum: {
1: "预定",
2: "续费",
3: "充值"
},
editDuration: []
editDuration: [],
checkedCouponInfo:{
id:''
}
};
},
onLoad(option) {
......@@ -306,12 +312,38 @@
this.onLoading()
},
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() {
let dateObj = this.onSetDateTime(this.startTime,this.endTime);
console.log(this.startTime,this.endTime,909090)
getUseCoupon({
storeId: this.roomInfo.storeId,
roomId: this.roomInfo.id,
preStartDate: "2023-10-25 14:00",
preEndDate: "2023-10-25 18:00"
preStartDate: dateObj.startDate,
preEndDate: dateObj.endDate
}).then(res => {
if (res.statusCode == 200) {
if (res.data && res.data.length) {
......@@ -319,6 +351,7 @@
this.packageMode = res.data;
}
}
this.onComputePrice();
})
},
onLoading() {
......@@ -369,7 +402,7 @@
this.onSetEndTime()
},
onDurationChange(i) {
if(i>= this.distanceMode.length-1){
if (i >= this.distanceMode.length - 1) {
this.onEditDuration();
return
}
......@@ -397,7 +430,8 @@
} else {
num = item
}
return num
return num>=10 ? num : `0${num}`
}).join(":")
} else {
// 小时模式
......@@ -413,7 +447,7 @@
} else {
num = item
}
return num
return num>=10 ? num : `0${num}`
}).join(":")
}
......@@ -446,7 +480,7 @@
},
onSelectedDate() {
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, "开始时间")
//重新设置结束时间
this.onSetEndTime()
......@@ -454,7 +488,7 @@
},
onEditDuration() {
if(this.editDuration.length){
if (this.editDuration.length) {
this.durationIndex = this.editDuration
}
this.$refs.popupDuration.open()
......@@ -470,7 +504,7 @@
this.distanceMode[this.distanceIndex] = {
duration: this.editDuration[0] + 1,
}
console.log(this.distanceMode,"1asdasdasd")
console.log(this.distanceMode, "1asdasdasd")
this.onHideModal()
this.$forceUpdate();
......@@ -481,6 +515,9 @@
this.$refs.popupDuration.close()
},
onOrderCreate() {
uni.showLoading({
title: "下单中..."
})
orderCreate({
storeId: this.roomInfo.storeId,
roomId: this.roomInfo.id,
......@@ -493,7 +530,42 @@
payFee: 0
}).then(res => {
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 @@
</view>
</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>
<!-- <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"
:loadmore-text="loadmoreText" :nomore-text="nomoreText" />
</view> -->
</view>
</view>
</template>
<script>
import {
orderList
} from "@/api/order.js"
export default {
data() {
return {
......@@ -46,13 +85,33 @@
label: "退单",
value: "4",
}
]
],
queryParams: {
status: "",
pageNum: 1,
pageSize: 10
},
};
},
onLoad() {
},
onShow() {
this.onLoading()
},
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) {
console.log(e, 99999)
this.statusIndex = e.currentTarget.dataset.id;
......@@ -66,5 +125,26 @@
display: flex;
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>
\ 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>
<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="bar-title" :style="{height:CustomBar-StatusBar+'px'}">
<text class="text-lg text-white text-bold">选择门店</text>
......@@ -73,14 +73,14 @@
pageNum: 1,
pageSize: 20
},
show:true
show:true,
timer:null,
storeTypeEnum:{},
};
},
onLoad() {
this.onLoading()
this.onLoading()
},
methods: {
onLoading() {
......@@ -150,11 +150,26 @@
})
},
onTouchStart(){
this.show = false
this.timer = null;
this.show = true;
},
onTouchMove(){
if(!this.timer){
this.timer = setTimeout(()=>{
this.show = false;
},200)
}
},
onTouchEnd(){
if(this.timer){
clearTimeout(this.timer)
}
if(!this.show){
this.show = true
}
}
},
}
</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