爱简收旧衣按件回收前端代码仓库
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

341 lines
9.1 KiB

<template>
<view class="inspect-container">
<!-- 顶部导航栏 -->
<view class="nav-bar">
<uni-icons type="left" @tap="goBack" size="24" color="#222" />
<text class="nav-title">步骤一数量确认</text>
<view class="nav-icons">
<uni-icons type="scan" size="24" color="#222" />
</view>
</view>
<view class="main-content">
<!-- 左侧分类导航 -->
<view class="category-nav">
<view v-for="(cat, idx) in categories" :key="cat.name" :class="['category-item', {active: idx === currentCategory}]" @tap="switchCategory(idx)">
<text>{{cat.name}}</text>
<view v-if="cat.badge" class="category-badge">{{cat.badge}}</view>
</view>
</view>
<!-- 右侧商品卡片区 -->
<view class="goods-list">
<view v-for="(item, idx) in currentGoods" :key="item.id" class="goods-card">
<view class="goods-header">
<image :src="item.img" class="goods-img" />
<view class="goods-info">
<view class="goods-title-row">
<text class="goods-name">{{item.name}}</text>
<text class="goods-price">¥ {{item.price}} <text class="goods-unit">/件</text></text>
</view>
<text class="goods-desc">{{item.desc}}</text>
</view>
</view>
<view class="goods-row">
<text class="row-label">合格数量</text>
<view class="num-ctrl">
<button class="num-btn" @tap="changeNum(item, 'qualified', -1)">-</button>
<text class="num">{{item.qualified}}</text>
<button class="num-btn" @tap="changeNum(item, 'qualified', 1)">+</button>
</view>
</view>
<view class="goods-row">
<text class="row-label">不合格数量</text>
<view class="num-ctrl">
<button class="num-btn" @tap="changeNum(item, 'unqualified', -1)">-</button>
<text class="num">{{item.unqualified}}</text>
<button class="num-btn" @tap="changeNum(item, 'unqualified', 1)">+</button>
</view>
</view>
<view class="goods-row">
<text class="row-label">总金额</text>
<input class="amount-input" v-model="item.amount" placeholder="请输入金额" />
</view>
</view>
</view>
</view>
<!-- 底部操作按钮 -->
<view class="footer-btns">
<button class="btn-outline" @tap="goBack">返回订单详情</button>
<button class="btn-main" @tap="goNext">下一步</button>
</view>
</view>
</template>
<script>
import pullRefreshMixin from '../mixins/pullRefreshMixin.js'
export default {
mixins: [pullRefreshMixin],
data() {
return {
categories: [
{ name: '羽绒服', badge: 1 },
{ name: '鞋子' },
{ name: '包包' },
{ name: '床被' },
{ name: '品牌服饰' },
{ name: '不可回收' }
],
currentCategory: 0,
goodsData: [
// 示例数据结构
[
{ id: 1, name: '羽绒服', img: '/static/coat1.png', price: 8, desc: '允许脏破烂,160码以上', qualified: 8, unqualified: 2, amount: '' },
{ id: 2, name: '羽绒裤', img: '/static/coat2.png', price: 8, desc: '允许脏破烂,160码以上', qualified: 0, unqualified: 0, amount: '' },
{ id: 3, name: '儿童羽绒服', img: '/static/coat3.png', price: 8, desc: '允许脏破烂,160码以上', qualified: 0, unqualified: 0, amount: '' }
],
// 其他分类...(可补充)
]
}
},
computed: {
currentGoods() {
return this.goodsData[this.currentCategory] || []
}
},
methods: {
goBack() {
uni.navigateBack()
},
goNext() {
// 跳转到下一步页面,带上质检数据
uni.navigateTo({
url: '/pages/manager/inspect-result'
})
},
switchCategory(idx) {
this.currentCategory = idx
},
changeNum(item, key, delta) {
if (key === 'qualified') {
item.qualified = Math.max(0, (item.qualified || 0) + delta)
} else {
item.unqualified = Math.max(0, (item.unqualified || 0) + delta)
}
},
refreshData() {
// 可根据实际需求刷新商品数据、分类等
// 例如重新请求接口或重置数据
},
async onRefresh() {
await this.refreshData && this.refreshData()
}
},
onPullDownRefresh() {
this.refreshData && this.refreshData()
uni.stopPullDownRefresh()
}
}
</script>
<style lang="scss" scoped>
.inspect-container {
min-height: 100vh;
background: #f8f8f8;
display: flex;
flex-direction: column;
}
.nav-bar {
display: flex;
align-items: center;
justify-content: space-between;
height: 56px;
background: #fff;
padding: 0 16px;
box-shadow: 0 2px 8px rgba(0,0,0,0.03);
.nav-title {
font-size: 18px;
font-weight: bold;
flex: 1;
text-align: center;
color: #222;
}
.nav-icons {
display: flex;
align-items: center;
gap: 12px;
}
}
.main-content {
display: flex;
flex: 1;
min-height: 0;
padding: 0 0 100px 0;
}
.category-nav {
width: 90px;
background: #f6f6f6;
border-radius: 24px 0 0 24px;
padding: 24px 0;
display: flex;
flex-direction: column;
align-items: center;
.category-item {
width: 72px;
height: 48px;
border-radius: 16px 0 0 16px;
display: flex;
align-items: center;
justify-content: center;
font-size: 16px;
color: #222;
margin-bottom: 12px;
background: #fff;
position: relative;
&.active {
background: #fff7e6;
color: #ffb400;
font-weight: bold;
}
.category-badge {
position: absolute;
top: 6px;
right: 10px;
background: #ff4d4f;
color: #fff;
font-size: 12px;
border-radius: 50%;
width: 18px;
height: 18px;
display: flex;
align-items: center;
justify-content: center;
}
}
}
.goods-list {
flex: 1;
padding: 24px 24px 0 24px;
overflow-y: auto;
}
.goods-card {
background: linear-gradient(180deg, #fff7e6 0%, #fff 100%);
border-radius: 24px;
box-shadow: 0 4px 24px rgba(0,0,0,0.06);
margin-bottom: 24px;
padding: 24px 24px 0 24px;
}
.goods-header {
display: flex;
align-items: center;
margin-bottom: 12px;
.goods-img {
width: 72px;
height: 72px;
border-radius: 16px;
margin-right: 18px;
background: #f8f8f8;
object-fit: contain;
}
.goods-info {
flex: 1;
display: flex;
flex-direction: column;
justify-content: center;
min-width: 0;
.goods-title-row {
display: flex;
align-items: baseline;
.goods-name {
font-size: 18px;
font-weight: bold;
color: #222;
margin-right: 8px;
}
.goods-price {
font-size: 16px;
color: #ffb400;
font-weight: bold;
.goods-unit {
font-size: 14px;
color: #bbb;
}
}
}
.goods-desc {
font-size: 14px;
color: #999;
margin-top: 4px;
}
}
}
.goods-row {
display: flex;
align-items: center;
margin-bottom: 18px;
.row-label {
font-size: 15px;
color: #888;
width: 90px;
flex-shrink: 0;
}
.num-ctrl {
display: flex;
align-items: center;
.num-btn {
width: 40px;
height: 40px;
border-radius: 50%;
background: #f6f6f6;
color: #bbb;
font-size: 24px;
border: none;
display: flex;
align-items: center;
justify-content: center;
margin: 0 8px;
}
.num {
font-size: 18px;
color: #222;
width: 32px;
text-align: center;
}
}
.amount-input {
flex: 1;
height: 40px;
border-radius: 12px;
background: #f6f6f6;
border: none;
font-size: 16px;
color: #222;
padding-left: 12px;
margin-left: 8px;
}
}
.footer-btns {
position: fixed;
left: 0;
right: 0;
bottom: 0;
background: #fff;
display: flex;
gap: 24px;
padding: 16px 24px 32px 24px;
z-index: 101;
.btn-outline {
flex: 1;
height: 48px;
border-radius: 24px;
border: 2px solid #ffd01e;
color: #ffb400;
background: #fff;
font-size: 18px;
font-weight: bold;
box-shadow: none;
padding: 0 18px;
}
.btn-main {
flex: 1;
height: 48px;
border-radius: 24px;
background: linear-gradient(90deg, #ffd01e 0%, #ffac04 100%);
color: #fff;
border: none;
font-size: 18px;
font-weight: bold;
box-shadow: none;
padding: 0 18px;
}
}
</style>