Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
S
SuperMan
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
1
Issues
1
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
罗超
SuperMan
Commits
01b2d0ca
Commit
01b2d0ca
authored
Jul 08, 2025
by
黄奎
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
1
parent
b377f14b
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
76 additions
and
42 deletions
+76
-42
hotelSpider.vue
src/components/Hotel/hotelSpider.vue
+76
-42
No files found.
src/components/Hotel/hotelSpider.vue
View file @
01b2d0ca
...
@@ -33,49 +33,23 @@
...
@@ -33,49 +33,23 @@
</ul>
</ul>
</div>
</div>
<div>
<div>
<table
class=
"singeRowTable"
border=
"0"
cellspacing=
"0"
cellpadding=
"0"
v-loading=
'loading'
>
<el-table
:data=
"processedData"
border
style=
"width: 100%"
v-loading=
'loading'
:span-method=
"objectSpanMethod"
<tr>
:header-cell-style=
"
{background: '#f5f7fa', fontWeight: 'bold'}" max-height="690px" highlight-current-row>
<th
width=
"200"
>
酒店名称
</th>
<el-table-column
prop=
"DiDaHotelName"
label=
"酒店名称"
width=
"200"
align=
"center"
fixed
></el-table-column>
<th
width=
"70"
>
类型
</th>
<el-table-column
prop=
"priceType"
label=
"类型"
width=
"70"
align=
"center"
fixed
></el-table-column>
<template
v-if=
"dataList&&dataList.length>0"
>
<el-table-column
v-for=
"(header, index) in dateHeaders"
:key=
"index"
:label=
"header.label"
align=
"center"
<template
v-for=
"(hItem,hIndex) in dataList[0].SubList"
>
min-width=
"75"
>
<th
:key=
"`d_h_`+hIndex"
>
<template
slot-scope=
"scope"
>
{{
hItem
.
CheckInStr
}}
(
{{
hItem
.
WeekStr
}}
)
<span
v-if=
"scope.row.priceType === '直客价'"
</th>
:style=
"
{color: scope.row.priceArray[index]
<
scope
.
row
.
teamPriceArray
[
index
]
?
'
red
'
:
''}"
>
</
template
>
{{
scope
.
row
.
priceArray
[
index
]
}}
</span>
<span
v-else
>
{{
scope
.
row
.
priceArray
[
index
]
}}
</span>
</
template
>
</
template
>
</tr>
</el-table-column>
<
template
v-for=
"(item,index) in dataList"
>
</el-table>
<tr
:key=
"`d_1_`+index"
>
<td
rowspan=
"2"
>
{{
item
.
DiDaHotelName
}}
</td>
<td>
直客价
</td>
<template
v-for=
"(hItem,hIndex) in item.SubList"
>
<td
:key=
"`d_1_`+index+`d1_`+hIndex"
>
<template
v-if=
"hItem.Price
<hItem
.
TeamPrice
"
>
<font
style=
"color:red;"
>
{{
hItem
.
Price
}}
</font>
</
template
>
<
template
v-else
>
{{
hItem
.
Price
}}
</
template
>
</td>
</template>
</tr>
<tr
:key=
"`d_2_`+index"
>
<td>
道旅价
</td>
<
template
v-for=
"(hItem,hIndex) in item.SubList"
>
<td
:key=
"`d_2_`+index+`d2_`+hIndex"
>
{{
hItem
.
TeamPrice
}}
</td>
</
template
>
</tr>
</template>
</table>
<el-pagination
background
@
current-change=
"handleCurrentChange"
:current-page
.
sync=
"msg.pageIndex"
<el-pagination
background
@
current-change=
"handleCurrentChange"
:current-page
.
sync=
"msg.pageIndex"
layout=
"total,prev, pager, next, jumper"
:page-size=
"msg.pageSize"
:total=
"msg.total"
></el-pagination>
layout=
"total,prev, pager, next, jumper"
:page-size=
"msg.pageSize"
:total=
"msg.total"
></el-pagination>
</div>
</div>
...
@@ -124,7 +98,67 @@
...
@@ -124,7 +98,67 @@
loading
:
false
,
loading
:
false
,
};
};
},
},
computed
:
{
// 处理表头数据
dateHeaders
()
{
if
(
this
.
dataList
.
length
>
0
&&
this
.
dataList
[
0
].
SubList
)
{
return
this
.
dataList
[
0
].
SubList
.
map
(
item
=>
({
label
:
`
${
item
.
CheckInStr
}
(
${
item
.
WeekStr
}
)`
}));
}
return
[];
},
// 处理表格数据
processedData
()
{
const
result
=
[];
this
.
dataList
.
forEach
(
hotel
=>
{
// 直客价行
result
.
push
({
DiDaHotelName
:
hotel
.
DiDaHotelName
,
priceType
:
'直客价'
,
priceArray
:
hotel
.
SubList
.
map
(
item
=>
item
.
Price
),
teamPriceArray
:
hotel
.
SubList
.
map
(
item
=>
item
.
TeamPrice
),
rowspan
:
2
// 用于合并单元格
});
// 道旅价行
result
.
push
({
priceType
:
'道旅价'
,
priceArray
:
hotel
.
SubList
.
map
(
item
=>
item
.
TeamPrice
),
rowspan
:
0
// 用于合并单元格
});
});
return
result
;
}
},
methods
:
{
methods
:
{
// 单元格合并方法
objectSpanMethod
({
row
,
column
,
rowIndex
,
columnIndex
})
{
if
(
columnIndex
===
0
)
{
// 酒店名称列
if
(
row
.
rowspan
===
2
)
{
return
{
rowspan
:
2
,
colspan
:
1
};
}
else
{
return
{
rowspan
:
0
,
colspan
:
0
};
}
}
if
(
columnIndex
===
1
)
{
// 类型列不需要合并
return
{
rowspan
:
1
,
colspan
:
1
};
}
},
//翻页功能按钮
//翻页功能按钮
handleCurrentChange
(
val
)
{
handleCurrentChange
(
val
)
{
this
.
msg
.
pageIndex
=
val
;
this
.
msg
.
pageIndex
=
val
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment