添加充值功能、优化内容

This commit is contained in:
wangxiaowei
2026-01-10 19:09:01 +08:00
parent d12651fe8a
commit 59859a2363
17 changed files with 959 additions and 105 deletions

View File

@ -59,24 +59,29 @@
<!-- 菜单栏 -->
<view class="flex justify-between mt-40rpx">
<view class="flex flex-col justify-center items-center w-[25%]" @click="showScanMenu = true">
<view class="flex flex-col justify-center items-center w-[20%]" @click="showScanMenu = true">
<wd-img width="90rpx" height="90rpx" :src="`${OSS}images/store/home/image3.png`" mode="aspectFit" />
<view class="font-400 text-24rpx text-[#303133] leading-34rpx">扫码验券</view>
</view>
<view class="flex flex-col justify-center items-center w-[25%]" @click="router.navigateTo('/bundle/finance/finance')">
<view class="flex flex-col justify-center items-center w-[20%]" @click="router.navigateTo('/bundle/finance/finance')">
<wd-img width="90rpx" height="90rpx" :src="`${OSS}images/store/home/image4.png`" mode="aspectFit" />
<view class="font-400 text-24rpx text-[#303133] leading-34rpx">财务管理</view>
</view>
<view class="flex flex-col justify-center items-center w-[25%]">
<view class="flex flex-col justify-center items-center w-[20%]">
<wd-img width="90rpx" height="90rpx" :src="`${OSS}images/store/home/image5.png`" mode="aspectFit" @click="router.navigateTo('/bundle/setmeal/setmeal')" />
<view class="font-400 text-24rpx text-[#303133] leading-34rpx">套餐管理</view>
</view>
<view class="flex flex-col justify-center items-center w-[25%]" @click="router.navigateTo('/bundle/user/user-list')">
<view class="flex flex-col justify-center items-center w-[20%]" @click="router.navigateTo('/bundle/user/user-list')">
<wd-img width="90rpx" height="90rpx" :src="`${OSS}images/store/home/image6.png`" mode="aspectFit" />
<view class="font-400 text-24rpx text-[#303133] leading-34rpx">户列表</view>
<view class="font-400 text-24rpx text-[#303133] leading-34rpx">户列表</view>
</view>
<view class="flex flex-col justify-center items-center w-[20%]" @click="router.navigateTo('/bundle/recharge/recharge')">
<wd-img width="90rpx" height="90rpx" :src="`${OSS}images/store/home/image8.png`" mode="aspectFit" />
<view class="font-400 text-24rpx text-[#303133] leading-34rpx">充值活动</view>
</view>
</view>

View File

@ -89,23 +89,24 @@
handleToLogin: async () => {
// TODO 如果是edit的话就是修改手机号
if (!testMobile(model.mobile)) {
toast.info('请输入正确的账号')
toast.show('请输入正确的账号')
return
}
if (!model.passowrd) {
toast.info('请输入密码')
toast.show('请输入密码')
return
}
uni.showLoading({
title: '登录中...'
toast.loading({
loadingType: 'ring',
loadingColor: '#4C9F44',
msg: '登录中...'
})
try {
const userStore = useUserStore()
const res = await userStore.mobileLogin(model.mobile, model.passowrd, 1, 1, 1)
uni.hideLoading()
toast.close()
// 这里记录用户账号密码,下次自动填充
uni.setStorageSync('loginMobile', model.mobile)
@ -116,11 +117,9 @@
router.reLaunch('/pages/index/index')
}, 1000)
} catch (error) {
toast.info('登录失败,请稍后重试')
uni.hideLoading()
toast.close()
return
}
}
}
</script>

View File

