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
85a127e5
Commit
85a127e5
authored
Dec 01, 2020
by
zhaofei
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
s
parent
f461f713
Changes
21
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
21 changed files
with
650 additions
and
921 deletions
+650
-921
api.js
client/api.js
+3
-4
prize-dialog.axml
client/components/dialog/prize-dialog/prize-dialog.axml
+17
-9
prize-dialog.js
client/components/dialog/prize-dialog/prize-dialog.js
+1
-1
rank-dialog.acss
client/components/dialog/rank-dialog/rank-dialog.acss
+13
-1
rank-dialog.axml
client/components/dialog/rank-dialog/rank-dialog.axml
+93
-48
rank-dialog.js
client/components/dialog/rank-dialog/rank-dialog.js
+176
-308
rank-dialog.json
client/components/dialog/rank-dialog/rank-dialog.json
+1
-1
ship-dialog.acss
client/components/dialog/ship-dialog/ship-dialog.acss
+21
-5
ship-dialog.axml
client/components/dialog/ship-dialog/ship-dialog.axml
+10
-9
ship-dialog.js
client/components/dialog/ship-dialog/ship-dialog.js
+46
-21
ship-dialog.json
client/components/dialog/ship-dialog/ship-dialog.json
+3
-3
task-dialog.js
client/components/dialog/task-dialog/task-dialog.js
+5
-11
list-table.axml
client/components/list/list-table/list-table.axml
+3
-3
list-table.js
client/components/list/list-table/list-table.js
+9
-31
add.js
client/pages/activity/add/add.js
+3
-3
validate.js
client/pages/activity/add/validate.js
+1
-1
validate.js
client/utils/validate.js
+20
-5
awards.controller.ts
server/duibats/src/controller/awards.controller.ts
+143
-339
save.controller.ts
server/duibats/src/controller/save.controller.ts
+1
-1
index.ts
server/duibats/src/index.ts
+5
-6
awards.service.ts
server/duibats/src/service/awards.service.ts
+76
-111
No files found.
client/api.js
View file @
85a127e5
...
...
@@ -2,7 +2,7 @@ import request from "./utils/request";
const
API
=
{
// 上传数据生成xslx文件 uploadDataCreateFile
uploadDataCreateFile
:
(
params
)
=>
request
(
"exportAwardsList"
,
"POST"
,
params
),
exportAwardsList
:
(
params
)
=>
request
(
"exportAwardsList"
,
"POST"
,
params
),
// 保存活动配置 saveActivityInfo
saveActivityInfo
:
(
params
)
=>
request
(
"saveActivityInfo"
,
"POST"
,
params
),
// 删除活动 delActivity
...
...
@@ -32,10 +32,9 @@ const API = {
request
(
"queryBenefitByEname"
,
"POST"
,
params
),
// 复制创建新活动
createCopyActivity
:
(
params
)
=>
request
(
"createCopyActivity"
,
"POST"
,
params
),
//搜索条件查询中奖信息
exportAwardsInfoBySearch
:
(
params
)
=>
request
(
"exportAwardsInfoBySearch"
,
"POST"
,
params
),
findWinnerInfoListBySearch
:
(
params
)
=>
request
(
"findWinnerInfoListBySearch"
,
"POST"
,
params
),
// 搜索条件查询中奖信息
downloadFile
:
(
params
)
=>
request
(
"downloadFile"
,
"POST"
,
params
),
getAwardsList
:
(
params
)
=>
request
(
"getAwardsList"
,
"POST"
,
params
),
};
export
default
API
;
client/components/dialog/prize-dialog/prize-dialog.axml
View file @
85a127e5
...
...
@@ -8,17 +8,25 @@
<view class="probability-prize-content">
<view class="probability-prize-content-form">
<form inline="true">
<form-item
style="width:100%"
size="large"
class="probability-prize-content-formItem"
label="是否降级奖品"
validateState="{{nameTips.status}}" help="{{nameTips.content}}"
required>
</form-item>
<form-item style="width:100%" size="large" class="probability-prize-content-formItem" label="奖品类型" required>
<view class="probability-prize-content-formitem-choosePrize-wrap">
<select onChange="onPrizeTypeChange" defaultValue="{{isEdit ? prizeDialogData.record.type : prizeInitData.type}}">
<option a:if="{{typeChecked.includes(1)}}" value="{{1}}">优惠券</option>
<option a:if="{{typeChecked.includes(2)}}" value="{{2}}">积分</option>
<option a:if="{{typeChecked.includes(3)}}" value="{{3}}">实物</option>
<
option a:if="{{typeChecked.includes(5)}}" value="{{5}}">降级奖品</option
>
<
!-- <option a:if="{{typeChecked.includes(5)}}" value="{{5}}">降级奖品</option> --
>
</select>
</view>
</form-item>
<form-item a:if="{{[EQUITY_TYPE
, LOWER_TYPE
].includes(prizeInitData.type)}}" validateState="{{choosePrizeTips.status}}" style="width:100%" size="large" help="{{choosePrizeTips.content}}" class="probability-prize-content-formItem probability-prize-content-formItem-choosePrize" label="选择奖品" required>
<form-item a:if="{{[EQUITY_TYPE].includes(prizeInitData.type)}}" validateState="{{choosePrizeTips.status}}" style="width:100%" size="large" help="{{choosePrizeTips.content}}" class="probability-prize-content-formItem probability-prize-content-formItem-choosePrize" label="选择奖品" required>
<view class="probability-prize-content-formitem-choosePrize-wrap">
<input a:if="{{prizeInitData.ename}}" class="probability-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="probability-prize-content-formitem-goequity" onTap="navigateToPlugin" type="primary">{{prizeInitData.ename ? '重新选择' : '选择奖品'}}</view>
...
...
@@ -26,7 +34,7 @@
</form-item>
<form-item
style="width:100%"
a:if="{{[OBJECT_TYPE, CREDITS_TYPE
, LOWER_TYPE
].includes(prizeInitData.type)}}"
a:if="{{[OBJECT_TYPE, CREDITS_TYPE].includes(prizeInitData.type)}}"
size="large"
class="probability-prize-content-formItem"
label="奖品名称"
...
...
@@ -48,7 +56,7 @@
</form-item>
<form-item
a:if="{{[OBJECT_TYPE,EQUITY_TYPE
, LOWER_TYPE
].includes(prizeInitData.type) && type !== 'rank'}}"
a:if="{{[OBJECT_TYPE,EQUITY_TYPE].includes(prizeInitData.type) && type !== 'rank'}}"
style="width:100%"
size="large"
class="probability-prize-content-formItem"
...
...
@@ -61,7 +69,7 @@
</form-item>
<form-item
style="width:100%"
a:if="{{[OBJECT_TYPE,EQUITY_TYPE
, LOWER_TYPE
].includes(prizeInitData.type) && prizeInitData.switchStock==1 && type !== 'rank'}}"
a:if="{{[OBJECT_TYPE,EQUITY_TYPE].includes(prizeInitData.type) && prizeInitData.switchStock==1 && type !== 'rank'}}"
size="large"
class="probability-prize-content-formItem"
label="奖品库存"
...
...
@@ -82,7 +90,7 @@
</form-item>
<form-item
a:if="{{[CREDITS_TYPE
, LOWER_TYPE
].includes(prizeInitData.type)}}"
a:if="{{[CREDITS_TYPE].includes(prizeInitData.type)}}"
size="large"
class="probability-prize-content-formItem"
label="积分价值"
...
...
@@ -93,7 +101,7 @@
</form-item>
<form-item
a:if="{{[OBJECT_TYPE,EQUITY_TYPE
, LOWER_TYPE
].includes(prizeInitData.type)}} "
a:if="{{[OBJECT_TYPE,EQUITY_TYPE].includes(prizeInitData.type)}} "
style="width:100%"
size="large"
class="probability-prize-content-formItem"
...
...
@@ -113,7 +121,7 @@
</form-item>
<form-item
a:if="{{[EQUITY_TYPE
, LOWER_TYPE
].includes(prizeInitData.type)}} "
a:if="{{[EQUITY_TYPE].includes(prizeInitData.type)}} "
style="width:100%"
size="large"
class="probability-prize-content-formItem"
...
...
@@ -174,7 +182,7 @@
</form-item>
<form-item
a:if="{{[OBJECT_TYPE
, LOWER_TYPE
].includes(prizeInitData.type)}}"
a:if="{{[OBJECT_TYPE].includes(prizeInitData.type)}}"
style="width:100%" size="large"
class="probability-prize-content-formItem probability-prize-content-formItem-choosePrize"
label="商品查看链接">
...
...
client/components/dialog/prize-dialog/prize-dialog.js
View file @
85a127e5
...
...
@@ -272,7 +272,7 @@ Component({
prizeInitData
:
{
...
this
.
data
.
prizeInitData
,
switchStock
:
value
,
stock
:
value
===
2
?
""
:
this
.
data
.
prizeInitData
.
stock
,
stock
:
value
===
2
?
""
:
this
.
data
.
prizeInitData
.
stock
||
""
,
},
});
},
...
...
client/components/dialog/rank-dialog/rank-dialog.acss
View file @
85a127e5
...
...
@@ -16,4 +16,16 @@
display: flex;
justify-content: flex-end;
margin: 10px 0 0 0;
}
\ No newline at end of file
}
.rank-pagination-text {
display: flex;
align-items: center;
}
.rank-dialog-wrap .operator-btns {
margin-bottom: 15px;
width: 300px;
float: right;
}
.rank-dialog-wrap .long-item .next-select {
width: 150px;
}
client/components/dialog/rank-dialog/rank-dialog.axml
View file @
85a127e5
<dialog-wrap
title="中奖信息"
title="中奖名单"
tips="(为保证您的正常导出,建议单次筛选500条以内进行操作)"
visible="{{visible}}"
onClose="onCloseDialog"
width="1000"
>
<view class="rank-dialog-wrap">
<!-- <view class="other-winner-list">
<button type="text">导出其它中奖名单</button>
</view> -->
<!-- <tab shape="wrapped">
<tab-item
a:for="{{tabs}}"
title="{{item.tab}}"
key="{{item.key}}"
> -->
<!-- 添加筛选条件导出中奖名单 start -->
<form a:if="{{isSearch}}" class="edit-content-form" data-name="form" inline="true" labelTextAlign="right" size="large">
<!-- 添加筛选条件导出中奖名单 start -->
<form class="edit-content-form" data-name="form" inline="true" labelTextAlign="right" size="large">
<form-item class="edit-content-formItem" label="奖品编号" labelTextAlign="right" asterisk="{{false}}">
<input
data-type="prize" value="{{searchInfo.prizeId}}" onChange="onInputChange"
hasLimitHint="true" name="奖品编号" />
<input
value="{{searchInfo.prizeId}}" onChange="handleInputChange" data-name='prizeId'
hasLimitHint="true" name="奖品编号" />
</form-item>
<form-item class="edit-content-formItem" label="用户
昵称
" labelTextAlign="right" asterisk="{{false}}">
<input
data-type="user" value="{{searchInfo.userNick}}" onChange="onInputChange"
hasLimitHint="true" name="用户id" />
<form-item class="edit-content-formItem" label="用户
id
" labelTextAlign="right" asterisk="{{false}}">
<input
value="{{searchInfo.userNick}}" onChange="handleInputChange" data-name='userNick'
hasLimitHint="true" name="用户id" />
</form-item>
<form-item class="edit-content-formItem" label="发奖时间" labelTextAlign="right" asterisk="{{false}}">
<range-picker style="width: 300px" onChange="
onChangeTime" hasClear="true" value="{{timeRange}}" data-time="{{timeRange}}" class="block" show-time="{{ format: 'HH:mm' }}"
/>
<range-picker style="width: 300px" onChange="
handleTimeRangeChange" hasClear="true" value="{{searchInfo.timeRange}}" class="block" show-time="{{ format: 'HH:mm' }}" data-time="{{searchInfo.timeRange}}"
/>
</form-item>
<form-item class="edit-content-formItem" label="发货状态" labelTextAlign="right">
<select onChange="onSelectShipStatus">
<option value="{{1}}">全部实物</option>
<option value="{{2}}">未发货</option>
<option value="{{3}}">已发货</option>
<select value="{{searchInfo.shipStatus}}" onChange="handleInputChange" data-name='shipStatus'>
<option value="">全部</option>
<option value="1">未填写地址</option>
<option value="2">待发货</option>
<option value="3">已发货</option>
</select>
</form-item>
<form-item class="edit-content-formItem" label="奖品类型">
<select data-type="prizeType" onChange="onSelectPrizeType">
<option value="{{1}}">优惠券</option>
<option value="{{3}}">实物</option>
<form-item class="edit-content-formItem long-item" label="奖品类型">
<select value="{{searchInfo.prizeType}}" onChange="handleInputChange" data-name='prizeType'>
<option value="">全部</option>
<option value="1">优惠券</option>
<!-- <option value="2">积分</option> -->
<option value="3">实物</option>
<option value="5">谢谢参与</option>
</select>
</form-item>
<form-item class="edit-content-formItem" label="发奖来源">
<select data-type="prizeDataType" onChange="onSelectPrizeType">
<option value="{{1}}">排行榜</option>
<option value="{{2}}">抽奖</option>
<option value="{{3}}">大转盘</option>
<form-item class="edit-content-formItem long-item" label="发奖来源">
<select value="{{searchInfo.prizeDataType}}" onChange="handleInputChange" data-name='prizeDataType'>
<option value="">全部</option>
<option value="1">游戏获得</option>
<option value="2">排行榜</option>
<option value="3">分享获得</option>
</select>
</form-item>
<view class="operator-btns" style="textAlign:right">
<button onTap="handleSearch" style="height:32px;" type="primary" size="medium">搜索</button>
<button style="margin-left:20px;height:32px" type="primary" onTap="handleExport" size="medium">导出</button>
<button style="margin-left:20px;height:32px" type="primary" onTap="handleImport" size="medium">导入发货</button>
</view>
</form>
<view a:if="{{isSearch}}" style="textAlign:right">
<button onTap="onChangeSearch" style="height:32px;" type="primary" size="medium">搜索</button>
<button style="margin-left:20px;height:32px" type="primary" data-type="search" onTap="exportWinnerListBySearch" size="medium">导出</button>
<button style="margin-left:20px;height:32px" type="primary" onTap="onChangeUpLoad" size="medium">导入发货</button>
</view>
<!-- end -->
<view a:if="{{!isSearch}}" class="now-winner-list">
<button type="primary" data-type="export" onTap="exportWinnerList">导出中奖名单</button>
<table dataSource="{{list}}" loading="{{isLoading}}">
<table-column title="奖品编号" dataIndex="_id"/>
<table-column title="用户id" dataIndex="userNick"/>
<table-column title="发奖时间" dataIndex="createTime">
</table-column>
<table-column title="填写地址时间" dataIndex="receiveTime">
<view slot-scope="x">
{{ x.record.type === 3 ? (x.record.receiveName ? x.record.receiveTime : '暂未填写') : '/' }}
</view>
</table-column>
<table-column title="奖品类型" dataIndex="type">
<view slot-scope="x">
<text a:if="{{x.record.type == 1}}">优惠券</text>
<!-- <text a:if="{{x.record.type == 2}}">积分</text> -->
<text a:elif="{{x.record.type == 3}}">实物</text>
<text a:else>/</text>
</view>
</table-column>
<table-column title="奖品名称" dataIndex="name"/>
<table-column title="发奖来源" dataIndex="prizeDataType">
<view slot-scope="x">
<text a:if="{{x.record.prizeDataType == 1}}">关卡获得</text>
<text a:if="{{x.record.prizeDataType == 2}}">排行榜</text>
<text a:if="{{x.record.prizeDataType == 3}}">分享获得</text>
</view>
<table dataSource="{{list}}">
<table-column a:for="{{columns}}" a:key="*this" title="{{item.title}}" dataIndex="{{item.prop}}" width="{{item.width}}"/>
</table>
<view class="rank-pagination">
<text class="rank-pagination-text">共{{total}}条</text>
<!-- <pagination shape="arrow-only" hideOnlyOnePage="true" defaultCurrent="1" current="{{pageInfo.pageNo}}" pageSize="{{pageInfo.pageSize}}" onChange="changePagination" pageShowCount="100" total="{{pageInfo.total}}" /> -->
<pagination showJump="{{false}}" defaultCurrent="{{1}}" data-type="all" pageSize="{{pageSize}}" onChange="onChangePageNo" pageShowCount="{{10}}" total="{{total}}" a:if="{{total > 0}}" shape="arrow-only" />
</table-column>
<table-column title="收货信息(联系人+详细地址)" dataIndex="receiveName">
<view slot-scope="x">
<view a:if="{{x.record.type == 3}}">
<view>{{(x.record.receiveName || '')}}</view>
<view>{{( x.record.phone || '')}} </view>
<view>{{ ( x.record.province + x.record.city + x.record.area + x.record.addressdetail || '') }}</view>
<view a:if="{{!x.record.receiveName}}">暂未填写</view>
</view>
<view a:else>/</view>
</view>
</table-column>
<table-column title="发货状态" dataIndex="shipStatus">
<view slot-scope="x">
<view a:if="{{x.record.type == 3}}">
<text a:if="{{x.record.shipStatus == 1}}">未填写地址</text>
<text a:if="{{x.record.shipStatus == 1 || x.record.shipStatus == 2}}">待发货</text>
<text a:if="{{x.record.shipStatus == 3}}">已发货</text>
</view>
<!-- </tab-item>
</tab> -->
<view a:else>/</view>
</view>
</table-column>
<table-column title="物流信息" dataIndex="shipCompany">
<view slot-scope="x">
<view a:if="{{x.record.type == 3}}">
<view>{{ x.record.shipCompany }}</view>
<view>{{ x.record.shipNum }}</view>
<view a:if="{{!x.record.shipCompany && !x.record.shipNum}}">暂未填写</view>
</view>
<view a:else>/</view>
</view>
</table-column>
</table>
<view class="rank-pagination">
<text class="rank-pagination-text">共 {{total}} 条</text>
<pagination showJump="{{false}}" defaultCurrent="{{1}}" current="{{searchInfo.pageNo}}" data-type="all" pageSize="{{searchInfo.pageSize}}" onChange="handleChangePage" pageShowCount="{{10}}" total="{{total}}" a:if="{{total > 0}}" shape="arrow-only" />
</view>
</view>
</dialog-wrap>
<ship-dialog a:if="{{showShip}}" showShip="{{showShip}}" onClose="onCloseShip" activityId="{{winactivityId}}"></ship-dialog>
\ No newline at end of file
<ship-dialog a:if="{{showShip}}" showShip="{{showShip}}" onClose="handleShipClose" activityId="{{winactivityId}}"></ship-dialog>
client/components/dialog/rank-dialog/rank-dialog.js
View file @
85a127e5
This diff is collapsed.
Click to expand it.
client/components/dialog/rank-dialog/rank-dialog.json
View file @
85a127e5
...
...
@@ -4,4 +4,4 @@
"dialog-wrap"
:
"../../basic/dialiog-wrap/dialiog-wrap"
,
"ship-dialog"
:
"../../dialog/ship-dialog/ship-dialog"
}
}
\ No newline at end of file
}
client/components/dialog/ship-dialog/ship-dialog.acss
View file @
85a127e5
...
...
@@ -3,7 +3,7 @@
width: 100%;
height: 200px;
/* margin-left: 80px; */
margin-top: 100px;
/* margin-top: 100px; */
}
.edit-content-titleLoad {
...
...
@@ -14,9 +14,15 @@
}
.edit-content-shipDialog {
width: 340px;
margin-left: 76px;
margin-top: 40px;
display:flex;
align-items: center;
/* margin-left: 76px;
margin-top: 40px; */
}
.fileIdInp{
width: 240px!important;
margin-right: 20px;
}
.edit-content-buttons {
...
...
@@ -26,4 +32,14 @@
.edit-content-buttonShip {
margin-left: 5px
}
\ No newline at end of file
}
.ship-tips {
margin: 20px 0;
}
.example {
color:rgb(143,208,206);
cursor: pointer;
}
client/components/dialog/ship-dialog/ship-dialog.axml
View file @
85a127e5
<dialog-wrap title="批量发货" visible="{{showShip}}" onClose="closeShip">
<view class="edit-content-shipDialog1">
<form-item class="edit-content-shipDialog" label="
上传附件:" style="display:flex
">
<input
placeholder="Input" style="80px
" value="{{fileName}}" onChange="onChangeInput"/>
<form-item class="edit-content-shipDialog" label="
fileId
">
<input
class="fileIdInp" placeholder="请输入fileId
" value="{{fileName}}" onChange="onChangeInput"/>
</form-item>
<view class="ship-tips">
请点击下载模板后,填写完信息发给运营获取fileId 参考示例: <text class="example" onTap="downloadExampleFile">示例.csv</text>
</view>
<view class="edit-content-buttons">
<button class="edit-content-buttonShip" type="primary" onTap="closeShip">
取消
</button>
<button class="edit-content-buttonShip" type="primary" onTap="onChangeLoadFile">
确认发货
</button>
<button onTap="closeShip">取消</button>
<button class="edit-content-buttonShip" disabled="{{!fileName}}" type="primary" onTap="onChangeLoadFile">确认发货</button>
</view>
</view>
</dialog-wrap>
\ No newline at end of file
</dialog-wrap>
<copy-link-dialog title="如何下载CSV" visible="{{copyLink}}" url="{{url}}" onClose="closeCopyLinkDialog"></copy-link-dialog>
client/components/dialog/ship-dialog/ship-dialog.js
View file @
85a127e5
import
{
downloadFile
}
from
"../../../api"
;
const
{
cloud
}
=
getApp
();
// import { upLoadFileApi } from "../../utils/my-api";
Component
({
data
:
{
fileName
:
""
fileName
:
""
,
copyLink
:
false
,
url
:
"yun.dui88.com/call/example.xlsx"
,
},
props
:
{
activityId
:
""
,
onClose
:
()
=>
{
}
onClose
:
()
=>
{
}
,
},
didMount
()
{
console
.
log
(
">>>>>>activityId"
,
this
.
props
.
activityId
);
},
didUpdate
()
{
console
.
log
(
">>>>>>activityId"
,
this
.
props
.
activityId
);
},
didUpdate
()
{
},
didUnmount
()
{
},
methods
:
{
//LS20200716关闭弹窗
closeShip
()
{
this
.
props
.
onClose
();
this
.
setData
({
fileName
:
""
})
fileName
:
""
,
})
;
console
.
log
(
"ship-dialog====showShip"
);
},
closeDialog
()
{
this
.
setData
({})
this
.
setData
({});
},
//下载示例文件
async
downloadExampleFile
()
{
// let urls = await cloud.file.getTempFileURL({
// fileId: ['cloud://E89396D800766AB3D101FD4DF83F5C7D//示例.xlsx']
// })
// console.log(urls,'urls');
// const { url } = urls[0]
// this.setData({
// copyLink:true,
// url:"yun.dui88.com/call/example.xlsx"
// })
const
{
url
}
=
this
.
data
my
.
setClipboard
({
text
:
url
.
replace
(
/amp;/g
,
""
),
success
(
res
)
{
my
.
showToast
({
type
:
"success"
,
content
:
"下载链接复制成功,请在浏览器中打开下载"
,
});
},
});
},
closeCopyLinkDialog
()
{
this
.
setData
({
copyLink
:
false
})
},
//20200717确认发货
//20200717
...
...
@@ -40,32 +67,30 @@ Component({
if
(
result
.
data
.
total
==
0
)
{
my
.
showToast
({
type
:
"fail"
,
content
:
`
无用户填写地址,导入信息错误
`
,
content
:
`
导入信息错误,请导入正确信息
`
,
});
}
else
{
}
else
{
my
.
showToast
({
type
:
"success"
,
content
:
`成功导入
${
JSON
.
stringify
(
result
.
data
.
total
)}
条发货信息!`
,
});
this
.
props
.
onClose
()
}
}
else
{
my
.
showToast
({
type
:
"fail"
,
content
:
result
.
message
content
:
result
.
message
,
});
}
},
//输入框变化
onChangeInput
(
e
)
{
console
.
log
(
"输入框变化"
,
e
);
let
{
fileName
}
=
this
.
data
;
this
.
setData
({
fileName
:
e
.
detail
.
value
})
fileName
:
e
.
detail
.
value
,
})
;
console
.
log
(
"===="
,
fileName
);
}
}
})
}
,
}
,
})
;
client/components/dialog/ship-dialog/ship-dialog.json
View file @
85a127e5
{
"component"
:
true
,
"usingComponents"
:
{
"dialog-wrap"
:
"../../basic/dialiog-wrap/dialiog-wrap"
"dialog-wrap"
:
"../../basic/dialiog-wrap/dialiog-wrap"
,
"copy-link-dialog"
:
"../copy-link-dialog/copy-link-dialog"
}
}
\ No newline at end of file
}
client/components/dialog/task-dialog/task-dialog.js
View file @
85a127e5
const
{
passUrlList
}
=
require
(
'../../../cmpUtils/const'
);
import
{
passUrlList
,
urlCheck
}
from
"../../../utils/helper"
;
import
{
validateRangeNumber
}
from
"../../../utils/validate"
;
Component
({
...
...
@@ -80,13 +81,6 @@ Component({
[
name
]:
value
})
},
validateLink
(
link
)
{
if
(
!
link
)
return
false
;
if
(
link
.
startsWith
(
'http://'
)
||
link
.
startsWith
(
'https://'
))
{
return
passUrlList
.
some
(
url
=>
link
.
indexOf
(
url
)
!==
-
1
);
}
return
false
;
},
onSaveTask
()
{
const
{
title
,
link
,
value
,
taskRateType
,
times
,
itemIds
}
=
this
.
data
;
// if(!title.trim()) {
...
...
@@ -97,11 +91,11 @@ Component({
// return;
// }
if
(
this
.
props
.
hasLink
&&
!
this
.
validateLink
(
link
)
)
{
if
(
this
.
props
.
hasLink
&&
!
urlCheck
(
link
,
passUrlList
).
status
)
{
my
.
showToast
({
type
:
'fail'
,
content
:
'请输入正确的链接地址'
})
content
:
urlCheck
(
link
,
passUrlList
).
message
})
;
return
;
}
...
...
client/components/list/list-table/list-table.axml
View file @
85a127e5
...
...
@@ -14,7 +14,7 @@
<table-column title="操作" dataIndex="id" alignHeader="left">
<view slot-scope="x">
<button a:if="{{buttons.includes('edit')}}" class="tb-list-edit" onTap="handleClickEdit" type="primary" text="true" data-x="{{x}}" >编辑活动</button>
<button a:if="{{buttons.includes('exportWinnerList')}}" class="tb-list-edit" type="primary" text="true" data-x="{{x}}"
disabled="{{!x.record.isEnd}}"
data-type="object" onTap="handleOpenWinnerList">查看中奖名单</button>
<button a:if="{{buttons.includes('exportWinnerList')}}" class="tb-list-edit" type="primary" text="true" data-x="{{x}}" data-type="object" onTap="handleOpenWinnerList">查看中奖名单</button>
<button a:if="{{buttons.includes('delete')}}" class="tb-list-edit" type="primary" text="true" data-x="{{x}}" onTap="handleTapDelete">删除</button>
<button a:if="{{buttons.includes('copyLink')}}" class="tb-list-edit" type="primary" text="true" data-x="{{x}}" onTap="onCopyLink">复制活动链接</button>
<button a:if="{{buttons.includes('copyNewActivity')}}" class="tb-list-edit" type="primary" text="true" data-x="{{x}}" onTap="onCreateNewActivity">复制新活动</button>
...
...
@@ -29,7 +29,7 @@
</view>
<copy-link-dialog visible="{{exportDialogVisible}}" url="{{exportUrl}}" onClose="onCloseExportDialog"/>
<copy-link-dialog visible="{{exportDialogVisible}}" url="{{export
Link
Url}}" onClose="onCloseExportDialog"/>
<confirm-dialog
visible="{{confirmDialog.visible}}"
...
...
@@ -39,4 +39,4 @@
/>
<rank-dialog a:if="{{winnerListDialogVisible}}" visible="{{winnerListDialogVisible}}" onClose="onCloseWinnerListDialog" selectedItem="{{selectedItem}}"/>
\ No newline at end of file
<rank-dialog a:if="{{winnerListDialogVisible}}" visible="{{winnerListDialogVisible}}" onClose="onCloseWinnerListDialog" onShowExportDialog="showExportDialog" selectedItem="{{selectedItem}}"/>
\ No newline at end of file
client/components/list/list-table/list-table.js
View file @
85a127e5
...
...
@@ -14,7 +14,7 @@ Component({
data
:
{
isLoadingList
:
false
,
exportDialogVisible
:
false
,
exportUrl
:
''
,
export
Link
Url
:
''
,
dataSource
:
[],
confirmDialog
:
{
visible
:
false
,
...
...
@@ -99,6 +99,14 @@ Component({
winnerListDialogVisible
:
false
});
},
//展示复制链接弹框
showExportDialog
(
data
)
{
console
.
log
(
'展示复制链接弹框'
,
data
)
this
.
setData
({
exportDialogVisible
:
true
,
exportLinkUrl
:
data
.
exportLinkUrl
})
},
// 复制链接
async
onCopyLink
(
evt
)
{
...
...
@@ -185,36 +193,6 @@ Component({
console
.
log
(
error
);
}
},
// 导出中奖名单
async
exportWinnerList
(
evt
)
{
const
{
activityId
}
=
evt
.
target
.
dataset
.
x
.
record
;
const
{
type
}
=
evt
.
target
.
dataset
;
let
isObject
=
type
===
"object"
;
my
.
showLoading
({
content
:
"生成文件中..."
});
try
{
const
{
success
,
data
,
message
}
=
await
uploadDataCreateFile
({
activityId
,
isObject
,
});
my
.
hideLoading
();
if
(
success
)
{
await
setClipboard
({
text
:
data
.
url
.
replace
(
/amp;/g
,
""
)
});
this
.
setData
({
exportDialogVisible
:
true
,
exportUrl
:
data
.
url
.
replace
(
/amp;/g
,
""
)
});
}
else
{
my
.
showToast
({
type
:
"fail"
,
content
:
message
,
});
}
}
catch
(
error
)
{
my
.
hideLoading
();
console
.
log
(
error
,
"exportList-error"
);
}
},
// 编辑
handleClickEdit
(
evt
)
{
let
{
activityId
}
=
evt
.
target
.
dataset
.
x
.
record
;
...
...
client/pages/activity/add/add.js
View file @
85a127e5
...
...
@@ -160,9 +160,9 @@ Component({
Object
.
keys
(
formState
).
forEach
(
key
=>
{
let
error
=
errors
.
filter
(
v
=>
target
?
v
.
field
===
target
&&
v
.
field
===
key
:
v
.
field
===
key
).
length
&&
errors
.
filter
(
v
=>
v
.
field
===
key
)[
0
];
// 时间实时校验
if
(
key
===
'timeRange'
&&
formState
[
key
].
status
===
'error'
)
{
return
}
//
if (key === 'timeRange' && formState[key].status === 'error') {
//
return
//
}
newValidator
[
key
]
=
{
status
:
error
?
'error'
:
'success'
,
message
:
error
?
error
.
message
:
''
...
...
client/pages/activity/add/validate.js
View file @
85a127e5
import
{
rankTableValidator
,
validateRangeNumber
,
rankTimeValidator
,
isNumber
,
validatePositiveInteger
,
validateInteger
,
urlChecks
}
from
"../../../utils/validate"
;
import
{
rankTableValidator
,
validateRangeNumber
,
rankTimeValidator
,
isNumber
,
validatePositiveInteger
,
validateInteger
,
urlChecks
,
rateTableValidator
}
from
"../../../utils/validate"
;
// 使用 async-validator 校验
// 文档地址: https://github.com/yiminghe/async-validator
...
...
client/utils/validate.js
View file @
85a127e5
...
...
@@ -34,16 +34,31 @@ export const validateRangeNumber = (number, [min, max] = [], fixed = 0) => {
console
.
error
(
'数字范围的最小值不能大于最大值'
);
return
;
}
if
(
!
pattern
.
test
(
number
)
||
number
===
''
)
return
false
;
if
(
number
!=
0
){
if
(
!
pattern
.
test
(
number
)
||
number
===
''
)
return
false
;
}
if
(
number
<
min
||
number
>
max
)
return
false
;
return
true
;
}
};
// 配置验证
// 单个奖池总概率验证
export
const
rateTableValidator
=
(
rule
,
value
,
callback
,
source
,
options
)
=>
{
let
n
=
0
;
if
(
!
value
.
length
||
!
value
)
{
return
new
Error
(
'请至少配置一个奖品'
);
}
if
(
value
.
length
){
value
.
forEach
(
item
=>
{
n
+=
Number
(
item
.
probability
)
})
}
if
(
n
>
100
){
return
new
Error
(
'总概率不能大于100%'
);
}
return
callback
()
};
// 排名表格验证
...
...
server/duibats/src/controller/awards.controller.ts
View file @
85a127e5
This diff is collapsed.
Click to expand it.
server/duibats/src/controller/save.controller.ts
View file @
85a127e5
...
...
@@ -52,7 +52,7 @@ export default class ActivitSaveController {
}
// 概率奖品配置需要增加 properiodfrom properiodto字段
//
prizeList = activityconfigService.setPrizeProbalityRange(prizeList)
prizeList
=
activityconfigService
.
setPrizeProbalityRange
(
prizeList
)
// 所有奖品均存在b_prize_config表里, 根据需求定义的奖品参数都要整合到allPrizeLists里
// level 排序用避免查询乱序
...
...
server/duibats/src/index.ts
View file @
85a127e5
...
...
@@ -7,14 +7,13 @@ import RuleController from './controller/rule.controller'
import
RaobaoItemController
from
'./controller/taobaoItem.controller'
import
SaveController
from
'./controller/save.controller'
const
{
getActivityList
,
getActivityDetail
,
delActivity
}
=
new
ActivityController
()
const
{
getActivityList
,
getActivityDetail
,
delActivity
,
createCopyActivity
}
=
new
ActivityController
()
const
{
sellerSaasSave
,
sellerSave
}
=
new
SellerController
()
const
{
findWinnerInfoList
,
exportAwardsList
,
findWinnerInfoListBySearch
,
getAwardsList
,
downloadFile
,
exportAwardsInfoBySearch
}
=
new
AwardsController
()
const
{
generateRule
}
=
new
RuleController
()
const
{
findItemListByStatus
,
findItemListByIds
,
queryBenefitByEname
}
=
new
RaobaoItemController
()
...
...
@@ -28,10 +27,10 @@ export default {
sellerSave
,
findWinnerInfoList
,
exportAwardsList
,
findWinnerInfoListBySearch
,
downloadFile
,
exportAwardsInfoBySearch
,
findItemListByStatus
,
findItemListByIds
,
queryBenefitByEname
queryBenefitByEname
,
createCopyActivity
,
getAwardsList
}
server/duibats/src/service/awards.service.ts
View file @
85a127e5
...
...
@@ -5,12 +5,12 @@
import
{
BaseDao
}
from
'../sdk'
import
{
AWARDS_DB_NAME
}
from
'../db'
import
{
DRAW_STATUS
,
SHIP_STATUS
}
from
'../constants'
import
{
DRAW_STATUS
,
PRIZE_TYPE
,
SHIP_STATUS
}
from
'../constants'
export
default
class
AwardsService
{
context
:
Context
awards
d
ao
:
IBaseDao
awards
D
ao
:
IBaseDao
constructor
(
context
:
Context
)
{
this
.
awards
d
ao
=
new
BaseDao
(
context
,
AWARDS_DB_NAME
)
this
.
awards
D
ao
=
new
BaseDao
(
context
,
AWARDS_DB_NAME
)
}
// 添加排行榜待开奖列表
...
...
@@ -24,7 +24,7 @@ export default class AwardsService {
}
})
try
{
await
this
.
awards
d
ao
.
insertMany
(
list
)
await
this
.
awards
D
ao
.
insertMany
(
list
)
return
true
}
catch
(
e
)
{
console
.
log
(
`添加排行榜待开奖列表出错:
${
e
}
`
)
...
...
@@ -32,134 +32,99 @@ export default class AwardsService {
}
}
// 根据活动id查找中奖名单
async
getAwardslistByActivityId
(
activityId
:
string
,
pageNo
=
1
,
pageSize
=
500
)
{
if
(
!
activityId
)
return
false
return
await
this
.
awardsdao
.
find
(
{
activityId
},
{
sort
:
{
score
:
-
1
,
rankTime
:
-
1
},
limit
:
pageSize
,
skip
:
(
pageNo
-
1
)
*
pageSize
}
)
}
//获取中奖名单长度
async
getAwardslistCount
(
activityId
:
string
)
{
if
(
!
activityId
)
{
return
false
}
return
await
this
.
awardsdao
.
count
({
activityId
:
activityId
})
}
// 条件搜索--查询中奖信息
async
getUserPrizeByActivityId
(
activityId
:
string
,
pageNo
:
number
,
pageSize
:
number
,
prizeId
:
string
,
userNick
:
string
,
timeStart
:
number
,
timeEnd
:
number
,
shipStatus
:
number
,
type
:
number
)
{
let
p
=
prizeId
?
{
_id
:
prizeId
}
:
''
let
u
=
userNick
?
{
userNick
:
{
$regex
:
'.*'
+
userNick
+
'.*'
}
}
:
''
let
c
=
timeStart
>
0
&&
timeEnd
>
0
?
{
createTime
:
{
$gt
:
timeStart
,
$lt
:
timeEnd
}
}
:
''
let
s
=
shipStatus
?
shipStatus
==
1
?
{
shipStatus
:
{
$in
:
[
SHIP_STATUS
.
NO_ADDRESS
,
SHIP_STATUS
.
NO_SHIP
,
SHIP_STATUS
.
HAS_SHIP
]
}
}
:
shipStatus
==
2
?
{
shipStatus
:
{
$in
:
[
SHIP_STATUS
.
NO_ADDRESS
,
SHIP_STATUS
.
NO_SHIP
]
}
}
:
{
shipStatus
:
SHIP_STATUS
.
HAS_SHIP
}
:
''
let
t
=
type
?
{
type
:
+
type
}
:
''
let
arr
=
[
p
,
u
,
c
,
s
,
t
]
arr
=
arr
.
filter
(
i
=>
{
return
i
})
console
.
log
(
'arr--222---'
,
arr
)
return
await
this
.
awardsdao
.
find
(
{
activityId
,
$and
:
arr
},
{
limit
:
pageSize
,
skip
:
(
pageNo
-
1
)
*
pageSize
}
)
}
//《条件搜索》获取中奖名单长度
async
getTotalObjectCount
(
activityId
:
string
,
prizeId
:
string
,
userNick
:
string
,
timeStart
:
number
,
timeEnd
:
number
,
shipStatus
:
number
,
type
:
number
,
prizeDataType
:
number
)
{
let
p
=
prizeId
?
{
_id
:
prizeId
}
:
''
let
pt
=
prizeDataType
?
{
prizeDataType
:
prizeDataType
}
:
''
let
u
=
userNick
?
{
userNick
:
{
$regex
:
'.*'
+
userNick
+
'.*'
}
}
:
''
let
c
=
timeStart
>
0
&&
timeEnd
>
0
?
{
createTime
:
{
$gt
:
timeStart
,
$lt
:
timeEnd
}
}
:
''
let
s
=
shipStatus
?
shipStatus
==
1
?
{
shipStatus
:
{
$in
:
[
SHIP_STATUS
.
NO_ADDRESS
,
SHIP_STATUS
.
NO_SHIP
,
SHIP_STATUS
.
HAS_SHIP
]
}
}
:
shipStatus
==
2
?
{
shipStatus
:
{
$in
:
[
SHIP_STATUS
.
NO_ADDRESS
,
SHIP_STATUS
.
NO_SHIP
]
}
}
:
{
shipStatus
:
SHIP_STATUS
.
HAS_SHIP
}
:
''
let
t
=
type
?
{
type
:
+
type
}
:
''
let
arr
=
[
p
,
u
,
c
,
s
,
t
,
pt
]
arr
=
arr
.
filter
(
i
=>
{
return
i
})
console
.
log
(
'arr--111---'
,
arr
,
's>>>'
,
s
)
return
await
this
.
awardsdao
.
count
({
activityId
,
$and
:
arr
})
}
//《条件搜索》导入发货状态
async
setUserShipStatus
(
activityId
:
string
,
prizeId
:
string
,
shipCompany
:
string
,
shipNum
:
number
|
string
)
{
async
setUserShipStatus
(
activityId
,
prizeId
,
shipCompany
,
shipNum
)
{
prizeId
=
prizeId
?
prizeId
:
'/'
shipCompany
=
shipCompany
?
shipCompany
:
''
shipNum
=
shipNum
!==
null
?
shipNum
:
''
let
status
=
0
shipNum
=
shipNum
?
shipNum
:
''
let
status
=
SHIP_STATUS
.
NO_SHIP
console
.
log
(
shipCompany
,
shipNum
,
'shipCompany,shipNum'
)
if
(
shipCompany
&&
shipNum
)
{
status
=
SHIP_STATUS
.
HAS_SHIP
}
else
{
status
=
SHIP_STATUS
.
NO_SHIP
}
if
(
status
==
SHIP_STATUS
.
HAS_SHIP
)
{
return
await
this
.
awardsdao
.
update
(
console
.
log
(
activityId
,
prizeId
,
PRIZE_TYPE
.
OBJECT
)
const
result
=
await
this
.
awardsDao
.
update
(
{
activityId
,
_id
:
prizeId
,
type
:
PRIZE_TYPE
.
OBJECT
,
shipStatus
:
SHIP_STATUS
.
NO_SHIP
},
{
$set
:
{
shipCompany
,
shipNum
,
shipStatus
:
SHIP_STATUS
.
HAS_SHIP
shipStatus
:
status
}
}
)
console
.
log
(
result
,
'result'
)
return
result
}
else
{
return
0
}
}
}
\ No newline at end of file
// 根据活动id查找中奖名单
async
getAwardListByActivityId
({
activityId
=
''
,
title
=
''
,
pageNo
=
1
,
pageSize
=
10
,
prizeId
=
null
,
userNick
=
''
,
type
=
null
,
prizeDataType
=
null
,
shipStatus
=
null
,
startTime
=
null
,
endTime
=
null
,
isExport
=
false
})
{
if
(
!
activityId
)
return
false
let
p
=
prizeId
?
{
_id
:
prizeId
}
:
null
let
u
=
userNick
?
{
userNick
:
{
$regex
:
'.*'
+
userNick
+
'.*'
}
}
:
null
let
c
=
startTime
>
0
&&
endTime
>
0
?
{
createTime
:
{
$gt
:
startTime
,
$lt
:
endTime
}
}
:
null
let
s
=
shipStatus
?
(
shipStatus
==
1
?
{
shipStatus
:
{
$in
:
[
SHIP_STATUS
.
NO_ADDRESS
,
SHIP_STATUS
.
NO_SHIP
,
SHIP_STATUS
.
HAS_SHIP
]
}
}
:
(
shipStatus
==
2
?
{
shipStatus
:
{
$in
:
[
SHIP_STATUS
.
NO_ADDRESS
,
SHIP_STATUS
.
NO_SHIP
]
}
}
:
{
shipStatus
:
SHIP_STATUS
.
HAS_SHIP
}
)
)
:
''
;
let
t
=
type
?
{
type
:
+
type
}
:
null
let
pt
=
prizeDataType
?
{
prizeDataType
:
+
prizeDataType
}
:
null
let
arr
=
[]
if
(
p
)
arr
.
push
(
p
)
if
(
u
)
arr
.
push
(
u
)
if
(
c
)
arr
.
push
(
c
)
if
(
s
)
arr
.
push
(
s
)
if
(
t
)
arr
.
push
(
t
)
if
(
pt
)
arr
.
push
(
pt
)
arr
=
arr
.
filter
(
i
=>
i
)
console
.
log
(
'arr--111---'
,
arr
,
activityId
)
const
query
=
{
activityId
}
// @ts-ignore
if
(
arr
.
length
>
0
)
query
.
$and
=
arr
const
list
=
await
this
.
awardsDao
.
find
(
query
,
{
limit
:
pageSize
,
skip
:
(
pageNo
-
1
)
*
pageSize
,
sort
:
{
score
:
-
1
,
rankTime
:
-
1
}
})
const
total
=
await
this
.
awardsDao
.
count
(
query
)
return
{
list
,
total
,
message
:
'成功'
,
pageNo
,
pageSize
}
}
}
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