index.vue 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172
  1. <template>
  2. <view class="order_index">
  3. <w-picker mode="date" startYear="2000" endYear="2100" v-model="datevalue" :current="true" :fields="showtype" @confirm="onConfirm($event)"
  4. @cancel="onCancel" :disabled-after="false" ref="date"></w-picker>
  5. <z-navbar>
  6. <view slot="title" @click="chooseDate(stateTab)">
  7. {{dataYearMonth}}
  8. </view>
  9. <view slot="right" class="iconfont iconjuxing5" @click="gotoSearch"></view>
  10. </z-navbar>
  11. <z-tabs :tabs="['咨询提醒','预定提醒']" v-if="!hideStateTab" v-model="stateTab" @change="changeTabs"></z-tabs>
  12. <consultation v-if="stateTab==0" :refresh="refresh" @getDateInfo="getDateInfo"></consultation>
  13. <reserve v-else @getDateInfo="getDateInfo" :refresh="refresh"></reserve>
  14. <view class="add_order flex-n fac fjc" @click="addConsultation">
  15. <view class="iconfont iconjia"></view>
  16. </view>
  17. <z-tabbar></z-tabbar>
  18. </view>
  19. </template>
  20. <script>
  21. import consultation from './consultation.vue';
  22. import reserve from './reserve.vue'
  23. export default {
  24. components: {
  25. consultation,
  26. reserve
  27. },
  28. data() {
  29. return {
  30. dataYearMonth: '2020.04',
  31. showtype:'day',
  32. datevalue:'',
  33. stateTab: 0,
  34. refresh:false,
  35. hideStateTab:false
  36. };
  37. },
  38. mounted() {
  39. uni.hideTabBar();
  40. this.getMenu();
  41. },
  42. onShow() {
  43. this.getMenu();
  44. this.refresh=true;
  45. },
  46. onHide(){
  47. this.refresh=false;
  48. },
  49. computed: {
  50. },
  51. methods: {
  52. getMenu(){
  53. uni.getStorage({
  54. key:'menu',
  55. success:(res)=>{
  56. console.log(res)
  57. if(res.data.indexOf('101')==-1){
  58. this.hideStateTab=true;
  59. this.stateTab=1;
  60. }
  61. if(res.data.indexOf('102')==-1){
  62. this.hideStateTab=true;
  63. this.stateTab=0;
  64. }
  65. }
  66. })
  67. },
  68. getDateInfo(date){
  69. this.dataYearMonth=date.yy+'.'+(date.mm>9?date.mm:('0'+date.mm))
  70. this.datevalue=date.date;
  71. },
  72. addConsultation(){
  73. if(this.stateTab==0)
  74. uni.navigateTo({
  75. url: '../manage/index?type=0',
  76. success: res => {},
  77. fail: () => {},
  78. complete: () => {}
  79. });
  80. else{
  81. uni.navigateTo({
  82. url: '../../book/manage/index?type=0',
  83. success: res => {},
  84. fail: () => {},
  85. complete: () => {}
  86. });
  87. }
  88. },
  89. gotoSearch(){
  90. if(this.stateTab==0){
  91. uni.navigateTo({
  92. url: '../../search/index?type=0',
  93. success: res => {},
  94. fail: () => {},
  95. complete: () => {}
  96. });
  97. }else{
  98. uni.navigateTo({
  99. url: '../../search/index?type=1',
  100. success: res => {},
  101. fail: () => {},
  102. complete: () => {}
  103. });
  104. }
  105. },
  106. onConfirm(e) {
  107. console.log(e)
  108. this.datevalue=e.value;
  109. var a = e.value.split("-");
  110. this.dataYearMonth = a[0] + '.' + a[1];
  111. this.$store.state.searchDate = e.value;
  112. },
  113. onCancel() {
  114. console.log(this.$refs.date.value,this.$refs.date.pickVal)
  115. },
  116. chooseDate:function(state){
  117. if(state!=3){
  118. this.showtype='day';
  119. }else{
  120. this.showtype='month';
  121. }
  122. this.$refs.date.show();
  123. },
  124. changeTabs(idx) {
  125. this.stateTab = idx;
  126. this.refresh=true;
  127. },
  128. }
  129. }
  130. </script>
  131. <style scoped lang="scss">
  132. .month-height {
  133. height: calc(100vh - 280rpx - var(--status-bar-height));
  134. }
  135. .day-height{
  136. height: calc(100vh - 280rpx - var(--status-bar-height));
  137. }
  138. .order_index {
  139. .add_order {
  140. position: fixed;
  141. width: 82rpx;
  142. height: 82rpx;
  143. background: #2481EE;
  144. border-radius: 50%;
  145. right: 51rpx;
  146. bottom: 143rpx;
  147. view {
  148. width: 49rpx;
  149. height: 49rpx;
  150. font-size: 49rpx;
  151. line-height: 49rpx;
  152. color: white;
  153. z-index: 300;
  154. }
  155. color: white;
  156. box-shadow:10rpx 10rpx 30rpx 0rpx #C6E0FF;
  157. }
  158. }
  159. </style>