fix: 修复评分显示问题,统一使用后端数据,所有分数保留一位小数
This commit is contained in:
parent
59eaa69e5c
commit
4096897a05
@ -60,7 +60,8 @@
|
|||||||
password: ''
|
password: ''
|
||||||
},
|
},
|
||||||
showPassword: false,
|
showPassword: false,
|
||||||
isAgree: false
|
isAgree: false,
|
||||||
|
needRefresh: false
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
@ -156,7 +157,8 @@
|
|||||||
if (res.user) {
|
if (res.user) {
|
||||||
this.userInfo = res.user
|
this.userInfo = res.user
|
||||||
uni.setStorageSync('userInfo', res.user)
|
uni.setStorageSync('userInfo', res.user)
|
||||||
this.$emit('loginSuccess')
|
this.needRefresh = true
|
||||||
|
this.$emit('loginSuccess', { needRefresh: this.needRefresh })
|
||||||
|
|
||||||
// 如果没有barId,提示去认证
|
// 如果没有barId,提示去认证
|
||||||
if (!res.user.barId) {
|
if (!res.user.barId) {
|
||||||
|
@ -420,7 +420,7 @@
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
return
|
return
|
||||||
} else if (barInfo.authState === 1) {
|
} else if (barInfo.authState === 2) {
|
||||||
uni.showToast({
|
uni.showToast({
|
||||||
title: '您的门店正在认证中,请耐心等待',
|
title: '您的门店正在认证中,请耐心等待',
|
||||||
icon: 'none'
|
icon: 'none'
|
||||||
|
@ -39,7 +39,7 @@
|
|||||||
</view>
|
</view>
|
||||||
<view v-if="barInfo" class="scan-box">
|
<view v-if="barInfo" class="scan-box">
|
||||||
<view v-if="barInfo.authState == 0" class="exprieTime">未认证</view>
|
<view v-if="barInfo.authState == 0" class="exprieTime">未认证</view>
|
||||||
<view v-else-if="barInfo.authState == 1" class="exprieTime">认证中</view>
|
<view v-else-if="barInfo.authState == 2" class="exprieTime">认证中</view>
|
||||||
<view v-else class="exprieTime">{{ barInfo.authEndTime }}认证到期</view>
|
<view v-else class="exprieTime">{{ barInfo.authEndTime }}认证到期</view>
|
||||||
<text>本月累计扫码酒款数量</text>
|
<text>本月累计扫码酒款数量</text>
|
||||||
<view class="margin-top">
|
<view class="margin-top">
|
||||||
@ -147,7 +147,7 @@
|
|||||||
|
|
||||||
if (!this.isLoggedIn) return 'guest';
|
if (!this.isLoggedIn) return 'guest';
|
||||||
if (!this.barInfo || this.barInfo.authState === 0) return 'unverified';
|
if (!this.barInfo || this.barInfo.authState === 0) return 'unverified';
|
||||||
if (this.barInfo.authState === 1) return 'verifying';
|
if (this.barInfo.authState === 2) return 'verifying';
|
||||||
return 'verified';
|
return 'verified';
|
||||||
},
|
},
|
||||||
maskedPhone() {
|
maskedPhone() {
|
||||||
@ -186,7 +186,7 @@
|
|||||||
if (res && res.data) {
|
if (res && res.data) {
|
||||||
this.barInfo = res.data;
|
this.barInfo = res.data;
|
||||||
// 如果是认证中状态,设置默认的扫码数据
|
// 如果是认证中状态,设置默认的扫码数据
|
||||||
if (this.barInfo.authState === 1) {
|
if (this.barInfo.authState === 2) {
|
||||||
this.myScanData = { scanCount: 0, percent: 0 };
|
this.myScanData = { scanCount: 0, percent: 0 };
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -194,7 +194,7 @@
|
|||||||
console.error('获取酒吧信息失败:', err);
|
console.error('获取酒吧信息失败:', err);
|
||||||
if (err.code === 500 && err.msg.includes('门店未认证')) {
|
if (err.code === 500 && err.msg.includes('门店未认证')) {
|
||||||
this.barInfo = {
|
this.barInfo = {
|
||||||
authState: 1,
|
authState: 2,
|
||||||
barName: '',
|
barName: '',
|
||||||
barNumber: '',
|
barNumber: '',
|
||||||
barContactPhone: ''
|
barContactPhone: ''
|
||||||
@ -206,7 +206,7 @@
|
|||||||
});
|
});
|
||||||
|
|
||||||
// 如果不是认证中状态,获取扫码数据
|
// 如果不是认证中状态,获取扫码数据
|
||||||
if (this.barInfo && this.barInfo.authState !== 1) {
|
if (this.barInfo && this.barInfo.authState !== 2) {
|
||||||
await getMyScanData().then(res => {
|
await getMyScanData().then(res => {
|
||||||
if (res.code === 200) {
|
if (res.code === 200) {
|
||||||
this.myScanData = res.data;
|
this.myScanData = res.data;
|
||||||
|
@ -205,7 +205,7 @@
|
|||||||
userStatus() {
|
userStatus() {
|
||||||
if (!this.isLoggedIn) return 'guest' // 游客
|
if (!this.isLoggedIn) return 'guest' // 游客
|
||||||
if (!this.barInfo || this.barInfo.authState === 0) return 'unverified' // 未认证
|
if (!this.barInfo || this.barInfo.authState === 0) return 'unverified' // 未认证
|
||||||
if (this.barInfo.authState === 1) return 'verifying' // 认证中
|
if (this.barInfo.authState === 2) return 'verifying' // 认证中
|
||||||
return 'verified' // 认证通过
|
return 'verified' // 认证通过
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@ -265,7 +265,7 @@
|
|||||||
console.log('【getBarInfoFun】认证状态(authState):', res.data.authState)
|
console.log('【getBarInfoFun】认证状态(authState):', res.data.authState)
|
||||||
|
|
||||||
this.barInfo = res.data
|
this.barInfo = res.data
|
||||||
this.isVerified = res.data.authState === 2 // 2表示认证通过
|
this.isVerified = res.data.authState === 1 // 1表示认证通过
|
||||||
console.log('【getBarInfoFun】更新后的认证状态(isVerified):', this.isVerified)
|
console.log('【getBarInfoFun】更新后的认证状态(isVerified):', this.isVerified)
|
||||||
|
|
||||||
uni.setStorageSync('barInfo', res.data)
|
uni.setStorageSync('barInfo', res.data)
|
||||||
|
@ -201,7 +201,7 @@ export default {
|
|||||||
latitude: '', // 纬度
|
latitude: '', // 纬度
|
||||||
longitude: '', // 经度
|
longitude: '', // 经度
|
||||||
openId: '', // 用户openId
|
openId: '', // 用户openId
|
||||||
auth_state: 0, // 认证状态(0:待审核)
|
auth_state: 2, // 认证状态(2:待审核)
|
||||||
},
|
},
|
||||||
// 用于显示的完整地区文本
|
// 用于显示的完整地区文本
|
||||||
displayArea: '',
|
displayArea: '',
|
||||||
|
@ -13,7 +13,7 @@
|
|||||||
</view>
|
</view>
|
||||||
<text class="product-subtitle">{{beerInfo.beerStyles || '--'}}</text>
|
<text class="product-subtitle">{{beerInfo.beerStyles || '--'}}</text>
|
||||||
<view class="rating">
|
<view class="rating">
|
||||||
<text class="rating-score">{{reviewScoreList.avgOverallRating || 0}}/5.0</text>
|
<text class="rating-score">{{reviewScoreList.avgOverallRating ? Number(reviewScoreList.avgOverallRating).toFixed(1) : '0.0'}}/5.0</text>
|
||||||
<uni-rate :value="reviewScoreList.avgOverallRating || 0" :readonly="true" :touchable="false" size="18" />
|
<uni-rate :value="reviewScoreList.avgOverallRating || 0" :readonly="true" :touchable="false" size="18" />
|
||||||
</view>
|
</view>
|
||||||
<view v-if="beerInfo.breweryId" class="brand" @click="toBrand">
|
<view v-if="beerInfo.breweryId" class="brand" @click="toBrand">
|
||||||
@ -52,7 +52,7 @@
|
|||||||
|
|
||||||
<!-- 评分总览 -->
|
<!-- 评分总览 -->
|
||||||
<view class="rating-overview">
|
<view class="rating-overview">
|
||||||
<text class="rating-score-large">{{currentTab === 2 ? (reviewScoreList.avgOverallRating || '-') : (myReviewInfo ? myReviewInfo.overallRating : '-')}}</text>
|
<text class="rating-score-large">{{currentTab === 2 ? (reviewScoreList.avgOverallRating ? Number(reviewScoreList.avgOverallRating).toFixed(1) : '-') : (myReviewInfo ? Number(myReviewInfo.overallRating).toFixed(1) : '-')}}</text>
|
||||||
<view class="rating-right">
|
<view class="rating-right">
|
||||||
<uni-rate
|
<uni-rate
|
||||||
:value="currentTab === 2 ? (reviewScoreList.avgOverallRating || 0) : (myReviewInfo ? myReviewInfo.overallRating : 0)"
|
:value="currentTab === 2 ? (reviewScoreList.avgOverallRating || 0) : (myReviewInfo ? myReviewInfo.overallRating : 0)"
|
||||||
@ -100,7 +100,7 @@
|
|||||||
]" :key="index">
|
]" :key="index">
|
||||||
<view class="bar-header">
|
<view class="bar-header">
|
||||||
<text class="bar-label">{{item.label}} ({{item.weight}})</text>
|
<text class="bar-label">{{item.label}} ({{item.weight}})</text>
|
||||||
<text class="bar-value">{{item.value ? item.value.toFixed(1) : '0.0'}}</text>
|
<text class="bar-value">{{item.value ? Number(item.value).toFixed(1) : '0.0'}}</text>
|
||||||
</view>
|
</view>
|
||||||
<view class="bar">
|
<view class="bar">
|
||||||
<view class="bar-filled" :style="{width: item.value ? (item.value/5*100 + '%') : '0%'}"></view>
|
<view class="bar-filled" :style="{width: item.value ? (item.value/5*100 + '%') : '0%'}"></view>
|
||||||
@ -154,14 +154,14 @@
|
|||||||
<!-- 评分和点赞 -->
|
<!-- 评分和点赞 -->
|
||||||
<view class="review-footer">
|
<view class="review-footer">
|
||||||
<uni-rate
|
<uni-rate
|
||||||
:value="item.compositeScore"
|
:value="item.overallRating"
|
||||||
:readonly="true"
|
:readonly="true"
|
||||||
:size="16"
|
:size="16"
|
||||||
:touchable="false"
|
:touchable="false"
|
||||||
color="#ECECEC"
|
color="#ECECEC"
|
||||||
active-color="#FEE034"
|
active-color="#FEE034"
|
||||||
/>
|
/>
|
||||||
<text class="score-text">{{item.compositeScore}}分</text>
|
<text class="score-text">{{item.overallRating ? Number(item.overallRating).toFixed(1) : '0.0'}}分</text>
|
||||||
<view class="like-btn" :class="{ active: item.reviewLike }" @tap.stop="handleLike(item)">
|
<view class="like-btn" :class="{ active: item.reviewLike }" @tap.stop="handleLike(item)">
|
||||||
<image class="like-icon" src="/static/like.png" mode="aspectFit"></image>
|
<image class="like-icon" src="/static/like.png" mode="aspectFit"></image>
|
||||||
<text class="like-count">{{item.likeCount || 0}}</text>
|
<text class="like-count">{{item.likeCount || 0}}</text>
|
||||||
@ -266,7 +266,7 @@
|
|||||||
|
|
||||||
if (this.isLoggedIn) {
|
if (this.isLoggedIn) {
|
||||||
const barInfo = uni.getStorageSync('barInfo')
|
const barInfo = uni.getStorageSync('barInfo')
|
||||||
this.isBarAuthenticated = barInfo && barInfo.authState === 2
|
this.isBarAuthenticated = barInfo && barInfo.authState === 1 // 1表示认证通过
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
@ -332,15 +332,19 @@
|
|||||||
console.log('获取评论列表数据:', res.rows.length)
|
console.log('获取评论列表数据:', res.rows.length)
|
||||||
let arr = res.rows.map(it => ({
|
let arr = res.rows.map(it => ({
|
||||||
...it,
|
...it,
|
||||||
compositeScore: this.getScore(it.aromaRating, it.tasteRating, it.colorRating),
|
|
||||||
isExpanded: false,
|
isExpanded: false,
|
||||||
needExpand: it.reviewContent && it.reviewContent.length > 50
|
needExpand: it.reviewContent && it.reviewContent.length > 50
|
||||||
}))
|
}))
|
||||||
if (arr.length > 0) {
|
if (arr.length > 0) {
|
||||||
console.log('更新评论列表')
|
console.log('更新评论列表')
|
||||||
|
// 如果是第一页,直接替换列表;否则追加到列表末尾
|
||||||
|
if (this.queryForm.pageNum === 1) {
|
||||||
|
this.reviewList = arr
|
||||||
|
} else {
|
||||||
this.reviewList = [...this.reviewList, ...arr]
|
this.reviewList = [...this.reviewList, ...arr]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
this.reviewTotal = res.total
|
this.reviewTotal = res.total
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
@ -379,10 +383,10 @@
|
|||||||
if (!this.isBarAuthenticated) {
|
if (!this.isBarAuthenticated) {
|
||||||
const barInfo = uni.getStorageSync('barInfo')
|
const barInfo = uni.getStorageSync('barInfo')
|
||||||
|
|
||||||
if (!barInfo || barInfo.authState === 0) {
|
if (!barInfo || barInfo.authState === 2) {
|
||||||
uni.showModal({
|
uni.showModal({
|
||||||
title: '提示',
|
title: '提示',
|
||||||
content: '请先认证门店',
|
content: '请先完成门店认证',
|
||||||
showCancel: true,
|
showCancel: true,
|
||||||
success: (res) => {
|
success: (res) => {
|
||||||
if (res.confirm) {
|
if (res.confirm) {
|
||||||
@ -396,9 +400,9 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (barInfo.authState === 1) {
|
if (barInfo.authState === 1) {
|
||||||
uni.showToast({
|
// 已认证,允许写酒评
|
||||||
title: '您的门店正在认证中,请耐心等待',
|
uni.navigateTo({
|
||||||
icon: 'none'
|
url: '/pages/index/writeReview?beerId=' + this.beerId
|
||||||
})
|
})
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
@ -448,10 +452,10 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
// 处理不同的认证状态
|
// 处理不同的认证状态
|
||||||
if (barInfo.authState === 0) {
|
if (barInfo.authState === 2) {
|
||||||
uni.showModal({
|
uni.showModal({
|
||||||
title: '提示',
|
title: '提示',
|
||||||
content: '请先认证门店',
|
content: '请先完成门店认证',
|
||||||
showCancel: true,
|
showCancel: true,
|
||||||
success: (res) => {
|
success: (res) => {
|
||||||
if (res.confirm) {
|
if (res.confirm) {
|
||||||
@ -462,12 +466,6 @@
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
return
|
return
|
||||||
} else if (barInfo.authState === 1) {
|
|
||||||
uni.showToast({
|
|
||||||
title: '您的门店正在认证中,请耐心等待',
|
|
||||||
icon: 'none'
|
|
||||||
})
|
|
||||||
return
|
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
@ -489,34 +487,49 @@
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
// 点赞
|
// 处理点赞
|
||||||
handleLike(item) {
|
async handleLike(item) {
|
||||||
const token = uni.getStorageSync('token')
|
if (!this.isLoggedIn) {
|
||||||
if (!token) {
|
|
||||||
this.$refs.loginRef.open()
|
this.$refs.loginRef.open()
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
let data = {
|
|
||||||
|
try {
|
||||||
|
// 发送点赞请求前,先确定当前的点赞状态
|
||||||
|
const nextStatus = item.reviewLike ? 2 : 1 // 如果当前是已点赞,则发送取消点赞(2);否则发送点赞(1)
|
||||||
|
|
||||||
|
const res = await likeReview({
|
||||||
reviewId: item.id,
|
reviewId: item.id,
|
||||||
status: item.reviewLike ? 2 : 1
|
status: nextStatus
|
||||||
}
|
|
||||||
likeReview(data).then(res => {
|
|
||||||
if (data.status == 1) {
|
|
||||||
uni.showToast({
|
|
||||||
title: '点赞成功',
|
|
||||||
icon: 'none'
|
|
||||||
})
|
})
|
||||||
|
|
||||||
|
if (res.code === 200) {
|
||||||
|
// 根据发送的状态更新UI
|
||||||
|
if (nextStatus === 1) { // 点赞操作
|
||||||
item.reviewLike = true
|
item.reviewLike = true
|
||||||
item.likeCount = (item.likeCount || 0) + 1
|
item.likeCount = (item.likeCount || 0) + 1
|
||||||
} else {
|
} else { // 取消点赞操作
|
||||||
uni.showToast({
|
|
||||||
title: '取消点赞',
|
|
||||||
icon: 'none'
|
|
||||||
})
|
|
||||||
item.reviewLike = false
|
item.reviewLike = false
|
||||||
item.likeCount = Math.max(0, (item.likeCount || 1) - 1)
|
item.likeCount = Math.max(0, (item.likeCount || 1) - 1)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
uni.showToast({
|
||||||
|
title: nextStatus === 1 ? '点赞成功' : '取消点赞',
|
||||||
|
icon: 'none'
|
||||||
})
|
})
|
||||||
|
} else {
|
||||||
|
uni.showToast({
|
||||||
|
title: '操作失败,请重试',
|
||||||
|
icon: 'none'
|
||||||
|
})
|
||||||
|
}
|
||||||
|
} catch (error) {
|
||||||
|
console.error('点赞操作失败:', error)
|
||||||
|
uni.showToast({
|
||||||
|
title: '操作失败,请重试',
|
||||||
|
icon: 'none'
|
||||||
|
})
|
||||||
|
}
|
||||||
},
|
},
|
||||||
// 生成酒单
|
// 生成酒单
|
||||||
toWinelist() {
|
toWinelist() {
|
||||||
@ -545,10 +558,10 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
// 处理不同的认证状态
|
// 处理不同的认证状态
|
||||||
if (barInfo.authState === 0) {
|
if (barInfo.authState === 2) {
|
||||||
uni.showModal({
|
uni.showModal({
|
||||||
title: '提示',
|
title: '提示',
|
||||||
content: '请先认证门店',
|
content: '您的门店正在认证中,请耐心等待',
|
||||||
showCancel: true,
|
showCancel: true,
|
||||||
success: (res) => {
|
success: (res) => {
|
||||||
if (res.confirm) {
|
if (res.confirm) {
|
||||||
@ -560,15 +573,25 @@
|
|||||||
})
|
})
|
||||||
return
|
return
|
||||||
} else if (barInfo.authState === 1) {
|
} else if (barInfo.authState === 1) {
|
||||||
uni.showToast({
|
// 已认证,允许生成酒单
|
||||||
title: '您的门店正在认证中,请耐心等待',
|
uni.navigateTo({
|
||||||
icon: 'none'
|
url: "/pagesActivity/winelist?beerId=" + this.beerId
|
||||||
})
|
})
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 未认证状态
|
||||||
|
uni.showModal({
|
||||||
|
title: '提示',
|
||||||
|
content: '请先认证门店',
|
||||||
|
showCancel: true,
|
||||||
|
success: (res) => {
|
||||||
|
if (res.confirm) {
|
||||||
uni.navigateTo({
|
uni.navigateTo({
|
||||||
url: "/pagesActivity/winelist?beerId=" + this.beerId
|
url: '/pages/index/registration'
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
// 分享
|
// 分享
|
||||||
|
@ -165,11 +165,11 @@
|
|||||||
|
|
||||||
// 检查认证状态
|
// 检查认证状态
|
||||||
if (barInfo) {
|
if (barInfo) {
|
||||||
if (barInfo.authState === 2) {
|
if (barInfo.authState === 1) {
|
||||||
// 已认证
|
// 已认证
|
||||||
this.isVerified = true
|
this.isVerified = true
|
||||||
this.isVerifying = false
|
this.isVerifying = false
|
||||||
} else if (barInfo.authState === 1) {
|
} else if (barInfo.authState === 2) {
|
||||||
// 认证中
|
// 认证中
|
||||||
this.isVerified = false
|
this.isVerified = false
|
||||||
this.isVerifying = true
|
this.isVerifying = true
|
||||||
|
@ -341,7 +341,7 @@
|
|||||||
const barInfo = uni.getStorageSync('barInfo');
|
const barInfo = uni.getStorageSync('barInfo');
|
||||||
|
|
||||||
this.isLoggedIn = !!token;
|
this.isLoggedIn = !!token;
|
||||||
this.isVerified = barInfo && barInfo.authState === 2;
|
this.isVerified = barInfo && barInfo.authState === 1;
|
||||||
},
|
},
|
||||||
handleButtonClick() {
|
handleButtonClick() {
|
||||||
const token = uni.getStorageSync('token');
|
const token = uni.getStorageSync('token');
|
||||||
@ -369,7 +369,27 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
// 处理不同的认证状态
|
// 处理不同的认证状态
|
||||||
if (barInfo.authState === 0) {
|
if (barInfo.authState === 2) {
|
||||||
|
uni.showModal({
|
||||||
|
title: '提示',
|
||||||
|
content: '您的门店正在认证中,请耐心等待',
|
||||||
|
showCancel: true,
|
||||||
|
success: (res) => {
|
||||||
|
if (res.confirm) {
|
||||||
|
uni.navigateTo({
|
||||||
|
url: '/pages/index/registration'
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
return;
|
||||||
|
} else if (barInfo.authState === 1) {
|
||||||
|
// 已认证,允许操作
|
||||||
|
this.handleScan();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 未认证状态
|
||||||
uni.showModal({
|
uni.showModal({
|
||||||
title: '提示',
|
title: '提示',
|
||||||
content: '请先认证门店',
|
content: '请先认证门店',
|
||||||
@ -382,25 +402,20 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
return;
|
|
||||||
} else if (barInfo.authState === 1) {
|
|
||||||
uni.showToast({
|
|
||||||
title: '您的门店正在认证中,请耐心等待',
|
|
||||||
icon: 'none'
|
|
||||||
});
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// 都通过后执行扫码
|
|
||||||
this.handleScan();
|
|
||||||
},
|
},
|
||||||
onLoginSuccess() {
|
onLoginSuccess(data) {
|
||||||
// 登录成功后重新检查状态
|
// 登录成功后重新检查状态
|
||||||
this.checkLoginStatus();
|
this.checkLoginStatus();
|
||||||
|
|
||||||
|
// 如果需要刷新页面
|
||||||
|
if (data && data.needRefresh) {
|
||||||
|
// 重新初始化页面数据
|
||||||
|
this.init();
|
||||||
|
}
|
||||||
|
|
||||||
// 检查认证状态
|
// 检查认证状态
|
||||||
const barInfo = uni.getStorageSync('barInfo');
|
const barInfo = uni.getStorageSync('barInfo');
|
||||||
if (!barInfo || barInfo.authState === 0) {
|
if (!barInfo) {
|
||||||
uni.showModal({
|
uni.showModal({
|
||||||
title: '提示',
|
title: '提示',
|
||||||
content: '请先认证门店',
|
content: '请先认证门店',
|
||||||
@ -414,19 +429,43 @@
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
return;
|
return;
|
||||||
} else if (barInfo.authState === 1) {
|
}
|
||||||
uni.showToast({
|
|
||||||
title: '您的门店正在认证中,请耐心等待',
|
// 处理不同的认证状态
|
||||||
icon: 'none'
|
if (barInfo.authState === 2) {
|
||||||
|
uni.showModal({
|
||||||
|
title: '提示',
|
||||||
|
content: '您的门店正在认证中,请耐心等待',
|
||||||
|
showCancel: true,
|
||||||
|
success: (res) => {
|
||||||
|
if (res.confirm) {
|
||||||
|
uni.navigateTo({
|
||||||
|
url: '/pages/index/registration'
|
||||||
});
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
return;
|
||||||
|
} else if (barInfo.authState === 1) {
|
||||||
|
// 已认证,允许操作
|
||||||
|
this.handleScan();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// 如果已认证,直接执行扫码
|
// 未认证状态
|
||||||
if (this.isVerified) {
|
uni.showModal({
|
||||||
this.handleScan();
|
title: '提示',
|
||||||
|
content: '请先认证门店',
|
||||||
|
showCancel: true,
|
||||||
|
success: (res) => {
|
||||||
|
if (res.confirm) {
|
||||||
|
uni.navigateTo({
|
||||||
|
url: '/pages/index/registration'
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
},
|
},
|
||||||
onUnload() {
|
onUnload() {
|
||||||
// 页面卸载时清除定时器
|
// 页面卸载时清除定时器
|
||||||
|
@ -216,31 +216,6 @@
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
// 检查登录和认证状态
|
|
||||||
const token = uni.getStorageSync('token')
|
|
||||||
const isAuth = uni.getStorageSync('isAuth')
|
|
||||||
|
|
||||||
if (!token) {
|
|
||||||
this.$refs.loginRef.open()
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!isAuth) {
|
|
||||||
uni.showModal({
|
|
||||||
title: '提示',
|
|
||||||
content: '您还未认证门店,请先完成认证',
|
|
||||||
confirmText: '去认证',
|
|
||||||
success: (res) => {
|
|
||||||
if (res.confirm) {
|
|
||||||
uni.navigateTo({
|
|
||||||
url: '/pagesActivity/barAuth'
|
|
||||||
})
|
|
||||||
}
|
|
||||||
}
|
|
||||||
})
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
if (this.currentStep < 3) {
|
if (this.currentStep < 3) {
|
||||||
this.currentStep++
|
this.currentStep++
|
||||||
}
|
}
|
||||||
|
@ -204,11 +204,11 @@
|
|||||||
|
|
||||||
// 检查认证状态
|
// 检查认证状态
|
||||||
if (barInfo) {
|
if (barInfo) {
|
||||||
if (barInfo.authState === 2) {
|
if (barInfo.authState === 1) {
|
||||||
// 已认证
|
// 已认证
|
||||||
this.isVerified = true
|
this.isVerified = true
|
||||||
this.isVerifying = false
|
this.isVerifying = false
|
||||||
} else if (barInfo.authState === 1) {
|
} else if (barInfo.authState === 2) {
|
||||||
// 认证中
|
// 认证中
|
||||||
this.isVerified = false
|
this.isVerified = false
|
||||||
this.isVerifying = true
|
this.isVerifying = true
|
||||||
|
Loading…
x
Reference in New Issue
Block a user