index.vue 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203
  1. <template>
  2. <view class="container">
  3. <JHeader title="追加评价" width="50" height="50" style="padding: 24upx 0 0;"></JHeader>
  4. <!-- 追加评论 -->
  5. <view class="addEvaluate-box flex-items-plus flex-column-plus">
  6. <view class="addEvaluate flex-column-plus">
  7. <view class="addEvaluateTitle-box flex-row-plus mar-top-20 mar-left-20">
  8. <image class="title-img" :src="common.seamingImgUrl(productImage)"></image>
  9. <view class="title-textbox overflow">
  10. <label class="fs28 title-text">{{ orderProductVO.productName }}</label>
  11. <view v-if="orderProductVO.value" class="fs24 mar-top-10 sukValue">
  12. {{ orderProductVO.value }}
  13. </view>
  14. <view v-else class="font-color-999 fs24 mar-top-10">
  15. 默认规格
  16. </view>
  17. </view>
  18. </view>
  19. <view class="fs26 mar-top-40 mar-left-20 addEvaluateText">追加评价</view>
  20. <view class="textarea-box mar-top-20 mar-left-20">
  21. <textarea
  22. v-model="commentText" class="textarea-text" maxlength="200" placeholder-style="color:#BBBBBB"
  23. placeholder="亲,有什么需要追加的吗"
  24. />
  25. </view>
  26. <view class="mar-left-10 mar-top-10 evaluateImg">
  27. <ATFMoreUpload :imgs="fileList" @upload="handleSaveImg" @delete="handleDeleteImg"></ATFMoreUpload>
  28. </view>
  29. </view>
  30. </view>
  31. <view class="butBox flex-items-plus mar-left-30">
  32. <view class="submitbut" @click="submitTap">追加评论</view>
  33. </view>
  34. </view>
  35. </template>
  36. <script>
  37. import { addToCommentOrderAdditionalApi } from '../../../api/anotherTFInterface'
  38. export default {
  39. name: 'AddEvaluate',
  40. data() {
  41. return {
  42. type: '',
  43. addCommentVOData: {},
  44. orderProductVO: {},
  45. productImage: '',
  46. commentId: '',
  47. commentText: '',
  48. fileList: [],
  49. commentImgs: ''
  50. }
  51. },
  52. onLoad(options) {
  53. this.type = Number(options.type)
  54. uni.$on('sendAddEvaluateMsg', (data) => {
  55. if (data.addCommentVOData) {
  56. if (this.type == 1) { // 针对一个订单下面的每个产品的评论
  57. this.addCommentVOData = data.addCommentVOData
  58. this.orderProductVO = this.addCommentVOData.skus[0]
  59. this.productImage = this.orderProductVO.image
  60. if (options.commentId) this.commentId = options.commentId
  61. } else if (this.type == 2) { // 针对一个产品的评论
  62. this.addCommentVOData = data.addCommentVOData
  63. this.orderProductVO = this.addCommentVOData
  64. this.productImage = this.orderProductVO.productImage
  65. this.commentId = this.addCommentVOData.commentId
  66. }
  67. }
  68. })
  69. },
  70. methods: {
  71. handleSaveImg(imgUrl) {
  72. this.fileList.push(imgUrl)
  73. this.$forceUpdate()
  74. },
  75. handleDeleteImg(imgUrl) {
  76. this.fileList.splice(this.fileList.findIndex((item) => item === imgUrl), 1)
  77. this.$forceUpdate()
  78. },
  79. submitTap() {
  80. if (!this.commentText) {
  81. uni.showToast({
  82. title: '请先说点什么吧',
  83. icon: 'none'
  84. })
  85. return
  86. }
  87. uni.showLoading({
  88. title: '提交中...'
  89. })
  90. if (this.fileList.length > 0) {
  91. for (let i = 0; i < this.fileList.length; i++) {
  92. this.commentImgs += this.fileList[i] + ','
  93. }
  94. }
  95. let data = []
  96. if (this.type) {
  97. data = [ {
  98. commentId: this.commentId,
  99. image: this.commentImgs,
  100. comment: this.commentText
  101. } ]
  102. }
  103. addToCommentOrderAdditionalApi({ params: data }).then((res) => {
  104. uni.hideLoading()
  105. uni.showToast({
  106. title: '追评成功'
  107. })
  108. setTimeout(() => {
  109. uni.redirectTo({
  110. url: `/another-tf/another-serve/userEvaluate/index`
  111. })
  112. }, 1500)
  113. })
  114. .catch((e) => {
  115. uni.hideLoading()
  116. })
  117. }
  118. }
  119. }
  120. </script>
  121. <style lang="scss" scoped>
  122. .container {
  123. background-color: #F7F7F7;
  124. min-height: 100vh;
  125. box-sizing: border-box;
  126. .addEvaluate-box {
  127. margin-top: 20upx;
  128. .addEvaluate {
  129. width: 690upx;
  130. background-color: #FFFFFF;
  131. border-radius: 10upx;
  132. padding-bottom: 30upx;
  133. .addEvaluateText {
  134. font-weight: bold;
  135. }
  136. .addEvaluateTitle-box {
  137. .title-img {
  138. width: 90upx;
  139. height: 90upx;
  140. border-radius: 4upx;
  141. }
  142. .title-textbox {
  143. width: 530upx;
  144. margin-left: 20upx;
  145. font-weight: bold;
  146. .sukValue {
  147. color: #CCCCCC;
  148. font-weight: 400;
  149. }
  150. }
  151. }
  152. }
  153. .textarea-box {
  154. .textarea-text {
  155. width: 610upx;
  156. height: 200upx;
  157. background-color: #FFFFFF;
  158. font-size: 26upx;
  159. padding: 20upx 20upx;
  160. border: 2rpx solid #E4E5E6;
  161. }
  162. }
  163. .addPicture-box {
  164. background-color: #F5F5F5;
  165. width: 40upx;
  166. height: 40upx;
  167. margin-top: 100upx;
  168. margin-left: 100upx;
  169. border-radius: 10upx;
  170. display: flex;
  171. justify-content: center;
  172. align-items: center;
  173. color: #BBBBBB;
  174. }
  175. }
  176. .butBox {
  177. position: absolute;
  178. bottom: 40upx;
  179. .submitbut {
  180. height: 100upx;
  181. width: 690upx;
  182. background: #333333;
  183. color: #FFEBC4;
  184. font-size: 28upx;
  185. text-align: center;
  186. line-height: 100upx;
  187. }
  188. }
  189. }
  190. </style>