Files
kangyuan-mobile/pages/index/listRecord.vue
T

235 lines
4.9 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>
<s-pages title="列表记录" :pink_bg="false" navPreset="light">
<view class="list-record-page">
<view class="share-btn" :style="{ top: shareTop }" @tap="onShare">
一键分享
</view>
<view class="hero">
<image class="hero-img" :src="cover || '/static/home/bc.png'" mode="aspectFill" />
</view>
<view class="record-list">
<view class="record-card" v-for="(item, i) in recordList" :key="item.id || i">
<view class="record-head flex-between">
<view class="record-title lineOne">{{ item.title }}</view>
<view class="record-status">{{ item.statusText }}</view>
</view>
<view class="record-progress">
<view class="progress-bar">
<view class="progress" :style="{ width: `${item.progress}%` }"></view>
</view>
</view>
<view class="record-meta">
<view class="meta-row flex-row-end">
<view class="record-qty">数量 {{ item.qty }}</view>
</view>
<view class="meta-row flex-between">
<view class="record-time">下单时间:{{ item.time }}</view>
<view class="record-total-inline">
<view class="total-label">总计</view>
<view class="total-price">¥{{ formatMoney(item.total) }}</view>
</view>
</view>
</view>
</view>
</view>
</view>
</s-pages>
</template>
<script setup>
import { ref } from 'vue';
import { onLoad } from '@dcloudio/uni-app';
const statusBarHeight = uni.getSystemInfoSync()?.statusBarHeight || 0;
const shareTop = `${statusBarHeight + 8}px`;
const shopId = ref('');
const name = ref('');
const cover = ref('');
const recordList = ref([
{
id: 1,
title: '卓玛阳光防断洗发水',
statusText: '已完成',
progress: 72,
qty: 137,
time: '2026-05-27 12:37',
total: 3000,
},
{
id: 2,
title: '卓玛阳光防断洗发水',
statusText: '已完成',
progress: 72,
qty: 137,
time: '2026-05-27 12:37',
total: 3000,
},
{
id: 3,
title: '卓玛阳光防断洗发水',
statusText: '已完成',
progress: 72,
qty: 137,
time: '2026-05-27 12:37',
total: 3000,
},
]);
onLoad((query) => {
shopId.value = query?.shopId ?? '';
name.value = query?.name ?? '';
// cover.value = query?.cover ?? '';
if (name.value) {
recordList.value = recordList.value.map((r) => ({ ...r, title: name.value }));
}
});
const formatMoney = (value) => {
const num = Number(value);
if (!Number.isFinite(num)) return '0.00';
return num.toFixed(2);
};
const onShare = () => {
uni.showToast({ title: '分享功能开发中', icon: 'none' });
};
</script>
<style lang="scss" scoped>
.list-record-page {
padding: 0 32rpx 32rpx;
min-height: 100%;
box-sizing: border-box;
}
.share-btn {
position: fixed;
right: 24rpx;
z-index: 99;
height: 56rpx;
padding: 0 18rpx;
border-radius: 18rpx;
background: rgba(255, 106, 74, 0.18);
color: #ff6a4a;
font-size: 24rpx;
display: flex;
align-items: center;
justify-content: center;
}
.hero {
margin-top: 18rpx;
border-radius: 26rpx;
overflow: hidden;
background: #ffffff;
}
.hero-img {
width: 100%;
height: 340rpx;
display: block;
}
.record-list {
margin-top: 18rpx;
}
.record-card {
background: #ffffff;
border-radius: 24rpx;
padding: 24rpx;
margin-bottom: 18rpx;
box-shadow: 0 16rpx 40rpx rgba(0, 0, 0, 0.06);
}
.record-head {
align-items: center;
gap: 16rpx;
}
.record-title {
flex: 1;
font-size: 34rpx;
font-weight: 700;
color: #111111;
}
.record-status {
flex-shrink: 0;
font-size: 24rpx;
color: #8a8a8a;
}
.record-progress {
margin-top: 18rpx;
}
.progress-bar {
width: 60%;
height: 20rpx;
border-radius: 999rpx;
background: linear-gradient(90deg, #2c63ff 0%, #ff3b30 100%);
overflow: hidden;
}
.progress {
height: 13rpx;
margin: 3rpx;
border-radius: 999rpx;
background: rgba(255, 255, 255, 0.92);
}
.record-meta {
margin-top: 18rpx;
display: flex;
flex-direction: column;
gap: 12rpx;
}
.meta-row {
align-items: baseline;
}
.record-total-inline {
display: flex;
align-items: baseline;
gap: 10rpx;
flex-shrink: 0;
}
.record-time {
font-size: 24rpx;
color: #111111;
flex: 1;
min-width: 0;
}
.record-qty {
font-size: 24rpx;
color: #333333;
}
.record-total {
margin-top: 18rpx;
align-items: baseline;
gap: 10rpx;
}
.total-label {
font-size: 24rpx;
color: #111111;
}
.total-price {
font-size: 34rpx;
font-weight: 800;
color: #ff3b30;
}
</style>