diff --git a/pages/nongKe/cloud_entrepot/index.vue b/pages/nongKe/cloud_entrepot/index.vue index 43e5340..1d3f8ae 100644 --- a/pages/nongKe/cloud_entrepot/index.vue +++ b/pages/nongKe/cloud_entrepot/index.vue @@ -132,10 +132,14 @@ ¥30.00 - - + + + @@ -156,9 +160,11 @@ - + - + @@ -175,7 +181,7 @@ - + 去结算 @@ -253,10 +259,15 @@ import { goShopDetail } from '@/libs/order.js' + import { + postCartAdd, + } from '@/api/store.js'; export default { data() { let src = 'https://lihai001.oss-cn-chengdu.aliyuncs.com/public/kk/luzhou/static4/13'; return { + trnList: [], + act_cart: false, appInfo: {}, pocls: "", type: "", @@ -280,6 +291,7 @@ headtop: 0, page_num: 1, act_img: "", + cartTagInfo: {}, actList: [{ tit: '综合', act: "", @@ -302,7 +314,6 @@ this.cartFn() uni.getSystemInfo({ success: (res) => { - console.log(res) this.winHeight = res.windowHeight this.appInfo = res.safeAreaInsets }, @@ -336,7 +347,6 @@ .in(this) .select('.content') .boundingClientRect(rect => { - // console.log(rect) if (rect.top <= (this.headtop + 16)) { this.pocls = 'fixed' this.act_swiper = 'act_swiper' @@ -356,17 +366,16 @@ .select('.flags') .boundingClientRect(rect => { this.headtop = rect.top - console.log(rect.top) }) .exec(); - // uni.createSelectorQuery() - // .in(this) - // .select('.content_sift') - // .boundingClientRect(rect => { - // // this.headtop += rect.height - // console.log(this.headtop) - // }) - // .exec(); + uni.createSelectorQuery() + .in(this) + .select('.cart') + .boundingClientRect(rect => { + this.cartTagInfo = rect + }) + .exec(); + }, onPullDownRefresh() { uni.stopPullDownRefresh() @@ -384,14 +393,11 @@ this.cartList[0].list.forEach(e => { this.totalMoney = this.totalMoney + Number(e.productAttr.price) * e.cart_num }) - - }) getCartCounts().then(res => { this.goodsNum = res.data[0].count }) }, - godDetail(item) { goShopDetail(item, this.uid).then(res => { if (this.isLogin) { @@ -452,8 +458,46 @@ }) }, - addcart(price) { - this.tot_price += Number(price) + addcart(i) { + let data = { + cart_num: 1, + is_new: 0, + product_attr_unique: i.sku[''].unique, + product_id: i.product_id, + product_type: i.product_type, + spread_id: "", + } + let that = this + let res = postCartAdd({ + ...data + }).then((res, err) => { + this.act_cart = true + this.cartFn() + uni.showToast({ + title: "加入成功", + duration: 1000, + + }) + }).catch(err => { + // this.act_cart = false + uni.showToast({ + title: err, + icon: "none", + duration: 1000, + }) + }) + setTimeout(() => { + that.act_cart = false + }, 500) + // let that = this + // uni.createSelectorQuery().in(this).select(`.act_class${i}`).boundingClientRect(data1 => { + // that.trnList[i].left = this.cartTagInfo.left - data1.left + 'px'; + // that.trnList[i].bottom = this.cartTagInfo.top - data1.top + 'px'; + // console.log(that.trnList[i]) + + + // }).exec(); + // this.tot_price += Number(price) }, all(index) { this.showPop = false @@ -479,6 +523,12 @@ category_id: this.cloudList[this.current].category_id }).then(res => { this.goodsList = res.data.list + this.goodsList.forEach(item => { + this.trnList.push({ + left: 0, + bottom: 0 + }) + }) }) // console.log(this.cloudList) data.length < 1 ? Toast("暂无云仓") : ''; @@ -493,6 +543,11 @@ z-index: 99999999; } + .act_cart { + transition: 0.5s; + transform: scale(1.1); + } + .box { position: relative; @@ -511,6 +566,7 @@ .active_swiper { transform: scale(1.3); + // transform: translateX() translateY(); } @@ -538,14 +594,15 @@ } .act_class { - transition: 1s; + transition: 0.5s; } .act_class:active { transform: scale(2); - // transform: translate(-500rpx, 500rpx); } + + .content_act { width: 100vw; position: absolute; @@ -703,6 +760,10 @@ align-items: center; width: 60vw; + .good_price_r { + z-index: 9; + } + .good_price_l { display: flex; @@ -764,6 +825,7 @@ .card { width: 720rpx; + z-index: 999999; // margin:auto; left: 50%; transform: translateX(-50%); @@ -853,6 +915,7 @@ } } + .body-wrapper { width: 694.74rpx; display: flex; @@ -919,4 +982,8 @@ flex-direction: column; align-items: center; } + + .cart { + z-index: 999; + } \ No newline at end of file