inquiryForm1.vue 9.8 KB

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