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
+63 -3
View File
@@ -1,9 +1,12 @@
<template>
<s-layout :navbar="navBar" title="金种子" navPreset="float">
<view class="pages w100" :style="{ marginTop: -height + 'px' }">
<view class="w100">
<!-- <image class="w100" :src="$url + 'home/seed_1.png'" mode="widthFix" /> -->
<image class="w100" src="/static/jinzhongzi_bg.png" mode="widthFix" />
<view class="seed-hero w100">
<image class="seed-hero__bg" src="/static/jinzhongzi_bg.png" mode="widthFix" />
<view class="seed-hero__text">
<view class="seed-hero__title">资产概览</view>
<view class="seed-hero__sub">更新于 {{ getUpdateDateText() }}</view>
</view>
</view>
<view class="content" :style="{ marginTop: -top + 'px' }">
<view class="con">
@@ -283,6 +286,33 @@
const n = Number(val);
return Number.isFinite(n) ? n.toFixed(4) : '0.0000';
};
const formatYmd = (val: any) => {
const formatDate = (d: Date) => {
const y = d.getFullYear();
const m = pad2(d.getMonth() + 1);
const day = pad2(d.getDate());
return `${y}年${m}月${day}日`;
};
if (val instanceof Date) return formatDate(val);
if (typeof val === 'number') {
const d = new Date(val);
return Number.isFinite(d.getTime()) ? formatDate(d) : '';
}
const s = String(val ?? '').trim();
if (!s) return '';
const m = s.match(/^(\d{4})-(\d{2})-(\d{2})/);
if (m) return `${m[1]}年${m[2]}月${m[3]}日`;
const d = new Date(s);
return Number.isFinite(d.getTime()) ? formatDate(d) : '';
};
const getUpdateDateText = () => {
return (
formatYmd(dataObj?.updateTime || dataObj?.updateDate || dataObj?.updateAt) ||
formatYmd(new Date())
);
};
const toLocalDateTime = (d) => {
const y = d.getFullYear();
const m = pad2(d.getMonth() + 1);
@@ -633,7 +663,37 @@
<style lang="scss" scoped>
.pages {
// position: relative;
box-sizing: border-box;
.seed-hero {
position: relative;
width: 100%;
}
.seed-hero__bg {
width: 100%;
display: block;
}
.seed-hero__text {
position: absolute;
left: 60rpx;
top: calc(env(safe-area-inset-top) + 120rpx);
z-index: 2;
}
.seed-hero__title {
font-size: 44rpx;
line-height: 52rpx;
font-weight: 700;
color: #fff;
}
.seed-hero__sub {
margin-top: 10rpx;
font-size: 26rpx;
line-height: 34rpx;
color: rgba(255, 255, 255, 0.88);
}
.content {
// position: absolute;
width: 100%;
+26
View File
@@ -3,6 +3,11 @@
<view class="share_page_bg" id="captureBox" :style="{ marginTop: `-${navHeight}px` }">
<view class="slogan">
<image class="slogan_img" src="/static/share_bg.png" mode="widthFix" />
<view class="slogan__text">
<view class="slogan__title">邀请好友</view>
<view class="slogan__title">一起瓜分金种子</view>
<view class="slogan__sub">好友注册你得奖励</view>
</view>
</view>
<view class="share_card">
@@ -385,6 +390,27 @@
display: block;
}
.slogan__text {
position: absolute;
left: 60rpx;
top: calc(env(safe-area-inset-top) + 100rpx);
z-index: 1;
}
.slogan__title {
font-size: 45rpx;
line-height: 60rpx;
font-weight: 800;
color: #ffffff;
}
.slogan__sub {
margin-top: 18rpx;
font-size: 28rpx;
line-height: 35rpx;
color: rgba(255, 255, 255, 0.88);
}
.share_card {
position: relative;
z-index: 0;
+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) => {
+4 -35
View File
@@ -2,7 +2,7 @@
<view class="tab2-wrap p-x-32 p-b-24">
<view
class="shop-card m-b-24"
v-for="(v, i) in mockList"
v-for="(v, i) in renderList"
:key="v.id || i"
@tap="toListRecord(v)"
>
@@ -45,9 +45,9 @@
</template>
<script setup>
import { ref } from 'vue';
import { computed } from 'vue';
defineProps({
const props = defineProps({
list: {
type: Array,
default: () => [],
@@ -60,38 +60,7 @@
const emit = defineEmits(['addCar', 'update', 'shipment']);
const mockList = ref([
{
id: 1,
name: '卓玛阳光防断洗发水',
// level: 'LV.3 超级店长',
createTime: '2026-03-09',
progress: 75,
earnings: 200,
leaf: 3200,
cover: '/static/home/img1.png',
},
{
id: 2,
name: '治山贡鸡源头旗舰店',
// level: 'LV.2 高级店长',
createTime: '2026-02-18',
progress: 62,
earnings: 870,
leaf: 5600,
cover: '/static/home/5.png',
},
{
id: 3,
name: '有购精选生活馆',
// level: 'LV.1 初级店长',
createTime: '2026-01-25',
progress: 48,
earnings: 126.5,
leaf: 2100,
cover: '/static/home/6.png',
},
]);
const renderList = computed(() => (Array.isArray(props.list) ? props.list : []));
const formatMoney = (value) => {
const num = Number(value);
+44 -8
View File
@@ -2,7 +2,13 @@
<template>
<s-layout title="首页" :showLeftButton="false" tabbar="/pages/index/index" navPreset="light">
<view class="pagesIndex">
<view class="index-notice-btn" @click="goNotice"></view>
<view class="index-header">
<view class="index-header__left">
<view class="index-header__title">优购商城</view>
<view class="index-header__subtitle">AI店铺 · 一人店铺 · 共建共享</view>
</view>
<view class="index-notice-btn" @click="goNotice"></view>
</view>
<view class="pageContent">
<view class="floating-search-wrap">
<view class="floating-search" @click="goSearch">
@@ -343,12 +349,12 @@
}
.pagesIndex {
position: relative;
padding-top: 470rpx;
padding-top: 480rpx;
// background: linear-gradient(135deg, #2c8cfa 0%, #3d5efb 100%);
background-image: url("../../static/index/index_bg.png");
background-image: url("../../static/index/index_bg.jpeg");
background-size: 100% auto;
background-repeat: no-repeat;
background-position: top center;
background-position: center -20rpx;
.pageContent{
border-radius: 20rpx 20rpx 0 0;
position: relative;
@@ -356,18 +362,48 @@
background: #fff;
}
}
.index-notice-btn {
.index-header {
position: absolute;
top: 60rpx;
right: 52rpx;
top: 0;
left: 0;
right: 0;
z-index: 20;
padding: calc(env(safe-area-inset-top) + 60rpx) 52rpx 0 52rpx;
display: flex;
align-items: center;
justify-content: space-between;
}
.index-header__left {
min-width: 0;
}
.index-header__title {
font-size: 44rpx;
line-height: 52rpx;
font-weight: 700;
color: #fff;
}
.index-header__subtitle {
margin-top: 10rpx;
font-size: 26rpx;
line-height: 34rpx;
color: rgba(255, 255, 255, 0.88);
}
.index-notice-btn {
position: relative;
width: 44rpx;
height: 44rpx;
background-image: url('/static/icon/ notice.png');
background-size: 100% 100%;
background-repeat: no-repeat;
background-position: center;
z-index: 20;
flex: 0 0 auto;
}
.floating-search-wrap {
position: absolute;
top: -50rpx;