packageForm.vue 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675
  1. <template>
  2. <view>
  3. <view class="content">
  4. <choosePatient ref="choosePatient" class="patient" :patient="patient" @addPatient="addPatient"></choosePatient>
  5. <!-- <view class="patient-cont">
  6. <view class="chose-patient">
  7. <view class="patient-box" @click="addPatient()" v-if="patient==null">
  8. <view class="patient-item">
  9. <view class="patient-tip">*</view>
  10. <view class="patient-title">选择就诊人</view>
  11. </view>
  12. <view class="right" >
  13. <image src="/static/images/arrow_gray.png" mode=""></image>
  14. </view>
  15. </view>
  16. <view class="patient" @click="addPatient()" v-if="patient!=null">
  17. <view class="left">
  18. <view class="name">{{patient.patientName}}</view>
  19. <view class="info">
  20. <text class="text" v-if="patient.sex==1">男</text>
  21. <text class="text" v-if="patient.sex==2">女</text>
  22. <text class="text">{{$getAge(patient.birthday)}}岁</text>
  23. <text class="text">{{$parseIdCard(patient.idCard)}}</text>
  24. </view>
  25. </view>
  26. <view class="right" >
  27. <image src="/static/images/arrow_gray.png" mode=""></image>
  28. </view>
  29. </view>
  30. </view>
  31. </view> -->
  32. <view class="msg-cont">
  33. <scroll-view
  34. class="msg-scroll"
  35. :scroll-top="scrollTop"
  36. scroll-y="true"
  37. :scroll-with-animation="true"
  38. >
  39. <view class="msgs">
  40. <view class="msg-item" v-for="(item,index) in msgs" >
  41. <view class="left" v-if="item.type==1">
  42. <!-- <image class="img" src="https://fs-1319721001.cos.ap-chongqing.myqcloud.com/fs/20240229/be32b8d2ae9f497297d10327656bb43c.png"></image> -->
  43. <image class="img" mode="aspectFill" :src="agreement.avatar?agreement.avatar:'https://fs-1319721001.cos.ap-chongqing.myqcloud.com/fs/20240229/1d7eb0607a074892964dd32e8735e540.jpg'"></image>
  44. <view class="msg-content">{{item.content}}</view>
  45. </view>
  46. <view class="right" v-if="item.type==2">
  47. <view class="msg-content">{{item.content}}</view>
  48. <image class="img" mode="aspectFill" :src="avatar?avatar:'https://fs-1319721001.cos.ap-chongqing.myqcloud.com/fs/20240229/1d7eb0607a074892964dd32e8735e540.jpg'"></image>
  49. </view>
  50. </view>
  51. </view>
  52. </scroll-view>
  53. </view>
  54. <view class="option-cont" v-if="item!=null">
  55. <view class="option-title" >{{item.title}}</view>
  56. <view class="options" >
  57. <view :class="option.color=='red'?'option-item red':'option-item green'" @click="optionClick(item,option)" v-for="(option,opIndex) in item.options" >{{option.name}}</view>
  58. </view>
  59. </view>
  60. </view>
  61. <u-modal @cancel="close()" @confirm="confirm()" :show="show" title="温馨提示" :content='content'></u-modal>
  62. </view>
  63. </template>
  64. <script>
  65. import choosePatient from "./components/choosePatient/choosePatient.vue"
  66. import {create,giftCreate,getAgreement} from '@/api/packageOrder.js'
  67. export default {
  68. components: {
  69. choosePatient
  70. },
  71. data() {
  72. return {
  73. content:null,
  74. show:false,
  75. scrollTop:0,//滚动条位置
  76. patient:null,
  77. items:[
  78. {
  79. title:"您是否已在线下就诊,且对所购买的药品无过敏或不良反应?",
  80. options:[
  81. {name:"是,我线下就诊过",value:1,color:'green'},
  82. {name:"无,从未就诊",value:0,color:'red'},
  83. ]
  84. },
  85. {
  86. title:"您是否已详细阅读药物说明,确认自己符合药物适用人群,并了解用药方法、用药禁忌等信息?",
  87. options:[
  88. {name:"是,我已充分了解",value:1,color:'green'},
  89. {name:"否,未阅读",value:0,color:'red'},
  90. ]
  91. },{
  92. title:"您之前因以下哪种情况去线下就医,接受过哪些检查?",
  93. options:[
  94. {name:"慢性病复查,复查了基本指标",value:1,color:'green'},
  95. {name:"头晕、头痛,查过血压",value:2,color:'green'},
  96. {name:"失眠、记忆力下降,常规检查",value:3,color:'green'},
  97. {name:"心悸、胸痛,查过心电图",value:4,color:'green'},
  98. {name:"关节疼痛,查过X光片",value:5,color:'green'},
  99. {name:"突发不适,常规检查",value:6,color:'green'}
  100. ]
  101. },
  102. {
  103. title:"您目前已确诊的慢性疾病有哪些?",
  104. options:[
  105. {name:"高血压",value:1,color:'green'},
  106. {name:"糖尿病",value:2,color:'green'},
  107. {name:"心脑血管疾病",value:3,color:'green'},
  108. {name:"呼吸系统疾病",value:4,color:'green'},
  109. {name:"骨关节病",value:5,color:'green'},
  110. {name:"肠胃疾病",value:6,color:'green'},
  111. {name:"其他",value:7,color:'green'},
  112. ]
  113. }
  114. ],
  115. msgs:[],
  116. index:0,
  117. item:null,
  118. notice:[
  119. {title:"好的。我将根据您提交的复诊信息开具处方,请详细阅读药品说明书,遵医嘱用药。"},
  120. {title:"您存在用药禁忌证,目前不推荐购买此套餐包。建议您尽早就医,在医生指导下采取针对性的治疗措施!在改善相关禁忌证后,也可以再次咨询,重新评估是否可以使用该套餐包。"}
  121. ],
  122. packageId:null,
  123. doctorId:null,
  124. isComplete:0,
  125. companyUserId:null,
  126. companyId:null,
  127. choose: 0, // 1:付邮费领取 2:加粉领取
  128. docAvatar:'',
  129. avatar: '',
  130. paddingTop: 130,
  131. agreement: {}
  132. };
  133. },
  134. onLoad(option) {
  135. this.packageId=option.packageId
  136. this.doctorId=option.doctorId
  137. this.choose = option.choose || 0
  138. if(!this.$isEmpty(option.companyId)){
  139. this.companyId=option.companyId
  140. }
  141. if(!this.$isEmpty(option.companyUserId)){
  142. this.companyUserId=option.companyUserId
  143. }
  144. var that=this;
  145. uni.$on('refreshOrderPatient', (res) => {
  146. that.patient=res
  147. setTimeout(()=>{
  148. this.getpaddingTop()
  149. },100)
  150. })
  151. this.item=this.items[0];
  152. this.addMsg(1,this.item.title);
  153. this.getAgreement()
  154. this.avatar = uni.getStorageSync('userInfo')&&JSON.parse(uni.getStorageSync('userInfo')).avatar
  155. },
  156. onShow() {
  157. this.$nextTick(()=>{
  158. this.$refs.choosePatient.getPatientList()
  159. })
  160. },
  161. methods:{
  162. getpaddingTop() {
  163. uni
  164. .createSelectorQuery().in(this)
  165. .select(".patient")
  166. .boundingClientRect((res) => {
  167. this.paddingTop = res&&res.height;
  168. })
  169. .exec();
  170. },
  171. getAgreement() {
  172. getAgreement().then(res=>{
  173. if(res.code==200) {
  174. this.agreement = res.doctor || {}
  175. uni.setNavigationBarTitle({
  176. title: this.agreement.doctorName || '问答'
  177. });
  178. }
  179. })
  180. },
  181. close(){
  182. this.show=false;
  183. },
  184. confirm(){
  185. if(this.isComplete==1){
  186. this.submit()
  187. }
  188. else{
  189. uni.navigateBack()
  190. }
  191. },
  192. addMsg(type,content){
  193. var msg={type:type,content:content}
  194. this.msgs.push(msg)
  195. var that=this;
  196. setTimeout(()=>{
  197. uni
  198. .createSelectorQuery()
  199. .select(".msgs")
  200. .boundingClientRect((res) => {
  201. if(res) {
  202. const scrollH = res.height;
  203. that.scrollTop = scrollH;
  204. }
  205. })
  206. .exec();
  207. },100)
  208. },
  209. optionClick(item,option){
  210. if(this.patient==null){
  211. uni.showToast({
  212. icon:'none',
  213. title: "请选择就诊人",
  214. });
  215. return;
  216. }
  217. if(option.value==0){
  218. this.content=this.notice[1].title;
  219. this.show=true;
  220. this.isComplete=0;
  221. return;
  222. }
  223. item.option=option.name;
  224. this.addMsg(2,option.name);
  225. this.index++;
  226. if(this.index<=this.items.length-1){
  227. this.item=this.items[this.index];
  228. this.addMsg(1,this.item.title)
  229. }
  230. else{
  231. this.content=this.notice[0].title;
  232. this.show=true;
  233. this.isComplete=1;
  234. return;
  235. }
  236. },
  237. addPatient(){
  238. uni.navigateTo({
  239. url: '/pages_user/patient'
  240. })
  241. },
  242. submit(){
  243. uni.showLoading({
  244. title:"处理中..."
  245. })
  246. const num = Math.floor(Math.random() * 6);
  247. this.items = this.items.map(item=>({
  248. ...item,
  249. option: item.title == "您目前已确诊的慢性疾病有哪些?"&&item.option =='其他' ? item.options[num].name:item.option
  250. }))
  251. var data={
  252. companyId:this.companyId,
  253. companyUserId:this.companyUserId,
  254. patientId:this.patient.patientId,
  255. patientJson:JSON.stringify(this.patient),
  256. packageId:this.packageId,
  257. doctorId:this.doctorId,
  258. formJson:JSON.stringify(this.items),
  259. }
  260. if(this.choose == 1 || this.choose == 2) {
  261. this.giftCreateOrder(data)
  262. return
  263. }
  264. var that=this;
  265. create(data).then(res => {
  266. uni.hideLoading()
  267. if(res.code==200){
  268. var temps=['jARl4BpoBkRu-2MxPMkQVhIfGMG0V9qW-X3V_7NtEOU']
  269. uni.requestSubscribeMessage({
  270. tmplIds: temps,
  271. success(e) {
  272. setTimeout(function(){
  273. uni.navigateTo({
  274. url: '/pages_order/packageOrderPay?orderId='+res.order.orderId
  275. })
  276. },200);
  277. },
  278. fail(e) {
  279. setTimeout(function(){
  280. uni.navigateTo({
  281. url: '/pages_order/packageOrderPay?orderId='+res.order.orderId
  282. })
  283. },200);
  284. }
  285. })
  286. }else{
  287. uni.showToast({
  288. icon:'none',
  289. title: res.msg,
  290. });
  291. }
  292. });
  293. },
  294. giftCreateOrder(data) {
  295. var that=this;
  296. const param = {
  297. ...data,
  298. choose: this.choose, //1:付邮费领取 2:加粉领取
  299. }
  300. giftCreate(param).then(res => {
  301. uni.hideLoading()
  302. if(res.code==200){
  303. var temps=['jARl4BpoBkRu-2MxPMkQVhIfGMG0V9qW-X3V_7NtEOU']
  304. uni.requestSubscribeMessage({
  305. tmplIds: temps,
  306. success(e) {
  307. setTimeout(function(){
  308. uni.navigateTo({
  309. url: '/pages_order/packageOrderPay?orderId='+res.order.orderId
  310. })
  311. },200);
  312. },
  313. fail(e) {
  314. setTimeout(function(){
  315. uni.navigateTo({
  316. url: '/pages_order/packageOrderPay?orderId='+res.order.orderId
  317. })
  318. },200);
  319. }
  320. })
  321. }else{
  322. uni.showToast({
  323. icon:'none',
  324. title: res.msg,
  325. });
  326. }
  327. });
  328. }
  329. }
  330. }
  331. </script>
  332. <style lang="scss">
  333. .content{
  334. flex: 1;
  335. width: 100%;
  336. height: 100vh;
  337. display: flex;
  338. flex-direction: column;
  339. overflow: hidden;
  340. position: relative;
  341. .msg-cont{
  342. width: 100%;
  343. flex: 1;
  344. overflow: hidden;
  345. .msg-scroll{
  346. height: 100%;
  347. .msgs{
  348. width: 100%;
  349. padding: 6rpx 0;
  350. .msg-item{
  351. padding: 10rpx 15rpx;
  352. display: flex;
  353. flex-direction: column;
  354. justify-content: center;
  355. align-items: flex-start;
  356. width: 100%;
  357. .left{
  358. width: 100%;
  359. display: flex;
  360. justify-content: flex-start;
  361. align-items: flex-start;
  362. .img{
  363. min-width: 100rpx;
  364. width: 100rpx;
  365. height:100rpx;
  366. border-radius: 50%;
  367. image{
  368. width: 100%;
  369. height:100%;
  370. }
  371. }
  372. .msg-content{
  373. margin-top: 15rpx;
  374. margin-left: 10rpx;
  375. border-radius: 15rpx;
  376. padding: 15rpx;
  377. background-color: #fff;
  378. color: #111;
  379. font-size: 32upx;
  380. font-family: PingFang SC;
  381. }
  382. }
  383. .right{
  384. width: 100%;
  385. display: flex;
  386. justify-content: flex-end;
  387. align-items: flex-start;
  388. .msg-content{
  389. margin-top: 15rpx;
  390. margin-right: 10rpx;
  391. border-radius: 15rpx;
  392. padding: 15rpx;
  393. background-color: #d3ad58;
  394. color: #fff;
  395. font-size: 32upx;
  396. font-family: PingFang SC;
  397. }
  398. .img{
  399. min-width: 100rpx;
  400. width: 100rpx;
  401. height:100rpx;
  402. border-radius: 50%;
  403. image{
  404. width: 100%;
  405. height:100%;
  406. }
  407. }
  408. }
  409. }
  410. }
  411. }
  412. }
  413. .option-cont{
  414. flex-shrink: 0;
  415. // position: fixed;
  416. // bottom: 0rpx;
  417. // #ifndef APP-PLUS
  418. max-height: 90vh;
  419. overflow-y: auto;
  420. // #endif
  421. // #ifdef APP-PLUS
  422. // height: 380rpx;
  423. // #endif
  424. width: 100%;
  425. background-color: #fff;
  426. border-radius: 60rpx 60rpx 0rpx 0rpx;
  427. padding: 30rpx;
  428. .option-title{
  429. width: 100%;
  430. padding-bottom: 15rpx;
  431. display: flex;
  432. align-items: center;
  433. justify-content: center;
  434. font-size: 32upx;
  435. font-family: PingFang SC;
  436. color: #111;
  437. }
  438. .options{
  439. margin-top: 20rpx;
  440. display: flex;
  441. flex-direction: column;
  442. justify-content: center;
  443. align-items: center;
  444. .option-item{
  445. display: flex;
  446. align-items: center;
  447. justify-content: center;
  448. width: 100%;
  449. border: 1rpx solid #eee;
  450. margin-bottom: 20rpx;
  451. padding: 15rpx;
  452. border-radius: 5rpx;
  453. color: #ffffff;
  454. font-size: 32upx;
  455. }
  456. .green{
  457. background-color: #588e31;
  458. }
  459. .red{
  460. background-color: #c00000;
  461. }
  462. }
  463. }
  464. .title{
  465. padding: 15rpx 30rpx;
  466. display: flex;
  467. justify-content: center;
  468. align-items: center;
  469. width: 100%;
  470. background-color: #d3ad58;
  471. font-size: 24upx;
  472. font-family: PingFang SC;
  473. font-weight: bold;
  474. color: #fff;
  475. }
  476. .patient-cont{
  477. padding: 15rpx;
  478. .chose-patient{
  479. padding: 30rpx;
  480. box-shadow: 0px 0px 5px 2px rgba(0,0,0,0.05);
  481. background-color: #fff;
  482. border-radius: 15rpx;
  483. .patient-box{
  484. display: flex;
  485. align-items: center;
  486. justify-content: space-between;
  487. .patient-item{
  488. display: flex;
  489. align-items: center;
  490. justify-content: flex-start;
  491. .patient-tip{
  492. margin-top:6rpx;
  493. display: flex;
  494. align-items: center;
  495. justify-content: center;
  496. font-size: 32upx;
  497. font-family: PingFang SC;
  498. color: #ff0000;
  499. }
  500. .patient-title{
  501. margin-left: 10rpx;
  502. font-size: 32upx;
  503. font-family: PingFang SC;
  504. font-weight: bold;
  505. color: #111111;
  506. }
  507. }
  508. .right{
  509. display: flex;
  510. align-items: center;
  511. image{
  512. width: 15upx;
  513. height: 30upx;
  514. }
  515. }
  516. }
  517. .patient{
  518. display: flex;
  519. align-items: center;
  520. justify-content: space-between;
  521. height: 110upx;
  522. .left{
  523. .name{
  524. font-size: 30upx;
  525. line-height: 1;
  526. font-family: PingFang SC;
  527. font-weight: bold;
  528. color: #111111;
  529. }
  530. .info{
  531. margin-top: 30rpx;
  532. display: flex;
  533. align-items: center;
  534. .text{
  535. font-size: 26upx;
  536. font-family: PingFang SC;
  537. line-height: 1;
  538. font-weight: 500;
  539. color: #999;
  540. margin-right: 19upx;
  541. }
  542. }
  543. }
  544. .right{
  545. display: flex;
  546. align-items: center;
  547. image{
  548. width: 15upx;
  549. height: 30upx;
  550. }
  551. }
  552. }
  553. }
  554. }
  555. .items{
  556. padding: 15rpx;
  557. width: 100%;
  558. padding: 30rpx;
  559. border-radius: 15rpx;
  560. background-color: #fff;
  561. display: flex;
  562. flex-direction: column;
  563. align-items: flex-start;
  564. justify-content: flex-start;
  565. .item{
  566. display: flex;
  567. flex-direction: column;
  568. align-items: flex-start;
  569. justify-content: flex-start;
  570. width: 100%;
  571. background-color: #f8f8f8;
  572. margin-bottom: 15rpx;
  573. .name{
  574. font-size: 32upx;
  575. font-family: PingFang SC;
  576. color: #2a2b2e;
  577. font-weight: bold;
  578. margin-bottom: 15rpx;
  579. }
  580. .options{
  581. margin: 15rpx 0rpx;
  582. width: 100%;
  583. display: flex;
  584. align-items: center;
  585. justify-content: space-between;
  586. margin-bottom: 10rpx;
  587. .option{
  588. margin-bottom: 20rpx;
  589. display: flex;
  590. align-items: center;
  591. justify-content: center;
  592. border-radius: 10rpx;
  593. width:20%;
  594. height:100rpx;
  595. border: 1rpx solid #9b9b9b;
  596. font-size: 28upx;
  597. font-family: PingFang SC;
  598. color: #2a2b2e;
  599. background-color: #fff;
  600. &:last-child{
  601. margin-right: 0rpx;
  602. margin-bottom: 0rpx;
  603. }
  604. }
  605. .active{
  606. border: 1rpx solid #d3ad58;
  607. background-color: #d3ad58;
  608. color: #fff;
  609. }
  610. }
  611. }
  612. }
  613. .btns{
  614. display: flex;
  615. align-items: center;
  616. justify-content: space-between;
  617. width: 100%;
  618. padding: 30rpx;
  619. .btn{
  620. height:80rpx;
  621. margin: 0rpx 30rpx;
  622. border-radius: 60rpx;
  623. width: 100%;
  624. border: 1rpx solid #d3ad58;
  625. font-size: 32supx; font-family: PingFang SC; color: #fff;
  626. font-weight: bold;
  627. background-color: #d3ad58;
  628. display: flex;
  629. align-items: center;
  630. justify-content: center;
  631. }
  632. }
  633. .tips{
  634. flex-direction: column;
  635. display: flex;
  636. align-items: center;
  637. justify-content: center;
  638. width: 100%;
  639. padding: 30rpx;
  640. .tip-title{
  641. font-size: 26supx;
  642. font-family: PingFang SC;
  643. color: #888;
  644. font-weight: bold;
  645. }
  646. .desc{
  647. margin-top: 15rpx;
  648. font-size: 24rpx;
  649. font-family: PingFang SC;
  650. color: #b8bdb5;
  651. }
  652. }
  653. }
  654. </style>