packageForm.vue 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682
  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" :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. this.addMsg(1,this.item.title);
  153. this.getAgreement()
  154. },
  155. onShow() {
  156. this.$nextTick(()=>{
  157. this.$refs.choosePatient.getPatientList()
  158. })
  159. },
  160. methods:{
  161. getpaddingTop() {
  162. uni
  163. .createSelectorQuery().in(this)
  164. .select(".patient")
  165. .boundingClientRect((res) => {
  166. this.paddingTop = res&&res.height;
  167. })
  168. .exec();
  169. },
  170. getAgreement() {
  171. getAgreement().then(res=>{
  172. if(res.code==200) {
  173. this.agreement = res.doctor || {}
  174. uni.setNavigationBarTitle({
  175. title: this.agreement.doctorName || '问答'
  176. });
  177. }
  178. })
  179. },
  180. close(){
  181. this.show=false;
  182. },
  183. confirm(){
  184. if(this.isComplete==1){
  185. this.submit()
  186. }
  187. else{
  188. uni.navigateBack()
  189. }
  190. },
  191. addMsg(type,content){
  192. var msg={type:type,content:content}
  193. this.msgs.push(msg)
  194. var that=this;
  195. setTimeout(()=>{
  196. uni
  197. .createSelectorQuery()
  198. .select(".msgs")
  199. .boundingClientRect((res) => {
  200. if(res) {
  201. const scrollH = res.height;
  202. that.scrollTop = scrollH;
  203. }
  204. })
  205. .exec();
  206. },100)
  207. },
  208. optionClick(item,option){
  209. if(this.patient==null){
  210. uni.showToast({
  211. icon:'none',
  212. title: "请选择就诊人",
  213. });
  214. return;
  215. }
  216. if(option.value==0){
  217. this.content=this.notice[1].title;
  218. this.show=true;
  219. this.isComplete=0;
  220. return;
  221. }
  222. item.option=option.name;
  223. console.log(item.option);
  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. .patient {
  334. position: absolute;
  335. width: 100%;
  336. z-index: 999;
  337. top: 0;
  338. left: 0;
  339. }
  340. .content{
  341. flex: 1;
  342. width: 100%;
  343. height: 100vh;
  344. display: flex;
  345. flex-direction: column;
  346. overflow: hidden;
  347. position: relative;
  348. .msg-cont{
  349. width: 100%;
  350. flex: 1;
  351. overflow: hidden;
  352. .msg-scroll{
  353. height: 100%;
  354. .msgs{
  355. width: 100%;
  356. padding: 6rpx 0;
  357. .msg-item{
  358. padding: 10rpx 15rpx;
  359. display: flex;
  360. flex-direction: column;
  361. justify-content: center;
  362. align-items: flex-start;
  363. width: 100%;
  364. .left{
  365. width: 100%;
  366. display: flex;
  367. justify-content: flex-start;
  368. align-items: flex-start;
  369. .img{
  370. min-width: 100rpx;
  371. width: 100rpx;
  372. height:100rpx;
  373. border-radius: 50%;
  374. image{
  375. width: 100%;
  376. height:100%;
  377. }
  378. }
  379. .msg-content{
  380. margin-top: 15rpx;
  381. margin-left: 10rpx;
  382. border-radius: 15rpx;
  383. padding: 15rpx;
  384. background-color: #fff;
  385. color: #111;
  386. font-size: 32upx;
  387. font-family: PingFang SC;
  388. }
  389. }
  390. .right{
  391. width: 100%;
  392. display: flex;
  393. justify-content: flex-end;
  394. align-items: flex-start;
  395. .msg-content{
  396. margin-top: 15rpx;
  397. margin-right: 10rpx;
  398. border-radius: 15rpx;
  399. padding: 15rpx;
  400. background-color: #d3ad58;
  401. color: #fff;
  402. font-size: 32upx;
  403. font-family: PingFang SC;
  404. }
  405. .img{
  406. min-width: 100rpx;
  407. width: 100rpx;
  408. height:100rpx;
  409. border-radius: 50%;
  410. image{
  411. width: 100%;
  412. height:100%;
  413. }
  414. }
  415. }
  416. }
  417. }
  418. }
  419. }
  420. .option-cont{
  421. flex-shrink: 0;
  422. // position: fixed;
  423. // bottom: 0rpx;
  424. // #ifndef APP-PLUS
  425. max-height: 90vh;
  426. overflow-y: auto;
  427. // #endif
  428. // #ifdef APP-PLUS
  429. // height: 380rpx;
  430. // #endif
  431. width: 100%;
  432. background-color: #fff;
  433. border-radius: 60rpx 60rpx 0rpx 0rpx;
  434. padding: 30rpx;
  435. .option-title{
  436. width: 100%;
  437. padding-bottom: 15rpx;
  438. display: flex;
  439. align-items: center;
  440. justify-content: center;
  441. font-size: 32upx;
  442. font-family: PingFang SC;
  443. color: #111;
  444. }
  445. .options{
  446. margin-top: 20rpx;
  447. display: flex;
  448. flex-direction: column;
  449. justify-content: center;
  450. align-items: center;
  451. .option-item{
  452. display: flex;
  453. align-items: center;
  454. justify-content: center;
  455. width: 100%;
  456. border: 1rpx solid #eee;
  457. margin-bottom: 20rpx;
  458. padding: 15rpx;
  459. border-radius: 5rpx;
  460. color: #ffffff;
  461. font-size: 32upx;
  462. }
  463. .green{
  464. background-color: #588e31;
  465. }
  466. .red{
  467. background-color: #c00000;
  468. }
  469. }
  470. }
  471. .title{
  472. padding: 15rpx 30rpx;
  473. display: flex;
  474. justify-content: center;
  475. align-items: center;
  476. width: 100%;
  477. background-color: #d3ad58;
  478. font-size: 24upx;
  479. font-family: PingFang SC;
  480. font-weight: bold;
  481. color: #fff;
  482. }
  483. .patient-cont{
  484. padding: 15rpx;
  485. .chose-patient{
  486. padding: 30rpx;
  487. box-shadow: 0px 0px 5px 2px rgba(0,0,0,0.05);
  488. background-color: #fff;
  489. border-radius: 15rpx;
  490. .patient-box{
  491. display: flex;
  492. align-items: center;
  493. justify-content: space-between;
  494. .patient-item{
  495. display: flex;
  496. align-items: center;
  497. justify-content: flex-start;
  498. .patient-tip{
  499. margin-top:6rpx;
  500. display: flex;
  501. align-items: center;
  502. justify-content: center;
  503. font-size: 32upx;
  504. font-family: PingFang SC;
  505. color: #ff0000;
  506. }
  507. .patient-title{
  508. margin-left: 10rpx;
  509. font-size: 32upx;
  510. font-family: PingFang SC;
  511. font-weight: bold;
  512. color: #111111;
  513. }
  514. }
  515. .right{
  516. display: flex;
  517. align-items: center;
  518. image{
  519. width: 15upx;
  520. height: 30upx;
  521. }
  522. }
  523. }
  524. .patient{
  525. display: flex;
  526. align-items: center;
  527. justify-content: space-between;
  528. height: 110upx;
  529. .left{
  530. .name{
  531. font-size: 30upx;
  532. line-height: 1;
  533. font-family: PingFang SC;
  534. font-weight: bold;
  535. color: #111111;
  536. }
  537. .info{
  538. margin-top: 30rpx;
  539. display: flex;
  540. align-items: center;
  541. .text{
  542. font-size: 26upx;
  543. font-family: PingFang SC;
  544. line-height: 1;
  545. font-weight: 500;
  546. color: #999;
  547. margin-right: 19upx;
  548. }
  549. }
  550. }
  551. .right{
  552. display: flex;
  553. align-items: center;
  554. image{
  555. width: 15upx;
  556. height: 30upx;
  557. }
  558. }
  559. }
  560. }
  561. }
  562. .items{
  563. padding: 15rpx;
  564. width: 100%;
  565. padding: 30rpx;
  566. border-radius: 15rpx;
  567. background-color: #fff;
  568. display: flex;
  569. flex-direction: column;
  570. align-items: flex-start;
  571. justify-content: flex-start;
  572. .item{
  573. display: flex;
  574. flex-direction: column;
  575. align-items: flex-start;
  576. justify-content: flex-start;
  577. width: 100%;
  578. background-color: #f8f8f8;
  579. margin-bottom: 15rpx;
  580. .name{
  581. font-size: 32upx;
  582. font-family: PingFang SC;
  583. color: #2a2b2e;
  584. font-weight: bold;
  585. margin-bottom: 15rpx;
  586. }
  587. .options{
  588. margin: 15rpx 0rpx;
  589. width: 100%;
  590. display: flex;
  591. align-items: center;
  592. justify-content: space-between;
  593. margin-bottom: 10rpx;
  594. .option{
  595. margin-bottom: 20rpx;
  596. display: flex;
  597. align-items: center;
  598. justify-content: center;
  599. border-radius: 10rpx;
  600. width:20%;
  601. height:100rpx;
  602. border: 1rpx solid #9b9b9b;
  603. font-size: 28upx;
  604. font-family: PingFang SC;
  605. color: #2a2b2e;
  606. background-color: #fff;
  607. &:last-child{
  608. margin-right: 0rpx;
  609. margin-bottom: 0rpx;
  610. }
  611. }
  612. .active{
  613. border: 1rpx solid #d3ad58;
  614. background-color: #d3ad58;
  615. color: #fff;
  616. }
  617. }
  618. }
  619. }
  620. .btns{
  621. display: flex;
  622. align-items: center;
  623. justify-content: space-between;
  624. width: 100%;
  625. padding: 30rpx;
  626. .btn{
  627. height:80rpx;
  628. margin: 0rpx 30rpx;
  629. border-radius: 60rpx;
  630. width: 100%;
  631. border: 1rpx solid #d3ad58;
  632. font-size: 32supx; font-family: PingFang SC; color: #fff;
  633. font-weight: bold;
  634. background-color: #d3ad58;
  635. display: flex;
  636. align-items: center;
  637. justify-content: center;
  638. }
  639. }
  640. .tips{
  641. flex-direction: column;
  642. display: flex;
  643. align-items: center;
  644. justify-content: center;
  645. width: 100%;
  646. padding: 30rpx;
  647. .tip-title{
  648. font-size: 26supx;
  649. font-family: PingFang SC;
  650. color: #888;
  651. font-weight: bold;
  652. }
  653. .desc{
  654. margin-top: 15rpx;
  655. font-size: 24rpx;
  656. font-family: PingFang SC;
  657. color: #b8bdb5;
  658. }
  659. }
  660. }
  661. </style>