child_care.vue 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487
  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 => {
  192. return {
  193. date: item.schedule_date,
  194. id: item.id
  195. }
  196. })
  197. res.data.data.forEach(item => {
  198. let time = item.schedule_period.map(itm => {
  199. if (item.id == itm.schedule_id) {
  200. itm.organization.org_id = itm.organization['id']
  201. return {
  202. yeardate:itm.schedule_date,
  203. schedule_id: itm.schedule_id,
  204. can_appoint_num: itm.can_appoint_num,
  205. ...itm.organization,
  206. ...itm.time_period
  207. }
  208. }
  209. })
  210. times.push(time)
  211. })
  212. // time[0].forEach(item => {
  213. // item.start_time_period = item.start_time_period + '-' + item.end_time_period
  214. // })
  215. this.multiSelector.push(nian)
  216. // time[0].sort((a,b)=> {return a.end_time_period>b.end_time_period?1:-1})
  217. times.forEach(item => {
  218. item.sort((a, b) => {
  219. return a.end_time_period > b.end_time_period ? 1 : -1
  220. })
  221. // for (let i = item.length - 1; i >= 0; i--) {
  222. // let arr = item[i].yeardate + " " + item[i].end_time_period;
  223. // arr = arr.split(/[- :]/)
  224. // let nndate = Date.parse(new Date(arr[0], arr[1] - 1, arr[2], arr[3], arr[4]));
  225. // let currentTime = Date.parse(new Date())
  226. // // console.log(nndate<currentTime,index)
  227. // if (nndate < currentTime) {
  228. // item.splice(i, 1)
  229. // }
  230. // }
  231. })
  232. this.multiSelector.push(times)
  233. let arr = this.multiSelector[1][0]
  234. arr.forEach(item => {
  235. item.year = nian[0].date
  236. })
  237. this.$refs.date.rightday = arr
  238. console.log(this.multiSelector)
  239. }
  240. },
  241. callbacktime(item) {
  242. // this.timehour = this.multiSelector[1][arr[1]].id
  243. // this.yuyuevalue = this.multiSelector[0][arr[0]] + " " + this.multiSelector[1][arr[1]].start_time_period
  244. // this.time = this.multiSelector[0][arr[0]]
  245. this.timehour = item.id
  246. this.yuyuevalue = item.year + " " + item.start_time_period + "-" + item.end_time_period
  247. this.time = item.year
  248. this.dateshow = false
  249. },
  250. //添加就诊人
  251. addPeople(e) {
  252. uni.navigateTo({
  253. url: "../archives/add_archives"
  254. })
  255. },
  256. xuanzefuwu() {
  257. uni.navigateTo({
  258. url: "../vaccines/mechanism"
  259. })
  260. },
  261. vaccinesList() {
  262. if (this.doctor == '') {
  263. uni.showToast({
  264. title: "请先选择机构",
  265. icon: "none"
  266. })
  267. return false
  268. }
  269. uni.navigateTo({
  270. url: "child_careList?id=" + this.doctor.id
  271. })
  272. },
  273. yuyuetime() {
  274. if (!this.is_Scheduling) {
  275. uni.showToast({
  276. title: "尚未排班",
  277. icon: "none"
  278. })
  279. return false
  280. }
  281. if (this.doctor == '') {
  282. uni.showToast({
  283. title: "请先选择机构",
  284. icon: "none"
  285. })
  286. return false
  287. }
  288. this.dateshow = true
  289. },
  290. gotopay: async function() {
  291. if (this.huanzheID == "") {
  292. uni.showToast({
  293. title: "请先选择接种用户",
  294. icon: "none"
  295. })
  296. return false
  297. }
  298. if (this.doctor == "") {
  299. uni.showToast({
  300. title: "请先选择机构",
  301. icon: "none"
  302. })
  303. return false
  304. }
  305. if (this.yimiao == "") {
  306. uni.showToast({
  307. title: "请先选择儿保项目",
  308. icon: "none"
  309. })
  310. return false
  311. }
  312. if (this.timehour == "") {
  313. uni.showToast({
  314. title: "请先选择预约时间",
  315. icon: "none"
  316. })
  317. return false
  318. }
  319. let obj = {
  320. product_type: 5,
  321. patient_id: this.huanzheID,
  322. total_amount: this.yimiao,
  323. organization_id: this.doctor.id,
  324. schedule_date: this.time,
  325. time_period_id: this.timehour,
  326. nurse_ids: this.childcare.map(item => {
  327. return item.id
  328. }),
  329. payment_type: 2
  330. }
  331. console.log(this.yimiao)
  332. if (this.yimiao == 0) {
  333. let res = await this.$request.post("/api/v1/order/appointPlaceOrder", {
  334. product_type: obj.product_type,
  335. patient_id: obj.patient_id,
  336. total_amount: obj.total_amount * 100,
  337. organization_id: obj.organization_id,
  338. schedule_date: obj.schedule_date,
  339. time_period_id: obj.time_period_id,
  340. nurse_ids: JSON.stringify(obj.nurse_ids),
  341. payment_type: obj.payment_type,
  342. })
  343. if (res.status == 0) {
  344. uni.showToast({
  345. title: "提交成功!",
  346. icon: "none",
  347. duration: 1000
  348. })
  349. setTimeout(() => {
  350. uni.redirectTo({
  351. url: "../order/order?type=" + obj.product_type
  352. })
  353. }, 1000)
  354. }
  355. } else {
  356. uni.navigateTo({
  357. url: "../order/payment?data=" + JSON.stringify(obj)
  358. })
  359. }
  360. },
  361. gotodoctorinfo(id) {
  362. uni.navigateTo({
  363. url: "../doctor_related/doctor_info?id=" + id + "&index=2"
  364. })
  365. }
  366. }
  367. }
  368. </script>
  369. <style lang="scss" scoped>
  370. .main {}
  371. .popup_title {
  372. height: 15%;
  373. width: 100%;
  374. display: flex;
  375. justify-content: center;
  376. align-items: center;
  377. border-bottom: 1rpx solid #f9f9f9;
  378. }
  379. .textareasty {
  380. background-color: white;
  381. border: 1px solid #efefef;
  382. border-radius: 16rpx;
  383. padding: 15rpx;
  384. margin: 15rpx auto;
  385. }
  386. .popup_title_text {
  387. width: auto;
  388. height: auto;
  389. font-size: 34rpx;
  390. font-weight: 540;
  391. }
  392. .popup_list {
  393. display: flex;
  394. height: 10vh;
  395. width: auto;
  396. border-bottom: 1rpx solid #f9f9f9;
  397. }
  398. .popup_list_title {
  399. height: 100%;
  400. width: 90%;
  401. display: inline-block;
  402. padding: 0 0 0 30rpx;
  403. .title {
  404. height: 50%;
  405. width: auto;
  406. font-size: 32rpx;
  407. font-weight: 500;
  408. padding: 20rpx 0 0 0;
  409. }
  410. .body {
  411. height: 50%;
  412. color: #a1a1a1;
  413. height: auto;
  414. width: auto;
  415. font-size: 30rpx;
  416. padding: 10rpx 0 0 0;
  417. }
  418. }
  419. .popup_button {
  420. height: 80rpx;
  421. width: 100%;
  422. display: flex;
  423. justify-content: center;
  424. align-items: center;
  425. view {
  426. color: #0b73ba;
  427. font-weight: 500;
  428. }
  429. }
  430. /**选择号码的样式和选择患者不同
  431. 需要更改样式*/
  432. .phone {
  433. height: 20%;
  434. width: 100%;
  435. .list {
  436. height: 100%;
  437. width: 100%;
  438. display: flex;
  439. padding: 0 10rpx 0 30rpx;
  440. .title {
  441. height: 100%;
  442. width: 65%;
  443. font-size: 32rpx;
  444. color: #7d7d7d;
  445. display: flex;
  446. align-items: center;
  447. }
  448. .phone {
  449. height: 100%;
  450. width: 30%;
  451. font-size: 32rpx;
  452. font-weight: 500;
  453. display: flex;
  454. justify-content: center;
  455. align-items: center;
  456. }
  457. .button {
  458. height: 100%;
  459. width: 5%;
  460. display: flex;
  461. justify-content: center;
  462. align-items: center;
  463. }
  464. }
  465. }
  466. </style>