inquiryForm1.vue 11 KB

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