inquiryForm1.vue 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451
  1. <template>
  2. <view class="content">
  3. <view>
  4. <u-navbar
  5. title="症状描述"
  6. @leftClick="leftClick"
  7. >
  8. </u-navbar>
  9. </view>
  10. <view class="main">
  11. <view class="status_bar" :style="{height: statusBarHeight}"></view>
  12. <u-alert fontSize="16" description = "尊敬的用户,您好! 为了您的健康,请认真填写以下内容,以便更好地为您提供咨询建议"></u-alert>
  13. <view class="chose-patient">
  14. <view class="title-box" @click="addPatient()" v-if="patient==null">
  15. <text class="title">选择就诊人</text>
  16. <view class="right" >
  17. <text class="value">请点击添加</text>
  18. <image src="https://cqtyt-2025.oss-cn-beijing.aliyuncs.com/huyi/images/arrow_gray.png" mode=""></image>
  19. </view>
  20. </view>
  21. <view class="patient" @click="addPatient()" v-if="patient!=null">
  22. <view class="left">
  23. <view class="name">{{patient.patientName}}</view>
  24. <view class="info">
  25. <text class="text" v-if="patient.sex==1">男</text>
  26. <text class="text" v-if="patient.sex==2">女</text>
  27. <text class="text">{{$getAge(patient.birthday)}}岁</text>
  28. <text class="text">{{$parseIdCard(patient.idCard)}}</text>
  29. </view>
  30. </view>
  31. <view class="right" >
  32. <image src="https://cqtyt-2025.oss-cn-beijing.aliyuncs.com/huyi/images/arrow_gray.png" mode=""></image>
  33. </view>
  34. </view>
  35. </view>
  36. <view class="cont">
  37. <view class="title-box">
  38. <view class="red-dot">*</view>
  39. <view class="title">请描述您的病情</view>
  40. </view>
  41. <view style="margin: 15rpx 0rpx">
  42. <u--textarea maxlength="500" v-model="title" placeholder="请输入内容" count ></u--textarea>
  43. </view>
  44. <view class="title-box">
  45. <view class="red-dot">*</view>
  46. <view class="title">本次患病多久了?</view>
  47. </view>
  48. <view style="margin: 15rpx 0rpx">
  49. <u-radio-group
  50. v-model="duration"
  51. iconPlacement="left">
  52. <u-radio :customStyle="{marginRight: '5px'}"
  53. v-for="(item, index) in durations"
  54. :key="index"
  55. :label="item.name"
  56. :name="item.name" activeColor="#078C9D"
  57. ></u-radio>
  58. </u-radio-group>
  59. </view>
  60. <view class="title-box">
  61. <view class="red-dot">*</view>
  62. <view class="title">此次病情是否去医院就诊过?</view>
  63. </view>
  64. <view style="margin: 15rpx 0rpx">
  65. <u-radio-group
  66. v-model="isVisit"
  67. iconPlacement="left">
  68. <u-radio :customStyle="{marginRight: '5px'}"
  69. v-for="(item, index) in isVisits"
  70. :key="index"
  71. :label="item.name"
  72. :name="item.name" activeColor="#078C9D"
  73. ></u-radio>
  74. </u-radio-group>
  75. </view>
  76. <view class="title-box">
  77. <view class="title">上传检测报告或患处照片?</view>
  78. </view>
  79. <view style="margin: 15rpx 0rpx">
  80. <u-upload
  81. :fileList="fileList1"
  82. @afterRead="afterRead"
  83. @delete="deletePic"
  84. name="1"
  85. :maxCount="5"
  86. ></u-upload>
  87. </view>
  88. </view>
  89. </view>
  90. <view class="btn-box">
  91. <view class="btn" @click="submitOrder()">提交订单</view>
  92. </view>
  93. </view>
  94. </template>
  95. <script>
  96. import {create,confirm} from '@/api/inquiryOrder.js'
  97. export default {
  98. data() {
  99. return {
  100. statusBarHeight: uni.getStorageSync('menuInfo').statusBarHeight,
  101. orderKey:null,
  102. patient:null,
  103. durations: [
  104. {
  105. name: '一周内',
  106. disabled: false
  107. },
  108. {
  109. name: '一个月内',
  110. disabled: false
  111. },
  112. {
  113. name: '半年内',
  114. disabled: false
  115. }, {
  116. name: '半年以上',
  117. disabled: false
  118. }
  119. ],
  120. isVisits: [
  121. {
  122. name: '未就诊',
  123. disabled: false
  124. },
  125. {
  126. name: '就诊过',
  127. disabled: false
  128. }
  129. ],
  130. title:"",
  131. isVisit:"就诊过",
  132. duration:"一周内",
  133. inquiryType:null,
  134. orderType:null,
  135. doctorId:null,
  136. fileList1: [],
  137. }
  138. },
  139. onLoad(options) {
  140. this.inquiryType=options.inquiryType;
  141. this.orderType=options.orderType;
  142. this.doctorId=options.doctorId;
  143. console.log(this.inquiryType)
  144. console.log(this.orderType)
  145. console.log(this.doctorId)
  146. this.confirm();
  147. },
  148. onShow() {
  149. var that=this;
  150. uni.$on('refreshOrderPatient', (res) => {
  151. that.patient=res
  152. })
  153. },
  154. methods: {
  155. leftClick() {
  156. console.log('leftClick');
  157. uni.showModal({
  158. title: '提示',
  159. content: '确认关闭吗',
  160. success: function (res) {
  161. if (res.confirm) {
  162. uni.navigateBack()
  163. } else if (res.cancel) {
  164. }
  165. }
  166. });
  167. },
  168. submitOrder(){
  169. if(this.patient==null){
  170. uni.showToast({
  171. icon:'none',
  172. title: '请选择就诊人',
  173. });
  174. return;
  175. }
  176. if(this.isVisit=='未就诊'){
  177. uni.showToast({
  178. icon:'none',
  179. title: '仅支持复诊',
  180. });
  181. return;
  182. }
  183. if(this.orderKey==null){
  184. this.confirm();
  185. }
  186. var images=[];
  187. this.fileList1.forEach(function(element) {
  188. images.push(element.url)
  189. });
  190. var data={
  191. orderKey:this.orderKey,
  192. patientId:this.patient.patientId,
  193. title:this.title,
  194. isVisit:this.isVisit,
  195. duration:this.duration,
  196. inquiryType:this.inquiryType,
  197. orderType:this.orderType,
  198. doctorId:this.doctorId,
  199. reportImages:images.toString(),
  200. source: getApp().globalData.source
  201. }
  202. uni.showLoading({
  203. title: '正在处理中...'
  204. });
  205. create(data).then(
  206. res => {
  207. uni.hideLoading()
  208. if(res.code==200){
  209. var temps=['YyaBF62vH1GPKY0tume8C2C5UETxcKrVsaTKdBW5eok']
  210. uni.requestSubscribeMessage({
  211. tmplIds: temps,
  212. success(e) {
  213. setTimeout(function(){
  214. uni.redirectTo({
  215. url: './inquiryPay?orderId='+res.order.orderId
  216. })
  217. },200);
  218. },
  219. fail(e) {
  220. setTimeout(function(){
  221. uni.redirectTo({
  222. url: './inquiryPay?orderId='+res.order.orderId
  223. })
  224. },200);
  225. }
  226. })
  227. return;
  228. }
  229. else{
  230. uni.showToast({
  231. icon:'none',
  232. title: res.msg,
  233. });
  234. }
  235. },
  236. rej => {}
  237. );
  238. },
  239. confirm(){
  240. let data = {};
  241. confirm(data).then(
  242. res => {
  243. if(res.code==200){
  244. this.orderKey=res.orderKey
  245. }
  246. },
  247. rej => {}
  248. );
  249. },
  250. addPatient(){
  251. uni.navigateTo({
  252. url: '/pages_user/patient'
  253. })
  254. },
  255. deletePic(event) {
  256. this[`fileList${event.name}`].splice(event.index, 1)
  257. },
  258. async afterRead(event) {
  259. // 当设置 multiple 为 true 时, file 为数组格式,否则为对象格式
  260. let lists = [].concat(event.file)
  261. let fileListLen = this[`fileList${event.name}`].length
  262. lists.map((item) => {
  263. this[`fileList${event.name}`].push({
  264. ...item,
  265. status: 'uploading',
  266. message: '上传中'
  267. })
  268. })
  269. for (let i = 0; i < lists.length; i++) {
  270. const result = await this.uploadFilePromise(lists[i].url)
  271. let item = this[`fileList${event.name}`][fileListLen]
  272. this[`fileList${event.name}`].splice(fileListLen, 1, Object.assign(item, {
  273. status: 'success',
  274. message: '',
  275. url: result
  276. }))
  277. fileListLen++
  278. }
  279. },
  280. uploadFilePromise(url) {
  281. return new Promise((resolve, reject) => {
  282. let a = uni.uploadFile({
  283. url: uni.getStorageSync('requestPath')+'/app/common/uploadOSS', // 仅为示例,非真实的接口地址
  284. filePath: url,
  285. name: 'file',
  286. formData: {
  287. user: 'test'
  288. },
  289. success: (res) => {
  290. setTimeout(() => {
  291. console.log(JSON.parse(res.data).url)
  292. resolve(JSON.parse(res.data).url)
  293. }, 1000)
  294. }
  295. });
  296. })
  297. }
  298. }
  299. }
  300. </script>
  301. <style lang="scss">
  302. page{
  303. background: #f1f6fc;
  304. }
  305. </style>
  306. <style scoped lang="scss">
  307. .content{
  308. position: relative;
  309. .main{
  310. margin-top: 44px;
  311. padding-bottom: 140upx;
  312. .cont{
  313. margin: 15rpx;
  314. padding: 30rpx;
  315. box-shadow: 0px 0px 5px 2px rgba(0,0,0,0.05);
  316. background-color: #fff;
  317. border-radius: 15rpx;
  318. .title-box{
  319. display: flex;
  320. flex-direction: row;
  321. align-items: center;
  322. justify-content: flex-start;
  323. .title{
  324. font-size: 32upx;
  325. font-family: PingFang SC;
  326. font-weight: bold;
  327. color: #111111;
  328. }
  329. .line{
  330. margin-right: 15rpx;
  331. height: 30rpx;
  332. width: 6rpx;
  333. background-color: #078C9D;
  334. }
  335. .red-dot{
  336. margin-right: 5rpx;
  337. color:red;
  338. }
  339. }
  340. }
  341. .chose-patient{
  342. margin: 15rpx 15rpx;
  343. padding: 30rpx 40rpx;
  344. box-shadow: 0px 0px 5px 2px rgba(0,0,0,0.05);
  345. background-color: #fff;
  346. border-radius: 15rpx;
  347. .title-box{
  348. display: flex;
  349. align-items: center;
  350. justify-content: space-between;
  351. .title{
  352. font-size: 32upx;
  353. font-family: PingFang SC;
  354. font-weight: bold;
  355. color: #111111;
  356. }
  357. .right{
  358. height: 100%;
  359. display: flex;
  360. align-items: center;
  361. justify-content: center;
  362. .value{
  363. font-size: 28upx;
  364. font-family: PingFang SC;
  365. color: #999;
  366. margin-right: 10rpx;
  367. }
  368. image{
  369. width: 15upx;
  370. height: 30upx;
  371. }
  372. }
  373. }
  374. .patient{
  375. display: flex;
  376. align-items: center;
  377. justify-content: space-between;
  378. height: 110upx;
  379. .left{
  380. .name{
  381. font-size: 30upx;
  382. line-height: 1;
  383. font-family: PingFang SC;
  384. font-weight: bold;
  385. color: #111111;
  386. }
  387. .info{
  388. margin-top: 30rpx;
  389. display: flex;
  390. align-items: center;
  391. .text{
  392. font-size: 26upx;
  393. font-family: PingFang SC;
  394. line-height: 1;
  395. font-weight: 500;
  396. color: #999;
  397. margin-right: 19upx;
  398. }
  399. }
  400. }
  401. .right{
  402. display: flex;
  403. align-items: center;
  404. image{
  405. width: 15upx;
  406. height: 30upx;
  407. }
  408. }
  409. }
  410. }
  411. }
  412. .btn-box{
  413. height: 140upx;
  414. z-index: 9999;
  415. width: 100%;
  416. padding: 0rpx 30upx;
  417. position: fixed;
  418. bottom: 0;
  419. left: 0;
  420. box-sizing: border-box;
  421. background-color: #ffffff;
  422. display: flex;
  423. align-items: center;
  424. justify-content: center;
  425. .btn{
  426. width: 100%;
  427. height: 88upx;
  428. line-height: 88upx;
  429. text-align: center;
  430. font-size: 34upx;
  431. font-family: PingFang SC;
  432. font-weight: 400;
  433. color: #FFFFFF;
  434. background: #078C9D;
  435. border-radius: 10upx;
  436. }
  437. }
  438. }
  439. </style>