chenrui před 2 roky
rodič
revize
7a9a6f2450
1 změnil soubory, kde provedl 71 přidání a 29 odebrání
  1. 71 29
      pages/sales/billHistoryDetail.vue

+ 71 - 29
pages/sales/billHistoryDetail.vue

@@ -54,7 +54,7 @@
 			<view class="detail_list u-flex">
 				<view class="detail_box">
 					<text>折后:</text>
-					<text>¥{{ billInfo.settleAmount||billInfo.settleAmount ==0? toThousands(billInfo.settleAmount,2):'--' }}</text>
+					<text>¥{{foldAmount}}</text>
 				</view>
 				<view class="detail_box">
 					<text>实收:</text>
@@ -64,10 +64,10 @@
 		</view>
 		<view class="detail_con"><billList ref="billBox" :showCheck="isShowEdit" :list="billArr"  @allChecked="chooseBillList"></billList></view>
 		<view v-if="!isShowEdit">
-		<view class="footer u-flex u-col-bottom u-row-right" v-if="billInfo.billStatus == 'UNSETTLE'&& billArr&&billArr.length!=0">
+		<view class="footer u-flex u-row-center" v-if="billInfo.billStatus == 'UNSETTLE'&& billArr&&billArr.length!=0">
 			<view class="u-flex u-col-center" >
-				<u-button type="warning" shape="circle" @click="openPaymentModal">确认收款</u-button>
-				<u-button type="primary" shape="circle" :loading="btnLoading" @click="submitOrder" style="margin-left:20rpx;" :custom-style="customStyle">再次发送对账单</u-button>
+				<u-button type="primary" shape="circle" :loading="btnLoading" @click="submitOrder" :custom-style="customStyle">再次发送对账单</u-button>
+				<u-button type="warning" shape="circle" style="margin-left:30rpx;width:290rpx;" @click="openPaymentModal">确认收款</u-button>
 			</view>
 		</view>
 		<view class="footer" v-else-if="billInfo.billStatus != 'UNSETTLE'&& billArr&&billArr.length!=0">
@@ -87,21 +87,20 @@
 		</view>
 		<u-modal v-model="modalShow" :show-title="false" :content="modalCon" :show-cancel-button="true" @confirm="handleConfirm"></u-modal>
 		<!-- 确认收款弹窗 -->
-		<u-popup v-model="showPayment" mode="center" :border-radius="20" width="82%">
+		<u-popup v-model="showPayment" mode="center" @close="closePopup" :border-radius="20" width="82%">
 			<view class="slot-content">
-				<view style="padding:50rpx 40rpx 20rpx;">
-					<u-form :model="form" ref="uForm" :label-width="150" :rules="rules" :label-style="{color:'#999'}">
+				<view style="padding:50rpx 30rpx 20rpx;">
+					<u-form :model="form" ref="uForm" :error-type="['message']" :label-width="150" :rules="rules" :label-style="{color:'#999'}">
 						<u-form-item :border-bottom ="false" label="总单数:" prop="num" v-if="billArr">{{billArr.length}}</u-form-item>
 						<u-form-item :border-bottom ="false" label="结算方式:" prop="settleTypeName">
-							<u-input type="text" placeholder="请选择结算方式" :disabled="true" :height="60"  v-model="form.settleTypeName" @click="settleShow = true"/>
-							<u-icon :name="settleShow?'arrow-right':'arrow-down'" color="#e0e0e0" size="26"></u-icon>
+							<u-input type="select" placeholder="请选择结算方式" :height="60"  v-model="form.settleTypeName" @click="settleShow = true"/>
 						</u-form-item>
-						<u-form-item v-if="enableFundAccount" :border-bottom ="false" label="结算账户:" prop="settleAccountName">
-							<u-input type="text" placeholder="请选择结算账户" :disabled="true" :height="60"  v-model="form.settleAccountName" @click="openSettleAccount"/>
-							<u-icon :name="settleAccount?'arrow-right':'arrow-down'" color="#e0e0e0" size="26"></u-icon>
+						<u-form-item v-if="enableFundAccount" style="padding-top:0;" :border-bottom ="false" label="结算账户:" prop="settleAccountName">
+							<u-input type="select" placeholder="请选择结算账户" :height="60"  v-model="form.settleAccountName" @click="openSettleAccount"/>
 						</u-form-item>
-						<u-form-item :border-bottom ="false" label="待收金额:" prop="num">¥{{ billInfo.totalAmount ||billInfo.totalAmount == 0 ? toThousands(billInfo.totalAmount,2):'--' }}</u-form-item>
-						<u-form-item :border-bottom ="false" label="折让金额:" prop="discountAmount"><u-input type="number" placeholder="请输入实际收款金额(最多2位小数)" :border="true" :height="60"  v-model="form.discountAmount"/></u-form-item>
+						<u-form-item :border-bottom ="false" label="待收金额:" prop="num">¥{{dueAmount}}</u-form-item>
+						<u-form-item :border-bottom ="false" label="折让金额:" prop="discountAmount"><u-input type="number" :custom-style="{color:'#ffa500'}" placeholder="请输入折让金额(最多2位小数)" :border="true" :height="60"  v-model="form.discountAmount"/></u-form-item>
+						<view class="tip" v-if="form.discountAmount*1 > settlement*1">折让金额不能大于待收金额,请重新输入</view>
 					</u-form>
 				</view>
 				<view class="costText">实收金额</view>
