Browse Source

花材列表

shish 2 years ago
parent
commit
23b553a1a4
3 changed files with 43 additions and 49 deletions
  1. 5 25
      ghsApp/src/admin/billing/index2.vue
  2. 18 21
      ghsApp/src/admin/item/list2.vue
  3. 20 3
      ghsApp/src/mixins/product2.js

+ 5 - 25
ghsApp/src/admin/billing/index2.vue

@@ -6,7 +6,7 @@
 				<button class="admin-button-com middle blue" @click="selectFlowerNumFn()">图片分类</button>
 			</view>
 			<view class="search-bar">
-				<app-search-module v-model="globalPy" placeholder="输入拼音首字母搜索" @input="searchFn" />
+				<app-search-module v-model="globalPy" placeholder="这里搜索" @input="globalSearch" />
 			</view>
 			<view style="float:right;">
 				<button class="admin-button-com middle blue" @click="removeFromSave(option.customId)">清除花材</button>
@@ -16,7 +16,7 @@
 		<view class="scroll-middle_bx">
 			<scroll-view scroll-y scroll-with-animation class="tab-view">
 				<!--分类-->
-				<div v-for="(item, index) in globalClassData" :key="index" class="tab-bar-item" :class="globalClassIndex == index ? 'active' : ''" :data-current="index" @tap.stop="switchClassTab(index,item)">
+				<div v-for="(item, index) in globalClassData" :key="index" class="tab-bar-item" :class="globalClassIndex == index ? 'active' : ''" :data-current="index" @tap.stop="globalSwitchClass(index,item)">
 					<text style="text-align: center;">{{ item.name || "" }}</text>
 				</div>
 				<view style="height: 120upx"></view>
@@ -174,11 +174,11 @@ export default {
 		}
 		let book = this.option.book ? this.option.book : 0
 		if(book == 0){
-			this.globalReuqestType = 'kd'
+			this.globalRequestType = 'kd'
 			this.initData()
 		}else{
 			this.globalCheckStock = false
-			this.globalReuqestType = 'book'
+			this.globalRequestType = 'book'
 			this.initData()
 		}
 	},
