Commit c4468795 authored by 王波's avatar 王波

Merge branch 'b-template-component' into feature/2021-05-31-benefitUpdate

parents cd38e06b bf7820dc
......@@ -8,40 +8,10 @@
<view class="rank-dialog-wrap">
<!-- 添加筛选条件导出中奖名单 start -->
<form class="edit-content-form" data-name="form" inline="true" labelTextAlign="right" size="large">
<form-item class="edit-content-formItem" label="奖品编号" labelTextAlign="right" asterisk="{{false}}">
<input value="{{searchInfo.prizeId}}" onChange="handleInputChange" data-name='prizeId' hasLimitHint="true" name="奖品编号" />
</form-item>
<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="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 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 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 long-item" label="发奖来源">
<select value="{{searchInfo.prizeDataType}}" onChange="handleInputChange" data-name='prizeDataType'>
<option value="">全部</option>
<% for(var i = 0; i < formatPrize.length; ++i) {%>
<%- `<option value="${formatPrize[i].prizeDataType}">${formatPrize[i].prizeSource}</option> `
%><% } %>
</select>
</form-item>
<% for(var i = 0; i < configWinnersFilter.length; ++i) {%>
<%-configWinnersFilter[i].template%>
<% } %>
<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>
......
......@@ -6,14 +6,10 @@ Component({
data: {
// 搜索条件
searchInfo: {
prizeId: null, // 奖品编号
userNick: null, // 用户id
timeRange: [], // 发奖时间
prizeType: null,
prizeDataType: null,
shipStatus: null,
pageNo: 1,
pageSize: 10
pageSize: 10,
<% for(var i = 0; i < winnersFilterData.length; ++i) {%>
<%-`${winnersFilterData[i]}: ${winnersFilterData[i] == 'timeRange' ? '[]' : null},`%><% }%>
},
list: [],
total: 0,
......@@ -41,8 +37,16 @@ Component({
// 搜索
async handleSearch() {
// 未选择任何条件搜索
const { prizeId, userNick, timeRange, prizeType, shipStatus, prizeDataType } = this.data.searchInfo;
if (!prizeId && !userNick && !timeRange.length && prizeType == null && shipStatus == null && prizeDataType == null) {
const {
<% for(var i = 0; i < winnersFilterData.length; ++i) {%>
<%- `${winnersFilterData[i]},`%><% } %>
} = this.data.searchInfo;
if (
<% for(var i = 0; i < winnersFilterData.length; ++i) {%>
<%- `${winnersFilterData[i] == 'timeRange' ? `!${winnersFilterData[i]}.length` : `!${winnersFilterData[i]}`} ${i === winnersFilterData.length - 1 ? '' : '&&'}` %>
<% } %>
) {
this.resetData();
my.showToast({
type: 'fail',
......@@ -59,14 +63,10 @@ Component({
resetData() {
this.setData({
searchInfo: {
prizeId: null, // 奖品编号
userNick: null, // 用户id
timeRange: [], // 发奖时间
prizeType: null,
prizeDataType: null,
shipStatus: null,
pageNo: 1,
pageSize: 10
pageSize: 10,
<% for(var i = 0; i < winnersFilterData.length; ++i) {%>
<%- `${winnersFilterData[i]}: ${winnersFilterData[i] == 'timeRange' ? '[]' : null},` %><% } %>
},
list: [],
total: 0,
......@@ -101,10 +101,11 @@ Component({
...this.data.searchInfo,
activityId: this.props.selectedItem.activityId
};
params.startTime = new Date(params.timeRange[0]).getTime();
<%- winnersFilterData.includes('timeRange') ?
`params.startTime = new Date(params.timeRange[0]).getTime();
params.endTime = new Date(params.timeRange[1]).getTime();
delete params.timeRange;` : ''%>
delete params.timeRange;
console.log('搜索参数', params);
try {
......@@ -138,8 +139,16 @@ Component({
async handleExport(evt) {
console.log(this.props);
// 未选择任何条件搜索
const { prizeId, userNick, timeRange, prizeType, shipStatus, prizeDataType } = this.data.searchInfo;
if (!prizeId && !userNick && !timeRange.length && prizeType == null && shipStatus == null && prizeDataType == null) {
const {
<% for(var i = 0; i < winnersFilterData.length; ++i) {%>
<%- `${winnersFilterData[i]},`%><% } %>
} = this.data.searchInfo;
if (
<% for(var i = 0; i < winnersFilterData.length; ++i) {%>
<%- `${winnersFilterData[i] == 'timeRange' ? `!${winnersFilterData[i]}.length` : `!${winnersFilterData[i]}`} ${i === winnersFilterData.length - 1 ? '' : '&&'}` %>
<% } %>
) {
this.resetData();
my.showToast({
type: 'fail',
......@@ -149,8 +158,10 @@ Component({
}
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();
<%- winnersFilterData.includes('timeRange') ?
`params.startTime = new Date(params.timeRange[0]).getTime();
params.endTime = new Date(params.timeRange[1]).getTime();` : '' %>
params.pageNo = 1;
params.pageSize = 500;
let res = [];
......
<view class="items-config">
<text style="font-size: 12px">{{itemIds ? `已选择${(itemIds + '').split(',').length}个商品` : ''}} </text>
<button type="primary" text size="small" onTap="onOpenDialog">{{itemIds ? '更换商品' : '选择商品'}}</button>
<text a:if="{{itemIds}}" style="font-size: 12px; margin-right: 10px">{{`已选择${(itemIds + '').split(',').length}个商品`}} </text>
<button type="primary" style="height:auto;" text size="small" onTap="onOpenDialog">{{itemIds ? '更换商品' : '选择商品'}}</button>
<items-dialog
onUpdateBabyChoose="onUpdateBabyChoose"
browseItemIds="{{itemIds + ''}}"
......
......@@ -21,11 +21,12 @@ var validator = new schema(descriptor)
const tasks = {
<% for(var i = 0; i < configList.length; ++i) {%>
<%- taskKeys.includes(configList[i].key) && configList[i].key !== 'label' ? `${configList[i].key}:{
value:"",
taskRateType:"",
times:"",
title:"",
link:""
value:${configList[i].value || '""'},
taskRateType: ${configList[i].taskRateType ? `TASK_RATE_TYPE["${configList[i].taskRateType}"]`: '""'},
times:${configList[i].times || '""'},
title:"${configList[i].taskConfigMode === 'fixed' ? configList[i].name : ''}",
link:"",
itemIds:""
},` : '' %><% } %>
}
......@@ -220,6 +221,18 @@ Component({
}
return prizeInfoListCopy
},
// 任务配置选择商品回调
onItemIdsChange(ids, dataName) {
this.setData({
tasks: {
...this.data.tasks,
[dataName]: {
...this.data.tasks[dataName],
itemIds: ids
}
},
});
},
backList() {
this.$page.$router.go(-1)
}
......
......@@ -28,7 +28,7 @@ export const isNumber = val => {
* @returns { boolean }
*/
export const validateRangeNumber = (number, [min, max] = [], fixed = 0) => {
let pattern = new RegExp(`^[0-9]+(\\.[0-9]{1,${fixed}})?$`);
let pattern = /`^[0-9]+(\\.[0-9]{1,${fixed}})?$`/;
// 判断空字符
if (typeof number === 'string' && !number.trim()) return false
......
/** @format */
import { CODE_TYPES, EIGHT_HOURS,PRIZE_TYPE,SHIP_STATUS } from './../constants'
import { services, paramsCheck } from '../decorator'
......@@ -107,20 +105,9 @@ export default class BaseController {
}
console.log(list, '导出报表')
let xlsxData = [
[
'奖品编号',
'用户id',
'中奖时间',
'地址填写时间',
'奖品类型',
'发奖来源',
'奖品名称',
'收货人',
'联系方式',
'收货地址',
'发货状态',
'物流公司',
'物流单号'
[<% for(var i = 0; i < winnersExportData.length; ++i) {%>
<%- `"${winnersExportData[i]}",`
%><% } %>
]
]
res.forEach((v, index, arr) => {
......@@ -146,19 +133,19 @@ export default class BaseController {
if (v.type == PRIZE_TYPE.THANK) prizeType = '谢谢参与'
}
xlsxData.push([
v._id,
v.userNick,
v.createTime ? formatTime(new Date(v.createTime + EIGHT_HOURS)) : '',
v.type == 3 ? (v.receiveTime ? formatTime(new Date(v.receiveTime + EIGHT_HOURS)) : '暂未填写') : '/',
prizeType,
prizeDataType,
v.type == 2 ? `${v.credits || 0}积分` : v.name || '',
v.type == 3 ? v.receiveName || '' : '/',
v.type == 3 ? (v.phone ? v.phone + '' : '暂未填写') : '/',
v.type == 3 ? v.province + v.city + v.area + v.streetName + v.addressDetail || '暂未填写' : '/',
shipTxt,
v.type == 3 ? v.shipCompany || '' : '/',
v.type == 3 ? (v.shipNum ? v.shipNum + '' : '') : '/'
<%- `${winnersExportData.includes('奖品编号') ? 'v._id,' : ''}`%>
<%- `${winnersExportData.includes('用户id') ? 'v.userNick,' : ''}`%>
<%- `${winnersExportData.includes('中奖时间') ? "v.createTime ? formatTime(new Date(v.createTime + EIGHT_HOURS)) : ''," : ""}`%>
<%- `${winnersExportData.includes('地址填写时间') ? "v.type == 3 ? (v.receiveTime ? formatTime(new Date(v.receiveTime + EIGHT_HOURS)) : '暂未填写') : '/'," : ""}`%>
<%- `${winnersExportData.includes('奖品类型') ? 'prizeType,' : ''}`%>
<%- `${winnersExportData.includes('发奖来源') ? 'prizeDataType,' : ''}`%>
<%- `${winnersExportData.includes('奖品名称') ? "v.type == 2 ? `${v.credits || 0}积分` : v.name || ''," : ""}`%>
<%- `${winnersExportData.includes('收货人') ? "v.type == 3 ? v.receiveName || '' : '/'," : ""}`%>
<%- `${winnersExportData.includes('联系方式') ? "v.type == 3 ? (v.phone ? v.phone + '' : '暂未填写') : '/'," : ""}`%>
<%- `${winnersExportData.includes('收货地址') ? "v.type == 3 ? v.province + v.city + v.area + v.streetName + v.addressDetail || '暂未填写' : '/'," : ""}`%>
<%- `${winnersExportData.includes('发货地址') ? 'shipTxt,' : ''}`%>
<%- `${winnersExportData.includes('物流公司') ? "v.type == 3 ? v.shipCompany || '' : '/'," : ""}`%>
<%- `${winnersExportData.includes('物流单号') ? "v.type == 3 ? (v.shipNum ? v.shipNum + '' : '') : '/'" : ""}`%>
])
})
let buffer = xlsx.build([
......
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