企微助手 ,仓库名 短剧

createFriendsCircle.vue 19KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554
  1. <template>
  2. <div class="createMassMsg" v-loading="loading">
  3. <div class="backBox" @click="$router.go(-1)">
  4. <div class="back">
  5. <i class="el-icon-back"></i>
  6. <span>返回</span>
  7. </div>
  8. </div>
  9. <div v-if="!loading" class="bg-ffffff" style="padding: 15px;">
  10. <h3 class="bigTitle">朋友圈类型 </h3>
  11. <div class="self-hint" style="margin-top:10px;width:730px">
  12. <i class="el-icon-message-solid"></i>
  13. <div v-if="fc_type==1">管理员可创建客户朋友圈发表任务,成员确认内容后即可发布到朋友圈中,每位客户的朋友圈每个月最多展示4条企业发表的内容电脑上暂不支持发送企微朋友圈。 </div>
  14. <div v-if="fc_type==0">管理员可创建客户朋友圈发表任务,成员确认内容后即可发布到朋友圈中,每位客户的朋友圈每天最多展示3条个人发表的内容。电脑上暂不支持发送企微朋友圈。 </div>
  15. </div>
  16. <div class="regulations">
  17. <label>朋友圈类型:</label>
  18. <div>
  19. <div style="display:flex">
  20. <el-radio v-model="fc_type" :label="1">企业发表</el-radio>
  21. <el-radio v-model="fc_type" :label="0">个人发表</el-radio>
  22. </div>
  23. </div>
  24. </div>
  25. <div class="line" style="margin-top:20px"></div>
  26. <h3 class="bigTitle">编辑朋友圈</h3>
  27. <div class="regulations">
  28. <label><em>*</em>朋友圈主题</label>
  29. <el-input placeholder="例:活动推送/拉新等" style="width:300px" v-model.trim="themeName" clearable size="small"></el-input>
  30. </div>
  31. <div class="regulations">
  32. <label><em>*</em>发表成员:</label>
  33. <div>
  34. <div style="display:flex">
  35. <el-radio :disabled="!editFlag" v-model="is_for_all" :label="1">全部员工</el-radio>
  36. <el-radio :disabled="!editFlag" v-model="is_for_all" :label="0">部分员工</el-radio>
  37. </div>
  38. <self-customerservice-f-c :disabled="!editFlag" v-if="is_for_all==0" title='' width="300px" :afferent_users='user_id_list' @customerDefine="(val)=>{user_id_list=val;}" style="margin-top: 10px"></self-customerservice-f-c>
  39. </div>
  40. </div>
  41. <div class="regulations">
  42. <label><em>*</em>选择客户</label>
  43. <div>
  44. <div>
  45. <el-radio v-model="customer_filter" :disabled="!editFlag" :label="0" @change="changeEvent">全部客户</el-radio>
  46. <el-radio v-model="customer_filter" :disabled="!editFlag" :label="1" @change="changeEvent">筛选客户</el-radio>
  47. </div>
  48. <div class="" v-if="customer_filter==1">
  49. <enterprise-tag title="" width="300px" :disabled="!editFlag" :afferent_obj='afferent_tag_obj' :reset='resetFlag' @tagDefine="tagDefine" style="margin:0;margin-top: 10px"></enterprise-tag>
  50. </div>
  51. <div class="customer_all">将群发消息给{{customer_filter==0?'全部客户的':customer_filter==1?'筛选客户的':''}}
  52. <span @click="massMsg_customerMatchCount" v-if="isLookCount" class="pointer"><i class="el-icon-loading" v-if="customerMatchCountLoading"></i> {{!customerMatchCountLoading?'查看':''}}</span>
  53. <span v-else>{{msg_count}}</span>
  54. 个客户
  55. </div>
  56. </div>
  57. </div>
  58. <div class="regulations">
  59. <label>消息内容1</label>
  60. <el-input
  61. class="contentOne"
  62. style="width: 50%"
  63. type="textarea"
  64. rows="6"
  65. autocomplete="off"
  66. placeholder="请输入消息内容"
  67. v-model="content1"
  68. show-word-limit
  69. maxlength="1000"></el-input>
  70. </div>
  71. <div class="regulations">
  72. <label>消息内容2</label>
  73. <div style="width: 100%">
  74. <div style="display:flex">
  75. <el-radio v-model="con_type" :label="0" style="width: 60px">图片</el-radio>
  76. <el-radio v-model="con_type" :label="1" style="width: 60px">视频</el-radio>
  77. <el-radio v-model="con_type" :label="2" >图文链接</el-radio>
  78. </div>
  79. <conTwo :conType="con_type"></conTwo>
  80. </div>
  81. </div>
  82. <div class="line" style="margin-top:20px"></div>
  83. <h3 class="bigTitle" style="margin-top:20px">高级设置: </h3>
  84. <div class="regulations">
  85. <label><em>*</em>发布方式:</label>
  86. <div>
  87. <div style="display:flex">
  88. <el-radio v-model="send_type" :label="1">立即发送</el-radio>
  89. <el-radio v-model="send_type" :label="0">定时发送</el-radio>
  90. </div>
  91. <div style="margin-top:15px;" v-if="send_type==0">
  92. <el-date-picker v-model="send_time.date" :picker-options="pickerOptions" :disabled="!editFlag" size="small" value-format="yyyy-MM-dd" type="date" style="width:160px" placeholder="选择日期"></el-date-picker>
  93. <el-time-picker v-model="send_time.time" :disabled="!editFlag" size="small" format="HH:mm" value-format="HH:mm:ss" placeholder="请输入时间" style="width:130px"></el-time-picker>
  94. </div>
  95. </div>
  96. </div>
  97. <div class="regulations regulations2">
  98. <label></label>
  99. <div class="operationProcess">
  100. <div class="process-title">
  101. <h3>企业发表朋友圈的操作流程</h3>
  102. <div class="zhankai" @click="processFlag=!processFlag">展开 <i :class="['el-icon-arrow-down',processFlag?'reversalAnimation':'']"></i></div>
  103. </div>
  104. <p class="process-hint">1、创建完朋友圈后,员工将在企业微信上收到【客户朋友圈】新消息通知</p>
  105. <p class="process-hint">2、员工点击【客户朋友圈】,点击待发送的朋友圈,可一键将朋友圈内容发表</p>
  106. <img v-if="processFlag" src="@/assets/img/exterprise-mass-send.png" class="img" alt="">
  107. </div>
  108. </div>
  109. <button class="button" @click="welcomeMsg_set">通知成员发送</button>
  110. </div>
  111. </div>
  112. </template>
  113. <script>
  114. import selfCustomerserviceFC from '@/components/assembly/screen/customerServiceFC.vue'
  115. import editCon from '@/components/assembly/editCon.vue'
  116. import welcomEdit from '@/components/assembly/welcom_edit.vue'
  117. import enterpriseTag from '@/components/assembly/screen/enterpriseTag.vue'
  118. import datePicker from '@/components/assembly/screen/datePicker.vue'
  119. import conTwo from '@/components/assembly/conTwo.vue'
  120. export default {
  121. name:'createFriendsCircle',
  122. components: { selfCustomerserviceFC, editCon, welcomEdit, enterpriseTag, datePicker, conTwo },
  123. data () {
  124. return {
  125. loading: false,
  126. user_id_list: [],
  127. fc_type: 0,
  128. editFlag: true,
  129. is_day_parting: false,
  130. name: '',
  131. deleteTimeIntervalList: [],//删除的分时段列表
  132. timeIntervalList: [],//分时段列表
  133. init_welcom_con: {
  134. is_day_parting: 1,//是否为分时段欢迎语 0:否 1:是
  135. weeks: [1, 2, 3, 4, 5, 6, 0],
  136. start_time: '',
  137. end_time: '',
  138. content: '',
  139. attachments: [],
  140. },
  141. main_msg_data: {
  142. "is_day_parting": 0,
  143. "weeks": [],
  144. "start_time": "",
  145. "end_time": "",
  146. "content": '',
  147. "attachments": []
  148. },
  149. dataInfo: {},
  150. is_for_all: 1,
  151. customer_filter: 0,
  152. gender: 3,
  153. customerMatchCountLoading: false,
  154. isLookCount: true,//是否查看群发的客户数
  155. msg_count: '',
  156. afferent_tag_obj: {
  157. tag_id_list: [],
  158. tag: 1
  159. },
  160. resetFlag: false,
  161. send_type:1,
  162. processFlag: false,
  163. send_time: {
  164. date: '',
  165. time: ''
  166. },
  167. pickerOptions: {
  168. disabledDate (time) {
  169. return time < Date.now() - 8.64e7;
  170. },
  171. shortcuts: [{
  172. text: '今天',
  173. onClick (picker) {
  174. picker.$emit('pick', new Date());
  175. }
  176. }, {
  177. text: '明天',
  178. onClick (picker) {
  179. const date = new Date();
  180. date.setTime(date.getTime() + 3600 * 1000 * 24);
  181. picker.$emit('pick', date);
  182. }
  183. }, {
  184. text: '一周后',
  185. onClick (picker) {
  186. const date = new Date();
  187. date.setTime(date.getTime() + 3600 * 1000 * 24 * 7);
  188. picker.$emit('pick', date);
  189. }
  190. }]
  191. },
  192. content1:'',
  193. con_type:0,
  194. themeName:''
  195. }
  196. },
  197. created () {
  198. if (this.$route.params.rule_id) {//详情
  199. this.detail()
  200. } else {
  201. this.loading = false;
  202. }
  203. },
  204. methods: {
  205. changeEvent () {
  206. this.isLookCount = true
  207. },
  208. tagDefine (data) {//标签选择回调
  209. this.isLookCount = true
  210. if (data.tag == 1 || data.tag == 2) {
  211. if (data.tag_id_list && data.tag_id_list.length != 0) {
  212. this.tag_info = {
  213. tag_id_list: data.tag_id_list,
  214. tag_type: data.tag
  215. }
  216. } else {
  217. this.tag_info = {
  218. tag_id_list: [],
  219. tag_type: 0
  220. }
  221. }
  222. } else {
  223. this.tag_info = {
  224. tag_id_list: [],
  225. tag_type: data.tag
  226. }
  227. }
  228. },
  229. massMsg_customerMatchCount () {//群发规则匹配客户数查询
  230. if (this.customerMatchCountLoading) return;
  231. this.customerMatchCountLoading = true;
  232. let params = {
  233. senders: this.is_for_all == 0 ? this.user_id_list.join(',') : '',
  234. customer_filter: this.customer_filter
  235. }
  236. // if (this.customer_filter == 1) {//筛选客户
  237. // params.gender = this.gender;
  238. // params.add_time_start = this.afferent_time && this.afferent_time.length > 1 ? this.afferent_time[0] : '';
  239. // params.add_time_end = this.afferent_time && this.afferent_time.length > 1 ? this.afferent_time[1] : '';
  240. // params.tag_screen_type = this.tag_info && this.tag_info.tag_type ? this.tag_info.tag_type : 0;
  241. // params.tag_list = this.tag_info && this.tag_info.tag_id_list ? this.tag_info.tag_id_list.join(',') : '';
  242. // params.exclude_tag_list = this.exclude_tag_info && this.exclude_tag_info.tag_id_list ? this.exclude_tag_info.tag_id_list.join(',') : '';
  243. // }
  244. this.$axios.get(this.URL.BASEURL + this.URL.massMsg_customerMatchCount, {
  245. params
  246. }).then((res) => {
  247. var res = res.data
  248. this.customerMatchCountLoading = false
  249. this.isLookCount = false
  250. if (res && res.errno == 0) {
  251. this.msg_count = res.rst.total;
  252. } else if (res.errno != 4002) {
  253. this.$message({
  254. message: res.err,
  255. type: "warning"
  256. })
  257. }
  258. }).catch((err) => {
  259. this.customerMatchCountLoading = false
  260. });
  261. },
  262. detail () {//详情
  263. this.loading = true
  264. this.$axios.get(this.URL.BASEURL + this.URL.welcomeMsg_detail, {
  265. params: {
  266. rule_id: this.$route.params.rule_id
  267. }
  268. }).then((res) => {
  269. var res = res.data
  270. this.loading = false
  271. if (res && res.errno == 0) {
  272. this.dataInfo = res.rst;
  273. this.fc_type = res.rst.fc_type;
  274. this.user_id_list = res.rst.users ? res.rst.users.split(',') : [];
  275. this.name = res.rst.name;
  276. let msg_list = res.rst.msg_list;
  277. msg_list.forEach((item) => {
  278. // item.content = item.content ? item.content.replace('%NICKNAME%', '「客户昵称」') : '';
  279. item.attachments = item.attachments && item.attachments != '' ? JSON.parse(item.attachments) : [];
  280. item.weeks = item.weeks ? item.weeks.split(',') : []
  281. })
  282. let main_msg_data = msg_list.filter((v) => {//特定有一个主欢迎语内容
  283. return v.is_day_parting == 0
  284. })
  285. this.main_msg_data = main_msg_data && main_msg_data.length > 0 ? main_msg_data[0] : {};
  286. this.timeIntervalList = msg_list.filter((v) => {//分时段欢迎语内容
  287. return v.is_day_parting == 1
  288. })
  289. if (msg_list.length > 1) {
  290. this.is_day_parting = true
  291. }
  292. } else if (res.errno != 4002) {
  293. this.$message({
  294. message: res.err,
  295. type: "warning"
  296. })
  297. }
  298. }).catch((err) => {
  299. this.loading = false
  300. });
  301. },
  302. getAttachment (val) {
  303. this.main_msg_data.attachments = val;
  304. },
  305. getWelcomEdit (val, index) {//分时段编辑
  306. this.$set(this.timeIntervalList, index, val)
  307. },
  308. deleteWelcomCon (index) {//删除分时段
  309. if (this.$route.params.rule_id && this.timeIntervalList[index].msg_id) {//删除的分时段内容
  310. let obj = JSON.parse(JSON.stringify(this.timeIntervalList[index]))
  311. obj.operate = 'del';
  312. this.deleteTimeIntervalList.push(obj)
  313. }
  314. this.timeIntervalList.splice(index, 1)
  315. },
  316. addWelcom () {//添加分时段
  317. this.timeIntervalList.push(this.init_welcom_con)
  318. },
  319. welcomeMsg_set () {//保存
  320. if (this.name == '') {
  321. this.$message({
  322. message: '请输入欢迎语标题!',
  323. type: "warning"
  324. })
  325. return
  326. }
  327. if (this.fc_type == 0 && (!this.user_id_list || this.user_id_list.length == 0)) {
  328. this.$message({
  329. message: '请选择使用成员!',
  330. type: "warning"
  331. })
  332. return
  333. }
  334. if (this.main_msg_data.content == '' && (!this.main_msg_data.attachments || this.main_msg_data.attachments == '' || this.main_msg_data.attachments.length == 0)) {
  335. this.$message({
  336. message: '请输入【主】欢迎语内容!',
  337. type: "warning"
  338. })
  339. return
  340. }
  341. if (this.main_msg_data.content != '' && this.$getStrBytes(this.main_msg_data.content) > 4000) {
  342. this.$message({
  343. message: '请检查【主】欢迎语内容,最多4000个字节,已超出!',
  344. type: "error"
  345. })
  346. return
  347. }
  348. let msg_data = []
  349. if (this.is_day_parting) {//开启分段欢迎语
  350. for (let i = 0; i < this.timeIntervalList.length; i++) {
  351. let item = this.timeIntervalList[i];
  352. if (item.content == '' && (!item.attachments || item.attachments == '' || item.attachments.length == 0)) {
  353. this.$message({
  354. message: `请输入【时段${i + 1}】欢迎语内容!`,
  355. type: "warning"
  356. })
  357. return
  358. }
  359. if (item.content != '' && this.$getStrBytes(item.content) > 4000) {
  360. this.$message({
  361. message: `请检查【时段${i + 1}】欢迎语内容,最多4000个字节,已超出!`,
  362. type: "error"
  363. })
  364. return
  365. }
  366. if (!item.weeks || item.weeks.length == 0) {
  367. this.$message({
  368. message: `请选择【时段${i + 1}】发送日期!`,
  369. type: "warning"
  370. })
  371. return
  372. }
  373. if (!item.start_time || item.start_time == '') {
  374. this.$message({
  375. message: `请输入【时段${i + 1}】发送开始时间!`,
  376. type: "warning"
  377. })
  378. return
  379. }
  380. if (!item.end_time || item.end_time == '') {
  381. this.$message({
  382. message: `请输入【时段${i + 1}】发送结束时间!`,
  383. type: "warning"
  384. })
  385. return
  386. }
  387. if (this.$date_compatible(('2020-04-01 ' + item.start_time)).getTime() > this.$date_compatible(('2020-04-01 ' + item.end_time)).getTime()) {
  388. this.$message({
  389. message: `请正确输入【时段${i + 1}】发送时间!`,
  390. type: "warning"
  391. })
  392. return
  393. }
  394. }
  395. msg_data = msg_data.concat(this.timeIntervalList)
  396. } else {//关闭分段欢迎语
  397. let delete_arr = JSON.parse(JSON.stringify(this.timeIntervalList));
  398. delete_arr = delete_arr.filter((v) => {
  399. return v.msg_id
  400. })
  401. delete_arr.forEach((item) => {
  402. item.operate = 'del'
  403. })
  404. this.deleteTimeIntervalList = this.deleteTimeIntervalList.concat(delete_arr)
  405. }
  406. msg_data = msg_data.concat(this.deleteTimeIntervalList);//删除的分时段内容
  407. msg_data.push(this.main_msg_data)
  408. msg_data.forEach((item) => {
  409. item.weeks = item.weeks.join(',');
  410. // item.content = item.content.replace('「客户昵称」', '%NICKNAME%')
  411. item.attachments = item.attachments == '' || item.attachments.length == 0 ? '' : JSON.stringify(item.attachments)
  412. })
  413. this.$loading(this.$loadingConfig)
  414. this.$axios.post(this.URL.BASEURL + this.URL.welcomeMsg_set, {
  415. rule_id: this.$route.params.rule_id ? this.$route.params.rule_id : '',
  416. name: this.name,
  417. fc_type: this.fc_type,
  418. users: this.fc_type == 0 ? this.user_id_list.join(',') : '',
  419. msg_data: msg_data
  420. }).then((res) => {
  421. var res = res.data
  422. this.$loading(this.$loadingConfig).close()
  423. if (res && res.errno == 0) {
  424. this.$router.go(-1)
  425. } else if (res.errno != 4002) {
  426. this.$message({
  427. message: res.err,
  428. type: "warning"
  429. })
  430. }
  431. }).catch((err) => {
  432. this.$loading(this.$loadingConfig).close()
  433. });
  434. }
  435. }
  436. }
  437. </script>
  438. <style lang="scss">
  439. .contentOne{
  440. .el-textarea__inner{
  441. background-color: #fafafa;
  442. }
  443. }
  444. </style>
  445. <style lang="scss" scoped>
  446. @import "./create.scss";
  447. .reversalAnimation {
  448. transform: rotate(180deg);
  449. }
  450. .button {
  451. width: 178px;
  452. height: 40px;
  453. background: #00b38a;
  454. border-radius: 5px;
  455. color: #ffffff;
  456. font-size: 14px;
  457. border: none;
  458. margin: 40px 100px;
  459. }
  460. .add_welcom_hint {
  461. color: #00b38a;
  462. font-size: 16px;
  463. font-weight: bold;
  464. margin-left: 90px;
  465. margin-top: 10px;
  466. margin-bottom: 20px;
  467. cursor: pointer;
  468. display: inline-block;
  469. }
  470. .screeningCustomers {
  471. width: 659px;
  472. background: #fafafa;
  473. border: 1px solid #e9e9e9;
  474. padding: 15px;
  475. padding-bottom: 0;
  476. margin-top: 15px;
  477. .screeningItem {
  478. display: flex;
  479. align-items: center;
  480. margin-bottom: 20px;
  481. label {
  482. width: 100px;
  483. color: #666666;
  484. font-size: 14px;
  485. line-height: 20px;
  486. display: inline-block;
  487. text-align: right;
  488. line-height: 30px;
  489. }
  490. .screening-hint {
  491. color: #777777;
  492. font-size: 14px;
  493. line-height: 20px;
  494. margin-top: 10px;
  495. }
  496. }
  497. }
  498. .customer_all {
  499. background: #edf8fd;
  500. color: #383e47;
  501. font-size: 14px;
  502. line-height: 21px;
  503. padding: 6px 15px;
  504. margin-top: 10px;
  505. span {
  506. color: #43b083;
  507. font-weight: bold;
  508. }
  509. }
  510. .operationProcess {
  511. width: 710px;
  512. background: #fafafa;
  513. padding: 15px;
  514. .process-title {
  515. display: flex;
  516. align-items: center;
  517. justify-content: space-between;
  518. margin-bottom: 16px;
  519. h3 {
  520. color: #333333;
  521. font-size: 15px;
  522. font-weight: bold;
  523. }
  524. .zhankai {
  525. color: #666;
  526. font-size: 13px;
  527. cursor: pointer;
  528. transition: all 0.5s;
  529. }
  530. }
  531. .process-hint {
  532. font-size: 14px;
  533. font-weight: 400;
  534. color: rgba(0, 0, 0, 0.45);
  535. line-height: 20px;
  536. margin-bottom: 8px;
  537. }
  538. .img {
  539. width: 100%;
  540. }
  541. }
  542. </style>