Tang 2 rokov pred
rodič
commit
819233d272

+ 30 - 6
src/components/Editor/index.vue

@@ -73,7 +73,7 @@ export default {
         modules: {
           clipboard: {
             // 粘贴版,处理粘贴时候带图片
-            matchers: [[Node.ELEMENT_NODE, this.handleCustomMatcher]],
+            // matchers: [[Node.ELEMENT_NODE, this.handleCustomMatcher]],
           },
           // 工具栏配置
           toolbar: [
@@ -138,20 +138,21 @@ export default {
       };
       this.$api.getPolicy(datats).then((res) => {
         this.datas = res.data.resultContent;
-        console.log(res.data.resultContent.host)
+        console.log(res.data.resultContent.host);
         this.uploadUrl = res.data.resultContent.host;
         resolve();
       });
     }).then(() => {
       this.init();
     });
+    this.paste();
   },
   beforeDestroy() {
     this.Quill = null;
   },
   methods: {
     handleCustomMatcher(node, Delta) {
-      console.log("handleCustomMatcher")
+      console.log("handleCustomMatcher", node);
       let ops = [];
       Delta.ops.forEach((op) => {
         if (op.insert && typeof op.insert === "string") {
@@ -187,7 +188,7 @@ export default {
       return Delta;
     },
     base64ToFile(base64, fileName) {
-      console.log("base64ToFile")
+      console.log("base64ToFile");
       return new Promise((resolve, reject) => {
         let arr = base64.split(",");
         let mime = arr[0].match(/:(.*?);/)[1];
@@ -204,7 +205,7 @@ export default {
       });
     },
     init() {
-      console.log("init")
+      console.log("init");
       const editor = this.$refs.editor;
       this.Quill = new Quill(editor, this.options);
       // 如果设置了上传地址则自定义图片上传事件
@@ -257,7 +258,7 @@ export default {
       };
     },
     imageChange(param, type) {
-      console.log("imageChange")
+      console.log("imageChange");
       this.$upload
         .upload(param.file, this.uploadStatus)
         .then((res) => {
@@ -280,6 +281,29 @@ export default {
     handleUploadError() {
       this.$message.error("图片插入失败");
     },
+    paste() {
+      window.addEventListener(
+        "paste",
+        (evt) => {
+          if (
+            evt.clipboardData &&
+            evt.clipboardData.files &&
+            evt.clipboardData.files.length
+          ) {
+            evt.preventDefault();
+            [].forEach.call(evt.clipboardData.files, (file) => {
+              if (!file.type.match(/^image\/(gif|jpe?g|a?png|bmp)/i)) {
+                return;
+              }
+              this.imageChange({
+                file: file,
+              });
+            });
+          }
+        },
+        false
+      );
+    },
   },
 };
 </script>

+ 3 - 1
src/components/modelView/index.vue

@@ -59,6 +59,7 @@
       v-if="modelData.distribution.checked"
       v-show="IMGSHOW"
       style="border: 1px solid skyblue"
+      :lock-aspect-ratio="true"
     >
       <!-- <img
         :style="modelData.distribution.css"
@@ -78,6 +79,7 @@
       v-if="modelData.cardCode.checked"
       v-show="IMGSHOW"
       style="border: 1px solid skyblue"
+      :lock-aspect-ratio="true"
     >
       <!-- <img
         :style="modelData.cardCode.css"
@@ -96,7 +98,7 @@
       :parent="true"
       v-if="modelData.advertise.checked"
     >
-      <p :style="modelData.advertise.css">{{ modelData.advertise.name }}</p>
+      <p style="white-space:pre-wrap;" :style="modelData.advertise.css">{{ modelData.advertise.name }}</p>
     </vue-draggable-resizable>
     <!-- 机构 -->
     <vue-draggable-resizable

+ 56 - 10
src/fxApi/temp.js

@@ -3,7 +3,7 @@ export default {
     //新增分销活动模板
     distributiontempsave(data) {
         return request({
-            url: '/distribution/temp/save', 
+            url: '/distribution/activity/save', 
             method: 'post',
             data
         })
@@ -11,7 +11,7 @@ export default {
     //修改分销活动模板
     editdistributiontemp(data) {
         return request({
-            url: '/distribution/temp/edit',
+            url: '/distribution/activity/edit',
             method: 'post',
             data
         })
@@ -19,7 +19,22 @@ export default {
     //启用-禁用
     editdistributiontempupdatestatus(data) {
         return request({
-            url: '/distribution/temp/update/status',
+            url: '/distribution/activity/update/status',
+            method: 'post',
+            data
+        })
+    },
+    //拉取商品
+    distributionactivitypullgoods(data) {
+        return request({
+            url: `/distribution/activity/pull/goods/` + data,
+            method: 'get',
+        })
+    },
+    //启用-禁用分销活动
+    editdistributionactivityeditstatus(data) {
+        return request({
+            url: '/distribution/activity/edit/status',
             method: 'post',
             data
         })
@@ -27,7 +42,7 @@ export default {
     //导出【请填写功能名称】列表
     distributiontempexport(data) {
         return request({
-            url: '/distribution/temp/export',
+            url: '/distribution/activity/export',
             method: 'get',
             params: data
         })
@@ -35,7 +50,7 @@ export default {
     //查询分销活动模板列表
     distributiontemplist(data) {
         return request({
-            url: '/distribution/temp/list',
+            url: '/distribution/activity/list',
             method: 'get',
             params: data
         })
@@ -43,14 +58,14 @@ export default {
     //活动模板发布
     distributiontemppublishdata(data) {
         return request({
-            url: `/distribution/temp/publish/` + data,
+            url: `/distribution/activity/publish/` + data,
             method: 'get',
         })
     },
     //获取分销活动模板详细信息
     distributiontempdata(data) {
         return request({
-            url: `/distribution/temp/` + data,
+            url: `/distribution/activity/` + data,
             method: 'get',
         })
     },
@@ -62,13 +77,44 @@ export default {
             params: data
         })
     },
-    //分销业务员列表
-    distributiontempsellerlist(data) {
+    //查询分销业务员列表
+    distributionsellerlist(data) {
         return request({
-            url: '/distribution/temp/seller/list',
+            url: '/distribution/seller/list',
             method: 'get',
             params: data
         })
     },
+    //获取分销业务员详细信息
+    distributionseller(data) {
+        return request({
+            url: '/distribution/seller/' + data,
+            method: 'get',
+        })
+    },
+    //新增分销业务员
+    addDistributionseller(data) {
+        return request({
+            url: '/distribution/seller',
+            method: 'post',
+            data
+        })
+    },
+    //批量新增关联分销业务员
+    distributionsellerbatchAdd(data) {
+        return request({
+            url: '/distribution/seller/batchAdd',
+            method: 'post',
+            data
+        })
+    },
+    //修改分销业务员
+    editDistributionseller(data) {
+        return request({
+            url: '/distribution/seller/edit',
+            method: 'post',
+            data
+        })
+    },
     
 }

+ 2 - 0
src/store/modules/user.js

@@ -70,6 +70,8 @@ const user = {
             resolve()
           })
           .catch(function (error) {
+            commit('setTENANT_NANE', '')
+              sessionStorage.removeItem('TenantId')
             resolve()
             console.log("TenantIDerror:", error);
           });

+ 2 - 2
src/utils/request.js

@@ -7,8 +7,8 @@ import methods from '@/utils/methodsTool';
 
 axios.defaults.headers['Content-Type'] = 'application/json;charset=utf-8'
 // 创建axios实例
-export const baseURL = process.env.VUE_APP_BASE_API
-// export const baseURL = 'http://192.168.1.24:5030/'
+// export const baseURL = process.env.VUE_APP_BASE_API
+export const baseURL = 'http://192.168.1.24:5030/'
 export const BASE_IMG_URL = process.env.VUE_APP_IMG_API
 const service = axios.create({
   // axios中请求配置有baseURL选项,表示请求URL公共部分

+ 8 - 8
src/views/Marketing/activitySystem/activityList/activityInfo/first.vue

@@ -5,12 +5,12 @@
         <el-form-item label="活动名称" prop="name">
           <el-input v-model="ruleForm.name"></el-input>
         </el-form-item>
-        <el-form-item label="选择模板" prop="posterTempId">
-          <el-select v-model="ruleForm.posterTempId" placeholder="请选择模板">
+        <el-form-item label="选择模板" prop="posterId">
+          <el-select v-model="ruleForm.posterId" placeholder="请选择模板">
             <el-option
               v-for="item in modelList"
               :label="item.name"
-              :value="item.posterTempId"
+              :value="item.posterId"
             ></el-option>
           </el-select>
         </el-form-item>
@@ -29,12 +29,12 @@
         </el-form-item>
         </el-col
       >
-      <el-col :span="6" :offset="4" v-show="ruleForm.posterTempId">
+      <el-col :span="6" :offset="4" v-show="ruleForm.posterId">
         <div style="text-align: center">
           <el-image
             style="width: 187.5px; height: 333.5px"
-            :src="ModelUrl(ruleForm.posterTempId)"
-            :preview-src-list="[ModelUrl(ruleForm.posterTempId)]"
+            :src="ModelUrl(ruleForm.posterId)"
+            :preview-src-list="[ModelUrl(ruleForm.posterId)]"
           >
           </el-image>
           <h2>模板预览</h2>
@@ -98,9 +98,9 @@ export default {
       return function (k) {
         if (k) {
           for (let i = 0; i < this.modelList.length; i++) {
-            if (this.modelList[i].posterTempId === k) {
+            if (this.modelList[i].posterId === k) {
               return this.$methodsTools.splitImgHost(
-                this.modelList[i].posterUrl
+                this.modelList[i].url
               );
             }
           }

+ 22 - 12
src/views/Marketing/activitySystem/activityList/activityInfo/index.vue

@@ -6,7 +6,7 @@
       ref="ruleForm"
       label-width="120px"
       class="demo-ruleForm"
-      :disabled="id ? true : false"
+      :disabled="status === 'info'"
     >
       <First :ruleForm="ruleForm"></First>
       <Second :ruleForm="ruleForm" @backGoodsList="backGoodsList"></Second>
@@ -14,11 +14,17 @@
     ></el-form>
     <div style="text-align: center">
       <el-button @click="close">取消</el-button>
-      <el-button type="primary" @click="submitForm('ruleForm')" v-if="!id"
+      <el-button
+        type="primary"
+        @click="submitForm('ruleForm')"
+        v-if="status !== 'info'"
         >保存</el-button
       >
-      <el-button type="primary" @click="submitForm('ruleForm', true)" v-if="!id"
-        >发布</el-button
+      <el-button
+        type="primary"
+        @click="submitForm('ruleForm', true)"
+        v-if="status !== 'info'"
+        >启用</el-button
       >
     </div>
   </div>
@@ -33,13 +39,13 @@ export default {
   data() {
     return {
       ruleForm: {
-        publishStatus: 0,
+        status: 0,
         goodsList: [], //商品列表
         tenantList: [], //机构列表
       },
       rules: {
         name: [{ required: true, message: "请输入活动名称", trigger: "blur" }],
-        posterTempId: [
+        posterId: [
           { required: true, message: "请选择模板", trigger: "change" },
         ],
         timeList: [
@@ -54,17 +60,18 @@ export default {
   },
   created() {
     this.id = this.$route.query.id;
+    this.status = this.$route.query.status;
     if (this.id) {
       this.getInit();
     }
   },
   methods: {
     close() {
-        this.$store.dispatch("tagsView/exitView", this.$route).then((res) => {
-          this.$router.push({
-            path: "activityList",
-          });
+      this.$store.dispatch("tagsView/exitView", this.$route).then((res) => {
+        this.$router.push({
+          path: "activityList",
         });
+      });
     },
     getInit() {
       this.$api.distributiontempdata(this.id).then((res) => {
@@ -72,6 +79,7 @@ export default {
           parseInt(res.data.startTime * 1000),
           parseInt(res.data.endTime * 1000),
         ];
+        res.data.goodsList = res.data.goodsList || []
         this.$nextTick(() => {
           this.ruleForm = res.data;
         });
@@ -87,10 +95,12 @@ export default {
               data.startTime = data.timeList[0] / 1000;
               data.endTime = data.timeList[1] / 1000;
               if (status) {
-                data.publishStatus = 1;
+                data.status = 1;
               }
               this.$api[
-                data.id ? "editdistributiontemp" : "distributiontempsave"
+                data.distributionId
+                  ? "editdistributiontemp"
+                  : "distributiontempsave"
               ](data).then((res) => {
                 this.$message.success("成功");
                 setTimeout(() => {

+ 16 - 0
src/views/Marketing/activitySystem/activityList/activityInfo/second.vue

@@ -5,6 +5,15 @@
         <el-form-item label="设置商品及佣金" prop="goodsList">
           <p>
             <el-button type="primary" @click="activeGoods">新增</el-button>
+            <el-form style="float:left;margin-right: 10px;">
+              <!-- 详情出现 --><el-button
+                v-if="ruleForm.tempId"
+                type="primary"
+                @click="pull"
+                :disabled="false"
+                >拉取商品</el-button
+              >
+            </el-form>
           </p>
           <el-table :data="ruleForm.goodsList" border style="width: 100%">
             <el-table-column
@@ -203,6 +212,13 @@ export default {
       const array = this.ruleForm.goodsList.map((item) => item.goodsId);
       this.$refs.goodsList.showBox(array);
     },
+    pull() {
+      this.$api
+        .distributionactivitypullgoods(this.ruleForm.distributionId)
+        .then((res) => {
+          this.$message.success("操作成功");
+        });
+    },
   },
 };
 </script>

+ 1 - 1
src/views/Marketing/activitySystem/activityList/activityInfo/three.vue

@@ -2,7 +2,7 @@
   <div id="">
     <el-row>
       <el-col :span="24">
-        <el-form-item label="选择推送机构" prop="tenantList">
+        <el-form-item  v-if="false" label="选择推送机构" prop="tenantList">
           <p>
             <el-button type="primary" @click="activeTenant">新增</el-button>
           </p>

+ 39 - 15
src/views/Marketing/activitySystem/activityList/index.vue

@@ -20,10 +20,20 @@
         <el-button type="text" @click="editClick(props.scope.row)"
           >详情</el-button
         ><el-button
-          v-if="props.scope.row.publishStatus === 0"
+          v-if="props.scope.row.tempId"
+          type="text"
+          @click="pull(props.scope.row)"
+          >拉取商品</el-button
+        ><el-button
+          v-if="!props.scope.row.tempId && props.scope.row.status !== -1"
           type="text"
           @click="sendUpload(props.scope.row)"
-          >发布</el-button
+          >{{ props.scope.row.status === 1 ? "禁用" : "启用" }}</el-button
+        ><el-button
+          v-if="props.scope.row.status === 0 && !props.scope.row.tempId"
+          type="text"
+          @click="editClick(props.scope.row, true)"
+          >修改</el-button
         >
       </template>
     </table-list>
@@ -42,7 +52,7 @@ import searchBoxNew from "@/components/searchBoxNew";
 import tableList from "@/components/tableList";
 import pagination from "@/components/pagination";
 export default {
-  name: "ActivityList",
+  // name: "ActivityList",
   components: { searchBoxNew, tableList, pagination },
   data() {
     return {
@@ -56,7 +66,7 @@ export default {
         choice: false,
         addHide: false,
         openCheckMore: true,
-        changeWidth: "100px",
+        changeWidth: "160px",
         backFatherBtn: {
           status: false,
           title: "配置下单填选模板",
@@ -117,17 +127,17 @@ export default {
           scope: "aTimeList",
         },
         {
-          label: "发布状态",
-          prop: "publishStatus",
+          label: "状态",
+          prop: "status",
           hidden: true,
           scope: "isOptions",
           options: [
             {
-              label: "已发布",
+              label: "启用",
               value: 1,
             },
             {
-              label: "未发布",
+              label: "禁用",
               value: 0,
             },
           ],
@@ -149,14 +159,16 @@ export default {
     addClick() {
       this.$router.push({
         path: "activityInfo",
+        status: "add",
       });
       // this.$refs.model.showBox();
     },
-    editClick(e) {
+    editClick(e, status) {
       this.$router.push({
         path: "activityInfo",
         query: {
-          id: e.id,
+          id: e.distributionId,
+          status: status ? "edit" : "info",
         },
       });
     },
@@ -190,14 +202,19 @@ export default {
       this.search(2);
     },
     sendUpload(v) {
-      this.$alert("是否发布", "提示", {
+      this.$alert(`是否${v.status === 1 ? "禁用" : "启用"}`, "提示", {
         dangerouslyUseHTMLString: true,
       })
         .then(() => {
-          this.$api.distributiontemppublishdata(v.id).then((res) => {
-            this.$message.success("发布成功");
-            this.search();
-          });
+          this.$api
+            .editdistributionactivityeditstatus({
+              distributionId: v.distributionId,
+              status: v.status === 1 ? 0 : 1,
+            })
+            .then((res) => {
+              this.$message.success("操作成功");
+              this.search();
+            });
         })
         .catch(() => {
           this.$message({
@@ -216,6 +233,13 @@ export default {
       this.formData.pageNum = v;
       this.search();
     },
+    pull(item) {
+      this.$api
+        .distributionactivitypullgoods(item.distributionId)
+        .then((res) => {
+          this.$message.success("操作成功");
+        });
+    },
   },
 };
 </script>

+ 2 - 7
src/views/Marketing/activitySystem/posterList/index.vue

@@ -42,7 +42,7 @@ import tableList from "@/components/tableList";
 import pagination from "@/components/pagination";
 import model from "./model.vue";
 export default {
-  name: "PosterList",
+  // name: "PosterList",
   components: { searchBoxNew, tableList, pagination, model },
   data() {
     return {
@@ -76,11 +76,6 @@ export default {
       },
       // 表单
       tableSet: [
-        {
-          label: "模板编号",
-          prop: "posterTempId",
-          hidden: true,
-        },
         {
           label: "模板名称",
           prop: "name",
@@ -125,7 +120,7 @@ export default {
     Status(e) {
       this.$api
         .editdistributionposter({
-          posterTempId: e.posterTempId,
+          posterId: e.posterId,
           status: e.status === 1 ? 0 : 1,
         })
         .then((res) => {

+ 146 - 87
src/views/Marketing/activitySystem/posterList/model.vue

@@ -2,7 +2,7 @@
   <div id="">
     <el-dialog
       :visible.sync="dialogVisible"
-      width="1060px"
+      width="1160px"
       :show-close="false"
       :close-on-click-modal="false"
     >
@@ -63,7 +63,16 @@
               <div class="lis">
                 <el-checkbox v-model="modelData.goods.checked"
                   >商品图:</el-checkbox
-                ><input id="goods" type="file" @change="uploadImg" />
+                ><label for="goods"
+                  ><i class="btn">{{
+                    modelData.goods.name ? "更换商品图" : "上传商品图"
+                  }}</i></label
+                ><input
+                  style="display: none"
+                  id="goods"
+                  type="file"
+                  @change="uploadImg"
+                />
               </div>
               <div class="lis">
                 <el-checkbox v-model="modelData.distribution.checked"
@@ -76,7 +85,11 @@
               <div class="lis">
                 <el-checkbox v-model="modelData.advertise.checked"
                   >广告语:</el-checkbox
-                ><el-input v-model="modelData.advertise.name"></el-input
+                ><el-input
+                  type="textarea"
+                  :rows="4"
+                  v-model="modelData.advertise.name"
+                ></el-input
                 ><el-color-picker
                   v-model="modelData.advertise.css.color"
                   show-alpha
@@ -150,6 +163,7 @@ export default {
       modelData: {
         background: {
           name: "",
+          type: 0,
           css: {
             top: "0px",
             left: "0px",
@@ -160,6 +174,7 @@ export default {
         },
         title: {
           name: "",
+          type: 1,
           top: 38,
           left: 0,
           width: 375,
@@ -173,6 +188,7 @@ export default {
         goods: {
           // name: require("@/assets/model_images/model1.png"),
           name: "",
+          type: 2,
           top: 126,
           left: 28,
           width: 330,
@@ -184,10 +200,11 @@ export default {
         },
         distribution: {
           name: "",
+          type: 3,
           top: 476,
           left: 114,
           width: 121,
-          height: 111,
+          height: 121,
           css: {
             width: "100%",
             height: "100%",
@@ -195,10 +212,11 @@ export default {
         },
         cardCode: {
           name: "",
+          type: 3,
           top: 476,
           left: 244,
-          width: 125,
-          height: 112,
+          width: 121,
+          height: 121,
           css: {
             width: "100%",
             height: "100%",
@@ -206,6 +224,7 @@ export default {
         },
         advertise: {
           name: "",
+          type: 1,
           top: 490,
           left: 0,
           width: 102,
@@ -217,6 +236,7 @@ export default {
         },
         mechanism: {
           name: "",
+          type: 1,
           top: 623,
           left: 0,
           width: 375,
@@ -245,8 +265,8 @@ export default {
         this.$nextTick(() => {
           this.ruleForm = {
             name: e.name,
-            posterTempId: e.posterTempId,
-            posterUrl: e.posterUrl,
+            posterId: e.posterId,
+            url: e.url,
             remark: e.remark,
             status: e.status,
           };
@@ -254,87 +274,97 @@ export default {
         });
       } else {
         this.$nextTick(() => {
-        this.modelData = {
-          background: {
-            name: "",
-            css: {
-              top: "0px",
-              left: "0px",
-              width: "375px",
-              height: "667px",
-              position: "absolute",
+          this.modelData = {
+            background: {
+              name: "",
+              type: 0,
+              css: {
+                top: "0px",
+                left: "0px",
+                width: "375px",
+                height: "667px",
+                position: "absolute",
+              },
             },
-          },
-          title: {
-            name: "",
-            top: 38,
-            left: 0,
-            width: 375,
-            height: 50,
-            css: {
-              textAlign: "center",
-              fontSize: "30px",
-              margin: "0px",
+            title: {
+              name: "",
+              type: 1,
+              top: 38,
+              left: 0,
+              width: 375,
+              height: 50,
+              css: {
+                textAlign: "center",
+                fontSize: "30px",
+                margin: "0px",
+                lineHeight: "36px",
+              },
             },
-          },
-          goods: {
-            // name: require("@/assets/model_images/model1.png"),
-            name: "",
-            top: 126,
-            left: 28,
-            width: 330,
-            height: 330,
-            css: {
-              width: "100%",
-              height: "100%",
+            goods: {
+              // name: require("@/assets/model_images/model1.png"),
+              name: "",
+              type: 2,
+              top: 126,
+              left: 28,
+              width: 330,
+              height: 330,
+              css: {
+                width: "100%",
+                height: "100%",
+              },
             },
-          },
-          distribution: {
-            name: "",
-            top: 476,
-            left: 114,
-            width: 121,
-            height: 111,
-            css: {
-              width: "100%",
-              height: "100%",
+            distribution: {
+              name: "",
+              type: 3,
+              top: 476,
+              left: 114,
+              width: 121,
+              height: 121,
+              css: {
+                width: "100%",
+                height: "100%",
+              },
             },
-          },
-          cardCode: {
-            name: "",
-            top: 476,
-            left: 244,
-            width: 125,
-            height: 112,
-            css: {
-              width: "100%",
-              height: "100%",
+            cardCode: {
+              name: "",
+              type: 3,
+              top: 476,
+              left: 244,
+              width: 121,
+              height: 121,
+              css: {
+                width: "100%",
+                height: "100%",
+              },
             },
-          },
-          advertise: {
-            name: "",
-            top: 490,
-            left: 0,
-            width: 102,
-            height: 96,
-            css: {
-              fontSize: "20px",
-              margin: "0px",
+            advertise: {
+              name: "",
+              type: 1,
+              top: 490,
+              left: 0,
+              width: 102,
+              height: 96,
+              css: {
+                fontSize: "20px",
+                margin: "0px",
+                lineHeight: "36px",
+              },
             },
-          },
-          mechanism: {
-            name: "",
-            top: 623,
-            left: 0,
-            width: 375,
-            height: 44,
-            css: {
-              fontSize: "16px",
-              textAlign: "center",
-              margin: "0px",
+            mechanism: {
+              name: "",
+              type: 1,
+              top: 623,
+              left: 0,
+              width: 375,
+              height: 44,
+              css: {
+                fontSize: "16px",
+                textAlign: "center",
+                margin: "0px",
+                lineHeight: "36px",
+              },
             },
-          },
-        };
+          };
           this.ruleForm = {};
         });
       }
@@ -348,10 +378,10 @@ export default {
       this.$refs[formName].validate(async (valid) => {
         if (valid) {
           this.disabledBtn = true;
-          this.ruleForm.posterUrl = await this.$refs.modelView.changeFile();
+          this.ruleForm.url = await this.$refs.modelView.changeFile();
           this.ruleForm.posterConfig = JSON.stringify(this.modelData);
           this.$api[
-            this.ruleForm.posterTempId
+            this.ruleForm.posterId
               ? "editdistributionposter"
               : "distributionpostersave"
           ](this.ruleForm)
@@ -389,10 +419,12 @@ export default {
       var file = e.target.files[0];
       if (file === undefined) {
         self.$set(self.modelData.goods, "name", "");
+        e.target.value = "";
         return;
       }
-      if (file.size > 0.3 * 1024 * 1024) {
-        self.$message.error("图片不得大于300kb");
+      if (file.size > 0.8 * 1024 * 1024) {
+        self.$message.error("图片不得大于800kb");
+        e.target.value = "";
         return;
       }
       var type = e.target.value.toLowerCase().split(".").splice(-1);
@@ -420,6 +452,33 @@ export default {
 </script>
 
 <style lang="scss" scoped>
+.btn {
+  display: inline-block;
+  line-height: 1;
+  white-space: nowrap;
+  cursor: pointer;
+  background: #ffffff;
+  border: 1px solid #dcdfe6;
+  -webkit-appearance: none;
+  text-align: center;
+  -webkit-box-sizing: border-box;
+  box-sizing: border-box;
+  outline: none;
+  margin: 0;
+  -webkit-transition: 0.1s;
+  transition: 0.1s;
+  font-weight: 400;
+  -moz-user-select: none;
+  -webkit-user-select: none;
+  -ms-user-select: none;
+  border-radius: 8px;
+  color: #ffffff;
+  background-color: #1890ff;
+  border-color: #1890ff;
+  padding: 10px 20px;
+  font-size: 14px;
+  font-style: normal;
+}
 .header_img {
   & > .imageStyBoxShow {
     border-radius: 50%;
@@ -453,7 +512,7 @@ export default {
       align-items: center;
       margin-bottom: 10px;
       & > .el-input {
-        width: 200px;
+        // width: 200px;
       }
     }
   }

+ 72 - 48
src/views/Marketing/distribution/salesmanList/formBox.vue

@@ -19,7 +19,6 @@
           :model="listData"
           :rules="rules"
           ref="listData"
-          :disabled="disabled"
         >
           <el-form-item
             v-for="(items, indexs) in listitem"
@@ -29,6 +28,7 @@
           >
             <div v-if="items.scope === 'header_img'" class="header_img">
               <el-image
+                v-if="listData[items.prop]"
                 class="imageStyBoxShow"
                 :src="$methodsTools.splitImgHost(listData[items.prop])"
                 :preview-src-list="[
@@ -37,7 +37,9 @@
               >
               </el-image>
               <label for="imgs"
-                ><i class="btns" v-if="!disabled">更换头像</i></label
+                ><i class="btns">{{
+                  listData[items.prop] ? "更换头像" : "上传头像"
+                }}</i></label
               >
               <input
                 id="imgs"
@@ -56,7 +58,6 @@
         <el-button
           type="primary"
           :loading="disabledBtn"
-          v-if="!disabled"
           @click="submit('listData')"
           >确 定</el-button
         >
@@ -68,73 +69,79 @@
 <script>
 export default {
   data() {
+    var validatorphone = (rule, value, callback) => {
+      var reg = /^1(3|4|5|6|7|8|9)\d{9}$/;
+      if (!value) {
+        return callback(new Error("请输入手机号码"));
+      } else if (!reg.test(value)) {
+        return callback(new Error("请输入正确手机号码"));
+      } else {
+        callback();
+      }
+    };
+    var validatorIdCode = (rule, value, callback) => {
+      var reg =
+        /^[1-9]\d{5}(18|19|20|(3\d))\d{2}((0[1-9])|(1[0-2]))(([0-2][1-9])|10|20|30|31)\d{3}[0-9Xx]$/;
+
+      if (!value) {
+        return callback(new Error("请输入身份证号码"));
+      } else if (!reg.test(value)) {
+        return callback(new Error("请输入正确身份证号码"));
+      } else {
+        callback();
+      }
+    };
     return {
       // 弹窗字段
       listitem: [
         {
           label: "头像",
-          prop: "adverUrl",
+          prop: "avatar",
           scope: "header_img",
         },
-        {
-          label: "业务员ID",
-          prop: "sort",
-        },
         {
           label: "姓名",
-          prop: "name",
-        },
-        {
-          label: "职务",
-          prop: "sort",
+          prop: "realname",
         },
         {
           label: "手机号码",
-          prop: "tel",
+          prop: "telphone",
         },
         {
           label: "身份证号",
           prop: "idCard",
         },
-        {
-          label: "微信号",
-          prop: "wx",
-        },
       ],
       dialogVisible: false,
       disabledBtn: false,
-      disabled: false,
       //   弹窗数据
-      listData: {},
+      listData: {
+        realname: "",
+        telphone: "",
+        idCard: "",
+        status: 1,
+      },
       //表单验证
       rules: {
-        name: [
+        avatar: [
           {
             required: true,
-            message: "请输入姓名",
-            trigger: "blur",
+            message: "请上传头像",
+            trigger: ["blur", "change"],
           },
         ],
-        tel: [
+        realname: [
           {
             required: true,
-            message: "请输入手机号码",
+            message: "请输入姓名",
             trigger: "blur",
           },
         ],
-        idCard: [
-          {
-            required: true,
-            message: "请输入身份证号",
-            trigger: "blur",
-          },
+        telphone: [
+          { required: true, validator: validatorphone, trigger: "blur" },
         ],
-        wx: [
-          {
-            required: true,
-            message: "请输入微信号",
-            trigger: "blur",
-          },
+        idCard: [
+          { required: true, validator: validatorIdCode, trigger: "blur" },
         ],
       },
     };
@@ -143,10 +150,12 @@ export default {
     uploadImg(e) {
       var file = e.target.files[0];
       if (file === undefined) {
+        e.target.value = "";
         return;
       }
       if (file.size > 0.3 * 1024 * 1024) {
         this.$message.warning("图片不得大于300kb");
+        e.target.value = "";
         return;
       }
       var type = e.target.value.toLowerCase().split(".").splice(-1);
@@ -158,17 +167,25 @@ export default {
       this.$upload
         .upload(file, 0)
         .then((res) => {
-          this.$set(this.listData, "adverUrl", res);
+          this.$set(this.listData, "avatar", res);
+          this.$refs["listData"].validateField("avatar");
         })
         .finally(() => {
           e.target.value = "";
         });
     },
-    showBox(e) {
-      if (e) {
-        this.disabled = true;
+    showBox(id) {
+      if (id) {
+        this.$api.distributionseller(id).then((res) => {
+          this.listData = res.data;
+        });
       } else {
-        this.disabled = false;
+        this.listData = {
+          realname: "",
+          telphone: "",
+          idCard: "",
+          status: 1,
+        };
       }
       this.dialogVisible = true;
     },
@@ -183,12 +200,19 @@ export default {
     },
     rulesTableSumbit() {
       this.disabledBtn = true;
-      setTimeout(() => {
-        this.$message.success("修改成功");
-        this.disabledBtn = false;
-        this.dialogVisible = false;
-        this.search();
-      }, 500);
+      this.$api[
+        this.listData.sellerId
+          ? "editDistributionseller"
+          : "addDistributionseller"
+      ](this.listData)
+        .then((res) => {
+          this.$message.success("操作成功");
+          this.dialogVisible = false;
+          this.$parent.search();
+        })
+        .finally(() => {
+          this.disabledBtn = false;
+        });
     },
     close() {
       this.$refs.listData.clearValidate();

+ 38 - 42
src/views/Marketing/distribution/salesmanList/index.vue

@@ -8,7 +8,7 @@
       @init="init"
     />
     <table-list
-      rowKey="id"
+      rowKey="sellerId"
       ref="tableList"
       :tableSets="tableSet"
       :tableData="tableData"
@@ -17,15 +17,17 @@
       :loading="loading"
     >
       <template slot="customize">
-        <!-- <el-button @click="sales" type="success" size="medium">关联现有业务员</el-button> -->
+        <el-button @click="sales" type="success" size="medium"
+          >关联现有业务员</el-button
+        >
       </template>
       <template slot="btn" slot-scope="props">
-        <!-- <el-button type="text" @click="del(props.scope.row)">禁用</el-button>
-        <el-button type="text" @click="del(props.scope.row)">启用</el-button>
+        <el-button type="text" @click="statusChange(props.scope.row)">{{
+          props.scope.row.status === 1 ? "禁用" : "启用"
+        }}</el-button>
         <el-button type="text" @click="editClick(props.scope.row)"
-          >详情</el-button
+          >修改</el-button
         >
-        <el-button type="text" @click="del(props.scope.row)">删除</el-button> -->
       </template>
     </table-list>
     <pagination
@@ -36,7 +38,7 @@
       @handleCurrentChange="handleCurrentChange"
     />
     <form-box ref="formBox"></form-box>
-    <sales-checkout ref="salesCheckout" > </sales-checkout>
+    <sales-checkout ref="salesCheckout"> </sales-checkout>
   </div>
 </template>
 
@@ -45,10 +47,10 @@ import searchBoxNew from "@/components/searchBoxNew";
 import tableList from "@/components/tableList";
 import pagination from "@/components/pagination";
 import FormBox from "./formBox.vue";
-import salesCheckout from "./salesCheckout.vue"
+import salesCheckout from "./salesCheckout.vue";
 export default {
   name: "SalesmanList",
-  components: { searchBoxNew, tableList, pagination, FormBox,salesCheckout },
+  components: { searchBoxNew, tableList, pagination, FormBox, salesCheckout },
   data() {
     return {
       disabledBtn: false,
@@ -58,11 +60,11 @@ export default {
         index: 0,
         ch: "条",
         num: true,
-        choice: true,
-        addHide: true,
-        openCheckMore: true,
-        tableHide:true,
-        changeWidth: "260px",
+        choice: false,
+        addHide: false,
+        openCheckMore: false,
+        tableHide: false,
+        changeWidth: "180px",
         backFatherBtn: {
           status: false,
           title: "配置下单填选模板",
@@ -82,7 +84,6 @@ export default {
         },
       ],
       formData: {
-        status: "0,1",
         pageSize: 10,
         pageNum: 1,
       },
@@ -117,7 +118,7 @@ export default {
           label: "是否完成提现授权",
           prop: "gzhOpenId",
           hidden: true,
-          scope:"isgzhOpenId"
+          scope: "isgzhOpenId",
         },
         {
           label: "邀请人ID",
@@ -129,6 +130,11 @@ export default {
           prop: "parentName",
           hidden: true,
         },
+        {
+          label: "成交订单客户数",
+          prop: "orderPeopleNum",
+          hidden: true,
+        },
         {
           label: "累计推广员数",
           prop: "promotionNum",
@@ -142,11 +148,11 @@ export default {
           options: [
             {
               label: "有效",
-              value: 0,
+              value: 1,
             },
             {
               label: "禁止",
-              value: 1,
+              value: 0,
             },
           ],
         },
@@ -159,8 +165,19 @@ export default {
     this.search();
   },
   methods: {
+    statusChange(row) {
+      this.$api
+        .editDistributionseller({
+          sellerId: row.sellerId,
+          status: row.status === 1 ? 0 : 1,
+        })
+        .then((res) => {
+          this.$message.success("操作成功");
+          this.search();
+        });
+    },
     //关联业务员
-    sales(){
+    sales() {
       this.$refs.salesCheckout.showBox();
     },
     //添加
@@ -168,20 +185,19 @@ export default {
       this.$refs.formBox.showBox();
     },
     editClick(e) {
-      this.$refs.formBox.showBox(true);
+      this.$refs.formBox.showBox(e.sellerId);
     },
     search(v) {
       this.loading = true;
       if (v === 2) {
         this.formData = {
-          status: "0,1",
           pageSize: 10,
           pageNum: 1,
         };
       }
       var data = JSON.parse(JSON.stringify(this.formData));
       this.$api
-        .distributiontempsellerlist(data)
+        .distributionsellerlist(data)
         .then((res) => {
           this.tableData = res.rows;
           this.total = res.total;
@@ -194,26 +210,6 @@ export default {
     init() {
       this.search(2);
     },
-    del(v) {
-      this.$alert(
-        "确定删除此内容?<br />内容删除后将无法恢复,请慎重考虑",
-        "提示",
-        {
-          dangerouslyUseHTMLString: true,
-        }
-      )
-        .then(() => {
-          this.$message.success("删除成功");
-          this.search();
-        })
-        .catch(() => {
-          this.$message({
-            type: "info",
-            message: "已取消删除",
-          });
-        });
-    },
-
     handleSizeChange(v) {
       this.formData.pageSize = v;
       this.formData.pageNum = 1;

+ 186 - 18
src/views/Marketing/distribution/salesmanList/salesCheckout.vue

@@ -2,7 +2,7 @@
   <div id="">
     <el-dialog
       :visible.sync="dialogVisible"
-      width="560px"
+      width="960px"
       :show-close="false"
       :close-on-click-modal="false"
     >
@@ -12,16 +12,37 @@
           <img src="@/assets/images/Close@2x.png" alt="" @click="close" />
         </div>
       </div>
-      <div>
-        <label
-          >姓名:<el-input
-            style="width: 200px"
-            v-model="listData.name"
-            placeholder="请输入姓名"
-          ></el-input></label
-        ><el-button>搜索</el-button>
-      </div>
-      表格<br />分页
+      <search-box-new
+        ref="searchBox"
+        :formData="formData"
+        :formList="formList"
+        @search="search"
+        @init="search(1)"
+      />
+      <table-list
+        rowKey="userId"
+        ref="tableList"
+        :tableSets="tableSet"
+        :tableData="tableData"
+        :navText="navText"
+        :loading="loading"
+      >
+        <template slot="btn" slot-scope="props">
+          <el-button type="text" @click="statusChange(props.scope.row)">{{
+            props.scope.row.status === 1 ? "禁用" : "启用"
+          }}</el-button>
+          <el-button type="text" @click="editClick(props.scope.row)"
+            >修改</el-button
+          >
+        </template>
+      </table-list>
+      <pagination
+        :total="total"
+        :pageSize="formData.pageSize"
+        :currentPage="formData.pageNum"
+        @handleSizeChange="handleSizeChange"
+        @handleCurrentChange="handleCurrentChange"
+      />
       <span slot="footer" class="dialog-footer">
         <el-button @click="close">取 消</el-button>
         <el-button type="primary" :loading="disabledBtn" @click="submit"
@@ -33,31 +54,178 @@
 </template>
 
 <script>
+import searchBoxNew from "@/components/searchBoxNew";
+import tableList from "@/components/tableList";
+import pagination from "@/components/pagination";
 export default {
+  components: { searchBoxNew, tableList, pagination },
   data() {
     return {
+      loading: false, //当前表单加载是否加载动画
+      navText: {
+        title: "学员端账号",
+        index: 0,
+        ch: "条",
+        num: true,
+        choice: true,
+        addHide: true,
+        openCheckMore: true,
+        tableHide: true,
+        changeWidth: "180px",
+        backFatherBtn: {
+          status: false,
+          title: "配置下单填选模板",
+        },
+      },
       dialogVisible: false,
       disabledBtn: false,
       //   弹窗数据
-      listData: {},
+      formData: {
+        realname:"",
+        status: "0,1",
+        pageSize: 10,
+        pageNum: 1,
+      },
+      formList: [
+        {
+          lable: "用户昵称",
+          prop: "nickname",
+          placeholder: "请输入用户昵称",
+        },
+      ],
+      tableData: [], //表单数据
+      total: 0, //一共多少条
+      // 表单
+      tableSet: [
+        {
+          label: "用户编码",
+          prop: "studentCode",
+          hidden: true,
+        },
+        {
+          label: "头像",
+          prop: "avatar",
+          hidden: true,
+          scope: "img",
+        },
+        {
+          label: "昵称",
+          prop: "nickname",
+          hidden: true,
+        },
+        {
+          label: "性别",
+          prop: "sex",
+          hidden: true,
+          scope: "sex",
+        },
+        {
+          label: "姓名",
+          prop: "realname",
+          hidden: true,
+        },
+        {
+          label: "身份证",
+          prop: "idCard",
+          hidden: true,
+        },
+        {
+          label: "手机号码",
+          prop: "telphone",
+          hidden: true,
+        },
+        {
+          label: "所在城市",
+          prop1: "province",
+          prop2: "city",
+          prop3: "district",
+          hidden: true,
+          scope: "address",
+        },
+        {
+          label: "注册时间",
+          prop: "createTime",
+          hidden: true,
+          scope: "aTimeList",
+        },
+        {
+          label: "归属来源",
+          prop: "registerPlat",
+          hidden: true,
+          scope: "ptai",
+        },
+        {
+          label: "最后一次登录时间",
+          prop: "lastLoginTime",
+          hidden: true,
+          scope: "aTimeList",
+        },
+      ],
     };
   },
   methods: {
     showBox() {
       this.dialogVisible = true;
+      this.$nextTick(() => {
+        this.search(1);
+      });
+    },
+    search(int) {
+      this.loading = true;
+      if (int === 1) {
+        this.formData = {
+        realname:"",
+          status: "0,1",
+          pageSize: 10,
+          pageNum: 1,
+        };
+        this.$refs.tableList.clearMoreActive();
+      }
+      console.log(this.formData)
+      this.$api
+        .inquireappuserlists(this.formData)
+        .then((res) => {
+          this.tableData = res.rows;
+          this.total = res.total;
+          this.navText.index = res.total;
+        })
+        .finally(() => {
+          this.loading = false;
+        });
     },
+
     submit() {
+      if (this.$refs.tableList.allCheckData.length === 0) {
+        this.$message.error("请勾选数据");
+        return;
+      }
+      const Array = this.$refs.tableList.allCheckData.map(
+        (item) => item.userId
+      );
       this.disabledBtn = true;
-      setTimeout(() => {
-        this.$message.success("修改成功");
-        this.disabledBtn = false;
-        this.dialogVisible = false;
-        this.search();
-      }, 500);
+      this.$api
+        .distributionsellerbatchAdd({ userIds: Array })
+        .then((res) => {
+          this.$message.success("操作成功");
+          this.dialogVisible = false;
+          this.$parent.search();
+        })
+        .finally(() => {
+          this.disabledBtn = false;
+        });
     },
     close() {
       this.dialogVisible = false;
     },
+    handleSizeChange(v) {
+      this.formData.pageSize = v;
+      this.formData.pageNum = 1;
+      this.search();
+    },
+    handleCurrentChange(v) {
+      this.formData.pageNum = v;
+      this.search();
+    },
   },
 };
 </script>