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

View File

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