多租户商城-商户小程序端
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

220 lines
5.7 KiB

2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
  1. <template>
  2. <view class="container">
  3. <global-loading />
  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="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 class="textarea-text" v-model="commentText" maxlength="200" placeholder-style="color:#BBBBBB" placeholder="亲,有什么需要追加的吗"/>
  22. </view>
  23. <view class="mar-left-10 mar-top-10 evaluateImg">
  24. <u-upload :action="action" ref="uUpload" :limitType="['png', 'jpg', 'jpeg', 'webp', 'gif', 'image']" :header="headerToken" :form-data="formData"></u-upload>
  25. </view>
  26. </view>
  27. </view>
  28. <view class="butBox flex-items-plus mar-left-30">
  29. <view class="submitbut" @click="submitTap">追加评论</view>
  30. </view>
  31. </view>
  32. </template>
  33. <script>
  34. const NET = require('../../utils/request')
  35. const API = require('../../config/api')
  36. export default {
  37. data() {
  38. return {
  39. addCommentVOList:{},
  40. orderProductVO:{},
  41. commentText:'',
  42. fileList:[],
  43. commentImgsFlag:false,
  44. commentImgs:'',
  45. action:API.UploadUrl,
  46. formData:{'folderId': -1},
  47. headerToken:{Authorization:''},
  48. productImage:'',
  49. type:0
  50. }
  51. },
  52. onLoad(options) {
  53. this.type = options.type;
  54. if(options.detail){
  55. const params = this.$getJumpParam(options)
  56. this.addCommentVOList = params.addCommentVOList
  57. this.orderProductVO = params.type===1?this.addCommentVOList.skus[0]:this.addCommentVOList
  58. this.productImage = this.orderProductVO.image
  59. }else{
  60. if(options.type == 1){
  61. this.addCommentVOList = uni.getStorageSync('addCommentVOList');
  62. this.orderProductVO = this.addCommentVOList.skus[0]
  63. this.productImage = this.orderProductVO.image
  64. }else{
  65. this.addCommentVOList = uni.getStorageSync('addCommentVOList');
  66. this.orderProductVO = this.addCommentVOList
  67. this.productImage = this.orderProductVO.productImage
  68. }
  69. uni.removeStorageSync('addCommentVOList')
  70. }
  71. if(options.commentId){
  72. this.commentId = options.commentId
  73. }
  74. const res = uni.getStorageSync('storage_key');
  75. this.headerToken.Authorization = res.token
  76. },
  77. onReady() {
  78. this.fileList = this.$refs.uUpload.lists
  79. },
  80. methods: {
  81. submitTap(){
  82. if (!this.commentText) {
  83. uni.showToast({
  84. title: '请先说点什么吧',
  85. icon: 'none'
  86. })
  87. return
  88. }
  89. // uni.showLoading({
  90. // title: '提交中...',
  91. // })
  92. if(this.fileList.length>0){
  93. this.commentImgsFlag = true
  94. for(let i=0;i<this.fileList.length;i++){
  95. this.commentImgs += this.fileList[i].response.data.url+','
  96. }
  97. }
  98. let data = []
  99. if(this.type == 1){
  100. data = [{
  101. commentId:this.commentId,
  102. image:this.commentImgs,
  103. comment:this.commentText
  104. }]
  105. }else if(this.type == 2){
  106. data = [{
  107. commentId:this.addCommentVOList.commentId,
  108. image:this.commentImgs,
  109. comment:this.commentText
  110. }]
  111. }
  112. NET.request(API.AdditionalComment,{params:data} , 'POST').then(res => {
  113. uni.hideLoading()
  114. uni.showToast({
  115. title: '追评成功',
  116. })
  117. setTimeout(() => {
  118. uni.redirectTo({
  119. url: 'userEvaluate'
  120. })
  121. }, 1500);
  122. }).catch(res => {
  123. uni.hideLoading()
  124. uni.showToast({
  125. title: res.message,
  126. })
  127. })
  128. }
  129. }
  130. }
  131. </script>
  132. <style lang="scss">
  133. page{
  134. background-color: #F7F7F7;
  135. }
  136. .container{
  137. .addEvaluate-box{
  138. margin-top: 20upx;
  139. .addEvaluate{
  140. width: 690upx;
  141. background-color: #FFFFFF;
  142. border-radius: 10upx;
  143. padding-bottom: 30upx;
  144. .addEvaluateText {
  145. font-weight: bold;
  146. }
  147. .addEvaluateTitle-box{
  148. .title-img{
  149. width: 90upx;
  150. height: 90upx;
  151. border-radius: 4upx;
  152. }
  153. .title-textbox{
  154. width: 530upx;
  155. margin-left: 20upx;
  156. font-weight: bold;
  157. .sukValue {
  158. color: #CCCCCC;
  159. font-weight: 400;
  160. }
  161. }
  162. }
  163. }
  164. .textarea-box{
  165. .textarea-text{
  166. width: 610upx;
  167. height: 200upx;
  168. background-color: #FFFFFF;
  169. font-size: 26upx;
  170. padding: 20upx 20upx;
  171. border: 2rpx solid #E4E5E6;
  172. }
  173. }
  174. .addPicture-box{
  175. background-color: #F5F5F5;
  176. width: 40upx;
  177. height: 40upx;
  178. margin-top: 100upx;
  179. margin-left: 100upx;
  180. border-radius: 10upx;
  181. display: flex;
  182. justify-content: center;
  183. align-items: center;
  184. color: #BBBBBB;
  185. }
  186. }
  187. .butBox{
  188. position: absolute;
  189. bottom: 40upx;
  190. .submitbut{
  191. height: 100upx;
  192. width: 690upx;
  193. background: #333333;
  194. color: #FFEBC4;
  195. font-size: 28upx;
  196. text-align: center;
  197. line-height: 100upx;
  198. }
  199. }
  200. }
  201. </style>
  202. <style scoped>
  203. .evaluateImg /deep/ .u-upload .u-list-item {
  204. background: none;
  205. border: 2rpx solid #E4E5E6;
  206. border-radius: 0;
  207. }
  208. .evaluateImg /deep/ .u-upload .u-list-item .uicon-plus:before {
  209. content: '';
  210. height: 71rpx;
  211. width: 71rpx;
  212. background: url("https://ceres.zkthink.com/static/images/addImg.png") no-repeat center center;
  213. display: block;
  214. background-size: contain;
  215. }
  216. </style>