inquiryForm3.vue 9.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437
  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="#C39A58"
  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="#C39A58"
  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
  136. }
  137. if(!this.$isEmpty(options.companyUserId)){
  138. this.companyUserId=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. reportImages:images.toString()
  186. }
  187. uni.showLoading({
  188. title: '正在处理中...'
  189. });
  190. create(data).then(
  191. res => {
  192. if(res.code==200){
  193. var temps=['YyaBF62vH1GPKY0tume8C2C5UETxcKrVsaTKdBW5eok']
  194. uni.requestSubscribeMessage({
  195. tmplIds: temps,
  196. success(e) {
  197. setTimeout(function(){
  198. uni.redirectTo({
  199. url: './inquiryPay?orderId='+res.order.orderId
  200. })
  201. },200);
  202. },
  203. fail(e) {
  204. setTimeout(function(){
  205. uni.redirectTo({
  206. url: './inquiryPay?orderId='+res.order.orderId
  207. })
  208. },200);
  209. }
  210. })
  211. return;
  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. .main{
  292. position: relative;
  293. padding-bottom: 140upx;
  294. .cont{
  295. margin: 15rpx;
  296. padding: 30rpx;
  297. box-shadow: 0px 0px 5px 2px rgba(0,0,0,0.05);
  298. background-color: #fff;
  299. border-radius: 15rpx;
  300. .title-box{
  301. display: flex;
  302. flex-direction: row;
  303. align-items: center;
  304. justify-content: flex-start;
  305. .title{
  306. font-size: 32upx;
  307. font-family: PingFang SC;
  308. font-weight: bold;
  309. color: #111111;
  310. }
  311. .line{
  312. margin-right: 15rpx;
  313. height: 30rpx;
  314. width: 6rpx;
  315. background-color: #C39A58;
  316. }
  317. .red-dot{
  318. margin-right: 5rpx;
  319. color:red;
  320. }
  321. }
  322. }
  323. .chose-patient{
  324. margin: 15rpx;
  325. padding: 30rpx 40rpx;
  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. align-items: center;
  332. justify-content: space-between;
  333. .title{
  334. font-size: 32upx;
  335. font-family: PingFang SC;
  336. font-weight: bold;
  337. color: #111111;
  338. }
  339. .right{
  340. height: 100%;
  341. display: flex;
  342. align-items: center;
  343. justify-content: center;
  344. .value{
  345. font-size: 28upx;
  346. font-family: PingFang SC;
  347. color: #999;
  348. margin-right: 10rpx;
  349. }
  350. image{
  351. width: 15upx;
  352. height: 30upx;
  353. }
  354. }
  355. }
  356. .patient{
  357. display: flex;
  358. align-items: center;
  359. justify-content: space-between;
  360. height: 110upx;
  361. .left{
  362. .name{
  363. font-size: 30upx;
  364. line-height: 1;
  365. font-family: PingFang SC;
  366. font-weight: bold;
  367. color: #111111;
  368. }
  369. .info{
  370. margin-top: 30rpx;
  371. display: flex;
  372. align-items: center;
  373. .text{
  374. font-size: 26upx;
  375. font-family: PingFang SC;
  376. line-height: 1;
  377. font-weight: 500;
  378. color: #999;
  379. margin-right: 19upx;
  380. }
  381. }
  382. }
  383. .right{
  384. display: flex;
  385. align-items: center;
  386. image{
  387. width: 15upx;
  388. height: 30upx;
  389. }
  390. }
  391. }
  392. }
  393. }
  394. .btn-box{
  395. height: 140upx;
  396. z-index: 9999;
  397. width: 100%;
  398. padding: 0rpx 30upx;
  399. position: fixed;
  400. bottom: 0;
  401. left: 0;
  402. box-sizing: border-box;
  403. background-color: #ffffff;
  404. display: flex;
  405. align-items: center;
  406. justify-content: center;
  407. .btn{
  408. width: 100%;
  409. height: 88upx;
  410. line-height: 88upx;
  411. text-align: center;
  412. font-size: 34upx;
  413. font-family: PingFang SC;
  414. font-weight: 400;
  415. color: #FFFFFF;
  416. background: #C39A58;
  417. border-radius: 10upx;
  418. }
  419. }
  420. </style>