child_care.vue 12 KB

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