linNext.js 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233
  1. // StepPage/pages/lin/lin.js
  2. Page({
  3. /**
  4. * 页面的初始数据
  5. */
  6. data: {
  7. productList:[
  8. {roll_film_id:'',basic_roll_film_id:'',b_r_f_name:'',title:'',code:'',apply_number:'',mark:''}
  9. ],
  10. basicRollFilmList:[],
  11. show:false,
  12. searchValue:'',
  13. searchList:[],
  14. chooseIndex:'',
  15. rollFilmList:[],
  16. sureRollFilmList:[],
  17. set_status:''
  18. },
  19. handleReturn(){
  20. wx.redirectTo({
  21. url: '../lin/lin',
  22. })
  23. },
  24. handleChangeNumber(e){
  25. let arr = this.data.productList;
  26. let index = e.target.dataset.index;
  27. arr[index].take_number = e.detail;
  28. this.setData({
  29. productList:arr
  30. })
  31. },
  32. onChangeMark(e){
  33. let arr = this.data.productList;
  34. let index = e.target.dataset.index;
  35. arr[index].mark = e.detail;
  36. this.setData({
  37. productList:arr
  38. })
  39. },
  40. handleNext(){
  41. const app = getApp();
  42. const openid = app.globalData.openID;
  43. let data = {
  44. apply:{
  45. apply_sub:this.data.productList,
  46. area:app.globalData.area
  47. },
  48. company_id:app.globalData.company_id,
  49. four_shop_id:app.globalData.fourShopId,
  50. regional_manager:app.globalData.regional_manager,
  51. storehouse_id:app.globalData.storehouse_id,
  52. contract_phone:app.globalData.contract_phone,
  53. take_person:app.globalData.take_person,
  54. take:{
  55. take:app.globalData.take_person,
  56. take_sub:this.data.productList
  57. },
  58. take_address:app.globalData.take_address,
  59. take_phone:app.globalData.take_phone,
  60. is_cash:app.globalData.is_cash,
  61. is_give:app.globalData.is_give,
  62. }
  63. data.order_number = app.globalData.detailData.order_number
  64. wx.p.request({
  65. url: `${app.globalData.url}wx/materialOrderEdit`,
  66. method:'POST',
  67. data:{
  68. openid,
  69. ...data
  70. }
  71. }).then(res=>{
  72. if(res.data.code==200){
  73. wx.showToast({
  74. title: '保存成功!',
  75. })
  76. app.globalData={
  77. stepData:[],
  78. openID:app.globalData.openID,
  79. url:'https://zhapi.qingyaokeji.com/'
  80. }
  81. wx.redirectTo({
  82. url: '../report/LinList/LinList',
  83. })
  84. }else{
  85. wx.showToast({
  86. icon:'error',
  87. title: '保存失败!',
  88. })
  89. }
  90. })
  91. },
  92. /**
  93. * 生命周期函数--监听页面加载
  94. */
  95. onLoad(options) {
  96. const app = getApp();
  97. const openid = app.globalData.openID;
  98. const storehouse_id = app.globalData.storehouse_id;
  99. const company_id = app.globalData.company_id;
  100. //获取卷膜分类
  101. wx.p.request({
  102. url: `${app.globalData.url}wx/basicRollFilmList`,
  103. method:'POST',
  104. data:{
  105. openid
  106. }
  107. }).then(res=>{
  108. if(res.data.code==200){
  109. this.setData({
  110. basicRollFilmList:this.getArr(res.data.data)
  111. })
  112. }
  113. })
  114. //获取卷膜型号
  115. wx.p.request({
  116. url: `${app.globalData.url}wx/rollFilmList`,
  117. method:'POST',
  118. data:{
  119. use:1,
  120. openid,
  121. storehouse_id,
  122. company_id
  123. }
  124. }).then(res=>{
  125. if(res.data.code==200){
  126. this.setData({
  127. rollFilmList:res.data.data.data,
  128. sureRollFilmList:JSON.parse(JSON.stringify(res.data.data.data))
  129. })
  130. }
  131. })
  132. if(app.globalData.set_status){
  133. if(app.globalData.set_status=='is_detail'){
  134. this.setData({
  135. productList:app.globalData.detailData.take.take_sub,
  136. set_status:app.globalData.set_status
  137. })
  138. }else{
  139. if(app.globalData.detailData.apply_status!=0){
  140. this.setData({
  141. productList:app.globalData.detailData.take.take_sub,
  142. set_status:app.globalData.set_status
  143. })
  144. }else{
  145. console.log(123)
  146. let arr = JSON.parse(JSON.stringify(app.globalData.apply_sub));
  147. arr.forEach(v=>{
  148. v.send_number = v.apply_number;
  149. v.take_number = v.apply_number;
  150. })
  151. this.setData({
  152. productList:arr,
  153. set_status:app.globalData.set_status
  154. })
  155. }
  156. }
  157. }else{
  158. this.setData({
  159. set_status:''
  160. })
  161. }
  162. },
  163. getArr(arr){
  164. let data = [];
  165. arr.forEach(v=>{
  166. if(v.children.length==0){
  167. data.push(v);
  168. }else{
  169. data = [...data,...this.getArr(v.children)]
  170. }
  171. })
  172. return data;
  173. },
  174. handleBack(){
  175. let app = getApp()
  176. app.globalData={
  177. stepData:[],
  178. openID:app.globalData.openID,
  179. url:'https://zhapi.qingyaokeji.com/'
  180. }
  181. wx.redirectTo({
  182. url: '../report/LinList/LinList',
  183. })
  184. },
  185. /**
  186. * 生命周期函数--监听页面初次渲染完成
  187. */
  188. onReady() {
  189. },
  190. /**
  191. * 生命周期函数--监听页面显示
  192. */
  193. onShow() {
  194. },
  195. /**
  196. * 生命周期函数--监听页面隐藏
  197. */
  198. onHide() {
  199. },
  200. /**
  201. * 生命周期函数--监听页面卸载
  202. */
  203. onUnload() {
  204. },
  205. /**
  206. * 页面相关事件处理函数--监听用户下拉动作
  207. */
  208. onPullDownRefresh() {
  209. },
  210. /**
  211. * 页面上拉触底事件的处理函数
  212. */
  213. onReachBottom() {
  214. },
  215. /**
  216. * 用户点击右上角分享
  217. */
  218. onShareAppMessage() {
  219. }
  220. })