Commit f27b898b by zhangzhen

功能完善

parent f2b55c49
......@@ -40,7 +40,8 @@
sortName:"客"
}
],
timer:null
timer:null,
orderInfo:{}
};
},
watch:{
......@@ -65,8 +66,8 @@
methods:{
onHandle(val,index){
console.log(val,index)
if(index===0){
this.onGetOrderByAvailable()
if([0,1].includes(index)){
this.onGetOrderByAvailable(index)
return
}
if(val.routePath){
......@@ -75,13 +76,23 @@
})
}
},
onGetOrderByAvailable(){
onGetOrderByAvailable(i){
getOrderByAvailable().then(res=>{
console.log(res)
if(res.data.code === 200){
if(res.data.data&&res.data.data.length===1){
this.orderNo = res.data.data[0].orderNo;
this.orderInfo = res.data.data[0];
if(i === 1){
// 去续单
uni.navigateTo({
url:`/pages/order/order?roomId=${this.orderInfo.roomId}&orderNo=${this.orderInfo.orderNo}`
})
}else{
// 去开门
this.onOpenDoor()
}
}else if(res.data.data&&res.data.data.length > 1){
uni.switchTab({
url:"/pages/orderRecord/orderRecord"
......@@ -89,7 +100,7 @@
}else{
uni.showToast({
icon:"none",
title:"暂无可用的订单"
title:"暂无可用的订单,请先下单预约哦!"
})
}
}else{
......@@ -104,15 +115,12 @@
uni.showLoading({
title:"开门中..."
})
openDoor(this.orderNo).then(res=>{
openDoor(this.orderInfo.orderNo).then(res=>{
uni.hideLoading()
uni.showToast({
icon:"none",
title:res.data.msg
})
// if(res.data.code ==200){
// }
})
}
}
......
......@@ -31,7 +31,7 @@
{
"path": "pages/order/order",
"style": {
"navigationBarTitleText": "预约",
"navigationBarTitleText": "房间预约",
"navigationStyle": "default"
}
},
......@@ -135,6 +135,14 @@
"navigationBarTitleText" : "保洁记录",
"enablePullDownRefresh" : false
}
},
{
"path": "pages/setUserInfo/index",
"style": {
"navigationBarTitleText": "资料修改",
"enablePullDownRefresh" : false,
"navigationStyle": "custom"
}
}
],
......
......@@ -162,7 +162,7 @@ import NoLogin from "@/components/noLogin/noLogin"
</script>
<style>
page{
background-color: #ffffff;
background-color: #f1f1f1;
}
</style>
<style lang="scss" scoped>
......
......@@ -4,25 +4,28 @@
<view class="header-content-box">
<view v-if="loginStatus" class="login-content">
<view class="flex-1 flex-row">
<view class="cu-avatar xl round margin-left"
style="background-image:url(https://ossweb-img.qq.com/images/lol/web201310/skin/big25002.jpg);">
<view class="cu-avatar xl round margin-left">
<image class="avatar-img" :src="userInfo.avatar|| assetsPath+'/cart.png'" mode="scaleToFill"></image>
</view>
<view class="flex-col margin-left">
<text class="text-title text-lg text-white text-bold text-xxl">{{userInfo.nickName||"凑角001"}}</text>
<view class="flex-row margin-top">
<text class="cuIcon-hotfill text-white"></text>
<view class="flex-row" style="margin-top: 10rpx;">
<!-- <text class="cuIcon-hotfill text-white"></text> -->
<text class="text-white text-lg">会员用户</text>
</view>
</view>
<view class="nav-right" @tap="onNavToSetUserInfo">
<text class="text-white text-xl">修改资料</text>
</view>
</view>
<view class="flex-row amount-coupon">
<view class="flex-col">
<!-- <view class="flex-col">
<text class="text-white text-xl">余额</text>
<text class="text-white text-xl">{{(Number(userInfo.amount)+Number(userInfo.freeAmount)).toFixed(2)}}</text>
</view>
<view class="line">
<view class="line"></view> -->
</view>
<view class="flex-col" @tap="onNavToMyCoupon">
<text class="text-white text-xl">优惠券</text>
<text class="text-white text-xl">{{userInfo.number|| 0}}</text>
......@@ -104,13 +107,13 @@
type:"",
show:true
},
{
label:"消费记录",
iconUrl:config.assetsPath+'/record_icon.png',
routePath:"",
type:"",
show:true
},
// {
// label:"消费记录",
// iconUrl:config.assetsPath+'/record_icon.png',
// routePath:"",
// type:"",
// show:true
// },
// {
// label:"立即充值",
// iconUrl:config.assetsPath+'/vip_icon.png',
......@@ -149,6 +152,7 @@
console.log(res)
if(res.data.code == 200){
this.userInfo = res.data.data;
uni.setStorageSync('userInfo',this.userInfo)
this.loginStatus = true;
}
})
......@@ -177,6 +181,13 @@
}
},
onNavToSetUserInfo(){
if(this.loginStatus==true){
uni.navigateTo({
url:"/pages/setUserInfo/index"
})
}
},
// 退出登录,解除手机号与当前微信的绑定
onLoginOut(){
uni.showLoading({
......@@ -228,7 +239,13 @@
width: 100%;
>.flex-row {
position: relative;
align-items: center;
.nav-right{
position: absolute;
right: 5vw;
margin-top: 40upx;
}
}
.amount-coupon {
......@@ -309,4 +326,9 @@
width: 94%;
margin-top: 40upx;
}
.avatar-img{
width: 100%;
height: 100%;
border-radius: 50%;
}
</style>
\ No newline at end of file
......@@ -14,7 +14,7 @@
</view>
<view class="flex-between part-2">
<text class="text-title text-lg">预定须知</text>
<text class="text-blue text-lg">使用教程></text>
<!-- <text class="text-blue text-lg">使用教程></text> -->
</view>
<view class="part-3">
<text class="text-gray">预定成功后,请按预约时间及时到店消费,若无法及时到店消费,可提前取消订单</text>
......@@ -51,7 +51,7 @@
</view>
</view>
<view v-show="index == 0" class="flex-row distance-mode">
<view v-show="orderType ===1 && index == 0" class="flex-row distance-mode">
<view class="">
<text class="text-title text-lg text-bold">时长选择:</text>
</view>
......@@ -65,12 +65,27 @@
</view>
</view>
</view>
<view v-if="orderType ===2" class="flex-row distance-mode" style="margin: 40upx 20upx 40upx;">
<view class="">
<text class="text-title text-lg text-bold">时长选择:</text>
</view>
<view class="flex-1 distance-box">
<view v-for="(item,index) in distanceMode2" :key="index" class="flex-col" style="margin: 0 6upx;"
@tap="onDurationChange(index)">
<view class="cu-tag radius" :class="index===distanceIndex? 'line-pink':'line-gray'">
<text>{{item.duration<1?'半小时': item.duration+'小时'}}</text>
</view>
</view>
</view>
</view>
<view class="flex-row date-mode">
<view class="">
<text class="text-title text-lg text-bold">时间选择:</text>
</view>
<view class="flex-1 date-box">
<button class="cu-btn round line-pink" @tap="onSelectDate">
<button class="cu-btn round" :class="orderType===1?'line-pink':'line-gray'" @tap="onSelectDate">
<text>{{startTime}}</text>
<text class="cuIcon-edit"></text>
</button>
......@@ -144,14 +159,13 @@
{{Number(roomInfo.price)*duration > computePriceInfo.payFee ?'-¥'+ Number(Number(roomInfo.price)*duration - computePriceInfo.payFee).toFixed(2):'¥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>
<button class="recharge-btn cu-btn round bg-pink sm" @tap="onNavRecharge">去充值</button>
<!-- <text class="text-title cuIcon-right "></text> -->
</view>
</view>
</view> -->
</view>
<view class="pay-content-box">
<view class="flex-row">
......@@ -162,8 +176,8 @@
</view>
</view>
<view class="">
<button class="cu-btn bg-pink round lg margin-right" @tap="onNavToCheckedCoupon">团购验券</button>
<button class="cu-btn bg-pink round lg" @tap="onOrderConfirm">预约</button>
<button v-if="orderType===1" class="cu-btn bg-pink round lg margin-right" @tap="onNavToCheckedCoupon">团购验券</button>
<button class="cu-btn bg-pink round lg" @tap="onOrderConfirm">{{orderType===1?'预约':'续单'}} </button>
</view>
</view>
......@@ -214,14 +228,14 @@
<view class="confirm-pop">
<view class="pop-content-box">
<view class="title">
<text class="text-black text-bold text-xl">预约信息确认</text>
<text class="text-black text-bold text-xl">{{orderType==1? '预约':'续单'}}信息确认</text>
</view>
<view class="info-box">
<view class="info">
<text class="text-black text-lg">预约门店:{{roomInfo.storeName|| ''}}</text>
<text class="text-black text-lg">{{orderType==1? '预约':'续单'}}门店:{{roomInfo.storeName|| ''}}</text>
</view>
<view class="info">
<text class="text-black text-lg">预约包间:{{roomInfo.name}}</text>
<text class="text-black text-lg">{{orderType==1? '预约':'续单'}}包间:{{roomInfo.name}}</text>
</view>
<view class="info">
<text class="text-black text-lg">开始时间:{{dateObj.startDate}}</text>
......@@ -247,7 +261,7 @@
<button class="cu-btn round block line-pink lg" @tap="onCancle">返回修改</button>
</view>
<view class="btn-box">
<button class="cu-btn round block bg-pink lg" @tap="onOrderCreate">立即预定</button>
<button class="cu-btn round block bg-pink lg" @tap="onOrderCreate">立即{{orderType==1? '预约':'续单'}}</button>
</view>
</view>
</view>
......@@ -269,7 +283,8 @@
} from "@/api/coupon"
import {
orderCreate,
computePrice
computePrice,
getOrderInfoByNo
} from "@/api/order"
export default {
......@@ -307,7 +322,8 @@
],
// 时长选择
distanceIndex: 0,
distanceMode: [{
distanceMode: [
{
duration: 4
},
{
......@@ -320,6 +336,23 @@
duration: '其他',
}
],
distanceMode2:[
{
duration: 0.5
},
{
duration: 1
},
{
duration: 2
},
{
duration: 3
},
{
duration: 4
}
],
// 套餐
modeIndex: 0,
packageMode: [{
......@@ -365,11 +398,20 @@
payFee: '',
totalFee: '',
},
dateObj: {}
dateObj: {},
preOrderNo:''
};
},
onLoad(option) {
this.id = option.roomId || 106;
if(option.orderNo){
this.orderType = 2;
this.preOrderNo = option.orderNo;
uni.setNavigationBarTitle({
title:'房间续单'
})
this.onGetOrderInfo()
}
uni.showLoading({
title: "加载中"
})
......@@ -388,7 +430,8 @@
images: res.data.data.images ? res.data.data.images
.split(",").map(val => this.hostUrl + val) : []
}
if (this.roomInfo.packList && this.roomInfo.packList.length) {
// 判断房间有没有绑定套餐
if (this.orderType ===1 && this.roomInfo.packList && this.roomInfo.packList.length) {
this.packageMode = this.roomInfo.packList
this.index = 1;
this.modeIndex = 0;
......@@ -397,6 +440,15 @@
}
})
},
onGetOrderInfo(){
getOrderInfoByNo(this.preOrderNo).then(res=>{
console.log(res,909090)
if(res.data.code == 200){
this.startTime = moment(res.data.data.endDate).add(1, "m").format("HH:mm")
}
})
},
//获取时间段是否被占用
onGetSortDistance() {
listSortDistance({
storeId: this.roomInfo.storeId,
......@@ -404,7 +456,6 @@
day: this.dateList[this.dateIndex].readDate
}).then(res => {
uni.hideLoading()
console.log(res)
this.dateIntervalList = res.data.data.map((item, index) => {
return {
...item,
......@@ -435,7 +486,28 @@
}).join(":")
} else {
// 小时模式
if(this.orderType ===1){
this.duration = Number(this.distanceMode[this.distanceIndex].duration);
}else if(this.orderType ===2){
this.duration = Number(this.distanceMode2[this.distanceIndex].duration);
}
console.log(this.duration,"时长数据")
if(this.orderType === 2 && this.duration<1){
let startDateArr = this.startTime.split(":").map(item=>Number(item))
// 分钟
let m = startDateArr[1]+60*this.duration
if(m>=60){
startDateArr[0]+=1
if(startDateArr[0]>23){
startDateArr[0] = startDateArr[0]-23
}
}else{
startDateArr[1] = m
}
this.endTime = startDateArr.map(num => num >= 10 ? num : `0${num}` ).join(':');
}else{
this.endTime = this.startTime.split(":").map((item, k) => {
let num = ''
if (k == 0) {
......@@ -445,11 +517,13 @@
num = Number(item) + this.duration
}
} else {
num = Number(item)
}
return num >= 10 ? num : `0${num}`
}).join(":")
}
}
this.onGetUseCoupon()
this.onUpdateIntervalList()
this.dateObj = this.onSetDateTime(this.startTime, this.endTime);
......@@ -466,7 +540,7 @@
let endM = Number(this.endTime.split(":")[1])
console.log(start, end, "start")
if (end <= start) {
if (end < start) {
end += 24
}
......@@ -531,7 +605,7 @@
onNavToSelectCoupon() {
let dateObj = this.onSetDateTime(this.startTime, this.endTime);
let that = this;
// if (this.useCouponList.length) {
if (this.useCouponList.length) {
uni.navigateTo({
url: "/pages/useCoupon/index",
events: {
......@@ -552,7 +626,7 @@
})
}
})
// }
}
},
//计算支付金额
onComputePrice() {
......@@ -583,6 +657,13 @@
},
// 下单模式切换
onTypeChange(i) {
if(this.orderType ==2){
uni.showToast({
icon:'none',
title:'房间续单无法选择套餐模式'
})
return
}
if (this.index === i || !this.packageMode.length) return;
this.index = i
this.modeIndex = 0;
......@@ -604,11 +685,13 @@
this.onSetEndTime()
},
onDateChange(k) {
if(this.orderType ==2) return;
if (this.dateIndex === k) return;
this.dateIndex = k
this.onGetSortDistance()
},
onSelectDate() {
if(this.orderType === 2) return;
if (!this.checkedIndex.length) {
let arr = this.startTime.split(":")
if (arr.length) {
......@@ -690,7 +773,7 @@
title: "下单中..."
})
let dateObj = this.onSetDateTime(this.startTime, this.endTime);
orderCreate({
let params = {
storeId: this.roomInfo.storeId,
roomId: this.roomInfo.id,
orderType: this.orderType,
......@@ -702,29 +785,21 @@
totalFee: Number(this.roomInfo.price) * this.duration,
payFee: this.computePriceInfo.payFee || 0,
packId:this.index>0? this.packageMode[this.modeIndex].id : ''
}).then(res => {
console.log(res, 909090)
}
if(this.orderType === 2 && this.preOrderNo){
params.preOrderNo = this.preOrderNo
}
orderCreate(params).then(res => {
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)
// }
// })
if(res.data.data.jsConfig){
wx.requestPayment({
"timeStamp": res.data.data.jsConfig.timeStamp,
"nonceStr": res.data.data.jsConfig.nonceStr,
"package": res.data.data.jsConfig.packages,
"signType": res.data.data.jsConfig.signType,
"paySign": res.data.data.jsConfig.paySign,
"success":function(resp){
"success":(resp)=>{
// 支付成功
uni.showToast({
icon: "success",
......@@ -739,17 +814,31 @@
}
})
},
"fail":function(resp){
"fail":(resp)=>{
// 取消支付或支付失败
uni.showToast({
title: "取消支付或支付失败"
})
// 调用取消订单接口
},
"complete":function(resp){
"complete":(resp)=>{
// 接口调用结束的回调函数(调用成功、失败都会执行)
}
});
}else{
uni.showToast({
icon: "success",
title: "下单成功",
success: () => {
setTimeout(() => {
uni.navigateTo({
url: "/pages/orderResult/orderResult?orderNo=" +
res.data.data.orderNo
})
}, 1000)
}
})
}
} else {
uni.showToast({
title: "下单失败"
......@@ -796,6 +885,7 @@
},
// 将时间转换成完整日期
onSetDateTime(startTime, endTime) {
console.log(startTime, endTime,'时间段')
let obj = {
startDate: "",
endDate: ''
......@@ -803,7 +893,7 @@
let startArr = startTime.split(":")
let endArr = endTime.split(":")
obj.startDate = `${this.dateList[this.dateIndex].readDate} ${startTime}:00`
if (Number(endArr[0]) <= Number(startArr[0])) {
if (Number(endArr[0]) < Number(startArr[0])) {
obj.endDate =
`${moment(this.dateList[this.dateIndex].readDate).add(1,"days").format("YYYY-MM-DD")} ${endTime}:00`
} else {
......@@ -1224,4 +1314,5 @@
}
}
}
</style>
\ No newline at end of file
......@@ -173,14 +173,21 @@ import NoLogin from "@/components/noLogin/noLogin"
</script>
<style>
page{
background-color: #ffffff;
background-color: #f1f1f1;
}
</style>
<style lang="scss" scoped>
.order-record {
display: flex;
flex-direction: column;
padding-top: 100upx;
.nav{
position: fixed;
top: 0;
left: 0;
height: 90upx;
z-index: 999;
}
.content-box {
display: flex;
flex-direction: column;
......
......@@ -62,7 +62,7 @@
</view>
</view>
<view class="part-2">
<view v-if="orderInfo.status <= 1" class="part-2">
<view class="flex-between title">
<view class="flex-row">
<text class="cuIcon-titles text-pink text-xl"></text>
......@@ -95,6 +95,9 @@
</view>
</view>
<view v-if="orderInfo.status === 0" class="cancle-btn-box">
<button class="cu-btn bg-pink round block lg">立即退单</button>
</view>
</view>
</view>
</template>
......@@ -176,6 +179,7 @@
display: flex;
flex-direction: column;
width: 100vw;
padding-bottom: 120upx;
.order-info-content{
display: flex;
flex-direction: column;
......@@ -309,4 +313,19 @@
}
}
}
.cancle-btn-box{
position: fixed;
left: 0;
bottom: 0;
width: 100%;
height: 120upx;
display: flex;
justify-content: center;
align-items: center;
background-color: #ffffff;
z-index: 99;
.cu-btn{
width: 80%;
}
}
</style>
<template>
<view class="set-user-info">
<f-navbar title="个人资料" fontColor="#333333" :bgColor="PrimaryColor"
:isShowLeft="true" :isShowTransparentTitle="true">
<view class="u-flex" slot="left">
<text style="font-size: 44rpx;" class="cuIcon-back text-black"></text>
</view>
</f-navbar>
<view class="main-content">
<view class="user-avatar-box" @tap="onChangeAvatar">
<view class="avatar">
<image class="avatar-img" :src="userInfo.avatar|| assetsPath+'/cart.png'" mode="scaleToFill"></image>
<view class="camera">
<image src="../../static/camera.png" mode="widthFix"></image>
</view>
</view>
<text class="text-gray margin-top">请上传头像</text>
</view>
<form>
<view class="cu-form-group">
<text class="text-black text-bold margin-right">会员昵称</text>
<input v-model="userInfo.nickName" type="text" :maxlength="12" placeholder="请输入用户昵称" name="input"></input>
</view>
<view class="cu-form-group">
<view class="text-black text-bold margin-right">会员性别</view>
<radio-group class="block" @change="onSwitch">
<view class="radio-group-box flex-row">
<view class="flex-row">
<text></text>
<radio class='pink radio' :class="userInfo.sex == 1?'checked':''" :checked="userInfo.sex==1?true:false" value="1"></radio>
</view>
<view class="flex-row">
<text></text>
<radio class='pink radio' :class="userInfo.sex == 2?'checked':''" :checked="userInfo.sex==2?true:false" value="2"></radio>
</view>
<view class="flex-row">
<text>未知</text>
<radio class='pink radio' :class="userInfo.sex == '0'?'checked':''" :checked="userInfo.sex=='0'?true:false" value="0"></radio>
</view>
</view>
</radio-group>
</view>
<view class="cu-form-group">
<text class="text-black text-bold margin-right">手机号</text>
<input v-model="userInfo.phone" type="number" :maxlength="12" placeholder="请输入您的手机号" name="input"></input>
</view>
</form>
<view class="confirm-btn-box">
<view class="confirm-btn">
<button class="btn cu-btn bg-pink block" @tap="onSaveUserInfo">确认修改</button>
</view>
</view>
</view>
</view>
</template>
<script>
import fNavbar from '@/components/module/f-navbar/f-navbar';
import { uploadFile,updateUserInfo } from "@/api/index.js";
import config from "@/config/index.config"
import {checkPhone} from "@/utils/tools.js"
export default{
components: {
fNavbar
},
data(){
return {
userInfo:{
avatar:"",
nickName:"",
phone:''
},
assetsPath:config.assetsPath,
nickName:"",
PrimaryColor: '#ffffff', //主题色
switchBtn:true
}
},
onLoad() {
this.onLoading();
},
methods:{
onLoading(){
this.userInfo = uni.getStorageSync("userInfo")
},
onSwitch(e){
this.userInfo.sex = e.target.value;
},
onChangeAvatar(){
let that = this;
uni.chooseImage({
count:1,
success: (result) => {
uploadFile({url:result.tempFilePaths[0]}).then(res=>{
let data = JSON.parse(res.data)
console.log(data,1212)
if(data.code == 200 ){
that.userInfo.avatar = data.url;
}
})
}
})
},
onSaveUserInfo(){
if(this.userInfo.phone && !checkPhone(this.userInfo.phone)){
uni.showToast({
icon:'none',
title:'手机号输入不正确'
})
return
}
updateUserInfo(this.userInfo).then(res=>{
if(res.data.code == 200 ){
uni.showToast({
icon:"none",
title:"保存成功"
})
}
})
}
}
}
</script>
<style>
page{
background-color: #FFFFFF;
}
</style>
<style lang="scss" scoped>
.main-content{
display: flex;
flex-direction: column;
width: 100vw;
.user-avatar-box{
height: 30vh;
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
margin-top: 40upx;
.avatar{
width: 90px;
height: 90px;
border-radius: 50%;
position: relative;
overflow: hidden;
.avatar-img{
display: block;
width: 100%;
height: 100%;
border-radius: 50%;
}
.camera{
position: absolute;
right: 0;
bottom: 0;
display: flex;
width: 24px;
height: 24px;
border-radius: 50%;
justify-content: center;
align-items: center;
background-color: #127FFF;
image{
display: block;
width: 28upx;
height: auto;
}
}
}
.margin-top{
margin-top: 20upx;
}
}
.cu-form-group {
width: 642/750*100vw;
height: 90upx;
margin: 10upx auto 0;
// border-bottom: 1px solid #F0F3F6;
.bg-blue {
background-color: #035EAC;
}
.bg-gray {
background-color: #999999;
text {
color: #FFFFFF;
}
}
}
.confirm-btn-box {
width: 100vw;
margin-top: 40upx;
.confirm-btn {
margin: 0 36upx;
.btn {
height: 90upx;
box-shadow: 0px 12px 26px 1px rgba(7, 83, 254, 0.2);
border-radius: 20upx;
font-size: 30*1.2upx;
color: #FFFFFF;
}
}
}
}
.radio-group-box{
.flex-row{
display: flex;
align-items: center;
margin: 0 10upx;
text{
margin-right: 8upx;
}
}
}
</style>
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