<!--产品--> <template> <div class="app-container" style="background-color: #fff"> <el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="118px" > <!-- <el-form-item label="vip类型" prop="vipType">--> <!-- <el-select v-model="form.vipType" placeholder="请选择vip类型">--> <!-- <el-option--> <!-- v-for="dict in dict.type.sys_user_vip"--> <!-- :key="dict.value"--> <!-- :label="dict.label"--> <!-- :value="dict.value"--> <!-- ></el-option>--> <!-- </el-select>--> <!-- </el-form-item>--> <el-form-item> <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery" >搜索</el-button > <el-button icon="el-icon-refresh" size="mini" @click="resetQuery" >重置</el-button > </el-form-item> </el-form> <el-row :gutter="10" class="mb8"> <el-col :span="1.5"> <el-button type="primary" plain icon="el-icon-plus" size="mini" @click="handleAdd" v-hasPermi="['ops:product:add']" >新增</el-button > </el-col> <right-toolbar :showSearch.sync="showSearch" @queryTable="getList" ></right-toolbar> </el-row> <el-table :data="productList" @selection-change="handleSelectionChange"> <!-- <el-table-column type="selection" width="55" align="center" />--> <el-table-column label="权益编码" align="center" prop="equityCode" /> <!-- <el-table-column label="权益排序" align="center" prop="equitySort" />--> <el-table-column prop="vipType" align="center" label="vip类型" width="100"> <template slot-scope="scope"> <DictTag :options="dict.type.sys_user_vip" :value="scope.row.vipType"></DictTag> </template> </el-table-column> <el-table-column label="权益名称" align="center" prop="entryName" /> <el-table-column label="资产类型" align="center" prop="propertyType" > <template slot-scope="scope"> <DictTag :options="dict.type.sys_wallet_type" :value="scope.row.propertyType"></DictTag> </template> </el-table-column> <el-table-column label="权益标签" align="center" prop="equityLabel" /> <el-table-column label="权益键值" align="center" prop="equityValue" /> <el-table-column label="关联表Id" align="center" prop="equityData" /> <el-table-column prop="status" label="状态" width="100"> <!-- 0正常1停用 --> <template slot-scope="scope"> {{ scope.row.status | switchStatus }} </template> </el-table-column> <!-- <el-table-column label="显示顺序" align="center" prop="orderNum" />--> <el-table-column label="操作" align="center" class-name="small-padding fixed-width" > <template slot-scope="scope"> <el-button size="mini" type="text" icon="el-icon-edit" @click="handleUpdate(scope.row)" v-hasPermi="['ops:product:edit']" >修改</el-button > <el-button size="mini" type="text" icon="el-icon-delete" @click="handleDelete(scope.row)" v-hasPermi="['ops:product:remove']" >删除</el-button > </template> </el-table-column> </el-table> <pagination v-show="total > 0" :total="total" :page.sync="queryParams.pageNum" :limit.sync="queryParams.pageSize" @pagination="getList" /> <!-- 添加或修改产品对话框 --> <el-dialog :title="title" :visible.sync="dialogFormVisible" width="600px"> <el-form ref="form" :model="form" :rules="rules" label-width="118px"> <div style="display: flex"> <el-form-item label="vip类型" prop="vipType"> <el-select v-model="form.vipType" placeholder="请选择vip类型"> <el-option v-for="dict in dict.type.sys_user_vip" :key="dict.value" :label="dict.label" :value="dict.value" ></el-option> </el-select> </el-form-item> <el-form-item label="权益名称" prop="entryName"> <el-input v-model="form.entryName" placeholder="请输入权益名称" /> </el-form-item> </div> <el-form-item label="权益键值" prop="equityValue"> <el-input v-model="form.equityValue" placeholder="请输入权益键值" /> </el-form-item> <el-form-item label="资产类型" prop="propertyType"> <el-select v-model="form.propertyType" placeholder="请选择资产类型"> <el-option v-for="dict in dict.type.sys_wallet_type" :key="dict.value" :label="dict.label" :value="dict.value" ></el-option> </el-select> </el-form-item> <el-form-item label="升级分数" prop="vipScore"> <el-input v-model="form.vipScore" placeholder="请输入升级分数" /> </el-form-item> <div style="display: flex"> <el-form-item label="权益标签" prop="equityLabel"> <el-input v-model="form.equityLabel" placeholder="请输入vip名称" /> </el-form-item> <div style="height: 35px; line-height: 35px; margin-left: 50px"> 状态 <el-radio v-model="form.status" label="0">正常</el-radio> <el-radio v-model="form.status" label="1">停用</el-radio> </div> </div> </el-form> <div slot="footer" class="dialog-footer"> <el-button @click="cancel">取 消</el-button> <el-button type="primary" @click="submitForm">确 定</el-button> </div> </el-dialog> </div> </template> <script> import { getData,getDataone,addData,delData,putData } from "@/api/ops/vip/vipdetail"; import { getToken } from "@/utils/auth"; export default { name: "Product", dicts: ['sys_normal_disable','sys_user_vip','sys_wallet_type'], data() { return { flag: false, headers: { Authorization: getToken(), }, dialogImageUrl: "", dialogVisible: false, // 状态 status: "", // 遮罩层 loading: true, // 选中数组 ids: [], // 非单个禁用 single: true, // 非多个禁用 multiple: true, // 显示搜索条件 showSearch: true, // 总条数 total: 0, // 产品表格数据 productList: [], // 弹出层标题 title: "", // 是否显示弹出层 dialogFormVisible: false, // 查询参数 queryParams: { pageNum: 1, pageSize: 10, vipName: null, vipType:'' }, // 表单参数 form: {}, // 表单校验 rules: { }, }; }, created() { this.queryParams.vipType =this.$route.query.vipType console.log( this.queryParams.vipType) this.getList(); }, filters: { switchStatus(val) { let res; if (val == 0) res = "正常"; if (val == 1) res = "停用"; return res; }, switchType(val) { let res; if (val == 0) res = "大众"; if (val == 1) res = "黄金"; if (val == 2) res = "铂金"; if (val == 3) res = "黑钻"; return res; }, switchpropertyType(val) { let res; if (val == 0) res = "静态钱包"; if (val == 1) res = "动态钱包"; if (val == 2) res = "债券"; if (val == 3) res = "星级分"; return res; }, switchdelFlag(val) { let res; if (val == 0) res = "关闭"; if (val == 1) res = "开启"; return res; }, }, methods: { handleAvatarSuccess(res, file) { this.flag = true; this.dialogImageUrl = URL.createObjectURL(file.raw); this.img = res.fileName; console.log(this.img); }, handleRemove(file, fileList) { console.log(file, fileList); }, handlePictureCardPreview(file) { console.log(this.dialogImageUrl, 1); this.dialogImageUrl = file.url; console.log(this.dialogImageUrl); this.dialogVisible = true; }, /** 查询产品列表 */ getList() { this.loading = true; getData(this.queryParams).then((res) => { this.productList = res.rows; console.log(this.productList); this.total = res.total; this.loading = false; }); }, // 取消按钮 cancel() { this.dialogFormVisible = false; this.reset(); if (this.img) { this.$refs.upload.clearFiles(); } }, // 表单重置 reset() { this.form = { pageNum: 1, pageSize: 10, vipName: null, vipType:this.queryParams.vipType }; this.showimg = ""; this.resetForm("form"); }, /** 搜索按钮操作 */ handleQuery() { //搜索 this.queryParams.pageNum = 1; this.getList(); }, /** 重置按钮操作 */ resetQuery() { console.log(210); this.resetForm("queryForm"); this.reset(); this.queryParams.status = null; this.queryParams.productType = null; this.handleQuery(); }, // 多选框选中数据 handleSelectionChange(selection) { console.log(216); // this.ids = selection.map(item => item.productId) // this.single = selection.length!==1 // this.multiple = !selection.length }, // 跳转下一级 next(row){ let data={ vipType:row.vipType } console.log(row) this.$router.push({ path:"/vipmanege/vipdetails", query:data}) }, /** 新增按钮操作 */ handleAdd() { this.reset(); this.dialogFormVisible = true; this.title = "添加产品"; }, /** 修改按钮操作 */ handleUpdate(row) { this.reset(); getDataone(row.equityCode).then((res) => { this.form = res.data; this.dialogFormVisible = true; this.title = "修改vip"; }); }, /** 提交按钮 */ submitForm() { this.$refs["form"].validate((valid) => { if (valid) { if (this.form.equityCode != null) { putData(this.form).then((response) => { this.$modal.msgSuccess("修改成功"); this.dialogFormVisible = false; this.getList() }); } else { addData(this.form).then((response) => { this.$modal.msgSuccess("新增成功"); this.dialogFormVisible = false; this.getList(); }); } } }); }, /** 删除按钮操作 */ handleDelete(row) { const Ids = row.equityCode; this.$modal .confirm('是否确认删除产品编号为"' + Ids + '"的数据项?') .then(function () { return delData(Ids); }) .then(() => { this.getList(); this.$modal.msgSuccess("删除成功"); }) .catch(() => {}); }, /** 导出按钮操作 */ handleExport() { console.log(422); exportProduct("传参").then((res) => { console.log(res); }); // this.download('ops/product/export', { // ...this.queryParams // }, `product_${new Date().getTime()}.xlsx`) }, }, }; </script>