购物车基本逻辑理顺

This commit is contained in:
aixianling
2023-01-12 12:09:21 +08:00
parent 520a78e861
commit 3e60f0f5c0
2 changed files with 40 additions and 7 deletions

View File

@@ -1,23 +1,58 @@
<template> <template>
<section class="AppCart"> <section class="AppCart">
<uni-list>
<uni-list-item title="示例产品" note="规格:8mmX10mm" thumbSize="lg" thumb="https://web-assets.dcloud.net.cn/unidoc/zh/unicloudlogo.png" :showArrow="false">
<template v-slot:footer>
<uni-number-box class="numberBox" :min="0"/>
</template>
</uni-list-item>
</uni-list>
<ai-gap h="80"/>
<uni-goods-nav class="fixed-b" fill @buttonClick="handleBuy" :buttonGroup="btnGroup" :options="options" @click="handleOptions"/>
</section> </section>
</template> </template>
<script> <script>
import List from "../utils/list";
export default { export default {
name: "AppCart", name: "AppCart",
appName: "购物车", appName: "购物车",
data() { data() {
return {} return {
items: null,
btnGroup: [{text: '立即购买', backgroundColor: 'linear-gradient(90deg, #FE6035, #EF1224)', color: '#fff'}],
options: [
{text: "店铺", icon: "shop", handler: () => uni.reLaunch({url: "./home"})},
{text: "清空", icon: "clear", handler: () => 0},
]
}
}, },
methods: {}, methods: {
created() { getList() {
this.items = new List("/api/cart/list")
this.items.init()
},
handleBuy() {
},
handleOptions({content}) {
content.handler?.()
}
},
onShow() {
uni.hideTabBar()
},
onReachBottom() {
this.items?.loadMore()
} }
} }
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
.AppCart { .AppCart {
.numberBox {
align-self: center;
}
} }
</style> </style>

View File

@@ -41,9 +41,6 @@ export default {
getList() { getList() {
this.products = new List("/api/product/list") this.products = new List("/api/product/list")
this.products.init() this.products.init()
},
handleGoodNav() {
}, },
handleType() { handleType() {
}, },
@@ -59,6 +56,7 @@ export default {
} }
}, },
onShow() { onShow() {
uni.showTabBar()
this.getList() this.getList()
}, },
onReachBottom() { onReachBottom() {