<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.title}}</view>
					</view>
				</view>
				
				<view class="cell flex flex-y-center">
					<view class="title-block">
						<text>分类描述</text>
					</view>
					<view class="desc">
						<view class="desc-info">{{info.keywords}}</view>
					</view>
				</view>
				
				<view class="cell flex flex-y-center">
					<view class="title-block">
						<text>排序</text>
					</view>
					<view class="desc">
						<view class="desc-info">{{info.sort}}</view>
					</view>
				</view>

			</view>
		</view>		
		
		<view class="info-car">
			<view class="title-block">
				<view class="title">分类图标</view>
			</view>
			<view class="content">
				<image :src="URL+info.thumb" class="logo-img"></image>
			</view>
		</view>
		
		<view style="height:30rpx;"></view>
		<view class="footer-bar" style="height: 100rpx;">
			<view class="content flex flex-center" style="height: 100rpx;">
				<view @click="del" class="detail-btn flex flex-center" 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 @click="enit" class="detail-btn flex flex-center">
					<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 {URL: getApp().globalData.URL,
				info:{},
				id:""
			}
		},
		onLoad(e) {
			this.id=e.id;
			// this.storeinfo();
		},
		onShow() {
			this.storeinfo();
		},
		methods: {
			
			
			storeinfo() {
				this.request({
					url: 'Smdcshop/cygoods_category_info',
					data: {
						id: this.id
					}
				}).then(res => {
					console.log(res)
					if (res.code == 200) {
						this.info = res.data
					}
				})
			},
			
			enit(){
			   let info=this.info;
				uni.navigateTo({
					url:`../editGoodsCat/editGoodsCat?id=${info.id}`
				})
			},
			
			del() {
				uni.showModal({
					title: '提示',
					content: '是否要删除？',
					showCancel: true,
					cancelText: '取消',
					confirmText: '确定',
					success: res => {
						if (res.confirm) {
							this.request({
								url: 'Smdcshop/cygoods_category_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: () => {}
				});
			},
		},	
	}
</script>

<style>
	@import url("../static/css/common.css");
	page {
		background-color: #F4F5F7;
	}

	

	.info-car {
		margin-top: 25rpx;
		background-color: #fff;
		padding: 0 25rpx;
	}

	.info-car .title-block {
		border-bottom: 1rpx solid #f5f5f5;
	}

	.info-car .title {
		height: 100rpx;
		line-height: 100rpx;
		font-size: 30rpx;
		color: #333;
		font-weight: 600;
	}

	.info-car .content {
		padding: 30rpx 0;
	}

	.info-car .input-box {
		font-size: 28rpx;
		color: #333;
	}

	.info-car .logo-img {
		display: block;
		width: 120rpx;
		height: 120rpx;
	}
	
</style>
