vaccines_info.vue 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595
  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" type="4" 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. is_loading: false
  145. }
  146. },
  147. methods: {
  148. // 选中某个单选框时,由radio时触发
  149. peopleRadioChange(e) {
  150. console.log(e);
  151. },
  152. xuanzehuanzhe(item) {
  153. this.huanzheID = item.id
  154. this.value = item.name
  155. this.showpeople = false
  156. },
  157. getarchives: async function() {
  158. let res = await this.$request.post("/api/v1/patient/patientList", {}, false)
  159. if (res.status == 0) {
  160. this.patientList = res.data.data
  161. }
  162. },
  163. gettime: async function() {
  164. if (this.doctor == '') {
  165. return false
  166. }
  167. if (this.yimiaoInfo == "") {
  168. return false
  169. }
  170. let res = await this.$request.post("/api/v1/docter/timePeriodList", {
  171. organization_id: this.doctor.id,
  172. schedule_type: 2,
  173. vaccine_id: this.yimiaoInfo.id
  174. })
  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. this.is_loading = true
  260. let arr = this.multiSelector[1][0]
  261. if (arr != undefined) {
  262. arr.forEach(item => {
  263. item.year = nian[0].date
  264. })
  265. this.$refs.date.rightday = arr
  266. } else {
  267. arr = []
  268. this.$refs.date.rightday = arr
  269. }
  270. }
  271. },
  272. callbacktime(item) {
  273. // this.timehour = this.multiSelector[1][arr[1]].id
  274. // this.yuyuevalue = this.multiSelector[0][arr[0]] + " " + this.multiSelector[1][arr[1]].start_time_period
  275. // this.time = this.multiSelector[0][arr[0]]
  276. let arr = item.year.split(/[- :]/)
  277. let nndate = new Date(arr[0], arr[1] - 1, arr[2]);
  278. nndate = Date.parse(nndate)
  279. let currentTime = Date.parse(new Date())
  280. if ((nndate - currentTime) / (1000 * 60 * 60 * 24) > this.doctor.can_vaccine_days) {
  281. uni.showToast({
  282. title: "尚未到可预约时间",
  283. icon: "none"
  284. })
  285. return false
  286. }
  287. this.timehour = item.id
  288. this.yuyuevalue = item.year + " " + item.start_time_period + "-" + item.end_time_period
  289. this.time = item.year
  290. this.dateshow = false
  291. },
  292. //添加就诊人
  293. addPeople(e) {
  294. uni.navigateTo({
  295. url: "../archives/add_archives"
  296. })
  297. },
  298. xuanzefuwu() {
  299. this.multiSelector = []
  300. this.yimiao = "请选择接种疫苗"
  301. this.yimiaoInfo = ""
  302. this.yuyuevalue = "请选择预约时间"
  303. this.timehour = ""
  304. uni.navigateTo({
  305. url: "mechanism?type=" + 2
  306. })
  307. },
  308. vaccinesList() {
  309. this.yuyuevalue = "请选择预约时间"
  310. this.timehour = ""
  311. this.is_loading = false
  312. if (this.doctor == '') {
  313. uni.showToast({
  314. title: "请先选择机构",
  315. icon: "none"
  316. })
  317. return false
  318. }
  319. if (this.huanzheID == "") {
  320. uni.showToast({
  321. title: "请先选择患者",
  322. icon: "none"
  323. })
  324. return false
  325. }
  326. uni.navigateTo({
  327. url: "vaccinesList?id=" + this.doctor.id + "&patient_id=" + this.huanzheID
  328. })
  329. },
  330. yuyuetime() {
  331. if (this.is_loading) {
  332. if (this.doctor == '') {
  333. uni.showToast({
  334. title: "请先选择机构",
  335. icon: "none"
  336. })
  337. return false
  338. }
  339. if (this.yimiaoInfo == "") {
  340. uni.showToast({
  341. title: "请先选择疫苗",
  342. icon: "none"
  343. })
  344. return false
  345. }
  346. if (this.multiSelector[0] == undefined || this.multiSelector[1] == undefined) {
  347. uni.showToast({
  348. title: "尚未排班",
  349. icon: "none"
  350. })
  351. return false
  352. }
  353. if (this.multiSelector[0].length == 0 && this.multiSelector[1].length == 0) {
  354. uni.showToast({
  355. title: "尚未排班",
  356. icon: "none"
  357. })
  358. return false
  359. }
  360. // if (!this.is_Scheduling) {
  361. // uni.showToast({
  362. // title: "尚未排班",
  363. // icon: "none"
  364. // })
  365. // return false
  366. // }
  367. this.dateshow = true
  368. }
  369. },
  370. submitpay() {
  371. if (this.huanzheID == "") {
  372. uni.showToast({
  373. title: "请先选择接种用户",
  374. icon: "none"
  375. })
  376. return false
  377. }
  378. if (this.doctor == "") {
  379. uni.showToast({
  380. title: "请先选择机构",
  381. icon: "none"
  382. })
  383. return false
  384. }
  385. if (this.yimiaoInfo == "") {
  386. uni.showToast({
  387. title: "请先选择疫苗",
  388. icon: "none"
  389. })
  390. return false
  391. }
  392. if (this.timehour == "") {
  393. uni.showToast({
  394. title: "请先选择预约时间",
  395. icon: "none"
  396. })
  397. return false
  398. }
  399. uni.requestSubscribeMessage({
  400. tmplIds: ['M9b6PPKtD7PEqLsSnQ453iTIHtIZZpixOBjUjax8YXU',
  401. 'Sg0lKmOexTnxxDzy39E26aNvmc3w4qKUnxl21A9dWns',
  402. 'phcsQ7ZbsJapfmx3NMChaxepR9tJFiqbO25P9tujErI'
  403. ],
  404. success: (res) => {
  405. this.gotopay()
  406. },
  407. fail: (err) => {
  408. this.gotopay()
  409. }
  410. })
  411. },
  412. gotopay: async function() {
  413. let obj = {
  414. product_type: 4,
  415. patient_id: this.huanzheID,
  416. total_amount: 0,
  417. organization_id: this.doctor.id,
  418. schedule_date: this.time,
  419. time_period_id: this.timehour,
  420. vaccine_id: this.yimiaoInfo.id,
  421. payment_type: 2
  422. }
  423. // if ((this.yimiaoInfo.price / 100) == 0) {
  424. let res = await this.$request.post("/api/v1/order/appointPlaceOrder", {
  425. product_type: obj.product_type,
  426. patient_id: obj.patient_id,
  427. total_amount: 0,
  428. organization_id: obj.organization_id,
  429. schedule_date: obj.schedule_date,
  430. time_period_id: obj.time_period_id,
  431. vaccine_id: obj.vaccine_id,
  432. payment_type: obj.payment_type,
  433. })
  434. if (res.status == 0) {
  435. uni.showToast({
  436. title: "提交成功!",
  437. icon: "none",
  438. duration: 1000
  439. })
  440. setTimeout(() => {
  441. uni.redirectTo({
  442. url: "../order/order?type=" + obj.product_type
  443. })
  444. }, 1000)
  445. } else {
  446. uni.showModal({
  447. title: "提示",
  448. content: res.message,
  449. confirmText: "查看预约",
  450. success: (res) => {
  451. if (res.confirm) {
  452. uni.navigateTo({
  453. url: "../common_tools/my_consulting/my_appointment"
  454. })
  455. }
  456. }
  457. })
  458. }
  459. // } else {
  460. // uni.navigateTo({
  461. // url: "../order/payment?data=" + JSON.stringify(obj)
  462. // })
  463. // }
  464. },
  465. gotodoctorinfo(id) {
  466. uni.navigateTo({
  467. url: "../doctor_related/doctor_info?id=" + id + "&index=2"
  468. })
  469. }
  470. }
  471. }
  472. </script>
  473. <style lang="scss" scoped>
  474. .main {}
  475. .popup_title {
  476. height: 15%;
  477. width: 100%;
  478. display: flex;
  479. justify-content: center;
  480. align-items: center;
  481. border-bottom: 1rpx solid #f9f9f9;
  482. }
  483. .textareasty {
  484. background-color: white;
  485. border: 1px solid #efefef;
  486. border-radius: 16rpx;
  487. padding: 15rpx;
  488. margin: 15rpx auto;
  489. }
  490. .popup_title_text {
  491. width: auto;
  492. height: auto;
  493. font-size: 34rpx;
  494. font-weight: 540;
  495. }
  496. .popup_list {
  497. display: flex;
  498. height: 10vh;
  499. width: auto;
  500. border-bottom: 1rpx solid #f9f9f9;
  501. }
  502. .popup_list_title {
  503. height: 100%;
  504. width: 90%;
  505. display: inline-block;
  506. padding: 0 0 0 30rpx;
  507. .title {
  508. height: 50%;
  509. width: auto;
  510. font-size: 32rpx;
  511. font-weight: 500;
  512. padding: 20rpx 0 0 0;
  513. }
  514. .body {
  515. height: 50%;
  516. color: #a1a1a1;
  517. height: auto;
  518. width: auto;
  519. font-size: 30rpx;
  520. padding: 10rpx 0 0 0;
  521. }
  522. }
  523. .popup_button {
  524. height: 80rpx;
  525. width: 100%;
  526. display: flex;
  527. justify-content: center;
  528. align-items: center;
  529. view {
  530. color: #0b73ba;
  531. font-weight: 500;
  532. }
  533. }
  534. /**选择号码的样式和选择患者不同
  535. 需要更改样式*/
  536. .phone {
  537. height: 20%;
  538. width: 100%;
  539. .list {
  540. height: 100%;
  541. width: 100%;
  542. display: flex;
  543. padding: 0 10rpx 0 30rpx;
  544. .title {
  545. height: 100%;
  546. width: 65%;
  547. font-size: 32rpx;
  548. color: #7d7d7d;
  549. display: flex;
  550. align-items: center;
  551. }
  552. .phone {
  553. height: 100%;
  554. width: 30%;
  555. font-size: 32rpx;
  556. font-weight: 500;
  557. display: flex;
  558. justify-content: center;
  559. align-items: center;
  560. }
  561. .button {
  562. height: 100%;
  563. width: 5%;
  564. display: flex;
  565. justify-content: center;
  566. align-items: center;
  567. }
  568. }
  569. }
  570. </style>