123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199 |
- <template>
- <div class="m-container">
- <h2>
- <div class="squrt"></div>
- 团练宝流量包
- </h2>
- <save-form
- :inline="true"
- class="searchForm"
- ref="searchForm"
- @submit="search"
- @reset="reset"
-
- :saveKey="'platformProductManager'"
- :model.sync="searchForm"
- >
- <el-form-item>
- <el-select
- v-model.trim="searchForm.minuteUp"
- clearable
- filterable
- placeholder="请选择分钟数"
- >
- <el-option v-for="min in minuteList" :label="min" :value="min" :key="min"></el-option>
- </el-select>
- </el-form-item>
- <el-form-item>
- <el-button native-type="submit" type="danger">搜索</el-button>
- <el-button native-type="reset" type="primary">重置</el-button>
- </el-form-item>
- </save-form>
- <el-button style="margin-bottom: 20px;" type="primary" v-permission="'cloudRoomFlowConfig/add'" @click="openCloudPackage('create')" icon="el-icon-plus">新增流量包</el-button>
- <!-- 列表 -->
- <div class="tableWrap">
- <el-table
- :data="tableList"
-
- :header-cell-style="{ background: '#EDEEF0', color: '#444' }"
- >
- <el-table-column align="center" prop="id" label="流量包编号">
- </el-table-column>
- <el-table-column align="center" label="分钟数" prop="minuteUpLimit">
- </el-table-column>
- <el-table-column align="center" label="原价(元)" prop="price">
- </el-table-column>
- <el-table-column align="center" label="描述" prop="remark">
- <template slot-scope="scope">
- <tooltip :content="scope.row.remark" />
- </template>
- </el-table-column>
- <el-table-column align="center" label="操作">
- <template slot-scope="scope">
- <el-button
- @click="resetCloudPackage(scope.row)"
- v-permission="'cloudRoomFlowConfig/update'"
- type="text"
-
- >修改</el-button
- >
- <el-button
- @click="delCloudPackage(scope.row)"
- v-permission="'cloudRoomFlowConfig/delete'"
- type="text"
-
- >删除</el-button
- >
- </template>
- </el-table-column>
- </el-table>
- <pagination
- :saveKey="'platformProductManager'"
- sync
- :total.sync="pageInfo.total"
- :page.sync="pageInfo.page"
- :limit.sync="pageInfo.limit"
- :page-sizes="pageInfo.page_size"
- @pagination="getList"
- />
- </div>
- <el-dialog
- :title="isAdd ? '新增流量包' : '修改流量包'"
- class="courseMask"
- width="500px"
- :visible.sync="courseVisible"
- >
- <cloudModel
- ref="cloudModel"
- :activeRow="activeRow"
- :pageType="pageType"
- v-if="courseVisible"
- @close="close"
- />
- <div slot="footer" class="dialog-footer">
- <el-button @click="courseVisible = false">取 消</el-button>
- <el-button type="primary" @click="submitInfo">确 定</el-button>
- </div>
- </el-dialog>
- </div>
- </template>
- <script>
- import pagination from "@/components/Pagination/index";
- import { queryPage, getMinuteUp, cloudDelete } from "./api";
- import cloudModel from './cloudModel'
- const initSearch = {
- minuteUp: null
- };
- export default {
- components: { pagination, cloudModel },
- data() {
- return {
- tableList: [],
- pageInfo: {
- // 分页规则
- limit: 10, // 限制显示条数
- page: 1, // 当前页
- total: 0, // 总条数
- page_size: [10, 20, 40, 50], // 选择限制显示条数
- },
- searchForm: { ...initSearch },
- isAdd: true,
- courseVisible: false,
- activeRow: null,
- minuteList: [],
- };
- },
- mounted() {
- this.__init()
- this.getList();
- },
- methods: {
- async __init() {
- try {
- const res = await getMinuteUp()
- this.minuteList = res.data || []
- } catch(e) {}
- },
- async getList() {
- try {
- const res = await queryPage({
- ...this.searchForm,
- page: this.pageInfo.page,
- rows: this.pageInfo.limit,
- });
- this.pageInfo.total = res.data.total;
- this.tableList = res.data.rows;
- } catch (e) {}
- },
- search() {
- this.pageInfo.page = 1;
- this.$refs.searchForm.save(this.searchForm);
- this.$refs.searchForm.save(this.pageInfo, "page");
- this.getList();
- },
- reset() {
- this.searchForm = { ...initSearch };
- this.search();
- },
- resetCloudPackage(row) {
- this.isAdd = false;
- this.activeRow = row;
- this.pageType = 'update'
- this.courseVisible = true;
- },
- submitInfo() {
- const str = this.isAdd ? "create" : "update";
- this.$refs.cloudModel.submitInfo(str);
- },
- close() {
- this.courseVisible = false;
- this.getList();
- },
- openCloudPackage() {
- this.isAdd = true;
- this.activeRow = null;
- this.pageType = 'create'
- this.courseVisible = true;
- },
- async delCloudPackage(row) {
- this.$confirm("是否删除?", "提示", {
- confirmButtonText: "确定",
- cancelButtonText: "取消",
- type: "warning",
- }).then( async() => {
- try{
- const res = await cloudDelete({ id:row.id})
- this.$message.success('删除成功')
- this.getList()
- }catch{}
- });
- },
- },
- };
- </script>
- <style lang="scss" scoped>
- .courseMask .el-dialog__body {
- padding-bottom: 0;
- }
- </style>
|