<template name="goods">
	<view class="goods-template">
		 <!-- 商品列表 -->
		<view class="goods-list">
			<view v-for="(item, index) in shopOrderData" :key="index" class="goods-item clearfix">
				<view class="shoptitle">
					<view class="title-logo"><image :src="item.shopLogo" mode=""></image></view>
					<view class="title-text">{{item.shopName}}</view> 
				</view>
				<view class="productlist" v-for="(pros,idx) in item.orderProductList" :key="idx">
					<view class="goods-pros-t">
						<view class="pros-left">
							<view class="pros-img"><image :src="pros.productImage" alt="" /></view>
						</view>
						<view class="pros-product">
							<view class="producttitle">{{pros.name}}</view>
							<view class="productspec product-view" v-if="pros.productCategory != 2">规格：{{pros.productUnit ? pros.productUnit : ''}}</view>
							<view class="floor-item-act" v-if="pros.ladderPriceFlag == 1">
								<text class="tag tag-01" v-if="!pros.heUserId">自营</text>
								<text class="tag tag-01" v-else>促销</text>
								<text class="tag tag-02" @click.stop="clickPopupShow(pros,2)">活动价</text>
							</view>
							<view class="product-view">
								<view class="view-num red">￥{{pros.price | NumFormat}}</view>
							</view>
							<view class="product-view">
								<view class="view-num right">x {{pros.num}}</view>
							</view>
						</view>	
					</view>
				</view>	
				<view class="goods-pros-m" v-if="item.note">
					<view class="m-text">留言:</view>
					<view class="m-input">
						<view class="text">{{item.note ? item.note : ''}}</view>
					</view>	
				</view>
				<view class="goods-pros-b">
					<view class="count">共{{item.itemCount}}件商品</view>
					<view class="sum">
						<view class="sum-money" :class="item.promotionFullReduction == 0 ? 'none' : ''">
							商品总额：<text class="money">￥{{item.totalAmount | NumFormat}}</text>
						</view>
					</view>
				</view>
			</view>
		</view>	
	</view>
</template>

<script>
	export default{
		name:"goods",
		props:{
			shopOrderData:{
				type:Array
			},
			information:{
				type:Object
			}
		},
		data() {
			return{
				initData:[],
			}
		},
		created(){
			this.initData = this.shopOrderData
		},
		filters:{
			NumFormat(value) {//处理金额
				return Number(value).toFixed(2);
			},
			formatIncludedTax(value) {
				if (value === '1') {
				  return '不含税 ';
				} else if (value === '2') {
				  return '含税';
				} else {
				  return '';
				}
			},
		},	
		computed: {
		
		},
		methods:{
			goShophome(id){
				this.$api.navigateTo(`/supplier/pages/user/my-shop?shopId=${id}`)
			},
			details(pros){
				if(pros.validFlag == 9){
					return
				}else{
					console.log(pros)
					this.$api.navigateTo(`/pages/goods/product?id=${pros.organizeProductId}`)
				}
			},
            clickPopupShow(pros, type){
                if(type === 2){
                    this.$emit('popupClick', pros)
                }
                
            },
			PromotionsFormat(promo){//促销活动类型数据处理
				if(promo!=null){
					if(promo.type == 1 && promo.mode == 1){
						return true
					}else{
						return false
					}
				}
				return false
			},
		}
	}
</script>

