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
9e0080c0
提交
9e0080c0
authored
12月 08, 2022
作者:
刘旭
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
优化
上级
8a48774d
隐藏空白字符变更
内嵌
并排
正在显示
5 个修改的文件
包含
61 行增加
和
21 行删除
+61
-21
index.ts
src/api/index.ts
+4
-1
goodsSku.vue
src/pages/goods/goodsSku.vue
+37
-18
checkout.vue
src/pages/order/checkout.vue
+14
-2
quotation.vue
src/pages/order/quotation.vue
+4
-0
address.vue
src/pages/profile/address.vue
+2
-0
没有找到文件。
src/api/index.ts
浏览文件 @
9e0080c0
...
...
@@ -9,6 +9,9 @@ export const indexDetails = (data: any) => request('/wx/goods/detail', 'GET', da
// 加入购物车
export
const
addCart
=
(
data
:
any
)
=>
request
(
'/wx/cart/add'
,
'POST'
,
data
);
// 加入购物车后重新选择规格
export
const
readdCart
=
(
data
:
any
)
=>
request
(
'/wx/cart/readd'
,
'POST'
,
data
);
// 立即购买
export
const
fastaddCart
=
(
data
:
any
)
=>
request
(
'/wx/cart/fastadd'
,
'POST'
,
data
);
...
...
@@ -53,6 +56,6 @@ export const pushOrder = (data: any) => request('/wx/order/push', 'GET', data);
// 获取商品配件
export
const
goodsParts
=
(
data
:
any
)
=>
request
(
'/wx/goods/parts'
,
'GET'
,
data
);
// 查询商品参数属性 ?productId=1
export
const
orderAttribute
=
(
data
:
any
)
=>
request
(
'/wx/cart/attribute'
,
'GET'
,
data
);
src/pages/goods/goodsSku.vue
浏览文件 @
9e0080c0
...
...
@@ -25,7 +25,7 @@
<
script
setup
lang=
"ts"
>
import
{
ref
,
watch
}
from
'vue'
;
import
{
addCart
,
fastaddCart
}
from
'@/api/index'
;
import
{
addCart
,
fastaddCart
,
readdCart
}
from
'@/api/index'
;
// SKU弹窗模式
let
skuMode
=
ref
(
1
);
...
...
@@ -174,23 +174,42 @@ let addCartFn = (obj: any) => {
specificationCustom
,
partIds
:
partsIds
.
value
}
if
(
props
.
cartId
)
data
=
{
...{
id
:
props
.
cartId
},
...
data
}
addCart
(
data
).
then
((
res
:
any
)
=>
{
if
(
res
.
data
.
code
===
200
)
{
uni
.
showToast
({
title
:
'已添加至购物车'
,
icon
:
'none'
,
duration
:
300
,
success
()
{
handleClose
()
emits
(
'partsClose'
)
// 还原
skuKey
.
value
=
false
}
});
}
else
{
console
.
log
(
res
,
'加入购物车错误'
);
}
})
if
(
props
.
cartId
)
{
data
=
{
...{
id
:
props
.
cartId
},
...
data
}
readdCart
(
data
).
then
((
res
:
any
)
=>
{
if
(
res
.
data
.
code
===
200
)
{
uni
.
showToast
({
title
:
'已添加至购物车'
,
icon
:
'none'
,
duration
:
300
,
success
()
{
handleClose
()
emits
(
'partsClose'
)
// 还原
skuKey
.
value
=
false
}
});
}
else
{
console
.
log
(
res
,
'加入购物车错误'
);
}
})
}
else
{
addCart
(
data
).
then
((
res
:
any
)
=>
{
if
(
res
.
data
.
code
===
200
)
{
uni
.
showToast
({
title
:
'已添加至购物车'
,
icon
:
'none'
,
duration
:
300
,
success
()
{
handleClose
()
emits
(
'partsClose'
)
// 还原
skuKey
.
value
=
false
}
});
}
else
{
console
.
log
(
res
,
'加入购物车错误'
);
}
})
}
};
// 加入购物车按钮
let
addCarts
=
(
selectShop
:
any
)
=>
{
...
...
src/pages/order/checkout.vue
浏览文件 @
9e0080c0
...
...
@@ -167,14 +167,26 @@ const onsubmit = () => {
});
};
let
addressId
=
ref
(
null
);
// 但值为null时,显示为默认地址
// 重新选择地址时的回调
uni
.
$on
(
'updataAddressId'
,
(
data
:
any
)
=>
{
uni
.
setStorage
({
key
:
'addressId'
,
data
:
data
.
id
,
success
()
{
addressId
.
value
=
uni
.
getStorageSync
(
'addressId'
);
},
});
});
// 初始化数据
const
initCheckoutCart
=
(
cartId
:
number
,
types
:
number
)
=>
{
let
couponId
=
uni
.
getStorageSync
(
'couponId'
);
let
addressId
=
uni
.
getStorageSync
(
'addressId'
);
//
let addressId = uni.getStorageSync('addressId');
checkoutCart
({
cartId
,
couponId
,
addressId
,
addressId
:
addressId
.
value
,
type
:
types
,
}).
then
((
res
:
any
)
=>
{
if
(
res
.
data
.
code
===
200
)
{
...
...
src/pages/order/quotation.vue
浏览文件 @
9e0080c0
...
...
@@ -334,6 +334,10 @@ let priceCheck = (val: any, index: number) => {
if
(
val
<=
0
)
{
nextTick
(()
=>
{
detailData
.
value
[
index
].
unitPrice
=
''
uni
.
showToast
({
title
:
'不能为负数'
,
icon
:
'none'
})
})
}
}
...
...
src/pages/profile/address.vue
浏览文件 @
9e0080c0
...
...
@@ -88,6 +88,8 @@ const setAddress = (item: any) => {
success
:
function
()
{
if
(
beforePage
.
route
===
'pages/order/quotation'
)
uni
.
$emit
(
'updateAddress'
,
{
addr
:
item
});
if
(
beforePage
.
route
===
'pages/order/checkout'
)
uni
.
$emit
(
'updataAddressId'
,
{
id
:
item
.
id
});
},
});
},
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论