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

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405
  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="300"
  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="请输入评价内容" :maxlength="300">
  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, msg } from "@/utils/utils";
  70. import tagPopup from "./components/popup-order-evaluate-tag";
  71. import { request, requestNew } from "@/utils/network/request";
  72. import { orderDetail, orderEvaluateTag, addEvaluation} from "@/utils/network/api";
  73. import { onLoad } from "@dcloudio/uni-app";
  74. import { stringToJson } from "@/utils/network/encryption";
  75. const state = reactive({
  76. orderInfo: {} as any, //订单信息
  77. showTagPop1: false, //第一个弹框
  78. showTagPop: false, //显示标签选择弹窗
  79. product: { //产品
  80. score: 0, //星级得分 最高5分,0.5小数点 2.5分及以下为差评 2.5以上4.0以下为中评 4.0及4.0以上为好评(必选)
  81. content: '', //评价内容
  82. imageList: [], //支持拍照上传最多上传9张
  83. },
  84. handle: { //办理满意度
  85. score: 0, //星级得分 最高5分,0.5小数点 2.5分及以下为差评 2.5以上4.0以下为中评 4.0及4.0以上为好评(必选)
  86. content: '', //评价内容
  87. tagList: [], //已选择的评价标签列表
  88. },
  89. user: { //业务员
  90. score: 0, //星级得分 最高5分,0.5小数点 2.5分及以下为差评 2.5以上4.0以下为中评 4.0及4.0以上为好评(必选)
  91. content: '', //评价内容
  92. tagList: [], //已选择的评价标签列表
  93. },
  94. tagAllList: [],
  95. orderId: '', //订单ID
  96. id: '',
  97. isAnonymity: 0, //是否匿名 默认匿名
  98. })
  99. //删除图片
  100. const removeImg = (imgList) => {
  101. state.product.imageList = imgList
  102. }
  103. //选择图片
  104. const backImg = (e : any) => {
  105. console.log("e", e)
  106. state.product.imageList = e;
  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. addProduct();
  137. }
  138. const addProduct = () => {
  139. if (state.product.score === 0) {
  140. msg('请对产品进行打分!');
  141. return;
  142. }
  143. if (state.user.score === 0) {
  144. msg('请对业务员进行打分!');
  145. return;
  146. }
  147. //若不填评价内容,根据打分规则自动填充评价内容
  148. //差评展示:默认差评 2.5分及以下
  149. //中评展示:默认中评 2.5以上4.0以下
  150. //好评展示:默认好评 4.0及4.0以上
  151. if (!state.product.content) {
  152. if (state.product.score <= 2.5) {
  153. state.product.content = "默认差评";
  154. } else if (state.product.score > 2.5 && state.product.score < 4) {
  155. state.product.content = "默认中评";
  156. } else {
  157. state.product.content = "默认好评";
  158. }
  159. }
  160. const options = {
  161. type: 2,
  162. data: {
  163. "orderId": state.orderId,
  164. "serviceType": "product",
  165. "score": state.product.score,
  166. "pictureUrl": state.product.imageList.join(";"),
  167. "message": '',
  168. "suggestion": state.product.content,
  169. "isAnonymity": state.isAnonymity
  170. },
  171. method: 'POST',
  172. showLoading: true,
  173. }
  174. console.log("options", options)
  175. requestNew(addEvaluation, options).then((res) => {
  176. addStaff()
  177. })
  178. }
  179. const addStaff = () => {
  180. if (!state.user.content) {
  181. if (state.user.score <= 2.5) {
  182. state.user.content = "默认差评";
  183. } else if (state.user.score > 2.5 && state.user.score < 4) {
  184. state.user.content = "默认中评";
  185. } else {
  186. state.user.content = "默认好评";
  187. }
  188. }
  189. const tagListArr = [];
  190. for (var i = 0; i < state.user.tagList.length; i++) {
  191. tagListArr.push(state.user.tagList[i].label)
  192. }
  193. const options = {
  194. type: 2,
  195. data: {
  196. "orderId": state.orderId,
  197. "serviceType": "staff",
  198. "score": state.user.score,
  199. "message": tagListArr.toString(),
  200. "suggestion": state.user.content,
  201. "isAnonymity": state.isAnonymity
  202. },
  203. method: 'POST',
  204. showLoading: true,
  205. }
  206. requestNew(addEvaluation, options).then((res) => {
  207. confirm('您的评价已发布成功!', () => {
  208. uni.$emit('refreshOrder');
  209. uni.navigateBack();
  210. }, '发布成功', false);
  211. })
  212. }
  213. /* 获取业务员标签ID */
  214. const getTagIds = () => {
  215. const list = [];
  216. state.user.tagList.map((tag) => {
  217. list.push(tag.id);
  218. });
  219. return list;
  220. }
  221. /* 获取评价标签 */
  222. const getEnvTag = () => {
  223. const options = {
  224. type: 2,
  225. data: {},
  226. method: 'POST',
  227. showLoading: true,
  228. }
  229. requestNew(orderEvaluateTag, options).then((res) => {
  230. state.tagAllList = res;
  231. })
  232. }
  233. // 是否匿名
  234. const switchChange = (e) => {
  235. console.log('switch1 发生 change 事件,携带值为', e.detail.value);
  236. if (e.detail.value == true) {
  237. state.isAnonymity = 1
  238. } else {
  239. state.isAnonymity = 0
  240. }
  241. }
  242. onLoad((option) => {
  243. console.log("option", option)
  244. state.orderId = option.orderId;
  245. state.id = option.id;
  246. getEnvTag();
  247. getOrderDetails(option.id);
  248. })
  249. /* 获取订单详情 */
  250. const getOrderDetails = (id) => {
  251. const options = {
  252. type: 2,
  253. data: { "id": id },
  254. method: 'POST',
  255. showLoading: true,
  256. }
  257. request(orderDetail, options).then((res) => {
  258. state.orderInfo = stringToJson(res.bizContent);
  259. console.log("获取订单详情", stringToJson(res.bizContent), state.orderInfo.equityId)
  260. })
  261. }
  262. </script>
  263. <style>
  264. page {
  265. background-color: #EEF7F7;
  266. padding-bottom: 50rpx;
  267. }
  268. </style>
  269. <style lang="scss" scoped>
  270. .card {
  271. background-color: white;
  272. border-radius: 20rpx;
  273. box-shadow: 0px 0px 6rpx 2rpx rgba(223, 223, 223, 0.3);
  274. margin: 30rpx;
  275. .title {
  276. text-align: center;
  277. font-size: 32rpx;
  278. color: #333333;
  279. padding-bottom: 30rpx;
  280. }
  281. .upload-img {
  282. margin-top: 10rpx;
  283. }
  284. .rate {
  285. .rate-label {
  286. font-size: 28rpx;
  287. color: #333333;
  288. padding-right: 20rpx;
  289. }
  290. }
  291. .input-box {
  292. width: 100%;
  293. border: 1px solid #DCDCDC;
  294. border-radius: 10rpx;
  295. background-color: #F3F3F3;
  296. padding: 30rpx;
  297. box-sizing: border-box;
  298. -moz-box-sizing: border-box;
  299. /*Firefox*/
  300. -webkit-box-sizing: border-box;
  301. /*Safari*/
  302. margin-top: 30rpx;
  303. }
  304. .text-hine {
  305. color: #999999;
  306. font-size: 26rpx;
  307. }
  308. .title1 {
  309. font-size: 30rpx;
  310. color: #333333;
  311. border-bottom: 1px solid #DCDCDC;
  312. padding: 30rpx;
  313. }
  314. .user {
  315. margin-bottom: 40rpx;
  316. .avatar {
  317. width: 140rpx;
  318. height: 160rpx;
  319. background-color: #F3F3F3;
  320. border-radius: 10rpx;
  321. }
  322. .user-info {
  323. margin-left: 40rpx;
  324. margin-top: 28rpx;
  325. .name {
  326. font-size: 28rpx;
  327. color: #333333;
  328. &:last-child {
  329. margin-top: 40rpx;
  330. }
  331. }
  332. }
  333. }
  334. .center {
  335. margin-top: 40rpx;
  336. padding-bottom: 20rpx;
  337. border-bottom: 1rpx solid #DCDCDC;
  338. .tags {
  339. flex-wrap: wrap;
  340. .tag {
  341. border-radius: 28rpx;
  342. background-color: #F3F3F3;
  343. padding: 0rpx 20rpx;
  344. border: 1px solid #DCDCDC;
  345. margin-right: 18rpx;
  346. margin-bottom: 15rpx;
  347. color: #333333;
  348. font-size: 26rpx;
  349. display: flex;
  350. flex-direction: row;
  351. justify-content: center;
  352. align-items: center;
  353. height: 57rpx;
  354. &:last-child {
  355. margin-right: 0rpx;
  356. margin-bottom: 0px;
  357. }
  358. .tag-close {
  359. width: 32rpx;
  360. height: 32rpx;
  361. margin-left: 15rpx;
  362. }
  363. }
  364. }
  365. }
  366. }
  367. .btn {
  368. margin: 60rpx 40rpx 0rpx;
  369. }
  370. .uni-list-cell {
  371. display: flex;
  372. margin: 10rpx auto;
  373. width: 90%;
  374. justify-content: space-between;
  375. align-items: center;
  376. }
  377. </style>