فهرست منبع

8.23bug修改

caojunjie 1 سال پیش
والد
کامیت
bb46410dfc
1فایلهای تغییر یافته به همراه109 افزوده شده و 70 حذف شده
  1. 109 70
      pages/device/RepairDetails/RepairDetails.vue

+ 109 - 70
pages/device/RepairDetails/RepairDetails.vue

@@ -148,7 +148,10 @@
 			<view>
 				<view class="kapian" v-for="(item,index) in form.maintenanceFees" :key="item.id">
 					<view class="WXflex">
-						<view class="wxscfun" style="color: #fff; background-color: #FD4B09;" v-if="form.status == 3" @click="kapianClick(item,index)">修改</view>
+						<view></view>
+						<view class="wxscfun" 
+						style="color: #fff; background-color: #FD4B09;" v-if="form.status == 3" 
+						@click="kapianClick(item,index)">修改</view>
 					</view>
 					<view class="repairProject">
 						<view class="wxbox">
@@ -194,10 +197,14 @@
 				<view class="buttonClass" 
 					v-if="form.dispatchingWorkers == 2 && userInfoRoleName.indexOf('admin') != -1"
 				 @click="maintenanceRevokeDispatchingWorkersfun">撤销派工</view>
-				<view class="buttonClass" v-if="form.dispatchingWorkers == 2 && userInfoRoleName.indexOf('维修工') != -1" @click="receivingOrdersfun">确认接单</view>
-				<view class="buttonClass" v-if="form.status == 3 && userInfoRoleName.indexOf('维修工') != -1 && form.dispatchingWorkers == 3" @click="Confirmexpenses">确认费用</view>
-				<view class="buttonClass" v-if="form.status == 4" @click="Revocationfeesfun">撤销费用</view>
-				<view class="buttonClass" v-if="form.status == 4" @click="ConfirmSettlement">确认结算</view>
+				<view class="buttonClass" v-if="form.dispatchingWorkers == 2 && userInfoRoleName.indexOf('维修工') != -1" 
+				@click="modalTitle = '确认接单';modalShow = true">确认接单</view>
+				<view class="buttonClass" v-if="form.status == 3 && userInfoRoleName.indexOf('维修工') != -1 && form.dispatchingWorkers == 3" 
+				@click="Confirmexpenses">确认费用</view>
+				<view class="buttonClass" v-if="form.status == 4"
+				@click="modalTitle = '撤销费用';modalShow = true">撤销费用</view>
+				<view class="buttonClass" v-if="form.status == 4"
+				 @click="modalTitle = '确认结算';modalShow = true">确认结算</view>
 			</view>
 		</view>
 		
@@ -207,6 +214,9 @@
 		<u-toast ref="uToast"></u-toast>
 		<!-- 添加费用弹窗 -->
 		
+		<u-modal :show="modalShow" :title="'是否要' + modalTitle" showCancelButton  cancelText="取消"
+					@confirm="modalConfirm" @cancel="modalShow = false">
+		</u-modal>
 		
 		<!-- <u-popup :show="show" mode="top"  @close="close" @open="open">
 		        <view>
