packageForm.vue 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682
  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://bjyjb-1362704775.cos.ap-chongqing.myqcloud.com/shop/image/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://bjyjb-1362704775.cos.ap-chongqing.myqcloud.com/shop/image/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://bjyjb-1362704775.cos.ap-chongqing.myqcloud.com/app/newImages/my_heads_icon.png'"></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://bjyjb-1362704775.cos.ap-chongqing.myqcloud.com/app/newImages/my_heads_icon.png'"></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. }
  267. if(this.choose == 1 || this.choose == 2) {
  268. this.giftCreateOrder(data)
  269. return
  270. }
  271. var that=this;
  272. create(data).then(res => {
  273. uni.hideLoading()
  274. if(res.code==200){
  275. var temps=['jARl4BpoBkRu-2MxPMkQVhIfGMG0V9qW-X3V_7NtEOU','wqKEklE_w5N19w9VAGY74TltPE6Ne3BaFObDD47uDEo']
  276. uni.requestSubscribeMessage({
  277. tmplIds: temps,
  278. success(e) {
  279. setTimeout(function(){
  280. uni.navigateTo({
  281. url: '/pages_order/packageOrderPay?orderId='+res.order.orderId+'&subMsg=1'
  282. })
  283. },200);
  284. },
  285. fail(e) {
  286. setTimeout(function(){
  287. uni.navigateTo({
  288. url: '/pages_order/packageOrderPay?orderId='+res.order.orderId+'&subMsg=1'
  289. })
  290. },200);
  291. }
  292. })
  293. }else{
  294. uni.showToast({
  295. icon:'none',
  296. title: res.msg,
  297. });
  298. }
  299. });
  300. },
  301. giftCreateOrder(data) {
  302. var that=this;
  303. const param = {
  304. ...data,
  305. choose: this.choose, //1:付邮费领取 2:加粉领取
  306. }
  307. giftCreate(param).then(res => {
  308. uni.hideLoading()
  309. if(res.code==200){
  310. var temps=['jARl4BpoBkRu-2MxPMkQVhIfGMG0V9qW-X3V_7NtEOU']
  311. uni.requestSubscribeMessage({
  312. tmplIds: temps,
  313. success(e) {
  314. setTimeout(function(){
  315. uni.navigateTo({
  316. url: '/pages_order/packageOrderPay?orderId='+res.order.orderId
  317. })
  318. },200);
  319. },
  320. fail(e) {
  321. setTimeout(function(){
  322. uni.navigateTo({
  323. url: '/pages_order/packageOrderPay?orderId='+res.order.orderId
  324. })
  325. },200);
  326. }
  327. })
  328. }else{
  329. uni.showToast({
  330. icon:'none',
  331. title: res.msg,
  332. });
  333. }
  334. });
  335. }
  336. }
  337. }
  338. </script>
  339. <style lang="scss">
  340. .content{
  341. flex: 1;
  342. width: 100%;
  343. height: 100vh;
  344. display: flex;
  345. flex-direction: column;
  346. overflow: hidden;
  347. position: relative;
  348. .msg-cont{
  349. width: 100%;
  350. flex: 1;
  351. overflow: hidden;
  352. .msg-scroll{
  353. height: 100%;
  354. .msgs{
  355. width: 100%;
  356. padding: 6rpx 0;
  357. .msg-item{
  358. padding: 10rpx 15rpx;
  359. display: flex;
  360. flex-direction: column;
  361. justify-content: center;
  362. align-items: flex-start;
  363. width: 100%;
  364. .left{
  365. width: 100%;
  366. display: flex;
  367. justify-content: flex-start;
  368. align-items: flex-start;
  369. .img{
  370. min-width: 100rpx;
  371. width: 100rpx;
  372. height:100rpx;
  373. border-radius: 50%;
  374. image{
  375. width: 100%;
  376. height:100%;
  377. }
  378. }
  379. .msg-content{
  380. margin-top: 15rpx;
  381. margin-left: 10rpx;
  382. border-radius: 15rpx;
  383. padding: 15rpx;
  384. background-color: #fff;
  385. color: #111;
  386. font-size: 32upx;
  387. font-family: PingFang SC;
  388. }
  389. }
  390. .right{
  391. width: 100%;
  392. display: flex;
  393. justify-content: flex-end;
  394. align-items: flex-start;
  395. .msg-content{
  396. margin-top: 15rpx;
  397. margin-right: 10rpx;
  398. border-radius: 15rpx;
  399. padding: 15rpx;
  400. background-color: #d3ad58;
  401. color: #fff;
  402. font-size: 32upx;
  403. font-family: PingFang SC;
  404. }
  405. .img{
  406. min-width: 100rpx;
  407. width: 100rpx;
  408. height:100rpx;
  409. border-radius: 50%;
  410. image{
  411. width: 100%;
  412. height:100%;
  413. }
  414. }
  415. }
  416. }
  417. }
  418. }
  419. }
  420. .option-cont{
  421. flex-shrink: 0;
  422. // position: fixed;
  423. // bottom: 0rpx;
  424. // #ifndef APP-PLUS
  425. max-height: 90vh;
  426. overflow-y: auto;
  427. // #endif
  428. // #ifdef APP-PLUS
  429. // height: 380rpx;
  430. // #endif
  431. width: 100%;
  432. background-color: #fff;
  433. border-radius: 60rpx 60rpx 0rpx 0rpx;
  434. padding: 30rpx;
  435. .option-title{
  436. width: 100%;
  437. padding-bottom: 15rpx;
  438. display: flex;
  439. align-items: center;
  440. justify-content: center;
  441. font-size: 32upx;
  442. font-family: PingFang SC;
  443. color: #111;
  444. }
  445. .options{
  446. margin-top: 20rpx;
  447. display: flex;
  448. flex-direction: column;
  449. justify-content: center;
  450. align-items: center;
  451. .option-item{
  452. display: flex;
  453. align-items: center;
  454. justify-content: center;
  455. width: 100%;
  456. border: 1rpx solid #eee;
  457. margin-bottom: 20rpx;
  458. padding: 15rpx;
  459. border-radius: 5rpx;
  460. color: #ffffff;
  461. font-size: 32upx;
  462. }
  463. .green{
  464. background-color: #588e31;
  465. }
  466. .red{
  467. background-color: #c00000;
  468. }
  469. }
  470. }
  471. .title{
  472. padding: 15rpx 30rpx;
  473. display: flex;
  474. justify-content: center;
  475. align-items: center;
  476. width: 100%;
  477. background-color: #d3ad58;
  478. font-size: 24upx;
  479. font-family: PingFang SC;
  480. font-weight: bold;
  481. color: #fff;
  482. }
  483. .patient-cont{
  484. padding: 15rpx;
  485. .chose-patient{
  486. padding: 30rpx;
  487. box-shadow: 0px 0px 5px 2px rgba(0,0,0,0.05);
  488. background-color: #fff;
  489. border-radius: 15rpx;
  490. .patient-box{
  491. display: flex;
  492. align-items: center;
  493. justify-content: space-between;
  494. .patient-item{
  495. display: flex;
  496. align-items: center;
  497. justify-content: flex-start;
  498. .patient-tip{
  499. margin-top:6rpx;
  500. display: flex;
  501. align-items: center;
  502. justify-content: center;
  503. font-size: 32upx;
  504. font-family: PingFang SC;
  505. color: #ff0000;
  506. }
  507. .patient-title{
  508. margin-left: 10rpx;
  509. font-size: 32upx;
  510. font-family: PingFang SC;
  511. font-weight: bold;
  512. color: #111111;
  513. }
  514. }
  515. .right{
  516. display: flex;
  517. align-items: center;
  518. image{
  519. width: 15upx;
  520. height: 30upx;
  521. }
  522. }
  523. }
  524. .patient{
  525. display: flex;
  526. align-items: center;
  527. justify-content: space-between;
  528. height: 110upx;
  529. .left{
  530. .name{
  531. font-size: 30upx;
  532. line-height: 1;
  533. font-family: PingFang SC;
  534. font-weight: bold;
  535. color: #111111;
  536. }
  537. .info{
  538. margin-top: 30rpx;
  539. display: flex;
  540. align-items: center;
  541. .text{
  542. font-size: 26upx;
  543. font-family: PingFang SC;
  544. line-height: 1;
  545. font-weight: 500;
  546. color: #999;
  547. margin-right: 19upx;
  548. }
  549. }
  550. }
  551. .right{
  552. display: flex;
  553. align-items: center;
  554. image{
  555. width: 15upx;
  556. height: 30upx;
  557. }
  558. }
  559. }
  560. }
  561. }
  562. .items{
  563. padding: 15rpx;
  564. width: 100%;
  565. padding: 30rpx;
  566. border-radius: 15rpx;
  567. background-color: #fff;
  568. display: flex;
  569. flex-direction: column;
  570. align-items: flex-start;
  571. justify-content: flex-start;
  572. .item{
  573. display: flex;
  574. flex-direction: column;
  575. align-items: flex-start;
  576. justify-content: flex-start;
  577. width: 100%;
  578. background-color: #f8f8f8;
  579. margin-bottom: 15rpx;
  580. .name{
  581. font-size: 32upx;
  582. font-family: PingFang SC;
  583. color: #2a2b2e;
  584. font-weight: bold;
  585. margin-bottom: 15rpx;
  586. }
  587. .options{
  588. margin: 15rpx 0rpx;
  589. width: 100%;
  590. display: flex;
  591. align-items: center;
  592. justify-content: space-between;
  593. margin-bottom: 10rpx;
  594. .option{
  595. margin-bottom: 20rpx;
  596. display: flex;
  597. align-items: center;
  598. justify-content: center;
  599. border-radius: 10rpx;
  600. width:20%;
  601. height:100rpx;
  602. border: 1rpx solid #9b9b9b;
  603. font-size: 28upx;
  604. font-family: PingFang SC;
  605. color: #2a2b2e;
  606. background-color: #fff;
  607. &:last-child{
  608. margin-right: 0rpx;
  609. margin-bottom: 0rpx;
  610. }
  611. }
  612. .active{
  613. border: 1rpx solid #d3ad58;
  614. background-color: #d3ad58;
  615. color: #fff;
  616. }
  617. }
  618. }
  619. }
  620. .btns{
  621. display: flex;
  622. align-items: center;
  623. justify-content: space-between;
  624. width: 100%;
  625. padding: 30rpx;
  626. .btn{
  627. height:80rpx;
  628. margin: 0rpx 30rpx;
  629. border-radius: 60rpx;
  630. width: 100%;
  631. border: 1rpx solid #d3ad58;
  632. font-size: 32supx; font-family: PingFang SC; color: #fff;
  633. font-weight: bold;
  634. background-color: #d3ad58;
  635. display: flex;
  636. align-items: center;
  637. justify-content: center;
  638. }
  639. }
  640. .tips{
  641. flex-direction: column;
  642. display: flex;
  643. align-items: center;
  644. justify-content: center;
  645. width: 100%;
  646. padding: 30rpx;
  647. .tip-title{
  648. font-size: 26supx;
  649. font-family: PingFang SC;
  650. color: #888;
  651. font-weight: bold;
  652. }
  653. .desc{
  654. margin-top: 15rpx;
  655. font-size: 24rpx;
  656. font-family: PingFang SC;
  657. color: #b8bdb5;
  658. }
  659. }
  660. }
  661. </style>