vaccines_info.vue 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587
  1. <template>
  2. <view class="">
  3. <view class="cu-list menu">
  4. <view class="cu-item arrow" @click="showpeople=true">
  5. <view class="content">
  6. <text class="text-grey">接种用户</text>
  7. </view>
  8. <view class="action">
  9. <text class="text-grey text-sm">{{value}}</text>
  10. </view>
  11. </view>
  12. <view class="cu-item arrow" @click="xuanzefuwu">
  13. <view class="content">
  14. <text class="text-grey">服务机构</text>
  15. </view>
  16. <view class="action">
  17. <text class="text-grey text-sm">{{servicejigou}}</text>
  18. </view>
  19. </view>
  20. <view class="padding-sm bg-white" v-if="doctor!=''">
  21. <scroll-view scroll-x="true" enable-flex="true" style="display: flex;height: 145rpx;">
  22. <view class="flex flex-direction align-center justify-center margin-right-xs"
  23. @click="gotodoctorinfo(item.id)" style="width: 168rpx;height: 130rpx;"
  24. v-for="(item,index) in doctor.docter" :key="index">
  25. <u-avatar :src="item.avatar" mode="circle"></u-avatar>
  26. <view class="">
  27. {{item.name}}
  28. </view>
  29. </view>
  30. </scroll-view>
  31. <view class="">
  32. <rich-text :nodes="doctor.vaccine_notice"></rich-text>
  33. </view>
  34. </view>
  35. <view class="cu-item arrow" @click="vaccinesList">
  36. <view class="content">
  37. <text class="text-grey">接种疫苗</text>
  38. </view>
  39. <view class="action">
  40. <text class="text-grey text-sm">{{yimiao}}</text>
  41. </view>
  42. </view>
  43. <view class="cu-item arrow" @click="yuyuetime">
  44. <view class="content">
  45. <text class="text-grey">预约时间</text>
  46. </view>
  47. <view class="action">
  48. <text class="text-grey text-sm">{{yuyuevalue}}</text>
  49. </view>
  50. </view>
  51. <view class="text-gray text-sm" style="margin: 25rpx 37rpx;line-height: 38rpx;">
  52. <rich-text :nodes="vaccine_notice"></rich-text>
  53. </view>
  54. </view>
  55. <!-- <u-picker mode="multiSelector" @confirm="callbacktime" v-model="show" :default-selector='[0, 1]' range-key="start_time_period"
  56. :range="multiSelector"></u-picker> -->
  57. <u-popup v-model="showpeople" mode="bottom" border-radius="14" length="50%">
  58. <view class="popup_title">
  59. <view class="popup_title_text">选择就诊人</view>
  60. </view>
  61. <scroll-view style="height: 70%;" scroll-y="true">
  62. <view class="popup_list" v-for="(item, index) in patientList" :key="index" :data-index="index"
  63. @click="xuanzehuanzhe(item)">
  64. <view class="popup_list_title">
  65. <view class="title">{{item.name}}</view>
  66. <view class="body">
  67. {{item.sex==1?'男':'女'}}
  68. </view>
  69. </view>
  70. <view class="popup_list_button flex align-center">
  71. <u-radio-group v-model="value">
  72. <u-radio @change="peopleRadioChange" :key="index" :name="item.name">
  73. </u-radio>
  74. </u-radio-group>
  75. </view>
  76. </view>
  77. </scroll-view>
  78. <u-gap height="10" bg-color="#f9f9f9"></u-gap>
  79. <view class="popup_button">
  80. <image style="width: 32rpx;height: 32rpx;margin-right: 15rpx;"
  81. src="https://zhengda.oss-cn-chengdu.aliyuncs.com/baoma/static/img/addjiu.png" mode=""></image>
  82. <view class="" @click="addPeople">
  83. 添加就诊人档案
  84. </view>
  85. </view>
  86. </u-popup>
  87. <view class="cu-bar bg-white tabbar" style="position: fixed;bottom: 0;width: 100%;">
  88. <view class="submit" style="background-color: #0B73B9;color: white;" @click="submitpay">
  89. 提交申请
  90. </view>
  91. </view>
  92. <u-popup v-model="dateshow" mode="bottom" :safe-area-inset-bottom="true" border-radius="14" length="50%"
  93. height="700rpx">
  94. <datepicker :date="multiSelector" @callbacktime="callbacktime" ref="date"></datepicker>
  95. </u-popup>
  96. <view class="cu-tabbar-height"></view>
  97. <view class="cu-tabbar-height"></view>
  98. </view>
  99. </template>
  100. <script>
  101. import datepicker from '../../components/datepicker/datepicker'
  102. var user = require('../../common/user.js');
  103. export default {
  104. onLoad() {
  105. this.$util.getAgreement().then(res => {
  106. this.vaccine_notice = res.data.vaccine_notice
  107. }).catch(err => {
  108. })
  109. },
  110. components: {
  111. datepicker
  112. },
  113. onShow() {
  114. if (this.doctor != null) {
  115. this.servicejigou = this.doctor.name
  116. this.jigouID = this.doctor.id
  117. }
  118. if (this.yimiaoInfo != null) {
  119. this.yimiao = this.yimiaoInfo.name
  120. this.multiSelector = []
  121. this.gettime()
  122. }
  123. this.getarchives()
  124. },
  125. data() {
  126. return {
  127. showpeople: false,
  128. huanzheID: "",
  129. value: "请选择接种用户",
  130. patientList: [],
  131. show: false,
  132. yuyuevalue: "请选择预约时间",
  133. multiSelector: [],
  134. timehour: "",
  135. doctor: "",
  136. servicejigou: "请选择服务机构",
  137. jigouID: "",
  138. yimiao: "请选择接种疫苗",
  139. yimiaoInfo: "",
  140. time: "",
  141. dateshow: false,
  142. is_Scheduling: true,
  143. vaccine_notice: ""
  144. }
  145. },
  146. methods: {
  147. // 选中某个单选框时,由radio时触发
  148. peopleRadioChange(e) {
  149. console.log(e);
  150. },
  151. xuanzehuanzhe(item) {
  152. this.huanzheID = item.id
  153. this.value = item.name
  154. this.showpeople = false
  155. },
  156. getarchives: async function() {
  157. let res = await this.$request.post("/api/v1/patient/patientList")
  158. if (res.status == 0) {
  159. this.patientList = res.data.data
  160. }
  161. },
  162. gettime: async function() {
  163. if (this.doctor == '') {
  164. return false
  165. }
  166. if (this.yimiaoInfo == "") {
  167. return false
  168. }
  169. let res = await this.$request.post("/api/v1/docter/timePeriodList", {
  170. organization_id: this.doctor.id,
  171. schedule_type: 2,
  172. vaccine_id:this.yimiaoInfo.id
  173. })
  174. console.log(res)
  175. if (res.status == 0) {
  176. let times = []
  177. // res.data.list.forEach(item => {
  178. // item.start_time_period = item.start_time_period + '-' + item.end_time_period
  179. // })
  180. // this.multiSelector.push(res.data.dates)
  181. // this.multiSelector.push(res.data.list)
  182. if (res.data.data.length == 0) {
  183. this.is_Scheduling = false
  184. return false
  185. }
  186. // let nian = res.data.data.map(item => {
  187. // return item.schedule_date
  188. // })
  189. // let time = res.data.data.map(item => {
  190. // return item.schedule_period.map(itm => {
  191. // itm.organization.org_id = itm.organization['id']
  192. // return {
  193. // can_appoint_num: itm.can_appoint_num,
  194. // ...itm.organization,
  195. // ...itm.time_period
  196. // }
  197. // })
  198. // })
  199. // time[0].forEach(item => {
  200. // item.start_time_period = item.start_time_period + '-' + item.end_time_period
  201. // })
  202. // this.multiSelector.push(nian)
  203. // // time[0].sort((a,b)=> {return a.end_time_period>b.end_time_period?1:-1})
  204. // this.multiSelector.push(time[0])
  205. // console.log(this.multiSelector)
  206. let nian = res.data.data.map(item => {
  207. if (item.schedule_period.length != 0) {
  208. return {
  209. date: item.schedule_date,
  210. id: item.id,
  211. week: item.week
  212. }
  213. }
  214. })
  215. res.data.data.forEach(item => {
  216. if (item.schedule_period.length != 0) {
  217. let time = item.schedule_period.map(itm => {
  218. if (item.id == itm.schedule_id) {
  219. if (itm.time_period != null) {
  220. itm.organization.org_id = itm.organization['id']
  221. return {
  222. yeardate: itm.schedule_date,
  223. schedule_id: itm.schedule_id,
  224. can_appoint_num: itm.can_appoint_num,
  225. can_appoint:itm.can_appoint,
  226. ...itm.organization,
  227. ...itm.time_period
  228. }
  229. }
  230. }
  231. })
  232. time = time.filter(item => item !== undefined)
  233. times.push(time)
  234. }
  235. })
  236. // time[0].forEach(item => {
  237. // item.start_time_period = item.start_time_period + '-' + item.end_time_period
  238. // })
  239. nian = nian.filter(item => item !== undefined)
  240. this.multiSelector.push(nian)
  241. // time[0].sort((a,b)=> {return a.end_time_period>b.end_time_period?1:-1})
  242. times.forEach(item => {
  243. item.sort((a, b) => {
  244. return a.end_time_period > b.end_time_period ? 1 : -1
  245. })
  246. // for (let i = item.length - 1; i >= 0; i--) {
  247. // let arr = item[i].yeardate + " " + item[i].end_time_period;
  248. // arr = arr.split(/[- :]/)
  249. // let nndate = Date.parse(new Date(arr[0], arr[1] - 1, arr[2], arr[3], arr[4]));
  250. // let currentTime = Date.parse(new Date())
  251. // // console.log(nndate<currentTime,index)
  252. // if (nndate < currentTime) {
  253. // item.splice(i, 1)
  254. // }
  255. // }
  256. })
  257. this.multiSelector.push(times)
  258. console.log(this.multiSelector)
  259. let arr = this.multiSelector[1][0]
  260. if (arr != undefined) {
  261. arr.forEach(item => {
  262. item.year = nian[0].date
  263. })
  264. this.$refs.date.rightday = arr
  265. } else {
  266. arr = []
  267. this.$refs.date.rightday = arr
  268. }
  269. }
  270. },
  271. callbacktime(item) {
  272. // this.timehour = this.multiSelector[1][arr[1]].id
  273. // this.yuyuevalue = this.multiSelector[0][arr[0]] + " " + this.multiSelector[1][arr[1]].start_time_period
  274. // this.time = this.multiSelector[0][arr[0]]
  275. let arr = item.year.split(/[- :]/)
  276. let nndate = new Date(arr[0], arr[1] - 1, arr[2]);
  277. nndate = Date.parse(nndate)
  278. let currentTime = Date.parse(new Date())
  279. if ((nndate - currentTime) / (1000 * 60 * 60 * 24) > this.doctor.can_vaccine_days) {
  280. uni.showToast({
  281. title: "尚未到可预约时间",
  282. icon: "none"
  283. })
  284. return false
  285. }
  286. this.timehour = item.id
  287. this.yuyuevalue = item.year + " " + item.start_time_period + "-" + item.end_time_period
  288. this.time = item.year
  289. this.dateshow = false
  290. },
  291. //添加就诊人
  292. addPeople(e) {
  293. uni.navigateTo({
  294. url: "../archives/add_archives"
  295. })
  296. },
  297. xuanzefuwu() {
  298. this.multiSelector = []
  299. this.yimiao = "请选择接种疫苗"
  300. this.yimiaoInfo = ""
  301. uni.navigateTo({
  302. url: "mechanism?type=" + 2
  303. })
  304. },
  305. vaccinesList() {
  306. if (this.doctor == '') {
  307. uni.showToast({
  308. title: "请先选择机构",
  309. icon: "none"
  310. })
  311. return false
  312. }
  313. if (this.huanzheID == "") {
  314. uni.showToast({
  315. title: "请先选择患者",
  316. icon: "none"
  317. })
  318. return false
  319. }
  320. uni.navigateTo({
  321. url: "vaccinesList?id=" + this.doctor.id + "&patient_id=" + this.huanzheID
  322. })
  323. },
  324. yuyuetime() {
  325. if (this.doctor == '') {
  326. uni.showToast({
  327. title: "请先选择机构",
  328. icon: "none"
  329. })
  330. return false
  331. }
  332. if (this.yimiaoInfo == "") {
  333. uni.showToast({
  334. title: "请先选择疫苗",
  335. icon: "none"
  336. })
  337. return false
  338. }
  339. if (this.multiSelector[0] == undefined || this.multiSelector[1] == undefined) {
  340. uni.showToast({
  341. title: "尚未排班",
  342. icon: "none"
  343. })
  344. return false
  345. }
  346. if (this.multiSelector[0].length == 0 && this.multiSelector[1].length == 0) {
  347. uni.showToast({
  348. title: "尚未排班",
  349. icon: "none"
  350. })
  351. return false
  352. }
  353. // if (!this.is_Scheduling) {
  354. // uni.showToast({
  355. // title: "尚未排班",
  356. // icon: "none"
  357. // })
  358. // return false
  359. // }
  360. this.dateshow = true
  361. },
  362. submitpay() {
  363. if (this.huanzheID == "") {
  364. uni.showToast({
  365. title: "请先选择接种用户",
  366. icon: "none"
  367. })
  368. return false
  369. }
  370. if (this.doctor == "") {
  371. uni.showToast({
  372. title: "请先选择机构",
  373. icon: "none"
  374. })
  375. return false
  376. }
  377. if (this.yimiaoInfo == "") {
  378. uni.showToast({
  379. title: "请先选择疫苗",
  380. icon: "none"
  381. })
  382. return false
  383. }
  384. if (this.timehour == "") {
  385. uni.showToast({
  386. title: "请先选择预约时间",
  387. icon: "none"
  388. })
  389. return false
  390. }
  391. uni.requestSubscribeMessage({
  392. tmplIds: ['M9b6PPKtD7PEqLsSnQ453iTIHtIZZpixOBjUjax8YXU',
  393. 'Sg0lKmOexTnxxDzy39E26aNvmc3w4qKUnxl21A9dWns',
  394. 'phcsQ7ZbsJapfmx3NMChaxepR9tJFiqbO25P9tujErI'
  395. ],
  396. success: (res) => {
  397. this.gotopay()
  398. },
  399. fail: (err) => {
  400. this.gotopay()
  401. }
  402. })
  403. },
  404. gotopay: async function() {
  405. let obj = {
  406. product_type: 4,
  407. patient_id: this.huanzheID,
  408. total_amount: 0,
  409. organization_id: this.doctor.id,
  410. schedule_date: this.time,
  411. time_period_id: this.timehour,
  412. vaccine_id: this.yimiaoInfo.id,
  413. payment_type: 2
  414. }
  415. // if ((this.yimiaoInfo.price / 100) == 0) {
  416. let res = await this.$request.post("/api/v1/order/appointPlaceOrder", {
  417. product_type: obj.product_type,
  418. patient_id: obj.patient_id,
  419. total_amount: 0,
  420. organization_id: obj.organization_id,
  421. schedule_date: obj.schedule_date,
  422. time_period_id: obj.time_period_id,
  423. vaccine_id: obj.vaccine_id,
  424. payment_type: obj.payment_type,
  425. })
  426. if (res.status == 0) {
  427. uni.showToast({
  428. title: "提交成功!",
  429. icon: "none",
  430. duration: 1000
  431. })
  432. setTimeout(() => {
  433. uni.redirectTo({
  434. url: "../order/order?type=" + obj.product_type
  435. })
  436. }, 1000)
  437. } else {
  438. uni.showModal({
  439. title: "提示",
  440. content: res.message,
  441. confirmText: "查看预约",
  442. success: (res) => {
  443. if (res.confirm) {
  444. uni.navigateTo({
  445. url: "../common_tools/my_consulting/my_appointment"
  446. })
  447. }
  448. }
  449. })
  450. }
  451. // } else {
  452. // uni.navigateTo({
  453. // url: "../order/payment?data=" + JSON.stringify(obj)
  454. // })
  455. // }
  456. },
  457. gotodoctorinfo(id) {
  458. uni.navigateTo({
  459. url: "../doctor_related/doctor_info?id=" + id + "&index=2"
  460. })
  461. }
  462. }
  463. }
  464. </script>
  465. <style lang="scss" scoped>
  466. .main {}
  467. .popup_title {
  468. height: 15%;
  469. width: 100%;
  470. display: flex;
  471. justify-content: center;
  472. align-items: center;
  473. border-bottom: 1rpx solid #f9f9f9;
  474. }
  475. .textareasty {
  476. background-color: white;
  477. border: 1px solid #efefef;
  478. border-radius: 16rpx;
  479. padding: 15rpx;
  480. margin: 15rpx auto;
  481. }
  482. .popup_title_text {
  483. width: auto;
  484. height: auto;
  485. font-size: 34rpx;
  486. font-weight: 540;
  487. }
  488. .popup_list {
  489. display: flex;
  490. height: 10vh;
  491. width: auto;
  492. border-bottom: 1rpx solid #f9f9f9;
  493. }
  494. .popup_list_title {
  495. height: 100%;
  496. width: 90%;
  497. display: inline-block;
  498. padding: 0 0 0 30rpx;
  499. .title {
  500. height: 50%;
  501. width: auto;
  502. font-size: 32rpx;
  503. font-weight: 500;
  504. padding: 20rpx 0 0 0;
  505. }
  506. .body {
  507. height: 50%;
  508. color: #a1a1a1;
  509. height: auto;
  510. width: auto;
  511. font-size: 30rpx;
  512. padding: 10rpx 0 0 0;
  513. }
  514. }
  515. .popup_button {
  516. height: 80rpx;
  517. width: 100%;
  518. display: flex;
  519. justify-content: center;
  520. align-items: center;
  521. view {
  522. color: #0b73ba;
  523. font-weight: 500;
  524. }
  525. }
  526. /**选择号码的样式和选择患者不同
  527. 需要更改样式*/
  528. .phone {
  529. height: 20%;
  530. width: 100%;
  531. .list {
  532. height: 100%;
  533. width: 100%;
  534. display: flex;
  535. padding: 0 10rpx 0 30rpx;
  536. .title {
  537. height: 100%;
  538. width: 65%;
  539. font-size: 32rpx;
  540. color: #7d7d7d;
  541. display: flex;
  542. align-items: center;
  543. }
  544. .phone {
  545. height: 100%;
  546. width: 30%;
  547. font-size: 32rpx;
  548. font-weight: 500;
  549. display: flex;
  550. justify-content: center;
  551. align-items: center;
  552. }
  553. .button {
  554. height: 100%;
  555. width: 5%;
  556. display: flex;
  557. justify-content: center;
  558. align-items: center;
  559. }
  560. }
  561. }
  562. </style>