商品数量调试

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" "navigationBarTextStyle": "white"
} }
}, },
{
"path": "pages/order_food/goodsList_scroll",
"style": {
"navigationStyle": "custom",
"navigationBarTextStyle": "white"
}
},
{ {
"path": "pages/make/list", "path": "pages/make/list",
"style": { "style": {

View File

@@ -61,8 +61,7 @@
let tableCode = this.getQueryString(decodeURIComponent(res.result), 'code') let tableCode = this.getQueryString(decodeURIComponent(res.result), 'code')
uni.cache.set('tableCode', tableCode) uni.cache.set('tableCode', tableCode)
if (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>
<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>
@@ -285,7 +285,7 @@
@click="shopAdd(specifications,specifications.indexa,specifications.indexb,'-',specifications.tagSnap == null ? '单规格':'')"> @click="shopAdd(specifications,specifications.indexa,specifications.indexb,'-',specifications.tagSnap == null ? '单规格':'')">
<u-icon name="minus-circle-fill" color="#E9AB7A" size="40"></u-icon> <u-icon name="minus-circle-fill" color="#E9AB7A" size="40"></u-icon>
</view> </view>
<text class="num">{{specifications.cartNumber}}</text> <text class="num">{{amountcartNumber}}</text>
<view class="btn" <view class="btn"
@click="shopAdd(specifications,specifications.indexa,specifications.indexb,'+',specifications.tagSnap == null ? '单规格':'')"> @click="shopAdd(specifications,specifications.indexa,specifications.indexb,'+',specifications.tagSnap == null ? '单规格':'')">
<u-icon name="plus-circle-fill" color="#E9AB7A" size="40"></u-icon> <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_skuselect flex-start" v-if="specifications.tagSnap">
<view class="shop_skuselectname">{{skuidname.toString()}}</view> <view class="shop_skuselectname">{{skuidname.toString()}}</view>
</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>
</view> </view>
</u-popup> </u-popup>
@@ -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 == "+" ){
item.cartNumber++; if ( this.amountcartNumber <= 0) {
this.amountcartNumber = this.amountcartNumber + item.suit;
}else {
this.amountcartNumber++;
}
} else { } 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 ) { addShopping ( item, index, index1, a, b ) {
if ( item.cartNumber <= 0 ) { console.log(item)
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, // "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;
}) })
} }
@@ -691,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(",")
@@ -717,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)
@@ -956,6 +980,7 @@
} }
.panelfive { .panelfive {
width: 100%;
.panelfive_list{ .panelfive_list{
display: flex; display: flex;
} }
@@ -964,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%;
@@ -1006,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; //
@@ -1024,7 +1052,6 @@
} }
.panelfiveitemsex { .panelfiveitemsex {
padding-bottom: 48rpx;
.panelfiveitemsex_oen { .panelfiveitemsex_oen {
text:nth-child(1) { text:nth-child(1) {
@@ -1055,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;
@@ -1361,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;
} }
} }
} }
@@ -1561,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;
@@ -1711,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;