对接接口

This commit is contained in:
wangxiaowei
2025-12-17 23:34:08 +08:00
parent 018a784a8c
commit df863a2f41
19 changed files with 792 additions and 389 deletions

View File

@ -89,5 +89,6 @@
"Wechat", "Wechat",
"WechatMiniprogram", "WechatMiniprogram",
"Weixin" "Weixin"
] ],
"git.ignoreLimitWarning": true
} }

24
src/api/bank.ts Normal file
View File

@ -0,0 +1,24 @@
import { http } from '@/http/alova'
import type { IAddBankCardParams } from '@/api/types/bank'
/**
* 添加银行卡
*/
export function addBankCard(data: IAddBankCardParams) {
return http.Post('/storeapi/user/addBank', data)
}
/**
* 删除银行卡
*/
export function deleteBankCard(id: number) {
return http.Post('/storeapi/user/delBank', { id })
}
/**
* 获取银行卡列表
*/
export function getBankCardList() {
return http.Post<any>('/storeapi/user/checkBank')
}

View File

@ -19,4 +19,33 @@ export function getStoreDetails(id: number) {
*/ */
export function switchStore(id: number) { export function switchStore(id: number) {
return http.Post('/storeapi/store/switchStore', { id }) return http.Post('/storeapi/store/switchStore', { id })
}
/**
* 编辑门店信息
*/
export interface IEditStoreInfoParams {
id: number,
name?: string,
dy_uid?: string,
image?: string,
image_arr?: string[],
video?: string,
province?: string,
province_id?: Number,
city?: string,
city_id?: Number,
district?: string,
district_id?: Number,
address?: string,
area?: string,
contact_phone?: string,
day_time?: string,
start_time?: string,
end_time?: string,
}
export function editStoreInfo(data: IEditStoreInfoParams) {
return http.Post('/storeapi/store/editStore', data)
} }

7
src/api/types/bank.ts Normal file
View File

@ -0,0 +1,7 @@
export interface IAddBankCardParams {
bank_name: string
bank_card: string
mobile: number|string
code: number|string
bank_open_name: string
}

View File

@ -24,18 +24,37 @@ export interface IUpdateUserInfoParams {
} }
export function updateUserInfo(data: IUpdateUserInfoParams) { export function updateUserInfo(data: IUpdateUserInfoParams) {
console.log("🚀 ~ updateUserInfo ~ data:", data)
return http.Post('/storeapi/user/updateUser', data) return http.Post('/storeapi/user/updateUser', data)
} }
/**
* 获取流水明细
*/
export interface IGetUserTransactionDetailsParams {
page: number
size: number
end_time: string
}
export function getUserTransactionDetails(data: IGetUserTransactionDetailsParams) {
return http.Post<IOrderListResult>('/storeapi/user/balanceLogList', data)
}
/**
* 获取流水明细详情(账单明细)
*/
export function getUserTransactionDetailsInfo(id: number) {
return http.Post<any>('/storeapi/user/balanceLogDetails', { id })
}
/** /**
* 获取验证码 * 获取验证码
*/ */
export interface IGetVerificationCodeParams { export interface IGetStoreVerificationCodeParams {
mobile: string mobile: string
scene: number scene: string
} }
export function getVerificationCode(data: IGetVerificationCodeParams) { export function getVerificationCode(data: IGetStoreVerificationCodeParams) {
return http.Post('/storeapi/sms/sendCode', data) return http.Post('/storeapi/sms/sendCode', data)
} }

View File

@ -10,15 +10,13 @@
<template> <template>
<view> <view>
<!-- 请输入银行名称 -->
<view> <view>
<view class="flex justify-between items-center mx-38rpx"> <view class="flex justify-between items-center mx-38rpx">
<view class="text-30rpx leading-42rpx text-#303133">银行</view> <view class="text-30rpx leading-42rpx text-#303133">银行</view>
<view class="flex items-center"> <view class="flex items-center">
<view> <view>
<wd-input inputmode="decimal" size="large" placeholder="请选择银行" required no-border custom-input-class="!text-right" placeholderStyle="font-size: 30rpx; line-height: 42rpx; color: #c9c9c9;text-align: right;"></wd-input> <wd-input v-model="form.bank_name" size="large" placeholder="请输入银行名称" required no-border custom-input-class="!text-right" placeholderStyle="font-size: 30rpx; line-height: 42rpx; color: #c9c9c9;text-align: right;"></wd-input>
</view>
<view>
<wd-icon name='chevron-right' size="32rpx" color="#909399"></wd-icon>
</view> </view>
</view> </view>
</view> </view>
@ -27,12 +25,13 @@
</view> </view>
</view> </view>
<!-- 银行卡号 -->
<view> <view>
<view class="flex justify-between items-center mx-38rpx"> <view class="flex justify-between items-center mx-38rpx">
<view class="text-30rpx leading-42rpx text-#303133">银行卡号</view> <view class="text-30rpx leading-42rpx text-#303133">银行卡号</view>
<view class="flex items-center"> <view class="flex items-center">
<view > <view >
<wd-input inputmode="decimal" size="large" placeholder="请输入银行卡号" required no-border custom-input-class="!text-right" placeholderStyle="font-size: 30rpx; line-height: 42rpx; color: #c9c9c9;text-align: right;"></wd-input> <wd-input v-model="form.bank_card" size="large" placeholder="请输入银行卡号" required no-border custom-input-class="!text-right" placeholderStyle="font-size: 30rpx; line-height: 42rpx; color: #c9c9c9;text-align: right;"></wd-input>
</view> </view>
</view> </view>
</view> </view>
@ -40,13 +39,14 @@
<wd-gap height="2rpx" bg-color="#F2F2F2"></wd-gap> <wd-gap height="2rpx" bg-color="#F2F2F2"></wd-gap>
</view> </view>
</view> </view>
<!-- 开户行 -->
<view> <view>
<view class="flex justify-between items-center mx-38rpx"> <view class="flex justify-between items-center mx-38rpx">
<view class="text-30rpx leading-42rpx text-#303133">绑定手机号</view> <view class="text-30rpx leading-42rpx text-#303133">开户行</view>
<view class="flex items-center"> <view class="flex items-center">
<view > <view >
<wd-input inputmode="decimal" size="large" placeholder="请输入银行卡号" no-border custom-input-class="!text-right" placeholderStyle="font-size: 30rpx; line-height: 42rpx; color: #c9c9c9;text-align: right;"></wd-input> <wd-input v-model="form.bank_open_name" size="large" placeholder="请输入开户行名称" no-border custom-input-class="!text-right" placeholderStyle="font-size: 30rpx; line-height: 42rpx; color: #c9c9c9;text-align: right;"></wd-input>
</view> </view>
</view> </view>
</view> </view>
@ -55,12 +55,28 @@
</view> </view>
</view> </view>
<!-- 绑定手机号 -->
<view>
<view class="flex justify-between items-center mx-38rpx">
<view class="text-30rpx leading-42rpx text-#303133">绑定手机号</view>
<view class="flex items-center">
<view >
<wd-input v-model="form.mobile" size="large" placeholder="请输入绑定手机号" no-border custom-input-class="!text-right" placeholderStyle="font-size: 30rpx; line-height: 42rpx; color: #c9c9c9;text-align: right;"></wd-input>
</view>
</view>
</view>
<view>
<wd-gap height="2rpx" bg-color="#F2F2F2"></wd-gap>
</view>
</view>
<!-- 验证码 -->
<view> <view>
<view class="flex justify-between items-center mx-38rpx"> <view class="flex justify-between items-center mx-38rpx">
<view class="text-30rpx leading-42rpx text-#303133 w-100rpx">验证码</view> <view class="text-30rpx leading-42rpx text-#303133 w-100rpx">验证码</view>
<view class="flex items-center"> <view class="flex items-center">
<view> <view>
<wd-input inputmode="decimal" size="large" placeholder="请输入银行卡号" no-border custom-input-class="!text-right" placeholderStyle="font-size: 30rpx; line-height: 42rpx; color: #c9c9c9;text-align: right;"> <wd-input size="large" v-model="form.code" placeholder="请输入验证码" no-border custom-input-class="!text-right" placeholderStyle="font-size: 30rpx; line-height: 42rpx; color: #c9c9c9;text-align: right;">
<template #suffix> <template #suffix>
<view class="flex items-center"> <view class="flex items-center">
<view class="flex items-center"> <view class="flex items-center">
@ -92,6 +108,11 @@
<script lang="ts" setup> <script lang="ts" setup>
import {toast} from '@/utils/toast' import {toast} from '@/utils/toast'
import type { IAddBankCardParams } from '@/api/types/bank'
import { addBankCard } from '@/api/bank'
import { getVerificationCode } from '@/api/user'
import { SMS_ENUM } from '@/enum/sms'
const OSS = inject('OSS') const OSS = inject('OSS')
@ -113,43 +134,77 @@
const countDown = ref<any>(null) // 倒计时组件 const countDown = ref<any>(null) // 倒计时组件
// 表单 // 表单
const form = reactive<{ const form = reactive<IAddBankCardParams>({
settleIn: number, bank_name: '',
code: string, bank_card: '',
message: string, mobile: '',
area: string[]
}>({
settleIn: 1,
code: '', code: '',
message: '', bank_open_name: '',
area: []
}) })
const Add = { const Add = {
// 确定提现
handleConfirmwithdrawMoney: () => {
/**
* 绑定银行卡
*/
handleBindBankCard: async () => {
if (!form.bank_name) {
toast.info('请输入银行名称')
return
}
if (!form.bank_card) {
toast.info('请输入银行卡号')
return
}
if (!form.mobile) {
toast.info('请输入绑定手机号')
return
}
if (!form.bank_open_name) {
toast.info('请输入开户行名称')
return
}
if (!form.code) {
toast.info('请输入验证码')
return
}
try {
await addBankCard(form)
toast.success('绑定成功')
uni.navigateBack()
} catch (error) {
toast.info('绑定失败,请稍后重试')
return
}
}, },
// 发送验证码 /**
handleCountDown: () => { * 发送验证码
*/
handleCountDown: async () => {
if (!form.mobile) {
toast.info('请输入绑定手机号')
return
}
await getVerificationCode({ scene: SMS_ENUM.BANK, mobile: String(form.mobile) })
startCountDown.value = true startCountDown.value = true
nextTick(() => { nextTick(() => {
countDown.value?.start() countDown.value?.start()
// 发送验证码请求
}) })
}, },
// 验证码倒计时结束 /**
* 验证码倒计时结束
*/
handleFinishCountDown: () => { handleFinishCountDown: () => {
startCountDown.value = false startCountDown.value = false
}, },
// 绑定银行卡
handleBindBankCard: () => {
toast.info('绑定成功')
}
} }
</script> </script>

