feat: 添加我的店铺api

This commit is contained in:
2026-06-03 15:18:09 +08:00
parent 5c7f7a9c4e
commit fd851bab83
14 changed files with 181 additions and 87 deletions
+34 -38
View File
@@ -95,7 +95,8 @@
</view>
<view class="shop-summary-info flex1">
<view class="shop-summary-title">{{ shopSummary.title }}</view>
<view class="shop-summary-id">ID:{{ shopSummary.id }}</view>
<view class="shop-summary-id">ID:{{ shopSummary.shopId }}</view>
<!-- <view class="shop-summary-id">商品总数:{{ shopSummary.total }}</view> -->
</view>
</view>
<view class="shop-summary-bottom" v-if="index === 1">
@@ -112,7 +113,7 @@
<view class="metric-divider"></view>
<view class="metric flex1">
<view class="metric-label">店铺等级</view>
<view class="metric-value">{{ shopSummary.level }}</view>
<view class="metric-value">LV.{{ shopSummary.level || 0 }}</view>
</view>
</view>
</view>
@@ -264,10 +265,11 @@
let res = null;
if (index.value) {
res = await api.getOrderPage({
res = await api.getMyShop({
pageNo: mescroll?.num || 1,
pageSize: mescroll?.size || 10,
keyWord: searchText.value,
keyWord: searchText.value || undefined,
status: mescroll?.params?.status,
});
} else {
res = await api.getSpuPage({
@@ -286,37 +288,31 @@
let curPageData = [];
if (index.value) {
const list = res.data.list || [];
const arr = [];
list.forEach((e) => {
e.items1 = JSON.parse(JSON.stringify(e.items));
if (e?.items?.length) {
e.items.forEach((item) => {
item.skuArr = item.items;
item.status = e.status;
item.id = item.spuId;
item.spuId = e.payOrderId;
item.shoppingPlazaId = e.roundTimeId;
item.items1 = e.items1;
arr.push(item);
});
}
});
if (arr.length) {
arr.forEach((e) => {
if (e.skuArr && e.skuArr.length) {
e.skuArr.forEach((item) => {
item.propertyText = '';
if (item?.properties) {
item.properties.forEach((e1) => {
item.propertyText += e1.valueName + ' ';
});
}
});
}
});
const root = res?.data || {};
if ((mescroll?.num || 1) === 1) {
shopSummary.value = {
title: '我的店铺',
totalEarnings: root?.totalRevenue ?? 0,
shopCount: root?.numberOfStores ?? 0,
level: root?.shopRating ?? 0,
total: root?.total ?? 0,
shopId: root?.shopId ?? '',
};
}
curPageData = arr;
const list = Array.isArray(root?.storeList) ? root.storeList : [];
curPageData = list.map((it) => {
const agencyTime = String(it?.agencyTime || '').trim();
const dateOnly = agencyTime ? agencyTime.split('T')[0].split(' ')[0] : '';
return {
id: it?.skuId ?? '',
name: it?.aiShopCommodityName ?? '',
createTime: dateOnly,
progress: 0,
earnings: it?.totalRevenue ?? 0,
leaf: it?.greenCredits ?? 0,
cover: it?.picUrl ?? '',
};
});
} else {
curPageData = res.data?.list || [];
}
@@ -357,10 +353,10 @@
const shopSummary = ref({
title: '我的店铺',
id: '123726492',
totalEarnings: 26873.8,
shopCount: 12,
level: 'LV.3',
totalEarnings: 0,
shopCount: 0,
level: 0,
total: 0,
});
const formatAmount = (value) => {