index_screen.js 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880
  1. const app = getApp();
  2. Page({
  3. data: {
  4. Ageid: 0,
  5. AgeArray: [], // 年龄-数据
  6. AgeIndex: [0, 0], // 年龄-下标
  7. heightid: 0,
  8. heightArray: [], // 身高-数据
  9. heightindex: [0, 0], // 身高-下标
  10. EducationArray: [], // 学历-数据
  11. Educationindex: '', // 学历-下标
  12. // MarriageArray: [], // 婚史-数据
  13. // Marriageindex: '', // 婚史-下标
  14. incomeid: 0,
  15. incomeArray: [], // 收入-数据
  16. incomeindex: [0, 0], // 收入-下标
  17. inputValue: '', // id
  18. age: '', // 年龄
  19. height: '', // 身高
  20. // marry: '', // 婚史
  21. // idmarry: 0,
  22. education: '', // 学历
  23. educationid: 0,
  24. income: 0, // 收入
  25. Zero:0, //处理不限
  26. Zero1: 0, //处理不限
  27. heightZero: 0, //处理不限
  28. heightZero1: 0, //处理不限
  29. incomeZero:0,
  30. incomeZero1:0,
  31. // min = '';
  32. // max = '';
  33. // 省市区
  34. city: 0, // 市 要传的数据
  35. provinceName: '', // 省 要传的数据
  36. cityName: '', // 市 要传的数据
  37. areaName: '', // 区 要传的数据
  38. provincedata: '', //省数据
  39. provinceid: 1, //省选中ID
  40. provincetext: '北京', //省 名字
  41. citydata: '', //市数据
  42. cityidx: '', //市选中ID
  43. citytext: '', //市 名字
  44. areadata: '', //区数据
  45. scrolltop: '', //市区滚动条
  46. hiddenName: true, //显示隐藏
  47. },
  48. onLoad: function (option) {
  49. var that = this
  50. // console.log(option)
  51. //先清空要传的数据
  52. app.globalData.Selection = 0; // 是否选中
  53. app.globalData.age = 0; // 年龄
  54. app.globalData.height = 0; // 身高
  55. // app.globalData.marry = 0 // 婚史
  56. app.globalData.education = 0 // 学历
  57. app.globalData.income = 0; // 收入
  58. var _city = option.city // 市
  59. var _provincename = option.provinceName // 省
  60. var _cityname = option.cityName // 市
  61. var _areaname = option.areaName // 区
  62. // var _idmarry = option.idmarry
  63. var _educationid = option.educationid
  64. that.setData({
  65. city: _city,
  66. provinceName: _provincename, // 省
  67. cityName: _cityname, // 市
  68. areaName: _areaname, // 区
  69. // idmarry: _idmarry,
  70. educationid: _educationid,
  71. })
  72. // console.log(that.data.city)
  73. // console.log(that.data.provinceName)
  74. // console.log(that.data.cityName)
  75. // console.log(that.data.areaName)
  76. // 年龄 ajax
  77. let Age_url = 'public/paramsgather?type=age';
  78. let Age_data = {};
  79. var _age = option.age // 年龄
  80. var agenewArry = _age.split("-"); //转成数组
  81. var _age_min = agenewArry[0]
  82. var _age_max = agenewArry[1]
  83. // console.log(_age_min)
  84. // console.log(_age_max)
  85. that.setData({
  86. age: _age
  87. })
  88. app.postRequest(Age_url, Age_data, function (res) { // 年龄 ajax
  89. if (res.code == 201) {
  90. let newarray = ['不限'];
  91. var res_data = newarray.concat(res.data); //在原有的数据上 凭借上 不限
  92. let newarray1 = ['以上'];
  93. var res_data1 = newarray1.concat(res.data); //在原有的数据上 凭借上 以上
  94. let min = data_processing(res_data, _age_min); //已选中的数据处理 min
  95. let max = data_processing(res_data1, _age_max); //已选中的数据处理 max
  96. if (min == 0 && max == 0){
  97. that.setData({
  98. AgeIndex: [min, max],
  99. Zero:1,
  100. })
  101. }else{
  102. that.setData({
  103. AgeIndex: [min, max],
  104. Zero:0,
  105. })
  106. }
  107. let dictObject = res.data; //对象不能直接使用 以下转成数组
  108. // 对象转成数组
  109. var createArr = []
  110. for (let i in dictObject) {
  111. createArr.push(dictObject[i] + "岁"); //在数据后面凭借 岁
  112. }
  113. let bx = ['不限'];
  114. var Unlimited = bx.concat(createArr); //在原有的数据上 凭借上 不限
  115. let ys = ['以上'];
  116. var Above = ys.concat(createArr); //在原有的数据上 凭借上 以上
  117. that.setData({
  118. AgeArray: [Unlimited, Above],
  119. })
  120. // console.log(createArr);
  121. }
  122. })
  123. // 身高 ajax
  124. let height_url = 'public/paramsgather?type=height';
  125. let height_data = {
  126. pid: '0'
  127. };
  128. var _height = option.height // 身高
  129. var heightnewArry = _height.split("-"); //转成数组
  130. var heightSmall = heightnewArry[0]
  131. var heightlarge = heightnewArry[1]
  132. // console.log(heightSmall)
  133. // console.log(heightlarge)
  134. that.setData({
  135. height: _height
  136. })
  137. app.postRequest(height_url, height_data, function (res) { // 身高 ajax
  138. if (res.code == 201) {
  139. let newarray = ['不限'];
  140. var res_data = newarray.concat(res.data); //在原有的数据上 凭借上 不限
  141. let newarray1 = ['以上'];
  142. var res_data1 = newarray1.concat(res.data); //在原有的数据上 凭借上 以上
  143. let min = data_processing(res_data, heightSmall); //已选中的数据处理 min
  144. let max = data_processing(res_data1, heightlarge); //已选中的数据处理 max
  145. if (min == 0 && max == 0) {
  146. that.setData({
  147. heightindex: [min, max],
  148. heightZero: 1,
  149. })
  150. } else {
  151. that.setData({
  152. heightindex: [min, max],
  153. heightZero: 0,
  154. })
  155. }
  156. let dictObject = res.data; //对象不能直接使用 以下转成数组
  157. // 对象转成数组
  158. var createArr = []
  159. for (let i in dictObject) {
  160. createArr.push(dictObject[i] + "cm");
  161. }
  162. let bx = ['不限'];
  163. var Unlimited = bx.concat(createArr);
  164. let ys = ['以上'];
  165. var Above = ys.concat(createArr);
  166. // console.log(createArr);
  167. that.setData({
  168. heightArray: [Unlimited, Above],
  169. })
  170. }
  171. })
  172. // 婚史 ajax
  173. // let Marriage_url = 'public/paramsgather?type=marriage';
  174. // let Marriage_data = {
  175. // pid: '0'
  176. // };
  177. // var _marry = option.marry // 婚史
  178. // // console.log(_marry)
  179. // that.setData({
  180. // marry: _marry
  181. // })
  182. // app.postRequest(Marriage_url, Marriage_data, function (res) { // 婚史 ajax
  183. // if (res.code == 201) {
  184. // // console.log(res.data);
  185. // for (let i = 0; i < res.data.length; i++) { //已选中的数据处理
  186. // if (i == _marry) {
  187. // that.setData({
  188. // Marriageindex: i,
  189. // })
  190. // }
  191. // }
  192. // that.setData({
  193. // MarriageArray: res.data,
  194. // idmarry: that.data.idmarry,
  195. // })
  196. // }
  197. // })
  198. // 学历 ajax
  199. let Education_url = 'public/paramsgather?type=xueli';
  200. let Education_data = {
  201. // pid: '0'
  202. };
  203. var _education = option.education // 学历
  204. // console.log(_education)
  205. that.setData({
  206. education: _education
  207. })
  208. app.postRequest(Education_url, Education_data, function (res) { // 学历 ajax
  209. if (res.code == 201) {
  210. // console.log(res.data);
  211. var obj = { id: 0, education_name: '不限' };
  212. var datares = res.data;
  213. datares.unshift(obj)
  214. for (let i = 0; i < datares.length; i++) { //已选中的数据处理
  215. if (datares[i].id == _education) {
  216. that.setData({
  217. Educationindex: i,
  218. })
  219. }
  220. }
  221. that.setData({
  222. EducationArray: datares,
  223. educationid: that.data.educationid
  224. })
  225. }
  226. })
  227. // 收入 ajax
  228. let income_url = 'public/paramsgather?type=shouru1';
  229. let income_data = {
  230. // pid: '0'
  231. };
  232. var _income = option.income // 收入
  233. var incomenewArry = _income.split("-"); //转成数组
  234. var incomemin = incomenewArry[0];
  235. var incomemax = incomenewArry[1];
  236. that.setData({
  237. income: _income
  238. })
  239. app.postRequest(income_url, income_data, function (res) { // 收入 ajax
  240. if (res.code == 201) {
  241. let newarray = ['不限'];
  242. var res_data = newarray.concat(res.data); //在原有的数据上 凭借上 不限
  243. let newarray1 = ['以上'];
  244. var res_data1 = newarray1.concat(res.data); //在原有的数据上 凭借上 以上
  245. var min = data_processing(res_data, incomemin); //已选中的数据处理 min
  246. var max = data_processing(res_data1, incomemax); //已选中的数据处理 max
  247. if (min == 0 && max == 0) {
  248. that.setData({
  249. incomeindex: [min, max],
  250. incomeZero: 1,
  251. })
  252. } else {
  253. that.setData({
  254. incomeindex: [min, max],
  255. incomeZero: 0,
  256. })
  257. }
  258. that.setData({
  259. incomeArray: [res_data, res_data1],
  260. })
  261. }
  262. })
  263. },
  264. // 年龄双选
  265. AgeEvent: function (e) {
  266. var that= this;
  267. // console.log('picker发送选择改变,携带值为', e.detail.value)
  268. var _value = e.detail.value; //发送选择改变,携带值为
  269. var Small = this.data.AgeArray[0][e.detail.value[0]].substring(0, 2);
  270. var large = this.data.AgeArray[1][e.detail.value[1]].substring(0, 2);
  271. // console.log(Agedata);
  272. if (Small > large && Small != '不限' && large != '以上') { //判断 最小值 大于 最大值 数据互换
  273. // console.log('调换')
  274. var Agedata = large + '-' + Small;
  275. that.Exchange(_value); // 调用数组调换
  276. } else {
  277. var Agedata = Small + '-' + large; //否则正常选中
  278. }
  279. if (Small == '不限' && large == '以上'){
  280. that.setData({
  281. Zero1: 1
  282. })
  283. }else{
  284. that.setData({
  285. Zero1:0
  286. })
  287. }
  288. this.setData({
  289. AgeIndex: _value,
  290. age: Agedata,
  291. Ageid: 1,
  292. })
  293. },
  294. // 数组数据调换
  295. Exchange: function (data) {
  296. for (var i = 0; i < data.length / 2; i++) {
  297. var data_i = data[i];
  298. data[i] = data[data.length - 1 - i];
  299. data[data.length - 1 - i] = data_i;
  300. }
  301. return;
  302. },
  303. heightEvent: function (e) { // 身高
  304. var that = this;
  305. // console.log(this);
  306. // console.log(e);
  307. // console.log(this.data.heightArray[e.detail.value]);
  308. // console.log('picker发送选择改变,携带值为', e.detail.value)
  309. var _value = e.detail.value; //发送选择改变,携带值为
  310. var heightSmall = this.data.heightArray[0][e.detail.value[0]].substring(0, 3);
  311. var heightlarge = this.data.heightArray[1][e.detail.value[1]].substring(0, 3);
  312. // console.log(heightdata)
  313. if (heightSmall > heightlarge && heightSmall != '不限' && heightlarge != '以上') { //判断 最小值 大于 最大值 数据互换
  314. // console.log('调换')
  315. var heightdata = heightlarge + '-' + heightSmall;
  316. that.Exchange(_value); // 调用数组调换
  317. } else {
  318. var heightdata = heightSmall + '-' + heightlarge;
  319. }
  320. if (heightSmall == '不限' && heightlarge == '以上') {
  321. that.setData({
  322. heightZero1: 1
  323. })
  324. } else {
  325. that.setData({
  326. heightZero1: 0
  327. })
  328. }
  329. that.setData({
  330. heightindex: _value,
  331. height: heightdata,
  332. heightid: 1,
  333. })
  334. },
  335. // MarriageEvent: function (e) { // 婚史 单项选择器
  336. // // console.log(this);
  337. // // console.log(e);
  338. // // console.log(this.data.MarriageArray[e.detail.value]);
  339. // // console.log('picker发送选择改变,携带值为', e.detail.value)
  340. // this.setData({
  341. // Marriageindex: e.detail.value,
  342. // marry: e.detail.value,
  343. // idmarry: 1,
  344. // })
  345. // },
  346. EducationEvent: function (e) { // 学历 单项选择器
  347. // console.log(this);
  348. // console.log(e);
  349. // console.log(this.data.EducationArray[e.detail.value].id);
  350. // console.log('picker发送选择改变,携带值为', e.detail.value)
  351. this.setData({
  352. Educationindex: e.detail.value,
  353. education: this.data.EducationArray[e.detail.value].id,
  354. educationid: 1,
  355. })
  356. },
  357. incomeEvent: function (e) { // 收入 单项选择器
  358. var that = this;
  359. // console.log(this);
  360. // console.log(e);
  361. // console.log(this.data.incomeArray[e.detail.value].id);
  362. // console.log('picker发送选择改变,携带值为', e.detail.value)
  363. var _value = e.detail.value; //发送选择改变,携带值为
  364. var srSmall = this.data.incomeArray[0][e.detail.value[0]];
  365. var srlarge = this.data.incomeArray[1][e.detail.value[1]];
  366. // console.log(Agedata);
  367. if (srSmall > srlarge && srSmall != '不限' && srlarge != '以上') { //判断 最小值 大于 最大值 数据互换
  368. // console.log('调换')
  369. var srdata = srlarge + '-' + srSmall;
  370. that.Exchange(_value); // 调用数组调换
  371. } else {
  372. var srdata = srSmall + '-' + srlarge; //否则正常选中
  373. }
  374. if (srSmall == '不限' && srlarge == '以上') {
  375. that.setData({
  376. incomeZero1: 1
  377. })
  378. } else {
  379. that.setData({
  380. incomeZero1: 0
  381. })
  382. }
  383. that.setData({
  384. incomeindex: _value,
  385. income: srdata,
  386. incomeid: 1,
  387. })
  388. },
  389. // 会员编码
  390. getPhone: function (e) {
  391. var _inputValue = e.detail.value;
  392. // console.log(_inputValue);
  393. this.setData({
  394. inputValue: _inputValue
  395. });
  396. },
  397. //下一步事件
  398. register: function (e) {
  399. var _this= this;
  400. //设置全局变量(app已经定义 var app=getApp()) 赋值要传的参数
  401. app.globalData.inputValue = String(_this.data.inputValue); //用户ID
  402. app.globalData.age = String(_this.data.age); // 年龄
  403. app.globalData.height = String(_this.data.height); // 身高
  404. // app.globalData.marry = String(_this.data.marry) // 婚史
  405. // app.globalData.idmarry = String(_this.data.idmarry) // 婚史
  406. app.globalData.education = String(_this.data.education) // 学历
  407. app.globalData.educationid = String(_this.data.educationid) // 学历
  408. app.globalData.income = String(_this.data.income); // 收入
  409. app.globalData.Selection = String(1); // 是否选中 1 选中 0没选中
  410. app.globalData.city = String(_this.data.city); // 市
  411. app.globalData.provinceName = String(_this.data.provinceName); // 省
  412. app.globalData.cityName = String(_this.data.cityName); // 市
  413. app.globalData.areaName = String(_this.data.areaName); // 区
  414. app.globalData.trigger = true; // 搜索或清空
  415. wx.switchTab({
  416. url: '../index/index',
  417. })
  418. _this.setData({
  419. inputValue:'',
  420. })
  421. },
  422. // 重置
  423. Reset: function (e) {
  424. var _this = this;
  425. _this.setData({
  426. AgeIndex: ['', ''], // 年龄-下标
  427. age: 0, // 年龄
  428. Ageid: 0,
  429. heightindex: ['', ''], // 身高-下标
  430. height: 0, //身高
  431. heightid: 0,
  432. // Marriageindex: '', // 婚史-下标
  433. // marry: 0,
  434. // idmarry: 0,
  435. Educationindex: '', //学历
  436. education: 0, //学历
  437. educationid: 0,
  438. incomeindex: ['', ''], //收入
  439. income: 0, //收入
  440. inputValue: '', //ID
  441. city: 0, // 市
  442. provinceName: '', // 省
  443. cityName: '', // 市
  444. areaName: '', // 区
  445. })
  446. app.globalData.inputValue = String(_this.data.inputValue); //用户ID
  447. app.globalData.age = String(_this.data.age); // 年龄
  448. app.globalData.height = String(_this.data.height); // 身高
  449. // app.globalData.marry = String(_this.data.marry) // 婚史
  450. // app.globalData.idmarry = String(_this.data.idmarry) // 婚史
  451. app.globalData.education = String(_this.data.education) // 学历
  452. app.globalData.educationid = String(_this.data.educationid) // 学历
  453. app.globalData.income = String(_this.data.income); // 收入
  454. app.globalData.Selection = String(1); // 是否选中 1 选中 0没选中
  455. app.globalData.city = String(_this.data.city); // 市
  456. app.globalData.provinceName = String(_this.data.provinceName); // 省
  457. app.globalData.cityName = String(_this.data.cityName); // 市
  458. app.globalData.areaName = String(_this.data.areaName); // 区
  459. app.globalData.trigger = true; // 搜索或清空
  460. },
  461. // 省市区三级联动 点击弹窗
  462. linkage: function (e) {
  463. var that = this;
  464. let citypid_url = 'public/citypid';
  465. let citypid_data = {};
  466. app.postRequest(citypid_url, citypid_data, function (res) { // 省市区三级联动 ajax
  467. if (res.code == 201) {
  468. that.setData({
  469. provincedata: res.data, // 省数据
  470. })
  471. // console.log(res.data)
  472. that.provinceOn();
  473. }
  474. })
  475. },
  476. // 省事件
  477. provinceOn: function (e) {
  478. var that = this;
  479. // console.log(e);
  480. if (e) {
  481. that.setData({
  482. provinceid: e.currentTarget.dataset.id, //省ID
  483. provincetext: e.currentTarget.dataset.text, //省名字
  484. })
  485. }
  486. // console.log(that.data.provinceid);
  487. // console.log(that.data.provincetext)
  488. let citypid_url = 'public/citypid';
  489. let citypid_data = {
  490. pid: that.data.provinceid,
  491. };
  492. app.postRequest(citypid_url, citypid_data, function (res) { // 省市区三级联动 ajax
  493. if (res.code == 201) {
  494. that.setData({
  495. hiddenName: false,
  496. citydata: res.data, // 市数据
  497. scrolltop: 0, //市区滚动条
  498. areadata: '', //区域数据清空
  499. cityidx: '', // idx 选中清空
  500. })
  501. // console.log(res.data)
  502. }
  503. })
  504. },
  505. // 市事件
  506. cityOn: function (e) {
  507. var that = this;
  508. var _cityidx = that.data.cityidx
  509. var cityid = e.currentTarget.dataset.id; //市ID
  510. var citytext = e.currentTarget.dataset.text; //市名字
  511. var _index = e.currentTarget.dataset.index + 1; //下标
  512. // console.log(_index);
  513. // console.log(_index*42,);
  514. // console.log(_cityidx);
  515. // console.log(cityid);
  516. that.setData({
  517. cityidx: cityid, // 市 选中
  518. citytext: citytext, // 市 选中名字
  519. areadata: '', //区域数据清空
  520. })
  521. let citypid_url = 'public/citypid';
  522. let citypid_data = {
  523. pid: cityid,
  524. };
  525. app.postRequest(citypid_url, citypid_data, function (res) { // 省市区三级联动 ajax
  526. if (res.code == 201) {
  527. if (_cityidx == cityid) {
  528. that.setData({
  529. areadata: '', // 区数据
  530. cityidx: '', // idx 选中清空
  531. })
  532. } else {
  533. that.setData({
  534. areadata: res.data, // 区数据
  535. scrolltop: _index * 42,
  536. })
  537. // console.log('执行')
  538. // console.log(_index * 42);
  539. }
  540. // console.log(res.data)
  541. }
  542. })
  543. },
  544. //区选中事件
  545. areaOn: function (e) {
  546. var that = this;
  547. var _style = e.currentTarget.dataset.style;
  548. // console.log(_style);
  549. var regionid = e.currentTarget.dataset.id; //传递地区ID
  550. // console.log(regionid);
  551. switch (_style) {
  552. case 'provinceLx':
  553. // console.log('省');
  554. that.setData({
  555. city: regionid,
  556. provinceName: that.data.provincetext, // 省名字
  557. cityName: '', // 市名字清空
  558. areaName: "", // 区名字
  559. })
  560. break;
  561. case 'cityLx':
  562. // console.log('市');
  563. that.setData({
  564. city: regionid,
  565. provinceName: that.data.provincetext, // 省名字
  566. cityName: that.data.citytext, // 省名字
  567. areaName: "", // 区名字
  568. })
  569. break;
  570. case 'areaLx':
  571. // console.log('区');
  572. var areatext = e.currentTarget.dataset.text; //区名字
  573. that.setData({
  574. city: regionid,
  575. provinceName: that.data.provincetext, // 省名字
  576. cityName: that.data.citytext, // 省名字
  577. areaName: areatext, // 区名字
  578. })
  579. break;
  580. }
  581. // console.log(that.data.city)
  582. // console.log(that.data.provinceName)
  583. // console.log(that.data.cityName)
  584. // console.log(that.data.areaName)
  585. //选择完清空
  586. that.setData({
  587. hiddenName: true,
  588. provinceid: 1,
  589. provincetext: '北京', //省 名字
  590. cityidx: 0,
  591. citytext: '',
  592. })
  593. },
  594. //省市区不限 清空
  595. regionBx: function () {
  596. var that = this;
  597. that.setData({
  598. hiddenName: true,
  599. provinceid: 1,
  600. provincetext: '北京', //省 名字
  601. cityidx: 0,
  602. citytext: '',
  603. city: 0, // 市数据清空
  604. provinceName: '', // 省名字
  605. cityName: '', // 市名字清空
  606. areaName: "", // 区名字
  607. })
  608. },
  609. //省市区关闭 清空
  610. Close: function () {
  611. var that = this;
  612. that.setData({
  613. hiddenName: true,
  614. provinceid: 1,
  615. provincetext: '北京', //省 名字
  616. cityidx: 0,
  617. citytext: '',
  618. })
  619. },
  620. })
  621. var data_processing = function (data, min_max,) {
  622. for (let i = 0; i < data.length; i++) { //已选中的数据处理
  623. if (data[i] == min_max) {
  624. return i;
  625. }
  626. }
  627. }