u-picker-select.vue 22 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706
  1. <template>
  2. <u-popup :maskCloseAble="maskCloseAble" mode="bottom" :popup="false" v-model="value" length="auto"
  3. :safeAreaInsetBottom="safeAreaInsetBottom" @close="close" :z-index="uZIndex">
  4. <view class="u-datetime-picker">
  5. <view class="u-picker-header" @touchmove.stop.prevent="">
  6. <view class="u-btn-picker u-btn-picker--tips" :style="{ color: cancelColor }" hover-class="u-opacity"
  7. :hover-stay-time="150" @tap="getResult('cancel')"></view>
  8. <view class="u-picker__title">{{ title }}</view>
  9. <view class="u-btn-picker u-btn-picker--primary" :style="{ color: cancelColor }"
  10. hover-class="u-opacity" :hover-stay-time="150" @touchmove.stop="" @tap.stop="getResult('cancel')">
  11. <u-icon name="close"></u-icon>
  12. </view>
  13. </view>
  14. </view>
  15. <view class="u-datetime-picker" v-if="noselect">
  16. <view class="u-picker-header" @touchmove.stop.prevent="">
  17. <view class="headesParamsSelect" :class="{
  18. selectIndex:params.day
  19. }" @click="params.day=true">按日期选择</view>
  20. <view class="headesParamsSelect" :class="{
  21. selectIndex:!params.day
  22. }" @click="params.day=false">按月选择</view>
  23. </view>
  24. </view>
  25. <view class="u-picker-body">
  26. <picker-view :value="valueArr" @change="change" class="u-picker-view" @pickstart="pickstart"
  27. @pickend="pickend">
  28. <picker-view-column v-if="!reset && params.year">
  29. <view class="u-column-item" v-for="(item, index) in years" :key="index">
  30. {{ item }}
  31. <text class="u-text" v-if="showTimeTag">年</text>
  32. </view>
  33. </picker-view-column>
  34. <picker-view-column v-if="!reset && params.month">
  35. <view class="u-column-item" v-for="(item, index) in months" :key="index">
  36. {{ formatNumber(item) }}
  37. <text class="u-text" v-if="showTimeTag">月</text>
  38. </view>
  39. </picker-view-column>
  40. <picker-view-column v-if="!reset && params.day">
  41. <view class="u-column-item" v-for="(item, index) in days" :key="index">
  42. {{ formatNumber(item) }}
  43. <text class="u-text" v-if="showTimeTag">日</text>
  44. </view>
  45. </picker-view-column>
  46. </picker-view>
  47. </view>
  48. <view class="u-datetime-picker">
  49. <view class="u-picker-header u-picker-header2" @touchmove.stop.prevent="">
  50. <view class="u-btn-picker u-btn-picker--tips" :style="{ color: cancelColor }" hover-class="u-opacity"
  51. :hover-stay-time="150" @tap="getResult('reset')">
  52. <view class="headesParamsSelect" >重置</view>
  53. </view>
  54. <view class="u-picker__title"></view>
  55. <view class="u-btn-picker u-btn-picker--primary" :style="{ color: moving ? cancelColor : confirmColor }"
  56. hover-class="u-opacity" :hover-stay-time="150" @touchmove.stop="" @tap.stop="getResult('confirm')">
  57. <view class="headesParamsSelect selectIndex" >确定</view>
  58. </view>
  59. </view>
  60. </view>
  61. </view>
  62. </u-popup>
  63. </template>
  64. <script>
  65. import provinces from '../../libs/util/province.js';
  66. import citys from '../../libs/util/city.js';
  67. import areas from '../../libs/util/area.js';
  68. /**
  69. * picker picker弹出选择器
  70. * @description 此选择器有两种弹出模式:一是时间模式,可以配置年,日,月,时,分,秒参数 二是地区模式,可以配置省,市,区参数
  71. * @tutorial https://www.uviewui.com/components/picker.html
  72. * @property {Object} params 需要显示的参数,见官网说明
  73. * @property {String} mode 模式选择,region-地区类型,time-时间类型(默认time)
  74. * @property {String Number} start-year 可选的开始年份,mode=time时有效(默认1950)
  75. * @property {String Number} end-year 可选的结束年份,mode=time时有效(默认2050)
  76. * @property {Boolean} safe-area-inset-bottom 是否开启底部安全区适配(默认false)
  77. * @property {Boolean} show-time-tag 时间模式时,是否显示后面的年月日中文提示
  78. * @property {String} cancel-color 取消按钮的颜色(默认#606266)
  79. * @property {String} confirm-color 确认按钮的颜色(默认#2979ff)
  80. * @property {String} default-time 默认选中的时间,mode=time时有效
  81. * @property {String} confirm-text 确认按钮的文字
  82. * @property {String} cancel-text 取消按钮的文字
  83. * @property {String} default-region 默认选中的地区,中文形式,mode=region时有效
  84. * @property {String} default-code 默认选中的地区,编号形式,mode=region时有效
  85. * @property {Boolean} mask-close-able 是否允许通过点击遮罩关闭Picker(默认true)
  86. * @property {String Number} z-index 弹出时的z-index值(默认1075)
  87. * @property {Array} default-selector 数组形式,其中每一项表示选择了range对应项中的第几个
  88. * @property {Array} range 自定义选择的数据,mode=selector或mode=multiSelector时有效
  89. * @property {String} range-key 当range参数的元素为对象时,指定Object中的哪个key的值作为选择器显示内容
  90. * @event {Function} confirm 点击确定按钮,返回当前选择的值
  91. * @event {Function} cancel 点击取消按钮,返回当前选择的值
  92. * @example <u-picker v-model="show" mode="time"></u-picker>
  93. */
  94. export default {
  95. name: 'u-picker',
  96. props: {
  97. // picker中需要显示的参数
  98. params: {
  99. type: Object,
  100. default () {
  101. return {
  102. year: true,
  103. month: true,
  104. day: true,
  105. hour: false,
  106. minute: false,
  107. second: false,
  108. province: true,
  109. city: true,
  110. area: true,
  111. timestamp: true,
  112. };
  113. }
  114. },
  115. // 当mode=selector或者mode=multiSelector时,提供的数组
  116. range: {
  117. type: Array,
  118. default () {
  119. return [];
  120. }
  121. },
  122. noselect:{
  123. type: Boolean,
  124. default: true
  125. },
  126. // 当mode=selector或者mode=multiSelector时,提供的默认选中的下标
  127. defaultSelector: {
  128. type: Array,
  129. default () {
  130. return [0];
  131. }
  132. },
  133. // 当 range 是一个 Array<Object> 时,通过 range-key 来指定 Object 中 key 的值作为选择器显示内容
  134. rangeKey: {
  135. type: String,
  136. default: ''
  137. },
  138. // 模式选择,region-地区类型,time-时间类型,selector-单列模式,multiSelector-多列模式
  139. mode: {
  140. type: String,
  141. default: 'time'
  142. },
  143. // 年份开始时间
  144. startYear: {
  145. type: [String, Number],
  146. default: 2020
  147. },
  148. // 年份结束时间
  149. endYear: {
  150. type: [String, Number],
  151. default: 2050
  152. },
  153. // "取消"按钮的颜色
  154. cancelColor: {
  155. type: String,
  156. default: '#606266'
  157. },
  158. // "确定"按钮的颜色
  159. confirmColor: {
  160. type: String,
  161. default: '#2979ff'
  162. },
  163. // 默认显示的时间,2025-07-02 || 2025-07-02 13:01:00 || 2025/07/02
  164. defaultTime: {
  165. type: String,
  166. default: ''
  167. },
  168. // 默认显示的地区,可传类似["河北省", "秦皇岛市", "北戴河区"]
  169. defaultRegion: {
  170. type: Array,
  171. default () {
  172. return [];
  173. }
  174. },
  175. // 时间模式时,是否显示后面的年月日中文提示
  176. showTimeTag: {
  177. type: Boolean,
  178. default: true
  179. },
  180. // 默认显示地区的编码,defaultRegion和areaCode同时存在,areaCode优先,可传类似["13", "1303", "130304"]
  181. areaCode: {
  182. type: Array,
  183. default () {
  184. return [];
  185. }
  186. },
  187. safeAreaInsetBottom: {
  188. type: Boolean,
  189. default: false
  190. },
  191. // 是否允许通过点击遮罩关闭Picker
  192. maskCloseAble: {
  193. type: Boolean,
  194. default: false
  195. },
  196. // 通过双向绑定控制组件的弹出与收起
  197. value: {
  198. type: Boolean,
  199. default: false
  200. },
  201. // 弹出的z-index值
  202. zIndex: {
  203. type: [String, Number],
  204. default: 0
  205. },
  206. // 顶部标题
  207. title: {
  208. type: String,
  209. default: ''
  210. },
  211. // 取消按钮的文字
  212. cancelText: {
  213. type: String,
  214. default: '取消'
  215. },
  216. // 确认按钮的文字
  217. confirmText: {
  218. type: String,
  219. default: '确认'
  220. }
  221. },
  222. data() {
  223. return {
  224. years: [],
  225. months: [],
  226. days: [],
  227. hours: [],
  228. minutes: [],
  229. seconds: [],
  230. year: 0,
  231. month: 0,
  232. day: 0,
  233. hour: 0,
  234. minute: 0,
  235. second: 0,
  236. reset: false,
  237. startDate: '',
  238. endDate: '',
  239. valueArr: [],
  240. provinces: provinces,
  241. citys: citys[0],
  242. areas: areas[0][0],
  243. province: 0,
  244. city: 0,
  245. area: 0,
  246. moving: false // 列是否还在滑动中,微信小程序如果在滑动中就点确定,结果可能不准确
  247. };
  248. },
  249. mounted() {
  250. this.init();
  251. },
  252. computed: {
  253. propsChange() {
  254. // 引用这几个变量,是为了监听其变化
  255. return `${this.mode}-${this.defaultTime}-${this.startYear}-${this.endYear}-${this.defaultRegion}-${this.areaCode}`;
  256. },
  257. regionChange() {
  258. // 引用这几个变量,是为了监听其变化
  259. return `${this.province}-${this.city}`;
  260. },
  261. yearAndMonth() {
  262. return `${this.year}-${this.month}`;
  263. },
  264. uZIndex() {
  265. // 如果用户有传递z-index值,优先使用
  266. return this.zIndex ? this.zIndex : this.$u.zIndex.popup;
  267. }
  268. },
  269. watch: {
  270. propsChange() {
  271. this.reset = true;
  272. setTimeout(() => this.init(), 10);
  273. },
  274. // 如果地区发生变化,为了让picker联动起来,必须重置this.citys和this.areas
  275. regionChange(val) {
  276. this.citys = citys[this.province];
  277. this.areas = areas[this.province][this.city];
  278. },
  279. // watch监听月份的变化,实时变更日的天数,因为不同月份,天数不一样
  280. // 一个月可能有30,31天,甚至闰年2月的29天,平年2月28天
  281. yearAndMonth(val) {
  282. if (this.params.year) this.setDays();
  283. },
  284. // 微信和QQ小程序由于一些奇怪的原因(故同时对所有平台均初始化一遍),需要重新初始化才能显示正确的值
  285. value(n) {
  286. if (n) {
  287. this.reset = true;
  288. setTimeout(() => this.init(), 10);
  289. }
  290. }
  291. },
  292. methods: {
  293. newDate (date) {
  294. var time=null;
  295. if (date) {
  296. var reg=new RegExp('-','gi')
  297. time=new Date(date.replace(reg,'/'));
  298. }
  299. return time
  300. },
  301. // 标识滑动开始,只有微信小程序才有这样的事件
  302. pickstart() {
  303. // #ifdef MP-WEIXIN
  304. this.moving = true;
  305. // #endif
  306. },
  307. // 标识滑动结束
  308. pickend() {
  309. // #ifdef MP-WEIXIN
  310. this.moving = false;
  311. // #endif
  312. },
  313. // 对单列和多列形式的判断是否有传入变量的情况
  314. getItemValue(item, mode) {
  315. // 目前(2020-05-25)uni-app对微信小程序编译有错误,导致v-if为false中的内容也执行,错误导致
  316. // 单列模式或者多列模式中的getItemValue同时被执行,故在这里再加一层判断
  317. if (this.mode == mode) {
  318. return typeof item == 'object' ? item[this.rangeKey] : item;
  319. }
  320. },
  321. // 小于10前面补0,用于月份,日期,时分秒等
  322. formatNumber(num) {
  323. return +num < 10 ? '0' + num : String(num);
  324. },
  325. // 生成递进的数组
  326. generateArray: function(start, end) {
  327. // 转为数值格式,否则用户给end-year等传递字符串值时,下面的end+1会导致字符串拼接,而不是相加
  328. start = Number(start);
  329. end = Number(end);
  330. end = end > start ? end : start;
  331. // 生成数组,获取其中的索引,并剪出来
  332. return [...Array(end + 1).keys()].slice(start);
  333. },
  334. getIndex: function(arr, val) {
  335. let index = arr.indexOf(val);
  336. // 如果index为-1(即找不到index值),~(-1)=-(-1)-1=0,导致条件不成立
  337. return ~index ? index : 0;
  338. },
  339. //日期时间处理
  340. initTimeValue() {
  341. // 格式化时间,在IE浏览器(uni不存在此情况),无法识别日期间的"-"间隔符号
  342. let fdate = this.defaultTime.replace(/\-/g, '/');
  343. fdate = fdate && fdate.indexOf('/') == -1 ? `2020/01/01 ${fdate}` : fdate;
  344. if(fdate.length==7){
  345. fdate+="/01"
  346. }
  347. let time = null;
  348. if (fdate) time = this.newDate(fdate);
  349. else time = new Date();
  350. // 获取年日月时分秒
  351. this.year = time.getFullYear();
  352. this.month = Number(time.getMonth()) + 1;
  353. this.day = time.getDate();
  354. this.hour = time.getHours();
  355. this.minute = time.getMinutes();
  356. this.second = time.getSeconds();
  357. },
  358. init() {
  359. this.valueArr = [];
  360. this.reset = false;
  361. if (this.mode == 'time') {
  362. this.initTimeValue();
  363. if (this.params.year) {
  364. this.valueArr.push(0);
  365. this.setYears();
  366. }
  367. if (this.params.month) {
  368. this.valueArr.push(0);
  369. this.setMonths();
  370. }
  371. if (this.params.day) {
  372. this.valueArr.push(0);
  373. this.setDays();
  374. }
  375. if (this.params.hour) {
  376. this.valueArr.push(0);
  377. this.setHours();
  378. }
  379. if (this.params.minute) {
  380. this.valueArr.push(0);
  381. this.setMinutes();
  382. }
  383. if (this.params.second) {
  384. this.valueArr.push(0);
  385. this.setSeconds();
  386. }
  387. } else if (this.mode == 'region') {
  388. if (this.params.province) {
  389. this.valueArr.push(0);
  390. this.setProvinces();
  391. }
  392. if (this.params.city) {
  393. this.valueArr.push(0);
  394. this.setCitys();
  395. }
  396. if (this.params.area) {
  397. this.valueArr.push(0);
  398. this.setAreas();
  399. }
  400. } else if (this.mode == 'selector') {
  401. this.valueArr = this.defaultSelector;
  402. } else if (this.mode == 'multiSelector') {
  403. this.valueArr = this.defaultSelector;
  404. this.multiSelectorValue = this.defaultSelector;
  405. }
  406. this.$forceUpdate();
  407. },
  408. // 设置picker的某一列值
  409. setYears() {
  410. // 获取年份集合
  411. this.years = this.generateArray(this.startYear, this.endYear);
  412. // 设置this.valueArr某一项的值,是为了让picker预选中某一个值
  413. this.valueArr.splice(this.valueArr.length - 1, 1, this.getIndex(this.years, this.year));
  414. },
  415. setMonths() {
  416. this.months = this.generateArray(1, 12);
  417. this.valueArr.splice(this.valueArr.length - 1, 1, this.getIndex(this.months, this.month));
  418. },
  419. setDays() {
  420. let totalDays = new Date(this.year, this.month, 0).getDate();
  421. this.days = this.generateArray(1, totalDays);
  422. let index = 0;
  423. // 这里不能使用类似setMonths()中的this.valueArr.splice(this.valueArr.length - 1, xxx)做法
  424. // 因为this.month和this.year变化时,会触发watch中的this.setDays(),导致this.valueArr.length计算有误
  425. if (this.params.year && this.params.month) index = 2;
  426. else if (this.params.month) index = 1;
  427. else if (this.params.year) index = 1;
  428. else index = 0;
  429. // 当月份变化时,会导致日期的天数也会变化,如果原来选的天数大于变化后的天数,则重置为变化后的最大值
  430. // 比如原来选中3月31日,调整为2月后,日期变为最大29,这时如果day值继续为31显然不合理,于是将其置为29(picker-column从1开始)
  431. if (this.day > this.days.length) this.day = this.days.length;
  432. this.valueArr.splice(index, 1, this.getIndex(this.days, this.day));
  433. },
  434. setHours() {
  435. this.hours = this.generateArray(0, 23);
  436. this.valueArr.splice(this.valueArr.length - 1, 1, this.getIndex(this.hours, this.hour));
  437. },
  438. setMinutes() {
  439. this.minutes = this.generateArray(0, 59);
  440. this.valueArr.splice(this.valueArr.length - 1, 1, this.getIndex(this.minutes, this.minute));
  441. },
  442. setSeconds() {
  443. this.seconds = this.generateArray(0, 59);
  444. this.valueArr.splice(this.valueArr.length - 1, 1, this.getIndex(this.seconds, this.second));
  445. },
  446. setProvinces() {
  447. // 判断是否需要province参数
  448. if (!this.params.province) return;
  449. let tmp = '';
  450. let useCode = false;
  451. // 如果同时配置了defaultRegion和areaCode,优先使用areaCode参数
  452. if (this.areaCode.length) {
  453. tmp = this.areaCode[0];
  454. useCode = true;
  455. } else if (this.defaultRegion.length) tmp = this.defaultRegion[0];
  456. else tmp = 0;
  457. // 历遍省份数组匹配
  458. provinces.map((v, k) => {
  459. if (useCode ? v.value == tmp : v.label == tmp) {
  460. tmp = k;
  461. }
  462. });
  463. this.province = tmp;
  464. this.provinces = provinces;
  465. // 设置默认省份的值
  466. this.valueArr.splice(0, 1, this.province);
  467. },
  468. setCitys() {
  469. if (!this.params.city) return;
  470. let tmp = '';
  471. let useCode = false;
  472. if (this.areaCode.length) {
  473. tmp = this.areaCode[1];
  474. useCode = true;
  475. } else if (this.defaultRegion.length) tmp = this.defaultRegion[1];
  476. else tmp = 0;
  477. citys[this.province].map((v, k) => {
  478. if (useCode ? v.value == tmp : v.label == tmp) {
  479. tmp = k;
  480. }
  481. });
  482. this.city = tmp;
  483. this.citys = citys[this.province];
  484. this.valueArr.splice(1, 1, this.city);
  485. },
  486. setAreas() {
  487. if (!this.params.area) return;
  488. let tmp = '';
  489. let useCode = false;
  490. if (this.areaCode.length) {
  491. tmp = this.areaCode[2];
  492. useCode = true;
  493. } else if (this.defaultRegion.length) tmp = this.defaultRegion[2];
  494. else tmp = 0;
  495. areas[this.province][this.city].map((v, k) => {
  496. if (useCode ? v.value == tmp : v.label == tmp) {
  497. tmp = k;
  498. }
  499. });
  500. this.area = tmp;
  501. this.areas = areas[this.province][this.city];
  502. this.valueArr.splice(2, 1, this.area);
  503. },
  504. close() {
  505. this.$emit('input', false);
  506. },
  507. // 用户更改picker的列选项
  508. change(e) {
  509. this.valueArr = e.detail.value;
  510. let i = 0;
  511. if (this.mode == 'time') {
  512. // 这里使用i++,是因为this.valueArr数组的长度是不确定长度的,它根据this.params的值来配置长度
  513. // 进入if规则,i会加1,保证了能获取准确的值
  514. if (this.params.year) this.year = this.years[this.valueArr[i++]];
  515. if (this.params.month) this.month = this.months[this.valueArr[i++]];
  516. if (this.params.day) this.day = this.days[this.valueArr[i++]];
  517. if (this.params.hour) this.hour = this.hours[this.valueArr[i++]];
  518. if (this.params.minute) this.minute = this.minutes[this.valueArr[i++]];
  519. if (this.params.second) this.second = this.seconds[this.valueArr[i++]];
  520. } else if (this.mode == 'region') {
  521. if (this.params.province) this.province = this.valueArr[i++];
  522. if (this.params.city) this.city = this.valueArr[i++];
  523. if (this.params.area) this.area = this.valueArr[i++];
  524. } else if (this.mode == 'multiSelector') {
  525. let index = null;
  526. // 对比前后两个数组,寻找变更的是哪一列,如果某一个元素不同,即可判定该列发生了变化
  527. this.defaultSelector.map((val, idx) => {
  528. if (val != e.detail.value[idx]) index = idx;
  529. });
  530. // 为了让用户对多列变化时,对动态设置其他列的变更
  531. if (index != null) {
  532. this.$emit('columnchange', {
  533. column: index,
  534. index: e.detail.value[index]
  535. });
  536. }
  537. }
  538. },
  539. // 用户点击确定按钮
  540. getResult(event = null) {
  541. // #ifdef MP-WEIXIN
  542. if (this.moving) return;
  543. // #endif
  544. let result = {};
  545. // 只返回用户在this.params中配置了为true的字段
  546. if (this.mode == 'time') {
  547. if (this.params.year) result.year = this.formatNumber(this.year || 0);
  548. if (this.params.month) result.month = this.formatNumber(this.month || 0);
  549. if (this.params.day) result.day = this.formatNumber(this.day || 0);
  550. if (this.params.hour) result.hour = this.formatNumber(this.hour || 0);
  551. if (this.params.minute) result.minute = this.formatNumber(this.minute || 0);
  552. if (this.params.second) result.second = this.formatNumber(this.second || 0);
  553. if (this.params.timestamp) result.timestamp = this.getTimestamp();
  554. } else if (this.mode == 'region') {
  555. if (this.params.province) result.province = provinces[this.province];
  556. if (this.params.city) result.city = citys[this.province][this.city];
  557. if (this.params.area) result.area = areas[this.province][this.city][this.area];
  558. } else if (this.mode == 'selector') {
  559. result = this.valueArr;
  560. } else if (this.mode == 'multiSelector') {
  561. result = this.valueArr;
  562. }
  563. if (event) this.$emit(event, result);
  564. this.close();
  565. },
  566. // 获取时间戳
  567. getTimestamp() {
  568. // yyyy-mm-dd为安卓写法,不支持iOS,需要使用"/"分隔,才能二者兼容
  569. let time = this.year + '/' + this.month + '/' + this.day + ' ' + this.hour + ':' + this.minute + ':' + this
  570. .second;
  571. return new Date(time).getTime() / 1000;
  572. }
  573. }
  574. };
  575. </script>
  576. <style lang="scss" scoped>
  577. @import '../../libs/css/style.components.scss';
  578. .u-datetime-picker {
  579. position: relative;
  580. z-index: 999;
  581. }
  582. .u-picker-view {
  583. height: 100%;
  584. box-sizing: border-box;
  585. }
  586. .u-picker-header {
  587. width: 100%;
  588. height: 90rpx;
  589. padding: 0 40rpx;
  590. @include vue-flex;
  591. justify-content: space-between;
  592. align-items: center;
  593. box-sizing: border-box;
  594. font-size: 30rpx;
  595. background: #fff;
  596. position: relative;
  597. .headesParamsSelect{
  598. width: 300rpx;
  599. height: 80rpx;
  600. line-height: 80rpx;
  601. border-radius: 25px;
  602. background-color: rgba(222,225,228,1);
  603. color: rgba(51,51,51,1);
  604. font-size: 28rpx;
  605. text-align: center;
  606. }
  607. .selectIndex{
  608. background:#307af7 ;
  609. color: rgba(255,255,255,1);
  610. }
  611. }
  612. .u-picker-header2{
  613. .headesParamsSelect{
  614. width: 300rpx;
  615. height: 80rpx;
  616. line-height: 80rpx;
  617. border-radius: 2px;
  618. background-color: rgba(222,225,228,1);
  619. color: rgba(51,51,51,1);
  620. font-size: 28rpx;
  621. text-align: center;
  622. }
  623. .selectIndex{
  624. background: linear-gradient(-88.46deg, rgba(34,109,198,1) 2.59%,rgba(9,158,237,1) 97.02%);
  625. color: rgba(255,255,255,1);
  626. }
  627. }
  628. .u-picker-header::after {
  629. content: '';
  630. position: absolute;
  631. border-bottom: 1rpx solid #eaeef1;
  632. -webkit-transform: scaleY(0.5);
  633. transform: scaleY(0.5);
  634. bottom: 0;
  635. right: 0;
  636. left: 0;
  637. }
  638. .u-picker__title {
  639. color: $u-content-color;
  640. }
  641. .u-picker-body {
  642. width: 100%;
  643. height: 500rpx;
  644. overflow: hidden;
  645. background-color: #fff;
  646. }
  647. .u-column-item {
  648. @include vue-flex;
  649. align-items: center;
  650. justify-content: center;
  651. font-size: 32rpx;
  652. color: $u-main-color;
  653. padding: 0 8rpx;
  654. }
  655. .u-text {
  656. font-size: 24rpx;
  657. padding-left: 8rpx;
  658. }
  659. .u-btn-picker {
  660. padding: 16rpx;
  661. box-sizing: border-box;
  662. text-align: center;
  663. text-decoration: none;
  664. }
  665. .u-opacity {
  666. opacity: 0.5;
  667. }
  668. .u-btn-picker--primary {
  669. color: $u-type-primary;
  670. }
  671. .u-btn-picker--tips {
  672. color: $u-tips-color;
  673. }
  674. </style>