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";
...
@@ -2,7 +2,7 @@ import request from "./utils/request";
const
API
=
{
const
API
=
{
// 上传数据生成xslx文件 uploadDataCreateFile
// 上传数据生成xslx文件 uploadDataCreateFile
uploadDataCreateFile
:
(
params
)
=>
request
(
"exportAwardsList"
,
"POST"
,
params
),
exportAwardsList
:
(
params
)
=>
request
(
"exportAwardsList"
,
"POST"
,
params
),
// 保存活动配置 saveActivityInfo
// 保存活动配置 saveActivityInfo
saveActivityInfo
:
(
params
)
=>
request
(
"saveActivityInfo"
,
"POST"
,
params
),
saveActivityInfo
:
(
params
)
=>
request
(
"saveActivityInfo"
,
"POST"
,
params
),
// 删除活动 delActivity
// 删除活动 delActivity
...
@@ -32,10 +32,9 @@ const API = {
...
@@ -32,10 +32,9 @@ const API = {
request
(
"queryBenefitByEname"
,
"POST"
,
params
),
request
(
"queryBenefitByEname"
,
"POST"
,
params
),
// 复制创建新活动
// 复制创建新活动
createCopyActivity
:
(
params
)
=>
request
(
"createCopyActivity"
,
"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
),
downloadFile
:
(
params
)
=>
request
(
"downloadFile"
,
"POST"
,
params
),
getAwardsList
:
(
params
)
=>
request
(
"getAwardsList"
,
"POST"
,
params
),
};
};
export
default
API
;
export
default
API
;
client/components/dialog/prize-dialog/prize-dialog.axml
View file @
85a127e5
...
@@ -8,17 +8,25 @@
...
@@ -8,17 +8,25 @@
<view class="probability-prize-content">
<view class="probability-prize-content">
<view class="probability-prize-content-form">
<view class="probability-prize-content-form">
<form inline="true">
<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>
<form-item style="width:100%" size="large" class="probability-prize-content-formItem" label="奖品类型" required>
<view class="probability-prize-content-formitem-choosePrize-wrap">
<view class="probability-prize-content-formitem-choosePrize-wrap">
<select onChange="onPrizeTypeChange" defaultValue="{{isEdit ? prizeDialogData.record.type : prizeInitData.type}}">
<select onChange="onPrizeTypeChange" defaultValue="{{isEdit ? prizeDialogData.record.type : prizeInitData.type}}">
<option a:if="{{typeChecked.includes(1)}}" value="{{1}}">优惠券</option>
<option a:if="{{typeChecked.includes(1)}}" value="{{1}}">优惠券</option>
<option a:if="{{typeChecked.includes(2)}}" value="{{2}}">积分</option>
<option a:if="{{typeChecked.includes(2)}}" value="{{2}}">积分</option>
<option a:if="{{typeChecked.includes(3)}}" value="{{3}}">实物</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>
</select>
</view>
</view>
</form-item>
</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">
<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="请选择奖品"/>
<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>
<view class="probability-prize-content-formitem-goequity" onTap="navigateToPlugin" type="primary">{{prizeInitData.ename ? '重新选择' : '选择奖品'}}</view>
...
@@ -26,7 +34,7 @@
...
@@ -26,7 +34,7 @@
</form-item>
</form-item>
<form-item
<form-item
style="width:100%"
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"
size="large"
class="probability-prize-content-formItem"
class="probability-prize-content-formItem"
label="奖品名称"
label="奖品名称"
...
@@ -48,7 +56,7 @@
...
@@ -48,7 +56,7 @@
</form-item>
</form-item>
<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%"
style="width:100%"
size="large"
size="large"
class="probability-prize-content-formItem"
class="probability-prize-content-formItem"
...
@@ -61,7 +69,7 @@
...
@@ -61,7 +69,7 @@
</form-item>
</form-item>
<form-item
<form-item
style="width:100%"
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"
size="large"
class="probability-prize-content-formItem"
class="probability-prize-content-formItem"
label="奖品库存"
label="奖品库存"
...
@@ -82,7 +90,7 @@
...
@@ -82,7 +90,7 @@
</form-item>
</form-item>
<form-item
<form-item
a:if="{{[CREDITS_TYPE
, LOWER_TYPE
].includes(prizeInitData.type)}}"
a:if="{{[CREDITS_TYPE].includes(prizeInitData.type)}}"
size="large"
size="large"
class="probability-prize-content-formItem"
class="probability-prize-content-formItem"
label="积分价值"
label="积分价值"
...
@@ -93,7 +101,7 @@
...
@@ -93,7 +101,7 @@
</form-item>
</form-item>
<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%"
style="width:100%"
size="large"
size="large"
class="probability-prize-content-formItem"
class="probability-prize-content-formItem"
...
@@ -113,7 +121,7 @@
...
@@ -113,7 +121,7 @@
</form-item>
</form-item>
<form-item
<form-item
a:if="{{[EQUITY_TYPE
, LOWER_TYPE
].includes(prizeInitData.type)}} "
a:if="{{[EQUITY_TYPE].includes(prizeInitData.type)}} "
style="width:100%"
style="width:100%"
size="large"
size="large"
class="probability-prize-content-formItem"
class="probability-prize-content-formItem"
...
@@ -174,7 +182,7 @@
...
@@ -174,7 +182,7 @@
</form-item>
</form-item>
<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"
style="width:100%" size="large"
class="probability-prize-content-formItem probability-prize-content-formItem-choosePrize"
class="probability-prize-content-formItem probability-prize-content-formItem-choosePrize"
label="商品查看链接">
label="商品查看链接">
...
...
client/components/dialog/prize-dialog/prize-dialog.js
View file @
85a127e5
...
@@ -272,7 +272,7 @@ Component({
...
@@ -272,7 +272,7 @@ Component({
prizeInitData
:
{
prizeInitData
:
{
...
this
.
data
.
prizeInitData
,
...
this
.
data
.
prizeInitData
,
switchStock
:
value
,
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 @@
...
@@ -16,4 +16,16 @@
display: flex;
display: flex;
justify-content: flex-end;
justify-content: flex-end;
margin: 10px 0 0 0;
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
<dialog-wrap
title="中奖信息"
title="中奖名单"
tips="(为保证您的正常导出,建议单次筛选500条以内进行操作)"
visible="{{visible}}"
visible="{{visible}}"
onClose="onCloseDialog"
onClose="onCloseDialog"
width="1000"
width="1000"
>
>
<view class="rank-dialog-wrap">
<view class="rank-dialog-wrap">
<!-- <view class="other-winner-list">
<!-- 添加筛选条件导出中奖名单 start -->
<button type="text">导出其它中奖名单</button>
<form class="edit-content-form" data-name="form" inline="true" labelTextAlign="right" size="large">
</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">
<form-item class="edit-content-formItem" label="奖品编号" labelTextAlign="right" asterisk="{{false}}">
<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>
<form-item class="edit-content-formItem" label="用户
昵称
" labelTextAlign="right" asterisk="{{false}}">
<form-item class="edit-content-formItem" label="用户
id
" labelTextAlign="right" asterisk="{{false}}">
<input
data-type="user" value="{{searchInfo.userNick}}" onChange="onInputChange"
hasLimitHint="true" name="用户id" />
<input
value="{{searchInfo.userNick}}" onChange="handleInputChange" data-name='userNick'
hasLimitHint="true" name="用户id" />
</form-item>
</form-item>
<form-item class="edit-content-formItem" label="发奖时间" labelTextAlign="right" asterisk="{{false}}">
<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>
<form-item class="edit-content-formItem" label="发货状态" labelTextAlign="right">
<form-item class="edit-content-formItem" label="发货状态" labelTextAlign="right">
<select onChange="onSelectShipStatus">
<select value="{{searchInfo.shipStatus}}" onChange="handleInputChange" data-name='shipStatus'>
<option value="{{1}}">全部实物</option>
<option value="">全部</option>
<option value="{{2}}">未发货</option>
<option value="1">未填写地址</option>
<option value="{{3}}">已发货</option>
<option value="2">待发货</option>
<option value="3">已发货</option>
</select>
</select>
</form-item>
</form-item>
<form-item class="edit-content-formItem" label="奖品类型">
<form-item class="edit-content-formItem long-item" label="奖品类型">
<select data-type="prizeType" onChange="onSelectPrizeType">
<select value="{{searchInfo.prizeType}}" onChange="handleInputChange" data-name='prizeType'>
<option value="{{1}}">优惠券</option>
<option value="">全部</option>
<option value="{{3}}">实物</option>
<option value="1">优惠券</option>
<!-- <option value="2">积分</option> -->
<option value="3">实物</option>
<option value="5">谢谢参与</option>
</select>
</select>
</form-item>
</form-item>
<form-item class="edit-content-formItem" label="发奖来源">
<form-item class="edit-content-formItem long-item" label="发奖来源">
<select data-type="prizeDataType" onChange="onSelectPrizeType">
<select value="{{searchInfo.prizeDataType}}" onChange="handleInputChange" data-name='prizeDataType'>
<option value="{{1}}">排行榜</option>
<option value="">全部</option>
<option value="{{2}}">抽奖</option>
<option value="1">游戏获得</option>
<option value="{{3}}">大转盘</option>
<option value="2">排行榜</option>
<option value="3">分享获得</option>
</select>
</select>
</form-item>
</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>
</form>
<table dataSource="{{list}}" loading="{{isLoading}}">
<view a:if="{{isSearch}}" style="textAlign:right">
<table-column title="奖品编号" dataIndex="_id"/>
<button onTap="onChangeSearch" style="height:32px;" type="primary" size="medium">搜索</button>
<table-column title="用户id" dataIndex="userNick"/>
<button style="margin-left:20px;height:32px" type="primary" data-type="search" onTap="exportWinnerListBySearch" size="medium">导出</button>
<table-column title="发奖时间" dataIndex="createTime">
<button style="margin-left:20px;height:32px" type="primary" onTap="onChangeUpLoad" size="medium">导入发货</button>
</table-column>
</view>
<table-column title="填写地址时间" dataIndex="receiveTime">
<!-- end -->
<view slot-scope="x">
<view a:if="{{!isSearch}}" class="now-winner-list">
{{ x.record.type === 3 ? (x.record.receiveName ? x.record.receiveTime : '暂未填写') : '/' }}
<button type="primary" data-type="export" onTap="exportWinnerList">导出中奖名单</button>
</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>
</view>
<table dataSource="{{list}}">
</table-column>
<table-column a:for="{{columns}}" a:key="*this" title="{{item.title}}" dataIndex="{{item.prop}}" width="{{item.width}}"/>
<table-column title="收货信息(联系人+详细地址)" dataIndex="receiveName">
</table>
<view slot-scope="x">
<view class="rank-pagination">
<view a:if="{{x.record.type == 3}}">
<text class="rank-pagination-text">共{{total}}条</text>
<view>{{(x.record.receiveName || '')}}</view>
<!-- <pagination shape="arrow-only" hideOnlyOnePage="true" defaultCurrent="1" current="{{pageInfo.pageNo}}" pageSize="{{pageInfo.pageSize}}" onChange="changePagination" pageShowCount="100" total="{{pageInfo.total}}" /> -->
<view>{{( x.record.phone || '')}} </view>
<pagination showJump="{{false}}" defaultCurrent="{{1}}" data-type="all" pageSize="{{pageSize}}" onChange="onChangePageNo" pageShowCount="{{10}}" total="{{total}}" a:if="{{total > 0}}" shape="arrow-only" />
<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>
</view>
<!-- </tab-item>
<view a:else>/</view>
</tab> -->
</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>
</view>
</dialog-wrap>
</dialog-wrap>
<ship-dialog a:if="{{showShip}}" showShip="{{showShip}}" onClose="onCloseShip" activityId="{{winactivityId}}"></ship-dialog>
<ship-dialog a:if="{{showShip}}" showShip="{{showShip}}" onClose="handleShipClose" activityId="{{winactivityId}}"></ship-dialog>
\ No newline at end of file
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 @@
...
@@ -4,4 +4,4 @@
"dialog-wrap"
:
"../../basic/dialiog-wrap/dialiog-wrap"
,
"dialog-wrap"
:
"../../basic/dialiog-wrap/dialiog-wrap"
,
"ship-dialog"
:
"../../dialog/ship-dialog/ship-dialog"
"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 @@
...
@@ -3,7 +3,7 @@
width: 100%;
width: 100%;
height: 200px;
height: 200px;
/* margin-left: 80px; */
/* margin-left: 80px; */
margin-top: 100px;
/* margin-top: 100px; */
}
}
.edit-content-titleLoad {
.edit-content-titleLoad {
...
@@ -14,9 +14,15 @@
...
@@ -14,9 +14,15 @@
}
}
.edit-content-shipDialog {
.edit-content-shipDialog {
width: 340px;
display:flex;
margin-left: 76px;
align-items: center;
margin-top: 40px;
/* margin-left: 76px;
margin-top: 40px; */
}
.fileIdInp{
width: 240px!important;
margin-right: 20px;
}
}
.edit-content-buttons {
.edit-content-buttons {
...
@@ -26,4 +32,14 @@
...
@@ -26,4 +32,14 @@
.edit-content-buttonShip {
.edit-content-buttonShip {
margin-left: 5px
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">
<dialog-wrap title="批量发货" visible="{{showShip}}" onClose="closeShip">
<view class="edit-content-shipDialog1">
<view class="edit-content-shipDialog1">
<form-item class="edit-content-shipDialog" label="
上传附件:" style="display:flex
">
<form-item class="edit-content-shipDialog" label="
fileId
">
<input
placeholder="Input" style="80px
" value="{{fileName}}" onChange="onChangeInput"/>
<input
class="fileIdInp" placeholder="请输入fileId
" value="{{fileName}}" onChange="onChangeInput"/>
</form-item>
</form-item>
<view class="ship-tips">
请点击下载模板后,填写完信息发给运营获取fileId 参考示例: <text class="example" onTap="downloadExampleFile">示例.csv</text>
</view>
<view class="edit-content-buttons">
<view class="edit-content-buttons">
<button class="edit-content-buttonShip" type="primary" onTap="closeShip">
<button onTap="closeShip">取消</button>
取消
<button class="edit-content-buttonShip" disabled="{{!fileName}}" type="primary" onTap="onChangeLoadFile">确认发货</button>
</button>
<button class="edit-content-buttonShip" type="primary" onTap="onChangeLoadFile">
确认发货
</button>
</view>
</view>
</view>
</view>
</dialog-wrap>
</dialog-wrap>
\ No newline at end of file
<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"
;
import
{
downloadFile
}
from
"../../../api"
;
const
{
cloud
}
=
getApp
();
// import { upLoadFileApi } from "../../utils/my-api";
// import { upLoadFileApi } from "../../utils/my-api";
Component
({
Component
({
data
:
{
data
:
{
fileName
:
""
fileName
:
""
,
copyLink
:
false
,
url
:
"yun.dui88.com/call/example.xlsx"
,
},
},
props
:
{
props
:
{
activityId
:
""
,
activityId
:
""
,
onClose
:
()
=>
{
}
onClose
:
()
=>
{
}
,
},
},
didMount
()
{
didMount
()
{
console
.
log
(
">>>>>>activityId"
,
this
.
props
.
activityId
);
console
.
log
(
">>>>>>activityId"
,
this
.
props
.
activityId
);
},
didUpdate
()
{
},
},
didUpdate
()
{
},
didUnmount
()
{
},
didUnmount
()
{
},
methods
:
{
methods
:
{
//LS20200716关闭弹窗
//LS20200716关闭弹窗
closeShip
()
{
closeShip
()
{
this
.
props
.
onClose
();
this
.
props
.
onClose
();
this
.
setData
({
this
.
setData
({
fileName
:
""
fileName
:
""
,
})
})
;
console
.
log
(
"ship-dialog====showShip"
);
console
.
log
(
"ship-dialog====showShip"
);
},
},
closeDialog
()
{
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确认发货
//20200717
//20200717
...
@@ -40,32 +67,30 @@ Component({
...
@@ -40,32 +67,30 @@ Component({
if
(
result
.
data
.
total
==
0
)
{
if
(
result
.
data
.
total
==
0
)
{
my
.
showToast
({
my
.
showToast
({
type
:
"fail"
,
type
:
"fail"
,
content
:
`
无用户填写地址,导入信息错误
`
,
content
:
`
导入信息错误,请导入正确信息
`
,
});
});
}
}
else
{
else
{
my
.
showToast
({
my
.
showToast
({
type
:
"success"
,
type
:
"success"
,
content
:
`成功导入
${
JSON
.
stringify
(
result
.
data
.
total
)}
条发货信息!`
,
content
:
`成功导入
${
JSON
.
stringify
(
result
.
data
.
total
)}
条发货信息!`
,
});
});
this
.
props
.
onClose
()
}
}
}
else
{
}
else
{
my
.
showToast
({
my
.
showToast
({
type
:
"fail"
,
type
:
"fail"
,
content
:
result
.
message
content
:
result
.
message
,
});
});
}
}
},
},
//输入框变化
//输入框变化
onChangeInput
(
e
)
{
onChangeInput
(
e
)
{
console
.
log
(
"输入框变化"
,
e
);
console
.
log
(
"输入框变化"
,
e
);
let
{
fileName
}
=
this
.
data
;
let
{
fileName
}
=
this
.
data
;
this
.
setData
({
this
.
setData
({
fileName
:
e
.
detail
.
value
fileName
:
e
.
detail
.
value
,
})
})
;
console
.
log
(
"===="
,
fileName
);
console
.
log
(
"===="
,
fileName
);
}
}
,
}
}
,
})
})
;
client/components/dialog/ship-dialog/ship-dialog.json
View file @
85a127e5
{
{
"component"
:
true
,
"component"
:
true
,
"usingComponents"
:
{
"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"
;
import
{
validateRangeNumber
}
from
"../../../utils/validate"
;
Component
({
Component
({
...
@@ -80,13 +81,6 @@ Component({
...
@@ -80,13 +81,6 @@ Component({
[
name
]:
value
[
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
()
{
onSaveTask
()
{
const
{
title
,
link
,
value
,
taskRateType
,
times
,
itemIds
}
=
this
.
data
;
const
{
title
,
link
,
value
,
taskRateType
,
times
,
itemIds
}
=
this
.
data
;
// if(!title.trim()) {
// if(!title.trim()) {
...
@@ -97,11 +91,11 @@ Component({
...
@@ -97,11 +91,11 @@ Component({
// return;
// return;
// }
// }
if
(
this
.
props
.
hasLink
&&
!
this
.
validateLink
(
link
)
)
{
if
(
this
.
props
.
hasLink
&&
!
urlCheck
(
link
,
passUrlList
).
status
)
{
my
.
showToast
({
my
.
showToast
({
type
:
'fail'
,
type
:
'fail'
,
content
:
'请输入正确的链接地址'
content
:
urlCheck
(
link
,
passUrlList
).
message
})
})
;
return
;
return
;
}
}
...
...
client/components/list/list-table/list-table.axml
View file @
85a127e5
...
@@ -14,7 +14,7 @@
...
@@ -14,7 +14,7 @@
<table-column title="操作" dataIndex="id" alignHeader="left">
<table-column title="操作" dataIndex="id" alignHeader="left">
<view slot-scope="x">
<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('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('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('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>
<button a:if="{{buttons.includes('copyNewActivity')}}" class="tb-list-edit" type="primary" text="true" data-x="{{x}}" onTap="onCreateNewActivity">复制新活动</button>
...
@@ -29,7 +29,7 @@
...
@@ -29,7 +29,7 @@
</view>
</view>
<copy-link-dialog visible="{{exportDialogVisible}}" url="{{exportUrl}}" onClose="onCloseExportDialog"/>
<copy-link-dialog visible="{{exportDialogVisible}}" url="{{export
Link
Url}}" onClose="onCloseExportDialog"/>
<confirm-dialog
<confirm-dialog
visible="{{confirmDialog.visible}}"
visible="{{confirmDialog.visible}}"
...
@@ -39,4 +39,4 @@
...
@@ -39,4 +39,4 @@
/>
/>
<rank-dialog a:if="{{winnerListDialogVisible}}" visible="{{winnerListDialogVisible}}" onClose="onCloseWinnerListDialog" selectedItem="{{selectedItem}}"/>
<rank-dialog a:if="{{winnerListDialogVisible}}" visible="{{winnerListDialogVisible}}" onClose="onCloseWinnerListDialog" onShowExportDialog="showExportDialog" selectedItem="{{selectedItem}}"/>
\ No newline at end of file
\ No newline at end of file
client/components/list/list-table/list-table.js
View file @
85a127e5
...
@@ -14,7 +14,7 @@ Component({
...
@@ -14,7 +14,7 @@ Component({
data
:
{
data
:
{
isLoadingList
:
false
,
isLoadingList
:
false
,
exportDialogVisible
:
false
,
exportDialogVisible
:
false
,
exportUrl
:
''
,
export
Link
Url
:
''
,
dataSource
:
[],
dataSource
:
[],
confirmDialog
:
{
confirmDialog
:
{
visible
:
false
,
visible
:
false
,
...
@@ -99,6 +99,14 @@ Component({
...
@@ -99,6 +99,14 @@ Component({
winnerListDialogVisible
:
false
winnerListDialogVisible
:
false
});
});
},
},
//展示复制链接弹框
showExportDialog
(
data
)
{
console
.
log
(
'展示复制链接弹框'
,
data
)
this
.
setData
({
exportDialogVisible
:
true
,
exportLinkUrl
:
data
.
exportLinkUrl
})
},
// 复制链接
// 复制链接
async
onCopyLink
(
evt
)
{
async
onCopyLink
(
evt
)
{
...
@@ -185,36 +193,6 @@ Component({
...
@@ -185,36 +193,6 @@ Component({
console
.
log
(
error
);
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
)
{
handleClickEdit
(
evt
)
{
let
{
activityId
}
=
evt
.
target
.
dataset
.
x
.
record
;
let
{
activityId
}
=
evt
.
target
.
dataset
.
x
.
record
;
...
...
client/pages/activity/add/add.js
View file @
85a127e5
...
@@ -160,9 +160,9 @@ Component({
...
@@ -160,9 +160,9 @@ Component({
Object
.
keys
(
formState
).
forEach
(
key
=>
{
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
];
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'
)
{
//
if (key === 'timeRange' && formState[key].status === 'error') {
return
//
return
}
//
}
newValidator
[
key
]
=
{
newValidator
[
key
]
=
{
status
:
error
?
'error'
:
'success'
,
status
:
error
?
'error'
:
'success'
,
message
:
error
?
error
.
message
:
''
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 校验
// 使用 async-validator 校验
// 文档地址: https://github.com/yiminghe/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) => {
...
@@ -34,16 +34,31 @@ export const validateRangeNumber = (number, [min, max] = [], fixed = 0) => {
console
.
error
(
'数字范围的最小值不能大于最大值'
);
console
.
error
(
'数字范围的最小值不能大于最大值'
);
return
;
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
;
if
(
number
<
min
||
number
>
max
)
return
false
;
return
true
;
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 {
...
@@ -52,7 +52,7 @@ export default class ActivitSaveController {
}
}
// 概率奖品配置需要增加 properiodfrom properiodto字段
// 概率奖品配置需要增加 properiodfrom properiodto字段
//
prizeList = activityconfigService.setPrizeProbalityRange(prizeList)
prizeList
=
activityconfigService
.
setPrizeProbalityRange
(
prizeList
)
// 所有奖品均存在b_prize_config表里, 根据需求定义的奖品参数都要整合到allPrizeLists里
// 所有奖品均存在b_prize_config表里, 根据需求定义的奖品参数都要整合到allPrizeLists里
// level 排序用避免查询乱序
// level 排序用避免查询乱序
...
...
server/duibats/src/index.ts
View file @
85a127e5
...
@@ -7,14 +7,13 @@ import RuleController from './controller/rule.controller'
...
@@ -7,14 +7,13 @@ import RuleController from './controller/rule.controller'
import
RaobaoItemController
from
'./controller/taobaoItem.controller'
import
RaobaoItemController
from
'./controller/taobaoItem.controller'
import
SaveController
from
'./controller/save.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
{
sellerSaasSave
,
sellerSave
}
=
new
SellerController
()
const
{
const
{
findWinnerInfoList
,
findWinnerInfoList
,
exportAwardsList
,
exportAwardsList
,
findWinnerInfoListBySearch
,
getAwardsList
,
downloadFile
,
downloadFile
,
exportAwardsInfoBySearch
}
=
new
AwardsController
()
}
=
new
AwardsController
()
const
{
generateRule
}
=
new
RuleController
()
const
{
generateRule
}
=
new
RuleController
()
const
{
findItemListByStatus
,
findItemListByIds
,
queryBenefitByEname
}
=
new
RaobaoItemController
()
const
{
findItemListByStatus
,
findItemListByIds
,
queryBenefitByEname
}
=
new
RaobaoItemController
()
...
@@ -28,10 +27,10 @@ export default {
...
@@ -28,10 +27,10 @@ export default {
sellerSave
,
sellerSave
,
findWinnerInfoList
,
findWinnerInfoList
,
exportAwardsList
,
exportAwardsList
,
findWinnerInfoListBySearch
,
downloadFile
,
downloadFile
,
exportAwardsInfoBySearch
,
findItemListByStatus
,
findItemListByStatus
,
findItemListByIds
,
findItemListByIds
,
queryBenefitByEname
queryBenefitByEname
,
createCopyActivity
,
getAwardsList
}
}
server/duibats/src/service/awards.service.ts
View file @
85a127e5
...
@@ -5,12 +5,12 @@
...
@@ -5,12 +5,12 @@
import
{
BaseDao
}
from
'../sdk'
import
{
BaseDao
}
from
'../sdk'
import
{
AWARDS_DB_NAME
}
from
'../db'
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
{
export
default
class
AwardsService
{
context
:
Context
context
:
Context
awards
d
ao
:
IBaseDao
awards
D
ao
:
IBaseDao
constructor
(
context
:
Context
)
{
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 {
...
@@ -24,7 +24,7 @@ export default class AwardsService {
}
}
})
})
try
{
try
{
await
this
.
awards
d
ao
.
insertMany
(
list
)
await
this
.
awards
D
ao
.
insertMany
(
list
)
return
true
return
true
}
catch
(
e
)
{
}
catch
(
e
)
{
console
.
log
(
`添加排行榜待开奖列表出错:
${
e
}
`
)
console
.
log
(
`添加排行榜待开奖列表出错:
${
e
}
`
)
...
@@ -32,134 +32,99 @@ export default class AwardsService {
...
@@ -32,134 +32,99 @@ export default class AwardsService {
}
}
}
}
// 根据活动id查找中奖名单
async
setUserShipStatus
(
activityId
,
prizeId
,
shipCompany
,
shipNum
)
{
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
)
{
prizeId
=
prizeId
?
prizeId
:
'/'
prizeId
=
prizeId
?
prizeId
:
'/'
shipCompany
=
shipCompany
?
shipCompany
:
''
shipCompany
=
shipCompany
?
shipCompany
:
''
shipNum
=
shipNum
!==
null
?
shipNum
:
''
shipNum
=
shipNum
?
shipNum
:
''
let
status
=
0
let
status
=
SHIP_STATUS
.
NO_SHIP
console
.
log
(
shipCompany
,
shipNum
,
'shipCompany,shipNum'
)
if
(
shipCompany
&&
shipNum
)
{
if
(
shipCompany
&&
shipNum
)
{
status
=
SHIP_STATUS
.
HAS_SHIP
status
=
SHIP_STATUS
.
HAS_SHIP
}
else
{
}
else
{
status
=
SHIP_STATUS
.
NO_SHIP
status
=
SHIP_STATUS
.
NO_SHIP
}
}
if
(
status
==
SHIP_STATUS
.
HAS_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
,
activityId
,
_id
:
prizeId
,
_id
:
prizeId
,
type
:
PRIZE_TYPE
.
OBJECT
,
shipStatus
:
SHIP_STATUS
.
NO_SHIP
shipStatus
:
SHIP_STATUS
.
NO_SHIP
},
},
{
{
$set
:
{
$set
:
{
shipCompany
,
shipCompany
,
shipNum
,
shipNum
,
shipStatus
:
SHIP_STATUS
.
HAS_SHIP
shipStatus
:
status
}
}
}
}
)
)
console
.
log
(
result
,
'result'
)
return
result
}
else
{
}
else
{
return
0
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