Commit 8b82441a authored by Facius's avatar Facius

订单cell

parent d54b4e03
<template> <template>
<view class="order-view" @click="handleClickCell"> <view class="order-view" @click="handleClickCell">
<view class="top"> <view class="order-top-view">
<view class="left"> <view class="left-view">
<view class="tag">{{ orderData.orderServiceType }}</view> <view :class="['tag-view', {'active': orderData.orderServiceType == '安装'}]">
<view class="store">{{ orderData.categoryName }}</view> {{ orderData.orderServiceType }}</view>
<view>{{ orderData.orderNumber }}</view> <view class="store-view">{{ orderData.categoryName }}</view>
</view>
<view class="right">{{ orderData.orderBusinessTypeText }}</view>
</view>
<view class="content">
<view class="title u-line-2">
<text>{{orderData.contactName }}</text> <text
style="margin-left: 8rpx;">{{ orderData.contactPhone }}</text>
</view> </view>
<view class="right-view">{{ orderData.orderBusinessTypeText }}</view>
</view> </view>
<view class="address u-line-2"> <view class="content-view">
<view class="left"> <view class="info-view" v-for="(item, key) in infoTexts" :key="key">
<view> <text>{{item}}:</text>
<u-icon name="map" size="32"></u-icon> <text>{{orderData[key]}}</text>
<text style="margin-left: 8rpx;">{{orderData.contactAddress }}</text>
</view>
</view> </view>
<view class="right">{{getDistance(orderData.contactAddressLatitud,orderData.contactAddressLongitud)}}km <view class="address-view">
<view class="address-left-view">
<image class="address-image" :src="dizhiImage"></image>
<text>{{orderData.contactAddress }}</text>
</view class="address-right-view">
<view>{{getDistance(orderData.contactAddressLatitud,orderData.contactAddressLongitud)}}km</view>
</view> </view>
</view> </view>
...@@ -33,7 +30,7 @@ ...@@ -33,7 +30,7 @@
<view class="tag">剩</view> <view class="tag">剩</view>
<u-count-down :timestamp="timestamp" font-size="44" color="#FF930D"></u-count-down> <u-count-down :timestamp="timestamp" font-size="44" color="#FF930D"></u-count-down>
</view> </view>
<u-button class="right-btn" @click.stop="handleClick"> <u-button class="right-btn" @click.stop="handleClick" :custom-style="buttonStyle">
{{orderText}} {{orderText}}
</u-button> </u-button>
</view> </view>
...@@ -52,7 +49,9 @@ ...@@ -52,7 +49,9 @@
orderNumber: 'OR2021041809827', // 工单编号 orderNumber: 'OR2021041809827', // 工单编号
contactName: '郭小清', // 客户信息 contactName: '郭小清', // 客户信息
contactPhone: '13631612077', // 联系方式 contactPhone: '13631612077', // 联系方式
contactAddress: '湾街道荔枝花园D座125号', // 详细地址 contactAddress: '湾街道荔枝花园D座125号', // 详细地址
contactAddressLatitud: '116.3896', // 联系人地址经度
contactAddressLongitud: '39.91917', // 联系人地址纬度
orderStatus: '0', // 工单状态 orderStatus: '0', // 工单状态
appointmentDatetime: '' // 预约时间 appointmentDatetime: '' // 预约时间
} }
...@@ -93,26 +92,39 @@ ...@@ -93,26 +92,39 @@
this.orderType = 5 this.orderType = 5
} else if ([80, 81, 89, 110].indexOf(this.orderData.orderStatus) != -1) { } else if ([80, 81, 89, 110].indexOf(this.orderData.orderStatus) != -1) {
this.orderType = 6 this.orderType = 6
} else {
this.orderType = 0
} }
} }
return this.typeTexts[this.orderType] return this.typeTexts[this.orderType]
}, },
buttonStyle() { // 按钮样式 buttonStyle() { // 按钮样式
switch (this.status) { switch (this.status) {
case 0: case 0:
if (this.orderData.currentWillOverTime) { if (this.orderData.currentWillOverTime) {
return this.buttonStyle[0] return this.buttonStyle[0]
} else { } else {
return this.buttonStyle[1] return this.buttonStyle[1]
} }
case 1: case 2: case 3: case 5: case 1:
return this.buttonStyle[0] case 2:
case 4: case 6: case 3:
return this.buttonStyle[2] case 5:
} return this.buttonStyle[0]
case 4:
case 6:
return this.buttonStyle[2]
}
},
infoTexts() {
return {
'orderNumber': '工单编号',
'contactName': '客户信息',
'contactPhone': '联系方式'
}
}, },
typeTexts() { typeTexts() {
return [type0Text, '去预约', '去签到', '去完工', '审核中', '去处理', '已完工'] return [this.type0Text, '去预约', '去签到', '去完工', '审核中', '去处理', '已完工']
}, },
type0Text() { type0Text() {
return this.orderData.currentWillOverTime ? '接单' : '抢单' return this.orderData.currentWillOverTime ? '接单' : '抢单'
...@@ -128,19 +140,46 @@ ...@@ -128,19 +140,46 @@
'background-color': 'transparent', 'background-color': 'transparent',
'color': '#2272FF' 'color': '#2272FF'
}] }]
}, },
buttonDisabled() { buttonDisabled() {
return this.orderData.orderStatus == 4 || this.orderData.orderStatus == 6 return this.orderData.orderStatus == 4 || this.orderData.orderStatus == 6
} },
}, dizhiImage() {
methods: { return process.uniEnv.qn_base_url + 'dizhi.png'
handleClick() { },
if (buttonDisabled) return },
this.$emit('action') methods: {
}, handleClick() {
actionClick() { if (buttonDisabled) return
this.$emit('click') this.$emit('action')
} },
actionClick() {
this.$emit('click')
},
getDistance(Latitud, Longitud) {
return this.distance(Latitud, Longitud, this.dataValue[0], this.dataValue[1])
},
/**
* echo distance(116.3896,39.91917,116.3940,39.91726);
* 计算两点之间直线距离
* @param float $lon1 经度
* @param float $lat1 维度
* @param float $lon2 经度
* @param float $lat2 维度
* @return float 浮点数
*/
distance(la1, lo1, la2, lo2) {
var La1 = la1 * Math.PI / 180.0;
var La2 = la2 * Math.PI / 180.0;
var La3 = La1 - La2;
var Lb3 = lo1 * Math.PI / 180.0 - lo2 * Math.PI / 180.0;
var s = 2 * Math.asin(Math.sqrt(Math.pow(Math.sin(La3 / 2), 2), Math.cos(La1) * Math.cos(La2) * Math.pow(
Math.sin(Lb3 / 2), 2)));
s = s * 6378.137; //地球半径
s = Math.round(s * 10000) / 10000;
// console.log("计算结果",s,'KM');
return s ? s.toFixed(2) : 0;
},
} }
} }
</script> </script>
...@@ -148,6 +187,78 @@ ...@@ -148,6 +187,78 @@
<style lang="scss" scoped> <style lang="scss" scoped>
.order-view { .order-view {
width: 100%; width: 100%;
height: 200rpx; background-color: #FFFFFF;
border-radius: 12rpx;
padding: 30rpx;
.order-top-view {
display: flex;
align-items: center;
justify-content: space-between;
.left-view {
display: flex;
align-items: center;
.tag-view {
width: 84rpx;
height: 40rpx;
color: #FFFFFF;
border-radius: 8rpx;
background-image: linear-gradient(to right, #FF930D, #FFC174);
&.active {
background-image: linear-gradient(to right, #2272FF, #47ABFF);
}
}
.store-view {
color: #333333;
font-size: 36rpx;
font-weight: bold;
margin-left: 20rpx;
}
}
.right-view {
width: 100rpx;
height: 40rpx;
background-color: #F4F5F7;
border-radius: 20rpx;
color: #333333;
font-size: 22rpx;
line-height: 40rpx;
}
}
.content-view {
.info-view {
text-align: left;
margin-top: 20rpx;
color: #333333;
font-size: 26rpx;
}
.address-view {
display: flex;
align-items: center;
justify-content: space-between;
color: #333333;
font-size: 24rpx;
.address-left-view {
display: flex;
align-items: center;
.address-image {
width: 24rpx;
height: 24rpx;
margin-right: 8rpx;
}
}
.address-right-view {}
}
}
} }
</style> </style>
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