您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

order-evaluate-product.vue 9.3KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350
  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. console.log("222",stringToJson(res.bizContent))
  188. state.orderInfo = stringToJson(res.bizContent);
  189. state.haveUser = !isBlank(state.orderInfo.staffId);
  190. })
  191. }
  192. /* 获取评价标签 */
  193. const getEnvTag = () => {
  194. const options = {
  195. type: 2,
  196. data: {},
  197. method: 'POST',
  198. showLoading: true,
  199. }
  200. request(orderEvaluateTag, options).then((res) => {
  201. console.log("111",stringToJson(res.bizContent))
  202. state.tagAllList = stringToJson(res.bizContent);
  203. })
  204. }
  205. onLoad((option) => {
  206. getOrderDetails(option.id);
  207. // getEnvTag();
  208. })
  209. </script>
  210. <style>
  211. page {
  212. background-color: #EEF7F7;
  213. padding-bottom: 50rpx;
  214. }
  215. </style>
  216. <style lang="scss" scoped>
  217. .card {
  218. background-color: white;
  219. border-radius: 20rpx;
  220. box-shadow: 0px 0px 6rpx 2rpx rgba(223, 223, 223, 0.3);
  221. margin: 30rpx;
  222. .title {
  223. text-align: center;
  224. font-size: 32rpx;
  225. color: #333333;
  226. padding-bottom: 30rpx;
  227. }
  228. .upload-img {
  229. margin-top: 10rpx;
  230. }
  231. .rate {
  232. .rate-label {
  233. font-size: 28rpx;
  234. color: #333333;
  235. padding-right: 20rpx;
  236. }
  237. }
  238. .input-box {
  239. width: 100%;
  240. border: 1px solid #DCDCDC;
  241. border-radius: 10rpx;
  242. background-color: #F3F3F3;
  243. padding: 30rpx;
  244. box-sizing: border-box;
  245. -moz-box-sizing: border-box;
  246. /*Firefox*/
  247. -webkit-box-sizing: border-box;
  248. /*Safari*/
  249. margin-top: 30rpx;
  250. }
  251. .text-hine {
  252. color: #999999;
  253. font-size: 26rpx;
  254. }
  255. .title1 {
  256. font-size: 30rpx;
  257. color: #333333;
  258. border-bottom: 1px solid #DCDCDC;
  259. padding: 30rpx;
  260. }
  261. .user {
  262. margin-bottom: 40rpx;
  263. .avatar {
  264. width: 140rpx;
  265. height: 160rpx;
  266. background-color: #F3F3F3;
  267. border-radius: 10rpx;
  268. }
  269. .user-info {
  270. margin-left: 40rpx;
  271. margin-top: 28rpx;
  272. .name {
  273. font-size: 28rpx;
  274. color: #333333;
  275. &:last-child {
  276. margin-top: 40rpx;
  277. }
  278. }
  279. }
  280. }
  281. .center {
  282. margin-top: 40rpx;
  283. padding-bottom: 20rpx;
  284. border-bottom: 1rpx solid #DCDCDC;
  285. .tags {
  286. flex-wrap: wrap;
  287. .tag {
  288. border-radius: 28rpx;
  289. background-color: #F3F3F3;
  290. padding: 0rpx 20rpx;
  291. border: 1px solid #DCDCDC;
  292. margin-right: 18rpx;
  293. margin-bottom: 15rpx;
  294. color: #333333;
  295. font-size: 26rpx;
  296. display: flex;
  297. flex-direction: row;
  298. justify-content: center;
  299. align-items: center;
  300. height: 57rpx;
  301. &:last-child {
  302. margin-right: 0rpx;
  303. margin-bottom: 0px;
  304. }
  305. .tag-close {
  306. width: 32rpx;
  307. height: 32rpx;
  308. margin-left: 15rpx;
  309. }
  310. }
  311. }
  312. }
  313. }
  314. .btn {
  315. margin: 60rpx 40rpx 0rpx;
  316. }
  317. </style>