123
This commit is contained in:
Binary file not shown.
|
Before Width: | Height: | Size: 23 KiB After Width: | Height: | Size: 28 KiB |
@@ -26,7 +26,7 @@
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="礼物描述" align="center" prop="desc"/>
|
||||
<!-- <el-table-column label="排序" align="center" prop="sort"/>-->
|
||||
<el-table-column label="排序" align="center" prop="sort"/>
|
||||
<el-table-column label="状态" align="center" prop="status">
|
||||
<template v-slot="scope">
|
||||
<el-switch
|
||||
@@ -37,6 +37,16 @@
|
||||
></el-switch>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="操作" align="center" class-name="small-padding fixed-width" fixed="right" width="80">
|
||||
<template v-slot="scope">
|
||||
<el-button
|
||||
size="mini"
|
||||
type="text"
|
||||
icon="el-icon-edit"
|
||||
@click="handleUpdate(scope.row)"
|
||||
>修改</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
|
||||
<pagination
|
||||
@@ -46,16 +56,20 @@
|
||||
:limit.sync="queryParams.pageSize"
|
||||
@pagination="getList"
|
||||
/>
|
||||
<update-gift-dialog v-if="updateGiftDialogVisible" ref="updateGiftDialog" @refreshDataList="getList"/>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import {listGift, updateGift} from "@/api/cai/gift";
|
||||
import UpdateGiftDialog from "@/views/cai/gift/update-gift-dialog.vue";
|
||||
|
||||
export default {
|
||||
name: "Gift",
|
||||
components: { UpdateGiftDialog},
|
||||
data() {
|
||||
return {
|
||||
updateGiftDialogVisible: false,
|
||||
// 遮罩层
|
||||
loading: true,
|
||||
// 选中数组
|
||||
@@ -82,6 +96,12 @@ export default {
|
||||
this.getList();
|
||||
},
|
||||
methods: {
|
||||
handleUpdate(row){
|
||||
this.updateGiftDialogVisible = true
|
||||
this.$nextTick(() => {
|
||||
this.$refs.updateGiftDialog.init(row)
|
||||
})
|
||||
},
|
||||
/** 查询礼物列表 */
|
||||
getList() {
|
||||
this.loading = true;
|
||||
|
||||
98
src/views/cai/gift/update-gift-dialog.vue
Normal file
98
src/views/cai/gift/update-gift-dialog.vue
Normal file
@@ -0,0 +1,98 @@
|
||||
<template>
|
||||
<el-dialog :title="title" :close-on-click-modal="false" :visible.sync="open" width="700px" append-to-body>
|
||||
<el-form ref="form" :model="form" :rules="rules" label-width="120px">
|
||||
<el-form-item label="礼物图片" prop="img">
|
||||
<image-preview :src="form.img" :width="50" :height="50"/>
|
||||
</el-form-item>
|
||||
<el-form-item label="礼物名称" prop="name">
|
||||
<el-input v-model="form.name" />
|
||||
</el-form-item>
|
||||
<el-form-item label="礼物价格" prop="price">
|
||||
<el-input v-model="form.price" />
|
||||
</el-form-item>
|
||||
<el-form-item label="排序" prop="sort">
|
||||
<el-input v-model="form.sort" />
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<div slot="footer" class="dialog-footer">
|
||||
<el-button :loading="buttonLoading" type="primary" @click="submitForm">确 定</el-button>
|
||||
<el-button @click="open = false">取 消</el-button>
|
||||
</div>
|
||||
</el-dialog>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import ImageUpload from '@/components/ImageUpload/index'
|
||||
import {getAnchor, updateAnchor} from "@/api/cai/anchor";
|
||||
import {getGift, updateGift} from "@/api/cai/gift";
|
||||
|
||||
export default {
|
||||
components: {
|
||||
ImageUpload,
|
||||
},
|
||||
data () {
|
||||
return {
|
||||
systemName: process.env.VUE_APP_SYSTEM_HOME,
|
||||
open: false,
|
||||
title: '',
|
||||
form:{
|
||||
id: undefined,
|
||||
img: undefined,
|
||||
name: undefined,
|
||||
price: undefined,
|
||||
sort: undefined,
|
||||
},
|
||||
// 表单校验
|
||||
rules: {
|
||||
name: [
|
||||
{ required: true, message: "数据不能为空", trigger: "blur" }
|
||||
],
|
||||
price: [
|
||||
{ required: true, message: "数据不能为空", trigger: "blur" }
|
||||
],
|
||||
sort: [
|
||||
{ required: true, message: "数据不能为空", trigger: "blur" }
|
||||
],
|
||||
},
|
||||
buttonLoading: false,
|
||||
}
|
||||
},
|
||||
created() {
|
||||
},
|
||||
methods: {
|
||||
init (row) {
|
||||
let id = row.id
|
||||
this.form.id = id || undefined;
|
||||
this.title = "修改礼物信息";
|
||||
this.open = true;
|
||||
this.$nextTick(() => {
|
||||
this.$refs['form'].resetFields();
|
||||
getGift(id).then(response => {
|
||||
this.form = response.data;
|
||||
});
|
||||
})
|
||||
},
|
||||
// 表单提交
|
||||
submitForm () {
|
||||
this.$refs['form'].validate((valid) => {
|
||||
if (valid) {
|
||||
this.buttonLoading = true;
|
||||
updateGift({
|
||||
id: this.form.id,
|
||||
name: this.form.name,
|
||||
price: this.form.price,
|
||||
sort: this.form.sort,
|
||||
}).then(data => {
|
||||
this.$modal.msgSuccess("修改成功");
|
||||
this.buttonLoading = false;
|
||||
this.open = false
|
||||
this.$emit('refreshDataList')
|
||||
}).finally(() => {
|
||||
this.buttonLoading = false;
|
||||
});
|
||||
}
|
||||
})
|
||||
},
|
||||
}
|
||||
}
|
||||
</script>
|
||||
Reference in New Issue
Block a user