order.js 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154
  1. Page({
  2. data: {
  3. hide: 1
  4. },
  5. onLoad: function (e) {
  6. getApp().page.onLoad(this, e);
  7. this.loadOrderList(e.status || 0)
  8. },
  9. loadOrderList: function (t) {
  10. var o = this;
  11. null == t && (t = -1), getApp().core.showLoading({
  12. title: "正在加载",
  13. mask: !0
  14. }), getApp().request({
  15. url: getApp().api.integral.list,
  16. data: {
  17. status: t
  18. },
  19. success: function (e) {
  20. 0 == e.code && o.setData({
  21. order_list: e.data.list,
  22. status: t
  23. })
  24. },
  25. complete: function () {
  26. getApp().core.hideLoading()
  27. }
  28. })
  29. },
  30. orderSubmitPay: function (e) {
  31. var t = e.currentTarget.dataset;
  32. getApp().core.showLoading({
  33. title: "提交中",
  34. mask: !0
  35. }), getApp().request({
  36. url: getApp().api.integral.order_submit,
  37. data: {
  38. id: t.id
  39. },
  40. success: function (e) {
  41. 0 == e.code ? (getApp().core.hideLoading(),
  42. getApp().core.requestPayment({
  43. _res: e,
  44. timeStamp: e.data.timeStamp,
  45. nonceStr: e.data.nonceStr,
  46. package: e.data.package,
  47. signType: e.data.signType,
  48. paySign: e.data.paySign,
  49. complete: function (e) {
  50. "requestPayment:fail" != e.errMsg && "requestPayment:fail cancel" != e.errMsg ? "requestPayment:ok" == e.errMsg && getApp().core.redirectTo({
  51. url: "/pages/integral-mall/order/order?status=1"
  52. }) : getApp().core.showModal({
  53. title: "提示",
  54. content: "订单尚未支付",
  55. showCancel: !1,
  56. confirmText: "确认"
  57. })
  58. }
  59. })) : (getApp().core.hideLoading(), getApp().core.showModal({
  60. title: "提示",
  61. content: e.msg,
  62. showCancel: !1,
  63. confirmText: "确认"
  64. }))
  65. }
  66. })
  67. },
  68. orderRevoke: function (t) {
  69. var o = this;
  70. getApp().core.showModal({
  71. title: "提示",
  72. content: "是否取消该订单?",
  73. cancelText: "否",
  74. confirmText: "是",
  75. success: function (e) {
  76. if (e.cancel) return !0;
  77. e.confirm && (getApp().core.showLoading({
  78. title: "操作中"
  79. }), getApp().request({
  80. url: getApp().api.integral.revoke,
  81. data: {
  82. order_id: t.currentTarget.dataset.id
  83. },
  84. success: function (e) {
  85. getApp().core.hideLoading(), getApp().core.showModal({
  86. title: "提示",
  87. content: e.msg,
  88. showCancel: !1,
  89. success: function (e) {
  90. e.confirm && o.loadOrderList(o.data.status)
  91. }
  92. })
  93. }
  94. }))
  95. }
  96. })
  97. },
  98. orderConfirm: function (t) {
  99. var o = this;
  100. getApp().core.showModal({
  101. title: "提示",
  102. content: "是否确认已收到货?",
  103. cancelText: "否",
  104. confirmText: "是",
  105. success: function (e) {
  106. if (e.cancel) return !0;
  107. e.confirm && (getApp().core.showLoading({
  108. title: "操作中"
  109. }), getApp().request({
  110. url: getApp().api.integral.confirm,
  111. data: {
  112. order_id: t.currentTarget.dataset.id
  113. },
  114. success: function (e) {
  115. getApp().core.hideLoading(), getApp().core.showToast({
  116. title: e.msg
  117. }), 0 == e.code && o.loadOrderList(3)
  118. }
  119. }))
  120. }
  121. })
  122. },
  123. orderQrcode: function (e) {
  124. var t = this,
  125. o = t.data.order_list,
  126. a = e.target.dataset.index;
  127. getApp().core.showLoading({
  128. title: "正在加载",
  129. mask: !0
  130. }), getApp().request({
  131. url: getApp().api.integral.get_qrcode,
  132. data: {
  133. order_no: o[a].order_no
  134. },
  135. success: function (e) {
  136. 0 == e.code ? t.setData({
  137. hide: 0,
  138. qrcode: e.data.url
  139. }) : getApp().core.showModal({
  140. title: "提示",
  141. content: e.msg
  142. })
  143. },
  144. complete: function () {
  145. getApp().core.hideLoading()
  146. }
  147. })
  148. },
  149. hide: function (e) {
  150. this.setData({
  151. hide: 1
  152. })
  153. }
  154. });