inquiryForm3.vue 9.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428
  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. companyId:null,
  94. companyUserId:null,
  95. orderKey:null,
  96. patient:null,
  97. durations: [
  98. {
  99. name: '一周内',
  100. disabled: false
  101. },
  102. {
  103. name: '一个月内',
  104. disabled: false
  105. },
  106. {
  107. name: '半年内',
  108. disabled: false
  109. }, {
  110. name: '半年以上',
  111. disabled: false
  112. }
  113. ],
  114. isVisits: [
  115. {
  116. name: '未就诊',
  117. disabled: false
  118. },
  119. {
  120. name: '就诊过',
  121. disabled: false
  122. }
  123. ],
  124. title:"",
  125. isVisit:"就诊过",
  126. duration:"一周内",
  127. inquiryType:null,
  128. orderType:null,
  129. doctorId:null,
  130. fileList1: [],
  131. }
  132. },
  133. onLoad(options) {
  134. if(!this.$isEmpty(options.companyId)){
  135. this.companyId=options.companyId == 'undefined' || options.companyId == 'null' ? null: options.companyId
  136. }
  137. if(!this.$isEmpty(options.companyUserId)){
  138. this.companyUserId=options.companyUserId == 'undefined' || options.companyUserId == 'null'? null: options.companyUserId
  139. }
  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. submitOrder(){
  156. if(this.patient==null){
  157. uni.showToast({
  158. icon:'none',
  159. title: '请选择就诊人',
  160. });
  161. return;
  162. }
  163. if(this.isVisit=='未就诊'){
  164. uni.showToast({
  165. icon:'none',
  166. title: '仅支持复诊',
  167. });
  168. return;
  169. }
  170. var images=[];
  171. this.fileList1.forEach(function(element) {
  172. images.push(element.url)
  173. });
  174. var data={
  175. companyId:this.companyId,
  176. companyUserId:this.companyUserId,
  177. orderKey:this.orderKey,
  178. patientId:this.patient.patientId,
  179. title:this.title,
  180. isVisit:this.isVisit,
  181. duration:this.duration,
  182. inquiryType:this.inquiryType,
  183. orderType:this.orderType,
  184. doctorId:this.doctorId,
  185. imgs:images.toString()
  186. }
  187. //#ifdef APP-PLUS
  188. data.source=2;
  189. //#endif
  190. //#ifdef H5
  191. data.source=3;
  192. //#endif
  193. uni.showLoading({title: '正在处理中...'});
  194. create(data).then(
  195. res => {
  196. if(res.code==200){
  197. setTimeout(function(){
  198. uni.redirectTo({
  199. url: './inquiryPay?orderId='+res.order.orderId
  200. })
  201. },200);
  202. return;
  203. }
  204. else{
  205. uni.showToast({
  206. icon:'none',
  207. title: res.msg,
  208. });
  209. }
  210. },
  211. rej => {}
  212. );
  213. },
  214. confirm(){
  215. let data = {};
  216. confirm(data).then(
  217. res => {
  218. if(res.code==200){
  219. this.orderKey=res.orderKey
  220. }
  221. },
  222. rej => {}
  223. );
  224. },
  225. addPatient(){
  226. uni.navigateTo({
  227. url: '/pages/user/patient'
  228. })
  229. },
  230. deletePic(event) {
  231. this[`fileList${event.name}`].splice(event.index, 1)
  232. },
  233. async afterRead(event) {
  234. // 当设置 multiple 为 true 时, file 为数组格式,否则为对象格式
  235. let lists = [].concat(event.file)
  236. let fileListLen = this[`fileList${event.name}`].length
  237. lists.map((item) => {
  238. this[`fileList${event.name}`].push({
  239. ...item,
  240. status: 'uploading',
  241. message: '上传中'
  242. })
  243. })
  244. for (let i = 0; i < lists.length; i++) {
  245. const result = await this.uploadFilePromise(lists[i].url)
  246. let item = this[`fileList${event.name}`][fileListLen]
  247. this[`fileList${event.name}`].splice(fileListLen, 1, Object.assign(item, {
  248. status: 'success',
  249. message: '',
  250. url: result
  251. }))
  252. fileListLen++
  253. }
  254. },
  255. uploadFilePromise(url) {
  256. return new Promise((resolve, reject) => {
  257. let a = uni.uploadFile({
  258. url: uni.getStorageSync('requestPath')+'/app/common/uploadOSS', // 仅为示例,非真实的接口地址
  259. filePath: url,
  260. name: 'file',
  261. formData: {
  262. user: 'test'
  263. },
  264. success: (res) => {
  265. setTimeout(() => {
  266. console.log(JSON.parse(res.data).url)
  267. resolve(JSON.parse(res.data).url)
  268. }, 1000)
  269. }
  270. });
  271. })
  272. },
  273. }
  274. }
  275. </script>
  276. <style lang="scss">
  277. page{
  278. background: #f1f6fc;
  279. }
  280. </style>
  281. <style scoped lang="scss">
  282. .main{
  283. position: relative;
  284. padding-bottom: 140upx;
  285. .cont{
  286. margin: 15rpx;
  287. padding: 30rpx;
  288. box-shadow: 0px 0px 5px 2px rgba(0,0,0,0.05);
  289. background-color: #fff;
  290. border-radius: 15rpx;
  291. .title-box{
  292. display: flex;
  293. flex-direction: row;
  294. align-items: center;
  295. justify-content: flex-start;
  296. .title{
  297. font-size: 32upx;
  298. font-family: PingFang SC;
  299. font-weight: bold;
  300. color: #111111;
  301. }
  302. .line{
  303. margin-right: 15rpx;
  304. height: 30rpx;
  305. width: 6rpx;
  306. background-color: #FF5C03;
  307. }
  308. .red-dot{
  309. margin-right: 5rpx;
  310. color:red;
  311. }
  312. }
  313. }
  314. .chose-patient{
  315. margin: 15rpx;
  316. padding: 30rpx 40rpx;
  317. box-shadow: 0px 0px 5px 2px rgba(0,0,0,0.05);
  318. background-color: #fff;
  319. border-radius: 15rpx;
  320. .title-box{
  321. display: flex;
  322. align-items: center;
  323. justify-content: space-between;
  324. .title{
  325. font-size: 32upx;
  326. font-family: PingFang SC;
  327. font-weight: bold;
  328. color: #111111;
  329. }
  330. .right{
  331. height: 100%;
  332. display: flex;
  333. align-items: center;
  334. justify-content: center;
  335. .value{
  336. font-size: 28upx;
  337. font-family: PingFang SC;
  338. color: #999;
  339. margin-right: 10rpx;
  340. }
  341. image{
  342. width: 15upx;
  343. height: 30upx;
  344. }
  345. }
  346. }
  347. .patient{
  348. display: flex;
  349. align-items: center;
  350. justify-content: space-between;
  351. height: 110upx;
  352. .left{
  353. .name{
  354. font-size: 30upx;
  355. line-height: 1;
  356. font-family: PingFang SC;
  357. font-weight: bold;
  358. color: #111111;
  359. }
  360. .info{
  361. margin-top: 30rpx;
  362. display: flex;
  363. align-items: center;
  364. .text{
  365. font-size: 26upx;
  366. font-family: PingFang SC;
  367. line-height: 1;
  368. font-weight: 500;
  369. color: #999;
  370. margin-right: 19upx;
  371. }
  372. }
  373. }
  374. .right{
  375. display: flex;
  376. align-items: center;
  377. image{
  378. width: 15upx;
  379. height: 30upx;
  380. }
  381. }
  382. }
  383. }
  384. }
  385. .btn-box{
  386. height: 140upx;
  387. z-index: 9999;
  388. width: 100%;
  389. padding: 0rpx 30upx;
  390. position: fixed;
  391. bottom: 0;
  392. left: 0;
  393. box-sizing: border-box;
  394. background-color: #ffffff;
  395. display: flex;
  396. align-items: center;
  397. justify-content: center;
  398. .btn{
  399. width: 100%;
  400. height: 88upx;
  401. line-height: 88upx;
  402. text-align: center;
  403. font-size: 34upx;
  404. font-family: PingFang SC;
  405. font-weight: 400;
  406. color: #FFFFFF;
  407. background: #FF5C03;
  408. border-radius: 10upx;
  409. }
  410. }
  411. </style>