index.js 6.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240
  1. // pages/tabber/news/index.js
  2. const app=getApp();
  3. var id='';
  4. Page({
  5. /**
  6. * 页面的初始数据
  7. */
  8. data: {
  9. selectInfo: {},
  10. nid:0,
  11. content:[],
  12. contentOne:[],
  13. contentTwo:[],
  14. contentThree:[],
  15. contentfour:[],
  16. one:'',
  17. two:'',
  18. three:'',
  19. four:'',
  20. five:'',
  21. six:'',
  22. inputValue:'',
  23. show:false,
  24. type:0,
  25. focus:false,
  26. class:'door_Collect_list',
  27. head_clas:[
  28. {title:'上门揽收',data_class:'door_Collect_list',dat:'下单时间'},
  29. {title:'上门送回',data_class:'door_stay_list',dat:'网点签收'},
  30. {title:'已揽收',data_class:'collect_list',dat:'揽收时间'},
  31. {title:'待送回',data_class:'stay_list',dat:'网点签收'}
  32. ],
  33. inpval:'',
  34. dat:''
  35. },
  36. /**
  37. * 生命周期函数--监听页面加载
  38. */
  39. onLoad: function (options) {
  40. class Select {
  41. in = 1
  42. getSelet(){
  43. console.log(2);
  44. return 10
  45. }
  46. }
  47. id=options&&options.id?options.id:wx.getStorageSync('nid')
  48. this.setData({
  49. nid:id
  50. })
  51. var b = new Select();
  52. console.log(b.getSelet());
  53. this.getData(this.data.class)
  54. },
  55. onPullDownRefresh:function(){
  56. this.getData(this.data.class)
  57. },
  58. click(e){
  59. var clsss=e.currentTarget.dataset.class;
  60. var dat=""
  61. var data=this.data.head_clas;
  62. for(var i=0; i<data.length;i++){
  63. if(data[i].data_class==clsss){
  64. dat=data[i].dat
  65. }
  66. }
  67. this.setData({
  68. class:clsss,
  69. dat:dat
  70. })
  71. this.getData(clsss);
  72. },
  73. serach(e){
  74. this.setData({
  75. inpval:e.detail.value
  76. })
  77. },
  78. onClose(){
  79. this.setData({
  80. show:!this.data.show
  81. })
  82. },
  83. getData(clsss=""){
  84. console.log(clsss);
  85. var that=this
  86. app.api.useApi(app.globalData.baseAppUrl + "api/admin/NetworkerDetails", {
  87. network_id:id,
  88. class:clsss,
  89. key:this.data.inpval
  90. }, "get").then(function (res) {
  91. console.log(res);
  92. wx.hideLoading();
  93. if (res.code != 200) {
  94. wx.showLoading({
  95. title: res.message.msg,
  96. })
  97. setTimeout(function () {
  98. wx.navigateBack({
  99. delta: 1
  100. })
  101. wx.hideLoading();
  102. }, 1000);
  103. } else {
  104. var head_clas=that.data.head_clas;
  105. console.log(head_clas)
  106. if(res.message.data.unit==0 && head_clas.length==4){
  107. head_clas.splice(0,1)
  108. head_clas.splice(1,1)
  109. }
  110. that.setData({
  111. selectInfo:res.message.data,
  112. head_clas:head_clas
  113. // contentOne:res.message.data.stay_list,
  114. // contentTwo:res.message.data.collect_list,//上门送回列表
  115. // content:res.message.data.stay_list,//一揽收
  116. // content:res.message.data.stay_list,//一揽收
  117. })
  118. }
  119. }).catch(function (err) {
  120. console.log(222);
  121. })
  122. },
  123. call(e){
  124. var phone=e.currentTarget.dataset.phone
  125. if(!phone)
  126. return;
  127. wx.makePhoneCall({
  128. phoneNumber: phone //仅为示例,并非真实的电话号码
  129. })
  130. },
  131. operate:function(e){
  132. var type=e.currentTarget.dataset.type//0揽收1送回
  133. console.log(type)
  134. this.setData({
  135. show:!this.data.show,
  136. type,
  137. focus:true
  138. })
  139. },
  140. finish:function(e){
  141. var that=this
  142. var val=e.detail.value;
  143. this.setData({
  144. one:val.split('')[0]?val.split('')[0]:'',
  145. two:val.split('')[1]?val.split('')[1]:'',
  146. three:val.split('')[2]?val.split('')[2]:'',
  147. four:val.split('')[3]?val.split('')[3]:'',
  148. five:val.split('')[4]?val.split('')[4]:'',
  149. six:val.split('')[5]?val.split('')[5]:''
  150. })
  151. if(val.length>=6){
  152. if(that.data.type==1){
  153. that.submit()
  154. }else{
  155. that.submitValue()
  156. }
  157. }
  158. },
  159. submitValue:function(){
  160. var that=this
  161. if(that.data.inputValue=='')
  162. return wx.showToast({title: '存衣码不能为空',icon:'none'})
  163. app.api.useApi(app.globalData.baseAppUrl + "api/admin/SaveCode", {
  164. logistic_code: that.data.inputValue,
  165. network_id:this.data.nid
  166. }, "post").then(function (res) {
  167. wx.hideLoading();
  168. if (res.code== 200) {
  169. that.setData({
  170. show:!that.data.show,
  171. inputValue:'',
  172. one:'',
  173. two:'',
  174. three:'',
  175. four:'',
  176. five:'',
  177. six:''
  178. })
  179. if(that.data.type==0)
  180. wx.navigateTo({
  181. url: 'bind?id='+res.message.data.order_id+'&pointId='+id,
  182. })
  183. }else{
  184. wx.showToast({title: res.message.msg,icon:'none'})
  185. }
  186. }).catch(function (err) {
  187. console.log(222);
  188. })
  189. },
  190. /**
  191. * 生命周期函数--监听页面初次渲染完成
  192. */
  193. onReady: function () {
  194. },
  195. submit:function(){
  196. var that=this
  197. if(that.data.inputValue=='')
  198. return wx.showToast({title: '取衣码不能为空',icon:'none'})
  199. app.api.useApi(app.globalData.baseAppUrl + "api/admin/TakeCode", {
  200. logistic_code: that.data.inputValue,
  201. network_id:this.data.nid
  202. }, "post").then(function (res) {
  203. wx.hideLoading();
  204. if (res.code== 200) {
  205. that.setData({
  206. show:!that.data.show,
  207. inputValue:'',
  208. one:'',
  209. two:'',
  210. three:'',
  211. four:'',
  212. five:'',
  213. six:''
  214. })
  215. wx.navigateTo({
  216. url: 'bind?id='+res.message.data.order_id+'&logistic_code='+res.message.data.logistic_code,
  217. })
  218. }else{
  219. wx.showToast({title: res.message.msg,icon:'none'})
  220. }
  221. }).catch(function (err) {
  222. console.log(222);
  223. })
  224. },
  225. })