shi.js 6.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317
  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. special_type:false
  29. },
  30. handleChangeRemark(e){
  31. this.setData({
  32. oa_remark:e.detail
  33. })
  34. },
  35. onSure() {
  36. let app = getApp();
  37. let openid = app.globalData.openID;
  38. if (this.data.is_o) {
  39. this.setData({
  40. is_o:false
  41. })
  42. let data = {
  43. id:app.globalData.oa_id,
  44. state:this.data.oa_state_m,
  45. remark:this.data.oa_remark
  46. }
  47. wx.p.request({
  48. url: `${app.globalData.url}wx/oaCheck`,
  49. method:'POST',
  50. data:{
  51. openid,
  52. ...data
  53. }
  54. }).then(res=>{
  55. if(res.data.code === 200){
  56. this.setData({ show_m: false });
  57. this.initData()
  58. if(this.data.oa_state_m){
  59. this.handleReturn();
  60. }
  61. }
  62. wx.showToast({
  63. icon:'none',
  64. title: res.data.msg,
  65. })
  66. setTimeout(()=>{
  67. this.setData({
  68. is_o:true
  69. })
  70. },2000)
  71. })
  72. }
  73. },
  74. initData(){
  75. let app = getApp();
  76. let openid = app.globalData.openID;
  77. let order_number = app.globalData.detailData.order_number;
  78. wx.p.request({
  79. url: `${app.globalData.url}wx/constructionDetail`,
  80. method:'POST',
  81. data:{
  82. order_number,
  83. openid
  84. }
  85. }).then(res1=>{
  86. if(res1.data.code==200){
  87. this.setData({
  88. status:res1.data.data.status
  89. })
  90. app.globalData.detailData.status = res1.data.data.status;
  91. if ( res1.data.data.status === 1 ) {
  92. wx.p.request({
  93. url: `${app.globalData.url}wx/oaOrderState`,
  94. method:'POST',
  95. data:{
  96. menu_id:224,
  97. order_no:res1.data.data.order_number,
  98. openid
  99. }
  100. }).then(req=>{
  101. if (req.data.code==200) {
  102. app.globalData.oa_state = req.data.data.state;
  103. app.globalData.oa_id = req.data.data.id
  104. }else{
  105. app.globalData.oa_state = '';
  106. app.globalData.oa_id = ''
  107. }
  108. this.setData({
  109. oa_state:app.globalData.oa_state
  110. })
  111. })
  112. }
  113. }
  114. })
  115. },
  116. onClose() {
  117. this.setData({
  118. show_m: false,
  119. // oa_remark:''
  120. });
  121. },
  122. handleSearch(){
  123. this.setData({
  124. show:true,
  125. searchList:this.data.shopList
  126. })
  127. },
  128. handleSearchC(){
  129. this.setData({
  130. show_c:true,
  131. searchListC:this.data.storehouseList
  132. })
  133. },
  134. handleCancel(){
  135. this.setData({
  136. show:false
  137. })
  138. },
  139. handleCancelC(){
  140. this.setData({
  141. show_c:false
  142. })
  143. },
  144. onSearch(event){
  145. let arr = this.data.shopList.filter(v=>v.title.indexOf(event.detail)!=-1);
  146. this.setData({
  147. searchList:arr
  148. })
  149. },
  150. onSearchC(event){
  151. let arr = this.data.storehouseList.filter(v=>v.title.indexOf(event.detail)!=-1);
  152. this.setData({
  153. searchListC:arr
  154. })
  155. },
  156. handleReturn(){
  157. let app = getApp();
  158. app.globalData= {
  159. openID:app.globalData.openID,
  160. url:'https://zhapi.qingyaokeji.com/',
  161. stepData:[]
  162. }
  163. wx.redirectTo({
  164. url: '../../pages/report/ShiList/ShiList',
  165. })
  166. },
  167. handleCheck(){
  168. Dialog.confirm({
  169. title: '审核',
  170. message: '确认审核吗?',
  171. })
  172. .then(() => {
  173. let app = getApp();
  174. let openid = app.globalData.openID;
  175. wx.p.request({
  176. url: `${app.globalData.url}wx/checkAll`,
  177. method:'POST',
  178. data:{
  179. order_number:app.globalData.detailData.order_number,
  180. openid,
  181. opt_case: 5,
  182. menu_id:224
  183. }
  184. }).then(res=>{
  185. if(res.data.code==200){
  186. wx.showToast({
  187. title: res.data.msg
  188. })
  189. this.initData()
  190. }else{
  191. wx.showModal({
  192. content: res.data.msg,
  193. showCancel:false,
  194. confirmText:'返回'
  195. })
  196. }
  197. })
  198. })
  199. .catch(() => {
  200. // on cancel
  201. });
  202. },
  203. handlePassModal(e){
  204. this.setData({
  205. show_m:true,
  206. oa_state_m:e.currentTarget.dataset.item
  207. })
  208. },
  209. handleChoose(item){
  210. let app = getApp();
  211. app.globalData.fourShopId = item.target.dataset.item.id;
  212. app.globalData.storehouse_id = item.target.dataset.item.storehouse_id;
  213. app.globalData.address = item.target.dataset.item.address;
  214. app.globalData.area = item.target.dataset.item.area;
  215. app.globalData.contract_person = item.target.dataset.item.contract_person;
  216. app.globalData.contract_phone = item.target.dataset.item.contract_phone;
  217. app.globalData.regional_manager = item.target.dataset.item.regional_manager;
  218. app.globalData.technical_manager = item.target.dataset.item.technical_manager;
  219. app.globalData.company_id = item.target.dataset.item.company_id;
  220. this.setData({
  221. show:false,
  222. title:item.target.dataset.item.title
  223. })
  224. },
  225. handleCheckImg(){
  226. let arr = [];
  227. let app = getApp();
  228. this.data.formData.img.forEach(v=>{
  229. if(v.src){
  230. if(v.type==1||v.type==3){
  231. let str = v.show_url.split(',');
  232. str.forEach(s=>{
  233. arr.push(`${s}`)
  234. })
  235. }else{
  236. arr.push(v.show_url)
  237. }
  238. }
  239. })
  240. wx.previewImage({
  241. urls:arr
  242. })
  243. },
  244. handleChooseC(item){
  245. let app = getApp();
  246. app.globalData.storehouse_id = item.target.dataset.item.id;
  247. app.globalData.title_c = item.target.dataset.item.title;
  248. this.setData({
  249. show_c:false,
  250. title_c:item.target.dataset.item.title
  251. })
  252. },
  253. /**
  254. * 生命周期函数--监听页面加载
  255. */
  256. onLoad(options) {
  257. let app = getApp();
  258. console.log(app)
  259. this.setData({
  260. formData:app.globalData.detailData,
  261. status:app.globalData.detailData.status,
  262. oa_state:app.globalData.oa_state?app.globalData.oa_state:'',
  263. special_type:app.globalData.bussiness_special_type
  264. })
  265. },
  266. /**
  267. * 生命周期函数--监听页面初次渲染完成
  268. */
  269. onReady() {
  270. },
  271. /**
  272. * 生命周期函数--监听页面显示
  273. */
  274. onShow() {
  275. },
  276. /**
  277. * 生命周期函数--监听页面隐藏
  278. */
  279. onHide() {
  280. },
  281. /**
  282. * 生命周期函数--监听页面卸载
  283. */
  284. onUnload() {
  285. },
  286. /**
  287. * 页面相关事件处理函数--监听用户下拉动作
  288. */
  289. onPullDownRefresh() {
  290. },
  291. /**
  292. * 页面上拉触底事件的处理函数
  293. */
  294. onReachBottom() {
  295. },
  296. /**
  297. * 用户点击右上角分享
  298. */
  299. onShareAppMessage() {
  300. }
  301. })