orderComment - 副本.vue 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596
  1. <template>
  2. <view class="container">
  3. <view class="top-box">
  4. <view class="top-rate">
  5. <view class="title">评价得分:</view>
  6. <u-rate count="5" v-model="queryParams.score"></u-rate>
  7. </view>
  8. <view class="content-box">
  9. <view class="title">评价内容:</view>
  10. <view class="comment-box">
  11. <u--textarea v-model="queryParams.remark" count placeholder="请输入评价内容" ></u--textarea>
  12. </view>
  13. </view>
  14. </view>
  15. <button class="btn" @click="handlerContextSumbit">提交</button>
  16. </view>
  17. </template>
  18. <script>
  19. import { goodsCommentsAdd } from "@/api/client/business.js"
  20. export default {
  21. data(){
  22. return{
  23. queryParams:{
  24. score:0,//评价打分
  25. remark:'',//评价内容
  26. goodsId: "", // 商品id
  27. orderId: "", // 订单id
  28. merchantId: "", // 商家id
  29. },
  30. }
  31. },
  32. onLoad(option){
  33. let { goodsList , orderList } = option
  34. this.queryParams.orderId = goodsList.orderId
  35. this.queryParams.goodsId = goodsList.goodsId
  36. this.queryParams.merchantId = orderList.merchantId
  37. },
  38. methods:{
  39. // 测试提交
  40. handlerContextSumbit(){
  41. goodsCommentsAdd(this.queryParams).then(res=>{
  42. if(res.code === 'OK'){
  43. uni.showToast({
  44. title:"评论成功",
  45. icon:'none'
  46. })
  47. setTimeout(()=>{
  48. uni.navigateBack(-1)
  49. },1500)
  50. }else{
  51. uni.showToast({
  52. title:res.msg,
  53. icon:'none'
  54. })
  55. }
  56. })
  57. },
  58. }
  59. }
  60. </script>
  61. <style lang="scss" scope>
  62. .container{
  63. padding: 20rpx;
  64. .top-box{
  65. padding: 20rpx;
  66. border-radius: 20rpx;
  67. box-shadow: 0 5rpx 12rpx 0 rgba(0,0,0,0.2);
  68. background-color: #fff;
  69. .top-rate{
  70. display: flex;
  71. align-items: center;
  72. }
  73. .content-box{
  74. margin-top: 20rpx;
  75. .comment-box{
  76. margin-top: 20rpx;
  77. }
  78. }
  79. .title{
  80. color: #000;
  81. font-size: 28rpx;
  82. }
  83. }
  84. .btn{
  85. margin-top: 20rpx;
  86. background-color: #F57F32;
  87. color: #fff;
  88. font-size:28rpx;
  89. border-radius: 20rpx;
  90. box-shadow: 0 5rpx 10rpx 0 rgba(245,127,50, 0.8);
  91. }
  92. }
  93. </style>