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

order-evaluate-product.vue 9.9KB

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