feat: 购券模块后端探活显隐——接口未部署期间模块自动隐藏,避免死入口

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
jacobxu666
2026-09-24 12:27:43 +08:00
co-authored by Claude Fable 5
parent 22035d543b
commit 45f608c408
+4 -4
View File
@@ -113,7 +113,8 @@ export default {
return this.detailType !== '2'
},
isPetrol() {
return this.loaded && String(this.shopId) === PETROL_SHOP_ID && !this.isVenue
// xuchao: 后端券服务探活(latest 返回 price)后才展示购券模块——后端未部署期间整模块自动隐藏,无死入口
return this.loaded && String(this.shopId) === PETROL_SHOP_ID && !this.isVenue && !!(this.voucher && this.voucher.price)
},
voucherBtnText() {
const s = this.voucher ? this.voucher.statusCode : -1
@@ -170,10 +171,9 @@ export default {
if (String(this.shopId) === PETROL_SHOP_ID) this.loadVoucher()
},
methods: {
// xuchao: 拉取石油券最新订单状态(未登录不查,按钮保持“¥200 购买”,点击时再引导登录)
// xuchao: 拉取石油券最新订单状态(未登录也调用:作为后端服务探活,price 决定模块显隐)
loadVoucher() {
const phone = uni.getStorageSync('phone')
if (!phone) { this.voucher = null; return }
const phone = uni.getStorageSync('phone') || ''
this.$u.api.voucherLatest({ phone }).then(res => {
this.voucher = bizOk(res) ? bizData(res) : null
}).catch(() => { this.voucher = null })