vaccines_info.vue 11 KB

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