@@ -110,6 +110,23 @@
|
||||
<text class="wo-status" :class="wo.status">{{ getWorkOrderStatusText(wo.status) }}</text>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- 关联客户 -->
|
||||
<view class="card" v-if="linkedCustomers.length > 0">
|
||||
<view class="card-header">
|
||||
<text class="card-title">关联客户</text>
|
||||
</view>
|
||||
<view class="linked-customers">
|
||||
<view
|
||||
class="linked-customer-item"
|
||||
v-for="customer in linkedCustomers"
|
||||
:key="customer.ID"
|
||||
>
|
||||
<text class="customer-name">{{ (customer.last_name || '') + (customer.first_name ? ' ' + customer.first_name : '') }}</text>
|
||||
<text v-if="customer.title" class="customer-title">{{ customer.title }}</text>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- 空状态 -->
|
||||
@@ -179,6 +196,7 @@ const item = ref(null)
|
||||
const photos = ref([])
|
||||
const commits = ref([])
|
||||
const workOrders = ref([])
|
||||
const linkedCustomers = ref([])
|
||||
const canModify = ref(false)
|
||||
|
||||
// 移动相关
|
||||
@@ -230,6 +248,7 @@ async function fetchDetail() {
|
||||
photos.value = res.data.photos || []
|
||||
commits.value = res.data.commits || []
|
||||
workOrders.value = res.data.work_orders || []
|
||||
linkedCustomers.value = res.data.customers || []
|
||||
canModify.value = res.data.canModifyItem
|
||||
} else {
|
||||
uni.showToast({ title: '获取详情失败', icon: 'none' })
|
||||
@@ -315,6 +334,18 @@ function addWorkOrder() {
|
||||
: item.value.Name,
|
||||
description: item.value.Remark || '',
|
||||
}
|
||||
|
||||
// 如果有已关联的客户,自动填充到工单
|
||||
if (linkedCustomers.value && linkedCustomers.value.length > 0) {
|
||||
prefillData.customer_ids = linkedCustomers.value.map(c => c.ID)
|
||||
prefillData.customers = linkedCustomers.value.map(c => ({
|
||||
id: c.ID,
|
||||
first_name: c.first_name || '',
|
||||
last_name: c.last_name || '',
|
||||
primary_phone: c.primary_phone || ''
|
||||
}))
|
||||
}
|
||||
|
||||
uni.setStorageSync('prefill_work_order', JSON.stringify(prefillData))
|
||||
uni.navigateTo({
|
||||
url: '/pages/workorder/add-workorder'
|
||||
@@ -642,6 +673,33 @@ onShow(() => {
|
||||
color: #ff575a;
|
||||
}
|
||||
|
||||
.linked-customers {
|
||||
padding: 20rpx 30rpx;
|
||||
}
|
||||
|
||||
.linked-customer-item {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
padding: 16rpx 0;
|
||||
border-bottom: 1rpx solid #f5f5f5;
|
||||
}
|
||||
|
||||
.linked-customer-item:last-child {
|
||||
border-bottom: none;
|
||||
}
|
||||
|
||||
.customer-name {
|
||||
font-size: 28rpx;
|
||||
color: #333;
|
||||
flex: 1;
|
||||
}
|
||||
|
||||
.customer-title {
|
||||
font-size: 24rpx;
|
||||
color: #999;
|
||||
margin-left: 16rpx;
|
||||
}
|
||||
|
||||
.action-bar {
|
||||
position: fixed;
|
||||
bottom: 0;
|
||||
|
||||
Reference in New Issue
Block a user