chen 2 năm trước cách đây
mục cha
commit
123341c13c

+ 104 - 98
admin/src/views/channel/allSecondChannel.vue

@@ -3,18 +3,40 @@
     <el-container class="app-container">
       <!--搜索-->
       <el-header>
-        <el-form :inline="true" :model="searchForm" ref="searchForm" class="demo-form-inline">
+        <el-form
+          :inline="true"
+          :model="searchForm"
+          ref="searchForm"
+          class="demo-form-inline"
+        >
           <el-form-item label="渠道名称">
-            <el-input v-model="searchForm.channelName" name="channelName" placeholder="渠道名称" size="mini" />
+            <el-input
+              v-model="searchForm.channelName"
+              name="channelName"
+              placeholder="渠道名称"
+              size="mini"
+            />
           </el-form-item>
           <el-form-item label="渠道key">
-            <el-input v-model="searchForm.channelKey" name="channelKey" placeholder="渠道Key" size="mini" />
+            <el-input
+              v-model="searchForm.channelKey"
+              name="channelKey"
+              placeholder="渠道Key"
+              size="mini"
+            />
           </el-form-item>
           <el-form-item label="完整渠道编码">
-            <el-input v-model="searchForm.fullCode" name="fullCode" placeholder="完整渠道编码" size="mini" />
+            <el-input
+              v-model="searchForm.fullCode"
+              name="fullCode"
+              placeholder="完整渠道编码"
+              size="mini"
+            />
           </el-form-item>
           <el-form-item style="float: right">
-            <el-button type="primary" @click="init()" size="mini">搜索</el-button>
+            <el-button type="primary" @click="init()" size="mini"
+              >搜索</el-button
+            >
             <el-button @click="reset('searchForm')" size="mini">重置</el-button>
           </el-form-item>
         </el-form>
@@ -25,21 +47,49 @@
       <el-table :data="tableData">
         <el-table-column prop="channelName" label="二级渠道名称">
         </el-table-column>
-        <el-table-column prop="channelCode" label="渠道key">
-        </el-table-column>
+        <el-table-column prop="channelCode" label="渠道key"> </el-table-column>
         <el-table-column prop="partnerContacts" label="合作方">
         </el-table-column>
-        <el-table-column prop="fullCode" label="完整渠道编码"> </el-table-column>
+        <el-table-column prop="fullCode" label="完整渠道编码">
+        </el-table-column>
         <el-table-column prop="channelType" label="渠道类别"> </el-table-column>
         <el-table-column prop="channelStatus" label="渠道形态">
         </el-table-column>
         <el-table-column prop="onlineTime" label="生效时间"> </el-table-column>
-        <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
+        <el-table-column
+          label="操作"
+          align="center"
+          class-name="small-padding fixed-width"
+        >
           <template #default="{ row }">
-            <el-button @click="toEdit(row.id)" size="mini" type="text" icon="el-icon-edit">編輯</el-button>
-            <el-button size="mini" type="text" icon="el-icon-plus" @click="copy(row)">复制链接</el-button>
-            <el-button @click="giveShort(row)" size="mini" type="text" icon="el-icon-delete">短链接</el-button>
-            <el-button @click="ewm(row.id)" size="mini" type="text" icon="el-icon-delete">二维码</el-button>
+            <el-button
+              @click="toEdit(row.id)"
+              size="mini"
+              type="text"
+              icon="el-icon-edit"
+              >編輯</el-button
+            >
+            <el-button
+              size="mini"
+              type="text"
+              icon="el-icon-plus"
+              @click="copy(row)"
+              >复制链接</el-button
+            >
+            <el-button
+              @click="giveShort(row)"
+              size="mini"
+              type="text"
+              icon="el-icon-delete"
+              >短链接</el-button
+            >
+            <el-button
+              @click="ewm(row.id)"
+              size="mini"
+              type="text"
+              icon="el-icon-delete"
+              >二维码</el-button
+            >
           </template>
         </el-table-column>
       </el-table>
@@ -52,24 +102,31 @@
           </div>
         </div>
         <span slot="footer" class="dialog-footer">
-          <el-button @click="dialogVisible = false" size="mini">取 消</el-button>
+          <el-button @click="dialogVisible = false" size="mini"
+            >取 消</el-button
+          >
         </span>
       </el-dialog>
       <!-- 分页 -->
-      <pagination v-show="total > 0" :total="total" :page="pageNo" :limit="pageSizes" @pagination="pagination" />
+      <pagination
+        v-show="total > 0"
+        :total="total"
+        :page="pageNo"
+        :limit="pageSizes"
+        @pagination="pagination"
+      />
     </el-container>
-
   </div>
 </template>
 
 <script>
+import { Channelsecondd, listChannel } from "./api";
 import { post, get } from "@/api/common";
 import QRCode from "qrcodejs2";
