cancelappointment.vue 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146
  1. <template>
  2. <view class="box" v-if="isShowPage">
  3. <view class="ddinfo">
  4. <view class="li">
  5. <text>预约院区</text>
  6. <view>{{params.storeName}}</view>
  7. </view>
  8. <view class="li">
  9. <text>预约服务</text>
  10. <view>{{params.serviceTitle}}</view>
  11. </view>
  12. <view class="li">
  13. <text>预约序号</text>
  14. <view>{{params.serialNumber}}</view>
  15. </view>
  16. <view class="li">
  17. <text>预约时间</text>
  18. <view class="textcolor-orange">{{params.appointmentTime}} {{getWeek(params.appointmentTime)}}<!-- <view class="textcolor-orange">10:00~11:30</view> --></view>
  19. </view>
  20. </view>
  21. <view class="ddinfo">
  22. <view class="li">
  23. <text>姓名</text>
  24. <view>{{params.name}}</view>
  25. </view>
  26. <view class="li">
  27. <text>电话</text>
  28. <view>{{params.phone}}</view>
  29. </view>
  30. <view class="li">
  31. <text>症状描述</text>
  32. <view>{{params.brief}}</view>
  33. </view>
  34. </view>
  35. <view class="ddinfo" v-if="isShowReason">
  36. <view class="li">
  37. <text>请选择取消原因</text>
  38. </view>
  39. <view class="cancel-bar">
  40. <view :class="'reason-item'+(reasonIndex==item.id ? ' active' : '')" v-for="(item,index) in reasonList" :key="index" @tap="selectReason(item,index)">
  41. {{item.text}}
  42. </view>
  43. <textarea placeholder="其他原因" placeholder-class="placeholder" v-model="otherReason" @focus="focusOhter"></textarea>
  44. </view>
  45. </view>
  46. <view class="cancel-sta" v-if="params.state == 8">服务已取消</view>
  47. <view class="cancel-sta end" v-if="params.state == 7">服务已完成</view>
  48. <view class="regist-bottom-btn" @click="cancelService" v-if="params.state == 3">取消预约</view>
  49. </view>
  50. </template>
  51. <script>
  52. // mine/coupons/coupons.js
  53. const req = require("../../utils/request.js");
  54. const api = require("../../utils/api.js");
  55. const app = getApp();
  56. export default {
  57. data() {
  58. return {
  59. isShowPage: false,
  60. id: '',
  61. params: {},
  62. reasonList:[
  63. {text:'临时有事',id:0},
  64. {text:'重复预约',id:1},
  65. {text:'不想去了',id:2},
  66. {text:'约错时间',id:3}
  67. ],
  68. reasonIndex: -1,
  69. reason:'',
  70. otherReason: '',
  71. isCancel: false,
  72. isShowReason: false
  73. };
  74. },
  75. components: {},
  76. props: {},
  77. onLoad(options) {
  78. this.id = options.id
  79. if(this.isCancel){
  80. this.isCancel = true
  81. uni.setNavigationBarTitle({
  82. title: '取消预约'
  83. })
  84. }
  85. this.getDetail()
  86. },
  87. onShow: function() {
  88. },
  89. methods: {
  90. getWeek(dateString) {
  91. var dateArray = dateString.split('-');
  92. var date = new Date(dateArray[0], parseInt(dateArray[1] - 1), dateArray[2]);
  93. return '星期' + '日一二三四五六'.charAt(date.getDay());
  94. },
  95. getDetail(){
  96. req.getRequest(api.reservation_service_record_detail,{id: this.id},data=>{
  97. this.params = data;
  98. this.isShowPage = true;
  99. })
  100. },
  101. cancelService(){
  102. if(!this.reason&&!this.otherReason){
  103. req.msg('请选择取消原因')
  104. this.isShowReason = true
  105. return false
  106. }
  107. let params = {
  108. id: this.id
  109. }
  110. if(this.otherReason){
  111. params.reason = this.otherReason
  112. }else{
  113. params.reason = this.reason
  114. }
  115. req.msgConfirm('取消之后需重新预约,确认取消预约吗?',suc=>{
  116. req.postRequest(api.reservation_service_cancel,params,data=>{
  117. req.msg('预约已取消')
  118. this.isShowReason = false
  119. this.getDetail()
  120. })
  121. })
  122. },
  123. jumpUrl(url) {
  124. uni.navigateTo({
  125. url: url
  126. })
  127. },
  128. selectReason(item,index){
  129. this.reasonIndex = index
  130. this.reason = item.text
  131. },
  132. focusOhter(e){
  133. this.reasonIndex = -1
  134. this.reason = ''
  135. }
  136. }
  137. };
  138. </script>
  139. <style>
  140. @import './cancelappointment.css';
  141. </style>