shish 4 anni fa
parent
commit
3d9a0c6730
1 ha cambiato i file con 62 aggiunte e 83 eliminazioni
  1. 62 83
      ghs/src/views/item/list.vue

+ 62 - 83
ghs/src/views/item/list.vue

@@ -153,22 +153,10 @@
         <el-button type="primary" size="mini" @click="$util.pageTo({url: '/item/import'})">从平台导入</el-button>
       </template>
 
-		<template #slot-addNew-goods-btn>
+	<template #slot-addNew-goods-btn>
         <el-button type="primary" size="mini" @click="replaceBtnFn(0)">新增</el-button>
       </template>
-
-
-	<template #slot-status>
-	<el-select v-model="status" placeholder="状态" style="width: 160px;" size="mini" @change="changedStatus">
-		<el-option
-		v-for="statusItem in statusOption"
-		:key="statusItem.value"
-		:label="statusItem.label"
-		:value="statusItem.value">
-		</el-option>
-	</el-select>
-	</template>
-		
+	
 
     </x-crud>
     <item-list-layer :show.sync="showItemModal" :classId.sync="classId" :className.sync="className" @confirm="selectItemFn" @cancel="showItemModal = false">
@@ -298,7 +286,7 @@ export default {
 		sortLink: '',
 		operateData: {},
 		statusOption: [{
-          value: '0',
+          value: '3',
           label: '全部'
         },{
           value: '1',
@@ -309,27 +297,27 @@ export default {
         }],
 		tabIndex: '0',
 		tabsData: [
-		{
-			text: '全部',
-			key: '0'
-		},
-				{
-			text: '上架',
-			key: '1'
-		},
-				{
-			text: '下架',
-			key: '2'
-		},
-				{
-			text: '已停用',
-			key: '3'
-		}
+			{
+				text: '上架',
+				key: '0'
+			},
+					{
+				text: '下架',
+				key: '1'
+			},
+			{
+				text: '已停用',
+				key: '2'
+			},
+			{
+				text: '全部',
+				key: '3'
+			}
 		],
 		selects: {},
-		status:'',
+		status:1,
 		sort: {
-		status: false
+			status: false
 		},
 		batchAlterNum:'',
 		batchAddNum:'',
@@ -345,40 +333,39 @@ export default {
 		className:'',
 		showItemModal: false,
 		dataList: {
-		form: {
-			data: '',
-			type: ''
-		}
-				
+			form: {
+				data: '',
+				type: ''
+			}		
 		},
 		initData: [],
 		addDialog: false,
 		replaceForm: {
-				name: '',
-				py: '',
-		  		stock: '',
-				classId: '',
-				className: '',
-				cover: '',
-				bigUnit: '',
-				smallUnit: '',
-				stockWarning:'',
-				cost:'',
-				addPrice:'',
-				weight:'',
-			},
+			name: '',
+			py: '',
+			stock: '',
+			classId: '',
+			className: '',
+			cover: '',
+			bigUnit: '',
+			smallUnit: '',
+			stockWarning:'',
+			cost:'',
+			addPrice:'',
+			weight:'',
+		},
 		replaceFormRules: {
 			name: {
 				required: true,
-						message: '名称不能为空',
+				message: '名称不能为空',
 			},
 			cover: {
 				required: true,
-						message: '图片不能为空',
+				message: '图片不能为空',
 			},
 			classId: {
 				required: true,
-						message: '请选择分类',
+				message: '请选择分类',
 			},
 			bigUnitId: {
 				required: true,
@@ -394,11 +381,11 @@ export default {
 			},
 			stockWarning: {
 				required: true,
-						message: '最低库存不能为空',
+				message: '最低库存不能为空',
 			},
 			cost: {
 				required: true,
-						message: '运费不能为空',
+				message: '运费不能为空',
 			},
 			stock: {
 				required: true,
@@ -406,11 +393,11 @@ export default {
 			},
 			addPrice: {
 				required: true,
-						message: '加价不能为空',
+				message: '加价不能为空',
 			},
 			weight: {
 				required: true,
-						message: '重量不能为空',
+				message: '重量不能为空',
 			}
 		},
 		itemClassList: [],
@@ -424,7 +411,6 @@ export default {
     this.init();
   },
   methods: {
-
 	copyProduct(id){
 		this.$service.product.copy({id:id}).then(res => {
 			this.$message.success('操作成功!')
@@ -436,22 +422,18 @@ export default {
 	cancelCopyProduct(id) {
 		this.$refs[`popover-` + id].doClose();
 	},
-	  changedStatus(status){
-		this.status = status
-		this.app.refresh({ classId: this.classId,status:this.status,showPage: 1});
-	  },
-	  //自动填写拼音
-	  fillName(event){
-		this.$service.product.py({ name: event }).then(res => {
-			if(res.py){
-				this.replaceForm.py = res.py
-			}
-		}).catch(err => { console.log(err) })
-	  },
-	  init(){
-		this.getAllClass()
-		this.getAllUnit()
-	  },
+	//自动填写拼音
+	fillName(event){
+	this.$service.product.py({ name: event }).then(res => {
+		if(res.py){
+			this.replaceForm.py = res.py
+		}
+	}).catch(err => { console.log(err) })
+	},
+	init(){
+	this.getAllClass()
+	this.getAllUnit()
+	},
     selectItemFn (currentItem) {
 
       let item = currentItem.list
@@ -529,7 +511,6 @@ export default {
 		if(this.replaceForm.cover.substr(0,4).toLowerCase() == "http"){
 			replaceForm.cover = this.replaceForm.shortCover;
 		}
-
 		this.$refs.replaceForm.validate((valid) => {
 			if(valid) {
 				if (this.currentItemId == 0) {
@@ -549,19 +530,17 @@ export default {
 		})
     },
     tabClick (tab) {
-		
 		let index = tab.index
 		if(index == 0){
-			this.app.refresh({ classId: this.classId,status: 0 ,delStatus:0 });
-		}else if(index == 1){
 			this.app.refresh({ status: 1 ,delStatus:0});
-		}else if(index == 2){
+		}else if(index == 1){
 			this.app.refresh({ status: 2 ,delStatus:0});
+		}else if(index == 2){
+			this.app.refresh({delStatus: 1});
 		}else if(index == 3){
-			this.app.refresh({ status:0, delStatus: 1});
+			this.app.refresh({status:0,delStatus:2});
 		}
     },
-
     onLoad ({ ctx, app }) {
       this.app = app
       if (this.$route.query.classId) {
@@ -693,7 +672,7 @@ export default {
 		})
         .set('layout', [['slot-tabs'],['search-key'],['flex1', 'slot-addNew-goods-btn','slot-add-goods-btn','slot-download-price-btn', 'refresh-btn'],
 		['data-table'],['flex1', 'pagination']]).done();
-		app.refresh({ classId: this.classId,status:this.status,showPage: 1,delStatus:0});
+		app.refresh({ classId: this.classId,status:this.status,delStatus:0,showPage: 1});
     },
     uploadSuccess() {
 		console.log('valid',this.$refs['replaceForm'].validateField('cover'))