Model.vue 12.7 KB
<template>
  <GLDialog :title="title" :visible.sync="visible" mode="big" :before-close="handleClose">
    <el-form :model="tplForm" class="basic-form" :rules="tplRules" ref="tplForm" label-width="154px">
      <template v-if="[7, 8, 9, 10].includes(taskType)">
        <el-form-item label="跟进员工类型:">
          <el-select v-model="tplForm.followerTypeId" @change="valueChange" @focus="groupFocus" :size="size" value-key="id" placeholder="请选择">
            <el-option v-for="item in followList" :key="item.id" :label="item.followName" :value="item.id"></el-option>
          </el-select>
        </el-form-item>
      </template>

      <el-form-item label="营销内容:">
        <GLEditor ref="welcome" :form="'customer'" style="line-height: 12px; width: 580px" boxHeight="200" :btnList="btnList" @previewWord="previewForm"></GLEditor>
      </el-form-item>
    </el-form>
    <div class="explain" v-show="taskType == 8 || taskType == 9">
      说明:
      <div>
        素材和活动属于营销链接,与图片、视频最多仅支持选择一种类型;
        <br />
        营销链接最多可在素材和活动中各选一个;
        <br />
        图片支持格式:.jpg .png,最多可上传9张,大小不超过10M,尺寸不超过1080*1080;
        <br />
        视频支持格式:.mp4,最多可上传1个,大小不超过10M,时长不超过30s。
        <br />
      </div>
    </div>
    <div class="explain" v-show="taskType == 5 || taskType == 7">
      示例

      <div>
        · 设定内容:您有{客户人数}位客户已进入可报价3天,请及时进行报价跟进。
        <br />
        · 实际发送内容:您有10位客户已进入可报价3天,请及时进行报价跟进。
        <br />
      </div>
    </div>
    <div class="explain" v-show="taskType == 10">提示:请及时联系运营人员完成短信签名认证,否则将影响短信发送</div>
    <span slot="footer" class="dialog-footer">
      <el-button size="small" @click="handleClose">取 消</el-button>
      <el-button size="small" type="primary" @click="handleSelect">确 定</el-button>
    </span>
  </GLDialog>
</template>
  <script>
