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-product.vue 10KB

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