nurseWeChatAppletUI/pages/goodsorderRate/goodsorderRate.vue

160 lines
3.4 KiB
Vue

<template>
<view class='app'>
<view class="rate">
<view class="images">
<view class="itemimgs" v-for="(item,index) in file">
<image class="delimg" src="../../static/gb2.png" mode="" style="color: red;"></image>
<image class="itemimg" :src="item" mode=""></image>
</view>
<view class="shot item" @tap='updataImage'>
<image src="../../static/paishe.png" mode=""></image>
<view class="title">
拍摄
</view>
</view>
<!-- <view class="videotape item">
<image src="../../static/video.png" mode=""></image>
<view class="title">
录像
</view>
</view> -->
</view>
</view>
<view class="score">
<view class="title">
综合评分
</view>
<u-rate :count="count" v-model="countvalue" size='46'></u-rate>
<view class="text">
<u-input v-model="text" type="textarea" :clearable='false' />
</view>
</view>
<view class="updata" @tap='updata'>
提交评价
</view>
<u-toast ref="uToast" />
</view>
</template>
<script>
import baseurl from '@/api/baseurl.js'
import {
insertGoodsEvaluate,
uploadEvaluatePictureUrl
} from '@/api/goodsorderRate/index.js'
export default {
data() {
return {
orderlist: {},
count: 5,
countvalue: 0,
text: '',
baseurl: null,
file: [],
imgs: [],
patientId: null,
openid: null,
timer:null,
};
},
methods: {
async updata() {
let that = this
this.file.forEach(e => {
uni.uploadFile({
url: baseurl + '/nurseApp/orderEvaluate/uploadEvaluatePictureUrl',
filePath: e,
name: 'file',
formData: {
'orderNo': that.orderlist.goOrderNo
},
timeout: 5000,
header: {
'Content-type': 'application/json;charset=utf-8'
},
success(res) {
var img = {
evaluatePictureUrl: JSON.parse(res.data).imgUrl
}
that.imgs.push(img)
if (that.imgs.length == that.file.length) {
that.info();
}
}
})
})
},
info() {
var that = this
var obj = {
"patientId": that.patientId,
"openid": that.openid,
"orderNo": that.orderlist.goOrderNo,
"evaluateChannel": "WE_CHAT_APPLET",
"evaluateContent": that.text,
"compositeScore": that.countvalue,
"orderEvaluatePictureInfoList": that.imgs
}
insertGoodsEvaluate(obj).then(res => {
if (res.code == 200) {
that.$refs.uToast.show({
title: '评价成功',
type: 'success',
duration: '1500'
})
if (that.timer) {
clearTimeout(that.timer)
}
that.timer = setTimeout(e => {
that.imgs = []
uni.navigateBack({
delta: 1
})
}, 1500)
} else {
that.imgs = []
}
})
},
updataImage() {
var that = this;
uni.chooseImage({
count: 9,
success(res) {
res.tempFilePaths.forEach(e => {
that.file.push(e)
})
}
})
},
},
onLoad(options) {
this.orderlist = JSON.parse(options.item)
},
onShow() {
this.baseurl = baseurl
var that = this
try {
const value = uni.getStorageSync('openid');
if (value) {
that.openid = value
} else {}
} catch (e) {}
try {
const value = uni.getStorageSync('patientId');
if (value) {
that.patientId = value
} else {}
} catch (e) {}
},
}
</script>
<style lang="scss">
@import './goodsorderRate.scss';
</style>