packageForm.vue 17 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="/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 {getIcdNameByPackageId} from '@/api/package.js'
  66. import choosePatient from "./components/choosePatient/choosePatient.vue"
  67. import {create,giftCreate,getAgreement} from '@/api/packageOrder.js'
  68. export default {
  69. components: {
  70. choosePatient
  71. },
  72. data() {
  73. return {
  74. content:null,
  75. show:false,
  76. scrollTop:0,//滚动条位置
  77. patient:null,
  78. items:[
  79. {
  80. title:"您是否因慢病在线下就诊?且对该处方内的产品无过敏或不良反应?",
  81. options:[
  82. {name:"是,我线下就诊过",value:1,color:'green'},
  83. {name:"无,从未就诊",value:0,color:'red'},
  84. ]
  85. },
  86. {
  87. title:"您是否已详细阅读疗法说明,确认自己符合疗法产品的适用人群,并了解使用方法,使用禁忌等?",
  88. options:[
  89. {name:"是,我已充分了解",value:1,color:'green'},
  90. {name:"否,未阅读",value:0,color:'red'},
  91. ]
  92. },
  93. {
  94. title:"请选择线下已确诊疾病",
  95. options:[]
  96. }
  97. ],
  98. msgs:[],
  99. index:0,
  100. item:null,
  101. notice:[
  102. {title:"好的。我将根据您提交的复诊信息开具处方,请详细阅读药品说明书,遵医嘱用药。"},
  103. {title:"您存在用药禁忌证,目前不推荐购买此套餐包。建议您尽早就医,在医生指导下采取针对性的治疗措施!在改善相关禁忌证后,也可以再次咨询,重新评估是否可以使用该套餐包。"}
  104. ],
  105. packageId:null,
  106. doctorId:null,
  107. isComplete:0,
  108. companyUserId:null,
  109. companyId:null,
  110. choose: 0, // 1:付邮费领取 2:加粉领取
  111. docAvatar:'',
  112. avatar: '',
  113. paddingTop: 130,
  114. agreement: {}
  115. };
  116. },
  117. onLoad(option) {
  118. this.packageId=option.packageId
  119. this.doctorId=option.doctorId
  120. this.choose = option.choose || 0
  121. if(!this.$isEmpty(option.companyId)){
  122. this.companyId=option.companyId
  123. }
  124. if(!this.$isEmpty(option.companyUserId)){
  125. this.companyUserId=option.companyUserId
  126. }
  127. var that=this;
  128. uni.$on('refreshOrderPatient', (res) => {
  129. that.patient=res
  130. setTimeout(()=>{
  131. this.getpaddingTop()
  132. },100)
  133. })
  134. this.item=this.items[0];
  135. this.addMsg(1,this.item.title);
  136. this.getAgreement()
  137. this.getIcdName()
  138. this.avatar = uni.getStorageSync('userInfo')&&JSON.parse(uni.getStorageSync('userInfo')).avatar
  139. },
  140. onShow() {
  141. this.$nextTick(()=>{
  142. this.$refs.choosePatient.getPatientList()
  143. })
  144. },
  145. methods:{
  146. getIcdName() {
  147. this.items[2].options = []
  148. getIcdNameByPackageId({packageId:this.packageId}).then(res=>{
  149. if(res.code == 200&&res.icdNames.length>0) {
  150. this.items[2].options= res.icdNames.map((item,i)=>({
  151. name:item,
  152. value:i+1,
  153. color:'green'
  154. }))
  155. const obj = {
  156. name: '其他',
  157. value: this.items[2].options.length+1,
  158. color: 'green'
  159. }
  160. this.items[2].options.push(obj)
  161. } else {
  162. this.items[2].options = [{
  163. name: '其他',
  164. value: 1,
  165. color: 'green'
  166. }]
  167. }
  168. })
  169. },
  170. getpaddingTop() {
  171. uni
  172. .createSelectorQuery().in(this)
  173. .select(".patient")
  174. .boundingClientRect((res) => {
  175. this.paddingTop = res&&res.height;
  176. })
  177. .exec();
  178. },
  179. getAgreement() {
  180. getAgreement().then(res=>{
  181. if(res.code==200) {
  182. this.agreement = res.doctor || {}
  183. uni.setNavigationBarTitle({
  184. title: this.agreement.doctorName || '问答'
  185. });
  186. }
  187. })
  188. },
  189. close(){
  190. this.show=false;
  191. },
  192. confirm(){
  193. if(this.isComplete==1){
  194. this.submit()
  195. }
  196. else{
  197. uni.navigateBack()
  198. }
  199. },
  200. addMsg(type,content){
  201. var msg={type:type,content:content}
  202. this.msgs.push(msg)
  203. var that=this;
  204. setTimeout(()=>{
  205. uni
  206. .createSelectorQuery()
  207. .select(".msgs")
  208. .boundingClientRect((res) => {
  209. if(res) {
  210. const scrollH = res.height;
  211. that.scrollTop = scrollH;
  212. }
  213. })
  214. .exec();
  215. },100)
  216. },
  217. optionClick(item,option){
  218. if(this.patient==null){
  219. uni.showToast({
  220. icon:'none',
  221. title: "请选择就诊人",
  222. });
  223. return;
  224. }
  225. if(option.value==0){
  226. this.content=this.notice[1].title;
  227. this.show=true;
  228. this.isComplete=0;
  229. return;
  230. }
  231. item.option=option.name;
  232. this.addMsg(2,option.name);
  233. this.index++;
  234. if(this.index<=this.items.length-1){
  235. this.item=this.items[this.index];
  236. this.addMsg(1,this.item.title)
  237. }
  238. else{
  239. this.content=this.notice[0].title;
  240. this.show=true;
  241. this.isComplete=1;
  242. return;
  243. }
  244. },
  245. addPatient(){
  246. uni.navigateTo({
  247. url: '/pages_user/patient'
  248. })
  249. },
  250. submit(){
  251. uni.showLoading({
  252. title:"处理中..."
  253. })
  254. const num = Math.floor(Math.random() * (this.items[2].options.length-1));
  255. this.items = this.items.map(item=>({
  256. ...item,
  257. option: item.title == "请选择线下已确诊疾病"&&item.option =='其他' ? item.options[num].name:item.option
  258. }))
  259. var data={
  260. companyId:this.companyId,
  261. companyUserId:this.companyUserId,
  262. patientId:this.patient.patientId,
  263. patientJson:JSON.stringify(this.patient),
  264. packageId:this.packageId,
  265. doctorId:this.doctorId,
  266. formJson:JSON.stringify(this.items),
  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>