<template>
	<!-- 规格管理 -->
	<view class="specspage">
		
		<!-- 规格列表 -->
		<view class="specslist">
			<view class="specsItemdata flex ali-c jus-b" v-for="(item,index) in specsList" :key="index">
				<view class="flex1">
					<view class="specsname">{{item.name}}</view>
					<view class="spectag twoline">{{item.spec_item}}</view>
				</view>
				<view class="issysbtns">
					<view class="btns" @tap="getedti(item)">修改</view>
				</view>
			</view>
		</view>
		
		<view class="addspecs">
			<navigator url="../specsadd/specsadd" class="submitbtn active">添加规格</navigator>
		</view>
		
	</view>
</template>

<script>
	import {specitemList} from  "@/utils/api/api.js";
	export default {
		data() {
			return {
				specsList:[],
			};
		},
		onLoad() {
			
		},
		onShow() {
			this.getspecitemList();
		},
		methods:{
			//获取规格列表
			async getspecitemList(){
				let res = await specitemList({
				});
				if(res.code==0){
					this.specsList = res.data;
				}else{
					this.$api.msg(res.msg);
				}
			},
			getedti(data){
				uni.setStorageSync("editspecs",data);
				uni.navigateTo({
					url:`/pages/specsadd/specsadd?actiontype=2&id=${data.id}`,
				})
			}
		}
	}
</script>

<style lang="scss">
	@import  "./specs.scss";
</style>
