CfAppraise.vue 9.7 KB

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