child_care.vue 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533
  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.nurse_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" v-if="childcare.length==0">请选择儿保项目</text>
  40. <text class="text-orange text-sm" v-else>合计:¥{{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="nurse_notice"></rich-text>
  53. </view>
  54. </view>
  55. <!-- <u-picker mode="multiSelector" @confirm="callbacktime" v-model="show" range-key="start_time_period" :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="gotopay">
  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. import {
  100. mapState,
  101. mapMutations,
  102. mapGetters,
  103. mapActions
  104. } from 'vuex';
  105. var user = require('../../common/user.js');
  106. export default {
  107. computed: {
  108. ...mapState(['user']),
  109. ...mapGetters({
  110. hasLogin: 'verifyJwt'
  111. })
  112. },
  113. components: {
  114. datepicker
  115. },
  116. onLoad() {
  117. this.$util.getAgreement().then(res => {
  118. this.nurse_notice = res.data.nurse_notice
  119. }).catch(err => {
  120. })
  121. },
  122. onShow() {
  123. let price = 0
  124. if (this.doctor != null) {
  125. this.servicejigou = this.doctor.name
  126. this.jigouID = this.doctor.id
  127. }
  128. if (this.childcare.length != 0) {
  129. this.childcare.forEach(item => {
  130. price += item.price / 100
  131. })
  132. this.yimiao = price.toFixed(2)
  133. }
  134. this.getarchives()
  135. this.multiSelector = []
  136. this.gettime()
  137. },
  138. onHide() {
  139. this.yimiao = ""
  140. },
  141. data() {
  142. return {
  143. showpeople: false,
  144. huanzheID: "",
  145. value: "请选择儿保用户",
  146. patientList: [],
  147. show: false,
  148. yuyuevalue: "请选择预约时间",
  149. multiSelector: [],
  150. timehour: "",
  151. doctor: "",
  152. servicejigou: "请选择服务机构",
  153. jigouID: "",
  154. yimiao: "",
  155. yimiaoInfo: "",
  156. time: "",
  157. childcare: [],
  158. dateshow: false,
  159. is_Scheduling: true,
  160. nurse_notice: ""
  161. }
  162. },
  163. methods: {
  164. // 选中某个单选框时,由radio时触发
  165. peopleRadioChange(e) {
  166. console.log(e);
  167. },
  168. xuanzehuanzhe(item) {
  169. this.huanzheID = item.id
  170. this.value = item.name
  171. this.showpeople = false
  172. },
  173. getarchives: async function() {
  174. let res = await this.$request.post("/api/v1/patient/patientList")
  175. if (res.status == 0) {
  176. this.patientList = res.data.data
  177. }
  178. },
  179. gettime: async function() {
  180. if (this.doctor == '') {
  181. return false
  182. }
  183. let res = await this.$request.post("/api/v1/docter/timePeriodList", {
  184. organization_id: this.doctor.id,
  185. schedule_type: 3
  186. })
  187. console.log(res)
  188. if (res.status == 0) {
  189. let times = []
  190. // res.data.list.forEach(item => {
  191. // item.start_time_period = item.start_time_period + '-' + item.end_time_period
  192. // })
  193. // this.multiSelector.push(res.data.dates)
  194. // this.multiSelector.push(res.data.list)
  195. if (res.data.data.length == 0) {
  196. this.is_Scheduling = false
  197. return false
  198. }
  199. let nian = res.data.data.map((item, index) => {
  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. times.forEach(item => {
  234. item.sort((a, b) => {
  235. return a.end_time_period > b.end_time_period ? 1 : -1
  236. })
  237. })
  238. this.multiSelector.push(times)
  239. let arr = this.multiSelector[1][0]
  240. arr.forEach(item => {
  241. item.year = nian[0].date
  242. })
  243. this.$refs.date.rightday = arr
  244. console.log(this.multiSelector)
  245. }
  246. },
  247. callbacktime(item) {
  248. // this.timehour = this.multiSelector[1][arr[1]].id
  249. // this.yuyuevalue = this.multiSelector[0][arr[0]] + " " + this.multiSelector[1][arr[1]].start_time_period
  250. // this.time = this.multiSelector[0][arr[0]]
  251. let arr = item.year.split(/[- :]/)
  252. let nndate = new Date(arr[0], arr[1] - 1, arr[2]);
  253. nndate = Date.parse(nndate)
  254. let currentTime = Date.parse(new Date())
  255. if ((nndate - currentTime) / (1000 * 60 * 60 * 24) > this.doctor.can_vaccine_days) {
  256. uni.showToast({
  257. title: "尚未到可预约时间",
  258. icon: "none"
  259. })
  260. return false
  261. }
  262. this.timehour = item.id
  263. this.yuyuevalue = item.year + " " + item.start_time_period + "-" + item.end_time_period
  264. this.time = item.year
  265. this.dateshow = false
  266. },
  267. //添加就诊人
  268. addPeople(e) {
  269. uni.navigateTo({
  270. url: "../archives/add_archives"
  271. })
  272. },
  273. xuanzefuwu() {
  274. this.yimiao = ""
  275. this.yimiaoInfo = ""
  276. this.childcare = []
  277. uni.navigateTo({
  278. url: "../vaccines/mechanism?type=" + 3
  279. })
  280. },
  281. vaccinesList() {
  282. if (this.doctor == '') {
  283. uni.showToast({
  284. title: "请先选择机构",
  285. icon: "none"
  286. })
  287. return false
  288. }
  289. uni.navigateTo({
  290. url: "child_careList?id=" + this.doctor.id
  291. })
  292. },
  293. yuyuetime() {
  294. if (this.multiSelector[0] == undefined || this.multiSelector[1] == undefined) {
  295. uni.showToast({
  296. title: "尚未排班",
  297. icon: "none"
  298. })
  299. return false
  300. }
  301. if (this.multiSelector[0].length == 0 && this.multiSelector[1].length == 0) {
  302. uni.showToast({
  303. title: "尚未排班",
  304. icon: "none"
  305. })
  306. return false
  307. }
  308. // if (!this.is_Scheduling) {
  309. // uni.showToast({
  310. // title: "尚未排班",
  311. // icon: "none"
  312. // })
  313. // return false
  314. // }
  315. if (this.doctor == '') {
  316. uni.showToast({
  317. title: "请先选择机构",
  318. icon: "none"
  319. })
  320. return false
  321. }
  322. this.dateshow = true
  323. },
  324. gotopay: async function() {
  325. if (this.huanzheID == "") {
  326. uni.showToast({
  327. title: "请先选择接种用户",
  328. icon: "none"
  329. })
  330. return false
  331. }
  332. if (this.doctor == "") {
  333. uni.showToast({
  334. title: "请先选择机构",
  335. icon: "none"
  336. })
  337. return false
  338. }
  339. if (this.yimiao == "") {
  340. uni.showToast({
  341. title: "请先选择儿保项目",
  342. icon: "none"
  343. })
  344. return false
  345. }
  346. if (this.timehour == "") {
  347. uni.showToast({
  348. title: "请先选择预约时间",
  349. icon: "none"
  350. })
  351. return false
  352. }
  353. let obj = {
  354. product_type: 5,
  355. patient_id: this.huanzheID,
  356. total_amount: this.yimiao,
  357. organization_id: this.doctor.id,
  358. schedule_date: this.time,
  359. time_period_id: this.timehour,
  360. nurse_ids: this.childcare.map(item => {
  361. return item.id
  362. }),
  363. payment_type: 2
  364. }
  365. console.log(this.yimiao)
  366. if (this.yimiao == 0) {
  367. let res = await this.$request.post("/api/v1/order/appointPlaceOrder", {
  368. product_type: obj.product_type,
  369. patient_id: obj.patient_id,
  370. total_amount: obj.total_amount * 100,
  371. organization_id: obj.organization_id,
  372. schedule_date: obj.schedule_date,
  373. time_period_id: obj.time_period_id,
  374. nurse_ids: JSON.stringify(obj.nurse_ids),
  375. payment_type: obj.payment_type,
  376. })
  377. if (res.status == 0) {
  378. uni.showToast({
  379. title: "提交成功!",
  380. icon: "none",
  381. duration: 1000
  382. })
  383. setTimeout(() => {
  384. uni.redirectTo({
  385. url: "../order/order?type=" + obj.product_type
  386. })
  387. }, 1000)
  388. }else{
  389. uni.showModal({
  390. title: "提示",
  391. content: res.message,
  392. confirmText: "确定",
  393. showCancel: false,
  394. success: (rr) => {
  395. }
  396. })
  397. }
  398. } else {
  399. uni.navigateTo({
  400. url: "../order/payment?data=" + JSON.stringify(obj)
  401. })
  402. }
  403. },
  404. gotodoctorinfo(id) {
  405. uni.navigateTo({
  406. url: "../doctor_related/doctor_info?id=" + id + "&index=2"
  407. })
  408. }
  409. }
  410. }
  411. </script>
  412. <style lang="scss" scoped>
  413. .main {}
  414. .popup_title {
  415. height: 15%;
  416. width: 100%;
  417. display: flex;
  418. justify-content: center;
  419. align-items: center;
  420. border-bottom: 1rpx solid #f9f9f9;
  421. }
  422. .textareasty {
  423. background-color: white;
  424. border: 1px solid #efefef;
  425. border-radius: 16rpx;
  426. padding: 15rpx;
  427. margin: 15rpx auto;
  428. }
  429. .popup_title_text {
  430. width: auto;
  431. height: auto;
  432. font-size: 34rpx;
  433. font-weight: 540;
  434. }
  435. .popup_list {
  436. display: flex;
  437. height: 10vh;
  438. width: auto;
  439. border-bottom: 1rpx solid #f9f9f9;
  440. }
  441. .popup_list_title {
  442. height: 100%;
  443. width: 90%;
  444. display: inline-block;
  445. padding: 0 0 0 30rpx;
  446. .title {
  447. height: 50%;
  448. width: auto;
  449. font-size: 32rpx;
  450. font-weight: 500;
  451. padding: 20rpx 0 0 0;
  452. }
  453. .body {
  454. height: 50%;
  455. color: #a1a1a1;
  456. height: auto;
  457. width: auto;
  458. font-size: 30rpx;
  459. padding: 10rpx 0 0 0;
  460. }
  461. }
  462. .popup_button {
  463. height: 80rpx;
  464. width: 100%;
  465. display: flex;
  466. justify-content: center;
  467. align-items: center;
  468. view {
  469. color: #0b73ba;
  470. font-weight: 500;
  471. }
  472. }
  473. /**选择号码的样式和选择患者不同
  474. 需要更改样式*/
  475. .phone {
  476. height: 20%;
  477. width: 100%;
  478. .list {
  479. height: 100%;
  480. width: 100%;
  481. display: flex;
  482. padding: 0 10rpx 0 30rpx;
  483. .title {
  484. height: 100%;
  485. width: 65%;
  486. font-size: 32rpx;
  487. color: #7d7d7d;
  488. display: flex;
  489. align-items: center;
  490. }
  491. .phone {
  492. height: 100%;
  493. width: 30%;
  494. font-size: 32rpx;
  495. font-weight: 500;
  496. display: flex;
  497. justify-content: center;
  498. align-items: center;
  499. }
  500. .button {
  501. height: 100%;
  502. width: 5%;
  503. display: flex;
  504. justify-content: center;
  505. align-items: center;
  506. }
  507. }
  508. }
  509. </style>