miao33: 从 main 同步 single_uniapp22miao,dart-sass 兼容修复,DEPLOY.md 更新

- 从 main 获取 single_uniapp22miao 子项目
- dart-sass: /deep/ -> ::v-deep,calc 运算符加空格
- DEPLOY.md 采用 shccd159 版本(4 子项目架构说明)

Made-with: Cursor
This commit is contained in:
apple
2026-03-16 11:16:42 +08:00
parent 9c29721dc4
commit 079076a70e
356 changed files with 569762 additions and 129 deletions

View File

@@ -0,0 +1,457 @@
<template>
<view class="purchase-list-page">
<!-- 顶部导航栏 -->
<view class="top-nav">
<view class="nav-left" @click="goBack">
<text class="back-icon"></text>
</view>
<view class="nav-center">
<text class="nav-title">采购</text>
</view>
<view class="nav-right" @click="refreshList">
<text class="refresh-text">刷新</text>
</view>
</view>
<!-- 倒计时区域 -->
<view class="countdown-section">
<text class="countdown-label">采购进行中</text>
<text class="countdown-time">{{ countdownTime }}</text>
</view>
<!-- 分页导航 -->
<view class="pagination">
<view
v-for="page in totalPages"
:key="page"
class="page-item"
:class="{ active: currentPage === page }"
@click="changePage(page)"
>
{{ page }}
</view>
</view>
<!-- 商品列表 -->
<view class="goods-list">
<!-- 空状态显示 -->
<view v-if="!loading && orderList.length === 0" class="empty-state">
<image src="/static/images/empty.png" mode="aspectFit" class="empty-image"></image>
<text class="empty-text">暂无商品</text>
</view>
<!-- 商品列表 -->
<view
v-else
v-for="(item, index) in orderList"
:key="index"
class="goods-item"
@click="viewOrderDetail(item)"
>
<!-- 商品图片 -->
<view class="goods-image">
<image :src="item.image" mode="aspectFill"></image>
</view>
<!-- 商品信息 -->
<view class="goods-info">
<view class="goods-title">{{ item.title }}</view>
<view class="goods-box">
<text class="box-text">{{ item.boxCount }}</text>
</view>
<view class="goods-price">
<text class="price-text">¥{{ item.price }}</text>
</view>
<view class="goods-status">
<text class="status-text">等待采购</text>
</view>
</view>
</view>
</view>
</view>
</template>
<script>
import { getOrderGoods, buyGoods, getDefaultAddress } from '@/api/miao.js';
export default {
data() {
return {
currentPage: 1,
totalPages: 5,
countdownTime: '00:12:05',
countdownInterval: null,
loading: false,
orderList: []
}
},
onLoad() {
this.startCountdown();
this.loadOrderList();
},
onUnload() {
if (this.countdownInterval) {
clearInterval(this.countdownInterval);
}
},
methods: {
// 加载订单列表
async loadOrderList() {
try {
this.loading = true;
// 使用真实接口获取可购买商品列表
const res = await getOrderGoods({
page: this.currentPage,
limit: 20,
type: 1 // 1:可购买
});
if (res.code === 0) {
// 处理接口返回的数据,适配页面展示格式
this.orderList = res.data.list.map(item => ({
id: item.id,
seller_id: item.sellerId,
image: item.image || '/static/images/empty.png',
title: item.title || '',
boxCount: item.box_count || 0,
price: item.price || '0.00'
}));
// 根据返回的总数计算总页数
this.totalPages = Math.ceil(res.data.total / 10);
}
} catch (error) {
console.error('加载订单列表失败:', error);
uni.showToast({
title: '加载失败,请重试',
icon: 'none'
});
} finally {
this.loading = false;
}
},
// 开始倒计时
startCountdown() {
// 从12分05秒开始倒计时
let totalSeconds = 12 * 60 + 5;
this.updateCountdownDisplay(totalSeconds);
this.countdownInterval = setInterval(() => {
totalSeconds--;
if (totalSeconds <= 0) {
clearInterval(this.countdownInterval);
this.countdownTime = '00:00:00';
// 可以在这里处理倒计时结束的逻辑
return;
}
this.updateCountdownDisplay(totalSeconds);
}, 1000);
},
// 更新倒计时显示
updateCountdownDisplay(totalSeconds) {
const hours = Math.floor(totalSeconds / 3600).toString().padStart(2, '0');
const minutes = Math.floor((totalSeconds % 3600) / 60).toString().padStart(2, '0');
const seconds = (totalSeconds % 60).toString().padStart(2, '0');
this.countdownTime = `${hours}:${minutes}:${seconds}`;
},
// 切换页码
changePage(page) {
this.currentPage = page;
this.loadOrderList();
},
// 返回上一页
goBack() {
uni.navigateBack();
},
// 刷新列表
async refreshList() {
await this.loadOrderList();
// 显示刷新提示
if (!this.loading) {
uni.showToast({
title: '刷新成功',
icon: 'success',
duration: 1500
});
}
},
// 点击商品,显示确认采购对话框
viewOrderDetail(item) {
uni.showModal({
title: '确认采购',
content: '是否采购该商品?',
confirmText: '确定',
cancelText: '取消',
success: (res) => {
if (res.confirm) {
// 用户确认采购,提交抢单
this.submitOrder(item);
}
}
});
},
// 提交抢单
async submitOrder(item) {
try {
// 显示加载提示
uni.showLoading({
title: '抢单中...',
mask: true
});
// 调试信息,检查传递的参数
console.log('抢单参数:', {
id: item.id,
seller_id: item.seller_id
});
// 检查seller_id是否存在
if (!item.seller_id || item.seller_id === '') {
uni.hideLoading();
uni.showToast({
title: '卖家信息异常,请刷新页面重试',
icon: 'none'
});
return;
}
// 提交抢单,使用新的参数格式
const res = await buyGoods({
id: item.id,
seller_id: item.seller_id
});
if (res.code === 0) {
// 抢单成功
uni.hideLoading();
// 如果没有地址或需要选择地址,跳转到地址选择页
// 并传递订单ID
uni.navigateTo({
url: `/pages/sub-pages/address/index?orderId=${res.data.order_id}`
});
} else {
// 抢单失败
uni.hideLoading();
uni.showToast({
title: res.msg || '抢单失败,请重试',
icon: 'none'
});
}
} catch (error) {
console.error('提交抢单失败:', error);
uni.hideLoading();
uni.showToast({
title: '网络错误,请检查网络连接',
icon: 'none'
});
}
}
}
}
</script>
<style lang="scss" scoped>
.purchase-list-page {
min-height: 100vh;
background-color: #f5f5f5;
}
/* 顶部导航栏 */
.top-nav {
display: flex;
align-items: center;
justify-content: space-between;
height: 100rpx;
background-color: #ffffff;
padding: 0 30rpx;
position: sticky;
top: 0;
z-index: 100;
box-shadow: 0 2rpx 10rpx rgba(0, 0, 0, 0.05);
.nav-left,
.nav-right {
width: 80rpx;
display: flex;
align-items: center;
.nav-left {
justify-content: flex-start;
}
.nav-right {
justify-content: flex-end;
}
}
.back-icon {
font-size: 60rpx;
color: #333333;
}
.nav-title {
font-size: 36rpx;
font-weight: bold;
color: #333333;
}
.refresh-text {
font-size: 28rpx;
color: #ff6b6b;
}
}
/* 倒计时区域 */
.countdown-section {
display: flex;
align-items: center;
justify-content: center;
padding: 20rpx 0;
background-color: #fff3e0;
.countdown-label {
font-size: 28rpx;
color: #ff6b6b;
margin-right: 10rpx;
}
.countdown-time {
font-size: 28rpx;
font-weight: bold;
color: #ff6b6b;
font-family: monospace;
}
}
/* 分页导航 */
.pagination {
display: flex;
align-items: center;
justify-content: center;
padding: 20rpx 0;
background-color: #ffffff;
margin-bottom: 20rpx;
flex-wrap: wrap;
.page-item {
padding: 10rpx 30rpx;
margin: 0 10rpx 10rpx 0;
font-size: 28rpx;
color: #666666;
border-radius: 20rpx;
&.active {
background-color: #ff6b6b;
color: #ffffff;
font-weight: bold;
}
}
}
/* 商品列表 */
.goods-list {
display: flex;
flex-wrap: wrap;
padding: 0 20rpx;
.goods-item {
width: 48%;
margin: 0 1% 30rpx;
background-color: #ffffff;
border-radius: 16rpx;
overflow: hidden;
box-shadow: 0 2rpx 15rpx rgba(0, 0, 0, 0.05);
}
.goods-image {
width: 100%;
height: 300rpx;
image {
width: 100%;
height: 100%;
}
}
.goods-info {
padding: 20rpx;
}
.goods-title {
font-size: 28rpx;
font-weight: bold;
color: #333333;
margin-bottom: 15rpx;
line-height: 1.4;
}
.goods-box {
margin-bottom: 15rpx;
.box-text {
font-size: 24rpx;
color: #4a90e2;
font-weight: bold;
}
}
.goods-price {
margin-bottom: 15rpx;
.price-text {
font-size: 32rpx;
color: #ff6b6b;
font-weight: bold;
}
}
.goods-status {
.status-text {
font-size: 24rpx;
color: #ffffff;
background-color: #ff6b6b;
padding: 5rpx 15rpx;
border-radius: 15rpx;
}
}
/* 空状态样式 */
.empty-state {
width: 100%;
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
padding: 100rpx 0;
.empty-image {
width: 200rpx;
height: 200rpx;
opacity: 0.5;
margin-bottom: 30rpx;
}
.empty-text {
font-size: 28rpx;
color: #999999;
}
}
}
</style>

