酒店桌布为微信小程序
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

173 lines
3.6 KiB

  1. <template>
  2. <!-- 修改营业时间弹框 -->
  3. <uv-overlay :show="show" @click="close">
  4. <view class="warp">
  5. <view class="rect" @tap.stop>
  6. <view class="title">修改营业时间</view>
  7. <view class="center">
  8. <view style="display: flex;justify-content: center;gap: 20rpx;">
  9. <view>上班时间</view>
  10. <view @click="startDateOpen()">
  11. {{ startTime }}
  12. <uv-datetime-picker ref="startDateRef" v-model="startTime" mode="time"
  13. @confirm="startDateChange()"></uv-datetime-picker>
  14. </view>
  15. </view>
  16. <view style="display: flex;justify-content: center;gap: 20rpx;">
  17. <view>下班时间</view>
  18. <view @click="endDateOpen()">
  19. {{ endTime }}
  20. <uv-datetime-picker style="z-index: 999;" ref="endDateRef" v-model="endTime" mode="time"
  21. @confirm="endDateChange()"></uv-datetime-picker>
  22. </view>
  23. </view>
  24. </view>
  25. <view class="bottom">
  26. <view>
  27. <uv-button type="info" shape="circle" text="取消" :custom-style="customStyle1"
  28. @click="close"></uv-button>
  29. </view>
  30. <view>
  31. <uv-button type="info" shape="circle" text="确定" :custom-style="customStyle2"
  32. @click="confirm"></uv-button>
  33. </view>
  34. </view>
  35. </view>
  36. </view>
  37. </uv-overlay>
  38. </template>
  39. <script>
  40. import dayjs from '../../uni_modules/uv-ui-tools/libs/util/dayjs';
  41. export default {
  42. data() {
  43. return {
  44. show: false,
  45. startTime: dayjs(new Date()).format("HH:mm"),
  46. endTime: dayjs(new Date()).format("HH:mm")
  47. }
  48. },
  49. computed: {
  50. customStyle1() {
  51. return {
  52. height: '60rpx',
  53. background: '#FFF',
  54. color: '#000000',
  55. fontSize: '36rpx',
  56. borderRadius: '40rpx', //圆角
  57. // nvue中必须是下方的写法
  58. 'border-top-right-radius': '40rpx',
  59. 'border-bottom-left-radius': '40rpx',
  60. 'border-bottom-right-radius': '40rpx',
  61. 'width': '150rpx',
  62. }
  63. },
  64. customStyle2() {
  65. return {
  66. height: '60rpx',
  67. background: '#fd5100',
  68. color: '#FFF',
  69. fontSize: '34px',
  70. borderRadius: '40rpx', //圆角
  71. // nvue中必须是下方的写法
  72. 'border-top-right-radius': '40rpx',
  73. 'border-bottom-left-radius': '40rpx',
  74. 'border-bottom-right-radius': '40rpx',
  75. 'width': '150rpx',
  76. }
  77. }
  78. },
  79. methods: {
  80. startDateChange(val) {
  81. this.$nextTick(() => {
  82. this.startTime = val.value
  83. });
  84. },
  85. startDateOpen() {
  86. this.$refs.startDateRef.open();
  87. },
  88. endDateChange(val) {
  89. this.$nextTick(() => {
  90. this.endTime = val.value
  91. });
  92. },
  93. endDateOpen() {
  94. this.$refs.endDateRef.open();
  95. },
  96. open() {
  97. this.show = true
  98. },
  99. close() {
  100. this.show = false
  101. },
  102. confirm() {
  103. this.show = false
  104. this.$api('updateJobTime', {
  105. time: this.startTime + '-' + this.endTime
  106. }, res => {
  107. if (res.code == 200) {
  108. uni.showToast({
  109. icon: 'success',
  110. title: '修改营业时间成功',
  111. duration: 1500
  112. })
  113. }
  114. })
  115. },
  116. }
  117. }
  118. </script>
  119. <style scoped lang="scss">
  120. .uv-popup {
  121. z-index: 999;
  122. }
  123. .warp {
  124. display: flex;
  125. align-items: center;
  126. justify-content: center;
  127. height: 100%;
  128. }
  129. .rect {
  130. width: 600rpx;
  131. height: 300rpx;
  132. background-color: #fff;
  133. border-radius: 20rpx;
  134. overflow: hidden;
  135. .title {
  136. padding: 10rpx 0 0 15rpx;
  137. background-color: #fd5100;
  138. color: #FFF;
  139. text-align: left;
  140. width: 100%;
  141. height: 18%;
  142. font-size: 36rpx;
  143. }
  144. .center {
  145. height: 50%;
  146. display: flex;
  147. flex-direction: column;
  148. gap: 20rpx;
  149. // justify-content: center;
  150. // align-items: center;
  151. font-size: 36rpx;
  152. }
  153. .bottom {
  154. display: flex;
  155. justify-content: center;
  156. gap: 50rpx;
  157. }
  158. }
  159. </style>