LinList.js 7.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351
  1. // StepPage/pages/report/ShiList/ShiList.js
  2. import Dialog from '../../../../miniprogram_npm/@vant/weapp/dialog/dialog';
  3. Page({
  4. /**
  5. * 页面的初始数据
  6. */
  7. data: {
  8. page_index: 1,
  9. page_size:10,
  10. items: [],
  11. itemTitle: '筛选',
  12. radio:'3',
  13. start_date:'',
  14. end_date:'',
  15. active:0,
  16. steps:[],
  17. show_m:false
  18. },
  19. handleClickCheck(e){
  20. let app = getApp();
  21. let openid = app.globalData.openID;
  22. let order_no = e.currentTarget.dataset.item.order_number
  23. wx.p.request({
  24. url: `${app.globalData.url}wx/oaGetTeamDetail`,
  25. method:'POST',
  26. data:{
  27. order_no,
  28. openid
  29. }
  30. }).then(res=>{
  31. if(res.data.code==200){
  32. this.setData({
  33. show_m:true,
  34. active:res.data.data?res.data.data.length:0,
  35. steps:res.data.data.map(v=>{
  36. return {
  37. text:v.state==0?'待审核':v.state==1?'审核通过':'审核驳回',
  38. desc:'['+v.remark+']'+v.team
  39. }
  40. })
  41. })
  42. }
  43. });
  44. },
  45. handleDel(item){
  46. let data = item.currentTarget.dataset.item;
  47. wx.showModal({
  48. title: '确认',
  49. content: '确认删除吗?',
  50. complete: (res) => {
  51. if (res.confirm) {
  52. let app = getApp();
  53. let openid = app.globalData.openID;
  54. wx.p.request({
  55. url: `${app.globalData.url}wx/materialOrderDel`,
  56. method:'POST',
  57. data:{
  58. openid,
  59. order_number:[data.order_number]
  60. }
  61. }).then(res=>{
  62. if(res.data.code==200){
  63. this.initData()
  64. }
  65. wx.showToast({
  66. icon:'none',
  67. title: res.data.msg
  68. })
  69. })
  70. // constructionDel
  71. }
  72. }
  73. })
  74. },
  75. handleLock(data){
  76. Dialog.confirm({
  77. title: '签收',
  78. message: '确认签收嘛',
  79. })
  80. .then(() => {
  81. let app = getApp();
  82. let openid = app.globalData.openID;
  83. let e = data.target.dataset.item;
  84. let index = data.target.dataset.index;
  85. wx.p.request({
  86. url: `${app.globalData.url}wx/checkAll`,
  87. method:'POST',
  88. data:{
  89. order_number:e.order_number,
  90. openid,
  91. opt_case: 3,
  92. menu_id:243
  93. }
  94. }).then(res=>{
  95. if(res.data.code==200){
  96. wx.showToast({
  97. title: res.data.msg
  98. })
  99. let arr = JSON.parse(JSON.stringify(this.data.items));
  100. arr[index].take_status = 2;
  101. this.setData({
  102. items:arr
  103. })
  104. }else{
  105. wx.showModal({
  106. content: res.data.msg,
  107. showCancel:false,
  108. confirmText:'返回'
  109. })
  110. }
  111. })
  112. })
  113. .catch(() => {
  114. // on cancel
  115. });
  116. },
  117. handleDetail(){
  118. let item = this.data.items.filter(v=>v.is_choose);
  119. if(item.length==0){
  120. return wx.showToast({
  121. icon:'error',
  122. title: '请选择',
  123. })
  124. }else{
  125. let app = getApp();
  126. let openid = app.globalData.openID;
  127. let order_number = item[0].order_number;
  128. wx.p.request({
  129. url: `${app.globalData.url}wx/materialOrderDetail`,
  130. method:'POST',
  131. data:{
  132. order_number,
  133. openid
  134. }
  135. }).then(res=>{
  136. if(res.data.code==200){
  137. app.globalData.set_status = 'is_detail';
  138. app.globalData.detailData = res.data.data;
  139. wx.redirectTo({
  140. url: '../../firstLin/firstLin',
  141. })
  142. }
  143. })
  144. }
  145. },
  146. handleEdit(){
  147. let item = this.data.items.filter(v=>v.is_choose);
  148. if(item.length==0){
  149. return wx.showToast({
  150. icon:'error',
  151. title: '请选择',
  152. })
  153. }else if(item[0].apply_status!=0){
  154. return wx.showToast({
  155. icon:'none',
  156. title: '已申领区域已审核不能编辑',
  157. })
  158. }else{
  159. let app = getApp();
  160. let openid = app.globalData.openID;
  161. let order_number = item[0].order_number;
  162. wx.p.request({
  163. url: `${app.globalData.url}wx/materialOrderDetail`,
  164. method:'POST',
  165. data:{
  166. order_number,
  167. openid
  168. }
  169. }).then(res=>{
  170. if(res.data.code==200){
  171. app.globalData.set_status = 'is_edit';
  172. app.globalData.detailData = res.data.data;
  173. wx.redirectTo({
  174. url: '../../firstLin/firstLin',
  175. })
  176. }
  177. })
  178. }
  179. },
  180. handleChoose(e){
  181. let index = e.currentTarget.dataset.index;
  182. this.data.items[index].is_choose = !this.data.items[index].is_choose;
  183. this.data.items.forEach((v,idx)=>{
  184. if(idx!==index){
  185. v.is_choose = false;
  186. }
  187. })
  188. this.setData({
  189. items : this.data.items
  190. })
  191. },
  192. bindDateChange1(e){
  193. this.setData({
  194. start_date: e.detail.value
  195. })
  196. },
  197. bindDateChange(e) {
  198. this.setData({
  199. end_date: e.detail.value
  200. })
  201. },
  202. onChange(event) {
  203. this.setData({
  204. radio: event.detail,
  205. });
  206. },
  207. onClick(event) {
  208. const { name } = event.currentTarget.dataset;
  209. this.setData({
  210. radio: name,
  211. });
  212. },
  213. onConfirm1() {
  214. this.selectComponent('#item').toggle();
  215. this.data.page_index = 1;
  216. let app = getApp();
  217. let openid = app.globalData.openID;
  218. wx.showLoading({
  219. title: '加载中',
  220. });
  221. console.log(Date.parse(this.data.start_date).toString().slice(0,10));
  222. let data = {
  223. page_index: this.data.page_index,
  224. page_size: this.data.page_size,
  225. crt_time: [this.data.start_date?Date.parse(this.data.start_date).toString().slice(0,10):'',this.data.end_date?Date.parse(this.data.end_date).toString().slice(0,10):''],
  226. take_status:this.data.radio==3?'':this.data.radio
  227. }
  228. wx.p.request({
  229. url: `${app.globalData.url}wx/materialOrderList`,
  230. method:'POST',
  231. data:{
  232. openid,
  233. ...data
  234. }
  235. }).then(res=>{
  236. if(res.data.code==200){
  237. res.data.data.data.forEach(element => {
  238. element.is_choose = false;
  239. });
  240. this.setData({
  241. items:res.data.data.data
  242. })
  243. // 加载完毕后隐藏加载提示
  244. wx.hideLoading();
  245. }
  246. })
  247. },
  248. initData(){
  249. let app = getApp();
  250. let openid = app.globalData.openID;
  251. wx.showLoading({
  252. title: '加载中',
  253. });
  254. let data = {
  255. page_index: this.data.page_index,
  256. page_size: this.data.page_size,
  257. crt_time: [this.data.start_date?Date.parse(this.data.start_date).toString().slice(0,10):'',this.data.end_date?Date.parse(this.data.end_date).toString().slice(0,10):''],
  258. take_status:this.data.radio==3?'':this.data.radio
  259. }
  260. wx.p.request({
  261. url: `${app.globalData.url}wx/materialOrderList`,
  262. method:'POST',
  263. data:{
  264. openid,
  265. ...data
  266. }
  267. }).then(res=>{
  268. if(res.data.code==200){
  269. res.data.data.data.forEach(element => {
  270. element.is_choose = false;
  271. });
  272. let arr = [...this.data.items,...res.data.data.data];
  273. this.setData({
  274. items:arr
  275. })
  276. // 加载完毕后隐藏加载提示
  277. wx.hideLoading();
  278. }
  279. })
  280. },
  281. handleReturn(){
  282. wx.redirectTo({
  283. url: '../../../../pages/zero/zero',
  284. })
  285. },
  286. onReachBottom: function() {
  287. var that = this;
  288. // 加载更多数据
  289. let nextPage = that.data.page_index + 1;
  290. // 调用API请求数据,假设返回的数据是newItems
  291. // let newItems = api.getData(nextPage);
  292. // 将新数据添加到原有数据列表的末尾
  293. // let items = this.data.items.concat(newItems);
  294. // 更新页面数据
  295. that.setData({
  296. page_index: nextPage,
  297. });
  298. that.initData();
  299. },
  300. /**
  301. * 生命周期函数--监听页面加载
  302. */
  303. onLoad(options) {
  304. this.initData()
  305. },
  306. /**
  307. * 生命周期函数--监听页面初次渲染完成
  308. */
  309. onReady() {
  310. },
  311. /**
  312. * 生命周期函数--监听页面显示
  313. */
  314. onShow() {
  315. },
  316. /**
  317. * 生命周期函数--监听页面隐藏
  318. */
  319. onHide() {
  320. },
  321. /**
  322. * 生命周期函数--监听页面卸载
  323. */
  324. onUnload() {
  325. },
  326. /**
  327. * 页面相关事件处理函数--监听用户下拉动作
  328. */
  329. onPullDownRefresh() {
  330. },
  331. /**
  332. * 用户点击右上角分享
  333. */
  334. onShareAppMessage() {
  335. }
  336. })