child_care.vue 14 KB

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