Commit 2023fc1c authored by 高铭波's avatar 高铭波

perf(order):勘查材料金额计算修改

parent 08090899
...@@ -10,14 +10,14 @@ ...@@ -10,14 +10,14 @@
<view class="right-view">{{ orderData.orderBusinessTypeText }}</view> <view class="right-view">{{ orderData.orderBusinessTypeText }}</view>
</view> </view>
<view class="content-view"> <view class="content-view">
<view class="info-view" v-for="(item, key) in infoTexts" :key="key"> <view class="info-view" v-for="(item, key) in infoTexts" :key="key">
<view class="info-title"> <view class="info-title">
<text>{{item.name + ':'}}</text> <text>{{item.name + ':'}}</text>
</view> </view>
<view class="info-content"> <view class="info-content">
<text>{{orderData[key]}}</text> <text>{{orderData[key]}}</text>
<text v-if="item.content">{{' / ' + orderData[item.content]}}</text> <text v-if="item.content">{{' / ' + orderData[item.content]}}</text>
</view> </view>
</view> </view>
<view class="address-view"> <view class="address-view">
<view class="address-left-view"> <view class="address-left-view">
...@@ -31,7 +31,7 @@ ...@@ -31,7 +31,7 @@
</view> </view>
<view class="line-view"></view> <view class="line-view"></view>
<view class="reason-view" v-if="showReason"> <view class="reason-view" v-if="showReason">
<view class="reason-title"><text>未通过原因:</text></view> <view class="reason-title"><text>未通过原因:</text></view>
<view class="reason-text"><text v-for="(item, index) in orderData.auditResults" :key="index">{{item}}</text></view> <view class="reason-text"><text v-for="(item, index) in orderData.auditResults" :key="index">{{item}}</text></view>
</view> </view>
...@@ -53,7 +53,6 @@ ...@@ -53,7 +53,6 @@
</u-button> </u-button>
</view> </view>
</view> </view>
</view>
</template> </template>
<script> <script>
...@@ -79,19 +78,19 @@ ...@@ -79,19 +78,19 @@
auditDatetime: '2021.04.19 12:45:09', // 审核时间 auditDatetime: '2021.04.19 12:45:09', // 审核时间
orderFinishDatetime: '2021.04.19 16:24:48', // 提交时间 orderFinishDatetime: '2021.04.19 16:24:48', // 提交时间
auditResults: {}, // 审核结果 auditResults: {}, // 审核结果
orderBusinessType: 'R', // 业务类型 R 为抢单 orderBusinessType: 'R', // 业务类型 R 为抢单
orderId: '0', // 订单id orderId: '0', // 订单id
} }
} }
}, },
/* 订单类型 /* 订单类型
waitAccept:待接单、 waitAccept:待接单、
waitAppointment:待预约、 waitAppointment:待预约、
waitCheckIn:待签到、 waitCheckIn:待签到、
waitFinish:待完工、 waitFinish:待完工、
audit: 审核中、 audit: 审核中、
exception:异常单、 exception:异常单、
finish:已完工 finish:已完工
*/ */
type: String, type: String,
location: { // 当前坐标 location: { // 当前坐标
...@@ -103,8 +102,8 @@ ...@@ -103,8 +102,8 @@
}, },
data() { data() {
return { return {
timeout: false, timeout: false,
timestamp: 0, timestamp: 0,
}; };
}, },
computed: { computed: {
...@@ -138,7 +137,7 @@ ...@@ -138,7 +137,7 @@
}, },
infoTexts() { infoTexts() {
return { return {
'orderNumber': {name:'工单编号'}, 'orderNumber': {name:'工单编号'},
'partnerCompanyName': {name: '合作厂商'}, 'partnerCompanyName': {name: '合作厂商'},
'contactName': {name: '客户信息', content: 'contactPhone'}, 'contactName': {name: '客户信息', content: 'contactPhone'},
...@@ -182,9 +181,9 @@ ...@@ -182,9 +181,9 @@
}, },
tagText() { tagText() {
return this.timeout ? '超' : '剩' return this.timeout ? '超' : '剩'
}, },
timeText() { timeText() {
let time = this.orderType == 4 ? this.orderData.orderFinishDatetime : this.orderData.auditDatetime let time = this.orderType == 4 ? this.orderData.orderFinishDatetime : this.orderData.auditDatetime
return time ? this.$u.timeFormat(time, 'yyyy.mm.dd hh:MM:ss') : '' return time ? this.$u.timeFormat(time, 'yyyy.mm.dd hh:MM:ss') : ''
}, },
timeTitle() { timeTitle() {
...@@ -193,92 +192,92 @@ ...@@ -193,92 +192,92 @@
showReason() { showReason() {
return this.orderType == 5 return this.orderType == 5
}, },
showDistance() { showDistance() {
return this.orderType == 0 && this.location.length >= 2 && (this.orderData.contactAddressLatitud || this.orderData.contactAddressLongitud) return this.orderType == 0 && this.location.length >= 2 && (this.orderData.contactAddressLatitud || this.orderData.contactAddressLongitud)
}, },
titles() { titles() {
return { return {
'waitAccept': '待' + this.type0Text, // 待接单、 'waitAccept': '待' + this.type0Text, // 待接单、
'waitAppointment': '待预约', // 待预约、 'waitAppointment': '待预约', // 待预约、
'waitCheckIn': '待签到', // 待签到、 'waitCheckIn': '待签到', // 待签到、
'waitFinish': '待完工', // 待完工、 'waitFinish': '待完工', // 待完工、
'audit': '审核中', // 审核中、 'audit': '审核中', // 审核中、
'exception': '异常单', // 异常单、 'exception': '异常单', // 异常单、
'finish': '已完工', //已完工 'finish': '已完工', //已完工
} }
}, },
types() { types() {
return { return {
'waitAccept': 0, // 待接单、 'waitAccept': 0, // 待接单、
'waitAppointment': 1, // 待预约、 'waitAppointment': 1, // 待预约、
'waitCheckIn': 2, // 待签到、 'waitCheckIn': 2, // 待签到、
'waitFinish': 3, // 待完工、 'waitFinish': 3, // 待完工、
'audit': 4, // 审核中、 'audit': 4, // 审核中、
'exception': 5, // 异常单、 'exception': 5, // 异常单、
'finish': 6, //已完工 'finish': 6, //已完工
} }
}, },
title() { title() {
return this.titles[this.type] return this.titles[this.type]
}, },
orderDistance() { orderDistance() {
return this.distance(this.orderData.contactAddressLatitud,this.orderData.contactAddressLongitud, this.location[0], this.location[1]) return this.distance(this.orderData.contactAddressLatitud,this.orderData.contactAddressLongitud, this.location[0], this.location[1])
}, },
/** orderType /** orderType
0 待接单、 0 待接单、
1 待预约、 1 待预约、
2 待签到、 2 待签到、
3 待完工、 3 待完工、
4 审核中、 4 审核中、
5 异常单、 5 异常单、
6 已完工 6 已完工
*/ */
orderType() { orderType() {
/* /*
orderStatus: orderStatus:
待接单 orderStatus<31 工单状态小于31 待接单 orderStatus<31 工单状态小于31
待预约 orderStatus == 31 and appointmentDatetime == null 工单状态等于30并且预约时间为空 待预约 orderStatus == 31 and appointmentDatetime == null 工单状态等于30并且预约时间为空
待签到 orderStatus == 31 and appointmentDatetime is not null 工单状态等于30并且预约时间不为空 待签到 orderStatus == 31 and appointmentDatetime is not null 工单状态等于30并且预约时间不为空
待完工 orderStatus >31 and orderStatus < 80 工单状态大于31 小于80 待完工 orderStatus >31 and orderStatus < 80 工单状态大于31 小于80
审核中 orderStatus ==85 or orderStatus == 87 工单状态 等于85 或者 等于有87 审核中 orderStatus ==85 or orderStatus == 87 工单状态 等于85 或者 等于有87
异常 orderStatus ==86 or orderStatus == 88 工单状态 等于86 或者 等于有88 异常 orderStatus ==86 or orderStatus == 88 工单状态 等于86 或者 等于有88
已完工 orderStatus in(80,81,89,110) 工单状态 等于80 or 81 or 89 or 110 已完工 orderStatus in(80,81,89,110) 工单状态 等于80 or 81 or 89 or 110
*/ */
if (!this.type) { if (!this.type) {
if (this.orderData.orderStatus < 31) { if (this.orderData.orderStatus < 31) {
return 0 return 0
} else if (this.orderData.orderStatus == 31) { } else if (this.orderData.orderStatus == 31) {
if (this.orderData.appointmentDatetime) { if (this.orderData.appointmentDatetime) {
return 2 return 2
} else { } else {
return 1 return 1
} }
} else if (this.orderData.orderStatus > 31 && this.orderData.orderStatus < 80) { } else if (this.orderData.orderStatus > 31 && this.orderData.orderStatus < 80) {
return 3 return 3
} else if (this.orderData.orderStatus == 85 || this.orderData.orderStatus == 87) { } else if (this.orderData.orderStatus == 85 || this.orderData.orderStatus == 87) {
return 4 return 4
} else if (this.orderData.orderStatus == 86 || this.orderData.orderStatus == 88) { } else if (this.orderData.orderStatus == 86 || this.orderData.orderStatus == 88) {
return 5 return 5
} else if ([80, 81, 89, 110].indexOf(this.orderData.orderStatus) != -1) { } else if ([80, 81, 89, 110].indexOf(this.orderData.orderStatus) != -1) {
return 6 return 6
} else { } else {
return 0 return 0
} }
} else { } else {
return this.types[this.type] return this.types[this.type]
} }
} }
},
created() {
this.updateTime()
},
watch:{
'orderData.currentCellTime'(val) {
// 从后台重新获取数据之后,时间重新计算
this.updateTime()
}
}, },
methods: { created() {
this.updateTime()
},
watch:{
'orderData.currentCellTime'(val) {
// 从后台重新获取数据之后,时间重新计算
this.updateTime()
}
},
methods: {
// title:标题,showCountTime:是否显示倒计时。详情页面情况太多,提前传值可以避免页面晃动 // title:标题,showCountTime:是否显示倒计时。详情页面情况太多,提前传值可以避免页面晃动
handleClick() { handleClick() {
// if (this.buttonDisabled) return // if (this.buttonDisabled) return
...@@ -287,14 +286,14 @@ ...@@ -287,14 +286,14 @@
handleClickCell() { handleClickCell() {
this.$emit('click', this.orderData, this.title, this.showCountTime ? 'show' : '') this.$emit('click', this.orderData, this.title, this.showCountTime ? 'show' : '')
}, },
handleChange(timestamp) { handleChange(timestamp) {
if (this.timeout) this.$refs['order-count-down'].seconds += 2 if (this.timeout) this.$refs['order-count-down'].seconds += 2
if (timestamp == 0 && !this.timeout) { // 超时之后倒计时变为正计时 if (timestamp == 0 && !this.timeout) { // 超时之后倒计时变为正计时
setTimeout(()=> { setTimeout(()=> {
this.timestamp = 1 this.timestamp = 1
this.timeout = true this.timeout = true
}, 1000) }, 1000)
} }
}, },
formatAddress(order) { formatAddress(order) {
let address = "" let address = ""
...@@ -307,33 +306,33 @@ ...@@ -307,33 +306,33 @@
} }
return address return address
}, },
/** /**
* echo distance(116.3896,39.91917,116.3940,39.91726); * echo distance(116.3896,39.91917,116.3940,39.91726);
* 计算两点之间直线距离 * 计算两点之间直线距离
* @param float $lon1 经度 * @param float $lon1 经度
* @param float $lat1 维度 * @param float $lat1 维度
* @param float $lon2 经度 * @param float $lon2 经度
* @param float $lat2 维度 * @param float $lat2 维度
* @return float 浮点数 * @return float 浮点数
*/ */
distance(lat1, lng1, lat2, lng2) { distance(lat1, lng1, lat2, lng2) {
var radLat1 = this.Rad(lat1); var radLat1 = this.Rad(lat1);
var radLat2 = this.Rad(lat2); var radLat2 = this.Rad(lat2);
var a = radLat1 - radLat2; var a = radLat1 - radLat2;
var b = this.Rad(lng1) - this.Rad(lng2); var b = this.Rad(lng1) - this.Rad(lng2);
var s = 2 * Math.asin(Math.sqrt(Math.pow(Math.sin(a/2),2) + var s = 2 * Math.asin(Math.sqrt(Math.pow(Math.sin(a/2),2) +
Math.cos(radLat1)*Math.cos(radLat2)*Math.pow(Math.sin(b/2),2))); Math.cos(radLat1)*Math.cos(radLat2)*Math.pow(Math.sin(b/2),2)));
s = s *6378.137 ;// EARTH_RADIUS; s = s *6378.137 ;// EARTH_RADIUS;
s = Math.round(s * 10000)/10000 //输出为米 s = Math.round(s * 10000)/10000 //输出为米
return Number(s?s.toFixed(2):0); return Number(s?s.toFixed(2):0);
}, },
Rad(d){ Rad(d){
return d * Math.PI / 180.0;//经纬度转换成三角函数中度分表形式。 return d * Math.PI / 180.0;//经纬度转换成三角函数中度分表形式。
}, },
updateTime() { updateTime() {
var time = new Date().getTime() var time = new Date().getTime()
this.timeout = this.orderData.currentOverTime < time this.timeout = this.orderData.currentOverTime < time
this.timestamp = Math.round(Math.abs(this.orderData.currentOverTime - time) / 1000) this.timestamp = Math.round(Math.abs(this.orderData.currentOverTime - time) / 1000)
} }
} }
} }
...@@ -357,14 +356,14 @@ ...@@ -357,14 +356,14 @@
display: flex; display: flex;
align-items: center; align-items: center;
.tag-view { .tag-view {
text-align: center; text-align: center;
width: 84rpx; width: 84rpx;
height: 40rpx; height: 40rpx;
color: #FFFFFF; color: #FFFFFF;
border-radius: 8rpx; border-radius: 8rpx;
background-image: linear-gradient(to right, #FF930D, #FFC174); background-image: linear-gradient(to right, #FF930D, #FFC174);
font-size: 22rpx; font-size: 22rpx;
line-height: 42rpx; line-height: 42rpx;
&.active { &.active {
background-image: linear-gradient(to right, #2272FF, #47ABFF); background-image: linear-gradient(to right, #2272FF, #47ABFF);
...@@ -379,7 +378,7 @@ ...@@ -379,7 +378,7 @@
} }
} }
.right-view { .right-view {
text-align: center; text-align: center;
width: 100rpx; width: 100rpx;
height: 40rpx; height: 40rpx;
...@@ -397,15 +396,15 @@ ...@@ -397,15 +396,15 @@
color: #333333; color: #333333;
font-size: 26rpx; font-size: 26rpx;
margin-top: 18rpx; margin-top: 18rpx;
margin-bottom: 18rpx; margin-bottom: 18rpx;
display: flex; display: flex;
align-items: flex-start; align-items: flex-start;
.info-title { .info-title {
flex-shrink: 0; flex-shrink: 0;
} }
.info-content { .info-content {
word-break: break-all; word-break: break-all;
} }
} }
...@@ -421,19 +420,19 @@ ...@@ -421,19 +420,19 @@
display: flex; display: flex;
align-items: center; align-items: center;
align-items: flex-start; align-items: flex-start;
text-align: left; text-align: left;
.address-image { .address-image {
width: 26rpx; width: 26rpx;
height: 28rpx; height: 28rpx;
margin-right: 8rpx; margin-right: 8rpx;
flex-shrink: 0; flex-shrink: 0;
margin-top: 4rpx; margin-top: 4rpx;
} }
} }
.address-right-view { .address-right-view {
margin-left: 30rpx; margin-left: 30rpx;
} }
} }
} }
...@@ -450,16 +449,16 @@ ...@@ -450,16 +449,16 @@
margin-top: 30rpx; margin-top: 30rpx;
font-size: 26rpx; font-size: 26rpx;
color: #FA5A49; color: #FA5A49;
display: flex; display: flex;
align-items: flex-start; align-items: flex-start;
display: flex; display: flex;
.reason-title { .reason-title {
flex-shrink: 0; flex-shrink: 0;
color: #666666; color: #666666;
} }
.reason-text { .reason-text {
display: flex; display: flex;
flex-direction: column; flex-direction: column;
} }
} }
...@@ -473,16 +472,16 @@ ...@@ -473,16 +472,16 @@
display: flex; display: flex;
align-items: center; align-items: center;
.bottom-tag-view { .bottom-tag-view {
width: 52rpx; width: 52rpx;
height: 52rpx; height: 52rpx;
border-radius: 26rpx; border-radius: 26rpx;
color: #FFFFFF; color: #FFFFFF;
font-size: 26rpx; font-size: 26rpx;
background-color: #FF930D; background-color: #FF930D;
margin-right: 16rpx; margin-right: 16rpx;
display: flex; display: flex;
justify-content: center; justify-content: center;
align-items: center; align-items: center;
&.timeout { &.timeout {
...@@ -491,7 +490,6 @@ ...@@ -491,7 +490,6 @@
} }
} }
.right-btn {}
} }
} }
</style> </style>
...@@ -25,7 +25,12 @@ ...@@ -25,7 +25,12 @@
</u-tr> </u-tr>
<view class="line-view"></view> <view class="line-view"></view>
<u-tr class="u-tr" v-for="(item, index) in list" :key="index"> <u-tr class="u-tr" v-for="(item, index) in list" :key="index">
<u-td class="u-td" v-for="(value, key) in titles" :key="key"> <u-td
class="u-td"
v-for="(value, key) in titles"
:key="key"
width="200"
>
<view v-if="key == 'useLength'" class="uselen-input"> <view v-if="key == 'useLength'" class="uselen-input">
<u-input <u-input
@blur="handleBlur(item)" @blur="handleBlur(item)"
...@@ -143,6 +148,15 @@ export default { ...@@ -143,6 +148,15 @@ export default {
useLength: "用量", useLength: "用量",
}; };
}, },
widths() {
return {
matName: 200,
matUnit: "auto",
freeLength: "auto",
unitAmt: "auto",
useLength: "auto",
};
},
thStyle() { thStyle() {
return { return {
"font-weight": "bold", "font-weight": "bold",
...@@ -162,9 +176,9 @@ export default { ...@@ -162,9 +176,9 @@ export default {
var amount = 0; var amount = 0;
for (var item of this.list) { for (var item of this.list) {
if ( if (
Number(item.useLength) && this.$u.test.number(item.useLength) &&
Number(item.freeLength) && this.$u.test.number(item.freeLength) &&
Number(item.unitAmt) this.$u.test.number(item.unitAmt)
) { ) {
amount += amount +=
Math.max(Number(item.useLength) - Number(item.freeLength), 0) * Math.max(Number(item.useLength) - Number(item.freeLength), 0) *
...@@ -197,6 +211,9 @@ export default { ...@@ -197,6 +211,9 @@ export default {
eventChannel.on("showMaterialData", function (data) { eventChannel.on("showMaterialData", function (data) {
if (!data || data.length === 0) { if (!data || data.length === 0) {
self.getMaterialData(); self.getMaterialData();
if (self.$u.test.isEmpty(self.other)) {
self.handleAdd();
}
} else { } else {
self.formatServiceMoreList(data); self.formatServiceMoreList(data);
} }
...@@ -208,7 +225,7 @@ export default { ...@@ -208,7 +225,7 @@ export default {
matName: "开孔厚40cm以上,直径11cm以下", matName: "开孔厚40cm以上,直径11cm以下",
matUnit: "个", matUnit: "个",
freeLength: 0, freeLength: 0,
unitAmt: 0, unitAmt: 10,
useLength: 0, useLength: 0,
}, },
{ {
...@@ -217,7 +234,7 @@ export default { ...@@ -217,7 +234,7 @@ export default {
matName: "验收完成后移动安装地点", matName: "验收完成后移动安装地点",
matUnit: "次", matUnit: "次",
freeLength: 0, freeLength: 0,
unitAmt: 0, unitAmt: 20,
useLength: 0, useLength: 0,
}, },
{ {
...@@ -226,7 +243,7 @@ export default { ...@@ -226,7 +243,7 @@ export default {
matName: "北京地区报装", matName: "北京地区报装",
matUnit: "次", matUnit: "次",
freeLength: 0, freeLength: 0,
unitAmt: 0, unitAmt: 30,
useLength: 0, useLength: 0,
}, },
{ {
...@@ -235,7 +252,7 @@ export default { ...@@ -235,7 +252,7 @@ export default {
matName: "墙面开墙及恢复", matName: "墙面开墙及恢复",
matUnit: "米", matUnit: "米",
freeLength: 0, freeLength: 0,
unitAmt: 0, unitAmt: 40,
useLength: 0, useLength: 0,
}, },
{ {
...@@ -244,7 +261,7 @@ export default { ...@@ -244,7 +261,7 @@ export default {
matName: "安装位置单次往返经销商距离", matName: "安装位置单次往返经销商距离",
matUnit: "千米", matUnit: "千米",
freeLength: 0, freeLength: 0,
unitAmt: 0, unitAmt: 50,
useLength: 0, useLength: 0,
}, },
{ {
...@@ -252,8 +269,8 @@ export default { ...@@ -252,8 +269,8 @@ export default {
priceType: "01", priceType: "01",
matName: "开孔厚40cm以上,直径11cm以下", matName: "开孔厚40cm以上,直径11cm以下",
matUnit: "个", matUnit: "个",
freeLength: 0, freeLength: 1,
unitAmt: 0, unitAmt: 60,
useLength: 0, useLength: 0,
}, },
{ {
...@@ -261,8 +278,8 @@ export default { ...@@ -261,8 +278,8 @@ export default {
priceType: "01", priceType: "01",
matName: "桥架50mm*50mm", matName: "桥架50mm*50mm",
matUnit: "米", matUnit: "米",
freeLength: 0, freeLength: 2,
unitAmt: 0, unitAmt: 70,
useLength: 0, useLength: 0,
}, },
{ {
...@@ -270,7 +287,7 @@ export default { ...@@ -270,7 +287,7 @@ export default {
priceType: "01", priceType: "01",
matName: "铺装庭院开挖(复合材料)", matName: "铺装庭院开挖(复合材料)",
matUnit: "米", matUnit: "米",
freeLength: 0, freeLength: 3,
unitAmt: 220, unitAmt: 220,
useLength: 0, useLength: 0,
}, },
...@@ -334,7 +351,7 @@ export default { ...@@ -334,7 +351,7 @@ export default {
let row = this.list.find((item, index) => { let row = this.list.find((item, index) => {
return item.useLength != 0; return item.useLength != 0;
}); });
if (!this.$u.test.isEmpty(this.list) && this.$u.test.isEmpty(row)) { if (this.$u.test.isEmpty(row)) {
this.$refs.uToast.show({ this.$refs.uToast.show({
title: "请填写电缆、漏保、空开等用量", title: "请填写电缆、漏保、空开等用量",
type: "error", type: "error",
...@@ -351,7 +368,7 @@ export default { ...@@ -351,7 +368,7 @@ export default {
return false; return false;
} }
for (let item of this.other) { for (let item of this.other) {
if (!item.otherExplain) { if (this.other.length > 1 && !item.otherExplain) {
this.$refs.uToast.show({ this.$refs.uToast.show({
title: "请输入其他项说明", title: "请输入其他项说明",
type: "warning", type: "warning",
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment