index.js 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125
  1. // pages/payment/index.js
  2. const app = getApp();
  3. Page({
  4. /**
  5. * 页面的初始数据
  6. */
  7. data: {
  8. frameStyle: { useTop: true, name: '订单信息', leftArrow: true, useBar: false },
  9. // 主体高度
  10. infoHeight: '',
  11. // 采购申请审核
  12. list: [],
  13. },
  14. back: function () {
  15. wx.navigateBack({ url: '/pages/home/index' })
  16. },
  17. // 详细信息
  18. toView: function (e) {
  19. let item = e.currentTarget.dataset.item;
  20. this.setData({ info: item })
  21. this.setData({ dialog: { title: '详细信息', show: true, type: '1' } })
  22. },
  23. // 财务确认订单
  24. toSign: function (e) {
  25. wx.showModal({
  26. title: '订单确认',
  27. content: '您是否确认订单?',
  28. confirmText: '同意',
  29. success: (res) => {
  30. if (res.confirm) wx.showToast({ title: `已成功同意订单`, icon: 'success', duration: 2000 })
  31. else if (res.cancel) { }
  32. }
  33. })
  34. },
  35. /**
  36. * 生命周期函数--监听页面加载
  37. */
  38. onLoad: function (options) {
  39. this.watchLogin();
  40. // 计算高度
  41. this.searchHeight();
  42. },
  43. // 监听用户是否登录
  44. watchLogin: function () {
  45. let data = [
  46. { order_num: 'Ygj4757945hdFueu', receive_user_name: '胡英俊', mech_name: '翻斗幼儿园-小豆班', status_name: '待财务确认', status: '3', user_name: '采购人员', user_phone: '12345678901', money: '3344', receive_user_phone: '98765432109', receive_address: '翻斗大街翻斗花园2号楼1001室', },
  47. { order_num: 'Hgj4757945hdFueu', receive_user_name: '胡图图', mech_name: '翻斗幼儿园-小豆班', status_name: '待财务确认', status: '3', user_name: '采购人员', user_phone: '12345678901', money: '3344', receive_user_phone: '98765432109', receive_address: '翻斗大街翻斗花园2号楼1001室', order: [{ name: '小洋人', num: '123', money: '3000' }, { name: '娃哈哈', num: '123', money: '344' }] },
  48. ]
  49. this.setData({ list: data })
  50. // wx.getStorage({
  51. // key: 'user',
  52. // success: res => {
  53. // if (res.data) {
  54. // // 查询菜单
  55. // if (res.data) this.searchRouter(res.data);
  56. // res.data.type = type.find((i) => i.value == res.data.type).label;
  57. // if (res.data) this.setData({ userInfo: res.data });
  58. // if (res.data && res.data.avatarUrl) this.setData({ avatarUrl: res.data.avatarUrl });
  59. // } else {
  60. // wx.redirectTo({ url: '/pages/login/index', })
  61. // }
  62. // }
  63. // })
  64. },
  65. // 计算高度
  66. searchHeight: function () {
  67. let frameStyle = this.data.frameStyle;
  68. let client = app.globalData.client;
  69. // 减去状态栏
  70. let infoHeight = client.windowHeight - (client.statusBarHeight + client.getMenu.height + (client.getMenu.top - client.statusBarHeight) * 2);
  71. // 是否减去底部菜单
  72. if (frameStyle.useBar) infoHeight = infoHeight - 50;
  73. if (infoHeight) this.setData({ infoHeight: infoHeight })
  74. },
  75. /**
  76. * 生命周期函数--监听页面初次渲染完成
  77. */
  78. onReady: function () {
  79. },
  80. /**
  81. * 生命周期函数--监听页面显示
  82. */
  83. onShow: function () {
  84. },
  85. /**
  86. * 生命周期函数--监听页面隐藏
  87. */
  88. onHide: function () {
  89. },
  90. /**
  91. * 生命周期函数--监听页面卸载
  92. */
  93. onUnload: function () {
  94. },
  95. /**
  96. * 页面相关事件处理函数--监听用户下拉动作
  97. */
  98. onPullDownRefresh: function () {
  99. },
  100. /**
  101. * 页面上拉触底事件的处理函数
  102. */
  103. onReachBottom: function () {
  104. },
  105. /**
  106. * 用户点击右上角分享
  107. */
  108. onShareAppMessage: function () {
  109. }
  110. })