export default {
  props: {
    tplVisible: Boolean,
    taskType: {
      type: String,
      default: '7'
    }
  },
  data() {
    return {
      visible: false,
      tplForm: {
        followerTypeId: '',
        staffUserIds: '',
        attachments: []
      },
      tplRules: {
        // userList: [{ validator: validatorUser, trigger: 'change' }],
      },
      followList: [],

      btnList: [
        {
          name: '表情',
          funcName: '',
          type: 'expression',
          limitSize: 10
        },
        {
          name: '图片',
          funcName: '',
          type: 'img',
          // togetherItem: [ATT_TYPE.TEXT], //只允许文本和图片
          // limitSize: 10,    //限制图片大小
          // limitNum: 2,      //限制图片数量
          // limitWidth: 10000, //限制单张图片宽度
          // limitHeight: 10000,//限制单张图片高度
          // Isdraggable: true, //图片拖拽
          uploadApi: this.$apis.common.pictureUpload
        },
        {
          name: '活动',
          type: 'activity',
          funName: 'activity',
          funParams: [
            {
              itemName: '权益卡试用',
              itemValue: 3,
              itemType: 'card',
              getInterfaceApi: this.$apis.welcomeword.getCard,
              params: {
                tryAble: 1,
                merchantId: this.$globalState.session.merchantId
              }
            },
            {
              itemName: '权益套餐',
              itemValue: 4,
              itemType: 'package',
              getInterfaceApi: this.$apis.welcomeword.getPackage,
              params: {
                state: 1
              }
            },
            {
              itemName: '商城券',
              itemValue: 2,
              itemType: 'coupon',
              getInterfaceApi: this.$apis.welcomeword.getMerchant,
              params: {
                discountTypes: [2, 3, 4],
                directionalFlag: 1, // 1所有人可用2定向礼包专用3关联优惠券
                validType: 'valid',
                status: 2
              }
            },
            {
              itemName: '秒杀活动',
              itemValue: 5,
              itemType: 'activity',
              getInterfaceApi: this.$apis.welcomeword.getActivity,
              params: {
                // activityStatus: 2,
                activityStatusList: [1, 2],
                currentPage: 1
              }
            },
            {
              itemName: '众筹活动',
              itemValue: 8,
              itemType: 'crowdfunding',
              getInterfaceApi: this.$apis.welcomeword.crowdfundingActivity,
              params: {
                currentPage: 1,
                activityStatus: 2
              }
            },
            {
              itemName: '问卷调查',
              itemValue: 7,
              itemType: 'questionnaire',
              getInterfaceApi: this.$apis.welcomeword.activityQuestionnaireForm,
              params: {
                merchantId: this.$globalState.session.merchantId,
                statuses: [0, 1]
              }
            }
          ]
        },
        {
          name: '素材',
          type: 'material',
          funName: 'material',
          groupListApi: this.$apis.welcomeword.getGroupListApi,
          materialListApi: this.$apis.welcomeword.getMaterialListApi
          // pdfNo: 1
          // videoNo: 1
        },
        {
          name: '视频',
          funcName: '',
          type: 'video',
          // limitSize: 10, //限制视频大小
          //   togetherItem: [ATT_TYPE.TEXT], //只允许文本和图片
          limitNum: 1, //限制视频数量
          // limitWidth: 1280, //限制视频宽度
          // limitHeight: 720, //限制视频高度
          limitTime: 30, //限制视频时长
          paramsType: 'form-data',
          uploadApi: this.$apis.common.compressVideo
        }
      ]
    }
  },
  watch: {
    tplVisible(newVal) {
      this.visible = newVal
      this.getFollowListType()
    },
    taskType(newVal) {
      this.changeEdit(newVal)
      switch (this.taskType) {
        case 7:
          this.title = '企微提醒模版'
          break
        case 5:
          this.title = '门店助手提醒模版'
          break
        case 8:
        case 9:
          this.title = '营销模板'
          break
        case 10:
          this.title = '短信模版'
          break
      }
    }
  },
  mounted() {
    this.merchantId = this.$globalState.session.merchantId
  },
  methods: {
    renderParameter(options) {
      let { marketingId, marketingType } = options
      let obj = {
        3: `{"appId":"wxe10067a63c1856ac","title":"送您一张专属权益服务卡","page":"packageShopmall/packageEquity/pages/freecard/freecard?id=${marketingId}&merchantId={1}&nodeId={2}&sopId={3}","pic_url":"http://img01.glsx.com.cn/upload/biz/dracMini-qy-10004.png"}`,
        4: `{"appId":"wxe10067a63c1856ac","title":"专属权益服务套餐","page":"packageShopmall/packageEquity/pages/package/package?id=${marketingId}&merchantId={1}&nodeId={2}&sopId={3}","pic_url":"http://img01.glsx.com.cn/upload/biz/dracMini-qy-10004.png"}`,
        2: `{"appId":"wxe10067a63c1856ac","title":"送您一张商城优惠券","page":"packageShopmall/packageMall/pages/coupon/coupon?couponId=${marketingId}&merchantId=&{1}&issueDate={3}&nodeId={2}&sopId={3},"pic_url":"http://img01.glsx.com.cn/upload/biz/dracMini-yh-10004.png"}`,
        5: `{"appId":"wxe10067a63c1856ac","title":"您有一个秒杀活动可参加","page":"packageShopmall/packageMall/pages/detail/detail?isActivity=true&id=${marketingId}&merchantId={1}&nodeId={2}&sopId={3}","pic_url":"http://img01.glsx.com.cn/upload/biz/dracMini-ms-10004.png"}`,
        8: `{"appId":"wxe10067a63c1856ac","title":"您有一个众筹活动可参加","page":"pages/crowdfunding/index/index?isActivity=true&id=${marketingId}&merchantId={1}&nodeId={2}&sopId={3}","pic_url":"http://img01.glsx.com.cn/upload/biz/dracMini-ms-10004.png"}`,
        7: `{"appId":"wxe10067a63c1856ac","title":"您有一个新资讯,请及时查看","page":"packageMine/pages/questionnaire/questionnaire?id=${marketingId}&merchantId={1}&nodeId={2}&sopId={3}","pic_url":"http://img01.glsx.com.cn/upload/biz/dracMini-ms-10004.png"}`
      }
      return obj[marketingType]
    },
    changeEdit(taskType) {
      if (taskType == 7 || taskType == 5) {
        this.btnList = [
          {
            type: 'dataSize',
            name: '客户人数'
          }
        ]
      } else if (taskType == 10) {
        this.btnList = [
          {
            name: '活动',
            type: 'activity',
            funName: 'activity',
            funParams: [
              {
                itemName: '权益卡试用',
                itemValue: 3,
                itemType: 'card',
                getInterfaceApi: this.$apis.welcomeword.getCard,
                params: {
                  tryAble: 1,
                  merchantId: this.$globalState.session.merchantId
                }
              },
              {
                itemName: '权益套餐',
                itemValue: 4,
                itemType: 'package',
                getInterfaceApi: this.$apis.welcomeword.getPackage,
                params: {
                  state: 1
                }
              },
              {
                itemName: '商城券',
                itemValue: 2,
                itemType: 'coupon',
                getInterfaceApi: this.$apis.welcomeword.getMerchant,
                params: {
                  discountTypes: [2, 3, 4],
                  directionalFlag: 1, // 1所有人可用2定向礼包专用3关联优惠券
                  validType: 'valid',
                  status: 2
                }
              },
              {
                itemName: '秒杀活动',
                itemValue: 5,
                itemType: 'activity',
                getInterfaceApi: this.$apis.welcomeword.getActivity,
                params: {
                  // activityStatus: 2,
                  activityStatusList: [1, 2],
                  currentPage: 1
                }
              },
              {
                itemName: '众筹活动',
                itemValue: 8,
                itemType: 'crowdfunding',
                getInterfaceApi: this.$apis.welcomeword.crowdfundingActivity,
                params: {
                  currentPage: 1,
                  activityStatus: 2
                }
              },
              {
                itemName: '问卷调查',
                itemValue: 7,
                itemType: 'questionnaire',
                getInterfaceApi: this.$apis.welcomeword.activityQuestionnaireForm,
                params: {
                  merchantId: this.$globalState.session.merchantId,
                  statuses: [0, 1]
                }
              }
            ]
          },
          {
            name: '素材',
            type: 'material',
            funName: 'material',
            groupListApi: this.$apis.welcomeword.getGroupListApi,
            materialListApi: this.$apis.welcomeword.getMaterialListApi
            // pdfNo: 1
            // videoNo: 1
          }
        ]
      }
    },
    //跟进员工类型
    getFollowListType() {
      this.$apis.journeyConfig.getFollowListType({ flag: 0 }).then(res => {
        this.followList = res
      })
    },
    //根据跟进员工类型获取员工
    valueChange(val) {
      let staffUserIds = []
      this.$apis.journeyConfig.getStaffList({ followerTypeId: val, pageNum: 1, pageSize: 9999 }).then(res => {
        res.data.forEach(val => {
          staffUserIds.push(val.userId)
        })
        this.tplForm.staffUserIds = staffUserIds.join(',')
        this.tplForm.followName = this.followList.filter(item=>item.id ==val )[0].followName
      })
    },
    previewForm(val) {
      const value = this.$common.utils.deepClone(val)
      console.log(value, 111111111111)
      if (value[0] && !value[0].attContent) value.splice(0, 1)
      this.tplForm.attContentList=this.$common.utils.deepClone(value)
      value.forEach(activity => {
        if (activity.attType == 7) {
          activity.attType = 4
          activity.attContent = this.renderParameter(activity.attContent)
        }
      })
      console.log(this.tplForm)
      this.tplForm.attachments = value
    },
    handleClose() {
      this.$emit('dialogClose', false)
    },
    handleSelect() {
      this.$emit('confirm', this.tplForm)
    }
  }
}
</script>
  <style scoped lang="scss">
.explain {
  font-size: 14px;
  color: #999999;
  line-height: 22px;
  margin: 12px 0 0 154px;
}
</style>