Commit cf273f90 authored by Facius's avatar Facius

详情页面的详情部分单独做成组件

parent 6d672f5d
<template> <template>
<view class="card base-item"> <view class="card base-item">
<view class="top-item"> <view class="top-item">
<view class="left"> <view class="left">
<view :class="['tag', {'active': order.orderServiceType == '安装'}]">{{ order.orderServiceType }}</view> <view :class="['tag', {'active': order.orderServiceType == '安装'}]">{{ order.orderServiceType }}</view>
<text class="title">{{ order.categoryName }}</text> <text class="title">{{ order.categoryName }}</text>
</view> </view>
<view class="right">{{ order.orderBusinessTypeText }}</view> <view class="right">{{ order.orderBusinessTypeText }}</view>
</view> </view>
<view class="order-cell"> <view class="order-cell">
<text>工单编号:</text> <text>工单编号:</text>
<text>{{ order.orderNumber }}</text> <text>{{ order.orderNumber }}</text>
</view> </view>
<view class="order-cell"> <view class="order-cell">
<text>合作厂商:</text> <text>合作厂商:</text>
<text>{{ order.partnerCompanyName }}</text> <text>{{ order.partnerCompanyName }}</text>
</view> </view>
<view class="order-cell between-cell"> <view class="order-cell between-cell">
<view class="left"> <view class="left">
<text>客户信息:</text> <text>客户信息:</text>
<text>{{ order.contactName }}</text> <text>{{ order.contactName }}</text>
</view> </view>
<image style="width: 84rpx;height: 56rpx;" :src="phoneIcon" @click="phoneToCustomer(order.contactPhone)" ></image> <image style="width: 84rpx;height: 56rpx;" :src="phoneIcon" @click="phoneToCustomer(order.contactPhone)">
</view> </image>
<view class="order-cell"> </view>
<text>联系方式:</text> <view class="order-cell">
<text>{{ order.contactPhone }}</text> <text>联系方式:</text>
</view> <text>{{ order.contactPhone }}</text>
<view class="between-cell address-cell"> </view>
<view class="left-address"> <view class="between-cell address-cell">
<u-icon name="map" size="28"></u-icon> <view class="left-address">
<text class="address-txt">{{ formatAddress }}</text> <u-icon name="map" size="28"></u-icon>
</view> <text class="address-txt">{{ formatAddress }}</text>
<image style="width: 84rpx;height: 56rpx;" :src="navigationIcon" @click="openLocation(order.contactAddress)"></image> </view>
</view> <image style="width: 84rpx;height: 56rpx;" :src="navigationIcon"
<!-- <u-read-more ref="uReadMore" :show-height="40" :shadowStyle="{paddingTop: '0rpx',marginTop: '0rpx'}" close-text="查看更多" open-text="点击收起" toggle color="#2272FF" font-size="26"> --> @click="openLocation(order.contactAddress)"></image>
<view v-if="readMore" @click="$emit('update:readMore', true)" class="read-more-toggle"> </view>
<u-icon name="arrow-down"></u-icon> <view v-if="readMore" @click="handleClick(false)" class="read-more-toggle">
<text class="read-more-text">查看更多</text> <u-icon name="arrow-down"></u-icon>
</view> <text class="read-more-text">查看更多</text>
<view v-else class="order-item-more"> </view>
<view class="line-view"></view> <view v-else class="order-item-more">
<view class="order-cell between-cell"> <view class="line-view"></view>
<text class="cell-title">品牌:</text> <view class="order-cell between-cell">
<text>{{ order.brandName }}</text> <text class="cell-title">品牌:</text>
</view> <text>{{ order.brandName }}</text>
<view class="order-cell between-cell"> </view>
<text class="cell-title">数量:</text> <view class="order-cell between-cell">
<text>x{{ order.orderProductCount }}</text> <text class="cell-title">数量:</text>
</view> <text>x{{ order.orderProductCount }}</text>
<view class="order-cell between-cell"> </view>
<text class="cell-title">充电桩信息:</text> <view class="order-cell between-cell">
<text>{{ order.serviceContent }}</text> <text class="cell-title">充电桩信息:</text>
</view> <text>{{ order.serviceContent }}</text>
<view class="read-more-toggle" @click="$emit('update:readMore', true)"> </view>
<u-icon name="arrow-up"></u-icon> <view class="read-more-toggle" @click="handleClick(true)">
<text class="read-more-text">点击收起</text> <u-icon name="arrow-up"></u-icon>
</view> <text class="read-more-text">点击收起</text>
</view> </view>
</view> </view>
</template> </view>
</template>
<script>
export default { <script>
props: { export default {
// 履约记录 props: {
order: { // 履约记录
type: Object, order: {
default () { type: Object,
return {} default () {
} return {}
}, }
readMore: { },
type:Boolean, readMore: {
default: true type: Boolean,
} default: true
}, }
data() { },
return { data() {
return {}
} },
}, computed: {
computed: { formatAddress() {
formatAddress() { let self = this
let self = this let address = ""
let address = "" if (self.order) {
if(self.order) { address = self.order.contactProvinceText || ""
address = self.order.contactProvinceText || "" address += self.order.contactCityText || ""
address += self.order.contactCityText || "" address += self.order.contactCommunityText || ""
address += self.order.contactCommunityText || "" address += self.order.contactStreetText || ""
address += self.order.contactStreetText || "" address += self.order.contactAddress || ""
address += self.order.contactAddress || "" }
} return address
return address },
} phoneIcon() {
}, //self-support/icon/dianhua-0@2x.png
methods: { if (this.isAllowDianhuaAndDaohang) {
openLocation(address){ return process.uniEnv.qn_base_url + 'dianhua.png'
if(this.isAllowDianhuaAndDaohang){ } else {
const latitude = this.order.contactAddressLatitud //res.latitude; return process.uniEnv.qn_base_url + 'dianhua-d.png'
const longitude =this.order.contactAddressLongitud //res.longitude; }
uni.openLocation({ },
latitude: Number(latitude), navigationIcon() {
longitude: Number(longitude), //self-support/icon/daohang-0@2x.png
success: function () { if (this.isAllowDianhuaAndDaohang) {
console.log('success'); return process.uniEnv.qn_base_url + 'daohang.png'
} } else {
}); return process.uniEnv.qn_base_url + 'daohang-d.png'
} }
}, },
phoneToCustomer(phone){ // 联系客户 },
if(this.isAllowDianhuaAndDaohang){ methods: {
uni.makePhoneCall({ openLocation(address) {
phoneNumber: phone ,//仅为示例 if (this.isAllowDianhuaAndDaohang) {
complete() { const latitude = this.order.contactAddressLatitud //res.latitude;
} const longitude = this.order.contactAddressLongitud //res.longitude;
}); uni.openLocation({
this.contactTime() latitude: Number(latitude),
} longitude: Number(longitude),
}, success: function() {
contactTime() { console.log('success');
let self = this }
var data={} });
if(this.submitType === "workerAppointment"){ }
self.$u.api.contactTime(data,this.order.orderId) },
} phoneToCustomer(phone) { // 联系客户
}, if (this.isAllowDianhuaAndDaohang) {
} uni.makePhoneCall({
phoneNumber: phone, //仅为示例
complete() {}
});
this.contactTime()
}
},
contactTime() {
let self = this
var data = {}
if (this.submitType === "workerAppointment") {
self.$u.api.contactTime(data, this.order.orderId)
}
},
handleClick(val) {
this.$emit('update:readMore', val)
}
}
}
</script>
<style lang="scss" scoped>
.base-item {
padding-bottom: 6rpx;
background-color: #FFFFFF;
margin-bottom: 20rpx;
padding: 30rpx 30rpx 0 30rpx;
border-radius: 6px;
.top-item {
display: flex;
justify-content: space-between;
margin-bottom: 30rpx;
.left {
display: flex;
align-items: center;
.tag {
text-align: center;
width: 84rpx;
height: 40rpx;
border-radius: 8rpx;
font-size: 22rpx;
font-weight: 500;
color: #FFFFFF;
line-height: 40rpx;
background-image: linear-gradient(to right, #FF930D, #FFC174);
&.active {
background-image: linear-gradient(to right, #2272FF, #47ABFF);
}
}
.title {
margin-left: 20rpx;
height: 36rpx;
font-size: 36rpx;
font-weight: bold;
color: #333333;
line-height: 36rpx;
}
}
.right {
text-align: center;
width: 100rpx;
height: 40rpx;
background: #F4F5F7;
border-radius: 22rpx;
font-size: 22rpx;
font-weight: 400;
color: #333333;
line-height: 40rpx;
}
}
.address-cell {
font-size: 24rpx;
font-weight: 400;
color: #333333;
line-height: 24rpx;
margin-top: 20rpx;
margin-bottom: 40rpx;
display: flex;
justify-content: space-between;
align-items: center;
.left-address {
display: flex;
align-items: flex-start;
.address-txt {
line-height: 30rpx;
margin-left: 8rpx;
margin-right: 30rpx;
}
}
}
}
.read-more-toggle {
text-align: center;
color: #2272FF;
font-size: 26rpx;
margin-top: 30rpx;
padding-bottom: 30rpx;
}
.read-more-text {
padding-left: 8rpx;
}
.order-item-more {
font-size: 26rpx;
color: #333333;
text-align: right;
.line-view {
background-color: #F4F5F7;
height: 2rpx;
margin-bottom: 20rpx;
}
} }
</script> .order-cell {
<style lang="scss" scoped>
.card {
background-color: #FFFFFF;
margin-bottom: 20rpx;
padding: 30rpx 30rpx 0 30rpx;
border-radius: 6px;
}
.base-item {
padding-bottom: 6rpx;
.top-item {
display: flex;
justify-content: space-between;
margin-bottom: 30rpx;
.left {
display: flex;
align-items: center;
.tag {
text-align: center;
width: 84rpx;
height: 40rpx;
border-radius: 8rpx;
font-size: 22rpx;
font-weight: 500;
color: #FFFFFF;
line-height: 40rpx;
background-image: linear-gradient(to right, #FF930D, #FFC174);
&.active {
background-image: linear-gradient(to right, #2272FF, #47ABFF);
}
}
.title {
margin-left: 20rpx;
height: 36rpx;
font-size: 36rpx;
font-weight: bold;
color: #333333;
line-height: 36rpx;
}
}
.right {
text-align: center;
width: 100rpx;
height: 40rpx;
background: #F4F5F7;
border-radius: 22rpx;
font-size: 22rpx;
font-weight: 400;
color: #333333;
line-height: 40rpx;
}
}
.address-cell {
font-size: 24rpx;
font-weight: 400;
color: #333333;
line-height: 24rpx;
margin-top: 20rpx;
margin-bottom: 40rpx;
display: flex;
justify-content: space-between;
align-items: center;
.left-address {
display: flex;
align-items: flex-start;
.address-txt {
line-height: 30rpx;
margin-left: 8rpx;
margin-right: 30rpx;
}
}
}
}
.read-more-toggle {
text-align: center;
color: #2272FF;
font-size: 26rpx; font-size: 26rpx;
margin-top: 30rpx; font-weight: 400;
padding-bottom: 30rpx; color: #333333;
} line-height: 48rpx;
margin-bottom: 10rpx;
.read-more-text {
padding-left: 8rpx;
} }
.order-item-more { .between-cell {
font-size: 26rpx; display: flex;
color: #333333; justify-content: space-between;
text-align: right; align-items: center;
.line-view { }
background-color: #F4F5F7; .display-cell {
height: 2rpx; display: flex;
margin-bottom: 20rpx;
}
} }
.cell-title {
text-align: left;
flex-shrink: 0;
}
</style> </style>
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
</view> </view>
<view class="content"> <view class="content">
<view class="card base-item"> <view class="card base-item">
<Detail :order="order"></Detail> <Detail :order="order" :readMore.sync="readMore"></Detail>
</view> </view>
<!-- 从我的页面进来显示计算信息 --> <!-- 从我的页面进来显示计算信息 -->
<view v-if="isFromMine" class="settlement-view"> <view v-if="isFromMine" class="settlement-view">
...@@ -32,7 +32,7 @@ ...@@ -32,7 +32,7 @@
<appoint-time :dateList="dateList" :timeList="timeList" @dateChange="dateChange" @timeChange="timeChange" @weekChange="weekChange"></appoint-time> <appoint-time :dateList="dateList" :timeList="timeList" @dateChange="dateChange" @timeChange="timeChange" @weekChange="weekChange"></appoint-time>
</view> </view>
<view class="card record-item"> <view class="card record-item">
<Record :orderRecords="orderRecords" :readMore.sync="readMore"></Record> <Record :orderRecords="orderRecords"></Record>
</view> </view>
</view> </view>
</view> </view>
...@@ -207,23 +207,6 @@ ...@@ -207,23 +207,6 @@
this.closeLocationChange() this.closeLocationChange()
}, },
computed: { computed: {
phoneIcon() {
//self-support/icon/dianhua-0@2x.png
if(this.isAllowDianhuaAndDaohang){
return process.uniEnv.qn_base_url + 'dianhua.png'
}else{
return process.uniEnv.qn_base_url + 'dianhua-d.png'
}
},
navigationIcon() {
//self-support/icon/daohang-0@2x.png
if(this.isAllowDianhuaAndDaohang){
return process.uniEnv.qn_base_url + 'daohang.png'
}else{
return process.uniEnv.qn_base_url + 'daohang-d.png'
}
},
centerButtonClass() { centerButtonClass() {
let btnClass = "appoint-btn" let btnClass = "appoint-btn"
return btnClass return btnClass
......
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