feat: 我的店铺列表进度条数据变更

This commit is contained in:
2026-06-05 09:46:13 +08:00
parent 9fa063f695
commit d657df4ba3
2 changed files with 6 additions and 9 deletions
+2 -1
View File
@@ -141,7 +141,6 @@
<aistore_tab2 <aistore_tab2
v-if="index === 1" v-if="index === 1"
:list="dataList" :list="dataList"
:totalEarnings="shopSummary.totalEarnings"
:source="index" :source="index"
@addCar="addCar" @addCar="addCar"
@update="update" @update="update"
@@ -311,6 +310,8 @@
createTime: dateOnly, createTime: dateOnly,
progress: 0, progress: 0,
earnings: it?.totalRevenue ?? 0, earnings: it?.totalRevenue ?? 0,
totalRevenue: it?.totalRevenue ?? 0,
userPayPrice: it?.userPayPrice ?? 0,
leaf: it?.greenCredits ?? 0, leaf: it?.greenCredits ?? 0,
cover: it?.picUrl ?? '', cover: it?.picUrl ?? '',
}; };
+4 -8
View File
@@ -55,10 +55,6 @@
type: Array, type: Array,
default: () => [], default: () => [],
}, },
totalEarnings: {
type: [Number, String],
default: 0,
},
source: { source: {
type: Number, type: Number,
default: 1, default: 1,
@@ -70,10 +66,10 @@
const renderList = computed(() => (Array.isArray(props.list) ? props.list : [])); const renderList = computed(() => (Array.isArray(props.list) ? props.list : []));
const calcProgressPercent = (item) => { const calcProgressPercent = (item) => {
const total = Number(props.totalEarnings) || 0; const totalRevenue = Number(item?.totalRevenue ?? item?.earnings) || 0;
const cur = Number(item?.earnings) || 0; const userPayPrice = Number(item?.userPayPrice) || 0;
if (total <= 0 || cur <= 0) return 0; if (userPayPrice <= 0 || totalRevenue <= 0) return 0;
const pct = (cur / total) * 100; const pct = (totalRevenue / userPayPrice) * 100;
if (!Number.isFinite(pct)) return 0; if (!Number.isFinite(pct)) return 0;
return Math.max(0, Math.min(100, pct)); return Math.max(0, Math.min(100, pct));
}; };