修改登录用户信息的储存方式;增加餐券余额

This commit is contained in:
wwt 2025-02-26 10:59:51 +08:00
parent bc9a51c5dd
commit 21a38b50fa
2 changed files with 11 additions and 3 deletions

View File

@ -86,7 +86,7 @@ const goLogin = async() => {
if (res.status === 0) { if (res.status === 0) {
showToast ('登录成功') showToast ('登录成功')
localStorage.setItem('token', res.data.token) localStorage.setItem('token', res.data.token)
localStorage.setItem('accountInfo', res.data.accountInfo) localStorage.setItem('accountInfo', JSON.stringify(res.data.accountInfo))
setTimeout(() => { setTimeout(() => {
router.push('/home') router.push('/home')
}, 1000) }, 1000)

View File

@ -73,9 +73,13 @@
</div> </div>
<van-button v-if="userName && appointDate && num" @click="confirmYuyue" style="width: 92%;margin-top: 30px;min-height: 40px;" <div style="color: #959595; font-size: 14px; margin-bottom: 10px;">
餐券余额{{ balance || 0 }}
<!-- .toLocaleString() -->
</div>
<van-button v-if="userName && appointDate && num" @click="confirmYuyue" style="width: 92%;min-height: 40px;"
color="#1936C9">确认预约</van-button> color="#1936C9">确认预约</van-button>
<van-button v-else color="#464646" style="width: 92%;margin-top: 30px;min-height: 40px;">确认预约</van-button> <van-button v-else color="#464646" style="width: 92%;min-height: 40px;">确认预约</van-button>
<div style="margin-top: 20px;color: #959595; font-size: 14px;"> <div style="margin-top: 20px;color: #959595; font-size: 14px;">
到预约时间未消费则餐券作废 到预约时间未消费则餐券作废
</div> </div>
@ -140,6 +144,9 @@ const columns = ref([
value: 600 value: 600
} }
]) ])
let userInfo = JSON.parse(localStorage.getItem('accountInfo'))
const balance = userInfo.balance;
const onYSConfirm = (value) => { const onYSConfirm = (value) => {
console.log(value) console.log(value)
standard.value = value.selectedValues[0] standard.value = value.selectedValues[0]
@ -223,6 +230,7 @@ const geYYtUserInfo = async () => {
remark.value = res.data.remark remark.value = res.data.remark
userName.value = res.data.userName userName.value = res.data.userName
standard.value = res.data.standard standard.value = res.data.standard
} else { } else {
if (res.data.isOver) { if (res.data.isOver) {
showfail.value = true showfail.value = true