chen hace 2 años
padre
commit
fa206171a7
Se han modificado 2 ficheros con 710 adiciones y 572 borrados
  1. 281 213
      admin/src/views/schemeV2/index.vue
  2. 429 359
      admin/src/views/schemeV2/schemeAdd.vue

+ 281 - 213
admin/src/views/schemeV2/index.vue

@@ -3,19 +3,36 @@
     <el-container>
       <!--搜索-->
       <el-header class="searchBox">
-        <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.strategyName" name="searchForm.strategyName" placeholder="策略名称" />
+            <el-input
+              v-model="searchForm.strategyName"
+              name="searchForm.strategyName"
+              placeholder="策略名称"
+            />
           </el-form-item>
           <el-form-item label="策略类型">
-            <el-select v-model="searchForm.strategyType" filterable placeholder="请选择">
+            <el-select
+              v-model="searchForm.strategyType"
+              filterable
+              placeholder="请选择"
+            >
               <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-select v-model="searchForm.strategyStatus" filterable placeholder="请选择">
+            <el-select
+              v-model="searchForm.strategyStatus"
+              filterable
+              placeholder="请选择"
+            >
               <el-option label="生效中" :value="1" />
               <el-option label="未生效" :value="0" />
             </el-select>
@@ -33,22 +50,46 @@
           <template #buttons>
             <vxe-button icon="fa fa-plus" @click="toAdd">新增</vxe-button>
             <vxe-button @click="init()">刷新</vxe-button>
-            <vxe-button status="primary" style="float: right" icon="fa fa-plus" @click="value5 = true">历史记录</vxe-button>
+            <vxe-button
+              status="primary"
+              style="float: right"
+              icon="fa fa-plus"
+              @click="value5 = true"
+              >历史记录</vxe-button
+            >
           </template>
         </vxe-toolbar>
-        <vxe-table border resizable keep-source show-overflow highlight-hover-row ref="xTable" :data="tableData"
-          :edit-config="{trigger: 'click', mode: 'cell', showStatus: true, }" @edit-closed="editClosedEvent">
+        <vxe-table
+          border
+          resizable
+          keep-source
+          show-overflow
+          highlight-hover-row
+          ref="xTable"
+          :data="tableData"
+          :edit-config="{ trigger: 'click', mode: 'cell', showStatus: true }"
+          @edit-closed="editClosedEvent"
+        >
           <vxe-table-column field="strategyName" title="策略名称" />
-          <vxe-table-column field="maskText" title="策略备注" :edit-render="{name: 'input'}" width="300" />
+          <vxe-table-column
+            field="maskText"
+            title="策略备注"
+            :edit-render="{ name: 'input' }"
+            width="300"
+          />
           <vxe-table-column field="strategyType" title="策略类型" width="100">
-            <template #default="{ row,_columnIndex}">
+            <template #default="{ row, _columnIndex }">
               {{ strategyType[row.strategyType].label }}
             </template>
           </vxe-table-column>
-          <vxe-table-column field="strategyStatus" title="状态" :edit-render="{name: '$select', options: strategyStatus}"
-            width="80" />
+          <vxe-table-column
+            field="strategyStatus"
+            title="状态"
+            :edit-render="{ name: '$select', options: strategyStatus }"
+            width="80"
+          />
           <vxe-table-column field="templateId" title="使用模板">
-            <template #default="{ row,_columnIndex}">
+            <template #default="{ row, _columnIndex }">
               {{ row.templateName }}
             </template>
           </vxe-table-column>
@@ -60,43 +101,80 @@
                 <vxe-button @click="cancelRowEvent(row)">取消</vxe-button>
               </template>
               <template v-else>
-                <vxe-button @click="toAdd(row)">编辑</vxe-button>
-                <vxe-button @click="toCopy(row)">复制</vxe-button>
-                <vxe-button @click="del(row)">删除</vxe-button>
+                <vxe-button @click="toEdit(row.id)">编辑</vxe-button>
+                <vxe-button @click="toCopy(row.id)">复制</vxe-button>
+                <vxe-button @click="del(row.id)">删除</vxe-button>
               </template>
             </template>
           </vxe-table-column>
         </vxe-table>
-        <vxe-pager :loading="loading" :current-page="searchForm.pageNum" :page-size="searchForm.pageSize"
+        <vxe-pager
+          :loading="loading"
+          :current-page="searchForm.pageNum"
+          :page-size="searchForm.pageSize"
           :total="searchForm.totalResult"
-          :layouts="['PrevPage', 'JumpNumber', 'NextPage', 'FullJump', 'Sizes', 'Total']"
-          @page-change="handlePageChange" />
+          :layouts="[
+            'PrevPage',
+            'JumpNumber',
+            'NextPage',
+            'FullJump',
+            'Sizes',
+            'Total',
+          ]"
+          @page-change="handlePageChange"
+        />
 
         <!-- 历史记录 -->
         <vxe-modal v-model="value5" width="60%" title="历史记录">
           <template #default>
-
             <vxe-toolbar>
               <template #buttons>
-                <vxe-input v-model="schemelogParam.notes" type="search" clearable placeholder="搜索操作记录"></vxe-input>
-                <vxe-input v-model="schemelogParam.userName" type="search" clearable placeholder="搜索操作人"></vxe-input>
+                <vxe-input
+                  v-model="schemelogParam.notes"
+                  type="search"
+                  clearable
+                  placeholder="搜索操作记录"
+                ></vxe-input>
+                <vxe-input
+                  v-model="schemelogParam.userName"
+                  type="search"
+                  clearable
+                  placeholder="搜索操作人"
+                ></vxe-input>
                 <vxe-button @click="searchEvent" content="搜索"></vxe-button>
               </template>
             </vxe-toolbar>
 
             <vxe-table auto-resize height="600" :data="schemelog">
-              <vxe-table-column field="createTime" title="时间"></vxe-table-column>
+              <vxe-table-column
+                field="createTime"
+                title="时间"
+              ></vxe-table-column>
               <vxe-table-column field="notes" title="操作记录">
                 <template slot-scope="props">
                   <div v-html="props.row.notes"></div>
                 </template>
               </vxe-table-column>
