Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
phsl
/
client
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Members
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
c26807a8
authored
Aug 12, 2025
by
孙美琪
Browse files
Options
Browse Files
Download
Plain Diff
Merge remote-tracking branch 'origin/develop' into develop
parents
b888b723
725a01c4
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
121 additions
and
63 deletions
+121
-63
src/api/computingResource.js
+7
-0
src/views/computingResource/resourceList.vue
+114
-63
No files found.
src/api/computingResource.js
View file @
c26807a8
...
@@ -47,6 +47,13 @@ export function orderBuy (query) {
...
@@ -47,6 +47,13 @@ export function orderBuy (query) {
})
})
}
}
export
function
bizOrderSubmit
(
query
){
return
request
({
url
:
'/api/v1/bizOrderSubmit'
,
method
:
'post'
,
data
:
query
})
}
// 确认订单回显数据
// 确认订单回显数据
export
function
confirmOrderInfo
(
query
)
{
export
function
confirmOrderInfo
(
query
)
{
return
request
({
return
request
({
...
...
src/views/computingResource/resourceList.vue
View file @
c26807a8
...
@@ -63,22 +63,24 @@
...
@@ -63,22 +63,24 @@
<el-table-column
prop=
"memory"
label=
"内存"
sortable
/>
<el-table-column
prop=
"memory"
label=
"内存"
sortable
/>
<el-table-column
prop=
"storage"
label=
"存储"
sortable
/>
<el-table-column
prop=
"storage"
label=
"存储"
sortable
/>
<el-table-column
prop=
"publicPrice"
label=
"报价"
sortable
/>
<el-table-column
prop=
"publicPrice"
label=
"报价"
sortable
/>
<el-table-column
prop=
"term"
label=
"时长"
sortable
/>
<el-table-column
label=
"操作"
width=
"204px"
>
<el-table-column
label=
"操作"
width=
"204px"
>
<template
#
default=
"
{row}">
<template
#
default=
"
{row}">
<
el-button
class=
"action-button"
@
click=
"selectedProduct(1,row.id)"
>
加入购物车
</el-button
>
<
!--
<el-button
class=
"action-button"
@
click=
"selectedProduct(1,row.id)"
>
加入购物车
</el-button>
--
>
<el-button
type=
"primary"
class=
"action-button"
@
click=
"selectedProduct(2,row.id)"
>
立即
申请
<el-button
type=
"primary"
class=
"action-button"
@
click=
"selectedProduct(2,row.id)"
>
立即
购买
</el-button>
</el-button>
</
template
>
</
template
>
</el-table-column>
</el-table-column>
</el-table>
</el-table>
</div>
</div>
<!--卡片形式-->
<div
v-if=
"showVersion === 2"
class=
"version-2"
>
<div
v-if=
"showVersion === 2"
class=
"version-2"
>
<el-row
:gutter=
"24"
>
<el-row
:gutter=
"24"
>
<el-col
v-for=
"(item,index) in tableData"
:key=
"index"
:span=
"6"
>
<el-col
v-for=
"(item,index) in tableData"
:key=
"index"
:span=
"6"
>
<div
class=
"product-card"
>
<div
class=
"product-card"
>
<div
class=
"top-info"
>
<div
class=
"top-info"
>
<div
class=
"title"
>
{{ item.model }}
</div>
<div
class=
"title"
>
{{ item.model }}
</div>
<div
class=
"title"
>
{{ item.term }}
</div>
<div
class=
"tag"
>
<div
class=
"tag"
>
<!--<el-tag type="warning" effect="dark">性价比</el-tag>-->
<!--<el-tag type="warning" effect="dark">性价比</el-tag>-->
<!--<el-tag type="info" effect="plain">专家推荐</el-tag>-->
<!--<el-tag type="info" effect="plain">专家推荐</el-tag>-->
...
@@ -117,12 +119,12 @@
...
@@ -117,12 +119,12 @@
</el-col>
</el-col>
</el-row>
</el-row>
<el-divider></el-divider>
<el-divider></el-divider>
<div
class=
"flex-justify-end price"
>
¥{{ item.publicPrice }}{{
item.unitTypeName
}}
</div>
<div
class=
"flex-justify-end price"
>
¥{{ item.publicPrice }}{{
item.unitTypeName
}}
</div>
<!--<div class="flex-justify-end month-expenses">约¥15/月</div>-->
<!--<div class="flex-justify-end month-expenses">约¥15/月</div>-->
<el-divider></el-divider>
<el-divider></el-divider>
<div
class=
"footer-action flex"
>
<div
class=
"footer-action flex"
>
<
el-button
class=
"action-button"
@
click=
"selectedProduct(1,item.id)"
>
加入购物车
</el-button
>
<
!-- <el-button class="action-button" @click="selectedProduct(1,item.id)">加入购物车</el-button>--
>
<el-button
type=
"primary"
class=
"action-button"
@
click=
"selectedProduct(2,item.id)"
>
立即
申请
<el-button
type=
"primary"
class=
"action-button"
@
click=
"selectedProduct(2,item.id)"
>
立即
购买
</el-button>
</el-button>
</div>
</div>
</div>
</div>
...
@@ -153,6 +155,7 @@
...
@@ -153,6 +155,7 @@
<div
class=
"label"
>
型号
</div>
<div
class=
"label"
>
型号
</div>
<div
class=
"value"
>
{{
productDetail
.
model
}}
</div>
<div
class=
"value"
>
{{
productDetail
.
model
}}
</div>
</div>
</div>
</div>
</div>
<div
class=
"info-block"
>
<div
class=
"info-block"
>
...
@@ -240,9 +243,9 @@ import {
...
@@ -240,9 +243,9 @@ import {
computilityMenu
,
computilityMenu
,
getRListByCategory
,
getRListByCategory
,
getRDetail
,
getRDetail
,
orderBuy
,
//
orderBuy,
shoppingAdd
,
shoppingAdd
,
orderComputer
orderComputer
,
bizOrderSubmit
}
from
'@/api/computingResource.js'
}
from
'@/api/computingResource.js'
import
{
useRoute
,
useRouter
}
from
'vue-router'
import
{
useRoute
,
useRouter
}
from
'vue-router'
...
@@ -284,9 +287,10 @@ function tabChange() {
...
@@ -284,9 +287,10 @@ function tabChange() {
}
}
function
getList
()
{
function
getList
()
{
getRListByCategory
({
nav
:
tabActive
.
value
,
pageNum
:
pageNum
.
value
,
pageSize
:
pageSize
.
value
}).
then
(
res
=>
{
getRListByCategory
({
categoryId
:
tabActive
.
value
,
pageNum
:
pageNum
.
value
,
pageSize
:
pageSize
.
value
}).
then
(
res
=>
{
total
.
value
=
res
.
total
total
.
value
=
res
.
total
tableData
.
value
=
res
.
rows
// tableData.value = res.rows
tableData
.
value
=
res
.
data
})
})
}
}
...
@@ -303,41 +307,43 @@ function selectedProduct(type, id) {
...
@@ -303,41 +307,43 @@ function selectedProduct(type, id) {
selectedType
.
value
=
type
selectedType
.
value
=
type
selectedId
.
value
=
id
selectedId
.
value
=
id
getRDetail
({
id
}).
then
(
res
=>
{
getRDetail
({
id
}).
then
(
res
=>
{
res
.
data
.
options
.
forEach
(
item
=>
{
//
res.data.options.forEach(item => {
if
([
0
,
1
,
4
].
includes
(
item
.
type
))
{
//
if ([0, 1, 4].includes(item.type)) {
item
.
value
=
item
.
options
[
0
].
id
//
item.value = item.options[0].id
}
//
}
if
(
item
.
type
===
2
)
{
//
if (item.type === 2) {
item
.
value
=
1
//
item.value = 1
}
//
}
})
//
})
productDetail
.
value
=
res
.
data
productDetail
.
value
=
res
.
data
orderComputerPrice
()
// orderComputerPrice()
orderPrice
.
value
=
res
.
data
.
publicPrice
;
showDrawer
.
value
=
true
showDrawer
.
value
=
true
})
})
}
}
function
initSubmitData
()
{
//
function initSubmitData() {
return
{
//
return {
id
:
selectedId
.
value
,
//
id: selectedId.value,
num
:
form
.
value
.
num
,
//
num: form.value.num,
computerItems
:
productDetail
.
value
.
options
.
map
(
item
=>
{
//
computerItems: productDetail.value.options.map(item => {
if
([
0
,
1
,
4
].
includes
(
item
.
type
))
{
//
if ([0, 1, 4].includes(item.type)) {
return
{
//
return {
id
:
item
.
id
,
//
id: item.id,
name
:
item
.
label
,
//
name: item.label,
valueId
:
item
.
value
//
valueId: item.value
}
//
}
}
//
}
return
{
//
return {
id
:
item
.
id
,
//
id: item.id,
name
:
item
.
label
,
//
name: item.label,
valueId
:
item
.
options
[
0
].
id
,
//
valueId: item.options[0].id,
value
:
item
.
value
.
toString
()
//
value: item.value.toString()
}
//
}
})
//
})
}
//
}
}
//
}
const
orderPrice
=
ref
(
0
)
const
orderPrice
=
ref
(
0
)
...
@@ -347,33 +353,78 @@ function orderComputerPrice() {
...
@@ -347,33 +353,78 @@ function orderComputerPrice() {
})
})
}
}
function
submit
()
{
function
getSubmitData
(){
const
data
=
initSubmitData
()
return
{
if
(
selectedType
.
value
===
1
)
{
skuId
:
selectedId
.
value
,
shoppingAdd
(
data
).
then
(
res
=>
{
ElMessageBox
.
confirm
(
'添加到购物车成功'
,
{
confirmButtonText
:
'去提交'
,
cancelButtonText
:
'关闭'
,
type
:
'success'
}
).
then
(()
=>
{
router
.
push
(
'/computingResource/shoppingCart'
)
}).
catch
(()
=>
{
})
})
}
}
}
if
(
selectedType
.
value
===
2
)
{
function
submit
()
{
orderBuy
(
data
).
then
(
res
=>
{
// 弹出确认对话框
router
.
push
({
ElMessageBox
.
confirm
(
path
:
'/computingResource/confirmOrder'
,
'确定购买吗?'
,
// 对话框提示文字
query
:
{
id
:
res
.
data
}
'购买确认'
,
// 对话框标题
{
confirmButtonText
:
'确认'
,
// 确认按钮文字
cancelButtonText
:
'取消'
,
// 取消按钮文字
type
:
'warning'
// 对话框类型(警告样式)
}
)
.
then
(()
=>
{
// 用户点击“确认”时执行
// 1. 获取提交数据(复用之前的 initSubmitData 函数)
const
submitData
=
getSubmitData
();
// 2. 调用购买接口(此处用 TODO 标记实际接口逻辑)
// TODO: 实际接口调用代码,例如:
bizOrderSubmit
(
submitData
).
then
(
res
=>
{
// 接口调用成功后的处理(如跳转订单页)
}).
catch
(
err
=>
{
// 接口调用失败的处理(如提示错误)
});
// 3. 关闭抽屉(如果需要)
showDrawer
.
value
=
false
;
})
})
})
.
catch
(()
=>
{
}
// 用户点击“取消”时执行(不做任何操作)
// console.log('用户取消购买');
// 可以添加取消后的提示(可选)
// ElMessage({
// type: 'info',
// message: '已取消购买'
// });
});
}
}
// function submit() {
// const data = initSubmitData()
// if (selectedType.value === 1) {
// shoppingAdd(data).then(res => {
// ElMessageBox.confirm(
// '添加到购物车成功',
// {
// confirmButtonText: '去提交',
// cancelButtonText: '关闭',
// type: 'success'
// }
// ).then(() => {
// router.push('/computingResource/shoppingCart')
// }).catch(() => {
// })
// })
//
// }
//
// if (selectedType.value === 2) {
// orderBuy(data).then(res => {
// router.push({
// path: '/computingResource/confirmOrder',
// query: {id: res.data}
// })
// })
// }
// }
</
script
>
</
script
>
<
style
scoped
lang=
"scss"
>
<
style
scoped
lang=
"scss"
>
...
...
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