edit_external_message.html 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821
  1. {extend name="public/layout" /} {block name="title"}群发到客户{/block} {block name="body"}
  2. <style type="text/css">
  3. html {
  4. background: #fff;
  5. }
  6. body {
  7. min-width: 320px;
  8. }
  9. @media screen and (max-width: 450px) {
  10. .layui-form-item {
  11. width: 100%;
  12. }
  13. }
  14. #layuiadmin-app-form-list {
  15. padding: 1% 2%;
  16. }
  17. .layui-form-item {
  18. position: relative;
  19. }
  20. .layui-form-label {
  21. width: 20%;
  22. }
  23. .layui-input {
  24. border: none;
  25. outline: none;
  26. }
  27. .layui-input-inline-bottom {
  28. border-bottom: 1px solid #D4E4ED;
  29. }
  30. .flex-center {
  31. display: flex;
  32. align-items: center;
  33. }
  34. .border {
  35. border: 1px solid #D4E4ED;
  36. padding-right: 10px;
  37. border-radius: 5px;
  38. }
  39. .layui-form-radio>i:hover,
  40. .layui-form-radioed>i {
  41. color: #249EFB;
  42. }
  43. .layui-form-radioed {
  44. color: #249EFB;
  45. }
  46. .layui-tab-card>.layui-tab-title {
  47. background-color: #fff;
  48. }
  49. .layui-tab-card {
  50. border-radius: 10px;
  51. box-shadow: none;
  52. border: none;
  53. }
  54. .layui-form-label {
  55. color: #8A9AAA;
  56. }
  57. .layui-input::placeholder {
  58. color: #9DB6CF;
  59. }
  60. .layui-tab-card>.layui-tab-title .layui-this {
  61. background-color: #249EFB;
  62. color: #fff;
  63. }
  64. .layui-tab-card>.layui-tab-title .layui-this:after {
  65. border-bottom: none;
  66. border: none;
  67. }
  68. .layui-tab-card>.layui-tab-title li {
  69. background-color: #F2F2F2;
  70. margin: 0px 5px;
  71. }
  72. .layui-anim.layui-icon {
  73. font-size: 18px;
  74. }
  75. .imgs {
  76. width: 89%;
  77. float: left;
  78. margin-top: -1%;
  79. margin-left: -1%;
  80. }
  81. .upload {
  82. background-color: #fff;
  83. /*position: absolute;*/
  84. bottom: 10px;
  85. /*right: 9%;*/
  86. cursor: pointer;
  87. z-index: 1;
  88. padding: 10px 5px 0px;
  89. }
  90. .cancel,
  91. .cancel:hover {
  92. background-color: #fff;
  93. color: #249EFB;
  94. border: 1px solid #249EFB;
  95. padding: 0px 20px;
  96. }
  97. .imageDiv {
  98. display: inline-block;
  99. width: 140px;
  100. height: 125px;
  101. -webkit-box-sizing: border-box;
  102. -moz-box-sizing: border-box;
  103. box-sizing: border-box;
  104. border: 1px dashed darkgray;
  105. background: #f8f8f8;
  106. position: relative;
  107. overflow: hidden;
  108. margin-right: 10px;
  109. }
  110. .imageDiv div {
  111. width: 100%;
  112. height: 100%;
  113. position: absolute;
  114. top: 0px;
  115. background-color: #e6e6e600;
  116. }
  117. .imageDiv div i {
  118. display: none;
  119. font-size: 31px;
  120. position: absolute;
  121. top: 37%;
  122. left: 45%;
  123. }
  124. .imageDiv div:hover {
  125. background-color: #e6e6e680;
  126. }
  127. .imageDiv div:hover i {
  128. display: block;
  129. cursor: pointer;
  130. }
  131. .font15 {
  132. font-size: 14px !important;
  133. margin-left: 5px;
  134. }
  135. .mt10 {
  136. margin-top: 10px !important;
  137. }
  138. .mask {
  139. width: 100%;
  140. height: 100%;
  141. background-color: rgba(0, 0, 0, 0.5);
  142. position: fixed;
  143. top: 0px;
  144. bottom: 0px;
  145. left: 0px;
  146. right: 0px;
  147. z-index: 999999 !important;
  148. display: flex;
  149. justify-content: center;
  150. align-items: center;
  151. }
  152. #range_people {
  153. width: 550px !important;
  154. height: 35px;
  155. border: 1px solid #CCCCCC;
  156. display: flex;
  157. align-items: center;
  158. box-sizing: border-box;
  159. padding: 0px 10px;
  160. }
  161. .mask-content {
  162. width: 90%;
  163. height: 90%;
  164. background-color: #fff;
  165. display: flex;
  166. flex-direction: column;
  167. }
  168. .header-nav {
  169. background-color: #D8E6F1;
  170. width: 100%;
  171. height: 45px;
  172. display: flex;
  173. justify-content: space-between;
  174. align-items: center;
  175. padding: 0px 20px;
  176. box-sizing: border-box;
  177. color: #333333;
  178. }
  179. .list-content {
  180. flex: 1;
  181. display: flex;
  182. overflow: hidden;
  183. }
  184. .first-box {
  185. flex: 1;
  186. display: flex;
  187. flex-direction: column;
  188. }
  189. .first-content {
  190. padding: 10px 20px;
  191. box-sizing: border-box;
  192. overflow: auto;
  193. }
  194. /* 设置滚动条的样式 */
  195. .first-content::-webkit-scrollbar {
  196. width: 10px;
  197. }
  198. /* 滚动槽 */
  199. .first-content::-webkit-scrollbar-track {
  200. -webkit-box-shadow: inset006pxrgba(0, 0, 0, 0.3);
  201. }
  202. /* 滚动条滑块 */
  203. .first-content::-webkit-scrollbar-thumb {
  204. background: #666666;
  205. -webkit-box-shadow: inset006pxrgba(0, 0, 0, 0.5);
  206. }
  207. .first-content::-webkit-scrollbar-thumb:window-inactive {
  208. background: #333;
  209. }
  210. .first-page {
  211. width: 100%;
  212. height: 50px;
  213. display: flex;
  214. justify-content: space-between;
  215. align-items: center;
  216. padding: 5px 20px;
  217. box-sizing: border-box;
  218. }
  219. .item {
  220. height: 40px;
  221. border-bottom: 1px solid #ECECEC;
  222. display: flex;
  223. align-items: center;
  224. }
  225. .second-box {
  226. flex: 1;
  227. overflow: auto;
  228. padding: 10px 20px;
  229. box-sizing: border-box;
  230. border-left: 1px solid #f5f5f5;
  231. }
  232. /* 设置滚动条的样式 */
  233. .second-box::-webkit-scrollbar {
  234. width: 10px;
  235. }
  236. /* 滚动槽 */
  237. .second-box::-webkit-scrollbar-track {
  238. -webkit-box-shadow: inset006pxrgba(0, 0, 0, 0.3);
  239. }
  240. /* 滚动条滑块 */
  241. .second-box::-webkit-scrollbar-thumb {
  242. background: #666666;
  243. -webkit-box-shadow: inset006pxrgba(0, 0, 0, 0.5);
  244. }
  245. .second-box::-webkit-scrollbar-thumb:window-inactive {
  246. background: #333;
  247. }
  248. .space-between {
  249. display: flex;
  250. justify-content: space-between;
  251. align-items: center;
  252. }
  253. .flex-sub {
  254. flex: 1;
  255. text-align: right;
  256. }
  257. .grey {
  258. background-color: #CCCCCC;
  259. }
  260. .justify-end {
  261. display: flex;
  262. justify-content: flex-end;
  263. box-sizing: border-box;
  264. padding: 10px 20px;
  265. }
  266. .justify-start {
  267. display: flex;
  268. justify-content: flex-end;
  269. box-sizing: border-box;
  270. padding: 10px 20px;
  271. }
  272. .ptb10 {
  273. box-sizing: border-box;
  274. padding: 10px 20px;
  275. }
  276. .borderTop {
  277. border-top: 1px solid #f5f5f5;
  278. }
  279. .center {
  280. display: flex;
  281. justify-content: center;
  282. align-items: center;
  283. }
  284. </style>
  285. <body>
  286. <form class="layui-form" id="admin" enctype="multipart/form-data">
  287. <div class="layui-form" lay-filter="layuiadmin-app-form-list" id="layuiadmin-app-form-list">
  288. <div class="layui-form-item">
  289. <div class="layui-tab layui-tab-card">
  290. <div class="layui-tab-content">
  291. <div class="layui-tab-item layui-show">
  292. <div class="layui-form-item">
  293. <label class="layui-form-label"><i style="color:red;">*&nbsp;</i>群发类型</label>
  294. <input type="radio" lay-filter="type" name="type" value="1" title="群发到客户" {if
  295. condition="$info['send_type'] eq 1" }checked{/if}>
  296. <input type="radio" lay-filter="type" name="type" value="2" title="群发到客户群" {if
  297. condition="$info['send_type'] eq 2" }checked{/if}>
  298. </div>
  299. <div class="layui-form-item mt10">
  300. <label class="layui-form-label"><i style="color:red;">*&nbsp;</i>群发内容</label>
  301. <textarea name="content" required lay-verify="required" placeholder="请输入"
  302. class="layui-textarea" style="width:70%;">{$info['content']}</textarea>
  303. <!-- <div class="upload" id="img"><i class="layui-icon layui-icon-picture"></i><span class="font15">上传图片</span></div>-->
  304. </div>
  305. <!-- <div class="layui-form-item mt10">
  306. <label class="layui-form-label">群发附件</label>
  307. <div class="layui-input-inline">
  308. <div class="upload" id="img"><i class="layui-icon layui-icon-picture"></i><span class="font15">上传图片</span></div>
  309. <input type="hidden" name="media_id" id="media_id">
  310. </div>
  311. </div> -->
  312. <div class="layui-form-item" id="imageFiles" style="min-height: 0px;margin-bottom: 0px;">
  313. <label class="layui-form-label"></label>
  314. <div class="picDiv" style="margin-left: 225px;">
  315. </div>
  316. </div>
  317. <div class="layui-form-item" style="margin-bottom: 30px;">
  318. <label class="layui-form-label"><i style="color:red;">*&nbsp;</i>执行时间</label>
  319. <div class="layui-input-inline flex-center border">
  320. <input type="text" name="sendtime" id="start_date" placeholder="选择开始日期"
  321. autocomplete="off" class="layui-input"
  322. value="{:date('Y-m-d H:i',$info['sendtime'])}">
  323. <img src="__STATIC__/img/bg-calendar.png" alt="日历" width="14px" height="14px">
  324. </div>
  325. <div class="layui-form-mid">-</div>
  326. <div class="layui-input-inline flex-center border">
  327. <input type="text" name="endtime" id="end_date" placeholder="选择结束日期"
  328. autocomplete="off" class="layui-input"
  329. value="{:date('Y-m-d H:i',$info['endtime'])}">
  330. <img src="__STATIC__/img/bg-calendar.png" alt="日历" width="14px" height="14px">
  331. </div>
  332. </div>
  333. <div class="layui-form-item">
  334. <label class="layui-form-label"><i style="color:red;">*&nbsp;</i>群发对象</label>
  335. <div class="layui-input-inline" style="width: 500px;">
  336. <div id="range_person" style="width: 500px;"></div>
  337. <div id="range_people" class="layui-hide"></div>
  338. </div>
  339. </div>
  340. <input type="button" style="margin-left:23.5%;height:38px;" lay-submit
  341. class="layui-btn layui-btn-normal" lay-filter="activity-submit" id="activity-submit"
  342. value="确认保存">
  343. <!-- <button type="button" class="layui-btn plr20 cancel">取消</button> -->
  344. </div>
  345. </div>
  346. </div>
  347. </div>
  348. </div>
  349. </form>
  350. <div class="mask layui-hide">
  351. <div class="mask-content">
  352. <div class="header-nav">
  353. <span>选择客户群</span>
  354. <i class="layui-icon layui-icon-close" style="font-weight: 600;font-size: 18px;cursor: pointer;"
  355. id="closeMask"></i>
  356. </div>
  357. <div class="list-content">
  358. <div class="first-box">
  359. <div class="first-content">
  360. </div>
  361. </div>
  362. <div class="second-box">
  363. </div>
  364. </div>
  365. <div class="space-between borderTop">
  366. <div class="flex-sub center" id="test1">
  367. </div>
  368. <div class="justify-end flex-sub">
  369. <div class="layui-btn sure">确定</div>
  370. </div>
  371. </div>
  372. </div>
  373. </div>
  374. <div style="display: none;">
  375. {volist name="info['employee_list']" id="vo" key="key"}
  376. <div class="noneBox" data-name="{$vo.name}" data-id="{$vo.id}">
  377. </div>
  378. {/volist}
  379. </div>
  380. </body>
  381. {/block} {block name="js"}
  382. <script src="__STATIC__/layui/layui/lay/modules/xm-select.js" type="text/javascript" charset="utf-8"></script>
  383. <script>
  384. layui.config({
  385. base: '__LAYUI__/',
  386. urlbase: '/sys'
  387. }).extend({
  388. index: 'lib/index' //主入口模块
  389. }).use(['index', 'form', 'upload', 'layedit', 'laydate', 'laypage'], function () {
  390. var form = layui.form,
  391. upload = layui.upload,
  392. layedit = layui.layedit,
  393. laydate = layui.laydate,
  394. $ = layui.jquery,
  395. files,
  396. img_id = [],
  397. img_id_arr = [],
  398. listData = [],
  399. selectData = [],
  400. laypage = layui.laypage;
  401. var textarea = layedit.build('content', {
  402. 'height': 500
  403. });
  404. form.render();
  405. /* 监听提交 */
  406. form.on('submit(activity-submit)', function (obj) {
  407. var index = parent.layer.getFrameIndex(window.name);
  408. var formData = new FormData(obj.form);
  409. let val1 = approve_ids.getValue('valueStr');
  410. let typeVal = formData.get("type");
  411. formData.append('id', "{$info['id']}");
  412. if ((!val1 && typeVal == 1) || (!selectData.length && typeVal == 2)) {
  413. layer.msg('请选择群发对象', {
  414. anim: 6
  415. , time: 2000
  416. });
  417. return;
  418. }
  419. if (typeVal == 1) {
  420. if (formData.has("employee_id")) {
  421. formData.delete('employee_id');
  422. }
  423. formData.append('select', val1)
  424. } else {
  425. if (formData.has("select")) {
  426. formData.delete('select');
  427. }
  428. formData.append('employee_id', selectData.map(v => v.id).join(','))
  429. }
  430. var formImg = []
  431. for (i in img_id_arr) {
  432. formImg.push(img_id[img_id_arr[i]])
  433. }
  434. formData.append('media_id_arr', formImg);
  435. // 单击之后提交按钮不可选,防止重复提交
  436. var DISABLED = 'layui-btn-disabled';
  437. var target = '#activity-submit';
  438. $(target).addClass(DISABLED);
  439. $(target).attr('disabled', 'disabled');
  440. $.ajax({
  441. url: '{:url("edit_external_message")}',
  442. type: 'post',
  443. data: formData,
  444. dataType: 'json',
  445. processData: false,
  446. contentType: false,
  447. success: function (res) {
  448. if (res.code === 0) {
  449. layer.msg(res.msg, {
  450. anim: 0
  451. }, function () {
  452. parent.layui.table.reload('qunfa-table');
  453. parent.layer.close(index);
  454. });
  455. } else {
  456. layer.msg(res.msg, {
  457. anim: 6
  458. });
  459. }
  460. }
  461. });
  462. });
  463. $('#range_people').click(() => {
  464. let el = $('.mask')[0];
  465. if (el.className.indexOf('layui-hide') > 0) {
  466. el.className = 'mask';
  467. } else {
  468. el.className = 'mask layui-hide';
  469. }
  470. })
  471. function getchatListData(page = 1) {
  472. $.ajax({
  473. url: "{:url('getUserList')}",
  474. data: {
  475. page: page,
  476. limit: 10
  477. },
  478. dataType: 'json',
  479. type: 'post',
  480. success: function (data) {
  481. listData = data.data.list;
  482. $('.first-content')[0].innerHTML = listData.map((v, i) => {
  483. let il = selectData.filter(o => o.id == v.id);
  484. if (il.length) {
  485. return `<div class="item space-between" title="${v.id}">
  486. <input id="${v.id}" type="checkbox" name="${v.id}" title="${v.name}" lay-skin="primary" style="display:block;" checked/>
  487. <label for="${v.id}" class="flex-sub">${v.name}</label>
  488. </div>`
  489. } else {
  490. return `<div class="item space-between" title="${v.id}">
  491. <input id="${v.id}" type="checkbox" name="${v.id}" title="${v.name}" lay-skin="primary" style="display:block;"/>
  492. <label for="${v.id}" class="flex-sub">${v.name}</label>
  493. </div>`
  494. }
  495. }).join('');
  496. //执行一个laypage实例
  497. laypage.render({
  498. elem: 'test1' //注意,这里的 test1 是 ID,不用加 # 号
  499. , count: data.data.count, //数据总数,从服务端得到
  500. curr: page,
  501. groups: 3,
  502. jump: function (obj, first) {
  503. //obj包含了当前分页的所有参数,比如:
  504. console.log(obj.curr); //得到当前页,以便向服务端请求对应页的数据。
  505. console.log(obj.limit); //得到每页显示的条数
  506. //首次不执行
  507. if (!first) {
  508. getchatListData(obj.curr);
  509. }
  510. }
  511. });
  512. }
  513. });
  514. }
  515. function setSelectDataHtml(data) {
  516. $('.second-box')[0].innerHTML = data.map((v, i) => {
  517. return `<div class="item space-between">
  518. <span>${v.name}</span>
  519. <i class="layui-icon layui-icon-close" data-index="${i}" data-chatId="${v.id}"></i>
  520. </div>`
  521. }).join('');
  522. }
  523. $('.sure').click(() => {
  524. $('#range_people')[0].innerHTML = selectData.map((v, i) => {
  525. return v.name;
  526. }).join(', ');
  527. $('.mask')[0].className = 'mask layui-hide';
  528. })
  529. $('.first-content').click((e) => {
  530. if (e.target.name) {
  531. let index = null;
  532. let o = listData.filter(v => v.id == e.target.name);
  533. let ol = selectData.filter((v, i) => {
  534. if (v.id == e.target.name) {
  535. index = i;
  536. return v;
  537. }
  538. });
  539. if (ol.length > 0 && (index || (index == 0))) {
  540. selectData.splice(index, 1);
  541. setSelectDataHtml(selectData)
  542. } else {
  543. selectData.push(...o);
  544. setSelectDataHtml(selectData)
  545. }
  546. }
  547. });
  548. $('.second-box').click((e) => {
  549. if (e.target.localName == 'i') {
  550. let o = parseInt(e.target.dataset.index);
  551. selectData.splice(o, 1);
  552. setSelectDataHtml(selectData);
  553. $(`#${e.target.dataset.chatid}`).prop('checked', false)
  554. }
  555. })
  556. $(document).click((e) => {
  557. setSendObject();
  558. })
  559. setSendObject();
  560. function setSendObject() {
  561. let pl = $('.layui-form-radioed')[0];
  562. if (pl.innerText == '群发到客户群') {
  563. let el = $('#range_person')[0];
  564. let elo = $('#range_people')[0];
  565. el.className = 'layui-hide'
  566. elo.className = ''
  567. } else {
  568. let el = $('#range_person')[0];
  569. let elo = $('#range_people')[0];
  570. el.className = '';
  571. elo.className = 'layui-hide'
  572. }
  573. }
  574. $('#closeMask').click(() => {
  575. let el = $('.mask')[0];
  576. el.className = 'mask layui-hide';
  577. })
  578. //选择群发对象
  579. var approve_ids = xmSelect.render({
  580. el: "#range_person",
  581. autoRow: true,
  582. filterable: true,
  583. tips: '群发对象',
  584. toolbar: {
  585. //工具条,全选,清空,反选,自定义
  586. show: true,
  587. list: [
  588. 'ALL',
  589. 'CLEAR',
  590. 'REVERSE'
  591. ]
  592. },
  593. // tree: {
  594. // show: true,
  595. // showFolderIcon: true,
  596. // showLine: true,
  597. // indent: 20,
  598. // expandedKeys: [ -3 ],
  599. // },
  600. height: "200px",
  601. data: [],
  602. //文本显示模式
  603. //处理方式
  604. });
  605. setTimeout(() => {
  606. setChatVal();
  607. }, 1000)
  608. function setChatVal() {
  609. let type = "{$info['send_type']}";
  610. if (type == 1) {
  611. let val1 = "{$info['customer_group']}";
  612. let data = [{
  613. children: [],
  614. id: 1,
  615. name: "确认量房",
  616. pid: 0,
  617. selected: val1.indexOf('1') > -1,
  618. value: 1,
  619. }, {
  620. children: [],
  621. id: 2,
  622. name: "交定",
  623. pid: 0,
  624. selected: val1.indexOf('2') > -1,
  625. value: 2,
  626. }, {
  627. children: [],
  628. id: 3,
  629. name: "合同",
  630. pid: 0,
  631. selected: val1.indexOf('3') > -1,
  632. value: 3,
  633. }];
  634. approve_ids.update({ data: data });
  635. } else {
  636. let el = $('.noneBox');
  637. selectData = [];
  638. if (el.length) {
  639. for (let i = 0; i < el.length; i++) {
  640. selectData.push({ id: el[i].dataset.id, name: el[i].dataset.name })
  641. }
  642. }
  643. setSelectDataHtml(selectData);
  644. setTimeout(() => {
  645. $('#range_people')[0].innerHTML = selectData.map((v, i) => {
  646. return v.name;
  647. }).join(', ');
  648. getchatListData();
  649. }, 100)
  650. }
  651. }
  652. //多图片上传
  653. // upload.render({
  654. // elem: '#img',
  655. // accept: 'images',
  656. // url: '/upload/',
  657. // exts: 'jpg|png|bmp|jpeg|JPG|PNG|BMP|JPEG',
  658. // field: 'article_image',
  659. // size: 5 * 1024,
  660. // auto: false,
  661. // multiple: true,
  662. // choose: function(obj) {
  663. // files = obj.pushFile();
  664. // length = $('.imageDiv').length;
  665. // obj.preview(function(index, file, result) {
  666. // console.log(index)
  667. // console.log(file)
  668. // console.log(result)
  669. // length++;
  670. // if(length > 9) {
  671. // if(length == 10) layer.msg('限制九张图片以下');
  672. // delete files[index];
  673. // } else {
  674. // $.ajax({
  675. // url: "{:url('weworkUpload')}",
  676. // data: {path: result},
  677. // type: 'post',
  678. // success:function (res) {
  679. // if (res.code == 0) {
  680. // img_id_arr.push(index);
  681. // img_id[index] = res.data;
  682. // $('.picDiv').prepend('<div class="imageDiv" data-id="' + index + '"><img src="' + result + '" alt="' + file.name + '" class="layui-upload-img" width="100%" height="100%"><div><i class="layui-icon layui-icon-delete" prop="del"></i></div></div>');
  683. // } else {
  684. // layer.msg(res.msg);
  685. // }
  686. // }
  687. // })
  688. // }
  689. // if (length) {
  690. // $('#imageFiles').removeClass('layui-hide')
  691. // }
  692. // });
  693. // }
  694. // });
  695. $('.cancel').click(function () {
  696. var index = parent.layer.getFrameIndex(window.name);
  697. parent.layer.close(index);
  698. })
  699. //日期范围
  700. laydate.render({
  701. elem: '#start_date',
  702. trigger: 'click',//呼出事件改成click
  703. type: 'datetime',
  704. format: 'yyyy-MM-dd HH:mm'
  705. });
  706. laydate.render({
  707. elem: '#end_date',
  708. trigger: 'click', //呼出事件改成click
  709. type: 'datetime',
  710. format: 'yyyy-MM-dd HH:mm'
  711. });
  712. form.on('radio(type)', function (data) {
  713. if (data.value == 1) {
  714. $('#money').addClass('layui-hide');
  715. } else {
  716. $('#money').removeClass('layui-hide');
  717. }
  718. });
  719. $('.picDiv').on('click', 'i', function (e) {
  720. var that = this;
  721. if (e.target.attributes[1].nodeValue === 'view') {
  722. layer.photos({ photos: { "data": [{ "src": e.target.attributes[2].nodeValue }] }, closeBtn: true });
  723. } else {
  724. layer.confirm('确定删除该图片么?', { title: ['信息', 'color:#333333;background-color:#D8E6F1;'], }, function (index) {
  725. var imgDiv = $(that).closest('.imageDiv');
  726. if (id = imgDiv.data('id')) {
  727. delete files[id];
  728. var io = img_id_arr.indexOf(id)
  729. if (io > -1) {
  730. img_id_arr.splice(io, 1);
  731. }
  732. }
  733. imgDiv.remove();
  734. layer.close(index);
  735. });
  736. }
  737. });
  738. });
  739. </script>
  740. {/block}