index.js 7.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250
  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. openpreview(e){
  59. wx.previewImage({
  60. current: e.currentTarget.dataset.url, // 当前显示图片的http链接
  61. urls: e.currentTarget.dataset.urls.map(v=>{return v.thumb}) || [] // 需要预览的图片http链接列表
  62. })
  63. },
  64. click(e){
  65. var clsss=e.currentTarget.dataset.class;
  66. var dat=""
  67. var data=this.data.head_clas;
  68. for(var i=0; i<data.length;i++){
  69. if(data[i].data_class==clsss){
  70. dat=data[i].dat
  71. }
  72. }
  73. this.setData({
  74. class:clsss,
  75. dat:dat,
  76. inpval: ''
  77. })
  78. this.getData(clsss);
  79. },
  80. serach(e){
  81. this.setData({
  82. inpval:e.detail.value
  83. })
  84. },
  85. onClose(){
  86. this.setData({
  87. show:!this.data.show
  88. })
  89. },
  90. getData(clsss=""){
  91. console.log(clsss);
  92. var that=this
  93. app.api.useApi(app.globalData.baseAppUrl + "api/admin/NetworkerDetails", {
  94. network_id:id,
  95. class:this.data.class,
  96. key:this.data.inpval
  97. }, "get").then(function (res) {
  98. console.log(res);
  99. wx.hideLoading();
  100. if (res.code != 200) {
  101. wx.showLoading({
  102. title: res.message.msg,
  103. })
  104. setTimeout(function () {
  105. wx.navigateBack({
  106. delta: 1
  107. })
  108. wx.hideLoading();
  109. }, 1000);
  110. } else {
  111. if(res.message.data.unit==0 && that.data.head_clas.length==4){
  112. that.data.head_clas.splice(0,2)
  113. // head_clas.splice(1,1)
  114. that.setData({
  115. class: that.data.head_clas[0].data_class
  116. })
  117. that.getData(that.data.class)
  118. }
  119. console.log(that.data.head_clas)
  120. that.setData({
  121. selectInfo:res.message.data,
  122. head_clas:that.data.head_clas
  123. // contentOne:res.message.data.stay_list,
  124. // contentTwo:res.message.data.collect_list,//上门送回列表
  125. // content:res.message.data.stay_list,//一揽收
  126. // content:res.message.data.stay_list,//一揽收
  127. })
  128. }
  129. }).catch(function (err) {
  130. console.log(222);
  131. })
  132. },
  133. call(e){
  134. var phone=e.currentTarget.dataset.phone
  135. if(!phone)
  136. return;
  137. wx.makePhoneCall({
  138. phoneNumber: phone //仅为示例,并非真实的电话号码
  139. })
  140. },
  141. operate:function(e){
  142. var type=e.currentTarget.dataset.type//0揽收1送回
  143. console.log(type)
  144. this.setData({
  145. show:!this.data.show,
  146. type,
  147. focus:true
  148. })
  149. },
  150. finish:function(e){
  151. var that=this
  152. var val=e.detail.value;
  153. this.setData({
  154. one:val.split('')[0]?val.split('')[0]:'',
  155. two:val.split('')[1]?val.split('')[1]:'',
  156. three:val.split('')[2]?val.split('')[2]:'',
  157. four:val.split('')[3]?val.split('')[3]:'',
  158. five:val.split('')[4]?val.split('')[4]:'',
  159. six:val.split('')[5]?val.split('')[5]:''
  160. })
  161. if(val.length>=6){
  162. if(that.data.type==1){
  163. that.submit()
  164. }else{
  165. that.submitValue()
  166. }
  167. }
  168. },
  169. submitValue:function(){
  170. var that=this
  171. if(that.data.inputValue=='')
  172. return wx.showToast({title: '存衣码不能为空',icon:'none'})
  173. app.api.useApi(app.globalData.baseAppUrl + "api/admin/SaveCode", {
  174. logistic_code: that.data.inputValue,
  175. network_id:this.data.nid
  176. }, "post").then(function (res) {
  177. wx.hideLoading();
  178. if (res.code== 200) {
  179. that.setData({
  180. show:!that.data.show,
  181. inputValue:'',
  182. one:'',
  183. two:'',
  184. three:'',
  185. four:'',
  186. five:'',
  187. six:''
  188. })
  189. if(that.data.type==0)
  190. wx.navigateTo({
  191. url: 'bind?id='+res.message.data.order_id+'&pointId='+id,
  192. })
  193. }else{
  194. wx.showToast({title: res.message.msg,icon:'none'})
  195. }
  196. }).catch(function (err) {
  197. console.log(222);
  198. })
  199. },
  200. /**
  201. * 生命周期函数--监听页面初次渲染完成
  202. */
  203. onReady: function () {
  204. },
  205. submit:function(){
  206. var that=this
  207. if(that.data.inputValue=='')
  208. return wx.showToast({title: '取衣码不能为空',icon:'none'})
  209. app.api.useApi(app.globalData.baseAppUrl + "api/admin/TakeCode", {
  210. logistic_code: that.data.inputValue,
  211. network_id:this.data.nid
  212. }, "post").then(function (res) {
  213. wx.hideLoading();
  214. if (res.code== 200) {
  215. that.setData({
  216. show:!that.data.show,
  217. inputValue:'',
  218. one:'',
  219. two:'',
  220. three:'',
  221. four:'',
  222. five:'',
  223. six:''
  224. })
  225. wx.navigateTo({
  226. url: 'bind?id='+res.message.data.order_id+'&logistic_code='+res.message.data.logistic_code,
  227. })
  228. }else{
  229. wx.showToast({title: res.message.msg,icon:'none'})
  230. }
  231. }).catch(function (err) {
  232. console.log(222);
  233. })
  234. },
  235. })