View File

@@ -0,0 +1,416 @@
<template>
<view class="rushing-page">
<!-- 页面内容 -->
<scroll-view
scroll-y
class="scroll-view"
:refresher-triggered="refreshing"
@refresherrefresh="onRefresh"
>
<!-- 顶部活动横幅 -->
<view class="activity-banner">
<view class="banner-content">
<!-- <view class="banner-text">
<text class="banner-title">贴心好礼大派送</text>
<text class="banner-subtitle">最高不限次数哦</text>
</view>
<view class="banner-actions">
<button class="claim-btn">立即查收</button>
</view> -->
</view>
</view>
<!-- 主要内容区 -->
<view class="main-content">
<!-- 标题行和跑马灯通知 -->
<view class="title-row">
<view class="title-with-icon">
<image class="notice-icon" src="http://miao1.suzhouyuqi.com/static/images/notice-ico.png" mode="aspectFit"></image>
</view>
<view class="marquee-container">
<view class="marquee-content">
<text class="marquee-text">温馨提示后果自担请您谨慎操作 1.用户在多采购贸易平台</text>
</view>
</view>
</view>
<!-- 通知内容 -->
<view class="notification-container" @click="goToPurchaseList">
<view class="notification-info">
<view class="shop-name">禹岐商贸</view>
<view class="time-info">
<text class="open-time">开放时间10:00~10:05</text>
<view class="status-time">
<view class="status-badge">采购进行中</view>
<view class="countdown">
<text class="countdown-text">{{ countdownTime }}</text>
</view>
</view>
</view>
</view>
<!-- 商品图片 -->
<view class="product-image">
<image :src="productInfo.image" mode="aspectFill"></image>
</view>
</view>
</view>
</scroll-view>
<!-- 底部导航栏 -->
<view class="bottom-nav">
<view class="nav-item" @click="goToHome">
<image class="nav-icon" src="/static/tabBar/home.png" mode="aspectFit"></image>
<text class="nav-text">首页</text>
</view>
<view class="nav-item active">
<image class="nav-icon" src="/static/tabBar/cartd.png" mode="aspectFit"></image>
<text class="nav-text active">采购</text>
</view>
<view class="nav-item" @click="goToUser">
<image class="nav-icon" src="/static/tabBar/user.png" mode="aspectFit"></image>
<text class="nav-text">个人中心</text>
</view>
</view>
</view>
</template>
<script>
export default {
data() {
return {
refreshing: false,
countdownTime: '00:03:00',
countdownInterval: null,
productInfo: {
image: '/static/images/empty.png' // 默认图片,实际项目中替换为真实商品图片
}
}
},
onLoad() {
this.startCountdown();
},
onUnload() {
// 清除倒计时
if (this.countdownInterval) {
clearInterval(this.countdownInterval);
}
},
methods: {
// 下拉刷新
async onRefresh() {
this.refreshing = true;
// 模拟刷新数据
setTimeout(() => {
this.refreshing = false;
}, 1500);
},
// 开始倒计时
startCountdown() {
// 从3分钟开始倒计时
let totalSeconds = 3 * 60;
this.updateCountdownDisplay(totalSeconds);
this.countdownInterval = setInterval(() => {
totalSeconds--;
if (totalSeconds <= 0) {
clearInterval(this.countdownInterval);
this.countdownTime = '00:00:00';
// 可以在这里处理倒计时结束的逻辑
return;
}
this.updateCountdownDisplay(totalSeconds);
}, 1000);
},
// 更新倒计时显示
updateCountdownDisplay(totalSeconds) {
const hours = Math.floor(totalSeconds / 3600).toString().padStart(2, '0');
const minutes = Math.floor((totalSeconds % 3600) / 60).toString().padStart(2, '0');
const seconds = (totalSeconds % 60).toString().padStart(2, '0');
this.countdownTime = `${hours}:${minutes}:${seconds}`;
},
// 跳转到首页
goToHome() {
uni.switchTab({
url: '/pages/index/index'
});
},
// 跳转到个人中心
goToUser() {
uni.switchTab({
url: '/pages/user/index'
});
},
// 跳转到采购列表页
goToPurchaseList() {
console.log('跳转到采购列表页');
uni.showToast({
title: '正在跳转到采购列表',
icon: 'none'
});
// 使用setTimeout确保toast显示后再跳转
setTimeout(() => {
uni.navigateTo({
url: '/pages/rushing/detail',
success: () => {
console.log('跳转成功');
},
fail: (err) => {
console.error('跳转失败:', err);
uni.showToast({
title: '跳转失败,请重试',
icon: 'none'
});
}
});
}, 500);
}
}
}
</script>
<style lang="scss" scoped>
.rushing-page {
height: 100vh;
display: flex;
flex-direction: column;
}
.scroll-view {
flex: 1;
-webkit-overflow-scrolling: touch;
}
/* 顶部活动横幅 */
.activity-banner {
background: url('http://miao1.suzhouyuqi.com/static/images/bg1.png') no-repeat center center;
background-size: cover;
padding: 60rpx 30rpx;
position: relative;
overflow: hidden;
height: 300rpx;
.banner-content {
display: flex;
align-items: center;
justify-content: space-between;
}
.banner-text {
.banner-title {
font-size: 40rpx;
font-weight: bold;
color: #ffffff;
display: block;
margin-bottom: 10rpx;
}
.banner-subtitle {
font-size: 28rpx;
color: rgba(255, 255, 255, 0.9);
display: block;
}
}
.banner-actions {
.claim-btn {
background-color: #ffffff;
color: #ff6b6b;
border: none;
border-radius: 20rpx;
padding: 15rpx 30rpx;
font-size: 26rpx;
font-weight: bold;
}
}
}
/* 主要内容区 */
.main-content {
padding: 30rpx;
}
/* 标题行 */
.title-row {
display: flex;
align-items: center;
margin-bottom: 30rpx;
padding: 0 10rpx;
.title-with-icon {
display: flex;
align-items: center;
margin-right: 15rpx;
.notice-icon {
width: 144rpx;
height: 40rpx;
}
}
.title-primary {
font-size: 32rpx;
font-weight: bold;
color: #333333;
}
}
/* 跑马灯通知 */
.marquee-container {
flex: 1;
height: 70rpx;
// background-color: #fff3e0;
// border-radius: 35rpx;
overflow: hidden;
position: relative;
// box-shadow: 0 2rpx 10rpx rgba(0, 0, 0, 0.05);
}
.marquee-content {
position: absolute;
white-space: nowrap;
animation: marquee 12s linear infinite;
}
.marquee-text {
font-size: 28rpx;
color: #ff6b6b;
line-height: 70rpx;
padding: 0 30rpx;
}
@keyframes marquee {
0% {
transform: translateX(100%);
}
100% {
transform: translateX(-100%);
}
}
/* 通知容器 */
.notification-container {
display: flex;
padding: 40rpx 30rpx;
background-color: #ffffff;
border-radius: 24rpx;
box-shadow: 0 2rpx 15rpx rgba(0, 0, 0, 0.1);
margin-top: 20rpx;
}
/* 通知信息 */
.notification-info {
flex: 1;
margin-right: 30rpx;
.shop-name {
font-size: 32rpx;
font-weight: bold;
color: #333333;
margin-bottom: 20rpx;
padding-left: 20rpx;
border-left: 6rpx solid #ff6b6b;
}
.time-info {
.open-time {
display: block;
font-size: 28rpx;
color: #666666;
margin-bottom: 20rpx;
}
.status-time {
display: flex;
align-items: center;
}
.status-badge {
background-color: #ff6b6b;
color: #ffffff;
padding: 8rpx 20rpx;
border-radius: 15rpx;
font-size: 26rpx;
margin-right: 20rpx;
}
.countdown {
background-color: #333333;
color: #ffffff;
padding: 8rpx 15rpx;
border-radius: 15rpx;
.countdown-text {
font-size: 26rpx;
font-family: monospace;
}
}
}
}
/* 商品图片 */
.product-image {
width: 240rpx;
height: 240rpx;
flex-shrink: 0;
image {
width: 100%;
height: 100%;
border-radius: 16rpx;
}
}
/* 底部导航栏 */
.bottom-nav {
display: flex;
background-color: #ffffff;
border-top: 1px solid #eeeeee;
height: 100rpx;
.nav-item {
flex: 1;
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
.nav-icon {
width: 50rpx;
height: 50rpx;
margin-bottom: 8rpx;
}
.nav-text {
font-size: 24rpx;
color: #999999;
&.active {
color: #ff6b6b;
}
}
&.active {
.nav-icon {
/* 可以在这里添加激活状态的图标样式 */
}
}
}
}
</style>