<template>
	<view class="index">
		<view class="title_text">
			修改分类
		</view>
		<view class="onecontent">
			<view class="onecontent_item flex-between">
				<view class="onecontent_itemleft">
					员工分类
				</view>
				<view class="onecontent_itemright flex-start">
					<input class="onecontent_itemright_text" v-model="form.name" maxlength="8" type="text"
						placeholder="请输入员工分类">
				</view>
			</view>
		</view>
		<view class="thereconse" @click="servicecreateitemclass">
			确定
		</view>
		<view class="thereconse thereconsess"  @click="shoppingdeletegoodstype">
			刪除
		</view>
	</view>
</template>
<script>
	export default {
		data() {
			return {
				form: {
					name:'',
					goods_type_id:''
				},
			}
		},
		onLoad(e) {
			this.form.name = e.name
			this.form.goods_type_id = e.goods_type_id
		},
		methods: {
			async shoppingdeletegoodstype(){
				let res = await this.api.staffemployeedel({
					id:this.form.goods_type_id
				});
				if (res.code == 1) {
					uni.showToast({
						title: '删除成功',
						icon: 'none'
					});
					setTimeout(() => {
						uni.navigateBack();
					}, 1000);
				}
			},
			async servicecreateitemclass() {
				let res = await this.api.staffemployeeadd({
					name:this.form.name,
					type:2,
					id: this.form.goods_type_id
				});
				if (res.code == 1) {
					uni.showToast({
						title: '修改成功',
						icon: 'none'
					});
					setTimeout(() => {
						uni.navigateBack();
					}, 1000);
				}
			},

		}
	}
</script>

<style lang="scss">
	page {
		background: #F6F6F6;
	}

	.index {
		.title_text {
			padding: 12rpx 40rpx;
			font-size: 28rpx;
			font-family: SourceHanSansCN-Regular, SourceHanSansCN;
			font-weight: 400;
			color: #666666;
		}

		#editor {
			width: 100%;
			height: 456rpx;
			padding: 12rpx 40rpx;
			background: #FFFFFF;
		}

		.onecontent {
			background: #ffffff;

			.onecontent_item {
				width: 100%;
				padding: 16rpx 46rpx;
				border-bottom: 2rpx solid #E5E5E5;

				.onecontent_itemleft {
					flex: 1;
					font-size: 28rpx;
					font-family: SourceHanSansCN-Regular, SourceHanSansCN;
					font-weight: 400;
					color: #666666;
				}

				.onecontent_itemright {
					flex: 3;

					.onecontent_itemrighttext {
						font-size: 24rpx;
						font-family: SourceHanSansCN-Regular, SourceHanSansCN;
						font-weight: 400;
						color: #999999;
					}

					.onecontent_itemrightimges {
						width: 112rpx;
						height: 112rpx;
						background: #F5F5F5;
						border-radius: 10rpx;
						font-size: 40rpx;
						color: #878787;
					}

					.onecontent_itemright_text {
						width: 100%;
						font-size: 24rpx;
						font-family: SourceHanSansCN-Regular, SourceHanSansCN;
						font-weight: 400;
						color: #999999;
					}
				}
			}
		}

		.thereconse {
			width: 630rpx;
			height: 80rpx;
			background: #999999;
			border-radius: 40rpx;
			font-size: 36rpx;
			text-align: center;
			margin: 50rpx auto;
			font-family: PingFang SC-Bold, PingFang SC;
			font-weight: bold;
			color: #FFFFFF;
			line-height: 80rpx;
			background: #6699FF;
			border-radius: 16rpx;
		}
		.thereconsess{
			background:#fc5f69;
		}
	}
</style>