<template>
	<view class="warehouseEntry">
		<view>
			<view>
				<view>
					<text style="color: red;">*</text> 供应商
				</view>
				<view>
					<input type="text" placeholder="请输入供应商名称" v-model="datas.form.purveyorName" name="" id="">
				</view>
			</view>
			<view>
				<view>
					<text style="color: red;">*</text> 联系电话
				</view>
				<view>
					<input type="text" placeholder="请输入联系电话" v-model="datas.form.purveyorTelephone" name="" id="">
				</view>
			</view>
			<view>
				<view>
					<text style="color: red;">*</text> 地址
				</view>
				<view>
					<input type="text" placeholder="请输入地址" v-model="datas.form.address" name="" id="">
				</view>
			</view>
			<view>
				<view>
					备注
				</view>
				<view>
					<input type="text" placeholder="请输入备注" v-model="datas.form.remark" name="" id="">
				</view>
			</view>
		</view>
	</view>
	<view class="bottombutton">
		<up-button type="primary" style="background-color:  #318AFE;color: #fff;" @tap="sumbit" :plain="true"
			text="保存"></up-button>
	</view>
	<!-- 消息提示 -->
	<up-toast ref="uToastRef"></up-toast>
</template>


<script setup>
	import {
		ref,
		computed,
		reactive,
		onMounted,
		getCurrentInstance
	} from 'vue';
	import color from '@/commons/color.js';
	import go from '@/commons/utils/go.js';
	import {
		tbShopPurveyorpost
	} from '@/http/yskApi/requestAll.js';
	let datas = reactive({
		form: {
			shopId: uni.getStorageSync("shopId"),
		},
	})
	const currentInstance = getCurrentInstance()

	function sumbit() {
		if (!datas.form.purveyorName || !datas.form.purveyorTelephone || !datas.form.address) {
			currentInstance.ctx.$refs.uToastRef.show({
				message: "请填写必填项",
				type: 'default',
			})
			return
		}
		tbShopPurveyorpost(datas.form).then(res => {
			currentInstance.ctx.$refs.uToastRef.show({
				message: "添加成功",
				type: 'default',
			})
			setTimeout(() => {
				// go.to('PAGES_SUPPLIER')pageConsumables/supplier
				// uni.redirectTo({url: '/pageConsumables/supplier'})
				go.back()
				// uni.redirectTo({url: '/pageConsumables/supplier'})
			}, 1000)
		})
	}
</script>

<style scoped lang="less">
	page {
		background-color: #f9f9f9;
	}

	.df() {
		display: flex;
		align-items: center;
	}

	ul,
	li {
		list-style: none;
		padding: 0;
	}

	.status {
		margin: 0 32rpx;
		position: absolute;
		// top: 100%;
		left: 0;
		right: 0;
		z-index: 10;
		background-color: #fff;
	}

	.warehouseEntry {
		height: 540rpx;
		background: #FFFFFF;
		border-radius: 18rpx 18rpx 18rpx 18rpx;
		margin: 28rpx;
		padding: 1rpx 24rpx;
		box-sizing: border-box;

		>view {
			>view {
				height: 84rpx;
				background: #fcfcfc;
				border: 2rpx solid #F9F9F9;
				margin-top: 32rpx;
				.df;

				>view:first-child {
					width: 190rpx;
					height: 84rpx;
					line-height: 84rpx;
					// text-align: left;
					padding-left: 24rpx;
					background: #F9F9F9;
					border-radius: 8rpx 0rpx 0rpx 8rpx;
					border: 2rpx solid #F9F9F9;
					font-family: Source Han Sans CN, Source Han Sans CN;
					font-weight: 400;
					font-size: 32rpx;
					color: #333333;
				}
			}
		}
	}

	.bottombutton {
		margin-top: 84rpx;
		padding: 0 24rpx;

		>button {
			width: 530rpx;
			height: 80rpx;
			border-radius: 56rpx 56rpx 56rpx 56rpx;
		}
	}
</style>