packageForm.vue 16 KB

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