pan.js 8.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374
  1. // StepPage/pages/first/first.js
  2. import Dialog from '../../../miniprogram_npm/@vant/weapp/dialog/dialog';
  3. Page({
  4. /**
  5. * 页面的初始数据
  6. */
  7. data: {
  8. show_m:false,
  9. shopList:[],
  10. storehouseList:[],
  11. set_status:'',
  12. searchList:[],
  13. searchListC:[],
  14. searchValue:'',
  15. searchValueC:"",
  16. show:false,
  17. show_c:false,
  18. title_c:"",
  19. title:'',
  20. type:'',
  21. is_check:0,
  22. status:0,
  23. oa_state:'',
  24. oa_remark:'',
  25. oa_state_m:'',
  26. is_o:true,
  27. formData:{}
  28. },
  29. handleChangeRemark(e){
  30. this.setData({
  31. oa_remark:e.detail
  32. })
  33. },
  34. onSure() {
  35. let app = getApp();
  36. let openid = app.globalData.openID;
  37. if (this.data.is_o) {
  38. this.setData({
  39. is_o:false
  40. })
  41. let data = {
  42. id:app.globalData.oa_id,
  43. state:this.data.oa_state_m,
  44. remark:this.data.oa_remark
  45. }
  46. wx.p.request({
  47. url: `${app.globalData.url}wx/oaCheck`,
  48. method:'POST',
  49. data:{
  50. openid,
  51. ...data
  52. }
  53. }).then(res=>{
  54. if(res.data.code === 200){
  55. this.setData({ show_m: false });
  56. this.initData()
  57. if(this.data.oa_state_m){
  58. this.handleReturn();
  59. }
  60. }
  61. wx.showToast({
  62. icon:'none',
  63. title: res.data.msg,
  64. })
  65. setTimeout(()=>{
  66. this.setData({
  67. is_o:true
  68. })
  69. },2000)
  70. })
  71. }
  72. },
  73. initData(){
  74. let app = getApp();
  75. let openid = app.globalData.openID;
  76. let order_number = app.globalData.detailData.order_number;
  77. wx.p.request({
  78. url: `${app.globalData.url}wx/inventoryDetail`,
  79. method:'POST',
  80. data:{
  81. order_number,
  82. openid
  83. }
  84. }).then(res=>{
  85. if(res.data.code==200){
  86. this.setData({
  87. status:res1.data.data.status
  88. })
  89. app.globalData.detailData.status = res1.data.data.status;
  90. if(res.data.data.status==1){
  91. wx.p.request({
  92. url: `${app.globalData.url}wx/oaOrderState`,
  93. method:'POST',
  94. data:{
  95. menu_id:249,
  96. order_no:res.data.data.order_number,
  97. openid
  98. }
  99. }).then(req=>{
  100. if (req.data.code==200) {
  101. app.globalData.oa_state = req.data.data.state;
  102. app.globalData.oa_id = req.data.data.id
  103. }else{
  104. app.globalData.oa_state = '';
  105. app.globalData.oa_id = ''
  106. }
  107. })
  108. }
  109. }
  110. })
  111. },
  112. onClose() {
  113. this.setData({
  114. show_m: false,
  115. // oa_remark:''
  116. });
  117. },
  118. handleSearch(){
  119. this.setData({
  120. show:true,
  121. searchList:this.data.shopList
  122. })
  123. },
  124. handleSearchC(){
  125. this.setData({
  126. show_c:true,
  127. searchListC:this.data.storehouseList
  128. })
  129. },
  130. handleCancel(){
  131. this.setData({
  132. show:false
  133. })
  134. },
  135. handleCancelC(){
  136. this.setData({
  137. show_c:false
  138. })
  139. },
  140. onSearch(event){
  141. let arr = this.data.shopList.filter(v=>v.title.indexOf(event.detail)!=-1);
  142. this.setData({
  143. searchList:arr
  144. })
  145. },
  146. onSearchC(event){
  147. let arr = this.data.storehouseList.filter(v=>v.title.indexOf(event.detail)!=-1);
  148. this.setData({
  149. searchListC:arr
  150. })
  151. },
  152. handleReturn(){
  153. let app = getApp();
  154. app.globalData= {
  155. openID:app.globalData.openID,
  156. url:'https://zhapi.qingyaokeji.com/',
  157. stepData:[]
  158. }
  159. wx.redirectTo({
  160. url: '../../pages/report/PanList/PanList',
  161. })
  162. },
  163. handleCheck(){
  164. Dialog.confirm({
  165. title: '审核',
  166. message: '确认审核吗?',
  167. })
  168. .then(() => {
  169. let app = getApp();
  170. let openid = app.globalData.openID;
  171. if(app.globalData.typePage==1){
  172. wx.p.request({
  173. url: `${app.globalData.url}wx/checkAll`,
  174. method:'POST',
  175. data:{
  176. order_number:app.globalData.detailData.order_number,
  177. openid,
  178. opt_case: 5,
  179. menu_id:224
  180. }
  181. }).then(res=>{
  182. if(res.data.code==200){
  183. wx.showToast({
  184. title: res.data.msg
  185. })
  186. this.initData()
  187. }else{
  188. wx.showModal({
  189. content: res.data.msg,
  190. showCancel:false,
  191. confirmText:'返回'
  192. })
  193. }
  194. })
  195. }else if(app.globalData.typePage==2){
  196. wx.p.request({
  197. url: `${app.globalData.url}wx/checkAll`,
  198. method:'POST',
  199. data:{
  200. order_number:app.globalData.detailData.order_number,
  201. openid,
  202. opt_case: 10,
  203. menu_id:249
  204. }
  205. }).then(res=>{
  206. if(res.data.code==200){
  207. wx.showToast({
  208. title: res.data.msg
  209. })
  210. this.initData()
  211. }else{
  212. wx.showModal({
  213. content: res.data.msg,
  214. showCancel:false,
  215. confirmText:'返回'
  216. })
  217. }
  218. })
  219. }
  220. })
  221. .catch(() => {
  222. // on cancel
  223. });
  224. },
  225. handlePassModal(e){
  226. this.setData({
  227. show_m:true,
  228. oa_state_m:e.currentTarget.dataset.item
  229. })
  230. },
  231. handleNext(){
  232. let app = getApp()
  233. if(!app.globalData.storehouse_id){
  234. return
  235. }
  236. if(this.data.type==2){
  237. wx.redirectTo({
  238. url: '../pan/pan',
  239. })
  240. }else{
  241. if(this.data.title){
  242. let app = getApp();
  243. if(app.globalData.set_status){
  244. if(app.globalData.typePage==1){
  245. wx.redirectTo({
  246. url: '../second/second',
  247. })
  248. }else if(app.globalData.typePage==4){
  249. wx.redirectTo({
  250. url: '../tui/tui',
  251. })
  252. }
  253. }else{
  254. if(app.globalData.typePage==1){
  255. let openid = app.globalData.openID;
  256. app.globalData.stepData = app.globalData.stepData.filter(v=>v.sort!=1);
  257. app.globalData.stepData=[{
  258. sort:1,
  259. data:{
  260. title:this.data.title
  261. }
  262. }]
  263. wx.p.request({
  264. url: `${app.globalData.url}wx/saveWxConstructionData`,
  265. method:'POST',
  266. data:{
  267. openid,
  268. type:1,
  269. data:JSON.stringify(app.globalData)
  270. }
  271. }).then(res=>{
  272. if(res.data.code==200){
  273. wx.redirectTo({
  274. url: '../second/second',
  275. })
  276. }
  277. })
  278. }else if(app.globalData.typePage==4){
  279. wx.redirectTo({
  280. url: '../tui/tui',
  281. })
  282. }
  283. }
  284. }
  285. }
  286. },
  287. handleChoose(item){
  288. let app = getApp();
  289. app.globalData.fourShopId = item.target.dataset.item.id;
  290. app.globalData.storehouse_id = item.target.dataset.item.storehouse_id;
  291. app.globalData.address = item.target.dataset.item.address;
  292. app.globalData.area = item.target.dataset.item.area;
  293. app.globalData.contract_person = item.target.dataset.item.contract_person;
  294. app.globalData.contract_phone = item.target.dataset.item.contract_phone;
  295. app.globalData.regional_manager = item.target.dataset.item.regional_manager;
  296. app.globalData.technical_manager = item.target.dataset.item.technical_manager;
  297. app.globalData.company_id = item.target.dataset.item.company_id;
  298. this.setData({
  299. show:false,
  300. title:item.target.dataset.item.title
  301. })
  302. },
  303. handleChooseC(item){
  304. let app = getApp();
  305. app.globalData.storehouse_id = item.target.dataset.item.id;
  306. app.globalData.title_c = item.target.dataset.item.title;
  307. this.setData({
  308. show_c:false,
  309. title_c:item.target.dataset.item.title
  310. })
  311. },
  312. /**
  313. * 生命周期函数--监听页面加载
  314. */
  315. onLoad(options) {
  316. let app = getApp();
  317. this.setData({
  318. status:app.globalData.detailData.status,
  319. oa_state:app.globalData.oa_state?app.globalData.oa_state:'',
  320. formData:app.globalData.detailData
  321. })
  322. },
  323. /**
  324. * 生命周期函数--监听页面初次渲染完成
  325. */
  326. onReady() {
  327. },
  328. /**
  329. * 生命周期函数--监听页面显示
  330. */
  331. onShow() {
  332. },
  333. /**
  334. * 生命周期函数--监听页面隐藏
  335. */
  336. onHide() {
  337. },
  338. /**
  339. * 生命周期函数--监听页面卸载
  340. */
  341. onUnload() {
  342. },
  343. /**
  344. * 页面相关事件处理函数--监听用户下拉动作
  345. */
  346. onPullDownRefresh() {
  347. },
  348. /**
  349. * 页面上拉触底事件的处理函数
  350. */
  351. onReachBottom() {
  352. },
  353. /**
  354. * 用户点击右上角分享
  355. */
  356. onShareAppMessage() {
  357. }
  358. })