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
Show 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
...
@@ -17,3 +17,15 @@
...
@@ -17,3 +17,15 @@
justify-content: flex-end;
justify-content: flex-end;
margin: 10px 0 0 0;
margin: 10px 0 0 0;
}
}
.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">
<button type="text">导出其它中奖名单</button>
</view> -->
<!-- <tab shape="wrapped">
<tab-item
a:for="{{tabs}}"
title="{{item.tab}}"
key="{{item.key}}"
> -->
<!-- 添加筛选条件导出中奖名单 start -->
<!-- 添加筛选条件导出中奖名单 start -->
<form a:if="{{isSearch}}"
class="edit-content-form" data-name="form" inline="true" labelTextAlign="right" size="large">
<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}}">
<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>
<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-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>
<!-- end -->
<view a:else>/</view>
<view a:if="{{!isSearch}}" class="now-winner-list">
<button type="primary" data-type="export" onTap="exportWinnerList">导出中奖名单</button>
</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="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 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>
</table>
<view class="rank-pagination">
<view class="rank-pagination">
<text class="rank-pagination-text">共{{total}}条</text>
<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}}" current="{{searchInfo.pageNo}}" data-type="all" pageSize="{{searchInfo.pageSize}}" onChange="handleChangePage" pageShowCount="{{10}}" total="{{total}}" a:if="{{total > 0}}" shape="arrow-only" />
<pagination showJump="{{false}}" defaultCurrent="{{1}}" data-type="all" pageSize="{{pageSize}}" onChange="onChangePageNo" pageShowCount="{{10}}" total="{{total}}" a:if="{{total > 0}}" shape="arrow-only" />
</view>
</view>
<!-- </tab-item>
</tab> -->
</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
import
{
findWinnerInfoList
,
getAwardsList
,
exportAwardsList
}
from
'/api'
import
moment
from
'moment'
import
{
findWinnerInfoList
,
uploadDataCreateFile
,
// 通过搜索条件筛选中奖名单
exportAwardsInfoBySearch
,
findWinnerInfoListBySearch
}
from
"/api"
;
import
{
appId
}
from
"/config"
;
import
{
setClipboard
}
from
"/utils"
;
//每页的展示数量
const
PageInfo
=
{
PAGE_SIZE
:
100
,
PAGE_NO
:
1
}
Component
({
Component
({
mixins
:
[],
mixins
:
[],
data
:
{
data
:
{
PageInfo
,
// 搜索条件
tabs
:
[{
searchInfo
:
{
tab
:
'0608-0712'
,
prizeId
:
null
,
//奖品编号
key
:
111
userNick
:
null
,
//用户id
},
{
timeRange
:
[],
//发奖时间
tab
:
'03308-0712'
,
prizeType
:
null
,
key
:
43
prizeDataType
:
null
,
},
{
shipStatus
:
null
,
tab
:
'064548-0712'
,
pageNo
:
1
,
key
:
435
pageSize
:
10
},
{
},
tab
:
'0608-0712'
,
key
:
436545
},
{
tab
:
'0608-0712'
,
key
:
65
},
{
tab
:
'0608-0712'
,
key
:
11561
},
{
tab
:
'0608-0712'
,
key
:
13311
},
{
tab
:
'0608-0712'
,
key
:
145611
},
{
tab
:
'0608-0712'
,
key
:
1178761
}],
dataSource
:
[],
columns
:
[
{
title
:
'奖品编号'
,
prop
:
'prizeId'
},
// prizeId为awards_info中的_id
{
title
:
'发奖时间'
,
prop
:
'createTime'
},
{
title
:
'填地址时间'
,
prop
:
'receiveTime'
},
{
title
:
'用户昵称'
,
prop
:
'userNick'
},
{
title
:
'发奖来源'
,
prop
:
'prizeDataType'
},
{
title
:
'奖品类型'
,
prop
:
'type'
},
{
title
:
'奖品名'
,
prop
:
'name'
},
{
title
:
'收货人'
,
prop
:
'receiveName'
},
{
title
:
'联系方式'
,
prop
:
'phone'
},
/* 注:需要在接口里将 省+市+区+详细 拼写起来*/
{
title
:
'收货地址'
,
prop
:
'address'
},
// { title: '收货地址', prop: 'address', width: 240 }
{
title
:
'物流状态'
,
prop
:
'shipStatus'
},
{
title
:
'物流公司'
,
prop
:
'shipCompany'
},
{
title
:
'物流单号'
,
prop
:
'shipNum'
}
],
// pageInfo: {
// pageNo: 1,
// pageSize: 100,
// total: 0
// },
// 《条件搜索》start显示中奖名单搜索条件
list
:
[],
list
:
[],
prizeId
:
""
,
userId
:
""
,
startT
:
""
,
endT
:
""
,
shipStatus
:
""
,
timeRange
:
[],
prizeType
:
""
,
prizeDataType
:
""
,
showShip
:
false
,
winactivityId
:
""
,
pageNo
:
PageInfo
.
PAGE_NO
,
pageSize
:
PageInfo
.
PAGE_SIZE
,
total
:
0
,
total
:
0
,
// end
isLoading
:
false
,
//需要筛选查询时改为true
showShip
:
false
,
isSearch
:
true
winactivityId
:
''
,
},
},
props
:
{
props
:
{
onClose
:
()
=>
{
},
onClose
:
()
=>
{
},
selectedItem
:
{},
onShowExportDialog
:
()
=>
{
},
selectedItem
:
{}
},
},
didMount
()
{
didMount
()
{
if
(
!
this
.
data
.
isSearch
)
{
this
.
searchList
();
this
.
loadWinnerList
();
}
},
},
didUpdate
()
{
},
didUnmount
()
{
},
methods
:
{
methods
:
{
// 更换页码时调用接口
handleChangePage
(
e
)
{
const
{
value
}
=
e
.
detail
this
.
setData
({
'searchInfo.pageNo'
:
value
})
this
.
searchList
()
},
// 搜索
async
handleSearch
()
{
// 未选择任何条件搜索
const
{
prizeId
,
userNick
,
timeRange
,
prizeType
,
shipStatus
,
prizeDataType
}
=
this
.
data
.
searchInfo
if
(
!
prizeId
&&
!
userNick
&&
!
timeRange
.
length
&&
prizeType
==
null
&&
shipStatus
==
null
&&
prizeDataType
==
null
)
{
this
.
resetData
()
my
.
showToast
({
type
:
'fail'
,
content
:
'请填写至少一个筛选信息'
})
return
}
this
.
setData
({
'searchInfo.pageNo'
:
1
})
this
.
searchList
()
},
// start《条件搜索》初始化数据更新
// start《条件搜索》初始化数据更新
ini
tData
()
{
rese
tData
()
{
this
.
setData
({
this
.
setData
({
searchInfo
:
{
prizeId
:
null
,
//奖品编号
userNick
:
null
,
//用户id
timeRange
:
[],
//发奖时间
prizeType
:
null
,
prizeDataType
:
null
,
shipStatus
:
null
,
pageNo
:
1
,
pageSize
:
10
},
list
:
[],
list
:
[],
prizeId
:
""
,
userId
:
""
,
startT
:
""
,
endT
:
""
,
timeRange
:
[],
shipStatus
:
""
,
prizeType
:
""
,
prizeDataType
:
""
,
pageNo
:
PageInfo
.
PAGE_NO
,
pageSize
:
PageInfo
.
PAGE_SIZE
,
total
:
0
,
total
:
0
,
});
isLoading
:
false
,
},
showShip
:
false
,
//加载中奖名单
winactivityId
:
''
async
loadWinnerList
()
{
})
let
{
pageNo
,
pageSize
}
=
this
.
data
;
let
{
activityId
}
=
this
.
props
.
selectedItem
;
const
{
data
,
success
}
=
await
findWinnerInfoList
({
activityId
,
pageNo
,
pageSize
});
console
.
log
(
'data>>>>>'
,
data
);
if
(
success
)
{
this
.
setData
({
list
:
data
.
list
,
total
:
data
.
total
});
}
},
},
// end
onCloseDialog
()
{
onCloseDialog
()
{
this
.
initData
();
this
.
resetData
()
this
.
props
.
onClose
&&
this
.
props
.
onClose
();
this
.
props
.
onClose
&&
this
.
props
.
onClose
()
},
// 监听input改变
handleInputChange
(
e
)
{
const
{
value
}
=
e
.
detail
;
const
{
name
}
=
e
.
target
.
dataset
;
this
.
setData
({
[
`searchInfo.
${
name
}
`
]:
value
})
},
},
async
getWinnerList
()
{
// 监听发奖时间变化
const
{
avtivityId
}
=
this
.
props
;
handleTimeRangeChange
(
e
)
{
const
{
data
}
=
await
findWinnerInfoList
({
const
[
startTime
,
endTime
]
=
e
.
detail
.
value
avtivityId
});
this
.
setData
({
this
.
setData
({
dataSource
:
data
'searchInfo.timeRange'
:
[
startTime
,
endTime
]
})
;
})
},
},
//
导出中奖名单
//
搜索
async
exportWinnerList
(
evt
)
{
async
searchList
(
)
{
const
{
activityId
,
title
}
=
this
.
props
.
selectedItem
;
let
params
=
{
const
{
type
}
=
evt
.
target
.
dataset
;
...
this
.
data
.
searchInfo
,
my
.
showLoading
({
content
:
"生成文件中..."
});
activityId
:
this
.
props
.
selectedItem
.
activityId
try
{
}
const
{
success
,
data
,
message
}
=
await
uploadDataCreateFile
({
params
.
startTime
=
new
Date
(
params
.
timeRange
[
0
]).
getTime
()
activityId
,
params
.
endTime
=
new
Date
(
params
.
timeRange
[
1
]).
getTime
()
title
});
delete
params
.
timeRange
my
.
hideLoading
();
console
.
log
(
'搜索参数'
,
params
)
try
{
this
.
setData
({
isLoading
:
true
})
console
.
log
(
params
)
const
{
data
,
success
}
=
(
await
findWinnerInfoList
(
params
))
||
{}
const
{
list
,
total
}
=
data
console
.
log
(
data
,
'data-----'
)
list
.
map
(
v
=>
{
v
.
createTime
=
moment
(
+
v
.
createTime
).
format
(
'YYYY-MM-DD HH:mm:ss'
)
v
.
receiveTime
=
moment
(
+
v
.
receiveTime
).
format
(
'YYYY-MM-DD HH:mm:ss'
)
})
if
(
success
)
{
if
(
success
)
{
await
setClipboard
({
text
:
data
.
url
.
replace
(
/amp;/g
,
""
)
});
my
.
showToast
({
type
:
'success'
,
content
:
'下载链接复制成功,请在浏览器中打开下载'
});
this
.
setData
({
this
.
setData
({
exportDialogVisible
:
true
,
list
,
exportUrl
:
data
.
url
.
replace
(
/amp;/g
,
""
)
total
});
})
}
else
{
this
.
setData
({
my
.
showToast
({
isLoading
:
false
type
:
"fail"
,
})
content
:
message
,
});
}
}
}
catch
(
error
)
{
}
catch
(
error
)
{
my
.
hideLoading
();
this
.
setData
({
console
.
log
(
error
,
"exportList-error"
);
isLoading
:
false
})
}
}
},
},
// 《条件搜索》 导出中奖名单
async
handleExport
(
evt
)
{
console
.
log
(
this
.
props
)
timeExchange
(
time
)
{
// 未选择任何条件搜索
console
.
log
(
"time=="
,
time
);
const
{
prizeId
,
userNick
,
timeRange
,
prizeType
,
shipStatus
,
prizeDataType
}
=
this
.
data
.
searchInfo
let
a
=
time
?
new
Date
(
time
)
:
""
;
if
(
!
prizeId
&&
!
userNick
&&
!
timeRange
.
length
&&
prizeType
==
null
&&
shipStatus
==
null
&&
prizeDataType
==
null
)
{
let
times
=
a
?
a
.
getTime
()
:
""
;
this
.
resetData
()
return
times
;
},
async
exportWinnerListBySearch
(
evt
)
{
const
{
activityId
,
title
}
=
this
.
props
.
selectedItem
;
let
{
prizeId
,
userId
,
startT
,
endT
,
shipStatus
,
pageNo
,
pageSize
,
prizeType
,
prizeDataType
}
=
this
.
data
;
let
timeStart
=
this
.
timeExchange
(
startT
);
let
timeEnd
=
this
.
timeExchange
(
endT
);
if
(
prizeId
||
userId
||
(
timeStart
&&
timeEnd
)
||
shipStatus
||
prizeType
||
prizeDataType
)
{
try
{
console
.
log
(
"导出名单数据接口"
);
const
{
success
,
data
,
message
}
=
await
exportAwardsInfoBySearch
({
activityId
,
pageNo
,
pageSize
,
title
,
prizeId
,
userId
,
timeStart
,
timeEnd
,
shipStatus
,
prizeType
,
prizeDataType
});
if
(
success
)
{
if
(
!
data
)
{
my
.
showToast
({
my
.
showToast
({
type
:
'fail'
,
type
:
'fail'
,
content
:
'没有符合条件的订单!'
content
:
'请填写至少一个筛选信息'
});
})
return
}
const
{
activityId
,
title
}
=
this
.
props
.
selectedItem
let
params
=
{
...
this
.
data
.
searchInfo
,
activityId
,
title
}
params
.
startTime
=
new
Date
(
params
.
timeRange
[
0
]).
getTime
()
params
.
endTime
=
new
Date
(
params
.
timeRange
[
1
]).
getTime
()
params
.
pageNo
=
1
params
.
pageSize
=
500
let
res
=
[]
delete
params
.
timeRange
my
.
showLoading
({
content
:
'生成文件中...'
})
try
{
let
{
success
,
data
,
message
}
=
(
await
getAwardsList
(
params
).
catch
(
error
=>
{
}))
||
{}
const
{
list
=
[],
total
}
=
data
||
{}
if
(
success
)
{
res
=
[...
res
,
...
list
]
while
(
total
>
res
.
length
)
{
params
.
pageNo
++
let
{
success
,
data
,
message
}
=
(
await
getAwardsList
(
params
).
catch
(
error
=>
{
}))
||
{}
const
{
list
=
[]
}
=
data
||
{}
if
(
success
)
{
res
=
[...
res
,
...
list
]
}
else
{
}
}
else
{
console
.
log
(
"导出中奖名单"
);
my
.
setClipboard
({
text
:
data
.
url
.
replace
(
/amp;/g
,
''
),
success
(
res
)
{
my
.
showToast
({
type
:
'success'
,
content
:
'下载链接复制成功,请在浏览器中打开下载'
});
}
}
});
if
(
res
.
length
==
0
)
{
my
.
showToast
({
type
:
'fail'
,
content
:
'查询结果为空'
})
my
.
hideLoading
()
return
}
}
let
{
success
,
data
,
message
}
=
(
await
exportAwardsList
({
title
,
list
:
res
}))
||
{}
console
.
log
(
success
,
data
,
message
,
'复制链接'
)
if
(
success
)
{
this
.
props
.
onShowExportDialog
({
exportLinkUrl
:
data
.
url
.
replace
(
/amp;/g
,
''
)
})
console
.
log
(
data
,
'下载链接'
)
}
else
{
}
else
{
my
.
showToast
({
my
.
showToast
({
type
:
'fail'
,
type
:
'fail'
,
content
:
message
content
:
message
});
})
}
}
catch
(
error
)
{
my
.
hideLoading
();
console
.
log
(
'exportList-error'
,
error
);
}
}
}
else
{
}
}
else
{
my
.
hideLoading
()
my
.
showToast
({
}
catch
(
error
)
{
type
:
"fail"
,
my
.
hideLoading
()
content
:
"请填写至少一个筛选信息"
console
.
log
(
error
,
'exportList-error'
)
});
}
}
},
},
// 导入发货信息
// 《条件搜索》导入发货信息
handleImport
()
{
onChangeUpLoad
()
{
const
{
activityId
}
=
this
.
props
.
selectedItem
cons
t
{
activityId
,
title
}
=
this
.
props
.
selectedItem
;
cons
ole
.
log
(
'打开导入文件弹窗'
)
this
.
setData
({
this
.
setData
({
showShip
:
true
,
showShip
:
true
,
winactivityId
:
activityId
winactivityId
:
activityId
});
})
console
.
log
(
'winner====showShip'
,
this
.
data
.
showShip
)
},
},
//
《条件搜索》
关闭导入发货窗口
// 关闭导入发货窗口
onCloseShip
()
{
handleShipClose
()
{
this
.
setData
({
this
.
setData
({
showShip
:
false
,
showShip
:
false
,
});
winactivityId
:
''
},
})
// 《条件搜索》搜索
async
onChangeSearch
()
{
const
{
activityId
,
title
}
=
this
.
props
.
selectedItem
;
let
{
prizeId
,
userId
,
startT
,
endT
,
pageNo
,
pageSize
,
shipStatus
,
prizeType
,
prizeDataType
}
=
this
.
data
;
let
timeStart
=
this
.
timeExchange
(
startT
);
let
timeEnd
=
this
.
timeExchange
(
endT
);
console
.
log
(
prizeId
,
userId
,
timeStart
,
timeEnd
,
pageNo
,
pageSize
,
shipStatus
,
prizeType
,
prizeDataType
);
if
(
prizeId
||
userId
||
(
timeStart
&&
timeEnd
)
||
shipStatus
===
0
||
shipStatus
||
prizeType
||
prizeDataType
)
{
let
rewardList
=
await
findWinnerInfoListBySearch
({
activityId
,
pageNo
,
pageSize
,
title
,
prizeId
,
userId
,
timeStart
,
timeEnd
,
shipStatus
,
prizeType
,
prizeDataType
});
if
(
rewardList
.
data
.
list
.
length
==
0
)
{
this
.
setData
({
list
:
[],
total
:
0
});
0
;
my
.
showToast
({
type
:
"fail"
,
content
:
"没有符合条件的订单!"
});
}
else
{
console
.
log
(
"rewardList=="
,
rewardList
);
this
.
setData
({
list
:
rewardList
.
data
.
list
,
total
:
rewardList
.
data
.
total
});
}
}
}
}
else
{
})
my
.
showToast
({
type
:
"fail"
,
content
:
"请填写至少一个筛选信息"
});
}
},
// 《条件搜索》按照时间搜索
onChangeTime
(
e
)
{
console
.
log
(
"时间搜索e"
,
e
);
const
[
startTime
,
endTime
]
=
e
.
detail
.
value
;
this
.
setData
({
startT
:
startTime
||
""
,
endT
:
endTime
||
""
,
timeRange
:
[
startTime
,
endTime
],
pageNo
:
PageInfo
.
PAGE_NO
,
pageSize
:
PageInfo
.
PAGE_SIZE
,
total
:
0
,
});
console
.
log
(
"this.data.timeRange=="
,
this
.
data
.
timeRange
,
this
.
data
.
startT
,
this
.
data
.
endT
);
},
// 《条件搜索》输入框查找信息
onInputChange
(
e
)
{
let
{
type
}
=
e
.
currentTarget
.
dataset
;
let
{
value
}
=
e
.
detail
;
this
.
setData
({
[
type
+
"Id"
]:
value
,
pageNo
:
PageInfo
.
PAGE_NO
,
pageSize
:
PageInfo
.
PAGE_SIZE
,
total
:
0
,
});
console
.
log
(
"this.data.prizeId==="
,
this
.
data
.
prizeId
,
"this.data.userId==="
,
this
.
data
.
userId
);
},
// 《条件搜索》发货状态筛选
onSelectShipStatus
(
e
)
{
console
.
log
(
'筛选发货状态e>>>'
,
e
);
this
.
setData
({
shipStatus
:
e
.
detail
.
value
,
pageNo
:
PageInfo
.
PAGE_NO
,
pageSize
:
PageInfo
.
PAGE_SIZE
,
total
:
0
,
});
},
// 《条件搜索》奖品类型筛选
onSelectPrizeType
(
e
)
{
let
{
type
}
=
e
.
target
.
dataset
;
console
.
log
(
'筛选奖品类型e>>>'
,
e
);
this
.
setData
({
[
type
]:
e
.
detail
.
value
,
pageNo
:
PageInfo
.
PAGE_NO
,
pageSize
:
PageInfo
.
PAGE_SIZE
,
total
:
0
,
});
console
.
log
(
"type"
,
this
.
data
[
type
]);
},
// 《条件搜索》更换页码时调用接口
onChangePageNo
(
e
)
{
this
.
setData
({
pageNo
:
e
.
detail
.
value
});
if
(
this
.
data
.
isSearch
)
{
this
.
onChangeSearch
();
}
else
{
this
.
loadWinnerList
();
}
}
},
});
client/components/dialog/rank-dialog/rank-dialog.json
View file @
85a127e5
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 {
...
@@ -27,3 +33,13 @@
...
@@ -27,3 +33,13 @@
.edit-content-buttonShip {
.edit-content-buttonShip {
margin-left: 5px
margin-left: 5px
}
}
.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>
<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"
}
}
}
}
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
(
number
!=
0
){
if
(
!
pattern
.
test
(
number
)
||
number
===
''
)
return
false
;
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
/** @format */
/** @format */
import
{
CODE_TYPES
,
EIGHT_HOURS
}
from
'./../constants'
import
{
CODE_TYPES
,
EIGHT_HOURS
,
PRIZE_TYPE
,
SHIP_STATUS
}
from
'./../constants'
import
{
services
,
paramsCheck
}
from
'../decorator'
import
{
services
,
paramsCheck
}
from
'../decorator'
import
{
resultsModel
}
from
'../sdk'
import
{
resultsModel
}
from
'../sdk'
import
{
formatTime
}
from
'../utils'
import
{
AwardsService
}
from
'../service'
import
{
AwardsService
}
from
'../service'
import
{
formatTime
}
from
'../utils/index'
import
*
as
xlsx
from
'node-xlsx'
import
*
as
xlsx
from
'node-xlsx'
//奖池类型
const
prizePoolType
=
{
'1'
:
'排行榜奖励'
,
'2'
:
'兑换奖品'
,
'3'
:
'大转盘奖品'
,
'4'
:
'其他奖励'
}
//发货状态
const
shipMsg
=
{
'1'
:
'未填地址'
,
'2'
:
'未发货'
,
'3'
:
'已发货'
}
const
prizeKind
=
{
'1'
:
'优惠券'
,
'2'
:
'权益'
,
'3'
:
'实物'
}
export
default
class
BaseController
{
export
default
class
BaseController
{
/**
/**
...
@@ -34,193 +15,132 @@ export default class BaseController {
...
@@ -34,193 +15,132 @@ export default class BaseController {
@
paramsCheck
([
'activityId'
])
@
paramsCheck
([
'activityId'
])
@
services
([
AwardsService
])
@
services
([
AwardsService
])
async
findWinnerInfoList
(
context
:
Context
,
{
session
},
[
awardsService
]:
[
AwardsService
])
{
async
findWinnerInfoList
(
context
:
Context
,
{
session
},
[
awardsService
]:
[
AwardsService
])
{
const
{
activityId
,
pageNo
=
1
,
pageSize
=
500
}
=
context
.
data
const
{
// 获取活动中奖列表
activityId
=
''
,
let
awardslist
=
await
awardsService
.
getAwardslistByActivityId
(
activityId
,
pageNo
,
pageSize
)
prizeId
=
null
,
userNick
=
''
,
console
.
log
(
`awardslist:
${
JSON
.
stringify
(
awardslist
)}
`
)
shipStatus
=
null
,
prizeType
=
null
,
prizeDataType
=
null
,
pageNo
=
1
,
pageSize
=
10
,
startTime
,
endTime
}
=
context
.
data
let
winnersObj
=
{}
// 获取活动中奖列表
awardslist
.
forEach
(
v
=>
{
let
awardList
=
await
awardsService
.
getAwardListByActivityId
({
if
(
!
winnersObj
[
v
.
rank
])
{
activityId
,
winnersObj
[
v
.
rank
]
=
[]
prizeId
,
}
userNick
,
winnersObj
[
v
.
rank
].
push
({
shipStatus
,
userNick
:
v
.
userNick
,
type
:
prizeType
,
id
:
v
.
openId
prizeDataType
,
})
pageNo
,
pageSize
,
startTime
,
endTime
})
})
console
.
log
(
`winnersObj:
${
JSON
.
stringify
(
winnersObj
)}
`
)
console
.
log
(
`awardList:
${
JSON
.
stringify
(
awardList
)}
`
)
return
resultsModel
.
success
(
awardList
)
let
results
=
[]
new
Map
(
Object
.
entries
(
winnersObj
)).
forEach
((
v
,
index
)
=>
{
results
.
push
({
rank
:
index
,
winnerDetailList
:
v
})
})
return
resultsModel
.
success
(
results
)
}
}
/**
//获取活动中奖名单 为导出做准备
* 导出活动中奖名单
*/
@
paramsCheck
([
'activityId'
,
'title'
])
@
paramsCheck
([
'activityId'
,
'title'
])
@
services
([
AwardsService
])
@
services
([
AwardsService
])
async
exportAwardsList
(
context
:
Context
,
{
session
},
[
awardsService
]:
[
AwardsService
])
{
async
getAwardsList
(
context
:
Context
,
{
session
},
[
awardsService
]:
[
AwardsService
])
{
const
{
cloud
}
=
context
const
{
activityId
,
title
}
=
context
.
data
// 获取活动中奖列表
let
pageNo
=
1
let
pageSize
=
500
let
awardslist
=
[]
// 自动分页
while
(
awardslist
.
length
>=
(
pageNo
-
1
)
*
500
)
{
let
nowPageNoList
=
await
awardsService
.
getAwardslistByActivityId
(
activityId
,
pageNo
,
pageSize
)
awardslist
=
[...
awardslist
,
...
nowPageNoList
]
pageNo
+=
1
}
console
.
log
(
`awardslist:
${
JSON
.
stringify
(
awardslist
)}
`
)
let
xlsxData
=
[[
'序列'
,
'名次'
,
'昵称'
,
'中奖名称'
]]
awardslist
.
forEach
((
v
,
index
,
arr
)
=>
{
xlsxData
.
push
([
index
+
1
,
v
.
rank
,
v
.
userNick
,
v
.
name
])
})
let
buffer
=
xlsx
.
build
([
{
name
:
title
+
new
Date
().
getTime
(),
data
:
xlsxData
}
])
console
.
log
(
`xlsxData:
${
JSON
.
stringify
(
xlsxData
)}
`
)
let
result
=
await
cloud
.
file
.
uploadFile
({
fileContent
:
buffer
,
fileName
:
title
+
new
Date
().
getTime
()
+
'.xlsx'
})
// result.url 需进行处理
if
(
result
.
url
)
{
result
.
url
=
result
.
url
.
replace
(
'http'
,
'https'
).
replace
(
'-internal'
,
''
)
}
return
resultsModel
.
success
(
result
)
}
@
services
([
AwardsService
])
async
exportAwardsInfoBySearch
(
context
:
Context
,
{
session
},
[
awardsService
]:
[
AwardsService
])
{
/******VV */
let
{
cloud
}
=
context
let
{
cloud
}
=
context
let
{
activityId
,
title
,
prizeId
,
userId
:
userNick
,
timeStart
,
timeEnd
,
shipStatus
,
prizeType
:
type
,
prizeDataType
}
=
context
.
data
let
{
if
(
!
activityId
)
{
return
resultsModel
.
error
(
CODE_TYPES
.
PARAMS_ERROR
,
`缺少activityId`
)
}
if
(
!
title
)
{
return
resultsModel
.
error
(
CODE_TYPES
.
PARAMS_ERROR
,
`缺少title`
)
}
console
.
log
(
'prizeId====='
,
prizeId
)
if
(
!
prizeId
&&
!
userNick
&&
!
timeStart
&&
!
timeEnd
&&
!
shipStatus
&&
!
prizeDataType
&&
!
type
)
{
return
resultsModel
.
error
(
CODE_TYPES
.
PARAMS_ERROR
,
`未填写筛选信息`
)
}
console
.
log
(
'activityId--1--'
,
activityId
,
activityId
,
'prizeId--1-'
,
title
,
prizeId
,
prizeId
,
'userNick--1-'
,
userNick
,
userNick
,
'timeStart--1-'
,
startTime
,
timeStart
,
endTime
,
'timeEnd--1-'
,
shipStatus
,
timeEnd
prizeType
,
)
prizeDataType
,
pageNo
,
pageSize
}
=
context
.
data
// 获取活动中奖列表
// 获取活动中奖列表
let
total
=
await
awardsService
.
getTotalObjectCount
(
let
awardList
=
await
awardsService
.
getAwardListByActivityId
({
activityId
,
activityId
,
title
,
prizeId
,
prizeId
,
userNick
,
userNick
,
timeStart
,
startTime
,
timeEnd
,
endTime
,
shipStatus
,
shipStatus
,
type
,
type
:
prizeType
,
prizeDataType
prizeDataType
,
)
let
awardslist
=
[]
//导出中奖名单的pagesize和pageNo
let
pageSize0
=
500
;
let
pageNo
=
1
;
let
totalPage
=
Math
.
ceil
(
total
/
pageSize0
);
let
result
=
[]
for
(
let
i
=
1
;
i
<=
totalPage
;
i
++
)
{
pageNo
=
i
result
.
push
(
awardsService
.
getUserPrizeByActivityId
(
activityId
,
pageNo
,
pageNo
,
pageSize0
,
pageSize
,
prizeId
,
isExport
:
true
userNick
,
})
timeStart
,
return
resultsModel
.
success
(
awardList
)
timeEnd
,
shipStatus
,
prizeDataType
))
}
const
res
=
await
Promise
.
all
(
result
);
for
(
let
i
=
1
;
i
<=
totalPage
;
i
++
)
{
awardslist
.
push
(
res
[
i
])
}
}
/**
// await Promise.all(result).then(res=>{
* 导出活动中奖名单
// for (let i = 1; i <= totalPage; i++) {
*/
// awardslist.push(res[i
])
@
paramsCheck
([
'title'
])
// }
@
services
([
AwardsService
])
// })
async
exportAwardsList
(
context
:
Context
,
{
session
},
[
awardsService
]:
[
AwardsService
])
{
let
{
cloud
}
=
context
cons
ole
.
log
(
`awardslist:》》》
${
JSON
.
stringify
(
awardslist
)}
《《《`
)
cons
t
{
list
=
[],
title
}
=
context
.
data
if
(
awardslist
.
length
>
0
)
{
console
.
log
(
list
,
'导出报表'
)
let
xlsxData
=
[
let
xlsxData
=
[
[
[
'序列'
,
'奖品编号'
,
'奖品编号'
,
'用户id'
,
'中奖时间'
,
'中奖时间'
,
'地址填写时间'
,
'地址填写时间'
,
'用户昵称'
,
'奖品种类'
,
'奖品类型'
,
'奖品类型'
,
'中奖名称'
,
'发奖来源'
,
'奖品名称'
,
'收货人'
,
'收货人'
,
'手机号'
,
'联系方式'
,
'省'
,
'收货地址'
,
'市'
,
'区'
,
'详细地址'
,
'发货状态'
,
'发货状态'
,
'物流公司'
,
'物流公司'
,
'物流单号'
'物流单号'
]
]
]
]
awardslist
.
forEach
((
v
,
index
,
arr
)
=>
{
list
.
forEach
((
v
,
index
,
arr
)
=>
{
let
prizeDataType
=
'/'
;
let
prizeType
=
'/'
;
let
shipTxt
=
'/'
;
if
(
v
)
{
if
(
v
.
prizeDataType
==
1
)
prizeDataType
=
'关卡获得'
if
(
v
.
prizeDataType
==
2
)
prizeDataType
=
'排行榜'
if
(
v
.
prizeDataType
==
3
)
prizeDataType
=
'分享获得'
if
(
v
.
type
==
PRIZE_TYPE
.
EQUITY
)
prizeType
=
'实物'
if
(
v
.
type
==
PRIZE_TYPE
.
CREDITS
)
prizeType
=
'积分'
if
(
v
.
type
==
PRIZE_TYPE
.
OBJECT
)
{
prizeType
=
'实物'
if
(
+
v
.
shipStatus
==
SHIP_STATUS
.
NO_ADDRESS
)
shipTxt
=
'未填写地址'
if
(
+
v
.
shipStatus
==
SHIP_STATUS
.
NO_SHIP
)
shipTxt
=
'未发货'
if
(
+
v
.
shipStatus
==
SHIP_STATUS
.
HAS_SHIP
)
shipTxt
=
'已发货'
}
if
(
v
.
type
==
PRIZE_TYPE
.
THANK
)
prizeType
=
'谢谢参与'
}
xlsxData
.
push
([
xlsxData
.
push
([
index
+
1
,
v
.
_id
,
v
.
_id
,
//中奖时间-填写地址时间
v
.
userNick
,
v
.
createTime
?
formatTime
(
new
Date
(
v
.
createTime
+
EIGHT_HOURS
))
:
''
,
v
.
createTime
?
formatTime
(
new
Date
(
v
.
createTime
+
EIGHT_HOURS
))
:
''
,
v
.
type
==
1
?
'/'
:
v
.
receiveTime
?
formatTime
(
new
Date
(
v
.
receiveTime
+
EIGHT_HOURS
))
:
'未填'
,
v
.
type
==
3
?
(
v
.
receiveTime
?
formatTime
(
new
Date
(
v
.
receiveTime
+
EIGHT_HOURS
))
:
'暂未填写'
)
:
'/'
,
v
.
userNick
||
'/'
,
prizeType
,
prizePoolType
[
v
.
prizeDataType
],
prizeDataType
,
prizeKind
[
v
.
type
],
v
.
type
==
2
?
`
${
v
.
credits
||
0
}
积分`
:
v
.
name
||
''
,
v
.
name
||
''
,
v
.
type
==
3
?
v
.
receiveName
||
''
:
'/'
,
v
.
type
==
1
?
'/'
:
v
.
receiveName
||
''
,
v
.
type
==
3
?
(
v
.
phone
?
v
.
phone
+
''
:
'暂未填写'
)
:
'/'
,
v
.
type
==
1
?
'/'
:
v
.
phone
||
'未填'
,
v
.
type
==
3
?
v
.
province
+
v
.
city
+
v
.
area
+
v
.
addressdetail
||
'暂未填写'
:
'/'
,
v
.
type
==
1
?
'/'
:
v
.
province
?
v
.
province
:
'未填'
,
shipTxt
,
v
.
type
==
1
?
'/'
:
v
.
city
?
v
.
city
:
'未填'
,
v
.
type
==
3
?
v
.
shipCompany
||
''
:
'/'
,
v
.
type
==
1
?
'/'
:
v
.
area
?
v
.
area
:
'未填'
,
v
.
type
==
3
?
(
v
.
shipNum
?
v
.
shipNum
+
''
:
''
)
:
'/'
v
.
type
==
1
?
'/'
:
v
.
addressDetail
?
v
.
addressDetail
:
'未填'
,
v
.
type
==
1
?
'/'
:
shipMsg
[
v
.
shipStatus
],
v
.
type
==
1
?
'/'
:
v
.
shipCompany
||
'/'
,
v
.
type
==
1
?
'/'
:
v
.
shipNum
||
'/'
])
])
})
})
let
buffer
=
xlsx
.
build
([
let
buffer
=
xlsx
.
build
([
...
@@ -229,7 +149,8 @@ export default class BaseController {
...
@@ -229,7 +149,8 @@ export default class BaseController {
data
:
xlsxData
data
:
xlsxData
}
}
])
])
try
{
console
.
log
(
`xlsxData:
${
JSON
.
stringify
(
xlsxData
)}
`
)
let
result
=
await
cloud
.
file
.
uploadFile
({
let
result
=
await
cloud
.
file
.
uploadFile
({
fileContent
:
buffer
,
fileContent
:
buffer
,
fileName
:
title
+
new
Date
().
getTime
()
+
'.xlsx'
fileName
:
title
+
new
Date
().
getTime
()
+
'.xlsx'
...
@@ -239,166 +160,49 @@ export default class BaseController {
...
@@ -239,166 +160,49 @@ export default class BaseController {
result
.
url
=
result
.
url
.
replace
(
'http'
,
'https'
).
replace
(
'-internal'
,
''
)
result
.
url
=
result
.
url
.
replace
(
'http'
,
'https'
).
replace
(
'-internal'
,
''
)
}
}
return
resultsModel
.
success
(
result
)
return
resultsModel
.
success
(
result
)
}
catch
(
e
)
{
console
.
log
(
'上传文件出错'
,
e
)
// 打印日志
return
resultsModel
.
error
(
CODE_TYPES
.
SYSTEM_ERROR
,
`上传文件错误`
)
}
}
else
{
return
resultsModel
.
success
(
false
)
}
}
//筛选中奖名单
@
services
([
AwardsService
])
async
findWinnerInfoListBySearch
(
context
:
Context
,
{
session
},
[
awardsService
]:
[
AwardsService
])
{
let
{
cloud
}
=
context
let
{
activityId
,
title
,
pageNo
,
pageSize
,
prizeId
,
userId
:
userNick
,
timeStart
,
timeEnd
,
shipStatus
,
prizeType
:
type
,
prizeDataType
}
=
context
.
data
console
.
log
(
'data>>>>>'
,
context
.
data
)
if
(
!
activityId
)
{
return
resultsModel
.
error
(
CODE_TYPES
.
PARAMS_ERROR
,
`缺少activityId`
)
}
if
(
!
title
)
{
return
resultsModel
.
error
(
CODE_TYPES
.
PARAMS_ERROR
,
`缺少title`
)
}
console
.
log
(
'prizeId====='
,
prizeId
)
if
(
!
prizeId
&&
!
userNick
&&
!
timeStart
&&
!
timeEnd
&&
!
shipStatus
&&
!
prizeDataType
&&
!
type
)
{
return
resultsModel
.
error
(
CODE_TYPES
.
PARAMS_ERROR
,
`未填写筛选信息`
)
}
console
.
log
(
'activityId----'
,
activityId
,
'prizeId---'
,
prizeId
,
'userNick---'
,
userNick
,
'timeStart---'
,
timeStart
,
'timeEnd---'
,
timeEnd
,
shipStatus
)
// 获取活动中奖列表
let
total
=
await
awardsService
.
getTotalObjectCount
(
activityId
,
prizeId
,
userNick
,
timeStart
,
timeEnd
,
shipStatus
,
type
,
prizeDataType
)
console
.
log
(
'totle========='
,
total
)
let
awardslist
=
[]
if
(
total
>
10
)
{
let
totalPage
=
Math
.
ceil
(
total
/
pageSize
)
let
awardMore
=
await
awardsService
.
getUserPrizeByActivityId
(
activityId
,
pageNo
,
pageSize
,
prizeId
,
userNick
,
timeStart
,
timeEnd
,
shipStatus
,
prizeDataType
)
// console.list()
awardslist
=
awardslist
.
concat
(
awardMore
)
}
else
{
awardslist
=
await
awardsService
.
getUserPrizeByActivityId
(
activityId
,
pageNo
,
pageSize
,
prizeId
,
userNick
,
timeStart
,
timeEnd
,
shipStatus
,
prizeDataType
)
console
.
log
(
'awardslist>>>>'
,
awardslist
)
}
console
.
log
(
`awardslist:》》》
${
JSON
.
stringify
(
awardslist
)}
《《《`
)
awardslist
.
map
(
item
=>
{
let
ad
=
item
.
province
+
item
.
city
+
item
.
area
+
item
.
addressDetail
,
type0
=
item
.
type
item
.
prizeId
=
item
.
_id
item
.
createTime
=
formatTime
(
new
Date
(
item
.
createTime
+
EIGHT_HOURS
))
||
''
item
.
receiveTime
=
item
.
receiveTime
?
formatTime
(
new
Date
(
item
.
receiveTime
+
EIGHT_HOURS
))
:
'未填'
item
.
prizeDataType
=
prizePoolType
[
item
.
prizeDataType
]
item
.
type
=
prizeKind
[
item
.
type
]
item
.
receiveName
=
type0
==
3
?
item
.
receiveName
||
'未填'
:
'/'
item
.
phone
=
type0
==
3
?
item
.
phone
||
'未填'
:
'/'
item
.
address
=
type0
==
3
?
(
item
.
province
?
ad
:
'未填'
)
:
'/'
item
.
shipStatus
=
type0
==
3
?
shipMsg
[
item
.
shipStatus
]
:
'/'
item
.
shipCompany
=
type0
==
3
?
item
.
shipCompany
||
'/'
:
'/'
item
.
shipNum
=
type0
==
3
?
item
.
shipNum
||
'/'
:
'/'
})
// console.log(`xlsxData: ${JSON.stringify(xlsxData)}`);
try
{
return
resultsModel
.
success
({
list
:
awardslist
,
total
})
}
catch
(
e
)
{
console
.
log
(
'上传文件出错'
,
e
)
// 打印日志
return
resultsModel
.
error
(
CODE_TYPES
.
SYSTEM_ERROR
,
`查看结果错误`
)
}
}
}
/*
/**
[{
* 导入发货
"data": [
*/
["序列", "中奖时间", "收获地址", "邮编"],
@
paramsCheck
([
'activityId'
,
'fileName'
])
["1","creatTime","XXX","XXX"]
],
"name": "测试活动LSS1594797305510"
}]
*/
//导入发货状态信息
@
services
([
AwardsService
])
@
services
([
AwardsService
])
async
downloadFile
(
context
:
Context
,
{
session
},
[
awardsService
]:
[
AwardsService
])
{
async
downloadFile
(
context
:
Context
,
{
session
},
[
awardsService
]:
[
AwardsService
])
{
const
cloud
=
context
.
cloud
const
{
cloud
}
=
context
//获取活动id
//获取活动id
const
{
activityId
,
fileName
}
=
context
.
data
const
{
activityId
,
fileName
}
=
context
.
data
console
.
log
(
'====--=-=-=-=-'
,
fileName
)
let
total
=
0
//-----------
let
result
;
let
fileId
=
fileName
let
result
,
total
=
0
try
{
try
{
result
=
await
cloud
.
file
.
downloadFile
({
fileId
})
result
=
await
cloud
.
file
.
downloadFile
({
fileId
:
fileName
})
}
catch
{
return
resultsModel
.
error
(
CODE_TYPES
.
SYSTEM_ERROR
,
'fileId错误'
)
}
const
sheets
=
xlsx
.
parse
(
result
)
const
sheets
=
xlsx
.
parse
(
result
)
console
.
log
(
sheets
,
'sheets-------'
)
//接口调用
//接口调用
let
{
data
}
=
sheets
[
0
]
let
{
data
}
=
sheets
[
0
]
if
(
data
[
1
].
length
==
3
)
{
console
.
log
(
JSON
.
stringify
(
data
),
'data----------'
)
if
(
!
data
[
1
]
||
data
[
1
].
length
!==
0
)
{
if
(
data
[
1
].
length
<=
3
)
{
for
(
let
i
=
1
;
i
<
data
.
length
;
i
++
)
{
for
(
let
i
=
1
;
i
<
data
.
length
;
i
++
)
{
//activityId, prizeId, shipCompany, shipNum,
let
prizeId
=
data
[
i
][
0
]
let
prizeId
=
data
[
i
][
0
]
let
shipCompany
=
data
[
i
][
1
]
let
shipCompany
=
data
[
i
][
1
]
let
shipNum
=
data
[
i
][
2
]
let
shipNum
=
data
[
i
][
2
]
// 此处需要判断用户是否填写了地址
let
result2
=
await
awardsService
.
setUserShipStatus
(
activityId
,
prizeId
,
shipCompany
,
shipNum
)
let
result2
=
await
awardsService
.
setUserShipStatus
(
activityId
,
prizeId
,
shipCompany
,
shipNum
)
total
+=
result2
total
+=
result2
console
.
log
(
'>>>'
)
}
}
console
.
log
(
total
,
data
,
'total,data'
)
return
resultsModel
.
success
({
total
,
data
})
return
resultsModel
.
success
({
total
,
data
})
}
else
{
}
else
{
console
.
log
(
data
[
1
].
length
,
'length'
)
return
resultsModel
.
error
(
CODE_TYPES
.
SYSTEM_ERROR
,
'导入文件格式错误'
)
return
resultsModel
.
error
(
CODE_TYPES
.
SYSTEM_ERROR
,
'导入文件格式错误'
)
}
}
}
catch
(
e
)
{
}
else
{
console
.
log
(
'e'
,
e
)
return
resultsModel
.
error
(
CODE_TYPES
.
SYSTEM_ERROR
,
'导入文件出现错误'
)
return
resultsModel
.
error
(
CODE_TYPES
.
SYSTEM_ERROR
,
'导入文件出现错误'
)
}
}
}
}
...
...
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
}
}
}
}
// 根据活动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