Files
dou_fire/pages/work/orderInfo.vue
唐明明 1f3f6b230a 工作台
2022-12-26 09:31:55 +08:00

305 lines
7.3 KiB
Vue
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<template>
<view class="content" v-if="order_no != ''">
<view class="order-header"></view>
<!-- 订单主要信息 -->
<view class="order-back order-flex order-info">
<view class="order-state">{{statusText}}</view>
<view class="order-item">
<label>服务类型</label>
<view class="order-value nowrap">
<text class="order-type" v-for="(item, index) in item_type" :key="index" v-if="item.number > 0">{{item.title}}×{{item.number}}</text>
</view>
</view>
<view class="order-items">
<view class="order-items-flex" v-for="(item, index) in items" :key="index" @click="$Router.push({ name: 'OrderSchemes', params: { id: item.business_order_item_id }})">
<label>{{item.institution.title}}({{item.business_type.title}})</label>
<view class="order-items-type nowrap">{{item.price}}<uni-icons type="right" color="gray" size="14px"></uni-icons></view>
</view>
</view>
<view class="order-item">
<label>欠款总金额</label>
<view class="order-value order-value-price nowrap">{{serviceTotal}}</view>
</view>
</view>
<!-- 订单服务包信息 -->
<view class="order-back order-flex" v-if="services.length > 0">
<view class="order-title">服务包</view>
<view class="order-serve">
<block v-for="(item, index) in services" :key="index">
<view class="serve-header">
{{item.title}}<text>{{item.price}}</text>
</view>
<view class="serve-item" v-for="(citem, cindex) in item.items" :key="cindex">
<view class="services-flex">
<label class="services-flex-label nowrap">服务类型</label>
<view class="services-flex-val nowrap">{{citem.business}}({{citem.type}})</view>
</view>
<view class="services-flex">
<label class="services-flex-title nowrap">{{citem.title}}</label>
<view class="services-flex-price nowrap"><text></text>{{citem.price}}</view>
</view>
</view>
</block>
</view>
</view>
<!-- 客户信息 -->
<view class="order-back order-flex">
<view class="order-title">客户信息</view>
<view class="order-item">
<label>客户姓名</label>
<view class="order-value nowrap">{{user.nickname || '-'}}</view>
</view>
<view class="order-item">
<label>客户性别</label>
<view class="order-value nowrap">{{user.sex || '-'}}</view>
</view>
<view class="order-item">
<label>客户电话</label>
<view class="order-value nowrap">{{user.username || '-'}}</view>
</view>
<view class="order-btn" @click="onCallPhone(user.username)">联系客户</view>
</view>
<!-- 订单其他信息 -->
<view class="order-back order-flex">
<view class="order-title">订单信息</view>
<view class="order-item">
<label>订单编号</label>
<view class="order-value nowrap">{{order_no || '-'}}</view>
</view>
<view class="order-item">
<label>创建时间</label>
<view class="order-value nowrap">{{created_at || '-'}}</view>
</view>
<view class="order-item">
<label>订单金额</label>
<view class="order-value nowrap">{{total || '-'}}</view>
</view>
</view>
</view>
</template>
<script>
import { info } from '@/apis/interfaces/order.js'
export default {
data() {
return {
orderId : '',
total : '0.00',
order_no : '',
statusText : '',
created_at : '',
user : {
nickname : '',
sex : '',
username : ''
},
item_type : [],
items : [],
services : [],
serviceTotal: ''
};
},
onShow() {
this.orderId = this.$Route.query.orderId
this.getInfo()
},
methods: {
// 订单详情
getInfo(){
info(this.orderId).then(res => {
let { status, created_at, total, order_no, user, item_type, items, services, service_prices } = res
this.statusText = status.text
this.created_at = created_at
this.total = total
this.order_no = order_no
this.user = user
this.item_type = item_type
this.items = items
this.services = services
this.serviceTotal = service_prices
}).catch(err => {
uni.showToast({
title: err.message,
icon : 'none'
})
})
},
// 刷新列表订单
onRefreshOrder(){
this.$store.commit('setOrderId', this.$Route.query.orderId)
},
// 拨打电话
onCallPhone(phone){
uni.makePhoneCall({
phoneNumber: phone,
fail(err) {
uni.showToast({
title: err.message,
icon : 'none'
})
}
})
}
}
}
</script>
<style lang="scss">
// header
.order-header{
background: #446EFE;
height: 150rpx;
}
// 订单块
.order-back{
background: white;
border-radius: 20rpx;
margin: 0 30rpx 30rpx;
}
// 订单信息
.order-info{
margin: -100rpx 30rpx 30rpx;
.order-state{
font-weight: bold;
font-size: 30rpx;
margin: 0 -30rpx;
padding: 0 30rpx;
border-bottom: solid 1rpx #f6f6f6;
padding-bottom: 20rpx;
line-height: 80rpx;
font-size: 48rpx;
}
}
// 订单列表
.order-flex{
padding: 20rpx 30rpx;
.order-title{
font-weight: bold;
font-size: 36rpx;
line-height: 60rpx;
}
// 订单信息
.order-item{
display: flex;
justify-content: space-between;
line-height: 80rpx;
font-size: 30rpx;
label{
width: 200rpx;
}
.order-value{
color: gray;
width: calc(100% - 200rpx);
text-align: right;
.order-type{
margin-right: 30rpx;
position: relative;
display: inline-block;
&::after{
position: absolute;
content: "/";
width: 30rpx;
text-align: center;
font-size: 30rpx;
top: 0;
right: -30rpx;
}
&:last-child{
margin-right: 0;
&::after{
display: none;
}
}
}
&.order-value-price{
color: red;
font-weight: bold;
}
}
}
// 服务包信息
.order-serve{
background-color: rgba(68, 110, 254, .03);
border-radius: 10rpx;
margin: 15rpx 0;
padding: 0 25rpx;
.serve-header{
display: flex;
padding-top: 20rpx;
padding-bottom: 20rpx;
justify-content: space-between;
font-weight: bold;
border-bottom: solid 1rpx #f6f6f6;
text{
color: red;
}
}
.serve-item{
border-bottom: solid 1rpx #f6f6f6;
padding: 20rpx 0;
&:last-child{
border: none;
}
}
.services-flex{
display: flex;
font-size: 30rpx;
line-height: 55rpx;
.services-flex-label{
width: 150rpx;
color: #111111;
}
.services-flex-val{
width: calc(100% - 150rpx);
text-align: right;
color: gray;
}
.services-flex-title{
width: 50%;
color: #111111;
font-size: 30rpx;
}
.services-flex-price{
font-size: 30rpx;
width: 50%;
text-align: right;
font-weight: bold;
color: #111111;
}
}
}
// 订单服务项目
.order-items{
background-color: rgba(68, 110, 254, .03);
border-radius: 10rpx;
margin-bottom: 10rpx;
padding: 20rpx 30rpx;
.order-items-flex{
display: flex;
justify-content: space-between;
flex-wrap: wrap;
line-height: 60rpx;
font-size: 28rpx;
label{
width: 340rpx;
}
.order-items-type{
width: calc(100% - 340rpx);
text-align: right;
color: gray;
}
}
}
// 订单按钮
.order-btn{
margin: 0 -30rpx;
padding: 20rpx 30rpx 0;
border-top: solid 1rpx #f6f6f6;
text-align: center;
line-height: 60rpx;
color: $main-color;
font-size: 32rpx;
}
}
</style>