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 = "尊敬的用户,您好!
  13. 为了您的健康,请认真填写以下内容,以便更好地为您提供咨询建议"></u-alert>
  14. <view class="chose-patient">
  15. <view class="title-box" @click="addPatient()" v-if="patient==null">
  16. <text class="title">选择就诊人</text>
  17. <view class="right" >
  18. <text class="value">请点击添加</text>
  19. <image src="/static/images/arrow_gray.png" mode=""></image>
  20. </view>
  21. </view>
  22. <view class="patient" @click="addPatient()" v-if="patient!=null">
  23. <view class="left">
  24. <view class="name">{{patient.patientName}}</view>
  25. <view class="info">
  26. <text class="text" v-if="patient.sex==1">男</text>
  27. <text class="text" v-if="patient.sex==2">女</text>
  28. <text class="text">{{$getAge(patient.birthday)}}岁</text>
  29. <text class="text">{{$parseIdCard(patient.idCard)}}</text>
  30. </view>
  31. </view>
  32. <view class="right" >
  33. <image src="/static/images/arrow_gray.png" mode=""></image>
  34. </view>
  35. </view>
  36. </view>
  37. <view class="cont">
  38. <view class="title-box">
  39. <view class="red-dot">*</view>
  40. <view class="title">请描述您的病情</view>
  41. </view>
  42. <view style="margin: 15rpx 0rpx">
  43. <u--textarea maxlength="500" v-model="title" placeholder="请输入内容" count ></u--textarea>
  44. </view>
  45. <view class="title-box">
  46. <view class="red-dot">*</view>
  47. <view class="title">本次患病多久了?</view>
  48. </view>
  49. <view style="margin: 15rpx 0rpx">
  50. <u-radio-group
  51. v-model="duration"
  52. iconPlacement="left">
  53. <u-radio :customStyle="{marginRight: '5px'}"
  54. v-for="(item, index) in durations"
  55. :key="index"
  56. :label="item.name"
  57. :name="item.name" activeColor="#C39A58"
  58. ></u-radio>
  59. </u-radio-group>
  60. </view>
  61. <view class="title-box">
  62. <view class="red-dot">*</view>
  63. <view class="title">此次病情是否去医院就诊过?</view>
  64. </view>
  65. <view style="margin: 15rpx 0rpx">
  66. <u-radio-group
  67. v-model="isVisit"
  68. iconPlacement="left">
  69. <u-radio :customStyle="{marginRight: '5px'}"
  70. v-for="(item, index) in isVisits"
  71. :key="index"
  72. :label="item.name"
  73. :name="item.name" activeColor="#C39A58"
  74. ></u-radio>
  75. </u-radio-group>
  76. </view>
  77. <view class="title-box">
  78. <view class="title">上传检测报告或患处照片?</view>
  79. </view>
  80. <view style="margin: 15rpx 0rpx">
  81. <u-upload
  82. :fileList="fileList1"
  83. @afterRead="afterRead"
  84. @delete="deletePic"
  85. name="1"
  86. :maxCount="5"
  87. ></u-upload>
  88. </view>
  89. </view>
  90. </view>
  91. <view class="btn-box">
  92. <view class="btn" @click="submitOrder()">提交订单</view>
  93. </view>
  94. </view>
  95. </template>
  96. <script>
  97. import {create,confirm} from '@/api/inquiryOrder.js'
  98. export default {
  99. data() {
  100. return {
  101. statusBarHeight: uni.getStorageSync('menuInfo').statusBarHeight,
  102. orderKey:null,
  103. patient:null,
  104. durations: [
  105. {
  106. name: '一周内',
  107. disabled: false
  108. },
  109. {
  110. name: '一个月内',
  111. disabled: false
  112. },
  113. {
  114. name: '半年内',
  115. disabled: false
  116. }, {
  117. name: '半年以上',
  118. disabled: false
  119. }
  120. ],
  121. isVisits: [
  122. {
  123. name: '未就诊',
  124. disabled: false
  125. },
  126. {
  127. name: '就诊过',
  128. disabled: false
  129. }
  130. ],
  131. title:"",
  132. isVisit:"就诊过",
  133. duration:"一周内",
  134. inquiryType:null,
  135. orderType:null,
  136. doctorId:null,
  137. fileList1: [],
  138. }
  139. },
  140. onLoad(options) {
  141. this.inquiryType=options.inquiryType;
  142. this.orderType=options.orderType;
  143. this.doctorId=options.doctorId;
  144. console.log(this.inquiryType)
  145. console.log(this.orderType)
  146. console.log(this.doctorId)
  147. this.confirm();
  148. },
  149. onShow() {
  150. var that=this;
  151. uni.$on('refreshOrderPatient', (res) => {
  152. that.patient=res
  153. })
  154. },
  155. methods: {
  156. leftClick() {
  157. console.log('leftClick');
  158. uni.showModal({
  159. title: '提示',
  160. content: '确认关闭吗',
  161. success: function (res) {
  162. if (res.confirm) {
  163. uni.navigateBack()
  164. } else if (res.cancel) {
  165. }
  166. }
  167. });
  168. },
  169. submitOrder(){
  170. if(this.patient==null){
  171. uni.showToast({
  172. icon:'none',
  173. title: '请选择就诊人',
  174. });
  175. return;
  176. }
  177. if(this.isVisit=='未就诊'){
  178. uni.showToast({
  179. icon:'none',
  180. title: '仅支持复诊',
  181. });
  182. return;
  183. }
  184. if(this.orderKey==null){
  185. this.confirm();
  186. }
  187. var images=[];
  188. this.fileList1.forEach(function(element) {
  189. images.push(element.url)
  190. });
  191. var data={
  192. orderKey:this.orderKey,
  193. patientId:this.patient.patientId,
  194. title:this.title,
  195. isVisit:this.isVisit,
  196. duration:this.duration,
  197. inquiryType:this.inquiryType,
  198. orderType:this.orderType,
  199. doctorId:this.doctorId,
  200. reportImages:images.toString()
  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: #C39A58;
  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: #C39A58;
  435. border-radius: 10upx;
  436. }
  437. }
  438. }
  439. </style>