<template>
	<view class="page" :style="themeColor">
		<view class="flex benben-position-layout flex flex-wrap align-center commodityManagement_flex_0"
			:style="{height:(88+StatusBarRpx)+'rpx',paddingTop:StatusBarRpx+'rpx'}">
			<view class='flex flex-wrap align-center justify-between flex-sub commodityManagement_fd0_0'>
				<view class='flex flex-wrap align-center' @tap.stop="handleJumpDiy" data-type="back" data-url="1">
					<text class='fu-iconfont2  commodityManagement_fd0_0_c0_c0' @tap.stop="handleJumpDiy"
						data-type="back" data-url="1">&#xE794;</text>
				</view>
				<view class='flex flex-wrap align-stretch justify-center flex-sub'>
					<text class='commodityManagement_fd0_0_c1_c0'>分类管理</text>
				</view>
				<view class='flex flex-wrap align-center commodityManagement_fd0_0_c2'>
				</view>
			</view>

		</view>
		<view :style="{height: (88+StatusBarRpx)+'rpx'}"></view>
		<!---flex布局flex布局开始-->
		<view class="flex flex-direction flex-wrap align-stretch benben-flex-layout commodityManagement_flex_1">
			<view v-for="(item,inedx) in goodsClass" :key="index" class='flex flex-wrap align-center justify-between flex-sub commodityManagement_fd1_0'>
				<view class='flex flex-wrap align-center'>
					<text class='commodityManagement_fd1_0_c0_c0'>{{item.name}}</text>
				</view>
				<view class='flex flex-wrap align-center' @tap.stop="editTap(item)">
					<image class='commodityManagement_fd1_0_c1_c0' mode="aspectFit" :src='STATIC_URL+"61.png"'></image>
					<text class='commodityManagement_fd1_0_c1_c1'>编辑</text>
				</view>
			</view>
			
			<fu-empty-ui v-if="goodsClass.length==0"></fu-empty-ui>
			
		</view>

		<!---flex布局flex布局结束-->
		<view class="flex flex-direction flex-wrap align-center benben-position-layout flex commodityManagement_flex_2">
			<button class='commodityManagement_fd2_0' @tap.stop="popupShow1684226988403=true">添加分类</button>

		</view>
		<view :style="{height: '148rpx'}"></view>
		<benben-popup v-model="popupShow1684226988403" :mask="true" mode='center'>
			<!---添加分类flex布局开始-->
			<view class="flex benben-flex-layout flex-wrap align-center">
				<view class='flex flex-direction flex-wrap align-stretch commodityManagement_fd3_0'>
					<view class='flex flex-wrap align-center justify-center flex-sub'>
						<text class='commodityManagement_fd3_0_c0_c0'>添加分类</text>
					</view>
					<view class='flex flex-wrap align-center commodityManagement_fd3_0_c1'>
						<image class='commodityManagement_fd3_0_c1_c0' mode="aspectFit" :src='STATIC_URL+"62.png"'>
						</image>
						<text>分类名称</text>
					</view>
					<view class='flex flex-wrap align-center justify-center commodityManagement_fd3_0_c2'>
						<input class='commodityManagement_fd3_0_c2_c0' type="text" placeholder="请输入商品分类名称"
							confirm-type="done" :maxlength="-1" placeholder-style="color:#999;font-size:28rpx"
							v-model="fd3_0_c2_c0" />
					</view>
					<view class='flex flex-wrap align-center commodityManagement_fd3_0_c3'>
						<text class='commodityManagement_fd3_0_c3_c0' @tap.stop="popupShow1684226988403=false">取消</text>
						<text class='commodityManagement_fd3_0_c3_c1' @tap="addTap">确定</text>
					</view>
				</view>
			</view>

			<!---添加分类flex布局结束-->

		</benben-popup>
		<benben-popup v-model="popupShow1684227700130" :mask="true" mode='center'>
			<!---编辑分类名称flex布局开始-->
			<view class="flex benben-flex-layout flex-wrap align-center">
				<view class='flex flex-direction flex-wrap align-stretch commodityManagement_fd4_0'>
					<view class='flex flex-wrap align-center justify-end flex-sub'>
						<text class='commodityManagement_fd4_0_c0_c0'>编辑商品分类</text>
						<image class='commodityManagement_fd4_0_c0_c1' :src='STATIC_URL+"2.png"'
							@tap.stop="popupShow1684227700130=false"></image>
					</view>
					<view class='flex flex-wrap align-center commodityManagement_fd4_0_c1'>
						<image class='commodityManagement_fd4_0_c1_c0' mode="aspectFit" :src='STATIC_URL+"62.png"'>
						</image>
						<text>分类名称</text>
					</view>
					<view class='flex flex-wrap align-center justify-center commodityManagement_fd4_0_c2'>
						<input class='commodityManagement_fd4_0_c2_c0' type="text" placeholder="请输入商品分类名称"
							confirm-type="done" :maxlength="-1" placeholder-style="color:#999;font-size:28rpx"
							v-model="fd4_0_c2_c0" />
					</view>
					<view class='flex flex-wrap align-center commodityManagement_fd4_0_c3'>
						<text class='commodityManagement_fd4_0_c3_c0' @tap.stop="delTap">删除</text>
						<text class='commodityManagement_fd4_0_c3_c1' @tap="sureTap">确定</text>
					</view>
				</view>
			</view>

			<!---编辑分类名称flex布局结束-->

		</benben-popup>


	</view>
