Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
T
taobao-mini-template
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
2
Issues
2
List
Board
Labels
Milestones
Merge Requests
1
Merge Requests
1
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
qinhaitao
taobao-mini-template
Commits
010974be
Commit
010974be
authored
Sep 03, 2020
by
李硕
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
奖品概率和定义字段添加
parent
1254fc22
Changes
8
Show whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
87 additions
and
73 deletions
+87
-73
prize-dialog.acss
client/components/dialog/prize-dialog/prize-dialog.acss
+15
-15
prize-dialog.axml
client/components/dialog/prize-dialog/prize-dialog.axml
+33
-33
prize-dialog.js
client/components/dialog/prize-dialog/prize-dialog.js
+17
-17
probability-prize-table.axml
...rize/probability-prize-table/probability-prize-table.axml
+1
-1
add.js
client/pages/activity/add/add.js
+2
-2
add.js
client/pages/activity/addBackup/add.js
+2
-2
activity.controller.js
server/duiba/controller/activity.controller.js
+2
-1
constants.js
server/duiba/utils/constants.js
+15
-2
No files found.
client/components/dialog/prize-dialog/prize-dialog.acss
View file @
010974be
.probablity-prize-content {
.probab
i
lity-prize-content {
background: #FFFFFF;
max-height: 507px;
display: flex;
flex-direction: column;
}
.probablity-prize-content-imageUpload-wrap{
.probab
i
lity-prize-content-imageUpload-wrap{
display:flex;
padding-top:10px;
box-sizing:border-box;
}
.probablity-prize-content-imageUpload-btn view{
.probab
i
lity-prize-content-imageUpload-btn view{
margin-bottom:5px;
color:#666666
}
.probablity-prize-content-formitem-choosePrize-tips-success{
.probab
i
lity-prize-content-formitem-choosePrize-tips-success{
color:#71B204 !important;
padding-top:20px;
font-size:14px;
}
.probablity-prize-content-formitem-choosePrize-tips-fail{
.probab
i
lity-prize-content-formitem-choosePrize-tips-fail{
color:#F23C3C !important;
padding-top:20px;
font-size:14px;
}
.probablity-prize-content-formitem-choosePrize-wrap{
.probab
i
lity-prize-content-formitem-choosePrize-wrap{
display:flex;
}
.probab
lity-prize-content-input.edit-probab
lity-input {
.probab
ility-prize-content-input.edit-probabi
lity-input {
width: 310px!important;
margin-right: 10px;
}
.probablity-prize-content-input.dialog-rank-input {
.probab
i
lity-prize-content-input.dialog-rank-input {
width: 310px!important;
}
.probablity-prize-content-formitem-goequity{
.probab
i
lity-prize-content-formitem-goequity{
width:80px;
height:30px;
border-radius:5px;
...
...
@@ -49,27 +49,27 @@
text-align:center;
line-height:30px;
}
.probablity-prize-content-imageUpload-btn{
.probab
i
lity-prize-content-imageUpload-btn{
display:flex;
flex-direction:column;
justify-content:space-around;
}
.probablity-prize-content-imageUpload-btn text{
.probab
i
lity-prize-content-imageUpload-btn text{
font-size:12px;
margin-bottom:5px;
color:#666666;
}
/* .probablity-prize-content-formItem {
/* .probab
i
lity-prize-content-formItem {
display: block;
} */
.probablity-prize-content-formItem-nocoupon{
.probab
i
lity-prize-content-formItem-nocoupon{
color:#000 !important;
margin-left:5px;
}
.probablity-prize-content-btn {
.probab
i
lity-prize-content-btn {
display: flex;
justify-content: flex-end;
}
.probablity-prize-content-btn_confirm {
.probab
i
lity-prize-content-btn_confirm {
margin-right: 10px;
}
\ No newline at end of file
client/components/dialog/prize-dialog/prize-dialog.axml
View file @
010974be
...
...
@@ -5,11 +5,11 @@
onClose="onCloseDialog"
width="738"
>
<view class="probablity-prize-content">
<view class="probablity-prize-content-form">
<view class="probab
i
lity-prize-content">
<view class="probab
i
lity-prize-content-form">
<form inline="true">
<form-item style="width:100%" size="large" class="probablity-prize-content-formItem" label="奖品类型" required>
<view class="probablity-prize-content-formitem-choosePrize-wrap">
<form-item style="width:100%" size="large" class="probab
i
lity-prize-content-formItem" label="奖品类型" required>
<view class="probab
i
lity-prize-content-formitem-choosePrize-wrap">
<select onChange="onPrizeTypeChange" defaultValue="{{isEdit ? prizeDialogData.record.type : prizeInitData.type}}">
<option value="{{1}}">优惠券</option>
<option value="{{2}}">积分</option>
...
...
@@ -17,27 +17,27 @@
</select>
</view>
</form-item>
<form-item a:if="{{prizeInitData.type == EQUITY_TYPE}}" validateState="{{choosePrizeTips.status}}" style="width:100%" size="large" help="{{choosePrizeTips.content}}" class="probab
lity-prize-content-formItem probab
lity-prize-content-formItem-choosePrize" label="选择奖品" required>
<view class="probablity-prize-content-formitem-choosePrize-wrap">
<input a:if="{{prizeInitData.ename}}" disabled="true" class="probablity-prize-content-input" style="margin-right:10px" onChange="changeInput" maxLength="10" value="{{prizeInitData.name}}" hasLimitHint="true" name="活动名称" defaultValue="{{prizeDialogEdit ? prizeDialogData.record.name : prizeInitData.name}}" placeholder="请选择奖品"/>
<view class="probablity-prize-content-formitem-goequity" onTap="navigateToPlugin" type="primary">{{prizeInitData.ename ? '重新选择' : '选择奖品'}}</view>
<form-item a:if="{{prizeInitData.type == EQUITY_TYPE}}" validateState="{{choosePrizeTips.status}}" style="width:100%" size="large" help="{{choosePrizeTips.content}}" class="probab
ility-prize-content-formItem probabi
lity-prize-content-formItem-choosePrize" label="选择奖品" required>
<view class="probab
i
lity-prize-content-formitem-choosePrize-wrap">
<input a:if="{{prizeInitData.ename}}" disabled="true" class="probab
i
lity-prize-content-input" style="margin-right:10px" onChange="changeInput" maxLength="10" value="{{prizeInitData.name}}" hasLimitHint="true" name="活动名称" defaultValue="{{prizeDialogEdit ? prizeDialogData.record.name : prizeInitData.name}}" placeholder="请选择奖品"/>
<view class="probab
i
lity-prize-content-formitem-goequity" onTap="navigateToPlugin" type="primary">{{prizeInitData.ename ? '重新选择' : '选择奖品'}}</view>
</view>
</form-item>
<form-item
style="width:100%"
a:if="{{prizeInitData.type == OBJECT_TYPE || prizeInitData.type == CREDITS_TYPE}}"
size="large"
class="probablity-prize-content-formItem"
class="probab
i
lity-prize-content-formItem"
label="奖品名称"
validateState="{{prizeNameTips.status}}" help="{{prizeNameTips.content}}"
required>
<input class="probablity-prize-content-input" data-name="name" onChange="onChangePrizeValue" maxLength="10" value="{{prizeInitData.name}}" hasLimitHint="true" name="奖品名称" defaultValue="{{prizeDialogEdit ? prizeDialogData.record.name : prizeInitData.name}}" placeholder="请输入奖品名称"/>
<input class="probab
i
lity-prize-content-input" data-name="name" onChange="onChangePrizeValue" maxLength="10" value="{{prizeInitData.name}}" hasLimitHint="true" name="奖品名称" defaultValue="{{prizeDialogEdit ? prizeDialogData.record.name : prizeInitData.name}}" placeholder="请输入奖品名称"/>
</form-item>
<form-item size="large" required class="probablity-prize-content-formItem" label="奖品图片" validateState="{{imageTips.status}}" help="{{imageTips.content}}">
<view class="probablity-prize-content-imageUpload-wrap">
<form-item size="large" required class="probab
i
lity-prize-content-formItem" label="奖品图片" validateState="{{imageTips.status}}" help="{{imageTips.content}}">
<view class="probab
i
lity-prize-content-imageUpload-wrap">
<image style="width:90px;height:90px;border:1px solid #ccc;margin-right:10px" src="{{prizeInitData.image}}"></image>
<view class="probablity-prize-content-imageUpload-btn">
<view class="probab
i
lity-prize-content-imageUpload-btn">
<view>奖品图片</view>
<text>尺寸为{{imageLimit[0]}}px * {{imageLimit[1]}}px,格式为jpg/png</text>
<view></view>
...
...
@@ -47,10 +47,10 @@
</form-item>
<form-item
a:if="{{(prizeInitData.type == OBJECT_TYPE || prizeInitData.type == EQUITY_TYPE) && type === 'probablity'}}"
a:if="{{(prizeInitData.type == OBJECT_TYPE || prizeInitData.type == EQUITY_TYPE) && type === 'probab
i
lity'}}"
style="width:100%"
size="large"
class="probablity-prize-content-formItem"
class="probab
i
lity-prize-content-formItem"
label="库存类型"
required>
<radio-group value="{{+prizeInitData.switchStock}}" onChange="onswitchStockChange">
...
...
@@ -60,16 +60,16 @@
</form-item>
<form-item
style="width:100%"
a:if="{{(prizeInitData.type == OBJECT_TYPE || prizeInitData.type == EQUITY_TYPE) && prizeInitData.switchStock==1 && type === 'probablity'}}"
a:if="{{(prizeInitData.type == OBJECT_TYPE || prizeInitData.type == EQUITY_TYPE) && prizeInitData.switchStock==1 && type === 'probab
i
lity'}}"
size="large"
class="probablity-prize-content-formItem"
class="probab
i
lity-prize-content-formItem"
label="奖品库存"
validateState="{{prizeNumberTips.status}}" help="{{prizeNumberTips.content}}"
required>
<input
type="number"
maxLength="5"
class="probablity-prize-content-input"
class="probab
i
lity-prize-content-input"
data-name="stock"
onChange="onChangePrizeValue"
addonTextAfter="已发放库存{{(prizeDialogEdit ? prizeDialogData.record.useStock : prizeInitData.useStock) || 0}}件"
...
...
@@ -83,25 +83,25 @@
<form-item
a:if="{{prizeInitData.type == CREDITS_TYPE}}"
size="large"
class="probablity-prize-content-formItem"
class="probab
i
lity-prize-content-formItem"
label="积分价值"
style="width:100%"
validateState="{{creditsValueTips.status}}" help="{{creditsValueTips.content}}"
required>
<input type="number" class="probablity-prize-content-input" data-name="credits" onChange="onChangePrizeValue" type="number" value="{{prizeInitData.credits}}" hasLimitHint="true" name="积分价值" defaultValue="{{prizeDialogEdit ? prizeDialogData.record.credits : prizeInitData.credits}}" placeholder="请输入积分价值"/>
<input type="number" class="probab
i
lity-prize-content-input" data-name="credits" onChange="onChangePrizeValue" type="number" value="{{prizeInitData.credits}}" hasLimitHint="true" name="积分价值" defaultValue="{{prizeDialogEdit ? prizeDialogData.record.credits : prizeInitData.credits}}" placeholder="请输入积分价值"/>
</form-item>
<form-item
a:if="{{type==='rank'}}"
size="large"
class="probablity-prize-content-formItem"
class="probab
i
lity-prize-content-formItem"
label="领奖名次"
style="width:100%"
validateState="{{rankValueTips.status}}" help="{{rankValueTips.content}}"
required>
<input
type="text"
class="probablity-prize-content-input dialog-rank-input"
class="probab
i
lity-prize-content-input dialog-rank-input"
data-name="rank"
onChange="onChangePrizeValue"
type="number"
...
...
@@ -109,32 +109,32 @@
hasLimitHint="true"
name="领奖名次"
defaultValue="{{prizeDialogEdit ? prizeDialogData.record.rank : prizeInitData.rank}}"
placeholder='领奖名次, 第
5名输入"5
", 第5-10名输入"5-10"'/>
placeholder='领奖名次, 第
4名输入"4-4
", 第5-10名输入"5-10"'/>
</form-item>
<form-item
a:if="{{type==='probablity'}}"
a:if="{{type==='probab
i
lity'}}"
style="width:100%"
size="large"
class="probablity-prize-content-formItem"
class="probab
i
lity-prize-content-formItem"
label="中奖概率"
validateState="{{probablityTips.status}}"
help="{{probablityTips.content}}"
validateState="{{probab
i
lityTips.status}}"
help="{{probab
i
lityTips.content}}"
required>
<input
class="probab
lity-prize-content-input edit-probab
lity-input"
class="probab
ility-prize-content-input edit-probabi
lity-input"
type="number"
onChange="onChangePrizeValue"
data-name="probablity"
value="{{prizeInitData.probablity}}"
data-name="probab
i
lity"
value="{{prizeInitData.probab
i
lity}}"
name="中奖概率"
defaultValue="{{prizeInitData.probablity}}"
defaultValue="{{prizeInitData.probab
i
lity}}"
placeholder="当前概率不能超过100"/>%
</form-item>
</form>
</view>
<view class="probablity-prize-content-btn">
<button class="probablity-prize-content-btn_confirm" onTap="updatePrize" type="primary">确定</button>
<view class="probab
i
lity-prize-content-btn">
<button class="probab
i
lity-prize-content-btn_confirm" onTap="updatePrize" type="primary">确定</button>
<button onTap="onCloseDialog">取消</button>
</view>
</view>
...
...
client/components/dialog/prize-dialog/prize-dialog.js
View file @
010974be
...
...
@@ -18,7 +18,7 @@ const INIT_DATA = {
type
:
1
,
image
:
""
,
credits
:
""
,
probablity
:
""
,
probab
i
lity
:
""
,
name
:
""
,
switchStock
:
STOCK_NO_LIMIT
,
useStock
:
0
,
...
...
@@ -42,7 +42,7 @@ Component({
status
:
"success"
,
content
:
""
,
},
probablityTips
:
{
probab
i
lityTips
:
{
status
:
"success"
,
content
:
""
,
},
...
...
@@ -70,7 +70,7 @@ Component({
type
:
1
,
image
:
""
,
credits
:
""
,
probablity
:
""
,
probab
i
lity
:
""
,
name
:
""
,
switchStock
:
STOCK_NO_LIMIT
,
useStock
:
0
,
...
...
@@ -83,7 +83,7 @@ Component({
record
:
{}
},
maxRankLimit
:
''
,
// 限制最高排名
type
:
'probab
lity'
,
// 奖品弹窗类型 probab
lity: 概率 rank: 排名
type
:
'probab
ility'
,
// 奖品弹窗类型 probabi
lity: 概率 rank: 排名
imageLimit
:
[
250
,
250
],
activityOutId
:
""
,
isEdit
:
false
,
...
...
@@ -190,7 +190,7 @@ Component({
type
:
+
value
,
image
:
""
,
credits
:
""
,
probablity
:
""
,
probab
i
lity
:
""
,
name
:
""
,
switchStock
:
STOCK_NO_LIMIT
};
...
...
@@ -309,7 +309,7 @@ Component({
image
,
type
,
startTime
,
probablity
,
probab
i
lity
,
stock
,
credits
,
useStock
,
...
...
@@ -321,19 +321,19 @@ Component({
const
{
imageTips
}
=
this
.
data
;
const
{
type
:
dialogType
,
maxRankLimit
}
=
this
.
props
;
let
probablityRexp
=
/^
\d
+
(\.\d{1,2})?
$/
;
if
(
!
probab
lityRexp
.
test
(
probablity
)
||
probab
lity
>
100
)
{
let
probab
i
lityRexp
=
/^
\d
+
(\.\d{1,2})?
$/
;
if
(
!
probab
ilityRexp
.
test
(
probability
)
||
probabi
lity
>
100
)
{
this
.
showItemTips
(
"probablityTips"
,
"probab
i
lityTips"
,
"error"
,
"奖品概率必须在0-100%之间且最多支持两位小数"
);
}
else
{
this
.
showItemTips
(
"probablityTips"
,
"success"
,
""
);
this
.
showItemTips
(
"probab
i
lityTips"
,
"success"
,
""
);
}
if
(
dialogType
!==
'probablity'
)
{
this
.
showItemTips
(
"probablityTips"
,
"success"
,
""
);
if
(
dialogType
!==
'probab
i
lity'
)
{
this
.
showItemTips
(
"probab
i
lityTips"
,
"success"
,
""
);
}
const
{
...
...
@@ -421,7 +421,7 @@ Component({
return
;
}
}
const
{
probablityTips
,
prizeNumberTips
,
creditsValueTips
}
=
this
.
data
;
const
{
probab
i
lityTips
,
prizeNumberTips
,
creditsValueTips
}
=
this
.
data
;
const
isImagePass
=
image
&&
imageTips
.
status
!==
"error"
;
let
stockPass
=
true
;
...
...
@@ -433,21 +433,21 @@ Component({
name
.
trim
()
&&
isImagePass
&&
ename
&&
probablityTips
.
status
!==
"error"
&&
probab
i
lityTips
.
status
!==
"error"
&&
prizeNumberTips
.
status
!==
"error"
;
const
isObjectPass
=
type
==
OBJECT_TYPE
&&
name
.
trim
()
&&
stockPass
&&
isImagePass
&&
probablityTips
.
status
!==
"error"
&&
probab
i
lityTips
.
status
!==
"error"
&&
prizeNumberTips
.
status
!==
"error"
const
isCreditsPass
=
type
==
CREDITS_TYPE
&&
name
.
trim
()
&&
credits
&&
isImagePass
&&
probablityTips
.
status
!==
"error"
&&
probab
i
lityTips
.
status
!==
"error"
&&
creditsValueTips
.
status
!==
"error"
;
//限制库存时,限制库存一定要大于发放库存
if
(
isEquietyPass
||
isObjectPass
||
isCreditsPass
)
{
...
...
@@ -457,7 +457,7 @@ Component({
name
,
ename
,
type
,
probablity
,
probab
i
lity
,
stock
,
credits
,
rank
,
...
...
client/components/prize/probability-prize-table/probability-prize-table.axml
View file @
010974be
...
...
@@ -22,7 +22,7 @@
<table-column title="奖品数量(件)" dataIndex="stock">
<view slot-scope="x">{{x.value || '-'}}</view>
</table-column>
<table-column title="中奖概率(%)" dataIndex="probablity">
<table-column title="中奖概率(%)" dataIndex="probab
i
lity">
<view slot-scope="x">{{x.value}}</view>
</table-column>
<table-column title="操作">
...
...
client/pages/activity/add/add.js
View file @
010974be
...
...
@@ -211,7 +211,7 @@ Component({
// 补足谢谢参与类型
formatPrizeList
(
prizeInfoList
=
[])
{
let
totalPercent
=
prizeInfoList
.
reduce
((
total
,
next
)
=>
{
return
total
=
addFloat
(
total
,
+
next
.
probablity
)
return
total
=
addFloat
(
total
,
+
next
.
probab
i
lity
)
},
0
)
// 排名类型不含谢谢参与
if
(
prizeInfoList
[
0
].
rank
)
return
prizeInfoList
;
...
...
@@ -224,7 +224,7 @@ Component({
let
thanksType
=
{
type
:
THANKS_TYPE
,
name
:
'谢谢参与'
,
probablity
:
100
-
totalPercent
probab
i
lity
:
100
-
totalPercent
}
prizeInfoListCopy
.
push
(
thanksType
)
}
...
...
client/pages/activity/addBackup/add.js
View file @
010974be
...
...
@@ -427,7 +427,7 @@ Component({
// 补足谢谢参与类型
formatPobalityPrizeList
(
prizeInfoList
=
[])
{
let
totalPercent
=
prizeInfoList
.
reduce
((
total
,
next
)
=>
{
return
total
=
addFloat
(
total
,
+
next
.
probablity
)
return
total
=
addFloat
(
total
,
+
next
.
probab
i
lity
)
},
0
)
// 排名类型不含谢谢参与
if
(
prizeInfoList
[
0
].
rank
)
return
prizeInfoList
;
...
...
@@ -437,7 +437,7 @@ Component({
let
thanksType
=
{
type
:
THANKS_TYPE
,
name
:
'谢谢参与'
,
probablity
:
100
-
totalPercent
probab
i
lity
:
100
-
totalPercent
}
prizeInfoListCopy
.
push
(
thanksType
)
}
...
...
server/duiba/controller/activity.controller.js
View file @
010974be
...
...
@@ -4,6 +4,8 @@ const {
TASK_CHECK_TYPE
,
TASK_TYPE_CHINA
,
PRIZE_TYPE
,
STOCK_TYPE
,
PRIZE_DATA_TYPR
}
=
require
(
"../utils/constants"
);
const
ResultsModel
=
require
(
"../utils/results.model"
);
let
resultsModel
=
new
ResultsModel
();
...
...
@@ -230,7 +232,6 @@ const saveActivityInfoByHasId = async function (context) {
);
}
}
console
.
log
(
shopInfoResult
,
"shopInfo"
);
const
baseData
=
{
title
,
subtitle
,
...
...
server/duiba/utils/constants.js
View file @
010974be
...
...
@@ -26,6 +26,12 @@ const DRAW_STATUS = {
// 重新领取
RETRY
:
6
,
};
//库存类型
const
STOCK_TYPE
=
{
LIMIT_STOCK
:
1
,
NO_LIMIT_STOCK
:
2
}
// 日志类型: error,info
const
LOGGER_TYPE
=
{
...
...
@@ -45,7 +51,12 @@ const PRIZE_TYPE = {
OBJECT
:
3
,
THANK
:
5
,
};
//奖池类型
const
PRIZE_DATA_TYPR
=
{
RANK_PRIZE
:
1
,
PRO_PRIZE
:
2
,
BUILD_PRIZE
:
3
}
// code类型
const
CODE_TYPES
=
{
PARAMS_ERROR
:
{
...
...
@@ -158,5 +169,7 @@ module.exports = {
TASK_TYPE_CHINA
,
APP_SUB_CODE
,
PRIZE_TYPE
,
SHIP_STATUS
SHIP_STATUS
,
STOCK_TYPE
,
PRIZE_DATA_TYPR
};
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