@@ -165,14 +164,14 @@ export default {
 					{ 
 						required: true, 
 						message: '请选择结算方式', 
-						trigger: 'change',
+						trigger: ['change','blur'],
 					}
 				],
 				settleAccountName:[
 					{ 
 						required: true, 
 						message: '请选择结算账户', 
-						trigger: 'change',
+						trigger: ['change','blur'],
 					}
 				]
 			},
@@ -227,17 +226,19 @@ export default {
 		},
 		settlement() {
 			let totalPrice=this.billInfo.totalAmount?this.billInfo.totalAmount:0;
+			let settleRealAmount = this.billInfo.settleRealAmount?this.billInfo.settleRealAmount:0
 			let discountPrice=this.form.discountAmount?this.form.discountAmount:0
-			let priceNum=totalPrice - discountPrice;
-			const ret = priceNum.toFixed(2)
-			let endPay=Number(totalPrice)>=Number(discountPrice) ? ret : 0
-			this.form.receiptAmount = endPay
-			return endPay
+			let priceNum=totalPrice - discountPrice - settleRealAmount;
+			let endPay=Number(priceNum)>0 ? priceNum : 0
+			const ret = endPay.toFixed(2)
+			this.form.receiptAmount = ret
+			return ret
 		},
+		 // 待收金额
 		dueAmount(){
 			let totalAmount = this.billInfo.totalAmount?this.billInfo.totalAmount:0
 			let settleRealAmount = this.billInfo.settleRealAmount?this.billInfo.settleRealAmount:0
-			let duePrice = totalAmount - settleRealAmount // 待收金额
+			let duePrice = totalAmount - settleRealAmount
 			duePrice=Number(duePrice)>0 ? duePrice : 0
 			const resPrice = duePrice.toFixed(2)
 			return resPrice
@@ -245,6 +246,15 @@ export default {
 		//经销商信息
 		userData() {
 			return this.$store.state.vuex_userData;
+		},
+		// 折后金额
+		foldAmount(){
+			let totalAmount = this.billInfo.totalAmount?this.billInfo.totalAmount:0
+			let discountPrice=this.billInfo.discountAmount?this.billInfo.discountAmount:0
+			let foldPrice = totalAmount - discountPrice 
+			foldPrice=Number(foldPrice)>0 ? foldPrice : 0
+			const newFoldPrice = foldPrice.toFixed(2)
+			return newFoldPrice
 		}
 	},
 	methods: {
@@ -259,9 +269,25 @@ export default {
 					that.$nextTick(() => {
 						that.$refs.billBox.setData(res.data.detailList);
 					});
+					this.isShowEditBtn()
 				}
 			});
 		},
+		//关闭编辑按钮
+		isShowEditBtn(){
+			// #ifdef APP-PLUS
+			let webview = this.$mp.page.$getAppWebview();
+			if(this.billInfo.billStatus != 'UNSETTLE' || !this.billArr || this.showPayment){
+				webview.setTitleNViewButtonStyle(0, {
+						  width:'0px'
+						})
+			}else{
+				webview.setTitleNViewButtonStyle(0, {
+						  width:'60px'
+						})
+			}
+			// #endif
+		},
 		// 关闭弹窗
 		closePopup(){
 			this.form={
@@ -273,6 +299,7 @@ export default {
 				settleAccountName:''
 			}
 			this.showPayment = false
+			this.isShowEditBtn()
 		},
 		// 打开确认收款弹窗
 		openPaymentModal(){
@@ -287,17 +314,16 @@ export default {
 						})
 					}else{
 						// 判断是否显示结算类型
-						if(this.$hasPermissions('M_fundAccountList')&&this.$hasPermissions('B_fundAccountEnable')){
-							queryFunctionState().then(res => {
-							  if (res.status == 200) {
-							    _this.enableFundAccount = res.data.functionEnableFlag == 1
-							  }
-							})
-						}
+						queryFunctionState().then(res => {
+						  if (res.status == 200) {
+						    _this.enableFundAccount = res.data.functionEnableFlag == 1
+						  }
+						})
 						_this.getPayType();
 						_this.showPayment = true
 						_this.form.discountAmount=_this.billInfo.discountAmount
 						_this.$nextTick(()=>{
+							_this.isShowEditBtn();
 							_this.$refs.uForm.setRules(_this.rules);
 						})
 					}
@@ -351,6 +377,13 @@ export default {
 				})
 				return
 			}
+			if(this.accountList && this.accountList.length==0){
+				uni.showToast({
+					title:'结算账户暂时没有数据,请重新选择结算类型',
+					icon:'none'
+				})
+				return
+			}
 			this.settleAccount = true
 		},
 		//结算账户 确定
@@ -386,9 +419,13 @@ export default {
 					let ajaxData=JSON.stringify(_this.form)
 					let newAjaxData = JSON.parse(ajaxData)
 					newAjaxData.verifySn = _this.verifySn
+					newAjaxData.discountAmount = _this.form.discountAmount?_this.form.discountAmount:0
 					delete newAjaxData.settleAccountName
 					settle(newAjaxData).then(result => {
 						if (result && result.status == 200) {
+							uni.showToast({
+								title:result.message
+							});
 							_this.closePopup()
 							_this.loadData({ verifySn: _this.verifySn });
 						}
@@ -590,6 +627,11 @@ export default {
 			line-height: 60rpx;
 			padding-bottom: 30rpx;
 		}
+		.tip {
+			color: #fa3534;
+			font-size: 20rpx;
+			margin-left: 160rpx;
+		}
 }
 
 </style>