w-picker.vue 38 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139
  1. <template>
  2. <view class="w-picker">
  3. <view class="mask" :class="{'show':showPicker}" @tap="maskTap" @touchmove.stop.prevent catchtouchmove="true"></view>
  4. <view class="w-picker-cnt" :class="{'show':showPicker}">
  5. <view class="w-picker-hd" @touchmove.stop.prevent catchtouchmove="true">
  6. <view class="w-picker-btn" @tap="pickerCancel">取消</view>
  7. <view class="w-picker-btn" :style="{'color':themeColor}" @tap="pickerConfirm">确定</view>
  8. </view>
  9. <view class="w-picker-view" v-if="mode=='linkage'">
  10. <picker-view :indicator-style="itemHeight" :value="pickVal" @change="bindChange" @touchstart="touchStart" @touchend="touchEnd">
  11. <picker-view-column v-for="(col,colIndex) in data" :key="colIndex">
  12. <view class="w-picker-item" v-for="(item,index) in col" :key="index">{{item.label}}</view>
  13. </picker-view-column>
  14. </picker-view>
  15. </view>
  16. <view class="w-picker-view" v-if="mode=='half'">
  17. <picker-view :indicator-style="itemHeight" :value="pickVal" @change="bindChange" @touchstart="touchStart" @touchend="touchEnd">
  18. <picker-view-column>
  19. <view class="w-picker-item" v-for="(item,index) in data.years" :key="index">{{item}}年</view>
  20. </picker-view-column>
  21. <picker-view-column>
  22. <view class="w-picker-item" v-for="(item,index) in data.months" :key="index">{{item}}月</view>
  23. </picker-view-column>
  24. <picker-view-column>
  25. <view class="w-picker-item" v-for="(item,index) in data.days" :key="index">{{item}}日</view>
  26. </picker-view-column>
  27. <picker-view-column>
  28. <view class="w-picker-item" v-for="(item,index) in data.areas" :key="index">{{item.label}}</view>
  29. </picker-view-column>
  30. </picker-view>
  31. </view>
  32. <view class="w-picker-view" v-if="mode=='date'">
  33. <picker-view :indicator-style="itemHeight" :value="pickVal" @change="bindChange" @touchstart="touchStart" @touchend="touchEnd">
  34. <picker-view-column>
  35. <view class="w-picker-item" v-for="(item,index) in data.years" :key="index">{{item}}年</view>
  36. </picker-view-column>
  37. <picker-view-column>
  38. <view class="w-picker-item" v-for="(item,index) in data.months" :key="index">{{item}}月</view>
  39. </picker-view-column>
  40. <picker-view-column>
  41. <view class="w-picker-item" v-for="(item,index) in data.days" :key="index">{{item}}日</view>
  42. </picker-view-column>
  43. </picker-view>
  44. </view>
  45. <view class="w-picker-view" v-if="mode=='yearMonth'">
  46. <picker-view :indicator-style="itemHeight" :value="pickVal" @change="bindChange" @touchstart="touchStart" @touchend="touchEnd">
  47. <picker-view-column>
  48. <view class="w-picker-item" v-for="(item,index) in data.years" :key="index">{{item}}年</view>
  49. </picker-view-column>
  50. <picker-view-column>
  51. <view class="w-picker-item" v-for="(item,index) in data.months" :key="index">{{item}}月</view>
  52. </picker-view-column>
  53. </picker-view>
  54. </view>
  55. <view class="w-picker-view" v-if="mode=='dateTime'">
  56. <picker-view :indicator-style="itemHeight" :value="pickVal" @change="bindChange" @touchstart="touchStart" @touchend="touchEnd">
  57. <picker-view-column>
  58. <view class="w-picker-item" v-for="(item,index) in data.years" :key="index">{{item}}年</view>
  59. </picker-view-column>
  60. <picker-view-column>
  61. <view class="w-picker-item" v-for="(item,index) in data.months" :key="index">{{item}}月</view>
  62. </picker-view-column>
  63. <picker-view-column >
  64. <view class="w-picker-item" v-for="(item,index) in data.days" :key="index">{{item}}日</view>
  65. </picker-view-column>
  66. <picker-view-column>
  67. <view class="w-picker-item" v-for="(item,index) in data.hours" :key="index">{{item}}时</view>
  68. </picker-view-column>
  69. <picker-view-column>
  70. <view class="w-picker-item" v-for="(item,index) in data.minutes" :key="index">{{item}}分</view>
  71. </picker-view-column>
  72. <picker-view-column v-if="hasSecond">
  73. <view class="w-picker-item" v-for="(item,index) in data.seconds" :key="index">{{item}}秒</view>
  74. </picker-view-column>
  75. </picker-view>
  76. </view>
  77. <view class="w-picker-view" v-if="mode=='range'">
  78. <picker-view :indicator-style="itemHeight" :value="pickVal" @change="bindChange" @touchstart="touchStart" @touchend="touchEnd">
  79. <picker-view-column>
  80. <view class="w-picker-item" v-for="(item,index) in data.fyears" :key="index">{{item}}</view>
  81. </picker-view-column>
  82. <picker-view-column>
  83. <view class="w-picker-item" v-for="(item,index) in data.fmonths" :key="index">{{item}}</view>
  84. </picker-view-column>
  85. <picker-view-column>
  86. <view class="w-picker-item" v-for="(item,index) in data.fdays" :key="index">{{item}}</view>
  87. </picker-view-column>
  88. <picker-view-column>
  89. <view class="w-picker-item">-</view>
  90. </picker-view-column>
  91. <picker-view-column>
  92. <view class="w-picker-item" v-for="(item,index) in data.tyears" :key="index">{{item}}</view>
  93. </picker-view-column>
  94. <picker-view-column>
  95. <view class="w-picker-item" v-for="(item,index) in data.tmonths" :key="index">{{item}}</view>
  96. </picker-view-column>
  97. <picker-view-column>
  98. <view class="w-picker-item" v-for="(item,index) in data.tdays" :key="index">{{item}}</view>
  99. </picker-view-column>
  100. </picker-view>
  101. </view>
  102. <view class="w-picker-view" v-if="mode=='time'">
  103. <picker-view :indicator-style="itemHeight" :value="pickVal" @change="bindChange" @touchstart="touchStart" @touchend="touchEnd">
  104. <picker-view-column>
  105. <view class="w-picker-item" v-for="(item,index) in data.hours" :key="index">{{item}}时</view>
  106. </picker-view-column>
  107. <picker-view-column>
  108. <view class="w-picker-item" v-for="(item,index) in data.minutes" :key="index">{{item}}分</view>
  109. </picker-view-column>
  110. <picker-view-column v-if="hasSecond">
  111. <view class="w-picker-item" v-for="(item,index) in data.seconds" :key="index">{{item}}秒</view>
  112. </picker-view-column>
  113. </picker-view>
  114. </view>
  115. <view class="w-picker-view" v-if="mode=='region'">
  116. <picker-view :indicator-style="itemHeight" :value="pickVal" @change="bindChange" @touchstart="touchStart" @touchend="touchEnd">
  117. <picker-view-column>
  118. <view class="w-picker-item" v-for="(item,index) in data.provinces" :key="index">{{item.label}}</view>
  119. </picker-view-column>
  120. <picker-view-column>
  121. <view class="w-picker-item" v-for="(item,index) in data.citys" :key="index">{{item.label}}</view>
  122. </picker-view-column>
  123. <picker-view-column v-if="!hideArea">
  124. <view class="w-picker-item" v-for="(item,index) in data.areas" :key="index">{{item.label}}</view>
  125. </picker-view-column>
  126. </picker-view>
  127. </view>
  128. <view class="w-picker-view" v-if="mode=='selector'">
  129. <picker-view :indicator-style="itemHeight" :value="pickVal" @change="bindChange" @touchstart="touchStart" @touchend="touchEnd">
  130. <picker-view-column>
  131. <view class="w-picker-item" v-for="(item,index) in data" :key="index">{{item.label}}</view>
  132. </picker-view-column>
  133. </picker-view>
  134. </view>
  135. <view class="w-picker-view" v-if="mode=='limit'">
  136. <picker-view :indicator-style="itemHeight" :value="pickVal" @change="bindChange" @touchstart="touchStart" @touchend="touchEnd">
  137. <picker-view-column>
  138. <view class="w-picker-item" v-for="(item,index) in data.date" :key="index">{{item.label}}</view>
  139. </picker-view-column>
  140. <picker-view-column>
  141. <view class="w-picker-item" v-for="(item,index) in data.hours" :key="index">{{item.label}}时</view>
  142. </picker-view-column>
  143. <picker-view-column>
  144. <view class="w-picker-item" v-for="(item,index) in data.minutes" :key="index">{{item.label}}分</view>
  145. </picker-view-column>
  146. </picker-view>
  147. </view>
  148. <view class="w-picker-view" v-if="mode=='limitHour'">
  149. <picker-view :indicator-style="itemHeight" :value="pickVal" @change="bindChange" @touchstart="touchStart" @touchend="touchEnd">
  150. <picker-view-column>
  151. <view class="w-picker-item" v-for="(item,index) in data.date" :key="index">{{item.label}}</view>
  152. </picker-view-column>
  153. <picker-view-column>
  154. <view class="w-picker-item" v-for="(item,index) in data.areas" :key="index">{{item.label}}</view>
  155. </picker-view-column>
  156. <picker-view-column>
  157. <view class="w-picker-item" v-for="(item,index) in data.hours" :key="index">{{item.label}}时</view>
  158. </picker-view-column>
  159. </picker-view>
  160. </view>
  161. </view>
  162. </view>
  163. </template>
  164. <script>
  165. import provinces from './city-data/province.js';
  166. import citys from './city-data/city.js';
  167. import areas from './city-data/area.js';
  168. import initPicker from "./w-picker.js";
  169. function oneOf (value, validList) {
  170. for (let i = 0; i < validList.length; i++) {
  171. if (value === validList[i]) {
  172. return true;
  173. }
  174. }
  175. throw new Error('mode无效,请选择有效的mode!');
  176. return false;
  177. }
  178. export default {
  179. data() {
  180. return {
  181. result:[],
  182. data:{},
  183. checkArr:[],
  184. checkValue:[],
  185. pickVal:[],
  186. showPicker:false,
  187. resultStr:"",
  188. itemHeight:`height: ${uni.upx2px(88)}px;`,
  189. confirmFlag:true
  190. };
  191. },
  192. computed:{
  193. },
  194. props:{
  195. mode:{
  196. type:String,
  197. validator(mode){
  198. let modeList=['half','date', 'dateTime', 'yearMonth','time','region','selector','limit','limitHour','range','linkage'];//过滤无效mode;
  199. return oneOf(mode,modeList);
  200. },
  201. default(){
  202. return "date"
  203. }
  204. },
  205. themeColor:{
  206. type:String,
  207. default(){
  208. return "#0abd0a"
  209. }
  210. },
  211. startYear:{
  212. type:[String,Number],
  213. default(){
  214. return "1970"
  215. }
  216. },
  217. endYear:{
  218. type:[String,Number],
  219. default(){
  220. return new Date().getFullYear()+''
  221. }
  222. },
  223. defaultVal:{
  224. type:[Array,String],
  225. default:""
  226. },
  227. areaCode:{
  228. type:Array,
  229. default(){
  230. return null
  231. }
  232. },
  233. hideArea:{//隐藏省市区三级联动 地区列
  234. type:Boolean,
  235. default:false
  236. },
  237. step:{
  238. type:[String,Number],
  239. default:1
  240. },
  241. current:{
  242. type:Boolean,
  243. default:false
  244. },
  245. selectList:{
  246. type:Array,
  247. default(){
  248. return [];
  249. }
  250. },
  251. //以下参数仅对mode==limit有效
  252. dayStep:{
  253. type:[String,Number],
  254. default:7
  255. },
  256. startHour:{
  257. type:[String,Number],
  258. default:8
  259. },
  260. endHour:{
  261. type:[String,Number],
  262. default:20
  263. },
  264. minuteStep:{
  265. type:[String,Number],
  266. default:10
  267. },
  268. afterStep:{
  269. type:[String,Number],
  270. default:30
  271. },
  272. disabledAfter:{
  273. type:Boolean,
  274. default:false
  275. },
  276. linkList:{
  277. type:Array,
  278. default(){
  279. return []
  280. }
  281. },
  282. value:{
  283. type:Array,
  284. default(){
  285. return null
  286. }
  287. },
  288. level:{
  289. type:[Number,String],
  290. default:2
  291. },
  292. timeout:{
  293. type:Boolean,
  294. default:false
  295. },
  296. hasSecond:{
  297. type:Boolean,
  298. default:true
  299. }
  300. },
  301. watch:{
  302. mode(){
  303. this.initData();
  304. },
  305. selectList(){
  306. this.initData();
  307. },
  308. linkList(){
  309. this.initData();
  310. },
  311. defaultVal(val){
  312. this.initData();
  313. console.log(val)
  314. },
  315. areaCode(){
  316. this.initData();
  317. },
  318. value(){
  319. this.initData();
  320. }
  321. },
  322. methods:{
  323. touchStart(){
  324. if(this.timeout){
  325. this.confirmFlag=false;
  326. }
  327. },
  328. touchEnd(){
  329. if(this.timeout){
  330. setTimeout(()=>{
  331. this.confirmFlag=true;
  332. },500)
  333. }
  334. },
  335. getLinkageVal(value,flag){
  336. let dval=[];
  337. let list=this.linkList;
  338. let lev=this.level;
  339. let arr=value;
  340. let k=0;
  341. let checkArr=[];
  342. let checkValue=[];
  343. let resultStr="";
  344. let data=[];
  345. switch(lev){
  346. case 2:
  347. dval=[0,0];
  348. break;
  349. case 3:
  350. dval=[0,0,0];
  351. break;
  352. }
  353. const getData=(obj,key,str)=>{
  354. if(key<lev){
  355. data.push(obj);
  356. if(!arr){
  357. let item=obj[0];
  358. checkArr.push(item.label);
  359. checkValue.push(item.value);
  360. resultStr+=item.label;
  361. if(item.children){
  362. getData(item.children,key+=1);
  363. }
  364. }else{
  365. obj.map((v,j)=>{
  366. if(flag?v.value==arr[key]:v.label==arr[key]){
  367. dval[key]=j;
  368. checkArr.push(v.label);
  369. checkValue.push(v.value);
  370. resultStr+=v.label;
  371. if(v.children){
  372. getData(v.children,key+=1);
  373. }
  374. }
  375. });
  376. }
  377. return {
  378. data,
  379. dval,
  380. checkArr,
  381. checkValue,
  382. resultStr
  383. };
  384. }else{
  385. return false;
  386. }
  387. };
  388. return getData(list,k);
  389. },
  390. getRegionVal(value,useCode){
  391. let province=value[0];
  392. let city=value[1];
  393. let a=0,b=0,c=0,dval=[];
  394. let _this=this;
  395. provinces.map((v,k)=>{
  396. if(useCode?v.value==province:v.label==province){
  397. a=k;
  398. }
  399. })
  400. citys[a].map((v,k)=>{
  401. if(useCode?v.value==city:v.label==city){
  402. b=k;
  403. }
  404. })
  405. if(!_this.hideArea){
  406. let area=value[2];
  407. areas[a][b].map((v,k)=>{
  408. if(useCode?v.value==area:v.label==area){
  409. c=k;
  410. }
  411. })
  412. dval=[a,b,c];
  413. }else{
  414. dval=[a,b];
  415. }
  416. return dval;
  417. },
  418. useCurrent(){
  419. let aToday=new Date();
  420. let tYear=aToday.getFullYear().toString();
  421. let tMonth=this.formatNum(aToday.getMonth()+1).toString();
  422. let tDay=this.formatNum(aToday.getDate()).toString();
  423. let tHours=this.formatNum(aToday.getHours()).toString();
  424. let tMinutes=this.formatNum(aToday.getMinutes()).toString();
  425. let tSeconds=this.formatNum(aToday.getSeconds()).toString();
  426. if(this.current||!this.defaultVal){
  427. switch(this.mode){
  428. case "range":
  429. return [tYear+"-"+tMonth+"-"+tDay,tYear+"-"+tMonth+"-"+tDay];
  430. break;
  431. case "date":
  432. return tYear+"-"+tMonth+"-"+tDay;
  433. break;
  434. case "yearMonth":
  435. return tYear+"-"+tMonth;
  436. break;
  437. case "time":
  438. if(this.hasSecond){
  439. return tHours+":"+(Math.floor(tMinutes/this.step)*this.step).toString()+":"+tSeconds;
  440. }else{
  441. return tHours+":"+(Math.floor(tMinutes/this.step)*this.step).toString();
  442. }
  443. break;
  444. case "dateTime":
  445. if(this.hasSecond){
  446. return tYear+"-"+tMonth+"-"+tDay+" "+tHours+":"+(Math.floor(tMinutes/this.step)*this.step).toString()+":"+tSeconds;
  447. }else{
  448. return tYear+"-"+tMonth+"-"+tDay+" "+tHours+":"+(Math.floor(tMinutes/this.step)*this.step).toString();
  449. }
  450. break;
  451. default :
  452. return tYear+"-"+tMonth+"-"+tDay+" "+tHours+":"+(Math.floor(tMinutes/this.step)*this.step).toString()+":"+tSeconds;
  453. break;
  454. }
  455. }else{
  456. return this.defaultVal;
  457. }
  458. },
  459. formatNum(num){
  460. return num<10?'0'+num:num+'';
  461. },
  462. maskTap(){
  463. this.$emit("cancel",{
  464. checkArr:this.checkArr,
  465. defaultVal:this.pickVal
  466. });
  467. this.showPicker = false;
  468. },
  469. show(){
  470. this.showPicker = true;
  471. },
  472. hide(){
  473. this.showPicker = false;
  474. },
  475. pickerCancel(){
  476. this.$emit("cancel",{
  477. checkArr:this.checkArr,
  478. defaultVal:this.pickVal
  479. });
  480. this.showPicker = false;
  481. },
  482. pickerConfirm(e){
  483. if(!this.confirmFlag){
  484. return;
  485. }
  486. switch(this.mode){
  487. case "range":
  488. let checkArr=this.checkArr;
  489. let fDateTime=new Date(checkArr[0],checkArr[1],checkArr[2]);
  490. let tDateTime=new Date(checkArr[3],checkArr[4],checkArr[5]);
  491. let dVal=this.pickVal;
  492. if(fDateTime>tDateTime){
  493. this.checkArr=[checkArr[3],checkArr[4],checkArr[5],checkArr[0],checkArr[1],checkArr[2]];
  494. this.pickVal=[dVal[4],dVal[5],dVal[6],0,dVal[0],dVal[1],dVal[2]];
  495. this.$emit("confirm",{
  496. checkArr:[...this.checkArr],
  497. from:checkArr[3]+"-"+checkArr[4]+"-"+checkArr[5],
  498. to:checkArr[0]+"-"+checkArr[1]+"-"+checkArr[2],
  499. defaultVal:[...this.pickVal],
  500. result:this.resultStr
  501. });
  502. }else{
  503. this.$emit("confirm",{
  504. checkArr:[...this.checkArr],
  505. from:checkArr[0]+"-"+checkArr[1]+"-"+checkArr[2],
  506. to:checkArr[3]+"-"+checkArr[4]+"-"+checkArr[5],
  507. defaultVal:[...this.pickVal],
  508. result:this.resultStr
  509. });
  510. }
  511. break;
  512. case "limit":
  513. let aTime=new Date().getTime();
  514. let bTime=new Date(this.resultStr.replace(/-/g,'/')).getTime();
  515. if(aTime>bTime){
  516. uni.showModal({
  517. title:"提示",
  518. content:"选择时间必须大于当前时间",
  519. confirmColor:this.themeColor
  520. });
  521. return;
  522. }
  523. this.$emit("confirm",{
  524. checkArr:[...this.checkArr],
  525. defaultVal:[...this.pickVal],
  526. result:this.resultStr
  527. });
  528. break;
  529. case "region":
  530. case "linkage":
  531. this.$emit("confirm",{
  532. checkArr:[...this.checkArr],
  533. checkValue:[...this.checkValue],
  534. defaultVal:[...this.pickVal],
  535. result:this.resultStr
  536. });
  537. break;
  538. case "selector":
  539. this.$emit("confirm",{
  540. checkArr:this.checkArr,
  541. defaultVal:[...this.pickVal],
  542. result:this.resultStr
  543. });
  544. break;
  545. default:
  546. this.$emit("confirm",{
  547. checkArr:[this.checkArr],
  548. defaultVal:[...this.pickVal],
  549. result:this.resultStr
  550. });
  551. break;
  552. }
  553. this.showPicker = false;
  554. },
  555. bindChange(val){
  556. let _this=this;
  557. let arr=val.detail.value;
  558. let year="",month="",day="",hour="",minute="",second="",note=[],province,city,area;
  559. let checkArr=_this.checkArr;
  560. let days=[],months=[],endYears=[],endMonths=[],endDays=[],startDays=[];
  561. let mode=_this.mode;
  562. let col1,col2,col3,d,a,h,m;
  563. let xDate=new Date().getTime();
  564. switch(mode){
  565. case "limitHour":
  566. col1=_this.data.date[arr[0]];
  567. col2=_this.data.areas[arr[1]];
  568. col3=_this.data.hours[arr[2]];
  569. if(col1.value!=checkArr[0].value){
  570. arr[1]=0;
  571. arr[2]=0;
  572. let areas=initPicker.limitHour.initAreas(col1);
  573. _this.data.areas=areas;
  574. let hours=initPicker.limitHour.initHours(col1,_this.data.areas[arr[1]]);
  575. _this.data.hours=hours;
  576. };
  577. if(col2.value!=checkArr[1].value){
  578. arr[2]=0;
  579. let hours=initPicker.limitHour.initHours(col1,_this.data.areas[arr[1]]);
  580. _this.data.hours=hours;
  581. };
  582. d=_this.data.date[arr[0]]||_this.data.date[_this.data.date.length-1];
  583. a=_this.data.areas[arr[1]]||_this.data.areas[_this.data.areas.length-1];
  584. h=_this.data.hours[arr[2]]||_this.data.hours[_this.data.hours.length-1];
  585. _this.checkArr=[d,a,h];
  586. _this.resultStr=`${d.value+' '+a.label+' '+h.label+"时"}`;
  587. break;
  588. case "limit":
  589. col1=_this.data.date[arr[0]];
  590. col2=_this.data.hours[arr[1]];
  591. if(col1.value!=checkArr[0].value){
  592. let hours=initPicker.limit.initHours(_this.startHour,_this.endHour,_this.minuteStep,_this.afterStep,col1.value);
  593. let minutes=initPicker.limit.initMinutes(_this.startHour,_this.endHour,_this.minuteStep,_this.afterStep,col1.value,col2.value);
  594. _this.data.hours=hours;
  595. _this.data.minutes=minutes;
  596. };
  597. if(col2.value!=checkArr[1].value){
  598. let minutes=initPicker.limit.initMinutes(_this.startHour,_this.endHour,_this.minuteStep,_this.afterStep,col1.value,col2.value);
  599. _this.data.minutes=minutes;
  600. };
  601. d=_this.data.date[arr[0]]||_this.data.date[_this.data.date.length-1];
  602. h=_this.data.hours[arr[1]]||_this.data.hours[_this.data.hours.length-1];
  603. m=_this.data.minutes[arr[2]]||_this.data.minutes[_this.data.minutes.length-1];
  604. _this.checkArr=[d,h,m];
  605. _this.resultStr=`${d.value+' '+h.value+':'+m.value+":"+"00"}`;
  606. break;
  607. case "range":
  608. let fyear=_this.data.fyears[arr[0]]||_this.data.fyears[_this.data.fyears.length-1];
  609. let fmonth=_this.data.fmonths[arr[1]]||_this.data.fmonths[_this.data.fmonths.length-1];
  610. let fday=_this.data.fdays[arr[2]]||_this.data.fdays[_this.data.fdays.length-1];
  611. let tyear=_this.data.tyears[arr[4]]||_this.data.tyears[_this.data.tyears.length-1];
  612. let tmonth=_this.data.tmonths[arr[5]]||_this.data.tmonths[_this.data.tmonths.length-1];
  613. let tday=_this.data.tdays[arr[6]]||_this.data.tdays[_this.data.tdays.length-1];
  614. if(fyear!=checkArr[0]){
  615. arr[4]=0;
  616. arr[5]=0;
  617. arr[6]=0;
  618. startDays=initPicker.range.initStartDays(fyear,fmonth);
  619. endYears=initPicker.range.initEndYears(fyear,_this.startYear,_this.endYear);
  620. endMonths=initPicker.range.initEndMonths(fmonth);
  621. endDays=initPicker.range.initEndDays(fyear,fmonth,fday,tyear,tmonth);
  622. _this.data.fdays=startDays;
  623. _this.data.tyears=endYears;
  624. _this.data.tmonths=endMonths;
  625. _this.data.tdays=endDays;
  626. tyear=_this.data.tyears[0];
  627. checkArr[3]=_this.data.tyears[0];
  628. tmonth=_this.data.tmonths[0];
  629. checkArr[4]=_this.data.tmonths[0];
  630. tday=_this.data.tdays[0];
  631. checkArr[5]=_this.data.tdays[0];
  632. };
  633. if(fmonth!=checkArr[1]){
  634. arr[4]=0;
  635. arr[5]=0;
  636. arr[6]=0;
  637. startDays=initPicker.range.initStartDays(fyear,fmonth);
  638. endYears=initPicker.range.initEndYears(fyear,_this.startYear,_this.endYear);
  639. endMonths=initPicker.range.initEndMonths(fmonth);
  640. endDays=initPicker.range.initEndDays(fyear,fmonth,fday,tyear,tmonth);
  641. _this.data.fdays=startDays;
  642. _this.data.tyears=endYears;
  643. _this.data.tmonths=endMonths;
  644. _this.data.tdays=endDays;
  645. tyear=_this.data.tyears[0];
  646. checkArr[3]=_this.data.tyears[0];
  647. tmonth=_this.data.tmonths[0];
  648. checkArr[4]=_this.data.tmonths[0];
  649. tday=_this.data.tdays[0];
  650. checkArr[5]=_this.data.tdays[0];
  651. };
  652. if(fday!=checkArr[2]){
  653. arr[4]=0;
  654. arr[5]=0;
  655. arr[6]=0;
  656. endYears=initPicker.range.initEndYears(fyear,_this.startYear,_this.endYear);
  657. endMonths=initPicker.range.initEndMonths(fmonth);
  658. endDays=initPicker.range.initEndDays(fyear,fmonth,fday,tyear,tmonth);
  659. _this.data.tyears=endYears;
  660. _this.data.tmonths=endMonths;
  661. _this.data.tdays=endDays;
  662. tyear=_this.data.tyears[0];
  663. checkArr[3]=_this.data.tyears[0];
  664. tmonth=_this.data.tmonths[0];
  665. checkArr[4]=_this.data.tmonths[0];
  666. tday=_this.data.tdays[0];
  667. checkArr[5]=_this.data.tdays[0];
  668. };
  669. if(tyear!=checkArr[3]){
  670. arr[5]=0;
  671. arr[6]=0;
  672. endMonths=initPicker.range.initToMonths(fyear,fmonth,fday,tyear);
  673. endDays=initPicker.range.initEndDays(fyear,fmonth,fday,tyear,tmonth);
  674. _this.data.tmonths=endMonths;
  675. _this.data.tdays=endDays;
  676. tmonth=_this.data.tmonths[0];
  677. checkArr[4]=_this.data.tmonths[0];
  678. tday=_this.data.tdays[0];
  679. checkArr[5]=_this.data.tdays[0];
  680. };
  681. if(tmonth!=checkArr[4]){
  682. arr[6]=0;
  683. endDays=initPicker.range.initToDays(fyear,fmonth,fday,tyear,tmonth);
  684. _this.data.tdays=endDays;
  685. tday=_this.data.tdays[0];
  686. checkArr[5]=_this.data.tdays[0];
  687. };
  688. _this.checkArr=[fyear,fmonth,fday,tyear,tmonth,tday];
  689. _this.resultStr=`${fyear+'-'+fmonth+'-'+fday+'至'+tyear+'-'+tmonth+'-'+tday}`;
  690. break;
  691. case "half":
  692. year=_this.data.years[arr[0]]||_this.data.years[_this.data.years.length-1];
  693. month=_this.data.months[arr[1]]||_this.data.months[_this.data.months.length-1];
  694. day=_this.data.days[arr[2]]||_this.data.days[_this.data.days.length-1];
  695. area=_this.data.areas[arr[3]]||_this.data.areas[_this.data.areas.length-1];
  696. if(year!=checkArr[0]){
  697. months=initPicker.date.initMonths(year,_this.disabledAfter);
  698. days=initPicker.date.initDays(year,month,_this.disabledAfter);
  699. if(_this.disabledAfter){
  700. arr[1]=arr[1]>(months.length-1)?months.length-1:arr[1];
  701. arr[2]=arr[2]>(days.length-1)?days.length-1:arr[2];
  702. month=_this.data.months[arr[1]]||_this.data.months[_this.data.months.length-1];
  703. day=_this.data.days[arr[2]]||_this.data.days[_this.data.days.length-1];
  704. }
  705. _this.data.days=days;
  706. _this.data.months=months;
  707. };
  708. if(month!=checkArr[1]){
  709. days=initPicker.date.initDays(year,month,_this.disabledAfter);
  710. arr[2]=arr[2]>(days.length-1)?days.length-1:arr[2];
  711. day=_this.data.days[arr[2]]||_this.data.days[_this.data.days.length-1];
  712. _this.data.days=days;
  713. };
  714. _this.checkArr=[year,month,day,area];
  715. _this.resultStr=`${year+'-'+month+'-'+day+area.label}`;
  716. break;
  717. case "date":
  718. year=_this.data.years[arr[0]]||_this.data.years[_this.data.years.length-1];
  719. month=_this.data.months[arr[1]]||_this.data.months[_this.data.months.length-1];
  720. day=_this.data.days[arr[2]]||_this.data.days[_this.data.days.length-1];
  721. if(year!=checkArr[0]){
  722. months=initPicker.date.initMonths(year,_this.disabledAfter);
  723. days=initPicker.date.initDays(year,month,_this.disabledAfter);
  724. if(_this.disabledAfter){
  725. arr[1]=arr[1]>(months.length-1)?months.length-1:arr[1];
  726. arr[2]=arr[2]>(days.length-1)?days.length-1:arr[2];
  727. month=_this.data.months[arr[1]]||_this.data.months[_this.data.months.length-1];
  728. day=_this.data.days[arr[2]]||_this.data.days[_this.data.days.length-1];
  729. }
  730. _this.data.days=days;
  731. _this.data.months=months;
  732. };
  733. if(month!=checkArr[1]){
  734. days=initPicker.date.initDays(year,month,_this.disabledAfter);
  735. arr[2]=arr[2]>(days.length-1)?days.length-1:arr[2];
  736. day=_this.data.days[arr[2]]||_this.data.days[_this.data.days.length-1];
  737. _this.data.days=days;
  738. };
  739. _this.checkArr=[year,month,day];
  740. _this.resultStr=`${year+'-'+month+'-'+day}`;
  741. break;
  742. case "yearMonth":
  743. year=_this.data.years[arr[0]]||_this.data.years[_this.data.years.length-1];
  744. month=_this.data.months[arr[1]]||_this.data.months[_this.data.months.length-1];
  745. if(year!=checkArr[0]){
  746. if(_this.disabledAfter){
  747. arr[1]=arr[1]>(months.length-1)?months.length-1:arr[1];
  748. month=_this.data.months[arr[1]]||_this.data.months[_this.data.months.length-1];
  749. }
  750. months=initPicker.date.initMonths(year,_this.disabledAfter);
  751. _this.data.months=months;
  752. };
  753. _this.checkArr=[year,month];
  754. _this.resultStr=`${year+'-'+month}`;
  755. break;
  756. case "dateTime":
  757. year=_this.data.years[arr[0]]||_this.data.years[_this.data.years.length-1];
  758. month=_this.data.months[arr[1]]||_this.data.months[_this.data.months.length-1];
  759. day=_this.data.days[arr[2]]||_this.data.days[_this.data.days.length-1];
  760. hour=_this.data.hours[arr[3]]||_this.data.hours[_this.data.hours.length-1];
  761. minute=_this.data.minutes[arr[4]]||_this.data.minutes[_this.data.minutes.length-1];
  762. if(year!=checkArr[0]){
  763. arr[2]=0;
  764. days=initPicker.date.initDays(year,month);
  765. day=_this.data.days[arr[2]]||_this.data.days[_this.data.days.length-1];
  766. _this.data.days=days;
  767. };
  768. if(month!=checkArr[1]){
  769. arr[2]=0;
  770. days=initPicker.date.initDays(year,month);
  771. day=_this.data.days[arr[2]]||_this.data.days[_this.data.days.length-1];
  772. _this.data.days=days;
  773. };
  774. if(_this.hasSecond){
  775. second=_this.data.seconds[arr[5]]||_this.data.seconds[_this.data.seconds.length-1];
  776. _this.checkArr=[year,month,day,hour,minute,second];
  777. _this.resultStr=`${year+'-'+month+'-'+day+' '+hour+':'+minute+':'+second}`;
  778. }else{
  779. _this.checkArr=[year,month,day,hour,minute];
  780. _this.resultStr=`${year+'-'+month+'-'+day+' '+hour+':'+minute}`;
  781. }
  782. break;
  783. case "time":
  784. hour=_this.data.hours[arr[0]]||_this.data.hours[_this.data.hours.length-1];
  785. minute=_this.data.minutes[arr[1]]||_this.data.minutes[_this.data.minutes.length-1];
  786. if(_this.hasSecond){
  787. second=_this.data.seconds[arr[2]]||_this.data.seconds[_this.data.seconds.length-1];
  788. _this.checkArr=[hour,minute,second];
  789. _this.resultStr=`${hour+':'+minute+':'+second}`;
  790. }else{
  791. _this.checkArr=[hour,minute];
  792. _this.resultStr=`${hour+':'+minute}`;
  793. }
  794. break;
  795. case "linkage":
  796. let c1,c2,c3;
  797. let list=this.linkList;
  798. c1=_this.data[0][arr[0]]||_this.data[0][0];
  799. c2=_this.data[1][arr[1]]||_this.data[1][0];
  800. if(this.level==3){
  801. c3=_this.data[2][arr[2]]||_this.data[2][0];
  802. if(c1.label!=checkArr[0]){
  803. arr[1] = 0;
  804. arr[2] = 0;
  805. _this.data[1]=list[arr[0]].children;
  806. _this.data[2]=list[arr[0]].children[arr[1]].children;
  807. c2=_this.data[1][arr[1]]||_this.data[1][0];
  808. c3=_this.data[2][arr[2]]||_this.data[2][0];
  809. };
  810. if(c2.label!=checkArr[1]){
  811. arr[2] = 0;
  812. _this.data[2]=list[arr[0]].children[arr[1]].children;
  813. c3=_this.data[2][arr[2]]||_this.data[2][0];
  814. };
  815. _this.checkArr=[c1.label,c2.label,c3.label];
  816. _this.checkValue=[
  817. _this.data[0][arr[0]]?_this.data[0][arr[0]].value:_this.data[0][0].value,
  818. _this.data[1][arr[1]]?_this.data[1][arr[1]].value:_this.data[1][0].value,
  819. _this.data[2][arr[2]]?_this.data[2][arr[2]].value:_this.data[2][0].value
  820. ];
  821. _this.resultStr=c1.label+c2.label+c3.label;
  822. }else{
  823. if(c1.label!=checkArr[0]){
  824. _this.data[1]=list[arr[0]].children;
  825. arr[1] = 0;
  826. c2=_this.data[1][arr[1]]||_this.data[1][0];
  827. };
  828. _this.checkArr=[c1.label,c2.label];
  829. _this.checkValue=[
  830. _this.data[0][arr[0]]?_this.data[0][arr[0]].value:_this.data[0][0].value,
  831. _this.data[1][arr[1]]?_this.data[1][arr[1]].value:_this.data[1][0].value
  832. ];
  833. _this.resultStr=c1.label+c2.label;
  834. }
  835. break;
  836. case "region":
  837. province=_this.data.provinces[arr[0]]||_this.data.provinces[0];
  838. city=_this.data.citys[arr[1]]||_this.data.citys[0];
  839. if(!_this.hideArea){
  840. area=_this.data.areas[arr[2]]||_this.data.areas[0];
  841. }
  842. if(province.label!=checkArr[0]){
  843. _this.data.citys = citys[arr[0]]||citys[0];
  844. if(!_this.hideArea){
  845. _this.data.areas = areas[arr[0]][0]||areas[0][0];
  846. }
  847. arr[1] = 0;
  848. arr[2] = 0;
  849. city=_this.data.citys[arr[1]]||_this.data.citys[0];
  850. if(!_this.hideArea){
  851. area=_this.data.areas[arr[2]]||_this.data.areas[0];
  852. }
  853. };
  854. if(city.label!=checkArr[1]&&!_this.hideArea){
  855. _this.data.areas = areas[arr[0]][arr[1]]||areas[0][0];
  856. arr[2]=0;
  857. area=_this.data.areas[arr[2]]||_this.data.areas[0];
  858. };
  859. if(!_this.hideArea){
  860. _this.checkArr=[province.label,city.label,area.label];
  861. _this.checkValue=[
  862. _this.data.provinces[arr[0]]?_this.data.provinces[arr[0]].value:_this.data.provinces[0].value,
  863. _this.data.citys[arr[1]]?_this.data.citys[arr[1]].value:_this.data.citys[0].value,
  864. _this.data.areas[arr[2]]?_this.data.areas[arr[2]].value:_this.data.areas[0].value
  865. ];
  866. _this.resultStr=province.label+city.label+area.label;
  867. }else{
  868. _this.checkArr=[province.label,city.label];
  869. _this.checkValue=[
  870. _this.data.provinces[arr[0]]?_this.data.provinces[arr[0]].value:_this.data.provinces[0].value,
  871. _this.data.citys[arr[1]]?_this.data.citys[arr[1]].value:_this.data.citys[0].value
  872. ];
  873. _this.resultStr=province.label+city.label;
  874. };
  875. break;
  876. case "selector":
  877. _this.checkArr=_this.data[arr[0]]||_this.data[_this.data.length-1];
  878. _this.resultStr=_this.data[arr[0]]?_this.data[arr[0]].label:_this.data[_this.data.length-1].label;
  879. break;
  880. }
  881. _this.$nextTick(()=>{
  882. _this.pickVal=arr;
  883. })
  884. },
  885. initData(){
  886. let _this=this;
  887. let data={};
  888. let mode=_this.mode;
  889. let year,month,day,hour,minute,second,province,city,area;
  890. let col1,col2,col3;
  891. let dVal=[];
  892. switch(mode){
  893. case "linkage":
  894. let init;
  895. if(_this.value){
  896. init=_this.getLinkageVal(_this.value,true);
  897. }else{
  898. init=_this.getLinkageVal(_this.defaultVal);
  899. }
  900. dVal=init.dval;
  901. data=init.data;
  902. _this.checkArr=init.checkArr;
  903. _this.checkValue=init.checkValue;
  904. _this.resultStr=init.resultStr;
  905. break;
  906. case "region":
  907. if(_this.areaCode){
  908. dVal=_this.getRegionVal(_this.areaCode,true);
  909. }else{
  910. dVal=_this.getRegionVal(_this.defaultVal);
  911. }
  912. if(_this.hideArea){
  913. data={
  914. provinces:provinces,
  915. citys:citys[dVal[0]]
  916. };
  917. }else{
  918. data={
  919. provinces:provinces,
  920. citys:citys[dVal[0]],
  921. areas:areas[dVal[0]][dVal[1]]
  922. };
  923. };
  924. break;
  925. case "selector":
  926. let idx=0;
  927. data=[..._this.selectList];
  928. _this.selectList.map((v,k)=>{
  929. if(v.label==this.defaultVal){
  930. idx=k;
  931. }
  932. })
  933. dVal=[idx];
  934. break;
  935. case "limit":
  936. data=initPicker.limit.init(_this.dayStep,_this.startHour,_this.endHour,_this.minuteStep,_this.afterStep,this.defaultVal);
  937. dVal=data.defaultVal||_this.defaultVal;
  938. break;
  939. case "limitHour":
  940. data=initPicker.limitHour.init(_this.dayStep,this.defaultVal);
  941. dVal=data.defaultVal||_this.defaultVal;
  942. break;
  943. case "range":
  944. data=initPicker.range.init(_this.startYear,_this.endYear,_this.useCurrent(),_this.current);
  945. dVal=data.defaultVal||_this.defaultVal;
  946. break;
  947. default:
  948. data=initPicker.date.init(_this.startYear,_this.endYear,_this.mode,_this.step,_this.useCurrent(),_this.current,_this.disabledAfter,_this.hasSecond);
  949. dVal=data.defaultVal||_this.defaultVal;
  950. break;
  951. }
  952. _this.data=data;
  953. switch(mode){
  954. case "limitHour":
  955. col1=data.date[dVal[0]]||data.date[data.date.length-1];
  956. col2=data.areas[dVal[2]]||data.areas[data.areas.length-1];
  957. col3=data.hours[dVal[1]]||data.hours[data.hours.length-1];
  958. _this.checkArr=[col1,col2,col3];
  959. _this.resultStr=`${col1.value+' '+col2.label+' '+col3.label+'时'}`;
  960. break;
  961. case "limit":
  962. col1=data.date[dVal[0]]||data.date[data.date.length-1];
  963. col2=data.hours[dVal[1]]||data.hours[data.hours.length-1];
  964. col3=data.minutes[dVal[2]]||data.minutes[data.minutes.length-1];
  965. _this.checkArr=[col1,col2,col3];
  966. _this.resultStr=`${col1.value+' '+col2.value+':'+col3.value+":"+"00"}`;
  967. break;
  968. case "range":
  969. let fYear=data.fyears[dVal[0]]||data.fyears[data.fyears.length-1];
  970. let fmonth=data.fmonths[dVal[1]]||data.fmonths[data.fmonths.length-1];
  971. let fday=data.fdays[dVal[2]]||data.fdays[data.fdays.length-1];
  972. let tYear=data.tyears[dVal[4]]||data.tyears[data.tyears.length-1];
  973. let tmonth=data.tmonths[dVal[5]]||data.tmonths[data.tmonths.length-1];
  974. let tday=data.tdays[dVal[6]]||data.tdays[data.tdays.length-1];
  975. _this.checkArr=[fYear,fmonth,fday,tYear,tmonth,tday];
  976. _this.resultStr=`${fYear+'-'+fmonth+'-'+fday+'至'+tYear+'-'+tmonth+'-'+tday}`;
  977. break;
  978. case "half":
  979. year=data.years[dVal[0]]||data.years[data.years.length-1];
  980. month=data.months[dVal[1]]||data.months[data.months.length-1];
  981. day=data.days[dVal[2]]||data.days[data.days.length-1];
  982. area=data.areas[dVal[3]]||data.areas[data.areas.length-1];
  983. _this.checkArr=[year,month,day,area];
  984. _this.resultStr=`${year+'-'+month+'-'+day+' '+area.label}`;
  985. break;
  986. case "date":
  987. year=data.years[dVal[0]]||data.years[data.years.length-1];
  988. month=data.months[dVal[1]]||data.months[data.months.length-1];
  989. day=data.days[dVal[2]]||data.days[data.days.length-1];
  990. _this.checkArr=[year,month,day];
  991. _this.resultStr=`${year+'-'+month+'-'+day}`;
  992. break;
  993. case "yearMonth":
  994. year=data.years[dVal[0]]||data.years[data.years.length-1];
  995. month=data.months[dVal[1]]||data.months[data.months.length-1];
  996. _this.checkArr=[year,month];
  997. _this.resultStr=`${year+'-'+month}`;
  998. break;
  999. case "dateTime":
  1000. year=data.years[dVal[0]]||data.years[data.years.length-1];
  1001. month=data.months[dVal[1]]||data.months[data.months.length-1];
  1002. day=data.days[dVal[2]]||data.days[data.days.length-1];
  1003. hour=data.hours[dVal[3]]||data.hours[data.hours.length-1];
  1004. minute=data.minutes[dVal[4]]||data.minutes[data.minutes.length-1];
  1005. if(_this.hasSecond){
  1006. second=data.seconds[dVal[5]]||data.seconds[data.seconds.length-1];
  1007. _this.resultStr=`${year+'-'+month+'-'+day+' '+hour+':'+minute+':'+second}`;
  1008. _this.checkArr=[year,month,day,hour,minute,second];
  1009. }else{
  1010. _this.resultStr=`${year+'-'+month+'-'+day+' '+hour+':'+minute}`;
  1011. _this.checkArr=[year,month,day,hour,minute];
  1012. }
  1013. break;
  1014. case "time":
  1015. hour=data.hours[dVal[0]]||data.hours[data.hours.length-1];
  1016. minute=data.minutes[dVal[1]]||data.minutes[data.minutes.length-1];
  1017. if(_this.hasSecond){
  1018. second=data.seconds[dVal[2]]||data.seconds[data.seconds.length-1];
  1019. _this.resultStr=`${hour+':'+minute+':'+second}`;
  1020. _this.checkArr=[hour,minute,second];
  1021. }else{
  1022. _this.resultStr=`${hour+':'+minute}`;
  1023. _this.checkArr=[hour,minute];
  1024. }
  1025. break;
  1026. case "region":
  1027. province=data.provinces[dVal[0]];
  1028. city=data.citys[dVal[1]];
  1029. if(!_this.hideArea){
  1030. area=data.areas[dVal[2]];
  1031. _this.checkArr=[province.label,city.label,area.label];
  1032. _this.checkValue=[province.value,city.value,area.value];
  1033. _this.resultStr=province.label+city.label+area.label;
  1034. }else{
  1035. _this.checkArr=[province.label,city.label];
  1036. _this.checkValue=[province.value,city.value];
  1037. _this.resultStr=province.label+city.label;
  1038. }
  1039. break;
  1040. case "selector":
  1041. _this.checkArr=data[dVal[0]]||data[data.length-1];
  1042. _this.resultStr=data[dVal[0]].label||data[data.length-1].label;
  1043. break;
  1044. }
  1045. _this.$nextTick(()=>{
  1046. _this.pickVal=[...dVal];
  1047. })
  1048. }
  1049. },
  1050. mounted() {
  1051. this.initData();
  1052. }
  1053. }
  1054. </script>
  1055. <style lang="scss">
  1056. .w-picker{
  1057. position: relative;
  1058. z-index: 888;
  1059. .mask {
  1060. position: fixed;
  1061. z-index: 1000;
  1062. top: 0;
  1063. right: 0;
  1064. left: 0;
  1065. bottom: 0;
  1066. background: rgba(0, 0, 0, 0.6);
  1067. visibility: hidden;
  1068. opacity: 0;
  1069. transition: all 0.3s ease;
  1070. }
  1071. .mask.show{
  1072. visibility: visible;
  1073. opacity: 1;
  1074. }
  1075. .w-picker-cnt {
  1076. position: fixed;
  1077. bottom: 0;
  1078. left: 0;
  1079. width: 100%;
  1080. transition: all 0.3s ease;
  1081. transform: translateY(100%);
  1082. z-index: 3000;
  1083. }
  1084. .w-picker-cnt.show {
  1085. transform: translateY(0);
  1086. }
  1087. .w-picker-hd {
  1088. display: flex;
  1089. align-items: center;
  1090. padding: 0 30upx;
  1091. height: 88upx;
  1092. background-color: #fff;
  1093. position: relative;
  1094. text-align: center;
  1095. font-size: 32upx;
  1096. justify-content: space-between;
  1097. .w-picker-btn{
  1098. font-size: 30upx;
  1099. }
  1100. }
  1101. .w-picker-hd:after {
  1102. content: ' ';
  1103. position: absolute;
  1104. left: 0;
  1105. bottom: 0;
  1106. right: 0;
  1107. height: 1px;
  1108. border-bottom: 1px solid #e5e5e5;
  1109. color: #e5e5e5;
  1110. transform-origin: 0 100%;
  1111. transform: scaleY(0.5);
  1112. }
  1113. .w-picker-item {
  1114. text-align: center;
  1115. width: 100%;
  1116. height: 88upx;
  1117. line-height: 88upx;
  1118. text-overflow: ellipsis;
  1119. white-space: nowrap;
  1120. font-size: 30upx;
  1121. }
  1122. .w-picker-view {
  1123. width: 100%;
  1124. height: 476upx;
  1125. overflow: hidden;
  1126. background-color: rgba(255, 255, 255, 1);
  1127. z-index: 666;
  1128. }
  1129. picker-view{
  1130. height: 100%;
  1131. }
  1132. }
  1133. </style>