packageForm.vue 17 KB

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