uni-datetime-picker.vue 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820
  1. <template>
  2. <view class="uni-date">
  3. <view class="uni-date-editor--x" :class="{'uni-date-editor--x__disabled': disabled,
  4. 'uni-date-x--border': border}">
  5. <view v-if="!isRange" class="uni-date-x uni-date-single" @click="show">
  6. <view class="uni-date__icon-logo">
  7. <image class="uni-date-editor--logo" src="./icon/cale-50.png" mode=""></image>
  8. </view>
  9. <input class="uni-date__input" type="text" v-model="singleVal" :placeholder="placeholder"
  10. :disabled="true" />
  11. </view>
  12. <view v-else class="uni-date-x uni-date-range" @click="show">
  13. <view class="uni-date__icon-logo">
  14. <image class="uni-date-editor--logo" src="./icon/cale-50.png" mode=""></image>
  15. </view>
  16. <input class="uni-date__input uni-date-range__input" type="text" v-model="range.startDate"
  17. :placeholder="startPlaceholder" :disabled="true" />
  18. <slot>
  19. <view class="">{{rangeSeparator}}</view>
  20. </slot>
  21. <input class="uni-date__input uni-date-range__input" type="text" v-model="range.endDate"
  22. :placeholder="endPlaceholder" :disabled="true" />
  23. </view>
  24. <view v-show="!disabled && (singleVal || (range.startDate && range.endDate))" class="uni-date__icon-clear"
  25. @click="clear">
  26. <uni-icons type="clear" color="#e1e1e1" size="14"></uni-icons>
  27. </view>
  28. </view>
  29. <view v-show="popup" class="uni-date-mask" @click="close"></view>
  30. <view ref="datePicker" v-show="popup" class="uni-date-picker__container">
  31. <view v-if="!isRange" class="uni-date-single--x" :style="popover">
  32. <view v-show="hasTime" class="uni-date-changed popup-x-header">
  33. <input class="uni-date__input uni-date-range__input" type="text" v-model="tempSingleDate"
  34. placeholder="选择日期" />
  35. <time-picker type="time" v-model="time" :border="false" :disabled="!tempSingleDate"
  36. :start="reactStartTime" :end="reactEndTime">
  37. <input class="uni-date__input uni-date-range__input" type="text" v-model="time"
  38. placeholder="选择时间" :disabled="!tempSingleDate" />
  39. </time-picker>
  40. </view>
  41. <uni-calendar ref="pcSingle" :showMonth="false" :start-date="caleRange.startDate"
  42. :end-date="caleRange.endDate" :date="defSingleDate" @change="singleChange" />
  43. <view v-if="hasTime" class="popup-x-footer">
  44. <!-- <text class="">此刻</text> -->
  45. <text class="confirm" @click="confirmSingleChange">确定</text>
  46. </view>
  47. <view class="uni-date-popper__arrow"></view>
  48. </view>
  49. <view v-else class="uni-date-range--x" :style="popover">
  50. <view v-show="hasTime" class="popup-x-header uni-date-changed">
  51. <view class="popup-x-header--datetime">
  52. <input class="uni-date__input uni-date-range__input" type="text" v-model="tempRange.startDate"
  53. placeholder="开始日期" />
  54. <time-picker type="time" v-model="tempRange.startTime" :start="reactStartTime" :border="false"
  55. :disabled="!tempRange.startDate">
  56. <input class="uni-date__input uni-date-range__input" type="text"
  57. v-model="tempRange.startTime" placeholder="开始时间" :disabled="!tempRange.startDate" />
  58. </time-picker>
  59. </view>
  60. <uni-icons type="arrowthinright" color="#999" style="line-height: 40px;"></uni-icons>
  61. <view class="popup-x-header--datetime">
  62. <input class="uni-date__input uni-date-range__input" type="text" v-model="tempRange.endDate"
  63. placeholder="结束日期" />
  64. <time-picker type="time" v-model="tempRange.endTime" :end="reactEndTime" :border="false"
  65. :disabled="!tempRange.endDate">
  66. <input class="uni-date__input uni-date-range__input" type="text" v-model="tempRange.endTime"
  67. placeholder="结束时间" :disabled="!tempRange.endDate" />
  68. </time-picker>
  69. </view>
  70. </view>
  71. <view class="popup-x-body">
  72. <uni-calendar ref="left" :showMonth="false" :start-date="caleRange.startDate"
  73. :end-date="caleRange.endDate" :range="true" @change="leftChange" :pleStatus="endMultipleStatus"
  74. @firstEnterCale="updateRightCale" @monthSwitch="leftMonthSwitch" style="padding-right: 16px;" />
  75. <uni-calendar ref="right" :showMonth="false" :start-date="caleRange.startDate"
  76. :end-date="caleRange.endDate" :range="true" @change="rightChange"
  77. :pleStatus="startMultipleStatus" @firstEnterCale="updateLeftCale"
  78. @monthSwitch="rightMonthSwitch" style="padding-left: 16px;border-left: 1px solid #F1F1F1;" />
  79. </view>
  80. <view v-if="hasTime" class="popup-x-footer">
  81. <text class="" @click="clear">清空</text>
  82. <text class="confirm" @click="confirmRangeChange">确定</text>
  83. </view>
  84. </view>
  85. </view>
  86. <uni-calendar ref="mobile" :clearDate="false" :date="defSingleDate" :defTime="reactMobDefTime"
  87. :start-date="caleRange.startDate" :end-date="caleRange.endDate" :selectableTimes="mobSelectableTime"
  88. :pleStatus="endMultipleStatus" :showMonth="false" :range="isRange" :typeHasTime="hasTime" :insert="false"
  89. @confirm="mobileChange" />
  90. </view>
  91. </template>
  92. <script>
  93. import uniCalendar from './basic/uni-calendar.vue'
  94. import timePicker from './basic/time-picker/components/time-picker/time-picker.vue'
  95. /**
  96. * DatetimePicker 时间选择器
  97. * @description 同时支持 PC 和移动端使用日历选择日期和日期范围
  98. * @tutorial https://ext.dcloud.net.cn/plugin?id=3962
  99. * @property {String} type 选择器类型
  100. * @property {String|Array} value 绑定值
  101. * @property {String} placeholder 单选择时的占位内容
  102. * @property {String} start-placeholder 范围选择时开始日期的占位内容
  103. * @property {String} end-placeholder 范围选择时结束日期的占位内容
  104. * @property {String} range-separator 选择范围时的分隔符
  105. * @property {Boolean} border = [true|false] 是否有边框
  106. * @property {Boolean} disabled = [true|false] 是否禁用
  107. * @event {Function} change 确定日期时触发的事件
  108. **/
  109. export default {
  110. name:'UniDatetimePicker',
  111. components: {
  112. uniCalendar,
  113. timePicker
  114. },
  115. data() {
  116. return {
  117. isRange: false,
  118. hasTime: false,
  119. mobileRange: false,
  120. // 单选
  121. singleVal: '',
  122. tempSingleDate: '',
  123. defSingleDate: '',
  124. time: '',
  125. // 范围选
  126. caleRange: {
  127. startDate: '',
  128. startTime: '',
  129. endDate: '',
  130. endTime: ''
  131. },
  132. range: {
  133. startDate: '',
  134. // startTime: '',
  135. endDate: '',
  136. // endTime: ''
  137. },
  138. tempRange: {
  139. startDate: '',
  140. startTime: '',
  141. endDate: '',
  142. endTime: ''
  143. },
  144. // 左右日历同步数据
  145. startMultipleStatus: {
  146. before: '',
  147. after: '',
  148. data: [],
  149. fulldate: ''
  150. },
  151. endMultipleStatus: {
  152. before: '',
  153. after: '',
  154. data: [],
  155. fulldate: ''
  156. },
  157. visible: false,
  158. popup: false,
  159. popover: null
  160. }
  161. },
  162. props: {
  163. type: {
  164. type: String,
  165. default: 'datetime'
  166. },
  167. value: {
  168. type: [String, Number, Array],
  169. default: ''
  170. },
  171. start: {
  172. type: [Number, String],
  173. default: ''
  174. },
  175. end: {
  176. type: [Number, String],
  177. default: ''
  178. },
  179. returnType: {
  180. type: String,
  181. default: 'string'
  182. },
  183. placeholder: {
  184. type: String,
  185. default: '选择日期'
  186. },
  187. startPlaceholder: {
  188. type: String,
  189. default: '起始日期'
  190. },
  191. endPlaceholder: {
  192. type: String,
  193. default: '结束日期'
  194. },
  195. rangeSeparator: {
  196. type: String,
  197. default: '-'
  198. },
  199. border: {
  200. type: [Boolean],
  201. default: true
  202. },
  203. disabled: {
  204. type: [Boolean],
  205. default: false
  206. }
  207. },
  208. watch: {
  209. type: {
  210. immediate: true,
  211. handler(newVal, oldVal) {
  212. if (newVal.indexOf('time') !== -1) {
  213. this.hasTime = true
  214. }
  215. if (newVal.indexOf('range') !== -1) {
  216. this.isRange = true
  217. } else {
  218. this.isRange = false
  219. }
  220. }
  221. },
  222. value: {
  223. immediate: true,
  224. handler(newVal, oldVal) {
  225. if (!newVal) return
  226. if (!Array.isArray(newVal) && !this.isRange) {
  227. const {
  228. defDate,
  229. defTime
  230. } = this.parseDate(newVal)
  231. this.singleVal = defDate
  232. this.tempSingleDate = defDate
  233. this.defSingleDate = defDate
  234. if (this.hasTime) {
  235. this.singleVal = defDate + ' ' + defTime
  236. this.time = defTime
  237. }
  238. } else {
  239. if (oldVal) return // 只初始默认值
  240. const [before, after] = newVal
  241. if (!before && !after) return
  242. const defBefore = this.parseDate(before)
  243. const defAfter = this.parseDate(after)
  244. this.range.startDate = this.tempRange.startDate = defBefore.defDate
  245. this.range.endDate = this.tempRange.endDate = defAfter.defDate
  246. if (this.hasTime) {
  247. this.range.startDate = defBefore.defDate + ' ' + defBefore.defTime
  248. this.range.endDate = defAfter.defDate + ' ' + defAfter.defTime
  249. this.tempRange.startTime = defBefore.defTime
  250. this.tempRange.endTime = defAfter.defTime
  251. }
  252. const defaultRange = {
  253. before: defBefore.defDate,
  254. after: defAfter.defDate
  255. }
  256. this.startMultipleStatus = Object.assign({}, this.startMultipleStatus, defaultRange, {
  257. which: 'right'
  258. })
  259. this.endMultipleStatus = Object.assign({}, this.endMultipleStatus, defaultRange, {
  260. which: 'left'
  261. })
  262. }
  263. }
  264. },
  265. start: {
  266. immediate: true,
  267. handler(newVal, oldVal) {
  268. if (!newVal) return
  269. const {
  270. defDate,
  271. defTime
  272. } = this.parseDate(newVal)
  273. this.caleRange.startDate = defDate
  274. if (this.hasTime) {
  275. this.caleRange.startTime = defTime
  276. }
  277. }
  278. },
  279. end: {
  280. immediate: true,
  281. handler(newVal, oldVal) {
  282. if (!newVal) return
  283. const {
  284. defDate,
  285. defTime
  286. } = this.parseDate(newVal)
  287. this.caleRange.endDate = defDate
  288. if (this.hasTime) {
  289. this.caleRange.endTime = defTime
  290. }
  291. }
  292. },
  293. },
  294. computed: {
  295. reactStartTime() {
  296. const activeDate = this.isRange ? this.tempRange.startDate : this.tempSingleDate
  297. const res = activeDate === this.caleRange.startDate ? this.caleRange.startTime : ''
  298. return res
  299. },
  300. reactEndTime() {
  301. const activeDate = this.isRange ? this.tempRange.endDate : this.tempSingleDate
  302. const res = activeDate === this.caleRange.endDate ? this.caleRange.endTime : ''
  303. return res
  304. },
  305. reactMobDefTime() {
  306. return this.isRange ? {
  307. start: this.tempRange.startTime,
  308. end: this.tempRange.endTime
  309. } : this.time
  310. },
  311. mobSelectableTime() {
  312. return {
  313. start: this.caleRange.startTime,
  314. end: this.caleRange.endTime
  315. }
  316. }
  317. },
  318. mounted() {
  319. if (this.isRange) {
  320. if (!Array.isArray(this.value)) return
  321. const [before, after] = this.value
  322. if (before && after) return
  323. setTimeout(() => {
  324. this.$refs.right.next()
  325. this.$refs.right.cale.lastHover = false
  326. }, 20)
  327. }
  328. },
  329. methods: {
  330. updateLeftCale(e) {
  331. // console.log('----updateStartCale:', e);
  332. const left = this.$refs.left
  333. // 设置范围选
  334. left.cale.setHoverMultiple(e.after)
  335. left.setDate(this.$refs.left.nowDate.fullDate)
  336. },
  337. updateRightCale(e) {
  338. // console.log('----updateStartCale:', e);
  339. const right = this.$refs.right
  340. // 设置范围选
  341. right.cale.setHoverMultiple(e.after)
  342. right.setDate(this.$refs.right.nowDate.fullDate)
  343. },
  344. getRef() {
  345. this.$refs.left.pre()
  346. },
  347. show(event) {
  348. if (this.disabled) {
  349. return
  350. }
  351. const systemInfo = uni.getSystemInfoSync()
  352. if (systemInfo.windowWidth <= 500) {
  353. this.$refs.mobile.open()
  354. return
  355. }
  356. this.popover = {
  357. top: '10px'
  358. }
  359. // const dateEditor = uni.createSelectorQuery().in(this).select(".uni-date-editor--x")
  360. // dateEditor.boundingClientRect(rect => {
  361. // console.log(22222222, rect);
  362. // if (leftWindowInfo.errMsg) {
  363. // left = rect.left + 'px'
  364. // } else {
  365. // left = '15px'
  366. // }
  367. // this.popover = {
  368. // // top: rect.top + rect.height + 15 + 'px',
  369. // top: '40px',
  370. // left: 0,
  371. // }
  372. // }).exec()
  373. setTimeout(() => {
  374. this.popup = !this.popup
  375. // this.visible = true
  376. }, 20)
  377. },
  378. close() {
  379. setTimeout(() => {
  380. this.popup = false
  381. // this.visible = true
  382. }, 20)
  383. },
  384. setEmit(value) {
  385. if (this.returnType === "timestamp") {
  386. if (!Array.isArray(value)) {
  387. if (!this.hasTime) {
  388. value = value + ' ' + '00:00:00'
  389. }
  390. value = this.createTimestamp(value)
  391. } else {
  392. if (!this.hasTime) {
  393. value[0] = value[0] + ' ' + '00:00:00'
  394. value[1] = value[1] + ' ' + '00:00:00'
  395. }
  396. value[0] = this.createTimestamp(value[0])
  397. value[1] = this.createTimestamp(value[1])
  398. }
  399. }
  400. this.$emit('change', value)
  401. this.$emit('input', value)
  402. },
  403. createTimestamp(date) {
  404. date = this.fixIosDateFormat(date)
  405. return Date.parse(new Date(date))
  406. },
  407. singleChange(e) {
  408. this.tempSingleDate = e.fulldate
  409. if (this.hasTime) return
  410. this.confirmSingleChange()
  411. },
  412. confirmSingleChange() {
  413. if (!this.tempSingleDate) {
  414. this.popup = false
  415. return
  416. }
  417. if (this.hasTime) {
  418. this.singleVal = this.tempSingleDate + ' ' + (this.time ? this.time : '00:00:00')
  419. } else {
  420. this.singleVal = this.tempSingleDate
  421. }
  422. this.setEmit(this.singleVal)
  423. this.popup = false
  424. },
  425. leftChange(e) {
  426. const {
  427. before,
  428. after
  429. } = e.range
  430. this.rangeChange(before, after)
  431. const obj = {
  432. before: e.range.before,
  433. after: e.range.after,
  434. data: e.range.data,
  435. fulldate: e.fulldate
  436. }
  437. this.startMultipleStatus = Object.assign({}, this.startMultipleStatus, obj)
  438. // console.log('startMultipleStatus 返回:', this.startMultipleStatus)
  439. },
  440. rightChange(e) {
  441. const {
  442. before,
  443. after
  444. } = e.range
  445. this.rangeChange(before, after)
  446. const obj = {
  447. before: e.range.before,
  448. after: e.range.after,
  449. data: e.range.data,
  450. fulldate: e.fulldate
  451. }
  452. this.endMultipleStatus = Object.assign({}, this.endMultipleStatus, obj)
  453. // console.log('endMultipleStatus 返回:', this.endMultipleStatus)
  454. },
  455. mobileChange(e) {
  456. if (this.isRange) {
  457. const {
  458. before,
  459. after
  460. } = e.range
  461. this.handleStartAndEnd(before, after, true)
  462. if (this.hasTime) {
  463. const {
  464. startTime,
  465. endTime
  466. } = e.timeRange
  467. this.tempRange.startTime = startTime
  468. this.tempRange.endTime = endTime
  469. }
  470. this.confirmRangeChange()
  471. } else {
  472. if (this.hasTime) {
  473. this.singleVal = e.fulldate + ' ' + e.time
  474. } else {
  475. this.singleVal = e.fulldate
  476. }
  477. this.setEmit(this.singleVal)
  478. }
  479. this.$refs.mobile.close()
  480. },
  481. rangeChange(before, after) {
  482. if (!(before && after)) return
  483. this.handleStartAndEnd(before, after, true)
  484. if (this.hasTime) return
  485. this.confirmRangeChange()
  486. },
  487. confirmRangeChange() {
  488. if (!this.tempRange.startDate && !this.tempRange.endDate) {
  489. this.popup = false
  490. return
  491. }
  492. let start, end
  493. if (!this.hasTime) {
  494. start = this.range.startDate = this.tempRange.startDate
  495. end = this.range.endDate = this.tempRange.endDate
  496. } else {
  497. start = this.range.startDate = this.tempRange.startDate + ' ' +
  498. (this.tempRange.startTime ? this.tempRange.startTime : '00:00:00')
  499. end = this.range.endDate = this.tempRange.endDate + ' ' +
  500. (this.tempRange.endTime ? this.tempRange.endTime : '00:00:00')
  501. }
  502. const displayRange = [start, end]
  503. this.setEmit(displayRange)
  504. this.popup = false
  505. },
  506. handleStartAndEnd(before, after, temp = false) {
  507. if (!(before && after)) return
  508. const type = temp ? 'tempRange' : 'range'
  509. if (this.dateCompare(before, after)) {
  510. this[type].startDate = before
  511. this[type].endDate = after
  512. } else {
  513. this[type].startDate = after
  514. this[type].endDate = before
  515. }
  516. },
  517. /**
  518. * 比较时间大小
  519. */
  520. dateCompare(startDate, endDate) {
  521. // 计算截止时间
  522. startDate = new Date(startDate.replace('-', '/').replace('-', '/'))
  523. // 计算详细项的截止时间
  524. endDate = new Date(endDate.replace('-', '/').replace('-', '/'))
  525. if (startDate <= endDate) {
  526. return true
  527. } else {
  528. return false
  529. }
  530. },
  531. clear() {
  532. if (!this.isRange) {
  533. this.singleVal = ''
  534. this.$refs.pcSingle.calendar.fullDate = ''
  535. this.$refs.pcSingle.setDate()
  536. this.$emit('change', '')
  537. this.$emit('input', '')
  538. } else {
  539. this.range.startDate = ''
  540. this.range.endDate = ''
  541. this.tempRange = {}
  542. this.$refs.left.cale.multipleStatus.before = ''
  543. this.$refs.left.cale.multipleStatus.after = ''
  544. this.$refs.left.cale.multipleStatus.data = []
  545. this.$refs.left.cale.lastHover = false
  546. this.$refs.left.setDate()
  547. this.$refs.right.cale.multipleStatus.before = ''
  548. this.$refs.right.cale.multipleStatus.after = ''
  549. this.$refs.right.cale.multipleStatus.data = []
  550. this.$refs.right.cale.lastHover = false
  551. this.$refs.right.setDate()
  552. this.$refs.right.next()
  553. this.$emit('change', ['', ''])
  554. this.$emit('input', ['', ''])
  555. }
  556. // if (this.popup) this.popup = false
  557. },
  558. parseDate(date) {
  559. date = this.fixIosDateFormat(date)
  560. const defVal = new Date(date)
  561. const year = defVal.getFullYear()
  562. const month = defVal.getMonth() + 1
  563. const day = defVal.getDate()
  564. const hour = defVal.getHours()
  565. const minute = defVal.getMinutes()
  566. const second = defVal.getSeconds()
  567. const defDate = year + '-' + this.lessTen(month) + '-' + this.lessTen(day)
  568. const defTime = this.lessTen(hour) + ':' + this.lessTen(minute) + ':' + this.lessTen(second)
  569. return {
  570. defDate,
  571. defTime
  572. }
  573. },
  574. lessTen(item) {
  575. return item < 10 ? '0' + item : item
  576. },
  577. //兼容 iOS、safari 日期格式
  578. fixIosDateFormat(value) {
  579. if (typeof value === 'string') {
  580. value = value.replace(/-/g, '/')
  581. }
  582. return value
  583. },
  584. leftMonthSwitch(e) {
  585. // console.log('leftMonthSwitch 返回:', e)
  586. },
  587. rightMonthSwitch(e) {
  588. // console.log('rightMonthSwitch 返回:', e)
  589. }
  590. }
  591. }
  592. </script>
  593. <style>
  594. .uni-date-x {
  595. display: flex;
  596. align-items: center;
  597. justify-content: center;
  598. padding: 0 10px;
  599. border-radius: 4px;
  600. background-color: #fff;
  601. color: #666;
  602. font-size: 14px;
  603. }
  604. .uni-date-x--border {
  605. box-sizing: border-box;
  606. border-radius: 4px;
  607. border: 1px solid #dcdfe6;
  608. }
  609. .uni-date-editor--x {
  610. position: relative;
  611. }
  612. .uni-date-editor--x:hover .uni-date__icon-clear {
  613. position: absolute;
  614. top: 5px;
  615. right: 0;
  616. display: inline-block;
  617. box-sizing: border-box;
  618. border: 6px solid transparent;
  619. margin-right: 6px;
  620. /* #ifdef H5 */
  621. cursor: pointer;
  622. /* #endif */
  623. }
  624. .uni-date__icon-clear {
  625. display: none;
  626. }
  627. .uni-date__input {
  628. height: 40px;
  629. width: 100%;
  630. padding: 0 8px;
  631. line-height: 40px;
  632. font-size: 14px;
  633. }
  634. .uni-date-range__input {
  635. text-align: center;
  636. }
  637. .uni-date-picker__container {
  638. position: relative;
  639. /* position: fixed;
  640. left: 0;
  641. right: 0;
  642. top: 0;
  643. bottom: 0;
  644. box-sizing: border-box;
  645. z-index: 996;
  646. font-size: 14px; */
  647. }
  648. .uni-date-mask {
  649. position: fixed;
  650. bottom: 0px;
  651. top: 0px;
  652. left: 0px;
  653. right: 0px;
  654. background-color: rgba(0, 0, 0, 0);
  655. transition-duration: 0.3s;
  656. z-index: 996;
  657. }
  658. .uni-date-single--x {
  659. /* padding: 0 8px; */
  660. position: absolute;
  661. top: 0;
  662. left: 0;
  663. z-index: 999;
  664. /* width: 375px; */
  665. border: 1px solid #e4e7ed;
  666. box-shadow: 0 2px 12px 0 rgb(0 0 0 / 10%);
  667. border-radius: 4px;
  668. }
  669. .uni-date-range--x {
  670. padding: 0 8px;
  671. background-color: #fff;
  672. position: absolute;
  673. top: 0;
  674. left: 0;
  675. z-index: 999;
  676. /* width: 733px; */
  677. border: 1px solid #e4e7ed;
  678. box-shadow: 0 2px 12px 0 rgb(0 0 0 / 10%);
  679. border-radius: 4px;
  680. }
  681. .uni-date-editor--x__disabled {
  682. opacity: 0.4;
  683. cursor: default;
  684. }
  685. .uni-date-editor--logo {
  686. width: 16px;
  687. height: 16px;
  688. vertical-align: middle;
  689. }
  690. /* 添加时间 */
  691. .popup-x-header {
  692. /* #ifndef APP-NVUE */
  693. display: flex;
  694. /* #endif */
  695. flex-direction: row;
  696. /* justify-content: space-between; */
  697. }
  698. .popup-x-header--datetime {
  699. /* #ifndef APP-NVUE */
  700. display: flex;
  701. /* #endif */
  702. flex-direction: row;
  703. flex: 1;
  704. }
  705. .popup-x-body {
  706. display: flex;
  707. }
  708. .popup-x-footer {
  709. padding: 0 15px;
  710. border-top-color: #F1F1F1;
  711. border-top-style: solid;
  712. border-top-width: 1px;
  713. background-color: #fff;
  714. line-height: 40px;
  715. text-align: right;
  716. color: #666;
  717. }
  718. .popup-x-footer text:hover {
  719. color: #007aff;
  720. cursor: pointer;
  721. opacity: 0.8;
  722. }
  723. .popup-x-footer .confirm {
  724. margin-left: 20px;
  725. color: #007aff;
  726. }
  727. .uni-date-changed {
  728. background-color: #fff;
  729. text-align: center;
  730. color: #333;
  731. border-bottom-color: #F1F1F1;
  732. border-bottom-style: solid;
  733. border-bottom-width: 1px;
  734. /* padding: 0 50px; */
  735. }
  736. .uni-date-changed--time text {
  737. /* padding: 0 20px; */
  738. height: 50px;
  739. line-height: 50px;
  740. }
  741. .uni-date-changed .uni-date-changed--time {
  742. /* display: flex; */
  743. flex: 1;
  744. }
  745. .uni-date-changed--time-date {
  746. color: #333;
  747. opacity: 0.6;
  748. }
  749. /* .uni-date-popper__arrow {
  750. width: 10px;
  751. height: 10px;
  752. top: -6px;
  753. left: 35px;
  754. margin-right: 3px;
  755. border-top-width: 0;
  756. border-bottom-color: #ebeef5;
  757. border-width: 6px;
  758. filter: drop-shadow(0 2px 12px rgba(0,0,0,.03));
  759. }
  760. .uni-date-popper__arrow:after {
  761. content: " ";
  762. position: absolute;
  763. display: block;
  764. width: 0;
  765. height: 0;
  766. border-color: transparent;
  767. border-style: solid;
  768. } */
  769. .mr-50 {
  770. margin-right: 50px;
  771. }
  772. </style>