Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
Y
yongxinda-h5
Project
Project
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
Graph
比较
统计图
议题
0
议题
0
列表
看板
标记
Milestones
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
刘旭
yongxinda-h5
Commits
e3856b2b
提交
e3856b2b
authored
12月 09, 2022
作者:
刘旭
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
补充收藏功能
上级
b14cd9de
隐藏空白字符变更
内嵌
并排
正在显示
5 个修改的文件
包含
83 行增加
和
8 行删除
+83
-8
index.ts
src/api/index.ts
+4
-1
goodsItem.vue
src/components/goodsItem.vue
+18
-0
index.vue
src/pages/cart/index.vue
+1
-1
productLine.vue
src/pages/productLine/productLine.vue
+5
-3
collection.vue
src/pages/profile/collection.vue
+55
-3
没有找到文件。
src/api/index.ts
浏览文件 @
e3856b2b
...
@@ -48,7 +48,10 @@ export const getCollectList = (data: any) => request('/wx/collect/list', 'GET',
...
@@ -48,7 +48,10 @@ export const getCollectList = (data: any) => request('/wx/collect/list', 'GET',
// 添加或取消收藏
// 添加或取消收藏
export
const
collectAddordelete
=
(
data
:
any
)
=>
request
(
'/wx/collect/addordelete'
,
'POST'
,
data
);
export
const
collectAddordelete
=
(
data
:
any
)
=>
request
(
'/wx/collect/addordelete'
,
'POST'
,
data
);
// 添加或取消收藏
// 删除收藏
export
const
deleteCollect
=
(
data
:
any
)
=>
request
(
'/wx/collect/addordelete'
,
'POST'
,
data
);
// 查询税率
export
const
getTax
=
()
=>
request
(
'/wx/config/tax'
,
'GET'
);
export
const
getTax
=
()
=>
request
(
'/wx/config/tax'
,
'GET'
);
// 推送订单
// 推送订单
...
...
src/components/goodsItem.vue
浏览文件 @
e3856b2b
...
@@ -17,6 +17,12 @@
...
@@ -17,6 +17,12 @@
</text>
-->
</text>
-->
</view>
</view>
</view>
</view>
<view
v-if=
"isCollection"
style=
"width: 59%; height: 100%; display: flex; justify-content: flex-end; align-items: flex-end;"
>
<u-button
size=
"mini"
style=
"margin: 0;"
@
tap=
"tapCollection"
>
删除
</u-button>
</view>
</view>
</view>
</
template
>
</
template
>
...
@@ -51,7 +57,19 @@ let props = defineProps({
...
@@ -51,7 +57,19 @@ let props = defineProps({
type
:
Number
,
type
:
Number
,
default
:
0
,
default
:
0
,
},
},
// 删除收藏按钮
isCollection
:
{
type
:
Boolean
,
default
:
false
,
},
});
});
let
emits
=
defineEmits
([
'tapDelCollection'
]);
// 点击按钮
let
tapCollection
=
()
=>
{
emits
(
'tapDelCollection'
);
};
</
script
>
</
script
>
<
style
lang=
"scss"
scoped
>
<
style
lang=
"scss"
scoped
>
...
...
src/pages/cart/index.vue
浏览文件 @
e3856b2b
...
@@ -379,7 +379,7 @@ const valChange = (e: any, item: any) => {
...
@@ -379,7 +379,7 @@ const valChange = (e: any, item: any) => {
// 初始化数据
// 初始化数据
const
initCartIndex
=
(
types
:
number
)
=>
{
const
initCartIndex
=
(
types
:
number
)
=>
{
getCartIndex
({
types
}).
then
((
res
:
any
)
=>
{
getCartIndex
({
type
:
type
s
}).
then
((
res
:
any
)
=>
{
if
(
res
.
data
.
code
===
200
)
{
if
(
res
.
data
.
code
===
200
)
{
cartList
.
value
=
res
.
data
.
data
.
cartList
;
cartList
.
value
=
res
.
data
.
data
.
cartList
;
totalPrice
.
value
=
res
.
data
.
data
.
cartTotal
.
checkedGoodsAmount
.
toFixed
(
2
);
totalPrice
.
value
=
res
.
data
.
data
.
cartTotal
.
checkedGoodsAmount
.
toFixed
(
2
);
...
...
src/pages/productLine/productLine.vue
浏览文件 @
e3856b2b
...
@@ -49,7 +49,7 @@
...
@@ -49,7 +49,7 @@
typeof scope.row.isSubmit === 'undefined'
typeof scope.row.isSubmit === 'undefined'
? false
? false
: !scope.row.isSubmit && !scope.row.deleted
: !scope.row.isSubmit && !scope.row.deleted
"
"
name=
"error-circle-fill"
name=
"error-circle-fill"
color=
"#0055ff"
color=
"#0055ff"
style=
"margin-right: 4rpx;"
style=
"margin-right: 4rpx;"
...
@@ -175,18 +175,20 @@ let buttonGroup = ref([
...
@@ -175,18 +175,20 @@ let buttonGroup = ref([
},
},
]);
]);
let
cartId
=
ref
();
// 修改的产品线id
let
lineId
=
ref
();
// 修改的产品线id
let
lineId
=
ref
();
// 修改的产品线id
onLoad
((
options
:
any
)
=>
{
onLoad
((
options
:
any
)
=>
{
// 修改产品线时使用
// 修改产品线时使用
if
(
typeof
options
.
cartId
!==
'undefined'
)
{
if
(
typeof
options
.
cartId
!==
'undefined'
)
{
cartId
.
value
=
options
.
cartId
;
flag
.
value
=
false
;
flag
.
value
=
false
;
lineId
.
value
=
options
.
id
;
lineId
.
value
=
options
.
id
;
// 把加入购物车变成禁用状态
// 把加入购物车变成禁用状态
// buttonGroup.value[0].backgroundColor = '#ccc';
// buttonGroup.value[0].backgroundColor = '#ccc';
initProductLine
(
options
.
id
);
initProductLine
(
options
.
id
);
}
else
if
(
typeof
options
.
collectionId
!==
'undefined'
)
{
flag
.
value
=
false
;
// 把加入购物车变成禁用状态
initProductLine
(
options
.
id
);
}
else
{
}
else
{
flag
.
value
=
true
;
flag
.
value
=
true
;
}
}
...
...
src/pages/profile/collection.vue
浏览文件 @
e3856b2b
...
@@ -9,6 +9,8 @@
...
@@ -9,6 +9,8 @@
:name=
"item.name"
:name=
"item.name"
:brief=
"item.brief"
:brief=
"item.brief"
:retailPrice=
"item.retailPrice"
:retailPrice=
"item.retailPrice"
:isCollection=
"true"
@
tapDelCollection=
"delCollection(item)"
@
tap=
"toGoods(item.valueId)"
@
tap=
"toGoods(item.valueId)"
/>
/>
</view>
</view>
...
@@ -16,19 +18,23 @@
...
@@ -16,19 +18,23 @@
<view
<view
v-for=
"item in collectList"
v-for=
"item in collectList"
:key=
"item.id"
:key=
"item.id"
style=
"width: 100%; height: 80rpx; line-height: 80rpx; background-color: #fff; padding: 0 30rpx; margin-bottom: 4rpx;"
class=
"product-collection"
@
tap=
"toProductLine(item.valueId)"
>
>
{{
item
.
name
}}
{{
item
.
name
}}
<u-button
size=
"mini"
style=
"margin: 0;"
@
tap=
"delCollection(item)"
>
删除
</u-button>
</view>
</view>
</view>
</view>
<view
style=
"padding: 20rpx;"
><u-loadmore
:status=
"status"
icon-type=
"flower"
/></view>
<view
style=
"padding: 20rpx;"
><u-loadmore
:status=
"status"
icon-type=
"flower"
/></view>
</view>
</view>
<u-empty
v-else
text=
"收藏为空"
mode=
"list"
style=
"margin: 200rpx auto;"
></u-empty>
<u-empty
v-else
text=
"收藏为空"
mode=
"list"
style=
"margin: 200rpx auto;"
></u-empty>
<u-modal
v-model=
"show"
show-cancel-button
:content=
"content"
@
confirm=
"onConfirm"
></u-modal>
</
template
>
</
template
>
<
script
setup
lang=
"ts"
>
<
script
setup
lang=
"ts"
>
import
{
ref
}
from
'vue'
;
import
{
ref
}
from
'vue'
;
import
{
getCollectList
}
from
'@/api/index'
;
import
{
getCollectList
,
deleteCollect
}
from
'@/api/index'
;
import
{
onReachBottom
}
from
'@dcloudio/uni-app'
;
import
{
onReachBottom
}
from
'@dcloudio/uni-app'
;
import
goodsItem
from
'@/components/goodsItem.vue'
;
import
goodsItem
from
'@/components/goodsItem.vue'
;
...
@@ -42,6 +48,10 @@ let total = ref(0);
...
@@ -42,6 +48,10 @@ let total = ref(0);
let
status
=
ref
(
'loadmore'
);
let
status
=
ref
(
'loadmore'
);
let
show
=
ref
(
false
);
let
content
=
ref
(
'是否取消收藏该商品'
);
let
collectList
=
ref
([]
as
any
);
let
collectList
=
ref
([]
as
any
);
let
list
=
ref
([
let
list
=
ref
([
...
@@ -58,6 +68,12 @@ let list = ref([
...
@@ -58,6 +68,12 @@ let list = ref([
let
current
=
ref
(
0
);
let
current
=
ref
(
0
);
// 删除商品传入参数
let
delGoods
=
ref
({
type
:
0
,
valueId
:
0
,
});
// 上拉加载数据
// 上拉加载数据
onReachBottom
(()
=>
{
onReachBottom
(()
=>
{
// 判断是否还有下一页数据
// 判断是否还有下一页数据
...
@@ -81,6 +97,30 @@ let toGoods = (id: number) => {
...
@@ -81,6 +97,30 @@ let toGoods = (id: number) => {
uni
.
navigateTo
({
url
:
'/pages/goods/index?id='
+
id
});
uni
.
navigateTo
({
url
:
'/pages/goods/index?id='
+
id
});
};
};
let
toProductLine
=
(
id
:
any
)
=>
{
uni
.
reLaunch
({
url
:
'../productLine/productLine?id='
+
id
+
'&collectionId=0'
,
});
};
let
delCollection
=
(
item
:
any
)
=>
{
if
(
item
.
type
===
0
)
content
.
value
=
'是否取消收藏该商品'
;
content
.
value
=
'是否取消收藏该产品线'
;
delGoods
.
value
.
type
=
item
.
type
;
delGoods
.
value
.
valueId
=
item
.
valueId
;
show
.
value
=
true
;
};
// 确认删除
let
onConfirm
=
()
=>
{
deleteCollect
(
delGoods
.
value
).
then
((
res
:
any
)
=>
{
if
(
res
.
data
.
code
===
200
)
{
collectList
.
value
=
[];
init
();
}
});
};
let
init
=
()
=>
{
let
init
=
()
=>
{
status
.
value
=
'loading'
;
status
.
value
=
'loading'
;
getCollectList
(
collectQuery
.
value
).
then
((
res
:
any
)
=>
{
getCollectList
(
collectQuery
.
value
).
then
((
res
:
any
)
=>
{
...
@@ -95,4 +135,16 @@ let init = () => {
...
@@ -95,4 +135,16 @@ let init = () => {
init
();
init
();
</
script
>
</
script
>
<
style
></
style
>
<
style
lang=
"scss"
scoped
>
.product-collection
{
width
:
100%
;
height
:
80rpx
;
line-height
:
80rpx
;
background-color
:
#fff
;
padding
:
0
30rpx
;
margin-bottom
:
4rpx
;
display
:
flex
;
justify-content
:
space-between
;
align-items
:
center
;
}
</
style
>
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论