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

update

parent 8169f120
...@@ -6,5 +6,7 @@ ...@@ -6,5 +6,7 @@
onTap="setBalloonVisible" onTap="setBalloonVisible"
class="tb-qa-tips" > class="tb-qa-tips" >
</view> </view>
<text>{{tips}}</text> <text>{{tips}}
<slot/>
</text>
</balloon> </balloon>
...@@ -22,8 +22,13 @@ ...@@ -22,8 +22,13 @@
.choose-content-tab-baby{ .choose-content-tab-baby{
border:1px solid #ccc; border:1px solid #ccc;
position:relative; 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 { .choose-content-tab-baby:hover {
border:1px solid #3386F1; border:1px solid #3386F1;
} }
...@@ -40,6 +45,7 @@ ...@@ -40,6 +45,7 @@
max-height:300px; max-height:300px;
overflow:scroll; overflow:scroll;
flex-wrap:wrap; flex-wrap:wrap;
/* justify-content: space-between; */
} }
.choose-content-tab-baby-info{ .choose-content-tab-baby-info{
......
...@@ -14,14 +14,14 @@ ...@@ -14,14 +14,14 @@
<view class="choose-content-tab-view"> <view class="choose-content-tab-view">
<select onChange="changeStatus" value="{{searchInfo.approveStatus}}" showSearch> <select onChange="changeStatus" value="{{searchInfo.approveStatus}}" showSearch>
<option value="onsale">出售中</option> <option value="onsale">出售中</option>
<!-- <option value="instock">仓库中</option> --> <option value="instock">仓库中</option>
</select> </select>
<text style="margin-left:20px;font-size:12px">标题关键字</text> <text style="margin-left:20px;font-size:12px">标题关键字</text>
<input style="width:120px;margin:0 10px" value="{{searchInfo.title}}" onChange="changeSearchKeyWords" placeholder="标题关键字"/> <input style="width:120px;margin:0 10px" value="{{searchInfo.title}}" onChange="changeSearchKeyWords" placeholder="标题关键字"/>
<button onTap="searchBabyList" size="medium" type="primary" size="small">搜索</button> <button onTap="searchBabyList" size="medium" type="primary" size="small">搜索</button>
</view> </view>
<view class="choose-content-tab-baby-wrap"> <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"> <view class="choose-content-tab-image-wrap">
<image src="{{item.picUrl}}"></image> <image src="{{item.picUrl}}"></image>
</view> </view>
......
...@@ -40,6 +40,7 @@ Component({ ...@@ -40,6 +40,7 @@ Component({
}); });
}, },
getBabyList(info, chooseId) { getBabyList(info, chooseId) {
console.log(info)
API.findItemListByStatus({ API.findItemListByStatus({
...info, ...info,
}).then((res) => { }).then((res) => {
......
...@@ -81,6 +81,7 @@ Component({ ...@@ -81,6 +81,7 @@ Component({
index: '', index: '',
record: {} record: {}
}, },
maxRankLimit: '', // 限制最高排名
type: 'probablity', // 奖品弹窗类型 probablity: 概率 rank: 排名 type: 'probablity', // 奖品弹窗类型 probablity: 概率 rank: 排名
imageLimit: [ 200, 200 ], imageLimit: [ 200, 200 ],
activityOutId: "", activityOutId: "",
...@@ -231,7 +232,7 @@ Component({ ...@@ -231,7 +232,7 @@ Component({
const { height, width, type, path } = await getImageInfo({ const { height, width, type, path } = await getImageInfo({
src: res.apFilePaths[0], src: res.apFilePaths[0],
}); });
const { imageLimit } = this.props; const { imageLimit, maxRankLimit } = this.props;
let imgBool = ~path.indexOf(".png") || ~path.indexOf(".jpg"); let imgBool = ~path.indexOf(".png") || ~path.indexOf(".jpg");
if (height !== imageLimit[1] || width !== imageLimit[0] || !imgBool) { if (height !== imageLimit[1] || width !== imageLimit[0] || !imgBool) {
...@@ -247,6 +248,7 @@ Component({ ...@@ -247,6 +248,7 @@ Component({
fileName: path.split("/").pop(), fileName: path.split("/").pop(),
}); });
this.setData({ this.setData({
prizeInitData: { prizeInitData: {
...this.data.prizeInitData, ...this.data.prizeInitData,
...@@ -295,7 +297,7 @@ Component({ ...@@ -295,7 +297,7 @@ Component({
...rest ...rest
} = this.data.prizeInitData; } = this.data.prizeInitData;
const { imageTips } = this.data; const { imageTips } = this.data;
const { type: dialogType } = this.props; const { type: dialogType, maxRankLimit } = this.props;
let probablityRexp = /^\d+(\.\d{1,2})?$/; let probablityRexp = /^\d+(\.\d{1,2})?$/;
if (!probablityRexp.test(probablity) || probablity > 100) { if (!probablityRexp.test(probablity) || probablity > 100) {
...@@ -366,6 +368,14 @@ Component({ ...@@ -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 { probablityTips, prizeNumberTips, creditsValueTips } = this.data;
const isImagePass = image && imageTips.status !== "error"; 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 @@ ...@@ -4,7 +4,7 @@
<view>图片</view> <view>图片</view>
<text>尺寸为{{imageLimit[0]}}px * {{imageLimit[1]}}px,格式为jpg/png</text> <text>尺寸为{{imageLimit[0]}}px * {{imageLimit[1]}}px,格式为jpg/png</text>
<view></view> <view></view>
<button onTap="uploadImage" type="primary">上传图片</button> <button onTap="uploadImage" type="primary">{{url ? '更改': '上传'}}图片</button>
</view> </view>
</view> </view>
<view class="upload-image-error" a:if="{{isError}}">请上传尺寸为{{imageLimit[0]}}px * {{imageLimit[1]}}px的图片</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 { .tb-rule-title {
font-size: 12px; font-size: 12px;
color: #333; 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-container">
<view class="tb-rule-title_container">
<view class="tb-rule-title">用于展示在活动页的规则说明</view> <view class="tb-rule-title">用于展示在活动页的规则说明</view>
<button type="primary" size="small" text onTap="handleTapGeneralRule">{{value ? '重新生成' : '生成规则'}}</button>
</view>
<textarea <textarea
style="width:400px;margin: 10px 0 0 0" style="width:400px;margin: 10px 0 0 0"
value="{{value}}" value="{{value}}"
......
import { generateRule } from '/api';
Component({ Component({
data: {}, data: {},
props: { props: {
onChange: () => {}, onChange: () => {},
value: '', value: '',
generateRuleInfo: {}
}, },
didMount() {}, didMount() {},
didUpdate() {}, didUpdate() {},
...@@ -10,5 +13,17 @@ Component({ ...@@ -10,5 +13,17 @@ Component({
onChange(e) { onChange(e) {
this.props.onChange && this.props.onChange(e.detail.value); 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 @@ ...@@ -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('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('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>
...@@ -38,5 +38,7 @@ ...@@ -38,5 +38,7 @@
onClose="onCloseConfirmDialog" onClose="onCloseConfirmDialog"
onConfirm="onConfirmDelete" onConfirm="onConfirmDelete"
/> />
<winner-list-dialog visible="{{winnerListDialogVisible}}" onClose="onCloseWinnerListDialog" list="{{winnerList}}" selectedItem="{{selectedItem}}"/>
<rank-dialog /> <rank-dialog />
\ No newline at end of file
...@@ -27,7 +27,9 @@ Component({ ...@@ -27,7 +27,9 @@ Component({
total: 0 total: 0
}, },
deleteId: "", deleteId: "",
selectedItem: "", winnerListDialogVisible: false,
winnerList: [],
selectedItem: {}
}, },
props: { props: {
buttons: ['edit', 'export', 'delete', 'copyLink'] buttons: ['edit', 'export', 'delete', 'copyLink']
...@@ -87,6 +89,24 @@ Component({ ...@@ -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) { async onCopyLink(evt) {
......
...@@ -3,6 +3,7 @@ ...@@ -3,6 +3,7 @@
"usingComponents": { "usingComponents": {
"copy-link-dialog": "/components/dialog/copy-link-dialog/copy-link-dialog", "copy-link-dialog": "/components/dialog/copy-link-dialog/copy-link-dialog",
"confirm-dialog": "/components/dialog/confirm-dialog/confirm-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 @@ ...@@ -41,5 +41,6 @@
imageLimit="{{imageLimit}}" imageLimit="{{imageLimit}}"
onClose="onCloseDialog" onClose="onCloseDialog"
type="rank" type="rank"
maxRankLimit="{{maxRankLimit}}"
onUpdate="onPrizeUpdate" onUpdate="onPrizeUpdate"
onAdd="onPrizeAdd"/> onAdd="onPrizeAdd"/>
\ No newline at end of file
...@@ -9,6 +9,7 @@ Component({ ...@@ -9,6 +9,7 @@ Component({
limit: 20, limit: 20,
imageLimit: [ 200, 200], imageLimit: [ 200, 200],
fixedRank: [], fixedRank: [],
maxRankLimit: '',
list: [], list: [],
onChange: () => {} onChange: () => {}
}, },
......
...@@ -68,9 +68,10 @@ ...@@ -68,9 +68,10 @@
<rank-table <rank-table
list="{{prizeInfoList}}" list="{{prizeInfoList}}"
onChange="onPrizeListChange" onChange="onPrizeListChange"
limit="{{8}}" limit="{{11}}"
maxRankLimit="{{100}}"
fixedRank="{{['1', '2', '3']}}" fixedRank="{{['1', '2', '3']}}"
imageLimit="{{[250, 250]}}" imageLimit="{{[200, 200]}}"
/> />
</form-item> </form-item>
...@@ -153,7 +154,13 @@ ...@@ -153,7 +154,13 @@
class="edit-content-form-item" class="edit-content-form-item"
label="logo图片" label="logo图片"
asterisk="{{false}}"> asterisk="{{false}}">
<view style="display:flex;">
<tb-image-upload url="{{logoImg}}" dataName="logoImg" onSuccess="onChangeByDataName" imageLimit="{{[200, 90]}}"/> <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> </form-item>
...@@ -206,7 +213,7 @@ ...@@ -206,7 +213,7 @@
class="edit-content-form-item" class="edit-content-form-item"
label="活动规则" label="活动规则"
asterisk="{{false}}"> asterisk="{{false}}">
<tb-rule value="{{rule}}" onChange="onRuleChange"/> <tb-rule value="{{rule}}" onChange="onRuleChange" generateRuleInfo="{{{title: subtitle, startTime, endTime, prizeInfoList}}}"/>
</form-item> </form-item>
<view class="submit-btn"> <view class="submit-btn">
......
...@@ -5,6 +5,7 @@ ...@@ -5,6 +5,7 @@
"tb-input": "/components/form/tb-input/tb-input", "tb-input": "/components/form/tb-input/tb-input",
"tb-config-input": "/components/form/tb-config-input/tb-config-input", "tb-config-input": "/components/form/tb-config-input/tb-config-input",
"tb-range-picker": "/components/form/tb-range-picker/tb-range-picker", "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", "tb-rule": "/components/form/tb-rule/tb-rule",
"probability-prize-table": "/components/prize/probability-prize-table/probability-prize-table", "probability-prize-table": "/components/prize/probability-prize-table/probability-prize-table",
"list-table": "/components/list/list-table/list-table", "list-table": "/components/list/list-table/list-table",
......
...@@ -56,16 +56,26 @@ export const rankTableValidator = (rule, value, callback, source, options) => { ...@@ -56,16 +56,26 @@ export const rankTableValidator = (rule, value, callback, source, options) => {
// 判断排名连续 // 判断排名连续
let valid = true; let validInfo = {
status: true,
message: '名次索引必须连续, 请检查'
};
rankArr.forEach((rank, i) => { rankArr.forEach((rank, i) => {
if(i === 0) return; if(i === 0) return;
let lastRank = rankArr[i-1][rankArr[i-1].length - 1]; let lastRank = rankArr[i-1][rankArr[i-1].length - 1];
let curRank = rank[0]; let curRank = rank[0];
if(curRank - lastRank !== 1) { if(curRank - lastRank === 0) {
valid = false; 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() 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