fix: 点击商品直接选中,显示长宽面积与颜色同一行
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
This commit is contained in:
@@ -27,10 +27,13 @@
|
|||||||
<!-- 商品列表 -->
|
<!-- 商品列表 -->
|
||||||
<scroll-view scroll-y class="product-scroll">
|
<scroll-view scroll-y class="product-scroll">
|
||||||
<view class="product-list">
|
<view class="product-list">
|
||||||
<view v-for="item in productList" :key="item.productId" class="product-item" @click="openProductDetail(item)">
|
<view v-for="item in productList" :key="item.productId" class="product-item" @click="selectProduct(item)">
|
||||||
<view class="product-info">
|
<view class="product-info">
|
||||||
<text class="product-name">{{ item.name }}</text>
|
<text class="product-name">{{ item.name }}</text>
|
||||||
<text class="product-spec">{{ item.spec || '-' }}</text>
|
<view class="product-row">
|
||||||
|
<text class="product-spec">{{ item.spec || '-' }}</text>
|
||||||
|
<text class="product-size" v-if="item.length && item.width">{{ item.length }} x {{ item.width }} = {{ item.area }} m²</text>
|
||||||
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<view class="product-price">
|
<view class="product-price">
|
||||||
<text class="price">¥{{ item.price }}</text>
|
<text class="price">¥{{ item.price }}</text>
|
||||||
@@ -116,6 +119,12 @@ export default {
|
|||||||
this.getProducts()
|
this.getProducts()
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
|
selectProduct(item) {
|
||||||
|
const pages = getCurrentPages()
|
||||||
|
const prevPage = pages[pages.length - 2]
|
||||||
|
prevPage.$vm.addProduct(item)
|
||||||
|
uni.navigateBack()
|
||||||
|
},
|
||||||
calcArea() {
|
calcArea() {
|
||||||
const length = parseFloat(this.selectedProduct.length) || 0
|
const length = parseFloat(this.selectedProduct.length) || 0
|
||||||
const width = parseFloat(this.selectedProduct.width) || 0
|
const width = parseFloat(this.selectedProduct.width) || 0
|
||||||
@@ -278,6 +287,21 @@ export default {
|
|||||||
color: #999;
|
color: #999;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.product-row {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
flex-wrap: wrap;
|
||||||
|
gap: 8rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.product-size {
|
||||||
|
font-size: 22rpx;
|
||||||
|
color: #667eea;
|
||||||
|
background: #f0f0ff;
|
||||||
|
padding: 2rpx 8rpx;
|
||||||
|
border-radius: 4rpx;
|
||||||
|
}
|
||||||
|
|
||||||
.product-price {
|
.product-price {
|
||||||
text-align: right;
|
text-align: right;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user