selectCity.vue 23 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841
  1. <template>
  2. <view>
  3. <u-navbar :title="title" @leftClick='back' :placeholder='true'>
  4. </u-navbar>
  5. <view class="row1">
  6. <view class="start-place" :class="type==0?'active1':''" @click="changeCity(0)">选择发货地</view>
  7. <view class="end-place" :class="type==1?'active1':''" @click="changeCity(1)">选择收货地</view>
  8. </view>
  9. <view class="container">
  10. <view class="row2">
  11. <view class="content1" v-if="type==0">
  12. <view class="history-city-title">历史发货地</view>
  13. <view class="city-list">
  14. <view class="city" v-for="(item,index) in historyFcityList" :key='index' @click="historyClick(0,item)">
  15. {{item.selected}}
  16. </view>
  17. </view>
  18. </view>
  19. <view class="content2" v-if="type==1">
  20. <view class="history-city-title">历史收货地</view>
  21. <view class="city-list">
  22. <view class="city" v-for="(item,index) in historyScityList" :key='index' @click="historyClick(1,item)">
  23. {{item.selected}}
  24. </view>
  25. </view>
  26. </view>
  27. </view>
  28. </view>
  29. <view class="page">
  30. <view class="title flex flex-space-between">
  31. <view class="flex nav-bag-left">
  32. <!-- 省 -->
  33. <view class="flex" :class="(type==0?fstatus:sstatus)==0?'select-active':''" @click="titleClick(0)">
  34. <view class="tt point">{{type==0?fchooseprovince:schooseprovince}}</view>
  35. <view v-if="type==0?fchooseprovince:schooseprovince" style="margin: 0 10rpx;">></view>
  36. </view>
  37. <!-- 市 -->
  38. <view class="flex"
  39. v-if="(type==0?fchooseprovince:schooseprovince)!='选择'&&(type==0?fchooseprovince:schooseprovince)!='全国'"
  40. :class="(type==0?fstatus:sstatus)==1?'select-active':''" @click="titleClick(1)">
  41. <view class="tt point nav-point">{{type==0?fchoosecity:schoosecity}}</view>
  42. <view v-if="type==0?fchoosecity:schoosecity" style="margin: 0 10rpx;">></view>
  43. </view>
  44. <!-- 区 -->
  45. <view class="tt area"
  46. v-if="(type==0?fchooseprovince:schooseprovince)!='选择'&&(type==0?fchoosecity:schoosecity)!='请选择市'&&(type==0?fchoosecity:schoosecity)!='全部'"
  47. :class="(type==0?fstatus:sstatus)==2?'select-active':''" @click="titleClick(2)">
  48. {{type==0?fchoosearea:schoosearea}}
  49. </view>
  50. </view>
  51. <view class="back-level" v-if="(type==0?fstatus:sstatus)!=0" @click="backLevel">返回上一级</view>
  52. </view>
  53. <view class="link">
  54. <!-- 省 -->
  55. <view class="container" v-if="(type==0?fstatus:sstatus)==0">
  56. <view class="content-item" :class="index ==(type==0?isfprovince:issprovince) ?'active':''"
  57. @click="selectProvince(item, index,(type==0?fstatus:sstatus))"
  58. v-for="(item,index) in (type==0?fprovincelist:sprovincelist)" :key="index">
  59. {{item.label}}
  60. </view>
  61. </view>
  62. <!-- 市 -->
  63. <view class="container" v-if="(type==0?fstatus:sstatus)==1">
  64. <view class="content-item" :class="index == (type==0?isfcity:isscity)?'active':''"
  65. @click="selectCity(item, index,type==0?fstatus:sstatus)"
  66. v-for="(item,index) in (type==0?fcitylist:scitylist)" :key="index">
  67. {{item.label}}
  68. </view>
  69. </view>
  70. <!-- index ==(type==0?isfarea:issarea) -->
  71. <!-- 区 -->
  72. <view class="container" v-if="(type==0?fstatus:sstatus)==2">
  73. <view class="content-item" :class="item.checked?'active':''"
  74. @click="selectaArea(item, index,(type==0?fstatus:sstatus))"
  75. v-for="(item,index) in (type==0?farealist:sarealist)" :key="index">
  76. {{item.label}}
  77. </view>
  78. </view>
  79. </view>
  80. </view>
  81. <u-button class="btn" @click="confirmBtn">确定</u-button>
  82. <u-toast ref="uToast"></u-toast>
  83. </view>
  84. </template>
  85. <script>
  86. import {
  87. address
  88. } from '@/components/data/data.js'
  89. export default {
  90. data() {
  91. return {
  92. fstatus: 0,
  93. sstatus: 0,
  94. isfprovince: null,
  95. isfcity: null,
  96. isfarea: null,
  97. issprovince: null,
  98. isscity: null,
  99. issarea: null,
  100. fprovincelist: [],
  101. sprovincelist: [],
  102. fcitylist: [],
  103. scitylist: [],
  104. farealist: [],
  105. sarealist: [],
  106. fchooseprovince: '选择',
  107. fchoosecity: '请选择市',
  108. fchoosearea: '请选择区',
  109. schooseprovince: '选择',
  110. schoosecity: '请选择市',
  111. schoosearea: '请选择区',
  112. heightCot: 0,
  113. historyFcityList: [],
  114. historyScityList: [],
  115. title: '',
  116. type: 0,
  117. count: 0,
  118. ftitle: '',
  119. ftitleList:[],
  120. stitleList:[],
  121. stitle: '',
  122. selectList: [],
  123. }
  124. },
  125. created() {
  126. this.fprovincelist = address
  127. this.sprovincelist = address
  128. console.log('---------------------------------')
  129. console.log(this.type)
  130. },
  131. onLoad(options) {
  132. console.log(options)
  133. this.type = options.type
  134. this.title = JSON.parse(options.startPlace).selected + '→' + JSON.parse(options.endPlace).selected
  135. //获取缓存收发地
  136. if (uni.getStorageSync('fPlaceList')) {
  137. this.historyFcityList = uni.getStorageSync('fPlaceList');
  138. } else {
  139. this.historyFcityList = []
  140. }
  141. if (uni.getStorageSync('sPlaceList')) {
  142. this.historyScityList = uni.getStorageSync('sPlaceList');
  143. } else {
  144. this.historyScityList = []
  145. }
  146. //赋值地区
  147. },
  148. methods: {
  149. historyClick(type,val){
  150. console.log(type)
  151. if(type==0){
  152. this.historyFcityList.unshift(val)
  153. let _newList = this.makeHistoryList(val)
  154. uni.setStorageSync('fPlaceList', _newList);
  155. uni.setStorageSync('fPlaceObj', val);
  156. }else{
  157. this.historyScityList.unshift(val)
  158. let _newList = this.makeHistoryList(val)
  159. uni.setStorageSync('sPlaceList', _newList);
  160. uni.setStorageSync('sPlaceObj',val )
  161. }
  162. uni.switchTab({
  163. url: '/pages/goodSource/index'
  164. });
  165. },
  166. // 历史收发地去重
  167. makeHistoryList(val) {
  168. if (this.type == 0) {
  169. let _obj = {}
  170. // for (let i = 0; i < this.historyScityList.length; i++) {
  171. // // let _data = this.historyScityList[i]
  172. // }
  173. if (val.selected == '全国' || val.fchoosecity == '全部') {
  174. this.historyFcityList = this.historyFcityList.reduce((cur, item) => {
  175. _obj[item.selected] ? "" : _obj[item.selected] = true && cur.push(item);
  176. return cur;
  177. }, [])
  178. } else {
  179. this.historyFcityList = this.historyFcityList.reduce((cur, item) => {
  180. if (item.fchoosecity == val.fchoosecity) {
  181. _obj[item.selected] ? "" : _obj[item.selected] = true && cur.push(item);
  182. return cur;
  183. } else {
  184. _obj[item.selected] ? "" : _obj[item.selected] = true && cur.push(item);
  185. return cur;
  186. }
  187. }, [])
  188. }
  189. return this.historyFcityList
  190. } else {
  191. let _obj = {}
  192. // for (let i = 0; i < this.historyScityList.length; i++) {
  193. // // let _data = this.historyScityList[i]
  194. // }
  195. if (val.selected == '全国' || val.schoosecity == '全部') {
  196. this.historyScityList = this.historyScityList.reduce((cur, item) => {
  197. _obj[item.selected] ? "" : _obj[item.selected] = true && cur.push(item);
  198. return cur;
  199. }, [])
  200. } else {
  201. this.historyScityList = this.historyScityList.reduce((cur, item) => {
  202. if (item.schoosecity == val.schoosecity) {
  203. _obj[item.selected] ? "" : _obj[item.selected] = true && cur.push(item);
  204. return cur;
  205. } else {
  206. _obj[item.selected] ? "" : _obj[item.selected] = true && cur.push(item);
  207. return cur;
  208. }
  209. }, [])
  210. }
  211. return this.historyScityList
  212. }
  213. },
  214. confirmBtn() {
  215. //设置地区 0发货地 1收货地
  216. if (this.type == 0) {
  217. if (this.fchooseprovince == '选择' ||(this.fchoosearea == '请选择区'&&this.fchoosecity!='全部')|| (this.fchoosecity == '请选择市' && this.fchooseprovince != '全国')) {
  218. this.$refs.uToast.show({
  219. type: 'error',
  220. message: "请选择区域!",
  221. })
  222. return
  223. }
  224. // }
  225. console.log("省", this.fchooseprovince)
  226. console.log("市", this.fchoosecity)
  227. console.log("区", this.fchoosearea)
  228. let _obj = {
  229. fchooseprovince: this.fchooseprovince,
  230. fchoosecity: this.fchoosecity,
  231. fchoosearea: this.fchoosearea,
  232. selected: ''
  233. }
  234. //选中全国
  235. if (this.fchoosecity == '请选择市' && this.fchooseprovince == '全国') {
  236. _obj.selected = this.fchooseprovince
  237. this.historyFcityList.unshift(_obj)
  238. let _newList = this.makeHistoryList(_obj)
  239. uni.setStorageSync('fPlaceList', _newList);
  240. }
  241. //选择省
  242. if (this.fchoosearea == '请选择区' && this.fchoosecity == '全部') {
  243. _obj.selected = this.fchooseprovince
  244. this.historyFcityList.unshift(_obj)
  245. let _newList = this.makeHistoryList(_obj)
  246. uni.setStorageSync('fPlaceList', _newList);
  247. }
  248. //选择市
  249. if (this.fchoosearea == '全部') {
  250. if(this.fchoosecity=='市辖区'){
  251. _obj.selected = this.fchooseprovince
  252. }else{
  253. _obj.selected = this.fchoosecity
  254. }
  255. this.historyFcityList.unshift(_obj)
  256. let _newList = this.makeHistoryList(_obj)
  257. uni.setStorageSync('fPlaceList', _newList);
  258. }
  259. uni.setStorageSync('fPlaceObj', _obj);
  260. //选择区
  261. if (this.fchoosearea != '请选择区' && this.fchoosearea != '全部') {
  262. console.log(this.fchooseprovince,this.fchoosecity,this.fchoosearea)
  263. // let _list = this.fchoosearea.split(',')
  264. // let _newList
  265. // //设置历史收发地并去重,区重名判断是否是同一个市在去重
  266. // for (let i = 0; i < _list.length; i++) {
  267. // let _deepObj = uni.$u.deepClone(_obj)
  268. // _deepObj.selected = _list[i]
  269. // this.historyFcityList.unshift(_deepObj)
  270. // _newList = this.makeHistoryList(_deepObj)
  271. // }
  272. // console.log(_newList)
  273. uni.setStorageSync('fPlaceList', this.historyFcityList);
  274. uni.setStorageSync('fPlaceObj', {
  275. fchooseprovince: this.fchooseprovince,
  276. fchoosecity: this.fchoosecity,
  277. fchoosearea: this.fchoosearea,
  278. selected: this.fchoosearea
  279. });
  280. }
  281. console.log(this.historyFcityList)
  282. uni.switchTab({
  283. url: '/pages/goodSource/index'
  284. });
  285. } else {
  286. //收货地
  287. if (this.schooseprovince == '选择' ||(this.schoosearea == '请选择区'&&this.schoosecity!='全部')|| (this.schoosecity == '请选择市' && this.schooseprovince != '全国')) {
  288. this.$refs.uToast.show({
  289. type: 'error',
  290. message: "请选择区域!",
  291. })
  292. }
  293. console.log(this.schooseprovince)
  294. console.log(this.schoosecity)
  295. console.log(this.schoosearea)
  296. let _obj = {
  297. schooseprovince: this.schooseprovince,
  298. schoosecity: this.schoosecity,
  299. schoosearea: this.schoosearea,
  300. selected: ''
  301. }
  302. //选中全国
  303. if (this.schoosecity == '请选择市' && this.schooseprovince == '全国') {
  304. _obj.selected = this.schooseprovince
  305. this.historyScityList.unshift(_obj)
  306. let _newList = this.makeHistoryList(_obj)
  307. uni.setStorageSync('sPlaceList', _newList);
  308. }
  309. //选择省
  310. if (this.schoosearea == '请选择区' && this.schoosecity == '全部') {
  311. _obj.selected = this.schooseprovince
  312. this.historyScityList.unshift(_obj)
  313. let _newList = this.makeHistoryList(_obj)
  314. uni.setStorageSync('sPlaceList', _newList);
  315. }
  316. //选择市
  317. if (this.schoosearea == '全部') {
  318. if(this.schoosecity=='市辖区'){
  319. _obj.selected = this.schooseprovince
  320. }else{
  321. _obj.selected = this.schoosecity
  322. }
  323. this.historyScityList.unshift(_obj)
  324. let _newList = this.makeHistoryList(_obj)
  325. uni.setStorageSync('sPlaceList', _newList);
  326. }
  327. uni.setStorageSync('sPlaceObj', _obj);
  328. //选择区
  329. if (this.schoosearea != '请选择区' && this.schoosearea != '全部') {
  330. let _list = this.schoosearea.split(',')
  331. let _newList
  332. for (let i = 0; i < _list.length; i++) {
  333. let _deepObj = uni.$u.deepClone(_obj)
  334. _deepObj.selected = _list[i]
  335. this.historyScityList.unshift(_deepObj)
  336. _newList = this.makeHistoryList(_deepObj)
  337. }
  338. console.log(_newList)
  339. uni.setStorageSync('sPlaceList', this.historyScityList);
  340. uni.setStorageSync('sPlaceObj', {
  341. schooseprovince: this.schooseprovince,
  342. schoosecity: this.schoosecity,
  343. schoosearea: this.schoosearea,
  344. selected: this.schoosearea
  345. });
  346. }
  347. console.log(this.historyScityList)
  348. uni.switchTab({
  349. url: '/pages/goodSource/index'
  350. });
  351. }
  352. },
  353. //返回上一级
  354. backLevel() {
  355. // this.count=0;
  356. if (this.type == 0) {
  357. this.fstatus--
  358. } else {
  359. this.sstatus--
  360. }
  361. if ((this.type == 0 ? this.fstatus : this.sstatus) == 1) {
  362. if (this.type == 0) {
  363. this.fchoosecity = '请选择市'
  364. this.fchoosearea = ''
  365. this.ftitle = ''
  366. this.isfcity = null
  367. this.ftitleList=[]
  368. } else {
  369. this.schoosecity = '请选择市'
  370. this.schoosearea = ''
  371. this.stitle = ''
  372. this.isscity = null
  373. this.stitleList=[]
  374. }
  375. } else if ((this.type == 0 ? this.fstatus : this.sstatus) == 0) {
  376. if (this.type == 0) {
  377. this.fchooseprovince = '选择'
  378. this.isfprovince = null
  379. } else {
  380. this.schooseprovince = '选择'
  381. this.issprovince = null
  382. }
  383. }
  384. },
  385. // 点击面包屑导航
  386. titleClick(status) {
  387. this.ftitle = ''
  388. this.stitle = ''
  389. this.count = 0
  390. if (this.type == 0) {
  391. this.fstatus = status
  392. this.isfprovince = null
  393. this.isfcity = null
  394. this.isfarea = null
  395. if (this.fchoosecity == '全部') return;
  396. } else {
  397. this.sstatus = status
  398. this.issprovince = null
  399. this.isscity = null
  400. this.issarea = null
  401. if (this.fchoosecity == '全部') return;
  402. }
  403. if (status == 0) {
  404. if (this.type == 0) {
  405. this.fchooseprovince = '选择'
  406. this.fchoosecity = '请选择市'
  407. this.fchoosearea = '请选择区'
  408. this.ftitleList=[]
  409. } else {
  410. this.schooseprovince = '选择'
  411. this.schoosecity = '请选择市'
  412. this.schoosearea = '请选择区'
  413. this.stitleList=[]
  414. }
  415. } else if (status == 1) {
  416. if (this.type == 0) {
  417. this.fchoosecity = '请选择市'
  418. this.fchoosearea = '请选择区'
  419. this.ftitleList=[]
  420. } else {
  421. this.schoosecity = '请选择市'
  422. this.schoosearea = '请选择区'
  423. this.stitleList=[]
  424. }
  425. }
  426. },
  427. // 选择省
  428. selectProvince(item, i, statusIndex) {
  429. this.count = 0;
  430. if (this.type == 0) {
  431. if (i == 0) {
  432. this.$refs.uToast.show({
  433. type: 'error',
  434. message: "发货地不可选择全国!",
  435. })
  436. return
  437. }
  438. this.fchoosecity = '请选择市'
  439. this.fchoosearea = '请选择区'
  440. this.isfprovince = i
  441. this.fchooseprovince = item.label
  442. if (item.child) {
  443. this.fcitylist = item.child
  444. }
  445. if (this.fchoosecity != '全部') {
  446. this.fstatus = statusIndex + 1
  447. }
  448. } else {
  449. this.issprovince = i
  450. this.schooseprovince = item.label
  451. if (item.label == '全国') {
  452. item.checked = !item.checked
  453. if (!item.checked) {
  454. this.issprovince = null
  455. }
  456. return
  457. } else {
  458. this.schoosecity = '请选择市'
  459. this.schoosearea = '请选择区'
  460. if (item.child) {
  461. this.scitylist = item.child
  462. }
  463. if (this.schoosecity != '全部') {
  464. this.sstatus = statusIndex + 1
  465. }
  466. }
  467. }
  468. },
  469. // 选择市
  470. selectCity(item, i, statusIndex) {
  471. if(item.label=='全部'){
  472. this.$refs.uToast.show({
  473. type: 'error',
  474. message: "不能选择全部,请重新选择!"
  475. })
  476. return
  477. }
  478. this.count = 0;
  479. if (this.type == 0) {
  480. this.isfcity = i
  481. } else {
  482. this.isscity = i
  483. }
  484. if (item.child) {
  485. for (let i = 0; i < item.child.length; i++) {
  486. item.child[i].checked = false
  487. }
  488. if (this.type == 0) {
  489. this.farealist = item.child
  490. } else {
  491. this.sarealist = item.child
  492. }
  493. }
  494. if (this.type == 0) {
  495. this.fchoosecity = item.label
  496. } else {
  497. this.schoosecity = item.label
  498. }
  499. if ((this.type == 0 ? this.fchoosecity : this.schoosecity) != '全部') {
  500. if (this.type == 0) {
  501. this.fstatus = statusIndex + 1
  502. } else {
  503. this.sstatus = statusIndex + 1
  504. }
  505. }
  506. },
  507. //选择区
  508. selectaArea(item, i) {
  509. if (item.label == '全部') {
  510. if (this.type == 0) {
  511. for (let i = 0; i < this.farealist.length; i++) {
  512. if (i == 0) {
  513. this.farealist[i].checked = true
  514. } else {
  515. this.farealist[i].checked = false
  516. }
  517. }
  518. this.ftitleList=[]
  519. this.fchoosearea = '全部'
  520. this.$forceUpdate()
  521. return
  522. } else {
  523. for (let i = 0; i < this.sarealist.length; i++) {
  524. if (i == 0) {
  525. this.sarealist[i].checked = true
  526. } else {
  527. this.sarealist[i].checked = false
  528. }
  529. }
  530. this.stitleList=[]
  531. this.schoosearea = '全部'
  532. this.$forceUpdate()
  533. return
  534. }
  535. }
  536. if (this.type == 0) {
  537. this.farealist[0].checked = false
  538. if (this.ftitleList.length < 3) {
  539. item.checked = !item.checked
  540. if (item.checked ) {
  541. if(this.ftitleList.indexOf(item.label)==-1){
  542. this.ftitleList.push(item.label)
  543. }
  544. } else if (!item.checked) {
  545. for (var i = 0; i < this.ftitleList.length; i++) {
  546. console.log(this.ftitleList[i])
  547. if(this.ftitleList[i]==item.label){
  548. this.ftitleList.splice(i,1)
  549. }
  550. }
  551. }
  552. } else {
  553. if (item.checked) {
  554. item.checked = !item.checked
  555. for (var i = 0; i < this.ftitleList.length; i++) {
  556. if(this.ftitleList[i]==item.label){
  557. this.ftitleList.splice(i,1)
  558. }
  559. }
  560. } else {
  561. this.$refs.uToast.show({
  562. type: 'error',
  563. message: "最多选择3个地区",
  564. })
  565. }
  566. }
  567. this.ftitle=this.ftitleList.toString()
  568. this.fchoosearea=this.ftitleList.toString()
  569. }else{
  570. this.sarealist[0].checked = false
  571. if (this.stitleList.length < 3) {
  572. item.checked = !item.checked
  573. if (item.checked ) {
  574. if(this.stitleList.indexOf(item.label)==-1){
  575. this.stitleList.push(item.label)
  576. }
  577. } else if (!item.checked) {
  578. for (var i = 0; i < this.stitleList.length; i++) {
  579. console.log(this.stitleList[i])
  580. if(this.stitleList[i]==item.label){
  581. this.stitleList.splice(i,1)
  582. }
  583. }
  584. }
  585. } else {
  586. if (item.checked) {
  587. item.checked = !item.checked
  588. for (var i = 0; i < this.stitleList.length; i++) {
  589. if(this.stitleList[i]==item.label){
  590. this.stitleList.splice(i,1)
  591. }
  592. }
  593. } else {
  594. this.$refs.uToast.show({
  595. type: 'error',
  596. message: "最多选择3个地区",
  597. })
  598. }
  599. }
  600. this.stitle=this.stitleList.toString()
  601. this.schoosearea=this.stitleList.toString()
  602. }
  603. console.log(this.ftitleList)
  604. this.$forceUpdate()
  605. //设置面包屑 0发货地 1收货地
  606. // if (this.type == 0) {
  607. // this.farealist[0].checked = false
  608. // // if(this.ftitleList.indexOf(item.label)==-1){
  609. // // this.ftitleList.push(item.label)
  610. // // }
  611. // if (item.checked && !this.fchoosearea.includes(item.label)) {
  612. // if (this.ftitle) {
  613. // this.ftitle += ',' + item.label
  614. // } else {
  615. // this.ftitle += item.label
  616. // }
  617. // this.fchoosearea = this.ftitle
  618. // console.log(this.fchoosearea)
  619. // } else {
  620. // if (this.ftitle.includes(',' + item.label)) {
  621. // this.ftitle = this.ftitle.replace(',' + item.label, '')
  622. // this.fchoosearea = this.fchoosearea.replace(',' + item.label, '')
  623. // } else {
  624. // let _val = this.ftitle.split(',')
  625. // let _len = _val.length;
  626. // if (_len == 1) {
  627. // this.ftitle = this.ftitle.replace(item.label, '')
  628. // this.fchoosearea = '请选择区'
  629. // } else if (_len > 1) {
  630. // this.ftitle = this.ftitle.replace(item.label + ',', '')
  631. // this.fchoosearea = this.fchoosearea.replace(item.label + ',', '')
  632. // }
  633. // }
  634. // }
  635. // } else {
  636. // if (item.checked && !this.schoosearea.includes(item.label)) {
  637. // if (this.stitle) {
  638. // this.stitle += ',' + item.label
  639. // } else {
  640. // this.stitle += item.label
  641. // }
  642. // this.schoosearea = this.stitle
  643. // } else {
  644. // if (this.stitle.includes(',' + item.label)) {
  645. // this.stitle = this.stitle.replace(',' + item.label, '')
  646. // this.schoosearea = this.schoosearea.replace(',' + item.label, '')
  647. // } else {
  648. // let _val = this.stitle.split(',')
  649. // let _len = _val.length;
  650. // if (_len == 1) {
  651. // this.stitle = this.stitle.replace(item.label, '')
  652. // this.schoosearea = '请选择区'
  653. // } else if (_len > 1) {
  654. // this.stitle = this.stitle.replace(item.label + ',', '')
  655. // this.schoosearea = this.schoosearea.replace(item.label + ',', '')
  656. // }
  657. // }
  658. // }
  659. // }
  660. },
  661. changeCity(type) {
  662. if (type == 0) {
  663. this.type = 0
  664. } else {
  665. this.type = 1
  666. }
  667. },
  668. back() {
  669. uni.navigateBack({
  670. })
  671. },
  672. }
  673. }
  674. </script>
  675. <style lang="scss" scoped>
  676. .row1 {
  677. display: flex;
  678. justify-content: space-evenly;
  679. margin-top: 10rpx;
  680. border-bottom: 1px solid #E6E6E6;
  681. }
  682. .start-place,
  683. .end-place {
  684. font-size: 28rpx;
  685. color: #B1B5C0;
  686. padding-bottom: 20rpx;
  687. }
  688. .active1 {
  689. position: relative;
  690. color: black;
  691. font-size: 32rpx;
  692. font-weight: 700;
  693. display: flex;
  694. justify-content: center;
  695. }
  696. .active1:after {
  697. content: '';
  698. position: absolute;
  699. bottom: 0rpx;
  700. width: 50%;
  701. left: 25%;
  702. padding: 0 20rpx;
  703. box-sizing: border-box;
  704. height: 6rpx;
  705. background: #2772FB;
  706. border-radius: 3px;
  707. }
  708. .history-city-title {
  709. font-size: 28rpx;
  710. font-weight: 700;
  711. color: #363636;
  712. margin-bottom: 20rpx;
  713. }
  714. .container {
  715. padding: 0 20rpx;
  716. }
  717. .content1 {
  718. margin: 20rpx 0;
  719. }
  720. .city-list {
  721. max-height: 118rpx;
  722. overflow: hidden;
  723. }
  724. .city {
  725. display: inline-block;
  726. font-size: 26rpx;
  727. text-align: center;
  728. padding: 8rpx 16rpx;
  729. margin: 0 20rpx 20rpx 0;
  730. height: 33rpx;
  731. line-height: 33rpx;
  732. border-radius: 4rpx;
  733. background: #F7F8FA;
  734. }
  735. .content2 {
  736. margin: 20rpx 0;
  737. }
  738. .container {
  739. // width: 100%;
  740. width: calc(100% - 40rpx);
  741. display: inline-flex;
  742. flex-flow: row wrap;
  743. align-content: flex-start;
  744. }
  745. .select-active,
  746. .back-level {
  747. color: #2772FB;
  748. font-size: 28rpx;
  749. }
  750. .content-item {
  751. background: #F7F8FA;
  752. margin: 10rpx;
  753. font-size: 30rpx;
  754. color: #333333;
  755. text-align: center;
  756. padding: 10rpx 0;
  757. border-radius: 10rx;
  758. overflow: hidden;
  759. text-overflow: ellipsis;
  760. white-space: nowrap;
  761. padding: 6rpx 8rpx;
  762. box-sizing: border-box;
  763. flex: 0 0 calc(25% - 20rpx);
  764. }
  765. .title {
  766. margin: 0 20rpx;
  767. }
  768. .active {
  769. background: #E5F0FE;
  770. border-radius: 10rpx;
  771. // border: 1px solid #2772FB;
  772. color: #2772FB;
  773. box-sizing: border-box;
  774. }
  775. .area {
  776. width: 55%;
  777. text-overflow: ellipsis;
  778. white-space: nowrap;
  779. overflow: hidden;
  780. }
  781. .nav-bag-left {
  782. width: 70%;
  783. font-size: 30rpx;
  784. }
  785. .btn {
  786. background: #2772FB;
  787. color: white;
  788. width: 80%;
  789. position: absolute;
  790. bottom: 30rpx;
  791. margin-left: 10%;
  792. border-radius: 50rpx;
  793. }
  794. </style>