Ви не можете вибрати більше 25 тем Теми мають розпочинатися з літери або цифри, можуть містити дефіси (-) і не повинні перевищувати 35 символів.

order-evaluate-salesman.vue 10KB

2 роки тому
2 роки тому
2 роки тому
2 роки тому
2 роки тому
2 роки тому
2 роки тому
2 роки тому
2 роки тому
2 роки тому
2 роки тому
2 роки тому
2 роки тому
2 роки тому
2 роки тому
2 роки тому
2 роки тому
2 роки тому
2 роки тому
2 роки тому
2 роки тому
2 роки тому
2 роки тому
2 роки тому
2 роки тому
2 роки тому
2 роки тому
2 роки тому
2 роки тому
2 роки тому
2 роки тому
2 роки тому
2 роки тому
2 роки тому
2 роки тому
2 роки тому
2 роки тому
2 роки тому
2 роки тому
2 роки тому
2 роки тому
2 роки тому
2 роки тому
2 роки тому
2 роки тому
2 роки тому
2 роки тому
2 роки тому
2 роки тому
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372
  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="btn">
  57. <submit-button @submit="publish" title="发布"></submit-button>
  58. </view>
  59. <!-- 选择标签弹窗 业务员办理满意度弹框-->
  60. <u-popup v-model="state.showTagPop1" mode="bottom" height="60%">
  61. <view v-if="state.showTagPop1">
  62. <tag-popup :selTags="state.handle.tagList" :tagAllList="state.tagAllList" @cancel="state.showTagPop1 = !state.showTagPop1" @confirm="confirmSelectTag1"></tag-popup>
  63. </view>
  64. </u-popup>
  65. <!-- 选择标签弹窗 业务员满意度弹框-->
  66. <u-popup v-model="state.showTagPop" mode="bottom" height="60%">
  67. <view v-if="state.showTagPop">
  68. <tag-popup :selTags="state.user.tagList" :tagAllList="state.tagAllList" @cancel="state.showTagPop = !state.showTagPop" @confirm="confirmSelectTag"></tag-popup>
  69. </view>
  70. </u-popup>
  71. </template>
  72. <script setup lang="ts">
  73. import evaluateStar from "./components/evaluate-star.vue"
  74. import {reactive} from "vue";
  75. import {confirm, isBlank, msg} from "@/utils/utils";
  76. import tagPopup from "./components/popup-order-evaluate-tag";
  77. import { request } from "@/utils/network/request";
  78. import { orderDetail, orderEvaluate,orderEvaluateTag,salesmanMsg } from "@/utils/network/api";
  79. import {onLoad} from "@dcloudio/uni-app";
  80. import { stringToJson } from "@/utils/network/encryption";
  81. import { getItem, StorageKeys } from "@/utils/storage";
  82. const state = reactive({
  83. orderInfo:{} as any, //订单信息
  84. haveUser: false, //存在有业务员发起的业务展示业务员评价模块
  85. showTagPop1:false, //第一个弹框
  86. showTagPop: false, //显示标签选择弹窗
  87. handle: { //办理满意度
  88. score: 0, //星级得分 最高5分,0.5小数点 2.5分及以下为差评 2.5以上4.0以下为中评 4.0及4.0以上为好评(必选)
  89. content: '', //评价内容
  90. tagList: [], //已选择的评价标签列表
  91. },
  92. user: { //业务员
  93. score: 0, //星级得分 最高5分,0.5小数点 2.5分及以下为差评 2.5以上4.0以下为中评 4.0及4.0以上为好评(必选)
  94. content: '', //评价内容
  95. tagList: [], //已选择的评价标签列表
  96. },
  97. tagAllList:[]
  98. })
  99. /* 确认选择tag 满意度 */
  100. const confirmSelectTag1 = (selectTag) => {
  101. state.showTagPop1 = !state.showTagPop1
  102. state.handle.tagList = [...selectTag];
  103. }
  104. /* 确认选择tag 业务员*/
  105. const confirmSelectTag = (selectTag) => {
  106. state.showTagPop = !state.showTagPop
  107. state.user.tagList = [...selectTag];
  108. }
  109. /* 删除评价标签 满意度*/
  110. const removeTag1 = (item: any) => {
  111. state.handle.tagList.map((tag, index) => {
  112. if (tag.id === item.id) {
  113. state.handle.tagList.splice(index, 1)
  114. }
  115. })
  116. }
  117. /* 删除评价标签 业务员*/
  118. const removeTag = (item: any) => {
  119. state.user.tagList.map((tag, index) => {
  120. if (tag.id === item.id) {
  121. state.user.tagList.splice(index, 1)
  122. }
  123. })
  124. }
  125. /* 发布 */
  126. const publish = (e) => {
  127. if (state.handle.score === 0) {
  128. msg('请对业务员办理满意度进行打分!');
  129. return;
  130. }
  131. if (state.haveUser && state.user.score === 0) {
  132. msg('请对业务员进行打分!');
  133. return;
  134. }
  135. //若不填评价内容,根据打分规则自动填充评价内容
  136. //差评展示:默认差评 2.5分及以下
  137. //中评展示:默认中评 2.5以上4.0以下
  138. //好评展示:默认好评 4.0及4.0以上
  139. if (!state.handle.content) {
  140. if (state.handle.score <= 2.5) {
  141. state.handle.content = "默认差评";
  142. } else if (state.handle.score > 2.5 && state.handle.score < 4) {
  143. state.handle.content = "默认中评";
  144. } else {
  145. state.handle.content = "默认好评";
  146. }
  147. }
  148. if (state.haveUser && !state.user.content) {
  149. if (state.user.score <= 2.5) {
  150. state.user.content = "默认差评";
  151. } else if (state.user.score > 2.5 && state.user.score < 4) {
  152. state.user.content = "默认中评";
  153. } else {
  154. state.user.content = "默认好评";
  155. }
  156. }
  157. const options = {
  158. type: 2,
  159. data: {
  160. "id": state.orderInfo.id,
  161. 'productScore': state.handle.score,
  162. 'productAppraise':state.handle.content,
  163. // 'appraisePics':state.handle.imageList.join(";"),
  164. 'staffId':state.orderInfo.openId, //业务员ID
  165. 'staffName':state.orderInfo.nickName,
  166. 'staffScore':state.user.score,
  167. 'staffTips':getTagIds().join(';'),
  168. 'staffAppraise':state.user.content,
  169. 'opId':getItem(StorageKeys.OpenId)
  170. },
  171. method: 'POST',
  172. showLoading: true,
  173. }
  174. request(orderEvaluate,options).then((res)=>{
  175. confirm('您的评价已发布成功!',()=>{
  176. uni.$emit('refreshOrder');
  177. uni.navigateBack();
  178. },'发布成功',false);
  179. })
  180. }
  181. /* 获取业务员标签ID */
  182. const getTagIds = () => {
  183. const list = [];
  184. state.user.tagList.map((tag)=>{
  185. list.push(tag.id);
  186. });
  187. return list;
  188. }
  189. /* 获取订单详情 */
  190. const getOrderDetails = (id) => {
  191. const options = {
  192. type: 2,
  193. data: {"id": id},
  194. method: 'POST',
  195. showLoading: true,
  196. }
  197. request(orderDetail, options).then((res) => {
  198. console.log("stringToJson(res.bizContent)",stringToJson(res.bizContent))
  199. state.orderInfo = stringToJson(res.bizContent);
  200. state.haveUser = !isBlank(state.orderInfo.staffId);
  201. })
  202. }
  203. /* 订单查询业务员简单信息 */
  204. const getSalesmanMsg = (id) => {
  205. const options = {
  206. type: 2,
  207. data: {"id": id},
  208. method: 'POST',
  209. showLoading: true,
  210. }
  211. request(salesmanMsg, options).then((res) => {
  212. console.log("stringToJson(res.bizContent)",stringToJson(res.bizContent))
  213. state.orderInfo = stringToJson(res.bizContent);
  214. // state.haveUser = !isBlank(state.orderInfo.openId);
  215. state.haveUser = true;
  216. })
  217. }
  218. /* 获取评价标签 */
  219. const getEnvTag = () => {
  220. const options = {
  221. type: 2,
  222. data: {},
  223. method: 'POST',
  224. showLoading: true,
  225. }
  226. request(orderEvaluateTag, options).then((res) => {
  227. state.tagAllList = stringToJson(res.bizContent);
  228. })
  229. }
  230. onLoad((option) => {
  231. // getOrderDetails(option.id);
  232. getSalesmanMsg(option.id);
  233. getEnvTag();
  234. })
  235. </script>
  236. <style>
  237. page {
  238. background-color: #EEF7F7;
  239. padding-bottom: 50rpx;
  240. }
  241. </style>
  242. <style lang="scss" scoped>
  243. .card {
  244. background-color: white;
  245. border-radius: 20rpx;
  246. box-shadow: 0px 0px 6rpx 2rpx rgba(223, 223, 223, 0.3);
  247. margin: 30rpx;
  248. .title {
  249. text-align: center;
  250. font-size: 32rpx;
  251. color: #333333;
  252. padding-bottom: 30rpx;
  253. }
  254. .upload-img {
  255. margin-top: 10rpx;
  256. }
  257. .rate {
  258. .rate-label {
  259. font-size: 28rpx;
  260. color: #333333;
  261. padding-right: 20rpx;
  262. }
  263. }
  264. .input-box {
  265. width: 100%;
  266. border: 1px solid #DCDCDC;
  267. border-radius: 10rpx;
  268. background-color: #F3F3F3;
  269. padding: 30rpx;
  270. box-sizing: border-box;
  271. -moz-box-sizing: border-box;
  272. /*Firefox*/
  273. -webkit-box-sizing: border-box;
  274. /*Safari*/
  275. margin-top: 30rpx;
  276. }
  277. .text-hine {
  278. color: #999999;
  279. font-size: 26rpx;
  280. }
  281. .title1 {
  282. font-size: 30rpx;
  283. color: #333333;
  284. border-bottom: 1px solid #DCDCDC;
  285. padding: 30rpx;
  286. }
  287. .user {
  288. margin-bottom: 40rpx;
  289. .avatar {
  290. width: 140rpx;
  291. height: 160rpx;
  292. background-color: #F3F3F3;
  293. border-radius: 10rpx;
  294. }
  295. .user-info {
  296. margin-left: 40rpx;
  297. margin-top: 28rpx;
  298. .name {
  299. font-size: 28rpx;
  300. color: #333333;
  301. &:last-child {
  302. margin-top: 40rpx;
  303. }
  304. }
  305. }
  306. }
  307. .center {
  308. margin-top: 40rpx;
  309. padding-bottom: 20rpx;
  310. border-bottom: 1rpx solid #DCDCDC;
  311. .tags {
  312. flex-wrap: wrap;
  313. .tag {
  314. border-radius: 28rpx;
  315. background-color: #F3F3F3;
  316. padding: 0rpx 20rpx;
  317. border: 1px solid #DCDCDC;
  318. margin-right: 18rpx;
  319. margin-bottom: 15rpx;
  320. color: #333333;
  321. font-size: 26rpx;
  322. display: flex;
  323. flex-direction: row;
  324. justify-content: center;
  325. align-items: center;
  326. height: 57rpx;
  327. &:last-child {
  328. margin-right: 0rpx;
  329. margin-bottom: 0px;
  330. }
  331. .tag-close {
  332. width: 32rpx;
  333. height: 32rpx;
  334. margin-left: 15rpx;
  335. }
  336. }
  337. }
  338. }
  339. }
  340. .btn {
  341. margin: 60rpx 40rpx 0rpx;
  342. }
  343. </style>