feat: 商品卡片增加编辑按钮,仅上架商品可编辑,状态改为已上架/已下架
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
Agent
2026-04-01 15:24:27 +00:00
parent 5dc15bb2a9
commit 6df829cf90

View File

@@ -33,7 +33,7 @@
:key="item.productId" :key="item.productId"
class="product-item" class="product-item"
> >
<view class="product-info" @click="editProduct(item)"> <view class="product-info">
<view class="product-header"> <view class="product-header">
<text class="product-name">{{ item.name }}</text> <text class="product-name">{{ item.name }}</text>
<text class="product-category" v-if="item.categoryName">{{ item.categoryName }}</text> <text class="product-category" v-if="item.categoryName">{{ item.categoryName }}</text>
@@ -45,11 +45,14 @@
</view> </view>
<view class="product-status"> <view class="product-status">
<text :class="['status', item.status === 1 ? 'on' : 'off']"> <text :class="['status', item.status === 1 ? 'on' : 'off']">
{{ item.status === 1 ? '上架' : '下架' }} {{ item.status === 1 ? '上架' : '下架' }}
</text> </text>
</view> </view>
</view> </view>
<view class="product-actions"> <view class="product-actions">
<view class="action-btn edit" @click="editProduct(item)" v-if="item.status === 1">
编辑
</view>
<view class="action-btn" @click="toggleStatus(item)"> <view class="action-btn" @click="toggleStatus(item)">
{{ item.status === 1 ? '下架' : '上架' }} {{ item.status === 1 ? '下架' : '上架' }}
</view> </view>
@@ -525,6 +528,11 @@ export default {
margin-bottom: 10rpx; margin-bottom: 10rpx;
} }
.action-btn.edit {
background: #f0f5ff;
color: #667eea;
}
.action-btn.delete { .action-btn.delete {
background: #fff1f0; background: #fff1f0;
color: #ff4d4f; color: #ff4d4f;