inquiryForm1.vue 10 KB

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