您最多选择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年前
1年前
1年前
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409
  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, 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. })
  182. }
  183. const addProductInterest = () => {
  184. //若不填评价内容,根据打分规则自动填充评价内容
  185. //差评展示:默认差评 2.5分及以下
  186. //中评展示:默认中评 2.5以上4.0以下
  187. //好评展示:默认好评 4.0及4.0以上
  188. if (!state.handle.content) {
  189. if (state.handle.score <= 2.5) {
  190. state.handle.content = "默认差评";
  191. } else if (state.handle.score > 2.5 && state.handle.score < 4) {
  192. state.handle.content = "默认中评";
  193. } else {
  194. state.handle.content = "默认好评";
  195. }
  196. }
  197. const tagListArr = [];
  198. for (var i = 0; i < state.handle.tagList.length; i++) {
  199. tagListArr.push(state.handle.tagList[i].label)
  200. }
  201. const options = {
  202. type: 2,
  203. data: {
  204. "orderId": state.orderId,
  205. "serviceType": "service",
  206. "equityId": state.orderInfo.equityId,//权益产品id
  207. "score": state.handle.score,
  208. "message": tagListArr.toString(),
  209. "suggestion": state.handle.content,
  210. "isAnonymity": state.isAnonymity
  211. },
  212. method: 'POST',
  213. showLoading: true,
  214. }
  215. console.log("options", options)
  216. request(addEvaluation, options).then((res) => {
  217. confirm('您的评价已发布成功!', () => {
  218. uni.$emit('refreshOrder');
  219. uni.navigateBack();
  220. }, '发布成功', false);
  221. })
  222. }
  223. /* 获取业务员标签ID */
  224. const getTagIds = () => {
  225. const list = [];
  226. state.handle.tagList.map((tag) => {
  227. list.push(tag.id);
  228. });
  229. return list;
  230. }
  231. /* 获取订单详情 */
  232. const getOrderDetails = (id) => {
  233. const options = {
  234. type: 2,
  235. data: { "id": id },
  236. method: 'POST',
  237. showLoading: true,
  238. }
  239. request(orderDetail, options).then((res) => {
  240. state.orderInfo = stringToJson(res.bizContent);
  241. console.log("获取订单详情", stringToJson(res.bizContent), state.orderInfo.equityId)
  242. })
  243. }
  244. // 是否匿名
  245. const switchChange = (e) => {
  246. console.log('switch1 发生 change 事件,携带值为', e.detail.value);
  247. if (e.detail.value == true) {
  248. state.isAnonymity = 1
  249. } else {
  250. state.isAnonymity = 0
  251. }
  252. }
  253. onLoad((option) => {
  254. console.log("option11111", option)
  255. getOrderDetails(option.id);
  256. getEnvTag()
  257. state.orderId = option.orderId
  258. })
  259. </script>
  260. <style>
  261. page {
  262. background-color: #EEF7F7;
  263. padding-bottom: 50rpx;
  264. }
  265. </style>
  266. <style lang="scss" scoped>
  267. .card {
  268. background-color: white;
  269. border-radius: 20rpx;
  270. box-shadow: 0px 0px 6rpx 2rpx rgba(223, 223, 223, 0.3);
  271. margin: 30rpx;
  272. .title {
  273. text-align: center;
  274. font-size: 32rpx;
  275. color: #333333;
  276. padding-bottom: 30rpx;
  277. }
  278. .upload-img {
  279. margin-top: 10rpx;
  280. }
  281. .rate {
  282. .rate-label {
  283. font-size: 28rpx;
  284. color: #333333;
  285. padding-right: 20rpx;
  286. }
  287. }
  288. .input-box {
  289. width: 100%;
  290. border: 1px solid #DCDCDC;
  291. border-radius: 10rpx;
  292. background-color: #F3F3F3;
  293. padding: 30rpx;
  294. box-sizing: border-box;
  295. -moz-box-sizing: border-box;
  296. /*Firefox*/
  297. -webkit-box-sizing: border-box;
  298. /*Safari*/
  299. margin-top: 30rpx;
  300. }
  301. .text-hine {
  302. color: #999999;
  303. font-size: 26rpx;
  304. }
  305. .title1 {
  306. font-size: 30rpx;
  307. color: #333333;
  308. border-bottom: 1px solid #DCDCDC;
  309. padding: 30rpx;
  310. }
  311. .title1 {
  312. font-size: 30rpx;
  313. color: #333333;
  314. border-bottom: 1px solid #DCDCDC;
  315. padding: 30rpx;
  316. }
  317. .user {
  318. margin-bottom: 40rpx;
  319. .avatar {
  320. width: 140rpx;
  321. height: 160rpx;
  322. background-color: #F3F3F3;
  323. border-radius: 10rpx;
  324. }
  325. .user-info {
  326. margin-left: 40rpx;
  327. margin-top: 28rpx;
  328. .name {
  329. font-size: 28rpx;
  330. color: #333333;
  331. &:last-child {
  332. margin-top: 40rpx;
  333. }
  334. }
  335. }
  336. }
  337. .center {
  338. margin-top: 40rpx;
  339. padding-bottom: 20rpx;
  340. border-bottom: 1rpx solid #DCDCDC;
  341. .tags {
  342. flex-wrap: wrap;
  343. .tag {
  344. border-radius: 28rpx;
  345. background-color: #F3F3F3;
  346. padding: 0rpx 20rpx;
  347. border: 1px solid #DCDCDC;
  348. margin-right: 18rpx;
  349. margin-bottom: 15rpx;
  350. color: #333333;
  351. font-size: 26rpx;
  352. display: flex;
  353. flex-direction: row;
  354. justify-content: center;
  355. align-items: center;
  356. height: 57rpx;
  357. &:last-child {
  358. margin-right: 0rpx;
  359. margin-bottom: 0px;
  360. }
  361. .tag-close {
  362. width: 32rpx;
  363. height: 32rpx;
  364. margin-left: 15rpx;
  365. }
  366. }
  367. }
  368. }
  369. }
  370. .btn {
  371. margin: 60rpx 40rpx 0rpx;
  372. }
  373. .uni-list-cell {
  374. display: flex;
  375. margin: 10rpx auto;
  376. width: 90%;
  377. justify-content: space-between;
  378. align-items: center;
  379. }
  380. </style>