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

order-evaluate-product.vue 9.8KB

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