<template>
	<view class="shop">
		<van-cell :title="defaultAddr === '' ? '默认收货地址' : defaultAddr" is-link link-type="navigateTo"
			url="/pages/address/address" />
		<view style="height: 25rpx;"></view>
		<view class="card_Main">
			<van-checkbox-group :value="checked" bind:change="onChange">
				<view class="list" v-for="(item,index) in shopCartInfo" :key="index">
					<van-row v-for="items in item.shopCartItemDiscounts[0].shopCartItems" :key="items.basketId">
						<van-col span="2">
							<van-checkbox @click="basketClick" :name="items.basketId"></van-checkbox>
						</van-col>
						<van-col span="22">
							<text class="shop-name">{{ item.shopName }}</text>
							<van-card :num="items.prodCount" :price="items.price" :desc="items.skuName"
								:title="items.prodName" :thumb="items.pic">
							</van-card>
						</van-col>
					</van-row>
					<van-divider />
				</view>
			</van-checkbox-group>
			  <van-submit-bar :price="totalMoney" button-text="提交订单" @submit="onSubmit">
			            <van-checkbox v-model="checked" @click="allProdSelected">全选</van-checkbox>
			            <a class="clear-cart" v-show="basketIds.length > 0" @click="clearCart">清空</a>
			        </van-submit-bar>
		</view>
	</view>
</template>

<script>
	import {
		shopCartInfo,
		totalPay,
		orderCount
	} from '../../api/shop.js'
	export default {
		data() {
			return {
				defaultAddr: "",
				basketIds: [],
				shopCartInfo: [],
				checked: false
			}
		},
		async onShow() {
			// const aaa = await totalPay(this.basketIds)
			// console.log(aaa, 'aaa')
			this.init();
		},
		methods: {
			init() {
				shopCartInfo({}).then(res => {
					console.log(res, '购物车')
					this.shopCartInfo = res;
				})
			}
		}
	}
</script>

<style>
</style>
