jf 5 лет назад
Родитель
Сommit
a7d9fc33b6

+ 2 - 1
ghsApp/src/components/module/allSelectInput.vue

@@ -26,7 +26,7 @@
 </style>
 <template>
 	<view class="change-input">
-			<input :focus="isFocus" :class="isActive&&value?'active':''" type="number" @focus="initAllInput" @blur="moveAllInput" v-model="inputVal" @input="changeAllInput" :placeholder="value==''&&inputVal==''?'自动调价':''">
+			<input :focus="isFocus" :class="isActive&&value?'active':''" type="number" @focus="initAllInput" @blur="moveAllInput" v-model="inputVal" @input="changeAllInput" :placeholder="value==''&&inputVal==''?placeholder:''">
 			<text :class="isActive?'active':''">{{value?value:''}}</text>
 	</view>
 </template>
@@ -37,6 +37,7 @@ export default {
 		isActive: '',
 		isFocus: '',
 		value: '',
+		placeholder: '',
 	},
 	data() {
 		return {

+ 19 - 4
ghsApp/src/components/module/app-commodity.vue

@@ -18,8 +18,8 @@
 					<i class="iconfont iconzeng" :class="addAnimationData?'animation':''" @click="addEvents"></i>
 				</view>
 				<view class="open-bx" v-else-if="type == COMMODITY_TYPE.CHANGE">
-					<allSelectInput :isActive="isAllActive" :isFocus="isAllFocus" :value="changeAutoPrice"
-						@deleteInputVal="deleteInputVal" @initAllInput="initAllInput" @moveAllInput="moveAllInput">
+					<allSelectInput :isActive="isAloneAllActive" :isFocus="isAloneAllFocus" :value="changeAutoPrice" :placeholder="'自动调价'"
+						@deleteInputVal="deleteInputVal" @initAllInput="initAloneAllInput" @moveAllInput="moveAllInput">
 					</allSelectInput>
 					<!--<input class="change-input" v-model="changeAutoPrice" type="digit" placeholder="自动调价"  selection-start="0" selection-end="1" />-->
 					<i :class="isShowSucceed?'position iconfont iconjihuo':'position'" ></i>
@@ -70,8 +70,11 @@ export default {
 	data() {
 		return {
 			COMMODITY_TYPE,
-			isAllActive: false,
-			isAllFocus: false,
+			// isAllActive: false,
+			// isAllFocus: false,
+			isAloneAllActive: false,
+			isAloneAllFocus: false,
+
 			isShowSucceed:false,
 			changeAutoPrice:'',
 			showPrice:0.00,
@@ -86,6 +89,18 @@ export default {
 		this.showPrice = this.info.price
 	},
 	methods: {
+		//input点击删除按键
+		deleteInputVal(){
+			this.isAloneAllActive=false;
+			this.changeAutoPrice = '';
+		},
+		//离开input
+		moveAllInput(e){
+			this.isAloneAllActive=false;
+			this.isAloneAllFocus=false;
+			if(e==''){return}
+			this.changeAutoPrice = e;
+		},
 		addEvents() {
 			this.animationFun('add');
 			// let params = {

+ 15 - 15
ghsApp/src/mixins/allSelectInput.js

@@ -6,22 +6,22 @@ export default {
 	},
 
 	methods: {
-		// 离开全选input alone
-		moveAllInput(e){
-			this.isAllActive=false;
-			this.isAllFocus=false;
-			if(e==''){return}
-			this.changeAutoPrice = e;
-		},
-		//input点击删除按键
-		deleteInputVal(){
-			this.isAllActive=false;
-			this.changeAutoPrice = '';
-		},
+		// // 离开全选input alone
+		// moveAloneAllInput(e){
+		// 	this.isAloneAllActive=false;
+		// 	this.isAloneAllFocus=false;
+		// 	if(e==''){return}
+		// 	this.changeAutoPrice = e;
+		// },
+		// //input点击删除按键
+		// deleteAloneInputVal(){
+		// 	this.isAloneAllActive=false;
+		// 	this.changeAutoPrice = '';
+		// },
 		// 选中input
-		initAllInput(){
-			this.isAllActive=true;
-			this.isAllFocus=true;
+		initAloneAllInput(){
+			this.isAloneAllActive=true;
+			this.isAloneAllFocus=true;
 		},
 	}
 };

+ 12 - 5
ghsApp/src/mixins/product.js

@@ -185,7 +185,8 @@ export default {
 			let info = {
 				bigCount: 0, //扎数
 				smallCount: 0, //支数
-				autoPrice: 0 //调价价格
+				autoPrice: 0, //调价价格
+				itemPrice: 0 //调价价格
 			};
 			const item =
 				this.selectList &&
@@ -197,7 +198,8 @@ export default {
 					...item,
 					bigCount: Number(item.bigCount),
 					smallCount: Number(item.smallCount),
-					autoPrice: Number(item.autoPrice)
+					autoPrice: Number(item.autoPrice),
+					itemPrice: Number(item.itemPrice),
 				};
 			}
 			return info;
@@ -222,6 +224,7 @@ export default {
 						if (item.id == selectItem.id && item.classId == selectItem.classId) {
 							info.bigCount += Number(selectItem.bigCount);
 							info.smallCount += Number(selectItem.smallCount);
+							info.itemPrice += selectItem.itemPrice?Number(selectItem.itemPrice):'';
 						}
 					}
 				}
@@ -298,7 +301,7 @@ export default {
 			// this.$forceUpdate();
 		},
 
-		addCustomNumEvent(item,params1) {
+		addCustomNumEvent(item,params1,type) {
 			const list = this.selectList;
 
 			// if (!has) {}
@@ -322,7 +325,9 @@ export default {
 					autoPrice: 0 //调价价格
 				};
 				list.push(params);
-			this.setSelectInfoByType({ type: this.pageType, info: list });
+				if(type!='noAdd'){
+					this.setSelectInfoByType({ type: this.pageType, info: list });
+				}
 			this.$nextTick(()=>{
 				this.customNum(params1)
 			})
@@ -436,13 +441,15 @@ export default {
 						) {
 							list[index].bigCount = Number(item.bigNum);
 							list[index].smallCount = Number(item.smallNum);
+							list[index].itemPrice = item.itemPrice?Number(item.itemPrice):'';
 						}
 					}
 
 					list[index] = {
 						...element,
 						bigCount: Number(item.bigCount),
-						smallCount: Number(item.smallCount)
+						smallCount: Number(item.smallCount),
+						itemPrice: item.itemPrice?Number(item.itemPrice):''
 					};
 
 					break;

+ 34 - 10
ghsApp/src/pagesPurchase/add.vue

@@ -67,6 +67,7 @@
 								:info="productItem"
 								:bigCount=" getSelectItemById(productItem.id, classItem.classId).bigCount"
 								:smallCount="getSelectItemById(productItem.id, classItem.classId).smallCount"
+								:itemPrice="getSelectItemById(productItem.id, classItem.classId).itemPrice"
 								@customNum="customNum"
 								@add="addEvent"
 								@addOneEvent="addCustomNumEvent"
@@ -101,12 +102,15 @@
 							<view class="kc">
 								价格
 							</view>
-							<input
-								:value="customData.itemPrice"
-								@change="changePriceEvent"
-								type="number"
-								placeholder="请填写采购总价"
-							/>元
+<!--							<input-->
+<!--								:value="customData.itemPrice"-->
+<!--								@change="changePriceEvent"-->
+<!--								type="number"-->
+<!--								placeholder="请填写采购总价"-->
+<!--							/>元-->
+							<allSelectInput :isActive="isAloneAllActive" :isFocus="isAloneAllFocus" :value="customData.itemPrice" :placeholder="'请填写采购总价'"
+																							@deleteInputVal="deleteAloneInputVal" @initAllInput="initAloneAllInput" @moveAllInput="moveAloneAllInput">
+							</allSelectInput>元
 						</view>
 					</view>
 					<view class="select-cmd_bx">
@@ -156,6 +160,9 @@ import productMins from "@/mixins/product";
 
 import allMoreSelectInput from "@/components/module/allMoreSelectInput";
 import allMoreSelectInputMins from "@/mixins/allMoreSelectInput";
+
+import allSelectInput from "@/components/module/allSelectInput";
+import allSelectInputMins from "@/mixins/allSelectInput";
 export default {
 	name: "purchase", // 采购
 	components: {
@@ -164,30 +171,46 @@ export default {
 		AppWrapperEmpty,
 		CommodityPurchase,
 		ModalModule,
-		FooterCart,allMoreSelectInput
+		FooterCart,allMoreSelectInput,allSelectInput
 	},
-	mixins: [productMins,allMoreSelectInputMins],
+	mixins: [productMins,allMoreSelectInputMins,allSelectInputMins],
 	data() {
 		return {
 			pageType: "purchase",
 
+			isAloneAllActive: false,
+			isAloneAllFocus: false,
+
 			isModel: false,
 			showSubmitModel: false,
 			customData: {
 				bigCount: 0,
 				smallCount: 0,
-				itemPrice: null
+				itemPrice: 0
 			}
 		};
 	},
 	onLoad() {},
 	methods: {
+		// 离开全选input alone
+		moveAloneAllInput(e){
+			this.isAloneAllActive=false;
+			this.isAloneAllFocus=false;
+			if(e==''){return}
+			this.customData.itemPrice = e;
+		},
+		//input点击删除按键
+		deleteAloneInputVal(){
+			this.isAloneAllActive=false;
+			this.customData.itemPrice = '';
+		},
 		//自定义数量
 		customNum(info) {
 			this.isModel = true;
 			this.customData = info;
 			this.$nextTick(()=>{
-				this.initAllInput();
+				// this.initAllInput();
+				this.initAloneAllInput();
 			})
 		},
 		modalCancel() {
@@ -197,6 +220,7 @@ export default {
 		affirm(val) {
 			// this.moveAllInput();
 			// this.moveAllInputOne();
+			console.log('this.customData)',this.customData)
 			this.isFocus = false;
 			this.isFocusOne = false;
 			this.$nextTick(()=>{

+ 12 - 5
ghsApp/src/pagesPurchase/components/CommodityPurchase.vue

@@ -61,7 +61,11 @@ export default {
 		autoPrice: {
 			type: Number,
 			default: 0
-		}
+		},
+		itemPrice: {
+			type: Number,
+			default: 0
+		},
 	},
 	data() {
 		return {
@@ -94,18 +98,21 @@ export default {
 			this.$emit("changePrice", this.info, value);
 		},
 		customNum() {
-			if(!this.info.bigCount){
+			console.log('this.info',this.info)
+			if(!this.bigCount && !this.smallCount){
 				let params = {
 					...this.info,
 					bigCount: this.bigCount,
-					smallCount: this.smallCount
+					smallCount: this.smallCount,
+					itemPrice: this.itemPrice
 				};
-				this.$emit("addOneEvent", this.info,params);
+				this.$emit("addOneEvent", this.info,params,'noAdd');
 			}
 			this.$emit("customNum", {
 				...this.info,
 				bigCount: this.bigCount,
-				smallCount: this.smallCount
+				smallCount: this.smallCount,
+				itemPrice: this.itemPrice
 			});
 		}
 	}