Browse Source

零售成品和花材开单,增加总金额、实收金额、打折和优惠栏目

jf 5 years ago
parent
commit
4613f0a372

+ 1 - 1
ghsApp/src/admin/billing/affirm.vue

@@ -97,7 +97,7 @@
 
 									<tui-list-cell class="line-cell" :hover="false" :arrow="false" >
 										<view class="tui-title">实收金额</view>
-										<input style="border: 1px solid #eee;color: #3385FF;width: calc(100%);" type="number" v-model="realMoney" placeholder-class="tui-placeholder"/>
+										<input style="border: 1px solid #eee;color: #3385FF;width: calc(100%);" type="number" @focus="realMoney=''" v-model="realMoney" placeholder-class="tui-placeholder"/>
 									</tui-list-cell>
 
 									<tui-list-cell class="line-cell" :hover="false" :arrow="false" >

+ 74 - 4
hdApp/src/admin/billing/affirm.vue

@@ -59,7 +59,7 @@
 					</tui-list-cell>
 					<tui-list-cell class="line-cell" :hover="false" :arrow="false" >
 						<view class="tui-title ">包装费</view>
-						<input type="number" placeholder="请填写人工和材料费" v-model="packingMoney" placeholder-class="tui-placeholder">
+						<input type="number" placeholder="请填写人工和材料费" @input="countAllPrices()" v-model="packingMoney" placeholder-class="tui-placeholder">
 					</tui-list-cell>
 					<tui-list-cell class="line-cell" :hover="false" :arrow="false">
 						<view class="tui-title ">送货</view>
@@ -68,7 +68,7 @@
 					</tui-list-cell>
 					<tui-list-cell v-if="sendType == 0" class="line-cell" :hover="false" :arrow="false" >
 						<view class="tui-title ">运费</view>
-						<input type="number" placeholder="选填" v-model="freight" placeholder-class="tui-placeholder">
+						<input type="number" placeholder="选填" v-model="freight" @input="countAllPrices()" placeholder-class="tui-placeholder">
 					</tui-list-cell>
 					<tui-list-cell class="line-cell" :hover="false" :arrow="false">
 						<view class="tui-title ">结算方式</view>
@@ -78,6 +78,30 @@
 						</button>
 					</tui-list-cell>
 
+					<tui-list-cell class="line-cell" :hover="false" :arrow="false" >
+						<view class="tui-title">总金额</view>
+						<text style="color: #3385FF" >{{	(allPrice+Number(packingMoney)+Number(freight)).toFixed(2)  }}</text>
+					</tui-list-cell>
+
+					<tui-list-cell class="line-cell" :hover="false" :arrow="false" >
+						<view class="tui-title">实收金额</view>
+						<view class="flex-space" style="width: 100%;">
+							<input style="border: 1px solid #eee;color: #3385FF;width: 60%;" type="number" @focus="realMoney='',discountIndex=0" v-model="realMoney" placeholder-class="tui-placeholder"/>
+							<picker style="border: 1px solid #eee;width: 30%;" @change="discountChange" :value="discountIndex" :range="discount">
+								<view class="flex-space">
+									<view class="uni-input">{{discount[discountIndex]}}</view>
+									<i class="iconfont iconxiangyou"></i>
+								</view>
+							</picker>
+						</view>
+						<!--<input style="border: 1px solid #eee;color: #3385FF;width: calc(100%);" type="number" @focus="realMoney=''" v-model="realMoney" placeholder-class="tui-placeholder"/>-->
+					</tui-list-cell>
+
+					<tui-list-cell class="line-cell" :hover="false" :arrow="false" >
+						<view class="tui-title">优惠</view>
+						<text style="color: #3385FF">{{	((allPrice+Number(packingMoney)+Number(freight)).toFixed(2) - realMoney).toFixed(2) }}</text>
+					</tui-list-cell>
+
 
 <!--					<appFormSend :form.sync="form"> </appFormSend>-->
 				</view>
@@ -87,7 +111,8 @@
 			<view class="price-view">
 				<text class="price-title">收款</text>
 				<text class="price-number">
-					¥ <text class="large">{{ allPrice+Number(packingMoney)+Number(freight)  }}</text>
+					<!--¥ <text class="large">{{	(allPrice+Number(packingMoney)+Number(freight)).toFixed(2)  }}</text>-->
+					¥ <text class="large">{{	realMoney }}</text>
 				</text>
 			</view>
 			<button class="admin-button-com blue middle" @click="affirmFormSubmit">开单</button>
