index.js 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127
  1. import {
  2. getAdminOrderDetail
  3. } from "../../../api/admin";
  4. const app = getApp();
  5. Page({
  6. /**
  7. * 页面的初始数据
  8. */
  9. data: {
  10. parameter: {
  11. 'navbar': '1',
  12. 'return': '1',
  13. 'title': '订单详情',
  14. 'color': false
  15. },
  16. orderInfo: null,
  17. order_id: '',
  18. title: "",
  19. payType: "",
  20. types: "",
  21. change: false,
  22. status: '', //操作中的状态 一键改价
  23. price: '',
  24. refund_price: '',
  25. type: '',
  26. remark: '',
  27. goname: ''
  28. },
  29. /**
  30. * 生命周期函数--监听页面加载
  31. */
  32. onLoad: function (options) {
  33. if (options.order_id) this.setData({
  34. order_id: options.order_id
  35. });
  36. if (options.goname) this.setData({
  37. goname: options.goname
  38. });
  39. },
  40. /**
  41. * 登录授权回调
  42. */
  43. onLoadFun: function () {
  44. this.getOrderInfo();
  45. },
  46. /**
  47. * 回调
  48. */
  49. getIndex: function () {
  50. this.getOrderInfo();
  51. },
  52. /**
  53. * 获取订单详细信息
  54. */
  55. getOrderInfo: function () {
  56. wx.showLoading({
  57. title: "正在加载中"
  58. });
  59. getAdminOrderDetail(this.data.order_id).then(res => {
  60. wx.hideLoading();
  61. this.setData({
  62. orderInfo: res.data,
  63. title: res.data._status._title,
  64. types: res.data._status._type,
  65. payType: res.data._status._payType,
  66. });
  67. }).catch(err => {
  68. wx.hideLoading();
  69. app.Tips({
  70. title: err
  71. });
  72. });
  73. },
  74. /**
  75. * 剪切订单号
  76. */
  77. copyOrderId: function () {
  78. wx.setClipboardData({
  79. data: this.data.orderInfo.order_id
  80. });
  81. },
  82. /**
  83. * 操作 一键改价 修改备注 打开组件
  84. */
  85. modify: function (e) {
  86. let status = e.currentTarget.dataset.status;
  87. this.setData({
  88. change: true,
  89. status: status,
  90. orderInfo: this.data.orderInfo
  91. });
  92. },
  93. /**
  94. * 关闭组件
  95. */
  96. change: function () {
  97. this.setData({
  98. change: false
  99. });
  100. },
  101. /**
  102. * 事件回调
  103. */
  104. onChangeFun: function (e) {
  105. let opt = e.detail;
  106. let action = opt.action || null;
  107. let value = opt.value != undefined ? opt.value : null;
  108. (action && this[action]) && this[action](value);
  109. },
  110. /**
  111. * 生命周期函数--监听页面初次渲染完成
  112. */
  113. onReady: function () {
  114. },
  115. })