<template>
<view class="shopping">
<GoodsItem :shappings="shappings" @shapcount="shapcounts" @checkss="checksss" @checks="checkse"></GoodsItem>
<view class="header">
<view class="header-left">购物({
{shappinglength}})</view>
<view class="header-right">编辑</view>
</view>
<view style="width: 100%;height: 70px;float:left;"></view>
<!-- <GoodsItem :shappings="shappings" @shapcount="shapcount" @checkss="checkss" @checks="checks"></GoodsItem> -->
<view class="footer">
<view class="footer-left">
<checkbox class="check" @click="checkboxAll()" :checked="checkboxAlls">全选</checkbox>
</view>
<view class="footer-main" v-if="shappinglength2">
合计:<text>{
{shappricesum|currntprice}}</text>
</view>
<view class="footer-right" v-if="shappinglength2">
<text @click="settlement">结算({
{shappinglength2}})</text>
</view>
</view>
</view>
</template>
<script>
import { mapGetters, mapMutations, mapState ,mapActions} from 'vuex'
import GoodsItem from "@/pages/components/GoodsItem.vue"
export default {
components: {
GoodsItem
},
data() {
return {
}
},
methods: {
...mapMutations({
settlement:"settlement",
checkboxAll:"checkboxAll",
checks:"checks",
shapcount:"shapcount",
checkss:"checkss"
}),
...mapActions({
}),
//单选商品
checksss(index, indexs) {
this.checkss({index,indexs})
},
//数量增加
shapcounts(index, indexs) {
this.shapcount({index,indexs})
},
checkse(index){
this.checks(index)
},
// //单选商品
// checkss(index, indexs) {
// this.shappings[index].goods[indexs].fas = !this.shappings[index].goods[indexs].fas
// },
//数量增加
// shapcount(index, indexs) {
// this.shappings[index].goods[indexs].count++;
// },
//一个店铺的全选
// checks(index) {
// this.shappings[index].fas = !this.shappings[index].fas
// if (this.shappings[index].fas) {
// this.shappings[index].goods.forEach(item => {
// item.fas = true
// })
// } else {
// this.shappings[index].goods.forEach(item => {
// item.fas = false
// })
// }
// },
//单价折扣
shapprice(price) {
return price * 0.8
},
// //全选
// checkboxAll() {
// this.checkboxAlls = !this.checkboxAlls
// if (this.checkboxAlls) {
// this.shappings.forEach(item => {
// item.fas = this.checkboxAlls
// item.goods.forEach(itemss => {
// itemss.fas = this.checkboxAlls
// })
// })
// } else {
// this.shappings.forEach(item => {
// item.fas = this.checkboxAlls;
// item.goods.forEach(itemss => {
// itemss.fas = this.checkboxAlls
// })
vue2-购物车小程序
最新推荐文章于 2023-07-04 23:47:38 发布