appointment.vue 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186
  1. <template>
  2. <view>
  3. <!-- 位置 -->
  4. <view class="box tap-area" v-if="merchant&&merchant.title" @click="jumpUrl('/pages/nearby/nearby')">
  5. <view class="header" v-if="merchant.logo">
  6. <image :src="merchant.logo" mode="aspectFill"></image>
  7. </view>
  8. <view class="header-title">
  9. <view class="header-name">{{merchant.title}}</view>
  10. <view class="header-text" v-if="merchant.range && merchant.range!=50000"><text>距离您</text>{{merchant.range ? merchant.mDistance < 1000 ? merchant.mDistance+'m' : merchant.range+'km' : ''}}</view>
  11. </view>
  12. <view class="header-more">
  13. <image src="../../static/pages/images/more.png" class="more"></image>
  14. </view>
  15. </view>
  16. <!-- 选择服务 -->
  17. <view class="service">
  18. <view class="service-title">请选择您要预约的服务</view>
  19. <view class="service-bar">
  20. <view :class="'service-item'+(serviceIndex==index ? ' active':'')" v-for="(item,index) in pageList" :key="index" @click="selectService(item,index)">
  21. <image src="../static/onlineregistration/image/tooth.png"></image>
  22. <view class="service-name fflex">{{item.title}}</view>
  23. </view>
  24. </view>
  25. </view>
  26. <!-- 信息填写 -->
  27. <view class="ddinfo">
  28. <view class="li ddflex">
  29. <text>姓名</text>
  30. <input v-model="info.name" placeholder="请输入您的姓名" class="fflex"/>
  31. </view>
  32. <view class="li ddflex">
  33. <text>电话</text>
  34. <input v-model="info.phone" placeholder="请输入您的手机号" class="fflex"/>
  35. </view>
  36. <view class="li ddflex">
  37. <text>时间</text>
  38. <view>
  39. <picker mode="date" :value="date" @change="bindDateChange">
  40. <view class="flex">{{ date ? date : '请选择时间' }}</view>
  41. </picker>
  42. </view>
  43. <image src="/static/pages/images/more.png" class="rico"></image>
  44. </view>
  45. <view class="li">
  46. <text>症状描述</text>
  47. <textarea placeholder="请输入症状描述" placeholder-class="placeholder" v-model="info.brief" class="textarea"></textarea>
  48. </view>
  49. </view>
  50. <view class="regist-bottom-btn" @tap="nextStep">下一步</view>
  51. <!-- 确认信息 -->
  52. <view v-show="showPop" class="confirmation-bar">
  53. <view class="pop-title">预约信息</view>
  54. <view class="pop-content">
  55. <view class="ddinfo">
  56. <view class="li ddflex">
  57. <text>姓名</text>
  58. <view>{{info.name}}</view>
  59. </view>
  60. <view class="li ddflex">
  61. <text>电话</text>
  62. <view>{{info.phone}}</view>
  63. </view>
  64. <view class="li ddflex">
  65. <text>预约院区</text>
  66. <view>{{merchant.title}}</view>
  67. </view>
  68. <view class="li ddflex">
  69. <text>预约服务</text>
  70. <view>{{service.title}}</view>
  71. </view>
  72. <view class="li ddflex">
  73. <text>预约时间</text>
  74. <view>{{date}}</view>
  75. </view>
  76. <view class="li ddflex">
  77. <text>症状描述</text>
  78. <view>{{info.brief}}</view>
  79. </view>
  80. </view>
  81. </view>
  82. <view class="pop-btn">
  83. <view class="pop-btn-cancal" @tap="popCancal">取消</view>
  84. <view class="pop-btn-submit" @tap="popSubmit">确认预约</view>
  85. </view>
  86. </view>
  87. <!-- 遮罩层 -->
  88. <view v-show="showPop" class="mask"></view>
  89. </view>
  90. </template>
  91. <script>
  92. const req = require("../../utils/request.js");
  93. const api = require("../../utils/api.js");
  94. const app = getApp();
  95. export default {
  96. data() {
  97. return {
  98. merchant: {},
  99. pageList: [],
  100. date: '',
  101. serviceIndex: 0,
  102. service: {},
  103. showPop: false,
  104. info:{
  105. name:'',
  106. phone:'',
  107. brief:''
  108. },
  109. isSubmit: true,
  110. params: {}
  111. };
  112. },
  113. components: {},
  114. props: {},
  115. onLoad() {
  116. this.getMerchant()
  117. this.getPageList()
  118. },
  119. onShow: function() {
  120. },
  121. methods: {
  122. getMerchant(){
  123. if(req.getStorage('MERCHANT')){
  124. this.merchant = req.getStorage('MERCHANT')
  125. }else{
  126. this.merchant = req.getStorage('defaultMerchant')
  127. }
  128. },
  129. getPageList(){
  130. req.getRequest(api.reservation_service_list,{merchantId: this.merchant.id},data=>{
  131. this.pageList = data;
  132. if(data&&data.length>0){
  133. this.service = data[0]
  134. }
  135. })
  136. },
  137. jumpUrl(url) {
  138. uni.navigateTo({
  139. url: url
  140. })
  141. },
  142. bindDateChange(e) {
  143. this.date = e.detail.value
  144. },
  145. selectService(item,index){
  146. this.serviceIndex = index;
  147. this.service = item
  148. },
  149. nextStep(){
  150. let params = this.info
  151. params.appointmentTime = this.date
  152. params.productId = this.service.id
  153. params.merchantId = this.merchant.id
  154. if(!params.name) return req.msg('请输入您的姓名')
  155. if(!params.phone) return req.msg('请输入您的手机号码')
  156. if(!params.appointmentTime) return req.msg('请选择预约时间')
  157. if(!params.brief) return req.msg('请输入症状描述')
  158. this.showPop = true
  159. this.params = params
  160. },
  161. popCancal(){
  162. this.showPop = false
  163. },
  164. popSubmit(){
  165. if(!this.isSubmit) return false;
  166. req.postRequest(api.reservation_service_create,this.params,data=>{
  167. req.msg('预约成功')
  168. this.popCancal()
  169. this.isSubmit = true;
  170. setTimeout(suc=>{
  171. this.jumpUrl('/onlineregistration/appointmentlist/appointmentlist')
  172. },200)
  173. })
  174. }
  175. }
  176. };
  177. </script>
  178. <style>
  179. @import './appointment.css'
  180. </style>