View File

@ -77,8 +77,33 @@
</template> </template>
<script lang="ts" setup> <script lang="ts" setup>
import { getUserTransactionDetailsInfo } from '@/api/user'
const OSS = inject('OSS') const OSS = inject('OSS')
// 提现明细
const id = ref<number>(0)
const billDetails = ref<any>({
id: 0,
amount: 0,
change_type: 0,
order: {
order_sn: '',
pay_way: '', // 支付方式 1余额支付 2微信支付 3门店支付
nickname: '',
mobile: '',
update_dtime: '',
service_price: ''
}
})
onLoad(async (args) => {
id.value = Number(args.id) || 0
const res = await getUserTransactionDetailsInfo(id.value)
billDetails.value = res.details
console.log("🚀 ~ billDetails.value:", billDetails.value)
})
</script> </script>

View File

@ -24,7 +24,7 @@
<view class="mt-32rpx"> <view class="mt-32rpx">
<view class="font-bold text-32rpx text-[#303133] leading-44rpx">抖音UID</view> <view class="font-bold text-32rpx text-[#303133] leading-44rpx">抖音UID</view>
<view class="mt-10rpx"> <view class="mt-10rpx">
<wd-input v-model="form.uid" :maxlength="20" show-word-limit placeholder="请输入抖音UID"/> <wd-input v-model="form.dy_uid" :maxlength="20" show-word-limit placeholder="请输入抖音UID"/>
</view> </view>
</view> </view>
@ -34,11 +34,11 @@
<view class="mt-50rpx"> <view class="mt-50rpx">
<view class="text-30rpx leading-42rpx text-[#303133]">省市区</view> <view class="text-30rpx leading-42rpx text-[#303133]">省市区</view>
<view class="border-b border-b-solid border-b-[#e5e7eb] area"> <view class="border-b border-b-solid border-b-[#e5e7eb] area">
<wd-col-picker v-model="form.area" :columns="area" :column-change="columnChange" @confirm="EditStore.handleConfirmAddress" placeholder="请选择省市区"></wd-col-picker> <wd-col-picker v-model="address" :columns="area" :column-change="columnChange" auto-complete @confirm="EditStore.handleConfirmAddress" placeholder="请选择省市区"> </wd-col-picker>
</view> </view>
</view> </view>
<view class="mt-28rpx"> <view class="mt-28rpx">
<view class="text-30rpx leading-42rpx text-[#303133]">省市区</view> <view class="text-30rpx leading-42rpx text-[#303133]">地址</view>
<view> <view>
<wd-input v-model="form.address" placeholder="请填写具体地址"/> <wd-input v-model="form.address" placeholder="请填写具体地址"/>
</view> </view>
@ -66,12 +66,12 @@
<view class="mt-32rpx"> <view class="mt-32rpx">
<view class="font-bold text-32rpx text-[#303133] leading-44rpx">门店电话</view> <view class="font-bold text-32rpx text-[#303133] leading-44rpx">门店电话</view>
<view class="mt-10rpx"> <view class="mt-10rpx">
<wd-input v-model="form.uid" :maxlength="20" show-word-limit placeholder="请输入门店电话"/> <wd-input v-model="form.contact_phone" :maxlength="20" show-word-limit placeholder="请输入门店电话"/>
</view> </view>
</view> </view>
<!-- 门店视频 --> <!-- 门店视频 -->
<view class="mt-32rpx"> <!-- <view class="mt-32rpx">
<view class="font-bold text-32rpx text-[#303133] leading-44rpx">门店视频</view> <view class="font-bold text-32rpx text-[#303133] leading-44rpx">门店视频</view>
<view class="mt-32rpx"> <view class="mt-32rpx">
<wd-upload :file-list="fileList" :limit="1" image-mode="scaleToFill" accept="video" :action="action" <wd-upload :file-list="fileList" :limit="1" image-mode="scaleToFill" accept="video" :action="action"
@ -86,14 +86,13 @@
</view> </view>
</wd-upload> </wd-upload>
</view> </view>
</view> </view> -->
<!-- 门店图片 --> <!-- 门店图片 -->
<view class="mt-32rpx"> <view class="mt-32rpx">
<view class="font-bold text-32rpx text-[#303133] leading-44rpx">门店图片</view> <view class="font-bold text-32rpx text-[#303133] leading-44rpx">门店图片</view>
<view class="mt-32rpx"> <view class="mt-32rpx">
<wd-upload :file-list="fileList" :limit="9" image-mode="scaleToFill" accept="image" :action="action" <wd-upload :header="{'token': token}" :file-list="fileList" image-mode="aspectFill" :limit="9" multiple :action="action"
@change="EditStore.handleUploadFile"> @change="EditStore.handleUploadFile">
<view <view
class="border-2rpx border-dashed border-[#E5E5E5] w-184rpx h-184rpx flex flex-col items-center justify-center rounded-16rpx"> class="border-2rpx border-dashed border-[#E5E5E5] w-184rpx h-184rpx flex flex-col items-center justify-center rounded-16rpx">
<view class=""> <view class="">
@ -116,37 +115,26 @@
<script lang="ts" setup> <script lang="ts" setup>
import { useColPickerData } from '@/hooks/useColPickerData' import { useColPickerData } from '@/hooks/useColPickerData'
import { toast } from '@/utils/toast' import { toast } from '@/utils/toast'
import { getStoreDetails, editStoreInfo } from '@/api/store'
import { useStoreStore } from '@/store'
const OSS = inject('OSS') const OSS = inject('OSS')
const useStore = useStoreStore()
const token = ref<string>('') // 用户token
// 上传文件 // 上传文件
// const fileList = ref<any[]>([])
const fileList = ref<any[]>([]) const fileList = ref<any[]>([])
const action = 'https://www.mocky.io/v2/5cc8019d300000980a055e76' // 仅做测试使用,实际请换成真实上传接口 const action = import.meta.env.VITE_UPLOAD_BASEURL
// 表单数据
const form = ref({
name: "",
uid: "",
area: [],
address: "",
start_time: "",
end_time: "",
phone: ""
})
// 省市区数据 // 省市区数据
const { colPickerData, findChildrenByCode } = useColPickerData() const { colPickerData, findChildrenByCode } = useColPickerData()
const value = ref<string[]>([]) const address = ref<string[]>([])
const area = ref<any[]>([ const area = ref<any[]>([])
colPickerData.map((item) => { const columnChange = async ({ selectedItem, resolve, finish }) => {
return { await EditStore.handleSleep(0)
value: item.value,
label: item.text const areaData = findChildrenByCode(colPickerData, selectedItem.value)
}
})
])
const columnChange = ({ selectedItem, resolve, finish }) => {
const areaData = findChildrenByCode(colPickerData, selectedItem.value)
if (areaData && areaData.length) { if (areaData && areaData.length) {
resolve( resolve(
areaData.map((item) => { areaData.map((item) => {
@ -161,27 +149,178 @@
} }
} }
// 门店信息
const form = ref({
id: 0,
name: '',
dy_uid: '',
image: '',
image_arr: [],
video: '',
province: '',
province_id: 0,
city: '',
city_id: 0,
district: '',
district_id: 0,
address: '',
area: '',
contact_phone: '',
day_time: '',
start_time: '',
end_time: '',
})
onShow(() => {
})
onLoad(() => {
token.value = uni.getStorageSync('token')
EditStore.handleGetStoreDetails()
})
const EditStore = { const EditStore = {
fileList: [],
/**
* 获取店铺详情
*/
handleGetStoreDetails: async () => {
const storeDetails = await getStoreDetails(useStore.defaultStore.id)
// 只取需要的字段赋值,避免污染
const d = storeDetails.details
form.value = {
id: d.id,
name: d.name,
dy_uid: d.dy_uid,
image: d.image,
image_arr: d.image_arr || [],
video: d.video || '',
province: d.province,
province_id: d.province_id,
city: d.city,
city_id: d.city_id,
district: d.district,
district_id: d.district_id,
address: d.address,
area: d.area,
contact_phone: d.contact_phone,
day_time: d.day_time,
start_time: d.start_time,
end_time: d.end_time,
}
fileList.value = (d.image_arr || []).map((item: string) => ({ url: item, name: item}))
EditStore.fileList = fileList.value
address.value = [
String(d.province_id),
String(d.city_id),
String(d.district_id)
]
},
/** /**
* 选择省市区 * 选择省市区
* @param selected * @param selected
*/ */
handleConfirmAddress(selected) { handleConfirmAddress(item) {
form.value.address = selected.map(item => item.label) form.value.province = item.selectedItems[0].label
form.value.province_id = Number(item.selectedItems[0].value)
form.value.city = item.selectedItems[1].label
form.value.city_id = Number(item.selectedItems[1].value)
form.value.district = item.selectedItems[2].label
form.value.district_id = Number(item.selectedItems[2].value)
}, },
/** /**
* 图片选择/删除 * 图片选择/删除
*/ */
handleUploadFile: (event: any) => { handleUploadFile: ({ fileList: files }) => {
fileList.value = event.fileList let url = ''
let name = ''
let response = null
const res = files.map(item => {
if (item.response) {
response = JSON.parse(item.response)
url = response.data.uri
name = response.data.name
}
return {
name: name || item.name,
url: url || item.url
}
})
EditStore.fileList = res
}, },
/** /**
* 保存门店信息 * 保存门店信息
*/ */
handleSaveStoreInfo: () => { handleSaveStoreInfo: async () => {
toast.info('保存成功') if (!form.value.name) {
toast.info('请输入门店名称')
return
}
if (!form.value.address) {
toast.info('请输入门店地址')
return
}
if (!form.value.start_time) {
toast.info('请选择营业开始时间')
return
}
if (!form.value.end_time) {
toast.info('请选择营业结束时间')
return
}
if (!form.value.contact_phone) {
toast.info('请输入门店电话')
return
}
if (EditStore.fileList.length === 0) {
toast.info('请上传门店图片')
return
}
form.value.image_arr = EditStore.fileList.map(item => item.url)
form.value.image = EditStore.fileList[0].url
form.value.id = useStore.defaultStore.id
uni.showLoading({
title: '保存中...'
})
try {
await editStoreInfo(form.value)
EditStore.handleGetStoreDetails()
uni.hideLoading()
toast.info('保存成功')
} catch (error) {
uni.hideLoading()
toast.info('保存失败,请稍后重试')
return
}
},
/**
* 等待城市数据渲染
* @param second
*/
handleSleep: async (second: number = 1) => {
return new Promise((resolve) => {
setTimeout(() => {
resolve(true)
}, 1000 * second)
})
} }
} }

View File

@ -15,23 +15,23 @@
<!-- 订单详情 --> <!-- 订单详情 -->
<view class="mt-28rpx mx-32rpx bg-white rounded-16rpx py-30rpx relative"> <view class="mt-28rpx mx-32rpx bg-white rounded-16rpx py-30rpx relative">
<view class="absolute top-0 right-38rpx"> <view class="absolute top-0 right-38rpx">
<!-- TODO 预定或续订图标或团购核销 --> <!-- change_type: 1包间预定 2包间续订 3提现 4团购核销 -->
<wd-img width="112rpx" height="112rpx" :src="`${OSS}images/store/bill/image1.png`" <wd-img v-if="billDetails.change_type == 1" width="112rpx" height="112rpx" :src="`${OSS}images/store/bill/image1.png`"
mode="aspectFill" /> mode="aspectFill" />
<!-- <wd-img width="112rpx" height="112rpx" :src="`${OSS}images/store/bill/image2.png`" <wd-img v-if="billDetails.change_type == 2" width="112rpx" height="112rpx" :src="`${OSS}images/store/bill/image2.png`"
mode="aspectFill" />
<wd-img v-if="billDetails.change_type == 4" width="112rpx" height="112rpx" :src="`${OSS}images/store/bill/image3.png`"
mode="aspectFill" /> mode="aspectFill" />
<wd-img width="112rpx" height="112rpx" :src="`${OSS}images/store/bill/image3.png`"
mode="aspectFill" /> -->
</view> </view>
<view class="flex items-center"> <view class="flex items-center">
<view class="w-8rpx h-32rpx bg-[#4C9F44] mr-22rpx"></view> <view class="w-8rpx h-32rpx bg-[#4C9F44] mr-22rpx"></view>
<view class="font-bold text-28rpx leading-40rpx text-[#303133]">订单号1744601722882174</view> <view class="font-bold text-28rpx leading-40rpx text-[#303133]">订单号{{ billDetails.order.order_sn }}</view>
</view> </view>
<view class="mt-38rpx text-center"> <view class="mt-38rpx text-center">
<view class="text-28rpx leading-40rpx text-[#606266]">金额</view> <view class="text-28rpx leading-40rpx text-[#606266]">金额</view>
<view class="mt-20rpx"> <view class="mt-20rpx">
+ <price-format color="#000" :first-size="36" :second-size="36" :showSubscript="false"></price-format> + <price-format color="#000" :first-size="36" :second-size="36" :showSubscript="false" :price="billDetails.amount"></price-format>
</view> </view>
</view> </view>
@ -40,19 +40,19 @@
<view class="text-28rpx leading-40rpx text-[#606266] mx-28rpx"> <view class="text-28rpx leading-40rpx text-[#606266] mx-28rpx">
<view class="flex justify-between items-center mb-16rpx"> <view class="flex justify-between items-center mb-16rpx">
<view>消费类型</view> <view>消费类型</view>
<view>包间预定 || 包间续费 || 团购核销</view> <view>{{ Bill.handleMapTransactionType(billDetails.change_type) }}</view>
</view> </view>
<view class="flex justify-between items-center mb-16rpx"> <view class="flex justify-between items-center mb-16rpx">
<view>交易方式</view> <view>交易方式</view>
<view>微信支付</view> <view>{{ PayWayText[billDetails.order.pay_way] }}</view>
</view> </view>
<view class="flex justify-between items-center mb-16rpx"> <view class="flex justify-between items-center mb-16rpx">
<view>消费金额</view> <view>消费金额</view>
<view>158</view> <view>{{ billDetails.amount }}</view>
</view> </view>
<view class="flex justify-between items-center mb-16rpx"> <view class="flex justify-between items-center mb-16rpx">
<view>平台服务费</view> <view>平台服务费</view>
<view>158</view> <view>{{ billDetails.service_price }}</view>
</view> </view>
</view> </view>
@ -61,16 +61,16 @@
<view class="text-28rpx leading-40rpx text-[#606266] mx-28rpx"> <view class="text-28rpx leading-40rpx text-[#606266] mx-28rpx">
<view class="flex justify-between items-center mb-16rpx"> <view class="flex justify-between items-center mb-16rpx">
<view>用户名</view> <view>用户名</view>
<view>用户名</view> <view>{{ billDetails.order.nickname }}</view>
</view> </view>
<!-- 如果是茶室预定类型则显示消费门店 --> <!-- 如果是茶室预定类型则显示消费门店 -->
<view class="flex justify-between items-center mb-16rpx"> <view class="flex justify-between items-center mb-16rpx">
<view>用户手机号</view> <view>用户手机号</view>
<view>茶艺师的昵称</view> <view>{{ billDetails.order.mobile }}</view>
</view> </view>
<view class="flex justify-between items-center mb-16rpx"> <view class="flex justify-between items-center mb-16rpx">
<view>支付时间</view> <view>支付时间</view>
<view>2025-04-25 04:43</view> <view>{{ billDetails.order.update_dtime }}</view>
</view> </view>
</view> </view>
</view> </view>
@ -79,8 +79,48 @@
<script lang="ts" setup> <script lang="ts" setup>
import { getUserTransactionDetailsInfo } from '@/api/user'
import { PayWayText } from '@/utils/pay'
const OSS = inject('OSS') const OSS = inject('OSS')
// 账单明细
const id = ref<number>(0)
const billDetails = ref<any>({
id: 0,
amount: 0,
change_type: 0,
order: {
order_sn: '',
pay_way: '', // 支付方式 1余额支付 2微信支付 3门店支付
nickname: '',
mobile: '',
update_dtime: '',
service_price: ''
}
})
onLoad(async (args) => {
id.value = Number(args.id) || 0
const res = await getUserTransactionDetailsInfo(id.value)
billDetails.value = res.details
console.log("🚀 ~ billDetails.value:", billDetails.value)
})
const Bill = {
/**
* 映射流水明细类型
*/
handleMapTransactionType: (type: number) => {
const typeMap: Record<number, string> = {
1: '包间预定',
2: '包间续费',
3: '提现',
4: '团购核销'
}
return typeMap[type] || '其他'
}
}
</script> </script>
<style lang="scss"> <style lang="scss">

View File

@ -35,9 +35,9 @@
<view class="font-400 text-28rpx leading-40rpx text-[#303133]">余额</view> <view class="font-400 text-28rpx leading-40rpx text-[#303133]">余额</view>
<view class="flex justify-between items-center mt-24rpx"> <view class="flex justify-between items-center mt-24rpx">
<view> <view>
<price-format color="#000" :first-size="48" :second-size="48" :subscript-size="28" :price="23.02"></price-format> <price-format color="#000" :first-size="48" :second-size="48" :subscript-size="28" :price="userStore.userMoney"></price-format>
</view> </view>
<view class="w-200rpx h-80rpx bg-[#4C9F44] rounded-8rpx font-bold text-28rpx leading-80rpx text-center text-[#fff]" @click="wallet.handleToRecharge"> <view class="w-200rpx h-80rpx bg-[#4C9F44] rounded-8rpx font-bold text-28rpx leading-80rpx text-center text-[#fff]" @click="Wallet.handleToRecharge">
提现 提现
</view> </view>
</view> </view>
@ -52,7 +52,7 @@
<view class="border-2rpx border-solid border-[#E5E5E5] w-196rpx h-56rpx flex justify-center items-center rounded-8rpx"> <view class="border-2rpx border-solid border-[#E5E5E5] w-196rpx h-56rpx flex justify-center items-center rounded-8rpx">
<view class="text-24rpx leading-34rpx text-[#606266] wall-date"> <view class="text-24rpx leading-34rpx text-[#606266] wall-date">
<!-- 2019年5月 --> <!-- 2019年5月 -->
<wd-datetime-picker v-model="value" :maxDate="Date.now()" type="year-month" @confirm="wallet.handleConfirmDate"></wd-datetime-picker> <wd-datetime-picker v-model="value" :maxDate="Date.now()" type="year-month" @confirm="Wallet.handleConfirmDate"></wd-datetime-picker>
</view> </view>
<view> <view>
<wd-icon name="fill-arrow-down" size="32rpx" color="#BFC2CC"></wd-icon> <wd-icon name="fill-arrow-down" size="32rpx" color="#BFC2CC"></wd-icon>
@ -62,46 +62,51 @@
<view> <view>
<!-- 最后一个元素不显示border --> <!-- 最后一个元素不显示border -->
<mescroll-body @init="mescrollInit" @down="downCallback" @up="wallet.upCallback" :up="upOption"> <mescroll-body @init="mescrollInit" @down="downCallback" @up="Wallet.upCallback" :up="upOption">
<!-- TODO 这里除了提现其余的要跳转到账单明细/bundle/wallet/wallet提现/bundle/parten/pages/withdraw/withdraw--> <!-- TODO 这里除了提现其余的要跳转到账单明细/bundle/wallet/wallet提现/bundle/parten/pages/withdraw/withdraw-->
<view class="h-144rpx leading-144rpx mt-18rpx border-b border-b-solid border-b-[#E5E5E5] flex items-center justify-between pb-14rpx" @click="wallet.handleToBillDetail(item)" v-for="(item, index) in 5" :key="index"> <view class="h-144rpx leading-144rpx mt-18rpx border-b border-b-solid border-b-[#E5E5E5] flex items-center justify-between pb-14rpx" @click="Wallet.handleToBillDetail(item)" v-for="item in list" :key="item.id">
<view> <view>
<view class="font-bold text-30rpx leading-42rpx text-[#303133]"> <view class="font-bold text-30rpx leading-42rpx text-[#303133]">
<view>包间预定</view>
<!-- <view>包间续费</view>
<view>团购核销</view>
<view class="flex items-center"> <view class="flex items-center">
<view>提现</view> <view>{{ Wallet.handleMapTransactionType(item.change_type) }}</view>
<view class="w-86rpx h-32rpx leading-32rpx text-center ml-30rpx text-[#40AE36] text-22rpx rounded-4rpx border-2rpx border-solid border-[#40AE36]">申请中</view> <view
</view> --> v-if="item.change_type == 3 && item.reflect_status == 0"
class="w-86rpx h-32rpx leading-32rpx text-center ml-30rpx text-[#40AE36] text-22rpx rounded-4rpx border-2rpx border-solid border-[#40AE36]">
申请中
</view>
<view
v-if="item.change_type == 3 && item.reflect_status == 2"
class="w-86rpx h-32rpx leading-32rpx text-center ml-30rpx text-[#E64545] text-22rpx rounded-4rpx border-2rpx border-solid border-[#E64545]">
已拒绝
</view>
</view>
</view> </view>
<view class="text-24rpx text-[#606266] leading-34rpx mt-16rpx"> <view class="text-24rpx text-[#606266] leading-34rpx mt-16rpx">
<!-- TODO 包间预定 || 包间续费下显示 --> <text v-if="item.change_type <= 2">预定账号{{ item.mobile }}</text>
<text>预定账号13917942276</text>
</view> </view>
<view class="mt-12rpx text-24rpx text-[#606266] leading-34rpx"> <view class="mt-12rpx text-24rpx text-[#606266] leading-34rpx">
2025-03-02 11:20 {{ item.create_time }}
</view> </view>
</view> </view>
<view> <view>
<view class="flex items-center h-50rpx"> <view class="flex items-center h-50rpx">
<view class="mr-16rpx"> <view class="mr-16rpx">
+<price-format color="#000" :first-size="36" :second-size="36" :showSubscript="false"></price-format> <text> {{ item.change_type == 3 ? '-' : '+' }}</text>
<price-format color="#000" :first-size="36" :second-size="36" :showSubscript="false" :price="item.amount"></price-format>
</view> </view>
<view> <view>
<wd-icon name="arrow-right" size="32rpx" color="#9496A5"></wd-icon> <wd-icon name="arrow-right" size="32rpx" color="#9496A5"></wd-icon>
</view> </view>
</view> </view>
<view class="text-24rpx text-[#909399] leading-34rpx"> <view class="text-24rpx text-[#909399] leading-34rpx">
余额5,224.55 余额 {{ item.after_amount }}
</view> </view>
</view> </view>
</view> </view>
</mescroll-body> </mescroll-body>
</view> </view>
</view> </view>
</view> </view>
</template> </template>
@ -109,84 +114,102 @@
<script lang="ts" setup> <script lang="ts" setup>
import { onPageScroll, onReachBottom } from '@dcloudio/uni-app' import { onPageScroll, onReachBottom } from '@dcloudio/uni-app'
import useMescroll from "@/uni_modules/mescroll-uni/hooks/useMescroll.js" import useMescroll from "@/uni_modules/mescroll-uni/hooks/useMescroll.js"
import { useUserStore } from '@/store'
import type { IUserResult } from '@/api/types/user'
import { getUserInfo, getUserTransactionDetails } from '@/api/user'
import { router } from '@/utils/tools'
const OSS = inject('OSS') const OSS = inject('OSS')
const userStore = useUserStore()
// 用户信息相关
/* mescroll */ /* mescroll */
const upOption = reactive({
empty: {
icon : OSS + 'icon/icon_reserver_empty.png',
}
})
const { mescrollInit, downCallback, getMescroll } = useMescroll(onPageScroll, onReachBottom) // 调用mescroll的hook const { mescrollInit, downCallback, getMescroll } = useMescroll(onPageScroll, onReachBottom) // 调用mescroll的hook
const downOption = {
// 日期过滤 auto: true
}
const upOption = {
auto: true,
textNoMore: '~ 已经到底啦 ~', //无更多数据的提示
}
const list = ref<Array<any>>([]) // 茶室列表
const value = ref<number>(Date.now()) const value = ref<number>(Date.now())
const selectTime = ref<string>('')
onShow(() => {
})
const wallet = { const Wallet = {
// 上拉加载的回调: 其中num:当前页 从1开始, size:每页数据条数,默认10 // 上拉加载的回调: 其中num:当前页 从1开始, size:每页数据条数,默认10
upCallback: (mescroll) => { upCallback: (mescroll) => {
// 需要留一下数据为空的时候显示的空数据图标内容 const filter = {
// list({ page: mescroll.num,
// page: mescroll.num, size: mescroll.size,
// size: mescroll.size end_time: selectTime.value
// }).then((res: { list: Array<any>, totalPages: Number }) => { }
// const curPageData = res.list || [] // 当前页数据
// if(mescroll.num == 1) goods.value = []; // 第一页需手动制空列表
// goods.value = goods.value.concat(curPageData); //追加新数据
// console.log("🚀 ~ goods:", goods) getUserTransactionDetails(filter).then((res) => {
const curPageData = res.list || [] // 当前页数据
// mescroll.endByPage(curPageData.length, res.totalPages); //必传参数(当前页的数据个数, 总页数) if(mescroll.num == 1) list.value = [] // 第一页需手动制空列表
list.value = list.value.concat(curPageData) //追加新数据
// }).catch(() => { mescroll.endSuccess(curPageData.length, Boolean(res.more))
// mescroll.endErr(); // 请求失败, 结束加载 }).catch(() => {
// }) mescroll.endErr() // 请求失败, 结束加载
// apiGoods(mescroll.num, mescroll.size).then(res=>{ })
// const curPageData = res.list || [] // 当前页数据
// if(mescroll.num == 1) goods.value = []; // 第一页需手动制空列表
// goods.value = goods.value.concat(curPageData); //追加新数据
// //联网成功的回调,隐藏下拉刷新和上拉加载的状态;
// //mescroll会根据传的参数,自动判断列表如果无任何数据,则提示空;列表无下一页数据,则提示无更多数据;
// //方法一(推荐): 后台接口有返回列表的总页数 totalPage
// //mescroll.endByPage(curPageData.length, totalPage); //必传参数(当前页的数据个数, 总页数)
// //方法二(推荐): 后台接口有返回列表的总数据量 totalSize
// //mescroll.endBySize(curPageData.length, totalSize); //必传参数(当前页的数据个数, 总数据量)
// //方法三(推荐): 您有其他方式知道是否有下一页 hasNext
// //mescroll.endSuccess(curPageData.length, hasNext); //必传参数(当前页的数据个数, 是否有下一页true/false)
// //方法四 (不推荐),会存在一个小问题:比如列表共有20条数据,每页加载10条,共2页.如果只根据当前页的数据个数判断,则需翻到第三页才会知道无更多数据.
// mescroll.endSuccess(curPageData.length); // 请求成功, 结束加载
// }).catch(()=>{
mescroll.endErr(); // 请求失败, 结束加载
// })
}, },
// 确认日期- /**
* 日期筛选
* @param date
*/
handleConfirmDate: (date: {value: number}) => { handleConfirmDate: (date: {value: number}) => {
const d = new Date(date.value) const d = new Date(date.value)
console.log("🚀 ~ d:", d)
const year = d.getFullYear() const year = d.getFullYear()
const month = d.getMonth() + 1 const month = d.getMonth() + 1
console.log(`${year}${month}`); selectTime.value = `${year}-${month < 10 ? '0' + month : month}`
// 切换tab时,重置当前的mescroll
list.value = []
getMescroll().resetUpScroll();
}, },
// 去提现 /**
* 去提现
*/
handleToRecharge: () => { handleToRecharge: () => {
uni.navigateTo({ uni.navigateTo({
url: '/bundle/parten/pages/withdraw/withdraw' url: '/bundle/parten/pages/withdraw/withdraw'
}) })
}, },
// 跳转对应账单详情 /**
handleToBillDetail: (id: number) => { * 跳转对应账单详情
uni.navigateTo({ * @param id
url: `/bundle/wallet/bill?id=${id}` */
}) handleToBillDetail: (item: {id: number, change_type: number}) => {
// change_type: 1包间预定 2包间续订 3提现 4团购核销
if (item.change_type === 3) {
router.navigateTo(`/bundle/parten/pages/withdraw/progress?id=${item.id}`)
return
} else {
router.navigateTo(`/bundle/wallet/bill?id=${item.id}`)
return
}
},
/**
* 映射流水明细类型
*/
handleMapTransactionType: (type: number) => {
const typeMap: Record<number, string> = {
1: '包间预定',
2: '包间续费',
3: '提现',
4: '团购核销'
}
return typeMap[type] || '其他'
} }
} }
</script> </script>

6
src/enum/sms.ts Normal file
View File

@ -0,0 +1,6 @@
// 短信枚举
export enum SMS_ENUM {
YZMDL = 'YZMDL', // 验证码登录
BANK = 'BANK', // 绑定银行卡
}

View File

@ -64,7 +64,7 @@ const alovaInstance = createAlova({
const token = uni.getStorageSync('token') const token = uni.getStorageSync('token')
if (!token) { if (!token) {
toast.info('请先登录') toast.info('请先登录')
router.switchTab(import.meta.env.VITE_LOGIN_URL, 500) router.navigateTo(import.meta.env.VITE_LOGIN_URL, 500)
throw new Error('[请求错误]:未登录') throw new Error('[请求错误]:未登录')
} }

View File

@ -133,7 +133,7 @@
}, },
"quickapp": {}, "quickapp": {},
"mp-weixin": { "mp-weixin": {
"appid": "wx63e106209b842919", "appid": "wx14a689c7c318bea8",
"setting": { "setting": {
"urlCheck": false, "urlCheck": false,
"es6": true, "es6": true,

View File

@ -164,7 +164,6 @@
}) })
const Index = { const Index = {
handleInit: async() => { handleInit: async() => {
await Index.handleGetStoreList() await Index.handleGetStoreList()
@ -175,13 +174,9 @@
* 获取门店列表 * 获取门店列表
*/ */
handleGetStoreList: async() => { handleGetStoreList: async() => {
console.log("🚀 ~ Index.handleGetStoreList:", 'Index.handleGetStoreLis123')
const storeLists = await getStoreList() const storeLists = await getStoreList()
// 保证 storeList.value 一定为数组 // 保证 storeList.value 一定为数组
storeList.value = Array.isArray(storeLists.list) ? storeLists.list : Object.values(storeLists.list || {}) storeList.value = Array.isArray(storeLists.list) ? storeLists.list : Object.values(storeLists.list || {})
console.log("🚀 ~ storeList.value:", storeList.value)
console.log("🚀 ~ storeList.value:", storeList.value.length)
if (storeList.value.length > 0) { if (storeList.value.length > 0) {
useStore.setStoreList(storeList.value) useStore.setStoreList(storeList.value)
@ -204,14 +199,12 @@
if (!defaultStore.value) return if (!defaultStore.value) return
const storeDetails = await getStoreDetails(useStore.defaultStore.id) const storeDetails = await getStoreDetails(useStore.defaultStore.id)
store.value = storeDetails.details store.value = storeDetails.details
console.log("🚀 ~ storeDetails:", storeDetails)
}, },
/** /**
* 选择扫码验券菜单 * 选择扫码验券菜单
*/ */
handleSelectScanMenu: (item: { item: { name: string }}) => { handleSelectScanMenu: (item: { item: { name: string }}) => {
console.log("🚀 ~ item:", item)
if (item.item.name === '扫码验券') { if (item.item.name === '扫码验券') {
Index.handleScanCode() Index.handleScanCode()
} else if (item.item.name === '输入券码') { } else if (item.item.name === '输入券码') {
@ -234,13 +227,6 @@
console.log('scanCode err:', err) console.log('scanCode err:', err)
} }
}) })
},
/**
* 一键续订时间
*/
handleChooseRenewTime: (item) => {
console.log("🚀 ~ item:", item)
} }
} }
</script> </script>

View File

@ -100,7 +100,7 @@
toast.success('登录成功') toast.success('登录成功')
setTimeout(() => { setTimeout(() => {
router.navigateBack() router.reLaunch('/pages/index/index')
}, 1000) }, 1000)
} catch (error) { } catch (error) {
toast.info('登录失败,请稍后重试') toast.info('登录失败,请稍后重试')

View File

@ -5,160 +5,6 @@
} }
}</route> }</route>
<script lang="ts" setup>
import type { IUserResult } from '@/api/types/user'
import { getUserInfo } from '@/api/user'
import { useUserStore } from '@/store'
import { router } from '@/utils/tools'
const OSS = inject('OSS')
const navbarHeight = inject('navbarHeight')
const rightPadding = inject('capsuleOffset')
// 登录信息相关
const user = ref<IUserResult>({
id: 0,
sn: 0,
sex: '未知',
account: '',
nickname: '',
real_name: '',
avatar: '',
collect_count: 0,
coupon_count: 0,
create_time: '',
has_auth: false,
has_password: false,
member: 0,
mobile: '',
user_money: '0.00',
version: '',
})
const isLogin = ref<boolean>(false)
// 客服电话
const showServiceMobile = ref<boolean>(false)
const sheetMenu = ref<{ name: string }[]>([])
// 门店信息
const storeInfo = ref({
douyin_uid: '236598984587',
address: '上海浦东新区新金桥路58号新银东大厦 15楼F室',
business_hours: '08:00-22:00',
contact_phone: '021-8888888',
})
// 门店媒体列表(视频/图片)
const storeMediaList = ref([
{ type: 'video', url: `${OSS}images/my/store_video_thumb.jpg`, overlay: null },
{ type: 'image', url: `${OSS}images/my/store_image1.jpg`, overlay: null },
{ type: 'image', url: `${OSS}images/my/store_image2.jpg`, overlay: null },
{ type: 'image', url: `${OSS}images/my/store_image3.jpg`, overlay: null },
{ type: 'image', url: `${OSS}images/my/store_image4.jpg`, overlay: null },
{ type: 'image', url: `${OSS}images/my/store_image5.jpg`, overlay: 8 },
])
// 格式化账号显示152****3412格式
function formatAccount(account: string) {
if (!account)
return ''
if (account.length <= 7)
return account
return `${account.substring(0, 3)}****${account.substring(account.length - 4)}`
}
onShow(() => {
const userStore = useUserStore()
isLogin.value = userStore.isLoggedIn
console.log("🚀 ~ isLogin.value:", isLogin.value)
if (isLogin.value) {
// 获取用户详情信息接口
getUserInfo().then((res) => {
user.value = res
})
}
else {
Object.keys(user.value).forEach((key) => {
user.value[key] = ''
})
}
})
onLoad(() => {
uni.$on('clearUser', () => {
const userStore = useUserStore()
isLogin.value = userStore.isLoggedIn
Object.keys(user.value).forEach((key) => {
user.value[key] = ''
})
})
})
onUnload(() => {
uni.$off('clearUser')
})
const My = {
// 跳转到个人信息
handleToProfile: () => {
if (!isLogin.value) {
router.navigateTo('/pages/login/login')
} else {
router.navigateTo('/bundle/profile/profile')
}
},
// 点击显示客服电话
handleShowService: () => {
showServiceMobile.value = true
sheetMenu.value = [
{ name: '400-800-8888' },
]
},
// 选择菜单-拨打客服电话
handleSelectMenu: (item: any) => {
uni.makePhoneCall({
phoneNumber: item.item.name,
})
},
// 跳转到设置页面
handleToSettings: () => {
// TODO: 跳转到设置页面
router.navigateTo('/bundle/store/setting')
},
// 预览媒体(视频/图片)
handlePreviewMedia: (index: number) => {
const item = storeMediaList.value[index]
if (item.type === 'video') {
// TODO: 播放视频
console.log('播放视频', item.url)
}
else {
// 预览图片
const urls = storeMediaList.value
.filter(i => i.type === 'image' && !i.overlay)
.map(i => i.url)
uni.previewImage({
current: index,
urls,
})
}
},
handleToWallet: () => {
if (!isLogin.value) {
router.navigateTo('/bundle/wallet/wallet')
} else {
router.navigateTo('/pages/login/login')
}
},
}
</script>
<template> <template>
<view> <view>
<view class="home-bg fixed left-0 top-0 w-[100%]" <view class="home-bg fixed left-0 top-0 w-[100%]"
@ -217,11 +63,11 @@ const My = {
<!-- 门店信息区域 --> <!-- 门店信息区域 -->
<view class="store-info-card mt-28rpx bg-white py-30rpx pl-30rpx"> <view class="store-info-card mt-28rpx bg-white py-30rpx pl-30rpx">
<view class="mb-24rpx text-32rpx text-[#303133] font-bold leading-44rpx"> <view class="mb-24rpx text-32rpx text-[#303133] font-bold leading-44rpx">
门店茶址24小时智能茶室(中新店)地址 {{ storeInfo.name }}
</view> </view>
<view class="mb-16rpx flex items-center text-24rpx text-[#606266] leading-40rpx"> <view class="mb-16rpx flex items-center text-24rpx text-[#606266] leading-40rpx">
<text class="w-140rpx">抖音uid:</text> <text class="w-140rpx" v-if="storeInfo.dy_uid">抖音uid:</text>
<text class="flex-1 text-[#000]">{{ storeInfo.douyin_uid || '236598984587' }}</text> <text class="flex-1 text-[#000]">{{ storeInfo.dy_uid || '236598984587' }}</text>
</view> </view>
<view class="mb-16rpx flex items-center text-24rpx text-[#606266] leading-40rpx"> <view class="mb-16rpx flex items-center text-24rpx text-[#606266] leading-40rpx">
<text class="w-140rpx">门店地址:</text> <text class="w-140rpx">门店地址:</text>
@ -230,7 +76,7 @@ const My = {
<view class="relative mb-16rpx flex items-center"> <view class="relative mb-16rpx flex items-center">
<view class="flex items-center text-24rpx text-[#606266] leading-40rpx"> <view class="flex items-center text-24rpx text-[#606266] leading-40rpx">
<text class="w-140rpx">营业时间:</text> <text class="w-140rpx">营业时间:</text>
<text class="flex-1 text-[#000]">{{ storeInfo.business_hours || '08:00-22:00' }}</text> <text class="flex-1 text-[#000]">{{ `${storeInfo.start_time }-${storeInfo.end_time }` || '08:00-22:00' }}</text>
</view> </view>
<view class="modify-btn absolute right-0 flex items-center px-20rpx py-8rpx" <view class="modify-btn absolute right-0 flex items-center px-20rpx py-8rpx"
:style="{ backgroundImage: `url('${OSS}images/store/my/image3.png')` }" :style="{ backgroundImage: `url('${OSS}images/store/my/image3.png')` }"
@ -239,7 +85,7 @@ const My = {
<text class="text-24rpx text-[#fff]">修改</text> <text class="text-24rpx text-[#fff]">修改</text>
</view> </view>
</view> </view>
<view class="flex items-center text-24rpx text-[#606266] leading-40rpx"> <view class="flex items-center text-24rpx text-[#606266] leading-40rpx" @click="My.handleCall(storeInfo.contact_phone)">
<text class="w-140rpx">联系电话:</text> <text class="w-140rpx">联系电话:</text>
<text class="flex-1 text-[#000]">{{ storeInfo.contact_phone || '021-8888888' }}</text> <text class="flex-1 text-[#000]">{{ storeInfo.contact_phone || '021-8888888' }}</text>
</view> </view>
@ -248,71 +94,246 @@ const My = {
<!-- 门店视频/图片区域 --> <!-- 门店视频/图片区域 -->
<view class="bg-white px-30rpx"> <view class="bg-white px-30rpx">
<view class="mb-24rpx text-32rpx text-[#303133] font-bold leading-44rpx"> <view class="mb-24rpx text-32rpx text-[#303133] font-bold leading-44rpx">
门店视频/图片 <!-- 门店视频/图片 -->
门店图片
</view> </view>
<view class="grid grid-cols-3 gap-16rpx"> <view class="grid grid-cols-3 gap-16rpx">
<view v-for="(item, index) in storeMediaList" :key="index" <view v-for="(item, index) in storeInfo.image_arr" :key="index"
class="relative aspect-square w-full overflow-hidden rounded-8rpx" class="relative aspect-square w-full overflow-hidden rounded-8rpx"
@click="My.handlePreviewMedia(index)"> @click="My.handlePreviewMedia(index)">
<wd-img width="100%" height="100%" :src="item.url" mode="aspectFill" /> <wd-img width="100%" height="100%" :src="item" mode="aspectFill" />
<!-- 视频播放图标 --> <!-- 视频播放图标 -->
<view v-if="item.type === 'video'" class="absolute inset-0 flex items-center justify-center"> <!-- <view v-if="item.type === 'video'" class="absolute inset-0 flex items-center justify-center">
<wd-img width="60rpx" height="60rpx" :src="`${OSS}images/store/my/image5.png')`" /> <wd-img width="60rpx" height="60rpx" :src="`${OSS}images/store/my/image5.png')`" />
</view> </view> -->
<!-- +8 遮罩 --> <!-- 超出6张显示遮罩 -->
<view v-if="item.overlay" <view v-if="storeInfo.image_arr.length > 6"
class="absolute inset-0 flex items-center justify-center bg-black bg-opacity-50"> class="absolute inset-0 flex items-center justify-center bg-black bg-opacity-50">
<text class="text-32rpx text-[#fff] font-bold">+{{ item.overlay }}</text> <text class="text-32rpx text-[#fff] font-bold">+{{ Number(storeInfo.image_arr.length - 6) }}</text>
</view> </view>
</view> </view>
</view> </view>
</view> </view>
</view> </view>
<!-- 客服电话 -->
<wd-action-sheet v-model="showServiceMobile" :actions="sheetMenu" cancel-text="取消"
@close="showServiceMobile = false" @select="My.handleSelectMenu" />
</view> </view>
</template> </template>
<script lang="ts" setup>
import type { IUserResult } from '@/api/types/user'
import { getUserInfo } from '@/api/user'
import { useUserStore } from '@/store'
import { router } from '@/utils/tools'
import { getStoreDetails } from '@/api/store'
import { useStoreStore } from '@/store'
const OSS = inject('OSS')
const navbarHeight = inject('navbarHeight')
const rightPadding = inject('capsuleOffset')
const useStore = useStoreStore()
// 登录信息相关
const user = ref<IUserResult>({
id: 0,
sn: 0,
sex: '未知',
account: '',
nickname: '',
real_name: '',
avatar: '',
collect_count: 0,
coupon_count: 0,
create_time: '',
has_auth: false,
has_password: false,
member: 0,
mobile: '',
user_money: '0.00',
version: '',
})
const isLogin = ref<boolean>(false)
// 门店信息
const storeInfo = ref({
name: '',
dy_uid: '',
address: '',
business_hours: '',
contact_phone: '',
start_time: '',
end_time: '',
image_arr: []
})
// 门店媒体列表(视频/图片)
const storeMediaList = ref([
{ type: 'video', url: `${OSS}images/my/store_video_thumb.jpg`, overlay: null },
{ type: 'image', url: `${OSS}images/my/store_image1.jpg`, overlay: null },
{ type: 'image', url: `${OSS}images/my/store_image2.jpg`, overlay: null },
{ type: 'image', url: `${OSS}images/my/store_image3.jpg`, overlay: null },
{ type: 'image', url: `${OSS}images/my/store_image4.jpg`, overlay: null },
{ type: 'image', url: `${OSS}images/my/store_image5.jpg`, overlay: 8 },
])
// 格式化账号显示152****3412格式
function formatAccount(account: string) {
if (!account)
return ''
if (account.length <= 7)
return account
return `${account.substring(0, 3)}****${account.substring(account.length - 4)}`
}
onShow(() => {
const userStore = useUserStore()
isLogin.value = userStore.isLoggedIn
if (isLogin.value) {
// 获取用户详情信息接口
getUserInfo().then((res) => {
user.value = res
userStore.setUserMoney(Number(user.value.user_money))
})
}
else {
Object.keys(user.value).forEach((key) => {
user.value[key] = ''
})
}
// 获取店铺详情
My.handleGetStoreDetails()
})
onLoad(() => {
uni.$on('clearUser', () => {
const userStore = useUserStore()
isLogin.value = userStore.isLoggedIn
Object.keys(user.value).forEach((key) => {
user.value[key] = ''
})
})
})
onUnload(() => {
uni.$off('clearUser')
})
const My = {
/**
* 获取店铺详情
*/
handleGetStoreDetails: async () => {
const storeDetails = await getStoreDetails(useStore.defaultStore.id)
storeInfo.value = storeDetails.details
console.log("🚀 ~ storeInfo.value:", storeInfo.value)
},
// 跳转到个人信息
handleToProfile: () => {
if (!isLogin.value) {
router.navigateTo('/pages/login/login')
} else {
router.navigateTo('/bundle/profile/profile')
}
},
/**
* 拨打电话
*/
handleCall: (phone: string) => {
uni.makePhoneCall({
phoneNumber: phone,
})
},
// 跳转到设置页面
handleToSettings: () => {
// TODO: 跳转到设置页面
router.navigateTo('/bundle/store/setting')
},
// 预览媒体(视频/图片)
handlePreviewMedia: (index: number) => {
const item = storeMediaList.value[index]
if (item.type === 'video') {
// 播放视频
uni.previewMedia({
sources: [
{
url: item.url,
type: 'video'
}
],
current: 0
})
}
else {
// 预览图片
const urls = storeMediaList.value
.filter(i => i.type === 'image' && !i.overlay)
.map(i => i.url)
uni.previewImage({
current: index,
urls,
})
}
},
/**
* 跳转到钱包页面
*/
handleToWallet: () => {
if (!isLogin.value) {
router.navigateTo('/bundle/wallet/wallet')
} else {
router.navigateTo('/pages/login/login')
}
},
}
</script>
<style lang="scss"> <style lang="scss">
page { page {
background: #fff; background: #fff;
} }
.home-bg { .home-bg {
background-size: 100% 100%; background-size: 100% 100%;
background-repeat: no-repeat; background-repeat: no-repeat;
background-position: top center; background-position: top center;
min-height: 450rpx; min-height: 450rpx;
} }
.user-info-bg { .user-info-bg {
background-size: 100% auto; background-size: 100% auto;
background-repeat: no-repeat; background-repeat: no-repeat;
background-position: top center; background-position: top center;
padding-top: 20rpx; padding-top: 20rpx;
padding-bottom: 20rpx; padding-bottom: 20rpx;
min-height: 200rpx; min-height: 200rpx;
} }
.store-info-card { .store-info-card {
position: relative; position: relative;
z-index: 10; z-index: 10;
border-radius: 32rpx 32rpx 0 0; border-radius: 32rpx 32rpx 0 0;
} }
.modify-btn { .modify-btn {
position: absolute; position: absolute;
background-size: 100% 100%; background-size: 100% 100%;
background-repeat: no-repeat; background-repeat: no-repeat;
background-position: center; background-position: center;
min-width: 160rpx; min-width: 160rpx;
height: 90rpx; height: 90rpx;
justify-content: space-around; justify-content: space-around;
} }
.right-slot { .right-slot {
padding-right: v-bind(rightPadding); padding-right: v-bind(rightPadding);
} }
</style> </style>

View File

@ -24,6 +24,8 @@
<view class="relative h-64rpx"> <view class="relative h-64rpx">
<wd-img width="224rpx" height="64rpx" :src="`${OSS}images/reserve_room/reserve_room_image5.png`"/> <wd-img width="224rpx" height="64rpx" :src="`${OSS}images/reserve_room/reserve_room_image5.png`"/>
<view class="text-[#4C9F44] font-bold text-32rpx leading-44rpx absolute top-[50%] transform translate-y-[-50%] left-74rpx">点击开锁</view> <view class="text-[#4C9F44] font-bold text-32rpx leading-44rpx absolute top-[50%] transform translate-y-[-50%] left-74rpx">点击开锁</view>
<!-- TODO 如果没有大门锁的话 -->
<!-- <view class="text-[#4C9F44] font-bold text-32rpx leading-44rpx absolute top-[50%] transform translate-y-[-50%] left-74rpx">暂无门锁</view> -->
</view> </view>
</view> </view>
</view> </view>

View File

@ -29,6 +29,9 @@ const userInfoState: IUserInfoVo = {
export const useUserStore = defineStore( export const useUserStore = defineStore(
'user', 'user',
() => { () => {
// 定义用户余额
const userMoney = ref<number>(0)
// 默认未登录 // 默认未登录
const isLoggedIn = ref<boolean>(false) const isLoggedIn = ref<boolean>(false)
// 定义用户信息 // 定义用户信息
@ -45,15 +48,16 @@ export const useUserStore = defineStore(
} }
userInfo.value = val userInfo.value = val
} }
const setUserAvatar = (avatar: string) => { const setUserAvatar = (avatar: string) => {
userInfo.value.avatar = avatar userInfo.value.avatar = avatar
console.log('设置用户头像', avatar)
console.log('userInfo', userInfo.value)
} }
// 删除用户信息 // 删除用户信息
const removeUserInfo = () => { const removeUserInfo = () => {
isLoggedIn.value = false isLoggedIn.value = false
userInfo.value = { ...userInfoState } userInfo.value = { ...userInfoState }
userMoney.value = 0
// 清除所有缓存 // 清除所有缓存
uni.clearStorageSync() uni.clearStorageSync()
@ -107,6 +111,7 @@ export const useUserStore = defineStore(
removeUserInfo() removeUserInfo()
return res return res
} }
/** /**
* 微信登录 * 微信登录
*/ */
@ -124,6 +129,14 @@ export const useUserStore = defineStore(
return res && user return res && user
} }
/**
* 设置用户余额
* @param money
*/
const setUserMoney = (money: number) => {
userMoney.value = money
}
return { return {
userInfo, userInfo,
login, login,
@ -134,7 +147,9 @@ export const useUserStore = defineStore(
setUserInfo, setUserInfo,
removeUserInfo, removeUserInfo,
isLoggedIn, isLoggedIn,
mobileLogin mobileLogin,
setUserMoney,
userMoney,
} }
}, },
{ {

View File

@ -46,4 +46,15 @@ export const PayList: PayMethod[] = [
value: PayValue.WeChatPay, value: PayValue.WeChatPay,
type: PayCategory.WeChatPay type: PayCategory.WeChatPay
} }
] ]
export function getPayMethodByType(type: PayCategory): PayMethod | undefined {
return PayList.find(item => item.type === type)
}
// 获取支付方式对应的文本值
export const PayWayText: Record<PayValue, string> = {
[PayValue.PlatformBalance]: '平台余额',
[PayValue.StoreBalance]: '门店余额',
[PayValue.WeChatPay]: '微信支付',
}