jiangfeng 5 лет назад
Родитель
Сommit
a9d9ef0b6c
1 измененных файлов с 35 добавлено и 12 удалено
  1. 35 12
      ghsApp/src/components/module/app-commodity.vue

+ 35 - 12
ghsApp/src/components/module/app-commodity.vue

@@ -9,7 +9,7 @@
 		<view class="cmd-info_bx">
 		<view class="cmd-info_bx">
 			<view class="tit" >{{ info.itemName || "" }}</view>
 			<view class="tit" >{{ info.itemName || "" }}</view>
 			<view class="kc num-open_bx flex-end" v-if="type == COMMODITY_TYPE.COMMON">
 			<view class="kc num-open_bx flex-end" v-if="type == COMMODITY_TYPE.COMMON">
-				<view class="price" v-if="!offPrice">¥{{ info.price }}</view>
+				<view class="price csss" v-if="!offPrice">¥{{ info.price }}</view>
 				<view class="price" v-else></view>
 				<view class="price" v-else></view>
 				<view style="text-align: right" >
 				<view style="text-align: right" >
 					<view class="open-bx" >
 					<view class="open-bx" >
@@ -25,14 +25,17 @@
 				</view>
 				</view>
 			</view>
 			</view>
 			<view class="num-open_bx flex-space" v-if="type == COMMODITY_TYPE.CHANGE">
 			<view class="num-open_bx flex-space" v-if="type == COMMODITY_TYPE.CHANGE">
-				<view class="price" v-if="!offPrice">¥{{ showPrice }}</view>
+				<!--<view class="price" v-if="!offPrice">¥{{ showPrice }}</view>-->
+				<view class="price cs" v-if="!offPrice">¥{{	oldPrice }}</view>
+
 				<view class="price" v-else></view>
 				<view class="price" v-else></view>
 
 
 				<view class="open-bx" style="padding-bottom: 40rpx" >
 				<view class="open-bx" style="padding-bottom: 40rpx" >
-					<allSelectInput :inputType="'digit'" :isActive="isAloneAllActive" :isFocus="isAloneAllFocus" :value="changeAutoPrice" :placeholder="'自动调价'"
-						@deleteInputVal="deleteInputVal" @initAllInput="initAloneAllInput" @moveAllInput="moveAllInput">
-					</allSelectInput>
+					<input class="change-input"  @focus="showPrice = null"  v-model="showPrice" type="digit" placeholder="自动调价"   />
 					<!--<input class="change-input" @tap.stop="" @focus="changeAutoPrice = null" v-model="changeAutoPrice" type="digit" placeholder="自动调价"  selection-start="0" selection-end="1" />-->
 					<!--<input class="change-input" @tap.stop="" @focus="changeAutoPrice = null" v-model="changeAutoPrice" type="digit" placeholder="自动调价"  selection-start="0" selection-end="1" />-->
+					<view style="width: 80rpx;text-align: center;color: red">
+						{{Number(oldPrice)>Number(showPrice)&&Number(showPrice)>0?((Number(showPrice)/Number(oldPrice)).toFixed(2)*10).toFixed(1)+'折':''}}
+					</view>
 					<i :class="isShowSucceed?'position iconfont iconjihuo':'position'" ></i>
 					<i :class="isShowSucceed?'position iconfont iconjihuo':'position'" ></i>
 					<view class="btn-box" @click="changePriceEvent">确定</view>
 					<view class="btn-box" @click="changePriceEvent">确定</view>
 				</view>
 				</view>
@@ -96,6 +99,10 @@ export default {
 			type: Boolean,
 			type: Boolean,
 			default: false
 			default: false
 		},
 		},
+		isAlterPrice: {
+			type: Boolean,
+			default: false
+		},
 	},
 	},
 	data() {
 	data() {
 		return {
 		return {
@@ -109,6 +116,7 @@ export default {
 			isShowSucceed:false,
 			isShowSucceed:false,
 			changeAutoPrice:'',
 			changeAutoPrice:'',
 			showPrice:0.00,
 			showPrice:0.00,
+			oldPrice:0.00,
 			ifFocus:false
 			ifFocus:false
 		};
 		};
 	},
 	},
@@ -118,6 +126,7 @@ export default {
 			this.changeAutoPrice = this.info.price
 			this.changeAutoPrice = this.info.price
 		}
 		}
 		this.showPrice = this.info.price
 		this.showPrice = this.info.price
+		this.oldPrice = (Number(this.info.cost) + Number(this.info.addPrice)).toFixed(2)
 	},
 	},
 	methods: {
 	methods: {
 		//input点击删除按键
 		//input点击删除按键
@@ -174,15 +183,29 @@ export default {
 			this.$emit("del", this.info);
 			this.$emit("del", this.info);
 		},
 		},
 		changePriceEvent(event) {
 		changePriceEvent(event) {
-			console.log('改价',this.changeAutoPrice)
-			this.isFocus = false;
-			this.isAloneAllFocus = false;
+			// console.log('改价',this.changeAutoPrice)
+			changePriceByIdApi({
+				productId: this.info.id,
+				price: this.showPrice
+			}).then(res => {
+				if(res.code == 1){
+					this.showPrice = res.data.price
+					this.isShowSucceed = true
+					setTimeout(()=>{
+						this.isShowSucceed = false
+					},1000)
+				}else{
+					this.$msg(res.msg)
+				}
+			})
+			// this.isFocus = false;
+			// this.isAloneAllFocus = false;
 			this.isAlterMoney = true;
 			this.isAlterMoney = true;
 
 
-			if(uni.getSystemInfoSync().platform=='android'){return};
-			this.$nextTick(()=>{
-				this.moveAllInput(this.changeAutoPrice);
-			})
+			// if(uni.getSystemInfoSync().platform=='android'){return};
+			// this.$nextTick(()=>{
+			// 	this.moveAllInput(this.changeAutoPrice);
+			// })
 
 
 
 
 		},
 		},