|
@@ -1,168 +1,153 @@
|
|
<template>
|
|
<template>
|
|
- <div class="app-container calendar-list-container">
|
|
|
|
-
|
|
|
|
- <!-- 查询和其他操作 -->
|
|
|
|
- <div class="filter-container">
|
|
|
|
- <el-input clearable class="filter-item" style="width: 200px;" placeholder="请输入名称" v-model="listQuery.couponName"></el-input>
|
|
|
|
- <el-select v-model="listQuery.couponType" clearable placeholder="请选择类型" class="filter-item" style="width: 200px">
|
|
|
|
|
|
+ <div class="app-container calendar-list-container">
|
|
|
|
+
|
|
|
|
+ <!-- 查询和其他操作 -->
|
|
|
|
+ <div class="filter-container">
|
|
|
|
+ <el-input clearable class="filter-item" style="width: 200px;" placeholder="请输入名称"
|
|
|
|
+ v-model="listQuery.couponName"></el-input>
|
|
|
|
+ <el-select v-model="listQuery.couponType" clearable placeholder="请选择类型" class="filter-item" style="width: 200px">
|
|
|
|
+ <el-option :key="item.type" v-for="item in typeList" :label="item.name" :value="item.type">
|
|
|
|
+ </el-option>
|
|
|
|
+ </el-select>
|
|
|
|
+ <el-date-picker class="filter-item" value-format="yyyy-MM-dd" v-model="listQuery.enableEndTime" type="date"
|
|
|
|
+ placeholder="截止日期">
|
|
|
|
+ </el-date-picker>
|
|
|
|
+ <el-date-picker class="filter-item" value-format="yyyy-MM-dd" v-model="listQuery.createTime" type="date"
|
|
|
|
+ placeholder="创建日期">
|
|
|
|
+ </el-date-picker>
|
|
|
|
+ <el-button class="filter-item" type="primary" v-waves icon="el-icon-search" @click="handleFilter">查找</el-button>
|
|
|
|
+ <el-button class="filter-item" type="primary" @click="handleCreate" icon="el-icon-edit">添加</el-button>
|
|
|
|
+ <el-button class="filter-item" type="warning" icon="el-icon-delete" @click="delAll">批量删除</el-button>
|
|
|
|
+ </div>
|
|
|
|
+
|
|
|
|
+ <!-- 查询结果 -->
|
|
|
|
+ <el-table size="small" :data="list" @selection-change="handleSelectionChange" v-loading="listLoading"
|
|
|
|
+ element-loading-text="正在查询中。。。" border fit highlight-current-row>
|
|
|
|
+ <el-table-column type="selection" width="55px"> </el-table-column>
|
|
|
|
+ <el-table-column type="index" label="序号" header-align="center" align="center">
|
|
|
|
+ </el-table-column>
|
|
|
|
+
|
|
|
|
+ <el-table-column align="center" min-width="100px" label="名称" prop="couponName">
|
|
|
|
+ </el-table-column>
|
|
|
|
+ <el-table-column align="center" min-width="80px" label="类型" prop="couponTypeName">
|
|
|
|
+ </el-table-column>
|
|
|
|
+ <el-table-column align="center" min-width="80px" label="数量" prop="num">
|
|
|
|
+ </el-table-column>
|
|
|
|
+ <el-table-column align="center" min-width="150px" label="截止日期" prop="enableEndTime">
|
|
|
|
+ </el-table-column>
|
|
|
|
+ <el-table-column align="center" min-width="100px" label="状态" prop="statusName">
|
|
|
|
+ </el-table-column>
|
|
|
|
+ <el-table-column align="center" min-width="150px" label="创建时间" prop="createTime">
|
|
|
|
+ </el-table-column>
|
|
|
|
+ <el-table-column align="center" label="操作" width="240px" class-name="small-padding fixed-width">
|
|
|
|
+ <template slot-scope="scope">
|
|
|
|
+ <el-button type="primary" size="small" @click="handleUpdate(scope.row, false)">编辑</el-button>
|
|
|
|
+
|
|
|
|
+ <el-button type="danger" size="small" @click="handleDelete(scope.row)">删除</el-button>
|
|
|
|
+ </template>
|
|
|
|
+ </el-table-column>
|
|
|
|
+ </el-table>
|
|
|
|
+
|
|
|
|
+ <!-- 分页 -->
|
|
|
|
+ <div class="pagination-container">
|
|
|
|
+ <el-pagination background @size-change="handleSizeChange" @current-change="handleCurrentChange"
|
|
|
|
+ :current-page="listQuery.page" :page-sizes="[10, 20, 30, 50]" :page-size="listQuery.limit"
|
|
|
|
+ layout="total, sizes, prev, pager, next, jumper" :total="total">
|
|
|
|
+ </el-pagination>
|
|
|
|
+ </div>
|
|
|
|
+
|
|
|
|
+ <!-- 添加或修改对话框 -->
|
|
|
|
+ <el-dialog :close-on-click-modal="false" :title="textMap[dialogStatus]" :visible.sync="dialogFormVisible" width="40%">
|
|
|
|
+ <el-form :rules="rules" ref="dataForm" :model="dataForm" status-icon label-position="left" label-width="80px"
|
|
|
|
+ style='width: 700px; margin-left:50px;'>
|
|
|
|
+ <el-form-item label="名称" prop="couponName">
|
|
|
|
+ <el-input style="width: 300px" v-model="dataForm.couponName"></el-input>
|
|
|
|
+ </el-form-item>
|
|
|
|
+ <el-form-item label="类型" prop="couponType">
|
|
|
|
+ <el-select v-model="dataForm.couponType" clearable placeholder="请选择类型" class="filter-item" style="width: 300px">
|
|
<el-option :key="item.type" v-for="item in typeList" :label="item.name" :value="item.type">
|
|
<el-option :key="item.type" v-for="item in typeList" :label="item.name" :value="item.type">
|
|
</el-option>
|
|
</el-option>
|
|
- </el-select>
|
|
|
|
- <el-date-picker
|
|
|
|
- class="filter-item"
|
|
|
|
- value-format="yyyy-MM-dd"
|
|
|
|
- v-model="listQuery.enableEndTime"
|
|
|
|
- type="date"
|
|
|
|
- placeholder="截止日期">
|
|
|
|
- </el-date-picker>
|
|
|
|
- <el-date-picker
|
|
|
|
- class="filter-item"
|
|
|
|
- value-format="yyyy-MM-dd"
|
|
|
|
- v-model="listQuery.createTime"
|
|
|
|
- type="date"
|
|
|
|
- placeholder="创建日期">
|
|
|
|
- </el-date-picker>
|
|
|
|
- <el-button class="filter-item" type="primary" v-waves icon="el-icon-search" @click="handleFilter">查找</el-button>
|
|
|
|
- <el-button class="filter-item" type="primary" @click="handleCreate" icon="el-icon-edit">添加</el-button>
|
|
|
|
- <el-button class="filter-item" type="warning" icon="el-icon-delete" @click="delAll">批量删除</el-button>
|
|
|
|
- </div>
|
|
|
|
-
|
|
|
|
- <!-- 查询结果 -->
|
|
|
|
- <el-table
|
|
|
|
- size="small"
|
|
|
|
- :data="list"
|
|
|
|
- @selection-change="handleSelectionChange"
|
|
|
|
- v-loading="listLoading"
|
|
|
|
- element-loading-text="正在查询中。。。"
|
|
|
|
- border
|
|
|
|
- fit
|
|
|
|
- highlight-current-row
|
|
|
|
- >
|
|
|
|
- <el-table-column type="selection" width="55px"> </el-table-column>
|
|
|
|
- <el-table-column type="index" label="序号" header-align="center" align="center">
|
|
|
|
- </el-table-column>
|
|
|
|
-
|
|
|
|
- <el-table-column align="center" min-width="100px" label="名称" prop="couponName">
|
|
|
|
- </el-table-column>
|
|
|
|
- <el-table-column align="center" min-width="150px" label="类型" prop="couponType">
|
|
|
|
- </el-table-column>
|
|
|
|
- <el-table-column align="center" min-width="80px" label="数量" prop="num">
|
|
|
|
- </el-table-column>
|
|
|
|
- <el-table-column align="center" min-width="80px" label="截止日期" prop="enableEndTime">
|
|
|
|
- </el-table-column>
|
|
|
|
- <el-table-column align="center" min-width="100px" label="状态">
|
|
|
|
- <template slot-scope="scope">
|
|
|
|
- <el-tag v-if="scope.row.status === '1'">停用</el-tag>
|
|
|
|
- <el-tag v-else>正常</el-tag>
|
|
|
|
- </template>
|
|
|
|
-
|
|
|
|
- </el-table-column>
|
|
|
|
- <el-table-column align="center" min-width="150px" label="创建时间" prop="createTime">
|
|
|
|
- </el-table-column>
|
|
|
|
- <el-table-column align="center" label="操作" width="240px" class-name="small-padding fixed-width">
|
|
|
|
- <template slot-scope="scope">
|
|
|
|
- <el-button
|
|
|
|
- type="primary"
|
|
|
|
- size="small"
|
|
|
|
- @click="handleUpdate(scope.row, false)"
|
|
|
|
- >编辑</el-button
|
|
|
|
- >
|
|
|
|
-
|
|
|
|
- <el-button type="danger" size="small" @click="handleDelete(scope.row)">删除</el-button>
|
|
|
|
- </template>
|
|
|
|
- </el-table-column>
|
|
|
|
- </el-table>
|
|
|
|
-
|
|
|
|
- <!-- 分页 -->
|
|
|
|
- <div class="pagination-container">
|
|
|
|
- <el-pagination background @size-change="handleSizeChange" @current-change="handleCurrentChange" :current-page="listQuery.page"
|
|
|
|
- :page-sizes="[10,20,30,50]" :page-size="listQuery.limit" layout="total, sizes, prev, pager, next, jumper" :total="total">
|
|
|
|
- </el-pagination>
|
|
|
|
|
|
+ </el-select>
|
|
|
|
+ </el-form-item>
|
|
|
|
+ <el-form-item label="使用类型" prop="useType">
|
|
|
|
+ <el-select v-model="dataForm.useType" clearable placeholder="请选择类型" class="filter-item" style="width: 300px">
|
|
|
|
+ <el-option :key="item.dictValue" v-for="item in dataTypeList" :label="item.dictLabel" :value="item.dictValue">
|
|
|
|
+ </el-option>
|
|
|
|
+ </el-select>
|
|
|
|
+ </el-form-item>
|
|
|
|
+ <el-form-item v-if="dataForm.useType=='1'" label="商品" prop="skuId">
|
|
|
|
+ <el-select v-model="dataForm.skuId" clearable multiple collapse-tags placeholder="请选择商品" class="filter-item" style="width: 300px">
|
|
|
|
+ <el-option :key="item.skuId" v-for="item in goodsList" :label="item.name" :value="item.skuId">
|
|
|
|
+ </el-option>
|
|
|
|
+ </el-select>
|
|
|
|
+ </el-form-item>
|
|
|
|
+ <el-form-item v-else label="分类" prop="categorys">
|
|
|
|
+ <el-select v-model="dataForm.categorys" clearable multiple collapse-tags placeholder="请选择分类" class="filter-item" style="width: 300px">
|
|
|
|
+ <el-option :key="item.dictValue" v-for="item in categorysList" :label="item.dictLabel" :value="item.dictValue">
|
|
|
|
+ </el-option>
|
|
|
|
+ </el-select>
|
|
|
|
+ </el-form-item>
|
|
|
|
+ <el-form-item v-if="dataForm.couponType=='2'" label="截止日期" prop="enableEndTime">
|
|
|
|
+ <el-date-picker style="width: 300px" class="filter-item" value-format="yyyy-MM-dd"
|
|
|
|
+ v-model="dataForm.enableEndTime" type="date" placeholder="截止日期">
|
|
|
|
+ </el-date-picker>
|
|
|
|
+ </el-form-item>
|
|
|
|
+ <el-form-item label="数量" prop="num">
|
|
|
|
+ <el-input-number :precision="0" :step="1" v-model="dataForm.num"></el-input-number>
|
|
|
|
+ </el-form-item>
|
|
|
|
+ <el-form-item label="状态">
|
|
|
|
+ <el-radio-group v-model="dataForm.status">
|
|
|
|
+ <el-radio :label="'0'">正常</el-radio>
|
|
|
|
+ <el-radio :label="'1'">停用</el-radio>
|
|
|
|
+ </el-radio-group>
|
|
|
|
+ </el-form-item>
|
|
|
|
+ <!-- <el-form-item label="备注">
|
|
|
|
+ <el-input type="textarea" :rows="2" style="width: 300px" v-model="dataForm.remark"></el-input>
|
|
|
|
+ </el-form-item> -->
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ </el-form>
|
|
|
|
+ <div slot="footer" class="dialog-footer">
|
|
|
|
+ <el-button @click="dialogFormVisible = false">取消</el-button>
|
|
|
|
+ <el-button v-if="dialogStatus == 'create'" type="primary" @click="createData">确定</el-button>
|
|
|
|
+ <el-button v-else type="primary" @click="updateData">确定</el-button>
|
|
</div>
|
|
</div>
|
|
|
|
+ </el-dialog>
|
|
|
|
+
|
|
|
|
+ </div>
|
|
|
|
+</template>
|
|
|
|
|
|
- <!-- 添加或修改对话框 -->
|
|
|
|
- <el-dialog
|
|
|
|
- :close-on-click-modal="false"
|
|
|
|
- :title="textMap[dialogStatus]"
|
|
|
|
- :visible.sync="dialogFormVisible"
|
|
|
|
- width="40%"
|
|
|
|
- >
|
|
|
|
- <el-form :rules="rules" ref="dataForm" :model="dataForm" status-icon label-position="left" label-width="80px" style='width: 700px; margin-left:50px;'>
|
|
|
|
- <el-form-item label="名称" prop="couponName">
|
|
|
|
- <el-input style="width: 300px" v-model="dataForm.couponName"></el-input>
|
|
|
|
- </el-form-item>
|
|
|
|
- <el-form-item label="兑换方式" prop="couponType">
|
|
|
|
- <el-select v-model="dataForm.couponType" clearable placeholder="请选择类型" class="filter-item" style="width: 300px">
|
|
|
|
- <el-option :key="item.type" v-for="item in typeList" :label="item.name" :value="item.type">
|
|
|
|
- </el-option>
|
|
|
|
- </el-select>
|
|
|
|
- </el-form-item>
|
|
|
|
- <el-form-item label="关联商品" prop="skuId">
|
|
|
|
- <el-select v-model="dataForm.skuId" clearable placeholder="请选择商品" class="filter-item" style="width: 300px">
|
|
|
|
- <el-option :key="item.type" v-for="item in typeList" :label="item.name" :value="item.type">
|
|
|
|
- </el-option>
|
|
|
|
- </el-select>
|
|
|
|
- </el-form-item>
|
|
|
|
- <el-form-item label="截止日期" prop="enableEndTime">
|
|
|
|
- <el-date-picker
|
|
|
|
- style="width: 300px"
|
|
|
|
- class="filter-item"
|
|
|
|
- value-format="yyyy-MM-dd"
|
|
|
|
- v-model="dataForm.enableEndTime"
|
|
|
|
- type="date"
|
|
|
|
- placeholder="截止日期">
|
|
|
|
- </el-date-picker>
|
|
|
|
- </el-form-item>
|
|
|
|
- <el-form-item label="数量" prop="num">
|
|
|
|
- <el-input-number :precision="0" :step="1" v-model="dataForm.num"></el-input-number>
|
|
|
|
- </el-form-item>
|
|
|
|
- <el-form-item label="状态">
|
|
|
|
- <el-radio-group v-model="dataForm.status">
|
|
|
|
- <el-radio :label="'0'">正常</el-radio>
|
|
|
|
- <el-radio :label="'1'">停用</el-radio>
|
|
|
|
- </el-radio-group>
|
|
|
|
- </el-form-item>
|
|
|
|
- <el-form-item label="备注">
|
|
|
|
- <el-input type="textarea" :rows="2" style="width: 300px" v-model="dataForm.remark"></el-input>
|
|
|
|
- </el-form-item>
|
|
|
|
-
|
|
|
|
-
|
|
|
|
- </el-form>
|
|
|
|
- <div slot="footer" class="dialog-footer">
|
|
|
|
- <el-button @click="dialogFormVisible = false">取消</el-button>
|
|
|
|
- <el-button v-if="dialogStatus == 'create'" type="primary" @click="createData">确定</el-button>
|
|
|
|
- <el-button v-else type="primary" @click="updateData">确定</el-button>
|
|
|
|
- </div>
|
|
|
|
- </el-dialog>
|
|
|
|
-
|
|
|
|
- </div>
|
|
|
|
- </template>
|
|
|
|
-
|
|
|
|
- <style>
|
|
|
|
- .demo-table-expand {
|
|
|
|
- font-size: 0;
|
|
|
|
- }
|
|
|
|
- .demo-table-expand label {
|
|
|
|
- width: 200px;
|
|
|
|
- color: #99a9bf;
|
|
|
|
- }
|
|
|
|
- .demo-table-expand .el-form-item {
|
|
|
|
- margin-right: 0;
|
|
|
|
- margin-bottom: 0;
|
|
|
|
- }
|
|
|
|
- </style>
|
|
|
|
-
|
|
|
|
- <script>
|
|
|
|
- import { list, createItem, updateItem, deleteitem } from "@/api/dictManage";
|
|
|
|
- import waves from "@/directive/waves"; // 水波纹指令
|
|
|
|
- import Tinymce from '@/components/Tinymce'
|
|
|
|
|
|
+<style>
|
|
|
|
+.demo-table-expand {
|
|
|
|
+ font-size: 0;
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+.demo-table-expand label {
|
|
|
|
+ width: 200px;
|
|
|
|
+ color: #99a9bf;
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+.demo-table-expand .el-form-item {
|
|
|
|
+ margin-right: 0;
|
|
|
|
+ margin-bottom: 0;
|
|
|
|
+}
|
|
|
|
+</style>
|
|
|
|
|
|
- export default {
|
|
|
|
- components: { Tinymce },
|
|
|
|
- directives: { waves },
|
|
|
|
- data() {
|
|
|
|
- return {
|
|
|
|
- typeList: [
|
|
|
|
|
|
+<script>
|
|
|
|
+import { list, createItem, updateItem, deleteitem } from "@/api/couponsManage";
|
|
|
|
+import { goodsList,dataTypeList } from "@/api/public";
|
|
|
|
+import waves from "@/directive/waves"; // 水波纹指令
|
|
|
|
+import Tinymce from '@/components/Tinymce'
|
|
|
|
+
|
|
|
|
+export default {
|
|
|
|
+ components: { Tinymce },
|
|
|
|
+ directives: { waves },
|
|
|
|
+ data() {
|
|
|
|
+ return {
|
|
|
|
+ categorysList:[],
|
|
|
|
+ dataTypeList:[],
|
|
|
|
+ goodsList:[],
|
|
|
|
+ typeList: [
|
|
{
|
|
{
|
|
type: "1",
|
|
type: "1",
|
|
name: "永久",
|
|
name: "永久",
|
|
@@ -172,226 +157,254 @@
|
|
name: "有效",
|
|
name: "有效",
|
|
},
|
|
},
|
|
],
|
|
],
|
|
- list: [
|
|
|
|
-
|
|
|
|
- ],
|
|
|
|
- delarr: [],
|
|
|
|
- multipleSelection: [],
|
|
|
|
- total: 0,
|
|
|
|
- listLoading: false,
|
|
|
|
- listQuery: {
|
|
|
|
- page: 1,
|
|
|
|
- limit: 10,
|
|
|
|
- couponName: '',
|
|
|
|
- couponType: '',
|
|
|
|
- enableEndTime:'',
|
|
|
|
- createTime:'',
|
|
|
|
- },
|
|
|
|
- dataForm: {
|
|
|
|
- couponName: undefined,
|
|
|
|
- couponType: undefined,
|
|
|
|
- skuId:undefined,
|
|
|
|
- enableEndTime: undefined,
|
|
|
|
- num: undefined,
|
|
|
|
- status: '1',
|
|
|
|
- remark: undefined,
|
|
|
|
- },
|
|
|
|
- dialogFormVisible: false,
|
|
|
|
- dialogStatus: '',
|
|
|
|
- textMap: {
|
|
|
|
- update: "编辑",
|
|
|
|
- create: "创建",
|
|
|
|
- },
|
|
|
|
- imageUrl: undefined,
|
|
|
|
- rules: {
|
|
|
|
- couponName: [{ required: true, message: "名称不能为空", trigger: "blur" }],
|
|
|
|
- couponType: [{ required: true, message: "类型不能为空", trigger: "blur" }],
|
|
|
|
- skuId: [{ required: true, message: "请选择商品", trigger: "blur" }],
|
|
|
|
- enableEndTime: [{ required: true, message: "请选择截止日期", trigger: "blur" }],
|
|
|
|
- num: [{ required: true, message: "数量不能为空", trigger: "blur" }],
|
|
|
|
- },
|
|
|
|
- }
|
|
|
|
- },
|
|
|
|
- created() {
|
|
|
|
- this.getList();
|
|
|
|
- },
|
|
|
|
- methods: {
|
|
|
|
- resetForm() {
|
|
|
|
- this.dataForm = {
|
|
|
|
- couponName: undefined,
|
|
|
|
- couponType: undefined,
|
|
|
|
- skuId:undefined,
|
|
|
|
- enableEndTime: undefined,
|
|
|
|
- num: undefined,
|
|
|
|
- status: '1',
|
|
|
|
- remark: undefined,
|
|
|
|
- };
|
|
|
|
- },
|
|
|
|
- handleCreate() {
|
|
|
|
- this.resetForm();
|
|
|
|
- this.dialogFormVisible = true;
|
|
|
|
- this.dialogStatus = "create";
|
|
|
|
- this.$nextTick(() => {
|
|
|
|
- this.$refs["dataForm"].clearValidate();
|
|
|
|
- });
|
|
|
|
- },
|
|
|
|
- createData() {
|
|
|
|
- this.$refs["dataForm"].validate((valid) => {
|
|
|
|
- if (valid) {
|
|
|
|
- createItem(this.dataForm)
|
|
|
|
- .then(() => {
|
|
|
|
- this.getList();
|
|
|
|
- this.dialogFormVisible = false;
|
|
|
|
-
|
|
|
|
- this.$notify({
|
|
|
|
- title: "成功",
|
|
|
|
- message: "创建成功",
|
|
|
|
- type: "success",
|
|
|
|
- duration: 2000,
|
|
|
|
- });
|
|
|
|
- this.getList()
|
|
|
|
- })
|
|
|
|
- }
|
|
|
|
- });
|
|
|
|
- },
|
|
|
|
- getList() {
|
|
|
|
- this.listLoading = true
|
|
|
|
- list(this.listQuery).then(response => {
|
|
|
|
- this.list = response.data.data.items
|
|
|
|
- this.total = response.data.data.total
|
|
|
|
- this.listLoading = false
|
|
|
|
- }).catch(() => {
|
|
|
|
- this.list = []
|
|
|
|
- this.total = 0
|
|
|
|
- this.listLoading = false
|
|
|
|
- })
|
|
|
|
- },
|
|
|
|
-
|
|
|
|
- handleFilter() {
|
|
|
|
- this.listQuery.page = 1
|
|
|
|
- this.getList()
|
|
|
|
|
|
+ list: [
|
|
|
|
+
|
|
|
|
+ ],
|
|
|
|
+ delarr: [],
|
|
|
|
+ multipleSelection: [],
|
|
|
|
+ total: 0,
|
|
|
|
+ listLoading: false,
|
|
|
|
+ listQuery: {
|
|
|
|
+ page: 1,
|
|
|
|
+ limit: 10,
|
|
|
|
+ couponName: '',
|
|
|
|
+ couponType: '',
|
|
|
|
+ enableEndTime: '',
|
|
|
|
+ createTime: '',
|
|
},
|
|
},
|
|
-
|
|
|
|
- handleSizeChange(val) {
|
|
|
|
- this.listQuery.limit = val
|
|
|
|
- this.getList()
|
|
|
|
|
|
+ dataForm: {
|
|
|
|
+ couponName: undefined,
|
|
|
|
+ couponType: undefined,
|
|
|
|
+ useType:undefined,
|
|
|
|
+ categorys:[],
|
|
|
|
+ skuId: [],
|
|
|
|
+ enableEndTime: undefined,
|
|
|
|
+ num: undefined,
|
|
|
|
+ status: '1',
|
|
|
|
+ remark: undefined,
|
|
},
|
|
},
|
|
-
|
|
|
|
- handleCurrentChange(val) {
|
|
|
|
- this.listQuery.page = val
|
|
|
|
- this.getList()
|
|
|
|
|
|
+ dialogFormVisible: false,
|
|
|
|
+ dialogStatus: '',
|
|
|
|
+ textMap: {
|
|
|
|
+ update: "编辑",
|
|
|
|
+ create: "创建",
|
|
},
|
|
},
|
|
-
|
|
|
|
- handleUpdate(row) {
|
|
|
|
- this.dataForm = Object.assign({}, row);
|
|
|
|
- this.dialogStatus = 'update'
|
|
|
|
- this.dialogFormVisible = true
|
|
|
|
- this.$nextTick(() => {
|
|
|
|
- this.$refs['dataForm'].clearValidate()
|
|
|
|
- })
|
|
|
|
- },
|
|
|
|
-
|
|
|
|
- updateData() {
|
|
|
|
- this.$refs['dataForm'].validate((valid) => {
|
|
|
|
- if (valid) {
|
|
|
|
- updateItem(this.dataForm).then(() => {
|
|
|
|
- this.dialogFormVisible = false
|
|
|
|
- this.$notify({
|
|
|
|
- title: '成功',
|
|
|
|
- message: '更新成功',
|
|
|
|
- type: 'success',
|
|
|
|
- duration: 2000
|
|
|
|
- })
|
|
|
|
- this.getList()
|
|
|
|
- })
|
|
|
|
-
|
|
|
|
- }
|
|
|
|
- })
|
|
|
|
|
|
+ imageUrl: undefined,
|
|
|
|
+ rules: {
|
|
|
|
+
|
|
|
|
+ couponName: [{ required: true, message: "名称不能为空", trigger: "blur" }],
|
|
|
|
+ couponType: [{ required: true, message: "请选择类型", trigger: "blur" }],
|
|
|
|
+ useType: [{ required: true, message: "请选择使用类型", trigger: "blur" }],
|
|
|
|
+ categorys: [{ required: true, message: "请选择分类", trigger: "blur" }],
|
|
|
|
+ skuId: [{ required: true, message: "请选择商品", trigger: "blur" }],
|
|
|
|
+ enableEndTime: [{ required: true, message: "请选择截止日期", trigger: "blur" }],
|
|
|
|
+ num: [{ required: true, message: "数量不能为空", trigger: "blur" }],
|
|
},
|
|
},
|
|
-
|
|
|
|
- handleDelete(row) {
|
|
|
|
-
|
|
|
|
- this.$confirm('确认删除吗?', '提示', {
|
|
|
|
- confirmButtonText: '确定',
|
|
|
|
- cancelButtonText: '取消',
|
|
|
|
- type: 'warning'
|
|
|
|
- }).then(() => {
|
|
|
|
- deleteitem({dictIds:row.dictId}).then(response => {
|
|
|
|
|
|
+ }
|
|
|
|
+ },
|
|
|
|
+ created() {
|
|
|
|
+ this.getList();
|
|
|
|
+ this.getGoodsList();
|
|
|
|
+ this.getDataTypeList();
|
|
|
|
+ this.getCategorysList();
|
|
|
|
+ },
|
|
|
|
+ methods: {
|
|
|
|
+ getCategorysList() {
|
|
|
|
+ dataTypeList({dictType:'mall_sku_attribute'}).then(response => {
|
|
|
|
+ this.categorysList = response.data.data;
|
|
|
|
+ }).catch(() => {});
|
|
|
|
+ },
|
|
|
|
+ getDataTypeList() {
|
|
|
|
+ dataTypeList({dictType:'coupon_use_type'}).then(response => {
|
|
|
|
+ this.dataTypeList = response.data.data;
|
|
|
|
+ }).catch(() => {});
|
|
|
|
+ },
|
|
|
|
+ getGoodsList() {
|
|
|
|
+ goodsList({}).then(response => {
|
|
|
|
+ this.goodsList = response.data.data;
|
|
|
|
+ }).catch(() => { });
|
|
|
|
+ },
|
|
|
|
+ resetForm() {
|
|
|
|
+ this.dataForm = {
|
|
|
|
+ couponName: undefined,
|
|
|
|
+ couponType: undefined,
|
|
|
|
+ useType:undefined,
|
|
|
|
+ categorys:[],
|
|
|
|
+ skuId: [],
|
|
|
|
+ enableEndTime: undefined,
|
|
|
|
+ num: undefined,
|
|
|
|
+ status: '1',
|
|
|
|
+ remark: undefined,
|
|
|
|
+ };
|
|
|
|
+ },
|
|
|
|
+ handleCreate() {
|
|
|
|
+ this.resetForm();
|
|
|
|
+ this.dialogFormVisible = true;
|
|
|
|
+ this.dialogStatus = "create";
|
|
|
|
+ this.$nextTick(() => {
|
|
|
|
+ this.$refs["dataForm"].clearValidate();
|
|
|
|
+ });
|
|
|
|
+ },
|
|
|
|
+ createData() {
|
|
|
|
+ this.$refs["dataForm"].validate((valid) => {
|
|
|
|
+ if (valid) {
|
|
|
|
+ createItem(this.dataForm)
|
|
|
|
+ .then(() => {
|
|
|
|
+ this.getList();
|
|
|
|
+ this.dialogFormVisible = false;
|
|
|
|
+
|
|
|
|
+ this.$notify({
|
|
|
|
+ title: "成功",
|
|
|
|
+ message: "创建成功",
|
|
|
|
+ type: "success",
|
|
|
|
+ duration: 2000,
|
|
|
|
+ });
|
|
|
|
+ this.getList()
|
|
|
|
+ })
|
|
|
|
+ }
|
|
|
|
+ });
|
|
|
|
+ },
|
|
|
|
+ getList() {
|
|
|
|
+ this.listLoading = true
|
|
|
|
+ list(this.listQuery).then(response => {
|
|
|
|
+ this.list = response.data.data.items
|
|
|
|
+ this.total = response.data.data.total
|
|
|
|
+ this.listLoading = false
|
|
|
|
+ }).catch(() => {
|
|
|
|
+ this.list = []
|
|
|
|
+ this.total = 0
|
|
|
|
+ this.listLoading = false
|
|
|
|
+ })
|
|
|
|
+ },
|
|
|
|
+
|
|
|
|
+ handleFilter() {
|
|
|
|
+ this.listQuery.page = 1
|
|
|
|
+ this.getList()
|
|
|
|
+ },
|
|
|
|
+
|
|
|
|
+ handleSizeChange(val) {
|
|
|
|
+ this.listQuery.limit = val
|
|
|
|
+ this.getList()
|
|
|
|
+ },
|
|
|
|
+
|
|
|
|
+ handleCurrentChange(val) {
|
|
|
|
+ this.listQuery.page = val
|
|
|
|
+ this.getList()
|
|
|
|
+ },
|
|
|
|
+
|
|
|
|
+ handleUpdate(row) {
|
|
|
|
+ this.dataForm = Object.assign({}, row);
|
|
|
|
+ this.dialogStatus = 'update'
|
|
|
|
+ this.dialogFormVisible = true
|
|
|
|
+ this.$nextTick(() => {
|
|
|
|
+ this.$refs['dataForm'].clearValidate()
|
|
|
|
+ })
|
|
|
|
+ },
|
|
|
|
+
|
|
|
|
+ updateData() {
|
|
|
|
+ this.$refs['dataForm'].validate((valid) => {
|
|
|
|
+ if (valid) {
|
|
|
|
+ updateItem(this.dataForm).then(() => {
|
|
|
|
+ this.dialogFormVisible = false
|
|
this.$notify({
|
|
this.$notify({
|
|
title: '成功',
|
|
title: '成功',
|
|
- message: '删除成功',
|
|
|
|
|
|
+ message: '更新成功',
|
|
type: 'success',
|
|
type: 'success',
|
|
duration: 2000
|
|
duration: 2000
|
|
})
|
|
})
|
|
this.getList()
|
|
this.getList()
|
|
})
|
|
})
|
|
- }).catch(() => {
|
|
|
|
-
|
|
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+ })
|
|
|
|
+ },
|
|
|
|
+
|
|
|
|
+ handleDelete(row) {
|
|
|
|
+
|
|
|
|
+ this.$confirm('确认删除吗?', '提示', {
|
|
|
|
+ confirmButtonText: '确定',
|
|
|
|
+ cancelButtonText: '取消',
|
|
|
|
+ type: 'warning'
|
|
|
|
+ }).then(() => {
|
|
|
|
+ deleteitem({ dictIds: row.dictId }).then(response => {
|
|
|
|
+ this.$notify({
|
|
|
|
+ title: '成功',
|
|
|
|
+ message: '删除成功',
|
|
|
|
+ type: 'success',
|
|
|
|
+ duration: 2000
|
|
|
|
+ })
|
|
|
|
+ this.getList()
|
|
})
|
|
})
|
|
-
|
|
|
|
- },
|
|
|
|
- delAll() {
|
|
|
|
- this.$confirm("确认删除吗?", "提示", {
|
|
|
|
- confirmButtonText: "确定",
|
|
|
|
- cancelButtonText: "取消",
|
|
|
|
- type: "warning",
|
|
|
|
- })
|
|
|
|
- .then(() => {
|
|
|
|
- const length = this.multipleSelection.length;
|
|
|
|
|
|
+ }).catch(() => {
|
|
|
|
|
|
- if (length > 0) {
|
|
|
|
- for (let i = 0; i < length; i++) {
|
|
|
|
- this.delarr.push(this.multipleSelection[i].dictId);
|
|
|
|
- }
|
|
|
|
- const dictIds = this.delarr.join(",");
|
|
|
|
- deleteitem({ dictIds: dictIds })
|
|
|
|
- .then(() => {
|
|
|
|
- this.$notify({
|
|
|
|
- title: "成功",
|
|
|
|
- message: "删除成功",
|
|
|
|
- type: "success",
|
|
|
|
- duration: 2000,
|
|
|
|
- });
|
|
|
|
- this.getList();
|
|
|
|
- })
|
|
|
|
- .catch(() => { });
|
|
|
|
- } else {
|
|
|
|
- this.$notify({
|
|
|
|
- title: "警告提示",
|
|
|
|
- message: "请选择要删除的信息!",
|
|
|
|
- type: "warning",
|
|
|
|
- });
|
|
|
|
- }
|
|
|
|
- })
|
|
|
|
- .catch(() => { });
|
|
|
|
- },
|
|
|
|
- handleSelectionChange(val) {
|
|
|
|
- this.multipleSelection = val;
|
|
|
|
- },
|
|
|
|
- }
|
|
|
|
|
|
+ })
|
|
|
|
+
|
|
|
|
+ },
|
|
|
|
+ delAll() {
|
|
|
|
+ this.$confirm("确认删除吗?", "提示", {
|
|
|
|
+ confirmButtonText: "确定",
|
|
|
|
+ cancelButtonText: "取消",
|
|
|
|
+ type: "warning",
|
|
|
|
+ })
|
|
|
|
+ .then(() => {
|
|
|
|
+ const length = this.multipleSelection.length;
|
|
|
|
+
|
|
|
|
+ if (length > 0) {
|
|
|
|
+ for (let i = 0; i < length; i++) {
|
|
|
|
+ this.delarr.push(this.multipleSelection[i].dictId);
|
|
|
|
+ }
|
|
|
|
+ const dictIds = this.delarr.join(",");
|
|
|
|
+ deleteitem({ dictIds: dictIds })
|
|
|
|
+ .then(() => {
|
|
|
|
+ this.$notify({
|
|
|
|
+ title: "成功",
|
|
|
|
+ message: "删除成功",
|
|
|
|
+ type: "success",
|
|
|
|
+ duration: 2000,
|
|
|
|
+ });
|
|
|
|
+ this.getList();
|
|
|
|
+ })
|
|
|
|
+ .catch(() => { });
|
|
|
|
+ } else {
|
|
|
|
+ this.$notify({
|
|
|
|
+ title: "警告提示",
|
|
|
|
+ message: "请选择要删除的信息!",
|
|
|
|
+ type: "warning",
|
|
|
|
+ });
|
|
|
|
+ }
|
|
|
|
+ })
|
|
|
|
+ .catch(() => { });
|
|
|
|
+ },
|
|
|
|
+ handleSelectionChange(val) {
|
|
|
|
+ this.multipleSelection = val;
|
|
|
|
+ },
|
|
}
|
|
}
|
|
- </script>
|
|
|
|
- <style>
|
|
|
|
- .ad-avatar-uploader .el-upload {
|
|
|
|
- border: 1px dashed #d9d9d9;
|
|
|
|
- border-radius: 6px;
|
|
|
|
- cursor: pointer;
|
|
|
|
- position: relative;
|
|
|
|
- overflow: hidden;
|
|
|
|
- }
|
|
|
|
- .ad-avatar-uploader .el-upload:hover {
|
|
|
|
- border-color: #409EFF;
|
|
|
|
- }
|
|
|
|
- .ad-avatar-uploader-icon {
|
|
|
|
- font-size: 28px;
|
|
|
|
- color: #8c939d;
|
|
|
|
- width: 178px;
|
|
|
|
- height: 178px;
|
|
|
|
- line-height: 178px;
|
|
|
|
- text-align: center;
|
|
|
|
- }
|
|
|
|
- .ad-avatar {
|
|
|
|
- display: block;
|
|
|
|
- }
|
|
|
|
- </style>
|
|
|
|
|
|
+}
|
|
|
|
+</script>
|
|
|
|
+<style>
|
|
|
|
+.ad-avatar-uploader .el-upload {
|
|
|
|
+ border: 1px dashed #d9d9d9;
|
|
|
|
+ border-radius: 6px;
|
|
|
|
+ cursor: pointer;
|
|
|
|
+ position: relative;
|
|
|
|
+ overflow: hidden;
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+.ad-avatar-uploader .el-upload:hover {
|
|
|
|
+ border-color: #409EFF;
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+.ad-avatar-uploader-icon {
|
|
|
|
+ font-size: 28px;
|
|
|
|
+ color: #8c939d;
|
|
|
|
+ width: 178px;
|
|
|
|
+ height: 178px;
|
|
|
|
+ line-height: 178px;
|
|
|
|
+ text-align: center;
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+.ad-avatar {
|
|
|
|
+ display: block;
|
|
|
|
+}
|
|
|
|
+</style>
|
|
|
|
|