更新:充值消费列表
This commit is contained in:
@@ -253,4 +253,16 @@ export async function getActivityDescription() {
|
|||||||
method: 'POST'
|
method: 'POST'
|
||||||
})
|
})
|
||||||
return res
|
return res
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取充值列表
|
||||||
|
*/
|
||||||
|
export async function getTransactionDetailsList(current: number, limit: number, userId: string,) {
|
||||||
|
const res = await mainClient.request<IApiResponse>({
|
||||||
|
url: 'common/transactionDetails/getTransactionDetailsList',
|
||||||
|
method: 'POST',
|
||||||
|
data: { current, limit, userId, }
|
||||||
|
})
|
||||||
|
return res
|
||||||
}
|
}
|
||||||
@@ -207,7 +207,8 @@
|
|||||||
"seasonCard": "Quarterly",
|
"seasonCard": "Quarterly",
|
||||||
"yearCard": "Yearly",
|
"yearCard": "Yearly",
|
||||||
"days": "days",
|
"days": "days",
|
||||||
"selectPackage": "Please select a package"
|
"selectPackage": "Please select a package",
|
||||||
|
"consumptionRecord": "Consumption record"
|
||||||
},
|
},
|
||||||
"book": {
|
"book": {
|
||||||
"title": "My Books",
|
"title": "My Books",
|
||||||
@@ -471,6 +472,11 @@
|
|||||||
"couponType0": "All Products",
|
"couponType0": "All Products",
|
||||||
"couponType1": "Specific Courses",
|
"couponType1": "Specific Courses",
|
||||||
"couponType2": "Course Categories",
|
"couponType2": "Course Categories",
|
||||||
"couponCount": "{count} coupons"
|
"couponCount": "{count} coupons",
|
||||||
|
"rechargeConsumptionList": "Recharge and consumption records",
|
||||||
|
"rechargeAmount": "Recharge amount",
|
||||||
|
"valueAddedServices": "Value-added services",
|
||||||
|
"readAgree": "I have read and agreed",
|
||||||
|
"readAgreeServices": "Please read and agree to the value-added services first"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -208,7 +208,8 @@
|
|||||||
"seasonCard": "季卡",
|
"seasonCard": "季卡",
|
||||||
"yearCard": "年卡",
|
"yearCard": "年卡",
|
||||||
"days": "天",
|
"days": "天",
|
||||||
"selectPackage": "请选择套餐"
|
"selectPackage": "请选择套餐",
|
||||||
|
"consumptionRecord": "消费记录"
|
||||||
},
|
},
|
||||||
"book": {
|
"book": {
|
||||||
"title": "我的书单",
|
"title": "我的书单",
|
||||||
@@ -472,6 +473,11 @@
|
|||||||
"couponType0": "全场通用",
|
"couponType0": "全场通用",
|
||||||
"couponType1": "指定课程可用",
|
"couponType1": "指定课程可用",
|
||||||
"couponType2": "指定课程品类可用",
|
"couponType2": "指定课程品类可用",
|
||||||
"couponCount": "共 {count} 张"
|
"couponCount": "共 {count} 张",
|
||||||
|
"rechargeConsumptionList": "充值消费记录",
|
||||||
|
"rechargeAmount": "充值金额",
|
||||||
|
"valueAddedServices": "增值服务",
|
||||||
|
"readAgree": "我已阅读并同意",
|
||||||
|
"readAgreeServices": "请先阅读并同意增值服务"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,15 +1,15 @@
|
|||||||
<template>
|
<template>
|
||||||
<view class="recharge-page">
|
<view class="recharge-page">
|
||||||
<!-- 自定义导航栏 -->
|
<!-- 自定义导航栏 -->
|
||||||
<nav-bar :title="$t('user.recharge')"></nav-bar>
|
<nav-bar :title="$t('order.recharge')"></nav-bar>
|
||||||
<view class="block">
|
<view class="block">
|
||||||
<view class="text">充值金额</view>
|
<view class="text">{{$t('order.rechargeAmount')}}</view>
|
||||||
<view class="recharge">
|
<view class="recharge">
|
||||||
<view class="recharge_block" @click="chosPric(item)"
|
<view class="recharge_block" @click="chosPric(item)"
|
||||||
:class="aloneItem.priceTypeId === item.priceTypeId ? 'selected' : ''"
|
:class="aloneItem.priceTypeId === item.priceTypeId ? 'selected' : ''"
|
||||||
v-for="item in rechargeList.bookBuyConfigList" :key="item.priceTypeId">
|
v-for="item in rechargeList.bookBuyConfigList" :key="item.priceTypeId">
|
||||||
<view class="recharge_money">¥{{item.money}}</view>
|
<view class="recharge_money">¥{{item.money}}</view>
|
||||||
<view>{{item.realMoney}}天医币</view>
|
<view>{{item.realMoney}}{{$t('order.virtualCoin')}}</view>
|
||||||
<!-- 红框位置的618活动标签 -->
|
<!-- 红框位置的618活动标签 -->
|
||||||
<!-- <view class="activity-tag">618活动</view> -->
|
<!-- <view class="activity-tag">618活动</view> -->
|
||||||
<span class="activity-label" v-if="item.givejf >0">618充值活动</span>
|
<span class="activity-label" v-if="item.givejf >0">618充值活动</span>
|
||||||
@@ -21,30 +21,30 @@
|
|||||||
<view v-html="remark.remark"></view>
|
<view v-html="remark.remark"></view>
|
||||||
</view>
|
</view>
|
||||||
<view class="cha_fangsh">
|
<view class="cha_fangsh">
|
||||||
<view class="cf_title PM_font">支付方式</view>
|
<view class="cf_title PM_font">{{$t('user.paymentMethod')}}</view>
|
||||||
<view class="cf_radio">
|
<view class="cf_radio">
|
||||||
<radio-group v-for="item in iosPaylist" @change="choseType(item.id)">
|
<radio-group v-for="item in iosPaylist" @click="choseType(item.id)">
|
||||||
<view style="width: 100%">
|
<view style="width: 100%">
|
||||||
<view :class="payType == item.id ? 'Tab_xf cf_xuanx' : 'cf_xuanx'">
|
<view :class="payType == item.id ? 'Tab_xf cf_xuanx' : 'cf_xuanx'">
|
||||||
<!-- <image class="pay_item_img" :src="item.imgUrl" mode="aspectFil">
|
<!-- <image class="pay_item_img" :src="item.imgUrl" mode="aspectFil">
|
||||||
</image> -->
|
</image> -->
|
||||||
<text>{{ item.title }}</text>
|
<text>{{ item.title }}</text>
|
||||||
<radio :checked="payType === item.id" style="float: right"></radio>
|
<radio :checked="payType === item.id"></radio>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</radio-group>
|
</radio-group>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<view class="agree_wo flexbox">
|
<view class="agree_wo flexbox">
|
||||||
<radio-group class="agree" v-for="(item, index) in argee" :key="index" @change="radioCheck">
|
<radio-group class="agree" v-for="(item, index) in argee" :key="index" @click="radioCheck">
|
||||||
<view>
|
<view>
|
||||||
<radio class="agreeRadio" :value="item.id" :checked="state" color="#007bff"></radio>
|
<radio class="agreeRadio" :value="item.id" :checked="state" color="#007bff"></radio>
|
||||||
</view>
|
</view>
|
||||||
</radio-group>
|
</radio-group>
|
||||||
<view>我已阅读并同意<span class="highlight" @click="showAgreement">《增值服务协议》</span></view>
|
<view>{{$t('order.readAgree')}}<span class="highlight" @click="showAgreement">《{{$t('order.valueAddedServices')}}》</span></view>
|
||||||
</view>
|
</view>
|
||||||
<view class="bottom-button-container">
|
<view class="bottom-button-container">
|
||||||
<button class="recharge-button" @click="handleRecharge">立即充值</button>
|
<button class="recharge-button" @click="handleRecharge">{{$t('order.recharge')}}</button>
|
||||||
</view>
|
</view>
|
||||||
<wd-popup v-model="agreemenState" position="bottom" :closeable="true">
|
<wd-popup v-model="agreemenState" position="bottom" :closeable="true">
|
||||||
<view class="agreement">
|
<view class="agreement">
|
||||||
@@ -61,10 +61,11 @@
|
|||||||
|
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { ref, computed, onMounted, toRefs, reactive } from 'vue'
|
import { ref, computed, onMounted, toRefs, reactive } from 'vue'
|
||||||
|
import { useI18n } from 'vue-i18n'
|
||||||
import { useMessage } from '@/uni_modules/wot-design-uni'
|
import { useMessage } from '@/uni_modules/wot-design-uni'
|
||||||
import { getBookBuyConfigList, getAgreement, getActivityDescription } from '@/api/modules/user'
|
import { getBookBuyConfigList, getAgreement, getActivityDescription } from '@/api/modules/user'
|
||||||
const googlePay = uni.requireNativePlugin("sn-googlepay5");
|
// const googlePay = uni.requireNativePlugin("sn-googlepay5");
|
||||||
|
const { t } = useI18n()
|
||||||
const message = useMessage()
|
const message = useMessage()
|
||||||
const payType = ref('1')
|
const payType = ref('1')
|
||||||
const iosPaylist = ref([
|
const iosPaylist = ref([
|
||||||
@@ -108,9 +109,11 @@
|
|||||||
const isConnected = ref(false)
|
const isConnected = ref(false)
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取使用环境
|
||||||
|
*/
|
||||||
const getDevName = () => {
|
const getDevName = () => {
|
||||||
// 获取使用环境
|
|
||||||
if (uni.getSystemInfoSync().platform === "android") {
|
if (uni.getSystemInfoSync().platform === "android") {
|
||||||
qudao.value = 'Google'
|
qudao.value = 'Google'
|
||||||
isAndroid.value = true;
|
isAndroid.value = true;
|
||||||
@@ -132,8 +135,8 @@
|
|||||||
* 勾选协议
|
* 勾选协议
|
||||||
*/
|
*/
|
||||||
const radioCheck = () => {
|
const radioCheck = () => {
|
||||||
console.log('点击了', state.value);
|
|
||||||
state.value = !state.value
|
state.value = !state.value
|
||||||
|
console.log('点击了', state.value);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -151,7 +154,6 @@
|
|||||||
console.log(rechargeList.value.bookBuyConfigList, '充值列表');
|
console.log(rechargeList.value.bookBuyConfigList, '充值列表');
|
||||||
// 默认选择第一个金额
|
// 默认选择第一个金额
|
||||||
aloneItem.value = rechargeList.value.bookBuyConfigList[0]
|
aloneItem.value = rechargeList.value.bookBuyConfigList[0]
|
||||||
getGooglePay()
|
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error('获取订单列表失败:', error)
|
console.error('获取订单列表失败:', error)
|
||||||
}
|
}
|
||||||
@@ -194,7 +196,16 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
const handleRecharge = () => {
|
const handleRecharge = () => {
|
||||||
|
if(!state.value){
|
||||||
|
uni.showToast({
|
||||||
|
title: t('order.readAgreeServices'),
|
||||||
|
icon: 'none'
|
||||||
|
})
|
||||||
|
return
|
||||||
|
}
|
||||||
|
uni.showLoading({ title: '加载中...' })
|
||||||
console.log('立即充值');
|
console.log('立即充值');
|
||||||
|
getGooglePay()
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -202,8 +213,6 @@
|
|||||||
*/
|
*/
|
||||||
const getGooglePay = () => {
|
const getGooglePay = () => {
|
||||||
googlePay.init({
|
googlePay.init({
|
||||||
// autoReconnect: true, // 是否自动重连(插件实现)
|
|
||||||
// enableAutoServiceReconnection: true, //是否自动重连(8.0+支持)
|
|
||||||
}, (e:any) => {
|
}, (e:any) => {
|
||||||
console.log('init', e);
|
console.log('init', e);
|
||||||
if (e.code == 0) {
|
if (e.code == 0) {
|
||||||
@@ -262,9 +271,6 @@
|
|||||||
getDevName();
|
getDevName();
|
||||||
getActivityDescriptionData()
|
getActivityDescriptionData()
|
||||||
getAgreementData()
|
getAgreementData()
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
})
|
})
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
@@ -300,7 +306,7 @@
|
|||||||
|
|
||||||
.recharge_money {
|
.recharge_money {
|
||||||
font-size: 30rpx;
|
font-size: 30rpx;
|
||||||
margin-bottom: 30rpx;
|
margin-bottom: 10rpx;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -376,9 +382,12 @@
|
|||||||
|
|
||||||
.cf_xuanx {
|
.cf_xuanx {
|
||||||
font-size: 24rpx;
|
font-size: 24rpx;
|
||||||
padding: 20rpx 0;
|
padding: 10rpx 0;
|
||||||
margin-bottom: 20rpx;
|
margin-bottom: 20rpx;
|
||||||
border-bottom: 1px solid #ededed;
|
border-bottom: 1px solid #ededed;
|
||||||
|
display: flex;
|
||||||
|
justify-content: space-between;
|
||||||
|
align-items:center;
|
||||||
|
|
||||||
image {
|
image {
|
||||||
width: 40rpx;
|
width: 40rpx;
|
||||||
|
|||||||
@@ -1,65 +1,46 @@
|
|||||||
<template>
|
<template>
|
||||||
<z-paging ref="paging" v-model="bookList" auto-show-back-to-top class="my-book-page" @query="loadBookList">
|
<z-paging ref="paging" v-model="bookList" auto-show-back-to-top class="my-book-page" @query="rechargeList" :default-page-size="10">
|
||||||
<template #top>
|
<template #top>
|
||||||
<!-- 自定义导航栏 -->
|
<!-- 自定义导航栏 -->
|
||||||
<nav-bar :title="$t('book.myBook')"></nav-bar>
|
<nav-bar :title="$t('user.consumptionRecord')"></nav-bar>
|
||||||
</template>
|
</template>
|
||||||
|
<view class="recharge-record" v-if="(bookList && bookList.length > 0)">
|
||||||
<!-- 充值列表 -->
|
<view class="go-gecharge" @click="goRecharge">
|
||||||
<!-- <uni-icons fontFamily="CustomFont" :size="26">{{'\uebc6'}}</uni-icons> -->
|
<view>{{$t('order.recharge')}}</view>
|
||||||
|
<view><wd-icon name="arrow-right" size="16px" color="#fff"/></view>
|
||||||
<view class="recharge-record">
|
|
||||||
<view><uni-icons type="right" size="30"></uni-icons></view>
|
|
||||||
<view class="go-gecharge">
|
|
||||||
立即充值
|
|
||||||
<uni-icons type="contact" size="30"></uni-icons>
|
|
||||||
</view>
|
</view>
|
||||||
<view class="title">充值消费记录</view>
|
<view class="title">{{$t('order.rechargeConsumptionList')}}</view>
|
||||||
<view class="recharge-record-block" v-for="(item) in 5">
|
<view class="recharge-record-block" v-for="(item, index) in bookList" :key="index">
|
||||||
<view class="recharge-record-block-row">购买商品<text class="text">90</text></view>
|
<view class="recharge-record-block-row">{{item.orderType}}<text class="text">{{item.changeAmount}}</text></view>
|
||||||
<view class="time">2025-10-20</view>
|
<view class="time">{{item.createTime}}</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<!-- <view v-if="(bookList && bookList.length > 0)" class="book-list">
|
|
||||||
<BookCard
|
|
||||||
v-for="item in bookList"
|
|
||||||
:key="item.id"
|
|
||||||
:book="item"
|
|
||||||
/>
|
|
||||||
</view> -->
|
|
||||||
|
|
||||||
<!-- 空状态 -->
|
|
||||||
<!-- <view v-else-if="!loading && !firstLoad" class="empty-state">
|
|
||||||
<image src="@/static/null_img.png" mode="aspectFit" />
|
|
||||||
<text class="empty-text">{{ $t('book.nullText') }}</text>
|
|
||||||
<wd-button type="primary" @click="goToBuy">
|
|
||||||
{{ $t('book.choose') }}
|
|
||||||
</wd-button>
|
|
||||||
</view> -->
|
|
||||||
</z-paging>
|
</z-paging>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { ref } from 'vue'
|
import { ref } from 'vue'
|
||||||
import { useI18n } from 'vue-i18n'
|
import { useI18n } from 'vue-i18n'
|
||||||
import { bookApi } from '@/api/modules/book'
|
import { useUserStore } from '@/stores/user'
|
||||||
import type { IBook } from '@/types/book'
|
import { getTransactionDetailsList } from '@/api/modules/user'
|
||||||
import BookCard from '@/components/book/BookCard.vue'
|
|
||||||
|
|
||||||
const { t } = useI18n()
|
const { t } = useI18n()
|
||||||
const paging = ref<any>()
|
const paging = ref<any>()
|
||||||
|
const userStore = useUserStore()
|
||||||
|
|
||||||
// 数据状态
|
// 数据状态
|
||||||
const bookList = ref<IBook[]>([])
|
const bookList = ref([])
|
||||||
const loading = ref(false)
|
const loading = ref(false)
|
||||||
const firstLoad = ref(true)
|
const firstLoad = ref(true)
|
||||||
|
|
||||||
// 加载书单列表
|
// 充值记录列表
|
||||||
async function loadBookList(pageNo : number, pageSize : number) {
|
async function rechargeList(pageNo : number, pageSize : number) {
|
||||||
|
const userId = userStore.userInfo.id
|
||||||
loading.value = true
|
loading.value = true
|
||||||
try {
|
try {
|
||||||
const res = await bookApi.getMyBooks(pageNo, pageSize)
|
const res = await getTransactionDetailsList(pageNo, pageSize, userId)
|
||||||
paging.value.complete(res.page.records)
|
console.log(res, 'res');
|
||||||
|
paging.value.complete(res.transactionDetailsList.records)
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
paging.value.complete(false)
|
paging.value.complete(false)
|
||||||
console.error('Failed to load book list:', error)
|
console.error('Failed to load book list:', error)
|
||||||
@@ -68,6 +49,15 @@
|
|||||||
loading.value = false
|
loading.value = false
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 跳转充值页面
|
||||||
|
*/
|
||||||
|
const goRecharge = () => {
|
||||||
|
uni.navigateTo({
|
||||||
|
url: '/pages/user/recharge/index'
|
||||||
|
})
|
||||||
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style lang="scss" scoped>
|
<style lang="scss" scoped>
|
||||||
@@ -86,15 +76,16 @@
|
|||||||
.go-gecharge{
|
.go-gecharge{
|
||||||
//height: 100rpx;
|
//height: 100rpx;
|
||||||
background: linear-gradient(to right, #007bff, #17a2b8);
|
background: linear-gradient(to right, #007bff, #17a2b8);
|
||||||
font-size: 40rpx;
|
font-size: 30rpx;
|
||||||
font-weight: bold;
|
font-weight: bold;
|
||||||
color: #fff;
|
color: #fff;
|
||||||
padding: 20rpx;
|
padding: 20rpx;
|
||||||
margin-bottom: 20rpx;
|
margin-bottom: 20rpx;
|
||||||
|
display: flex;justify-content:space-between;align-items:center
|
||||||
}
|
}
|
||||||
|
|
||||||
.title {
|
.title {
|
||||||
font-size: 40rpx;
|
font-size: 30rpx;
|
||||||
padding-left:20rpx;
|
padding-left:20rpx;
|
||||||
margin-bottom: 30rpx;
|
margin-bottom: 30rpx;
|
||||||
color: #007bff;
|
color: #007bff;
|
||||||
@@ -120,6 +111,25 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
.empty-state {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
padding-top: 200rpx;
|
||||||
|
|
||||||
|
image {
|
||||||
|
width: 400rpx;
|
||||||
|
height: 300rpx;
|
||||||
|
margin-bottom: 40rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.empty-text {
|
||||||
|
font-size: 28rpx;
|
||||||
|
color: #999;
|
||||||
|
margin-bottom: 50rpx;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
</style>
|
</style>
|
||||||
Reference in New Issue
Block a user