-              <vxe-table-column field="userName" title="操作人"></vxe-table-column>
+              <vxe-table-column
+                field="userName"
+                title="操作人"
+              ></vxe-table-column>
             </vxe-table>
-            <vxe-pager :loading="loading" :current-page="schemelogParam.pageNum" :page-size="schemelogParam.pageSize"
+            <vxe-pager
+              :loading="loading"
+              :current-page="schemelogParam.pageNum"
+              :page-size="schemelogParam.pageSize"
               :total="schemelogParam.totalResult"
-              :layouts="['PrevPage', 'JumpNumber', 'NextPage', 'FullJump', 'Sizes', 'Total']"
-              @page-change="handlePageChangeChannelog" />
+              :layouts="[
+                'PrevPage',
+                'JumpNumber',
+                'NextPage',
+                'FullJump',
+                'Sizes',
+                'Total',
+              ]"
+              @page-change="handlePageChangeChannelog"
+            />
           </template>
         </vxe-modal>
       </el-main>
@@ -105,211 +183,201 @@
 </template>
 
 <script>
-  import {
-    post,
-    get
-  } from '@/api/common'
-
-  export default {
-    name: 'Index',
-    data() {
-      return {
-        //  搜索相关内容
-        searchForm: {
-          channelKey: '',
-          strategyName: '',
-          strategyType: '',
-          strategyStatus: '',
-          pageNum: 1,
-          pageSize: 10,
-          totalResult: 0
+import { post, get, del } from "@/api/common";
+import getTime from "@/utils/getTime.js";
+export default {
+  name: "Index",
+  data() {
+    return {
+      //  搜索相关内容
+      searchForm: {
+        channelKey: "",
+        strategyName: "",
+        strategyType: "",
+        strategyStatus: "",
+        pageNum: 1,
+        pageSize: 10,
+        totalResult: 0,
+      },
+      // 表格数据
+      loading: false,
+      tableData: [],
+      templateList: [],
+      strategyStatus: [
+        {
+          label: "生效中",
+          value: "1",
         },
-        // 表格数据
-        loading: false,
-        tableData: [],
-        templateList: [],
-        strategyStatus: [{
-            label: '生效中',
-            value: '1'
-          },
-          {
-            label: '未生效',
-            value: '0'
-          }
-        ],
-        strategyType: [{
-            label: '基本策略',
-            value: '0'
-          },
-          {
-            label: '活动策略',
-            value: '1'
-          },
-          {
-            label: '测试策略',
-            value: '2'
-          }
-        ],
-
-        value5: false,
-        pushdata: false,
-        pushdataDate: '',
-        schemelog: [],
-        schemelogList: [],
-        filterName1: '',
-        schemelogParam: {
-          pageNum: 1,
-          pageSize: 10,
-          totalResult: 0
+        {
+          label: "未生效",
+          value: "0",
         },
-      }
+      ],
+      strategyType: [
+        {
+          label: "基本策略",
+          value: "0",
+        },
+        {
+          label: "活动策略",
+          value: "1",
+        },
+        {
+          label: "测试策略",
+          value: "2",
+        },
+      ],
+
+      value5: false,
+      pushdata: false,
+      pushdataDate: "",
+      schemelog: [],
+      schemelogList: [],
+      filterName1: "",
+      schemelogParam: {
+        pageNum: 1,
+        pageSize: 10,
+        totalResult: 0,
+      },
+    };
+  },
+  mounted() {
+    this.init();
+  },
+  methods: {
+    toEdit(id) {
+      this.$router.push("/schemeV2/schemeAdd?ids=" + id);
     },
-    mounted() {
-      get('/strategy/strategy-info/page', {
-        'pageSize': 100,
-        'pageNum': 1
-      }).then(res => {
-        res.data.list.map(res => {
-          res.templatePhoto = process.env.VUE_APP_BASE_IMG_URL + res.templatePhoto
-          res.label = res.templateName
-          res.value = res.id
-        })
-        this.templateList = res.data.list
-      })
-      this.init()
+
+    getTimeStr(timeStamp) {
+      var now = new Date(timeStamp),
+        y = now.getFullYear(),
+        m = ("0" + (now.getMonth() + 1)).slice(-2),
+        d = ("0" + now.getDate()).slice(-2);
+      return y + "-" + m + "-" + d + " " + now.toTimeString().substr(0, 8);
     },
-    methods: {
-      init() {
-        // get('/strategyInfoNew/page', this.searchForm).then(res => {
-        //   console.log(res)
-        //   if (res.data) {
-        //     this.tableData = res.data.list
-        //     this.searchForm.totalResult = res.data.total
-        //   } else {
-        //     this.tableData = []
-        //     this.searchForm.totalResult = 0
-        //   }
+    init() {
+      get("/strategy/strategy-info/page", {
+        pageSize: 100,
+        pageNum: 1,
+      }).then((res) => {
+        res.data.list.map((res) => {
+          res.templatePhoto =
+            process.env.VUE_APP_BASE_IMG_URL + res.templatePhoto;
+          res.label = res.templateName;
+          res.value = res.id;
+        });
 
-        // })
-      },
-      editClosedEvent({
-        row,
-        column
-      }) {
-        const $table = this.$refs.xTable
-        const field = column.property
-        const cellValue = row[field]
-        // 判断单元格值是否被修改
-        if ($table.isUpdateByRow(row, field)) {
-          setTimeout(() => {
-            let param = {}
-            param[field] = cellValue
-            post('/strategyInfoNew/update/' + row.id, row).then(res => {
-              this.$message({
-                message: res.message,
-                type: 'success'
-              });
-            })
-            // 局部更新单元格为已保存状态
-            $table.reloadRow(row, null, field)
-          }, 300)
-        }
-      },
-      reset(formName) { // 重置
-        // this.searchForm = {}
-        // get('/strategyInfoNew/page', {}).then(res => {
-        //   this.tableData = res.data.list
-        // })
-      },
-      toAdd(e) {
-      this.$router.push("/schemeV2/schemeAdd")
-      },
-      toCopy(e) {
-        const routeUrl = this.$router.resolve({
-          path: '/schemeV2/schemeAdd',
-          query: {
-            copyId: e.id
-          }
+        this.tableData = res.data.list;
+        this.tableData.forEach((item) => {
+          item.createTime = getTime(item.createTime);
+        });
+      });
+    },
+    editClosedEvent({ row, column }) {
+      const $table = this.$refs.xTable;
+      const field = column.property;
+      const cellValue = row[field];
+      // 判断单元格值是否被修改
+      if ($table.isUpdateByRow(row, field)) {
+        setTimeout(() => {
+          let param = {};
+          param[field] = cellValue;
+          post("/strategyInfoNew/update/" + row.id, row).then((res) => {
+            this.$message({
+              message: res.message,
+              type: "success",
+            });
+          });
+          // 局部更新单元格为已保存状态
+          $table.reloadRow(row, null, field);
+        }, 300);
+      }
+    },
+    reset(formName) {
+      // 重置
+      // this.searchForm = {}
+      // get('/strategyInfoNew/page', {}).then(res => {
+      //   this.tableData = res.data.list
+      // })
+    },
+    toAdd() {
+      this.$router.push("/schemeV2/schemeAdd");
+    },
+    toCopy(id) {
+         this.$router.push("/schemeV2/schemeAdd?copyId=" + id);
+    },
+    del(id) {
+      this.$confirm("此操作将永久删除该文件, 是否继续?", "提示", {
+        confirmButtonText: "确定",
+        cancelButtonText: "取消",
+        type: "warning",
+      })
+        .then(() => {
+          // const $table = this.$refs.xTable;
+          // $table.remove(row);
+          del("/strategy/strategy-info/delete", { id }).then((res) => {
+            this.init();
+          });
         })
-        window.open(routeUrl.href, '_blank')
-      },
-      del(row) {
-        this.$confirm('此操作将永久删除该文件, 是否继续?', '提示', {
-          confirmButtonText: '确定',
-          cancelButtonText: '取消',
-          type: 'warning'
-        }).then(() => {
-          const $table = this.$refs.xTable
-          $table.remove(row)
-          post('/strategyInfoNew/delete', {
-            'ids': [row.id]
-          }).then(res => {})
-        }).catch(() => {
+        .catch(() => {
           this.$message({
-            type: 'info',
-            message: '已取消删除'
+            type: "info",
+            message: "已取消删除",
           });
         });
-      },
-      handlePageChange({
-        currentPage,
-        pageSize
-      }) {
-        this.searchForm.pageNum = currentPage
-        this.searchForm.pageSize = pageSize
-        this.init()
-      },
-      handlePageChangeChannelog({
-        currentPage,
-        pageSize
-      }) {
-        this.schemelogParam.pageNum = currentPage
-        this.schemelogParam.pageSize = pageSize
-        get('/strategyInfoNew/getlog', this.schemelogParam).then(res => {
-          this.schemelog = res.data.list
-          this.schemelogParam.totalResult = res.data.total
-        })
-      },
-      searchEvent() {
-        get('/strategyInfoNew/getlog', this.schemelogParam).then(res => {
-          this.schemelog = res.data.list
-          this.schemelogParam.totalResult = res.data.total
-        })
-      }
-    }
-  }
-
+    },
+    handlePageChange({ currentPage, pageSize }) {
+      this.searchForm.pageNum = currentPage;
+      this.searchForm.pageSize = pageSize;
+      this.init();
+    },
+    handlePageChangeChannelog({ currentPage, pageSize }) {
+      this.schemelogParam.pageNum = currentPage;
+      this.schemelogParam.pageSize = pageSize;
+      get("/strategyInfoNew/getlog", this.schemelogParam).then((res) => {
+        this.schemelog = res.data.list;
+        this.schemelogParam.totalResult = res.data.total;
+      });
+    },
+    searchEvent() {
+      get("/strategyInfoNew/getlog", this.schemelogParam).then((res) => {
+        this.schemelog = res.data.list;
+        this.schemelogParam.totalResult = res.data.total;
+      });
+    },
+  },
+};
 </script>
 
 <style lang="scss">
-  .searchBox {
-    background-color: #fff;
-    border-radius: 4px;
-    box-shadow: #bfbfbf 0 0 2px;
-    height: unset !important;
-    padding: 10px 10px;
+.searchBox {
+  background-color: #fff;
+  border-radius: 4px;
+  box-shadow: #bfbfbf 0 0 2px;
+  height: unset !important;
+  padding: 10px 10px;
 
-    form {
-      margin: auto;
+  form {
+    margin: auto;
 
-      .el-form-item {
-        margin: 5px 5px;
-      }
+    .el-form-item {
+      margin: 5px 5px;
     }
   }
+}
 
-  .tableBox {
-    margin-top: 10px;
-    background-color: #fff;
-    border-radius: 4px;
-    box-shadow: #bfbfbf 0 0 2px;
+.tableBox {
+  margin-top: 10px;
+  background-color: #fff;
+  border-radius: 4px;
+  box-shadow: #bfbfbf 0 0 2px;
 
-    .block {
-      .el-pagination {
-        margin-top: 30px;
-        float: right;
-      }
+  .block {
+    .el-pagination {
+      margin-top: 30px;
+      float: right;
     }
   }
-
+}
 </style>

+ 429 - 359
admin/src/views/schemeV2/schemeAdd.vue

@@ -251,19 +251,29 @@
                   </el-form-item>
                 </el-col>
               </el-row>
-              <!-- <el-row :gutter="20">
+              <el-row :gutter="20">
                 <el-col :span="6">
                   <el-form-item label="启用走马灯">
-                    <el-switch style="width: 300px" v-model="extJson.isZoetrope" active-text="启用" inactive-text="不启用"
-                      active-value="1" inactive-value="0" />
+                    <el-switch
+                      style="width: 300px"
+                      v-model="extJson.isZoetrope"
+                      active-text="启用"
+                      inactive-text="不启用"
+                      active-value="1"
+                      inactive-value="0"
+                    />
                   </el-form-item>
                 </el-col>
                 <el-col :span="18">
                   <el-form-item label="走马灯文本">
-                    <el-input type="textarea" :autosize="{ minRows: 2, maxRows: 4}" v-model="extJson.zoetropeText" />
+                    <el-input
+                      type="textarea"
+                      :autosize="{ minRows: 2, maxRows: 4 }"
+                      v-model="extJson.zoetropeText"
+                    />
                   </el-form-item>
                 </el-col>
-              </el-row> -->
+              </el-row>
               <el-row :gutter="20">
                 <el-col :span="6">
                   <el-form-item label="订购记录">
@@ -505,47 +515,92 @@
               </el-form-item>
 
               <!-- <el-form-item label="活动海报">
-                <el-upload class="avatar-uploader" :action="imgapi" :show-file-list="false"
-                  :on-success="changePromotionPicposterPhoto">
+                <el-upload
+                  class="avatar-uploader"
+                  :action="imgapi"
+                  :show-file-list="false"
+                  :on-success="changePromotionPicposterPhoto"
+                >
                   <div v-if="form.posterPhoto">
-                    <img style="float: left" :src="form.posterPhoto" class="avatar" />
+                    <img
+                      style="float: left"
+                      :src="form.posterPhoto"
+                      class="avatar"
+                    />
                   </div>
                   <el-button v-else size="small" type="primary">
                     点击上传
                   </el-button>
                 </el-upload>
-                <div v-if="form.posterPhoto" style="display: inline-block; color: #20a0ff; padding-left: 20px"
-                  @click="form.posterPhoto = ''">
+                <div
+                  v-if="form.posterPhoto"
+                  style="
+                    display: inline-block;
+                    color: #20a0ff;
+                    padding-left: 20px;
+                  "
+                  @click="form.posterPhoto = ''"
+                >
                   删除
                 </div>
-              </el-form-item> -->
-              <!-- <el-form-item label="活动logo">
-                <el-upload class="avatar-uploader" :action="imgapi" :show-file-list="false"
-                  :on-success="changePromotionPicactivityLogo">
+              </el-form-item>
+              <el-form-item label="活动logo">
+                <el-upload
+                  class="avatar-uploader"
+                  :action="imgapi"
+                  :show-file-list="false"
+                  :on-success="changePromotionPicactivityLogo"
+                >
                   <div v-if="form.activityLogo">
-                    <img style="float: left" :src="form.activityLogo" class="avatar" />
+                    <img
+                      style="float: left"
+                      :src="form.activityLogo"
+                      class="avatar"
+                    />
                   </div>
                   <el-button v-else size="small" type="primary">
                     点击上传
                   </el-button>
                 </el-upload>
-                <div v-if="form.activityLogo" style="display: inline-block; color: #20a0ff; padding-left: 20px"
-                  @click="form.activityLogo = ''">
+                <div
+                  v-if="form.activityLogo"
+                  style="
+                    display: inline-block;
+                    color: #20a0ff;
+                    padding-left: 20px;
+                  "
+                  @click="form.activityLogo = ''"
+                >
                   删除
                 </div>
-              </el-form-item> -->
-              <!-- <el-form-item label="推广图">
-                <el-upload class="avatar-uploader" :action="imgapi" :show-file-list="false"
-                  :on-success="changePromotionPicpromotePhoto">
+              </el-form-item>
+              <el-form-item label="推广图">
+                <el-upload
+                  class="avatar-uploader"
+                  :action="imgapi"
+                  :show-file-list="false"
+                  :on-success="changePromotionPicpromotePhoto"
+                >
                   <div v-if="form.promotePhoto">
-                    <img style="float: left" :src="form.promotePhoto" class="avatar" />
+                    <img
+                      style="float: left"
+                      :src="form.promotePhoto"
+                      class="avatar"
+                    />
                   </div>
                   <el-button v-else size="small" type="primary">
                     点击上传
                   </el-button>
                 </el-upload>
-                <div v-if="form.promotePhoto" style="display: inline-block; color: #20a0ff; padding-left: 20px"
-                  @click="form.promotePhoto = ''">
+                <div
+                  v-if="form.promotePhoto"
+                  style="
+                    display: inline-block;
+                    color: #20a0ff;
+                    padding-left: 20px;
+                  "
+                  @click="form.promotePhoto = ''"
+                >
                   删除
                 </div>
               </el-form-item> -->
@@ -644,7 +699,7 @@
 </template>
 
 <script>
-import { post, get } from "@/api/common";
+import { post, get, put } from "@/api/common";
 function getArrayClassification(params) {
   var options = {
     data: params.data,
@@ -664,8 +719,6 @@ function getArrayClassification(params) {
   return tree;
 }
 
-
-
 const XEUtils = require("xe-utils");
 const weekOptions = ["周日", "周一", "周二 ", "周三", "周四", "周五", "周六"];
 export default {
@@ -701,7 +754,7 @@ export default {
         templateId: 104,
         primaryProductId: "",
         strategyStatus: "1",
-        extJson: {},
+        extJson: "",
         maskText: "",
         maskText2: "",
         activityUuid: "",
@@ -712,7 +765,10 @@ export default {
         recommendStrategyIds: [],
         unsubscribeStrategyIds: [""],
         linkUrl: "",
+        id: "",
       },
+      text: {},
+      id: null,
       oldform: {},
       //扩展字段
       extJson: {
@@ -813,144 +869,157 @@ export default {
     };
   },
   watch: {
-    // datetimerange(val) {
-    //   if (val) {
-    //     this.rulesform.activeStartDate = val[0];
-    //     this.rulesform.activeEndDate = val[1];
-    //   } else {
-    //     this.rulesform.activeStartDate = "";
-    //     this.rulesform.activeEndDate = "";
-    //   }
-    // },
-    // timerange(val) {
-    //   this.rulesform.activeStartTime = val[0];
-    //   this.rulesform.activeEndTime = val[1];
-    // },
-    // checkedWeeks(val) {
-    //   this.rulesform.weeks = val
-    //     .map((i) => weekOptions.findIndex((j) => j == i))
-    //     .sort()
-    //     .toString();
-    // },
+    datetimerange(val) {
+      console.log(val);
+      if (val) {
+        this.rulesform.activeStartDate = val[0];
+        this.rulesform.activeEndDate = val[1];
+        console.log(val[1], this.rulesform, 111);
+      } else {
+        this.rulesform.activeStartDate = "";
+        this.rulesform.activeEndDate = "";
+      }
+    },
+    timerange(val) {
+      console.log(val);
+      this.rulesform.activeStartTime = val[0];
+      this.rulesform.activeEndTime = val[1];
+    },
+    checkedWeeks(val) {
+      console.log(val);
+      this.rulesform.weeks = val
+        .map((i) => weekOptions.findIndex((j) => j == i))
+        .sort()
+        .toString();
+    },
   },
   created() {
     document.title = "编辑策略";
   },
   mounted() {
-    // if (this.$route.query.id) {
-    //   get("/strategy/strategy-info/page", {
-    //     id: this.$route.query.id,
-    //   }).then((res) => {
-    //     res = res.data.list[0];
-    //     this.oldform = JSON.parse(JSON.stringify(res));
-    //     this.form = {
-    //       strategyName: res.strategyName,
-    //       strategyType: res.strategyType,
-    //       templateId: res.templateId,
-    //       strategyStatus: res.strategyStatus.toString(),
-    //       primaryProductId: res.primaryProductId,
-    //       maskText: res.maskText,
-    //       activityUuid: res.activityUuid,
-    //       activityType: res.activityType,
-    //       posterPhoto: res.posterPhoto,
-    //       activityLogo: res.activityLogo,
-    //       promotePhoto: res.promotePhoto,
-    //       recommendStrategyIds: res.recommendStrategyIds,
-    //       unsubscribeStrategyIds: res.unsubscribeStrategyIds
-    //         ? res.unsubscribeStrategyIds
-    //         : [],
-    //       viceProductIds: res.viceProductIds,
-    //       linkUrl: res.linkUrl,
-    //       directCharge: res.directCharge,
-    //     };
-    //     if (res.extJson) {
-    //       this.extJson = JSON.parse(res.extJson);
-    //       if (this.extJson.dispose) {
-    //         this.disposeVal = this.extJson.dispose.split(",");
-    //       }
-    //     }
-    //     if (res.activeStartDate) {
-    //       this.datetimerange = [res.activeStartDate, res.activeEndDate];
-    //     }
-    //     if (res.weeks) {
-    //       let checkedWeeks = res.weeks.split(",");
-    //       checkedWeeks.forEach((item) => {
-    //         this.checkedWeeks.push(weekOptions[item]);
-    //       });
-    //     }
-    //     let checkedchannel = [];
-    //     res.channelInfoDatas.forEach((item) => {
-    //       checkedchannel.push([item.firstChannelId, item.secondChannelId]);
-    //     });
-    //     this.checkedchannel = checkedchannel;
-    //     this.rulesform = {
-    //       activeStartTime: res.activeStartTime,
-    //       activeEndTime: res.activeEndTime,
-    //       strategyId: this.$route.query.id,
-    //       firstChannelId: res.firstChannelId,
-    //       secondChannelIds: res.secondChannelIds,
-    //     };
-    //   });
-    //   this.btn = "编辑保存";
-    // }
-    // if (this.$route.query.copyId) {
-    //   get('/strategy/strategy-info/page', {
-    //     'id': this.$route.query.copyId
-    //   }).then(res => {
-    //     res = res.data.list[0];
-    //     this.oldform = JSON.parse(JSON.stringify(res))
-    //     this.form = {
-    //       strategyName: res.strategyName + " 副本",
-    //       strategyType: res.strategyType,
-    //       templateId: res.templateId,
-    //       strategyStatus: res.strategyStatus.toString(),
-    //       primaryProductId: res.primaryProductId,
-    //       maskText: res.maskText,
-    //       activityUuid: res.activityUuid,
-    //       activityType: res.activityType,
-    //       posterPhoto: res.posterPhoto,
-    //       activityLogo: res.activityLogo,
-    //       promotePhoto: res.promotePhoto,
-    //       recommendStrategyIds: res.recommendStrategyIds,
-    //       unsubscribeStrategyIds: res.unsubscribeStrategyIds ? res.unsubscribeStrategyIds : [],
-    //       viceProductIds: res.viceProductIds,
-    //       linkUrl: res.linkUrl
-    //     };
-    //     if (res.extJson) {
-    //       this.extJson = JSON.parse(res.extJson)
-    //       if (this.extJson.dispose) {
-    //         this.disposeVal = this.extJson.dispose.split(',')
-    //       }
-    //     }
-    //     if (res.activeStartDate) {
-    //       this.datetimerange = [res.activeStartDate, res.activeEndDate]
-    //     }
-    //     if (res.weeks) {
-    //       let checkedWeeks = res.weeks.split(",");
-    //       checkedWeeks.forEach(item => {
-    //         this.checkedWeeks.push(weekOptions[item])
-    //       })
-    //     }
-    //     let checkedchannel = [];
-    //     res.channelInfoDatas.forEach(item => {
-    //       checkedchannel.push([item.firstChannelId, item.secondChannelId])
-    //     });
-    //     this.checkedchannel = checkedchannel;
-    //     this.rulesform = {
-    //       activeStartTime: res.activeStartTime,
-    //       activeEndTime: res.activeEndTime,
-    //       strategyId: this.$route.query.id,
-    //       firstChannelId: res.firstChannelId,
-    //       secondChannelIds: res.secondChannelIds,
-    //     }
-    //   });
-    // }
-    // get("/product/info/page", {
-    //   pageSize: 100,
-    //   pageNum: 1,
-    // }).then((res) => {
-    //   this.productInfoList = res.data.list;
-    // });
+    // console.log(this.$route.query.ids);
+    if (this.$route.query.ids) {
+      get("/strategy/strategy-info/list", {
+        ids: this.$route.query.ids,
+      }).then((res) => {
+        console.log(res);
+        res = res.data[0];
+        this.oldform = JSON.parse(JSON.stringify(res));
+        this.form = {
+        
+          strategyName: res.strategyName,
+          strategyType: res.strategyType,
+          templateId: res.templateId,
+          strategyStatus: res.strategyStatus.toString(),
+          primaryProductId: res.primaryProductId,
+          maskText: res.maskText,
+          activityUuid: res.activityUuid,
+          activityType: res.activityType,
+          posterPhoto: res.posterPhoto,
+          activityLogo: res.activityLogo,
+          promotePhoto: res.promotePhoto,
+          recommendStrategyIds: res.recommendStrategyIds,
+          unsubscribeStrategyIds: res.unsubscribeStrategyIds
+            ? res.unsubscribeStrategyIds
+            : [],
+          viceProductIds: res.viceProductIds,
+          linkUrl: res.linkUrl,
+          directCharge: res.directCharge,
+          id: res.id,
+        };
+        if (res.extJson) {
+          this.extJson = JSON.parse(res.extJson);
+          if (this.extJson.dispose) {
+            this.disposeVal = this.extJson.dispose.split(",");
+          }
+        }
+        if (res.activeStartDate) {
+          this.datetimerange = [res.activeStartDate, res.activeEndDate];
+        }
+        if (res.weeks) {
+          let checkedWeeks = res.weeks.split(",");
+          checkedWeeks.forEach((item) => {
+            this.checkedWeeks.push(weekOptions[item]);
+          });
+        }
+        // // let checkedchannel = [];
+        // console.log(res);
+        // res.channelInfoDatas.forEach((item) => {
+        //   checkedchannel.push([item.firstChannelId, item.secondChannelId]);
+        // });
+        // this.checkedchannel = checkedchannel;
+        
+        this.rulesform = {
+          activeStartTime: res.activeStartTime,
+          activeEndTime: res.activeEndTime,
+          strategyId: this.$route.query.id,
+          firstChannelId: res.firstChannelId,
+          secondChannelIds: res.secondChannelIds,
+        };
+      });
+      this.btn = "编辑保存";
+    }
+    if (this.$route.query.copyId) {
+      get("/strategy/strategy-info/list", {
+        ids: this.$route.query.copyId,
+      }).then((res) => {
+        console.log(res);
+        res = res.data[0];
+        this.oldform = JSON.parse(JSON.stringify(res));
+        this.form = {
+          strategyName: res.strategyName + " 副本",
+          strategyType: res.strategyType,
+          templateId: res.templateId,
+          strategyStatus: res.strategyStatus.toString(),
+          primaryProductId: res.primaryProductId,
+          maskText: res.maskText,
+          activityUuid: res.activityUuid,
+          activityType: res.activityType,
+          posterPhoto: res.posterPhoto,
+          activityLogo: res.activityLogo,
+          promotePhoto: res.promotePhoto,
+          recommendStrategyIds: res.recommendStrategyIds,
+          unsubscribeStrategyIds: res.unsubscribeStrategyIds
+            ? res.unsubscribeStrategyIds
+            : [],
+          viceProductIds: res.viceProductIds,
+          linkUrl: res.linkUrl,
+        };
+        if (res.extJson) {
+          this.extJson = JSON.parse(res.extJson);
+          if (this.extJson.dispose) {
+            this.disposeVal = this.extJson.dispose.split(",");
+          }
+        }
+        if (res.activeStartDate) {
+          this.datetimerange = [res.activeStartDate, res.activeEndDate];
+        }
+        if (res.weeks) {
+          let checkedWeeks = res.weeks.split(",");
+          checkedWeeks.forEach((item) => {
+            this.checkedWeeks.push(weekOptions[item]);
+          });
+        }
+        let checkedchannel = [];
+        res.channelInfoDatas.forEach((item) => {
+          checkedchannel.push([item.firstChannelId, item.secondChannelId]);
+        });
+        this.checkedchannel = checkedchannel;
+        this.rulesform = {
+          activeStartTime: res.activeStartTime,
+          activeEndTime: res.activeEndTime,
+          strategyId: this.$route.query.id,
+          firstChannelId: res.firstChannelId,
+          secondChannelIds: res.secondChannelIds,
+        };
+      });
+    }
+    get("/product/info/page", {
+      pageSize: 100,
+      pageNum: 1,
+    }).then((res) => {
+      this.productInfoList = res.data.list;
+    });
     //获取模板列表
     // get('/templateInfo/page', {
     //   'pageSize': 9999,
@@ -961,203 +1030,204 @@ export default {
     //   });
     //   this.templateList = res.data.list
     // });
-    // get("/strategy/strategy-info/page", {
-    //   pageSize: 100,
-    //   pageNum: 1,
-    // }).then((res) => {
-    //   this.strategyInfoNewList = res.data.list;
-    // });
-    // get("/channel/info/page", {
-    //   pageSize: 100,
-    //   pageNum: 1,
-    // }).then((res) => {
-    //   this.options = getArrayClassification({
-    //     data: res.data.list,
-    //     parent: "parentId",
-    //     id: "id",
-    //     child: "children",
-    //   });
-    //   this.props = {
-    //     multiple: true,
-    //     label: "channelName",
-    //     value: "id",
-    //   };
-    // });
+    get("/strategy/strategy-info/page", {
+      pageSize: 100,
+      pageNum: 1,
+    }).then((res) => {
+      this.strategyInfoNewList = res.data.list;
+    });
+    get("/channel/info/page", {
+      pageSize: 100,
+      pageNum: 1,
+    }).then((res) => {
+      this.options = getArrayClassification({
+        data: res.data.list,
+        parent: "parentId",
+        id: "id",
+        child: "children",
+      });
+      this.props = {
+        multiple: true,
+        label: "channelName",
+        value: "id",
+      };
+    });
   },
   methods: {
-    onSubmit() {
-      post("/strategy/strategy-info/create",this.form).then((res)=>{
-        console.log(res);
-      })
-    },
-
-    // onSubmit: function (formName) {
-    //   // this.$confirm(
-    //   //   "您确定编辑该策略?当前操作会影响所有上线该策略的渠道",
-    //   //   "提示",
-    //   //   {
-    //   //     confirmButtonText: "确定",
-    //   //     cancelButtonText: "取消",
-    //   //     type: "warning",
-    //   //   }
-    //   // )
-    //   //   .then(() => {
-    //   //     this.$refs[formName].validate((valid) => {
-    //   //       console.log(valid);
-    //   //       if (valid) {
-    //   //         let ids = this.form.unsubscribeStrategyIds[0];
-    //   //         this.form.unsubscribeStrategyIds =
-    //   //           ids !== "" && ids !== [] && ids ? [ids] : [];
-    //   //         let template = this.templateList.find((n) => {
-    //   //           return n.id === this.form.templateId;
-    //   //         });
-    //   //         this.extJson.templateCode = template.templateCode;
-    //   //         if (
-    //   //           this.extJson.isMask === "1" &&
-    //   //           (!this.extJson.maskText || this.extJson.maskText === "")
-    //   //         ) {
-    //   //           this.$message.error("遮罩文案未填写");
-    //   //           return false;
-    //   //         }
-    //   //         // if (this.extJson.isZoetrope === '1' && (!this.extJson.zoetropeText || this.extJson
-    //   //         //     .zoetropeText === "")) {
-    //   //         //   this.$message.error('走马灯文案未填写');
-    //   //         //   return false
-    //   //         // }
-    //   //         this.form.extJson = JSON.stringify(this.extJson);
-    //   //         this.rulesform.weeks = this.checkedWeeks
-    //   //           .map((i) => weekOptions.findIndex((j) => j == i))
-    //   //           .sort()
-    //   //           .toString();
+    onSubmit: function (formName) {
+      this.$confirm(
+        "您确定编辑该策略?当前操作会影响所有上线该策略的渠道",
+        "提示",
+        {
+          confirmButtonText: "确定",
+          cancelButtonText: "取消",
+          type: "warning",
+        }
+      )
+        .then(() => {
+          this.$refs[formName].validate((valid) => {
+            console.log(valid);
+            if (valid) {
+              console.log(1111);
+              // let ids = this.form.unsubscribeStrategyIds[0];
+              // this.form.unsubscribeStrategyIds =
+              //   ids !== "" && ids !== [] && ids ? [ids] : [];
+              // let template = this.templateList.find((n) => {
+              //   return n.id === this.form.templateId;
+              // });
+              // this.extJson.templateCode = template.templateCode;
+              // if (
+              //   this.extJson.isMask === "1" &&
+              //   (!this.extJson.maskText || this.extJson.maskText === "")
+              // ) {
+              //   this.$message.error("遮罩文案未填写");
+              //   return false;
+              // }
+              // if (this.extJson.isZoetrope === '1' && (!this.extJson.zoetropeText || this.extJson
+              //     .zoetropeText === "")) {
+              //   this.$message.error('走马灯文案未填写');
+              //   return false
+              // }
+              console.log(222);
+              this.form.extJson = JSON.stringify(this.extJson);
+              this.rulesform.weeks = this.checkedWeeks
+                .map((i) => weekOptions.findIndex((j) => j == i))
+                .sort()
+                .toString();
 
-    //   //         var array1 = JSON.parse(JSON.stringify(this.oldform));
-    //   //         var array2 = JSON.parse(JSON.stringify(this.form));
-    //   //         array2["activeEndDate"] = this.rulesform.activeEndDate
-    //   //           ? this.rulesform.activeEndDate
-    //   //           : null;
-    //   //         array2["activeEndTime"] = this.rulesform.activeEndTime
-    //   //           ? this.rulesform.activeEndTime
-    //   //           : null;
-    //   //         array2["activeStartDate"] = this.rulesform.activeStartDate
-    //   //           ? this.rulesform.activeStartDate
-    //   //           : null;
-    //   //         array2["activeStartTime"] = this.rulesform.activeStartTime
-    //   //           ? this.rulesform.activeStartTime
-    //   //           : null;
-    //   //         array2["weeks"] = this.rulesform.weeks;
-    //   //         let text = "策略:" + this.form.strategyName;
-    //   //         XEUtils.objectEach(array2, (item, key) => {
-    //   //           if (item != array1[key]) {
-    //   //             if (key == "extJson") {
-    //   //               let ext = JSON.parse(item);
-    //   //               if (array1[key]) {
-    //   //                 let arr = JSON.parse(array1[key]);
-    //   //                 XEUtils.objectEach(ext, (i, k) => {
-    //   //                   if (i != arr[k]) {
-    //   //                     text += `\n${k}:${arr[k]} 改为 ${i ? i : "空"}`;
-    //   //                   }
-    //   //                 });
-    //   //               } else {
-    //   //                 XEUtils.objectEach(ext, (i, k) => {
-    //   //                   text += `\n${k}:空 改为 ${i ? i : "空"}`;
-    //   //                 });
-    //   //               }
-    //   //             } else {
-    //   //               text += `\n${key}:${array1[key]} 改为 ${
-    //   //                 item ? item : "空"
-    //   //               }`;
-    //   //             }
-    //   //           }
-    //   //         });
+              var array1 = JSON.parse(JSON.stringify(this.oldform));
+              var array2 = JSON.parse(JSON.stringify(this.form));
+              array2["activeEndDate"] = this.rulesform.activeEndDate
+                ? this.rulesform.activeEndDate
+                : null;
+              array2["activeEndTime"] = this.rulesform.activeEndTime
+                ? this.rulesform.activeEndTime
+                : null;
+              array2["activeStartDate"] = this.rulesform.activeStartDate
+                ? this.rulesform.activeStartDate
+                : null;
+              array2["activeStartTime"] = this.rulesform.activeStartTime
+                ? this.rulesform.activeStartTime
+                : null;
+              array2["weeks"] = this.rulesform.weeks;
+              let text = "策略:" + this.form.strategyName;
+              console.log(333);
+              XEUtils.objectEach(array2, (item, key) => {
+                if (item != array1[key]) {
+                  if (key == "extJson") {
+                    let ext = JSON.parse(item);
+                    if (array1[key]) {
+                      let arr = JSON.parse(array1[key]);
+                      XEUtils.objectEach(ext, (i, k) => {
+                        if (i != arr[k]) {
+                          text += `\n${k}:${arr[k]} 改为 ${i ? i : "空"}`;
+                        }
+                      });
+                    } else {
+                      XEUtils.objectEach(ext, (i, k) => {
+                        text += `\n${k}:空 改为 ${i ? i : "空"}`;
+                      });
+                    }
+                  } else {
+                    text += `\n${key}:${array1[key]} 改为 ${
+                      item ? item : "空"
+                    }`;
+                  }
+                }
+              });
 
-    //   //         if (this.$route.query.id) {
-    //   //           post("/strategyInfoNew/savelog", {
-    //   //             type: array2.activityType ? array2.activityType : 0,
-    //   //             notes: text,
-    //   //             strategyId: array2.id,
-    //   //             strategyName: array2.strategyName,
-    //   //           });
-    //   //           post(
-    //   //             "/strategyInfoNew/update/" + this.$route.query.id,
-    //   //             this.form
-    //   //           ).then((res) => {
-    //   //             get("/strategy/strategy-info/page", {
-    //   //               pageSize: 100,
-    //   //               pageNum: 1,
-    //   //             }).then((res) => {
-    //   //               this.strategyInfoNewList = res.data.list;
-    //   //             });
-    //   //             let checkedchannel = [];
-    //   //             this.checkedchannel.forEach((res) => {
-    //   //               checkedchannel.push({
-    //   //                 firstChannelId: res[0],
-    //   //                 secondChannelId: res[1],
-    //   //               });
-    //   //             });
-    //   //             this.rulesform.channelInfoDatas = checkedchannel;
-    //   //             post(
-    //   //               "strategyInfoNew/updateStrategyRules",
-    //   //               this.rulesform
-    //   //             ).then((res) => {
-    //   //               // this.close()
-    //   //             });
-    //   //             this.$message({
-    //   //               message: res.message,
-    //   //               type: "success",
-    //   //               duration: 3000,
-    //   //               offset: 360,
-    //   //             });
-    //   //             setTimeout(() => {
-    //   //               window.close();
-    //   //             }, 1200);
-    //   //           });
-    //   //         } else {
-    //   //           post("/strategy/strategy-info/create", this.form).then(
-    //   //             (res) => {
-    //   //               let params = {
-    //   //                 activeStartDate: "",
-    //   //                 activeStartTime: "00:00:00",
-    //   //                 activeEndDate: "",
-    //   //                 activeEndTime: "23:59:59",
-    //   //                 channelInfoDatas: [
-    //   //                   {
-    //   //                     firstChannelId: "",
-    //   //                     secondChannelId: "",
-    //   //                   },
-    //   //                 ],
-    //   //                 strategyId: "",
-    //   //                 weeks: "",
-    //   //               };
+              if (this.$route.query.ids) {
+                // post("/strategyInfoNew/savelog", {
+                //   type: array2.activityType ? array2.activityType : 0,
+                //   notes: text,
+                //   strategyId: array2.id,
+                //   strategyName: array2.strategyName,
+                // });
+                this.id = this.$route.ids;
+                // console.log(this.id);
+                console.log(this.form);
+                //修改
+                put("/strategy/strategy-info/update", this.form).then((res) => {
+                  get("/strategy/strategy-info/page", {
+                    pageSize: 100,
+                    pageNum: 1,
+                  }).then((res) => {
+                    this.strategyInfoNewList = res.data.list;
+                  });
+                  let checkedchannel = [];
+                  this.checkedchannel.forEach((res) => {
+                    checkedchannel.push({
+                      firstChannelId: res[0],
+                      secondChannelId: res[1],
+                    });
+                  });
+                  this.rulesform.channelInfoDatas = checkedchannel;
+                  //   post(
+                  //     "strategyInfoNew/updateStrategyRules",
+                  //     this.rulesform
+                  //   ).then((res) => {
+                  //     // this.close()
+                  //   });
+                  this.$message({
+                    message: "操作成功",
+                    type: "success",
+                    duration: 3000,
+                    offset: 360,
+                  });
+                  //   setTimeout(() => {
+                  //     window.close();
+                  //   }, 1200);
+                });
+              } else {
+                post(
+                  "/strategy/strategy-info/create",
+                  this.form,
+                  this.rulesform
+                ).then((res) => {
+                  let params = {
+                    activeStartDate: "",
+                    activeStartTime: "00:00:00",
+                    activeEndDate: "",
+                    activeEndTime: "23:59:59",
+                    channelInfoDatas: [
+                      {
+                        firstChannelId: "",
+                        secondChannelId: "",
+                      },
+                    ],
+                    strategyId: "",
+                    weeks: "",
+                  };
+                  console.log(res);
+                  // post("strategyInfoNew/updateStrategyRules", params).then(
+                  //   (res) => {
+                  //     // this.close()
+                  //   }
+                  // );
 
-    //   //               post("strategyInfoNew/updateStrategyRules", params).then(
-    //   //                 (res) => {
-    //   //                   // this.close()
-    //   //                 }
-    //   //               );
-    //   //               this.$message({
-    //   //                 message: res.message,
-    //   //                 type: "success",
-    //   //                 duration: 3000,
-    //   //                 offset: 360,
-    //   //               });
-    //   //               setTimeout(() => {
-    //   //                 window.close();
-    //   //               }, 1200);
-    //   //             }
-    //   //           );
-    //   //         }
-    //   //       } else {
-    //   //         return false;
-    //   //       }
-    //   //     });
-    //   //   })
-    //   //   .catch(() => {
-    //   //     this.$message({
-    //   //       type: "info",
-    //   //       message: "已取消",
-    //   //     });
-    //   //   });
-    // },
+                  this.$message({
+                    message: "操作成功",
+                    type: "success",
+                    duration: 3000,
+                    offset: 360,
+                  });
+                  setTimeout(() => {
+                    this.$router.back();
+                  }, 1200);
+                });
+              }
+            } else {
+              return false;
+            }
+          });
+        })
+        .catch(() => {
+          this.$message({
+            type: "info",
+            message: "已取消",
+          });
+        });
+    },
     changePromotionPicposterPhoto(e) {
       // this.$set(
       //   this.form,
@@ -1180,14 +1250,14 @@ export default {
       // );
     },
     handleCheckAllChange(val) {
-      // this.checkedWeeks = val ? weekOptions : [];
-      // this.isIndeterminate = false;
+      this.checkedWeeks = val ? weekOptions : [];
+      this.isIndeterminate = false;
     },
     handleCheckedCitiesChange(value) {
-      // let checkedCount = value.length;
-      // this.checkAll = checkedCount === this.weeksList.length;
-      // this.isIndeterminate =
-      //   checkedCount > 0 && checkedCount < this.weeksList.length;
+      let checkedCount = value.length;
+      this.checkAll = checkedCount === this.weeksList.length;
+      this.isIndeterminate =
+        checkedCount > 0 && checkedCount < this.weeksList.length;
     },
     close() {
       this.$confirm("此操作不会保存已编辑数据, 是否继续?", "提示", {