index.js 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149
  1. // pages/market_buy/index.js
  2. const { buy_status } = require('../../utils/dict');
  3. const app = getApp();
  4. Page({
  5. /**
  6. * 页面的初始数据
  7. */
  8. data: {
  9. frameStyle: { useTop: true, name: '采买需求信息', leftArrow: true, useBar: false },
  10. // 主体高度
  11. infoHeight: '',
  12. // 采买列表
  13. list: [{ order_num: 'Hgj4757945hdFueu', receive_user_name: '胡图图', mech_name: '翻斗幼儿园-小豆班', status_name: '待供货单位确认', status: '1', 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' }] }],
  14. // 弹框
  15. dialog: { title: '详细信息', show: false, type: '1' },
  16. // 详细信息
  17. info: {},
  18. // 导出条件
  19. exportForm: {},
  20. // 商品状态
  21. statusList: buy_status
  22. },
  23. back: function () {
  24. wx.navigateBack({ url: '/pages/home/index' })
  25. },
  26. // 导出条件
  27. export_term: function () {
  28. this.setData({ dialog: { title: '导出条件', show: true, type: '2' }, })
  29. },
  30. // 选择状态
  31. statusChange: function (e) {
  32. let { value } = e.detail;
  33. if (value) {
  34. let data = this.data.statusList[value];
  35. this.setData({ 'exportForm.status': data.value })
  36. }
  37. },
  38. // 开始时间
  39. startChange: function (e) {
  40. let { value } = e.detail;
  41. this.setData({ 'exportForm.apply_date@start': value })
  42. },
  43. // 结束时间
  44. endChange: function (e) {
  45. let { value } = e.detail;
  46. this.setData({ 'exportForm.apply_date@end': value })
  47. },
  48. // 重置条件
  49. expertReset: function (e) {
  50. this.setData({ exportForm: { user_name: '', mech_name: '', receive_user_name: '', status: null } })
  51. },
  52. // 确认导出
  53. exportSubmit: function (e) {
  54. console.log(e.detail.value);
  55. console.log('打开文档成功')
  56. },
  57. // 添加采购申请
  58. toAdd: function () {
  59. wx.navigateTo({ url: `/pages/market_buy/detail` })
  60. },
  61. // 详细信息
  62. toView: function (e) {
  63. let item = e.currentTarget.dataset.item;
  64. this.setData({ info: item })
  65. this.setData({ dialog: { title: '详细信息', show: true, type: '1' } })
  66. },
  67. // 订单签收
  68. toSign: function (e) {
  69. wx.showModal({
  70. title: '是否确认签收订单',
  71. success(res) {
  72. if (res.confirm) {
  73. wx.showToast({ title: `订单签收完成`, icon: 'success', duration: 2000 })
  74. } else if (res.cancel) {
  75. }
  76. }
  77. })
  78. },
  79. /**
  80. * 生命周期函数--监听页面加载
  81. */
  82. onLoad: function (options) {
  83. // 计算高度
  84. this.searchHeight();
  85. },
  86. search: function (data) {
  87. },
  88. // 计算高度
  89. searchHeight: function () {
  90. let frameStyle = this.data.frameStyle;
  91. let client = app.globalData.client;
  92. // 减去状态栏
  93. let infoHeight = client.windowHeight - (client.statusBarHeight + client.getMenu.height + (client.getMenu.top - client.statusBarHeight) * 2);
  94. // 是否减去底部菜单
  95. if (frameStyle.useBar) infoHeight = infoHeight - 50;
  96. if (infoHeight) this.setData({ infoHeight: infoHeight })
  97. },
  98. /**
  99. * 生命周期函数--监听页面初次渲染完成
  100. */
  101. onReady: function () {
  102. },
  103. /**
  104. * 生命周期函数--监听页面显示
  105. */
  106. onShow: function () {
  107. this.search();
  108. },
  109. /**
  110. * 生命周期函数--监听页面隐藏
  111. */
  112. onHide: function () {
  113. },
  114. /**
  115. * 生命周期函数--监听页面卸载
  116. */
  117. onUnload: function () {
  118. },
  119. /**
  120. * 页面相关事件处理函数--监听用户下拉动作
  121. */
  122. onPullDownRefresh: function () {
  123. },
  124. /**
  125. * 页面上拉触底事件的处理函数
  126. */
  127. onReachBottom: function () {
  128. },
  129. /**
  130. * 用户点击右上角分享
  131. */
  132. onShareAppMessage: function () {
  133. }
  134. })