| | |
| | | ref="table" |
| | | class="prize-table" |
| | | > |
| | | <template slot-scope="{ row }" slot="prizeCoverUrl"> |
| | | <template slot-scope="{ row }" slot="prizeImgUrl"> |
| | | <img |
| | | :src="row.prizeCoverUrl" |
| | | :src="row.prizeImgUrl" |
| | | alt="奖品封面" |
| | | class="thumbnail" |
| | | @click="previewImage(row.prizeCoverUrl)" |
| | | @click="previewImage(row.prizeImgUrl)" |
| | | > |
| | | </template> |
| | | <!-- 操作按钮插槽 --> |
| | |
| | | style="width: 300px" type="textarea" :autosize="{minRows: 2,maxRows: 5}" placeholder="请输入"></Input> |
| | | </FormItem> |
| | | </Col> |
| | | <Col span="24"> |
| | | <FormItem label="奖品封面:" prop="prizeCover"> |
| | | <Upload |
| | | v-if="!coverTempUrl" |
| | | :before-upload="(file) => handleBeforeUpload(file, 'cover')" |
| | | :format="['jpg','jpeg','png','gif']" |
| | | :max-size="20480" |
| | | action="" |
| | | accept="image/*" |
| | | > |
| | | <Button icon="ios-cloud-upload-outline" >上传封面文件</Button> |
| | | </Upload> |
| | | <div v-else class="upload-file-info"> |
| | | <img :src="coverTempUrl" alt="奖品封面" class="preview-image-limit"> |
| | | <Button type="text" @click="handleRemove('cover')">删除</Button> |
| | | </div> |
| | | <!-- <Col span="24">--> |
| | | <!-- <FormItem label="奖品封面:" prop="prizeCover">--> |
| | | <!-- <Upload--> |
| | | <!-- v-if="!coverTempUrl"--> |
| | | <!-- :before-upload="(file) => handleBeforeUpload(file, 'cover')"--> |
| | | <!-- :format="['jpg','jpeg','png','gif']"--> |
| | | <!-- :max-size="20480"--> |
| | | <!-- action=""--> |
| | | <!-- accept="image/*"--> |
| | | <!-- >--> |
| | | <!-- <Button icon="ios-cloud-upload-outline" >上传封面文件</Button>--> |
| | | <!-- </Upload>--> |
| | | <!-- <div v-else class="upload-file-info">--> |
| | | <!-- <img :src="coverTempUrl" alt="奖品封面" class="preview-image-limit">--> |
| | | <!-- <Button type="text" @click="handleRemove('cover')">删除</Button>--> |
| | | <!-- </div>--> |
| | | |
| | | </FormItem> |
| | | </Col> |
| | | <!-- </FormItem>--> |
| | | <!-- </Col>--> |
| | | <Col span="24"> |
| | | <FormItem label="奖品图片:" prop="prizeImg"> |
| | | |
| | |
| | | { required: true, message: '请输入奖品描述', trigger: 'blur' }, |
| | | { max: 100, message: '长度不能超过100个字符', trigger: 'blur' } |
| | | ], |
| | | prizeCover: [ |
| | | {required: true, message: '请选择奖品封面', trigger: 'blur'} |
| | | ], |
| | | // prizeCover: [ |
| | | // {required: true, message: '请选择奖品封面', trigger: 'blur'} |
| | | // ], |
| | | prizeImg: [ |
| | | {required: true, message: '请选择奖品图片', trigger: 'blur'} |
| | | ], |
| | |
| | | |
| | | columns:[ |
| | | { |
| | | title: '奖品封面', |
| | | key: 'prizeCoverUrl', |
| | | slot:'prizeCoverUrl', |
| | | title: '奖品图片', |
| | | key: 'prizeImgUrl', |
| | | slot:'prizeImgUrl', |
| | | align: 'center', |
| | | minWidth: 100, |
| | | }, |
| | |
| | | handleRowClick(currentRow ,oldCurrentRow){ |
| | | this.prizeFrom.couponId = currentRow.id; |
| | | this.showCoupon = currentRow.couponName; |
| | | console.log(this.prizeFrom.couponId) |
| | | }, |
| | | getCouponDataList() { |
| | | // 获取数据 |
| | |
| | | getPlatformCouponList(this.couponSearchForm).then((res) => { |
| | | this.couponLoading = false; |
| | | if (res.success) { |
| | | console.log(res); |
| | | this.couponData = res.result.records; |
| | | this.couponTotal = res.result.total; |
| | | } |
| | |
| | | this.modelShow = false |
| | | this.submitLoading = false |
| | | this.showCoupon = ''; |
| | | this.$refs.form.resetFields() |
| | | |
| | | }, |
| | | getPage(){ |
| | | this.loading = true; |
| | |
| | | this.infoModalShow = false; |
| | | }, |
| | | openEdit(row){ |
| | | this.$refs.form.resetFields(); |
| | | //重置id |
| | | //需要判断是否可以编辑 |
| | | canUpDatePrizeDraw(row.id).then(res =>{ |
| | | if (res.code === 200){ |
| | | if (res.state){ |
| | | console.log(res.data) |
| | | this.modelShow = true; |
| | | this.modelTitle = "编辑奖品"; |
| | | this.prizeFrom ={ |
| | |
| | | this.coverTempUrl = row.prizeCoverUrl; |
| | | this.imgTempUrl = row.prizeImgUrl; |
| | | this.showCoupon = res.data.couponName; |
| | | |
| | | }else { |
| | | this.$Message.error("该奖品在抽奖活动中无法编辑!") |
| | | } |
| | |
| | | }, |
| | | openAdd(){ |
| | | this.$refs.form.resetFields() |
| | | //重置id |
| | | this.prizeFrom.id = null; |
| | | |
| | | this.modelShow = true; |
| | | this.modelTitle = "新增奖品"; |
| | | //清除表单状态. |
| | |
| | | this.imgTempUrl = null; |
| | | this.showCoupon = null; |
| | | }, |
| | | delById(row){ |
| | | del(row.id).then(res=>{ |
| | | if (res.code === 200){ |
| | | this.$Message.success(res.msg) |
| | | }else { |
| | | this.$Message.error(res.msg) |
| | | async delById(row){ |
| | | let status = false |
| | | await canUpDatePrizeDraw(row.id).then(res => { |
| | | |
| | | if (res.code === 200) { |
| | | status = res.state; |
| | | |
| | | } |
| | | this.getPage() |
| | | }) |
| | | }); |
| | | if (status){ |
| | | await del(row.id).then(res=>{ |
| | | if (res.code === 200){ |
| | | this.$Message.success(res.msg) |
| | | }else { |
| | | this.$Message.error(res.msg) |
| | | } |
| | | this.getPage() |
| | | }) |
| | | }else { |
| | | this.$Message.error("该奖品在抽奖活动中无法删除!") |
| | | } |
| | | |
| | | }, |
| | | // 获取富文本编辑器的内容 |
| | | // 初始化数据 |
| | | init() { |
| | | this.getPage() |
| | | }, |
| | | changePage(){ |
| | | this.searchForm.pageNumber = 1 |
| | | this.searchForm.pageSize = pageSize |
| | | changePage(v){ |
| | | this.searchForm.pageNumber = v; |
| | | this.getPage() |
| | | }, |
| | | changePageSize(){ |
| | | this.searchForm.pageNumber = page |
| | | changePageSize(v){ |
| | | this.searchForm.pageNumber = 1; |
| | | this.searchForm.pageSize = v; |
| | | this.getPage() |
| | | }, |
| | | couponChangePage(v) { |