商品数量调试

This commit is contained in:
GaoHao
2024-08-02 16:50:34 +08:00
parent 807d1970e6
commit a6cf6c70f3
3 changed files with 62 additions and 33 deletions

View File

@@ -166,13 +166,7 @@
"navigationBarTextStyle": "white"
}
},
{
"path": "pages/order_food/goodsList_scroll",
"style": {
"navigationStyle": "custom",
"navigationBarTextStyle": "white"
}
},
{
"path": "pages/make/list",
"style": {

View File

@@ -61,8 +61,7 @@
let tableCode = this.getQueryString(decodeURIComponent(res.result), 'code')
uni.cache.set('tableCode', tableCode)
if (tableCode) {
uni.pro.navigateTo('order_food/goodsList_scroll')
// uni.pro.navigateTo('order_food/order_food')
uni.pro.navigateTo('order_food/order_food')
}
}

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>
@@ -285,7 +285,7 @@
@click="shopAdd(specifications,specifications.indexa,specifications.indexb,'-',specifications.tagSnap == null ? '单规格':'')">
<u-icon name="minus-circle-fill" color="#E9AB7A" size="40"></u-icon>
</view>
<text class="num">{{specifications.cartNumber}}</text>
<text class="num">{{amountcartNumber}}</text>
<view class="btn"
@click="shopAdd(specifications,specifications.indexa,specifications.indexb,'+',specifications.tagSnap == null ? '单规格':'')">
<u-icon name="plus-circle-fill" color="#E9AB7A" size="40"></u-icon>
@@ -295,7 +295,7 @@
<view class="shop_skuselect flex-start" v-if="specifications.tagSnap">
<view class="shop_skuselectname">{{skuidname.toString()}}</view>
</view>
<view class="addShopping" :class="specifications.cartNumber>0?'active':''" @click="addShopping(specifications,specifications.indexa,specifications.indexb,'+',specifications.tagSnap == null ? '单规格':'')">添加到购物车</view>
<view class="addShopping" :class="amountcartNumber>0?'active':''" @click="addShopping(specifications,specifications.indexa,specifications.indexb,'+',specifications.tagSnap == null ? '单规格':'')">添加到购物车</view>
</view>
</view>
</u-popup>
@@ -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 == "+" ){
item.cartNumber++;
if ( this.amountcartNumber <= 0) {
this.amountcartNumber = this.amountcartNumber + item.suit;
}else {
this.amountcartNumber++;
}
} else {
if ( item.cartNumber > 0 ) {
item.cartNumber--
if ( this.amountcartNumber > 0 ) {
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 ) {
if ( item.cartNumber <= 0 ) {
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, //
"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;
})
}
@@ -691,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(",")
@@ -717,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)
@@ -956,6 +980,7 @@
}
.panelfive {
width: 100%;
.panelfive_list{
display: flex;
}
@@ -964,6 +989,7 @@
width: 340rpx;
margin-right: 30rpx;
position: relative;
flex-shrink: 0;
.panelfiveitemimage {
border-radius: 20rpx 20rpx 0rpx 0rpx;
width: 100%;
@@ -1006,6 +1032,8 @@
.panelfiveitemfour {
margin-top: 12rpx;
width: 100%;
height: 36rpx;
line-height: 36rpx;
overflow: hidden; //
text-overflow: ellipsis; //
white-space: nowrap; //
@@ -1024,7 +1052,6 @@
}
.panelfiveitemsex {
padding-bottom: 48rpx;
.panelfiveitemsex_oen {
text:nth-child(1) {
@@ -1055,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;
@@ -1361,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;
}
}
}
@@ -1561,7 +1589,9 @@
font-weight: 400;
font-size: 24rpx;
color: #333333;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
&+.item {
margin-top: 1px;
@@ -1711,6 +1741,12 @@
color: #999999;
margin-bottom: 8rpx;
}
.describe,.name{
width: 270rpx;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
.lookBack{
color: #FF534B;