酒店
This commit is contained in:
1 parent
664c6aa993
commit
bb2c1d0fca
2 files changed
+43
-1
No files matched your search
@@ -41,6 +41,15 @@ export function pullRoomsFromUpstream(id: string | number) {
|
||||
})
|
||||
}
|
||||
|
||||
/** 仅拉取 getRoomPrice 房价样例(今天 1 天) */
|
||||
export function pullPriceFromUpstream(id: string | number) {
|
||||
return request({
|
||||
url: `/supermarket/smHotel/mid/pullPrice/${id}`,
|
||||
method: "post",
|
||||
timeout: 120000,
|
||||
})
|
||||
}
|
||||
|
||||
export function pushToDownstream(id: string | number) {
|
||||
return request({
|
||||
url: `/supermarket/smHotel/mid/push/${id}`,
|
||||
|
||||
@@ -148,7 +148,7 @@
|
||||
<template #default="scope">{{ scope.row.dailyCount ?? 0 }}</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="sheetName" label="来源Sheet" min-width="120" show-overflow-tooltip />
|
||||
<el-table-column label="操作" width="460" fixed="right">
|
||||
<el-table-column label="操作" width="540" fixed="right">
|
||||
<template #default="scope">
|
||||
<el-button
|
||||
icon="view"
|
||||
@@ -178,6 +178,16 @@
|
||||
>
|
||||
拉取房间
|
||||
</el-button>
|
||||
<el-button
|
||||
icon="Coin"
|
||||
text
|
||||
type="primary"
|
||||
v-auth="'supermarket_smHotel_edit'"
|
||||
:loading="pullingPriceId === scope.row.id"
|
||||
@click="handlePullPrice(scope.row)"
|
||||
>
|
||||
拉取房价
|
||||
</el-button>
|
||||
<el-button
|
||||
icon="Refresh"
|
||||
text
|
||||
@@ -460,6 +470,7 @@ import { fetchList, delObjs, importExcel, getImportStatus } from "/@/api/superma
|
||||
import {
|
||||
pullFromUpstream,
|
||||
pullRoomsFromUpstream,
|
||||
pullPriceFromUpstream,
|
||||
pullAndPush,
|
||||
pullAndPushBatch,
|
||||
fetchAuthorizedHotels,
|
||||
@@ -494,6 +505,7 @@ let pollTimer: ReturnType<typeof setInterval> | null = null
|
||||
const syncLoading = ref(false)
|
||||
const syncingId = ref<string | number | null>(null)
|
||||
const pullingRoomsId = ref<string | number | null>(null)
|
||||
const pullingPriceId = ref<string | number | null>(null)
|
||||
const pushLoading = ref(false)
|
||||
const pushingId = ref<string | number | null>(null)
|
||||
const authHotelVisible = ref(false)
|
||||
@@ -964,6 +976,27 @@ const handlePullRooms = async (row: any) => {
|
||||
}
|
||||
}
|
||||
|
||||
const handlePullPrice = async (row: any) => {
|
||||
const id = row?.id
|
||||
if (!id) return
|
||||
pullingPriceId.value = id
|
||||
try {
|
||||
const res: any = await pullPriceFromUpstream(id)
|
||||
const data = res?.data || {}
|
||||
const base = `房价接口(样例 ${data.sampleStart || "今天"}):产品 ${data.productCount ?? 0},日历 ${data.dailyCount ?? 0}`
|
||||
if (Number(data.productCount || 0) <= 0 && Number(data.dailyCount || 0) <= 0) {
|
||||
useMessage().warning(`${base}。无房价数据,请看服务端日志 getRoomPrice 返回`)
|
||||
} else {
|
||||
useMessage().success(base)
|
||||
}
|
||||
getDataList(false)
|
||||
} catch (err: any) {
|
||||
useMessage().error(err?.msg || err?.message || "拉取房价失败")
|
||||
} finally {
|
||||
pullingPriceId.value = null
|
||||
}
|
||||
}
|
||||
|
||||
const handleSyncOne = async (id: string | number) => {
|
||||
syncingId.value = id
|
||||
try {
|
||||
|
||||
Reference in new issue
Block a user