Files
kangyuan-mobile/pages/index/components/aistore_tab2.vue
T

238 lines
4.7 KiB
Vue
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
<template>
<view class="tab2-wrap p-x-32 p-b-24">
<view
class="shop-card m-b-24"
v-for="(v, i) in renderList"
:key="v.id || i"
@tap="toListRecord(v)"
>
<view class="shop-card-inner">
<view class="shop-card-top">
<view class="shop-name lineOne">{{ v.name }}</view>
</view>
<view class="meta-row flex-between">
<view class="progress-row">
<view class="progress-bar">
<view
class="progress"
:style="{ width: `${Math.max(0, Math.min(100, Number(v.progress) || 0))}%` }"
></view>
</view>
</view>
<view class="first-time">首次代理时间:{{ v.createTime }}</view>
</view>
<view class="stats flex-between">
<view class="stat">
<view class="stat-head flex-between">
<view class="stat-title">店铺总收益</view>
<image class="stat-icon" src="/static/aiStore/earnings.png" mode="aspectFit" />
</view>
<view class="stat-value">¥{{ formatMoney(v.earnings) }}</view>
</view>
<view class="stat">
<view class="stat-head flex-between">
<view class="stat-title">绿色积分</view>
<image class="stat-icon" src="/static/aiStore/leaf.png" mode="aspectFit" />
</view>
<view class="stat-value leaf">{{ v.leaf || 0 }}</view>
</view>
</view>
</view>
</view>
</view>
</template>
<script setup>
import { computed } from 'vue';
const props = defineProps({
list: {
type: Array,
default: () => [],
},
source: {
type: Number,
default: 1,
},
});
const emit = defineEmits(['addCar', 'update', 'shipment']);
const renderList = computed(() => (Array.isArray(props.list) ? props.list : []));
const formatMoney = (value) => {
const num = Number(value);
if (!Number.isFinite(num)) return '0.00';
return num.toFixed(2);
};
const toListRecord = (item) => {
const shopId = item?.id ?? '';
const name = item?.name ?? '';
const cover = item?.cover ?? '';
const url =
'/pages/index/listRecord' +
`?shopId=${encodeURIComponent(String(shopId))}` +
`&name=${encodeURIComponent(String(name))}` +
`&cover=${encodeURIComponent(String(cover))}`;
uni.navigateTo({ url });
};
</script>
<style lang="scss" scoped>
.tab2-wrap {
box-sizing: border-box;
}
.shop-card {
background: #ffffff;
border-radius: 24rpx;
overflow: hidden;
box-shadow: 0 16rpx 40rpx rgba(25, 80, 215, 0.12);
}
.shop-card-inner {
padding: 24rpx;
}
.shop-card-top {
align-items: flex-end;
}
.shop-name {
flex: 1;
font-size: 34rpx;
font-weight: 600;
color: #1b2b4b;
letter-spacing: 0.5rpx;
}
.meta-row {
margin-top: 16rpx;
align-items: center;
gap: 16rpx;
}
.first-time {
flex-shrink: 0;
font-size: 22rpx;
color: #5b6b8a;
}
.progress-row {
flex: 1;
min-width: 180rpx;
}
.cover-wrap {
position: relative;
height: 220rpx;
}
.cover {
width: 100%;
height: 100%;
}
.cover-mask {
position: absolute;
left: 0;
top: 0;
right: 0;
bottom: 0;
background: linear-gradient(180deg, rgba(0, 0, 0, 0.12) 0%, rgba(0, 0, 0, 0.55) 100%);
}
.cover-content {
position: absolute;
left: 24rpx;
right: 24rpx;
bottom: 20rpx;
color: #ffffff;
}
.title {
font-size: 34rpx;
font-weight: 600;
letter-spacing: 0.5rpx;
}
.subText {
font-size: 22rpx;
opacity: 0.92;
}
.tag {
padding: 6rpx 16rpx;
border-radius: 999rpx;
font-size: 22rpx;
border: 1rpx solid rgba(255, 255, 255, 0.4);
background: rgba(255, 255, 255, 0.22);
box-sizing: border-box;
}
.body {
padding: 24rpx;
}
.progress-label {
font-size: 24rpx;
color: #5b6b8a;
margin-bottom: 12rpx;
}
.progress-bar {
height: 15rpx;
border-radius: 999rpx;
background: linear-gradient(90deg, #2c63ff 0%, #ff3b30 100%);
overflow: hidden;
}
.progress {
height: 13rpx;
margin: 1rpx;
border-radius: 999rpx;
background: rgba(255, 255, 255, 0.92);
}
.stats {
margin-top: 20rpx;
}
.stat {
width: 48%;
padding: 20rpx 22rpx 12rpx;
border-radius: 20rpx;
box-sizing: border-box;
background: #f7faff;
border: 1rpx solid #e6ecfb;
}
.stat-head {
gap: 12rpx;
}
.stat-title {
font-size: 22rpx;
color: #5b6b8a;
}
.stat-icon {
width: 28rpx;
height: 28rpx;
}
.stat-value {
font-size: 42rpx;
font-weight: 700;
color: #ff4d3f;
margin-top: 10rpx;
}
.stat-value.leaf {
color: #12b76a;
}
</style>