购物车结算
This commit is contained in:
parent
8deeb65dc8
commit
5edf9029fd
@ -318,6 +318,9 @@
|
|||||||
this.getCloundShop()
|
this.getCloundShop()
|
||||||
// console.log(this.appInfo, "手机信息")
|
// console.log(this.appInfo, "手机信息")
|
||||||
},
|
},
|
||||||
|
onShow() {
|
||||||
|
this.cartFn()
|
||||||
|
},
|
||||||
// 分页
|
// 分页
|
||||||
// onReachBottom() {
|
// onReachBottom() {
|
||||||
// if (this.flag) return
|
// if (this.flag) return
|
||||||
@ -374,10 +377,10 @@
|
|||||||
|
|
||||||
},
|
},
|
||||||
onPullDownRefresh() {
|
onPullDownRefresh() {
|
||||||
uni.stopPullDownRefresh()
|
|
||||||
this.getCloundShop()
|
this.getCloundShop()
|
||||||
this.getList()
|
this.getList()
|
||||||
this.cartFn()
|
this.cartFn()
|
||||||
|
uni.stopPullDownRefresh()
|
||||||
},
|
},
|
||||||
// onReachBottom() {
|
// onReachBottom() {
|
||||||
// console.log("daidi")
|
// console.log("daidi")
|
||||||
@ -390,14 +393,13 @@
|
|||||||
this.totalMoney = 0
|
this.totalMoney = 0
|
||||||
this.cartList = res.data.list
|
this.cartList = res.data.list
|
||||||
this.cartList.forEach(e => {
|
this.cartList.forEach(e => {
|
||||||
this.totalMoney += e.list[0].cart_num * e.list[0].productAttr.price
|
e.list.forEach(item => {
|
||||||
// console.log(e.list[0].cart_num, e.list[0].productAttr.price)
|
this.totalMoney += item.productAttr.price * item.cart_num
|
||||||
// return
|
})
|
||||||
// console.log(e.list[0].cart_num, e.productAttr[0].price)
|
|
||||||
// this.totalMoney = this.totalMoney + Number(e.productAttr.price) * e.cart_num
|
|
||||||
// console.log(e.productAttr.price, e.cart_num)
|
|
||||||
})
|
})
|
||||||
|
this.totalMoney = this.totalMoney.toFixed(2);
|
||||||
})
|
})
|
||||||
|
// this.
|
||||||
getCartCounts().then(res => {
|
getCartCounts().then(res => {
|
||||||
this.goodsNum = res.data[0].count
|
this.goodsNum = res.data[0].count
|
||||||
})
|
})
|
||||||
@ -542,6 +544,18 @@
|
|||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style lang="scss" scoped>
|
<style lang="scss" scoped>
|
||||||
|
@keyframes addcart {
|
||||||
|
from {
|
||||||
|
// background-color: red;
|
||||||
|
opacity: 1,
|
||||||
|
}
|
||||||
|
|
||||||
|
to {
|
||||||
|
// background-color: yellow;
|
||||||
|
opacity: 0,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
.flags {
|
.flags {
|
||||||
background-color: red;
|
background-color: red;
|
||||||
z-index: 99999999;
|
z-index: 99999999;
|
||||||
|
@ -140,11 +140,16 @@
|
|||||||
width="49.07rpx" height="49.07rpx"></u--image>
|
width="49.07rpx" height="49.07rpx"></u--image>
|
||||||
|
|
||||||
</view> -->
|
</view> -->
|
||||||
<div class="good_price_r" ref="jia" @click.stop="addcart(index)">
|
<div class="good_price_r" @click.stop="addcart(index)" ref="container">
|
||||||
<div ref="jia1" style="transition: 1s cubic-bezier(0.5,-0.5,1,1);">
|
<!-- transform:translateY(${trnList[index].bottom});transition: 1s cubic-bezier(0.5, -0.5, 1, 1); -->
|
||||||
|
<!-- :style="`transform:translateX(${trnList[index].left})`" -->
|
||||||
|
<!-- :class="{x_tra:trnList[index].bottom}" -->
|
||||||
|
<div :class="{x_tra:trnList[index].bottom }"
|
||||||
|
:style="`transform:translateY(${trnList[index].bottom});transition: 0.75s cubic-bezier(0.5, -0.5, 1, 1);`">
|
||||||
<u--image :class="'act_class'+index" class="act_class"
|
<u--image :class="'act_class'+index" class="act_class"
|
||||||
:showLoading="true" src="/static/images/LHYC/J.png"
|
:style="`transform:translateX(${trnList[index].left})`"
|
||||||
width="49.07rpx" height="49.07rpx"></u--image>
|
src="/static/images/LHYC/J.png" width="49.07rpx"
|
||||||
|
height="49.07rpx"></u--image>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
@ -467,11 +472,9 @@
|
|||||||
})
|
})
|
||||||
|
|
||||||
},
|
},
|
||||||
addcart(i) {
|
addcarts(i) {
|
||||||
let that = this
|
let that = this
|
||||||
console.log((this.$refs.jia[i]))
|
// return
|
||||||
this.a = this.$refs.jia[i]
|
|
||||||
return
|
|
||||||
uni.createSelectorQuery().in(this).select(`.act_class${i}`).boundingClientRect(data1 => {
|
uni.createSelectorQuery().in(this).select(`.act_class${i}`).boundingClientRect(data1 => {
|
||||||
that.trnList[i].left = this.cartTagInfo.left - data1.left + 'px';
|
that.trnList[i].left = this.cartTagInfo.left - data1.left + 'px';
|
||||||
that.trnList[i].bottom = this.cartTagInfo.top - data1.top + 'px';
|
that.trnList[i].bottom = this.cartTagInfo.top - data1.top + 'px';
|
||||||
@ -480,8 +483,8 @@
|
|||||||
// console.log(this.$refs.jia1[i])
|
// console.log(this.$refs.jia1[i])
|
||||||
// return
|
// return
|
||||||
// this.$refs.jia[i].style.transition = "0.5s"
|
// this.$refs.jia[i].style.transition = "0.5s"
|
||||||
this.$refs.jia[i].style.transform = `translateX(${this.trnList[i].left})`
|
// this.$refs.jia[i].style.transform = `translateX(${this.trnList[i].left})`
|
||||||
this.$refs.jia1[i].style.transform = `translateY(${this.trnList[i].bottom})`
|
// this.$refs.jia1[i].style.transform = `translateY(${this.trnList[i].bottom})`
|
||||||
// this.$refs.jia[i].style.transform = `translateY(${this.trnList[i].bottom})`
|
// this.$refs.jia[i].style.transform = `translateY(${this.trnList[i].bottom})`
|
||||||
|
|
||||||
// this.trnList[i].left
|
// this.trnList[i].left
|
||||||
@ -563,8 +566,61 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
<script module='renderjs' lang="renderjs">
|
||||||
|
export default {
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
,
|
||||||
|
render(h) {
|
||||||
|
// 渲染函数
|
||||||
|
return h('div', {
|
||||||
|
on: {
|
||||||
|
click: this.addcart, // 绑定点击事件
|
||||||
|
},
|
||||||
|
}, 'Click me');
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
addcart(i) {
|
||||||
|
console.log(7878)
|
||||||
|
return
|
||||||
|
var divElement = document.createElement('div');
|
||||||
|
|
||||||
|
// 设置div的样式
|
||||||
|
divElement.style.width = '200px';
|
||||||
|
divElement.style.height = '200px';
|
||||||
|
divElement.style.backgroundColor = 'red';
|
||||||
|
|
||||||
|
// 添加文本内容
|
||||||
|
divElement.textContent = 'Hello, Uni-App!';
|
||||||
|
|
||||||
|
// 获取容器元素的引用
|
||||||
|
var container = this.$refs.container;
|
||||||
|
|
||||||
|
// 将div元素添加到容器中
|
||||||
|
container[i].appendChild(divElement);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</script>
|
||||||
<style lang="scss" scoped>
|
<style lang="scss" scoped>
|
||||||
|
@keyframes addcatr {
|
||||||
|
0% {
|
||||||
|
opacity: 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
95% {
|
||||||
|
opacity: 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
100% {
|
||||||
|
opacity: 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
.flags {
|
.flags {
|
||||||
background-color: red;
|
background-color: red;
|
||||||
z-index: 99999999;
|
z-index: 99999999;
|
||||||
@ -623,9 +679,9 @@
|
|||||||
padding-top: 200rpx;
|
padding-top: 200rpx;
|
||||||
}
|
}
|
||||||
|
|
||||||
// .act_class {
|
.act_class {
|
||||||
// transition: 0.5s;
|
transition: 0.5s;
|
||||||
// }
|
}
|
||||||
|
|
||||||
// .act_class:active {
|
// .act_class:active {
|
||||||
// transform: scale(2);
|
// transform: scale(2);
|
||||||
@ -893,6 +949,16 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.x_tra {
|
||||||
|
animation-name: addcatr;
|
||||||
|
animation-duration: .75s;
|
||||||
|
animation-timing-function: ease-in-out;
|
||||||
|
animation-iteration-count: 1;
|
||||||
|
animation-fill-mode: forwards; // animation-iteration-count: 1;
|
||||||
|
/* 设置为1 */
|
||||||
|
// transition: 1s cubic-bezier(0.5, -0.5, 1, 1);
|
||||||
|
}
|
||||||
|
|
||||||
.badge {
|
.badge {
|
||||||
position: absolute;
|
position: absolute;
|
||||||
top: 0;
|
top: 0;
|
||||||
|
@ -736,6 +736,7 @@
|
|||||||
let allArr = [];
|
let allArr = [];
|
||||||
let totalMoney = 0
|
let totalMoney = 0
|
||||||
let totalNum = 0
|
let totalNum = 0
|
||||||
|
console.log(this.cartList)
|
||||||
this.cartList.valid.forEach((el, index) => {
|
this.cartList.valid.forEach((el, index) => {
|
||||||
if (type == 'goodsCheck') {
|
if (type == 'goodsCheck') {
|
||||||
let tempArr = el.list.filter(goods => {
|
let tempArr = el.list.filter(goods => {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user