index.js 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152
  1. const { apply_status } = require('../../utils/dict');
  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. { id: '001', user_name: '法外狂徒张三', user_phone: '12345678901', examine_name: '李四', examine_date: '111', status_name: '待审', status: '0', examine_desc: '我想不同意,但我还是同意了', order: [{ name: '小洋人', num: '121', desc: '别卖太便宜了,赔钱' }], },
  14. { id: '002', user_name: '小红帽', user_phone: '98765432109', examine_date: '222', examine_name: '赵五', status_name: '待审', status: '0', examine_desc: '我想不同意,但我还是同意了', order: [{ name: '小洋人', num: '121', desc: '别卖太便宜了,赔钱' }], }
  15. ],
  16. // 弹框
  17. dialog: { title: '详细信息', show: false, type: '1' },
  18. // 详细信息
  19. info: {},
  20. // 审核
  21. checkForm: { examine_name: '李四' },
  22. // 导出条件
  23. exportForm: {},
  24. // 商品状态
  25. statusList: apply_status
  26. },
  27. back: function () {
  28. wx.navigateBack({ url: '/pages/home/index' })
  29. },
  30. // 导出条件
  31. export_term: function () {
  32. this.setData({ dialog: { title: '导出条件', show: true, type: '3' }, })
  33. },
  34. // 选择状态
  35. statusChange: function (e) {
  36. let { value } = e.detail;
  37. if (value) {
  38. let data = this.data.statusList[value];
  39. this.setData({ 'exportForm.status': data.value })
  40. }
  41. },
  42. // 开始时间
  43. startChange: function (e) {
  44. let { value } = e.detail;
  45. this.setData({ 'exportForm.apply_date@start': value })
  46. },
  47. // 结束时间
  48. endChange: function (e) {
  49. let { value } = e.detail;
  50. this.setData({ 'exportForm.apply_date@end': value })
  51. },
  52. // 重置条件
  53. expertReset: function (e) {
  54. this.setData({ exportForm: { user_name: '', status: '' } })
  55. },
  56. // 确认导出
  57. exportSubmit: function (e) {
  58. wx.showModal({
  59. title: '是否确认导出',
  60. success: (res) => {
  61. if (res.confirm) wx.showToast({ title: `操作成功`, icon: 'success', duration: 2000 })
  62. else if (res.cancel) { }
  63. }
  64. })
  65. },
  66. // 采购申请审核
  67. toCheck: function (e) {
  68. this.setData({ dialog: { title: '采购申请审核', show: true, type: '2' } })
  69. },
  70. // 提交审核
  71. checkSubmit: function (e) {
  72. wx.showToast({ title: `审核信息成功`, icon: 'success', duration: 2000 });
  73. this.setData({ dialog: { title: '详细信息', show: false, type: '1' } })
  74. },
  75. // 详细信息
  76. toView: function (e) {
  77. let item = e.currentTarget.dataset.item;
  78. this.setData({ info: item })
  79. this.setData({ dialog: { title: '详细信息', show: true, type: '1' } })
  80. },
  81. // 查询
  82. shoppinginput: function (e) {
  83. this.setData({ shoopingtext: e.detail.value })
  84. },
  85. /**
  86. * 生命周期函数--监听页面加载
  87. */
  88. onLoad: function (options) {
  89. // 计算高度
  90. this.searchHeight();
  91. },
  92. // 计算高度
  93. searchHeight: function () {
  94. let frameStyle = this.data.frameStyle;
  95. let client = app.globalData.client;
  96. // 减去状态栏
  97. let infoHeight = client.windowHeight - (client.statusBarHeight + client.getMenu.height + (client.getMenu.top - client.statusBarHeight) * 2);
  98. // 是否减去底部菜单
  99. if (frameStyle.useBar) infoHeight = infoHeight - 50;
  100. if (infoHeight) this.setData({ infoHeight: infoHeight })
  101. },
  102. /**
  103. * 生命周期函数--监听页面初次渲染完成
  104. */
  105. onReady: function () {
  106. },
  107. /**
  108. * 生命周期函数--监听页面显示
  109. */
  110. onShow: function () {
  111. this.search();
  112. },
  113. /**
  114. * 生命周期函数--监听页面隐藏
  115. */
  116. onHide: function () {
  117. },
  118. /**
  119. * 生命周期函数--监听页面卸载
  120. */
  121. onUnload: function () {
  122. },
  123. /**
  124. * 页面相关事件处理函数--监听用户下拉动作
  125. */
  126. onPullDownRefresh: function () {
  127. },
  128. /**
  129. * 页面上拉触底事件的处理函数
  130. */
  131. onReachBottom: function () {
  132. },
  133. /**
  134. * 用户点击右上角分享
  135. */
  136. onShareAppMessage: function () {
  137. }
  138. })