You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

equity-product-evaluation.vue 9.4KB

1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406
  1. <template>
  2. <!-- 权益产品评价 -->
  3. <view class="card" style="padding: 40rpx 30rpx;">
  4. <view class="title">权益产品评价</view>
  5. <!-- <evaluate-star v-model="state.interest.score" title="评价得分"></evaluate-star> -->
  6. <view class="evaluate-star">
  7. <view class="evaluate_title" v-if="title">{{title}}</view>
  8. <view class="star-row">
  9. <view class="star-box" v-for="(item,index) in total" @click="changeRate(index)" :key="index"
  10. :style="style">
  11. <image class="star-img" :src="`${$imgUrl}common/whole_star.png`" v-if="whole-0.5>index" />
  12. <image :class="['star-img',whole-0.5>index?'star-hide':'']" :src="`${$imgUrl}common/half_star.png`"
  13. v-if="half && whole>index" />
  14. <image class="star-img" :src="`${$imgUrl}common/empty_star.png`" v-if="whole<=index" />
  15. </view>
  16. </view>
  17. </view>
  18. <textarea class="input-box" v-model="state.interest.content" placeholder-class="text-hint" :maxlength="300"
  19. style="height: 260rpx;" placeholder="从多角度评价,可以帮助我们提升服务质量。">
  20. </textarea>
  21. <view class="upload-img">
  22. <form-image @backImg="backImgInterest($event)" @removeImg="removeImgInterest" :isUrl="false"
  23. style="width: 100%;" :retract="-15"></form-image>
  24. </view>
  25. </view>
  26. <view class="uni-list" style='font-size:32rpx'>
  27. <view class="uni-list-cell uni-list-cell-pd">
  28. <view class="uni-list-cell-db">是否匿名</view>
  29. <switch style="transform:scale(0.7)" @change="switchChange" />
  30. </view>
  31. </view>
  32. <view class="btn">
  33. <submit-button @submit="publish" title="发布"></submit-button>
  34. </view>
  35. <!-- 选择标签弹窗 -->
  36. <u-popup v-model="state.showTagPop" mode="bottom" height="60%">
  37. <view v-if="state.showTagPop">
  38. <tag-popup :selTags="state.user.tagList" :tagAllList="state.tagAllList"
  39. @cancel="state.showTagPop = !state.showTagPop" @confirm="confirmSelectTag"></tag-popup>
  40. </view>
  41. </u-popup>
  42. </template>
  43. <script setup lang="ts">
  44. // import evaluateStar from "@/subpackage/orders/components/evaluate-star.vue"
  45. import { reactive, onMounted, ref } from "vue";
  46. import { confirm, isBlank, msg } from "@/utils/utils";
  47. import tagPopup from "@/subpackage/orders/components/popup-order-evaluate-tag";
  48. import { request } from "@/utils/network/request";
  49. import { orderDetail, addEvaluation, addProductInterestApi } from "@/utils/network/api";
  50. import { onLoad } from "@dcloudio/uni-app";
  51. import { stringToJson } from "@/utils/network/encryption";
  52. import { getItem, StorageKeys } from "@/utils/storage";
  53. const state = reactive({
  54. orderInfo: {} as any, //订单信息
  55. showTagPop: false, //显示标签选择弹窗
  56. product: { //产品
  57. score: 0, //星级得分 最高5分,0.5小数点 2.5分及以下为差评 2.5以上4.0以下为中评 4.0及4.0以上为好评(必选)
  58. content: '', //评价内容
  59. imageList: [], //支持拍照上传最多上传9张
  60. },
  61. interest: { //产品
  62. score: 0, //星级得分 最高5分,0.5小数点 2.5分及以下为差评 2.5以上4.0以下为中评 4.0及4.0以上为好评(必选)
  63. content: '', //评价内容
  64. imageList: [], //支持拍照上传最多上传9张
  65. },
  66. user: { //业务员
  67. score: 0, //星级得分 最高5分,0.5小数点 2.5分及以下为差评 2.5以上4.0以下为中评 4.0及4.0以上为好评(必选)
  68. content: '', //评价内容
  69. tagList: [], //已选择的评价标签列表
  70. },
  71. tagAllList: [],
  72. orderId: "",
  73. haveInterestsProduct: false, //是否有权益产品
  74. isAnonymity: 0, //是否匿名
  75. equityId: "",
  76. id: ""
  77. })
  78. const props = defineProps({
  79. //双向绑定数据
  80. modelValue: {
  81. type: Number,
  82. default: 0
  83. },
  84. //评分总数
  85. total: {
  86. type: Number,
  87. default: 5
  88. },
  89. //评分名称
  90. title: {
  91. type: String,
  92. default: ''
  93. },
  94. //星星大小rpx
  95. size: {
  96. type: Number,
  97. default: 48
  98. }
  99. })
  100. const whole = ref(0)
  101. const half = ref(false)
  102. const sum = ref(0)
  103. let style = reactive({})
  104. /* 确认选择tag */
  105. const confirmSelectTag = (selectTag) => {
  106. state.showTagPop = !state.showTagPop
  107. state.user.tagList = [...selectTag];
  108. }
  109. //选择图片
  110. const backImg = (e : any) => {
  111. console.log("e", e)
  112. state.product.imageList = e;
  113. }
  114. //删除图片
  115. const removeImg = (imgList) => {
  116. state.product.imageList = imgList
  117. }
  118. //选择图片权益产品
  119. const backImgInterest = (e : any) => {
  120. state.interest.imageList = e;
  121. }
  122. //删除图片
  123. const removeImgInterest = (imgList) => {
  124. state.interest.imageList = imgList
  125. }
  126. /* 删除评价标签 */
  127. const removeTag = (item : any) => {
  128. state.user.tagList.map((tag, index) => {
  129. if (tag.id === item.id) {
  130. state.user.tagList.splice(index, 1)
  131. }
  132. })
  133. }
  134. /* 发布 */
  135. const publish = (e) => {
  136. addProductInterest();
  137. }
  138. const addProductInterest = () => {
  139. if (state.interest.score === 0) {
  140. msg('请对权益产品进行打分!');
  141. return;
  142. }
  143. //若不填评价内容,根据打分规则自动填充评价内容
  144. //差评展示:默认差评 2.5分及以下
  145. //中评展示:默认中评 2.5以上4.0以下
  146. //好评展示:默认好评 4.0及4.0以上
  147. if (!state.interest.content) {
  148. if (state.interest.score <= 2.5) {
  149. state.interest.content = "默认差评";
  150. } else if (state.interest.score > 2.5 && state.interest.score < 4) {
  151. state.interest.content = "默认中评";
  152. } else {
  153. state.interest.content = "默认好评";
  154. }
  155. }
  156. const options = {
  157. type: 2,
  158. data: {
  159. "orderId": state.orderId,
  160. "serviceType": "equity",
  161. "equityId": state.equityId,//权益产品id
  162. "score": state.interest.score,
  163. "pictureUrl": state.interest.imageList.join(";"),
  164. "message": '',
  165. "suggestion": state.interest.content,
  166. "isAnonymity": state.isAnonymity //是否匿名
  167. },
  168. method: 'POST',
  169. showLoading: true,
  170. }
  171. console.log("options", options)
  172. request(addEvaluation, options).then((res) => {
  173. addProductInterestRequest()
  174. })
  175. }
  176. /* 完成评价掉接口 */
  177. const addProductInterestRequest = () => {
  178. const options = {
  179. type: 2,
  180. data: { "id": state.id },
  181. method: 'POST',
  182. showLoading: true,
  183. }
  184. request(addProductInterestApi, options).then((res) => {
  185. confirm('您的评价已发布成功!', () => {
  186. uni.$emit('refreshOrder');
  187. uni.navigateBack();
  188. }, '发布成功', false);
  189. })
  190. }
  191. // 是否匿名
  192. const switchChange = (e) => {
  193. console.log('switch1 发生 change 事件,携带值为', e.detail.value);
  194. if (e.detail.value == true) {
  195. state.isAnonymity = 1
  196. } else {
  197. state.isAnonymity = 0
  198. }
  199. }
  200. onLoad((option) => {
  201. console.log("option11111", option)
  202. state.equityId = option.equityId
  203. state.id = option.id
  204. state.orderId = option.orderId
  205. })
  206. onMounted(() => {
  207. style = {
  208. width: props.size + 'rpx',
  209. height: props.size + 'rpx',
  210. }
  211. })
  212. const changeRate = (e) => {
  213. var a = e++
  214. sum.value++
  215. if (sum.value === 1) {
  216. whole.value = e - 0.5
  217. half.value = true
  218. sum.value = -1
  219. } else {
  220. half.value = false
  221. whole.value = e++
  222. }
  223. state.interest.score = whole.value
  224. console.log("whole.value", e, whole.value)
  225. }
  226. </script>
  227. <style>
  228. page {
  229. background-color: #EEF7F7;
  230. padding-bottom: 50rpx;
  231. }
  232. </style>
  233. <style lang="scss" scoped>
  234. /* 点评星级 */
  235. .evaluate-star {
  236. width: 100%;
  237. display: flex;
  238. align-items: center;
  239. .evaluate_title {
  240. font-size: 28rpx;
  241. color: #333333;
  242. padding-right: 20rpx;
  243. }
  244. .star-row {
  245. display: flex;
  246. align-items: center;
  247. .star-box {
  248. width: 48rpx;
  249. height: 48rpx;
  250. margin-right: 16rpx;
  251. .star-img {
  252. width: 100%;
  253. height: 100%;
  254. }
  255. .star-hide {
  256. display: none;
  257. }
  258. }
  259. }
  260. }
  261. .card {
  262. background-color: white;
  263. border-radius: 20rpx;
  264. box-shadow: 0px 0px 6rpx 2rpx rgba(223, 223, 223, 0.3);
  265. margin: 30rpx;
  266. .title {
  267. text-align: center;
  268. font-size: 32rpx;
  269. color: #333333;
  270. padding-bottom: 30rpx;
  271. }
  272. .upload-img {
  273. margin-top: 10rpx;
  274. }
  275. .rate {
  276. .rate-label {
  277. font-size: 28rpx;
  278. color: #333333;
  279. padding-right: 20rpx;
  280. }
  281. }
  282. .input-box {
  283. width: 100%;
  284. border: 1px solid #DCDCDC;
  285. border-radius: 10rpx;
  286. background-color: #F3F3F3;
  287. padding: 30rpx;
  288. box-sizing: border-box;
  289. -moz-box-sizing: border-box;
  290. /*Firefox*/
  291. -webkit-box-sizing: border-box;
  292. /*Safari*/
  293. margin-top: 30rpx;
  294. }
  295. .text-hine {
  296. color: #999999;
  297. font-size: 26rpx;
  298. }
  299. .title1 {
  300. font-size: 30rpx;
  301. color: #333333;
  302. border-bottom: 1px solid #DCDCDC;
  303. padding: 30rpx;
  304. }
  305. .user {
  306. margin-bottom: 40rpx;
  307. .avatar {
  308. width: 140rpx;
  309. height: 160rpx;
  310. background-color: #F3F3F3;
  311. border-radius: 10rpx;
  312. }
  313. .user-info {
  314. margin-left: 40rpx;
  315. margin-top: 28rpx;
  316. .name {
  317. font-size: 28rpx;
  318. color: #333333;
  319. &:last-child {
  320. margin-top: 40rpx;
  321. }
  322. }
  323. }
  324. }
  325. .center {
  326. margin-top: 40rpx;
  327. padding-bottom: 20rpx;
  328. border-bottom: 1rpx solid #DCDCDC;
  329. .tags {
  330. flex-wrap: wrap;
  331. .tag {
  332. border-radius: 28rpx;
  333. background-color: #F3F3F3;
  334. padding: 0rpx 20rpx;
  335. border: 1px solid #DCDCDC;
  336. margin-right: 18rpx;
  337. margin-bottom: 15rpx;
  338. color: #333333;
  339. font-size: 26rpx;
  340. display: flex;
  341. flex-direction: row;
  342. justify-content: center;
  343. align-items: center;
  344. height: 57rpx;
  345. &:last-child {
  346. margin-right: 0rpx;
  347. margin-bottom: 0px;
  348. }
  349. .tag-close {
  350. width: 32rpx;
  351. height: 32rpx;
  352. margin-left: 15rpx;
  353. }
  354. }
  355. }
  356. }
  357. }
  358. .btn {
  359. margin: 60rpx 40rpx 0rpx;
  360. }
  361. .uni-list-cell {
  362. display: flex;
  363. margin: 10rpx auto;
  364. width: 90%;
  365. justify-content: space-between;
  366. align-items: center;
  367. }
  368. </style>