vaccines_info.vue 12 KB

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