sendMsgOpenTool.vue 53 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188
  1. <template>
  2. <div class="app-container">
  3. <el-dialog :title="sendMsgOpen.title" :visible.sync="sendMsgOpen.open" width="1000px" append-to-body>
  4. <el-alert
  5. type="error"
  6. :closable="false"
  7. show-icon>
  8. <template #title>
  9. <span style="font-size: 25px; line-height: 1.5;">
  10. 此功能用于给 选中的 营期 内【所有的】客户发送 消息
  11. </span>
  12. </template>
  13. </el-alert>
  14. <el-form ref="msgForm" :model="msgForm" :rules="msgRules" label-width="100px">
  15. <el-form-item label="策略" prop="draftStrategy">
  16. <el-radio-group v-model="msgForm.draftStrategy">
  17. <el-radio :label="1">正常群发</el-radio>
  18. <el-radio :label="2">清除草稿</el-radio>
  19. <el-radio :label="3">发送草稿</el-radio>
  20. </el-radio-group>
  21. </el-form-item>
  22. <el-form-item label="选择课程" v-if="msgForm.draftStrategy==1" >
  23. <el-select v-model="msgForm.courseId" placeholder="请选择课程" style=" margin-right: 10px;" size="mini" filterable @change="courseChange()">
  24. <el-option
  25. v-for="dict in courseList"
  26. :key="dict.dictValue"
  27. :label="dict.dictLabel"
  28. :value="parseInt(dict.dictValue)"
  29. />
  30. </el-select>
  31. <el-select v-model="msgForm.videoId" placeholder="请选择小节" size="mini" style=" margin-right: 10px;" filterable @change="videoIdChange()" >
  32. <el-option
  33. v-for="dict in videoList"
  34. :key="dict.dictValue"
  35. :label="dict.dictLabel"
  36. :value="parseInt(dict.dictValue)"
  37. />
  38. </el-select>
  39. <el-select v-model="msgForm.courseType" placeholder="请选择消息类型" size="mini" style=" margin-right: 10px;">
  40. <el-option
  41. v-for="dict in sysFsSopWatchStatus"
  42. :key="dict.dictValue"
  43. :label="dict.dictLabel"
  44. :value="parseInt(dict.dictValue)"
  45. />
  46. </el-select>
  47. </el-form-item>
  48. <el-form-item label="选择直播间">
  49. <el-select v-model="msgForm.liveId"
  50. filterable
  51. placeholder="请选择直播间" size="mini"
  52. style=" margin-right: 10px;"
  53. @change="liveChangemsgForm(msgForm.liveId)" clearable >
  54. <el-option
  55. v-for="dict in liveList"
  56. :key="dict.liveId"
  57. :label="dict.liveName"
  58. :value="dict.liveId"
  59. />
  60. </el-select>
  61. </el-form-item>
  62. <el-form-item label="规则" prop="setting" v-if="msgForm.draftStrategy==1" >
  63. <div v-for="(item, index) in setting" :key="index" style="background-color: #fdfdfd; border: 1px solid #e6e6e6; margin-bottom: 20px;">
  64. <el-row>
  65. <el-col :span="22">
  66. <el-form :model="item" label-width="70px">
  67. <el-form-item label="内容类别" style="margin: 2%">
  68. <el-radio-group v-model="item.contentType">
  69. <el-radio :label="item.dictValue" v-for="item in sysQwSopAiContentType" @change="handleContentTypeChange()">{{item.dictLabel}}</el-radio>
  70. </el-radio-group>
  71. </el-form-item>
  72. <!-- <div v-if="item.contentType == 12">
  73. <el-card class="box-card">
  74. <el-form-item label="直播间" >
  75. <el-select v-model="item.liveId"
  76. placeholder="请选择直播间" size="mini"
  77. @change="liveChange(item)" >
  78. <el-option
  79. v-for="dict in liveList"
  80. :key="dict.liveId"
  81. :label="dict.liveName"
  82. :value="dict.liveId"
  83. />
  84. </el-select>
  85. </el-form-item>
  86. <el-form-item label="标题" prop="miniprogramTitle">
  87. <el-input v-model="item.miniprogramTitle" placeholder="请输入小程序消息标题,最长为64字节" :rows="2" maxlength="64"
  88. type="textarea" />
  89. </el-form-item>
  90. <el-form-item label="封面" prop="miniprogramPicUrl">
  91. <ImageUpload v-model="item.miniprogramPicUrl" type="image" :num="10" :width="150" :height="150" />
  92. </el-form-item>
  93. <el-form-item label="appid" prop="miniprogramAppid" v-show="false">
  94. <el-input v-model="item.miniprogramAppid='wx503cf8ab31f83dd4' " disabled />
  95. </el-form-item>
  96. <el-form-item label="page路径" prop="miniprogramPage" v-show="false" label-width="100px" style="margin-left: -30px">
  97. <el-input v-model="item.miniprogramPage" placeholder="小程序消息打开后的路径" disabled />
  98. </el-form-item>
  99. </el-card>
  100. </div> -->
  101. <el-form-item label="内容" style="margin-bottom: 2%" >
  102. <div v-if="item.contentType == 12 || item.contentType == 18 || item.contentType == 19 || item.contentType == 24 || item.contentType == 25">
  103. <el-card class="box-card">
  104. <el-form-item label="直播间" >
  105. <el-select v-model="item.liveId"
  106. filterable
  107. placeholder="请选择直播间" size="mini"
  108. @change="liveChange(item)" :disabled="liveDisabled()">
  109. <el-option
  110. v-for="dict in liveList"
  111. :key="dict.liveId"
  112. :label="dict.liveName"
  113. :value="dict.liveId"
  114. />
  115. </el-select>
  116. </el-form-item>
  117. <el-form-item label="标题" prop="miniprogramTitle">
  118. <el-input :disabled="liveDisabled()" v-model="item.miniprogramTitle" placeholder="请输入小程序消息标题,最长为64字节" :rows="2" maxlength="64"
  119. type="textarea" />
  120. </el-form-item>
  121. <el-form-item label="封面" prop="miniprogramPicUrl">
  122. <ImageUpload :disabled="liveDisabled()" v-model="item.miniprogramPicUrl" type="image" :num="10" :width="150" :height="150" />
  123. </el-form-item>
  124. <el-form-item label="appid" prop="miniprogramAppid" v-show="false">
  125. <el-input v-model="item.miniprogramAppid='wxcfd4cd6e2375e42f' " disabled />
  126. </el-form-item>
  127. <el-form-item label="page路径" prop="miniprogramPage" v-show="false" label-width="100px" style="margin-left: -30px">
  128. <el-input v-model="item.miniprogramPage" placeholder="小程序消息打开后的路径" disabled />
  129. </el-form-item>
  130. </el-card>
  131. </div>
  132. <el-input
  133. v-if="item.contentType == 1 || item.contentType == 15|| item.contentType == 13"
  134. v-model="item.value"
  135. type="textarea"
  136. :rows="3"
  137. placeholder="内容"
  138. style="width: 90%; margin-top: 10px;"
  139. @keydown.native="handleKeydown($event, index)"
  140. :ref="`textarea-${index}`"
  141. >
  142. </el-input>
  143. <el-link
  144. v-if="item.contentType == 1 || item.contentType == 15|| item.contentType == 13"
  145. type="primary"
  146. @click="toggleSalesCall(index)"
  147. style="margin-top: 10px;"
  148. >
  149. {{ item.isSalesCallAdded ? '移除#销售称呼#' : '添加#销售称呼#' }}
  150. </el-link>
  151. <el-link
  152. v-if="item.contentType == 1 || item.contentType == 15|| item.contentType == 13"
  153. type="primary"
  154. @click="toggleSalesCallCustomer(index)"
  155. style="margin-top: 10px;margin-left: 2%"
  156. >
  157. {{ item.isSalesCallCustomerAdded ? '移除#客户称呼#' : '添加#客户称呼#' }}
  158. </el-link>
  159. <ImageUpload v-if="item.contentType == 2 " v-model="item.imgUrl" type="image" :num="1" :width="150" :height="150" />
  160. <div v-if="item.contentType == 3 || item.contentType ==9 ">
  161. <el-card class="box-card">
  162. <el-form-item label="链接标题:" label-width="100px">
  163. <el-input v-model="item.linkTitle" placeholder="请输入链接标题" style="width: 90%;"/>
  164. </el-form-item>
  165. <el-form-item label="链接描述:" label-width="100px" >
  166. <el-input type="textarea" :rows="3" v-model="item.linkDescribe" placeholder="请输入链接描述" style="width: 90%;margin-top: 1%;"/>
  167. </el-form-item>
  168. <el-form-item label="链接封面:" label-width="100px">
  169. <ImageUpload v-model="item.linkImageUrl" type="image" :num="1" :file-size="2" :width="150" :height="150" style="margin-top: 1%;" />
  170. </el-form-item>
  171. <el-form-item label="链接地址:" label-width="100px" >
  172. <el-tag type="warning" v-model="item.isBindUrl=1">选择的课程小节 即为卡片链接地址</el-tag>
  173. </el-form-item>
  174. </el-card>
  175. </div>
  176. <div v-if="item.contentType == 4 || item.contentType == 10 || item.contentType == 17 || item.contentType == 23">
  177. <el-card class="box-card">
  178. <el-form-item label="标题" prop="miniprogramTitle">
  179. <el-input v-model="item.miniprogramTitle" placeholder="请输入小程序消息标题,最长为64字" />
  180. </el-form-item>
  181. <el-form-item label="封面" prop="miniprogramPicUrl">
  182. <ImageUpload v-model="item.miniprogramPicUrl" type="image" :num="10" :width="150" :height="150" />
  183. </el-form-item>
  184. <el-form-item label="appid" prop="miniprogramAppid" v-show="false" >
  185. <el-input v-model="item.miniprogramAppid='wx73f85f8d62769119' " disabled />
  186. </el-form-item>
  187. <el-form-item label="page路径" prop="miniprogramPage" v-show="item.contentType == 10" label-width="100px" style="margin-left: -30px" >
  188. <el-input v-model="item.miniprogramPage" placeholder="小程序消息打开后的路径" type="textarea" :rows="3" />
  189. </el-form-item>
  190. </el-card>
  191. </div>
  192. <div v-if="item.contentType == 5 ">
  193. <el-form-item label="上传文件:" prop="fileUrl" label-width="100px">
  194. <el-upload
  195. v-model="item.fileUrl"
  196. class="avatar-uploader"
  197. :action="uploadUrl"
  198. :show-file-list="false"
  199. :on-success="(res, file) => handleAvatarSuccessFile(res, file, item)"
  200. :before-upload="beforeAvatarUploadFile">
  201. <i class="el-icon-plus avatar-uploader-icon"></i>
  202. </el-upload>
  203. <el-link v-if="item.fileUrl" type="primary" :href="downloadUrl(item.fileUrl)" download>
  204. {{item.fileUrl}}
  205. </el-link>
  206. </el-form-item>
  207. </div>
  208. <div v-if="item.contentType == 6 ">
  209. <el-form-item label="上传视频:" prop="videoUrl" label-width="100px">
  210. <el-upload
  211. v-model="item.videoUrl"
  212. class="avatar-uploader"
  213. :action="uploadUrl"
  214. :show-file-list="false"
  215. :on-success="(res, file) => handleAvatarSuccessVideo(res, file, item)"
  216. :before-upload="beforeAvatarUploadVideo">
  217. <i class="el-icon-plus avatar-uploader-icon"></i>
  218. </el-upload>
  219. <video v-if="item.videoUrl"
  220. :src="item.videoUrl"
  221. controls style="width: 200px;height: 100px">
  222. </video>
  223. </el-form-item>
  224. </div>
  225. <div v-if="item.contentType == 7 || item.contentType == 16">
  226. <el-input
  227. v-model="item.value"
  228. type="textarea" :rows="3" maxlength="66" show-word-limit
  229. placeholder="输入要转为语音的内容" style="width: 90%;margin-top: 10px;"
  230. @input="handleInputVideoText(item.value,item)"/>
  231. </div>
  232. <!-- <div v-if="item.contentType == 12">
  233. <el-card class="box-card">
  234. <el-form-item label="直播间3" >
  235. <el-select v-model="item.liveId"
  236. placeholder="请选择直播间" size="mini"
  237. @change="liveChange(item)" >
  238. <el-option
  239. v-for="dict in liveList"
  240. :key="dict.liveId"
  241. :label="dict.liveName"
  242. :value="dict.liveId"
  243. />
  244. </el-select>
  245. </el-form-item>
  246. <el-form-item label="标题" prop="miniprogramTitle">
  247. <el-input v-model="item.miniprogramTitle" placeholder="请输入小程序消息标题,最长为64字节" :rows="2" maxlength="64"
  248. type="textarea" />
  249. </el-form-item>
  250. <el-form-item label="封面" prop="miniprogramPicUrl">
  251. <ImageUpload v-model="item.miniprogramPicUrl" type="image" :num="10" :width="150" :height="150" />
  252. </el-form-item>
  253. <el-form-item label="appid" prop="miniprogramAppid" v-show="false">
  254. <el-input v-model="item.miniprogramAppid='wx503cf8ab31f83dd4' " disabled />
  255. </el-form-item>
  256. <el-form-item label="page路径" prop="miniprogramPage" v-show="false" label-width="100px" style="margin-left: -30px">
  257. <el-input v-model="item.miniprogramPage" placeholder="小程序消息打开后的路径" disabled />
  258. </el-form-item>
  259. </el-card>
  260. </div> -->
  261. <div v-if="item.contentType == 8">
  262. <el-button type="primary"
  263. style="margin-bottom: 1%"
  264. @click="hanldeSelectVideoNum(setting,index)">
  265. 选择视频号
  266. </el-button>
  267. <el-card class="box-card" v-if="item.coverUrl">
  268. <el-form-item label="封面标题:" label-width="100px">
  269. <el-input v-model="item.nickname"
  270. style="width: 90%;margin-bottom: 1%" disabled/>
  271. </el-form-item>
  272. <el-form-item label="头像:" label-width="100px">
  273. <el-image
  274. v-if="item.avatar != null"
  275. :src="item.avatar"
  276. :preview-src-list="[item.avatar]"
  277. :style="{ width: '50px', height: '50px' }"
  278. ></el-image>
  279. </el-form-item>
  280. <el-form-item label="封面:" label-width="100px">
  281. <el-image
  282. v-if="item.coverUrl != null"
  283. :src="item.coverUrl"
  284. :preview-src-list="[item.coverUrl]"
  285. :style="{ width: '200px', height: '200px' }"
  286. ></el-image>
  287. </el-form-item>
  288. <el-form-item label="简介:" label-width="100px">
  289. <el-input type="textarea" :rows="3"
  290. v-model="item.desc"
  291. style="width: 90%;margin-top: 1%;" disabled/>
  292. </el-form-item>
  293. <el-form-item label="视频地址:" label-width="100px"
  294. style="margin-top: 1%">
  295. <el-input v-model="item.url"
  296. style="width: 90%;" disabled/>
  297. </el-form-item>
  298. </el-card>
  299. </div>
  300. <div v-if="item.contentType == 20">
  301. <el-card class="box-card">
  302. <el-form-item label="直播间" >
  303. <el-select v-model="item.liveId"
  304. placeholder="请选择直播间" size="mini"
  305. @change="liveChange(item)" >
  306. <el-option
  307. v-for="dict in liveList"
  308. :key="dict.liveId"
  309. :label="dict.liveName"
  310. :value="dict.liveId"
  311. />
  312. </el-select>
  313. </el-form-item>
  314. <el-form-item label="标题" prop="miniprogramTitle">
  315. <el-input v-model="item.miniprogramTitle" placeholder="请输入小程序消息标题,最长为64字节" :rows="2" maxlength="64"
  316. type="textarea" @input="checkLiveMiniprogramTitle(item)"/>
  317. </el-form-item>
  318. <el-form-item label="封面" prop="miniprogramPicUrl">
  319. <ImageUpload v-model="item.miniprogramPicUrl" type="image" :num="10" :width="150" :height="150" />
  320. </el-form-item>
  321. <el-form-item label="appid" prop="miniprogramAppid" v-show="false">
  322. <el-input v-model="item.miniprogramAppid='wxcfd4cd6e2375e42f' " disabled />
  323. </el-form-item>
  324. <el-form-item label="page路径" prop="miniprogramPage" v-show="false" label-width="100px" style="margin-left: -30px">
  325. <el-input v-model="item.miniprogramPage" placeholder="小程序消息打开后的路径" disabled />
  326. </el-form-item>
  327. </el-card>
  328. </div>
  329. <div v-if="item.contentType == 14">
  330. <el-card class="box-card">
  331. <el-form-item label="福袋名称" >
  332. <el-select v-model="item.luckyBagId"
  333. placeholder="请选择福袋" size="mini"
  334. @change="getLuckyBagStatus(item)" >
  335. <el-option
  336. v-for="dict in luckyBagList"
  337. :key="dict.id"
  338. :label="dict.name"
  339. :value="dict.id"
  340. />
  341. </el-select>
  342. </el-form-item>
  343. <el-form-item label="福袋状态" >
  344. <el-tag :type="item.luckyBagDataStatus == 1 ? 'success' : 'danger'">
  345. {{ item.luckyBagDataStatus == 1 ? '启用' : '禁用' }}
  346. </el-tag>
  347. </el-form-item>
  348. </el-card>
  349. </div>
  350. <div v-if="item.contentType == 21">
  351. <el-card class="box-card">
  352. <el-form-item label="短信模板" >
  353. <el-select v-model="item.smsTemplateId"
  354. placeholder="请选择短信模板" size="mini"
  355. @change="getSmsTemplateInfo(item)" >
  356. <el-option
  357. v-for="template in smsTemplateList"
  358. :key="template.tempId"
  359. :label="template.title"
  360. :value="template.tempId"
  361. />
  362. </el-select>
  363. </el-form-item>
  364. <el-form-item label="内容预览" v-if="item.smsTemplateContent">
  365. <div style="color: #666; font-size: 12px; padding: 8px; border: 1px solid #eee; border-radius: 4px; background-color: #f9f9f9; max-height: 100px; overflow-y: auto;">
  366. {{ item.smsTemplateContent }}
  367. </div>
  368. </el-form-item>
  369. </el-card>
  370. </div>
  371. </el-form-item>
  372. <el-form-item label="添加短链" v-if="item.contentType == 1 || item.contentType == 15" >
  373. <el-tooltip content="请先根据课程选定课程小节之后再添加" effect="dark" :disabled="!!msgForm.videoId">
  374. <el-switch
  375. v-model="item.isBindUrl"
  376. :disabled="!msgForm.videoId"
  377. active-color="#13ce66"
  378. inactive-color="#DCDFE6"
  379. active-value="1"
  380. inactive-value="2">
  381. </el-switch>
  382. </el-tooltip>
  383. <span v-if="item.isBindUrl == '1'" style="margin-left: 10px; color: #13ce66">添加URL</span>
  384. <span v-if="item.isBindUrl == '2'" style="margin-left: 10px; color: #b1b4ba">不加URL</span>
  385. </el-form-item>
  386. <el-form-item label="课节过期时间" v-if="(item.isBindUrl == '1' || item.contentType == 14)
  387. && item.contentType != 2
  388. && item.contentType != 5
  389. && item.contentType != 6
  390. && item.contentType != 8"
  391. style="margin-top: 1%" label-width="100px">
  392. <el-row>
  393. <el-input-number v-model="item.expiresDays" :min="1" :max="100" ></el-input-number>
  394. (天)
  395. </el-row>
  396. <el-row>
  397. <span class="tip">填写0或不填时,默认为系统配置的默认时间</span>
  398. </el-row>
  399. </el-form-item>
  400. </el-form>
  401. </el-col>
  402. <el-col :span="1" :offset="1">
  403. <i class="el-icon-delete" @click="delSetList(index)" style="margin-top: 20px;" v-if="setting.length>1"></i>
  404. </el-col>
  405. </el-row>
  406. </div>
  407. <el-link type="primary" class="el-icon-plus" :underline="false" @click='addSetList()' >添加内容</el-link>
  408. </el-form-item>
  409. <el-form-item label="发送时间" prop="sendTime" v-if="msgForm.draftStrategy==1" >
  410. <el-time-picker
  411. class="custom-input"
  412. v-model="msgForm.sendTime"
  413. value-format="HH:mm"
  414. format="HH:mm"
  415. placeholder="时间"
  416. style="width: 100px;height: 20px;">
  417. </el-time-picker>
  418. <span class="tip" style="margin-left: 2%"> 不填时,默认为系统当前时间(立即发送)</span>
  419. </el-form-item>
  420. </el-form>
  421. <div slot="footer" class="dialog-footer">
  422. <el-button type="primary" @click="submitMsgForm">确 定</el-button>
  423. <el-button @click="cancelMsgForm">取 消</el-button>
  424. </div>
  425. </el-dialog>
  426. <el-dialog :title="videoNumOptions.title" :visible.sync="videoNumOptions.open" width="1500px" append-to-body>
  427. <userVideo ref="QwUserVideo" @videoResult="qwUserVideoResult"></userVideo>
  428. </el-dialog>
  429. </div>
  430. </template>
  431. <script>
  432. import { sendMsgSopType,} from "../../../api/qw/sopUserLogsInfo";
  433. import ImageUpload from "@/views/qw/sop/ImageUpload.vue";
  434. import {courseList, videoList} from "@/api/qw/sop";
  435. import userVideo from "@/views/qw/userVideo/userVideo";
  436. import {listToLiveNoEnd} from "@/api/live/live";
  437. import {listReward} from "@/api/qw/luckyBag";
  438. import { getSmsTempList } from "@/api/company/companySmsTemp";
  439. export default {
  440. name: "sendMsgOpenTool",
  441. components: {ImageUpload,userVideo},
  442. data() {
  443. return {
  444. queryParams1: {
  445. pageNum: 1,
  446. pageSize: 10,
  447. dataStatus: '1',
  448. name: null,
  449. type: null
  450. },
  451. luckyBagList: [],
  452. projectFrom:process.env.VUE_APP_PROJECT_FROM,
  453. videoNumOptions: {
  454. title: '选择视频号',
  455. open: false,
  456. content: null,
  457. contentIndex: null,
  458. },
  459. //上传语音的遮罩层
  460. voiceLoading :false,
  461. uploadUrl:process.env.VUE_APP_BASE_API+"/common/uploadOSS",
  462. uploadUrlByVoice:process.env.VUE_APP_BASE_API+"/common/uploadOSSByHOOKVoice",
  463. // 遮罩层
  464. loading: true,
  465. // 导出遮罩层
  466. exportLoading: false,
  467. // 选中数组
  468. ids: [],
  469. // 非单个禁用
  470. single: true,
  471. // 非多个禁用
  472. multiple: true,
  473. // 显示搜索条件
  474. showSearch: true,
  475. // 总条数
  476. total: 0,
  477. // sopUserLogsInfo表格数据
  478. sopUserLogsInfoList: [],
  479. sysFsSopWatchStatus: [],
  480. isSalesCallAdded:false,
  481. isSalesCallCustomerAdded:false,
  482. tagList:[],
  483. selectTags:[],
  484. // 弹出层标题
  485. title: "",
  486. // 是否显示弹出层
  487. open: false,
  488. updateOpen:false,
  489. // 查询参数
  490. queryParams: {
  491. pageNum: 1,
  492. pageSize: 10,
  493. tagIds:null,
  494. remark:null,
  495. sopId: null,
  496. userLogsId: null,
  497. userIdParam:null,
  498. startTimeParam:null,
  499. externalContactId: null,
  500. qwUserId: null,
  501. corpId: null,
  502. externalId: null,
  503. fsUserId: null,
  504. externalUserName: null,
  505. createTime: null,
  506. },
  507. courseList:[],
  508. videoList:[],
  509. //插件版
  510. sysQwSopAiContentType:[],
  511. sendMsgOpen:{
  512. title:'一键批量群发',
  513. open:false,
  514. ids:null,
  515. },
  516. smsTemplateList: [],
  517. // 表单参数
  518. form: {},
  519. setting:[{contentType:'1', value: '',}],
  520. msgForm:{
  521. liveId:null,
  522. videoId:null,
  523. courseId:null,
  524. courseType:null,
  525. userIdParam:null,
  526. setting:null,
  527. ids:null,
  528. type:null,
  529. corpId:null,
  530. sopId: null,
  531. startTime: null,
  532. sendTime: null,
  533. draftStrategy:1,
  534. },
  535. // 表单校验
  536. rules: {},
  537. batchRules:{
  538. paramTime: [
  539. { required: true, message: '选择的时间不能为空', trigger: 'blur' }
  540. ],
  541. },
  542. msgRules:{},
  543. liveList: [],
  544. };
  545. },
  546. created() {
  547. this.getDicts("sys_qwSopAi_contentType").then(response => {
  548. this.sysQwSopAiContentType = response.data;
  549. });
  550. this.getDicts("sys_fs_sop_watch_status").then(response => {
  551. this.sysFsSopWatchStatus = response.data;
  552. });
  553. courseList().then(response => {
  554. this.courseList = response.list;
  555. });
  556. listToLiveNoEnd().then(response => {
  557. this.liveList = response.rows;
  558. })
  559. listReward(this.queryParams1).then(response => {
  560. this.luckyBagList = response.rows;
  561. });
  562. this.loadSmsTemplates();
  563. },
  564. methods: {
  565. getLuckyBagStatus(content) {
  566. const selectedLuckyBag = this.luckyBagList.find(item => item.id === content.luckyBagId);
  567. if (selectedLuckyBag) {
  568. content.luckyBagDataStatus = selectedLuckyBag.dataStatus; // 自动填充标题
  569. } else {
  570. // 若未找到对应直播间,清空标题和封面(可选)
  571. content.luckyBagDataStatus = null;
  572. }
  573. },
  574. checkLiveMiniprogramTitle(item) {
  575. this.$forceUpdate();
  576. },
  577. liveChange(content) {
  578. // content.liveId 是选中的直播间 ID(liveId)
  579. const selectedLive = this.liveList.find(live => live.liveId === content.liveId);
  580. if (selectedLive) {
  581. // 从选中的直播间对象中提取标题和封面,赋值给当前内容的对应字段
  582. // 假设直播间对象中标题字段为 liveTitle,封面字段为 coverImg(根据实际接口字段调整)
  583. content.miniprogramTitle = selectedLive.liveName || ''; // 自动填充标题
  584. content.miniprogramPicUrl = selectedLive.liveImgUrl || ''; // 自动填充封面
  585. } else {
  586. // 若未找到对应直播间,清空标题和封面(可选)
  587. content.miniprogramTitle = '';
  588. content.miniprogramPicUrl = '';
  589. }
  590. },
  591. qwUserVideoResult(val) {
  592. // 根据选中的内容,将返回的数据更新到相应的表单项
  593. const content = this.videoNumOptions.content;
  594. const setList = content[this.videoNumOptions.contentIndex];
  595. setList.nickname = val.nickname;
  596. setList.avatar = val.avatar;
  597. setList.coverUrl = val.coverUrl;
  598. setList.thumbUrl = val.thumbUrl;
  599. setList.desc = val.desc;
  600. setList.url = val.url;
  601. setList.extras = val.extras;
  602. setList.videoId = val.id;
  603. console.info(setList)
  604. this.videoNumOptions.open = false;
  605. },
  606. oneClickGroupSending(val,type,corpId){
  607. this.sendMsgOpen.open= true;
  608. this.msgForm.ids = val;
  609. this.msgForm.type = type;
  610. this.msgForm.corpId = corpId;
  611. },
  612. courseChange() {
  613. if (this.msgForm.courseId != null ) {
  614. const selectedCourse = this.courseList.find(course => parseInt(course.dictValue) === this.msgForm.courseId);
  615. for (let i = 0; i < this.setting.length; i++) {
  616. //响应式直接给链接的标题/封面上值
  617. if (selectedCourse && this.msgForm.courseId != null) {
  618. if ( this.setting[i].contentType == 3 || this.setting[i].contentType == 9 ){
  619. this.$set(this.setting[i], 'linkTitle', selectedCourse.dictLabel);
  620. this.$set(this.setting[i], 'linkImageUrl', selectedCourse.dictImgUrl);
  621. }
  622. if ( this.setting[i].contentType == 4 || this.setting[i].contentType == 10 || this.setting[i].contentType == 17 || this.setting[i].contentType == 23){
  623. this.$set(this.setting[i], 'miniprogramPicUrl', selectedCourse.dictImgUrl);
  624. }
  625. }
  626. }
  627. }
  628. videoList(this.msgForm.courseId).then(response => {
  629. this.videoList=response.list;
  630. });
  631. this.msgForm.videoId = null
  632. },
  633. videoIdChange() {
  634. if (this.msgForm.videoId != null ) {
  635. // 查找选中的课节对应的 label
  636. const selectedVideo = this.videoList.find(course => parseInt(course.dictValue) === this.msgForm.videoId);
  637. for (let i = 0; i < this.setting.length; i++) {
  638. //响应式直接给链接的描述上值
  639. if (selectedVideo && this.msgForm.videoId != null) {
  640. if (this.setting[i].contentType == 3 || this.setting[i].contentType == 9 ){
  641. this.$set(this.setting[i], 'linkDescribe', selectedVideo.dictLabel);
  642. if (this.projectFrom == 'sxjz' && selectedVideo.dictImgUrl) {
  643. this.$set(this.setting[i], 'linkImageUrl', selectedVideo.dictImgUrl);
  644. }
  645. }
  646. if (this.setting[i].contentType == 4 || this.setting[i].contentType == 10 || this.setting[i].contentType == 17 || this.setting[i].contentType == 23){
  647. this.$set(this.setting[i], 'miniprogramTitle', selectedVideo.dictLabel);
  648. if (this.projectFrom == 'sxjz' && selectedVideo.dictImgUrl) {
  649. this.$set(this.setting[i], 'miniprogramPicUrl', selectedVideo.dictImgUrl);
  650. }
  651. }
  652. }
  653. }
  654. }
  655. },
  656. handleAvatarSuccessFile(res, file, item) {
  657. if (res.code === 200) {
  658. // 使用 $set 确保响应式更新
  659. this.$set(item, 'fileUrl', res.url);
  660. } else {
  661. this.msgError(res.msg);
  662. }
  663. },
  664. beforeAvatarUploadFile(file){
  665. const isLt1M = file.size / 1024 / 1024 < 10;
  666. if (!isLt1M) {
  667. this.$message.error('上传大小不能超过 10MB!');
  668. }
  669. return isLt1M;
  670. },
  671. //下载文件
  672. downloadUrl(materialUrl) {
  673. // 直接返回文件 URL
  674. return materialUrl;
  675. },
  676. handleAvatarSuccessVideo(res, file, item) {
  677. if(res.code==200){
  678. // 使用 $set 确保响应式更新
  679. this.$set(item, 'videoUrl', res.url);
  680. }
  681. else{
  682. this.msgError(res.msg);
  683. }
  684. },
  685. beforeAvatarUploadVideo(file){
  686. const isLt30M = file.size / 1024 / 1024 < 10;
  687. const isMP4 = file.type === 'video/mp4';
  688. if (!isMP4) {
  689. this.$message.error('仅支持上传 MP4 格式的视频文件!');
  690. return false;
  691. }
  692. if (!isLt30M) {
  693. this.$message.error('上传大小不能超过 10MB!');
  694. return false;
  695. }
  696. return true;
  697. },
  698. handleInputVideoText(value,content){
  699. // 允许的字符:中文、英文(大小写)、数字和指定标点符号(,。!?)
  700. const regex = /^[\u4e00-\u9fa5,。!?,!?]+$/;
  701. // 删除不符合条件的字符
  702. const filteredValue = value.split('').filter(char => regex.test(char)).join('');
  703. this.$set(content, 'value', filteredValue);
  704. },
  705. //选择视频号
  706. hanldeSelectVideoNum(content, index) {
  707. this.videoNumOptions.content = content;
  708. this.videoNumOptions.contentIndex = index;
  709. this.videoNumOptions.open = true;
  710. },
  711. delSetList(index){
  712. this.setting.splice(index,1)
  713. },
  714. addSetList(){
  715. const newSetting = {
  716. contentType:'1',
  717. value: '',
  718. };
  719. // 将新设置项添加到 content.setting 数组中
  720. this.setting.push(newSetting);
  721. },
  722. handleKeydown(event, index) {
  723. const item = this.setting[index];
  724. const textarea = this.$refs[`textarea-${index}`][0].$refs.textarea;
  725. const cursorPosition = textarea.selectionStart;
  726. // 检查是否按下了 Backspace 或 Delete 键
  727. if (event.key === 'Backspace' || event.key === 'Delete') {
  728. const tags = ['#销售称呼#', '#客户称呼#']; // 需要检查的标签
  729. const value = item.value;
  730. // 遍历标签,检查是否需要删除
  731. for (const tag of tags) {
  732. let start, end;
  733. if (event.key === 'Backspace') {
  734. // 检查光标前是否是当前标签的一部分
  735. start = cursorPosition - tag.length;
  736. if (start >= 0 && value.slice(start, cursorPosition) === tag) {
  737. // 删除整个标签
  738. item.value = value.slice(0, start) + value.slice(cursorPosition);
  739. // 更新光标位置
  740. this.$nextTick(() => {
  741. textarea.setSelectionRange(start, start);
  742. });
  743. // 更新状态
  744. if (tag === '#销售称呼#') item.isSalesCallAdded = false;
  745. if (tag === '#客户称呼#') item.isSalesCallCustomerAdded = false;
  746. event.preventDefault(); // 阻止默认删除行为
  747. break; // 找到匹配的标签后退出循环
  748. }
  749. } else if (event.key === 'Delete') {
  750. // 检查光标后是否是当前标签的一部分
  751. end = cursorPosition + tag.length;
  752. if (end <= value.length && value.slice(cursorPosition, end) === tag) {
  753. // 删除整个标签
  754. item.value = value.slice(0, cursorPosition) + value.slice(end);
  755. // 更新状态
  756. if (tag === '#销售称呼#') item.isSalesCallAdded = false;
  757. if (tag === '#客户称呼#') item.isSalesCallCustomerAdded = false;
  758. event.preventDefault(); // 阻止默认删除行为
  759. break; // 找到匹配的标签后退出循环
  760. }
  761. }
  762. // 检查光标是否位于标签的中间
  763. for (let i = 0; i <= tag.length; i++) {
  764. const tagStart = cursorPosition - i;
  765. const tagEnd = tagStart + tag.length;
  766. if (
  767. tagStart >= 0 &&
  768. tagEnd <= value.length &&
  769. value.slice(tagStart, tagEnd) === tag
  770. ) {
  771. // 删除整个标签
  772. item.value = value.slice(0, tagStart) + value.slice(tagEnd);
  773. // 更新光标位置
  774. this.$nextTick(() => {
  775. textarea.setSelectionRange(tagStart, tagStart);
  776. });
  777. // 更新状态
  778. if (tag === '#销售称呼#') item.isSalesCallAdded = false;
  779. if (tag === '#客户称呼#') item.isSalesCallCustomerAdded = false;
  780. event.preventDefault(); // 阻止默认删除行为
  781. break; // 找到匹配的标签后退出循环
  782. }
  783. }
  784. }
  785. }
  786. },
  787. // 切换添加销售称呼按钮点击事件
  788. toggleSalesCall(index) {
  789. const item = this.setting[index];
  790. const salesCall = '#销售称呼#';
  791. const textarea = this.$refs[`textarea-${index}`][0].$refs.textarea;
  792. // 获取当前光标位置
  793. const cursorPosition = textarea.selectionStart;
  794. if (item.isSalesCallAdded) {
  795. // 移除所有的 #销售称呼#
  796. item.value = item.value.replace(new RegExp(salesCall, 'g'), '');
  797. } else {
  798. // 添加 #销售称呼#
  799. item.value = item.value.slice(0, cursorPosition) + salesCall + item.value.slice(cursorPosition);
  800. }
  801. // 切换状态
  802. item.isSalesCallAdded = !item.isSalesCallAdded;
  803. // 保持光标位置
  804. this.$nextTick(() => {
  805. textarea.setSelectionRange(cursorPosition, cursorPosition);
  806. });
  807. },
  808. toggleSalesCallCustomer(index) {
  809. const item = this.setting[index];
  810. const salesCall = '#客户称呼#';
  811. const textarea = this.$refs[`textarea-${index}`][0].$refs.textarea;
  812. // 获取当前光标位置
  813. const cursorPosition = textarea.selectionStart;
  814. if (item.isSalesCallCustomerAdded) {
  815. // 移除所有的 #销售称呼#
  816. item.value = item.value.replace(new RegExp(salesCall, 'g'), '');
  817. } else {
  818. // 添加 #客户称呼#
  819. item.value = item.value.slice(0, cursorPosition) + salesCall + item.value.slice(cursorPosition);
  820. }
  821. // 切换状态
  822. item.isSalesCallCustomerAdded = !item.isSalesCallCustomerAdded;
  823. // 保持光标位置
  824. this.$nextTick(() => {
  825. textarea.setSelectionRange(cursorPosition, cursorPosition);
  826. });
  827. },
  828. handleContentTypeChange() {
  829. //如果是链接的才上
  830. if (this.msgForm.courseId != null ) {
  831. const selectedCourse = this.courseList.find(course => parseInt(course.dictValue) === this.msgForm.courseId);
  832. for (let i = 0; i < this.setting.length; i++) {
  833. //响应式直接给链接的标题/封面上值
  834. if (selectedCourse && this.msgForm.courseId != null) {
  835. if (this.setting[i].contentType == 3 || this.setting[i].contentType == 9){
  836. this.$set(this.setting[i], 'linkTitle', selectedCourse.dictLabel);
  837. this.$set(this.setting[i], 'linkImageUrl', selectedCourse.dictImgUrl);
  838. }
  839. if (this.setting[i].contentType == 4 || this.setting[i].contentType == 10 || this.setting[i].contentType == 17
  840. || this.setting[i].contentType == 23){//新增APP 看课 跳转短链回填封面
  841. this.$set(this.setting[i], 'miniprogramPicUrl', selectedCourse.dictImgUrl);
  842. }
  843. }
  844. }
  845. }
  846. if (this.msgForm.videoId != null ) {
  847. // 查找选中的课节对应的 label
  848. const selectedVideo = this.videoList.find(course => parseInt(course.dictValue) === this.msgForm.videoId);
  849. for (let i = 0; i < this.setting.length; i++) {
  850. //响应式直接给链接的描述上值
  851. if (selectedVideo && this.msgForm.videoId != null) {
  852. if (this.setting[i].contentType == 3 || this.setting[i].contentType == 9){
  853. this.$set(this.setting[i], 'linkDescribe', selectedVideo.dictLabel);
  854. if (this.projectFrom == 'sxjz' && selectedVideo.dictImgUrl) {
  855. this.$set(this.setting[i], 'linkImageUrl', selectedVideo.dictImgUrl);
  856. }
  857. }
  858. if (this.setting[i].contentType == 4 || this.setting[i].contentType == 10 || this.setting[i].contentType == 17
  859. || this.setting[i].contentType == 23){//新增APP 看课 跳转短链回填标题
  860. this.$set(this.setting[i], 'miniprogramTitle', selectedVideo.dictLabel);
  861. if (this.projectFrom == 'sxjz' && selectedVideo.dictImgUrl) {
  862. this.$set(this.setting[i], 'miniprogramPicUrl', selectedVideo.dictImgUrl);
  863. }
  864. }
  865. }
  866. }
  867. }
  868. },
  869. resetSendMsgSop() {
  870. this.msgForm = {
  871. liveId:null,
  872. videoId:null,
  873. courseId:null,
  874. courseType:null,
  875. setting:null,
  876. sendTime:null,
  877. draftStrategy:1,
  878. };
  879. this.resetForm("msgForm");
  880. },
  881. // 获取短信模板信息(类似福袋的处理方式)
  882. getSmsTemplateInfo(content) {
  883. // 如果短信模板列表为空,先加载数据
  884. if (this.smsTemplateList.length === 0) {
  885. getSmsTempList().then(response => {
  886. this.smsTemplateList = response.rows || response.data || [];
  887. // 加载完成后再次调用自身来处理选中项
  888. this.processSelectedSmsTemplate(content);
  889. }).catch(error => {
  890. console.error('加载短信模板失败:', error);
  891. this.$message.error('加载短信模板失败');
  892. });
  893. } else {
  894. // 直接处理选中项
  895. this.processSelectedSmsTemplate(content);
  896. }
  897. },
  898. // 处理选中的短信模板
  899. processSelectedSmsTemplate(content) {
  900. const selectedTemplate = this.smsTemplateList.find(item => item.tempId === content.smsTemplateId);
  901. if (selectedTemplate) {
  902. // 自动填充模板内容预览
  903. this.$set(content, 'smsTemplateContent', selectedTemplate.content || selectedTemplate.templateContent || '');
  904. } else {
  905. // 清空相关内容
  906. this.$set(content, 'smsTemplateContent', '');
  907. }
  908. },
  909. // 加载短信模板列表
  910. loadSmsTemplates() {
  911. if (this.smsTemplateList.length > 0) {
  912. return; // 如果已经有数据,不再重复加载
  913. }
  914. getSmsTempList().then(response => {
  915. this.smsTemplateList = response.rows || response.data || [];
  916. if (this.smsTemplateList.length === 0) {
  917. this.$message.info('暂无可用的短信模板');
  918. }
  919. }).catch(error => {
  920. console.error('加载短信模板失败:', error);
  921. this.$message.error('加载短信模板失败');
  922. });
  923. },
  924. // 多选框选中数据
  925. handleSelectionChange(selection) {
  926. this.ids = selection.map(item => item.id)
  927. this.single = selection.length!==1
  928. this.multiple = !selection.length
  929. },
  930. submitMsgForm(){
  931. this.$refs["msgForm"].validate(valid => {
  932. if (valid) {
  933. if (this.msgForm.draftStrategy==1) {
  934. this.msgForm.setting = JSON.stringify(this.setting)
  935. let jsonSetting = JSON.parse(this.msgForm.setting);
  936. let hasLiveSetting = false;
  937. console.log(jsonSetting)
  938. for (let index = 0; index < jsonSetting.length; index++) {
  939. if (!!jsonSetting[index] && (jsonSetting[index].contentType == "12" || jsonSetting[index].contentType == "18" || jsonSetting[index].contentType == "19" || jsonSetting[index].contentType == "20" || jsonSetting[index].contentType == "24" || jsonSetting[index].contentType == "25")) {
  940. if (!!hasLiveSetting) {
  941. return this.$message.error("发送直播间只能一次只能发送一条");
  942. }
  943. hasLiveSetting = true;
  944. }
  945. }
  946. if (!!hasLiveSetting && (this.msgForm.courseId != null && this.msgForm.courseId != '')) {
  947. return this.$message.error("直播间不能选取课程");
  948. }
  949. if (!!hasLiveSetting && (this.msgForm.videoId != null && this.msgForm.videoId != '')) {
  950. return this.$message.error("直播间不能选取课节");
  951. }
  952. if (this.setting.length <= 0) {
  953. return this.$message.error("请添加规则")
  954. }
  955. if ((this.msgForm.courseId === null || this.msgForm.courseId === '') && !hasLiveSetting && this.msgForm.liveId === null) {
  956. return this.$message.error("课程不能为空")
  957. }
  958. if ((this.msgForm.videoId === null || this.msgForm.videoId === '') && !hasLiveSetting && this.msgForm.liveId === null) {
  959. return this.$message.error("课节不能为空")
  960. }
  961. if (this.msgForm.courseType === null || this.msgForm.courseType === '') {
  962. return this.$message.error("消息类型不能为空")
  963. }
  964. for (let i = 0; i < this.setting.length; i++) {
  965. if (this.setting[i].contentType == 1 && (this.setting[i].value == null || this.setting[i].value == "")) {
  966. return this.$message.error("内容不能为空")
  967. }
  968. if (this.setting[i].contentType == 2 && (this.setting[i].imgUrl == null || this.setting[i].imgUrl == "")) {
  969. return this.$message.error("图片不能为空")
  970. }
  971. if ((this.setting[i].contentType == 3 || this.setting[i].contentType == 9) && (this.setting[i].linkTitle == null || this.setting[i].linkTitle == "")) {
  972. return this.$message.error("链接标题不能为空")
  973. }
  974. if ((this.setting[i].contentType == 3 || this.setting[i].contentType == 9) && (this.setting[i].linkDescribe == null || this.setting[i].linkDescribe == "")) {
  975. return this.$message.error("链接描述不能为空")
  976. }
  977. if ((this.setting[i].contentType == 3 || this.setting[i].contentType == 9) && (this.setting[i].linkImageUrl == null || this.setting[i].linkImageUrl == "")) {
  978. return this.$message.error("链接图片不能为空")
  979. }
  980. if ((this.setting[i].contentType == 3 || this.setting[i].contentType == 9) && this.setting[i].type == 1 && (this.setting[i].linkUrl == null || this.setting[i].linkUrl == "")) {
  981. return this.$message.error("链接地址不能为空")
  982. }
  983. if ((this.setting[i].contentType == 4 || this.setting[i].contentType == 10 || this.setting[i].contentType == 17 || this.setting[i].contentType == 23 || this.setting[i].contentType == 24 || this.setting[i].contentType == 25) && (this.setting[i].miniprogramTitle == null || this.setting[i].miniprogramTitle == "")) {
  984. return this.$message.error("小程序消息标题不能为空")
  985. }
  986. if ((this.setting[i].contentType == 4 || this.setting[i].contentType == 10 || this.setting[i].contentType == 17 || this.setting[i].contentType == 23 || this.setting[i].contentType == 24 || this.setting[i].contentType == 25) && (this.setting[i].miniprogramPicUrl == null || this.setting[i].miniprogramPicUrl == "")) {
  987. return this.$message.error("小程序封面地址不能为空")
  988. }
  989. if (this.setting[i].contentType == 10 && (this.setting[i].miniprogramPage == null || this.setting[i].miniprogramPage == "")) {
  990. return this.$message.error("小程序page地址不能为空")
  991. }
  992. if (this.setting[i].contentType == 5 && (this.setting[i].fileUrl == null || this.setting[i].fileUrl == "")) {
  993. return this.$message.error("文件不能为空")
  994. }
  995. if (this.setting[i].contentType == 6 && (this.setting[i].videoUrl == null || this.setting[i].videoUrl == "")) {
  996. return this.$message.error("视频不能为空")
  997. }
  998. if ((this.setting[i].contentType == 7 || this.setting[i].contentType == 16) && (this.setting[i].value == null || this.setting[i].value == "")) {
  999. return this.$message.error("语音不能为空")
  1000. }
  1001. // 添加对福袋的验证
  1002. if (this.setting[i].contentType == 14 && (this.setting[i].luckyBagId == null || this.setting[i].luckyBagId === "")) {
  1003. return this.$message.error("福袋不能为空")
  1004. }
  1005. if ((this.setting[i].contentType == 12 || this.setting[i].contentType == 24 || this.setting[i].contentType == 25) && (this.setting[i].liveId == null || this.setting[i].liveId == "")) {
  1006. return this.$message.error("直播间不能为空");
  1007. }
  1008. if (this.setting[i].contentType == 20 && (this.setting[i].liveId == null || this.setting[i].liveId == "")) {
  1009. return this.$message.error("直播间不能为空");
  1010. }
  1011. if (this.setting[i].contentType == 20 && (this.setting[i].miniprogramTitle == null || this.setting[i].miniprogramTitle == "")) {
  1012. return this.$message.error("标题不能为空");
  1013. }
  1014. if (this.setting[i].contentType == 20 && (this.setting[i].miniprogramPicUrl == null || this.setting[i].miniprogramPicUrl == "")) {
  1015. return this.$message.error("封面不能为空");
  1016. }
  1017. // 短信模板验证
  1018. if (this.setting[i].contentType == 21 && (this.setting[i].smsTemplateId == null || this.setting[i].smsTemplateId === "")) {
  1019. return this.$message.error("短信模板不能为空")
  1020. }else {
  1021. if (this.setting[i].contentType == 21 && this.setting[i].smsTemplateId) {
  1022. // 根据选中的短信模板ID查找对应的模板信息
  1023. const selectedTemplate = this.smsTemplateList.find(template => template.tempId === this.setting[i].smsTemplateId);
  1024. if (selectedTemplate) {
  1025. // 设置短信模板的相关字段
  1026. this.$set(this.setting[i], 'smsTemplateCode', selectedTemplate.tempCode || '');
  1027. this.$set(this.setting[i], 'smsTemplateTitle', selectedTemplate.title || '');
  1028. }
  1029. }
  1030. }
  1031. }
  1032. // // 短信模板数据映射
  1033. // for (let j = 0; j < processedSetting.length; j++) {
  1034. // const item = processedSetting[j];
  1035. // if (item.contentType == 21 && item.smsTemplateId) {
  1036. // // 根据选中的短信模板ID查找对应的模板信息
  1037. // const selectedTemplate = this.smsTemplateList.find(template => template.tempId === item.smsTemplateId);
  1038. // if (selectedTemplate) {
  1039. // // 设置短信模板的相关字段
  1040. // this.$set(item, 'smsTemplateCode', selectedTemplate.tempCode || '');
  1041. // this.$set(item, 'smsTemplateTitle', selectedTemplate.title || '');
  1042. // }
  1043. // }
  1044. // }
  1045. // // 重新序列化处理后的数据
  1046. // this.msgForm.setting = JSON.stringify(processedSetting);
  1047. this.msgForm.setting = JSON.stringify(this.setting)
  1048. this.sendMsgOpen.open = false;
  1049. const loading = this.$loading({
  1050. lock: true,
  1051. text: '正在执行中请稍后~~请不要刷新页面!!',
  1052. spinner: 'el-icon-loading',
  1053. background: 'rgba(0, 0, 0, 0.7)'
  1054. });
  1055. sendMsgSopType(this.msgForm).then(response => {
  1056. this.msgSuccess("一键群发成功");
  1057. loading.close();
  1058. this.setting = [];
  1059. this.resetSendMsgSop();
  1060. }).finally(() => {
  1061. loading.close();
  1062. });
  1063. }
  1064. }
  1065. });
  1066. },
  1067. cancelMsgForm(){
  1068. this.sendMsgOpen.open = false;
  1069. this.resetSendMsgSop();
  1070. },
  1071. liveChangemsgForm(liveId){
  1072. console.log(liveId);
  1073. console.log(this.setting);
  1074. if(!!liveId){
  1075. for(let i =0;i<this.setting.length;i++){
  1076. this.$set(this.setting[i], 'liveId', liveId);
  1077. this.liveChange(this.setting[i]);
  1078. }
  1079. }
  1080. },
  1081. liveDisabled(){
  1082. return !!this.msgForm && !!this.msgForm.liveId ;
  1083. }
  1084. }
  1085. };
  1086. </script>