inquiryForm3.vue 9.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436
  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="https://bjyjb-1362704775.cos.ap-chongqing.myqcloud.com/shop/image/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="https://bjyjb-1362704775.cos.ap-chongqing.myqcloud.com/shop/image/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. :fileList="fileList1"
  74. @afterRead="afterRead"
  75. @delete="deletePic"
  76. name="1"
  77. :maxCount="5"
  78. ></u-upload>
  79. </view>
  80. </view>
  81. </view>
  82. <view class="btn-box">
  83. <view class="btn" @click="submitOrder()">提交订单</view>
  84. </view>
  85. </view>
  86. </template>
  87. <script>
  88. import {create,confirm} from '@/api/inquiryOrder.js'
  89. export default {
  90. data() {
  91. return {
  92. companyId:null,
  93. companyUserId:null,
  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. if(!this.$isEmpty(options.companyId)){
  134. this.companyId=options.companyId
  135. }
  136. if(!this.$isEmpty(options.companyUserId)){
  137. this.companyUserId=options.companyUserId
  138. }
  139. this.inquiryType=options.inquiryType;
  140. this.orderType=options.orderType;
  141. this.doctorId=options.doctorId;
  142. console.log(this.inquiryType)
  143. console.log(this.orderType)
  144. console.log(this.doctorId)
  145. this.confirm();
  146. },
  147. onShow() {
  148. var that=this;
  149. uni.$on('refreshOrderPatient', (res) => {
  150. that.patient=res
  151. })
  152. },
  153. methods: {
  154. submitOrder(){
  155. if(this.patient==null){
  156. uni.showToast({
  157. icon:'none',
  158. title: '请选择就诊人',
  159. });
  160. return;
  161. }
  162. if(this.isVisit=='未就诊'){
  163. uni.showToast({
  164. icon:'none',
  165. title: '仅支持复诊',
  166. });
  167. return;
  168. }
  169. var images=[];
  170. this.fileList1.forEach(function(element) {
  171. images.push(element.url)
  172. });
  173. var data={
  174. companyId:this.companyId,
  175. companyUserId:this.companyUserId,
  176. orderKey:this.orderKey,
  177. patientId:this.patient.patientId,
  178. title:this.title,
  179. isVisit:this.isVisit,
  180. duration:this.duration,
  181. inquiryType:this.inquiryType,
  182. orderType:this.orderType,
  183. doctorId:this.doctorId,
  184. reportImages:images.toString()
  185. }
  186. uni.showLoading({
  187. title: '正在处理中...'
  188. });
  189. create(data).then(
  190. res => {
  191. if(res.code==200){
  192. var temps=['YyaBF62vH1GPKY0tume8C2C5UETxcKrVsaTKdBW5eok']
  193. uni.requestSubscribeMessage({
  194. tmplIds: temps,
  195. success(e) {
  196. setTimeout(function(){
  197. uni.redirectTo({
  198. url: './inquiryPay?orderId='+res.order.orderId
  199. })
  200. },200);
  201. },
  202. fail(e) {
  203. setTimeout(function(){
  204. uni.redirectTo({
  205. url: './inquiryPay?orderId='+res.order.orderId
  206. })
  207. },200);
  208. }
  209. })
  210. return;
  211. }
  212. else{
  213. uni.showToast({
  214. icon:'none',
  215. title: res.msg,
  216. });
  217. }
  218. },
  219. rej => {}
  220. );
  221. },
  222. confirm(){
  223. let data = {};
  224. confirm(data).then(
  225. res => {
  226. if(res.code==200){
  227. this.orderKey=res.orderKey
  228. }
  229. },
  230. rej => {}
  231. );
  232. },
  233. addPatient(){
  234. uni.navigateTo({
  235. url: '/pages_user/patient'
  236. })
  237. },
  238. deletePic(event) {
  239. this[`fileList${event.name}`].splice(event.index, 1)
  240. },
  241. async afterRead(event) {
  242. // 当设置 multiple 为 true 时, file 为数组格式,否则为对象格式
  243. let lists = [].concat(event.file)
  244. let fileListLen = this[`fileList${event.name}`].length
  245. lists.map((item) => {
  246. this[`fileList${event.name}`].push({
  247. ...item,
  248. status: 'uploading',
  249. message: '上传中'
  250. })
  251. })
  252. for (let i = 0; i < lists.length; i++) {
  253. const result = await this.uploadFilePromise(lists[i].url)
  254. let item = this[`fileList${event.name}`][fileListLen]
  255. this[`fileList${event.name}`].splice(fileListLen, 1, Object.assign(item, {
  256. status: 'success',
  257. message: '',
  258. url: result
  259. }))
  260. fileListLen++
  261. }
  262. },
  263. uploadFilePromise(url) {
  264. return new Promise((resolve, reject) => {
  265. let a = uni.uploadFile({
  266. url: uni.getStorageSync('requestPath')+'/app/common/uploadOSS', // 仅为示例,非真实的接口地址
  267. filePath: url,
  268. name: 'file',
  269. formData: {
  270. user: 'test'
  271. },
  272. success: (res) => {
  273. setTimeout(() => {
  274. console.log(JSON.parse(res.data).url)
  275. resolve(JSON.parse(res.data).url)
  276. }, 1000)
  277. }
  278. });
  279. })
  280. },
  281. }
  282. }
  283. </script>
  284. <style lang="scss">
  285. page{
  286. background: #f1f6fc;
  287. }
  288. </style>
  289. <style scoped lang="scss">
  290. .main{
  291. position: relative;
  292. padding-bottom: 140upx;
  293. .cont{
  294. margin: 15rpx;
  295. padding: 30rpx;
  296. box-shadow: 0px 0px 5px 2px rgba(0,0,0,0.05);
  297. background-color: #fff;
  298. border-radius: 15rpx;
  299. .title-box{
  300. display: flex;
  301. flex-direction: row;
  302. align-items: center;
  303. justify-content: flex-start;
  304. .title{
  305. font-size: 32upx;
  306. font-family: PingFang SC;
  307. font-weight: bold;
  308. color: #111111;
  309. }
  310. .line{
  311. margin-right: 15rpx;
  312. height: 30rpx;
  313. width: 6rpx;
  314. background-color: #2583EB;
  315. }
  316. .red-dot{
  317. margin-right: 5rpx;
  318. color:red;
  319. }
  320. }
  321. }
  322. .chose-patient{
  323. margin: 15rpx;
  324. padding: 30rpx 40rpx;
  325. box-shadow: 0px 0px 5px 2px rgba(0,0,0,0.05);
  326. background-color: #fff;
  327. border-radius: 15rpx;
  328. .title-box{
  329. display: flex;
  330. align-items: center;
  331. justify-content: space-between;
  332. .title{
  333. font-size: 32upx;
  334. font-family: PingFang SC;
  335. font-weight: bold;
  336. color: #111111;
  337. }
  338. .right{
  339. height: 100%;
  340. display: flex;
  341. align-items: center;
  342. justify-content: center;
  343. .value{
  344. font-size: 28upx;
  345. font-family: PingFang SC;
  346. color: #999;
  347. margin-right: 10rpx;
  348. }
  349. image{
  350. width: 15upx;
  351. height: 30upx;
  352. }
  353. }
  354. }
  355. .patient{
  356. display: flex;
  357. align-items: center;
  358. justify-content: space-between;
  359. height: 110upx;
  360. .left{
  361. .name{
  362. font-size: 30upx;
  363. line-height: 1;
  364. font-family: PingFang SC;
  365. font-weight: bold;
  366. color: #111111;
  367. }
  368. .info{
  369. margin-top: 30rpx;
  370. display: flex;
  371. align-items: center;
  372. .text{
  373. font-size: 26upx;
  374. font-family: PingFang SC;
  375. line-height: 1;
  376. font-weight: 500;
  377. color: #999;
  378. margin-right: 19upx;
  379. }
  380. }
  381. }
  382. .right{
  383. display: flex;
  384. align-items: center;
  385. image{
  386. width: 15upx;
  387. height: 30upx;
  388. }
  389. }
  390. }
  391. }
  392. }
  393. .btn-box{
  394. height: 140upx;
  395. z-index: 9999;
  396. width: 100%;
  397. padding: 0rpx 30upx;
  398. position: fixed;
  399. bottom: 0;
  400. left: 0;
  401. box-sizing: border-box;
  402. background-color: #ffffff;
  403. display: flex;
  404. align-items: center;
  405. justify-content: center;
  406. .btn{
  407. width: 100%;
  408. height: 88upx;
  409. line-height: 88upx;
  410. text-align: center;
  411. font-size: 34upx;
  412. font-family: PingFang SC;
  413. font-weight: 400;
  414. color: #FFFFFF;
  415. background: #2583EB;
  416. border-radius: 10upx;
  417. }
  418. }
  419. </style>