doctorinfo.vue 7.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250
  1. <template>
  2. <view>
  3. <!-- 医生信息 -->
  4. <view class="box doctor-item">
  5. <view class="header"><image :src="params.headUrl ? params.headUrl : '../static/onlineregistration/image/doctorPic.png'" mode="aspectFill"></image></view>
  6. <view class="header-title">
  7. <view>
  8. <text class="doctor-name">{{ params.realName }}</text>
  9. <text class="doctor-position" v-if="params.userExtend && params.userExtend.label">
  10. <block v-for="(it, idx) in params.userExtend.label.split(',')" :key="idx" v-if="idx == 0">{{ it }}</block>
  11. </text>
  12. </view>
  13. <view class="doctor-about" v-if="params.userExtend&&params.userExtend.projects">{{ params.userExtend.projects }}</view>
  14. </view>
  15. <!-- <view class="header-more">
  16. <view>
  17. <image src="../static/onlineregistration/image/qrcode.png"></image>
  18. <view class="qrcode-text">二维码</view>
  19. </view>
  20. </view> -->
  21. </view>
  22. <!-- 挂号和简介 -->
  23. <view class="box tab-box">
  24. <view class="tab bgfff dflex">
  25. <view :class="'li ' + (currentTab == 0 ? 'active' : '')" data-current="0" @tap="tab">预约</view>
  26. <view :class="'li ' + (currentTab == 1 ? 'active' : '')" data-current="1" @tap="tab">简介</view>
  27. </view>
  28. <view v-if="currentTab == 0" class="regist-bar">
  29. <view class="register-li" v-for="(item, index) in workList" :key="index">
  30. <view>{{ item.dateTime }} {{ getweekday(item.dateTime) }}</view>
  31. <view class="regist-content">
  32. <view
  33. :class="'regist-item' + (subItem.receivedNo - subItem.surplusNo == 0 ? ' noh' : dateIndex == index && timeIndex == subIndex ? ' active' : '')"
  34. v-for="(subItem, subIndex) in item.rosteringList"
  35. :key="subIndex"
  36. @click="selectTime(subItem, index, subIndex)"
  37. v-if="subItem.isOpen"
  38. >
  39. <text>{{ captureTime(subItem.startTime, true) }} ~ {{ captureTime(subItem.endTime, true) }}</text>
  40. <text class="regist-number" v-if="subItem.receivedNo - subItem.surplusNo == 0">(已约满)</text>
  41. <text class="regist-number" v-else>
  42. ( 剩
  43. <text class="regist-number-red">{{ ' ' + subItem.receivedNo - subItem.surplusNo + ' ' }}</text>
  44. )
  45. </text>
  46. <image src="../static/onlineregistration/image/gou.png" class="sub-gou" v-if="dateIndex == index && timeIndex == subIndex"></image>
  47. </view>
  48. </view>
  49. </view>
  50. </view>
  51. <view v-if="currentTab == 1" class="info-bar">
  52. <!-- 简介 -->
  53. <block v-if="params.userExtend && (params.userExtend.brief || params.userExtend.projects)">
  54. <view class="info-item" v-if="params.userExtend && params.userExtend.brief">
  55. <view class="info-title">医生简介</view>
  56. <view class="info-content"><rich-text :nodes="params.userExtend.brief"></rich-text></view>
  57. </view>
  58. <view class="info-item" v-if="params.userExtend && params.userExtend.projects">
  59. <view class="info-title">擅长项目</view>
  60. <view class="info-content"><rich-text :nodes="params.userExtend.projects"></rich-text></view>
  61. </view>
  62. </block>
  63. <view class="nodata" v-else>
  64. <image :src="picUrlss + 'empty_jl.png'"></image>
  65. <view>暂无医生简介</view>
  66. </view>
  67. <!-- <view class="info-item">
  68. <view class="info-title">医生案例</view>
  69. <view class="info-case">
  70. <view class="info-case-item">
  71. <image src="../static/onlineregistration/image/infopic.png"></image>
  72. <view class="info-case-title">青少年牙齿矫正</view>
  73. </view>
  74. </view>
  75. </view> -->
  76. </view>
  77. </view>
  78. <!-- 挂号信息 -->
  79. <view class="regist-bottom" v-if="currentTab == 0 && dateIndex != null && timeIndex != null">
  80. <block v-if="currentRoster.money >0">
  81. <view>
  82. <text class="regist-bottom-title">预约费</text>
  83. <text class="textcolor-red">
  84. <text class="regist-bottom-money">{{ currentRoster.money }}</text>
  85. </text>
  86. </view>
  87. <view class="regist-bottom-btn" @click="jumpUrl('/onlineregistration/confirmation/confirmation?id=' + currentRoster.id + '&departmentId=' + departmentId)">
  88. 立即预约
  89. </view>
  90. </block>
  91. <view v-else class="regist-bottom-btn fflex" @click="jumpUrl('/onlineregistration/confirmation/confirmation?id=' + currentRoster.id + '&departmentId=' + departmentId)">
  92. 立即预约
  93. </view>
  94. </view>
  95. </view>
  96. </template>
  97. <script>
  98. // mine/coupons/coupons.js
  99. const req = require('../../utils/request.js');
  100. const api = require('../../utils/api.js');
  101. const util = require('../../utils/util.js');
  102. const app = getApp();
  103. export default {
  104. data() {
  105. return {
  106. picUrlss: req.public.picUrls,
  107. id: '',
  108. departmentId: '',
  109. params: {},
  110. currentTab: 0,
  111. timeIndex: null,
  112. dateIndex: null,
  113. form: {
  114. page: 1,
  115. limit: 10
  116. },
  117. workList: [],
  118. isLoad: true,
  119. currentRoster: '' ,//选中的排班
  120. isReservation: false,//该时间段是否预约
  121. };
  122. },
  123. components: {},
  124. props: {},
  125. onLoad(options) {
  126. this.id = options.id;
  127. this.departmentId = options.departmentId;
  128. this.getInfo();
  129. },
  130. onShow: function() {
  131. this.getRostering();
  132. },
  133. onReachBottom() {
  134. this.form.page++;
  135. this.getRostering();
  136. },
  137. methods: {
  138. getInfo() {
  139. req.getRequest(api.doctor_info, { id: this.id }, data => {
  140. this.params = data;
  141. });
  142. },
  143. captureTime(time, isTime) {
  144. return util.captureTime(time, isTime);
  145. },
  146. DateToUnix(string) {
  147. //将日期时间转为时间戳
  148. var f = string.split(' ', 2);
  149. var d = (f[0] ? f[0] : '').split('-', 3);
  150. var t = (f[1] ? f[1] : '').split(':', 3);
  151. var ts = new Date(
  152. parseInt(d[0], 10) || null,
  153. (parseInt(d[1], 10) || 1) - 1,
  154. parseInt(d[2], 10) || null,
  155. parseInt(t[0], 10) || null,
  156. parseInt(t[1], 10) || null,
  157. parseInt(t[2], 10) || null
  158. ).getTime();
  159. // ts=ts/1000;
  160. return ts;
  161. },
  162. timeRange(startTime, endTime) {
  163. let endTimes = this.DateToUnix(endTime);
  164. let n = new Date();
  165. var thisResult = (Number(Date.parse(n)) - endTimes) / 3600 / 1000;
  166. if (thisResult > 0) {
  167. return false;
  168. } else {
  169. return true;
  170. }
  171. },
  172. getRostering() {
  173. let that = this;
  174. let form = that.form;
  175. form.sysUid = this.id;
  176. req.getRequest(api.doctor_rostering, form, data => {
  177. data.map(it => {
  178. it.rosteringList.map(sub => {
  179. sub.isOpen = that.timeRange(sub.startTime, sub.endTime);
  180. });
  181. return it;
  182. });
  183. if (data && data.length == 10) this.isLoad = true;
  184. if (this.form.page > 1) data = this.workList.concat(data);
  185. this.workList = data;
  186. });
  187. },
  188. tab(e) {
  189. let that = this;
  190. const index = e.currentTarget.dataset.current;
  191. if (that.currentTab === index) {
  192. return false;
  193. }
  194. that.setData({
  195. currentTab: index
  196. });
  197. },
  198. async selectTime(subItem, index, subIndex) {
  199. let that = this;
  200. console.log('subItem==', subItem);
  201. if (subItem.receivedNo - subItem.surplusNo == 0) return false;
  202. let isReservation = await this.checkReservation(subItem);
  203. if(isReservation){
  204. req.alertMsg('你已预约该时间段',data=>{
  205. // this.jumpUrl('/onlineregistration/registrationlist/registrationlist')
  206. })
  207. }else{
  208. that.timeIndex = subIndex;
  209. that.dateIndex = index;
  210. this.currentRoster = subItem;
  211. }
  212. },
  213. checkReservation(item){
  214. let pa = {
  215. rosteringId: item.id
  216. }
  217. return new Promise((resolve,reject)=>{
  218. req.getRequest(api.rostering_isReservation,pa,data=>{
  219. resolve(data);
  220. // this.isReservation = data;
  221. // if(data){
  222. // return req.alertMsg('你已预约该时间段','查看详情',data=>{
  223. // this.jumpUrl('/onlineregistration/registrationlist/registrationlist')
  224. // })
  225. // }
  226. })
  227. })
  228. },
  229. jumpUrl(url) {
  230. uni.navigateTo({
  231. url: url
  232. });
  233. },
  234. getweekday(date) {
  235. var weekArray = new Array('星期日', '星期一', '星期二', '星期三', '星期四', '星期五', '星期六');
  236. var week = weekArray[new Date(date).getDay()];
  237. return week;
  238. }
  239. }
  240. };
  241. </script>
  242. <style>
  243. @import 'doctorinfo.css';
  244. </style>