order-detail-clerk.js 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  1. Page({
  2. data: {
  3. order: null,
  4. code_id: null,
  5. getGoodsTotalPrice: function() {
  6. return this.data.order.total_price
  7. }
  8. },
  9. onLoad: function(e) {
  10. getApp().page.onLoad(this, e);
  11. var t = this,
  12. code_id = e.code_id,
  13. o = "";
  14. if ("undefined" == typeof my) o = e.scene;
  15. else if (null !== getApp().query) {
  16. var r = getApp().query;
  17. getApp().query = null,
  18. o = r.order_no
  19. }
  20. t.setData({
  21. store: getApp().core.getStorageSync(getApp().const.STORE),
  22. user_info: getApp().getUser(),
  23. code_id: e.code_id
  24. }),
  25. getApp().core.showLoading({
  26. title: "正在加载"
  27. }),
  28. getApp().request({
  29. url: getApp().api.order.clerk_goods_detail,
  30. data: {
  31. code_id: o
  32. },
  33. success: function(e) {
  34. 0 == e.code ? t.setData({
  35. order: e.data
  36. }) : getApp().core.showModal({
  37. title: "警告!",
  38. showCancel: !1,
  39. content: e.msg,
  40. confirmText: "确认",
  41. success: function(e) {
  42. e.confirm && getApp().core.redirectTo({
  43. url: "/pages/index/index"
  44. })
  45. }
  46. })
  47. },
  48. complete: function() {
  49. getApp().core.hideLoading()
  50. }
  51. })
  52. },
  53. clerk: function(e) {
  54. var t = this;
  55. getApp().core.showModal({
  56. title: "提示",
  57. content: "是否确认核销?",
  58. success: function(e) {
  59. e.confirm && (getApp().core.showLoading({
  60. title: "正在加载"
  61. }), getApp().request({
  62. url: getApp().api.order.clerk_goods,
  63. data: {
  64. code_id: t.data.order.code_id
  65. },
  66. success: function(e) {
  67. 0 == e.code ? getApp().core.redirectTo({
  68. url: "/pages/user/user"
  69. }) : getApp().core.showModal({
  70. title: "警告!",
  71. showCancel: !1,
  72. content: e.msg,
  73. confirmText: "确认",
  74. success: function(e) {
  75. e.confirm && getApp().core.redirectTo({
  76. url: "/pages/index/index"
  77. })
  78. }
  79. })
  80. },
  81. complete: function() {
  82. getApp().core.hideLoading()
  83. }
  84. }))
  85. }
  86. })
  87. }
  88. });