fix: 1. 修复门店注册表单提交数据格式 2. 添加品牌主页返回按钮 3. 优化登录弹窗结构

This commit is contained in:
davy 2025-04-04 20:53:55 +08:00
parent 2fdbba6fa0
commit 913118d58e
3 changed files with 293 additions and 110 deletions

View File

@ -1,5 +1,14 @@
<template>
<view class="page-content">
<!-- 自定义导航栏 -->
<view class="custom-nav" :style="{ paddingTop: statusBarHeight + 'px' }">
<view class="nav-content">
<view class="back-btn" @click="goBack">
<text class="cuIcon-back"></text>
</view>
</view>
</view>
<image class="banner" :src="breweryInfo.brandCover"></image>
<view class="brand-header">
<view style="padding:0 24rpx">
@ -137,6 +146,7 @@
</scroll-view>
</view>
</view>
<!-- 登录弹窗组件 -->
<loginPopup ref="loginRef" @loginSuccess="loginSuccess"></loginPopup>
</view>
@ -160,6 +170,7 @@
},
data() {
return {
statusBarHeight: 0, //
breweryId: '',
currentTab: 1,
breweryInfo: {}, //
@ -184,6 +195,9 @@
onLoad({
breweryId
}) {
//
this.statusBarHeight = uni.getSystemInfoSync().statusBarHeight
this.breweryId = breweryId
this.queryForm.id = breweryId
this.getBreweryInfoFun()
@ -195,6 +209,10 @@
this.getBreweryCoinBalanceFun() //
},
methods: {
//
goBack() {
uni.navigateBack()
},
changeTab(index) {
this.currentTab = index
this.queryForm.pageNum = 1
@ -240,10 +258,6 @@
},
//
getBreweryCoinBalanceFun() {
if (!uni.getStorageSync('token')) {
this.$refs.loginRef.open()
return
}
getBreweryCoinBalance(this.breweryId).then(res => {
if (res.data) {
this.myCoin = res.data.balance
@ -252,10 +266,6 @@
},
//
getBreweryFavorStatusFun() {
if (!uni.getStorageSync('token')) {
this.$refs.loginRef.open()
return
}
getBreweryFavorStatus(this.breweryId).then(res => {
if (res.data) {
this.isFavor = true
@ -362,10 +372,6 @@
},
//
favorBreweryFun(status) {
if (!uni.getStorageSync('token')) {
this.$refs.loginRef.open()
return
}
let data = {
breweryId: this.breweryId,
status
@ -381,10 +387,8 @@
title: '取消收藏',
icon: 'none'
})
}
this.getBreweryFavorStatusFun()
})
},
//
@ -405,9 +409,41 @@
<style lang="scss" scoped>
.page-content {
.custom-nav {
position: fixed;
top: 0;
left: 0;
right: 0;
z-index: 999;
background: transparent;
.nav-content {
height: 44px;
display: flex;
align-items: center;
padding: 0 32rpx;
.back-btn {
width: 64rpx;
height: 64rpx;
display: flex;
align-items: center;
justify-content: center;
background: rgba(255, 255, 255, 0.8);
border-radius: 50%;
.cuIcon-back {
font-size: 36rpx;
color: #000;
}
}
}
}
.banner {
width: 100%;
height: 724rpx;
margin-top: v-bind('statusBarHeight + 44 + "px"');
}
.brand-header {

View File

@ -543,6 +543,22 @@ export default {
return;
}
//
console.log('提交的表单数据:', {
完整表单: this.form,
酒吧名称: this.form.bar_name,
联系电话: this.form.bar_contact_phone,
省份: this.form.province,
城市: this.form.city,
区域: this.form.district,
地址: this.form.address,
营业执照: this.form.business_license,
门头照片: this.form.storefront_photo,
纬度: this.form.latitude,
经度: this.form.longitude,
openId: this.form.openId
});
//
uni.showLoading({
title: '提交中',

View File

@ -1,5 +1,15 @@
<template>
<view class="page-content">
<view class="page">
<view class="content">
<!-- 自定义导航栏 -->
<view class="custom-nav" :style="{ paddingTop: statusBarHeight + 'px' }">
<view class="nav-content">
<view class="back-btn" @click="goBack">
<text class="cuIcon-back"></text>
</view>
</view>
</view>
<image class="banner" :src="breweryInfo.brandCover"></image>
<view class="info">
<view class="flex justify-between align-center" style="margin-bottom: 32rpx;" @click="goBreweryDetail">
@ -54,7 +64,7 @@
<!-- </view> -->
<!-- 兑换按钮区 -->
<view class="bottom-box">
<view v-if="!coinBalance.balance || coinBalance.balance < detail.redeemedNum" class="tip">
<view v-if="isLogin && coinBalance.balance < detail.redeemedNum" class="tip">
<image src="@/static/warning.png" style="margin-right: 24rpx;width: 25rpx;height: 25rpx;"></image>
<text>您的{{breweryInfo.brandName}}品牌币数量不足哦</text>
</view>
@ -64,27 +74,25 @@
<image src="@/static/beerCoin.png" style="width: 30rpx;height: 30rpx;margin-left: 20rpx;">
</image>
</view>
<view class="flex align-center">当前可用品牌币{{ coinBalance.balance}}<image src="@/static/beerCoin.png"
<view class="flex align-center">当前可用品牌币{{ isLogin ? (coinBalance.balance || 0) : '登录后可见' }}<image src="@/static/beerCoin.png"
style="width: 30rpx;height: 30rpx;margin-left: 20rpx;">
</image>
</view>
<!-- <view class="flex align-center">当前可用通用币0<image src="@/static/beerCoin.png"
style="width: 30rpx;height: 30rpx;margin-left: 20rpx;">
</image>
</view> -->
</view>
<view class="btn" @click="handleRedeem">
立即兑换
</view>
</view>
</view>
</view>
<!-- 登录弹窗 -->
<loginPopup ref="loginRef"></loginPopup>
</view>
</template>
<script>
import loginPopup from '@/components/loginPopup.vue';
import { getGoodsInfo, getBreweryInfo,getBreweryCoinBalance } from '@/api/bar.js'
import { getGoodsInfo, getBreweryInfo, getBreweryCoinBalance } from '@/api/bar.js'
export default {
components: {
loginPopup
@ -95,28 +103,63 @@
breweryId:'', // id
detail: {},
breweryInfo:{},
coinBalance:{}
coinBalance:{},
isLogin: false, //
isVerified: false, //
statusBarHeight: 0, //
};
},
onLoad({id, breweryId}) {
if (!uni.getStorageSync('token')) {
this.$refs.loginRef.open()
return
}
//
this.statusBarHeight = uni.getSystemInfoSync().statusBarHeight
this.id = id
this.breweryId = breweryId
this.checkLoginStatus()
this.getBreweryInfoFun()
this.getDetailFun()
},
onShow() {
this.getDetailFun()
this.checkLoginStatus()
if(this.isLogin) {
this.getBreweryCoinBalanceFun()
}
},
methods: {
//
goBack() {
uni.navigateBack()
},
//
checkLoginStatus() {
try {
const token = uni.getStorageSync('token')
const userInfo = uni.getStorageSync('userInfo')
this.isLogin = !!token && !!userInfo
this.isVerified = userInfo?.isVerified === 1
//
if(token && !userInfo) {
uni.removeStorageSync('token')
this.isLogin = false
this.isVerified = false
}
} catch(e) {
console.error('检查登录状态失败:', e)
this.isLogin = false
this.isVerified = false
}
},
//
getBreweryInfoFun() {
getBreweryInfo(this.breweryId).then(res => {
this.breweryInfo = res.data
}).catch(err => {
console.error('获取品牌信息失败:', err)
uni.showToast({
title: '获取品牌信息失败',
icon: 'none'
})
})
},
//
@ -131,7 +174,12 @@
this.detail = res.data
}
}).catch(err => {
console.error('获取商品详情失败:', err)
uni.hideLoading()
uni.showToast({
title: '获取商品详情失败',
icon: 'none'
})
})
},
//
@ -143,12 +191,59 @@
//
getBreweryCoinBalanceFun() {
getBreweryCoinBalance(this.breweryId).then(res => {
console.log(res)
this.coinBalance = res.data
}).catch(err => {
console.error('获取币种余额失败:', err)
uni.showToast({
title: '获取币种余额失败',
icon: 'none'
})
})
},
//
handleRedeem() {
async handleRedeem() {
//
this.checkLoginStatus()
if(!this.isLogin) {
// 使 nextTick
await this.$nextTick()
if(this.$refs.loginRef) {
this.$refs.loginRef.open()
} else {
uni.showToast({
title: '请稍后再试',
icon: 'none'
})
}
return
}
if(!this.isVerified) {
uni.showModal({
title: '提示',
content: '请先完成实名认证',
confirmText: '去认证',
success: (res) => {
if(res.confirm) {
uni.navigateTo({
url: '/pagesMy/verify'
})
}
}
})
return
}
if(!this.coinBalance.balance || this.coinBalance.balance < this.detail.redeemedNum) {
uni.showToast({
title: '品牌币余额不足',
icon: 'none',
duration: 2000
})
return
}
uni.navigateTo({
url: '/pagesCoin/redeemOrder?goodsId=' + this.id
})
@ -158,14 +253,46 @@
</script>
<style lang="scss" scoped>
.page-content {
// background: linear-gradient(180deg, #FEE034 0%, #FDFDFD 50%, #FDFDFD 100%);
// padding-top: 300rpx;
.page {
min-height: 100vh;
.custom-nav {
position: fixed;
top: 0;
left: 0;
right: 0;
z-index: 999;
background: transparent;
.nav-content {
height: 44px;
display: flex;
align-items: center;
padding: 0 32rpx;
.back-btn {
width: 64rpx;
height: 64rpx;
display: flex;
align-items: center;
justify-content: center;
background: rgba(255, 255, 255, 0.8);
border-radius: 50%;
.cuIcon-back {
font-size: 36rpx;
color: #000;
}
}
}
}
.banner {
width: 100%;
height: 724rpx;
margin-top: v-bind('statusBarHeight + 44 + "px"');
}
.info {
position: relative;
border-radius: 30rpx;
@ -183,18 +310,14 @@
border-radius: 50%;
}
}
.container {
padding: 0 32rpx;
margin-top: 20rpx;
padding-bottom: 300rpx;
background: #FFFFFF;
}
.bottom-box {
position: fixed;
left: 0;
width: 100%;
bottom: 0;
background: #FFFFFF;
z-index: 99;
.tip {
height: 52rpx;
@ -208,11 +331,9 @@
}
.fun-box {
height: 224rpx;
background: #FFFFFF;
box-shadow: 0px -4px 8px 0px rgba(0, 0, 0, 0.1);
// border-radius: 30rpx 30rpx 0px 0px;
display: flex;
justify-content: space-between;
align-items: center;
@ -247,9 +368,19 @@
color: #000;
text-align: center;
line-height: 82rpx;
transition: all 0.3s;
&:active {
transform: scale(0.98);
opacity: 0.9;
}
}
}
}
}
//
:deep(.uni-popup) {
z-index: 9999;
}
</style>