選択できるのは25トピックまでです。 トピックは、先頭が英数字で、英数字とダッシュ('-')を使用した35文字以内のものにしてください。

order-evaluate-product.vue 11KB

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