lilishop-ui/buyer/src/pages/home/MyShoppingCart.vue

91 lines
1.8 KiB
Vue
Raw Blame History

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

<template>
<div>
<Table border ref="selection" :columns="columns" :data="shoppingCart" size="large" no-data-text="">
<template slot-scope="{row}" slot="price">
<span>{{row.price | unitPrice('¥')}}</span>
</template>
</Table>
<div class="go-to">
<Button @click="goTo" type="primary">去付款</Button>
</div>
</div>
</template>
<script>
import store from '@/vuex/store';
import { mapState, mapActions } from 'vuex';
export default {
name: 'MyShoppingCart',
data () {
return {
columns: [ // 表格表头
{
type: 'selection',
width: 58,
align: 'center'
},
{
title: '图片',
key: 'img',
width: 86,
render: (h, params) => {
return h('div', [
h('img', {
attrs: {
src: params.row.img
}
})
]);
},
align: 'center'
},
{
title: '标题',
key: 'title',
align: 'center'
},
{
title: '套餐',
width: 198,
key: 'package',
align: 'center'
},
{
title: '数量',
key: 'count',
width: 68,
align: 'center'
},
{
title: '价格',
width: 68,
slot: 'price',
align: 'center'
}
]
};
},
created () {
this.loadShoppingCart();
},
computed: {
...mapState(['shoppingCart'])
},
methods: {
...mapActions(['loadShoppingCart']),
goTo () {
this.$router.push('/cart');
}
},
store
};
</script>
<style scoped>
.go-to {
margin: 15px;
display: flex;
justify-content: flex-end;
}
</style>