购物车结算

This commit is contained in:
THK3121 2023-09-12 14:40:57 +08:00
parent 8deeb65dc8
commit 5edf9029fd
3 changed files with 101 additions and 20 deletions

View File

@ -318,6 +318,9 @@
this.getCloundShop()
// console.log(this.appInfo, "")
},
onShow() {
this.cartFn()
},
//
// onReachBottom() {
// if (this.flag) return
@ -374,10 +377,10 @@
},
onPullDownRefresh() {
uni.stopPullDownRefresh()
this.getCloundShop()
this.getList()
this.cartFn()
uni.stopPullDownRefresh()
},
// onReachBottom() {
// console.log("daidi")
@ -390,14 +393,13 @@
this.totalMoney = 0
this.cartList = res.data.list
this.cartList.forEach(e => {
this.totalMoney += e.list[0].cart_num * e.list[0].productAttr.price
// console.log(e.list[0].cart_num, e.list[0].productAttr.price)
// 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)
e.list.forEach(item => {
this.totalMoney += item.productAttr.price * item.cart_num
})
})
this.totalMoney = this.totalMoney.toFixed(2);
})
// this.
getCartCounts().then(res => {
this.goodsNum = res.data[0].count
})
@ -542,6 +544,18 @@
</script>
<style lang="scss" scoped>
@keyframes addcart {
from {
// background-color: red;
opacity: 1,
}
to {
// background-color: yellow;
opacity: 0,
}
}
.flags {
background-color: red;
z-index: 99999999;

View File

@ -140,11 +140,16 @@
width="49.07rpx" height="49.07rpx"></u--image>
</view> -->
<div class="good_price_r" ref="jia" @click.stop="addcart(index)">
<div ref="jia1" style="transition: 1s cubic-bezier(0.5,-0.5,1,1);">
<div class="good_price_r" @click.stop="addcart(index)" ref="container">
<!-- 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"
:showLoading="true" src="/static/images/LHYC/J.png"
width="49.07rpx" height="49.07rpx"></u--image>
:style="`transform:translateX(${trnList[index].left})`"
src="/static/images/LHYC/J.png" width="49.07rpx"
height="49.07rpx"></u--image>
</div>
@ -467,11 +472,9 @@
})
},
addcart(i) {
addcarts(i) {
let that = this
console.log((this.$refs.jia[i]))
this.a = this.$refs.jia[i]
return
// return
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';
@ -480,8 +483,8 @@
// console.log(this.$refs.jia1[i])
// return
// this.$refs.jia[i].style.transition = "0.5s"
this.$refs.jia[i].style.transform = `translateX(${this.trnList[i].left})`
this.$refs.jia1[i].style.transform = `translateY(${this.trnList[i].bottom})`
// this.$refs.jia[i].style.transform = `translateX(${this.trnList[i].left})`
// this.$refs.jia1[i].style.transform = `translateY(${this.trnList[i].bottom})`
// this.$refs.jia[i].style.transform = `translateY(${this.trnList[i].bottom})`
// this.trnList[i].left
@ -563,8 +566,61 @@
}
}
</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>
@keyframes addcatr {
0% {
opacity: 1;
}
95% {
opacity: 1;
}
100% {
opacity: 0;
}
}
.flags {
background-color: red;
z-index: 99999999;
@ -623,9 +679,9 @@
padding-top: 200rpx;
}
// .act_class {
// transition: 0.5s;
// }
.act_class {
transition: 0.5s;
}
// .act_class:active {
// 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 {
position: absolute;
top: 0;

View File

@ -736,6 +736,7 @@
let allArr = [];
let totalMoney = 0
let totalNum = 0
console.log(this.cartList)
this.cartList.valid.forEach((el, index) => {
if (type == 'goodsCheck') {
let tempArr = el.list.filter(goods => {