inquiryForm1.vue 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450
  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://bjyjb-1362704775.cos.ap-chongqing.myqcloud.com/shop/image/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://bjyjb-1362704775.cos.ap-chongqing.myqcloud.com/shop/image/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="#2583EB"
  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="#2583EB"
  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. }
  201. uni.showLoading({
  202. title: '正在处理中...'
  203. });
  204. create(data).then(
  205. res => {
  206. uni.hideLoading()
  207. if(res.code==200){
  208. var temps=['YyaBF62vH1GPKY0tume8C2C5UETxcKrVsaTKdBW5eok']
  209. uni.requestSubscribeMessage({
  210. tmplIds: temps,
  211. success(e) {
  212. setTimeout(function(){
  213. uni.redirectTo({
  214. url: './inquiryPay?orderId='+res.order.orderId
  215. })
  216. },200);
  217. },
  218. fail(e) {
  219. setTimeout(function(){
  220. uni.redirectTo({
  221. url: './inquiryPay?orderId='+res.order.orderId
  222. })
  223. },200);
  224. }
  225. })
  226. return;
  227. }
  228. else{
  229. uni.showToast({
  230. icon:'none',
  231. title: res.msg,
  232. });
  233. }
  234. },
  235. rej => {}
  236. );
  237. },
  238. confirm(){
  239. let data = {};
  240. confirm(data).then(
  241. res => {
  242. if(res.code==200){
  243. this.orderKey=res.orderKey
  244. }
  245. },
  246. rej => {}
  247. );
  248. },
  249. addPatient(){
  250. uni.navigateTo({
  251. url: '/pages_user/patient'
  252. })
  253. },
  254. deletePic(event) {
  255. this[`fileList${event.name}`].splice(event.index, 1)
  256. },
  257. async afterRead(event) {
  258. // 当设置 multiple 为 true 时, file 为数组格式,否则为对象格式
  259. let lists = [].concat(event.file)
  260. let fileListLen = this[`fileList${event.name}`].length
  261. lists.map((item) => {
  262. this[`fileList${event.name}`].push({
  263. ...item,
  264. status: 'uploading',
  265. message: '上传中'
  266. })
  267. })
  268. for (let i = 0; i < lists.length; i++) {
  269. const result = await this.uploadFilePromise(lists[i].url)
  270. let item = this[`fileList${event.name}`][fileListLen]
  271. this[`fileList${event.name}`].splice(fileListLen, 1, Object.assign(item, {
  272. status: 'success',
  273. message: '',
  274. url: result
  275. }))
  276. fileListLen++
  277. }
  278. },
  279. uploadFilePromise(url) {
  280. return new Promise((resolve, reject) => {
  281. let a = uni.uploadFile({
  282. url: uni.getStorageSync('requestPath')+'/app/common/uploadOSS', // 仅为示例,非真实的接口地址
  283. filePath: url,
  284. name: 'file',
  285. formData: {
  286. user: 'test'
  287. },
  288. success: (res) => {
  289. setTimeout(() => {
  290. console.log(JSON.parse(res.data).url)
  291. resolve(JSON.parse(res.data).url)
  292. }, 1000)
  293. }
  294. });
  295. })
  296. }
  297. }
  298. }
  299. </script>
  300. <style lang="scss">
  301. page{
  302. background: #f1f6fc;
  303. }
  304. </style>
  305. <style scoped lang="scss">
  306. .content{
  307. position: relative;
  308. .main{
  309. margin-top: 44px;
  310. padding-bottom: 140upx;
  311. .cont{
  312. margin: 15rpx;
  313. padding: 30rpx;
  314. box-shadow: 0px 0px 5px 2px rgba(0,0,0,0.05);
  315. background-color: #fff;
  316. border-radius: 15rpx;
  317. .title-box{
  318. display: flex;
  319. flex-direction: row;
  320. align-items: center;
  321. justify-content: flex-start;
  322. .title{
  323. font-size: 32upx;
  324. font-family: PingFang SC;
  325. font-weight: bold;
  326. color: #111111;
  327. }
  328. .line{
  329. margin-right: 15rpx;
  330. height: 30rpx;
  331. width: 6rpx;
  332. background-color: #2583EB;
  333. }
  334. .red-dot{
  335. margin-right: 5rpx;
  336. color:red;
  337. }
  338. }
  339. }
  340. .chose-patient{
  341. margin: 15rpx 15rpx;
  342. padding: 30rpx 40rpx;
  343. box-shadow: 0px 0px 5px 2px rgba(0,0,0,0.05);
  344. background-color: #fff;
  345. border-radius: 15rpx;
  346. .title-box{
  347. display: flex;
  348. align-items: center;
  349. justify-content: space-between;
  350. .title{
  351. font-size: 32upx;
  352. font-family: PingFang SC;
  353. font-weight: bold;
  354. color: #111111;
  355. }
  356. .right{
  357. height: 100%;
  358. display: flex;
  359. align-items: center;
  360. justify-content: center;
  361. .value{
  362. font-size: 28upx;
  363. font-family: PingFang SC;
  364. color: #999;
  365. margin-right: 10rpx;
  366. }
  367. image{
  368. width: 15upx;
  369. height: 30upx;
  370. }
  371. }
  372. }
  373. .patient{
  374. display: flex;
  375. align-items: center;
  376. justify-content: space-between;
  377. height: 110upx;
  378. .left{
  379. .name{
  380. font-size: 30upx;
  381. line-height: 1;
  382. font-family: PingFang SC;
  383. font-weight: bold;
  384. color: #111111;
  385. }
  386. .info{
  387. margin-top: 30rpx;
  388. display: flex;
  389. align-items: center;
  390. .text{
  391. font-size: 26upx;
  392. font-family: PingFang SC;
  393. line-height: 1;
  394. font-weight: 500;
  395. color: #999;
  396. margin-right: 19upx;
  397. }
  398. }
  399. }
  400. .right{
  401. display: flex;
  402. align-items: center;
  403. image{
  404. width: 15upx;
  405. height: 30upx;
  406. }
  407. }
  408. }
  409. }
  410. }
  411. .btn-box{
  412. height: 140upx;
  413. z-index: 9999;
  414. width: 100%;
  415. padding: 0rpx 30upx;
  416. position: fixed;
  417. bottom: 0;
  418. left: 0;
  419. box-sizing: border-box;
  420. background-color: #ffffff;
  421. display: flex;
  422. align-items: center;
  423. justify-content: center;
  424. .btn{
  425. width: 100%;
  426. height: 88upx;
  427. line-height: 88upx;
  428. text-align: center;
  429. font-size: 34upx;
  430. font-family: PingFang SC;
  431. font-weight: 400;
  432. color: #FFFFFF;
  433. background: #2583EB;
  434. border-radius: 10upx;
  435. }
  436. }
  437. }
  438. </style>