Commit 85a127e5 authored by zhaofei's avatar zhaofei

s

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