Commit f27b898b by zhangzhen

功能完善

parent f2b55c49
...@@ -40,7 +40,8 @@ ...@@ -40,7 +40,8 @@
sortName:"客" sortName:"客"
} }
], ],
timer:null timer:null,
orderInfo:{}
}; };
}, },
watch:{ watch:{
...@@ -65,8 +66,8 @@ ...@@ -65,8 +66,8 @@
methods:{ methods:{
onHandle(val,index){ onHandle(val,index){
console.log(val,index) console.log(val,index)
if(index===0){ if([0,1].includes(index)){
this.onGetOrderByAvailable() this.onGetOrderByAvailable(index)
return return
} }
if(val.routePath){ if(val.routePath){
...@@ -75,13 +76,23 @@ ...@@ -75,13 +76,23 @@
}) })
} }
}, },
onGetOrderByAvailable(){ onGetOrderByAvailable(i){
getOrderByAvailable().then(res=>{ getOrderByAvailable().then(res=>{
console.log(res) console.log(res)
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.orderNo = res.data.data[0].orderNo; this.orderInfo = res.data.data[0];
this.onOpenDoor() 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){ }else if(res.data.data&&res.data.data.length > 1){
uni.switchTab({ uni.switchTab({
url:"/pages/orderRecord/orderRecord" url:"/pages/orderRecord/orderRecord"
...@@ -89,7 +100,7 @@ ...@@ -89,7 +100,7 @@
}else{ }else{
uni.showToast({ uni.showToast({
icon:"none", icon:"none",
title:"暂无可用的订单" title:"暂无可用的订单,请先下单预约哦!"
}) })
} }
}else{ }else{
...@@ -104,15 +115,12 @@ ...@@ -104,15 +115,12 @@
uni.showLoading({ uni.showLoading({
title:"开门中..." title:"开门中..."
}) })
openDoor(this.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
}) })
// if(res.data.code ==200){
// }
}) })
} }
} }
......
...@@ -31,7 +31,7 @@ ...@@ -31,7 +31,7 @@
{ {
"path": "pages/order/order", "path": "pages/order/order",
"style": { "style": {
"navigationBarTitleText": "预约", "navigationBarTitleText": "房间预约",
"navigationStyle": "default" "navigationStyle": "default"
} }
}, },
...@@ -135,6 +135,14 @@ ...@@ -135,6 +135,14 @@
"navigationBarTitleText" : "保洁记录", "navigationBarTitleText" : "保洁记录",
"enablePullDownRefresh" : false "enablePullDownRefresh" : false
} }
},
{
"path": "pages/setUserInfo/index",
"style": {
"navigationBarTitleText": "资料修改",
"enablePullDownRefresh" : false,
"navigationStyle": "custom"
}
} }
], ],
......
...@@ -162,7 +162,7 @@ import NoLogin from "@/components/noLogin/noLogin" ...@@ -162,7 +162,7 @@ import NoLogin from "@/components/noLogin/noLogin"
</script> </script>
<style> <style>
page{ page{
background-color: #ffffff; background-color: #f1f1f1;
} }
</style> </style>
<style lang="scss" scoped> <style lang="scss" scoped>
......
...@@ -4,25 +4,28 @@ ...@@ -4,25 +4,28 @@
<view class="header-content-box"> <view class="header-content-box">
<view v-if="loginStatus" class="login-content"> <view v-if="loginStatus" class="login-content">
<view class="flex-1 flex-row"> <view class="flex-1 flex-row">
<view class="cu-avatar xl round margin-left" <view class="cu-avatar xl round margin-left">
style="background-image:url(https://ossweb-img.qq.com/images/lol/web201310/skin/big25002.jpg);"> <image class="avatar-img" :src="userInfo.avatar|| assetsPath+'/cart.png'" mode="scaleToFill"></image>
</view> </view>
<view class="flex-col margin-left"> <view class="flex-col margin-left">
<text class="text-title text-lg text-white text-bold text-xxl">{{userInfo.nickName||"凑角001"}}</text> <text class="text-title text-lg text-white text-bold text-xxl">{{userInfo.nickName||"凑角001"}}</text>
<view class="flex-row margin-top"> <view class="flex-row" style="margin-top: 10rpx;">
<text class="cuIcon-hotfill text-white"></text> <!-- <text class="cuIcon-hotfill text-white"></text> -->
<text class="text-white text-lg">会员用户</text> <text class="text-white text-lg">会员用户</text>
</view> </view>
</view> </view>
<view class="nav-right" @tap="onNavToSetUserInfo">
<text class="text-white text-xl">修改资料</text>
</view>
</view> </view>
<view class="flex-row amount-coupon"> <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">余额</text>
<text class="text-white text-xl">{{(Number(userInfo.amount)+Number(userInfo.freeAmount)).toFixed(2)}}</text> <text class="text-white text-xl">{{(Number(userInfo.amount)+Number(userInfo.freeAmount)).toFixed(2)}}</text>
</view> </view>
<view class="line"> <view class="line"></view> -->
</view>
<view class="flex-col" @tap="onNavToMyCoupon"> <view class="flex-col" @tap="onNavToMyCoupon">
<text class="text-white text-xl">优惠券</text> <text class="text-white text-xl">优惠券</text>
<text class="text-white text-xl">{{userInfo.number|| 0}}</text> <text class="text-white text-xl">{{userInfo.number|| 0}}</text>
...@@ -104,13 +107,13 @@ ...@@ -104,13 +107,13 @@
type:"", type:"",
show:true show:true
}, },
{ // {
label:"消费记录", // label:"消费记录",
iconUrl:config.assetsPath+'/record_icon.png', // iconUrl:config.assetsPath+'/record_icon.png',
routePath:"", // routePath:"",
type:"", // type:"",
show:true // show:true
}, // },
// { // {
// label:"立即充值", // label:"立即充值",
// iconUrl:config.assetsPath+'/vip_icon.png', // iconUrl:config.assetsPath+'/vip_icon.png',
...@@ -149,6 +152,7 @@ ...@@ -149,6 +152,7 @@
console.log(res) console.log(res)
if(res.data.code == 200){ if(res.data.code == 200){
this.userInfo = res.data.data; this.userInfo = res.data.data;
uni.setStorageSync('userInfo',this.userInfo)
this.loginStatus = true; this.loginStatus = true;
} }
}) })
...@@ -177,6 +181,13 @@ ...@@ -177,6 +181,13 @@
} }
}, },
onNavToSetUserInfo(){
if(this.loginStatus==true){
uni.navigateTo({
url:"/pages/setUserInfo/index"
})
}
},
// 退出登录,解除手机号与当前微信的绑定 // 退出登录,解除手机号与当前微信的绑定
onLoginOut(){ onLoginOut(){
uni.showLoading({ uni.showLoading({
...@@ -228,7 +239,13 @@ ...@@ -228,7 +239,13 @@
width: 100%; width: 100%;
>.flex-row { >.flex-row {
position: relative;
align-items: center; align-items: center;
.nav-right{
position: absolute;
right: 5vw;
margin-top: 40upx;
}
} }
.amount-coupon { .amount-coupon {
...@@ -309,4 +326,9 @@ ...@@ -309,4 +326,9 @@
width: 94%; width: 94%;
margin-top: 40upx; margin-top: 40upx;
} }
.avatar-img{
width: 100%;
height: 100%;
border-radius: 50%;
}
</style> </style>
\ No newline at end of file
...@@ -173,14 +173,21 @@ import NoLogin from "@/components/noLogin/noLogin" ...@@ -173,14 +173,21 @@ import NoLogin from "@/components/noLogin/noLogin"
</script> </script>
<style> <style>
page{ page{
background-color: #ffffff; background-color: #f1f1f1;
} }
</style> </style>
<style lang="scss" scoped> <style lang="scss" scoped>
.order-record { .order-record {
display: flex; display: flex;
flex-direction: column; flex-direction: column;
padding-top: 100upx;
.nav{
position: fixed;
top: 0;
left: 0;
height: 90upx;
z-index: 999;
}
.content-box { .content-box {
display: flex; display: flex;
flex-direction: column; flex-direction: column;
......
...@@ -62,7 +62,7 @@ ...@@ -62,7 +62,7 @@
</view> </view>
</view> </view>
<view class="part-2"> <view v-if="orderInfo.status <= 1" class="part-2">
<view class="flex-between title"> <view class="flex-between title">
<view class="flex-row"> <view class="flex-row">
<text class="cuIcon-titles text-pink text-xl"></text> <text class="cuIcon-titles text-pink text-xl"></text>
...@@ -95,6 +95,9 @@ ...@@ -95,6 +95,9 @@
</view> </view>
</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>
</view> </view>
</template> </template>
...@@ -176,6 +179,7 @@ ...@@ -176,6 +179,7 @@
display: flex; display: flex;
flex-direction: column; flex-direction: column;
width: 100vw; width: 100vw;
padding-bottom: 120upx;
.order-info-content{ .order-info-content{
display: flex; display: flex;
flex-direction: column; flex-direction: column;
...@@ -309,4 +313,19 @@ ...@@ -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> </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