Merge branch 'order-729'

合并order-729分支代码
This commit is contained in:
duanshuwen
2025-08-10 19:55:49 +08:00
24 changed files with 1668 additions and 94 deletions

View File

@@ -6,14 +6,28 @@
</view>
<view class="order-content">
<view class="order-item">
<image src="./images/icon_service.png" class="order-icon"></image>
<text class="order-description">加一台麻将机</text>
<image src="./images/icon_service.png" class="order-icon"></image>
<uni-data-select
v-if="!isCallSuccess && workOrderTypeList.length > 0"
class="order-select"
placeholder="请选择服务工单"
v-model="workOrderTypeName"
:localdata="workOrderTypeList"
@change="changeWorkOrderType"
></uni-data-select>
<text v-else class="order-description">{{ workOrderTypeName }}</text>
</view>
<view class="order-line"></view>
<view class="order-details">
<view class="detail-item">
<text class="detail-label">房间号</text>
<text class="detail-value">302</text>
<input
v-if="!isCallSuccess"
class="detail-input"
placeholder="请填写房间号"
v-model="roomId"
/>
<text v-else class="detail-value">{{ roomId }}</text>
</view>
<view class="detail-item">
<text class="detail-label">服务时间</text>
@@ -42,12 +56,12 @@
<text v-else class="detail-value">{{ contactPhone }}</text>
</view>
</view>
<!-- 呼叫前显示立即呼叫按钮 -->
<button v-if="!isCallSuccess" class="order-button" @click="handleCall">
立即呼叫
</button>
<!-- 呼叫成功后显示两个按钮 -->
<view v-else class="order-buttons">
<button class="order-button-secondary" @click="viewWorkOrder">
@@ -73,69 +87,110 @@ import { ref, onMounted, nextTick } from "vue";
import { SCROLL_TO_BOTTOM } from "@/constant/constant";
import { createWorkOrder } from "@/request/api/OrderApi";
import { createWorkOrder, workOrderTypeListForBiz } from "@/request/api/OrderApi";
const workOrderTypeId = ref('')
const workOrderTypeName = ref('')
const roomId = ref('')
const contactName = ref("");
const contactPhone = ref("");
const isCallSuccess = ref(false); // 呼叫成功状态
const workOrderId = ref(""); // 工单ID
const workOrderId = ref(0); // 工单ID
const workOrderTypeList = ref([])
const changeWorkOrderType = (item) => {
console.log(item)
workOrderTypeId.value = item.value
workOrderTypeName.value = item.text
}
const handleCall = async () => {
// 验证输入
if (!contactName.value.trim()) {
uni.showToast({
title: '请填写联系人',
icon: 'none',
duration: 2000
});
return;
}
if (!contactPhone.value.trim()) {
uni.showToast({
title: '请填写联系电话',
icon: 'none',
duration: 2000
});
return;
}
// 验证输入
if (!roomId.value.trim()) {
uni.showToast({
title: '请填写房间号',
icon: 'none',
duration: 2000
});
return;
}
try {
const res = await createWorkOrder({
contactName: contactName.value,
contactPhone: contactPhone.value,
workOrderTypeId: '1942741501754765314',
roomId: '302',
});
if (!contactName.value.trim()) {
uni.showToast({
title: '请填写联系人',
icon: 'none',
duration: 2000
});
return;
}
if (res.code === 0) {
// 保存工单ID
workOrderId.value = res.data?.id || "";
// 设置呼叫成功状态
isCallSuccess.value = true;
uni.showToast({
title: '工单创建成功',
icon: 'success',
duration: 2000
if (!contactPhone.value.trim()) {
uni.showToast({
title: '请填写联系电话',
icon: 'none',
duration: 2000
});
return;
}
sendCreateWorkOrder()
};
/// 创建工单
const sendCreateWorkOrder = async () => {
try {
const res = await createWorkOrder({
contactName: contactName.value,
contactPhone: contactPhone.value,
workOrderTypeId: workOrderTypeId.value,
roomId: roomId.value,
});
} else {
if (res.code === 0) {
// 保存工单ID
workOrderId.value = res.data?.id || "";
// 设置呼叫成功状态
isCallSuccess.value = true;
uni.showToast({
title: '工单创建成功',
icon: 'success',
duration: 2000
});
} else {
uni.showToast({
title: res.message || '创建工单失败',
icon: 'none',
duration: 2000
});
}
} catch (error) {
console.error('创建工单失败:', error);
uni.showToast({
title: res.message || '创建工单失败',
title: '网络错误,请重试',
icon: 'none',
duration: 2000
});
}
} catch (error) {
console.error('创建工单失败:', error);
uni.showToast({
title: '网络错误,请重试',
icon: 'none',
duration: 2000
});
}
};
}
/// 获取工单类型
const getWorkOrderType = async () => {
const res = await workOrderTypeListForBiz()
if(res.code === 0) {
res.data.forEach((item, index) => {
workOrderTypeList.value.push({
value: item.id,
text: item.workOrderTypeName,
})
})
if (workOrderTypeList.value.length > 0) {
workOrderTypeId.value = workOrderTypeList.value[0].value
workOrderTypeName.value = workOrderTypeList.value[0].text
}
}
}
// 查看工单
const viewWorkOrder = () => {
@@ -173,11 +228,12 @@ const makePhoneCall = () => {
};
onMounted(() => {
nextTick(() => {
setTimeout(() => {
uni.$emit(SCROLL_TO_BOTTOM, true)
}, 200)
});
getWorkOrderType()
nextTick(() => {
setTimeout(() => {
uni.$emit(SCROLL_TO_BOTTOM, true)
}, 200)
});
})
</script>

View File

@@ -107,6 +107,15 @@
border-bottom: 1px solid #ddd;
}
.order-select {
border: none;
outline: none;
width: 100%;
font-size: 14px;
color: #999;
border-bottom: 1px solid #ddd;
}
.order-button {
width: 280px;
height: 42px;

View File

@@ -14,7 +14,7 @@
v-for="(item, index) in thumbnails"
:key="index"
>
<image :src="item.photoUrl" mode="aspectFill"></image>
<image :src="item.imageUrl" mode="aspectFill"></image>
</swiper-item>
</swiper>
@@ -39,8 +39,8 @@
:id="`thumbnail-${index}`"
@click="handleThumbnailClick(index)"
>
<image :src="thumb.photoUrl" mode="aspectFill"></image>
<text>{{ thumb.photoName }}</text>
<image :src="thumb.imageUrl" mode="aspectFill"></image>
<text>{{ thumb.name }}</text>
</view>
</view>
</scroll-view>
@@ -106,35 +106,35 @@ const swiperStyle = computed(() => {
// 默认图片数据
const defaultImages = [
{
photoUrl:
"https://fastly.picsum.photos/id/866/654/400.jpg?hmac=z3vI4CYrpnXEgimSlJCDwXRxEa-UDHiRwzGEyB8V-po",
photoName: "瑶山古寨",
imageUrl:
"https://one-feel-image-bucket.oss-cn-chengdu.aliyuncs.com/DH04006.jpg",
name: "瑶山古寨",
},
{
photoUrl:
"https://fastly.picsum.photos/id/284/654/400.jpg?hmac=89XRCJxYTblKIFGLOp6hJ9U0GC8BQrcnJwE5pG21NAk",
photoName: "民俗表演",
imageUrl:
"https://one-feel-image-bucket.oss-cn-chengdu.aliyuncs.com/DH04002.JPG",
name: "民俗表演",
},
{
photoUrl:
"https://fastly.picsum.photos/id/281/654/400.jpg?hmac=hcAJB7y2Xz3DVuz6S4XeQZgzaTJ_QWnxtbnaagZL6Fs",
photoName: "特色美食",
imageUrl:
"https://one-feel-image-bucket.oss-cn-chengdu.aliyuncs.com/DH04007.jpg",
name: "特色美食",
},
{
photoUrl:
"https://fastly.picsum.photos/id/435/654/400.jpg?hmac=TSVDxfo-zXbunxNQK0erSG_nmKcS20xfhbQsCAXLlHo",
photoName: "传统服饰",
imageUrl:
"https://one-feel-image-bucket.oss-cn-chengdu.aliyuncs.com/DH04014.JPG",
name: "传统服饰",
},
{
photoUrl:
"https://fastly.picsum.photos/id/737/654/400.jpg?hmac=VED05oEK3XB0Aa_DUVoZjTAf0bHjAmNYyJky4lq5vVo",
photoName: "其他",
imageUrl:
"https://one-feel-image-bucket.oss-cn-chengdu.aliyuncs.com/DH04020.JPG",
name: "其他",
},
];
// 使用传入的图片数据或默认数据
const thumbnails = computed(() => {
return props.images.length ? props.images : defaultImages;
return props.images;
});
const handleThumbnailClick = (index) => {

View File

@@ -29,7 +29,7 @@
position: absolute;
left: 12px;
right: 12px;
bottom: 36px;
bottom: 0px;
height: 60px;
}