123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351 |
- <template>
- <view class="cf-appraise">
- <pub-loading-view :loaded="loaded" height="100%">
- <view class="cf-appraise-section" v-if="info">
- <view class="cf-appraise-top-section">
- <view class="cf-appraise-top">
- <view class="cf-appraise-top-title">“中医用药一件事”满意度调查</view>
- <view class="cf-appraise-top-comprehensive">
- <view class="appraise-star-title">综合评价</view>
- <view class="cf-appraise-top-comprehensive-item" :class="info.comprehensiveVal==1?'is-active':''"
- @click="onClickComprehensive(1)">
- <text class="iconfont"></text>差评
- </view>
- <view class="cf-appraise-top-comprehensive-item" :class="info.comprehensiveVal==2?'is-active':''"
- @click="onClickComprehensive(2)">
- <text class="iconfont"></text>中评
- </view>
- <view class="cf-appraise-top-comprehensive-item" :class="info.comprehensiveVal==3?'is-active':''"
- @click="onClickComprehensive(3)">
- <text class="iconfont"></text>好评
- </view>
- </view>
- <CfAppraiseStar :isEdit="isEdit" title="就医效果" :starText="starText[0]" v-model:starval="info.starVal[0]" />
- <CfAppraiseStar :isEdit="isEdit" title="开方医生" :starText="starText[1]" v-model:starval="info.starVal[1]" />
- <CfAppraiseStar :isEdit="isEdit" title="煎药质量" :starText="starText[2]" v-model:starval="info.starVal[2]" />
- <CfAppraiseStar :isEdit="isEdit" title="物流服务" :starText="starText[3]" v-model:starval="info.starVal[3]" />
- </view>
- <view class="cf-appraise-view" v-if="isEdit">
- <view class="cf-appraise-view-text">{{info.text}}</view>
- <view class="cf-appraise-view-imgs">
- <image mode="heightFix" :src="item" v-for="(item,index) in info.imgList" :item="index" />
- </view>
- </view>
- <view class="cf-appraise-edit" v-else>
- <view class="cf-appraise-edit-textarea">
- <textarea v-model="info.text" class="textarea" :disabled="false" placeholder-style="color:#B3B5B9"
- maxlength="-1" placeholder="展开说说您对“中医用药一件事”的想法吧..." />
- </view>
- <!-- 最多三张 -->
- <view class="picture-item" v-if="true">
- <uni-file-picker class="file-picker" limit="3" :auto-upload="false" :del-icon="true"
- file-extname='png,git,jpeg,pdf,jpg' file-mediatype="image" v-model="fileList" @select="onSelectFile"
- @delete="onDelFile">
- <view class="cf-appraise-edit-add">
- <text class="iconfont"></text>
- </view>
- </uni-file-picker>
- </view>
- <view class="echoPicture" v-else>
- <view v-for="item in fileList" :key="item" class="loop-item">
- <image class="image-sty" :src="item"></image>
- </view>
- </view>
- </view>
- <view class="cf-appraise-anonymous">
- <view class="anonymous-text" @click="updateAnonymity">
- <text class="iconfont" :class="info.anonymous?'is-active':''"></text>匿名评价
- </view>
- </view>
- </view>
- <view class="cf-appraise-btn pub-button is-bg large" v-if="!isEdit" @click="onApply">提交评价</view>
- </view>
- </pub-loading-view>
- </view>
- </template>
- <script lang="ts" setup>
- import { ref, PropType, onMounted } from 'vue'
- import dlg from '@/lib/dlg.ts'
- import rest from '@/stores/rest'
- import CfAppraiseStar from './CfAppraiseStar.vue'
- const props = defineProps({
- ptwybh: {
- type: String,
- default: ""
- },
- isEdit: {
- type: Boolean,
- default: false
- }
- })
- const loaded = ref(false)
- const starText = [
- ['', '无效健康', '较差健康', '一般健康', '基本健康', '完全康复'],
- ['', '非常差', '差', '一般', '好', '非常好'],
- ['', '非常差', '差', '一般', '好', '非常好'],
- ['', '非常差', '差', '一般', '好', '非常好'],
- ]
- const info = ref({
- starVal: [0, 0, 0, 0],
- comprehensiveVal: 1,
- text: '',
- imgList: [],
- anonymous: true
- })
- const fileList = ref([])//用于显示图片列表
- const files = ref([]) //上传post
- // 上传图片
- const onSelectFile = async (res) => {
- console.log("上传", res)
- if (!res.tempFilePaths.length) return;
- uni.showLoading({
- title: '',
- mask: true
- });
- for (var i = 0; i < res.tempFilePaths.length; i++) {
- let uploadedFile = await rest.upload(res.tempFilePaths[i]);
- if (!uploadedFile) {
- dlg.error("上传失败,请重试!");
- uni.hideLoading();
- return;
- }
- files.value.push(uploadedFile);
- }
- uni.hideLoading();
- }
- // 删除图片
- const onDelFile = (val) => {
- if (val.index != -1) {
- files.value.splice(val.index, 1);
- }
- }
- // 修改
- const updateAnonymity = () => {
- info.value.anonymous = !info.value.anonymous
- }
- const onClickComprehensive = (val : number) => {
- info.value.comprehensiveVal = val
- }
- const onApply = async () => {
- const formData = {
- orderId: props.ptwybh,
- zhpj: info.value.comprehensiveVal,
- jyxg: info.value.starVal[0],
- kfys: info.value.starVal[1],
- jyzl: info.value.starVal[2],
- wlfw: info.value.starVal[3],
- content: info.value.text,
- image: info.value.imgList,
- anonymity: info.value.anonymous ? 1 : 0
- }
- let fields = {
- 'orderId': '订单ID不能为空',
- 'zhpj': '综合评价不能为空',
- 'jyxg': '就医效果不能为空',
- 'kfys': '开方医生不能为空',
- 'jyzl': '煎药质量不能为空',
- 'wlfw': '物流服务不能为空'
- };
- for (let key in fields) {
- if (!formData[key]) {
- dlg.error(fields[key]);
- return;
- }
- }
- console.log("processedData", formData, files.value)
- // await rest.post('/zyyp/prescription-evaluate/create',formData)
- dlg.success('操作成功')
- }
- onMounted(() => {
- })
- </script>
- <style lang="scss" scoped>
- .cf-appraise {
- padding: 0 $page-row-spacing;
- height: 100%;
- .cf-appraise-section {
- height: 100%;
- position: relative;
- display: flex;
- flex-direction: column;
- .cf-appraise-top-section {
- flex: 1;
- box-sizing: border-box;
- overflow-y: auto;
- .cf-appraise-top {
- background: #fff;
- padding: $uni-spacing-col-s3 $page-row-spacing;
- border-radius: 8rpx;
- .cf-appraise-top-title {
- text-align: center;
- font-size: $uni-font-size-xl;
- line-height: $uni-line-height-xl;
- font-weight: 600;
- }
- .cf-appraise-top-comprehensive {
- @include flex;
- margin-top: 40rpx;
- .cf-appraise-top-comprehensive-item {
- margin-left: 48rpx;
- @include flex;
- color: $uni-text-color-light;
- .iconfont {
- font-size: 48rpx;
- margin-right: 8rpx;
- background: linear-gradient(180deg, #B3B5B9 0%, #899AB9 100%);
- background-clip: text;
- text-fill-color: transparent;
- -webkit-background-clip: text;
- -webkit-text-fill-color: transparent;
- }
- &:nth-child(2) {
- margin-left: 32rpx;
- }
- &.is-active {
- color: $uni-text-color;
- .iconfont {
- background: linear-gradient(180deg, #FFBD48 0%, $uni-color-orange 100%);
- background-clip: text;
- text-fill-color: transparent;
- -webkit-background-clip: text;
- -webkit-text-fill-color: transparent;
- }
- }
- }
- }
- }
- .cf-appraise-view {
- background: #fff;
- padding: $uni-spacing-col-s2 $uni-spacing-row-s3 $uni-spacing-col-s4;
- border-radius: 8rpx;
- margin-top: 24rpx;
- .cf-appraise-view-imgs {
- margin-top: 16rpx;
- image {
- width: 200rpx;
- height: 200rpx;
- border-radius: 8rpx;
- &+image {
- margin-left: 16rpx;
- }
- }
- }
- }
- .cf-appraise-edit {
- background: #fff;
- padding: $uni-spacing-col-s4 $uni-spacing-row-s4;
- border-radius: 8rpx;
- margin-top: 24rpx;
- color: $uni-text-color;
- .cf-appraise-edit-textarea {
- .textarea {
- width: 100%;
- height: 256rpx;
- font-size: $uni-font-size-lg;
- line-height: $uni-line-height-lg;
- :deep(.uni-textarea-placeholder) {
- color: $uni-text-color-light !important;
- }
- }
- }
- .picture-item {
- margin-top: 32rpx;
- .file-picker {
- .cf-appraise-edit-add {
- @include flex-center;
- width: 200rpx;
- height: 200rpx;
- background: linear-gradient(0deg, rgba(255, 255, 255, 0.9), rgba(255, 255, 255, 0.9)), #1E92F0;
- .iconfont {
- font-size: 76rpx;
- color: $uni-color-primary;
- }
- }
- }
- }
- .echoPicture {
- margin-top: 16rpx;
- display: flex;
- flex-wrap: wrap;
- padding-left: 2px;
- .loop-item {
- .image-sty {
- height: 200rpx;
- width: 200rpx;
- margin: 5px 2px 0 0px;
- }
- }
- }
- }
- .cf-appraise-anonymous {
- display: flex;
- margin: $uni-spacing-col-s4 0 $uni-spacing-col-s4 $uni-spacing-row-s4;
- // font-size: $uni-font-size-sm;
- // line-height: $uni-line-height-lg;
- .anonymous-text {
- @include flex;
- flex-wrap: 0;
- }
- .iconfont {
- margin-right: 16rpx;
- font-size: 40rpx;
- background: linear-gradient(180deg, #B3B5B9 0%, #899AB9 100%);
- background-clip: text;
- text-fill-color: transparent;
- -webkit-background-clip: text;
- -webkit-text-fill-color: transparent;
- &.is-active {
- background: linear-gradient(180deg, #46ACFF 0%, $uni-color-primary 100%);
- background-clip: text;
- text-fill-color: transparent;
- -webkit-background-clip: text;
- -webkit-text-fill-color: transparent;
- }
- }
- }
- }
- }
- }
- </style>
|