ConsultationDetails.vue 8.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342
  1. <template>
  2. <view>
  3. <u-alert type="warning" :description='description'></u-alert>
  4. <view class="p20 column">
  5. <view class="bg-white p30 radius16">
  6. <view class="justify-between align-center">
  7. <view class="bold">咨询人<text class="color-price">*</text></view>
  8. <view class="justify-start align-center">
  9. <image src="/static/images/health/add_modify.png" class="w24 h24"></image>
  10. <view class="fs24 ml8">添加/修改</view>
  11. </view>
  12. </view>
  13. <scroll-view :scroll-x="true" class="peoplebox">
  14. <view class="scroll-content ">
  15. <view v-for="(item,index) in peoplelist" :key="index" @click="actpeople(item,index)"
  16. :class="actitem==index?'act-box':'noact-box'" class="item-list ">
  17. <image :src="item.sex=='男'?maleurl:famaleurl" class="w72 h72 radius36 "></image>
  18. <view class="ml12">
  19. <view class="fs26 bold">{{item.name}}</view>
  20. <view class="justify-start align-center color-text2 fs24">
  21. <text>{{item.sex}}</text>
  22. <text class="ml4">{{item.age}}岁</text>
  23. </view>
  24. </view>
  25. </view>
  26. </view>
  27. </scroll-view>
  28. <view class="justify-start align-center center ptb20" v-if="peoplelist.length==0">
  29. <u-icon name="plus-circle"></u-icon>
  30. <text class="fs28 color-text1">用药人列表为空,请添加</text>
  31. </view>
  32. </view>
  33. <view class="bg-white p30 radius16 mt30">
  34. <view class="bold">您最想咨询的问题是什么<text class="color-price">*</text></view>
  35. <view class="textinput">
  36. <textarea auto-height maxlength='500' placeholder="请输入内容" :value='consulting' @input='lookvalue'/>
  37. </view>
  38. <view class="justify-between align-center">
  39. <image src="/static/images/health/voice_icon.png" class="w48 h48"></image>
  40. <text class="fs24 color-text1">{{consultingNum}}/500</text>
  41. </view>
  42. </view>
  43. <view class="bg-white p30 radius16 mt30">
  44. <view class="bold">此次病情是否去线下就诊过<text class="color-price">*</text></view>
  45. <view class="justify-start align-center mt20">
  46. <view v-for="(item,index) in seedoctor" :key="index" :class="actsee==index?'bg-color color-white':'bg-light'"
  47. @click="selectsee(item,index)" class="ptb20 plr30 mr20 radius12" >{{item.name}}</view>
  48. </view>
  49. </view>
  50. <view class="bg-white p30 radius16 mt30">
  51. <view class="bold">上传检测报告或患处照片<text class="color-price">*</text></view>
  52. <view class="justify-start align-center mt20">
  53. <view v-for="(item,index) in imgList" :key="index" @tap="viewImage" :data-url="imgList[index]"
  54. class="img-box justify-start align-center mr20">
  55. <image :src="item" class="w120 h120 radius8 " mode="aspectFill" @click="showImg(item)"></image>
  56. <image class="close-img" src="@/static/images/close32.png" mode="" @tap.stop="delImg" :data-index="index"></image>
  57. </view>
  58. <view class="column align-center bg-light w120 h120 radius8 center" @tap="chooseImage" v-if="imgList.length<4" >
  59. <u-icon name="plus" ></u-icon>
  60. <view class="fs24">上传报告</view>
  61. </view>
  62. </view>
  63. <view class="justify-between fs24 color-text1 mt20">
  64. <view>最多上传4张图片</view>
  65. <view><text>{{imgList.length}}</text>/4</view>
  66. </view>
  67. </view>
  68. <view class="h200"></view>
  69. </view>
  70. <view class="footer center">
  71. <view class="bg-color radius44 color-white h88 lh88 center" style="width: 90%;"
  72. @click="submit">生成方案</view>
  73. </view>
  74. </view>
  75. </template>
  76. <script>
  77. import {getuserlist,submitconsult} from '@/api/health.js'
  78. export default {
  79. data() {
  80. return {
  81. description:'为了您的健康,请认真填写以下内容,以便药师为您更好的分析,提供患有针对性的解决方案!',
  82. peoplelist:[
  83. {
  84. name:'任继峰',
  85. sex:'男',
  86. age:'55',
  87. id:0
  88. },
  89. {
  90. name:'任继峰',
  91. sex:'男',
  92. age:'55',
  93. id:1
  94. },
  95. {
  96. name:'朱丽君',
  97. sex:'女',
  98. age:'55',
  99. id:2
  100. },
  101. {
  102. name:'朱丽君',
  103. sex:'女',
  104. age:'55',
  105. id:3
  106. }
  107. ],
  108. famaleurl:"/static/images/health/female_profile.png",
  109. maleurl:"/static/images/health/male_profile.png",
  110. actitem:null,
  111. userid:null,
  112. consulting:null,
  113. consultingNum:0,
  114. seedoctor:[
  115. {
  116. name:'就诊过',
  117. value:0
  118. },
  119. {
  120. name:'未就诊',
  121. value:1
  122. }
  123. ],
  124. actsee:null,
  125. imgList:[],
  126. photos:[]
  127. }
  128. },
  129. methods: {
  130. // 选择上传的图片
  131. chooseImage() {
  132. console.log('图片')
  133. var that = this;
  134. uni.showActionSheet({
  135. itemList: ['相册', '拍照'],
  136. success: function(res) {
  137. if (res.tapIndex == 0) {
  138. //从相册选择
  139. that.chooseImageFunction('album')
  140. } else if (res.tapIndex == 1) {
  141. //拍照
  142. that.chooseImageFunction('camera')
  143. }
  144. },
  145. fail: function(res) {
  146. }
  147. });
  148. },
  149. chooseImageFunction: function(type) {
  150. var that = this;
  151. uni.chooseImage({
  152. count: 4, // 默认9
  153. sizeType: ['compressed'], //可以指定是原图还是压缩图,默认二者都有
  154. sourceType: [type],
  155. success: (res) => {
  156. uni.uploadFile({
  157. url: uni.getStorageSync('requestPath')+'/app/common/uploadOSS', //仅为示例,非真实的接口地址
  158. filePath: res.tempFilePaths[0],
  159. name: 'file',
  160. formData: {
  161. 'user': 'test' // 上传附带参数
  162. },
  163. success: (uploadFileRes) => {
  164. // 根据接口具体返回格式 赋值具体对应url
  165. if (this.imgList.length != 0) {
  166. this.imgList = this.imgList.concat(res.tempFilePaths)
  167. } else {
  168. this.imgList = res.tempFilePaths
  169. }
  170. this.photos = this.photos.concat(JSON.parse(uploadFileRes.data).url)
  171. }
  172. });
  173. }
  174. });
  175. },
  176. // 查看图片
  177. viewImage(e) {
  178. uni.previewImage({
  179. urls: this.imgList,
  180. current: e.currentTarget.dataset.url
  181. });
  182. },
  183. // 删除上传的图片
  184. delImg(e) {
  185. var that = this;
  186. uni.showModal({
  187. title: '提示',
  188. content: '确定要删除照片吗?',
  189. cancelText: '取消',
  190. confirmText: '确定',
  191. success: res => {
  192. if (res.confirm) {
  193. that.imgList.splice(e.currentTarget.dataset.index, 1)
  194. this.photos.splice(e.currentTarget.dataset.index, 1);
  195. }
  196. },
  197. })
  198. },
  199. submit(){
  200. if(this.userid==null){
  201. uni.showToast({
  202. icon:'none',
  203. title:'请选择咨询人!',
  204. });
  205. return
  206. }
  207. if(this.consulting==null){
  208. uni.showToast({
  209. icon:'none',
  210. title:'请输入咨询内容!',
  211. });
  212. return
  213. }
  214. if(this.actsee==null){
  215. uni.showToast({
  216. icon:'none',
  217. title:'请选择是否线下就诊过!',
  218. });
  219. return
  220. }
  221. if(this.actsee==0){
  222. if(this.imagelist.length==0){
  223. uni.showToast({
  224. icon:'none',
  225. title:'如果在线下就诊过,请上传检测报告!',
  226. });
  227. return
  228. }
  229. }
  230. const data={
  231. id:this.userid,
  232. doctor:this.actsee,
  233. imgurl:this.imagelist
  234. }
  235. submitconsult().then(res=>{
  236. if(res.code==200){
  237. uni.showToast({
  238. icon:'none',
  239. title:'提交成功',
  240. });
  241. }else{
  242. uni.showToast({
  243. icon:'none',
  244. title:res.msg,
  245. });
  246. }
  247. })
  248. },
  249. actpeople(item,index){
  250. this.actitem=index
  251. this.userid=item.id
  252. },
  253. lookvalue(e){
  254. this.consulting=e.detail.value
  255. this.consultingNum=e.detail.cursor
  256. if(this.consultingNum==500){
  257. uni.showToast({
  258. icon:'none',
  259. title:'最大输入500字符!',
  260. });
  261. }
  262. },
  263. selectsee(item,index){
  264. this.actsee=item.value
  265. },
  266. showImg(img) {
  267. if(img!=null){
  268. var imgs=[];
  269. imgs.push(img)
  270. //预览图片
  271. uni.previewImage({
  272. urls: imgs,
  273. current: imgs[0]
  274. });
  275. }
  276. else{
  277. //预览图片
  278. uni.previewImage({
  279. urls: this.imagelist,
  280. current: this.imagelist[0]
  281. });
  282. }
  283. },
  284. }
  285. }
  286. </script>
  287. <style scoped lang="scss">
  288. .peoplebox{
  289. white-space: nowrap;
  290. margin-top: 30rpx;
  291. ::-webkit-scrollbar {
  292. display: none;
  293. }
  294. .scroll-content{
  295. display: flex;
  296. flex-wrap: nowrap;
  297. }
  298. .item-list{
  299. padding: 20rpx 28rpx;
  300. width: fit-content;
  301. display: flex;
  302. justify-content: start;
  303. border-radius: 12rpx;
  304. margin-right: 20rpx;
  305. }
  306. .noact-box{
  307. background-color: #F5F7FA;
  308. }
  309. .act-box{
  310. background-color: #F0FAFF;
  311. border: 2rpx solid #008FD3;
  312. }
  313. }
  314. .img-box{
  315. position: relative;
  316. }
  317. .close-img{
  318. width: 32upx;
  319. height: 32upx;
  320. position: absolute;
  321. top:2upx;
  322. right: 2upx;
  323. }
  324. .textinput{
  325. margin-top: 30rpx;
  326. height:200rpx;
  327. overflow-y: scroll;
  328. }
  329. .footer{
  330. padding: 40rpx 0;
  331. width: 100%;
  332. position: fixed;
  333. bottom: 0;
  334. background-color: #fff;
  335. }
  336. </style>