@@ -132,10 +157,13 @@ export default {
 			autoLoad: false,
 			packingMoney:'',//包装费
 			freight:'',//运费
+			realMoney:0,//真实金额
 			payType:1,//选中的-支付类型
 			clientInfo: '',//客户信息
 			showCustomer: false,
-			sendType:1
+			sendType:1,
+			discountIndex:0,
+			discount:['未打折','95折','9折','85折','8折','75折','7折','65折','6折']
 		};
 	},
 	onLoad() {
@@ -150,12 +178,53 @@ export default {
 				title: this.getMerchantInfo.name
 			});
 		}
+		this.realMoney = this.allPrice.toFixed(2);
 	},
 	computed: {
 		...mapGetters(["getMerchantInfo", "getLoginInfo","getDictionariesInfo"])
 	},
 	methods: {
 		...mapActions(["initMerchantInfo"]),
+		discountChange(e){
+			this.discountIndex = e.target.value;
+			let discount = 0;
+			let Prices = this.allPrice.toFixed(2)
+			let allPrices = (Number(Prices) + Number(this.freight) + Number(this.packingMoney)).toFixed(2);
+			switch (e.target.value) {
+				case '0':
+					discount = 0
+					break;
+				case '1':
+					discount = (allPrices - (allPrices * 0.95)).toFixed(2);
+					break;
+				case '2':
+					discount = (allPrices - (allPrices * 0.9)).toFixed(2);
+					break;
+				case '3':
+					discount = (allPrices - (allPrices * 0.85)).toFixed(2);
+					break;
+				case '4':
+					discount = (allPrices - (allPrices * 0.8)).toFixed(2);
+					break;
+				case '5':
+					discount = (allPrices - (allPrices * 0.75)).toFixed(2);
+					break;
+				case '6':
+					discount = (allPrices - (allPrices * 0.7)).toFixed(2);
+					break;
+				case '7':
+					discount = (allPrices - (allPrices * 0.65)).toFixed(2);
+					break;
+				case '8':
+					discount = (allPrices - (allPrices * 0.6)).toFixed(2);
+					break;
+			}
+			this.realMoney = (allPrices - discount).toFixed(2);
+		},
+		countAllPrices(){
+			let allPrices = this.allPrice.toFixed(2)
+			this.realMoney = (Number(allPrices) + Number(this.freight) + Number(this.packingMoney)).toFixed(2);
+		},
 		// 选取客户
 		changeCustomerFn(info) {
 			console.log("changeCustomerFn", info);
@@ -176,6 +245,7 @@ export default {
 				customId:this.clientInfo.id,// 客户
 				payWay:this.payType,//付款方式
 				sendType:this.sendType,
+				realPrice: this.realMoney,
 				product:JSON.stringify(product),//下单商品
 			};
 			let self = this;

+ 73 - 6
hdApp/src/admin/billing/affirmGoods.vue

@@ -57,13 +57,13 @@
 
 					<tui-list-cell class="line-cell" :hover="false" :arrow="false">
 						<view class="tui-title ">送货</view>
-						<button @tap="sendType=1" class="admin-button-com mini-btn" :class="sendType==1?'blue':'default'">自取</button>
-						<button @tap="sendType=0" class="admin-button-com mini-btn" :class="sendType==0?'blue':'default'">配送</button>
+						<button @tap="sendType=1,freight=0,countAllPrices()" class="admin-button-com mini-btn" :class="sendType==1?'blue':'default'">自取</button>
+						<button @tap="sendType=0,freight=0" class="admin-button-com mini-btn" :class="sendType==0?'blue':'default'">配送</button>
 					</tui-list-cell>
 
 					<tui-list-cell v-if="sendType == 0" class="line-cell" :hover="false" :arrow="false" >
 						<view class="tui-title ">运费</view>
-						<input type="number" placeholder="留空免运费" v-model="freight" placeholder-class="tui-placeholder">
+						<input type="number" placeholder="留空免运费" v-model="freight" @input="countAllPrices()" placeholder-class="tui-placeholder">
 					</tui-list-cell>
 
 					<tui-list-cell class="line-cell" :hover="false" :arrow="false">
@@ -73,6 +73,28 @@
 							{{ res.name }}
 						</button>
 					</tui-list-cell>
+					<tui-list-cell class="line-cell" :hover="false" :arrow="false" >
+						<view class="tui-title">总金额</view>
+						<text style="color: #3385FF" >{{	(Number(freight)+Number(allGoodsPrice)).toFixed(2)  }}</text>
+					</tui-list-cell>
+
+					<tui-list-cell class="line-cell" :hover="false" :arrow="false" >
+						<view class="tui-title">实收金额</view>
+						<view class="flex-space" style="width: 100%;">
+							<input style="border: 1px solid #eee;color: #3385FF;width: 60%;" type="number" @focus="realMoney='',discountIndex=0" v-model="realMoney" placeholder-class="tui-placeholder"/>
+							<picker style="border: 1px solid #eee;width: 30%;" @change="discountChange" :value="discountIndex" :range="discount">
+								<view class="flex-space">
+									<view class="uni-input">{{discount[discountIndex]}}</view>
+									<i class="iconfont iconxiangyou"></i>
+								</view>
+							</picker>
+						</view>
+					</tui-list-cell>
+
+					<tui-list-cell class="line-cell" :hover="false" :arrow="false" >
+						<view class="tui-title">优惠</view>
+						<text style="color: #3385FF">{{	((Number(freight)+Number(allGoodsPrice)).toFixed(2) - realMoney).toFixed(2) }}</text>
+					</tui-list-cell>
 
 
 <!--					<appFormSend :form.sync="form"> </appFormSend>-->
@@ -83,7 +105,7 @@
 			<view class="price-view">
 				<text class="price-title">收款</text>
 				<text class="price-number">
-					¥ <text class="large">{{ Number(freight)+Number(allGoodsPrice)  }}</text>
+					¥ <text class="large">{{	realMoney  }}</text>
 				</text>
 			</view>
 			<button class="admin-button-com blue middle" @click="affirmFormSubmit">开单</button>
@@ -109,7 +131,7 @@ const formUtil = require("@/utils/formValidation.js");
 import { createOrder,freight } from "@/api/order/index";
 // import { freight } from "@/api/order";
 import { mapActions, mapGetters } from "vuex";
-
+import { copyObject } from "@/utils/util";
 export default {
 	name: "BillingAffirm", // 开单确认
 	components: {
@@ -132,7 +154,10 @@ export default {
 			payType:1,//选中的-支付类型
 			clientInfo: '',//客户信息
 			showCustomer: false,
-			sendType:1
+			realMoney: 0,
+			sendType:1,
+			discountIndex:0,
+			discount:['未打折','95折','9折','85折','8折','75折','7折','65折','6折']
 		};
 	},
 	onLoad() {
@@ -147,6 +172,7 @@ export default {
 				title: this.getMerchantInfo.name
 			});
 		}
+		this.realMoney = this.allGoodsPrice.toFixed(2);
 		setTimeout(()=>{
 			this.payType = this.getDictionariesInfo.htPayWayOption[0].id;
 		},100)
@@ -156,6 +182,46 @@ export default {
 	},
 	methods: {
 		...mapActions(["initMerchantInfo"]),
+		discountChange(e){
+			this.discountIndex = e.target.value;
+			let discount = 0;
+			let allGoodsPrice = this.allGoodsPrice.toFixed(2)
+			let allPrices = (Number(allGoodsPrice) + Number(this.freight)).toFixed(2);
+			switch (e.target.value) {
+				case '0':
+					discount = 0
+				break;
+				case '1':
+					discount = (allPrices - (allPrices * 0.95)).toFixed(2);
+					break;
+				case '2':
+					discount = (allPrices - (allPrices * 0.9)).toFixed(2);
+					break;
+				case '3':
+					discount = (allPrices - (allPrices * 0.85)).toFixed(2);
+					break;
+				case '4':
+					discount = (allPrices - (allPrices * 0.8)).toFixed(2);
+					break;
+				case '5':
+					discount = (allPrices - (allPrices * 0.75)).toFixed(2);
+					break;
+				case '6':
+					discount = (allPrices - (allPrices * 0.7)).toFixed(2);
+					break;
+				case '7':
+					discount = (allPrices - (allPrices * 0.65)).toFixed(2);
+					break;
+				case '8':
+					discount = (allPrices - (allPrices * 0.6)).toFixed(2);
+					break;
+			}
+			this.realMoney = (allPrices - discount).toFixed(2);
+		},
+		countAllPrices(){
+			let allPrices = this.allGoodsPrice.toFixed(2)
+			this.realMoney = (Number(allPrices) + Number(this.freight)).toFixed(2);
+		},
 		// 选取客户
 		changeCustomerFn(info) {
 			console.log("changeCustomerFn", info);
@@ -182,6 +248,7 @@ export default {
 				customId:this.clientInfo.id,// 客户
 				payWay:this.payType,//付款方式
 				sendType:this.sendType,//配送方式 0未知 1自取
+				realPrice: this.realMoney,
 				goodsInfo:JSON.stringify(product),//下单商品
 			};
 			let self = this;