shish il y a 2 ans
Parent
commit
c6ef07b3aa

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

@@ -12,7 +12,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="globalSwitchClass(index,item)">
+				<div v-for="(item, index) in globalClassData" :key="index" class="tab-bar-item" :class="[globalClassIndex == index ? 'active' : '']" :data-current="index" @tap.stop="currentSwitchClass(index,item)">
 					<text>{{ item.name || "" }}</text>
 				</div>
 			</scroll-view>
@@ -59,7 +59,7 @@
 
 		<uni-popup ref="globalClassImgRef" background-color="#fff" type="center" :animation="false" class="class-popup-style">
 			<view style="display:flex;padding:20upx;height:auto;justify-content: space-between;align-items:center;flex-wrap:wrap;max-height:100vh;overflow:auto;">
-				<view v-for="(item, index) in globalClassData" :key="index" @tap.stop="globalChangeClass(index,item)" style="margin-bottom:20upx;margin-left:3upx;">
+				<view v-for="(item, index) in globalClassData" :key="index" @tap.stop="currentChangeClass(index,item)" style="margin-bottom:20upx;margin-left:3upx;">
 				<image :src="item.cover" style="width:120upx;height:120upx;border-radius:10upx;"></image>
 				<view style="margin-top:5upx;overflow: hidden;white-space: nowrap;width:120upx;text-align:center;">{{item.name}}</view>
 				</view>
@@ -142,15 +142,30 @@ export default {
 			})
 		},
 		commitChange(){
+			let that = this
 			let data = JSON.stringify(this.stockArr);
 			checkOrderApi({pdType:'',itemInfo:data,remark:'修改库存'}).then(res => {
 				if(res.code == 1){
-					this.stockArr = [];
-					this.initProduct()
+					that.clearPrice()
 				}
 				this.$msg(res.msg)					
 			})
 		},
+		currentSwitchClass(index,item){
+			this.clearPrice()
+			this.globalSwitchClass(index,item)
+		},
+		currentChangeClass(index,item){
+			this.clearPrice()
+			this.globalChangeClass(index,item)
+		},
+		clearPrice(){
+			let that = this
+			this.stockArr.forEach(function(value,index,array){
+				that.$refs[`productRef${value.productId}`][0].modifyStock = ''
+			})
+			that.stockArr = []
+		},
 		saveStock(stock,id){
 			if(this.stockArr.length > 0){
 				this.stockArr.forEach(function(value,index,array){

+ 20 - 15
ghsApp/src/admin/changePrice/list2.vue

@@ -15,7 +15,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="globalSwitchClass(index,item)">
+				<div v-for="(item, index) in globalClassData" :key="index" class="tab-bar-item" :class="[globalClassIndex == index ? 'active' : '']" :data-current="index" @tap.stop="currentSwitchClass(index,item)">
 					<text style="text-align: center;">{{ item.name || "" }}</text>
 				</div>
 			</scroll-view>
@@ -65,15 +65,13 @@
 
 		<uni-popup ref="globalClassImgRef" background-color="#fff" type="center" :animation="false" class="class-popup-style">
 			<view style="display:flex;padding:20upx;height:auto;justify-content: space-between;align-items:center;flex-wrap:wrap;max-height:100vh;overflow:auto;">
-				<view v-for="(item, index) in globalClassData" :key="index" @tap.stop="globalChangeClass(index,item)" style="margin-bottom:20upx;margin-left:3upx;">
+				<view v-for="(item, index) in globalClassData" :key="index" @tap.stop="currentChangeClass(index,item)" style="margin-bottom:20upx;margin-left:3upx;">
 				<image :src="item.cover" style="width:120upx;height:120upx;border-radius:10upx;"></image>
 				<view style="margin-top:5upx;overflow: hidden;white-space: nowrap;width:120upx;text-align:center;">{{item.name}}</view>
 				</view>
 			</view>
 		</uni-popup>
 
-		<image v-if="showClassRemind" @click="hideClassRemind" style="position:absolute;width:610upx;height:699upx;top:225upx;left:80upx;z-index:9999;" :src="`${constant.imgUrl}/class_remind.png`"></image>
-
 	</view>
 </view>
 </template>
@@ -122,9 +120,6 @@ export default {
 		},
 		selectFlowerNumFn(){
 			this.$refs.globalClassImgRef.open('top')
-		},
-		hideClassRemind(){
-
 		},
 		cancelPreSellFn(item){
 			let that = this
@@ -214,18 +209,28 @@ export default {
 			let data = JSON.stringify(this.priceList);
 			batchChangePrice({data:data,appVersion:1}).then(res => {
 					if(res.code == 1){
-
-						that.priceList.forEach(function(value,index,array){
-							that.$refs[`productRef${value.id}`][0].hjModifyPrice = ''
-							that.$refs[`productRef${value.id}`][0].modifyPrice = ''
-							that.$refs[`productRef${value.id}`][0].skModifyPrice = ''
-						})
-
-						that.priceList = []
+						that.clearPrice()
 					}
 					uni.showToast({ title: '修改成功', icon: 'success', })
 				})
 		},
+		currentSwitchClass(index,item){
+			this.clearPrice()
+			this.globalSwitchClass(index,item)
+		},
+		currentChangeClass(index,item){
+			this.clearPrice()
+			this.globalChangeClass(index,item)
+		},
+		clearPrice(){
+			let that = this
+			this.priceList.forEach(function(value,index,array){
+				that.$refs[`productRef${value.id}`][0].hjModifyPrice = ''
+				that.$refs[`productRef${value.id}`][0].modifyPrice = ''
+				that.$refs[`productRef${value.id}`][0].skModifyPrice = ''
+			})
+			that.priceList = []
+		},
 		savePrice(price,skPrice,hjPrice,id,status){
 			if(this.priceList.length > 0){
 				this.priceList.forEach(function(value,index,array){