Commit 26cfb9a5 authored by 秦海涛's avatar 秦海涛

update

parent 8169f120
......@@ -6,5 +6,7 @@
onTap="setBalloonVisible"
class="tb-qa-tips" >
</view>
<text>{{tips}}</text>
<text>{{tips}}
<slot/>
</text>
</balloon>
......@@ -22,8 +22,13 @@
.choose-content-tab-baby{
border:1px solid #ccc;
position:relative;
margin:10px 10px 0 0;
margin:0 5px 10px 0;
}
.choose-content-tab-baby_nomargin {
margin-right: 0;
}
.choose-content-tab-baby:hover {
border:1px solid #3386F1;
}
......@@ -40,6 +45,7 @@
max-height:300px;
overflow:scroll;
flex-wrap:wrap;
/* justify-content: space-between; */
}
.choose-content-tab-baby-info{
......
......@@ -14,14 +14,14 @@
<view class="choose-content-tab-view">
<select onChange="changeStatus" value="{{searchInfo.approveStatus}}" showSearch>
<option value="onsale">出售中</option>
<!-- <option value="instock">仓库中</option> -->
<option value="instock">仓库中</option>
</select>
<text style="margin-left:20px;font-size:12px">标题关键字</text>
<input style="width:120px;margin:0 10px" value="{{searchInfo.title}}" onChange="changeSearchKeyWords" placeholder="标题关键字"/>
<button onTap="searchBabyList" size="medium" type="primary" size="small">搜索</button>
</view>
<view class="choose-content-tab-baby-wrap">
<view class="choose-content-tab-baby" onTap="changeCheckStatus" data-index={{index}} data-item="{{item}}" a:for-index="index" a:for-item="item" a:for="{{babyDialogInfo.list}}">
<view class="choose-content-tab-baby {{(index+1) % 4 === 0 ? 'choose-content-tab-baby_nomargin': ''}}" onTap="changeCheckStatus" data-index={{index}} data-item="{{item}}" a:for-index="index" a:for-item="item" a:for="{{babyDialogInfo.list}}">
<view class="choose-content-tab-image-wrap">
<image src="{{item.picUrl}}"></image>
</view>
......
......@@ -40,6 +40,7 @@ Component({
});
},
getBabyList(info, chooseId) {
console.log(info)
API.findItemListByStatus({
...info,
}).then((res) => {
......
......@@ -81,6 +81,7 @@ Component({
index: '',
record: {}
},
maxRankLimit: '', // 限制最高排名
type: 'probablity', // 奖品弹窗类型 probablity: 概率 rank: 排名
imageLimit: [ 200, 200 ],
activityOutId: "",
......@@ -231,7 +232,7 @@ Component({
const { height, width, type, path } = await getImageInfo({
src: res.apFilePaths[0],
});
const { imageLimit } = this.props;
const { imageLimit, maxRankLimit } = this.props;
let imgBool = ~path.indexOf(".png") || ~path.indexOf(".jpg");
if (height !== imageLimit[1] || width !== imageLimit[0] || !imgBool) {
......@@ -247,6 +248,7 @@ Component({
fileName: path.split("/").pop(),
});
this.setData({
prizeInitData: {
...this.data.prizeInitData,
......@@ -295,7 +297,7 @@ Component({
...rest
} = this.data.prizeInitData;
const { imageTips } = this.data;
const { type: dialogType } = this.props;
const { type: dialogType, maxRankLimit } = this.props;
let probablityRexp = /^\d+(\.\d{1,2})?$/;
if (!probablityRexp.test(probablity) || probablity > 100) {
......@@ -366,6 +368,14 @@ Component({
}
}
const rankArr = rank.split('-');
if(dialogType === 'rank' && maxRankLimit && rankArr[rankArr.length - 1] > maxRankLimit ) {
my.showToast({
type: "fail",
content: `最多配置前${maxRankLimit}名奖品`
});
return;
}
const { probablityTips, prizeNumberTips, creditsValueTips } = this.data;
const isImagePass = image && imageTips.status !== "error";
......
/* .winner-list-wrap {
padding: 20px 0 0 0;
} */
.db-table-header {
background:rgba(235,243,255,1);
display: flex;
height: 32px;
line-height: 32px;
text-align: center;
border: 1px solid #D7DBE0;
border-top: none;
}
.db-table-index {
width: 40%;
border-right: 1px solid #D7DBE0;
}
.db-table-content {
width: 60%;
}
.db-table-header:nth-of-type(1) {
border-top: 1px solid #D7DBE0;
}
.db-table-body_inner {
display: flex;
text-align: center;
height: 32px;
line-height: 32px;
border: 1px solid #D7DBE0;
border-top: none;
}
.winner-list-table {
margin-top: 24px;
max-height: 500px;
overflow: auto;
}
\ No newline at end of file
<dialog-wrap
title="中奖名单"
visible="{{visible}}"
onClose="closeDialog"
>
<view class="winner-list-wrap">
<text>「店铺漂流记」活动中奖名单</text>
<button size="small" class="edit" type="primary" text="true" onTap="exportWinnerList">导出中奖名单</button>
<view class="winner-list-table">
<view a:for="{{list}}">
<view class="db-table-header">
<view class="db-table-index">第{{item.rank}}名</view>
<view class="db-table-content">用户ID名称</view>
</view>
<view class="db-table-body">
<view a:for="{{item.winnerDetailList}}" a:for-item="subItem" a:for-index="subIndex" class="db-table-body_inner">
<view class="db-table-index">{{(+item.rank.split('-')[0]) + subIndex}}</view>
<view class="db-table-content">{{subItem.userNick}}</view>
</view>
</view>
</view>
</view>
</view>
</dialog-wrap>
\ No newline at end of file
import { uploadDataCreateFile } from '/api';
Component({
mixins: [],
data: {},
props: {
visible: false,
onClose: () => {},
list: [
{
rank: '1-3',
winnerDetailList: []
}
],
selectedItem: {}
},
didMount() {},
didUpdate() {},
didUnmount() {},
methods: {
closeDialog() {
this.props.onClose();
},
// 导出中奖名单
async exportWinnerList() {
const { activityId, title } = this.props.selectedItem;
my.showLoading({
content: '生成文件中...'
})
try {
const { success, data, message } = await uploadDataCreateFile({
activityId,
title
})
my.hideLoading();
if(success) {
my.setClipboard({
text: data.url.replace(/amp;/g, ''),
success(res) {
my.showToast({
type: 'success',
content: '下载链接复制成功,请在浏览器中打开下载'
})
}
});
} else {
my.showToast({
type: 'fail',
content: message
})
}
} catch (error) {
my.hideLoading();
console.log(error, 'exportList-error');
}
}
},
});
{
"component": true,
"usingComponents": {
"dialog-wrap": "../../basic/dialiog-wrap/dialiog-wrap"
}
}
\ No newline at end of file
......@@ -4,7 +4,7 @@
<view>图片</view>
<text>尺寸为{{imageLimit[0]}}px * {{imageLimit[1]}}px,格式为jpg/png</text>
<view></view>
<button onTap="uploadImage" type="primary">上传图片</button>
<button onTap="uploadImage" type="primary">{{url ? '更改': '上传'}}图片</button>
</view>
</view>
<view class="upload-image-error" a:if="{{isError}}">请上传尺寸为{{imageLimit[0]}}px * {{imageLimit[1]}}px的图片</view>
\ No newline at end of file
.tb-rule-title {
font-size: 12px;
color: #333;
margin-right: 10px;
}
.tb-rule-title_container {
display: flex;
align-items: center;
}
\ No newline at end of file
<view class="tb-rule-container">
<view class="tb-rule-title_container">
<view class="tb-rule-title">用于展示在活动页的规则说明</view>
<button type="primary" size="small" text onTap="handleTapGeneralRule">{{value ? '重新生成' : '生成规则'}}</button>
</view>
<textarea
style="width:400px;margin: 10px 0 0 0"
value="{{value}}"
......
import { generateRule } from '/api';
Component({
data: {},
props: {
onChange: () => {},
value: '',
generateRuleInfo: {}
},
didMount() {},
didUpdate() {},
......@@ -10,5 +13,17 @@ Component({
onChange(e) {
this.props.onChange && this.props.onChange(e.detail.value);
},
async handleTapGeneralRule() {
console.log(this.props.generateRuleInfo, 'this.props.generateRuleInfo')
const { data, success, message } = await generateRule(this.props.generateRuleInfo);
if(!success) {
my.showToast({
type: 'fail',
content: message
})
return;
}
this.props.onChange && this.props.onChange(data);
}
},
});
......@@ -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('export')}}" class="tb-list-edit" type="primary" text="true" data-x="{{x}}" disabled="{{!x.record.isEnd}}" data-type="object" onTap="exportWinnerList">查看中奖名单</button>
<button a:if="{{buttons.includes('export')}}" 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('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>
......@@ -38,5 +38,7 @@
onClose="onCloseConfirmDialog"
onConfirm="onConfirmDelete"
/>
<winner-list-dialog visible="{{winnerListDialogVisible}}" onClose="onCloseWinnerListDialog" list="{{winnerList}}" selectedItem="{{selectedItem}}"/>
<rank-dialog />
\ No newline at end of file
......@@ -27,7 +27,9 @@ Component({
total: 0
},
deleteId: "",
selectedItem: "",
winnerListDialogVisible: false,
winnerList: [],
selectedItem: {}
},
props: {
buttons: ['edit', 'export', 'delete', 'copyLink']
......@@ -87,6 +89,24 @@ Component({
});
}
},
// 获取中奖名单
async handleOpenWinnerList(evt) {
const { activityId } = evt.target.dataset.x.record;
const { data,success } = await findWinnerInfoList({ activityId});
if (success) {
this.setData({
winnerListDialogVisible: true,
winnerList: data,
selectedItem: evt.target.dataset.x.record
})
}
},
onCloseWinnerListDialog() {
this.setData({
winnerListDialogVisible: false
})
},
// 复制链接
async onCopyLink(evt) {
......
......@@ -3,6 +3,7 @@
"usingComponents": {
"copy-link-dialog": "/components/dialog/copy-link-dialog/copy-link-dialog",
"confirm-dialog": "/components/dialog/confirm-dialog/confirm-dialog",
"rank-dialog": "/components/dialog/rank-dialog/rank-dialog"
"rank-dialog": "/components/dialog/rank-dialog/rank-dialog",
"winner-list-dialog": "/components/dialog/winner-list-dialog/winner-list-dialog"
}
}
\ No newline at end of file
......@@ -41,5 +41,6 @@
imageLimit="{{imageLimit}}"
onClose="onCloseDialog"
type="rank"
maxRankLimit="{{maxRankLimit}}"
onUpdate="onPrizeUpdate"
onAdd="onPrizeAdd"/>
\ No newline at end of file
......@@ -9,6 +9,7 @@ Component({
limit: 20,
imageLimit: [ 200, 200],
fixedRank: [],
maxRankLimit: '',
list: [],
onChange: () => {}
},
......
......@@ -68,9 +68,10 @@
<rank-table
list="{{prizeInfoList}}"
onChange="onPrizeListChange"
limit="{{8}}"
limit="{{11}}"
maxRankLimit="{{100}}"
fixedRank="{{['1', '2', '3']}}"
imageLimit="{{[250, 250]}}"
imageLimit="{{[200, 200]}}"
/>
</form-item>
......@@ -153,7 +154,13 @@
class="edit-content-form-item"
label="logo图片"
asterisk="{{false}}">
<view style="display:flex;">
<tb-image-upload url="{{logoImg}}" dataName="logoImg" onSuccess="onChangeByDataName" imageLimit="{{[200, 90]}}"/>
<question-tips>
<image style="width:200px;height:400px;border:1px solid #ccc;margin-right:10px" src="//yun.duiba.com.cn/20200410/image2020-6-7_18-16-3.png"></image>
</question-tips>
</view>
</form-item>
......@@ -206,7 +213,7 @@
class="edit-content-form-item"
label="活动规则"
asterisk="{{false}}">
<tb-rule value="{{rule}}" onChange="onRuleChange"/>
<tb-rule value="{{rule}}" onChange="onRuleChange" generateRuleInfo="{{{title: subtitle, startTime, endTime, prizeInfoList}}}"/>
</form-item>
<view class="submit-btn">
......
......@@ -5,6 +5,7 @@
"tb-input": "/components/form/tb-input/tb-input",
"tb-config-input": "/components/form/tb-config-input/tb-config-input",
"tb-range-picker": "/components/form/tb-range-picker/tb-range-picker",
"question-tips": "/components/basic/question-tips/question-tips",
"tb-rule": "/components/form/tb-rule/tb-rule",
"probability-prize-table": "/components/prize/probability-prize-table/probability-prize-table",
"list-table": "/components/list/list-table/list-table",
......
......@@ -56,16 +56,26 @@ export const rankTableValidator = (rule, value, callback, source, options) => {
// 判断排名连续
let valid = true;
let validInfo = {
status: true,
message: '名次索引必须连续, 请检查'
};
rankArr.forEach((rank, i) => {
if(i === 0) return;
let lastRank = rankArr[i-1][rankArr[i-1].length - 1];
let curRank = rank[0];
if(curRank - lastRank !== 1) {
valid = false;
if(curRank - lastRank === 0) {
validInfo = {
status: false,
message: '请勿对重复的名次添加奖品'
}
}
if(validInfo.status && (curRank - lastRank !== 1)) {
validInfo.status = false;
}
})
if(!valid) return new Error('名次索引必须连续, 请检查');
if(!validInfo.status) return new Error(validInfo.message);
return callback()
}
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