@@ -259,6 +269,9 @@
 	export default {
 		data() {
 			return {
+				modalShow:false,
+				modalTitle:'',
+				
 				id:null,
 				wxStyle: '',
 				gzStyle: '',
@@ -359,6 +372,7 @@
 				
 			},
 			moneyInput(value) {
+				if (!value) return 
 				//正则表达试
 				value = (value.match(/^\d*(\.?\d{0,2})/g)[0]) || null
 				//重新赋值给input
@@ -392,60 +406,103 @@
 				this.kapianShow = false;
 				this.kapian = {}
 				this.form.maintenanceFees.splice(index,1)
-				this.moneyInput()
+				
+				var money = 0
+				for (let fees of this.form.maintenanceFees) {
+					money += Number(fees.amount)
+				}
+				this.form.maintenanceAmount = money;
 			},
 			// 撤销派工
 			maintenanceRevokeDispatchingWorkersfun(){
-				this.overlayShow = true;
-				this.form.maintenanceWorkerId = null
-				this.form.maintenanceWorkerName = null
-				this.form.maintenanceWorkerTel = null
-				maintenanceRevokeDispatchingWorkers(this.form).then(res=>{
-					if (res.code == 200) {
-						this.$refs.uToast.show({
-							type: 'success',
-							message: "撤销派工成功",
-						})
-						this.form = res.data
-						this.wxStyle = ""
-						this.gzStyle = ""
-					}else {
-						this.$refs.uToast.show({
-							type: 'error',
-							message: res.msg,
-						})
-					}
-					
-					this.overlayShow = false;
-				})
+				this.modalTitle = '撤销派工'
+				this.modalShow = true
 			},
 			// 派工
 			maintenanceDispatchingWorkersfun(){
-				this.overlayShow = true;
 				if (!this.form.maintenanceWorkerId) {
-					this.overlayShow = false;
 					return this.$refs.uToast.show({type: 'warning',message: '请选择维修工'})
 				}
 				// if (!this.form.maintenanceWorkerTel) {
 				// 	return this.$refs.uToast.show({type: 'warning',message: '请输入维修工电话'})
 				// }
-				maintenanceDispatchingWorkers(this.form).then(res=>{
-					if (res.code == 200) {
-						this.$refs.uToast.show({
-							type: 'success',
-							message: "派工成功",
-						})
-						this.form = res.data
-						this.tab('wx')
-					}else {
-						this.$refs.uToast.show({
-							type: 'error',
-							message: res.msg,
-						})
-					}
-					
-					this.overlayShow = false;
-				})
+				this.modalTitle = '派工'
+				this.modalShow = true
+				
+			},
+			// 确认派工弹窗
+			modalConfirm(){
+				this.modalShow = false
+				if (this.modalTitle == '派工') {
+					this.overlayShow = true;
+					maintenanceDispatchingWorkers(this.form).then(res=>{
+						if (res.code == 200) {
+							this.$refs.uToast.show({
+								type: 'success',
+								message: "派工成功",
+							})
+							this.form = res.data
+							this.tab('wx')
+						}else {
+							this.$refs.uToast.show({
+								type: 'error',
+								message: res.msg,
+							})
+						}
+						
+						this.overlayShow = false;
+					})
+				}else if (this.modalTitle == '撤销派工') {
+					this.overlayShow = true;
+					this.form.maintenanceWorkerId = null
+					this.form.maintenanceWorkerName = null
+					this.form.maintenanceWorkerTel = null
+					maintenanceRevokeDispatchingWorkers(this.form).then(res=>{
+						if (res.code == 200) {
+							this.$refs.uToast.show({
+								type: 'success',
+								message: "撤销派工成功",
+							})
+							this.form = res.data
+							this.wxStyle = ""
+							this.gzStyle = ""
+						}else {
+							this.$refs.uToast.show({
+								type: 'error',
+								message: res.msg,
+							})
+						}
+						
+						this.overlayShow = false;
+					})
+				}else if (this.modalTitle == '确认接单') {
+					this.receivingOrdersfun()
+				}else if (this.modalTitle == '确认费用') {
+					this.overlayShow = true
+					maintenanceConfirm(this.form).then(res=>{
+						if (res.code == 200) {
+							this.$refs.uToast.show({
+								type: 'success',
+								message: "操作成功",
+							})
+							// uni.navigateBack({
+							// 	delta: 1
+							// });
+							this.form = res.data
+						}else {
+							this.$refs.uToast.show({
+								type: 'error',
+								message: res.msg,
+							})
+						}
+						this.overlayShow = false;
+					})
+				}else if (this.modalTitle == '撤销费用') {
+					this.Revocationfeesfun()
+				}else if (this.modalTitle == '确认结算') {
+					this.ConfirmSettlement()
+				}
+				
 			},
 			// 维修工弹窗开启
 			pickerShowfun(){
@@ -487,28 +544,26 @@
 			},
 			// 确认费用
 			Confirmexpenses(){
-				this.overlayShow = true
 				let a = true
 				if (this.form.maintenanceFees.length <= 0) {
-					this.overlayShow = false;
+					
 					return this.$refs.uToast.show({type: 'warning',message: '请添加维修费用'})
 				}else {
 					this.form.maintenanceFees.map((item,index)=>{
 						if (!item.costName) {
 							this.$refs.uToast.show({type: 'warning',message: `请填写序号${index + 1}的费用名称`})
 							a = false
-							this.overlayShow = false;
+
 							return
 						}
 						if (!item.amount) {
 							this.$refs.uToast.show({type: 'warning',message: `请填写序号${index + 1}的金额`})
 							a = false
-							this.overlayShow = false;
+
 							return
 						}
 					})
 					if (a == false) {
-						this.overlayShow = false;
 						return 
 					} 
 					
@@ -517,24 +572,8 @@
 						this.form.maintenanceFiles[key].sort = key + 1
 					}
 					
-					maintenanceConfirm(this.form).then(res=>{
-						if (res.code == 200) {
-							this.$refs.uToast.show({
-								type: 'success',
-								message: "操作成功",
-							})
-							// uni.navigateBack({
-							// 	delta: 1
-							// });
-							this.form = res.data
-						}else {
-							this.$refs.uToast.show({
-								type: 'error',
-								message: res.msg,
-							})
-						}
-						this.overlayShow = false;
-					})
+					this.modalTitle = '确认费用'
+					this.modalShow = true
 					
 				}