Browse Source

隐藏功能

shish 3 years ago
parent
commit
7e6390cd88
2 changed files with 36 additions and 3 deletions
  1. 23 1
      ghsApp/src/admin/item/components/item.vue
  2. 13 2
      ghsApp/src/admin/item/list.vue

+ 23 - 1
ghsApp/src/admin/item/components/item.vue

@@ -8,6 +8,19 @@
 		<button v-if="info.presell == 1" @click.stop="cancelPreSellFn(info)" class="admin-button-com mini-btn blue" 
 			style="position:absolute;bottom:0upx;font-size:24upx;left:10upx;z-index:20;">取消预售</button>
 
+		<block v-if="info.frontHide && !$util.isEmpty(info.frontHide)">
+		<block v-if="Number(info.discountPrice)<=0 && info.presell == 0">
+		<button v-if="frontHide == 0" @click.stop="hideChangeFn(info,1)" class="admin-button-com mini-btn default" 
+			style="width:141upx;position:absolute;bottom:0upx;font-size:24upx;left:10upx;z-index:20;padding-top:16upx;padding-bottom:16upx;">
+			隐藏
+			</button>
+		<button v-else @click.stop="hideChangeFn(info,0)" class="admin-button-com mini-btn default" 
+			style="width:141upx;position:absolute;bottom:0upx;font-size:24upx;left:10upx;z-index:20;padding-top:16upx;padding-bottom:16upx;">
+			取消隐藏
+			</button>
+		</block>
+		</block>
+
 		<view class="img_bx" @click="pageTo({url: '/admin/item/detail',query: {id: info.id}})">
 			<view v-if="info.status == 2" class="sold-out">
 				<view class="sold-out-xj">已下架</view>
@@ -17,7 +30,7 @@
 		<view class="cmd-info_bx active" @click="pageTo({url: '/admin/item/detail',query: {id: info.id}})">
 			<view class="tit">
 				<text style="font-size:22upx;border:1upx solid #3385ff;color:white;background-color:#3385ff;margin-right:5upx;padding-left:5upx;padding-right:5upx;" 
-				v-if="info.frontHide && info.frontHide == 1">隐</text>
+				v-if="frontHide== 1">隐</text>
 				<text style="font-size:22upx;border:1upx solid #3385ff;color:white;background-color:#3385ff;margin-right:5upx;padding-left:5upx;padding-right:5upx;" 
 				v-if="info.presell == 1">预售</text>
 				{{ info.name }}
@@ -55,9 +68,18 @@ export default {
 	},
 	data() {
 		return {
+			frontHide:0
 		};
 	},
+	mounted(){
+		if(this.info){
+			this.frontHide = this.info.frontHide
+		}
+	},
 	methods: {
+		hideChangeFn(item,status){
+			this.$emit("hideChangeFn",item,status)
+		},
 		cancelPreSellFn(item){
 			this.$emit("cancelPreSellFn",item)
 		},

+ 13 - 2
ghsApp/src/admin/item/list.vue

@@ -27,7 +27,10 @@
 							<view v-if="classItem.child && !$util.isEmpty(classItem.child)">
 								<template v-for="(productItem, productIndex) in classItem.child">
 									<view style="height:255upx" :id="`class_${classIndex}`" :key="productIndex">
-										<ItemStock v-if="classItem.isActive" :info="productItem" @moreAction="moreAction" @doPrintLabel="doPrintLabel" @cancelDiscountFn="cancelDiscountFn" @cancelPreSellFn="cancelPreSellFn" @breakSingleItem="breakSingleItem">
+										<ItemStock v-if="classItem.isActive" :info="productItem" @moreAction="moreAction" 
+										@doPrintLabel="doPrintLabel" @cancelDiscountFn="cancelDiscountFn" 
+										:ref="`productRef${productItem.id}`" @hideChangeFn="hideChangeFn" 
+										@cancelPreSellFn="cancelPreSellFn" @breakSingleItem="breakSingleItem">
 										</ItemStock>
 									</view>
 								</template>
@@ -119,7 +122,7 @@ import productMins from "@/mixins/product";
 import { mapGetters } from "vuex";
 import { getWeixinId } from "@/api/invite/index";
 import { print,cancelDiscountPrice,cancelPreSell } from '@/api/product';
-import { getHdPoster,getSkPoster,breakItem } from '@/api/item'
+import { getHdPoster,getSkPoster,breakItem,changeFrontHide } from '@/api/item'
 import uniPopup from '@/uni_modules/uni-popup/components/uni-popup/uni-popup.vue';
 import ModalModule from "@/components/plugin/modal"
 export default {
@@ -171,6 +174,14 @@ export default {
 		})
 	},
 	methods: {
+		hideChangeFn(item,status){
+			let that = this
+			changeFrontHide({id:item.id,status:status}).then(res=>{
+				if(res.code == 1){
+					that.$refs[`productRef${item.id}`][0].frontHide = status
+				}
+			})
+		},
 		breakSingleItem(item){
 			let that = this
 			this.breakNum = 1