CfAppraise.vue 9.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330
  1. <template>
  2. <view class="cf-appraise">
  3. <pub-loading-view :loaded="loaded" height="100%">
  4. <view class="cf-appraise-section" v-if="info">
  5. <view class="cf-appraise-top-section">
  6. <view class="cf-appraise-top">
  7. <view class="cf-appraise-top-title">“中医用药一件事”满意度调查</view>
  8. <view class="cf-appraise-top-comprehensive">
  9. <view class="appraise-star-title">综合评价</view>
  10. <view class="cf-appraise-top-comprehensive-item" :class="info.comprehensiveVal==0?'is-active':''"
  11. @click="onClickComprehensive(0)">
  12. <text class="iconfont">&#xe687;</text>差评
  13. </view>
  14. <view class="cf-appraise-top-comprehensive-item" :class="info.comprehensiveVal==1?'is-active':''"
  15. @click="onClickComprehensive(1)">
  16. <text class="iconfont">&#xe698;</text>中评
  17. </view>
  18. <view class="cf-appraise-top-comprehensive-item" :class="info.comprehensiveVal==2?'is-active':''"
  19. @click="onClickComprehensive(2)">
  20. <text class="iconfont">&#xe696;</text>好评
  21. </view>
  22. </view>
  23. <CfAppraiseStar :isEdit="isEdit" title="就医效果" :starText="starText[0]" v-model:starval="info.starVal[0]" />
  24. <CfAppraiseStar :isEdit="isEdit" title="开方医生" :starText="starText[1]" v-model:starval="info.starVal[1]" />
  25. <CfAppraiseStar :isEdit="isEdit" title="煎药质量" :starText="starText[2]" v-model:starval="info.starVal[2]" />
  26. <CfAppraiseStar :isEdit="isEdit" title="物流服务" :starText="starText[3]" v-model:starval="info.starVal[3]" />
  27. </view>
  28. <view class="cf-appraise-view" v-if="isEdit">
  29. <view class="cf-appraise-view-text">{{info.text}}</view>
  30. <view class="cf-appraise-view-imgs">
  31. <image mode="heightFix" :src="item" v-for="(item,index) in info.imgList" :item="index" />
  32. </view>
  33. </view>
  34. <view class="cf-appraise-edit" v-else>
  35. <view class="cf-appraise-edit-tips">
  36. <textarea v-model="info.text" class="textarea" :disabled="false" placeholder-style="color:#B3B5B9" maxlength="-1" placeholder="展开说说您对“中医用药一件事”的想法吧..."/>
  37. </view>
  38. <!-- 最多三张 -->
  39. <view class="picture-item" v-if="true">
  40. <uni-file-picker limit="3" :auto-upload="false" del-icon="true" file-extname='png,git,jpeg,pdf,jpg' :imageStyles="imageStyles" file-mediatype="image" v-model="fileList" @select="onSelectFile" @delete="onDelFile">
  41. <view class="cf-appraise-edit-add">
  42. <text class="iconfont">&#xe69f;</text>
  43. </view>
  44. </uni-file-picker>
  45. </view>
  46. <view class="echoPicture" v-else>
  47. <view v-for="item in fileList" :key="item" class="loop-item">
  48. <image class="image-sty" :src="item"></image>
  49. </view>
  50. </view>
  51. </view>
  52. <view class="cf-appraise-anonymous">
  53. <view class="anonymous-text" @click="updateAnonymity">
  54. <text class="iconfont" :class="info.anonymous?'is-active':''">&#xe699;</text>匿名评价
  55. </view>
  56. </view>
  57. </view>
  58. <view class="cf-appraise-btn pub-button is-bg large" v-if="!isEdit" @click="onApply">提交评价</view>
  59. </view>
  60. </pub-loading-view>
  61. </view>
  62. </template>
  63. <script lang="ts" setup>
  64. import { ref, PropType, onMounted } from 'vue'
  65. import dlg from '@/lib/dlg.ts'
  66. import rest from '@/stores/rest'
  67. import CfAppraiseStar from './CfAppraiseStar.vue'
  68. import testBgUrl from '../../static/image/no-data.png'
  69. const loaded = ref(false)
  70. const isEdit = ref(false)
  71. const starText = [
  72. ['', '无效健康', '较差健康', '一般健康', '基本健康', '完全康复'],
  73. ['', '非常差', '差', '一般', '好', '非常好'],
  74. ['', '非常差', '差', '一般', '好', '非常好'],
  75. ['', '非常差', '差', '一般', '好', '非常好']]
  76. const info = ref()
  77. const infoNew = ref({
  78. starVal: [0, 0, 0, 0],
  79. comprehensiveVal: 0,
  80. text: '',
  81. imgList: [
  82. ],
  83. anonymous: true
  84. })
  85. const info2 = ref({
  86. starVal: [5, 4, 3, 2],
  87. comprehensiveVal: 2,
  88. text: '中药材资源是中医药的物质基础,其质量事关临床用药的安全性与有效性,其科学评价是中药产业现代化、标准化以及国际化的前提条件。 中药材的性状特征、药效成分以及分子标记为迄今三类质量评价方法的主要依据 ',
  89. imgList: [
  90. testBgUrl, testBgUrl, testBgUrl
  91. ],
  92. anonymous: true
  93. })
  94. const fileList = ref([])//用于显示图片列表
  95. const files = ref([]) //上传post
  96. const imageStyles = ref({
  97. width: '210rpx',
  98. height: '210rpx',
  99. })
  100. // 上传图片
  101. const onSelectFile = async (res)=> {
  102. console.log("上传")
  103. if (!res.tempFilePaths.length) return;
  104. uni.showLoading({
  105. title: '',
  106. mask: true
  107. });
  108. for (var i = 0; i < res.tempFilePaths.length; i++) {
  109. // 将 Blob 转换为 Base64
  110. let blob = res.tempFilePaths[i];
  111. let uploadedFile = await rest.upload(blob);
  112. if (!uploadedFile) {
  113. dlg.error("上传失败,请重试!");
  114. uni.hideLoading();
  115. return;
  116. }
  117. files.value.push(uploadedFile);
  118. }
  119. uni.hideLoading();
  120. }
  121. // 删除图片
  122. const onDelFile = (val) => {
  123. if (val.index != -1) {
  124. files.value.splice(val.index, 1);
  125. }
  126. }
  127. // 修改
  128. const updateAnonymity = ()=> {
  129. info.value.anonymous = !info.value.anonymous
  130. }
  131. const onClickComprehensive = (val : number) => {
  132. info.value.comprehensiveVal = val
  133. }
  134. const getInfo = async () => {
  135. loaded.value = true;
  136. try {
  137. let res = await rest.get('/app-api/zyyp/prescription-evaluate/getByOrderId',{orderId:'2024_1857595040975118338'})
  138. if (res){
  139. console.log("内容存在",res)
  140. }
  141. console.log("内容不存在",res)
  142. } catch (e) {
  143. console.log(e);
  144. }
  145. info.value = infoNew.value
  146. // isEdit.value = true
  147. // info.value = info2.value
  148. loaded.value = false;
  149. }
  150. const onApply = () => {
  151. console.log("info.value", info.value)
  152. dlg.success('操作成功')
  153. }
  154. onMounted(() => {
  155. getInfo()
  156. })
  157. </script>
  158. <style lang="scss" scoped>
  159. .cf-appraise {
  160. padding: 0 $page-row-spacing;
  161. height: 100%;
  162. .cf-appraise-section {
  163. height: 100%;
  164. position: relative;
  165. display: flex;
  166. flex-direction: column;
  167. .cf-appraise-top-section {
  168. flex: 1;
  169. box-sizing: border-box;
  170. overflow-y: auto;
  171. .cf-appraise-top {
  172. background: #fff;
  173. padding: $uni-spacing-col-s3 $page-row-spacing;
  174. border-radius: 8rpx;
  175. .cf-appraise-top-title {
  176. text-align: center;
  177. font-size: $uni-font-size-xl;
  178. line-height: $uni-line-height-xl;
  179. font-weight: 600;
  180. }
  181. .cf-appraise-top-comprehensive {
  182. @include flex;
  183. margin-top: 40rpx;
  184. .cf-appraise-top-comprehensive-item {
  185. margin-left: 48rpx;
  186. @include flex;
  187. color: $uni-text-color-light;
  188. .iconfont {
  189. font-size: 48rpx;
  190. margin-right: 8rpx;
  191. background: linear-gradient(180deg, #B3B5B9 0%, #899AB9 100%);
  192. background-clip: text;
  193. text-fill-color: transparent;
  194. -webkit-background-clip: text;
  195. -webkit-text-fill-color: transparent;
  196. }
  197. &:nth-child(2) {
  198. margin-left: 32rpx;
  199. }
  200. &.is-active {
  201. color: $uni-text-color;
  202. .iconfont {
  203. background: linear-gradient(180deg, #FFBD48 0%, $uni-color-orange 100%);
  204. background-clip: text;
  205. text-fill-color: transparent;
  206. -webkit-background-clip: text;
  207. -webkit-text-fill-color: transparent;
  208. }
  209. }
  210. }
  211. }
  212. }
  213. .cf-appraise-view {
  214. background: #fff;
  215. padding: $uni-spacing-col-s2 $uni-spacing-row-s3 $uni-spacing-col-s4;
  216. border-radius: 8rpx;
  217. margin-top: 24rpx;
  218. .cf-appraise-view-imgs {
  219. margin-top: 16rpx;
  220. image {
  221. width: 200rpx;
  222. height: 200rpx;
  223. border-radius: 8rpx;
  224. &+image {
  225. margin-left: 16rpx;
  226. }
  227. }
  228. }
  229. }
  230. .cf-appraise-edit {
  231. background: #fff;
  232. padding: $uni-spacing-col-s4 $uni-spacing-row-s4;
  233. border-radius: 8rpx;
  234. margin-top: 24rpx;
  235. color: $uni-text-color-grey;
  236. .cf-appraise-edit-tips {
  237. .textarea {
  238. width: 100%;
  239. }
  240. }
  241. .picture-item {
  242. margin-top: 16rpx;
  243. .cf-appraise-edit-add {
  244. @include flex-center;
  245. width: 100%;
  246. height: 100%;
  247. background: linear-gradient(0deg, rgba(255, 255, 255, 0.9), rgba(255, 255, 255, 0.9)), #1E92F0;
  248. .iconfont {
  249. font-size: 76rpx;
  250. color: $uni-color-primary;
  251. }
  252. }
  253. }
  254. .echoPicture {
  255. margin-top: 16rpx;
  256. display: flex;
  257. flex-wrap: wrap;
  258. padding-left: 2px;
  259. .loop-item {
  260. .image-sty{
  261. height: 200rpx;
  262. width: 200rpx;
  263. margin: 5px 2px 0 0px;
  264. }
  265. }
  266. }
  267. }
  268. .cf-appraise-anonymous {
  269. display: flex;
  270. margin: $uni-spacing-col-s4 0 $uni-spacing-col-s4 $uni-spacing-row-s4;
  271. // font-size: $uni-font-size-sm;
  272. // line-height: $uni-line-height-lg;
  273. .anonymous-text {
  274. @include flex;
  275. flex-wrap: 0;
  276. }
  277. .iconfont {
  278. margin-right: 16rpx;
  279. font-size: 40rpx;
  280. background: linear-gradient(180deg, #B3B5B9 0%, #899AB9 100%);
  281. background-clip: text;
  282. text-fill-color: transparent;
  283. -webkit-background-clip: text;
  284. -webkit-text-fill-color: transparent;
  285. &.is-active {
  286. background: linear-gradient(180deg, #46ACFF 0%, $uni-color-primary 100%);
  287. background-clip: text;
  288. text-fill-color: transparent;
  289. -webkit-background-clip: text;
  290. -webkit-text-fill-color: transparent;
  291. }
  292. }
  293. }
  294. }
  295. }
  296. }
  297. </style>