Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
groupPurchase-miniapp
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
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
彭佳妮(贵阳日报)
groupPurchase-miniapp
Commits
fd695032
Commit
fd695032
authored
Aug 09, 2024
by
张娇(东信)
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
购物车列表ids
parent
0922c162
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
41 additions
and
17 deletions
+41
-17
cart.vue
src/pages/assistingAgriculture/cart/cart.vue
+37
-16
index.vue
src/pages/assistingAgriculture/index/index.vue
+4
-1
No files found.
src/pages/assistingAgriculture/cart/cart.vue
View file @
fd695032
...
...
@@ -10,7 +10,7 @@
<wd-icon
v-if=
"shop.isChecked"
name=
"check1"
></wd-icon>
</div>
<div
class=
"type"
>
店铺
</div>
<div
class=
"shop-name"
@
click=
"toStore"
>
{{
shop
.
shopName
}}
</div>
<div
class=
"shop-name"
@
click=
"toStore
(item)
"
>
{{
shop
.
shopName
}}
</div>
<wd-icon
name=
"arrow-right"
size=
"32rpx"
style=
"margin-left: -15rpx"
></wd-icon>
</div>
<div
class=
"commodity-list"
>
...
...
@@ -51,7 +51,7 @@
<span>
¥
{{
totalPrice
/
100
}}
</span>
</div>
</div>
<div
class=
"submit"
@
tap=
"toSettle"
>
去结算(
{{
totalPrice
/
100
}}
)
</div>
<div
class=
"submit"
@
tap=
"toSettle
(item)
"
>
去结算(
{{
totalPrice
/
100
}}
)
</div>
</div>
</div>
</
template
>
...
...
@@ -114,30 +114,52 @@ const presaleSortList = (index) => {
});
});
};
// 跳转店铺主页
// const toStore = () => {
// xma.navigateTo({
// url: `/pages/assistingAgriculture/shop/index?shopId=1`,
// });
// };
const
selectedItems
=
computed
(()
=>
{
return
cartList
.
value
.
reduce
((
acc
,
shop
)
=>
{
const
selectedProducts
=
shop
.
prodInfos
.
filter
((
item
)
=>
item
.
isChecked
);
return
acc
.
concat
(
selectedProducts
);
},
[]);
});
const
getSelectedItems
=
()
=>
{
return
cartList
.
value
.
reduce
((
acc
,
shop
)
=>
{
const
selectedProducts
=
shop
.
prodInfos
.
filter
((
item
)
=>
item
.
isChecked
);
return
acc
.
concat
(
selectedProducts
);
},
[]);
};
function
toSettle
()
{
const
selected
=
getSelectedItems
();
if
(
selected
.
length
>
0
)
{
console
.
log
(
'Selected items:'
,
selected
);
const
basketIds
=
selected
.
map
((
item
)
=>
item
.
basket
.
basketId
).
join
(
','
);
console
.
log
(
'Basket IDs:'
,
basketIds
);
// TODO: 跳转到结算页面
xma
.
navigateTo
({
url
:
'/pages/assistingAgriculture/cart/ConfirmOrder'
,
url
:
`/pages/assistingAgriculture/cart/ConfirmOrder?ids=
${
basketIds
}
`
,
});
}
else
{
xma
.
showToast
({
title
:
'请选择需要结算的商品!'
,
icon
:
'none'
,
});
}
}
// 跳转店铺主页
const
toStore
=
(
item
)
=>
{
xma
.
navigateTo
({
url
:
`/pages/assistingAgriculture/shop/index?shopId=1`
,
});
};
</
script
>
<
style
lang=
"scss"
scoped
>
uni-page-body
{
height
:
100%
;
}
.cart-wrap
{
height
:
100%
;
background-color
:
#f6f6f6
;
position
:
relative
;
padding
:
20rpx
;
padding-bottom
:
0
;
padding-bottom
:
220rpx
;
box-sizing
:
border-box
;
display
:
flex
;
flex-direction
:
column
;
...
...
@@ -161,9 +183,8 @@ uni-page-body {
}
.shop
{
background-color
:
#fff
;
padding
:
32rpx
20rpx
;
padding
:
32rpx
20rpx
120rpx
20rpx
;
margin-bottom
:
20rpx
;
.shop-info
{
.type
{
padding
:
3rpx
6rpx
;
...
...
@@ -217,7 +238,7 @@ uni-page-body {
}
}
.total
{
position
:
absolute
;
position
:
fixed
;
bottom
:
0
;
left
:
0
;
width
:
100%
;
...
...
src/pages/assistingAgriculture/index/index.vue
View file @
fd695032
...
...
@@ -146,7 +146,10 @@ const toBuilding = (item) => {
url
:
`/pages/assistingAgriculture/RuralTravel/RuralTravel?categoryId=
${
item
.
categoryId
}
`
,
});
}
else
{
console
.
log
(
222
);
xma
.
showToast
({
title
:
'正在开发中!'
,
icon
:
'none'
,
});
}
};
// 跳转详情页
...
...
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