addHours.vue 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134
  1. <template>
  2. <view>
  3. <cu-custom bgColor="bg-fff" :isBack="true">
  4. <block slot="content">添加营业时间</block>
  5. </cu-custom>
  6. <view class="tab-top bg-fff">
  7. <view class="title">营业日</view>
  8. <view style="padding-bottom:20upx;border-bottom: 1px solid #EEEEEE;">
  9. <text v-for="(tag, index) in tags" :key="index" class="tag-type"
  10. :class="{ 'selected-background': isSelected(index) }"
  11. :style="tag == '周四' || tag == '整周' ? 'margin-right:0' : ''" @click="toggleSelection(index)">
  12. {{ tag }}
  13. </text>
  14. </view>
  15. <view style="padding-top:18upx">营业时段</view>
  16. <view class="cu-form-group" style="margin:0">
  17. <input placeholder="添加营业时段(2/3)" v-model="corporateName" name="input"></input>
  18. <button class="cu-btn bg-blue " @click="add">添加</button>
  19. </view>
  20. </view>
  21. <rangTime ref="rangTime"
  22. :mode="mode"
  23. @onSubmit="onEndTimeChange" />
  24. <view class="padding flex flex-direction sub-bottom">
  25. <button class="cu-btn bg-blue round " @click="sumbit">提交</button>
  26. </view>
  27. </view>
  28. </template>
  29. <script>
  30. import rangTime from '../../components/dengrq-datetime-picker/dateSelector/index.vue'
  31. export default {
  32. components: {
  33. rangTime
  34. },
  35. data() {
  36. return {
  37. mode: 6,
  38. corporateName:'',
  39. tags: ['周一', '周二', '周三', '周四', '周五', '周六', '周日', '整周'], // 你的标签数组
  40. selectedIndices: [], // 用于存储被选中的标签索引
  41. isSelectDate: false,
  42. selectedTime: [],
  43. }
  44. },
  45. methods: {
  46. customDataChange(e) {
  47. //通过e.detail.value获取值,获取的是自定义数据的下标
  48. const val = e.detail.value
  49. console.log(val);
  50. },
  51. cancelSelect(e){
  52. console.log("您已取消选择");
  53. },
  54. // 检查一个标签是否被选中
  55. isSelected(index) {
  56. return this.selectedIndices.includes(index);
  57. },
  58. // 切换标签的选中状态
  59. toggleSelection(index) {
  60. const indexIndex = this.selectedIndices.indexOf(index);
  61. if (indexIndex > -1) {
  62. // 如果标签已经被选中,则移除它
  63. this.selectedIndices.splice(indexIndex, 1);
  64. } else {
  65. // 如果标签没有被选中,则添加它
  66. this.selectedIndices.push(index);
  67. }
  68. },
  69. add(){
  70. this.$refs.rangTime.open()
  71. },
  72. onEndTimeChange(val){
  73. console.log(val,99999 );
  74. }
  75. }
  76. }
  77. </script>
  78. <style scoped lang="scss">
  79. page {
  80. background: #F8F8FA;
  81. }
  82. .tab-top {
  83. margin: 24upx 30upx;
  84. padding: 14upx 18upx;
  85. }
  86. .tag-type {
  87. display: inline-block;
  88. font-size: 26upx;
  89. width: 146upx;
  90. height: 54upx;
  91. color: #333333;
  92. margin: 18upx 23upx 0 0;
  93. border-radius: 4px 4px 4px 4px;
  94. border: 1px solid #C2C2C2;
  95. text-align: center;
  96. line-height: 54upx;
  97. }
  98. .selected-background {
  99. color: #2983EC;
  100. position: relative;
  101. background: rgba(68, 154, 255, 0.1);
  102. border: 1px solid #449AFF;
  103. }
  104. .selected-background ::after {
  105. content: '';
  106. position: absolute;
  107. top: -1px;
  108. right: -1px;
  109. width: 22upx;
  110. height: 22upx;
  111. background-image: url('/static/store/xuanzhong.png');
  112. background-size: cover;
  113. background-repeat: no-repeat;
  114. border-radius: 0 5px 0 0;
  115. }
  116. .sub-bottom {
  117. position: fixed;
  118. width: 100%;
  119. bottom: 0;
  120. background: #FFFFFF;
  121. border-top: 1px solid #EEEEEE;
  122. }
  123. </style>