123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378 |
- <!-- 活动管理ß -->
- <template>
- <div class="app-container">
- <!-- 搜索 -->
- <el-form inline size="mini">
- <el-form-item label="活动名称:">
- <el-input v-model="form.name" placeholder="请输入活动名称" clearable />
- </el-form-item>
- <el-form-item label="当前状态:">
- <el-select
- v-model="form.activityState"
- placeholder="请选择当前状态"
- clearable
- >
- <el-option
- v-for="item in currentOptions"
- :key="item.value"
- :value="item.value"
- :label="item.label"
- />
- </el-select>
- </el-form-item>
- <el-form-item label="上下架状态:">
- <el-select
- v-model="form.status"
- placeholder="请选择上下架状态"
- clearable
- >
- <el-option
- v-for="item in disabledOptions"
- :key="item.value"
- :value="item.value"
- :label="item.label"
- />
- </el-select>
- </el-form-item>
- <el-form-item>
- <el-button type="primary" icon="el-icon-search" @click="getSearch"
- >搜索</el-button
- >
- <el-button icon="el-icon-refresh" @click="getRefresh">重置</el-button>
- <el-button
- type="primary"
- icon="el-icon-plus"
- plain
- @click="showDialog"
- v-hasPermi="['operation:activity:add']"
- >新增赠送流量</el-button
- >
- <el-button
- type="primary"
- icon="el-icon-plus"
- plain
- @click="getDetail"
- v-hasPermi="['operation:activity:add']"
- >新增活动</el-button
- >
- </el-form-item>
- </el-form>
- <!-- 列表 -->
- <el-table :data="tableData" v-loading="loading">
- <el-table-column label="序号" align="center" type="index" />
- <el-table-column
- label="活动id"
- align="center"
- prop="id"
- show-overflow-tooltip
- />
- <el-table-column
- label="活动名称"
- align="center"
- prop="name"
- show-overflow-tooltip
- />
- <el-table-column label="活动图片" align="center" width="100px">
- <template slot-scope="scope">
- <el-image :src="scope.row.pic" />
- </template>
- </el-table-column>
- <el-table-column label="创建时间" align="center" prop="createTime" />
- <el-table-column label="有效时间" align="center" show-overflow-tooltip>
- <template slot-scope="scope">
- {{ scope.row.timeList.join(" - ") }}
- </template>
- </el-table-column>
- <el-table-column
- label="当前状态"
- align="center"
- :formatter="activityFormatter"
- width="150px"
- />
- <el-table-column
- label="上下架状态"
- align="center"
- :formatter="statusFormatter"
- width="150px"
- />
- <el-table-column label="操作" align="center">
- <template slot-scope="scope">
- <el-button type="text" @click="getDetail(scope.row, true)"
- >查看</el-button
- >
- <el-button
- type="text"
- v-if="scope.row.status === 0"
- @click="getChange(scope.row.id, 1, '下架')"
- v-hasPermi="['operation:activity:down']"
- >下架</el-button
- >
- <span v-else style="margin: 0 10px">
- <el-button
- v-if="scope.row.activityState !== 2"
- type="text"
- @click="getDetail(scope.row)"
- v-hasPermi="['operation:activity:edit']"
- >编辑</el-button
- >
- <el-button
- v-if="scope.row.activityState !== 2"
- type="text"
- @click="getChange(scope.row.id, 0, '上架')"
- v-hasPermi="['operation:activity:up']"
- >上架</el-button
- >
- <el-button
- type="delete"
- @click="getDelete(scope.row)"
- v-hasPermi="['operation:activity:delete']"
- >删除</el-button
- >
- </span>
- <el-button
- type="text"
- v-clipboard:copy="scope.row.copyUrl"
- v-clipboard:success="getCopy"
- v-hasPermi="['operation:activity:copy']"
- >复制链接</el-button
- >
- </template>
- </el-table-column>
- </el-table>
- <pagination
- v-show="total > 0"
- :total="total"
- :page.sync="form.pageNum"
- :limit.sync="form.pageSize"
- @pagination="getList"
- />
- <el-dialog
- :visible.sync="dialogVisible"
- :title="dialogTitle"
- width="1000px"
- :before-close="getDialogClose"
- >
- <!-- :rules="[
- {
- required: true,
- message: '请输入要赠送设备的ICCID号',
- trigger: 'blur',
- },
- { max: 30, message: '不可超过30个字符', trigger: 'blur' },
- ]" -->
- <el-form :model="dialogData" ref="dialogData" label-width="auto">
- <!-- ICCID号 -->
- <el-form-item label="ICCID号:" prop="iccid">
- <el-input
- v-model="dialogData.iccid"
- placeholder="请输入要赠送设备的ICCID号"
- />
- </el-form-item>
- <!-- 关联活动ID -->
- <el-form-item label="关联活动ID:">
- <el-select
- v-model="dialogData.activityId"
- placeholder="请选择关联活动"
- >
- <el-option
- v-for="item in dialogAcitivityIds"
- :key="item.id"
- :value="item.id"
- :label="item.name"
- />
- </el-select>
- </el-form-item>
- <!-- 设备型号 -->
- <el-form-item label="设备型号:">
- <el-select v-model="dialogData.deviceId" placeholder="请选择设备型号">
- <el-option
- v-for="item in devOptions"
- :key="item.value"
- :value="item.value"
- :label="item.label"
- />
- </el-select>
- </el-form-item>
- </el-form>
- <div slot="footer">
- <el-button @click="getDialogClose">取消</el-button>
- <el-button type="primary" @click="getDialogSubmit">确定</el-button>
- </div>
- </el-dialog>
- </div>
- </template>
- <script>
- import {
- allNoDeleteList,
- change,
- doExchange,
- list,
- } from "@/api/operation/activity";
- import { currentMixin, devMixin, disabledMixin } from "@/mixin/index";
- export default {
- mixins: [devMixin, currentMixin, disabledMixin],
- data() {
- return {
- dialogVisible: false,
- dialogTitle: "新增赠送流量",
- dialogAcitivityIds: [],
- dialogData: {},
- // 遮罩层
- loading: false,
- // 表单
- form: {
- pageNum: 1,
- pageSize: 10,
- },
- // 总数据
- total: 0,
- // 列表
- tableData: [],
- };
- },
- mounted() {
- this.getList();
- this.getAllNoDeleteList();
- this.getDevList();
- },
- methods: {
- // 弹窗
- async showDialog() {
- this.dialogVisible = true;
- this.dialogData = {};
- if (this.dialogAcitivityIds.length == 0) {
- this.getAllNoDeleteList();
- }
- if (this.devOptions.length == 0) {
- this.getList();
- }
- },
- // 提交分类表单
- getDialogSubmit() {
- var iccid = this.dialogData.iccid;
- var activityId = this.dialogData.activityId;
- var deviceId = this.dialogData.deviceId;
- var param = {
- iccid: iccid,
- activityId: activityId,
- deviceId: deviceId,
- };
- console.log("操作参数==" + JSON.stringify(param));
- doExchange(param).then((res) => {
- // 89860624650085884202
- console.log("操作结果=" + JSON.stringify(param));
- if (res.code === 0) {
- this.dialogVisible = false;
- this.dialogData = {};
- this.$refs.dialogData.resetFields();
- this.$message.success("操作成功!");
- }
- });
- },
- // 取消
- getDialogClose() {
- this.dialogVisible = false;
- this.dialogData = {};
- this.$refs.dialogData.resetFields();
- },
- getAllNoDeleteList() {
- // 平台ID:灵活配置多个平台的 0-vip会员 1-联通
- var param = { platformId: 1 };
- allNoDeleteList(param).then((res) => {
- if (res.code === 0) {
- this.dialogAcitivityIds = res.data;
- }
- });
- },
- // 列表
- getList() {
- this.loading = true;
- list(this.form).then((res) => {
- console.log("操作结果dasd发==00=" + JSON.stringify(res));
- if (res.code === 0) {
- this.tableData = res.data.records;
- this.total = res.data.total;
- this.loading = false;
- }
- });
- },
- // 搜索
- getSearch() {
- this.form.pageNum = 1;
- this.getList();
- },
- // 重置
- getRefresh() {
- this.form = {
- pageNum: 1,
- pageSize: 10,
- };
- this.getList();
- },
- // 详情
- getDetail(row, boolean) {
- this.$router.push({
- path: `/operation/activity/detail`,
- query: {
- id: row.id,
- boolean: boolean,
- activityState: row.activityState,
- },
- });
- },
- // 上下架
- getChange(id, status, title) {
- change(id, status).then((res) => {
- if (res.code === 0) {
- this.$message.success(`${title}成功!`);
- this.getList();
- }
- });
- },
- // 删除
- getDelete(row) {
- this.$confirm(`是否删除${row.name}?`, "提示", {
- type: "warning",
- }).then(() => {
- change(row.id, 2).then((res) => {
- if (res.code === 0) {
- this.$message.success("删除成功!");
- this.getList();
- }
- });
- });
- },
- // 复制链接
- getCopy() {
- this.$message.success("复制成功!");
- },
- // 字典翻译
- activityFormatter(row) {
- return this.selectDictLabel(this.currentOptions, row.activityState);
- },
- statusFormatter(row) {
- return this.selectDictLabel(this.disabledOptions, row.status);
- },
- },
- };
- </script>
|