购物车

This commit is contained in:
魏啾
2024-08-03 16:58:19 +08:00
parent 93c3e70e98
commit aeae9c2e39

View File

@@ -469,29 +469,6 @@
}
},
/**
* 获取商品数据
*/
async productqueryProduct() {
let res = await this.api.productqueryProduct({
"shopId": uni.cache.get('shopUser'),
"productGroupId": ''
})
if (res.code == 0) {
this.shopProductList = res.data;
if (this.cartLists && this.cartLists.data && this.cartLists.data.length >= 0) {
this.setNumber()
}
this.scrollTopSize = 0
this.scrollHeight = 1000
this.topArr = []
setTimeout(() => {
this.getElementTop();
}, 100);
}
},
/**
* 商品数量增加/减少
* @param {Object} item
@@ -833,10 +810,30 @@
this.socketTicket.send(data);
}
},
/**
* 获取商品数据
*/
async productqueryProduct() {
let res = await this.api.productqueryProduct({
"shopId": uni.cache.get('shopUser'),
"productGroupId": ''
})
if (res.code == 0) {
this.shopProductList = res.data;
if (this.cartLists && this.cartLists.data && this.cartLists.data.length >= 0) {
this.setNumber()
}
this.scrollTopSize = 0
this.scrollHeight = 1000
this.topArr = []
setTimeout(() => {
this.getElementTop();
}, 500);
}
},
/* 获取元素顶部信息 */
getElementTop() {
new Promise((resolve, reject) => {
let view = uni.createSelectorQuery().selectAll('.main-item');
view.boundingClientRect(async data => {
@@ -846,6 +843,7 @@
this.scrollTopSize = res.top; //元素距离顶部的距离
})
}).then((res) => {
console.log(res, 111)
let topArr = res.map((item) => {
return item.top; /* 减去滚动容器距离顶部的距离 加导航栏高度*/
});