<template>
	<u-popup :show="show" mode="bottom" @close="close" @open="open" :round="10">
		<view class="my-popup padding">
			<view class="w-full padding-bottom-lg" v-for="(item, index) in carList" :key="index">
				<my-goods :item="item" ref="my-goods">
					<view class="num-step">
						<u-number-box v-model="item.goods_num" :min="1" @change="changeValue($event, item.id)" />
					</view>
				</my-goods>
			</view>
		</view>
	</u-popup>
</template>

<script>
	export default {
		name: "cartPopup",
		props: {
			carList: {
				type: Array,
				required: true
			}
		},
		data() {
			return {
				show: false,
				value: 1,
				// data: {
				// 	src: '../../static/x0.jpg',
				// 	title: '标题标题标题标题标题标题标题标题标题标题标题标题标题标题标题',
				// 	spec: '180cm',
				// 	price: '53.30'
				// }
			};
		},
		methods: {
			open() {},
			setShow(v) {
				this.show = v;
			},
			close() {
				this.show = false;
			},
			changeValue(value, index) {
				this.$emit('numChanged',value.value, index)
				console.log('更新后的数量=======:', value, '索引=========:', index)
			}
		}
	}
</script>

<style scoped lang="scss">
	.my-popup {
		width: 100%;
		max-height: 800rpx;
		overflow: auto;
		padding-bottom: 130rpx;

		.num-step {
			width: 200rpx;
			padding-top: 40rpx;
		}
	}
</style>