Browse Source

全选与取消

shish 3 years ago
parent
commit
9a5ab883d6

+ 17 - 2
ghsApp/src/admin/changePrice/outList.vue

@@ -25,13 +25,15 @@
 
 				<block v-if="!$util.isEmpty(globalClassItemList)">
 					<view class="item_list_bx selectAll" v-for="(classItem, classIndex) in globalClassItemList" :key="classIndex" :id="`class_${classIndex}`">
-						<view class="item_list_title"> {{ classItem.className }}</view>
+						<view class="item_list_title"> {{ classItem.className }} 
+							<text style="float:right;color:#3385FF;margin-right:50upx;" @click="getCurrentAll(classIndex)">全选 / 取消</text>
+						</view>
 
 						<view v-if="classItem.child && !$util.isEmpty(classItem.child)">
 
 							<template v-for="(productItem, productIndex) in classItem.child">
 								<view style="height:230upx" :id="`class_${classIndex}`" :key="productIndex">
-									<ItemComponent v-if="classItem.isActive" :isPrice="false" @checkItem="checkItemEvent" :info="productItem"></ItemComponent>
+									<ItemComponent :ref="`item_${productItem.id}`" v-if="classItem.isActive" :isPrice="false" @checkItem="checkItemEvent" :info="productItem"></ItemComponent>
 								</view>
 							</template>
 
@@ -105,6 +107,19 @@ export default {
 		this.initProduct()
 	},
 	methods: {
+		getCurrentAll(index){
+			uni.showLoading({mask:true})
+			let that = this
+			let child = this.globalClassItemList[index] && this.globalClassItemList[index].child ? this.globalClassItemList[index].child : []
+			if(!this.$util.isEmpty(child)){
+				child.forEach((item) => {
+					let id = item.id
+					let current = 'item_'+id
+					that.$refs[current][0].checkEvent()
+				})
+			}
+			uni.hideLoading()
+		},
 		stopSelect(){
 			let that = this
 			if(this.$util.isEmpty(this.currentList)){

+ 19 - 4
ghsApp/src/admin/changePrice/removeList.vue

@@ -25,13 +25,15 @@
 
 				<block v-if="!$util.isEmpty(globalClassItemList)">
 					<view class="item_list_bx selectAll" v-for="(classItem, classIndex) in globalClassItemList" :key="classIndex" :id="`class_${classIndex}`">
-						<view class="item_list_title"> {{ classItem.className }}</view>
+						<view class="item_list_title"> {{ classItem.className }}
+							<text style="float:right;color:#3385FF;margin-right:50upx;" @click="getCurrentAll(classIndex)">全选 / 取消</text>
+						</view>
 
 						<view v-if="classItem.child && !$util.isEmpty(classItem.child)">
 
 							<template v-for="(productItem, productIndex) in classItem.child">
 								<view style="height:230upx" :id="`class_${classIndex}`" :key="productIndex">
-									<ItemComponent v-if="classItem.isActive" :isPrice="false" :info="productItem" @checkItem="checkItemEvent"></ItemComponent>
+									<ItemComponent :ref="`item_${productItem.id}`" v-if="classItem.isActive" :isPrice="false" :info="productItem" @checkItem="checkItemEvent"></ItemComponent>
 								</view>
 							</template>
 
@@ -54,7 +56,7 @@
 		</view>
 
       <div class="app-footer">
-        <button class="admin-button-com big blue" @click="recoverSelect">恢复所选</button>
+        <button class="admin-button-com big blue" @click="recoverSelect">移到停用</button>
       </div>
 
 		<uni-popup ref="selectFlowerNumRef" background-color="#fff" type="center" :animation="false" class="class-popup-style">
@@ -105,13 +107,26 @@ export default {
 		this.initProduct()
 	},
 	methods: {
+		getCurrentAll(index){
+			uni.showLoading({mask:true})
+			let that = this
+			let child = this.globalClassItemList[index] && this.globalClassItemList[index].child ? this.globalClassItemList[index].child : []
+			if(!this.$util.isEmpty(child)){
+				child.forEach((item) => {
+					let id = item.id
+					let current = 'item_'+id
+					that.$refs[current][0].checkEvent()
+				})
+			}
+			uni.hideLoading()
+		},
 		recoverSelect(){
 			let that = this
 			if(this.$util.isEmpty(this.currentList)){
 				this.$msg('请选择花材')
 				return false
 			}
-			this.$util.confirmModal({content:'确认恢复所选花材?'},() => {
+			this.$util.confirmModal({content:'确认所选花材移到停用列表?'},() => {
 				batchRecover({ids:JSON.stringify(that.currentList)}).then(res=>{
 					if(res.code == 1){
 						that.$msg(res.msg)

+ 17 - 2
ghsApp/src/admin/changePrice/stopList.vue

@@ -25,13 +25,15 @@
 
 				<block v-if="!$util.isEmpty(globalClassItemList)">
 					<view class="item_list_bx selectAll" v-for="(classItem, classIndex) in globalClassItemList" :key="classIndex" :id="`class_${classIndex}`">
-						<view class="item_list_title"> {{ classItem.className }}</view>
+						<view class="item_list_title"> {{ classItem.className }}
+							<text style="float:right;color:#3385FF;margin-right:50upx;" @click="getCurrentAll(classIndex)">全选 / 取消</text>
+						</view>
 
 						<view v-if="classItem.child && !$util.isEmpty(classItem.child)">
 
 							<template v-for="(productItem, productIndex) in classItem.child">
 								<view style="height:230upx" :id="`class_${classIndex}`" :key="productIndex">
-									<ItemComponent v-if="classItem.isActive" :isPrice="false" :info="productItem" @checkItem="checkItemEvent"></ItemComponent>
+									<ItemComponent :ref="`item_${productItem.id}`" v-if="classItem.isActive" :isPrice="false" :info="productItem" @checkItem="checkItemEvent"></ItemComponent>
 								</view>
 							</template>
 
@@ -106,6 +108,19 @@ export default {
 		this.initProduct()
 	},
 	methods: {
+		getCurrentAll(index){
+			uni.showLoading({mask:true})
+			let that = this
+			let child = this.globalClassItemList[index] && this.globalClassItemList[index].child ? this.globalClassItemList[index].child : []
+			if(!this.$util.isEmpty(child)){
+				child.forEach((item) => {
+					let id = item.id
+					let current = 'item_'+id
+					that.$refs[current][0].checkEvent()
+				})
+			}
+			uni.hideLoading()
+		},
 		enableSelect(){
 			let that = this
 			if(this.$util.isEmpty(this.currentList)){