Orders_Admin.js 30 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714
  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: 'SendInfo', width: 200, title: '发货状态-发货时间', sort: true }
  144. , { field: 'StatusName', width: 200, title: '订单状态', sort: true }
  145. , { field: 'OrderNo', width: 200, title: '平台订单号-渠道订单号', sort: true }
  146. , { field: 'ProductName', width: 200, title: '商品名称', sort: true }
  147. , { field: 'ProductKind', width: 200, title: '商品类型', sort: true }
  148. , { field: 'TotalPrice', width: 200, title: '订单金额', sort: true }
  149. , { field: 'BuyCount', width: 200, title: '购买数量', sort: true }
  150. , { field: 'UserInfo', width: 200, title: '创客信息', sort: true }
  151. , { field: 'Store', width: 200, title: '发货仓库信息', sort: true }
  152. , { field: 'StoreContact', width: 200, title: '仓库联系人信息', sort: true }
  153. , { field: 'StoreFrom', width: 200, title: '仓库归属信息', sort: true }
  154. , { field: 'TopUserInfo', width: 200, title: '顶级创客信息', sort: true }
  155. , { field: 'Address', width: 200, title: '收货地址', sort: true }
  156. , { field: 'RecieveInfo', width: 200, title: '收件人姓名-联系电话', sort: true }
  157. , { field: 'PayMode', width: 200, title: '支付渠道', sort: true }
  158. // , { field: 'PayStatusName', width: 200, title: '支付状态', sort: true }
  159. , { field: 'DeliveryType', width: 200, title: '提货类型', sort: true }
  160. , { field: 'Remark', width: 200, title: '订单备注', sort: true }
  161. // , { field: 'RefundStatusName', width: 200, title: '退款状态', sort: true }
  162. , { field: 'ErpInfo', width: 200, title: '快递单号-快递名称', sort: true }
  163. , { field: 'CreateDate', width: 200, title: '下单时间', sort: true }
  164. , { field: 'PayDate', width: 200, title: '支付时间', sort: true }
  165. , { field: 'SendDate', width: 200, title: '发货时间', sort: true }
  166. , { field: 'RefundDate', width: 200, title: '退款时间', sort: true }
  167. , { title: '操作', align: 'center', width: 300, fixed: 'right', toolbar: '#table-list-tools' }
  168. ]]
  169. , where: {
  170. }
  171. , page: true
  172. , limit: 30
  173. , height: 'full-220'
  174. , text: '对不起,加载出现异常!'
  175. , done: function (res, curr, count) {
  176. $("#SuccessAmount").text(res.other.SuccessAmount);
  177. $("#FailAmount").text(res.other.FailAmount);
  178. $(".layui-none").text("无数据");
  179. }
  180. });
  181. //监听工具条
  182. table.on('tool(LAY-list-manage)', function (obj) {
  183. var data = obj.data;
  184. if (obj.event === 'del') {
  185. var index = layer.confirm('确定要删除吗?删除后不能恢复!', function (index) {
  186. $.ajax({
  187. type: "POST",
  188. url: "/Admin/Orders/Delete?r=" + Math.random(1),
  189. data: "Id=" + data.Id,
  190. dataType: "text",
  191. success: function (data) {
  192. if (data == "success") {
  193. obj.del();
  194. layer.close(index);
  195. } else {
  196. parent.layer.msg(data);
  197. }
  198. }
  199. });
  200. });
  201. } else if (obj.event === 'edit') {
  202. var tr = $(obj.tr);
  203. var perContent = layer.open({
  204. type: 2
  205. , title: '创客订单-编辑'
  206. , content: 'Edit?Id=' + data.Id + ''
  207. , maxmin: true
  208. , area: ['500px', '450px']
  209. , btn: ['确定', '取消']
  210. , yes: function (index, layero) {
  211. var iframeWindow = window['layui-layer-iframe' + index]
  212. , submitID = 'LAY-list-front-submit'
  213. , submit = layero.find('iframe').contents().find('#' + submitID);
  214. setTimeout(function () {
  215. layero.find('iframe').contents().find('.layui-tab-item').each(function (i) {
  216. var errObj = $(this).find('.layui-form-danger');
  217. if (errObj.length > 0) {
  218. iframeWindow.element.tabChange('mytabbar', String(i + 1));
  219. submit.click();
  220. }
  221. });
  222. }, 300);
  223. //监听提交
  224. iframeWindow.layui.form.on('submit(' + submitID + ')', function (data) {
  225. var field = data.field; //获取提交的字段
  226. var userdata = "";
  227. for (var prop in field) {
  228. userdata += prop + "=" + encodeURIComponent(field[prop]) + "&";
  229. }
  230. //提交 Ajax 成功后,静态更新表格中的数据
  231. //$.ajax({});
  232. $.ajax({
  233. type: "POST",
  234. url: "/Admin/Orders/Edit?r=" + Math.random(1),
  235. data: userdata,
  236. dataType: "text",
  237. success: function (data) {
  238. layer.close(index); //关闭弹层
  239. if (data == "success") {
  240. table.reload('LAY-list-manage'); //数据刷新
  241. } else {
  242. layer.msg(data);
  243. }
  244. }
  245. });
  246. });
  247. submit.trigger('click');
  248. }
  249. , success: function (layero, index) {
  250. }
  251. });
  252. layer.full(perContent);
  253. } else if (obj.event === 'detail') {
  254. var tr = $(obj.tr);
  255. var perContent = layer.open({
  256. type: 2
  257. , title: '订单详情'
  258. , content: 'Detail?Id=' + data.Id + ''
  259. , maxmin: true
  260. , area: ['700px', '650px']
  261. , btn: ['关闭']
  262. , yes: function (index, layero) {
  263. layer.close(index);
  264. }
  265. , success: function (layero, index) {
  266. }
  267. });
  268. layer.full(perContent);
  269. } else if (obj.event === 'send') {
  270. var tr = $(obj.tr);
  271. var perContent = layer.open({
  272. type: 2
  273. , title: '创客订单-发货'
  274. , content: 'Send?Id=' + data.Id + ''
  275. , maxmin: true
  276. , area: ['500px', '650px']
  277. , btn: ['确认发货', '取消']
  278. , yes: function (index, layero) {
  279. var iframeWindow = window['layui-layer-iframe' + index]
  280. , submitID = 'LAY-list-front-submit'
  281. , submit = layero.find('iframe').contents().find('#' + submitID);
  282. setTimeout(function () {
  283. layero.find('iframe').contents().find('.layui-tab-item').each(function (i) {
  284. var errObj = $(this).find('.layui-form-danger');
  285. if (errObj.length > 0) {
  286. iframeWindow.element.tabChange('mytabbar', String(i + 1));
  287. submit.click();
  288. }
  289. });
  290. }, 300);
  291. //监听提交
  292. iframeWindow.layui.form.on('submit(' + submitID + ')', function (data) {
  293. var field = data.field; //获取提交的字段
  294. var userdata = "";
  295. for (var prop in field) {
  296. userdata += prop + "=" + encodeURIComponent(field[prop]) + "&";
  297. }
  298. //提交 Ajax 成功后,静态更新表格中的数据
  299. //$.ajax({});
  300. var IdList = '';
  301. layero.find('iframe').contents().find('input[type=hidden][name=IdList]').each(function (i) {
  302. IdList += $(this).val() + "#";
  303. });
  304. userdata += "&IdList=" + IdList;
  305. var StoreIdList = '';
  306. layero.find('iframe').contents().find('select[name=StoreIdList]').each(function (i) {
  307. StoreIdList += $(this).val() + "#";
  308. });
  309. userdata += "&StoreIdList=" + StoreIdList;
  310. var SnNosList = '';
  311. layero.find('iframe').contents().find('textarea[name=SnNosList]').each(function (i) {
  312. SnNosList += $(this).val() + "#";
  313. });
  314. userdata += "&SnNosList=" + SnNosList;
  315. $.ajax({
  316. type: "POST",
  317. url: "/Admin/Orders/Send?r=" + Math.random(1),
  318. data: userdata,
  319. dataType: "text",
  320. success: function (data) {
  321. if (data == "success") {
  322. layer.close(index); //关闭弹层
  323. layer.msg('提交成功', { time: 1500 }, function () {
  324. table.reload('LAY-list-manage'); //数据刷新
  325. });
  326. } else {
  327. layer.msg(data);
  328. }
  329. }
  330. });
  331. });
  332. submit.trigger('click');
  333. }
  334. , success: function (layero, index) {
  335. }
  336. });
  337. } else if (obj.event === 'return') {
  338. var tr = $(obj.tr);
  339. var perContent = layer.open({
  340. type: 2
  341. , title: '退款'
  342. , content: 'Return?Id=' + data.Id + ''
  343. , maxmin: true
  344. , area: ['500px', '450px']
  345. , btn: ['确认退款', '取消']
  346. , yes: function (index, layero) {
  347. var iframeWindow = window['layui-layer-iframe' + index]
  348. , submitID = 'LAY-list-front-submit'
  349. , submit = layero.find('iframe').contents().find('#' + submitID);
  350. setTimeout(function () {
  351. layero.find('iframe').contents().find('.layui-tab-item').each(function (i) {
  352. var errObj = $(this).find('.layui-form-danger');
  353. if (errObj.length > 0) {
  354. iframeWindow.element.tabChange('mytabbar', String(i + 1));
  355. submit.click();
  356. }
  357. });
  358. }, 300);
  359. //监听提交
  360. iframeWindow.layui.form.on('submit(' + submitID + ')', function (data) {
  361. var field = data.field; //获取提交的字段
  362. var userdata = "";
  363. for (var prop in field) {
  364. userdata += prop + "=" + encodeURIComponent(field[prop]) + "&";
  365. }
  366. //提交 Ajax 成功后,静态更新表格中的数据
  367. //$.ajax({});
  368. $.ajax({
  369. type: "POST",
  370. url: "/Admin/Orders/Return?r=" + Math.random(1),
  371. data: userdata,
  372. dataType: "text",
  373. success: function (data) {
  374. if (data == "success") {
  375. layer.close(index); //关闭弹层
  376. layer.msg('提交成功', { time: 1500 }, function () {
  377. table.reload('LAY-list-manage'); //数据刷新
  378. });
  379. } else {
  380. layer.msg(data);
  381. }
  382. }
  383. });
  384. });
  385. submit.trigger('click');
  386. }
  387. , success: function (layero, index) {
  388. }
  389. });
  390. } else if (obj.event === 'prize100') {
  391. var loadindex = layer.load(1, {
  392. shade: [0.5, '#000']
  393. });
  394. $.ajax({
  395. url: "/Admin/Orders/Prize100?r=" + Math.random(1),
  396. data: "Id=" + data.Id,
  397. dataType: "json",
  398. success: function (data) {
  399. layer.close(loadindex);
  400. if (data.code == '1') {
  401. layer.alert(data.result.replace(/\n/g, '<br />'), { area: ['680px', '460px'] });
  402. } else {
  403. var index = layer.confirm(data.result.replace(/\n/g, '<br />') + '<br />是否立即补发?', { area: ['500px', '460px'] }, function (index) {
  404. $.ajax({
  405. type: "POST",
  406. url: "/Admin/Orders/AddPrize100?r=" + Math.random(1),
  407. data: "Id=" + data.Id,
  408. dataType: "text",
  409. success: function (data) {
  410. if (data == "success") {
  411. layer.close(index);
  412. layer.msg("补发成功");
  413. } else {
  414. layer.msg(data);
  415. }
  416. }
  417. });
  418. });
  419. }
  420. }
  421. });
  422. }
  423. });
  424. //监听搜索
  425. form.on('submit(LAY-list-front-search)', function (data) {
  426. var field = data.field;
  427. //执行重载
  428. table.reload('LAY-list-manage', {
  429. where: field,
  430. page: {
  431. curr: 1
  432. }
  433. });
  434. });
  435. form.on('submit(LAY-list-front-searchall)', function (data) {
  436. table.reload('LAY-list-manage', {
  437. where: null,
  438. page: {
  439. curr: 1
  440. }
  441. });
  442. });
  443. //事件
  444. var active = {
  445. batchdel: function () {
  446. var checkStatus = table.checkStatus('LAY-list-manage')
  447. , data = checkStatus.data; //得到选中的数据
  448. if (data.length < 1) {
  449. parent.layer.msg("请选择要删除的项");
  450. } else {
  451. var ids = "";
  452. $.each(data, function (index, value) {
  453. ids += data[index].Id + ",";
  454. });
  455. ids = ids.substring(0, ids.length - 1);
  456. var index = layer.confirm('确定要删除吗?删除后不能恢复!', function (index) {
  457. $.ajax({
  458. type: "POST",
  459. url: "/Admin/Orders/Delete?r=" + Math.random(1),
  460. data: "Id=" + ids,
  461. dataType: "text",
  462. success: function (data) {
  463. layer.close(index);
  464. if (data == "success") {
  465. table.reload('LAY-list-manage');
  466. } else {
  467. layer.msg(data);
  468. }
  469. }
  470. });
  471. });
  472. }
  473. }
  474. , add: function () {
  475. var perContent = layer.open({
  476. type: 2
  477. , title: '创客订单-添加'
  478. , content: 'Add'
  479. , maxmin: true
  480. , area: ['500px', '450px']
  481. , btn: ['确定', '取消']
  482. , yes: function (index, layero) {
  483. var iframeWindow = window['layui-layer-iframe' + index]
  484. , submitID = 'LAY-list-front-submit'
  485. , submit = layero.find('iframe').contents().find('#' + submitID);
  486. setTimeout(function () {
  487. layero.find('iframe').contents().find('.layui-tab-item').each(function (i) {
  488. var errObj = $(this).find('.layui-form-danger');
  489. if (errObj.length > 0) {
  490. iframeWindow.element.tabChange('mytabbar', String(i + 1));
  491. submit.click();
  492. }
  493. });
  494. }, 300);
  495. //监听提交
  496. iframeWindow.layui.form.on('submit(' + submitID + ')', function (data) {
  497. var field = data.field; //获取提交的字段
  498. var userdata = "";
  499. for (var prop in field) {
  500. userdata += prop + "=" + encodeURIComponent(field[prop]) + "&";
  501. }
  502. //提交 Ajax 成功后,静态更新表格中的数据
  503. //$.ajax({});
  504. $.ajax({
  505. type: "POST",
  506. url: "/Admin/Orders/Add?r=" + Math.random(1),
  507. data: userdata,
  508. dataType: "text",
  509. success: function (data) {
  510. layer.close(index); //关闭弹层
  511. if (data == "success") {
  512. table.reload('LAY-list-manage'); //数据刷新
  513. } else {
  514. layer.msg(data);
  515. }
  516. }
  517. });
  518. });
  519. submit.trigger('click');
  520. }
  521. });
  522. layer.full(perContent);
  523. }
  524. , ImportData: function () {
  525. ExcelKind = 1;
  526. layer.open({
  527. type: 1,
  528. title: '导入',
  529. maxmin: false,
  530. area: ['460px', '280px'],
  531. content: $('#excelForm'),
  532. cancel: function () {
  533. }
  534. });
  535. $("#excelTemp").html('<a href="/excelfile/模板文件.xlsx">点击下载模板文件</a>');
  536. }, ExportsExcel: function () {
  537. var userdata = '';
  538. $(".layuiadmin-card-header-auto input").each(function (i) {
  539. console.log($(this).attr('name'));
  540. console.log($(this).val());
  541. userdata += $(this).attr('name') + '=' + encodeURIComponent($(this).val()) + '&';
  542. });
  543. $(".layuiadmin-card-header-auto select").each(function (i) {
  544. userdata += $(this).attr('name') + '=' + encodeURIComponent($(this).val()) + '&';
  545. });
  546. $.ajax({
  547. type: "GET",
  548. url: "/Admin/Orders/ExportsExcel?r=" + Math.random(1),
  549. data: userdata,
  550. dataType: "json",
  551. success: function (data) {
  552. data.Obj.unshift(data.Fields);
  553. excel.exportExcel(data.Obj, data.Info, 'xlsx');
  554. }
  555. });
  556. }
  557. , ExportExcel: function () {
  558. var userdata = '';
  559. $(".layuiadmin-card-header-auto input").each(function (i) {
  560. userdata += $(this).attr('name') + '=' + encodeURIComponent($(this).val()) + '&';
  561. });
  562. $(".layuiadmin-card-header-auto select").each(function (i) {
  563. userdata += $(this).attr('name') + '=' + encodeURIComponent($(this).val()) + '&';
  564. });
  565. var index = layer.load(1, {
  566. shade: [0.8, '#000'],
  567. content: '',
  568. success: function (layero) {
  569. var obj = layero.find('.layui-layer-content').css({
  570. 'padding-top': '10px',
  571. 'width': '200px',
  572. 'color': '#fff',
  573. 'text-align': 'center'
  574. });
  575. var st = setInterval(function () {
  576. $.ajax({
  577. type: "GET",
  578. url: "/Admin/Orders/CheckExport?r=" + Math.random(1),
  579. dataType: "text",
  580. success: function (data) {
  581. if (data == "finish") {
  582. clearInterval(st);
  583. } else {
  584. obj.text(data);
  585. }
  586. }
  587. });
  588. }, 1000);
  589. }
  590. });
  591. $.ajax({
  592. type: "GET",
  593. url: "/Admin/Orders/ExportExcel?r=" + Math.random(1),
  594. data: userdata,
  595. dataType: "text",
  596. success: function (data) {
  597. layer.close(index);
  598. if (data.indexOf("success|") > -1) {
  599. var datalist = data.split('|');
  600. window.location.href = datalist[1];
  601. } else {
  602. layer.msg('导出失败');
  603. }
  604. // data.Obj.unshift(data.Fields);
  605. // excel.exportExcel(data.Obj, data.Info, 'xlsx');
  606. }
  607. });
  608. }
  609. , Open: function () {
  610. var checkStatus = table.checkStatus('LAY-list-manage')
  611. , data = checkStatus.data; //得到选中的数据
  612. if (data.length < 1) {
  613. parent.layer.msg("请选择要开启的项");
  614. } else {
  615. var ids = "";
  616. $.each(data, function (index, value) {
  617. ids += data[index].Id + ",";
  618. });
  619. ids = ids.substring(0, ids.length - 1);
  620. var index = layer.confirm('确定要开启吗?', function (index) {
  621. $.ajax({
  622. type: "POST",
  623. url: "/Admin/Orders/Open?r=" + Math.random(1),
  624. data: "Id=" + ids,
  625. dataType: "text",
  626. success: function (data) {
  627. layer.close(index);
  628. if (data == "success") {
  629. table.reload('LAY-list-manage');
  630. } else {
  631. layer.msg(data);
  632. }
  633. }
  634. });
  635. });
  636. }
  637. }
  638. , Close: function () {
  639. var checkStatus = table.checkStatus('LAY-list-manage')
  640. , data = checkStatus.data; //得到选中的数据
  641. if (data.length < 1) {
  642. parent.layer.msg("请选择要关闭的项");
  643. } else {
  644. var ids = "";
  645. $.each(data, function (index, value) {
  646. ids += data[index].Id + ",";
  647. });
  648. ids = ids.substring(0, ids.length - 1);
  649. var index = layer.confirm('确定要关闭吗?', function (index) {
  650. $.ajax({
  651. type: "POST",
  652. url: "/Admin/Orders/Close?r=" + Math.random(1),
  653. data: "Id=" + ids,
  654. dataType: "text",
  655. success: function (data) {
  656. layer.close(index);
  657. if (data == "success") {
  658. table.reload('LAY-list-manage');
  659. } else {
  660. layer.msg(data);
  661. }
  662. }
  663. });
  664. });
  665. }
  666. }
  667. };
  668. $('.layui-btn').on('click', function () {
  669. var type = $(this).data('type');
  670. active[type] ? active[type].call(this) : '';
  671. });
  672. });