packageForm.vue 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606
  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,giftCreate} 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. choose: 0, // 1:付邮费领取 2:加粉领取
  98. };
  99. },
  100. onLoad(option) {
  101. this.packageId=option.packageId
  102. this.doctorId=option.doctorId
  103. this.choose = option.choose || 0
  104. if(!this.$isEmpty(option.companyId)){
  105. this.companyId=option.companyId
  106. }
  107. if(!this.$isEmpty(option.companyUserId)){
  108. this.companyUserId=option.companyUserId
  109. }
  110. var that=this;
  111. uni.$on('refreshOrderPatient', (res) => {
  112. that.patient=res
  113. })
  114. this.item=this.items[0];
  115. this.addMsg(1,this.item.title);
  116. },
  117. onShow() {
  118. },
  119. methods:{
  120. close(){
  121. this.show=false;
  122. },
  123. confirm(){
  124. if(this.isComplete==1){
  125. this.submit()
  126. }
  127. else{
  128. uni.navigateBack()
  129. }
  130. },
  131. addMsg(type,content){
  132. var msg={type:type,content:content}
  133. this.msgs.push(msg)
  134. var that=this;
  135. uni
  136. .createSelectorQuery()
  137. .select(".msgs")
  138. .boundingClientRect((res) => {
  139. const scrollH = res.height;
  140. that.scrollTop = scrollH;
  141. console.log(that.scrollTop)
  142. })
  143. .exec();
  144. },
  145. optionClick(item,option){
  146. if(this.patient==null){
  147. uni.showToast({
  148. icon:'none',
  149. title: "请选择就诊人",
  150. });
  151. return;
  152. }
  153. if(option.value==0){
  154. this.content=this.notice[1].title;
  155. this.show=true;
  156. this.isComplete=0;
  157. return;
  158. }
  159. item.option=option.name;
  160. console.log(item.option);
  161. this.addMsg(2,option.name);
  162. this.index++;
  163. if(this.index<=this.items.length-1){
  164. this.item=this.items[this.index];
  165. this.addMsg(1,this.item.title)
  166. }
  167. else{
  168. this.content=this.notice[0].title;
  169. this.show=true;
  170. this.isComplete=1;
  171. return;
  172. }
  173. },
  174. addPatient(){
  175. uni.navigateTo({
  176. url: '/pages_user/patient'
  177. })
  178. },
  179. submit(){
  180. uni.showLoading({
  181. title:"处理中..."
  182. })
  183. var data={
  184. companyId:this.companyId,
  185. companyUserId:this.companyUserId,
  186. patientId:this.patient.patientId,
  187. patientJson:JSON.stringify(this.patient),
  188. packageId:this.packageId,
  189. doctorId:this.doctorId,
  190. formJson:JSON.stringify(this.items),
  191. }
  192. if(this.choose == 1 || this.choose == 2) {
  193. this.giftCreateOrder(data)
  194. return
  195. }
  196. var that=this;
  197. create(data).then(res => {
  198. uni.hideLoading()
  199. if(res.code==200){
  200. var temps=['jARl4BpoBkRu-2MxPMkQVhIfGMG0V9qW-X3V_7NtEOU']
  201. uni.requestSubscribeMessage({
  202. tmplIds: temps,
  203. success(e) {
  204. setTimeout(function(){
  205. uni.navigateTo({
  206. url: '/pages_order/packageOrderPay?orderId='+res.order.orderId
  207. })
  208. },200);
  209. },
  210. fail(e) {
  211. setTimeout(function(){
  212. uni.navigateTo({
  213. url: '/pages_order/packageOrderPay?orderId='+res.order.orderId
  214. })
  215. },200);
  216. }
  217. })
  218. }else{
  219. uni.showToast({
  220. icon:'none',
  221. title: res.msg,
  222. });
  223. }
  224. });
  225. },
  226. giftCreateOrder(data) {
  227. var that=this;
  228. const param = {
  229. ...data,
  230. choose: this.choose, //1:付邮费领取 2:加粉领取
  231. }
  232. giftCreate(param).then(res => {
  233. uni.hideLoading()
  234. if(res.code==200){
  235. var temps=['jARl4BpoBkRu-2MxPMkQVhIfGMG0V9qW-X3V_7NtEOU']
  236. uni.requestSubscribeMessage({
  237. tmplIds: temps,
  238. success(e) {
  239. setTimeout(function(){
  240. uni.navigateTo({
  241. url: '/pages_order/packageOrderPay?orderId='+res.order.orderId
  242. })
  243. },200);
  244. },
  245. fail(e) {
  246. setTimeout(function(){
  247. uni.navigateTo({
  248. url: '/pages_order/packageOrderPay?orderId='+res.order.orderId
  249. })
  250. },200);
  251. }
  252. })
  253. }else{
  254. uni.showToast({
  255. icon:'none',
  256. title: res.msg,
  257. });
  258. }
  259. });
  260. }
  261. }
  262. }
  263. </script>
  264. <style lang="scss">
  265. page{
  266. height: 100%;
  267. }
  268. .content{
  269. height: 100vh;
  270. .msg-cont{
  271. padding-bottom: 550rpx;
  272. width: 100%;
  273. height: calc(100vh - 760rpx);
  274. .msg-scroll{
  275. height: calc(100vh - 760rpx);
  276. .msgs{
  277. overflow: hidden;
  278. width: 100%;
  279. .msg-item{
  280. padding: 10rpx 15rpx;
  281. display: flex;
  282. flex-direction: column;
  283. justify-content: center;
  284. align-items: flex-start;
  285. width: 100%;
  286. .left{
  287. width: 100%;
  288. display: flex;
  289. justify-content: flex-start;
  290. align-items: flex-start;
  291. .img{
  292. min-width: 100rpx;
  293. width: 100rpx;
  294. height:100rpx;
  295. border-radius: 50%;
  296. image{
  297. width: 100%;
  298. height:100%;
  299. }
  300. }
  301. .msg-content{
  302. margin-top: 15rpx;
  303. margin-left: 10rpx;
  304. border-radius: 15rpx;
  305. padding: 15rpx;
  306. background-color: #fff;
  307. color: #111;
  308. font-size: 32upx;
  309. font-family: PingFang SC;
  310. }
  311. }
  312. .right{
  313. width: 100%;
  314. display: flex;
  315. justify-content: flex-end;
  316. align-items: flex-start;
  317. .msg-content{
  318. margin-top: 15rpx;
  319. margin-right: 10rpx;
  320. border-radius: 15rpx;
  321. padding: 15rpx;
  322. background-color: #d3ad58;
  323. color: #fff;
  324. font-size: 32upx;
  325. font-family: PingFang SC;
  326. }
  327. .img{
  328. min-width: 100rpx;
  329. width: 100rpx;
  330. height:100rpx;
  331. border-radius: 50%;
  332. image{
  333. width: 100%;
  334. height:100%;
  335. }
  336. }
  337. }
  338. }
  339. }
  340. }
  341. }
  342. .option-cont{
  343. position: fixed;
  344. bottom: 0rpx;
  345. height: 380rpx;
  346. width: 100%;
  347. background-color: #fff;
  348. border-radius: 60rpx 60rpx 0rpx 0rpx;
  349. padding: 30rpx;
  350. .option-title{
  351. width: 100%;
  352. padding-bottom: 15rpx;
  353. display: flex;
  354. align-items: center;
  355. justify-content: center;
  356. font-size: 32upx;
  357. font-family: PingFang SC;
  358. color: #111;
  359. }
  360. .options{
  361. margin-top: 20rpx;
  362. display: flex;
  363. flex-direction: column;
  364. justify-content: center;
  365. align-items: center;
  366. .option-item{
  367. display: flex;
  368. align-items: center;
  369. justify-content: center;
  370. width: 100%;
  371. border: 1rpx solid #eee;
  372. margin-bottom: 30rpx;
  373. padding: 15rpx;
  374. border-radius: 5rpx;
  375. color: #ffffff;
  376. font-size: 32upx;
  377. }
  378. .green{
  379. background-color: #588e31;
  380. }
  381. .red{
  382. background-color: #c00000;
  383. }
  384. }
  385. }
  386. .title{
  387. padding: 15rpx 30rpx;
  388. display: flex;
  389. justify-content: center;
  390. align-items: center;
  391. width: 100%;
  392. background-color: #d3ad58;
  393. font-size: 24upx;
  394. font-family: PingFang SC;
  395. font-weight: bold;
  396. color: #fff;
  397. }
  398. .patient-cont{
  399. padding: 15rpx;
  400. .chose-patient{
  401. padding: 30rpx;
  402. box-shadow: 0px 0px 5px 2px rgba(0,0,0,0.05);
  403. background-color: #fff;
  404. border-radius: 15rpx;
  405. .patient-box{
  406. display: flex;
  407. align-items: center;
  408. justify-content: space-between;
  409. .patient-item{
  410. display: flex;
  411. align-items: center;
  412. justify-content: flex-start;
  413. .patient-tip{
  414. margin-top:6rpx;
  415. display: flex;
  416. align-items: center;
  417. justify-content: center;
  418. font-size: 32upx;
  419. font-family: PingFang SC;
  420. color: #ff0000;
  421. }
  422. .patient-title{
  423. margin-left: 10rpx;
  424. font-size: 32upx;
  425. font-family: PingFang SC;
  426. font-weight: bold;
  427. color: #111111;
  428. }
  429. }
  430. .right{
  431. display: flex;
  432. align-items: center;
  433. image{
  434. width: 15upx;
  435. height: 30upx;
  436. }
  437. }
  438. }
  439. .patient{
  440. display: flex;
  441. align-items: center;
  442. justify-content: space-between;
  443. height: 110upx;
  444. .left{
  445. .name{
  446. font-size: 30upx;
  447. line-height: 1;
  448. font-family: PingFang SC;
  449. font-weight: bold;
  450. color: #111111;
  451. }
  452. .info{
  453. margin-top: 30rpx;
  454. display: flex;
  455. align-items: center;
  456. .text{
  457. font-size: 26upx;
  458. font-family: PingFang SC;
  459. line-height: 1;
  460. font-weight: 500;
  461. color: #999;
  462. margin-right: 19upx;
  463. }
  464. }
  465. }
  466. .right{
  467. display: flex;
  468. align-items: center;
  469. image{
  470. width: 15upx;
  471. height: 30upx;
  472. }
  473. }
  474. }
  475. }
  476. }
  477. .items{
  478. padding: 15rpx;
  479. width: 100%;
  480. padding: 30rpx;
  481. border-radius: 15rpx;
  482. background-color: #fff;
  483. display: flex;
  484. flex-direction: column;
  485. align-items: flex-start;
  486. justify-content: flex-start;
  487. .item{
  488. display: flex;
  489. flex-direction: column;
  490. align-items: flex-start;
  491. justify-content: flex-start;
  492. width: 100%;
  493. background-color: #f8f8f8;
  494. margin-bottom: 15rpx;
  495. .name{
  496. font-size: 32upx;
  497. font-family: PingFang SC;
  498. color: #2a2b2e;
  499. font-weight: bold;
  500. margin-bottom: 15rpx;
  501. }
  502. .options{
  503. margin: 15rpx 0rpx;
  504. width: 100%;
  505. display: flex;
  506. align-items: center;
  507. justify-content: space-between;
  508. margin-bottom: 10rpx;
  509. .option{
  510. margin-bottom: 20rpx;
  511. display: flex;
  512. align-items: center;
  513. justify-content: center;
  514. border-radius: 10rpx;
  515. width:20%;
  516. height:100rpx;
  517. border: 1rpx solid #9b9b9b;
  518. font-size: 28upx;
  519. font-family: PingFang SC;
  520. color: #2a2b2e;
  521. background-color: #fff;
  522. &:last-child{
  523. margin-right: 0rpx;
  524. margin-bottom: 0rpx;
  525. }
  526. }
  527. .active{
  528. border: 1rpx solid #d3ad58;
  529. background-color: #d3ad58;
  530. color: #fff;
  531. }
  532. }
  533. }
  534. }
  535. .btns{
  536. display: flex;
  537. align-items: center;
  538. justify-content: space-between;
  539. width: 100%;
  540. padding: 30rpx;
  541. .btn{
  542. height:80rpx;
  543. margin: 0rpx 30rpx;
  544. border-radius: 60rpx;
  545. width: 100%;
  546. border: 1rpx solid #d3ad58;
  547. font-size: 32supx; font-family: PingFang SC; color: #fff;
  548. font-weight: bold;
  549. background-color: #d3ad58;
  550. display: flex;
  551. align-items: center;
  552. justify-content: center;
  553. }
  554. }
  555. .tips{
  556. flex-direction: column;
  557. display: flex;
  558. align-items: center;
  559. justify-content: center;
  560. width: 100%;
  561. padding: 30rpx;
  562. .tip-title{
  563. font-size: 26supx;
  564. font-family: PingFang SC;
  565. color: #888;
  566. font-weight: bold;
  567. }
  568. .desc{
  569. margin-top: 15rpx;
  570. font-size: 24rpx;
  571. font-family: PingFang SC;
  572. color: #b8bdb5;
  573. }
  574. }
  575. }
  576. </style>