@ -1,5 +1,6 @@
<route lang="jsonc" type="page">{
"layout": "tabbar",
"needLogin": true,
"style": {
"navigationStyle": "custom"
}
@ -67,7 +68,7 @@
</view>
<view class="mb-16rpx flex items-center text-24rpx text-[#606266] leading-40rpx">
<text class="w-140rpx">门店ID:</text>
<text class="flex-1 text-[#000]">{{ storeInfo.id }}</text>
<text class="flex-1 text-[#000]">{{ storeInfo.id > 0 ? storeInfo.id : '-'}}</text>
</view>
<view class="mb-16rpx flex items-center text-24rpx text-[#606266] leading-40rpx">
<text class="w-140rpx">门店地址:</text>

View File

@ -1,5 +1,6 @@
<!-- 使用 type="home" 属性设置首页其他页面不需要设置默认为page -->
<route lang="jsonc">{
"needLogin": true,
"layout": "tabbar",
"style": {
// 'custom' 表示开启自定义导航栏,默认 'default'

View File

@ -80,6 +80,8 @@
</view>
</view>
<!-- 团购视频 -->
<!-- <view class="mt-28rpx">
<view class="mb-28rpx flex items-center">
@ -122,20 +124,47 @@
</view>
</view>
<view class="text-26rpx text-[#9CA3AF] font-400 leading-36rpx">
可添加1张图片
可添加1-9张图片
</view>
</view>
<view class="flex flex-wrap items-center gap-16rpx">
<wd-upload
:header="{'token': token}"
:file-list="fileList"
:limit="1"
v-model:file-list="fileList"
:limit="9"
multiple
image-mode="scaleToFill"
:action="action"
@success="RoomDetail.handleUploadSuccess">
:action="action">
</wd-upload>
</view>
</view>
<!-- 排序 -->
<view class="mt-28rpx add-textarea">
<view class="flex items-center justify-between mb-20rpx">
<view class="mr-10rpx text-32rpx text-[#303133] font-bold leading-44rpx">
包间排序
</view>
<view class="text-24rpx text-[#9CA3AF] font-400 leading-34rpx">
数字越大排名越靠前
</view>
</view>
<wd-input v-model="form.weight" no-border placeholder="请输入包间排序" :maxlength="10"
custom-class="!bg-[#F6F7F8] !rounded-16rpx !px-28rpx !py-20rpx" />
</view>
<!-- 推荐人数 -->
<view class="mt-28rpx add-textarea">
<view class="flex items-center justify-between mb-20rpx">
<view class="mr-10rpx text-32rpx text-[#303133] font-bold leading-44rpx">
推荐人数
</view>
</view>
<wd-input v-model="form.people_number" no-border placeholder="推荐人数1-5人" :maxlength="10"
custom-class="!bg-[#F6F7F8] !rounded-16rpx !px-28rpx !py-20rpx" />
</view>
</view>
<!-- 规格与价格 -->
@ -397,7 +426,7 @@
<script lang="ts" setup>
import { getRoomDetails, getRoomLabelList, handleCreateTag, handleDeleteTag, editRoom } from '@/api/store'
import { updateUserInfo } from '@/api/user'
import { router } from '@/utils/tools'
import { router, removeImageUrlPrefix } from '@/utils/tools'
import { toast } from '@/utils/toast'
import { useStoreStore } from '@/store'
@ -431,12 +460,15 @@
// 表单
const form = reactive({
title: '',
image: '',
image_arr: [] as string[],
img: '',
tags: [] as string[],
price: '',
hours: '',
video: null as any,
other_describe: '',
weight: 0,
people_number: ''
})
const tags = ref<Array<{ id: number, label_name: string, index: number }>>([])
const roomLabelId = ref<string>('')
@ -455,21 +487,25 @@
*/
handleGetRoomDetails: async () => {
const res = await getRoomDetails(roomId.value)
fileList.value = [{url: res.details.room.img, name: res.details.room.img }]
fileList.value =res.details.room.room_arr.map((url: string) => ({
url,
}))
roomLabelId.value = res.details.room.label_id
form.title = res.details.room.title
form.image = res.details.room.img
form.img = res.details.room.img
form.price = res.details.room.price.toString()
form.hours = res.details.room.hours.toString()
form.other_describe = res.details.room.other_describe || ''
form.weight = res.details.room.weight || 0
form.people_number = res.details.room.people_number || ''
},
/**
* 获取包间标签列表
*/
handleGetRoomLabels: async () => {
const res = await getRoomLabelList(useStore.defaultStore.id)
availableTags.value = res.list
@ -494,8 +530,6 @@
}
})
}
console.log("🚀 ~ availableTags.value:", availableTags.value)
},
/**
@ -514,23 +548,6 @@
showTagSelectPopup.value = true
},
/**
* 上传图片
*/
handleUploadSuccess: async (e: any) => {
try {
const response = JSON.parse(e.file.response)
if (response.code) {
const avatarUrl = response.data.url
form.image = avatarUrl
} else {
throw new Error('上传失败')
}
} catch (error) {
toast.info('上传失败')
}
},
/**
* 关闭选择标签弹窗
*/
@ -712,8 +729,8 @@
return
}
if (!form.image) {
toast.info('请上传团购图片')
if (fileList.value.length === 0) {
toast.info('请上传包间图片')
return
}
@ -727,14 +744,18 @@
return
}
const imgArr = removeImageUrlPrefix(fileList.value)
let params = {
id: roomId.value,
img: form.image.replace(import.meta.env.VITE_UPLOAD_IMAGE_URL, ''),
img: imgArr[0],
img_arr: imgArr.join(','),
title: form.title,
label_id: tags.value.map(tag => tag.id).join(','),
price: Number(form.price),
hours: Number(form.hours),
other_describe: form.other_describe,
weight: Number(form.weight),
people_number: form.people_number
}
uni.showLoading({
@ -745,13 +766,13 @@
await editRoom(params)
uni.hideLoading()
toast.info('修改成功')
router.navigateBack(1, 500)
// router.navigateBack(1, 500)
} catch (e) {
toast.info('修改失败,请稍后重试')
uni.hideLoading()
return
}
},
}
}
</script>

View File

@ -1,5 +1,6 @@
<route lang="jsonc" type="page">{
"layout": "tabbar",
"needLogin": true,
"style": {
"navigationStyle": "custom"
}