<!--pages/basket/basket.wxml-->
	<view class='container basket'>
		<view class="prod-list">
			<view wx:for="{{shopCartOrders}}" wx:for-item="shopCart" wx:for-index="topIndex" wx:key="index" class="shop-item">
				<!-- 头部店铺 -->
				<view class="head-shop">
					<view class="btn choose-btn">
						<label>
							<checkbox bindtap='onSelectedShopItem' data-item="{{shopCart}}" data-topindex="{{topIndex}}" checked="{{shopCart.checked}}" color="#105c3e" />
						</label>
					</view>
					<view class="shop-box">
						<!-- <view class="shop-icon">
							<image src="../../images/icon/shop.png"></image>
						</view> -->
						<view class="shop-name">{{shopCart.shopName}}</view>
					</view>
				</view>
				<!-- /头部店铺 -->

				<block wx:for="{{shopCart.shopCartItemDiscounts}}" wx:key='index' wx:for-index="scIndex">
					<view class='prod-block {{item.chooseDiscountItemDto?"discount":""}}'>
						<!-- 满减提示 -->
						<view class='discount-tips' hidden='{{!item.chooseDiscountItemDto}}'>
							<text class='text-block'>{{wxs.parseDiscount(item.chooseDiscountItemDto.discountRule)}}</text>
							<text class='text-list'>{{wxs.parseDiscountMsg(item.chooseDiscountItemDto.discountRule,item.chooseDiscountItemDto.needAmount,item.chooseDiscountItemDto.discount)}}</text>
							<text class='text-list reduce-amount' wx:if="{{item.chooseDiscountItemDto.reduceAmount > 0}}">已优惠 ￥{{wxs.parsePrice(item.chooseDiscountItemDto.reduceAmount)[0]}}.{{wxs.parsePrice(item.chooseDiscountItemDto.reduceAmount)[1]}}</text>
						</view>
						<!-- 商品item -->
						<block wx:for="{{item.shopCartItems}}" wx:key='index' wx:for-item="prod">
							<view class="goods-item">
              <view class="disable" wx:if="{{prod.isDelete == 1}}"></view>
								<!-- 商品信息 -->
								<view class='item'>
									<view class="btn">
										<label>
											<checkbox bindtap='onSelectedItem' data-topindex="{{topIndex}}" data-scindex="{{scIndex}}" data-index="{{index}}" value="{{prod.prodId}}" checked="{{prod.checked}}" color="#105c3e" />
										</label>
									</view>
									<view class='prodinfo'>
                    <view class="pic-box">
                      <image class="pic" src="{{prod.pic}}" mode="" bindtap="toProdPage" data-prodid="{{prod.prodId}}" />
                      <view class="sell-out" wx:if="{{prod.stock == 0}}">
                        <view class="sell-out-text">已售罄</view>
                      </view>
                    </view>
										<!-- <view class="pic" bindtap="toProdPage" data-prodid="{{prod.prodId}}">
											<image src='{{prod.pic}}' />
										</view> -->
										<view class="opt">
											<view class='prod-name'>{{prod.prodName}}</view>
											<view class="prod-center-row">
												<view class="prod-discount" bindtap="onChooseDiscount" data-discounts="{{prod.discounts}}" data-basketid="{{prod.basketId}}" data-discountid="{{prod.discountId}}" wx:if="{{prod.discounts.length>0}}">
													<view class="discount-name">{{wxs.getCurrDiscountName(prod.discountId,prod.discounts)}}</view>
													<view class="down-arrow"></view>
												</view>
												<view class='prod-info-text {{prod.skuName?"":"empty-n"}}' wx:if="{{prod.skuName}}">{{prod.skuName}}</view>
											</view>
											<view class='price-count' wx:if="{{prod.isDelete == 0}}">
												<view class='price'>
													<text class=''>￥</text>
													<text class=''>{{wxs.parsePrice(prod.price)[0]}}</text>
													<text class=''>.{{wxs.parsePrice(prod.price)[1]}}</text>
												</view>
												<view class="m-numSelector"  class="num-box">
                        <image bindtap='onCountMinus' class="btn" data-topindex="{{topIndex}}" data-scindex="{{scIndex}}" data-index="{{index}}" src="/images/icon/reduce.png" mode=""/>
													<input class="num" type='number' value='{{prod.prodCount}}' disabled></input>
                          <image bindtap='onCountPlus' class="btn" data-topindex="{{topIndex}}" data-scindex="{{scIndex}}" data-index="{{index}}" src="/images/icon/add.png" mode=""/>
												</view>
											</view>
                      <view class="del-box" wx:else>
                          <view class="del-label">商品已被删除</view>
                          <view class="del-btn" bindtap='onDelProd' data-basketid="{{prod.basketId}}">删除</view>
                      </view>
										</view>
									</view>
								</view>
							</view>
						</block>
					</view>
				</block>
			</view>
		</view>

		<!-- 底部按钮 -->
		<view class="cart-footer" wx:if="{{shopCartOrders.length>0}}">
      <image src="/images/icon/basket-icon.png" mode="" class="icon"/>
			<view class="all">
				<label bindtap='onSelAll'>
					<checkbox checked='{{allChecked}}' color='#f7d731;' />全选</label>
			</view>
			<view class="del" bindtap='onDelBasket'>
				<text>删除</text>
			</view>
			<view class="total" bindtap="showPriDet">
				<view class="total-con">
					<view class="finally">
						<text class="blod">总计:</text>
						<view class='price'>
							<text class='symbol'>￥</text>
							<text class='big-num'>{{wxs.parsePrice(finalMoney)[0]}}</text>
							<text class='small-num'>.{{wxs.parsePrice(finalMoney)[1]}}</text>
						</view>
					</view>
					<view class="total-msg" wx:if="{{subtractMoney>0}}">
						<!-- 总额:￥{{wxs.toPrice(totalMoney)}}  -->
						已优惠:￥{{wxs.toPrice(subtractMoney)}}
					</view>
				</view>
				<view class="arrow-icon">
					<image src="../../images/icon/down-arrow.png" wx:if="{{hidePriModal}}"></image>
					<image src="../../images/icon/up-arrow.png" wx:if="{{!hidePriModal}}"></image>
				</view>
			</view>
			<view class="settle" bindtap='toFirmOrder'>
				<text>结算</text>
			</view>
		</view>
		<!-- end 底部按钮 -->

		<!-- 底部活动选择弹框 -->
		<view class="modals modals-bottom-dialog" hidden="{{hideModal}}">
			<view class="modals-cancel" bindtap="hideModal"></view>
			<view class="bottom-dialog-body bottom-pos radius" animation="{{animationData}}">
				<view class="discount-title radius">选择促销活动</view>
				<view class="radio-group">
					<radio-group bindchange="radioChange" class="discount-radio">
						<view wx:for="{{prodDiscounts}}" wx:key="index">
							<label>
								<radio color="#eb2444" value="{{item.discountId}}" checked="{{item.discountId==discountid}}"></radio>{{item.discountName}}
							</label>
						</view>
						<view>
							<label>
								<radio color="#eb2444" value="-1" checked="{{-1==discountid}}"></radio>不参加促销
							</label>
						</view>
					</radio-group>
				</view>
			</view>
		</view>

		<!-- 底部金额明细弹框 -->
		<view class="pri-modal modals-bottom-dialog" hidden="{{hidePriModal}}">
			<view class="modals-cancel" bindtap="hidePriModal"></view>
			<view class="bottom-dialog-box bottom-pos radius" animation="{{animationData}}">
				<view class="discount-title radius">金额明细</view>
				<view class="price-detail">
					<view class="price-detail-item">
						<view class="det-tit">商品总额</view>
						<view class="det-num">￥{{wxs.toPrice(totalMoney)}}</view>
					</view>
					<view class="price-detail-item" wx-if="{{subtractMoney > 0}}">
						<view class="det-tit">促销立减</view>
						<view class="det-num">-￥{{wxs.toPrice(subtractMoney)}}</view>
					</view>
				</view>
			</view>
		</view>
		<!-- 底部end -->

		<!-- 空 -->
		<view class="empty" wx:if="{{!shopCartOrders.length}}">
			<view class="empty-icon">
				<image src="../../images/icon/empty-basket.png"></image>
			</view>
			<view class="empty-text">您还没有添加商品到购物车哦~</view>
      <view class="btn" bind:tap="goShopping">去逛逛</view>
		</view>

    <tabbar class="my-tabbar" active="2" style="box-shadow: none;"></tabbar>

	</view>

<wxs module="wxs" src="../../wxs/number.wxs" />