Commit f339cbf1 authored by 王波's avatar 王波

1.增加奖品列表上移下移事件

parent f2afe434
......@@ -20,7 +20,7 @@
</view>
</table-column>
<table-column title="奖品数量(件)" dataIndex="stock">
<view slot-scope="x">{{x.value || '-'}}</view>
<view slot-scope="x">{{x.value || x.value === 0 ? x.value : '-'}}</view>
</table-column>
<table-column a:if="{{type==='probability'}}" title="中奖概率(%)" dataIndex="probability">
<view slot-scope="x">{{x.value}}</view>
......
......@@ -26,6 +26,25 @@ Component({
const { onChange, list, dataName } = this.props;
onChange && onChange(list.filter(((i, k) => k !== index)), dataName)
},
up(e) {
const index = e.target.dataset.idx;
const { onChange, list, dataName } = this.props;
const upPrize = JSON.parse(JSON.stringify(list[index-1]))
const nowPrize = JSON.parse(JSON.stringify(list[index]))
list[index-1] = nowPrize
list[index] = upPrize
onChange && onChange(list, dataName);
},
down(e) {
const index = e.target.dataset.idx;
const { onChange, list, dataName } = this.props;
const downPrize = JSON.parse(JSON.stringify(list[index+1]))
const nowPrize = JSON.parse(JSON.stringify(list[index]))
list[index+1] = nowPrize
list[index] = downPrize
onChange && onChange(list, dataName);
},
addPrize() {
const { limit, list } = this.props;
......
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