packageForm.vue 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677
  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. console.log(res)
  202. if(res) {
  203. const scrollH = res.height;
  204. that.scrollTop = scrollH;
  205. }
  206. })
  207. .exec();
  208. },100)
  209. },
  210. optionClick(item,option){
  211. if(this.patient==null){
  212. uni.showToast({
  213. icon:'none',
  214. title: "请选择就诊人",
  215. });
  216. return;
  217. }
  218. if(option.value==0){
  219. this.content=this.notice[1].title;
  220. this.show=true;
  221. this.isComplete=0;
  222. return;
  223. }
  224. item.option=option.name;
  225. console.log(item.option);
  226. this.addMsg(2,option.name);
  227. this.index++;
  228. if(this.index<=this.items.length-1){
  229. this.item=this.items[this.index];
  230. this.addMsg(1,this.item.title)
  231. }
  232. else{
  233. this.content=this.notice[0].title;
  234. this.show=true;
  235. this.isComplete=1;
  236. return;
  237. }
  238. },
  239. addPatient(){
  240. uni.navigateTo({
  241. url: '/pages_user/patient'
  242. })
  243. },
  244. submit(){
  245. uni.showLoading({
  246. title:"处理中..."
  247. })
  248. const num = Math.floor(Math.random() * 6);
  249. this.items = this.items.map(item=>({
  250. ...item,
  251. option: item.title == "您目前已确诊的慢性疾病有哪些?"&&item.option =='其他' ? item.options[num].name:item.option
  252. }))
  253. var data={
  254. companyId:this.companyId,
  255. companyUserId:this.companyUserId,
  256. patientId:this.patient.patientId,
  257. patientJson:JSON.stringify(this.patient),
  258. packageId:this.packageId,
  259. doctorId:this.doctorId,
  260. formJson:JSON.stringify(this.items),
  261. }
  262. if(this.choose == 1 || this.choose == 2) {
  263. this.giftCreateOrder(data)
  264. return
  265. }
  266. var that=this;
  267. create(data).then(res => {
  268. uni.hideLoading()
  269. if(res.code==200){
  270. var temps=['jARl4BpoBkRu-2MxPMkQVhIfGMG0V9qW-X3V_7NtEOU']
  271. uni.requestSubscribeMessage({
  272. tmplIds: temps,
  273. success(e) {
  274. setTimeout(function(){
  275. uni.navigateTo({
  276. url: '/pages_order/packageOrderPay?orderId='+res.order.orderId
  277. })
  278. },200);
  279. },
  280. fail(e) {
  281. setTimeout(function(){
  282. uni.navigateTo({
  283. url: '/pages_order/packageOrderPay?orderId='+res.order.orderId
  284. })
  285. },200);
  286. }
  287. })
  288. }else{
  289. uni.showToast({
  290. icon:'none',
  291. title: res.msg,
  292. });
  293. }
  294. });
  295. },
  296. giftCreateOrder(data) {
  297. var that=this;
  298. const param = {
  299. ...data,
  300. choose: this.choose, //1:付邮费领取 2:加粉领取
  301. }
  302. giftCreate(param).then(res => {
  303. uni.hideLoading()
  304. if(res.code==200){
  305. var temps=['jARl4BpoBkRu-2MxPMkQVhIfGMG0V9qW-X3V_7NtEOU']
  306. uni.requestSubscribeMessage({
  307. tmplIds: temps,
  308. success(e) {
  309. setTimeout(function(){
  310. uni.navigateTo({
  311. url: '/pages_order/packageOrderPay?orderId='+res.order.orderId
  312. })
  313. },200);
  314. },
  315. fail(e) {
  316. setTimeout(function(){
  317. uni.navigateTo({
  318. url: '/pages_order/packageOrderPay?orderId='+res.order.orderId
  319. })
  320. },200);
  321. }
  322. })
  323. }else{
  324. uni.showToast({
  325. icon:'none',
  326. title: res.msg,
  327. });
  328. }
  329. });
  330. }
  331. }
  332. }
  333. </script>
  334. <style lang="scss">
  335. .content{
  336. flex: 1;
  337. width: 100%;
  338. height: 100vh;
  339. display: flex;
  340. flex-direction: column;
  341. overflow: hidden;
  342. position: relative;
  343. .msg-cont{
  344. width: 100%;
  345. flex: 1;
  346. overflow: hidden;
  347. .msg-scroll{
  348. height: 100%;
  349. .msgs{
  350. width: 100%;
  351. padding: 6rpx 0;
  352. .msg-item{
  353. padding: 10rpx 15rpx;
  354. display: flex;
  355. flex-direction: column;
  356. justify-content: center;
  357. align-items: flex-start;
  358. width: 100%;
  359. .left{
  360. width: 100%;
  361. display: flex;
  362. justify-content: flex-start;
  363. align-items: flex-start;
  364. .img{
  365. min-width: 100rpx;
  366. width: 100rpx;
  367. height:100rpx;
  368. border-radius: 50%;
  369. image{
  370. width: 100%;
  371. height:100%;
  372. }
  373. }
  374. .msg-content{
  375. margin-top: 15rpx;
  376. margin-left: 10rpx;
  377. border-radius: 15rpx;
  378. padding: 15rpx;
  379. background-color: #fff;
  380. color: #111;
  381. font-size: 32upx;
  382. font-family: PingFang SC;
  383. }
  384. }
  385. .right{
  386. width: 100%;
  387. display: flex;
  388. justify-content: flex-end;
  389. align-items: flex-start;
  390. .msg-content{
  391. margin-top: 15rpx;
  392. margin-right: 10rpx;
  393. border-radius: 15rpx;
  394. padding: 15rpx;
  395. background-color: #d3ad58;
  396. color: #fff;
  397. font-size: 32upx;
  398. font-family: PingFang SC;
  399. }
  400. .img{
  401. min-width: 100rpx;
  402. width: 100rpx;
  403. height:100rpx;
  404. border-radius: 50%;
  405. image{
  406. width: 100%;
  407. height:100%;
  408. }
  409. }
  410. }
  411. }
  412. }
  413. }
  414. }
  415. .option-cont{
  416. flex-shrink: 0;
  417. // position: fixed;
  418. // bottom: 0rpx;
  419. // #ifndef APP-PLUS
  420. max-height: 90vh;
  421. overflow-y: auto;
  422. // #endif
  423. // #ifdef APP-PLUS
  424. // height: 380rpx;
  425. // #endif
  426. width: 100%;
  427. background-color: #fff;
  428. border-radius: 60rpx 60rpx 0rpx 0rpx;
  429. padding: 30rpx;
  430. .option-title{
  431. width: 100%;
  432. padding-bottom: 15rpx;
  433. display: flex;
  434. align-items: center;
  435. justify-content: center;
  436. font-size: 32upx;
  437. font-family: PingFang SC;
  438. color: #111;
  439. }
  440. .options{
  441. margin-top: 20rpx;
  442. display: flex;
  443. flex-direction: column;
  444. justify-content: center;
  445. align-items: center;
  446. .option-item{
  447. display: flex;
  448. align-items: center;
  449. justify-content: center;
  450. width: 100%;
  451. border: 1rpx solid #eee;
  452. margin-bottom: 20rpx;
  453. padding: 15rpx;
  454. border-radius: 5rpx;
  455. color: #ffffff;
  456. font-size: 32upx;
  457. }
  458. .green{
  459. background-color: #588e31;
  460. }
  461. .red{
  462. background-color: #c00000;
  463. }
  464. }
  465. }
  466. .title{
  467. padding: 15rpx 30rpx;
  468. display: flex;
  469. justify-content: center;
  470. align-items: center;
  471. width: 100%;
  472. background-color: #d3ad58;
  473. font-size: 24upx;
  474. font-family: PingFang SC;
  475. font-weight: bold;
  476. color: #fff;
  477. }
  478. .patient-cont{
  479. padding: 15rpx;
  480. .chose-patient{
  481. padding: 30rpx;
  482. box-shadow: 0px 0px 5px 2px rgba(0,0,0,0.05);
  483. background-color: #fff;
  484. border-radius: 15rpx;
  485. .patient-box{
  486. display: flex;
  487. align-items: center;
  488. justify-content: space-between;
  489. .patient-item{
  490. display: flex;
  491. align-items: center;
  492. justify-content: flex-start;
  493. .patient-tip{
  494. margin-top:6rpx;
  495. display: flex;
  496. align-items: center;
  497. justify-content: center;
  498. font-size: 32upx;
  499. font-family: PingFang SC;
  500. color: #ff0000;
  501. }
  502. .patient-title{
  503. margin-left: 10rpx;
  504. font-size: 32upx;
  505. font-family: PingFang SC;
  506. font-weight: bold;
  507. color: #111111;
  508. }
  509. }
  510. .right{
  511. display: flex;
  512. align-items: center;
  513. image{
  514. width: 15upx;
  515. height: 30upx;
  516. }
  517. }
  518. }
  519. .patient{
  520. display: flex;
  521. align-items: center;
  522. justify-content: space-between;
  523. height: 110upx;
  524. .left{
  525. .name{
  526. font-size: 30upx;
  527. line-height: 1;
  528. font-family: PingFang SC;
  529. font-weight: bold;
  530. color: #111111;
  531. }
  532. .info{
  533. margin-top: 30rpx;
  534. display: flex;
  535. align-items: center;
  536. .text{
  537. font-size: 26upx;
  538. font-family: PingFang SC;
  539. line-height: 1;
  540. font-weight: 500;
  541. color: #999;
  542. margin-right: 19upx;
  543. }
  544. }
  545. }
  546. .right{
  547. display: flex;
  548. align-items: center;
  549. image{
  550. width: 15upx;
  551. height: 30upx;
  552. }
  553. }
  554. }
  555. }
  556. }
  557. .items{
  558. padding: 15rpx;
  559. width: 100%;
  560. padding: 30rpx;
  561. border-radius: 15rpx;
  562. background-color: #fff;
  563. display: flex;
  564. flex-direction: column;
  565. align-items: flex-start;
  566. justify-content: flex-start;
  567. .item{
  568. display: flex;
  569. flex-direction: column;
  570. align-items: flex-start;
  571. justify-content: flex-start;
  572. width: 100%;
  573. background-color: #f8f8f8;
  574. margin-bottom: 15rpx;
  575. .name{
  576. font-size: 32upx;
  577. font-family: PingFang SC;
  578. color: #2a2b2e;
  579. font-weight: bold;
  580. margin-bottom: 15rpx;
  581. }
  582. .options{
  583. margin: 15rpx 0rpx;
  584. width: 100%;
  585. display: flex;
  586. align-items: center;
  587. justify-content: space-between;
  588. margin-bottom: 10rpx;
  589. .option{
  590. margin-bottom: 20rpx;
  591. display: flex;
  592. align-items: center;
  593. justify-content: center;
  594. border-radius: 10rpx;
  595. width:20%;
  596. height:100rpx;
  597. border: 1rpx solid #9b9b9b;
  598. font-size: 28upx;
  599. font-family: PingFang SC;
  600. color: #2a2b2e;
  601. background-color: #fff;
  602. &:last-child{
  603. margin-right: 0rpx;
  604. margin-bottom: 0rpx;
  605. }
  606. }
  607. .active{
  608. border: 1rpx solid #d3ad58;
  609. background-color: #d3ad58;
  610. color: #fff;
  611. }
  612. }
  613. }
  614. }
  615. .btns{
  616. display: flex;
  617. align-items: center;
  618. justify-content: space-between;
  619. width: 100%;
  620. padding: 30rpx;
  621. .btn{
  622. height:80rpx;
  623. margin: 0rpx 30rpx;
  624. border-radius: 60rpx;
  625. width: 100%;
  626. border: 1rpx solid #d3ad58;
  627. font-size: 32supx; font-family: PingFang SC; color: #fff;
  628. font-weight: bold;
  629. background-color: #d3ad58;
  630. display: flex;
  631. align-items: center;
  632. justify-content: center;
  633. }
  634. }
  635. .tips{
  636. flex-direction: column;
  637. display: flex;
  638. align-items: center;
  639. justify-content: center;
  640. width: 100%;
  641. padding: 30rpx;
  642. .tip-title{
  643. font-size: 26supx;
  644. font-family: PingFang SC;
  645. color: #888;
  646. font-weight: bold;
  647. }
  648. .desc{
  649. margin-top: 15rpx;
  650. font-size: 24rpx;
  651. font-family: PingFang SC;
  652. color: #b8bdb5;
  653. }
  654. }
  655. }
  656. </style>