shish %!s(int64=4) %!d(string=hai) anos
pai
achega
02b22184ec

+ 54 - 26
ghsApp/src/admin/changePrice/components/Item.vue

@@ -13,11 +13,12 @@
 			<view class="num-open_bx">
 				<view>
 					<view class="open-bx" >
-						还剩 <text style="margin-left:8upx;color:#333333;">{{ parseFloat(info.stock) }}</text>
-						<view class="price-area">
-						<input class="change-input" @click.stop @blur="savePrice"
-						@focus="modifyPrice = ''" placeholder-style="color:#CCCCCC" v-model="modifyPrice" type="digit" placeholder="填价格" />
-						<view v-if="Number(modifyPrice)>0" class="change-text">成本{{parseFloat((Number(modifyPrice)-Number(info.addPrice)).toFixed(2))}} 加价{{parseFloat(info.addPrice)}}</view>
+						<text style="color:#333333;">¥{{ parseFloat(info.skPrice) }}</text>
+						<view class="hd-price-area">
+							<input class="change-input" @click.stop @blur="savePrice" @focus="modifyPrice = ''" placeholder-style="color:#CCCCCC" v-model="modifyPrice" type="digit" placeholder="花店价" />
+						</view>
+						<view class="sk-price-area">
+							<input class="change-input" @click.stop @blur="saveSkPrice" @focus="skModifyPrice = ''" placeholder-style="color:#CCCCCC" v-model="skModifyPrice" type="digit" placeholder="散客价" />
 						</view>
 					</view>
 				</view>
@@ -25,8 +26,7 @@
 		</view>
 	</view>
 	<view class="level-price">
-		<text>散客 ¥{{skPrice}}</text>
-		<text>花店 ¥{{pdPrice}}</text>
+		<text>剩余 {{showStock}}</text>
 	</view>
 </view>
 </template>
