对接银行卡接口
This commit is contained in:
@ -8,7 +8,6 @@ export function addBankCard(data: IAddBankCardParams) {
|
|||||||
return http.Post('/storeapi/user/addBank', data)
|
return http.Post('/storeapi/user/addBank', data)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 删除银行卡
|
* 删除银行卡
|
||||||
*/
|
*/
|
||||||
@ -21,4 +20,11 @@ export function deleteBankCard(id: number) {
|
|||||||
*/
|
*/
|
||||||
export function getBankCardList() {
|
export function getBankCardList() {
|
||||||
return http.Post<any>('/storeapi/user/checkBank')
|
return http.Post<any>('/storeapi/user/checkBank')
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 提现申请
|
||||||
|
*/
|
||||||
|
export function withdrawApply(amount: number, bank_id: number) {
|
||||||
|
return http.Post('/storeapi/user/submitReflect', { amount, bank_id })
|
||||||
}
|
}
|
||||||
@ -48,4 +48,17 @@ export interface IEditStoreInfoParams {
|
|||||||
|
|
||||||
export function editStoreInfo(data: IEditStoreInfoParams) {
|
export function editStoreInfo(data: IEditStoreInfoParams) {
|
||||||
return http.Post('/storeapi/store/editStore', data)
|
return http.Post('/storeapi/store/editStore', data)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取房间列表
|
||||||
|
*/
|
||||||
|
export interface IGetRoomListParams {
|
||||||
|
page: number
|
||||||
|
size: number
|
||||||
|
store_id: number
|
||||||
|
}
|
||||||
|
|
||||||
|
export function getRoomList(data: IGetRoomListParams) {
|
||||||
|
return http.Post<any>('/storeapi/store/roomList', data)
|
||||||
|
}
|
||||||
|
|||||||
@ -9,12 +9,12 @@
|
|||||||
</route>
|
</route>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<view>
|
<view class="pb-48rpx">
|
||||||
<!-- 删除确认框 -->
|
<!-- 删除确认框 -->
|
||||||
<wd-message-box selector="wd-message-box-slot"></wd-message-box>
|
<wd-message-box selector="wd-message-box-slot"></wd-message-box>
|
||||||
|
|
||||||
<view class="flex items-center mx-58rpx mb-28rpx">
|
<view class="flex items-center mx-58rpx mb-28rpx">
|
||||||
<view class="font-bold text-28rpx leading-40rpx text-#303133">我的银行卡(9张)</view>
|
<view class="font-bold text-28rpx leading-40rpx text-#303133">我的银行卡({{ bankList.length }}张)</view>
|
||||||
<view class="flex items-center">
|
<view class="flex items-center">
|
||||||
<view class="flex items-center mr-12rpx">
|
<view class="flex items-center mr-12rpx">
|
||||||
<wd-img :src="`${OSS}icon/icon_safe.png`" width="32rpx" height="32rpx"></wd-img>
|
<wd-img :src="`${OSS}icon/icon_safe.png`" width="32rpx" height="32rpx"></wd-img>
|
||||||
@ -29,9 +29,9 @@
|
|||||||
<view class="flex items-center mr-22rpx">
|
<view class="flex items-center mr-22rpx">
|
||||||
<wd-img :src="`${OSS}icon/icon_bank_card4.png`" width="48rpx" height="48rpx"></wd-img>
|
<wd-img :src="`${OSS}icon/icon_bank_card4.png`" width="48rpx" height="48rpx"></wd-img>
|
||||||
</view>
|
</view>
|
||||||
<view class="font-400 text-30rpx leading-42rpx text-#303133">招商银行 储蓄卡(3265)</view>
|
<view class="font-400 text-30rpx leading-42rpx text-#303133">{{ item.bank_name }} 储蓄卡({{ List.handleFormatBankCardNumber(item.bank_card) }})</view>
|
||||||
</view>
|
</view>
|
||||||
<view @click="List.handleDeleteBankCard(index)">
|
<view @click="List.handleDeleteBankCard(index, item.id)">
|
||||||
<wd-icon name="delete-thin" size="42rpx" color="#BFC2CC"></wd-icon>
|
<wd-icon name="delete-thin" size="42rpx" color="#BFC2CC"></wd-icon>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
@ -46,25 +46,36 @@
|
|||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
import { useMessage } from 'wot-design-uni'
|
import { useMessage } from 'wot-design-uni'
|
||||||
import {toast} from '@/utils/toast'
|
import {toast} from '@/utils/toast'
|
||||||
|
import { getBankCardList, deleteBankCard } from '@/api/bank'
|
||||||
|
|
||||||
const OSS = inject('OSS')
|
const OSS = inject('OSS')
|
||||||
const message = useMessage('wd-message-box-slot')
|
const message = useMessage('wd-message-box-slot')
|
||||||
|
|
||||||
// 选择银行卡
|
// 选择银行卡
|
||||||
const showBankCardPopup = ref<boolean>(false)
|
const bankList = ref<Array<{ id: number, bank_name: string, bank_card: string }>>([])
|
||||||
const selectedBankCardIndex = ref<number>(0)
|
|
||||||
const bankList = ref<Array<{ id: number, bankName: string, bankCard: string }>>([
|
onShow(() => {
|
||||||
{ id: 1, bankName: '招商银行', bankCard: '3265' },
|
List.getBankCardList()
|
||||||
{ id: 2, bankName: '建设银行', bankCard: '1234' },
|
})
|
||||||
{ id: 3, bankName: '农业银行', bankCard: '5678' },
|
|
||||||
])
|
|
||||||
|
|
||||||
const List = {
|
const List = {
|
||||||
handleDeleteBankCard: (index: number) => {
|
/**
|
||||||
|
* 获取银行卡列表
|
||||||
|
*/
|
||||||
|
getBankCardList: async () => {
|
||||||
|
const res = await getBankCardList()
|
||||||
|
bankList.value = res.list
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除银行卡
|
||||||
|
* @param index
|
||||||
|
*/
|
||||||
|
handleDeleteBankCard: async (index: number, id: number) => {
|
||||||
message.confirm({
|
message.confirm({
|
||||||
title: '是否删除银行卡',
|
title: '是否删除银行卡',
|
||||||
msg: '删除银行卡后无法恢复,确定删除银行卡吗?',
|
msg: '删除银行卡后无法恢复,确定删除银行卡吗?',
|
||||||
confirmButtonText: '去预定',
|
confirmButtonText: '确定',
|
||||||
cancelButtonText: '取消',
|
cancelButtonText: '取消',
|
||||||
cancelButtonProps: {
|
cancelButtonProps: {
|
||||||
customClass: '!bg-[#F6F7F8] !text-[#303133] !text-32rpx !leading-44rpx !rounded-8rpx',
|
customClass: '!bg-[#F6F7F8] !text-[#303133] !text-32rpx !leading-44rpx !rounded-8rpx',
|
||||||
@ -72,16 +83,43 @@
|
|||||||
confirmButtonProps: {
|
confirmButtonProps: {
|
||||||
customClass: '!bg-[#4C9F44] !text-[#fff] !text-32rpx !leading-44rpx !rounded-8rpx',
|
customClass: '!bg-[#4C9F44] !text-[#fff] !text-32rpx !leading-44rpx !rounded-8rpx',
|
||||||
}
|
}
|
||||||
}).then((res) => {
|
}).then(async (res) => {
|
||||||
bankList.value.splice(index, 1)
|
if (res.action === 'confirm') {
|
||||||
toast.info('删除成功')
|
uni.showLoading({
|
||||||
// 点击确认按钮回调事件
|
title: '操作中...',
|
||||||
|
mask: false
|
||||||
|
})
|
||||||
|
|
||||||
|
try {
|
||||||
|
await deleteBankCard(id)
|
||||||
|
uni.hideLoading()
|
||||||
|
toast.success('删除成功')
|
||||||
|
bankList.value.splice(index, 1)
|
||||||
|
} catch (error) {
|
||||||
|
uni.hideLoading()
|
||||||
|
toast.info('删除失败')
|
||||||
|
return
|
||||||
|
}
|
||||||
|
}
|
||||||
}).catch(() => {
|
}).catch(() => {
|
||||||
// 点击取消按钮回调事件
|
// 点击取消按钮回调事件
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
|
|
||||||
// 跳转到添加银行卡页面
|
/**
|
||||||
|
* 格式化银行卡号
|
||||||
|
* @ param bankCardNumber 银行卡号
|
||||||
|
*/
|
||||||
|
handleFormatBankCardNumber: (bankCardNumber: string) => {
|
||||||
|
if (!bankCardNumber) return ''
|
||||||
|
const noSpace = bankCardNumber.replace(/\s/g, '')
|
||||||
|
if (noSpace.length <= 4) return noSpace
|
||||||
|
return noSpace.slice(-4)
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 跳转到添加银行卡页面
|
||||||
|
*/
|
||||||
handleAddBankCard: () => {
|
handleAddBankCard: () => {
|
||||||
uni.navigateTo({
|
uni.navigateTo({
|
||||||
url: '/bundle/parten/pages/bank-card/add'
|
url: '/bundle/parten/pages/bank-card/add'
|
||||||
|
|||||||
@ -92,12 +92,12 @@
|
|||||||
/**
|
/**
|
||||||
* 退出
|
* 退出
|
||||||
*/
|
*/
|
||||||
handleLogout: () => {
|
handleLogout: async () => {
|
||||||
const userStore = useUserStore()
|
const userStore = useUserStore()
|
||||||
userStore.logout()
|
await userStore.logout()
|
||||||
if (!userStore.isLoggedIn) {
|
if (!userStore.isLoggedIn) {
|
||||||
toast.info('退出成功')
|
toast.info('退出成功')
|
||||||
router.reLaunch('/pages/my/my')
|
router.redirectTo('/pages/login/login')
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -5,122 +5,6 @@
|
|||||||
}
|
}
|
||||||
}</route>
|
}</route>
|
||||||
|
|
||||||
<script lang="ts" setup>
|
|
||||||
import { router } from '@/utils/tools'
|
|
||||||
|
|
||||||
const OSS = inject('OSS')
|
|
||||||
const navbarHeight = inject('navbarHeight')
|
|
||||||
|
|
||||||
// 房间状态枚举
|
|
||||||
enum RoomStatus {
|
|
||||||
AVAILABLE = 'available', // 空闲中 - 绿色
|
|
||||||
CLEANING = 'cleaning', // 待打扫 - 蓝色/橙色
|
|
||||||
MAINTENANCE = 'maintenance', // 维护中 - 红色
|
|
||||||
IN_USE = 'in_use', // 使用中 - 蓝色
|
|
||||||
}
|
|
||||||
|
|
||||||
// 房间状态配置
|
|
||||||
const statusConfig = {
|
|
||||||
[RoomStatus.AVAILABLE]: {
|
|
||||||
text: '空闲中',
|
|
||||||
color: '#4C9F44', // 绿色
|
|
||||||
},
|
|
||||||
[RoomStatus.CLEANING]: {
|
|
||||||
text: '待打扫',
|
|
||||||
color: '#F29747', // 蓝色
|
|
||||||
},
|
|
||||||
[RoomStatus.MAINTENANCE]: {
|
|
||||||
text: '维护中',
|
|
||||||
color: '#F65353', // 红色
|
|
||||||
},
|
|
||||||
[RoomStatus.IN_USE]: {
|
|
||||||
text: '使用中',
|
|
||||||
color: '#1890FF', // 蓝色
|
|
||||||
},
|
|
||||||
}
|
|
||||||
|
|
||||||
// Mock 房间数据
|
|
||||||
const roomList = ref([
|
|
||||||
{
|
|
||||||
id: 1,
|
|
||||||
name: '对月',
|
|
||||||
type: '榻榻米',
|
|
||||||
image: `${OSS}images/room1.jpg`, // Mock图片,实际需要替换
|
|
||||||
status: RoomStatus.AVAILABLE,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
id: 2,
|
|
||||||
name: '听雨',
|
|
||||||
type: '榻榻米',
|
|
||||||
image: `${OSS}images/room2.jpg`,
|
|
||||||
status: RoomStatus.CLEANING,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
id: 3,
|
|
||||||
name: '观星',
|
|
||||||
type: '榻榻米',
|
|
||||||
image: `${OSS}images/room3.jpg`,
|
|
||||||
status: RoomStatus.MAINTENANCE,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
id: 4,
|
|
||||||
name: '品茶',
|
|
||||||
type: '榻榻米',
|
|
||||||
image: `${OSS}images/room4.jpg`,
|
|
||||||
status: RoomStatus.CLEANING,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
id: 5,
|
|
||||||
name: '静心',
|
|
||||||
type: '榻榻米',
|
|
||||||
image: `${OSS}images/room5.jpg`,
|
|
||||||
status: RoomStatus.IN_USE,
|
|
||||||
},
|
|
||||||
])
|
|
||||||
|
|
||||||
const RoomManage = {
|
|
||||||
/**
|
|
||||||
* 点击房间卡片
|
|
||||||
*/
|
|
||||||
handleClickRoom: (room: any) => {
|
|
||||||
router.navigateTo(`/bundle/tea-room/detail?id=${room.id}`)
|
|
||||||
},
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 点击编辑房间图片
|
|
||||||
*/
|
|
||||||
handleEditImage: (room: any, event: any) => {
|
|
||||||
// event.stopPropagation()
|
|
||||||
// TODO: 实现编辑房间图片功能
|
|
||||||
console.log('编辑房间图片:', room.id)
|
|
||||||
router.navigateTo(`/pages/store/room-detail?id=${room.id}`)
|
|
||||||
},
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 点击更多选项
|
|
||||||
*/
|
|
||||||
handleMore: () => {
|
|
||||||
// TODO: 实现更多选项功能
|
|
||||||
console.log('更多选项')
|
|
||||||
},
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 点击目标图标
|
|
||||||
*/
|
|
||||||
handleTarget: () => {
|
|
||||||
// TODO: 实现目标功能
|
|
||||||
console.log('目标功能')
|
|
||||||
},
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 获取状态配置
|
|
||||||
*/
|
|
||||||
function getStatusConfig(status: RoomStatus) {
|
|
||||||
return statusConfig[status] || statusConfig[RoomStatus.AVAILABLE]
|
|
||||||
}
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<view>
|
<view>
|
||||||
<!-- 导航栏 -->
|
<!-- 导航栏 -->
|
||||||
@ -174,6 +58,122 @@ function getStatusConfig(status: RoomStatus) {
|
|||||||
</view>
|
</view>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
|
<script lang="ts" setup>
|
||||||
|
import { router } from '@/utils/tools'
|
||||||
|
|
||||||
|
const OSS = inject('OSS')
|
||||||
|
const navbarHeight = inject('navbarHeight')
|
||||||
|
|
||||||
|
// 房间状态枚举
|
||||||
|
enum RoomStatus {
|
||||||
|
AVAILABLE = 'available', // 空闲中 - 绿色
|
||||||
|
CLEANING = 'cleaning', // 待打扫 - 蓝色/橙色
|
||||||
|
MAINTENANCE = 'maintenance', // 维护中 - 红色
|
||||||
|
IN_USE = 'in_use', // 使用中 - 蓝色
|
||||||
|
}
|
||||||
|
|
||||||
|
// 房间状态配置
|
||||||
|
const statusConfig = {
|
||||||
|
[RoomStatus.AVAILABLE]: {
|
||||||
|
text: '空闲中',
|
||||||
|
color: '#4C9F44', // 绿色
|
||||||
|
},
|
||||||
|
[RoomStatus.CLEANING]: {
|
||||||
|
text: '待打扫',
|
||||||
|
color: '#F29747', // 蓝色
|
||||||
|
},
|
||||||
|
[RoomStatus.MAINTENANCE]: {
|
||||||
|
text: '维护中',
|
||||||
|
color: '#F65353', // 红色
|
||||||
|
},
|
||||||
|
[RoomStatus.IN_USE]: {
|
||||||
|
text: '使用中',
|
||||||
|
color: '#1890FF', // 蓝色
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
// Mock 房间数据
|
||||||
|
const roomList = ref([
|
||||||
|
{
|
||||||
|
id: 1,
|
||||||
|
name: '对月',
|
||||||
|
type: '榻榻米',
|
||||||
|
image: `${OSS}images/room1.jpg`, // Mock图片,实际需要替换
|
||||||
|
status: RoomStatus.AVAILABLE,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
id: 2,
|
||||||
|
name: '听雨',
|
||||||
|
type: '榻榻米',
|
||||||
|
image: `${OSS}images/room2.jpg`,
|
||||||
|
status: RoomStatus.CLEANING,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
id: 3,
|
||||||
|
name: '观星',
|
||||||
|
type: '榻榻米',
|
||||||
|
image: `${OSS}images/room3.jpg`,
|
||||||
|
status: RoomStatus.MAINTENANCE,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
id: 4,
|
||||||
|
name: '品茶',
|
||||||
|
type: '榻榻米',
|
||||||
|
image: `${OSS}images/room4.jpg`,
|
||||||
|
status: RoomStatus.CLEANING,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
id: 5,
|
||||||
|
name: '静心',
|
||||||
|
type: '榻榻米',
|
||||||
|
image: `${OSS}images/room5.jpg`,
|
||||||
|
status: RoomStatus.IN_USE,
|
||||||
|
},
|
||||||
|
])
|
||||||
|
|
||||||
|
const RoomManage = {
|
||||||
|
/**
|
||||||
|
* 点击房间卡片
|
||||||
|
*/
|
||||||
|
handleClickRoom: (room: any) => {
|
||||||
|
router.navigateTo(`/bundle/tea-room/detail?id=${room.id}`)
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 点击编辑房间图片
|
||||||
|
*/
|
||||||
|
handleEditImage: (room: any, event: any) => {
|
||||||
|
// event.stopPropagation()
|
||||||
|
// TODO: 实现编辑房间图片功能
|
||||||
|
console.log('编辑房间图片:', room.id)
|
||||||
|
router.navigateTo(`/pages/store/room-detail?id=${room.id}`)
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 点击更多选项
|
||||||
|
*/
|
||||||
|
handleMore: () => {
|
||||||
|
// TODO: 实现更多选项功能
|
||||||
|
console.log('更多选项')
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 点击目标图标
|
||||||
|
*/
|
||||||
|
handleTarget: () => {
|
||||||
|
// TODO: 实现目标功能
|
||||||
|
console.log('目标功能')
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取状态配置
|
||||||
|
*/
|
||||||
|
function getStatusConfig(status: RoomStatus) {
|
||||||
|
return statusConfig[status] || statusConfig[RoomStatus.AVAILABLE]
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
<style lang="scss">
|
<style lang="scss">
|
||||||
page {
|
page {
|
||||||
background: #f6f7f8;
|
background: #f6f7f8;
|
||||||
|
|||||||
Reference in New Issue
Block a user