Merge branch 'aigc' of https://git.nianxx.cn/zoujing/YGChatCS into home3.0

This commit is contained in:
2026-07-16 09:11:01 +08:00
4 changed files with 63 additions and 62 deletions

View File

@@ -1,15 +1,15 @@
<template> <template>
<view class="ledger-card"> <view class="ledger-card">
<view class="ledger-card-copy"> <view class="ledger-card-copy">
<text class="ledger-title">{{ record.type }}</text> <text class="ledger-title">{{ record.title }}</text>
<text class="ledger-task">{{ record.task }}</text> <text class="ledger-task">{{ record.subTitle }}</text>
<text class="ledger-time">{{ record.time }}</text> <text class="ledger-time">{{ record.createTime }}</text>
</view> </view>
<text :class="['ledger-delta', isPlus ? 'is-plus' : 'is-minus']"> <text class="ledger-delta" :class="{ 'is-plus': isPlus, 'is-minus': isMinus }">
{{ record.delta }} {{ changePointsText }}
</text> </text>
<text class="ledger-status">{{ record.status }}</text> <text class="ledger-status">{{ statusText }}</text>
</view> </view>
</template> </template>
@@ -23,7 +23,27 @@ const props = defineProps({
}, },
}); });
const isPlus = computed(() => String(props.record.delta || "").startsWith("+")); const changePoints = computed(() => {
const value = Number(props.record.changePoints);
return Number.isFinite(value) ? value : 0;
});
const changePointsText = computed(() => {
return changePoints.value > 0 ? `+${changePoints.value}` : String(changePoints.value);
});
const isPlus = computed(() => changePoints.value > 0);
const isMinus = computed(() => changePoints.value < 0);
const statusText = computed(() => {
const statusName = props.record.statusName;
if (statusName !== undefined && statusName !== null && statusName !== "") {
return statusName;
}
const status = props.record.status;
return status === undefined || status === null ? "" : String(status);
});
</script> </script>
<style scoped lang="scss"> <style scoped lang="scss">

View File

@@ -1,42 +0,0 @@
export const pointsLedgerRecords = [
{
id: "new-user-gift",
type: "新用户赠送",
task: "试用权益",
time: "2026-06-29 09:41:00",
delta: "+300",
status: "已到账",
},
{
id: "recharge-1000",
type: "优惠充值",
task: "实付 ¥9.5",
time: "2026-06-29 10:18:25",
delta: "+1000",
status: "已到账",
},
{
id: "video-freeze",
type: "动效视频版冻结",
task: "鸳鸯湖明信片",
time: "2026-06-29 15:45:58",
delta: "-200",
status: "冻结中",
},
{
id: "video-success",
type: "动效视频版成功",
task: "鸳鸯湖明信片",
time: "2026-06-29 15:46:12",
delta: "-200",
status: "已扣除",
},
{
id: "video-refund",
type: "动效视频版失败退回",
task: "卧龙潭旅行成片",
time: "2026-06-29 16:05:30",
delta: "+200",
status: "已退回",
},
];

View File

@@ -1,27 +1,45 @@
<template> <template>
<view class="points-details-page"> <z-paging ref="paging" v-model="records" class="points-details-page" bg-color="#effaf5"
<TopNavBar safe-area-inset-bottom @query="queryList">
title="积分明细" <template #top>
background="transparent" <TopNavBar title="积分明细" background="transparent" title-color="#172033" back-icon-color="#172033"
title-color="#172033" :align-with-menu-button="true" :z-index="3" @back="handleBack" />
back-icon-color="#172033" </template>
:align-with-menu-button="true"
:z-index="3"
@back="handleBack"
/>
<view class="points-details-content"> <view class="points-details-content">
<LedgerList :records="records" /> <LedgerList :records="records" />
</view> </view>
</view>
<template #empty>
<CustomEmpty statusText="暂无积分明细" />
</template>
</z-paging>
</template> </template>
<script setup> <script setup>
import { ref } from "vue";
import CustomEmpty from "@/components/CustomEmpty/index.vue";
import TopNavBar from "@/components/TopNavBar/index.vue"; import TopNavBar from "@/components/TopNavBar/index.vue";
import { getCreditLedgerPage } from "@/request/api/AigcApi.js";
import LedgerList from "./components/LedgerList/index.vue"; import LedgerList from "./components/LedgerList/index.vue";
import { pointsLedgerRecords } from "./data/ledger.js";
const records = pointsLedgerRecords; const records = ref([]);
const paging = ref(null);
const queryList = async (pageNum, pageSize) => {
try {
const res = await getCreditLedgerPage({ pageNum, pageSize });
if (res?.code === 0 && Array.isArray(res.data?.records)) {
paging.value?.completeByTotal(res.data.records, Number(res.data.total) || 0);
return;
}
paging.value?.complete([]);
} catch (error) {
console.error("获取积分明细失败", error);
paging.value?.complete(false);
}
};
const handleBack = () => { const handleBack = () => {
const pages = getCurrentPages(); const pages = getCurrentPages();

View File

@@ -32,6 +32,10 @@ function rechargeCredit(args) {
return request.post("/hotelBiz/credit/recharge", args); return request.post("/hotelBiz/credit/recharge", args);
} }
function getCreditLedgerPage(args) {
return request.post("/hotelBiz/credit/ledger/page", args);
}
export { export {
getAigcTemplateList, getAigcTemplateList,
getAigcTemplateItemList, getAigcTemplateItemList,
@@ -41,4 +45,5 @@ export {
getCurrentCredit, getCurrentCredit,
getRechargeOptions, getRechargeOptions,
rechargeCredit, rechargeCredit,
getCreditLedgerPage,
}; };