index.js 5.0 KB

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