packageForm.vue 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564
  1. <template>
  2. <view class="content">
  3. <view class="patient-cont">
  4. <view class="chose-patient">
  5. <view class="patient-box" @click="addPatient()" v-if="patient==null">
  6. <view class="patient-item">
  7. <view class="patient-tip">*</view>
  8. <view class="patient-title">选择就诊人</view>
  9. </view>
  10. <view class="right" >
  11. <image src="/static/images/arrow_gray.png" mode=""></image>
  12. </view>
  13. </view>
  14. <view class="patient" @click="addPatient()" v-if="patient!=null">
  15. <view class="left">
  16. <view class="name">{{patient.patientName}}</view>
  17. <view class="info">
  18. <text class="text" v-if="patient.sex==1">男</text>
  19. <text class="text" v-if="patient.sex==2">女</text>
  20. <text class="text">{{$getAge(patient.birthday)}}岁</text>
  21. <text class="text">{{$parseIdCard(patient.idCard)}}</text>
  22. </view>
  23. </view>
  24. <view class="right" >
  25. <image src="/static/images/arrow_gray.png" mode=""></image>
  26. </view>
  27. </view>
  28. </view>
  29. </view>
  30. <view class="msg-cont">
  31. <scroll-view
  32. class="msg-scroll"
  33. :scroll-top="scrollTop"
  34. scroll-y="true"
  35. :scroll-with-animation="true"
  36. >
  37. <view class="msgs">
  38. <view class="msg-item" v-for="(item,index) in msgs" >
  39. <view class="left" v-if="item.type==1">
  40. <image class="img" src="https://fs-1319721001.cos.ap-chongqing.myqcloud.com/fs/20240229/be32b8d2ae9f497297d10327656bb43c.png"></image>
  41. <view class="msg-content">{{item.content}}</view>
  42. </view>
  43. <view class="right" v-if="item.type==2">
  44. <view class="msg-content">{{item.content}}</view>
  45. <image class="img" src="https://fs-1319721001.cos.ap-chongqing.myqcloud.com/fs/20240229/1d7eb0607a074892964dd32e8735e540.jpg"></image>
  46. </view>
  47. </view>
  48. </view>
  49. </scroll-view>
  50. </view>
  51. <view class="option-cont" v-if="item!=null">
  52. <view class="option-title" >{{item.title}}</view>
  53. <view class="options" >
  54. <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>
  55. </view>
  56. </view>
  57. <u-modal @cancel="close()" @confirm="confirm()" :show="show" title="温馨提示" :content='content'></u-modal>
  58. </view>
  59. </template>
  60. <script>
  61. import {create} from '@/api/packageOrder.js'
  62. export default {
  63. data() {
  64. return {
  65. content:null,
  66. show:false,
  67. scrollTop:0,//滚动条位置
  68. patient:null,
  69. items:[
  70. {
  71. title:"您是否已在线下就诊,且对所购买的药品无过敏或不良反应?",
  72. options:[
  73. {name:"是,我线下就诊过",value:1,color:'green'},
  74. {name:"无,从未就诊",value:0,color:'red'},
  75. ]
  76. },
  77. {
  78. title:"您是否已详细阅读药物说明,确认自己符合药物适用人群,并了解用药方法、用药禁忌等信息?",
  79. options:[
  80. {name:"是,我已充分了解",value:1,color:'green'},
  81. {name:"否,未阅读",value:0,color:'red'},
  82. ]
  83. }
  84. ],
  85. msgs:[],
  86. index:0,
  87. item:null,
  88. notice:[
  89. {title:"好的。我将根据您提交的复诊信息开具处方,请详细阅读药品说明书,遵医嘱用药。"},
  90. {title:"您存在用药禁忌证,目前不推荐购买此套餐包。建议您尽早就医,在医生指导下采取针对性的治疗措施!在改善相关禁忌证后,也可以再次咨询,重新评估是否可以使用该套餐包。"}
  91. ],
  92. packageId:null,
  93. doctorId:null,
  94. isComplete:0,
  95. companyUserId:null,
  96. companyId:null
  97. };
  98. },
  99. onLoad(option) {
  100. this.packageId=option.packageId
  101. this.doctorId=option.doctorId
  102. if(!this.$isEmpty(option.companyId)){
  103. this.companyId=option.companyId
  104. }
  105. if(!this.$isEmpty(option.companyUserId)){
  106. this.companyUserId=option.companyUserId
  107. }
  108. var that=this;
  109. uni.$on('refreshOrderPatient', (res) => {
  110. that.patient=res
  111. })
  112. this.item=this.items[0];
  113. this.addMsg(1,this.item.title);
  114. },
  115. onShow() {
  116. },
  117. methods:{
  118. close(){
  119. this.show=false;
  120. },
  121. confirm(){
  122. if(this.isComplete==1){
  123. this.submit()
  124. }
  125. else{
  126. uni.navigateBack()
  127. }
  128. },
  129. addMsg(type,content){
  130. var msg={type:type,content:content}
  131. this.msgs.push(msg)
  132. var that=this;
  133. uni
  134. .createSelectorQuery()
  135. .select(".msgs")
  136. .boundingClientRect((res) => {
  137. const scrollH = res.height;
  138. that.scrollTop = scrollH;
  139. console.log(that.scrollTop)
  140. })
  141. .exec();
  142. },
  143. optionClick(item,option){
  144. if(this.patient==null){
  145. uni.showToast({
  146. icon:'none',
  147. title: "请选择就诊人",
  148. });
  149. return;
  150. }
  151. if(option.value==0){
  152. this.content=this.notice[1].title;
  153. this.show=true;
  154. this.isComplete=0;
  155. return;
  156. }
  157. item.option=option.name;
  158. console.log(item.option);
  159. this.addMsg(2,option.name);
  160. this.index++;
  161. if(this.index<=this.items.length-1){
  162. this.item=this.items[this.index];
  163. this.addMsg(1,this.item.title)
  164. }
  165. else{
  166. this.content=this.notice[0].title;
  167. this.show=true;
  168. this.isComplete=1;
  169. return;
  170. }
  171. },
  172. addPatient(){
  173. uni.navigateTo({
  174. url: '/pages_user/patient'
  175. })
  176. },
  177. submit(){
  178. uni.showLoading({
  179. title:"处理中..."
  180. })
  181. var data={
  182. companyId:this.companyId,
  183. companyUserId:this.companyUserId,
  184. patientId:this.patient.patientId,
  185. patientJson:JSON.stringify(this.patient),
  186. packageId:this.packageId,
  187. doctorId:this.doctorId,
  188. formJson:JSON.stringify(this.items),
  189. }
  190. var that=this;
  191. create(data).then(res => {
  192. uni.hideLoading()
  193. if(res.code==200){
  194. var temps=['jARl4BpoBkRu-2MxPMkQVhIfGMG0V9qW-X3V_7NtEOU']
  195. uni.requestSubscribeMessage({
  196. tmplIds: temps,
  197. success(e) {
  198. setTimeout(function(){
  199. uni.navigateTo({
  200. url: '/pages_order/packageOrderPay?orderId='+res.order.orderId
  201. })
  202. },200);
  203. },
  204. fail(e) {
  205. setTimeout(function(){
  206. uni.navigateTo({
  207. url: '/pages_order/packageOrderPay?orderId='+res.order.orderId
  208. })
  209. },200);
  210. }
  211. })
  212. }else{
  213. uni.showToast({
  214. icon:'none',
  215. title: res.msg,
  216. });
  217. }
  218. });
  219. }
  220. }
  221. }
  222. </script>
  223. <style lang="scss">
  224. page{
  225. height: 100%;
  226. }
  227. .content{
  228. height: 100vh;
  229. .msg-cont{
  230. padding-bottom: 550rpx;
  231. width: 100%;
  232. height: calc(100vh - 760rpx);
  233. .msg-scroll{
  234. height: calc(100vh - 760rpx);
  235. .msgs{
  236. overflow: hidden;
  237. width: 100%;
  238. .msg-item{
  239. padding: 10rpx 15rpx;
  240. display: flex;
  241. flex-direction: column;
  242. justify-content: center;
  243. align-items: flex-start;
  244. width: 100%;
  245. .left{
  246. width: 100%;
  247. display: flex;
  248. justify-content: flex-start;
  249. align-items: flex-start;
  250. .img{
  251. min-width: 100rpx;
  252. width: 100rpx;
  253. height:100rpx;
  254. border-radius: 50%;
  255. image{
  256. width: 100%;
  257. height:100%;
  258. }
  259. }
  260. .msg-content{
  261. margin-top: 15rpx;
  262. margin-left: 10rpx;
  263. border-radius: 15rpx;
  264. padding: 15rpx;
  265. background-color: #fff;
  266. color: #111;
  267. font-size: 32upx;
  268. font-family: PingFang SC;
  269. }
  270. }
  271. .right{
  272. width: 100%;
  273. display: flex;
  274. justify-content: flex-end;
  275. align-items: flex-start;
  276. .msg-content{
  277. margin-top: 15rpx;
  278. margin-right: 10rpx;
  279. border-radius: 15rpx;
  280. padding: 15rpx;
  281. background-color: #d3ad58;
  282. color: #fff;
  283. font-size: 32upx;
  284. font-family: PingFang SC;
  285. }
  286. .img{
  287. min-width: 100rpx;
  288. width: 100rpx;
  289. height:100rpx;
  290. border-radius: 50%;
  291. image{
  292. width: 100%;
  293. height:100%;
  294. }
  295. }
  296. }
  297. }
  298. }
  299. }
  300. }
  301. .option-cont{
  302. position: fixed;
  303. bottom: 0rpx;
  304. height: 380rpx;
  305. width: 100%;
  306. background-color: #fff;
  307. border-radius: 60rpx 60rpx 0rpx 0rpx;
  308. padding: 30rpx;
  309. .option-title{
  310. width: 100%;
  311. padding-bottom: 15rpx;
  312. display: flex;
  313. align-items: center;
  314. justify-content: center;
  315. font-size: 32upx;
  316. font-family: PingFang SC;
  317. color: #111;
  318. }
  319. .options{
  320. margin-top: 20rpx;
  321. display: flex;
  322. flex-direction: column;
  323. justify-content: center;
  324. align-items: center;
  325. .option-item{
  326. display: flex;
  327. align-items: center;
  328. justify-content: center;
  329. width: 100%;
  330. border: 1rpx solid #eee;
  331. margin-bottom: 30rpx;
  332. padding: 15rpx;
  333. border-radius: 5rpx;
  334. color: #ffffff;
  335. font-size: 32upx;
  336. }
  337. .green{
  338. background-color: #588e31;
  339. }
  340. .red{
  341. background-color: #c00000;
  342. }
  343. }
  344. }
  345. .title{
  346. padding: 15rpx 30rpx;
  347. display: flex;
  348. justify-content: center;
  349. align-items: center;
  350. width: 100%;
  351. background-color: #d3ad58;
  352. font-size: 24upx;
  353. font-family: PingFang SC;
  354. font-weight: bold;
  355. color: #fff;
  356. }
  357. .patient-cont{
  358. padding: 15rpx;
  359. .chose-patient{
  360. padding: 30rpx;
  361. box-shadow: 0px 0px 5px 2px rgba(0,0,0,0.05);
  362. background-color: #fff;
  363. border-radius: 15rpx;
  364. .patient-box{
  365. display: flex;
  366. align-items: center;
  367. justify-content: space-between;
  368. .patient-item{
  369. display: flex;
  370. align-items: center;
  371. justify-content: flex-start;
  372. .patient-tip{
  373. margin-top:6rpx;
  374. display: flex;
  375. align-items: center;
  376. justify-content: center;
  377. font-size: 32upx;
  378. font-family: PingFang SC;
  379. color: #ff0000;
  380. }
  381. .patient-title{
  382. margin-left: 10rpx;
  383. font-size: 32upx;
  384. font-family: PingFang SC;
  385. font-weight: bold;
  386. color: #111111;
  387. }
  388. }
  389. .right{
  390. display: flex;
  391. align-items: center;
  392. image{
  393. width: 15upx;
  394. height: 30upx;
  395. }
  396. }
  397. }
  398. .patient{
  399. display: flex;
  400. align-items: center;
  401. justify-content: space-between;
  402. height: 110upx;
  403. .left{
  404. .name{
  405. font-size: 30upx;
  406. line-height: 1;
  407. font-family: PingFang SC;
  408. font-weight: bold;
  409. color: #111111;
  410. }
  411. .info{
  412. margin-top: 30rpx;
  413. display: flex;
  414. align-items: center;
  415. .text{
  416. font-size: 26upx;
  417. font-family: PingFang SC;
  418. line-height: 1;
  419. font-weight: 500;
  420. color: #999;
  421. margin-right: 19upx;
  422. }
  423. }
  424. }
  425. .right{
  426. display: flex;
  427. align-items: center;
  428. image{
  429. width: 15upx;
  430. height: 30upx;
  431. }
  432. }
  433. }
  434. }
  435. }
  436. .items{
  437. padding: 15rpx;
  438. width: 100%;
  439. padding: 30rpx;
  440. border-radius: 15rpx;
  441. background-color: #fff;
  442. display: flex;
  443. flex-direction: column;
  444. align-items: flex-start;
  445. justify-content: flex-start;
  446. .item{
  447. display: flex;
  448. flex-direction: column;
  449. align-items: flex-start;
  450. justify-content: flex-start;
  451. width: 100%;
  452. background-color: #f8f8f8;
  453. margin-bottom: 15rpx;
  454. .name{
  455. font-size: 32upx;
  456. font-family: PingFang SC;
  457. color: #2a2b2e;
  458. font-weight: bold;
  459. margin-bottom: 15rpx;
  460. }
  461. .options{
  462. margin: 15rpx 0rpx;
  463. width: 100%;
  464. display: flex;
  465. align-items: center;
  466. justify-content: space-between;
  467. margin-bottom: 10rpx;
  468. .option{
  469. margin-bottom: 20rpx;
  470. display: flex;
  471. align-items: center;
  472. justify-content: center;
  473. border-radius: 10rpx;
  474. width:20%;
  475. height:100rpx;
  476. border: 1rpx solid #9b9b9b;
  477. font-size: 28upx;
  478. font-family: PingFang SC;
  479. color: #2a2b2e;
  480. background-color: #fff;
  481. &:last-child{
  482. margin-right: 0rpx;
  483. margin-bottom: 0rpx;
  484. }
  485. }
  486. .active{
  487. border: 1rpx solid #d3ad58;
  488. background-color: #d3ad58;
  489. color: #fff;
  490. }
  491. }
  492. }
  493. }
  494. .btns{
  495. display: flex;
  496. align-items: center;
  497. justify-content: space-between;
  498. width: 100%;
  499. padding: 30rpx;
  500. .btn{
  501. height:80rpx;
  502. margin: 0rpx 30rpx;
  503. border-radius: 60rpx;
  504. width: 100%;
  505. border: 1rpx solid #d3ad58;
  506. font-size: 32supx; font-family: PingFang SC; color: #fff;
  507. font-weight: bold;
  508. background-color: #d3ad58;
  509. display: flex;
  510. align-items: center;
  511. justify-content: center;
  512. }
  513. }
  514. .tips{
  515. flex-direction: column;
  516. display: flex;
  517. align-items: center;
  518. justify-content: center;
  519. width: 100%;
  520. padding: 30rpx;
  521. .tip-title{
  522. font-size: 26supx;
  523. font-family: PingFang SC;
  524. color: #888;
  525. font-weight: bold;
  526. }
  527. .desc{
  528. margin-top: 15rpx;
  529. font-size: 24rpx;
  530. font-family: PingFang SC;
  531. color: #b8bdb5;
  532. }
  533. }
  534. }
  535. </style>