packageForm.vue 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683
  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="https://cqtyt-2025.oss-cn-beijing.aliyuncs.com/huyi/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="https://cqtyt-2025.oss-cn-beijing.aliyuncs.com/huyi/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" mode="aspectFill" :src="agreement.avatar?agreement.avatar:'https://cqtyt-2025.oss-cn-beijing.aliyuncs.com/huyi/imagesNew/1d7eb0607a074892964dd32e8735e540.jpg'"></image>
  43. <view class="msg-content">{{item.content}}</view>
  44. </view>
  45. <view class="right" v-if="item.type==2">
  46. <view class="msg-content">{{item.content}}</view>
  47. <image class="img" mode="aspectFill" :src="avatar?avatar:'https://cqtyt-2025.oss-cn-beijing.aliyuncs.com/huyi/imagesNew/1d7eb0607a074892964dd32e8735e540.jpg'"></image>
  48. </view>
  49. </view>
  50. </view>
  51. </scroll-view>
  52. </view>
  53. <view class="option-cont" v-if="item!=null">
  54. <view class="option-title" >{{item.title}}</view>
  55. <view class="options" >
  56. <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>
  57. </view>
  58. </view>
  59. </view>
  60. <u-modal @cancel="close()" @confirm="confirm()" :show="show" title="温馨提示" :content='content'></u-modal>
  61. </view>
  62. </template>
  63. <script>
  64. import {getIcdNameByPackageId} from '@/api/package.js'
  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. {
  93. title:"请选择线下已确诊疾病",
  94. options:[]
  95. }
  96. ],
  97. msgs:[],
  98. index:0,
  99. item:null,
  100. notice:[
  101. {title:"好的。我将根据您提交的复诊信息开具处方,请详细阅读药品说明书,遵医嘱用药。"},
  102. {title:"您存在用药禁忌证,目前不推荐购买此套餐包。建议您尽早就医,在医生指导下采取针对性的治疗措施!在改善相关禁忌证后,也可以再次咨询,重新评估是否可以使用该套餐包。"}
  103. ],
  104. packageId:null,
  105. doctorId:null,
  106. isComplete:0,
  107. companyUserId:null,
  108. companyId:null,
  109. choose: 0, // 1:付邮费领取 2:加粉领取
  110. docAvatar:'',
  111. avatar: '',
  112. paddingTop: 130,
  113. agreement: {}
  114. };
  115. },
  116. onLoad(option) {
  117. this.packageId=option.packageId
  118. this.doctorId=option.doctorId
  119. this.choose = option.choose || 0
  120. if(!this.$isEmpty(option.companyId)){
  121. this.companyId=option.companyId
  122. }
  123. if(!this.$isEmpty(option.companyUserId)){
  124. this.companyUserId=option.companyUserId
  125. }
  126. var that=this;
  127. uni.$on('refreshOrderPatient', (res) => {
  128. that.patient=res
  129. setTimeout(()=>{
  130. this.getpaddingTop()
  131. },100)
  132. })
  133. this.item=this.items[0];
  134. this.addMsg(1,this.item.title);
  135. this.getAgreement()
  136. this.getIcdName()
  137. this.avatar = uni.getStorageSync('userInfo')&&JSON.parse(uni.getStorageSync('userInfo')).avatar
  138. },
  139. onShow() {
  140. this.$nextTick(()=>{
  141. this.$refs.choosePatient.getPatientList()
  142. })
  143. },
  144. methods:{
  145. getIcdName() {
  146. this.items[2].options = []
  147. getIcdNameByPackageId({packageId:this.packageId}).then(res=>{
  148. if(res.code == 200&&res.icdNames.length>0) {
  149. this.items[2].options= res.icdNames.map((item,i)=>({
  150. name:item,
  151. value:i+1,
  152. color:'green'
  153. }))
  154. const obj = {
  155. name: '其他',
  156. value: this.items[2].options.length+1,
  157. color: 'green'
  158. }
  159. this.items[2].options.push(obj)
  160. } else {
  161. this.items[2].options = [{
  162. name: '其他',
  163. value: 1,
  164. color: 'green'
  165. }]
  166. }
  167. })
  168. },
  169. getpaddingTop() {
  170. uni
  171. .createSelectorQuery().in(this)
  172. .select(".patient")
  173. .boundingClientRect((res) => {
  174. this.paddingTop = res&&res.height;
  175. })
  176. .exec();
  177. },
  178. getAgreement() {
  179. getAgreement().then(res=>{
  180. if(res.code==200) {
  181. this.agreement = res.doctor || {}
  182. uni.setNavigationBarTitle({
  183. title: this.agreement.doctorName || '问答'
  184. });
  185. }
  186. })
  187. },
  188. close(){
  189. this.show=false;
  190. },
  191. confirm(){
  192. if(this.isComplete==1){
  193. this.submit()
  194. }
  195. else{
  196. uni.navigateBack()
  197. }
  198. },
  199. addMsg(type,content){
  200. var msg={type:type,content:content}
  201. this.msgs.push(msg)
  202. var that=this;
  203. setTimeout(()=>{
  204. uni
  205. .createSelectorQuery()
  206. .select(".msgs")
  207. .boundingClientRect((res) => {
  208. if(res) {
  209. const scrollH = res.height;
  210. that.scrollTop = scrollH;
  211. }
  212. })
  213. .exec();
  214. },100)
  215. },
  216. optionClick(item,option){
  217. if(this.patient==null){
  218. uni.showToast({
  219. icon:'none',
  220. title: "请选择就诊人",
  221. });
  222. return;
  223. }
  224. if(option.value==0){
  225. this.content=this.notice[1].title;
  226. this.show=true;
  227. this.isComplete=0;
  228. return;
  229. }
  230. item.option=option.name;
  231. this.addMsg(2,option.name);
  232. this.index++;
  233. if(this.index<=this.items.length-1){
  234. this.item=this.items[this.index];
  235. this.addMsg(1,this.item.title)
  236. }
  237. else{
  238. this.content=this.notice[0].title;
  239. this.show=true;
  240. this.isComplete=1;
  241. return;
  242. }
  243. },
  244. addPatient(){
  245. uni.navigateTo({
  246. url: '/pages_user/patient'
  247. })
  248. },
  249. submit(){
  250. uni.showLoading({
  251. title:"处理中..."
  252. })
  253. const num = Math.floor(Math.random() * (this.items[2].options.length-1));
  254. this.items = this.items.map(item=>({
  255. ...item,
  256. option: item.title == "请选择线下已确诊疾病"&&item.option =='其他' ? item.options[num].name:item.option
  257. }))
  258. var data={
  259. companyId:this.companyId,
  260. companyUserId:this.companyUserId,
  261. patientId:this.patient.patientId,
  262. patientJson:JSON.stringify(this.patient),
  263. packageId:this.packageId,
  264. doctorId:this.doctorId,
  265. formJson:JSON.stringify(this.items),
  266. source: getApp().globalData.source
  267. }
  268. if(this.choose == 1 || this.choose == 2) {
  269. this.giftCreateOrder(data)
  270. return
  271. }
  272. var that=this;
  273. create(data).then(res => {
  274. uni.hideLoading()
  275. if(res.code==200){
  276. var temps=['jARl4BpoBkRu-2MxPMkQVhIfGMG0V9qW-X3V_7NtEOU','wqKEklE_w5N19w9VAGY74TltPE6Ne3BaFObDD47uDEo']
  277. uni.requestSubscribeMessage({
  278. tmplIds: temps,
  279. success(e) {
  280. setTimeout(function(){
  281. uni.navigateTo({
  282. url: '/pages_order/packageOrderPay?orderId='+res.order.orderId+'&subMsg=1'
  283. })
  284. },200);
  285. },
  286. fail(e) {
  287. setTimeout(function(){
  288. uni.navigateTo({
  289. url: '/pages_order/packageOrderPay?orderId='+res.order.orderId+'&subMsg=1'
  290. })
  291. },200);
  292. }
  293. })
  294. }else{
  295. uni.showToast({
  296. icon:'none',
  297. title: res.msg,
  298. });
  299. }
  300. });
  301. },
  302. giftCreateOrder(data) {
  303. var that=this;
  304. const param = {
  305. ...data,
  306. choose: this.choose, //1:付邮费领取 2:加粉领取
  307. }
  308. giftCreate(param).then(res => {
  309. uni.hideLoading()
  310. if(res.code==200){
  311. var temps=['jARl4BpoBkRu-2MxPMkQVhIfGMG0V9qW-X3V_7NtEOU']
  312. uni.requestSubscribeMessage({
  313. tmplIds: temps,
  314. success(e) {
  315. setTimeout(function(){
  316. uni.navigateTo({
  317. url: '/pages_order/packageOrderPay?orderId='+res.order.orderId
  318. })
  319. },200);
  320. },
  321. fail(e) {
  322. setTimeout(function(){
  323. uni.navigateTo({
  324. url: '/pages_order/packageOrderPay?orderId='+res.order.orderId
  325. })
  326. },200);
  327. }
  328. })
  329. }else{
  330. uni.showToast({
  331. icon:'none',
  332. title: res.msg,
  333. });
  334. }
  335. });
  336. }
  337. }
  338. }
  339. </script>
  340. <style lang="scss">
  341. .content{
  342. flex: 1;
  343. width: 100%;
  344. height: 100vh;
  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: #d3ad58;
  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: 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: #d3ad58;
  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 #d3ad58;
  615. background-color: #d3ad58;
  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 #d3ad58;
  633. font-size: 32supx; font-family: PingFang SC; color: #fff;
  634. font-weight: bold;
  635. background-color: #d3ad58;
  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>