123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452 |
- <template>
- <view class="content">
- <view class="inner">
- <!-- 选择问诊人 -->
- <view class="chose-people">
- <view class="title-box">
- <text class="title">选择问诊人</text>
- <view class="add-box">
- <image src="@/static/images/add26.png" mode=""></image>
- <text @click="addPeople">添加</text>
- </view>
- </view>
- <view class="peop-list">
- <view v-for="(item,index) in patient" :key="index" :class="patientId == item.patientId?'item active':'item'" @click="chosePatient(item)">
- <view class="name">{{ item.patientName }}</view>
- <view class="info">
- <text class="sex" v-if="item.gender==1">男</text>
- <text class="sex" v-if="item.gender==2">女</text>
- <text class="ege">{{utils.getAge(item.birthday)}}岁</text>
- </view>
- <!-- 选中的对号角标 -->
- <image v-if="patientId == item.patientId" class="active-img" src="@/static/images/sel_right50.png" mode=""></image>
- </view>
- </view>
- </view>
- <!-- 病情描述 -->
- <view class="desc">
- <textarea
- v-model="remark"
- placeholder="请描述您的病情..."
- placeholder-style="color:#999999;font-size:30rpx;"
- />
- <!-- 上传图片描述 -->
- <view class="upload-des">
- <view class="label-box">
- <text class="black">上传疾病部位照片</text>
- <text class="gray">(选填)</text>
- </view>
- <view class="num-box">
- <text class="black">{{ imgList.length }}</text>
- <text class="gray">/3</text>
- </view>
- </view>
- <!-- 多图上传 -->
- <view class="upload-box">
- <!-- 上传的图片列表 -->
- <view class="img-item" v-for="(item,index) in imgList" :key="index" @tap="viewImage" :data-url="imgList[index]">
- <image class="img" :src="item" mode="aspectFill"></image>
- <image class="close-img" src="@/static/images/close32.png" mode="" @tap.stop="delImg" :data-index="index"></image>
- </view>
- <!-- 上传图片按钮 -->
- <view class="uoload-btn" @tap="chooseImage" v-if="imgList.length<3">
- <image src="@/static/images/photo.png" mode=""></image>
- <text>上传照片</text>
- </view>
- </view>
- </view>
-
- </view>
- <view class="btn-box">
- <view class="btn" @click="submitOrder()">发布问诊</view>
- </view>
- </view>
- </template>
- <script>
- import {getPatientList} from '@/api/patient'
- import {uploadOSS} from '@/api/common.js'
- import {create} from '@/api/doctorOrder.js'
- export default {
- data() {
- return {
- patient:[],
- patientId:null,
- priceId:null,
- doctorId:null,
- remark:"",
- // 选择上传的图片
- imgList: [],
- photos:[],
-
- };
- },
- onLoad(option) {
- this.doctorId=option.doctorId;
- this.priceId=option.priceId;
- this.getPatientList();
- uni.$on('refreshPatient', () => {
- this.getPatientList()
- })
- },
- methods:{
- getPatientList(){
- uni.showLoading({
- title:"正在加载中"
- })
- getPatientList().then(
- res => {
- uni.hideLoading()
- if(res.code==200){
- this.patient=res.data;
- }else{
- uni.showToast({
- icon:'none',
- title: "请求失败",
- });
- }
- },
- rej => {}
- );
- },
- // 选中问诊人
- chosePatient(item) {
- this.patientId = item.patientId
- },
- // 添加问诊人
- addPeople() {
- uni.navigateTo({
- url:"pages_user/user/addPatient?type=add"
- })
- },
-
- // 选择上传的图片
- chooseImage() {
- var that = this;
- uni.showActionSheet({
- itemList: ['相册', '拍照'],
- success: function(res) {
- if (res.tapIndex == 0) {
- //从相册选择
- that.chooseImageFunction('album')
- } else if (res.tapIndex == 1) {
- //拍照
- that.chooseImageFunction('camera')
- }
- },
- fail: function(res) {
-
- }
- });
- },
- chooseImageFunction: function(type) {
- var that = this;
- uni.chooseImage({
- count: 3, // 默认9
- sizeType: ['compressed'], //可以指定是原图还是压缩图,默认二者都有
- sourceType: [type],
- success: (res) => {
- uni.uploadFile({
- url: uni.getStorageSync('requestPath')+'/app/common/uploadOSS', //仅为示例,非真实的接口地址
- filePath: res.tempFilePaths[0],
- name: 'file',
- formData: {
- 'user': 'test' // 上传附带参数
- },
- success: (uploadFileRes) => {
- // 根据接口具体返回格式 赋值具体对应url
- if (this.imgList.length != 0) {
- this.imgList = this.imgList.concat(res.tempFilePaths)
- } else {
- this.imgList = res.tempFilePaths
-
- }
-
- this.photos = this.photos.concat(JSON.parse(uploadFileRes.data).url)
- }
- });
-
- }
- });
- },
- // 查看图片
- viewImage(e) {
- uni.previewImage({
- urls: this.imgList,
- current: e.currentTarget.dataset.url
- });
- },
- // 删除上传的图片
- delImg(e) {
- var that = this;
- uni.showModal({
- title: '提示',
- content: '确定要删除照片吗?',
- cancelText: '取消',
- confirmText: '确定',
- success: res => {
- if (res.confirm) {
- that.imgList.splice(e.currentTarget.dataset.index, 1)
- this.photos.splice(e.currentTarget.dataset.index, 1);
- }
- },
- })
- },
- submitOrder() {
- if(this.remark==""){
- uni.showToast({
- icon:'none',
- title: '请输入描述信息',
- });
- return;
- }
- if(this.patientId==null){
- uni.showToast({
- icon:'none',
- title: '请选择患者',
- });
- return;
- }
- let data = {patientId:this.patientId,title:this.remark,doctorId:this.doctorId,priceId:this.priceId,imgs:this.photos.toString()};
- create(data).then(
- res => {
- if(res.code==200){
- setTimeout(function(){
- uni.redirectTo({
- url: './paymentOrder?orderId='+res.order.orderId
- })
- },200);
- return;
- }
- else{
- uni.showToast({
- icon:'none',
- title: res.msg,
- });
- }
- },
- rej => {}
- );
-
- },
- }
- }
- </script>
- <style lang="scss">
- page{
- height: 100%;
- }
- .content{
- height: 100%;
- display: flex;
- flex-direction: column;
- justify-content: space-between;
- .inner{
- flex: 1;
- padding: 20upx;
- box-sizing: border-box;
- .chose-people{
- box-sizing: border-box;
- min-height: 247upx;
- background: #FFFFFF;
- border-radius: 16upx;
- padding: 40upx 30upx 30upx;
- .title-box{
- display: flex;
- align-items: center;
- justify-content: space-between;
- .title{
- font-size: 32upx;
- font-family: PingFang SC;
- font-weight: bold;
- color: #111111;
- }
- .add-box{
- display: flex;
- align-items: center;
- image{
- width: 26upx;
- height: 26upx;
- margin-right: 11upx;
- }
- text{
- font-size: 28upx;
- font-family: PingFang SC;
- font-weight: 500;
- color: #111111;
- }
- }
- }
- .peop-list{
- display: flex;
- flex-wrap: wrap;
- margin-top: 30upx;
- .item{
- box-sizing: border-box;
- padding: 18upx 30upx;
- width: 31.28%;
- height: 110upx;
- background: #F7F7F7;
- border-radius: 16upx;
- margin: 0 20upx 10upx 0;
- border: 2upx solid #F7F7F7;
- display: flex;
- flex-direction: column;
- justify-content: space-between;
- &:nth-child(3n){
- margin-right: 0;
- }
- &.active{
- background: rgba(230, 250, 247, 0);
- border: 2upx solid #018C39;
- position: relative;
- }
- .active-img{
- width: 50upx;
- height: 50upx;
- position: absolute;
- right: -2upx;
- bottom: -2upx;
- }
- .name{
- font-size: 30upx;
- line-height: 1;
- font-family: PingFang SC;
- font-weight: bold;
- color: #111111;
- }
- .info{
- display: flex;
- align-items: center;
- .sex,
- .ege{
- font-size: 26upx;
- font-family: PingFang SC;
- line-height: 1;
- font-weight: 500;
- color: #666666;
- }
- .ege{
- margin-left: 19upx;
- }
- }
- }
- }
- }
- .desc{
- box-sizing: border-box;
- height: 619upx;
- background: #FFFFFF;
- border-radius: 16upx;
- margin-top: 20upx;
- padding: 40upx 30upx;
- textarea{
- width: 100%;
- height: 280upx;
- }
- }
- .upload-des{
- display: flex;
- align-items: center;
- justify-content: space-between;
- padding-top: 40upx;
- border-top: 1px solid #F0F0F0;
- .label-box{
- display: flex;
- align-items: center;
- .black{
- font-size: 28upx;
- font-family: PingFang SC;
- font-weight: bold;
- color: #111111;
- }
- .gray{
- font-size: 28upx;
- font-family: PingFang SC;
- color: #999999;
- }
- }
- .num-box{
- display: flex;
- align-items: center;
- .black{
- font-size: 24upx;
- font-family: PingFang SC;
- color: #111111;
- }
- .gray{
- font-size: 24upx;
- font-family: PingFang SC;
- color: #999999;
- }
- }
- }
- .upload-box{
- display: flex;
- flex-wrap: wrap;
- padding-top: 30upx;
- .img-item{
- width: 160upx;
- height: 160upx;
- border-radius: 16upx;
- overflow: hidden;
- position: relative;
- margin-right: 20upx;
- .img{
- width: 100%;
- height: 100%;
- }
- .close-img{
- width: 32upx;
- height: 32upx;
- position: absolute;
- top: 4upx;
- right: 4upx;
- }
- }
- .uoload-btn{
- width: 160upx;
- height: 160upx;
- background: #F7F7F7;
- border-radius: 16upx;
- display: flex;
- flex-direction: column;
- align-items: center;
- justify-content: center;
- image{
- width: 40upx;
- height: 32upx;
- margin-bottom: 16upx;
- }
- text{
- font-size: 22upx;
- font-family: PingFang SC;
- font-weight: 500;
- color: #666666;
- line-height: 1;
- }
- }
- }
- }
- .btn-box{
- height: 121upx;
- background: #FFFFFF;
- display: flex;
- align-items: center;
- justify-content: center;
- .btn{
- width: 91.73%;
- height: 88upx;
- line-height: 88upx;
- font-size: 30upx;
- font-family: PingFang SC;
- font-weight: bold;
- color: #FFFFFF;
- text-align: center;
- background: #018C39;
- border-radius: 44upx;
- }
- }
- }
- </style>
|