Você não pode selecionar mais de 25 tópicos Os tópicos devem começar com uma letra ou um número, podem incluir traços ('-') e podem ter até 35 caracteres.

order-evaluate-product.vue 9.2KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348
  1. <!-- 订单-评价 -->
  2. <template>
  3. <!-- 1,4 -->
  4. <!-- 产品 -->
  5. <!-- 发行产品评价 -->
  6. <view class="card" style="padding: 40rpx 30rpx;">
  7. <view class="title">{{state.orderInfo.productName}}</view>
  8. <evaluate-star v-model="state.product.score" title="评价得分"></evaluate-star>
  9. <textarea class="input-box" v-model="state.product.content" placeholder-class="text-hint" :maxlength="500"
  10. style="height: 260rpx;" placeholder="从多角度评价,可以帮助我们提升服务质量。">
  11. </textarea>
  12. <view class="upload-img">
  13. <form-image @backImg="backImg($event)" @removeImg="removeImg" :isUrl="false" style="width: 100%;" :retract="-15"></form-image>
  14. </view>
  15. </view>
  16. <!-- 权益产品评价 -->
  17. <view class="card" style="padding: 40rpx 30rpx;">
  18. <view class="title">{{state.orderInfo.productName}}</view>
  19. <evaluate-star v-model="state.product.score" title="评价得分"></evaluate-star>
  20. <textarea class="input-box" v-model="state.product.content" placeholder-class="text-hint" :maxlength="500"
  21. style="height: 260rpx;" placeholder="从多角度评价,可以帮助我们提升服务质量。">
  22. </textarea>
  23. <view class="upload-img">
  24. <form-image @backImg="backImg($event)" @removeImg="removeImg" :isUrl="false" style="width: 100%;" :retract="-15"></form-image>
  25. </view>
  26. </view>
  27. <!-- 业务员 -->
  28. <!-- 业务员满意度评价 -->
  29. <view class="card" v-if="state.haveUser">
  30. <view class="title1">业务员</view>
  31. <view style="padding: 30rpx 30rpx 45rpx;">
  32. <view class="user as-layout-horizontal">
  33. <image class="avatar" :src="`${$imgUrl}default_head.png`" mode="aspectFill"></image>
  34. <view class="user-info">
  35. <view class="name">{{state.orderInfo.staffName ?? ''}}</view>
  36. <view class="name">{{state.orderInfo.staffPhone ?? ''}}</view>
  37. </view>
  38. </view>
  39. <evaluate-star v-model="state.user.score" title="进行评价"></evaluate-star>
  40. <view class="center as-layout-horizontal">
  41. <view class="tags as-layout-horizontal">
  42. <view class="tag" v-for="(item,index) in state.user.tagList" :key="item">
  43. {{item.label}}
  44. <image v-if="state.user.tagList.length > 1" class="tag-close"
  45. :src="`${$imgUrl}common/icon-close.png`" @click="removeTag(item)" />
  46. </view>
  47. </view>
  48. <image
  49. :src="`${$imgUrl}common/${state.showTagPop ? 'arror-top.png' : 'arror-down.png'}`"
  50. style="width: 40rpx;height: 40rpx;" @click="state.showTagPop = !state.showTagPop"></image>
  51. </view>
  52. <textarea class="input-box" v-model="state.user.content" placeholder-class="text-hint"
  53. style="height: 200rpx;" placeholder="请输入评价内容">
  54. </textarea>
  55. </view>
  56. </view>
  57. <view class="btn">
  58. <submit-button @submit="publish" title="发布"></submit-button>
  59. </view>
  60. <!-- 选择标签弹窗 -->
  61. <u-popup v-model="state.showTagPop" mode="bottom" height="60%">
  62. <view v-if="state.showTagPop">
  63. <tag-popup :selTags="state.user.tagList" :tagAllList="state.tagAllList" @cancel="state.showTagPop = !state.showTagPop" @confirm="confirmSelectTag"></tag-popup>
  64. </view>
  65. </u-popup>
  66. </template>
  67. <script setup lang="ts">
  68. import evaluateStar from "./components/evaluate-star.vue"
  69. import {reactive} from "vue";
  70. import {confirm, isBlank, msg} from "@/utils/utils";
  71. import tagPopup from "./components/popup-order-evaluate-tag";
  72. import { request } from "@/utils/network/request";
  73. import { orderDetail, orderEvaluate,orderEvaluateTag,saleMessage } from "@/utils/network/api";
  74. import {onLoad} from "@dcloudio/uni-app";
  75. import { stringToJson } from "@/utils/network/encryption";
  76. import { getItem, StorageKeys } from "@/utils/storage";
  77. const state = reactive({
  78. orderInfo:{} as any, //订单信息
  79. haveUser: false, //存在有业务员发起的业务展示业务员评价模块
  80. showTagPop: false, //显示标签选择弹窗
  81. product: { //产品
  82. score: 0, //星级得分 最高5分,0.5小数点 2.5分及以下为差评 2.5以上4.0以下为中评 4.0及4.0以上为好评(必选)
  83. content: '', //评价内容
  84. imageList: [], //支持拍照上传最多上传9张
  85. },
  86. user: { //业务员
  87. score: 0, //星级得分 最高5分,0.5小数点 2.5分及以下为差评 2.5以上4.0以下为中评 4.0及4.0以上为好评(必选)
  88. content: '', //评价内容
  89. tagList: [], //已选择的评价标签列表
  90. },
  91. tagAllList:[]
  92. })
  93. /* 确认选择tag */
  94. const confirmSelectTag = (selectTag) => {
  95. state.showTagPop = !state.showTagPop
  96. state.user.tagList = [...selectTag];
  97. }
  98. //选择图片
  99. const backImg = (e: any) => {
  100. state.product.imageList = e;
  101. }
  102. //删除图片
  103. const removeImg = (imgList) => {
  104. state.product.imageList = imgList
  105. }
  106. /* 删除评价标签 */
  107. const removeTag = (item: any) => {
  108. state.user.tagList.map((tag, index) => {
  109. if (tag.id === item.id) {
  110. state.user.tagList.splice(index, 1)
  111. }
  112. })
  113. }
  114. /* 发布 */
  115. const publish = (e) => {
  116. if (state.product.score === 0) {
  117. msg('请对产品进行打分!');
  118. return;
  119. }
  120. if (state.haveUser && state.user.score === 0) {
  121. msg('请对业务员进行打分!');
  122. return;
  123. }
  124. //若不填评价内容,根据打分规则自动填充评价内容
  125. //差评展示:默认差评 2.5分及以下
  126. //中评展示:默认中评 2.5以上4.0以下
  127. //好评展示:默认好评 4.0及4.0以上
  128. if (!state.product.content) {
  129. if (state.product.score <= 2.5) {
  130. state.product.content = "默认差评";
  131. } else if (state.product.score > 2.5 && state.product.score < 4) {
  132. state.product.content = "默认中评";
  133. } else {
  134. state.product.content = "默认好评";
  135. }
  136. }
  137. if (state.haveUser && !state.user.content) {
  138. if (state.user.score <= 2.5) {
  139. state.user.content = "默认差评";
  140. } else if (state.user.score > 2.5 && state.user.score < 4) {
  141. state.user.content = "默认中评";
  142. } else {
  143. state.user.content = "默认好评";
  144. }
  145. }
  146. const options = {
  147. type: 2,
  148. data: {
  149. "id": state.orderInfo.id,
  150. 'productScore': state.product.score,
  151. 'productAppraise':state.product.content,
  152. 'appraisePics':state.product.imageList.join(";"),
  153. 'staffId':state.orderInfo.staffId,
  154. 'staffName':state.orderInfo.staffName,
  155. 'staffScore':state.user.score,
  156. 'staffTips':getTagIds().join(';'),
  157. 'staffAppraise':state.user.content,
  158. 'opId':getItem(StorageKeys.OpenId)
  159. },
  160. method: 'POST',
  161. showLoading: true,
  162. }
  163. request(orderEvaluate,options).then((res)=>{
  164. confirm('您的评价已发布成功!',()=>{
  165. uni.$emit('refreshOrder');
  166. uni.navigateBack();
  167. },'发布成功',false);
  168. })
  169. }
  170. /* 获取业务员标签ID */
  171. const getTagIds = () => {
  172. const list = [];
  173. state.user.tagList.map((tag)=>{
  174. list.push(tag.id);
  175. });
  176. return list;
  177. }
  178. /* 获取订单详情 */
  179. const getOrderDetails = (id) => {
  180. const options = {
  181. type: 2,
  182. data: {"id": id},
  183. method: 'POST',
  184. showLoading: true,
  185. }
  186. request(orderDetail, options).then((res) => {
  187. state.orderInfo = stringToJson(res.bizContent);
  188. state.haveUser = !isBlank(state.orderInfo.staffId);
  189. })
  190. }
  191. /* 获取评价标签 */
  192. const getEnvTag = () => {
  193. const options = {
  194. type: 2,
  195. data: {},
  196. method: 'POST',
  197. showLoading: true,
  198. }
  199. request(orderEvaluateTag, options).then((res) => {
  200. state.tagAllList = stringToJson(res.bizContent);
  201. })
  202. }
  203. onLoad((option) => {
  204. getOrderDetails(option.id);
  205. getEnvTag();
  206. })
  207. </script>
  208. <style>
  209. page {
  210. background-color: #EEF7F7;
  211. padding-bottom: 50rpx;
  212. }
  213. </style>
  214. <style lang="scss" scoped>
  215. .card {
  216. background-color: white;
  217. border-radius: 20rpx;
  218. box-shadow: 0px 0px 6rpx 2rpx rgba(223, 223, 223, 0.3);
  219. margin: 30rpx;
  220. .title {
  221. text-align: center;
  222. font-size: 32rpx;
  223. color: #333333;
  224. padding-bottom: 30rpx;
  225. }
  226. .upload-img {
  227. margin-top: 10rpx;
  228. }
  229. .rate {
  230. .rate-label {
  231. font-size: 28rpx;
  232. color: #333333;
  233. padding-right: 20rpx;
  234. }
  235. }
  236. .input-box {
  237. width: 100%;
  238. border: 1px solid #DCDCDC;
  239. border-radius: 10rpx;
  240. background-color: #F3F3F3;
  241. padding: 30rpx;
  242. box-sizing: border-box;
  243. -moz-box-sizing: border-box;
  244. /*Firefox*/
  245. -webkit-box-sizing: border-box;
  246. /*Safari*/
  247. margin-top: 30rpx;
  248. }
  249. .text-hine {
  250. color: #999999;
  251. font-size: 26rpx;
  252. }
  253. .title1 {
  254. font-size: 30rpx;
  255. color: #333333;
  256. border-bottom: 1px solid #DCDCDC;
  257. padding: 30rpx;
  258. }
  259. .user {
  260. margin-bottom: 40rpx;
  261. .avatar {
  262. width: 140rpx;
  263. height: 160rpx;
  264. background-color: #F3F3F3;
  265. border-radius: 10rpx;
  266. }
  267. .user-info {
  268. margin-left: 40rpx;
  269. margin-top: 28rpx;
  270. .name {
  271. font-size: 28rpx;
  272. color: #333333;
  273. &:last-child {
  274. margin-top: 40rpx;
  275. }
  276. }
  277. }
  278. }
  279. .center {
  280. margin-top: 40rpx;
  281. padding-bottom: 20rpx;
  282. border-bottom: 1rpx solid #DCDCDC;
  283. .tags {
  284. flex-wrap: wrap;
  285. .tag {
  286. border-radius: 28rpx;
  287. background-color: #F3F3F3;
  288. padding: 0rpx 20rpx;
  289. border: 1px solid #DCDCDC;
  290. margin-right: 18rpx;
  291. margin-bottom: 15rpx;
  292. color: #333333;
  293. font-size: 26rpx;
  294. display: flex;
  295. flex-direction: row;
  296. justify-content: center;
  297. align-items: center;
  298. height: 57rpx;
  299. &:last-child {
  300. margin-right: 0rpx;
  301. margin-bottom: 0px;
  302. }
  303. .tag-close {
  304. width: 32rpx;
  305. height: 32rpx;
  306. margin-left: 15rpx;
  307. }
  308. }
  309. }
  310. }
  311. }
  312. .btn {
  313. margin: 60rpx 40rpx 0rpx;
  314. }
  315. </style>