购物车
This commit is contained in:
@@ -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
|
* @param {Object} item
|
||||||
@@ -833,10 +810,30 @@
|
|||||||
this.socketTicket.send(data);
|
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() {
|
getElementTop() {
|
||||||
|
|
||||||
new Promise((resolve, reject) => {
|
new Promise((resolve, reject) => {
|
||||||
let view = uni.createSelectorQuery().selectAll('.main-item');
|
let view = uni.createSelectorQuery().selectAll('.main-item');
|
||||||
view.boundingClientRect(async data => {
|
view.boundingClientRect(async data => {
|
||||||
@@ -846,6 +843,7 @@
|
|||||||
this.scrollTopSize = res.top; //元素距离顶部的距离
|
this.scrollTopSize = res.top; //元素距离顶部的距离
|
||||||
})
|
})
|
||||||
}).then((res) => {
|
}).then((res) => {
|
||||||
|
console.log(res, 111)
|
||||||
let topArr = res.map((item) => {
|
let topArr = res.map((item) => {
|
||||||
return item.top; /* 减去滚动容器距离顶部的距离 加导航栏高度*/
|
return item.top; /* 减去滚动容器距离顶部的距离 加导航栏高度*/
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user