对接接口
This commit is contained in:
@ -35,9 +35,9 @@
|
||||
<view class="font-400 text-28rpx leading-40rpx text-[#303133]">余额</view>
|
||||
<view class="flex justify-between items-center mt-24rpx">
|
||||
<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 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>
|
||||
@ -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="text-24rpx leading-34rpx text-[#606266] wall-date">
|
||||
<!-- 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>
|
||||
<wd-icon name="fill-arrow-down" size="32rpx" color="#BFC2CC"></wd-icon>
|
||||
@ -62,46 +62,51 @@
|
||||
|
||||
<view>
|
||||
<!-- 最后一个元素不显示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)-->
|
||||
<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 class="font-bold text-30rpx leading-42rpx text-[#303133]">
|
||||
<view>包间预定</view>
|
||||
<!-- <view>包间续费</view>
|
||||
<view>团购核销</view>
|
||||
<view class="flex items-center">
|
||||
<view>提现</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>{{ Wallet.handleMapTransactionType(item.change_type) }}</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 class="text-24rpx text-[#606266] leading-34rpx mt-16rpx">
|
||||
<!-- TODO 包间预定 || 包间续费下显示 -->
|
||||
<text>预定账号:13917942276</text>
|
||||
<text v-if="item.change_type <= 2">预定账号:{{ item.mobile }}</text>
|
||||
</view>
|
||||
<view class="mt-12rpx text-24rpx text-[#606266] leading-34rpx">
|
||||
2025-03-02 11:20
|
||||
{{ item.create_time }}
|
||||
</view>
|
||||
</view>
|
||||
<view>
|
||||
<view class="flex items-center h-50rpx">
|
||||
<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>
|
||||
<wd-icon name="arrow-right" size="32rpx" color="#9496A5"></wd-icon>
|
||||
</view>
|
||||
</view>
|
||||
<view class="text-24rpx text-[#909399] leading-34rpx">
|
||||
余额5,224.55
|
||||
余额 {{ item.after_amount }}
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</mescroll-body>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
|
||||
</view>
|
||||
</template>
|
||||
|
||||
@ -109,84 +114,102 @@
|
||||
<script lang="ts" setup>
|
||||
import { onPageScroll, onReachBottom } from '@dcloudio/uni-app'
|
||||
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 userStore = useUserStore()
|
||||
|
||||
// 用户信息相关
|
||||
|
||||
/* mescroll */
|
||||
const upOption = reactive({
|
||||
empty: {
|
||||
icon : OSS + 'icon/icon_reserver_empty.png',
|
||||
}
|
||||
})
|
||||
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 selectTime = ref<string>('')
|
||||
|
||||
onShow(() => {
|
||||
|
||||
})
|
||||
|
||||
const wallet = {
|
||||
const Wallet = {
|
||||
// 上拉加载的回调: 其中num:当前页 从1开始, size:每页数据条数,默认10
|
||||
upCallback: (mescroll) => {
|
||||
// 需要留一下数据为空的时候显示的空数据图标内容
|
||||
// list({
|
||||
// page: mescroll.num,
|
||||
// size: mescroll.size
|
||||
// }).then((res: { list: Array<any>, totalPages: Number }) => {
|
||||
// const curPageData = res.list || [] // 当前页数据
|
||||
// if(mescroll.num == 1) goods.value = []; // 第一页需手动制空列表
|
||||
// goods.value = goods.value.concat(curPageData); //追加新数据
|
||||
const filter = {
|
||||
page: mescroll.num,
|
||||
size: mescroll.size,
|
||||
end_time: selectTime.value
|
||||
}
|
||||
|
||||
// console.log("🚀 ~ goods:", goods)
|
||||
|
||||
// mescroll.endByPage(curPageData.length, res.totalPages); //必传参数(当前页的数据个数, 总页数)
|
||||
|
||||
// }).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(); // 请求失败, 结束加载
|
||||
// })
|
||||
getUserTransactionDetails(filter).then((res) => {
|
||||
const curPageData = res.list || [] // 当前页数据
|
||||
if(mescroll.num == 1) list.value = [] // 第一页需手动制空列表
|
||||
list.value = list.value.concat(curPageData) //追加新数据
|
||||
mescroll.endSuccess(curPageData.length, Boolean(res.more))
|
||||
}).catch(() => {
|
||||
mescroll.endErr() // 请求失败, 结束加载
|
||||
})
|
||||
},
|
||||
|
||||
// 确认日期-
|
||||
/**
|
||||
* 日期筛选
|
||||
* @param date
|
||||
*/
|
||||
handleConfirmDate: (date: {value: number}) => {
|
||||
const d = new Date(date.value)
|
||||
console.log("🚀 ~ d:", d)
|
||||
const year = d.getFullYear()
|
||||
const month = d.getMonth() + 1
|
||||
console.log(`${year}年${month}月`);
|
||||
selectTime.value = `${year}-${month < 10 ? '0' + month : month}`
|
||||
|
||||
// 切换tab时,重置当前的mescroll
|
||||
list.value = []
|
||||
getMescroll().resetUpScroll();
|
||||
},
|
||||
|
||||
// 去提现
|
||||
/**
|
||||
* 去提现
|
||||
*/
|
||||
handleToRecharge: () => {
|
||||
uni.navigateTo({
|
||||
url: '/bundle/parten/pages/withdraw/withdraw'
|
||||
})
|
||||
},
|
||||
|
||||
// 跳转对应账单详情
|
||||
handleToBillDetail: (id: number) => {
|
||||
uni.navigateTo({
|
||||
url: `/bundle/wallet/bill?id=${id}`
|
||||
})
|
||||
/**
|
||||
* 跳转对应账单详情
|
||||
* @param 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>
|
||||
|
||||
Reference in New Issue
Block a user