@@ -186,29 +186,9 @@ export default {
 		scrollBottom(){
             this.getGlobalProductList()
         },
-        searchFn(){
-            if(!this.$util.isEmpty(this.globalPy)){
-                this.globalPage = 1
-                this.globalClassIndex = -1
-                this.globalFinishGetItem = 0
-                this.getGlobalProductList()
-            }else{
-                this.globalPage = 1
-                this.globalClassIndex = 0
-                this.globalFinishGetItem = 0
-                this.getGlobalProductList()
-            }
-        },
-		switchClassTab(cur,item) {
-			this.globalClassIndex = cur
-            this.globalPage = 1
-            this.globalClassId = item.id
-            this.globalFinishGetItem = 0
-            this.getGlobalProductList()
-		},
 		changeClass(index,item){
 			this.$refs.selectFlowerNumRef.close()
-			this.switchClassTab(index,item)
+			this.globalSwitchClass(index,item)
 		},
 		delProduct(info){
 			let that = this

+ 18 - 21
ghsApp/src/admin/item/list2.vue

@@ -6,7 +6,7 @@
 					<button class="admin-button-com middle blue" @click="selectFlowerNumFn()">图片分类</button>
 				</view>
 				<view class="search-bar">
-					<app-search-module v-model="py" placeholder="输拼音首字母也可以搜" @input="goSearchFn"/>
+					<app-search-module v-model="globalPy" placeholder="这里搜索" @input="globalSearch"/>
 				</view>
 				<view style="padding:0 0upx 0 15upx;" >
 					<button class="admin-button-com middle blue" @click="refreshItem()">刷新</button>
@@ -17,20 +17,19 @@
 			</view>
 			<view class="scroll-middle_bx">
 				<scroll-view scroll-y scroll-with-animation class="tab-view" :scroll-top="scrollTop">
-					<div v-for="(item, index) in globalClassItemList" :key="index" class="tab-bar-item" :class="[classIndex == index ? 'active' : '']" :data-current="index" @tap.stop="swichClass(index)">
-						<text style="text-align: center;">{{ item.className || "" }}</text>
+					<div v-for="(item, index) in globalClassData" :key="index" class="tab-bar-item" :class="[globalClassIndex == index ? 'active' : '']" :data-current="index" @tap.stop="globalSwitchClass(index,item)">
+						<text style="text-align: center;">{{ item.name || "" }}</text>
 					</div>
 				</scroll-view>
-					<scroll-view scroll-y class="right-box" :scroll-into-view="scroll_into_view" scroll-with-animation="true"
-							@scroll="scroll_detail" lower-threshold="100" @scrolltolower="scroll_bottom">
-
-					<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 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" 
+				<scroll-view scroll-y class="right-box" :scroll-into-view="scroll_into_view" scroll-with-animation="true"
+					@scroll="scroll_detail" lower-threshold="100" @scrolltolower="scroll_bottom">
+					<block v-if="!$util.isEmpty(globalItemData)">
+						<view class="item_list_bx selectAll">
+							<view class="item_list_title"></view>
+							<view v-if="!$util.isEmpty(globalItemData)">
+								<template v-for="(productItem, productIndex) in globalItemData">
+									<view style="height:255upx" :key="productIndex">
+										<ItemStock :info="productItem" @moreAction="moreAction" 
 										@doPrintLabel="doPrintLabel" @cancelDiscountFn="cancelDiscountFn" @cancelFullOff="cancelFullOff"
 										:ref="`productRef${productItem.id}`" @hideChangeFn="hideChangeFn" 
 										@cancelPreSellFn="cancelPreSellFn" @breakSingleItem="breakSingleItem">
@@ -179,13 +178,14 @@ export default {
 			this.searchFn()			
 		},
 		initItem(){
-			this.initData({requestType:'itemList'}).then(res=>{
+			this.globalRequestType = 'itemList'
+			this.initData().then(res=>{
 				uni.hideLoading()
 			})
 		},
 		refreshItem(){
 			uni.showLoading({mask:true})
-			this.py = ''
+			this.globalPy = ''
 			this.initItem()
 		},
 		hideChangeFn(item,status){
@@ -324,7 +324,7 @@ export default {
 		},
 		changeClass(index){
 			this.$refs.selectFlowerNumRef.close()
-			this.swichClass(index)
+			this.globalSwitchClass(index)
 		},
 		selectFlowerNumFn(){
 			this.$refs.selectFlowerNumRef.open('top')
@@ -497,11 +497,8 @@ export default {
 			} else {
 			}
 		},
-		scrollTop() {},
-		initProductInfo() {
-			this.globalClassItemListContrapose = [];
-			this.page = 1;
-			this.isMore = true;
+		scrollTop() {
+
 		}
 	}
 };

+ 20 - 3
ghsApp/src/mixins/product2.js

@@ -195,6 +195,13 @@ export default {
 				}
 			}
 		},
+		globalSwitchClass(cur,item) {
+			this.globalClassIndex = cur
+            this.globalPage = 1
+            this.globalClassId = item.id
+            this.globalFinishGetItem = 0
+            this.getGlobalProductList()
+		},
 		pushToSave(selectData){
 			this.setSelectInfo({ selectJobType: this.selectJobType, info: selectData,selectJobId:this.selectJobId })
 			uni.setStorageSync('selectList_'+this.selectJobType+'_target_'+this.selectJobId, selectData)
@@ -227,9 +234,19 @@ export default {
 				this.$forceUpdate()
 			}
 		},
-		searchFn() {
-
-		},
+        globalSearch(){
+            if(!this.$util.isEmpty(this.globalPy)){
+                this.globalPage = 1
+                this.globalClassIndex = -1
+                this.globalFinishGetItem = 0
+                this.getGlobalProductList()
+            }else{
+                this.globalPage = 1
+                this.globalClassIndex = 0
+                this.globalFinishGetItem = 0
+                this.getGlobalProductList()
+            }
+        },
 		getSelectItemById(id, classId) {
 			let info = { bigCount: null, smallCount: null, autoPrice: null, itemPrice: null }
 			const item = this.selectList && this.selectList.find(ele => { return ele.id == id && ele.classId == classId })