index.js 2.2 KB

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