vaccines_info.vue 12 KB

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