Authored by huangyi

修改api

@@ -25,7 +25,8 @@ @@ -25,7 +25,8 @@
25 <Input v-model="prize.total" placeholder="奖品总数"></Input> 25 <Input v-model="prize.total" placeholder="奖品总数"></Input>
26 </FormItem> 26 </FormItem>
27 <FormItem label="中奖概率" prop="chance"> 27 <FormItem label="中奖概率" prop="chance">
28 - <Input v-model="prize.chance" placeholder="中奖概率"></Input> 28 + <Col span="18">
  29 + <Input v-model="prize.chance" placeholder="中奖概率请输入小数或者整数"></Input></Col>%
29 </FormItem> 30 </FormItem>
30 <FormItem label="奖品图片" prop="prize_bg"> 31 <FormItem label="奖品图片" prop="prize_bg">
31 <img class="win-prize-bg" v-show="prize.img" :src="prize.img"> 32 <img class="win-prize-bg" v-show="prize.img" :src="prize.img">
@@ -57,7 +58,7 @@ @@ -57,7 +58,7 @@
57 58
58 export default { 59 export default {
59 name: 'AddPrize', 60 name: 'AddPrize',
60 - data() { 61 + data: function() {
61 return { 62 return {
62 actId: 0, 63 actId: 0,
63 split: 0.3, 64 split: 0.3,
@@ -87,7 +88,70 @@ @@ -87,7 +88,70 @@
87 }, 88 },
88 { 89 {
89 title: '中奖概率', 90 title: '中奖概率',
90 - key: 'chance' 91 + render: (h, {row}) => {
  92 + return h('span', {}, row.chance + '%');
  93 + }
  94 + },
  95 + {
  96 + title: '奖品图片',
  97 + key: 'img',
  98 + render: (h, {row}) => {
  99 + return h('img', {
  100 + attrs: {
  101 + src: row.img
  102 + },
  103 + style: {
  104 + width: '100%',
  105 + height: 'auto'
  106 + }
  107 + });
  108 + }
  109 + },
  110 + {
  111 + title: '奖品操作',
  112 + render: (h, {row}) => {
  113 + return h('Button', {
  114 + props: {
  115 + type: 'error',
  116 + size: 'small'
  117 + },
  118 + on: {
  119 + click: () => {
  120 + this.deletePrize(row.id, row._index);
  121 + }
  122 + }
  123 + }, '删除');
  124 + }
  125 + }
  126 + ],
  127 + prizeAddColumns: [
  128 + {
  129 + title: '位置序号',
  130 + key: 'prize_idx'
  131 + },
  132 + {
  133 + title: '奖品名称',
  134 + key: 'name'
  135 + },
  136 + {
  137 + title: '奖品类型',
  138 + render: (h, {row}) => {
  139 + return h('span', {}, pirzeType[row.type]);
  140 + }
  141 + },
  142 + {
  143 + title: '奖品值',
  144 + key: 'value'
  145 + },
  146 + {
  147 + title: '奖品总数',
  148 + key: 'total'
  149 + },
  150 + {
  151 + title: '中奖概率',
  152 + render: (h, {row}) => {
  153 + return h('span', {}, row.chance + '%');
  154 + }
91 }, 155 },
92 { 156 {
93 title: '奖品图片', 157 title: '奖品图片',
@@ -121,7 +185,6 @@ @@ -121,7 +185,6 @@
121 } 185 }
122 } 186 }
123 ], 187 ],
124 - prizeAddColumns: null,  
125 prize: { 188 prize: {
126 act_id: '', 189 act_id: '',
127 name: '', 190 name: '',
@@ -316,11 +379,6 @@ @@ -316,11 +379,6 @@
316 this.prize.act_id = this.actId; 379 this.prize.act_id = this.actId;
317 this.prizeList(); 380 this.prizeList();
318 this.bindUpload(); 381 this.bindUpload();
319 - },  
320 - created() {  
321 - let arr = this.prizeColumns;  
322 -  
323 - this.prizeAddColumns = arr.splice(arr.length - 1, 1);  
324 } 382 }
325 }; 383 };
326 </script> 384 </script>