CfAppraise.vue 9.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351
  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==1?'is-active':''"
  11. @click="onClickComprehensive(1)">
  12. <text class="iconfont">&#xe687;</text>差评
  13. </view>
  14. <view class="cf-appraise-top-comprehensive-item" :class="info.comprehensiveVal==2?'is-active':''"
  15. @click="onClickComprehensive(2)">
  16. <text class="iconfont">&#xe698;</text>中评
  17. </view>
  18. <view class="cf-appraise-top-comprehensive-item" :class="info.comprehensiveVal==3?'is-active':''"
  19. @click="onClickComprehensive(3)">
  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' file-mediatype="image" v-model="fileList" @select="onSelectFile"
  43. @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. const props = defineProps({
  72. ptwybh: {
  73. type: String,
  74. default: ""
  75. },
  76. isEdit: {
  77. type: Boolean,
  78. default: false
  79. }
  80. })
  81. const loaded = ref(false)
  82. const starText = [
  83. ['', '无效健康', '较差健康', '一般健康', '基本健康', '完全康复'],
  84. ['', '非常差', '差', '一般', '好', '非常好'],
  85. ['', '非常差', '差', '一般', '好', '非常好'],
  86. ['', '非常差', '差', '一般', '好', '非常好'],
  87. ]
  88. const info = ref({
  89. starVal: [0, 0, 0, 0],
  90. comprehensiveVal: 1,
  91. text: '',
  92. imgList: [],
  93. anonymous: true
  94. })
  95. const fileList = ref([])//用于显示图片列表
  96. const files = ref([]) //上传post
  97. // 上传图片
  98. const onSelectFile = async (res) => {
  99. console.log("上传", res)
  100. if (!res.tempFilePaths.length) return;
  101. uni.showLoading({
  102. title: '',
  103. mask: true
  104. });
  105. for (var i = 0; i < res.tempFilePaths.length; i++) {
  106. let uploadedFile = await rest.upload(res.tempFilePaths[i]);
  107. if (!uploadedFile) {
  108. dlg.error("上传失败,请重试!");
  109. uni.hideLoading();
  110. return;
  111. }
  112. files.value.push(uploadedFile);
  113. }
  114. uni.hideLoading();
  115. }
  116. // 删除图片
  117. const onDelFile = (val) => {
  118. if (val.index != -1) {
  119. files.value.splice(val.index, 1);
  120. }
  121. }
  122. // 修改
  123. const updateAnonymity = () => {
  124. info.value.anonymous = !info.value.anonymous
  125. }
  126. const onClickComprehensive = (val : number) => {
  127. info.value.comprehensiveVal = val
  128. }
  129. const onApply = async () => {
  130. const formData = {
  131. orderId: props.ptwybh,
  132. zhpj: info.value.comprehensiveVal,
  133. jyxg: info.value.starVal[0],
  134. kfys: info.value.starVal[1],
  135. jyzl: info.value.starVal[2],
  136. wlfw: info.value.starVal[3],
  137. content: info.value.text,
  138. image: info.value.imgList,
  139. anonymity: info.value.anonymous ? 1 : 0
  140. }
  141. let fields = {
  142. 'orderId': '订单ID不能为空',
  143. 'zhpj': '综合评价不能为空',
  144. 'jyxg': '就医效果不能为空',
  145. 'kfys': '开方医生不能为空',
  146. 'jyzl': '煎药质量不能为空',
  147. 'wlfw': '物流服务不能为空'
  148. };
  149. for (let key in fields) {
  150. if (!formData[key]) {
  151. dlg.error(fields[key]);
  152. return;
  153. }
  154. }
  155. console.log("processedData", formData, files.value)
  156. // await rest.post('/zyyp/prescription-evaluate/create',formData)
  157. dlg.success('操作成功')
  158. }
  159. onMounted(() => {
  160. })
  161. </script>
  162. <style lang="scss" scoped>
  163. .cf-appraise {
  164. padding: 0 $page-row-spacing;
  165. height: 100%;
  166. .cf-appraise-section {
  167. height: 100%;
  168. position: relative;
  169. display: flex;
  170. flex-direction: column;
  171. .cf-appraise-top-section {
  172. flex: 1;
  173. box-sizing: border-box;
  174. overflow-y: auto;
  175. .cf-appraise-top {
  176. background: #fff;
  177. padding: $uni-spacing-col-s3 $page-row-spacing;
  178. border-radius: 8rpx;
  179. .cf-appraise-top-title {
  180. text-align: center;
  181. font-size: $uni-font-size-xl;
  182. line-height: $uni-line-height-xl;
  183. font-weight: 600;
  184. }
  185. .cf-appraise-top-comprehensive {
  186. @include flex;
  187. margin-top: 40rpx;
  188. .cf-appraise-top-comprehensive-item {
  189. margin-left: 48rpx;
  190. @include flex;
  191. color: $uni-text-color-light;
  192. .iconfont {
  193. font-size: 48rpx;
  194. margin-right: 8rpx;
  195. background: linear-gradient(180deg, #B3B5B9 0%, #899AB9 100%);
  196. background-clip: text;
  197. text-fill-color: transparent;
  198. -webkit-background-clip: text;
  199. -webkit-text-fill-color: transparent;
  200. }
  201. &:nth-child(2) {
  202. margin-left: 32rpx;
  203. }
  204. &.is-active {
  205. color: $uni-text-color;
  206. .iconfont {
  207. background: linear-gradient(180deg, #FFBD48 0%, $uni-color-orange 100%);
  208. background-clip: text;
  209. text-fill-color: transparent;
  210. -webkit-background-clip: text;
  211. -webkit-text-fill-color: transparent;
  212. }
  213. }
  214. }
  215. }
  216. }
  217. .cf-appraise-view {
  218. background: #fff;
  219. padding: $uni-spacing-col-s2 $uni-spacing-row-s3 $uni-spacing-col-s4;
  220. border-radius: 8rpx;
  221. margin-top: 24rpx;
  222. .cf-appraise-view-imgs {
  223. margin-top: 16rpx;
  224. image {
  225. width: 200rpx;
  226. height: 200rpx;
  227. border-radius: 8rpx;
  228. &+image {
  229. margin-left: 16rpx;
  230. }
  231. }
  232. }
  233. }
  234. .cf-appraise-edit {
  235. background: #fff;
  236. padding: $uni-spacing-col-s4 $uni-spacing-row-s4;
  237. border-radius: 8rpx;
  238. margin-top: 24rpx;
  239. color: $uni-text-color;
  240. .cf-appraise-edit-textarea {
  241. .textarea {
  242. width: 100%;
  243. height: 256rpx;
  244. font-size: $uni-font-size-lg;
  245. line-height: $uni-line-height-lg;
  246. :deep(.uni-textarea-placeholder) {
  247. color: $uni-text-color-light !important;
  248. }
  249. }
  250. }
  251. .picture-item {
  252. margin-top: 32rpx;
  253. .file-picker {
  254. .cf-appraise-edit-add {
  255. @include flex-center;
  256. width: 200rpx;
  257. height: 200rpx;
  258. background: linear-gradient(0deg, rgba(255, 255, 255, 0.9), rgba(255, 255, 255, 0.9)), #1E92F0;
  259. .iconfont {
  260. font-size: 76rpx;
  261. color: $uni-color-primary;
  262. }
  263. }
  264. }
  265. }
  266. .echoPicture {
  267. margin-top: 16rpx;
  268. display: flex;
  269. flex-wrap: wrap;
  270. padding-left: 2px;
  271. .loop-item {
  272. .image-sty {
  273. height: 200rpx;
  274. width: 200rpx;
  275. margin: 5px 2px 0 0px;
  276. }
  277. }
  278. }
  279. }
  280. .cf-appraise-anonymous {
  281. display: flex;
  282. margin: $uni-spacing-col-s4 0 $uni-spacing-col-s4 $uni-spacing-row-s4;
  283. // font-size: $uni-font-size-sm;
  284. // line-height: $uni-line-height-lg;
  285. .anonymous-text {
  286. @include flex;
  287. flex-wrap: 0;
  288. }
  289. .iconfont {
  290. margin-right: 16rpx;
  291. font-size: 40rpx;
  292. background: linear-gradient(180deg, #B3B5B9 0%, #899AB9 100%);
  293. background-clip: text;
  294. text-fill-color: transparent;
  295. -webkit-background-clip: text;
  296. -webkit-text-fill-color: transparent;
  297. &.is-active {
  298. background: linear-gradient(180deg, #46ACFF 0%, $uni-color-primary 100%);
  299. background-clip: text;
  300. text-fill-color: transparent;
  301. -webkit-background-clip: text;
  302. -webkit-text-fill-color: transparent;
  303. }
  304. }
  305. }
  306. }
  307. }
  308. }
  309. </style>