<template>
	<view>
		<view class="addall" v-if="show">
			<view>温馨提示</view>
			<view>
				<image src="/static/index/procurement/ddj.png" mode="aspectFill"></image>
			</view>
			<view>确认将所有未添加状态的库存预警物料添加至购物车中，并且物料的采购数量为物料的库存上限减去库存数量！</view>
			<view>
				<view @click="$emit('back')">取消</view>
				<view class="qd" @click="add()">确定</view>
			</view>
		</view>
		<errorshow :show="openerror" :font="errmsg" @close="openerror=false"  />
	</view>
</template>

<script>
	import { addWaringAll } from '../api/lunpan.js'
	export default {
		props:{
			show:false,
		},
		data(){
			return{
				openerror:false,
				errmsg:''
			}
		},
		methods: {
			add(){
				
				addWaringAll({nuId: uni.getStorageSync('nuId')}).then(res=>{
					if(res.success){
						uni.showToast({
							icon:res.success?'success':'none',
							title:res.message
						})
						setTimeout(()=>{
							this.$emit('config')
						},1800)
					}else{
						this.errmsg = res.message;
						this.openerror = true;
						this.$emit('back')
					}
					
				})
			}
		}
	}
</script>

<style scoped lang="less">
.addall{
	width: 42.4vw;
	height: 26vw;
	background: #FFFFFF;
	box-shadow: 0rpx 0rpx 1.3vw 0rpx rgba(163,167,182,0.16);
	border-radius: 1.6vw;
	position: fixed;
	right: 28.7vw;
	bottom: 18vw;
	padding: 2.8vw;
	z-index: 120;
	>view{
		&:nth-child(4){
			width: 22vw;
			display: flex;
			justify-content: space-around;
			margin: 1.8vw auto 0;
			view{
				width: 8.2vw;
				height: 3.3vw;
				background: #EDEDEF;
				border-radius: 1.6vw;
				font-weight: 400;
				font-size: 1.6vw;
				color: #888888;
				display: flex;
				justify-content: center;
				align-items: center;
				border: 1px solid #EDEDEF;
			}
			.qd{
				background: linear-gradient(0deg, #CAE0F9, #E9F4FF);
				border: 1px solid rgba(3,133,250,0.34);
				color: #0385FA;
			}
		}
		&:nth-child(3){
			width: 33vw;
			height: 3.4vw;
			font-weight: 400;
			font-size: 1.3vw;
			color: #888888;
			line-height: 1.7vw;
			margin: 0.4vw auto 0;
		}
		&:nth-child(2){
			width: 7.6vw;
			height: 7.6vw;
			margin: 1.1vw auto 0;
			image{
				width: 100%;
				height: 100%;
			}
		}
		&:nth-child(1){
			font-weight: 400;
			font-size: 1.6vw;
			color: #333333;
		}
	}
}
</style>
