info.js 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134
  1. // pages/salesOrderMan/info.js
  2. const app = getApp()
  3. var QRCode = require('../../utils/weapp-qrcode.js');
  4. Page({
  5. /**
  6. * 页面的初始数据
  7. */
  8. data: {
  9. info: {},
  10. orderStatusArray:[], //订单状态
  11. orderTypeArray:[],//订单类型
  12. },
  13. /**
  14. * 生命周期函数--监听页面加载
  15. */
  16. onLoad(options) {
  17. //字典数据
  18. let treeData = app.globalData.treeArr
  19. for (const element of treeData) {
  20. let arrStr;
  21. switch (element.dictValue) {
  22. case 'order_status':
  23. arrStr = "orderStatusArray";
  24. break;
  25. case 'order_type':
  26. arrStr = "orderTypeArray";
  27. break;
  28. }
  29. this.setData({
  30. [arrStr]: element.children
  31. })
  32. }
  33. //获取详情
  34. var pages = getCurrentPages();
  35. var prevPage = pages[pages.length - 2];
  36. let getInfo = prevPage.data.resData[options.index]
  37. this.setData({
  38. info:getInfo
  39. })
  40. if(getInfo.orderStatus == '3'){
  41. this.makeCode(JSON.stringify({
  42. "id": getInfo.id,
  43. "orderName":getInfo.orderName,
  44. "orderNumber":getInfo.orderNumber,
  45. "type":'1'
  46. }))
  47. }
  48. },
  49. // 二维码
  50. makeCode(data) {
  51. var qrcode;
  52. qrcode = new QRCode('canvas', {
  53. text: data,
  54. width: 220,
  55. height: 220,
  56. colorDark: "#000000",
  57. colorLight: "#ffffff",
  58. correctLevel: QRCode.CorrectLevel.H,
  59. });
  60. qrcode.makeCode(data);
  61. },
  62. //查询详情
  63. getInfo: function (id) {
  64. //详情
  65. app.request.GET({
  66. url: app.API.appointDetail,
  67. page: this,
  68. params: {
  69. 'id': id
  70. },
  71. successFun: true
  72. }).then(res => {
  73. let getInfo = res.data.data;
  74. this.setData({
  75. info: getInfo,
  76. accessControlAuth:JSON.parse(getInfo.accessControlAuth)
  77. })
  78. })
  79. },
  80. /**
  81. * 生命周期函数--监听页面初次渲染完成
  82. */
  83. onReady() {
  84. },
  85. /**
  86. * 生命周期函数--监听页面显示
  87. */
  88. onShow() {
  89. },
  90. /**
  91. * 生命周期函数--监听页面隐藏
  92. */
  93. onHide() {
  94. },
  95. /**
  96. * 生命周期函数--监听页面卸载
  97. */
  98. onUnload() {
  99. },
  100. /**
  101. * 页面相关事件处理函数--监听用户下拉动作
  102. */
  103. onPullDownRefresh() {
  104. },
  105. /**
  106. * 页面上拉触底事件的处理函数
  107. */
  108. onReachBottom() {
  109. },
  110. /**
  111. * 用户点击右上角分享
  112. */
  113. onShareAppMessage() {
  114. }
  115. })