Vous ne pouvez pas sélectionner plus de 25 sujets Les noms de sujets doivent commencer par une lettre ou un nombre, peuvent contenir des tirets ('-') et peuvent comporter jusqu'à 35 caractères.

order-evaluate-salesman.vue 12KB

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