</template>
<script>
	export default {
		components: {},


		data() {
			return {
				"fd4_0_c2_c0": "",
				"popupShow1684227700130": false,
				"fd3_0_c2_c0": "",
				"popupShow1684226988403": false,
				goodsClass:[],
				classId:""
			};
		},
		computed: {
			themeColor() {
				return this.$store.getters.themeColor
			},

		},
		watch: {},
		onLoad(options) {
			this.post6487d63dc3e21()
		},
		
		onShow() {
			
		},
		methods: {
			//商品分类列表
			post6487d63dc3e21(){
				this.$api.post(global.apiUrls.post6487d63dc3e21).then(res=>{
					if(res.data.code==1){{
						this.goodsClass = res.data.data
					}}
				})
			},
			//添加商家分类
			addTap(){
				if(!this.fd3_0_c2_c0) return this.$message.info('请输入商品分类名称')
				this.$api.post(global.apiUrls.post6486bc83caec2,{
					name:this.fd3_0_c2_c0
				}).then(res=>{
					if(res.data.code==1){
						this.popupShow1684226988403 = false
						this.fd3_0_c2_c0 = ""
						this.post6487d63dc3e21()
					}
				})
			},
			editTap(item){
				this.classId = item.aid;
				this.fd4_0_c2_c0 = item.name
				this.popupShow1684227700130 = true
			},
			sureTap(){
				if(!this.fd4_0_c2_c0) return this.$message.info('请输入商品分类名称')
				this.$api.post(global.apiUrls.post6486c879ba7f3,{
					name:this.fd4_0_c2_c0,
					aid:this.classId
				}).then(res=>{
					if(res.data.code==1){
						this.popupShow1684227700130 = false
						this.fd4_0_c2_c0 = ""
						this.post6487d63dc3e21()
					}
				})
			},
			delTap(){
				this.$api.post(global.apiUrls.post6486c9004af38,{
					aid:this.classId
				}).then(res=>{
					if(res.data.code==1){
						this.popupShow1684227700130 = false
						this.fd4_0_c2_c0 = ""
						this.post6487d63dc3e21()
					}else{
						this.$message.info(res.data.msg)
					}
				})
			}
		}
	};
