vaccines_info.vue 12 KB

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