This commit is contained in:
魏啾
2024-08-02 17:27:34 +08:00

View File

@@ -32,7 +32,7 @@
本店招牌菜
</view>
<view class="panelfive">
<scroll-view :scroll-x="true" :scroll-into-view="leftIntoView" :scroll-with-animation="false">
<scroll-view :scroll-x="panelfiveShow" :scroll-into-view="leftIntoView" :scroll-with-animation="false">
<view class="panelfive_list">
<view class="panelfiveitem" @click="clickspecifications(item,index,index,'热销')" v-for="(item,index) in shopProductList.hots" :key="index">
<image class="panelfiveitemimage" :src="item.coverImg" mode="aspectFill"></image>
@@ -45,8 +45,8 @@
<view class="panelfiveitemthere flex-start">
<text>招牌</text>
</view>
<view class="panelfiveitemfour" v-if="item.shortTitle">
{{item.shortTitle}}
<view class="panelfiveitemfour">
{{item.shortTitle?item.shortTitle:''}}
</view>
<view class="panelfiveitemfive">
月售{{item.stockNumber}}
@@ -160,7 +160,7 @@
<text class="num">{{cartLists.amount||'0.00'}}</text>
</view>
<view class="btn" @tap="$u.debounce(orderdetail, 500)">
<text class="t">结算</text>
<text class="t">结算</text>
</view>
</view>
</view>
@@ -330,6 +330,7 @@
cartLists: {}, //
cartLists_count: 0,
shopInfo: {}, //
panelfiveShow: false,
shopProductList: {
}, //
@@ -338,6 +339,7 @@
}, //
socketTicket: null,
amountcartNumber: 0,
skuNumber: 0,
salePrice: '', //
cartListsdatashow: false ,//
showCart: false,
@@ -376,6 +378,7 @@
this.scrollHeight = data.windowHeight
}
})
this.panelfiveShow = true;
}, 100);
/* 在非H5平台nextTick回调后有概率获取到错误的元素高度则添加200ms的延迟来减少BUG的产生 */
@@ -512,10 +515,20 @@
*/
shopAdd (item, index, index1, a, b) {
if ( a == "+" ){
this.amountcartNumber++;
if ( this.amountcartNumber <= 0) {
this.amountcartNumber = this.amountcartNumber + item.suit;
}else {
this.amountcartNumber++;
}
} else {
if ( this.amountcartNumber > 0 ) {
this.amountcartNumber--
console.log(item)
if ( this.amountcartNumber <= item.suit) {
this.amountcartNumber = this.amountcartNumber - item.suit
} else {
this.amountcartNumber = this.amountcartNumber - 1;
}
}
}
},
@@ -524,12 +537,19 @@
* 添加购物车
*/
addShopping ( item, index, index1, a, b ) {
console.log(item)
if ( this.amountcartNumber <= 0 ) {
return;
}
let num = 0;
if ( item.typeEnum == "normal") {
num = item.cartNumber + this.amountcartNumber;
} else {
num = this.skuNumber + this.amountcartNumber;
}
let params = {
"skuId": this.skuId,
"num": item.cartNumber + this.amountcartNumber, //
"num": num, //
"type": a == '+' ? 1 : 0,
"productId": item.id, //id
"shopId": uni.cache.get('shopUser'),
@@ -621,10 +641,12 @@
}
})
})
this.cartListsdatashow = this.cartLists.data.length == 0 ? false : true
this.cartListsdatashow = this.cartLists.data.length == 0 ? false : true;
console.log(this.cartLists)
if ( this.cartLists.data.length > 0 ){
this.cartLists_count = 0;
this.cartLists.data.forEach((v,e)=>{
console.log(v)
this.cartLists_count += v.number;
})
}
@@ -636,6 +658,7 @@
* @param {Object} index1
*/
clickspecifications(item1, index, index1,type) {
console.log(item1)
this.skuidname = []
this.specifications = item1
this.specifications.indexa = index
@@ -690,6 +713,7 @@
async hodgepodge(item, a, c, num) { //id
try {
let res = await this.api.productqueryProductSku({
code: uni.cache.get('tableCode'),
shopId: uni.cache.get('shopUser'),
productId: item.id, //id
spec_tag: this.skuidname.join(",")
@@ -716,6 +740,7 @@
this.addCart(params);
} else {
this.skuId = res.data.id;
this.skuNumber = res.data.number;
this.showShopsku = true //
}
this.$set(this, 'amountcartNumber', 0)
@@ -955,6 +980,7 @@
}
.panelfive {
width: 100%;
.panelfive_list{
display: flex;
}
@@ -963,6 +989,7 @@
width: 340rpx;
margin-right: 30rpx;
position: relative;
flex-shrink: 0;
.panelfiveitemimage {
border-radius: 20rpx 20rpx 0rpx 0rpx;
width: 100%;
@@ -1005,6 +1032,8 @@
.panelfiveitemfour {
margin-top: 12rpx;
width: 100%;
height: 36rpx;
line-height: 36rpx;
overflow: hidden; //
text-overflow: ellipsis; //
white-space: nowrap; //
@@ -1023,7 +1052,6 @@
}
.panelfiveitemsex {
padding-bottom: 48rpx;
.panelfiveitemsex_oen {
text:nth-child(1) {
@@ -1054,17 +1082,19 @@
}
}
.panelfiveitemNum{
position: absolute;
bottom: 82rpx;
right: 0;
// position: absolute;
// bottom: 82rpx;
// right: 0;
padding-bottom: 48rpx;
display: flex;
align-items: center;
justify-content: flex-end;
.sku-wrap{
width: 138rpx;
height: 54rpx;
background: #E3AD7F;
border-radius: 32rpx;
position: absolute;
bottom: 10rpx;
right: 20rpx;
position: relative;
align-items: center;
.t{
font-size: 28rpx;
@@ -1360,17 +1390,16 @@
.btn {
width: 160rpx;
height: 64rpx;
background: #FEFAF7;
background: #E7AE7B;
border-radius: 36rpx 36rpx 36rpx 36rpx;
border: 2rpx solid #E8AD7B;
display: flex;
align-items: center;
justify-content: flex-end;
justify-content: center;
.t{
font-weight: bold;
font-size: 28rpx;
color: #E8AD7B;
margin-right: 26rpx;
color: #FFFFFF;
}
}
}
@@ -1560,7 +1589,9 @@
font-weight: 400;
font-size: 24rpx;
color: #333333;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
&+.item {
margin-top: 1px;
@@ -1710,6 +1741,12 @@
color: #999999;
margin-bottom: 8rpx;
}
.describe,.name{
width: 270rpx;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
.lookBack{
color: #FF534B;