@@ -51,37 +51,44 @@ export default {
 	data() {
 		return {
 			modifyPrice:'',
-			skPrice:0,
-			pdPrice:0
+			skModifyPrice:'',
+			showStock:''
 		};
 	},
 	watch: {
 		modifyPrice: {
 			handler(newValue) {
-				this.changeLevelPrice(newValue)			
+				this.skModifyPrice = Number(newValue)+Number(this.info.skMore)
+				this.skModifyPrice = parseFloat(this.skModifyPrice.toFixed(2))
 			}
 		}
 	},
 	mounted(){
-		this.skPrice = parseFloat(this.info.skPrice)
-		this.pdPrice = parseFloat(this.info.price)
+		let info = this.info
+		this.showStock = ''
+		if(Number(info.stock)>1){
+			this.showStock += Math.trunc(info.stock)+info.bigUnit
+		}
+		let decimal = Number(info.stock) - Math.trunc(info.stock)
+		decimal = decimal.toFixed(2)
+		if(decimal > 0){
+			this.showStock += parseFloat((decimal*info.ratio).toFixed(2))+info.smallUnit
+		}
 	},
 	methods: {
 		savePrice() {
-			this.$emit("savePrice",this.modifyPrice,this.info.id);
+			if(Number(this.modifyPrice)>0 && Number(this.skModifyPrice)){
+				this.$emit("savePrice",this.modifyPrice,this.skModifyPrice,this.info.id)
+			}
 		},
-		changeLevelPrice(pdPrice){
-			if(Number(pdPrice) <= 0 ||this.$util.isEmpty(pdPrice)){
-				pdPrice = this.info.price
+		saveSkPrice(){
+			if(Number(this.modifyPrice)>0 && Number(this.skModifyPrice)){
+				this.$emit("savePrice",this.modifyPrice,this.skModifyPrice,this.info.id)
 			}
-			this.pdPrice = parseFloat(pdPrice)
-			let skSub = (this.info.addPrice - this.info.skAddPrice).toFixed(2)
-			this.skPrice = parseFloat((pdPrice - skSub).toFixed(2))
 		}
 	}
 };
 </script>
-
 <style lang="scss" scoped>
 .product{
 	height:230upx;
@@ -89,7 +96,7 @@ export default {
 		display:flex;
 		color:#999999;
 		text-align: right;
-		font-size:22upx;
+		font-size:24upx;
 		justify-content:space-around;
 	}
 }
@@ -147,11 +154,11 @@ export default {
 			overflow: hidden;
 			white-space: nowrap;
 			text-overflow: ellipsis;
-			width:360upx;
+			width:200upx;
 		}
 		& .kc {
 			color:red;
-			font-size: 32upx;
+			font-size: 31upx;
 			padding: 17upx 0 24upx;
 			font-weight: 700;
 		}
@@ -172,10 +179,31 @@ export default {
 				*.warn {
 					color: $redColor;
 				}
-				.price-area{
+				.hd-price-area{
+					width:190upx;
+					position: absolute;
+					top:10upx;
+					right:0upx;
+					.change-input {
+						width: 150upx;
+						height: 60upx;
+						line-height: 60upx;
+						text-align: center;
+						background: #ffffff;
+						border: 1upx solid #b4b4b4;
+						border-radius: 4upx;
+						font-size: 25upx;
+						color:#777777;
+						display:inline-block;
+					}
+					.change-text{
+						font-size:22upx;
+					}
+				}
+				.sk-price-area{
 					width:190upx;
 					position: absolute;
-					top:50upx;
+					top:95upx;
 					right:0upx;
 					.change-input {
 						width: 150upx;
@@ -197,4 +225,4 @@ export default {
 		}
 	}
 }
-</style>
+</style>

+ 2 - 5
ghsApp/src/admin/changePrice/list.vue

@@ -148,9 +148,7 @@ export default {
 					this.$msg(res.msg)					
 				})
 		},
-		savePrice(price,id){
-			console.log('price',price,id)
-
+		savePrice(price,skPrice,id){
 			if(this.priceArr.length > 0){
 				this.priceArr.forEach(function(value,index,array){
 					if(value.id == id){
@@ -158,8 +156,7 @@ export default {
 					}
 				});
 			}
-			this.priceArr.push({id:id,price:price});
-			console.log(this.priceArr,'price')
+			this.priceArr.push({id:id,price:price,skPrice:skPrice})
 		},
 		affirm(val) {
 			if (val.index === 0) {

+ 28 - 40
ghsApp/src/admin/item/detail.vue

@@ -21,13 +21,14 @@
 
         <tui-list-cell class="line-cell" :hover="false">
           <view class="tui-title">花店价</view>
-          <input v-model="form.price" placeholder-class="phcolor" class="tui-input" name="price" @focus="form.price=''" placeholder="请填写售价" maxlength="50" type="digit" />
+          <input v-model="form.price" style="width:140upx;" placeholder-class="phcolor" class="tui-input" name="price" @focus="form.price=''" placeholder="请填写" type="digit" />
+          <text style="color:#666666;margin-right:20upx;">散客比花店贵:</text>
+          <input v-model="form.price" style="width:110upx;" placeholder-class="phcolor" class="tui-input" name="skMore" @focus="form.skMore=''" placeholder="请填写" type="digit" />
         </tui-list-cell>
 
         <tui-list-cell class="line-cell" :hover="false">
-          <view class="tui-title">今日特价</view>
-          <input v-model="form.discountPrice" style="width:300upx;" placeholder-class="phcolor" class="tui-input" name="discountPrice" @focus="form.discountPrice=''" placeholder="不做特价填0" maxlength="50" type="digit" />
-          <button v-if="productData.id > 0" class="admin-button-com blue middle" @click="printLabel(productData)">打标签</button>
+          <view class="tui-title">花店今日特价</view>
+          <input v-model="form.discountPrice" placeholder-class="phcolor" class="tui-input" name="discountPrice" @focus="form.discountPrice=''" placeholder="不做特价填0" maxlength="50" type="digit" />
         </tui-list-cell>
 
         <tui-list-cell class="line-cell" :hover="false">
@@ -50,23 +51,6 @@
             <view class="tui-placeholder" style="height:45upx;" v-else>请选择</view>
           </picker>
         </tui-list-cell>
-
-        <tui-list-cell class="line-cell" :hover="false">
-          <view class="tui-title">散客加价</view>
-          <input v-model="form.skAddPrice" placeholder-class="phcolor" class="tui-input" style="width:130upx;" name="skAddPrice" @focus="form.skAddPrice=''" placeholder="请填写" maxlength="50" type="digit" />
-          <text style="color:#CCCCCC;">
-            <text style="width:170upx;display:inline-block;">成本 ¥{{parseFloat(cost)}}</text>
-            <text style="width:170upx;display:inline-block;">售价 ¥{{skSellPrice}}</text>
-          </text>
-        </tui-list-cell>
-        <tui-list-cell class="line-cell" :hover="false">
-          <view class="tui-title">花店加价</view>
-          <input v-model="form.addPrice" placeholder-class="phcolor" class="tui-input" style="width:130upx;" name="addPrice" @focus="form.addPrice=''" placeholder="请填写" maxlength="50" type="digit" />
-          <text style="color:#CCCCCC;">
-            <text style="width:170upx;display:inline-block;">成本 ¥{{parseFloat(cost)}}</text>
-            <text style="width:170upx;display:inline-block;">售价 ¥{{sellPrice}}</text>
-          </text>
-        </tui-list-cell>
         <tui-list-cell class="line-cell" :arrow="false">
           <view class="tui-title">大单位</view>
           <input v-model="form.bigUnitId" name="bigUnitId" type="text" hidden />
@@ -93,7 +77,17 @@
 
         <tui-list-cell class="line-cell" :hover="false">
           <view class="tui-title">库存预警值</view>
-          <input v-model="form.stockWarning" @focus="form.stockWarning=''" placeholder-class="phcolor" class="tui-input" name="stockWarning" placeholder="请填写" maxlength="50" type="number" />
+          <input v-model="form.stockWarning" style="width:300upx;" @focus="form.stockWarning=''" placeholder-class="phcolor" class="tui-input" name="stockWarning" placeholder="请填写" maxlength="50" type="number" />
+          <button v-if="productData.id > 0" class="admin-button-com blue middle" @click="printLabel(productData)">打标签</button>
+        </tui-list-cell>
+
+        <tui-list-cell class="line-cell" :hover="false">
+          <view class="tui-title">花店加价</view>
+          <input v-model="form.addPrice" placeholder-class="phcolor" class="tui-input" style="width:130upx;" name="addPrice" @focus="form.addPrice=''" placeholder="请填写" maxlength="50" type="digit" />
+          <text style="color:#CCCCCC;">
+            <text style="width:170upx;display:inline-block;">成本 ¥{{parseFloat(cost)}}</text>
+            <text style="width:170upx;display:inline-block;">售价 ¥{{sellPrice}}</text>
+          </text>
         </tui-list-cell>
 
         <tui-list-cell class="line-cell" :hover="false">
@@ -169,9 +163,9 @@ export default {
         smallUnitId:2,
         classId:'',
         price:'',
-        skAddPrice:'',
         addPrice:'',
         discountPrice:'',
+        skMore:'',
         weight:'',
         cover:[],
         stockWarning:'',
@@ -205,11 +199,6 @@ export default {
       let price = Number(this.cost) + Number(this.form.addPrice)
       price = parseFloat(price.toFixed(2))
       return price
-    },
-    skSellPrice(){
-      let price = Number(this.cost) + Number(this.form.skAddPrice)
-      price = parseFloat(price.toFixed(2))
-      return price
     }
 	},
   onLoad(option) {
@@ -307,10 +296,9 @@ export default {
         this.form.delStatus = 0
         this.form.id = 0
         this.form.price = ''
-        this.form.skAddPrice =''
         this.form.addPrice =''
         this.form.discountPrice = ''
-
+        this.form.skMore = ''
         this.cost = res.data.cost || 0
       })
     },
@@ -414,15 +402,15 @@ export default {
 					return;
 				}
 				if(/(^[1-9]([0-9]+)?(\.[0-9]{1,2})?$)|(^(0){1}$)|(^[0-9]\.[0-9]([0-9])?$)/.test(this.form.price) == false){
-					uni.showToast({title:"请填写价",icon:"none"})
+					uni.showToast({title:"请填写花店价",icon:"none"})
 					return;
 				}
-				if(/(^[1-9]([0-9]+)?(\.[0-9]{1,2})?$)|(^(0){1}$)|(^[0-9]\.[0-9]([0-9])?$)/.test(this.form.skAddPrice) == false){
-					uni.showToast({title:"请填写散客加价",icon:"none"})
+				if(/(^[1-9]([0-9]+)?(\.[0-9]{1,2})?$)|(^(0){1}$)|(^[0-9]\.[0-9]([0-9])?$)/.test(this.form.addPrice) == false){
+					uni.showToast({title:"请填写花店加价",icon:"none"})
 					return;
 				}
-				if(/(^[1-9]([0-9]+)?(\.[0-9]{1,2})?$)|(^(0){1}$)|(^[0-9]\.[0-9]([0-9])?$)/.test(this.form.addPrice) == false){
-					uni.showToast({title:"请填写普店加价",icon:"none"})
+				if(/(^[1-9]([0-9]+)?(\.[0-9]{1,2})?$)|(^(0){1}$)|(^[0-9]\.[0-9]([0-9])?$)/.test(this.form.skMore) == false){
+					uni.showToast({title:"请填写散客比花店贵多少",icon:"none"})
 					return;
 				}
       }
@@ -489,11 +477,6 @@ export default {
           rule: ["required"],
           msg: ["请填写售价"]
         },
-        {
-          name: "skAddPrice",
-          rule: ["required"],
-          msg: ["请填写散客加价"]
-        },
         {
           name: "addPrice",
           rule: ["required"],
@@ -504,6 +487,11 @@ export default {
           rule: ["required"],
           msg: ["不做特价请填0"]
         },
+        {
+          name: "skMore",
+          rule: ["required"],
+          msg: ["请填写散客比花店贵多少"]
+        },
         {
           name: "weight",
           rule: ["required"],