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
9745141f
提交
9745141f
authored
11月 23, 2022
作者:
刘旭
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
优化商品属性
上级
3612a4e5
隐藏空白字符变更
内嵌
并排
正在显示
6 个修改的文件
包含
101 行增加
和
55 行删除
+101
-55
index.ts
src/api/index.ts
+5
-2
profile.ts
src/api/profile.ts
+3
-0
goodsSku.vue
src/pages/goods/goodsSku.vue
+4
-3
index.vue
src/pages/goods/index.vue
+60
-27
index.vue
src/pages/profile/index.vue
+19
-10
request.ts
src/utils/request.ts
+10
-13
没有找到文件。
src/api/index.ts
浏览文件 @
9745141f
...
...
@@ -49,7 +49,10 @@ export const collectAddordelete = (data: any) => request('/wx/collect/addordelet
export
const
getTax
=
()
=>
request
(
'/wx/config/tax'
,
'GET'
);
// 推送订单
export
const
pushOrder
=
(
data
:
any
)
=>
request
(
'/wx/order/push'
,
'GET'
,
data
)
export
const
pushOrder
=
(
data
:
any
)
=>
request
(
'/wx/order/push'
,
'GET'
,
data
)
;
// 获取商品配件
export
const
goodsParts
=
(
data
:
any
)
=>
request
(
'/wx/goods/parts'
,
'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/api/profile.ts
浏览文件 @
9745141f
...
...
@@ -20,3 +20,6 @@ export const resetAvatar = (data: any) => request('/wx/auth/reset_avatar', 'POST
// 客户-收货人
export
const
consigneeList
=
(
data
?:
any
)
=>
request
(
'/wx/address/consignee'
,
'GET'
,
data
);
// 查询每个状态订单数
export
const
orderCount
=
()
=>
request
(
'/wx/user/index'
,
'GET'
);
src/pages/goods/goodsSku.vue
浏览文件 @
9745141f
...
...
@@ -42,9 +42,10 @@ let selectedGoodsSum = ref(1)
let
emits
=
defineEmits
([
'selected'
,
'addProduct'
,
'close-sku'
,
'partsClose'
])
watch
([
selectedGoodsItem
,
selectedGoodsSum
],(
newVal
)
=>
{
// console.log(newVal);
emits
(
'selected'
,
newVal
)
},{
immediate
:
true
})
if
(
newVal
)
{
if
(
newVal
[
0
]
!==
undefined
)
emits
(
'selected'
,
newVal
)
}
})
let
onChange
=
(
e
:
any
)
=>
{
selectedGoodsItem
.
value
=
e
.
sku_name_arr
...
...
src/pages/goods/index.vue
浏览文件 @
9745141f
...
...
@@ -3,7 +3,7 @@
<!-- 轮播图 -->
<view
class=
"wrap"
>
<u-swiper
:list=
"detailData?.info.gallery"
:list=
"detailData?.info.gallery
? detailData?.info.gallery : []
"
img-mode=
"scaleToFill"
height=
"800"
></u-swiper>
...
...
@@ -102,23 +102,23 @@
<u-popup
v-model=
"attrPopup"
mode=
"bottom"
height=
"50%"
closeable
>
<view
class=
"attr-content"
>
<view
class=
"title"
>
商品属性
</view>
<view
v-if=
"
detailData?.attribute
.length !== 0"
>
<
view
v-for=
"(item, index) in detailData?.attribute"
:key=
"item.id"
class=
"details"
>
<text
class=
"left"
>
{{
item
.
attribute
}}
</text
>
<
text
class=
"right"
>
{{
item
.
value
}}
</text
>
<u-line
v-show=
"
detailData?.attribute
.length - 1 !== index"
/>
</
vie
w>
<view
v-if=
"
attributeData
.length !== 0"
>
<
u-row
v-for=
"(item, index) in attributeData"
:key=
"item.id"
>
<u-col
:span=
"4"
>
<view
class=
"left"
>
{{
item
.
attribute
}}
</view>
</u-col>
<u-col
:span=
"8"
>
<view
class=
"right"
>
{{
item
.
value
}}
</view
>
<
/u-col
>
<u-line
v-show=
"
attributeData
.length - 1 !== index"
/>
</
u-ro
w>
</view>
<view
v-else
><u-empty
text=
"暂无属性"
mode=
"data"
/></view>
</view>
</u-popup>
</view>
<goodsSku
ref=
"goodsSkuRef"
@
selected=
"selected"
@
partsClose=
'partsClose'
></goodsSku>
<goodsSku
ref=
"goodsSkuRef"
@
selected=
"selected"
@
partsClose=
"partsClose"
></goodsSku>
</
template
>
<
script
lang=
"ts"
setup
>
...
...
@@ -127,7 +127,8 @@ import { onLoad } from '@dcloudio/uni-app';
import
{
indexDetails
,
collectAddordelete
,
goodsParts
goodsParts
,
orderAttribute
}
from
'@/api/index'
;
import
goodsSku
from
'./goodsSku'
...
...
@@ -137,6 +138,7 @@ const detailData: any = ref();
const
partsData
=
ref
();
const
tabButtons
=
ref
([
'商品详情'
]);
let
current
=
ref
(
0
);
let
attributeData
=
ref
([]
as
any
)
const
goodsInfo
=
ref
({
id
:
1
,
...
...
@@ -185,6 +187,21 @@ let selectedGoods = computed(() => {
const
selected
=
(
data
:
any
)
=>
{
selectedGoodsItem
.
value
=
data
[
0
]
selectedGoodsSum
.
value
=
data
[
1
]
let
productId
;
detailData
.
value
?.
productList
.
forEach
((
item
:
any
)
=>
{
// 判断是否相等
if
(
item
.
specifications
.
length
===
data
[
0
].
length
)
{
let
bool
=
true
item
.
specifications
.
forEach
((
res
:
any
)
=>
{
if
(
data
[
0
].
indexOf
(
res
)
==
-
1
)
bool
=
false
})
if
(
bool
)
productId
=
item
.
id
bool
=
true
}
})
if
(
productId
)
initAttribute
(
productId
)
else
attributeData
.
value
=
null
}
// 点击分组
...
...
@@ -242,6 +259,15 @@ const onClickItem = (e: any) => {
}
};
const
initAttribute
=
(
productId
:
number
)
=>
{
orderAttribute
({
productId
}).
then
((
res
:
any
)
=>
{
if
(
res
.
data
.
code
===
200
)
{
attributeData
.
value
=
res
.
data
.
data
console
.
log
(
'Attribute'
,
res
);
}
})
}
// 初始化商品详情数据
const
initDetails
=
(
id
:
number
)
=>
{
indexDetails
({
...
...
@@ -517,7 +543,7 @@ const initParts = (id: number) => {
left
:
var
(
--
window-left
);
right
:
var
(
--
window-right
);
bottom
:
0
;
z-index
:
99
;
z-index
:
0
99
;
padding-bottom
:
constant
(
safe-area-inset-bottom
);
background-color
:
#ffffff
;
padding-bottom
:
env
(
safe-area-inset-bottom
);
...
...
@@ -529,22 +555,29 @@ const initParts = (id: number) => {
.title
{
text-align
:
center
;
margin-bottom
:
10
0rpx
;
margin-bottom
:
5
0rpx
;
}
.details
{
width
:
100%
;
font-size
:
14px
;
.left
{
display
:
inline-block
;
width
:
40%
;
padding
:
20rpx
0
;
}
.left
{
padding
:
20rpx
0
;
// overflow: hidden;
// text-overflow: ellipsis; /* 超出部分省略号 */
// word-break: break-all; /* break-all(允许在单词内换行。) */
// display: -webkit-box; /* 对象作为伸缩盒子模型显示 */
// -webkit-box-orient: vertical; /* 设置或检索伸缩盒对象的子元素的排列方式 */
// -webkit-line-clamp: 2; /* 显示的行数 */
// max-height: 80rpx; /* 设置最大高度,根据行高,要几行乘以几倍 */
}
.right
{
padding
:
20rpx
0
;
}
.right
{
padding
:
20rpx
0
;
// overflow: hidden;
// text-overflow: ellipsis; /* 超出部分省略号 */
// word-break: break-all; /* break-all(允许在单词内换行。) */
// display: -webkit-box; /* 对象作为伸缩盒子模型显示 */
// -webkit-box-orient: vertical; /* 设置或检索伸缩盒对象的子元素的排列方式 */
// -webkit-line-clamp: 2; /* 显示的行数 */
// max-height: 80rpx; /* 设置最大高度,根据行高,要几行乘以几倍 */
}
}
</
style
>
src/pages/profile/index.vue
浏览文件 @
9745141f
...
...
@@ -62,16 +62,13 @@
<
script
lang=
"ts"
setup
>
import
{
ref
}
from
'vue'
;
const
toLogin
=
()
=>
{
uni
.
navigateTo
({
url
:
'../login/login'
,
});
};
import
{
orderCount
}
from
'@/api/profile'
;
let
nickName
=
uni
.
getStorageSync
(
'nickName'
);
const
orderBtnList
=
ref
([
let
orderStatusCount
=
ref
();
let
orderBtnList
=
ref
([
{
url
:
'/static/my/tuisongshezhi.png'
,
text
:
'待推送'
,
...
...
@@ -98,7 +95,7 @@ const orderBtnList = ref([
},
]);
cons
t
expandBtnList
=
ref
([
le
t
expandBtnList
=
ref
([
{
url
:
'/static/my/wodeshoucang.png'
,
text
:
'我的收藏'
,
...
...
@@ -119,6 +116,18 @@ const expandBtnList = ref([
},
]);
let
initOrderCount
=
()
=>
{
orderCount
().
then
((
res
:
any
)
=>
{
if
(
res
.
data
.
code
===
200
)
{
orderStatusCount
.
value
=
res
.
data
.
data
.
order
;
orderBtnList
.
value
[
0
].
badge
=
orderStatusCount
.
value
.
unpush
;
orderBtnList
.
value
[
1
].
badge
=
orderStatusCount
.
value
.
unproduction
;
orderBtnList
.
value
[
2
].
badge
=
orderStatusCount
.
value
.
undeliver
;
orderBtnList
.
value
[
3
].
badge
=
orderStatusCount
.
value
.
uncompleted
;
}
});
};
initOrderCount
();
let
change
=
(
e
:
any
)
=>
{
let
index
=
e
.
detail
.
index
;
switch
(
index
)
{
...
...
@@ -139,11 +148,11 @@ let handleOrderTypeChange = (e: any) => {
uni
.
navigateTo
({
url
:
'/pages/order/orderList?showType='
+
index
});
};
cons
t
showAllOrder
=
()
=>
{
le
t
showAllOrder
=
()
=>
{
uni
.
navigateTo
({
url
:
'/pages/order/orderList'
});
};
cons
t
toSetting
=
()
=>
{
le
t
toSetting
=
()
=>
{
uni
.
navigateTo
({
url
:
'./setting'
});
};
</
script
>
...
...
src/utils/request.ts
浏览文件 @
9745141f
import
config
from
'./config'
;
import
{
nextTick
}
from
'vue'
;
const
baseUrl
=
config
.
baseUrl
;
// 封装公共申请办法
...
...
@@ -43,9 +42,16 @@ function request(url: string, method: 'GET' | 'POST' | 'PUT' | 'DELETE', data?:
title
:
res
.
data
.
msg
,
icon
:
'none'
,
});
}
else
if
(
res
.
error
==
'invalid_token'
)
{
console
.
log
(
'token'
,
res
);
uni
.
clearStorage
();
}
else
if
(
res
.
data
.
code
==
911
)
{
uni
.
reLaunch
({
url
:
'/pages/login/login'
,
success
()
{
uni
.
showToast
({
title
:
'请登录'
,
icon
:
'none'
,
});
},
});
}
else
{
console
.
log
(
res
,
'非200错误'
);
//其余异样
...
...
@@ -60,15 +66,6 @@ function request(url: string, method: 'GET' | 'POST' | 'PUT' | 'DELETE', data?:
title
:
'连接服务器失败'
,
icon
:
'none'
,
});
uni
.
reLaunch
({
url
:
'/pages/login/login'
,
success
()
{
uni
.
showToast
({
title
:
'请登录'
,
icon
:
'none'
,
});
},
});
reject
(
err
);
},
});
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论