everyday-card-clerk.js 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122
  1. var utils = require("../../utils/helper.js");
  2. Page({
  3. data: {
  4. hide: 1,
  5. qrcode: ""
  6. },
  7. onLoad: function(e) {
  8. getApp().page.onLoad(this, e), this.getOrderDetails(e)
  9. },
  10. onReady: function(e) {
  11. getApp().page.onReady(this)
  12. },
  13. onShow: function(e) {
  14. getApp().page.onShow(this)
  15. },
  16. onHide: function(e) {
  17. getApp().page.onHide(this)
  18. },
  19. onUnload: function(e) {
  20. getApp().page.onUnload(this)
  21. },
  22. onPullDownRefresh: function(e) {
  23. getApp().page.onPullDownRefresh(this)
  24. },
  25. onReachBottom: function(e) {
  26. getApp().page.onReachBottom(this)
  27. },
  28. getOrderDetails: function(e) {
  29. var o = "";
  30. if ("undefined" == typeof my) o = e.scene;
  31. else if (null !== getApp().query) {
  32. var t = getApp().query;
  33. getApp().query = null, o = t.order_id
  34. }
  35. var n = this;
  36. wx.showModal({
  37. title: '提示',
  38. content: '确定核销?',
  39. success:function(res){
  40. if(res.confirm){
  41. getApp().core.showLoading({
  42. title: "正在加载",
  43. mask: !0
  44. }), getApp().request({
  45. url: getApp().api.everyday_coupon.pickcoupon,
  46. method: "get",
  47. data: {
  48. id: o
  49. },
  50. success: function (e) {
  51. getApp().core.redirectTo({
  52. url: "/pages/user/user"
  53. })
  54. // 0 == e.code ? n.setData({
  55. // goods: e.data
  56. // }) : getApp().core.showModal({
  57. // title: "提示",
  58. // content: e.msg,
  59. // showCancel: !1,
  60. // success: function(e) {
  61. // e.confirm && getApp().core.redirectTo({
  62. // url: "/pages/user/user"
  63. // })
  64. // }
  65. // })
  66. },
  67. complete: function (e) {
  68. setTimeout(function () {
  69. getApp().core.hideLoading()
  70. }, 1e3)
  71. }
  72. })
  73. }else{
  74. wx.redirectTo({
  75. url: '/pages/index/index',
  76. })
  77. }
  78. }
  79. })
  80. },
  81. goToGoodsDetails: function(e) {
  82. getApp().core.redirectTo({
  83. url: "/pages/book/details/details?id=" + this.data.goods.goods_id
  84. })
  85. },
  86. nowWriteOff: function(e) {
  87. var o = this;
  88. getApp().core.showModal({
  89. title: "提示",
  90. content: "是否确认核销?",
  91. success: function(e) {
  92. e.confirm ? (getApp().core.showLoading({
  93. title: "正在加载"
  94. }), getApp().request({
  95. url: getApp().api.book.clerk,
  96. data: {
  97. order_id: o.data.goods.id
  98. },
  99. success: function(e) {
  100. 0 == e.code ? getApp().core.redirectTo({
  101. url: "/pages/user/user"
  102. }) : getApp().core.showModal({
  103. title: "警告!",
  104. showCancel: !1,
  105. content: e.msg,
  106. confirmText: "确认",
  107. success: function(e) {
  108. e.confirm && getApp().core.redirectTo({
  109. url: "/pages/index/index"
  110. })
  111. }
  112. })
  113. },
  114. complete: function() {
  115. getApp().core.hideLoading()
  116. }
  117. })) : e.cancel
  118. }
  119. })
  120. }
  121. });