Orders_Admin.js 30 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709
  1. var ExcelData,ExcelKind;
  2. function ConfirmImport() {
  3. $.ajax({
  4. type: "POST",
  5. url: "/Admin/Orders/Import?r=" + Math.random(1),
  6. data: "ExcelData=" + encodeURIComponent(JSON.stringify(ExcelData)),
  7. dataType: "text",
  8. success: function (data) {
  9. if (data == "success") {
  10. layer.msg("导入成功", { time: 2000 }, function () {
  11. window.location.reload();
  12. });
  13. } else {
  14. layer.msg(data);
  15. }
  16. }
  17. });
  18. }
  19. var excel;
  20. layui.config({
  21. base: '/layuiadmin/' //静态资源所在路径
  22. }).extend({
  23. myexcel: 'layui/lay/modules/excel',
  24. index: 'lib/index' //主入口模块
  25. }).use(['index', 'table', 'excel', 'laydate'], function () {
  26. var $ = layui.$
  27. , form = layui.form
  28. , table = layui.table;
  29. //- 筛选条件-日期
  30. var laydate = layui.laydate;
  31. var layPayeDate = laydate.render({
  32. elem: '#PayDate',
  33. type: 'date',
  34. range: true,
  35. trigger: 'click',
  36. change: function (value, date, endDate) {
  37. var op = true;
  38. if (date.year == endDate.year && endDate.month - date.month <= 1) {
  39. if (endDate.month - date.month == 1 && endDate.date > date.date) {
  40. op = false;
  41. layPayeDate.hint('日期范围请不要超过1个月');
  42. setTimeout(function () {
  43. $(".laydate-btns-confirm").addClass("laydate-disabled");
  44. }, 1);
  45. }
  46. } else {
  47. op = false;
  48. layPayeDate.hint('日期范围请不要超过1个月');
  49. setTimeout(function () {
  50. $(".laydate-btns-confirm").addClass("laydate-disabled");
  51. }, 1);
  52. }
  53. if (op) {
  54. $('#PayDate').val(value);
  55. }
  56. }
  57. });
  58. var layCreateDate = laydate.render({
  59. elem: '#CreateDate',
  60. type: 'date',
  61. range: true,
  62. trigger: 'click',
  63. change: function (value, date, endDate) {
  64. var op = true;
  65. if (date.year == endDate.year && endDate.month - date.month <= 1) {
  66. if (endDate.month - date.month == 1 && endDate.date > date.date) {
  67. op = false;
  68. layCreateDate.hint('日期范围请不要超过1个月');
  69. setTimeout(function () {
  70. $(".laydate-btns-confirm").addClass("laydate-disabled");
  71. }, 1);
  72. }
  73. } else {
  74. op = false;
  75. layCreateDate.hint('日期范围请不要超过1个月');
  76. setTimeout(function () {
  77. $(".laydate-btns-confirm").addClass("laydate-disabled");
  78. }, 1);
  79. }
  80. if (op) {
  81. $('#CreateDate').val(value);
  82. }
  83. }
  84. });
  85. var laySendDate = laydate.render({
  86. elem: '#SendDate',
  87. trigger: 'click',
  88. type: 'date',
  89. range: true,
  90. change: function (value, date, endDate) {
  91. var op = true;
  92. if (date.year == endDate.year && endDate.month - date.month <= 1) {
  93. if (endDate.month - date.month == 1 && endDate.date > date.date) {
  94. op = false;
  95. laySendDate.hint('日期范围请不要超过1个月');
  96. setTimeout(function () {
  97. $(".laydate-btns-confirm").addClass("laydate-disabled");
  98. }, 1);
  99. }
  100. } else {
  101. op = false;
  102. laySendDate.hint('日期范围请不要超过1个月');
  103. setTimeout(function () {
  104. $(".laydate-btns-confirm").addClass("laydate-disabled");
  105. }, 1);
  106. }
  107. if (op) {
  108. $('#SendDate').val(value);
  109. }
  110. }
  111. });
  112. //excel导入
  113. excel = layui.excel;
  114. $('#ExcelFile').change(function (e) {
  115. var files = e.target.files;
  116. excel.importExcel(files, { }, function (data) {
  117. ExcelData = data[0].sheet1;
  118. });
  119. });
  120. //监听单元格编辑
  121. table.on('edit(LAY-list-manage)', function(obj){
  122. var value = obj.value //得到修改后的值
  123. ,data = obj.data //得到所在行所有键值
  124. ,field = obj.field; //得到字段
  125. if(field == "Sort"){
  126. $.ajax({
  127. type: "POST",
  128. url: "/Admin/Orders/Sort?r=" + Math.random(1),
  129. data: "Id=" + data.Id + "&Sort=" + value,
  130. dataType: "text",
  131. success: function (data) {
  132. }
  133. });
  134. }
  135. });
  136. //列表数据
  137. table.render({
  138. elem: '#LAY-list-manage'
  139. , url: '/Admin/Orders/IndexData' //模拟接口
  140. , cols: [[
  141. { type: 'checkbox', fixed: 'left' }
  142. , { field: 'Id', fixed: 'left', title: 'ID', width: 80, sort: true, unresize: true }
  143. ,{field:'OrderNo', width: 200, title:'平台订单号-渠道订单号', sort: true}
  144. ,{field:'ProductName', width: 200, title:'商品名称', sort: true}
  145. ,{field:'Store', width: 200, title:'发货仓库信息', sort: true}
  146. ,{field:'StoreContact', width: 200, title:'仓库联系人信息', sort: true}
  147. ,{field:'StoreFrom', width: 200, title:'仓库归属信息', sort: true}
  148. ,{field:'UserInfo', width: 200, title:'创客信息', sort: true}
  149. ,{field:'TopUserInfo', width: 200, title:'顶级创客信息', sort: true}
  150. ,{field:'Address', width: 200, title:'收货地址', sort: true}
  151. ,{field:'RecieveInfo', width: 200, title:'收件人姓名-联系电话', sort: true}
  152. ,{field:'PayMode', width: 200, title:'支付渠道', sort: true}
  153. ,{field:'TotalPrice', width: 200, title:'订单金额', sort: true}
  154. ,{field:'PayStatus', width: 200, title:'支付状态', sort: true}
  155. ,{field:'DeliveryType', width: 200, title:'提货类型', sort: true}
  156. ,{field:'Remark', width: 200, title:'订单备注', sort: true}
  157. ,{field:'SendInfo', width: 200, title:'发货状态-发货时间', sort: true}
  158. ,{field:'RefundStatusName', width: 200, title:'退款状态', sort: true}
  159. ,{field:'ErpInfo', width: 200, title:'快递单号-快递名称', sort: true}
  160. ,{field:'CreateDate', width: 200, title:'下单时间', sort: true}
  161. ,{field:'PayDate', width: 200, title:'支付时间', sort: true}
  162. , { title: '操作', align: 'center', width: 300, fixed: 'right', toolbar: '#table-list-tools' }
  163. ]]
  164. , where: {
  165. }
  166. , page: true
  167. , limit: 30
  168. , height: 'full-220'
  169. , text: '对不起,加载出现异常!'
  170. , done: function (res, curr, count) {
  171. $("#SuccessAmount").text(res.other.SuccessAmount);
  172. $("#FailAmount").text(res.other.FailAmount);
  173. $(".layui-none").text("无数据");
  174. }
  175. });
  176. //监听工具条
  177. table.on('tool(LAY-list-manage)', function (obj) {
  178. var data = obj.data;
  179. if (obj.event === 'del') {
  180. var index = layer.confirm('确定要删除吗?删除后不能恢复!', function (index) {
  181. $.ajax({
  182. type: "POST",
  183. url: "/Admin/Orders/Delete?r=" + Math.random(1),
  184. data: "Id=" + data.Id,
  185. dataType: "text",
  186. success: function (data) {
  187. if (data == "success") {
  188. obj.del();
  189. layer.close(index);
  190. } else {
  191. parent.layer.msg(data);
  192. }
  193. }
  194. });
  195. });
  196. } else if (obj.event === 'edit') {
  197. var tr = $(obj.tr);
  198. var perContent = layer.open({
  199. type: 2
  200. , title: '创客订单-编辑'
  201. , content: 'Edit?Id=' + data.Id + ''
  202. , maxmin: true
  203. , area: ['500px', '450px']
  204. , btn: ['确定', '取消']
  205. , yes: function (index, layero) {
  206. var iframeWindow = window['layui-layer-iframe' + index]
  207. , submitID = 'LAY-list-front-submit'
  208. , submit = layero.find('iframe').contents().find('#' + submitID);
  209. setTimeout(function () {
  210. layero.find('iframe').contents().find('.layui-tab-item').each(function (i) {
  211. var errObj = $(this).find('.layui-form-danger');
  212. if (errObj.length > 0) {
  213. iframeWindow.element.tabChange('mytabbar', String(i + 1));
  214. submit.click();
  215. }
  216. });
  217. }, 300);
  218. //监听提交
  219. iframeWindow.layui.form.on('submit(' + submitID + ')', function (data) {
  220. var field = data.field; //获取提交的字段
  221. var userdata = "";
  222. for (var prop in field) {
  223. userdata += prop + "=" + encodeURIComponent(field[prop]) + "&";
  224. }
  225. //提交 Ajax 成功后,静态更新表格中的数据
  226. //$.ajax({});
  227. $.ajax({
  228. type: "POST",
  229. url: "/Admin/Orders/Edit?r=" + Math.random(1),
  230. data: userdata,
  231. dataType: "text",
  232. success: function (data) {
  233. layer.close(index); //关闭弹层
  234. if (data == "success") {
  235. table.reload('LAY-list-manage'); //数据刷新
  236. } else {
  237. layer.msg(data);
  238. }
  239. }
  240. });
  241. });
  242. submit.trigger('click');
  243. }
  244. , success: function (layero, index) {
  245. }
  246. });
  247. layer.full(perContent);
  248. } else if (obj.event === 'detail') {
  249. var tr = $(obj.tr);
  250. var perContent = layer.open({
  251. type: 2
  252. , title: '订单详情'
  253. , content: 'Detail?Id=' + data.Id + ''
  254. , maxmin: true
  255. , area: ['700px', '650px']
  256. , btn: ['关闭']
  257. , yes: function (index, layero) {
  258. layer.close(index);
  259. }
  260. , success: function (layero, index) {
  261. }
  262. });
  263. layer.full(perContent);
  264. } else if (obj.event === 'send') {
  265. var tr = $(obj.tr);
  266. var perContent = layer.open({
  267. type: 2
  268. , title: '创客订单-编辑'
  269. , content: 'Send?Id=' + data.Id + ''
  270. , maxmin: true
  271. , area: ['500px', '650px']
  272. , btn: ['提交', '取消']
  273. , yes: function (index, layero) {
  274. var iframeWindow = window['layui-layer-iframe' + index]
  275. , submitID = 'LAY-list-front-submit'
  276. , submit = layero.find('iframe').contents().find('#' + submitID);
  277. setTimeout(function () {
  278. layero.find('iframe').contents().find('.layui-tab-item').each(function (i) {
  279. var errObj = $(this).find('.layui-form-danger');
  280. if (errObj.length > 0) {
  281. iframeWindow.element.tabChange('mytabbar', String(i + 1));
  282. submit.click();
  283. }
  284. });
  285. }, 300);
  286. //监听提交
  287. iframeWindow.layui.form.on('submit(' + submitID + ')', function (data) {
  288. var field = data.field; //获取提交的字段
  289. var userdata = "";
  290. for (var prop in field) {
  291. userdata += prop + "=" + encodeURIComponent(field[prop]) + "&";
  292. }
  293. //提交 Ajax 成功后,静态更新表格中的数据
  294. //$.ajax({});
  295. var IdList = '';
  296. layero.find('iframe').contents().find('input[type=hidden][name=IdList]').each(function (i) {
  297. IdList += $(this).val() + "#";
  298. });
  299. userdata += "&IdList=" + IdList;
  300. var StoreIdList = '';
  301. layero.find('iframe').contents().find('select[name=StoreIdList]').each(function (i) {
  302. StoreIdList += $(this).val() + "#";
  303. });
  304. userdata += "&StoreIdList=" + StoreIdList;
  305. var SnNosList = '';
  306. layero.find('iframe').contents().find('textarea[name=SnNosList]').each(function (i) {
  307. SnNosList += $(this).val() + "#";
  308. });
  309. userdata += "&SnNosList=" + SnNosList;
  310. $.ajax({
  311. type: "POST",
  312. url: "/Admin/Orders/Send?r=" + Math.random(1),
  313. data: userdata,
  314. dataType: "text",
  315. success: function (data) {
  316. if (data == "success") {
  317. layer.close(index); //关闭弹层
  318. layer.msg('提交成功', { time: 1500 }, function () {
  319. table.reload('LAY-list-manage'); //数据刷新
  320. });
  321. } else {
  322. layer.msg(data);
  323. }
  324. }
  325. });
  326. });
  327. submit.trigger('click');
  328. }
  329. , success: function (layero, index) {
  330. }
  331. });
  332. } else if (obj.event === 'return') {
  333. var tr = $(obj.tr);
  334. var perContent = layer.open({
  335. type: 2
  336. , title: '退货'
  337. , content: 'Return?Id=' + data.Id + ''
  338. , maxmin: true
  339. , area: ['500px', '450px']
  340. , btn: ['提交', '取消']
  341. , yes: function (index, layero) {
  342. var iframeWindow = window['layui-layer-iframe' + index]
  343. , submitID = 'LAY-list-front-submit'
  344. , submit = layero.find('iframe').contents().find('#' + submitID);
  345. setTimeout(function () {
  346. layero.find('iframe').contents().find('.layui-tab-item').each(function (i) {
  347. var errObj = $(this).find('.layui-form-danger');
  348. if (errObj.length > 0) {
  349. iframeWindow.element.tabChange('mytabbar', String(i + 1));
  350. submit.click();
  351. }
  352. });
  353. }, 300);
  354. //监听提交
  355. iframeWindow.layui.form.on('submit(' + submitID + ')', function (data) {
  356. var field = data.field; //获取提交的字段
  357. var userdata = "";
  358. for (var prop in field) {
  359. userdata += prop + "=" + encodeURIComponent(field[prop]) + "&";
  360. }
  361. //提交 Ajax 成功后,静态更新表格中的数据
  362. //$.ajax({});
  363. $.ajax({
  364. type: "POST",
  365. url: "/Admin/Orders/Return?r=" + Math.random(1),
  366. data: userdata,
  367. dataType: "text",
  368. success: function (data) {
  369. if (data == "success") {
  370. layer.close(index); //关闭弹层
  371. layer.msg('提交成功', { time: 1500 }, function () {
  372. table.reload('LAY-list-manage'); //数据刷新
  373. });
  374. } else {
  375. layer.msg(data);
  376. }
  377. }
  378. });
  379. });
  380. submit.trigger('click');
  381. }
  382. , success: function (layero, index) {
  383. }
  384. });
  385. } else if (obj.event === 'prize100') {
  386. var loadindex = layer.load(1, {
  387. shade: [0.5, '#000']
  388. });
  389. $.ajax({
  390. url: "/Admin/Orders/Prize100?r=" + Math.random(1),
  391. data: "Id=" + data.Id,
  392. dataType: "json",
  393. success: function (data) {
  394. layer.close(loadindex);
  395. if (data.code == '1') {
  396. layer.alert(data.result.replace(/\n/g, '<br />'), { area: ['680px', '460px'] });
  397. } else {
  398. var index = layer.confirm(data.result.replace(/\n/g, '<br />') + '<br />是否立即补发?', { area: ['500px', '460px'] }, function (index) {
  399. $.ajax({
  400. type: "POST",
  401. url: "/Admin/Orders/AddPrize100?r=" + Math.random(1),
  402. data: "Id=" + data.Id,
  403. dataType: "text",
  404. success: function (data) {
  405. if (data == "success") {
  406. layer.close(index);
  407. layer.msg("补发成功");
  408. } else {
  409. layer.msg(data);
  410. }
  411. }
  412. });
  413. });
  414. }
  415. }
  416. });
  417. }
  418. });
  419. //监听搜索
  420. form.on('submit(LAY-list-front-search)', function (data) {
  421. var field = data.field;
  422. //执行重载
  423. table.reload('LAY-list-manage', {
  424. where: field,
  425. page: {
  426. curr: 1
  427. }
  428. });
  429. });
  430. form.on('submit(LAY-list-front-searchall)', function (data) {
  431. table.reload('LAY-list-manage', {
  432. where: null,
  433. page: {
  434. curr: 1
  435. }
  436. });
  437. });
  438. //事件
  439. var active = {
  440. batchdel: function () {
  441. var checkStatus = table.checkStatus('LAY-list-manage')
  442. , data = checkStatus.data; //得到选中的数据
  443. if (data.length < 1) {
  444. parent.layer.msg("请选择要删除的项");
  445. } else {
  446. var ids = "";
  447. $.each(data, function (index, value) {
  448. ids += data[index].Id + ",";
  449. });
  450. ids = ids.substring(0, ids.length - 1);
  451. var index = layer.confirm('确定要删除吗?删除后不能恢复!', function (index) {
  452. $.ajax({
  453. type: "POST",
  454. url: "/Admin/Orders/Delete?r=" + Math.random(1),
  455. data: "Id=" + ids,
  456. dataType: "text",
  457. success: function (data) {
  458. layer.close(index);
  459. if (data == "success") {
  460. table.reload('LAY-list-manage');
  461. } else {
  462. layer.msg(data);
  463. }
  464. }
  465. });
  466. });
  467. }
  468. }
  469. , add: function () {
  470. var perContent = layer.open({
  471. type: 2
  472. , title: '创客订单-添加'
  473. , content: 'Add'
  474. , maxmin: true
  475. , area: ['500px', '450px']
  476. , btn: ['确定', '取消']
  477. , yes: function (index, layero) {
  478. var iframeWindow = window['layui-layer-iframe' + index]
  479. , submitID = 'LAY-list-front-submit'
  480. , submit = layero.find('iframe').contents().find('#' + submitID);
  481. setTimeout(function () {
  482. layero.find('iframe').contents().find('.layui-tab-item').each(function (i) {
  483. var errObj = $(this).find('.layui-form-danger');
  484. if (errObj.length > 0) {
  485. iframeWindow.element.tabChange('mytabbar', String(i + 1));
  486. submit.click();
  487. }
  488. });
  489. }, 300);
  490. //监听提交
  491. iframeWindow.layui.form.on('submit(' + submitID + ')', function (data) {
  492. var field = data.field; //获取提交的字段
  493. var userdata = "";
  494. for (var prop in field) {
  495. userdata += prop + "=" + encodeURIComponent(field[prop]) + "&";
  496. }
  497. //提交 Ajax 成功后,静态更新表格中的数据
  498. //$.ajax({});
  499. $.ajax({
  500. type: "POST",
  501. url: "/Admin/Orders/Add?r=" + Math.random(1),
  502. data: userdata,
  503. dataType: "text",
  504. success: function (data) {
  505. layer.close(index); //关闭弹层
  506. if (data == "success") {
  507. table.reload('LAY-list-manage'); //数据刷新
  508. } else {
  509. layer.msg(data);
  510. }
  511. }
  512. });
  513. });
  514. submit.trigger('click');
  515. }
  516. });
  517. layer.full(perContent);
  518. }
  519. , ImportData: function () {
  520. ExcelKind = 1;
  521. layer.open({
  522. type: 1,
  523. title: '导入',
  524. maxmin: false,
  525. area: ['460px', '280px'],
  526. content: $('#excelForm'),
  527. cancel: function () {
  528. }
  529. });
  530. $("#excelTemp").html('<a href="/excelfile/模板文件.xlsx">点击下载模板文件</a>');
  531. },ExportsExcel: function () {
  532. var userdata = '';
  533. $(".layuiadmin-card-header-auto input").each(function (i) {
  534. console.log($(this).attr('name'));
  535. console.log($(this).val());
  536. userdata += $(this).attr('name') + '=' + encodeURIComponent($(this).val()) + '&';
  537. });
  538. $(".layuiadmin-card-header-auto select").each(function (i) {
  539. userdata += $(this).attr('name') + '=' + encodeURIComponent($(this).val()) + '&';
  540. });
  541. $.ajax({
  542. type: "GET",
  543. url: "/Admin/Orders/ExportsExcel?r=" + Math.random(1),
  544. data: userdata,
  545. dataType: "json",
  546. success: function (data) {
  547. data.Obj.unshift(data.Fields);
  548. excel.exportExcel(data.Obj, data.Info, 'xlsx');
  549. }
  550. });
  551. }
  552. , ExportExcel: function () {
  553. var userdata = '';
  554. $(".layuiadmin-card-header-auto input").each(function (i) {
  555. userdata += $(this).attr('name') + '=' + encodeURIComponent($(this).val()) + '&';
  556. });
  557. $(".layuiadmin-card-header-auto select").each(function (i) {
  558. userdata += $(this).attr('name') + '=' + encodeURIComponent($(this).val()) + '&';
  559. });
  560. var index = layer.load(1, {
  561. shade: [0.8, '#000'],
  562. content: '',
  563. success: function (layero) {
  564. var obj = layero.find('.layui-layer-content').css({
  565. 'padding-top': '10px',
  566. 'width': '200px',
  567. 'color': '#fff',
  568. 'text-align': 'center'
  569. });
  570. var st = setInterval(function () {
  571. $.ajax({
  572. type: "GET",
  573. url: "/Admin/Orders/CheckExport?r=" + Math.random(1),
  574. dataType: "text",
  575. success: function (data) {
  576. if (data == "finish") {
  577. clearInterval(st);
  578. } else {
  579. obj.text(data);
  580. }
  581. }
  582. });
  583. }, 1000);
  584. }
  585. });
  586. $.ajax({
  587. type: "GET",
  588. url: "/Admin/Orders/ExportExcel?r=" + Math.random(1),
  589. data: userdata,
  590. dataType: "text",
  591. success: function (data) {
  592. layer.close(index);
  593. if (data.indexOf("success|") > -1) {
  594. var datalist = data.split('|');
  595. window.location.href = datalist[1];
  596. } else {
  597. layer.msg('导出失败');
  598. }
  599. // data.Obj.unshift(data.Fields);
  600. // excel.exportExcel(data.Obj, data.Info, 'xlsx');
  601. }
  602. });
  603. }
  604. , Open: function () {
  605. var checkStatus = table.checkStatus('LAY-list-manage')
  606. , data = checkStatus.data; //得到选中的数据
  607. if(data.length < 1){
  608. parent.layer.msg("请选择要开启的项");
  609. }else{
  610. var ids = "";
  611. $.each(data, function (index, value) {
  612. ids += data[index].Id + ",";
  613. });
  614. ids = ids.substring(0, ids.length - 1);
  615. var index = layer.confirm('确定要开启吗?', function (index) {
  616. $.ajax({
  617. type: "POST",
  618. url: "/Admin/Orders/Open?r=" + Math.random(1),
  619. data: "Id=" + ids,
  620. dataType: "text",
  621. success: function (data) {
  622. layer.close(index);
  623. if (data == "success") {
  624. table.reload('LAY-list-manage');
  625. } else {
  626. layer.msg(data);
  627. }
  628. }
  629. });
  630. });
  631. }
  632. }
  633. , Close: function () {
  634. var checkStatus = table.checkStatus('LAY-list-manage')
  635. , data = checkStatus.data; //得到选中的数据
  636. if(data.length < 1){
  637. parent.layer.msg("请选择要关闭的项");
  638. }else{
  639. var ids = "";
  640. $.each(data, function (index, value) {
  641. ids += data[index].Id + ",";
  642. });
  643. ids = ids.substring(0, ids.length - 1);
  644. var index = layer.confirm('确定要关闭吗?', function (index) {
  645. $.ajax({
  646. type: "POST",
  647. url: "/Admin/Orders/Close?r=" + Math.random(1),
  648. data: "Id=" + ids,
  649. dataType: "text",
  650. success: function (data) {
  651. layer.close(index);
  652. if (data == "success") {
  653. table.reload('LAY-list-manage');
  654. } else {
  655. layer.msg(data);
  656. }
  657. }
  658. });
  659. });
  660. }
  661. }
  662. };
  663. $('.layui-btn').on('click', function () {
  664. var type = $(this).data('type');
  665. active[type] ? active[type].call(this) : '';
  666. });
  667. });