index.js 23 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903
  1. const app = getApp();
  2. const webSocket = require('../../utils/websocket.js');
  3. Page({
  4. data: {
  5. multiArray: [], // 地址-数据
  6. step: 0, // 地址
  7. multiIndex: [0, 0, 0], // 地址-下标
  8. CityRecord: '', //城市记录
  9. areaRecord: '', //区域记录
  10. CityRecordid: [], //下标记录
  11. UsedRecord: false, //是否初次
  12. provincename:'', // 省
  13. cityname: '', // 市
  14. areaname: '', // 区
  15. heightid: 0,
  16. heightArray: [], // 身高-数据
  17. heightindex: [0, 0], // 身高-下标
  18. Ageid: 0,
  19. AgeArray: [], // 年龄-数据
  20. AgeIndex: [0, 0], // 年龄-下标
  21. MarriageArray: [], // 婚史-数据
  22. Marriageindex: '', // 婚史-下标
  23. EducationArray: [], // 学历-数据
  24. Educationindex: '', // 学历-下标
  25. nickname: '',//ID
  26. sex: 0, // 性别
  27. age: 0, // 年龄
  28. height: 0, // 身高
  29. province: 0, // 省
  30. city: 0, // 市
  31. area: 0, // 区
  32. education: 0, // 学历
  33. marry: 0, // 婚史
  34. income:0,
  35. // income: '', // 收入
  36. // occupation: '', // 职业
  37. // home: '', //列表信息
  38. // tab: [true, true, true, true],
  39. home: [], //定义列表信息数组
  40. // tabTxt: ['性别', '年龄', '婚史', '特色'],//tab文案
  41. page: 1,//当前页码
  42. limit: 10,//获取条数
  43. morehide: false, //暂无更多信息显示隐藏
  44. moreTxt: '',
  45. },
  46. onLoad: function (options) {
  47. webSocket.connectSocket();
  48. },
  49. onShow: function (options) {
  50. var that = this;
  51. that.setData({
  52. page: 1,//当前页码
  53. })
  54. getApp().showLoading(); //提示加载中
  55. // console.log(app.globalData.height);
  56. // console.log(app.globalData.marry);
  57. // console.log(app.globalData.education);
  58. // console.log(app.globalData.income);
  59. var _Selection = app.globalData.Selection // 是否选中 1选中 0没选中
  60. // console.log(_Selection);
  61. var _income = app.globalData.income // 收入
  62. that.setData({
  63. UsedRecord: false,
  64. CityRecord: '',
  65. areaRecord:'',
  66. multiIndex: [0, 0, 0], // 地址-下标
  67. step: 0,
  68. })
  69. if (app.globalData.income){
  70. that.setData({
  71. income: _income,
  72. })
  73. } else if (app.globalData.income == 0 && _Selection == 1) { //判断筛选页面 是否清空数据 同时 是否选中,而不是返回
  74. that.setData({
  75. income: _income,
  76. })
  77. }
  78. // console.log(that.data.provincename);
  79. // console.log(that.data.cityname);
  80. // console.log(that.data.areaname);
  81. var _province = app.globalData.province // 省
  82. var _city = app.globalData.city // 市
  83. var _area = app.globalData.area // 区
  84. if (_province && _city && _area) {
  85. that.setData({
  86. province: _province,
  87. city: _city,
  88. area: _area,
  89. })
  90. // console.log(_province);
  91. // console.log(_city);
  92. // console.log(_area);
  93. } else if (_city == 0 && _Selection == 1) { //判断筛选页面 是否清空数据 同时 是否选中,而不是返回
  94. that.setData({
  95. province: _province,
  96. city: _city,
  97. area: _area,
  98. })
  99. }
  100. var _provincename = app.globalData.provincename // 省
  101. var _cityname = app.globalData.cityname // 市
  102. var _areaname = app.globalData.areaname // 区
  103. if (_provincename && _cityname && _areaname) {
  104. that.setData({
  105. provincename: _provincename,
  106. cityname: _cityname,
  107. areaname: _areaname,
  108. step : 0,
  109. })
  110. // console.log(_provincename);
  111. // console.log(_cityname);
  112. // console.log(_areaname);
  113. } else if (_cityname == 0 && _Selection == 1) { //判断筛选页面 是否清空数据 同时 是否选中,而不是返回
  114. that.setData({
  115. provincename: _provincename,
  116. cityname: _cityname,
  117. areaname: _areaname,
  118. step: 0,
  119. })
  120. }
  121. // that.setData({
  122. // // nickname: that.options.nickname, //姓名
  123. // age: that.options.age, // 年龄
  124. // height: that.options.height, // 身高
  125. // // province: that.options.province, // 市
  126. // // city: that.options.city, // 市
  127. // // area: that.options.area, // 区
  128. // education: that.options.education, // 学历
  129. // income: that.options.income, // 收入
  130. // });
  131. // 年龄 ajax
  132. let Age_url = 'public/paramsgather?type=age';
  133. let Age_data = {};
  134. if (app.globalData.age){ //判断 是否从筛选页面传来的参数
  135. // console.log(app.globalData.age);
  136. var _age = app.globalData.age // 年龄
  137. var agenewArry = _age.split("-"); //转成数组
  138. var _age_min = agenewArry[0]
  139. var _age_max = agenewArry[1]
  140. // console.log(_age_min)
  141. // console.log(_age_max)
  142. that.setData({
  143. Ageid: 0,
  144. age: _age
  145. })
  146. } else if (app.globalData.age == 0 && _Selection == 1) { //判断筛选页面 是否清空数据 同时 是否选中,而不是返回
  147. var _age = app.globalData.age // 年龄
  148. that.setData({
  149. age: _age,
  150. Ageid :0,
  151. AgeIndex: ['', '']
  152. })
  153. }
  154. app.postRequest(Age_url, Age_data, function (res) { // 年龄 ajax
  155. if (res.code == 201) {
  156. if (app.globalData.age){
  157. for (let i = 0; i < res.data.length; i++) { //已选中的数据处理
  158. if (res.data[i] == _age_min) { var _min = i; }
  159. if (res.data[i] == _age_max) { var _max = i; }
  160. that.setData({
  161. AgeIndex: [_min, _max]
  162. })
  163. }
  164. }
  165. let dictObject = res.data; //对象不能直接使用 以下转成数组
  166. // 对象转成数组
  167. var createArr = []
  168. for (let i in dictObject) {
  169. createArr.push(dictObject[i] + "岁");
  170. }
  171. that.setData({
  172. AgeArray: [createArr, createArr],
  173. })
  174. // console.log(createArr);
  175. }
  176. })
  177. // 身高 ajax
  178. let height_url = 'public/paramsgather?type=height';
  179. let height_data = {
  180. pid: '0'
  181. };
  182. if (app.globalData.height) { //判断 是否从筛选页面传来的参数
  183. // console.log(app.globalData.height);
  184. var _height = app.globalData.height // 身高
  185. var heightnewArry = _height.split("-"); //转成数组
  186. var heightSmall = heightnewArry[0]
  187. var heightlarge = heightnewArry[1]
  188. // console.log(heightSmall)
  189. // console.log(heightlarge)
  190. that.setData({
  191. height: _height,
  192. heightid:0
  193. })
  194. } else if (app.globalData.height == 0 && _Selection == 1) { //判断筛选页面 是否清空数据 同时 是否选中,而不是返回
  195. var _height = app.globalData.height // 身高
  196. that.setData({
  197. height: _height,
  198. heightid: 0,
  199. heightindex: ['', ''], // 身高-下标
  200. })
  201. }
  202. app.postRequest(height_url, height_data, function (res) { // 身高 ajax
  203. if (res.code == 201) {
  204. if (app.globalData.height) {
  205. for (let i = 0; i < res.data.length; i++) { //已选中的数据处理
  206. // console.log(res.data[i])
  207. if (res.data[i] == heightSmall) { var _min = i; }
  208. if (res.data[i] == heightlarge) { var _max = i; }
  209. that.setData({
  210. heightindex: [_min, _max]
  211. })
  212. }
  213. }
  214. let dictObject = res.data; //对象不能直接使用 以下转成数组
  215. // 对象转成数组
  216. var createArr = []
  217. for (let i in dictObject) {
  218. createArr.push(dictObject[i] + "cm");
  219. }
  220. // console.log(createArr);
  221. that.setData({
  222. heightArray: [createArr, createArr],
  223. })
  224. }
  225. })
  226. // 婚史 ajax
  227. let Marriage_url = 'public/paramsgather?type=marriage';
  228. let Marriage_data = {};
  229. if (app.globalData.marry) { //判断 是否从筛选页面传来的参数
  230. // console.log(app.globalData.marry);
  231. var _marry = app.globalData.marry // 婚姻
  232. that.setData({
  233. marry: _marry
  234. })
  235. } else if (app.globalData.marry == 0 && _Selection == 1) { //判断筛选页面 是否清空数据 同时 是否选中,而不是返回
  236. var _marry = app.globalData.marry // 婚姻
  237. that.setData({
  238. marry: _marry,
  239. Marriageindex: "", // 身高-下标
  240. })
  241. }
  242. app.postRequest(Marriage_url, Marriage_data, function (res) { // 婚史 ajax
  243. if (res.code == 201) {
  244. if (app.globalData.marry) {
  245. for (let i = 0; i < res.data.length; i++) { //已选中的数据处理
  246. if (i == _marry) {
  247. that.setData({
  248. Marriageindex: i,
  249. })
  250. }
  251. }
  252. }
  253. that.setData({
  254. MarriageArray: res.data
  255. })
  256. }
  257. })
  258. // 学历 ajax
  259. let Education_url = 'public/paramsgather?type=xueli';
  260. let Education_data = {};
  261. if (app.globalData.education) { //判断 是否从筛选页面传来的参数
  262. // console.log(app.globalData.marry);
  263. var _education = app.globalData.education // 学历
  264. that.setData({
  265. education: _education
  266. })
  267. } else if (app.globalData.education == 0 && _Selection == 1) { //判断筛选页面 是否清空数据 同时 是否选中,而不是返回
  268. var _education = app.globalData.education // 学历
  269. that.setData({
  270. education: _education,
  271. Educationindex: "", // 学历-下标
  272. })
  273. }
  274. app.postRequest(Education_url, Education_data, function (res) { // 学历 ajax
  275. if (res.code == 201) {
  276. if (app.globalData.education) {
  277. for (let i = 0; i < res.data.length; i++) { //已选中的数据处理
  278. if (res.data[i].id == _education) {
  279. that.setData({
  280. Educationindex: i,
  281. })
  282. }
  283. }
  284. }
  285. that.setData({
  286. EducationArray: res.data
  287. })
  288. }
  289. })
  290. that.getProvince(); //地址 ajax
  291. that.list();
  292. },
  293. // 会员编码
  294. getPhone: function (e) {
  295. var nickname = e.detail.value;
  296. console.log(nickname);
  297. this.setData({
  298. nickname: nickname
  299. });
  300. },
  301. // 会员编码查询
  302. Code: function (e) {
  303. var that = this;
  304. // 判断会员编码是否存在
  305. if (that.data.nickname){
  306. that.showLoading(); //提示加载中
  307. // 列表信息
  308. let home_url = 'circle/friend/home';
  309. let home_data = {
  310. page: that.data.page,
  311. limit: that.data.limit,
  312. number: that.data.nickname, // 性别
  313. };
  314. app.postRequest(home_url, home_data, function (res) {
  315. if (res.code == 201) {
  316. // console.log(res.data);
  317. that.setData({
  318. home: res.data,
  319. })
  320. that.cancelLoading(); //数据加载完关闭
  321. return;
  322. }
  323. that.cancelLoading(); //数据加载完关闭
  324. that.setData({
  325. home_code: res.code,
  326. morehide: true,
  327. moreTxt: '暂无更多数据。'
  328. })
  329. })
  330. }else{
  331. var fail = '请输入会员编号' //调用提示框
  332. getApp().Tips(fail)
  333. }
  334. },
  335. heightEvent: function (e) { // 身高
  336. var that = this;
  337. // console.log(this);
  338. // console.log(e);
  339. // console.log(this.data.heightArray[e.detail.value]);
  340. // console.log('picker发送选择改变,携带值为', e.detail.value)
  341. var heightSmall = this.data.heightArray[0][e.detail.value[0]].substring(0, 3);
  342. var heightlarge = this.data.heightArray[1][e.detail.value[1]].substring(0, 3);
  343. var heightdata = heightSmall + '-' + heightlarge;
  344. // console.log(heightdata)
  345. this.setData({
  346. heightindex: e.detail.value,
  347. height: heightdata,
  348. heightid: 1,
  349. })
  350. that.list();
  351. },
  352. // 年龄双选
  353. AgeEvent: function (e) {
  354. var that = this;
  355. // console.log('picker发送选择改变,携带值为', e.detail.value)
  356. var Small = this.data.AgeArray[0][e.detail.value[0]].substring(0, 2);
  357. var large = this.data.AgeArray[1][e.detail.value[1]].substring(0, 2);
  358. var Agedata = Small + '-' + large;
  359. // console.log(Agedata);
  360. this.setData({
  361. AgeIndex: e.detail.value,
  362. age: Agedata,
  363. Ageid: 1,
  364. page:1,
  365. })
  366. that.list(); //调用筛选
  367. },
  368. MarriageEvent: function (e) { // 婚史 单项选择器
  369. var that = this;
  370. // console.log(this);
  371. // console.log(e);
  372. // console.log(this.data.MarriageArray[e.detail.value]);
  373. // console.log('picker发送选择改变,携带值为', e.detail.value)
  374. this.setData({
  375. Marriageindex: e.detail.value,
  376. marry: e.detail.value,
  377. page: 1,
  378. })
  379. that.list(); //调用筛选
  380. },
  381. EducationEvent: function (e) { // 学历 单项选择器
  382. var that = this;
  383. // console.log(this);
  384. // console.log(e);
  385. // console.log(this.data.EducationArray[e.detail.value].id);
  386. // console.log('picker发送选择改变,携带值为', e.detail.value)
  387. this.setData({
  388. Educationindex: e.detail.value,
  389. education: this.data.EducationArray[e.detail.value].id,
  390. page: 1,
  391. })
  392. that.list(); //调用筛选
  393. },
  394. // 列表切换
  395. // filterTab: function (e) {
  396. // var data = [true, true, true, true], qhid = e.currentTarget.dataset.qhid;
  397. // // console.log(e.currentTarget.dataset.qhid);
  398. // data[qhid] = !this.data.tab[qhid];
  399. // // console.log(!this.data.tab[qhid]);
  400. // this.setData({
  401. // tab: data,
  402. // })
  403. // },
  404. getProvince() { // 多项选择器
  405. let _this = this;
  406. let d_url = 'public/citypid';
  407. app.postRequest(d_url, { pid: '0' }, function (res) {
  408. if (res.code == '201') {
  409. var provinceList = res.data;
  410. var provinceArr = [];
  411. provinceArr = _this.mapArray(res.data);
  412. _this.setData({
  413. multiArray: [provinceArr, [], []],
  414. provinceList,
  415. provinceArr,
  416. })
  417. // console.log(provinceList);
  418. // console.log(provinceArr);
  419. // console.log(_this.data.CityRecord)
  420. // 方便取消事件调用 getProvince 判断 如果选择过城市 传选择过的城市
  421. if (_this.data.CityRecord) {
  422. // console.log('有');
  423. var defaultCode = _this.data.CityRecord
  424. if (defaultCode) {
  425. _this.setData({
  426. currnetProvinceKey: defaultCode
  427. })
  428. _this.getCity(defaultCode)
  429. }
  430. } else { //如果没有选择过 , 传第一个城市
  431. // console.log('无');
  432. var defaultCode = provinceList[0]['area_id']
  433. if (defaultCode) {
  434. _this.setData({
  435. currnetProvinceKey: defaultCode
  436. })
  437. _this.getCity(defaultCode)
  438. }
  439. }
  440. }
  441. })
  442. },
  443. getCity(codes) {
  444. // 多项选择
  445. let _this = this;
  446. let d_url = 'public/citypid';
  447. app.postRequest(d_url, { pid: codes }, function (res) {
  448. var cityList = res.data;
  449. var cityArr = [];
  450. if (res.code == '201') {
  451. cityArr = _this.mapArray(res.data);
  452. _this.setData({
  453. multiArray: [_this.data.provinceArr, cityArr, []],
  454. cityArr,
  455. cityList
  456. })
  457. // 方便取消事件调用 getProvince 判断 如果选择过城市 传选择过的城市
  458. if (_this.data.areaRecord && _this.data.cancelID == false) {
  459. // console.log('有');
  460. var defaultCode = _this.data.areaRecord
  461. // console.log(_this.data.areaRecord);
  462. if (defaultCode) {
  463. _this.setData({
  464. currnetProvinceKey: defaultCode
  465. })
  466. _this.getArea(defaultCode)
  467. }
  468. } else { //如果没有选择过 , 传第一个城市
  469. // console.log('无');
  470. var defaultCode = cityList[0]['area_id']
  471. // console.log(defaultCode);
  472. if (defaultCode) {
  473. _this.setData({
  474. currnetProvinceKey: defaultCode
  475. })
  476. _this.getArea(defaultCode)
  477. }
  478. }
  479. }
  480. })
  481. },
  482. getArea(codes) {
  483. // 多项选择
  484. let _this = this;
  485. let d_url = 'public/citypid';
  486. app.postRequest(d_url, { pid: codes }, function (res) {
  487. var areaList = res.data;
  488. var areaArr = [];
  489. if (res.code == '201') {
  490. areaArr = _this.mapArray(res.data);
  491. }
  492. // console.log(areaList);
  493. // console.log(areaArr);
  494. _this.setData({
  495. multiArray: [_this.data.provinceArr, _this.data.cityArr, areaArr],
  496. areaList,
  497. areaArr,
  498. })
  499. _this.setData({
  500. cancelID: true,
  501. })
  502. })
  503. },
  504. mapArray: function (data) {
  505. let cityArray = []
  506. if (data) {
  507. for (let i = 0; i < data.length; i++) {
  508. if (data[i].area_name) {
  509. cityArray[i] = data[i].area_name;
  510. }
  511. }
  512. }
  513. return cityArray;
  514. },
  515. columnchange(e) { // 滚动选择器 触发的事件
  516. var column = e.detail.column // 当前改变的列
  517. // console.log(column);
  518. // console.log(this.data.multiIndex);
  519. // console.log(JSON.parse(JSON.stringify(this.data.multiIndex)));
  520. var data = {
  521. multiIndex: this.data.multiIndex,
  522. multiArray: this.data.multiArray
  523. }
  524. data.multiIndex[column] = e.detail.value; // 第几列改变了就是对应multiIndex的第几个,更新它
  525. switch (column) { // 处理不同的逻辑
  526. case 0: // 第一列更改 就是省级的更改
  527. var currentProvinceKey = this.data.provinceList[e.detail.value].area_id
  528. if (currentProvinceKey != this.data.currnetProvinceKey) { // 判断当前的key是不是真正的更新了
  529. this.getCity(currentProvinceKey) // 获取当前key下面的市级数据
  530. }
  531. data.multiIndex[1] = 0 // 将市默认选择第一个
  532. break;
  533. case 1: // 市发生变化
  534. var currentCitykey = this.data.cityList[e.detail.value].area_id
  535. if (currentCitykey != this.data.currnetCityKey) { // 同样判断
  536. this.getArea(currentCitykey) // 获取门店
  537. }
  538. data.multiIndex[2] = 0
  539. break;
  540. }
  541. this.setData(data) // 更新数据
  542. // console.log(this.data.step)
  543. },
  544. pickchange(e) {
  545. var that =this;
  546. // console.log(that.data.multiIndex);
  547. // console.log(that.data.provinceList[e.detail.value[0]].area_id);
  548. // console.log(that.data.cityList[e.detail.value[1]].area_id);
  549. // console.log(that.data.areaList[e.detail.value[2]].area_id);
  550. that.setData({
  551. step: 1, // 更新,用来选择用户选中的门店
  552. multiIndex: e.detail.value, // 更新下标字段
  553. province: that.data.provinceList[e.detail.value[0]].area_id, // 市
  554. city: that.data.cityList[e.detail.value[1]].area_id, // 市
  555. area: that.data.areaList[e.detail.value[2]].area_id, // 区
  556. provincename: that.data.provinceList[e.detail.value[0]].area_name, // 市
  557. cityname: that.data.cityList[e.detail.value[1]].area_name, // 市
  558. areaname: that.data.areaList[e.detail.value[2]].area_name, // 区
  559. CityRecord: that.data.provinceList[e.detail.value[0]].area_id, // 省
  560. areaRecord: that.data.cityList[e.detail.value[1]].area_id, // 市
  561. CityRecordid: that.data.multiIndex,
  562. UsedRecord: true, //已使用过
  563. })
  564. that.list();
  565. },
  566. // 城市取消
  567. cancel: function (e) {
  568. var _this = this;
  569. if (_this.data.UsedRecord == true) {
  570. _this.setData({
  571. multiIndex: _this.data.CityRecordid,
  572. cancelID: false
  573. })
  574. // console.log(_this.data.CityRecordid);
  575. _this.getProvince(); //地址 ajax
  576. }
  577. },
  578. // 上拉加载更多
  579. onReachBottom() {
  580. var that = this;
  581. that.showLoading(); //提示加载中
  582. // 列表信息
  583. let home_url = 'circle/friend/home';
  584. let home_data = {
  585. page: (that.data.page++) + 1,
  586. limit: that.data.limit,
  587. height: that.data.height, // 身高
  588. age: that.data.age, // 年龄
  589. marry: that.data.marry, // 婚史
  590. education: that.data.education, // 学历
  591. // province: that.data.province, // 市
  592. city: that.data.city, // 市
  593. // area: that.data.area, // 区
  594. };
  595. app.postRequest(home_url, home_data, function (res) {
  596. if (res.code == 201) {
  597. // console.log(res.data);
  598. var home = that.data.home
  599. var moreTxt = '';
  600. if (0 < (res.data.length < 10)) {
  601. moreTxt = '暂无更多数据。'
  602. console.log('无')
  603. } else {
  604. moreTxt = ''
  605. console.log('有')
  606. }
  607. // 设置数据
  608. for (var i = 0; i < res.data.length; i++) {
  609. home.push(res.data[i]);
  610. }
  611. that.setData({
  612. home: home,
  613. morehide: true,
  614. moreTxt: moreTxt,
  615. })
  616. that.cancelLoading(); //数据加载完关闭
  617. return;
  618. }
  619. that.cancelLoading(); //数据加载完关闭
  620. that.setData({
  621. home_code: res.code,
  622. morehide: true,
  623. moreTxt:"暂无更多数据。"
  624. })
  625. })
  626. },
  627. More:function(){
  628. var that = this;
  629. // console.log(that.data.age);
  630. wx.navigateTo({
  631. url: '/pages/index_screen/index_screen?age=' + that.data.age + '&height=' + that.data.height + '&marry=' + that.data.marry + '&education=' + that.data.education + '&income=' + that.data.income + '&province=' + that.data.province + '&city=' + that.data.city + '&area=' + that.data.area + '&provincename=' + that.data.provincename + '&cityname=' + that.data.cityname + '&areaname=' + that.data.areaname + ''
  632. })
  633. },
  634. list: function () {
  635. var that = this;
  636. that.showLoading(); //提示加载中
  637. // 列表信息
  638. let home_url = 'circle/friend/home';
  639. let home_data = {
  640. page: that.data.page,
  641. limit: that.data.limit,
  642. age: that.data.age, // 年龄
  643. height: that.data.height, // 身高
  644. marry: that.data.marry, // 婚史
  645. education: that.data.education, // 学历
  646. income: that.data.income, //收入
  647. // province: that.data.province , // 市
  648. city: that.data.city, // 市
  649. // area: that.data.area, // 区
  650. };
  651. app.postRequest(home_url, home_data, function (res) {
  652. if (res.code == 201) {
  653. var moreTxt = '';
  654. if (res.data.length < 10) {
  655. moreTxt = '暂无更多数据。'
  656. } else {
  657. moreTxt = ''
  658. }
  659. console.log(res.data);
  660. that.setData({
  661. home: res.data,
  662. moreTxt: moreTxt,
  663. home_code: res.code,
  664. })
  665. that.cancelLoading(); //数据加载完关闭
  666. return;
  667. }
  668. that.cancelLoading(); //数据加载完关闭
  669. that.setData({
  670. home: res.data,
  671. morehide: true,
  672. moreTxt: '暂无更多数据。'
  673. })
  674. })
  675. },
  676. // 加载
  677. showLoading: function () {
  678. wx.showToast({
  679. title: '加载中',
  680. icon: 'loading'
  681. });
  682. },
  683. // 关闭加载
  684. cancelLoading: function () {
  685. wx.hideToast();
  686. }
  687. })