order-detail.js 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138
  1. var app = getApp(),
  2. api = getApp().api;
  3. Page({
  4. data: {
  5. isPageShow: !1,
  6. order: null,
  7. getGoodsTotalPrice: function () {
  8. return this.data.order.total_price
  9. },
  10. hide: 1,
  11. qrcode: ""
  12. },
  13. onLoad: function (e) {
  14. getApp().page.onLoad(this, e);
  15. var t = this;
  16. getApp().core.showLoading({
  17. title: "正在加载"
  18. });
  19. var o = getCurrentPages(),
  20. a = o[o.length - 2];
  21. getApp().request({
  22. url: getApp().api.order.detail,
  23. data: {
  24. order_id: e.id,
  25. route: a.route
  26. },
  27. success: function (e) {
  28. 0 == e.code && t.setData({
  29. order: e.data,
  30. isPageShow: !0
  31. })
  32. },
  33. complete: function () {
  34. getApp().core.hideLoading()
  35. }
  36. })
  37. },
  38. orderQrcode: function (t) {
  39. var e = this,
  40. a = e.data.order.goods_list,
  41. b = t.target.dataset.goodlistId,
  42. o = t.target.dataset.index;
  43. getApp().core.showLoading({
  44. title: "正在加载",
  45. mask: !0
  46. }),
  47. // e.data.goods_list[o].offline_qrcode ? (e.setData({
  48. // hide: 0,
  49. // qrcode: e.data.goods_list[o].offline_qrcode
  50. // }),
  51. // getApp().core.hideLoading()) :
  52. getApp().request({
  53. url: getApp().api.order.get_goods_qrcode,
  54. data: {
  55. code_id: a[b].virtual_data[o].code_id
  56. },
  57. success: function (t) {
  58. 0 == t.code ? e.setData({
  59. hide: 0,
  60. qrcode: t.data.url
  61. }) : getApp().core.showModal({
  62. title: "提示",
  63. content: t.msg
  64. })
  65. // wx.navigateTo({
  66. // url:"/pages/order-detail-clerk/order-detail-clerk?code_id=" + a[b].virtual_data[o].code_id
  67. // })
  68. },
  69. complete: function () {
  70. getApp().core.hideLoading()
  71. }
  72. })
  73. },
  74. hide: function (t) {
  75. this.setData({
  76. hide: 1
  77. })
  78. },
  79. copyText: function (e) {
  80. var t = e.currentTarget.dataset.text;
  81. getApp().core.setClipboardData({
  82. data: t,
  83. success: function () {
  84. getApp().core.showToast({
  85. title: "已复制"
  86. })
  87. }
  88. })
  89. },
  90. viewImg: function(e){
  91. var url = e.currentTarget.dataset.qrurl;
  92. console.log(url)
  93. getApp().core.previewImage({
  94. urls: [url],
  95. })
  96. },
  97. location: function () {
  98. var e = this.data.order.shop;
  99. getApp().core.openLocation({
  100. latitude: parseFloat(e.latitude),
  101. longitude: parseFloat(e.longitude),
  102. address: e.address,
  103. name: e.name
  104. })
  105. },
  106. orderRevoke: function (t) {
  107. var o = this;
  108. getApp().core.showModal({
  109. title: "提示",
  110. content: "是否退款该订单?",
  111. cancelText: "否",
  112. confirmText: "是",
  113. success: function (e) {
  114. if (e.cancel) return !0;
  115. e.confirm && (getApp().core.showLoading({
  116. title: "操作中"
  117. }), getApp().request({
  118. url: getApp().api.order.revoke,
  119. data: {
  120. order_id: t.currentTarget.dataset.id
  121. },
  122. success: function (e) {
  123. getApp().core.hideLoading(), getApp().core.showModal({
  124. title: "提示",
  125. content: e.msg,
  126. showCancel: !1,
  127. success: function (e) {
  128. e.confirm && o.onLoad({
  129. id: o.data.order.order_id
  130. })
  131. }
  132. })
  133. }
  134. }))
  135. }
  136. })
  137. }
  138. });