feat: 我的店铺进度条

This commit is contained in:
2026-06-04 17:41:39 +08:00
parent c305aa60b0
commit 9fa063f695
3 changed files with 16 additions and 12 deletions
+1
View File
@@ -141,6 +141,7 @@
<aistore_tab2
v-if="index === 1"
:list="dataList"
:totalEarnings="shopSummary.totalEarnings"
:source="index"
@addCar="addCar"
@update="update"
+14 -1
View File
@@ -16,7 +16,7 @@
<view class="progress-bar">
<view
class="progress"
:style="{ width: `${Math.max(0, Math.min(100, Number(v.progress) || 0))}%` }"
:style="{ width: `${calcProgressPercent(v)}%` }"
></view>
</view>
</view>
@@ -55,6 +55,10 @@
type: Array,
default: () => [],
},
totalEarnings: {
type: [Number, String],
default: 0,
},
source: {
type: Number,
default: 1,
@@ -65,6 +69,15 @@
const renderList = computed(() => (Array.isArray(props.list) ? props.list : []));
const calcProgressPercent = (item) => {
const total = Number(props.totalEarnings) || 0;
const cur = Number(item?.earnings) || 0;
if (total <= 0 || cur <= 0) return 0;
const pct = (cur / total) * 100;
if (!Number.isFinite(pct)) return 0;
return Math.max(0, Math.min(100, pct));
};
const toListRecord = (item) => {
const skuId = item?.skuId ?? '';
const url =
+1 -11
View File
@@ -82,16 +82,6 @@
return num.toFixed(2);
};
const resolveProgress = (status) => {
const s = Number(status);
if (s === 0) return 25;
if (s === 10) return 50;
if (s === 20) return 75;
if (s === 30) return 100;
if (s === 40) return 0;
return 0;
};
const mapOrderToRecord = (order) => {
const items = Array.isArray(order?.items) ? order.items : [];
const firstItem = items[0] || {};
@@ -107,7 +97,7 @@
id: order?.id,
title: titleText,
statusText,
progress: resolveProgress(order?.status),
progress: 80,
qty,
time: timeText,
total: totalYuan,