Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
A
apaas-ui
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
gzga-jzapi
apaas-ui
Commits
9a727ce1
Commit
9a727ce1
authored
Jun 17, 2020
by
徐一鸣
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
应用加购物车和立即申请
parent
4ab69016
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
49 additions
and
15 deletions
+49
-15
src/components/service-info/app-info.vue
src/components/service-info/app-info.vue
+45
-11
src/components/service-info/service-info.vue
src/components/service-info/service-info.vue
+4
-4
No files found.
src/components/service-info/app-info.vue
View file @
9a727ce1
...
@@ -44,9 +44,7 @@
...
@@ -44,9 +44,7 @@
<el-button
<el-button
v-for=
"(item, index) in specifications"
v-for=
"(item, index) in specifications"
:key=
"'specifications_' + index"
:key=
"'specifications_' + index"
:type=
"
:type=
"item.value === specificationID ? 'primary' : 'default'"
item.value === commodityData.specification ? 'primary' : 'default'
"
@
click=
"changeSpecification(item)"
@
click=
"changeSpecification(item)"
>
>
{{
item
.
name
}}
{{
item
.
name
}}
...
@@ -83,21 +81,57 @@ export default {
...
@@ -83,21 +81,57 @@ export default {
value
:
2
,
value
:
2
,
},
},
],
],
commodityData
:
{
specificationID
:
1
,
specification
:
1
,
},
}),
}),
methods
:
{
methods
:
{
changeSpecification
({
value
})
{
changeSpecification
({
value
})
{
this
.
commodityData
.
specification
=
value
;
this
.
specificationID
=
value
;
},
},
addToCart
()
{
addToCart
()
{
console
.
log
(
"
addToCart
"
);
// console.log("addToCart");
console
.
log
(
this
.
commodityData
);
this
.
$http
.
post
(
"
/apaas/serviceapp/v3/shopcart/add
"
,
{
service_id
:
0
,
// 0表示不是服务
app_id
:
parseFloat
(
this
.
data
.
app_id
),
spec_id
:
this
.
specificationID
,
duration
:
1
,
duration_method
:
1
,
is_subscribe
:
0
,
// 是否订阅
})
.
then
(({
data
})
=>
{
if
(
data
.
success
==
1
)
{
this
.
$message
({
message
:
`添加购物车成功`
,
type
:
"
success
"
,
});
this
.
$store
.
commit
(
"
setMenuCartState
"
);
}
else
{
this
.
$message
({
message
:
`添加购物车失败`
,
type
:
"
warning
"
,
});
}
})
.
catch
((
error
)
=>
{
this
.
$message
({
message
:
`添加购物车失败`
,
type
:
"
warning
"
,
});
});
},
},
applyImmediately
()
{
applyImmediately
()
{
console
.
log
(
"
applyImmediately
"
);
// console.log("applyImmediately");
console
.
log
(
this
.
commodityData
);
this
.
$router
.
push
({
path
:
"
/shop/shop_car_apply
"
,
query
:
{
app_id
:
parseFloat
(
this
.
data
.
app_id
),
spec_id
:
this
.
specificationID
,
duration
:
1
,
duration_unit
:
1
,
},
});
},
},
},
},
};
};
...
...
src/components/service-info/service-info.vue
View file @
9a727ce1
...
@@ -153,10 +153,10 @@ export default {
...
@@ -153,10 +153,10 @@ export default {
// console.log("addToCart");
// console.log("addToCart");
this
.
$http
this
.
$http
.
post
(
"
/apaas/serviceapp/v3/shopcart/add
"
,
{
.
post
(
"
/apaas/serviceapp/v3/shopcart/add
"
,
{
service_id
:
parseFloat
(
this
.
data
.
service_id
),
// 0表示不是服务
service_id
:
parseFloat
(
this
.
data
.
service_id
),
app_id
:
parseFloat
(
this
.
data
.
app_id
),
// 0表示不是应用
app_id
:
0
,
// 0表示不是应用
spec_id
:
this
.
specification
.
id
,
// 规格id
duration
:
this
.
duration
,
// 申请时长
duration
:
this
.
duration
,
// 申请时长
spec_id
:
this
.
specification
.
id
,
// 当为服务时,为服务规格 当为应用时 这里是部署方式的规格 1 部署 2开发
duration_method
:
this
.
type
,
// 计时方式 按年 按月
duration_method
:
this
.
type
,
// 计时方式 按年 按月
is_subscribe
:
0
,
// 是否订阅
is_subscribe
:
0
,
// 是否订阅
})
})
...
@@ -186,9 +186,9 @@ export default {
...
@@ -186,9 +186,9 @@ export default {
path
:
"
/shop/shop_car_apply
"
,
path
:
"
/shop/shop_car_apply
"
,
query
:
{
query
:
{
service_id
:
parseFloat
(
this
.
data
.
service_id
),
service_id
:
parseFloat
(
this
.
data
.
service_id
),
spec_id
:
this
.
specification
.
id
,
duration
:
this
.
duration
,
duration
:
this
.
duration
,
duration_unit
:
this
.
type
,
duration_unit
:
this
.
type
,
spec_id
:
this
.
specification
.
id
},
},
});
});
},
},
...
...
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