packageForm.vue 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681
  1. <template>
  2. <view>
  3. <view class="content">
  4. <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" :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" :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. setTimeout(()=>{
  153. this.addMsg(1,this.item.title);
  154. },100)
  155. this.getAgreement()
  156. },
  157. onShow() {
  158. },
  159. methods:{
  160. getpaddingTop() {
  161. uni
  162. .createSelectorQuery().in(this)
  163. .select(".patient")
  164. .boundingClientRect((res) => {
  165. this.paddingTop = res&&res.height;
  166. })
  167. .exec();
  168. },
  169. getAgreement() {
  170. getAgreement().then(res=>{
  171. if(res.code==200) {
  172. this.agreement = res.doctor || {}
  173. uni.setNavigationBarTitle({
  174. title: this.agreement.doctorName || '问答'
  175. });
  176. }
  177. })
  178. },
  179. close(){
  180. this.show=false;
  181. },
  182. confirm(){
  183. if(this.isComplete==1){
  184. this.submit()
  185. }
  186. else{
  187. uni.navigateBack()
  188. }
  189. },
  190. addMsg(type,content){
  191. var msg={type:type,content:content}
  192. this.msgs.push(msg)
  193. var that=this;
  194. uni
  195. .createSelectorQuery()
  196. .select(".msgs")
  197. .boundingClientRect((res) => {
  198. const scrollH = res.height;
  199. that.scrollTop = scrollH;
  200. console.log(that.scrollTop)
  201. })
  202. .exec();
  203. },
  204. optionClick(item,option){
  205. if(this.patient==null){
  206. uni.showToast({
  207. icon:'none',
  208. title: "请选择就诊人",
  209. });
  210. return;
  211. }
  212. if(option.value==0){
  213. this.content=this.notice[1].title;
  214. this.show=true;
  215. this.isComplete=0;
  216. return;
  217. }
  218. item.option=option.name;
  219. console.log(item.option);
  220. this.addMsg(2,option.name);
  221. this.index++;
  222. if(this.index<=this.items.length-1){
  223. this.item=this.items[this.index];
  224. this.addMsg(1,this.item.title)
  225. }
  226. else{
  227. this.content=this.notice[0].title;
  228. this.show=true;
  229. this.isComplete=1;
  230. return;
  231. }
  232. },
  233. addPatient(){
  234. uni.navigateTo({
  235. url: '/pages_user/patient'
  236. })
  237. },
  238. submit(){
  239. uni.showLoading({
  240. title:"处理中..."
  241. })
  242. const num = Math.floor(Math.random() * 6);
  243. this.items = this.items.map(item=>({
  244. ...item,
  245. option: item.title == "您目前已确诊的慢性疾病有哪些?"&&item.option =='其他' ? item.options[num].name:item.option
  246. }))
  247. var data={
  248. companyId:this.companyId,
  249. companyUserId:this.companyUserId,
  250. patientId:this.patient.patientId,
  251. patientJson:JSON.stringify(this.patient),
  252. packageId:this.packageId,
  253. doctorId:this.doctorId,
  254. formJson:JSON.stringify(this.items),
  255. }
  256. if(this.choose == 1 || this.choose == 2) {
  257. this.giftCreateOrder(data)
  258. return
  259. }
  260. var that=this;
  261. create(data).then(res => {
  262. uni.hideLoading()
  263. if(res.code==200){
  264. var temps=['jARl4BpoBkRu-2MxPMkQVhIfGMG0V9qW-X3V_7NtEOU']
  265. uni.requestSubscribeMessage({
  266. tmplIds: temps,
  267. success(e) {
  268. setTimeout(function(){
  269. uni.navigateTo({
  270. url: '/pages_order/packageOrderPay?orderId='+res.order.orderId
  271. })
  272. },200);
  273. },
  274. fail(e) {
  275. setTimeout(function(){
  276. uni.navigateTo({
  277. url: '/pages_order/packageOrderPay?orderId='+res.order.orderId
  278. })
  279. },200);
  280. }
  281. })
  282. }else{
  283. uni.showToast({
  284. icon:'none',
  285. title: res.msg,
  286. });
  287. }
  288. });
  289. },
  290. giftCreateOrder(data) {
  291. var that=this;
  292. const param = {
  293. ...data,
  294. choose: this.choose, //1:付邮费领取 2:加粉领取
  295. }
  296. giftCreate(param).then(res => {
  297. uni.hideLoading()
  298. if(res.code==200){
  299. var temps=['jARl4BpoBkRu-2MxPMkQVhIfGMG0V9qW-X3V_7NtEOU']
  300. uni.requestSubscribeMessage({
  301. tmplIds: temps,
  302. success(e) {
  303. setTimeout(function(){
  304. uni.navigateTo({
  305. url: '/pages_order/packageOrderPay?orderId='+res.order.orderId
  306. })
  307. },200);
  308. },
  309. fail(e) {
  310. setTimeout(function(){
  311. uni.navigateTo({
  312. url: '/pages_order/packageOrderPay?orderId='+res.order.orderId
  313. })
  314. },200);
  315. }
  316. })
  317. }else{
  318. uni.showToast({
  319. icon:'none',
  320. title: res.msg,
  321. });
  322. }
  323. });
  324. }
  325. }
  326. }
  327. </script>
  328. <style lang="scss">
  329. .patient {
  330. position: absolute;
  331. width: 100%;
  332. z-index: 999;
  333. top: 0;
  334. left: 0;
  335. }
  336. .content{
  337. flex: 1;
  338. width: 100%;
  339. height: 100vh;
  340. display: flex;
  341. flex-direction: column;
  342. overflow: hidden;
  343. position: relative;
  344. .msg-cont{
  345. width: 100%;
  346. flex: 1;
  347. overflow: hidden;
  348. .msg-scroll{
  349. height: 100%;
  350. .msgs{
  351. width: 100%;
  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: 380rpx;
  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: 30rpx;
  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>