vaccines_info.vue 15 KB

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