Compare commits
No commits in common. "932078c3dc5f2741fb5a8fe380b57edb7beccfaf" and "c3e47c281337713204e7c7eae5f5c3975d619c20" have entirely different histories.
932078c3dc
...
c3e47c2813
@ -21,42 +21,22 @@
|
|||||||
</view>
|
</view>
|
||||||
<view class="detail-item">
|
<view class="detail-item">
|
||||||
<text class="detail-label">联系房客:</text>
|
<text class="detail-label">联系房客:</text>
|
||||||
<!-- 呼叫成功后显示为文本,否则显示输入框 -->
|
|
||||||
<input
|
<input
|
||||||
v-if="!isCallSuccess"
|
|
||||||
class="detail-input"
|
class="detail-input"
|
||||||
placeholder="请填写联系人"
|
placeholder="请填写联系人"
|
||||||
v-model="contactName"
|
v-model="contactName"
|
||||||
/>
|
/>
|
||||||
<text v-else class="detail-value">{{ contactName }}</text>
|
|
||||||
</view>
|
</view>
|
||||||
<view class="detail-item">
|
<view class="detail-item">
|
||||||
<text class="detail-label">联系电话:</text>
|
<text class="detail-label">联系电话:</text>
|
||||||
<!-- 呼叫成功后显示为文本,否则显示输入框 -->
|
|
||||||
<input
|
<input
|
||||||
v-if="!isCallSuccess"
|
|
||||||
class="detail-input"
|
class="detail-input"
|
||||||
placeholder="请填写联系电话"
|
placeholder="请填写联系电话"
|
||||||
v-model="contactPhone"
|
v-model="contactPhone"
|
||||||
/>
|
/>
|
||||||
<text v-else class="detail-value">{{ contactPhone }}</text>
|
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
|
<button class="order-button" @click="handleCall">立即呼叫</button>
|
||||||
<!-- 呼叫前显示立即呼叫按钮 -->
|
|
||||||
<button v-if="!isCallSuccess" class="order-button" @click="handleCall">
|
|
||||||
立即呼叫
|
|
||||||
</button>
|
|
||||||
|
|
||||||
<!-- 呼叫成功后显示两个按钮 -->
|
|
||||||
<view v-else class="order-buttons">
|
|
||||||
<button class="order-button-secondary" @click="viewWorkOrder">
|
|
||||||
查看工单
|
|
||||||
</button>
|
|
||||||
<button class="order-button-primary" @click="markCompleted">
|
|
||||||
已完成
|
|
||||||
</button>
|
|
||||||
</view>
|
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
@ -69,100 +49,14 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup>
|
<script setup>
|
||||||
import { ref, onMounted, nextTick } from "vue";
|
import { ref } from "vue";
|
||||||
import { SCROLL_TO_BOTTOM } from "@/constant/constant";
|
|
||||||
|
|
||||||
|
|
||||||
import { createWorkOrder } from "@/request/api/OrderApi";
|
|
||||||
|
|
||||||
const contactName = ref("");
|
const contactName = ref("");
|
||||||
const contactPhone = ref("");
|
const contactPhone = ref("");
|
||||||
const isCallSuccess = ref(false); // 呼叫成功状态
|
|
||||||
const workOrderId = ref(""); // 工单ID
|
|
||||||
|
|
||||||
const handleCall = async () => {
|
const handleCall = () => {
|
||||||
// 验证输入
|
// Logic to handle the call action
|
||||||
if (!contactName.value.trim()) {
|
console.log("Calling with:", contactName.value, contactPhone.value);
|
||||||
uni.showToast({
|
|
||||||
title: '请填写联系人',
|
|
||||||
icon: 'none',
|
|
||||||
duration: 2000
|
|
||||||
});
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!contactPhone.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 (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: '网络错误,请重试',
|
|
||||||
icon: 'none',
|
|
||||||
duration: 2000
|
|
||||||
});
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
// 查看工单
|
|
||||||
const viewWorkOrder = () => {
|
|
||||||
console.log("查看工单:", workOrderId.value);
|
|
||||||
// 这里可以跳转到工单详情页面
|
|
||||||
uni.navigateTo({
|
|
||||||
url: `/pages/order/list?id=${workOrderId.value}`
|
|
||||||
});
|
|
||||||
};
|
|
||||||
|
|
||||||
// 标记已完成
|
|
||||||
const markCompleted = () => {
|
|
||||||
console.log("标记工单已完成:", workOrderId.value);
|
|
||||||
uni.showModal({
|
|
||||||
title: '确认完成',
|
|
||||||
content: '确认标记此工单为已完成吗?',
|
|
||||||
success: (res) => {
|
|
||||||
if (res.confirm) {
|
|
||||||
// 这里可以调用API标记工单完成
|
|
||||||
uni.showToast({
|
|
||||||
title: '工单已完成',
|
|
||||||
icon: 'success',
|
|
||||||
duration: 2000
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
};
|
};
|
||||||
|
|
||||||
const makePhoneCall = () => {
|
const makePhoneCall = () => {
|
||||||
@ -171,14 +65,6 @@ const makePhoneCall = () => {
|
|||||||
phoneNumber: "15185111210",
|
phoneNumber: "15185111210",
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
onMounted(() => {
|
|
||||||
nextTick(() => {
|
|
||||||
setTimeout(() => {
|
|
||||||
uni.$emit(SCROLL_TO_BOTTOM, true)
|
|
||||||
}, 200)
|
|
||||||
});
|
|
||||||
})
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style scoped lang="scss">
|
<style scoped lang="scss">
|
||||||
|
|||||||
@ -8,10 +8,6 @@
|
|||||||
联系电话:
|
联系电话:
|
||||||
立即呼叫按钮
|
立即呼叫按钮
|
||||||
|
|
||||||
呼叫成功之后
|
|
||||||
1、呼叫按钮变为两个按钮 查看工单和已完成,见图中的布局
|
|
||||||
2、联系人和联系电话,仅展示,不能编辑
|
|
||||||
|
|
||||||
## 提示词:
|
## 提示词:
|
||||||
|
|
||||||
使用 uniapp + vue3 组合式 api 开发微信小程序,要求如下:
|
使用 uniapp + vue3 组合式 api 开发微信小程序,要求如下:
|
||||||
|
|||||||
@ -121,43 +121,6 @@
|
|||||||
justify-content: center;
|
justify-content: center;
|
||||||
}
|
}
|
||||||
|
|
||||||
// 呼叫成功后的按钮容器
|
|
||||||
.order-buttons {
|
|
||||||
display: flex;
|
|
||||||
justify-content: space-between;
|
|
||||||
margin-top: 20px;
|
|
||||||
gap: 12px;
|
|
||||||
}
|
|
||||||
|
|
||||||
// 查看工单按钮(次要按钮)
|
|
||||||
.order-button-secondary {
|
|
||||||
flex: 1;
|
|
||||||
height: 42px;
|
|
||||||
background: linear-gradient(90deg, #0256FF, #00A6FF);
|
|
||||||
color: #fff;
|
|
||||||
font-size: 14px;
|
|
||||||
font-weight: 600;
|
|
||||||
border: none;
|
|
||||||
border-radius: 20px;
|
|
||||||
display: flex;
|
|
||||||
align-items: center;
|
|
||||||
justify-content: center;
|
|
||||||
}
|
|
||||||
|
|
||||||
// 已完成按钮(主要按钮)
|
|
||||||
.order-button-primary {
|
|
||||||
flex: 1;
|
|
||||||
height: 42px;
|
|
||||||
background: linear-gradient(90deg, #ff7e00, #ffba00);
|
|
||||||
color: #fff;
|
|
||||||
font-size: 14px;
|
|
||||||
font-weight: 600;
|
|
||||||
border-radius: 20px;
|
|
||||||
display: flex;
|
|
||||||
align-items: center;
|
|
||||||
justify-content: center;
|
|
||||||
}
|
|
||||||
|
|
||||||
.footer-help {
|
.footer-help {
|
||||||
margin-bottom: 12px;
|
margin-bottom: 12px;
|
||||||
display: flex;
|
display: flex;
|
||||||
|
|||||||
@ -133,8 +133,8 @@ onMounted(() => {
|
|||||||
box-shadow: 0 4rpx 8rpx rgba(0, 0, 0, 0.1); /* 阴影 */
|
box-shadow: 0 4rpx 8rpx rgba(0, 0, 0, 0.1); /* 阴影 */
|
||||||
}
|
}
|
||||||
.calendar-img {
|
.calendar-img {
|
||||||
width: 16px;
|
width: 48rpx;
|
||||||
height: 16px;
|
height: 48rpx;
|
||||||
}
|
}
|
||||||
.calendar-text {
|
.calendar-text {
|
||||||
font-size: 22rpx;
|
font-size: 22rpx;
|
||||||
|
|||||||
@ -9,11 +9,6 @@ const userWorkOrderList = (args) => {
|
|||||||
return request.post("/hotelBiz/workOrder/userWorkOrderList", args);
|
return request.post("/hotelBiz/workOrder/userWorkOrderList", args);
|
||||||
};
|
};
|
||||||
|
|
||||||
/// 创建工单
|
|
||||||
function createWorkOrder(args) {
|
|
||||||
return request.post('/hotelBiz/workOrder/createWorkOrder', args);
|
|
||||||
}
|
|
||||||
|
|
||||||
// 获取订单详情
|
// 获取订单详情
|
||||||
const userOrderDetail = (args) => {
|
const userOrderDetail = (args) => {
|
||||||
return request.post("/hotelBiz/order/userOrderDetail", args);
|
return request.post("/hotelBiz/order/userOrderDetail", args);
|
||||||
@ -42,7 +37,6 @@ const orderPayNow = (args) => {
|
|||||||
export {
|
export {
|
||||||
userOrderList,
|
userOrderList,
|
||||||
userWorkOrderList,
|
userWorkOrderList,
|
||||||
createWorkOrder,
|
|
||||||
userOrderDetail,
|
userOrderDetail,
|
||||||
preOrder,
|
preOrder,
|
||||||
orderCancel,
|
orderCancel,
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user