vaccines_info.vue 13 KB

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