Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
M
mayi-mp-shop
Overview
Overview
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
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
程默
mayi-mp-shop
Commits
611d0c69
Commit
611d0c69
authored
Jan 11, 2024
by
侯体倬
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
折扣价优化
parent
4caca564
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
17 additions
and
17 deletions
+17
-17
static/nativeComponents/GoodsList/GoodsItem/index.js
+16
-16
static/nativeComponents/GoodsList/GoodsItem/index.wxml
+1
-1
No files found.
static/nativeComponents/GoodsList/GoodsItem/index.js
View file @
611d0c69
...
@@ -46,13 +46,19 @@ const componentOptions = {
...
@@ -46,13 +46,19 @@ const componentOptions = {
this
.
getSecKillInfo
(
val
);
this
.
getSecKillInfo
(
val
);
}
}
}
}
// 判断当前商品行数是否为 3,如果为 3 进行格式化
// 价格设置
const
columnNumFlag
=
this
.
data
.
datas
.
componentData
[
'columnNum'
]
==
3
;
const
minPrice
=
+
this
.
data
.
minPrice
;
this
.
setData
({
if
(
+
val
.
minPrice
<
minPrice
||
minPrice
==
0
)
{
minPrice
:
columnNumFlag
?
this
.
keepSelfNum
(
val
.
minPrice
||
0
)
:
val
.
minPrice
,
this
.
setData
({
minPrice
:
this
.
keepTwoNum
(
val
.
minPrice
||
0
)
});
minGoodsSuggestedRetailPrice
:
columnNumFlag
?
this
.
keepSelfNum
(
val
.
minGoodsSuggestedRetailPrice
||
0
)
:
val
.
minGoodsSuggestedRetailPrice
}
})
const
minGoodsSuggestedRetailPrice
=
+
this
.
data
.
minGoodsSuggestedRetailPrice
;
}
if
(
+
val
.
minGoodsSuggestedRetailPrice
<
minGoodsSuggestedRetailPrice
||
minGoodsSuggestedRetailPrice
==
0
)
{
this
.
setData
({
minGoodsSuggestedRetailPrice
:
this
.
keepTwoNum
(
val
.
minGoodsSuggestedRetailPrice
||
0
)
})
}
},
},
},
// 组件方法
// 组件方法
methods
:
{
methods
:
{
...
@@ -149,7 +155,7 @@ const componentOptions = {
...
@@ -149,7 +155,7 @@ const componentOptions = {
// 秒杀结束
// 秒杀结束
handleSecFinish
()
{
handleSecFinish
()
{
this
.
setData
({
isBeginSecKill
:
false
});
this
.
setData
({
isBeginSecKill
:
false
});
this
.
setData
({
items
:
{
...
this
.
data
.
items
,
secondKillActivityInfoGoodsList
:
null
}
})
this
.
setData
({
'items.secondKillActivityInfoGoodsList'
:
null
})
},
},
getSaleTime
(
val
)
{
getSaleTime
(
val
)
{
return
new
Date
(
val
.
replace
(
/-/g
,
"/"
)).
getTime
()
-
new
Date
().
getTime
();
return
new
Date
(
val
.
replace
(
/-/g
,
"/"
)).
getTime
()
-
new
Date
().
getTime
();
...
@@ -289,15 +295,9 @@ const componentOptions = {
...
@@ -289,15 +295,9 @@ const componentOptions = {
"items.coverImage"
:
"https://cdn.mayi888.com/product/85pdScJ5ch.jpg?x-oss-process=image/resize,m_pad,limit_0,w_400,h_400"
,
"items.coverImage"
:
"https://cdn.mayi888.com/product/85pdScJ5ch.jpg?x-oss-process=image/resize,m_pad,limit_0,w_400,h_400"
,
})
})
},
},
keepSelfNum
(
num
)
{
keepTwoNum
(
num
)
{
let
r
;
num
=
Number
(
num
);
num
=
Number
(
num
);
try
{
return
isNaN
(
num
)
?
0
:
num
.
toFixed
(
2
);
r
=
num
.
toString
().
split
(
"."
)[
1
].
length
;
}
catch
(
e
)
{
r
=
0
;
}
return
num
.
toFixed
(
r
);
}
}
},
},
// 组件生命周期
// 组件生命周期
...
...
static/nativeComponents/GoodsList/GoodsItem/index.wxml
View file @
611d0c69
...
@@ -185,7 +185,7 @@
...
@@ -185,7 +185,7 @@
wx:elif="{{datas.componentData['priceShow']}}"
wx:elif="{{datas.componentData['priceShow']}}"
>
>
<text>¥{{items!=null ? minPrice : 0}}</text>
<text>¥{{items!=null ? minPrice : 0}}</text>
<text style="font-size:24rpx;color:#999;text-decoration:line-through;" wx:if="{{items!=null&&datas.componentData['priceMarking']&&items['minGoodsSuggestedRetailPrice']&&(
items['minPrice']-0<items['minGoodsSuggestedRetailPrice']
-0)&&datas.componentData['columnNum']<4}}">¥{{minGoodsSuggestedRetailPrice}}</text>
<text style="font-size:24rpx;color:#999;text-decoration:line-through;" wx:if="{{items!=null&&datas.componentData['priceMarking']&&items['minGoodsSuggestedRetailPrice']&&(
minPrice-0<minGoodsSuggestedRetailPrice
-0)&&datas.componentData['columnNum']<4}}">¥{{minGoodsSuggestedRetailPrice}}</text>
</view>
</view>
<view class="vipPrice2 flex" wx:if="{{datas.componentData.vipPrice}}">
<view class="vipPrice2 flex" wx:if="{{datas.componentData.vipPrice}}">
<view class="left" wx:if="{{items.showVipPrice==true}}">
<view class="left" wx:if="{{items.showVipPrice==true}}">
...
...
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