</script>
<style lang="scss" scoped>
	.page {
		width: 100vw;
		overflow-x: hidden;
		min-height: calc(100vh - var(--window-bottom));
		background: rgba(248, 248, 248, 1);
		background-size: 100% auto !important;
	}

	.commodityManagement_flex_0 {
		background: #fff;
		width: 750rpx;
		height: 88rpx;
		overflow: hidden;
		z-index: 10;
		top: 0rpx;
		background-size: 100% auto !important;
	}

	.commodityManagement_fd0_0_c2 {
		width: 32rpx;
		height: 32rpx;
	}

	.commodityManagement_fd0_0_c1_c0 {
		font-size: 36rpx;
		font-weight: 500;
		color: #333;
		line-height: 88rpx;
	}

	.commodityManagement_fd0_0_c0_c0 {
		font-size: 32rpx;
		font-weight: 500;
		color: #333;
		line-height: 88rpx;
	}

	.commodityManagement_fd0_0 {
		margin: 0rpx 32rpx 0rpx 32rpx;
	}

	.commodityManagement_flex_1 {
		padding: 0rpx 024rpx 0rpx 024rpx;
	}

	.commodityManagement_fd1_0_c1_c1 {
		color: #59A6F4;
		font-size: 28rpx;
		font-weight: 400;
		line-height: 30rpx;
	}

	.commodityManagement_fd1_0_c1_c0 {
		width: 32rpx;
		height: 32rpx;
		border-radius: 0rpx 0rpx 0rpx 0rpx;
		margin: 0rpx 8rpx 0rpx 0rpx;
	}

	.commodityManagement_fd1_0_c0_c0 {
		color: #0E0E0C;
		font-size: 28rpx;
		font-weight: 400;
		line-height: 30rpx;
	}

	.commodityManagement_fd1_0 {
		background: rgba(255, 255, 255, 1);
		margin: 24rpx 0rpx 0rpx 0rpx;
		border-radius: 16rpx 16rpx 16rpx 16rpx;
		background-size: 100% auto !important;
		padding: 32rpx 24rpx 32rpx 24rpx;
	}

	.commodityManagement_flex_2 {
		background: rgba(248, 248, 248, 1);
		width: 750rpx;
		height: 148rpx;
		overflow: hidden;
		z-index: 10;
		bottom: calc(0rpx + var(--window-bottom));
		background-size: 100% auto !important;
	}

	.commodityManagement_fd2_0 {
		background: rgba(255, 147, 0, 1);
		border-radius: 44rpx 44rpx 44rpx 44rpx;
		font-size: 32rpx;
		color: #fff;
		width: 686rpx;
		height: 88rpx;
		line-height: 88rpx;
		font-weight: 400;
	}

	.commodityManagement_fd3_0_c3_c1 {
		color: #FF9300;
		font-size: 32rpx;
		font-weight: 500;
		line-height: 32rpx;
		padding: 24rpx 99rpx 24rpx 99rpx;
	}

	.commodityManagement_fd3_0_c3_c0 {
		border-right: 1px solid #eee;
		color: #999999;
		font-size: 32rpx;
		font-weight: 500;
		line-height: 32rpx;
		padding: 24rpx 99rpx 24rpx 99rpx;
	}

	.commodityManagement_fd3_0_c3 {
		border-top: 1px solid #eee;
	}

	.commodityManagement_fd3_0_c2_c0 {
		background: rgba(248, 248, 248, 1);
		width: 482rpx;
		height: 88rpx;
		border-radius: 16rpx 16rpx 16rpx 16rpx;
		background-size: 100% auto !important;
		padding-left: 16rpx;
	}

	.commodityManagement_fd3_0_c2 {
		margin: 0rpx 0rpx 35rpx 0rpx;
	}

	.commodityManagement_fd3_0_c1_c0 {
		width: 12rpx;
		height: 12rpx;
		border-radius: 0rpx 0rpx 0rpx 0rpx;
		margin: 0rpx 12rpx 0rpx 0rpx;
	}

	.commodityManagement_fd3_0_c1 {
		margin: 32rpx 24rpx 24rpx 24rpx;
	}

	.commodityManagement_fd3_0_c0_c0 {
		color: #000000;
		font-size: 32rpx;
		font-weight: 500;
		line-height: 48rpx;
	}

	.commodityManagement_fd3_0 {
		background: #fff;
		width: 530rpx;
		border-radius: 16rpx 16rpx 16rpx 16rpx;
		background-size: 100% auto !important;
		padding: 32rpx 0rpx 0rpx 0rpx;
	}

	.commodityManagement_fd4_0_c3_c1 {
		color: #FF9300;
		font-size: 32rpx;
		font-weight: 500;
		line-height: 32rpx;
		padding: 24rpx 99rpx 24rpx 99rpx;
	}

	.commodityManagement_fd4_0_c3_c0 {
		border-right: 1px solid #eee;
		color: #999999;
		font-size: 32rpx;
		font-weight: 500;
		line-height: 32rpx;
		padding: 24rpx 99rpx 24rpx 99rpx;
	}

	.commodityManagement_fd4_0_c3 {
		border-top: 1px solid #eee;
	}

	.commodityManagement_fd4_0_c2_c0 {
		background: rgba(248, 248, 248, 1);
		width: 482rpx;
		height: 88rpx;
		border-radius: 16rpx 16rpx 16rpx 16rpx;
		background-size: 100% auto !important;
		padding-left: 16rpx;
	}

	.commodityManagement_fd4_0_c2 {
		margin: 0rpx 0rpx 35rpx 0rpx;
	}

	.commodityManagement_fd4_0_c1_c0 {
		width: 12rpx;
		height: 12rpx;
		border-radius: 0rpx 0rpx 0rpx 0rpx;
		margin: 0rpx 12rpx 0rpx 0rpx;
	}

	.commodityManagement_fd4_0_c1 {
		margin: 32rpx 24rpx 24rpx 24rpx;
	}

	.commodityManagement_fd4_0_c0_c1 {
		width: 40rpx;
		height: 40rpx;
		border-radius: 0rpx 0rpx 0rpx 0rpx;
		margin: 0rpx 24rpx 0rpx 105rpx;
	}

	.commodityManagement_fd4_0_c0_c0 {
		color: #000000;
		font-size: 32rpx;
		font-weight: 500;
		line-height: 48rpx;
	}

	.commodityManagement_fd4_0 {
		background: #fff;
		width: 530rpx;
		border-radius: 16rpx 16rpx 16rpx 16rpx;
		background-size: 100% auto !important;
		padding: 32rpx 0rpx 0rpx 0rpx;
	}
</style>
