Browse Source

隐藏功能

shish 5 years ago
parent
commit
4fadcd7d7b
2 changed files with 57 additions and 16 deletions
  1. 9 0
      ghs/src/service/product/index.js
  2. 48 16
      ghs/src/views/item/list.vue

+ 9 - 0
ghs/src/service/product/index.js

@@ -46,6 +46,15 @@ list(data) {
     });
 	}
 
+  	//上下架
+	changeDelStatus(data) {
+    return this.request({
+        url: '/del-status-update',
+        method: 'POST',
+        data: data
+    });
+	}
+
   copy(data) {
     return this.request({
       url: '/copy',

+ 48 - 16
ghs/src/views/item/list.vue

@@ -18,7 +18,7 @@
 	</template>
 
       <template #table-column-name="{scope}">
-        <span class="item-name">{{ scope.row.name }}</span>
+        <span class="item-name"><i class="el-icon-delete" v-if="scope.row.delStatus == 1" style="font-size:13px;"></i>{{ scope.row.name }}</span>
       </template>
 
       <template #table-column-status="{scope}">
@@ -83,20 +83,23 @@
 
       <template #slot-modify="{ scope }">
 
+		<el-popover style="margin-right:10px;" placement="top" width="160" :ref="'popover-' + scope.row.id">
+			<p>确认复制生成花材?</p>
+			<div style="text-align: right; margin: 0">
+			<el-button size="mini" type="text" @click.stop="cancelCopyProduct(scope.row.id)">取消</el-button>
+			<el-button type="primary" size="mini" @click.stop="copyProduct(scope.row.id)">确定</el-button>
+			</div>
+			<el-button slot="reference" size="mini" type="text" plain @click.stop="">复制</el-button>
+		</el-popover>
+
+		<el-button type="text" @click.native.stop="replaceBtnFn(scope.row.id)" >修改</el-button>
+		<el-button type="text" v-if="scope.row.status==2" @click.native.stop="setStatusFun(scope.row.id,1)" >上架</el-button>
+		<el-button type="text" v-if="scope.row.status==1" @click.native.stop="setStatusFun(scope.row.id,2)" >下架</el-button>
 
-				<el-popover style="margin-right:10px;" placement="top" width="160" :ref="'popover-' + scope.row.id">
-					<p>确认复制生成花材?</p>
-					<div style="text-align: right; margin: 0">
-					<el-button size="mini" type="text" @click.stop="cancelCopyProduct(scope.row.id)">取消</el-button>
-					<el-button type="primary" size="mini" @click.stop="copyProduct(scope.row.id)">确定</el-button>
-					</div>
-					<el-button slot="reference" size="mini" type="text" plain @click.stop="">复制</el-button>
-				</el-popover>
+		<el-button type="text" v-if="scope.row.delStatus==0" @click.native.stop="setDelStatusFun(scope.row.id,1)" >删除</el-button>
+		<el-button type="text" v-if="scope.row.delStatus==1" @click.native.stop="setDelStatusFun(scope.row.id,0)" >恢复</el-button>
 
-				<el-button type="text" @click.native.stop="replaceBtnFn(scope.row.id)" >修改</el-button>
-				<el-button type="text" v-if="scope.row.status==2" @click.native.stop="setStatusFun(scope.row.id,1)" >上架</el-button>
-				<el-button type="text" v-if="scope.row.status==1" @click.native.stop="setStatusFun(scope.row.id,2)" >下架</el-button>
-			</template>
+	</template>
 
 		<template #table-header-cost>
 			<div class="set-sort">
@@ -312,6 +315,18 @@ export default {
 		{
 			text: '花材列表',
 			key: '0'
+		},
+				{
+			text: '上架',
+			key: '1'
+		},
+				{
+			text: '下架',
+			key: '2'
+		},
+				{
+			text: '已删除',
+			key: '3'
 		}
 		],
 		selects: {},
@@ -501,6 +516,12 @@ export default {
         this.app.refresh()
       }).catch(err => {})
 	},
+	setDelStatusFun(id,delStatus){
+      this.$service.product.changeDelStatus({id:id,delStatus:delStatus}).then(res => {
+        this.$message.success('操作成功!')
+        this.app.refresh()
+      }).catch(err => {})
+	},
     replaceConfirmFn() {
 		let replaceForm = this.$util.copyObject(this.replaceForm)
 		if(this.replaceForm.cover.substr(0,4).toLowerCase() == "http"){
@@ -525,9 +546,20 @@ export default {
 			}
 		})
     },
-    tabClick (tab, e) {
-      this.app.refresh({ classId: this.classId });
+    tabClick (tab) {
+		
+		let index = tab.index
+		if(index == 0){
+			this.app.refresh({ classId: this.classId,status: 0 ,delStatus:'' });
+		}else if(index == 1){
+			this.app.refresh({ status: 1 ,delStatus:''});
+		}else if(index == 2){
+			this.app.refresh({ status: 2 ,delStatus:''});
+		}else if(index == 3){
+			this.app.refresh({ delStatus: 1 ,status:0});
+		}
     },
+
     onLoad ({ ctx, app }) {
       this.app = app
       if (this.$route.query.classId) {
@@ -636,7 +668,7 @@ export default {
           op: {
             visible: true,
             props: {
-              width: 160,
+              width: 185,
               align: 'center',
               fixed: 'right',
               label: '操作'