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

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