-import XEUtils from "xe-utils";
 
 export default {
   name: "SchemeEdit",
-  data () {
+  data() {
     return {
       searchForm: {
         channelName: "",
@@ -110,54 +167,36 @@ export default {
       channelog: [],
       channelogList: [],
       filterName1: "",
-      channelogParam: {
-        channelId: this.$route.query.id,
-        pageNum: 1,
-        pageSize: 10,
-        totalResult: 0,
-      },
     };
   },
-  watch: {
-    value5 (val) {
-      if (val) {
-        get("/channelInfo/channelogpage", this.channelogParam).then((res) => {
-          this.channelog = res.data.list;
-          this.channelogParam.totalResult = res.data.total;
-        });
-        this.channelogParam.pageSize = 100;
-        get("/channelInfo/channelogpage", this.channelogParam).then((res) => {
-          this.channelogList = JSON.parse(JSON.stringify(res.data.list));
-        });
-      }
-    },
-  },
 
-  created () {
+  created() {
     this.getSeconList();
   },
 
   methods: {
     //获取列表
-    getSeconList () {
-      get("/channel/info/listChannels", {
-        pageNo: this.pageNo,
-        pageSize: this.pageSize,
-      }).then((res) => {
-
-        // 筛选出二级列表
-        let sesondlist = res.data.list;
-        this.total = res.data.total;
-        this.tableData = sesondlist;
-      });
+    getSeconList() {
+      Channelsecondd({ pageNo: this.pageNo, pageSize: this.pageSize }).then(
+        (res) => {
+          this.total = res.data.total;
+          // console.log(res.data.list);
+          let sesondlist = res.data.list.filter(function (item) {
+            // console.log(item);
+            return item.parentId != 0;
+          });
+          this.tableData = sesondlist;
+          console.log(this.tableData);
+        }
+      );
     },
 
-    onSubmit () {
+    onSubmit() {
       post(
         "/channelInfo/pushdata?beginTime=" +
-        this.pushdataDate[0] +
-        "&endTime=" +
-        this.pushdataDate[1],
+          this.pushdataDate[0] +
+          "&endTime=" +
+          this.pushdataDate[1],
         {}
       ).then((res) => {
         this.$message({
@@ -167,11 +206,11 @@ export default {
         this.pushdata = false;
       });
     },
-    reset (formName) {
+    reset(formName) {
       // 重置
       this.searchForm = {};
     },
-    checkpushdata (e) {
+    checkpushdata(e) {
       get("/channelInfo/checkpushdata", { fullCode: e }).then((res) => {
         let data = JSON.parse(res.data)[0];
         if (data.resdesc == "ok") {
@@ -187,45 +226,29 @@ export default {
         }
       });
     },
-    init () {
-
-      get("/channel/info/page", this.searchForm).then((res) => {
-
+    init() {
+      listChannel(this.searchForm).then((res) => {
         this.tableData = res.data.list;
         this.searchForm.totalResult = res.data.total;
       });
     },
 
     // 改变页码触发
-    pagination (page) {
+    pagination(page) {
       this.pageNo = page.page;
       // 重新获取列表数据
       this.getSeconList();
     },
-    editClosedEvent ({ row, column }) {
+    editClosedEvent({ row, column }) {
       const $table = this.$refs.xTable;
       const prop = column.property;
       const cellValue = row[prop];
       // 判断单元格值是否被修改
-      if ($table.isUpdateByRow(row, prop)) {
-        setTimeout(() => {
-          let param = {};
-          param[prop] = cellValue;
-          post("/channelInfo/update/" + row.id, row).then((res) => {
-            this.$message({
-              message: res.message,
-              type: "success",
-            });
-          });
-          // 局部更新单元格为已保存状态
-          $table.reloadRow(row, null, prop);
-        }, 300);
-      }
     },
-    toEdit (id) {
+    toEdit(id) {
       this.$router.push("/channel/channelEdit?ids=" + id);
     },
-    copy (row) {
+    copy(row) {
       let oInput = document.createElement("input");
       oInput.value = `https://operation.mige.tv/a/#/${row.channelKey}`;
       document.body.appendChild(oInput);
@@ -237,11 +260,10 @@ export default {
       });
       oInput.remove();
     },
-    giveShort (row) {
+    giveShort(row) {
       let stUrl = row.shortUrl;
 
       if (stUrl) {
-
         let oInput = document.createElement("input");
         oInput.value = `http://v.mige.tv/${stUrl}`;
         document.body.appendChild(oInput);
@@ -253,13 +275,11 @@ export default {
         });
         oInput.remove();
       } else {
-
         let data = {
           channel: row.channelKey,
           longUrl: `https://operation.mige.tv/a/#/${row.channelKey}`,
         };
         post("/channel/info/shorturl", data).then((res) => {
-
           let resUrl = res.data.shortCode;
           let oInput = document.createElement("input");
           oInput.value = `http://v.mige.tv/${resUrl}`;
@@ -274,7 +294,7 @@ export default {
         });
       }
     },
-    ewm (row) {
+    ewm(row) {
       this.dialogVisible = true;
       this.$nextTick(function () {
         document.getElementById("qrcode").innerHTML = "";
@@ -285,25 +305,11 @@ export default {
         });
       });
     },
-    handlePageChange ({ currentPage, pageSize }) {
+    handlePageChange({ currentPage, pageSize }) {
       this.searchForm.pageNum = currentPage;
       this.searchForm.pageSize = pageSize;
       this.init();
     },
-    handlePageChangeChannelog ({ currentPage, pageSize }) {
-      this.channelogParam.pageNum = currentPage;
-      this.channelogParam.pageSize = pageSize;
-      get("/channelInfo/channelogpage", this.channelogParam).then((res) => {
-        this.channelog = res.data.list;
-        this.channelogParam.totalResult = res.data.total;
-      });
-    },
-    searchEvent () {
-      get("/channelInfo/channelogpage", this.channelogParam).then((res) => {
-        this.channelog = res.data.list;
-        this.channelogParam.totalResult = res.data.total;
-      });
-    },
   },
 };
 </script>

+ 80 - 2
admin/src/views/channel/api.js

@@ -1,6 +1,6 @@
 import request from '@/utils/request'
 
-// 导出角色
+// 导出
 export function exportChannel(query) {
   return request({
     url: '/channel/info/export-excel',
@@ -8,4 +8,82 @@ export function exportChannel(query) {
     params: query,
     responseType: 'blob'
   })
-}
+}
+//获取渠道列表
+export function listChannel(query) {
+  return request({
+    url: '/channel/info/page',
+    method: 'get',
+    params: query
+  })
+}
+//新增渠道列表
+export function addChannel(params) {
+  return request({
+    url: "/channel/info/create",
+    method: 'post',
+    data: params
+  })
+}
+//删除渠道
+export function delChannel(params) {
+  return request({
+    url: '/channel/info/delete',
+    method: 'delete',
+    params
+  })
+}
+
+//获取一条数据
+export function getOne(query) {
+  return request({
+    url: '/channel/info/list',
+    method: 'get',
+    params: query
+  })
+}
+
+//编辑一条数据
+export function editChannel(params) {
+  return request({
+    url: '/channel/info/update',
+    method: 'put',
+    data: params
+  })
+}
+
+//获取二级列表
+export function Channelsecondd(query) {
+  return request({
+    url: '/channel/info/listChannels',
+    method: 'get',
+    params: query
+  })
+}
+
+//新增历史记录
+export function createHistory(params) {
+  return request({
+    url: "/channel/info/create",
+    method: 'post',
+    data: params
+  })
+}
+
+//获取历史记录
+export function listChannelHistory(query) {
+  return request({
+    url: '/channel/log/page',
+    method: 'get',
+    params: query
+  })
+}
+
+//查询一级获取渠道列表
+export function listChanneGet(query) {
+  return request({
+    url: '/channel/info/get',
+    method: 'get',
+    params: query
+  })
+}

+ 180 - 77
admin/src/views/channel/channelEdit.vue

@@ -4,52 +4,133 @@
       <el-main>
         <!-- 二级 -->
         <template v-if="form.parentId || $route.query.type == 'erji'">
-          <el-form ref="form" :model="formm" :rules="ruless" label-width="160px">
+          <el-form
+            ref="form"
+            :model="formm"
+            :rules="ruless"
+            label-width="160px"
+          >
             <el-form-item label="渠道名称" prop="channelName">
-              <el-input placeholder="请输入内容" v-model="formm.channelName" clearable @blur="changeName"></el-input>
+              <el-input
+                placeholder="请输入内容"
+                v-model="formm.channelName"
+                clearable
+                @blur="changeName"
+              ></el-input>
               <!-- @change="changeInputer" -->
             </el-form-item>
             <el-form-item label="一级渠道">
-              <el-select v-model="formm.parentId" remote reserve-keyword placeholder="请输入关键词" :loading="loading">
-                <el-option v-for="item in options" :key="item.id" :label="item.channelName" :value="item.id">
+              <el-select
+                v-model="formm.parentId"
+                remote
+                reserve-keyword
+                placeholder="请输入关键词"
+                :loading="loading"
+              >
+                <el-option
+                  v-for="item in options"
+                  :key="item.id"
+                  :label="item.channelName"
+                  :value="item.id"
+                >
                 </el-option>
               </el-select>
             </el-form-item>
             <el-form-item label="二级编码">
-              <el-input placeholder="自动生成" v-model="formm.channelCode" disabled @change="changeInput"></el-input>
+              <el-input
+                placeholder="自动生成"
+                v-model="formm.channelCode"
+                disabled
+                @change="changeInput"
+              ></el-input>
             </el-form-item>
             <el-form-item label="完整编码">
-              <el-input placeholder="自动生成" v-model="formm.fullCode" disabled @change="changeInput"></el-input>
+              <el-input
+                placeholder="自动生成"
+                v-model="formm.fullCode"
+                disabled
+                @change="changeInput"
+              ></el-input>
             </el-form-item>
             <el-form-item label="key">
-              <el-input placeholder="自动生成" v-model="formm.channelKey" disabled @change="changeInput"></el-input>
+              <el-input
+                placeholder="自动生成"
+                v-model="formm.channelKey"
+                disabled
+                @change="changeInput"
+              ></el-input>
             </el-form-item>
             <el-form-item label="渠道类别" prop="channelType">
-              <el-select v-model="formm.channelType" clearable placeholder="请选择">
-                <el-option v-for="item in typeList" :key="item.value" :label="item.label" :value="item.value">
+              <el-select
+                v-model="formm.channelType"
+                clearable
+                placeholder="请选择"
+              >
+                <el-option
+                  v-for="item in typeList"
+                  :key="item.value"
+                  :label="item.label"
+                  :value="item.value"
+                >
                 </el-option>
               </el-select>
             </el-form-item>
             <el-form-item label="上线时间">
               <el-col :span="11">
-                <el-date-picker type="datetime" placeholder="选择日期" v-model="formm.onlineTime" start-placeholder="开始日期" end-placeholder="结束日期" range-separator="至" value-format="yyyy-MM-dd HH:mm:ss" style="width: 100%">
+                <el-date-picker
+                  type="datetime"
+                  placeholder="选择日期"
+                  v-model="formm.onlineTime"
+                  start-placeholder="开始日期"
+                  end-placeholder="结束日期"
+                  range-separator="至"
+                  value-format="yyyy-MM-dd HH:mm:ss"
+                  style="width: 100%"
+                >
                 </el-date-picker>
               </el-col>
             </el-form-item>
 
             <el-form-item label="绑定策略" prop="strategyId">
-              <el-select v-model="formm.strategyId" filterable remote reserve-keyword placeholder="请输入关键词" :loading="loading">
-                <el-option v-for="item in celueList" :key="item.id" :label="item.strategyName" :value="item.id">
+              <el-select
+                v-model="formm.strategyId"
+                filterable
+                remote
+                reserve-keyword
+                placeholder="请输入关键词"
+                :loading="loading"
+              >
+                <el-option
+                  v-for="item in celueList"
+                  :key="item.id"
+                  :label="item.strategyName"
+                  :value="item.id"
+                >
                 </el-option>
               </el-select>
               <span style="margin-left: 20px">
-                <el-button @click="refresh" icon="el-icon-refresh" size="mini" content="刷新"></el-button>
+                <el-button
+                  @click="refresh"
+                  icon="el-icon-refresh"
+                  size="mini"
+                  content="刷新"
+                ></el-button>
               </span>
               <span style="margin-left: 20px">
-                <el-button @click="toAdd" icon="el-icon-plus" size="mini" content="新建"></el-button>
+                <el-button
+                  @click="toAdd"
+                  icon="el-icon-plus"
+                  size="mini"
+                  content="新建"
+                ></el-button>
               </span>
               <span style="margin-left: 20px">
-                <el-button @click="toEdit(formm.strategyId)" icon="el-icon-edit" size="mini" content="编辑"></el-button>
+                <el-button
+                  @click="toEdit(formm.strategyId)"
+                  icon="el-icon-edit"
+                  size="mini"
+                  content="编辑"
+                ></el-button>
               </span>
             </el-form-item>
 
@@ -78,14 +159,28 @@
         <template v-else>
           <el-form ref="form" :model="form" :rules="rules" label-width="160px">
             <el-form-item label="渠道名称" prop="channelName">
-              <el-input placeholder="请输入内容" v-model="form.channelName" clearable @change="changeInput"></el-input>
+              <el-input
+                placeholder="请输入内容"
+                v-model="form.channelName"
+                clearable
+                @change="changeInput"
+              ></el-input>
             </el-form-item>
             <el-form-item label="一级编码">
               <el-input disabled v-model="form.channelCode"></el-input>
             </el-form-item>
             <el-form-item label="上线时间">
               <el-col :span="11">
-                <el-date-picker type="datetime" placeholder="选择日期" v-model="form.onlineTime" start-placeholder="开始日期" end-placeholder="结束日期" range-separator="至" value-format="yyyy-MM-dd HH:mm:ss" style="width: 100%">
+                <el-date-picker
+                  type="datetime"
+                  placeholder="选择日期"
+                  v-model="form.onlineTime"
+                  start-placeholder="开始日期"
+                  end-placeholder="结束日期"
+                  range-separator="至"
+                  value-format="yyyy-MM-dd HH:mm:ss"
+                  style="width: 100%"
+                >
                 </el-date-picker>
               </el-col>
             </el-form-item>
@@ -122,12 +217,19 @@
 </template>
 
 <script>
+import {
+  addChannel,
+  getOne,
+  editChannel,
+  listChannel,
+  createHistory,
+} from "./api";
 import { post, get, put } from "@/api/common";
 import XEUtils from "xe-utils";
 var text1 = "";
 export default {
   name: "SchemeEdit",
-  data () {
+  data() {
     return {
       form: {
         channelPattern: "1",
@@ -139,7 +241,7 @@ export default {
         channelStatus: "",
         parentId: this.$route.query.id,
         onlineTime: "",
-        strategyId: ""
+        strategyId: "",
       },
       oldform: {},
 
@@ -213,24 +315,20 @@ export default {
       num: null,
     };
   },
-  created () {
+  created() {
     //获取策略
     get("/strategy/strategy-info/page", {
       pageSize: 100,
       pageNum: 1,
-    }).then(res => {
-      this.celueList = res.data.list
-
-    })
-
+    }).then((res) => {
+      this.celueList = res.data.list;
+    });
 
     // 数据回显
     if (this.$route.query.ids) {
       document.title = "修改渠道";
       this.id = this.$route.query.ids;
-      get("/channel/info/list", {
-        ids: this.id,
-      }).then((res) => {
+      getOne({ ids: this.id }).then((res) => {
         this.form = res.data[0];
         this.formm = res.data[0];
         this.oldform = JSON.parse(JSON.stringify(res.data[0]));
@@ -238,7 +336,7 @@ export default {
     }
     document.title = "新增渠道";
 
-    get("/channel/info/page", {
+    listChannel({
       parentId: 0,
       pageSize: 10,
       pageNum: 1,
@@ -250,7 +348,15 @@ export default {
 
   methods: {
     //新增历史记录
-    addHistory (type, channelId, text) {
+
+    addHistory(type, channelId, text) {
+      // createHistory({
+      //   type: type,
+      //   notes: text,
+      //   channelId: channelId,
+      // }).then((res) => {
+      //   console.log(res, "新增历史记录", text);
+      // });
       post("/channel/log/create", {
         type: type,
         notes: text,
@@ -260,7 +366,7 @@ export default {
       });
     },
 
-    ontwo () {
+    ontwo() {
       var array1 = this.oldform;
       var array2 = this.formm;
       XEUtils.objectEach(array2, (item, key) => {
@@ -279,8 +385,7 @@ export default {
         delete this.form.createTime;
         this.parentId = 370;
         this.id = this.id;
-        put("/channel/info/update", this.formm).then((res) => {
-          //   编辑成功
+        editChannel(this.formm).then((res) => {
           if (res.data) {
             this.$message({
               message: "编辑成功√",
@@ -293,6 +398,7 @@ export default {
             }, 200);
           }
         });
+
       } else {
         // console.log("二级创建");
         if (
@@ -300,7 +406,6 @@ export default {
           !this.formm.channelType ||
           !this.formm.strategyId
         ) {
-
           this.$message({
             message: "请输入内容",
             type: "error",
@@ -309,27 +414,27 @@ export default {
           });
           return;
         }
-        post("/channel/info/create", this.formm).then((res) => {
-          this.$message({
-            message: "创建成功√",
-            type: "success",
-          });
-          setTimeout(() => {
-            this.$router.back();
-          }, 200);
+        addChannel(this.formm).then((res) => {
+          if (res.data) {
+            this.$message({
+              message: "编辑成功√",
+              type: "success",
+            });
+            setTimeout(() => {
+              this.$router.back();
+            }, 200);
+          }
         });
       }
     },
 
     //   点击提交
-    onSubmit () {
-
+    onSubmit() {
       this.$confirm("此操作将永久改变数据, 是否继续?", "提示", {
         confirmButtonText: "确定",
         cancelButtonText: "取消",
         type: "warning",
       }).then(() => {
-
         let type = 1;
         let channelId = 0;
         let text = "渠道:" + this.form.channelName;
@@ -344,8 +449,7 @@ export default {
           //  一级编辑
           if (this.form.parentId == 0) {
             // console.log("一级编辑");
-            put("/channel/info/update", this.form).then((res) => {
-              //   编辑成功
+            editChannel(this.form).then((res) => {
               if (res.data) {
                 this.$message({
                   message: "编辑成功√",
@@ -362,7 +466,6 @@ export default {
         } else {
           console.log("新增");
           if (!this.form.channelName) {
-
             this.$message({
               message: "请输入内容",
               type: "error",
@@ -371,29 +474,31 @@ export default {
             });
             return;
           }
-          //新建
-          post("/channel/info/create", this.form).then((res) => {
-            this.$message({
-              message: "创建成功√",
-              type: "success",
-              duration: 3000,
-              offset: 360,
-            });
-            setTimeout(() => {
-              this.$router.back();
-            }, 200);
+          //一级新建
+          addChannel(this.form).then((res) => {
+            if (res.data) {
+              this.$message({
+                message: "编辑成功√",
+                type: "success",
+                duration: 3000,
+                offset: 360,
+              });
+              setTimeout(() => {
+                this.$router.back();
+              }, 200);
+            }
           });
         }
       });
     },
-    changeInput () {
+    changeInput() {
       this.form.channelName = this.form.channelName.includes("H5")
         ? this.form.channelName
         : `${this.form.channelName}H5`;
       // this.$set(this.form,'name',`${newV}H5`)
     },
 
-    close () {
+    close() {
       this.$confirm("此操作不会保存已编辑数据, 是否继续?", "提示", {
         confirmButtonText: "确定",
         cancelButtonText: "取消",
@@ -409,30 +514,28 @@ export default {
           });
         });
     },
-    toAdd (e) {
-      this.$router.push("/schemeV2/schemeAdd")
+    toAdd(e) {
+      this.$router.push("/schemeV2/schemeAdd");
     },
 
-    toEdit (id) {
-
-
-      this.$router.push("/schemeV2/schemeAdd?ids=" + id)
+    toEdit(id) {
+      this.$router.push("/schemeV2/schemeAdd?ids=" + id);
     },
 
     // },
-    refresh () {
-      get('/strategy/strategy-info/page', {
-        'strategyType': 0,
-        'pageSize': 100,
-        'pageNum': 1,
-        'strategyType': 0
-      }).then(res => {
-        this.celueList = res.data.list
-      })
+    refresh() {
+      get("/strategy/strategy-info/page", {
+        strategyType: 0,
+        pageSize: 100,
+        pageNum: 1,
+        strategyType: 0,
+      }).then((res) => {
+        this.celueList = res.data.list;
+      });
     },
 
     // 渠道名称输入框失焦事件
-    changeName () {
+    changeName() {
       if (!this.num && !this.$route.query.ids)
         if (this.formm.channelName) {
           this.num = 1;

+ 88 - 46
admin/src/views/channel/firstChannelList.vue

@@ -1,11 +1,20 @@
 <template>
   <div class="app-container">
-
     <!--搜索-->
 
-    <el-form :inline="true" :model="searchForm" ref="searchForm" size="small" class="demo-form-inline">
+    <el-form
+      :inline="true"
+      :model="searchForm"
+      ref="searchForm"
+      size="small"
+      class="demo-form-inline"
+    >
       <el-form-item label="渠道名称">
-        <el-input v-model="searchForm.channelName" name="searchForm.channelName" placeholder="渠道名称" />
+        <el-input
+          v-model="searchForm.channelName"
+          name="searchForm.channelName"
+          placeholder="渠道名称"
+        />
       </el-form-item>
       <el-form-item label="合作方">
         <el-input v-model="searchForm.channelPartner" placeholder="合作方" />
@@ -18,10 +27,24 @@
     </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="add">新增</el-button>
+        <el-button
+          type="primary"
+          plain
+          icon="el-icon-plus"
+          size="mini"
+          @click="add"
+          >新增</el-button
+        >
       </el-col>
       <el-col :span="1.5">
-        <el-button type="info" plain icon="el-icon-upload2" size="mini" @click="Refresh">刷新</el-button>
+        <el-button
+          type="info"
+          plain
+          icon="el-icon-upload2"
+          size="mini"
+          @click="Refresh"
+          >刷新</el-button
+        >
       </el-col>
     </el-row>
 
@@ -34,26 +57,57 @@
       <el-table-column prop="channelCode" label="渠道编码"> </el-table-column>
       <el-table-column prop="channelStatus" label="状态">
         <template slot-scope="scope">
-          <el-switch :value="scope.row.channelStatus" :active-value="1" :inactive-value="0"></el-switch>
+          <el-tag v-if="scope.row.channelStatus == 1" type="success"
+            >生效</el-tag
+          >
+          <el-tag v-else type="warning">关闭</el-tag>
         </template>
       </el-table-column>
       <el-table-column prop="onlineTime" label="生效时间"> </el-table-column>
-      <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
+      <el-table-column
+        label="操作"
+        align="center"
+        class-name="small-padding fixed-width"
+      >
         <template slot-scope="scope">
-          <el-button @click="edit(scope.row.id)" size="mini" type="text" icon="el-icon-edit">編輯</el-button>
-          <el-button size="mini" type="text" icon="el-icon-plus" @click="query(scope.row.id)">查询</el-button>
-          <el-button @click="del(scope.row.id)" size="mini" type="text" icon="el-icon-delete">删除</el-button>
+          <el-button
+            @click="edit(scope.row.id)"
+            size="mini"
+            type="text"
+            icon="el-icon-edit"
+            >編輯</el-button
+          >
+          <el-button
+            size="mini"
+            type="text"
+            icon="el-icon-plus"
+            @click="query(scope.row.id)"
+            >查询</el-button
+          >
+          <el-button
+            @click="del(scope.row.id)"
+            size="mini"
+            type="text"
+            icon="el-icon-delete"
+            >删除</el-button
+          >
         </template>
       </el-table-column>
     </el-table>
-    <pagination v-show="total > 0" :total="total" :page="pageNo" :limit="pageSizes" @pagination="pagination" />
+    <pagination
+      v-show="total > 0"
+      :total="total"
+      :page="pageNo"
+      :limit="pageSizes"
+      @pagination="pagination"
+    />
   </div>
 </template>
 
 <script>
-import { get, del } from "@/api/common";
+import { listChannel, delChannel } from "./api";
 export default {
-  data () {
+  data() {
     return {
       searchForm: {
         channelName: "",
@@ -74,86 +128,75 @@ export default {
       tableData: [],
     };
   },
-  mounted () {
+  mounted() {
     // 获取列表
-    this.getChannerList();
+    this.getList();
     // 获取分页
   },
   methods: {
-    reset () {
+    reset() {
       this.searchForm = {
         channelName: "",
         channelPartner: "",
-      }
+      };
     },
-    query (id) {
-
+    query(id) {
       this.$router.push("/channel/secondChannelList?id=" + id);
     },
     //刷新
-    Refresh () {
-
-      this.getChannerList();
+    Refresh() {
+      this.getList();
     },
     // 搜索
-    init () {
+    init() {
       if (!this.searchForm.channelName || !this.searchForm.channelPartner) {
-        this.$message.error("请输入内容")
+        this.$message.error("请输入内容");
       } else {
-        get("/channel/info/page", this.searchForm).then((res) => {
+        listChannel(this.searchForm).then((res) => {
           this.tableData = res.data.list;
           this.total = res.data.total;
-
-          // 清空
           this.searchForm = {
             channelName: "",
             channelPartner: "",
           };
         });
       }
-
     },
 
     // 改变页码触发
-    pagination (page) {
+    pagination(page) {
       this.pageNo = page.page;
       // 重新获取列表数据
-      this.getChannerList();
+      this.getList();
     },
 
-    // 获取订购页列表方法
-    getChannerList () {
-      get("/channel/info/page", {
+    // 获取一级渠道列表方法
+    getList() {
+      listChannel({
         pageNo: this.pageNo,
         pageSize: this.pageSize,
         parentId: 0,
       }).then((res) => {
-
-
-        // 一级列表的数组长度=total
         this.total = res.data.total;
         this.tableData = res.data.list;
       });
     },
     //添加跳转
-    add () {
+    add() {
       this.$router.push("/channel/channelEdit");
     },
     //删除
-    del (id) {
-
+    del(id) {
       this.$confirm("此操作将永久删除该文件, 是否继续?", "提示", {
         confirmButtonText: "确定",
         cancelButtonText: "取消",
         type: "warning",
       })
         .then(() => {
-
-          del("/channel/info/delete", { id }).then((res) => {
-            // 判断是否成功,成功刷新列表
+          delChannel({ id }).then((res) => {
             if (res.data) {
               // 刷新
-              this.getChannerList();
+              this.getList();
               // 提示
               setTimeout(() => {
                 this.$message({
@@ -166,7 +209,7 @@ export default {
                 // 没有数据
                 this.pageNo - 1;
                 // 刷新
-                this.getChannerList();
+                this.getList();
               }
             }
           });
@@ -179,9 +222,8 @@ export default {
         });
     },
     //编辑
-    edit (id) {
+    edit(id) {
       this.$router.push("/channel/channelEdit?ids=" + id);
-
     },
   },
 };

+ 239 - 132
admin/src/views/channel/secondChannelList.vue

@@ -2,8 +2,12 @@
   <div class="app-container">
     <el-descriptions class="margin-top" title="一级渠道信息">
       <template slot="extra">
-        <el-button type="primary" size="mini" @click="oneTOEdit(id)">编辑</el-button>
-        <el-button type="primary" @click="value5 = true" size="mini">历史记录</el-button>
+        <el-button type="primary" size="mini" @click="oneTOEdit(id)"
+          >编辑</el-button
+        >
+        <el-button type="primary" @click="value5 = true" size="mini"
+          >历史记录</el-button
+        >
       </template>
       <el-descriptions-item label="渠道名称">
         <template slot="label"> 渠道名称 </template>
@@ -41,28 +45,61 @@
     </el-descriptions>
 
     <el-header>
-      <el-form :inline="true" :model="searchForm" ref="searchForm" class="demo-form-inline">
+      <el-form
+        :inline="true"
+        :model="searchForm"
+        ref="searchForm"
+        class="demo-form-inline"
+      >
         <el-form-item label="渠道名称">
-          <el-input v-model="searchForm.channelName" name="searchForm.channelName" placeholder="策略名称" size="mini" />
+          <el-input
+            v-model="searchForm.channelName"
+            name="searchForm.channelName"
+            placeholder="策略名称"
+            size="mini"
+          />
         </el-form-item>
         <el-form-item label="合作方">
-          <el-input v-model="searchForm.channelPartner" placeholder="合作方" size="mini" />
+          <el-input
+            v-model="searchForm.channelPartner"
+            placeholder="合作方"
+            size="mini"
+          />
         </el-form-item>
         <el-form-item style="float: right">
-          <el-button type="primary" size="mini" @click="search()">搜索</el-button>
-          <el-button type="danger" size="mini" @click="pushdata = true">同步科创</el-button>
+          <el-button type="primary" size="mini" @click="search()"
+            >搜索</el-button
+          >
+          <el-button type="danger" size="mini" @click="pushdata = true"
+            >同步科创</el-button
+          >
           <el-button size="mini" @click="reset('searchForm')">重置</el-button>
-          <el-button size="mini" type="warning" @click="download()">导出</el-button>
+          <el-button size="mini" type="warning" @click="download()"
+            >导出</el-button
+          >
         </el-form-item>
       </el-form>
     </el-header>
 
     <el-row :gutter="10" class="mb8">
       <el-col :span="1.5">
-        <el-button type="primary" plain icon="el-icon-plus" size="mini" @click="add({ id: content.id }, 'erji', content.channelName)">新增</el-button>
+        <el-button
+          type="primary"
+          plain
+          icon="el-icon-plus"
+          size="mini"
+          @click="add({ id: content.id }, 'erji', content.channelName)"
+          >新增</el-button
+        >
       </el-col>
       <el-col :span="1.5">
-        <el-button type="info" icon="el-icon-upload2" size="mini" @click="init()">刷新</el-button>
+        <el-button
+          type="info"
+          icon="el-icon-upload2"
+          size="mini"
+          @click="init()"
+          >刷新</el-button
+        >
       </el-col>
     </el-row>
 
@@ -82,8 +119,18 @@
       <template #default>
         <vxe-toolbar>
           <template #buttons>
-            <vxe-input v-model="channelogParam.notes" type="search" clearable placeholder="搜索操作记录"></vxe-input>
-            <vxe-input v-model="channelogParam.userName" type="search" clearable placeholder="搜索操作人"></vxe-input>
+            <vxe-input
+              v-model="channelogParam.notes"
+              type="search"
+              clearable
+              placeholder="搜索操作记录"
+            ></vxe-input>
+            <vxe-input
+              v-model="channelogParam.userName"
+              type="search"
+              clearable
+              placeholder="搜索操作人"
+            ></vxe-input>
             <vxe-button @click="searchEvent" content="搜索"></vxe-button>
           </template>
         </vxe-toolbar>
@@ -97,14 +144,21 @@
           </vxe-table-column>
           <vxe-table-column field="userName" title="操作人"></vxe-table-column>
         </vxe-table>
-        <vxe-pager :loading="loading" :current-page="channelogParam.pageNo" :page-size="channelogParam.pageSize" :total="channelogParam.totalResult" :layouts="[
-              'PrevPage',
-              'JumpNumber',
-              'NextPage',
-              'FullJump',
-              'Sizes',
-              'Total',
-            ]" @page-change="handlePageChangeChannelog" />
+        <vxe-pager
+          :loading="loading"
+          :current-page="channelogParam.pageNo"
+          :page-size="channelogParam.pageSize"
+          :total="channelogParam.totalResult"
+          :layouts="[
+            'PrevPage',
+            'JumpNumber',
+            'NextPage',
+            'FullJump',
+            'Sizes',
+            'Total',
+          ]"
+          @page-change="handlePageChangeChannelog"
+        />
       </template>
     </vxe-modal>
     <!-- 同步 -->
@@ -112,11 +166,21 @@
       <template #default>
         <el-form ref="form" label-width="80px">
           <el-form-item label="选择时间">
-            <el-date-picker v-model="pushdataDate" type="daterange" range-separator="至" start-placeholder="开始日期" end-placeholder="结束日期" format="yyyy 年 MM 月 dd 日" value-format="yyyy-MM-dd">
+            <el-date-picker
+              v-model="pushdataDate"
+              type="daterange"
+              range-separator="至"
+              start-placeholder="开始日期"
+              end-placeholder="结束日期"
+              format="yyyy 年 MM 月 dd 日"
+              value-format="yyyy-MM-dd"
+            >
             </el-date-picker>
           </el-form-item>
           <el-form-item>
-            <el-button type="primary" mini @click="onSubmit">立即同步</el-button>
+            <el-button type="primary" mini @click="onSubmit"
+              >立即同步</el-button
+            >
             <el-button @click="pushdata = false" mini>取消</el-button>
           </el-form-item>
         </el-form>
@@ -129,42 +193,82 @@
       </el-table-column>
       <el-table-column prop="channelKey" label="渠道key" width="180">
       </el-table-column>
-      <el-table-column prop="fullCode" label="完整渠道编码">
-      </el-table-column>
+      <el-table-column prop="fullCode" label="完整渠道编码"> </el-table-column>
       <el-table-column prop="address" label="渠道类别"> </el-table-column>
-      <el-table-column prop="channelStatus" label="渠道形态">
-      </el-table-column>
+      <el-table-column prop="channelStatus" label="渠道形态"> </el-table-column>
       <el-table-column prop="channelStatus" label="状态">
         <template slot-scope="scope">
-          <el-switch :value="scope.row.channelStatus" :active-value="1" :inactive-value="0"></el-switch>
+          <el-tag v-if="scope.row.channelStatus == 1" type="success"
+            >生效</el-tag
+          >
+          <el-tag v-else type="warning">关闭</el-tag>
         </template>
       </el-table-column>
 
       <el-table-column prop="onlineTime" label="生效时间"> </el-table-column>
       <el-table-column prop="channelCode" label="操作">
         <template #default="{ row }">
-          <el-button @click="toEdit(row.id, 'erji')" size="mini" type="text" icon="el-icon-edit">编辑</el-button>
-          <el-button @click="checkpushdata(row)" size="mini" type="text" icon="el-icon-edit">查询同步</el-button>
-          <el-button size="mini" type="text" icon="el-icon-plus" @click="copy(row)">复制链接</el-button>
-          <el-button @click="giveShort(row)" size="mini" type="text" icon="el-icon-share">短链接</el-button>
-          <el-button @click="ewm(row)" size="mini" type="text" icon="el-icon-mobile-phone">二维码</el-button>
+          <el-button
+            @click="toEdit(row.id, 'erji')"
+            size="mini"
+            type="text"
+            icon="el-icon-edit"
+            >编辑</el-button
+          >
+          <el-button
+            @click="checkpushdata(row)"
+            size="mini"
+            type="text"
+            icon="el-icon-edit"
+            >查询同步</el-button
+          >
+          <el-button
+            size="mini"
+            type="text"
+            icon="el-icon-plus"
+            @click="copy(row)"
+            >复制链接</el-button
+          >
+          <el-button
+            @click="giveShort(row)"
+            size="mini"
+            type="text"
+            icon="el-icon-share"
+            >短链接</el-button
+          >
+          <el-button
+            @click="ewm(row)"
+            size="mini"
+            type="text"
+            icon="el-icon-mobile-phone"
+            >二维码</el-button
+          >
         </template>
       </el-table-column>
     </el-table>
-    <pagination v-show="total>0" :total="total" :page.sync="tableData.pageNo" :limit.sync="tableData.pageSize" @pagination="pagination" />
-    </el-container>
-
+    <pagination
+      v-show="total > 0"
+      :total="total"
+      :page.sync="tableData.pageNo"
+      :limit.sync="tableData.pageSize"
+      @pagination="pagination"
+    />
   </div>
 </template>
 
 <script>
-import { exportChannel } from './api'
-import { post, get, } from "@/api/common";
+import {
+  exportChannel,
+  Channelsecondd,
+  listChannel,
+  listChanneGet,
+} from "./api";
+import { post, get } from "@/api/common";
 import QRCode from "qrcodejs2";
 
 export default {
   name: "SchemeEdit",
-  data () {
+  data() {
     return {
       id: this.$route.query.id,
       searchForm: {
@@ -188,48 +292,51 @@ export default {
       content: {
         id: this.$route.query.id,
       },
-      strategyStatus: [{
-        label: "生效中",
-        value: "1",
-      },
-      {
-        label: "未生效",
-        value: "0",
-      },
+      strategyStatus: [
+        {
+          label: "生效中",
+          value: "1",
+        },
+        {
+          label: "未生效",
+          value: "0",
+        },
       ],
-      typeList: [{
-        value: "集团渠道",
-        label: "集团渠道",
-      },
-      {
-        value: "省分线下渠道",
-        label: "省分线下渠道",
-      },
-      {
-        value: "省分线上渠道",
-        label: "省分线上渠道",
-      },
-      {
-        value: "互联网渠道",
-        label: "互联网渠道",
-      },
-      {
-        value: "自有线上渠道",
-        label: "自有线上渠道",
-      },
-      {
-        value: "社会代理和其他渠道",
-        label: "社会代理和其他渠道",
-      },
+      typeList: [
+        {
+          value: "集团渠道",
+          label: "集团渠道",
+        },
+        {
+          value: "省分线下渠道",
+          label: "省分线下渠道",
+        },
+        {
+          value: "省分线上渠道",
+          label: "省分线上渠道",
+        },
+        {
+          value: "互联网渠道",
+          label: "互联网渠道",
+        },
+        {
+          value: "自有线上渠道",
+          label: "自有线上渠道",
+        },
+        {
+          value: "社会代理和其他渠道",
+          label: "社会代理和其他渠道",
+        },
       ],
-      patnerList: [{
-        value: "0",
-        label: "V1",
-      },
-      {
-        value: "1",
-        label: "V2",
-      },
+      patnerList: [
+        {
+          value: "0",
+          label: "V1",
+        },
+        {
+          value: "1",
+          label: "V2",
+        },
       ],
 
       dialogVisible: false,
@@ -248,9 +355,8 @@ export default {
     };
   },
   watch: {
-    value5 (val) {
+    value5(val) {
       if (val) {
-
         get("/channel/log/page", this.channelogParam).then((res) => {
           this.channelog = res.data.list;
           this.channelogParam.totalResult = res.data.total;
@@ -262,73 +368,69 @@ export default {
       }
     },
   },
-  created () {
+  created() {
     this.getSecondList();
   },
   methods: {
     // 改变页码触发
-    pagination (page) {
+    pagination(page) {
       this.pageNo = page.page;
       // 重新获取列表数据
       this.init();
     },
 
     //重置
-    reset () {
-      this.searchForm = {}
+    reset() {
+      this.searchForm = {};
     },
 
     //获取列表
-    getSecondList () {
+    getSecondList() {
       document.title = "一级渠道详情";
       this.searchForm.parentId = this.$route.query.id;
-      get("/channel/info/get", {
+
+      listChanneGet({
         id: this.$route.query.id,
       }).then((res) => {
         this.content = res.data;
-        this.total = res.data.total;
-
+        // console.log(res.data, " res.data.total");
+        // this.total = res.data.total;
       });
+
       this.init();
     },
 
-    pagination (page) {
+    pagination(page) {
       this.pageNo = page.page;
       // 重新获取列表数据
       this.getSecondList();
     },
     //搜索按钮
-    search () {
+    search() {
       if (!this.searchForm.channelName || !this.searchForm.channelPartner) {
-        this.$message.error("请输入内容")
+        this.$message.error("请输入内容");
       } else {
-        get("/channel/info/listChannels", this.searchForm).then((res) => {
-
-          this.tableData = res.data.list
+        Channelsecondd(this.searchForm).then((res) => {
+          this.tableData = res.data.list;
           this.total = res.data.list.length;
-
-
         });
       }
-
     },
 
     // 一级编辑
-    oneTOEdit (id) {
+    oneTOEdit(id) {
       this.$router.push("/channel/channelEdit?ids=" + id);
     },
     //二级编辑
-    toEdit (id, type) {
+    toEdit(id, type) {
       this.$router.push("/channel/channelEdit?ids=" + id);
     },
 
-    formatterWotv ({
-      cellValue
-    }) {
+    formatterWotv({ cellValue }) {
       return cellValue !== "1" ? "关闭" : "开启";
     },
     //复制链接
-    copy (row) {
+    copy(row) {
       let oInput = document.createElement("input");
       oInput.value = `https://operation.mige.tv/a/#/${row.channelKey}`;
       document.body.appendChild(oInput);
@@ -341,7 +443,7 @@ export default {
       oInput.remove();
     },
     //短链接
-    giveShort (row) {
+    giveShort(row) {
       let stUrl = row.shortUrl;
       if (stUrl) {
         let oInput = document.createElement("input");
@@ -375,49 +477,54 @@ export default {
       }
     },
 
-
     //导出
-    download () {
-      this.$modal.confirm('是否确认导出所有渠道数据?').then(function () {
-        return exportChannel();
-      }).then(response => {
-        this.$download.excel(response, '渠道数据.xlsx');
-      })
+    download() {
+      this.$modal
+        .confirm("是否确认导出所有渠道数据?")
+        .then(function () {
+          return exportChannel();
+        })
+        .then((response) => {
+          this.$download.excel(response, "渠道数据.xlsx");
+        });
     },
 
     //历史记录分页
-    handlePageChangeChannelog ({
-      currentPage,
-      pageSize
-    }) {
+    handlePageChangeChannelog({ currentPage, pageSize }) {
       this.channelogParam.pageNo = currentPage;
       this.channelogParam.pageSize = pageSize;
-      get("/channelInfo/channelogpage", this.channelogParam).then((res) => {
 
+      listChannelHistory(this.channelogParam).then((res) => {
         this.channelog = res.data.list;
+        console.log(res.data.total, "res.data.total");
         this.channelogParam.totalResult = res.data.total;
       });
+      // get("/channelInfo/channelogpage", this.channelogParam).then((res) => {
+      //   this.channelog = res.data.list;
+      //   this.channelogParam.totalResult = res.data.total;
+      // });
     },
     //获取二级列表
-    init () {
-      get("/channel/info/listChannels", this.initfrom).then((res) => {
+    init() {
+      Channelsecondd(this.initfrom).then((res) => {
         let secondList = res.data.list.filter((item) => {
           return item.parentId == this.$route.query.id;
         });
 
         this.tableData = secondList;
+        console.log(secondList.length, "secondList.length");
         this.total = secondList.length;
         this.oldform = secondList;
       });
     },
     //历史记录搜索
-    searchEvent () {
-      get("/channelInfo/channelogpage", this.channelogParam).then((res) => {
+    searchEvent() {
+      listChannelHistory(this.channelogParam).then((res) => {
         this.channelog = res.data.list;
         this.channelogParam.totalResult = res.data.total;
       });
     },
-    ewm (row) {
+    ewm(row) {
       this.dialogVisible = true;
       this.$nextTick(function () {
         document.getElementById("qrcode").innerHTML = "";
@@ -429,7 +536,7 @@ export default {
       });
     },
 
-    checkpushdata (e) {
+    checkpushdata(e) {
       get("/channelInfo/detail", {
         id: e.id,
       }).then((res1) => {
@@ -450,9 +557,10 @@ export default {
             this.pushdataDate = [bigentime, endtime];
             post(
               "/channelInfo/pushdata?beginTime=" +
-              this.pushdataDate[0] +
-              "&endTime=" +
-              this.pushdataDate[1], {}
+                this.pushdataDate[0] +
+                "&endTime=" +
+                this.pushdataDate[1],
+              {}
             ).then((res) => {
               this.$message({
                 message: channel.channelName + "同步成功",
@@ -464,19 +572,18 @@ export default {
       });
     },
 
-    add (e, type, channelName) {
+    add(e, type, channelName) {
       this.$router.push(
         "/channel/channelEdit?id=" +
-        e.id +
-        "&type=" +
-        type +
-        "&firstChannelName=" +
-        channelName
+          e.id +
+          "&type=" +
+          type +
+          "&firstChannelName=" +
+          channelName
       );
     },
   },
 };
-
 </script>
 
 <style scoped></style>

+ 19 - 0
admin/src/views/dataPage/orderData/api.js

@@ -0,0 +1,19 @@
+import request from '@/utils/request'
+
+// 导出角色
+export function exportAccess(query) {
+  return request({
+    url: '/record/access-record/export-excel',
+    method: 'get',
+    params: query,
+    responseType: 'blob'
+  })
+}
+
+export function accessList(params) {
+  return request({
+    url: '/record/access-record/page',
+    method: 'get',
+    params: params
+  })
+}

+ 49 - 37
admin/src/views/dataPage/orderData/index.vue

@@ -3,7 +3,12 @@
     <el-container>
       <!--搜索-->
       <el-header class="searchBox">
-        <el-form :inline="true" :model="searchForm" class="demo-form-inline" size="small">
+        <el-form
+          :inline="true"
+          :model="searchForm"
+          class="demo-form-inline"
+          size="small"
+        >
           <el-form-item label="产品名称">
             <el-input v-model="searchForm.productName" placeholder="产品名称" />
           </el-form-item>
@@ -26,7 +31,16 @@
             </el-select>
           </el-form-item>
           <el-form-item label="时间范围">
-            <el-date-picker v-model="value2" type="datetimerange" :picker-options="pickerOptions" range-separator="至" start-placeholder="开始日期" end-placeholder="结束日期" align="right" @change="dateChange" />
+            <el-date-picker
+              v-model="value2"
+              type="datetimerange"
+              :picker-options="pickerOptions"
+              range-separator="至"
+              start-placeholder="开始日期"
+              end-placeholder="结束日期"
+              align="right"
+              @change="dateChange"
+            />
           </el-form-item>
 
           <el-form-item size="mini">
@@ -64,7 +78,11 @@
           <el-table-column prop="createTime" label="订购时间" width="160" />
         </el-table>
         <div class="block">
-          <pagination v-show="total > 0" :total="total" :page="searchForm.pageNo" :limit="searchForm.pageSize" @pagination="pagination" />
+          <pagination
+            :total="total"
+            :page="searchForm.pageNo"
+            :limit="searchForm.pageSize"
+          />
         </div>
       </el-main>
     </el-container>
@@ -72,16 +90,16 @@
 </template>
 
 <script>
-import { exportAccess, accessList } from '../api'
+import { exportAccess, accessList } from "./api.js";
 import filter from "@/common/filter";
 // import { get } from 'xe-utils';
 export default {
-  data () {
+  data() {
     return {
       searchForm: {
         // productName: '',
         // fullCode: '',
-        // phone: '',              
+        // phone: '',
         // handleType: '',
         // handleResult: '',
         // startTime: '',
@@ -91,12 +109,12 @@ export default {
       },
       value2: "",
       tableData: [],
-      total: 5000,
+      total: 10,
       pickerOptions: {
         shortcuts: [
           {
             text: "最近一周",
-            onClick (picker) {
+            onClick(picker) {
               const end = new Date();
               const start = new Date();
               start.setTime(start.getTime() - 3600 * 1000 * 24 * 7);
@@ -105,7 +123,7 @@ export default {
           },
           {
             text: "最近一个月",
-            onClick (picker) {
+            onClick(picker) {
               const end = new Date();
               const start = new Date();
               start.setTime(start.getTime() - 3600 * 1000 * 24 * 30);
@@ -114,7 +132,7 @@ export default {
           },
           {
             text: "最近三个月",
-            onClick (picker) {
+            onClick(picker) {
               const end = new Date();
               const start = new Date();
               start.setTime(start.getTime() - 3600 * 1000 * 24 * 90);
@@ -125,37 +143,30 @@ export default {
       },
     };
   },
-  created () {
-
+  created() {
     this.search();
   },
   methods: {
     // 改变页码触发
-    pagination (page) {
+    pagination(page) {
       this.pageNo = page.page;
-      console.log(this.pageNo)
+      console.log(this.pageNo);
       // 重新获取列表数据
       this.search();
     },
-    search () {
+    search() {
       // 同步搜索
-      accessList(this.searchForm).then(res => {
+      accessList(this.searchForm).then((res) => {
         this.tableData = res.data.list;
-        console.log(res)
+        console.log(res);
         this.total = res.data.total;
-      })
-
-      // get("/record/access-record/page", this.searchForm).then(res => {
-      //   this.tableData = res.data.list;
-      //   this.total = res.data.total;
-
-      // })
+      });
     },
-    searchBtn () {
+    searchBtn() {
       // 搜索按钮
       this.search();
     },
-    reset () {
+    reset() {
       // 重置
       this.searchForm = {
         cpid: "",
@@ -165,30 +176,31 @@ export default {
       };
       this.search();
     },
-    dateChange (e) {
+    dateChange(e) {
       console.log(e);
       this.searchForm.startTime = filter.frDateTime(e[0]);
       this.searchForm.endTime = filter.frDateTime(e[1]);
     },
-    handleSizeChange (e) {
+    handleSizeChange(e) {
       // 单页数量
       this.searchForm.pageSize = e;
       this.search();
     },
-    handleCurrentChange (e) {
+    handleCurrentChange(e) {
       // 跳页
       this.searchForm.pageNum = e;
       this.search();
     },
-    download () {
+    download() {
       // 导出
-      this.$modal.confirm('是否确认导出所有渠道数据').then(function () {
-        return exportAccess();
-      }).then(response => {
-        this.$download.excel(response, '订单操作数据.xlsx')
-      })
-
-
+      this.$modal
+        .confirm("是否确认导出所有渠道数据")
+        .then(function () {
+          return exportAccess();
+        })
+        .then((response) => {
+          this.$download.excel(response, "订单操作数据.xlsx");
+        });
     },
   },
 };

+ 1 - 1
admin/src/views/dataPage/receData/index.vue

@@ -94,7 +94,7 @@
 <script>
 import { get, post } from '@/api/common'
 import filter from '@/common/filter'
-import { receList } from '../api'
+import { receList } from '../orderData/api'
 
 export default {
   name: 'RunData',

+ 22 - 18
admin/src/views/produce/api.js

@@ -10,22 +10,26 @@ export function listProduct(query) {
 }
 
 //新增商品分类
-export function  addProduct (data){
-return request({
-  url:"product/cpid-info/create",
-  method:'post',
-  data:data
-})
+export function addProduct(params) {
+  return request({
+    url: "product/cpid-info/create",
+    method: 'post',
+    data: params
+  })
+}
+//删除商品分类
+export function delProduct(params) {
+  return request({
+    url: '/product/cpid-info/delete',
+    method: 'delete',
+    params
+  })
+}
+//编辑一条数据
+export function editProduct(params) {
+  return request({
+    url: '/product/cpid-info/update',
+    method: 'put',
+    data: params
+  })
 }
-
-
-
-
- 
-
-
-
-
-
-
-

+ 128 - 90
admin/src/views/produce/produceClass/index.vue

@@ -2,9 +2,18 @@
   <!-- 产品分类 -->
   <div class="abtestIndex">
     <!--搜索-->
-    <el-form :inline="true" :model="searchForm" size="small" class="demo-form-inline">
+    <el-form
+      :inline="true"
+      :model="searchForm"
+      size="small"
+      class="demo-form-inline"
+    >
       <el-form-item label="分类名称">
-        <el-input v-model="searchForm.categoryName" placeholder="分类名称" clearable />
+        <el-input
+          v-model="searchForm.categoryName"
+          placeholder="分类名称"
+          clearable
+        />
       </el-form-item>
       <el-form-item label="CPID">
         <el-input v-model="searchForm.cpid" placeholder="CPID" clearable />
@@ -17,7 +26,14 @@
 
     <el-row :gutter="10" class="mb8">
       <el-col :span="1.5">
-        <el-button type="primary" plain icon="el-icon-plus" size="mini" @click="add">新增</el-button>
+        <el-button
+          type="primary"
+          plain
+          icon="el-icon-plus"
+          size="mini"
+          @click="add"
+          >新增</el-button
+        >
       </el-col>
     </el-row>
     <!--表格-->
@@ -29,17 +45,44 @@
       <el-table-column prop="createTime" label="创建时间" />
       <el-table-column fixed="right" label="操作" width="100">
         <template slot-scope="scope">
-          <el-button type="text" size="mini" @click="edit(scope.row.id, scope.row)" icon="el-icon-edit">编辑</el-button>
-          <el-button type="text" size="mini" @click="dele(scope.row.id)" icon="el-icon-delete">删除</el-button>
+          <el-button
+            type="text"
+            size="mini"
+            @click="edit(scope.row.id, scope.row)"
+            icon="el-icon-edit"
+            >编辑</el-button
+          >
+          <el-button
+            type="text"
+            size="mini"
+            @click="dele(scope.row.id)"
+            icon="el-icon-delete"
+            >删除</el-button
+          >
         </template>
       </el-table-column>
-
     </el-table>
 
-    <pagination class="mt10" v-show="total > 0" :total="total" :page="searchForm.pageNo" :limit="searchForm.pageSizes" @pagination="pagination" />
+    <pagination
+      class="mt10"
+      v-show="total > 0"
+      :total="total"
+      :page="searchForm.pageNo"
+      :limit="searchForm.pageSizes"
+      @pagination="pagination"
+    />
 
     <!--新增抽屉-->
-    <el-drawer ref="addDrawer" title="编辑产品分类" size="50%" :before-close="addHandleClose" :with-header="false" :visible.sync="addDialog" direction="rtl" custom-class="demo-drawer">
+    <el-drawer
+      ref="addDrawer"
+      title="编辑产品分类"
+      size="50%"
+      :before-close="addHandleClose"
+      :with-header="false"
+      :visible.sync="addDialog"
+      direction="rtl"
+      custom-class="demo-drawer"
+    >
       <div class="demo-drawer__content">
         <span>编辑产品分类</span>
         <el-form :model="addForm">
@@ -53,18 +96,36 @@
             <el-input v-model="addForm.parentCategory" autocomplete="off" />
           </el-form-item>
           <el-form-item label="会员pwd" label-width="80px">
-            <el-input v-model="addForm.pwd" placeholder="科创会员兑换专用pwd,根据映射表填写" autocomplete="off" />
+            <el-input
+              v-model="addForm.pwd"
+              placeholder="科创会员兑换专用pwd,根据映射表填写"
+              autocomplete="off"
+            />
           </el-form-item>
         </el-form>
         <div class="demo-drawer__footer">
           <el-button @click="cancelForm">取 消</el-button>
-          <el-button type="primary" :loading="loading" @click="$refs.addDrawer.closeDrawer()">{{ loading ? "提交中 ..." : "确 定" }}</el-button>
+          <el-button
+            type="primary"
+            :loading="loading"
+            @click="$refs.addDrawer.closeDrawer()"
+            >{{ loading ? "提交中 ..." : "确 定" }}</el-button
+          >
         </div>
       </div>
     </el-drawer>
 
     <!--编辑抽屉-->
-    <el-drawer ref="editDrawer" title="编辑产品分类" size="50%" :before-close="editHandleClose" :with-header="false" :visible.sync="editDialog" direction="rtl" custom-class="demo-drawer">
+    <el-drawer
+      ref="editDrawer"
+      title="编辑产品分类"
+      size="50%"
+      :before-close="editHandleClose"
+      :with-header="false"
+      :visible.sync="editDialog"
+      direction="rtl"
+      custom-class="demo-drawer"
+    >
       <div class="demo-drawer__content">
         <span>编辑产品分类</span>
         <el-form :model="editForm">
@@ -78,12 +139,21 @@
             <el-input v-model="editForm.parentCategory" autocomplete="off" />
           </el-form-item>
           <el-form-item label="会员pwd" label-width="80px">
-            <el-input v-model="editForm.pwd" placeholder="科创会员兑换专用pwd,根据映射表填写" autocomplete="off" />
+            <el-input
+              v-model="editForm.pwd"
+              placeholder="科创会员兑换专用pwd,根据映射表填写"
+              autocomplete="off"
+            />
           </el-form-item>
         </el-form>
         <div class="demo-drawer__footer">
           <el-button @click="cancelForm">取 消</el-button>
-          <el-button type="primary" :loading="loading" @click="$refs.editDrawer.closeDrawer()">{{ loading ? "提交中 ..." : "确 定" }}</el-button>
+          <el-button
+            type="primary"
+            :loading="loading"
+            @click="$refs.editDrawer.closeDrawer()"
+            >{{ loading ? "提交中 ..." : "确 定" }}</el-button
+          >
         </div>
       </div>
     </el-drawer>
@@ -91,12 +161,10 @@
 </template>
 
 <script>
-// import { listProduct, addProduct } from "../api.js";
-import { post, get, del, put } from "@/api/common";
+import { listProduct, addProduct, delProduct, editProduct } from "../api.js";
 import getTime from "@/utils/getTime.js";
 export default {
-
-  data () {
+  data() {
     return {
       loading: false,
       editDialog: false,
@@ -125,19 +193,18 @@ export default {
     };
   },
 
-  created () {
-    this.search()
-    // this.getList();
+  created() {
+    this.getList();
   },
   methods: {
     // 改变页码触发
-    pagination (page) {
+    pagination(page) {
       this.pageNo = page.page;
       // 重新获取列表数据
-      this.search();
+      this.getList();
     },
 
-    getTimeStr (timeStamp) {
+    getTimeStr(timeStamp) {
       var now = new Date(timeStamp),
         y = now.getFullYear(),
         m = ("0" + (now.getMonth() + 1)).slice(-2),
@@ -145,44 +212,26 @@ export default {
       return y + "-" + m + "-" + d + " " + now.toTimeString().substr(0, 8);
     },
     //获取列表
-    getList () {
-      listProduct(this.searchForm).then(response => {
+    getList() {
+      listProduct(this.searchForm).then((response) => {
         this.tableData = response.data.list;
         this.tableData.forEach((item) => {
           item.createTime = getTime(item.createTime);
         });
 
         this.total = response.data.total;
-      })
+      });
     },
 
-
-    async search () {
-      //获取列表
-      await get("/product/cpid-info/page", this.searchForm)
-        .then((res) => {
-          this.tableData = res.data.list;
-
-          this.tableData.forEach((item) => {
-            item.createTime = getTime(item.createTime);
-          });
-
-          this.total = res.data.total;
-        })
-        .catch((err) => {
-          console.log(err);
-        });
-    },
-    searchBtn () {
-      //   // 搜索按钮
+    searchBtn() {
+      // 搜索按钮
       if (!this.searchForm.categoryName || !this.searchForm.cpid) {
-        this.$message.error("请输入内容")
+        this.$message.error("请输入内容");
       } else {
-        this.search();
+        this.getList();
       }
-
     },
-    reset () {
+    reset() {
       // 重置
       this.searchForm = {};
       this.editForm = {
@@ -191,9 +240,9 @@ export default {
         parentCategory: "",
         pwd: "",
         id: "",
-      }
+      };
     },
-    add () {
+    add() {
       // 新增
       this.addDialog = true;
       this.bannerList = [];
@@ -201,56 +250,44 @@ export default {
       this.proUrl = "";
       this.guidUrl = "";
 
-      this.search();
+      this.getList();
     },
-    // addProduct (this.addForm).then(response=>{
-    //       this.$modal.msgSuccess("新增成功");
-    // }),
 
-
-    addHandleClose (done) {
-      // 新增数据
+    addHandleClose(done) {
+      //   // 新增数据
       if (this.loading) return;
-      this.$confirm("确定要提交吗?")
-        .then((_) => {
-          done();
-          this.addDialog = true;
-          post("/product/cpid-info/create", this.addForm)
-            .then((res) => {
-              if (res.code == 0) {
-                this.search();
-                this.reset()
-
-              }
-              setTimeout(() => {
-                this.addDialog = false;
-              }, 400);
-            })
-            .catch((err) => {
-              console.log(err);
-            });
-        })
-        .catch((_) => {
-          this.addDialog = false;
+      this.$confirm("确定要提交吗?").then((_) => {
+        done();
+        this.addDialog = true;
+        addProduct(this.addForm).then((res) => {
+          if (res.code == 0) {
+            this.$message.success("新增成功!");
+            this.getList();
+            this.reset();
+            setTimeout(() => {
+              this.addDialog = false;
+            }, 400);
+          }
         });
+      });
     },
-    edit (id, e) {
+    edit(id, e) {
       // 编辑
       this.editForm.id = id;
       this.editForm = e;
       this.editDialog = true;
     },
-    editHandleClose (done) {
+    editHandleClose(done) {
       // 修改数据
       if (this.loading) return;
       this.$confirm("确定要提交吗?")
         .then((_) => {
           done();
           this.editDialog = true;
-          put("/product/cpid-info/update", this.editForm)
+          editProduct(this.editForm)
             .then((res) => {
-
-              if (res.code === 0) this.search(); this.reset();
+              if (res.code === 0) this.getList();
+              this.reset();
               setTimeout(() => {
                 this.editDialog = false;
               }, 400);
@@ -263,15 +300,16 @@ export default {
           this.editDialog = false;
         });
     },
-    dele (id) {
+    dele(id) {
       // 删除
       this.$confirm("确定要删除么?").then((_) => {
-        del("/product/cpid-info/delete", { id }).then((res) => {
-          if (res.code === 0) this.search(); this.reset();
+        delProduct({ id: id }).then((res) => {
+          if (res.code === 0) this.getList();
+          this.reset();
         });
       });
     },
-    cancelForm () {
+    cancelForm() {
       // 关闭抽屉
 
       this.loading = false;
@@ -279,12 +317,12 @@ export default {
       this.addDialog = false;
       clearTimeout(this.timer);
     },
-    handleSizeChange (e) {
+    handleSizeChange(e) {
       // 单页数量
       this.searchForm.pageSize = e;
       // this.search()
     },
-    handleCurrentChange (e) {
+    handleCurrentChange(e) {
       // 跳页
       this.searchForm.pageNum = e;
       // this.search()

+ 113 - 40
admin/src/views/produce/productV2/addProduct.vue

@@ -2,51 +2,100 @@
   <div class="addProduct">
     <el-form :model="form" label-width="100px">
       <el-form-item label="产品名称">
-        <el-input style="width: 300px" v-model="form.productName" placeholder="产品名称"></el-input>
+        <el-input
+          style="width: 300px"
+          v-model="form.productName"
+          placeholder="产品名称"
+        ></el-input>
       </el-form-item>
       <el-form-item label="spid">
-        <el-input style="width: 300px" v-model="form.spid" placeholder="spid"></el-input>
+        <el-input
+          style="width: 300px"
+          v-model="form.spid"
+          placeholder="spid"
+        ></el-input>
       </el-form-item>
       <el-form-item label="cpid">
         <el-select v-model="form.cpid" placeholder="cpid" style="width: 300px">
-          <el-option v-for="item in cpidList" :key="item.cpid" :label="item.cpid" :value="item.cpid">
+          <el-option
+            v-for="item in cpidList"
+            :key="item.cpid"
+            :label="item.cpid"
+            :value="item.cpid"
+          >
           </el-option>
         </el-select>
       </el-form-item>
       <el-form-item label="activeType">
-        <el-input style="width: 300px" v-model="form.activeType" placeholder="科创定义activeType,根据对照表填写"></el-input>
+        <el-input
+          style="width: 300px"
+          v-model="form.activeType"
+          placeholder="科创定义activeType,根据对照表填写"
+        ></el-input>
       </el-form-item>
       <el-form-item label="直冲阈值">
-        <el-input style="width: 300px" v-model="form.threshold" placeholder="如无阈值设置,则填0"></el-input>
+        <el-input
+          style="width: 300px"
+          v-model="form.threshold"
+          placeholder="如无阈值设置,则填0"
+        ></el-input>
         <div style="color: red">
           直冲阈值>0,开启订购自动领取会员,当日订购成功数满足阈值则开始自动领取该产品会员
         </div>
       </el-form-item>
       <el-form-item label="产品形态">
-        <el-select v-model="form.isCompositeProduct" placeholder="请选择" style="width: 300px">
+        <el-select
+          v-model="form.isCompositeProduct"
+          placeholder="请选择"
+          style="width: 300px"
+        >
           <el-option label="单产品" :value="0" />
           <el-option label="复合产品" :value="1" />
           <el-option label="多选一" :value="2" />
         </el-select>
       </el-form-item>
       <el-form-item label="产品原价">
-        <el-input style="width: 300px" v-model="form.originalPrice" placeholder="产品原价"></el-input>
+        <el-input
+          style="width: 300px"
+          v-model="form.originalPrice"
+          placeholder="产品原价"
+        ></el-input>
       </el-form-item>
       <el-form-item label="产品备注">
-        <el-input style="width: 300px" placeholder="产品备注" v-model="form.remark"></el-input>
+        <el-input
+          style="width: 300px"
+          placeholder="产品备注"
+          v-model="form.remark"
+        ></el-input>
       </el-form-item>
       <el-form-item label="会员信息">
-        <el-input style="width: 300px" placeholder="若无,则留空" v-model="form.memberName"></el-input>
+        <el-input
+          style="width: 300px"
+          placeholder="若无,则留空"
+          v-model="form.memberName"
+        ></el-input>
       </el-form-item>
       <el-form-item label="会员领取链接">
-        <el-input style="width: 300px" placeholder="会员领取链接" v-model="productJson[0].memberUrl"></el-input>
+        <el-input
+          style="width: 300px"
+          placeholder="会员领取链接"
+          v-model="productJson[0].memberUrl"
+        ></el-input>
       </el-form-item>
       <el-form-item label="激活指引">
-        <el-input style="width: 500px" placeholder="激活指引" v-model="form.flowJumpUrl"></el-input>
+        <el-input
+          style="width: 500px"
+          placeholder="激活指引"
+          v-model="form.flowJumpUrl"
+        ></el-input>
       </el-form-item>
 
       <el-form-item label="分享文案">
-        <el-input style="width: 500px" v-model="form.remark3" placeholder="微信分享副标题"></el-input>
+        <el-input
+          style="width: 500px"
+          v-model="form.remark3"
+          placeholder="微信分享副标题"
+        ></el-input>
       </el-form-item>
       <el-form-item label="页面背景配色">
         <el-row :gutter="10">
@@ -189,21 +238,46 @@
         >
       </el-form-item> -->
       <el-form-item label="炫彩UI">
-        <el-radio v-model="productJson[0].productV" label="1" @change="radioChange">V1</el-radio>
-        <el-radio v-model="productJson[0].productV" label="2" @change="radioChange">V2</el-radio>
+        <el-radio
+          v-model="productJson[0].productV"
+          label="1"
+          @change="radioChange"
+          >V1</el-radio
+        >
+        <el-radio
+          v-model="productJson[0].productV"
+          label="2"
+          @change="radioChange"
+          >V2</el-radio
+        >
       </el-form-item>
       <!-- 富文本编辑 -->
       <!-- 富文本编辑 -->
       <el-form-item>
         <el-tabs type="border-card" style="margin-top: 20px">
           <el-tab-pane label="产品订购说明">
-            <quill-editor ref="text" class="myQuillEditor" v-model="form.orderingInfo" :options="editorOption" />
+            <quill-editor
+              ref="text"
+              class="myQuillEditor"
+              v-model="form.orderingInfo"
+              :options="editorOption"
+            />
           </el-tab-pane>
           <el-tab-pane label="赠送话费说明">
-            <quill-editor ref="text" v-model="form.givePhoneInfo" class="myQuillEditor" :options="editorOption" />
+            <quill-editor
+              ref="text"
+              v-model="form.givePhoneInfo"
+              class="myQuillEditor"
+              :options="editorOption"
+            />
           </el-tab-pane>
           <el-tab-pane label="活动说明">
-            <quill-editor ref="text" v-model="form.manualInfo" class="myQuillEditor" :options="editorOption" />
+            <quill-editor
+              ref="text"
+              v-model="form.manualInfo"
+              class="myQuillEditor"
+              :options="editorOption"
+            />
           </el-tab-pane>
         </el-tabs>
       </el-form-item>
@@ -213,19 +287,22 @@
             <el-button style="width: 100%" @click="close()">取消</el-button>
           </el-col>
           <el-col :span="12">
-            <el-button type="primary" style="width: 100%" @click="addClick">确定
+            <el-button type="primary" style="width: 100%" @click="addClick"
+              >确定
             </el-button>
           </el-col>
         </el-row>
       </el-form-item>
     </el-form>
+    <a href="../api.js"></a>
   </div>
 </template>
 
 <script>
-import { post, get, del, put } from "@/api/common";
+import { addProductV2 } from "./api.js";
+import { listProduct } from "../api.js";
+import { get } from "@/api/common";
 import { quillEditor } from "vue-quill-editor";
-import Quill from "quill";
 import "quill/dist/quill.core.css";
 import "quill/dist/quill.snow.css";
 import "quill/dist/quill.bubble.css";
@@ -233,7 +310,7 @@ export default {
   components: {
     quillEditor,
   },
-  data () {
+  data() {
     return {
       imgapi: process.env.VUE_APP_BASE_IMG_API,
       addColors: {
@@ -362,7 +439,7 @@ export default {
       },
     };
   },
-  created () {
+  created() {
     document.title = "产品新增";
     let copyId = this.$route.query.copyId;
     if (copyId) {
@@ -409,17 +486,15 @@ export default {
       });
     }
   },
-  mounted () {
-    get("/product/cpid-info/page", {
-      pageSize: 100,
-      pageNum: 1,
-    }).then((res) => {
-      this.cpidList = res.data.list;
+  mounted() {
+    listProduct(this.searchForm).then((response) => {
+      this.cpidList = response.data.list;
     });
+
   },
   methods: {
     // 确认新增
-    addClick () {
+    addClick() {
       this.form.themeColor = JSON.stringify([
         this.addColors.thc.s,
         this.addColors.thc.e,
@@ -435,11 +510,9 @@ export default {
       this.form.guidancePic = JSON.stringify(this.guidancePic);
       this.$confirm("确定要提交吗?").then((_) => {
         if (!this.form.threshold) this.form.threshold = 0;
-        post("/product/info/create", this.form).then((res) => {
-
+        addProductV2(this.form).then((res) => {
           if (res.code === 0) {
             this.$message.success("新增成功");
-
             setTimeout(() => {
               this.$router.back();
             }, 1200);
@@ -447,31 +520,31 @@ export default {
         });
       });
     },
-    close () {
-      this.$router.back()();
+    close() {
+      this.$router.back();
     },
-    bannerSuccess (file, fileList) {
+    bannerSuccess(file, fileList) {
       this.bannerUrl = process.env.VUE_APP_BASE_IMG_URL + file.data;
       let arr = [];
       arr.push(file.data);
       this.form.bannerPics = JSON.stringify(arr);
     },
-    logoSuccess (file) {
+    logoSuccess(file) {
       this.logoUrl = process.env.VUE_APP_BASE_IMG_URL + file.data;
       this.form.logoPic = file.data;
     },
-    guideSuccessP (file) {
+    guideSuccessP(file) {
       this.guideUrlP = process.env.VUE_APP_BASE_IMG_URL + file.data;
       this.guidancePic.p = file.data;
     },
-    guideSuccessC (file) {
+    guideSuccessC(file) {
       this.guideUrlC = process.env.VUE_APP_BASE_IMG_URL + file.data;
       this.guidancePic.c = file.data;
     },
-    btnSuccess (file) {
+    btnSuccess(file) {
       this.productJson[0].btnUrl = process.env.VUE_APP_BASE_IMG_URL + file.data;
     },
-    radioChange () {
+    radioChange() {
       if (this.productJson[0].productV === "2") {
         this.form.givePhoneInfo =
           "<p><strong>产品</strong> xxxx流量会员合约包</p><p><strong>资费</strong> <strong>首月xx元,次月起xx元/月</strong></p><p><strong>内容</strong> xxGB定向流量+xxxx会员</p><p><strong>合约</strong> <strong>本产品合约期为6个月,第六个月方可退订,用户在合约期内解除合约时,需补足首月优惠金额,切在原合约期结束后方能再次退订</strong></p>";

+ 43 - 0
admin/src/views/produce/productV2/api.js

@@ -0,0 +1,43 @@
+import request from '@/utils/request'
+
+//获取产品管理列表
+export function listProductV2(query) {
+  return request({
+    url: 'product/info/page',
+    method: 'get',
+    params: query
+  })
+}
+//新增商品管理
+export function addProductV2(params) {
+    return request({
+      url: "/product/info/create",
+      method: 'post',
+      data: params
+    })
+  }
+
+//删除商品管理
+export function delProductV2(params) {
+    return request({
+      url: '/product/info/delete',
+      method: 'delete',
+      params
+    })
+  }
+//编辑一条数据
+export function editProductV2(params) {
+  return request({
+    url: '/product/info/update',
+    method: 'put',
+    data: params
+  })
+}
+//获取一条数据
+export function getOne(query) {
+  return request({
+    url: '/product/info/get',
+    method: 'get',
+    params: query
+  })
+}

+ 108 - 38
admin/src/views/produce/productV2/editProduct.vue

@@ -2,53 +2,102 @@
   <div class="edit">
     <el-form :model="form" label-width="100px">
       <el-form-item label="产品名称">
-        <el-input style="width: 300px" v-model="form.productName" placeholder="产品名称"></el-input>
+        <el-input
+          style="width: 300px"
+          v-model="form.productName"
+          placeholder="产品名称"
+        ></el-input>
       </el-form-item>
       <el-form-item label="spid">
-        <el-input style="width: 300px" v-model="form.spid" placeholder="spid"></el-input>
+        <el-input
+          style="width: 300px"
+          v-model="form.spid"
+          placeholder="spid"
+        ></el-input>
       </el-form-item>
       <el-form-item label="cpid">
         <el-select v-model="form.cpid" placeholder="cpid" style="width: 300px">
-          <el-option v-for="item in cpidList" :key="item.cpid" :label="item.cpid" :value="item.cpid">
+          <el-option
+            v-for="item in cpidList"
+            :key="item.cpid"
+            :label="item.cpid"
+            :value="item.cpid"
+          >
           </el-option>
         </el-select>
       </el-form-item>
       <el-form-item label="activeType">
-        <el-input style="width: 300px" v-model="form.activeType" placeholder="科创定义activeType,根据对照表填写"></el-input>
+        <el-input
+          style="width: 300px"
+          v-model="form.activeType"
+          placeholder="科创定义activeType,根据对照表填写"
+        ></el-input>
       </el-form-item>
       <el-form-item label="直冲阈值">
-        <el-input style="width: 300px" v-model="form.threshold" placeholder="如无阈值设置,则填0"></el-input>
+        <el-input
+          style="width: 300px"
+          v-model="form.threshold"
+          placeholder="如无阈值设置,则填0"
+        ></el-input>
         <div style="color: red">
           直冲阈值>0,开启订购自动领取会员,当日订购成功数满足阈值则开始自动领取该产品会员
         </div>
       </el-form-item>
       <el-form-item label="产品形态">
-        <el-select v-model="form.isCompositeProduct" placeholder="请选择" style="width: 300px">
+        <el-select
+          v-model="form.isCompositeProduct"
+          placeholder="请选择"
+          style="width: 300px"
+        >
           <el-option label="单产品" :value="0" />
           <el-option label="复合产品" :value="1" />
           <el-option label="多选一" :value="2" />
         </el-select>
       </el-form-item>
       <el-form-item label="产品原价">
-        <el-input style="width: 300px" v-model="form.originalPrice" placeholder="产品原价"></el-input>
+        <el-input
+          style="width: 300px"
+          v-model="form.originalPrice"
+          placeholder="产品原价"
+        ></el-input>
       </el-form-item>
       <el-form-item label="产品备注">
-        <el-input style="width: 300px" placeholder="产品备注" v-model="form.remark"></el-input>
+        <el-input
+          style="width: 300px"
+          placeholder="产品备注"
+          v-model="form.remark"
+        ></el-input>
       </el-form-item>
       <el-form-item label="会员信息">
-        <el-input style="width: 300px" placeholder="若无,则留空" v-model="form.memberName"></el-input>
+        <el-input
+          style="width: 300px"
+          placeholder="若无,则留空"
+          v-model="form.memberName"
+        ></el-input>
       </el-form-item>
       <el-form-item label="会员领取链接">
-        <el-input style="width: 300px" placeholder="会员领取链接" v-model="productJson[0].memberUrl"></el-input>
+        <el-input
+          style="width: 300px"
+          placeholder="会员领取链接"
+          v-model="productJson[0].memberUrl"
+        ></el-input>
       </el-form-item>
       <el-form-item label="激活指引">
-        <el-input style="width: 500px" placeholder="激活指引" v-model="form.flowJumpUrl"></el-input>
+        <el-input
+          style="width: 500px"
+          placeholder="激活指引"
+          v-model="form.flowJumpUrl"
+        ></el-input>
       </el-form-item>
       <!-- <el-form-item label="分享标题">
                     <el-input style="width: 500px" v-model="form.pageTitle"></el-input>
                   </el-form-item> -->
       <el-form-item label="分享文案">
-        <el-input style="width: 500px" v-model="form.remark3" placeholder="微信分享副标题"></el-input>
+        <el-input
+          style="width: 500px"
+          v-model="form.remark3"
+          placeholder="微信分享副标题"
+        ></el-input>
       </el-form-item>
       <el-form-item label="页面背景配色">
         <el-row :gutter="10">
@@ -201,13 +250,28 @@
       <el-form-item>
         <el-tabs type="border-card" style="margin-top: 20px">
           <el-tab-pane label="产品订购说明">
-            <quill-editor ref="text" class="myQuillEditor" v-model="form.orderingInfo" :options="editorOption" />
+            <quill-editor
+              ref="text"
+              class="myQuillEditor"
+              v-model="form.orderingInfo"
+              :options="editorOption"
+            />
           </el-tab-pane>
           <el-tab-pane label="赠送话费说明">
-            <quill-editor ref="text" v-model="form.givePhoneInfo" class="myQuillEditor" :options="editorOption" />
+            <quill-editor
+              ref="text"
+              v-model="form.givePhoneInfo"
+              class="myQuillEditor"
+              :options="editorOption"
+            />
           </el-tab-pane>
           <el-tab-pane label="活动说明">
-            <quill-editor ref="text" v-model="form.manualInfo" class="myQuillEditor" :options="editorOption" />
+            <quill-editor
+              ref="text"
+              v-model="form.manualInfo"
+              class="myQuillEditor"
+              :options="editorOption"
+            />
           </el-tab-pane>
         </el-tabs>
       </el-form-item>
@@ -217,7 +281,8 @@
             <el-button style="width: 100%" @click="close()">取消</el-button>
           </el-col>
           <el-col :span="12">
-            <el-button type="primary" style="width: 100%" @click="sureClick">确定
+            <el-button type="primary" style="width: 100%" @click="sureClick"
+              >确定
             </el-button>
           </el-col>
         </el-row>
@@ -227,7 +292,9 @@
 </template>
 
 <script>
-import { get, put } from "@/api/common";
+import { listProduct } from "../api.js";
+import { editProductV2, getOne } from "./api.js";
+import { get } from "@/api/common";
 import { quillEditor } from "vue-quill-editor";
 import "quill/dist/quill.core.css";
 import "quill/dist/quill.snow.css";
@@ -237,7 +304,7 @@ export default {
   components: {
     quillEditor,
   },
-  data () {
+  data() {
     return {
       id: "",
       imgapi: process.env.VUE_APP_BASE_IMG_API,
@@ -366,17 +433,15 @@ export default {
       },
     };
   },
-  created () {
+  created() {
     document.title = "产品修改";
-    get("/product/info/get", {
+    getOne({
       id: this.$route.query.ids,
       pageSize: 1,
     }).then((res) => {
       let row = res.data;
       row.threshold = row.threshold ? row.threshold : 0;
-
       this.form = row;
-
       this.addColors.thc = {
         s: JSON.parse(row.themeColor)[0],
         e: JSON.parse(row.themeColor)[1],
@@ -389,7 +454,6 @@ export default {
         ee: JSON.parse(row.bgColor)[3],
       };
 
-
       // row.threshold = row.threshold ? row.threshold : 0;
       // this.form = row;
 
@@ -418,16 +482,13 @@ export default {
       }
     });
   },
-  mounted () {
-    get("/product/cpid-info/page", {
-      pageSize: 100,
-      pageNum: 1,
-    }).then((res) => {
-      this.cpidList = res.data.list;
+  mounted() {
+    listProduct(this.searchForm).then((response) => {
+      this.cpidList = response.data.list;
     });
   },
   methods: {
-    sureClick () {
+    sureClick() {
       this.$confirm("确定要修改吗?")
         .then((_) => {
           this.form.themeColor = JSON.stringify([
@@ -443,41 +504,50 @@ export default {
           if (!this.form.threshold) this.form.threshold = 0;
           this.form.guidancePic = JSON.stringify(this.guidancePic);
           this.form.cacheSeatOne = JSON.stringify(this.productJson);
-          put("/product/info/update", this.form).then((res) => {
-            if (res.code === 0) this.$message.success("修改成功");
 
+          editProductV2(this.form).then((res) => {
+            console.log(11111111);
+            if (res.code === 0) this.$message.success("修改成功");
             setTimeout(() => {
               this.$router.back();
               this.editDialog = false;
             }, 400);
           });
+          // put("/product/info/update", this.form).then((res) => {
+          //   if (res.code === 0) this.$message.success("修改成功");
+
+          //   setTimeout(() => {
+          //     this.$router.back();
+          //     this.editDialog = false;
+          //   }, 400);
+          // });
         })
         .catch((_) => {
           this.editDialog = false;
         });
     },
-    close () {
+    close() {
       this.$router.back()();
     },
-    bannerSuccess (file) {
+    bannerSuccess(file) {
       this.bannerUrl = process.env.VUE_APP_BASE_IMG_URL + file.data;
       let arr = [];
       arr.push(file.data);
       this.form.bannerPics = JSON.stringify(arr);
     },
-    logoSuccess (file) {
+    logoSuccess(file) {
       this.logoUrl = process.env.VUE_APP_BASE_IMG_URL + file.data;
       this.form.logoPic = file.data;
     },
-    guideSuccessP (file) {
+    guideSuccessP(file) {
       this.guideUrlP = process.env.VUE_APP_BASE_IMG_URL + file.data;
       this.guidancePic.p = file.data;
     },
-    guideSuccessC (file) {
+    guideSuccessC(file) {
       this.guideUrlC = process.env.VUE_APP_BASE_IMG_URL + file.data;
       this.guidancePic.c = file.data;
     },
-    btnSuccess (file) {
+    btnSuccess(file) {
       this.productJson[0].btnUrl = process.env.VUE_APP_BASE_IMG_URL + file.data;
     },
   },

+ 104 - 57
admin/src/views/produce/productV2/productManagement.vue

@@ -4,23 +4,63 @@
       <el-row>
         <el-col :span="5">
           <span style="font-size: 14px; color: #606266; font-weight: bold">
-            产品名称:</span>
-          <el-input type="text" v-model="productName" style="width: 70%; margin-left: 15px" placeholder="产品名称" clearable size="small"></el-input>
+            产品名称:</span
+          >
+          <el-input
+            type="text"
+            v-model="productName"
+            style="width: 70%; margin-left: 15px"
+            placeholder="产品名称"
+            clearable
+            size="small"
+          ></el-input>
         </el-col>
         <el-col :span="5">
-          <span style="font-size: 14px; color: #606266; font-weight: bold">spid:</span>
-          <el-input style="width: 70%; margin-left: 15px" type="text" v-model="spid" placeholder="科创spid" size="small"></el-input>
+          <span style="font-size: 14px; color: #606266; font-weight: bold"
+            >spid:</span
+          >
+          <el-input
+            style="width: 70%; margin-left: 15px"
+            type="text"
+            v-model="spid"
+            placeholder="科创spid"
+            size="small"
+          ></el-input>
         </el-col>
         <el-col :span="3">
-          <el-button type="primary" @click="search" icon="el-icon-search" size="small">搜索</el-button>
-          <el-button @click="reset" size="small" icon="el-icon-refresh">重置</el-button>
+          <el-button
+            type="primary"
+            @click="search"
+            icon="el-icon-search"
+            size="small"
+            >搜索</el-button
+          >
+          <el-button @click="reset" size="small" icon="el-icon-refresh"
+            >重置</el-button
+          >
         </el-col>
       </el-row>
     </el-form>
-    <el-form class="formBorder" :model="productFrom" label-width="0px" style="margin-top: 20px">
+    <el-form
+      class="formBorder"
+      :model="productFrom"
+      label-width="0px"
+      style="margin-top: 20px"
+    >
       <el-form-item>
-        <el-button style="float: left" @click="addPush" size="mini" type="primary" plain icon="el-icon-plus"> 新增 </el-button>
-        <el-button style="float: left" @click="init" size="mini"> 刷新 </el-button>
+        <el-button
+          style="float: left"
+          @click="addPush"
+          size="mini"
+          type="primary"
+          plain
+          icon="el-icon-plus"
+        >
+          新增
+        </el-button>
+        <el-button style="float: left" @click="init" size="mini">
+          刷新
+        </el-button>
       </el-form-item>
 
       <el-form-item>
@@ -32,17 +72,43 @@
           <el-table-column label="时间" prop="createTime" />
           <el-table-column label="操作" prop="originalPrice">
             <template slot-scope="scope">
-              <el-button size="mini" type="text" icon="el-icon-edit" @click="edit(scope.row.id)">编辑</el-button>
-              <el-button size="mini" type="text" icon="el-icon-set-up" @click="addPush(scope.row)">复制</el-button>
-              <el-button size="mini" type="text" icon="el-icon-delete" @click="dele(scope.row.id)">删除</el-button>
+              <el-button
+                size="mini"
+                type="text"
+                icon="el-icon-edit"
+                @click="edit(scope.row.id)"
+                >编辑</el-button
+              >
+              <el-button
+                size="mini"
+                type="text"
+                icon="el-icon-set-up"
+                @click="addPush(scope.row)"
+                >复制</el-button
+              >
+              <el-button
+                size="mini"
+                type="text"
+                icon="el-icon-delete"
+                @click="dele(scope.row.id)"
+                >删除</el-button
+              >
             </template>
           </el-table-column>
-
         </el-table>
-
       </el-form-item>
       <el-form-item>
-        <el-pagination style="float: right" background @size-change="handleSizeChange" @current-change="handleCurrentChange" :current-page="productFrom.currenttPage" :page-sizes="[10, 20, 30, 40, 50]" layout="total, sizes, prev, pager, next, jumper" :total="productFrom.total" :page-size="productFrom.pageSize">
+        <el-pagination
+          style="float: right"
+          background
+          @size-change="handleSizeChange"
+          @current-change="handleCurrentChange"
+          :current-page="productFrom.currenttPage"
+          :page-sizes="[10, 20, 30, 40, 50]"
+          layout="total, sizes, prev, pager, next, jumper"
+          :total="productFrom.total"
+          :page-size="productFrom.pageSize"
+        >
         </el-pagination>
       </el-form-item>
     </el-form>
@@ -50,21 +116,15 @@
 </template>
 
 <script>
-import {
-  post,
-  get,
-  del,
-  put
-} from "@/api/common";
-import {
-  quillEditor
-} from "vue-quill-editor";
+import { listProductV2, delProductV2 } from "./api.js";
+import { get } from "@/api/common";
+import { quillEditor } from "vue-quill-editor";
 import getTime from "@/utils/getTime.js";
 export default {
   components: {
     quillEditor,
   },
-  data () {
+  data() {
     return {
       productName: "",
       spid: "",
@@ -76,16 +136,15 @@ export default {
       },
     };
   },
-  created () {
-    this.getProductv2List();
+  created() {
+    this.getList();
   },
   methods: {
-    init () {
-      this.getProductv2List()
+    init() {
+      this.getList();
     },
 
-
-    getTimeStr (timeStamp) {
+    getTimeStr(timeStamp) {
       var now = new Date(timeStamp),
         y = now.getFullYear(),
         m = ("0" + (now.getMonth() + 1)).slice(-2),
@@ -93,26 +152,25 @@ export default {
       return y + "-" + m + "-" + d + " " + now.toTimeString().substr(0, 8);
     },
 
-    getProductv2List () {
-      get("product/info/page").then((res) => {
+    getList() {
+      listProductV2().then((res) => {
         this.productFrom.productData = res.data.list;
         this.productFrom.total = res.data.total;
         this.productFrom.pageSize = res.data.pageSize;
         this.productFrom.currenttPage = res.data.pageNum;
-
         this.productFrom.productData.forEach((item) => {
           item.createTime = getTime(item.createTime);
         });
       });
     },
     // 编辑
-    edit (id) {
+    edit(id) {
       this.$router.push("/produce/productV2/editProduct?ids=" + id);
       // this.$router.push("../../produce/productV2/editProduct.vue");
     },
 
     // 新增/复制
-    addPush (row) {
+    addPush(row) {
       let id = row.id;
       // console.log(id);
       if (row.id) {
@@ -123,19 +181,15 @@ export default {
         this.$router.push("/produce/productV2/addProduct");
       }
     },
-    dele (id) {
+    dele(id) {
       // 删除
-      this.$confirm("确定要删除么?").then((_) => {
-        del("/product/info/delete", {
-          id: id
-        }).then((res) => {
-          if (res.code === 0) this.$message.success("删除成功");
-          this.getProductv2List();
-        });
+      delProductV2({ id: id }).then((res) => {
+        if (res.code === 0) this.$message.success("删除成功");
+        this.getList();
       });
     },
     // 搜索
-    search () {
+    search() {
       let data = {
         pageNo: 1,
         pageSize: 100,
@@ -143,27 +197,23 @@ export default {
         spid: this.spid,
       };
 
-
       if (!data.productName || !data.spid) {
-        this.$message.error("请输入内容")
+        this.$message.error("请输入内容");
       } else {
-        get("/product/info/page", data).then((res) => {
-
-
+        listProductV2(data).then((res) => {
           this.productFrom.productData = res.data.list;
           this.productFrom.total = res.data.total;
           this.productFrom.pageSize = res.data.pageSize;
           this.productFrom.currenttPage = res.data.pageNum;
         });
       }
-
     },
     // 重置
-    reset () {
+    reset() {
       this.productName = "";
       this.spid = "";
     },
-    handleSizeChange (val) {
+    handleSizeChange(val) {
       let data = {
         pageSize: val,
         pageNum: this.productFrom.pageNum,
@@ -176,7 +226,7 @@ export default {
         this.productFrom.currenttPage = res.data.pageNum;
       });
     },
-    handleCurrentChange (val) {
+    handleCurrentChange(val) {
       let data = {
         pageSize: this.productFrom.pageSize,
         pageNum: val,
@@ -191,7 +241,4 @@ export default {
     },
   },
 };
-
 </script>
-
-