<template>
	<view class="container">
		<view class="page-block">
			<view class="page-title-block">
				<view class="title">标签信息</view>
			</view>
			<view class="content">
				<view class="cell flex flex-y-center">
					<view class="title-block">
						<text>标签名称</text>
					</view>
					<view class="desc">
						<view class="input-box">{{info.tag_name}}</view>
					</view>
				</view>
				<view class="cell flex flex-y-center">
					<view class="title-block">
						<text>排序</text>
					</view>
					<view class="desc">
						<view class="input-box">{{info.num}}</view>
					</view>
				</view>
			</view>
		</view>

		<view style="height:30rpx;"></view>
		<view class="footer-bar" style="height: 100rpx;">
			<view class="content flex flex-center" style="height: 100rpx;">
				<view class="detail-btn flex flex-center" @click="del" style="border-right: 2rpx solid #F4F5F7;">
					<image src="../static/images/icon_16.png" mode="aspectFit" class="btn-icon"></image>
					<view style="color:#999999">删除标签</view>
				</view>
				<view class="detail-btn flex flex-center" @click="enit">
					<image src="../static/images/icon_17.png" mode="aspectFit" class="btn-icon"></image>
					<view style="color:#3387FF">重新编辑</view>
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				info: {},
				type:2,
			}
		},
		onLoad(e) {
			console.log(e)
			// this.getData(e.id);
			this.type=e.type;
			this.info = e;
			
		},
		methods: {
			enit() {
				let info = this.info;
				uni.navigateTo({
					url: `../editprinerlabel/editprinerlabel?id=${info.id}&tag_name=${info.tag_name}&num=${info.num}&type=${this.type}`
				})
			},
			del() {
				uni.showModal({
					title: '提示',
					content: '是否要删除？',
					showCancel: true,
					cancelText: '取消',
					confirmText: '确定',
					success: res => {
						if (res.confirm) {
							this.request({
								url: 'Smdcshop/tag_delect',
								data: {
									id: this.info.id,
								},
							}).then(res => {
								console.log(res, "res")
								if (res.code === 200 || res.code === "200") {
									uni.showToast({
										title: "删除成功",
										icon: "none",
									})
									setTimeout(() => {
										uni.navigateBack()
									}, 2000)
								}
							}).catch((res) => {
								uni.showToast({
									title: res.message,
									icon: "none",
								})
							});
						}
					},
					fail: () => {},
					complete: () => {}
				});
			},


			// getData(id) {
			// 	this.request({
			// 		url: 'Smdcshop/table_type_update_info',
			// 		data: {
			// 			id: id
			// 		}
			// 	}).then(res => {
			// 		if (res.code == "200") {
			// 			this.info = res.data
			// 		} else {
			// 			this.is_bottom = true
			// 		}
			// 	})
			// }
		}
	}
</script>

<style>
	@import url("../static/css/common.css");

	page {
		background-color: #F4F5F7;
	}
</style>
