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.

order-evaluate-salesman.vue 11KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418
  1. <!-- 订单-评价 -->
  2. <template>
  3. <!-- 业务员办理满意度评价 -->
  4. <view class="card">
  5. <view class="title1">业务办理满意度评价</view>
  6. <view style="padding: 30rpx 30rpx 45rpx;">
  7. <evaluate-star v-model="state.handle.score" title="进行评价"></evaluate-star>
  8. <view class="center as-layout-horizontal">
  9. <view class="tags as-layout-horizontal">
  10. <view class="tag" v-for="(item,index) in state.handle.tagList" :key="item">
  11. {{item.label}}
  12. <image v-if="state.handle.tagList.length > 1" class="tag-close"
  13. :src="`${$imgUrl}common/icon-close.png`" @click="removeTag1(item)" />
  14. </view>
  15. </view>
  16. <image
  17. :src="`${$imgUrl}common/${state.showTagPop1 ? 'arror-top.png' : 'arror-down.png'}`"
  18. style="width: 40rpx;height: 40rpx;" @click="state.showTagPop1 = !state.showTagPop1"></image>
  19. </view>
  20. <textarea class="input-box" v-model="state.handle.content" placeholder-class="text-hint"
  21. style="height: 200rpx;" placeholder="请输入评价内容">
  22. </textarea>
  23. </view>
  24. </view>
  25. <!-- 业务员满意度评价 -->
  26. <view class="card" v-if="state.haveUser">
  27. <view class="title1">业务员满意度评价</view>
  28. <view style="padding: 30rpx 30rpx 45rpx;">
  29. <view class="user as-layout-horizontal">
  30. <image class="avatar" :src="`${$imgUrl}default_head.png`" mode="aspectFill"></image>
  31. <view class="user-info">
  32. <view class="name">{{state.orderInfo.nickName ?? ''}}</view>
  33. <view class="name">{{state.orderInfo.tell ?? ''}}</view>
  34. <!-- <view class="name">张三</view>
  35. <view class="name">18712345678</view> -->
  36. </view>
  37. </view>
  38. <evaluate-star v-model="state.user.score" title="进行评价"></evaluate-star>
  39. <view class="center as-layout-horizontal">
  40. <view class="tags as-layout-horizontal">
  41. <view class="tag" v-for="(item,index) in state.user.tagList" :key="item">
  42. {{item.label}}
  43. <image v-if="state.user.tagList.length > 1" class="tag-close"
  44. :src="`${$imgUrl}common/icon-close.png`" @click="removeTag(item)" />
  45. </view>
  46. </view>
  47. <image
  48. :src="`${$imgUrl}common/${state.showTagPop ? 'arror-top.png' : 'arror-down.png'}`"
  49. style="width: 40rpx;height: 40rpx;" @click="state.showTagPop = !state.showTagPop"></image>
  50. </view>
  51. <textarea class="input-box" v-model="state.user.content" placeholder-class="text-hint"
  52. style="height: 200rpx;" placeholder="请输入评价内容">
  53. </textarea>
  54. </view>
  55. </view>
  56. <view class="uni-list">
  57. <view class="uni-list-cell uni-list-cell-pd">
  58. <view class="uni-list-cell-db">是否匿名</view>
  59. <switch checked style="transform:scale(0.7)" @change="switchChange"/>
  60. </view>
  61. </view>
  62. <view class="btn">
  63. <submit-button @submit="publish" title="发布"></submit-button>
  64. </view>
  65. <!-- 选择标签弹窗 业务员办理满意度弹框-->
  66. <u-popup v-model="state.showTagPop1" mode="bottom" height="60%">
  67. <view v-if="state.showTagPop1">
  68. <tag-popup :selTags="state.handle.tagList" :tagAllList="state.tagAllList" @cancel="state.showTagPop1 = !state.showTagPop1" @confirm="confirmSelectTag1"></tag-popup>
  69. </view>
  70. </u-popup>
  71. <!-- 选择标签弹窗 业务员满意度弹框-->
  72. <u-popup v-model="state.showTagPop" mode="bottom" height="60%">
  73. <view v-if="state.showTagPop">
  74. <tag-popup :selTags="state.user.tagList" :tagAllList="state.tagAllList" @cancel="state.showTagPop = !state.showTagPop" @confirm="confirmSelectTag"></tag-popup>
  75. </view>
  76. </u-popup>
  77. </template>
  78. <script setup lang="ts">
  79. import evaluateStar from "./components/evaluate-star.vue"
  80. import {reactive} from "vue";
  81. import {confirm, isBlank, msg} from "@/utils/utils";
  82. import tagPopup from "./components/popup-order-evaluate-tag";
  83. import { request } from "@/utils/network/request";
  84. import { orderDetail,orderEvaluateTag,salesmanMsg,addEvaluation,judageSalesman} from "@/utils/network/api";
  85. import {onLoad} from "@dcloudio/uni-app";
  86. import { stringToJson } from "@/utils/network/encryption";
  87. import { getItem, StorageKeys } from "@/utils/storage";
  88. const state = reactive({
  89. orderInfo:{} as any, //订单信息
  90. haveUser: false, //存在有业务员发起的业务展示业务员评价模块
  91. showTagPop1:false, //第一个弹框
  92. showTagPop: false, //显示标签选择弹窗
  93. handle: { //办理满意度
  94. score: 0, //星级得分 最高5分,0.5小数点 2.5分及以下为差评 2.5以上4.0以下为中评 4.0及4.0以上为好评(必选)
  95. content: '', //评价内容
  96. tagList: [], //已选择的评价标签列表
  97. },
  98. user: { //业务员
  99. score: 0, //星级得分 最高5分,0.5小数点 2.5分及以下为差评 2.5以上4.0以下为中评 4.0及4.0以上为好评(必选)
  100. content: '', //评价内容
  101. tagList: [], //已选择的评价标签列表
  102. },
  103. tagAllList:[],
  104. orderId:'', //订单ID
  105. id:'',
  106. })
  107. /* 确认选择tag 满意度 */
  108. const confirmSelectTag1 = (selectTag) => {
  109. state.showTagPop1 = !state.showTagPop1
  110. state.handle.tagList = [...selectTag];
  111. }
  112. /* 确认选择tag 业务员*/
  113. const confirmSelectTag = (selectTag) => {
  114. state.showTagPop = !state.showTagPop
  115. state.user.tagList = [...selectTag];
  116. }
  117. /* 删除评价标签 满意度*/
  118. const removeTag1 = (item: any) => {
  119. state.handle.tagList.map((tag, index) => {
  120. if (tag.id === item.id) {
  121. state.handle.tagList.splice(index, 1)
  122. }
  123. })
  124. }
  125. /* 删除评价标签 业务员*/
  126. const removeTag = (item: any) => {
  127. state.user.tagList.map((tag, index) => {
  128. if (tag.id === item.id) {
  129. state.user.tagList.splice(index, 1)
  130. }
  131. })
  132. }
  133. /* 发布 */
  134. const publish = (e) => {
  135. addService();
  136. }
  137. const addService = ()=>{
  138. if (state.handle.score === 0) {
  139. msg('请对业务员办理满意度进行打分!');
  140. return;
  141. }
  142. //若不填评价内容,根据打分规则自动填充评价内容
  143. //差评展示:默认差评 2.5分及以下
  144. //中评展示:默认中评 2.5以上4.0以下
  145. //好评展示:默认好评 4.0及4.0以上
  146. if (!state.handle.content) {
  147. if (state.handle.score <= 2.5) {
  148. state.handle.content = "默认差评";
  149. } else if (state.handle.score > 2.5 && state.handle.score < 4) {
  150. state.handle.content = "默认中评";
  151. } else {
  152. state.handle.content = "默认好评";
  153. }
  154. }
  155. const tagListArr=[];
  156. for(var i=0;i<state.handle.tagList.length;i++){
  157. tagListArr.push(state.handle.tagList[i].label)
  158. }
  159. const options = {
  160. type: 2,
  161. data: {
  162. "orderId":state.orderId,
  163. "serviceType":"service",
  164. "score":state.handle.score,
  165. "message":tagListArr.toString(),
  166. "suggestion":state.handle.content
  167. },
  168. method: 'POST',
  169. showLoading: true,
  170. }
  171. request(addEvaluation,options).then((res)=>{
  172. // 是否对业务员进行评价
  173. if(state.haveUser){
  174. addStaff();
  175. }else{
  176. confirm('您的评价已发布成功!',()=>{
  177. uni.$emit('refreshOrder');
  178. uni.navigateBack();
  179. },'发布成功',false);
  180. }
  181. })
  182. }
  183. const addStaff = ()=>{
  184. if (state.haveUser && state.user.score === 0) {
  185. msg('请对业务员进行打分!');
  186. return;
  187. }
  188. if (state.haveUser && !state.user.content) {
  189. if (state.user.score <= 2.5) {
  190. state.user.content = "默认差评";
  191. } else if (state.user.score > 2.5 && state.user.score < 4) {
  192. state.user.content = "默认中评";
  193. } else {
  194. state.user.content = "默认好评";
  195. }
  196. }
  197. const tagListArr=[];
  198. for(var i=0;i<state.user.tagList.length;i++){
  199. tagListArr.push(state.user.tagList[i].label)
  200. }
  201. const options = {
  202. type: 2,
  203. data: {
  204. "orderId":state.orderId,
  205. "serviceType":"staff",
  206. "score":state.user.score,
  207. "message":tagListArr.toString(),
  208. "suggestion":state.user.content
  209. },
  210. method: 'POST',
  211. showLoading: true,
  212. }
  213. request(addEvaluation,options).then((res)=>{
  214. confirm('您的评价已发布成功!',()=>{
  215. uni.$emit('refreshOrder');
  216. uni.navigateBack();
  217. },'发布成功',false);
  218. })
  219. }
  220. /* 获取业务员标签ID */
  221. const getTagIds = () => {
  222. const list = [];
  223. state.user.tagList.map((tag)=>{
  224. list.push(tag.id);
  225. });
  226. return list;
  227. }
  228. /* 订单查询业务员简单信息 */
  229. const getSalesmanMsg = (id) => {
  230. const options = {
  231. type: 2,
  232. data: {"id": id},
  233. method: 'POST',
  234. showLoading: true,
  235. }
  236. request(salesmanMsg, options).then((res) => {
  237. console.log("订单查询业务员简单信息",stringToJson(res.bizContent))
  238. state.orderInfo = stringToJson(res.bizContent);
  239. })
  240. }
  241. // 获取是否有业务员
  242. const isSalesman=(orderId)=>{
  243. const options = {
  244. type: 2,
  245. data: {"orderId": orderId},
  246. method: 'POST',
  247. showLoading: true,
  248. }
  249. request(judageSalesman, options).then((res) => {
  250. console.log("获取是否有业务员",stringToJson(res.bizContent))
  251. state.haveUser = stringToJson(res.bizContent);
  252. getSalesmanMsg(state.id);
  253. })
  254. }
  255. /* 获取评价标签 */
  256. const getEnvTag = () => {
  257. const options = {
  258. type: 2,
  259. data: {},
  260. method: 'POST',
  261. showLoading: true,
  262. }
  263. request(orderEvaluateTag, options).then((res) => {
  264. state.tagAllList = stringToJson(res.bizContent);
  265. })
  266. }
  267. // 是否匿名
  268. const switchChange=(e)=>{
  269. console.log('switch1 发生 change 事件,携带值为', e.detail.value)
  270. }
  271. onLoad((option) => {
  272. console.log("option",option)
  273. state.orderId=option.orderId;
  274. state.id=option.id;
  275. isSalesman(option.orderId); //获取是否有业务员
  276. getEnvTag();
  277. })
  278. </script>
  279. <style>
  280. page {
  281. background-color: #EEF7F7;
  282. padding-bottom: 50rpx;
  283. }
  284. </style>
  285. <style lang="scss" scoped>
  286. .card {
  287. background-color: white;
  288. border-radius: 20rpx;
  289. box-shadow: 0px 0px 6rpx 2rpx rgba(223, 223, 223, 0.3);
  290. margin: 30rpx;
  291. .title {
  292. text-align: center;
  293. font-size: 32rpx;
  294. color: #333333;
  295. padding-bottom: 30rpx;
  296. }
  297. .upload-img {
  298. margin-top: 10rpx;
  299. }
  300. .rate {
  301. .rate-label {
  302. font-size: 28rpx;
  303. color: #333333;
  304. padding-right: 20rpx;
  305. }
  306. }
  307. .input-box {
  308. width: 100%;
  309. border: 1px solid #DCDCDC;
  310. border-radius: 10rpx;
  311. background-color: #F3F3F3;
  312. padding: 30rpx;
  313. box-sizing: border-box;
  314. -moz-box-sizing: border-box;
  315. /*Firefox*/
  316. -webkit-box-sizing: border-box;
  317. /*Safari*/
  318. margin-top: 30rpx;
  319. }
  320. .text-hine {
  321. color: #999999;
  322. font-size: 26rpx;
  323. }
  324. .title1 {
  325. font-size: 30rpx;
  326. color: #333333;
  327. border-bottom: 1px solid #DCDCDC;
  328. padding: 30rpx;
  329. }
  330. .user {
  331. margin-bottom: 40rpx;
  332. .avatar {
  333. width: 140rpx;
  334. height: 160rpx;
  335. background-color: #F3F3F3;
  336. border-radius: 10rpx;
  337. }
  338. .user-info {
  339. margin-left: 40rpx;
  340. margin-top: 28rpx;
  341. .name {
  342. font-size: 28rpx;
  343. color: #333333;
  344. &:last-child {
  345. margin-top: 40rpx;
  346. }
  347. }
  348. }
  349. }
  350. .center {
  351. margin-top: 40rpx;
  352. padding-bottom: 20rpx;
  353. border-bottom: 1rpx solid #DCDCDC;
  354. .tags {
  355. flex-wrap: wrap;
  356. .tag {
  357. border-radius: 28rpx;
  358. background-color: #F3F3F3;
  359. padding: 0rpx 20rpx;
  360. border: 1px solid #DCDCDC;
  361. margin-right: 18rpx;
  362. margin-bottom: 15rpx;
  363. color: #333333;
  364. font-size: 26rpx;
  365. display: flex;
  366. flex-direction: row;
  367. justify-content: center;
  368. align-items: center;
  369. height: 57rpx;
  370. &:last-child {
  371. margin-right: 0rpx;
  372. margin-bottom: 0px;
  373. }
  374. .tag-close {
  375. width: 32rpx;
  376. height: 32rpx;
  377. margin-left: 15rpx;
  378. }
  379. }
  380. }
  381. }
  382. }
  383. .btn {
  384. margin: 60rpx 40rpx 0rpx;
  385. }
  386. .uni-list-cell{
  387. display: flex;
  388. margin: 10rpx auto;
  389. width: 90%;
  390. justify-content: space-between;
  391. align-items: center;
  392. }
  393. </style>