order.js 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687
  1. define(['jquery', 'bootstrap', 'frontend', 'form'], function ($, undefined, Frontend, Form) {
  2. $(document).on("click", ".btn-received", function () {
  3. var that = this;
  4. Layer.confirm("请确认收到货以后再点击确认收货?", {icon: 3}, function (index, layero) {
  5. Fast.api.ajax({
  6. url: "shop.order/takedelivery",
  7. data: {orderid: $(that).data("orderid")}
  8. }, function (data, ret) {
  9. Layer.close(index);
  10. setTimeout(function () {
  11. location.reload();
  12. }, 1500);
  13. });
  14. })
  15. });
  16. $(document).on("click", ".btn-cancel", function () {
  17. var that = this;
  18. Layer.confirm("是否取消订单?", {icon: 3}, function (index, layero) {
  19. Fast.api.ajax({
  20. url: "shop.order/cancel",
  21. data: {orderid: $(that).data("orderid")}
  22. }, function (data, ret) {
  23. Layer.close(index);
  24. setTimeout(function () {
  25. location.reload();
  26. }, 1500);
  27. });
  28. })
  29. });
  30. $(document).on("click", ".btn-refund", function () {
  31. var that = this;
  32. Layer.confirm("确认申请退款?", {icon: 3}, function (index, layero) {
  33. Fast.api.ajax({
  34. url: "shop.order/apply",
  35. data: {id: $(that).data("id"), type: 1}
  36. }, function (data, ret) {
  37. Layer.close(index);
  38. setTimeout(function () {
  39. location.reload();
  40. }, 1500);
  41. });
  42. })
  43. });
  44. $(document).on("click", ".btn-saveexpress", function () {
  45. if ($("#expressno").val() == '' || $("#expressname").val() == '') {
  46. Layer.msg("请填写快递名称和快递单号");
  47. return false;
  48. }
  49. var that = this;
  50. Layer.confirm("确认物品已经寄回且正确填写快递信息?", {icon: 3}, function (index, layero) {
  51. Fast.api.ajax({
  52. url: "shop.order/saveexpress",
  53. data: {id: $(that).data("id"), expressno: $("#expressno").val(), expressname: $("#expressname").val()}
  54. }, function (data, ret) {
  55. Layer.close(index);
  56. setTimeout(function () {
  57. location.reload();
  58. }, 1500);
  59. });
  60. })
  61. });
  62. var Controller = {
  63. index: function () {
  64. },
  65. apply: function () {
  66. Form.api.bindevent($("#applyform"), function (data, ret) {
  67. setTimeout(function () {
  68. location.href = ret.url;
  69. }, 1500);
  70. });
  71. },
  72. logistics: function () {
  73. if ($(".timeline").length > 0) {
  74. Fast.api.ajax({
  75. url: '',
  76. }, function (data, ret) {
  77. var html = Template("timelinetpl", data);
  78. $(".timeline").removeClass("loading").html(html);
  79. return false;
  80. });
  81. }
  82. }
  83. };
  84. return Controller;
  85. });