|
@@ -340,6 +340,13 @@ export default {
|
|
|
methods: {
|
|
methods: {
|
|
|
loadMembership: function() {
|
|
loadMembership: function() {
|
|
|
var that = this
|
|
var that = this
|
|
|
|
|
+ // 未登录(如从分享链接进入)时跳过会员查询,直接按非会员处理,
|
|
|
|
|
+ // 避免 /api/membership/my 返回 401 触发"登录已过期"并强制跳登录页
|
|
|
|
|
+ if (!uni.getStorageSync('token')) {
|
|
|
|
|
+ that.isMember = false
|
|
|
|
|
+ that.memberLevel = 'FREE'
|
|
|
|
|
+ return
|
|
|
|
|
+ }
|
|
|
getMyMembership().then(function(res) {
|
|
getMyMembership().then(function(res) {
|
|
|
if (res && res.code === 200 && res.data) {
|
|
if (res && res.code === 200 && res.data) {
|
|
|
var lvl = res.data.memberLevel || 'FREE'
|
|
var lvl = res.data.memberLevel || 'FREE'
|
|
@@ -395,6 +402,9 @@ export default {
|
|
|
},
|
|
},
|
|
|
loadSkuData: function(productId) {
|
|
loadSkuData: function(productId) {
|
|
|
var that = this
|
|
var that = this
|
|
|
|
|
+ // 未登录(如从分享链接进入)时跳过 SKU 规格查询,避免 /api/product/spec/map 返回 401
|
|
|
|
|
+ // 触发"登录已过期"并强制跳登录页;SKU 选择是购买流程功能,未登录无需加载
|
|
|
|
|
+ if (!uni.getStorageSync('token')) return
|
|
|
productSpecMap({ productIds: [parseInt(productId)] }).then(function(res) {
|
|
productSpecMap({ productIds: [parseInt(productId)] }).then(function(res) {
|
|
|
if (res.code === 200 && res.data) {
|
|
if (res.code === 200 && res.data) {
|
|
|
var map = res.data
|
|
var map = res.data
|
|
@@ -415,6 +425,9 @@ export default {
|
|
|
if (that.product && that.product.price && that.product.pointsMultiplier) {
|
|
if (that.product && that.product.price && that.product.pointsMultiplier) {
|
|
|
that.cfEarnedValue = Math.floor(that.product.price / 100) * that.product.pointsMultiplier;
|
|
that.cfEarnedValue = Math.floor(that.product.price / 100) * that.product.pointsMultiplier;
|
|
|
}
|
|
}
|
|
|
|
|
+ // 未登录(如从分享链接进入)时跳过优惠券查询,避免 /api/coupon/product 返回 401
|
|
|
|
|
+ // 触发"登录已过期"并强制跳登录页;优惠券兑换是登录用户功能,未登录无需展示
|
|
|
|
|
+ if (!uni.getStorageSync('token')) return
|
|
|
getProductCoupons({ productId: productId }).then(function(res) {
|
|
getProductCoupons({ productId: productId }).then(function(res) {
|
|
|
if (res.code === 200) {
|
|
if (res.code === 200) {
|
|
|
that.productCoupons = res.data || []
|
|
that.productCoupons = res.data || []
|