<style lang="scss">
	.goods-template{
		width: 100%;
		height: auto;
		background: #FFFFFF;
		float: left;
		margin-top: 24rpx;
		.goods-list{
			width: 100%;
			height: auto;
			background: #F7F7F7;
			.goods-item{
				width: 702rpx;
				padding:24rpx;
				height: auto;
				background: #FFFFFF;
				margin-bottom: 24rpx;
				&:last-child{
					margin-bottom: 0;
				}
			}
			.shoptitle{
				width: 100%;
				float: left;
				height: 56rpx;
				line-height: 56rpx;
				margin-bottom: 12rpx;
				.title-logo{
					width: 48rpx;
					height: 48rpx;
					float: left;
					border-radius: 8rpx;
					border: 1px solid #e1e1e1;
					margin-right: 8rpx;
					image{
						border-radius: 8rpx;
						width: 48rpx;
						height: 48rpx;
					}
				}
				.title-text{
					width: 400rpx;
					overflow: hidden;
					text-overflow:ellipsis;
					white-space: nowrap;
					float: left;
					font-size: $font-size-28;
					color: $text-color;
					text-align: left;
					line-height: 56rpx;
					font-weight: bold;
					.iconfont{
						color: #999999;
						font-size: 28rpx;
						margin-left: 10rpx;
					}
					.paymenttext{
						color: #f9a94b;
						font-size: $font-size-22;
						margin-left: 20rpx;
					}
				}
				
			}
			.productlist{
				width: 100%;
				height: auto;
				border-bottom: 2rpx solid #e1e1e1;
				padding: 10rpx;
				box-sizing: border-box;
			}	
			.goods-pros-t{
				display: flex;
				width: 100%;
				height: auto;
				margin: 20rpx 0;
				.pros-left{
					width: 210rpx;
					height: 100%;
					margin:0 26rpx 0 0;
				}
				.pros-img{
					width: 210rpx;
					height: 210rpx;
					border-radius: 10rpx;
					border:1px solid #f3f3f3;
					position: relative;
					image{
						width: 210rpx;
						height: 210rpx;
						border-radius: 10rpx;
					}
				}
			}
			.pros-product{
				width: 468rpx;
				height: 100%;
				line-height: 36rpx;
				font-size: $font-size-26;	
				position: relative;
				.product-view{
					&.allPrice{
						width: 100%;
					}
					.view-num{
						flex: 1;
						text-align: left;
						font-size: $font-size-26;
						color: #999999;
						line-height: 44rpx;
						float: left;
						&.right{
							float: right;
						}
						&.red{
							color: $color-system;
							font-weight: bold;
							&.disabled{
								color: #999999;
								text-decoration: line-through;
							}
						}
					}
				}
				.producttitle{
					width: 100%;
					display: inline-block;
					height: auto;							
					text-overflow:ellipsis;
					display: -webkit-box;
					word-break: break-all;
					-webkit-box-orient: vertical;
					-webkit-line-clamp: 2;
					overflow: hidden;
					margin-bottom: 8rpx;
				}
				.productspec{
					height: 44rpx;
					color: #999999;
					line-height: 44rpx;
				}
				.productprice{
					height: 48rpx;
					position: absolute;
					width: 100%;
					bottom: 0;
					.price{
						line-height: 48rpx;
						font-size: $font-size-28;
						width: 48%;
						color: #ff457b;
						float: left;
					}
					.count{
						height: 100%;
						float: right;
						position: relative;
						.small{
							color: #666666;
						}
					}
				}
				.floor-item-act{
					width: 100%;
					height: 32rpx;
					margin-top: 8rpx;
					float: left;
					.tag{
						display: inline-block;
						height: 32rpx;
						font-size: 22rpx;
						line-height: 30rpx;
						text-align: center;
						color: #f83c6c;
						float: left;
						margin-right: 10rpx;
						&.tag-02{
							width: 80rpx;
							background: url(https://static.caimei365.com/app/mini-hehe/icon/icon-active.png)top center no-repeat;
							background-size: contain;
						}
						&.tag-01{
							width: 56rpx;
							color: #fff;
							background-color: #f83c6c;
							border-radius: 4rpx;
						}
					}
				}
			}
			.goods-pros-m{
				width: 100%;
				height: auto;
				line-height: 76rpx;
				font-size: $font-size-26;
				color: $text-color;
				float: left;
				.m-text{
					width: 62rpx;
					float: left;
					padding-right: 20rpx;
					font-weight:bold;
				}
				.m-input{
					display: -webkit-box;
					display: -webkit-flex;
					display: flex;
					-webkit-box-align: center;
					-webkit-align-items: center;
					align-items: center;
					position: relative;
					width: 620rpx;
					height: auto;
					padding: 20rpx 0 10rpx 0;
					background: #FFFFFF;
					.text{
						width: 100%;
						height: 100%;
						font-size: $font-size-26;
						line-height: 36rpx;
						color: #333333;
					}
				}
			}
			.goods-pros-b{
				width:100%;
				height: 80rpx;
				margin-top: 12rpx;
				float: left;
				.count{
					float: left;
					font-size: $font-size-26;
					line-height: 80rpx;
					color: $text-color;
					display: flex;
					justify-content: flex-end;
					font-weight: bold;
				}
				.sum{
					width: 520rpx;
					float: right;
					.sum-money{
						width: 100%;
						height: 40rpx;
						font-size: $font-size-28;
						line-height: 40rpx;
						color: $text-color;
						display: flex;
						justify-content: flex-end;
						&.none{
							height: 80rpx;
							line-height: 80rpx;
						}
						.money{
							color: $color-system;
							font-size: $font-size-28;
						}
					}		
				}
			}
		}
	}
</style>
