多租户商城-商户小程序端
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.

222 lines
5.9 KiB

2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
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 font-color-252744 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">{{ $t('page.additionalevaluation')}}</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:#90919C" 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">{{ $t('common.submit') }}</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: #FAFAFA;;
  135. }
  136. .container{
  137. .addEvaluate-box{
  138. margin-top: 20upx;
  139. .addEvaluate{
  140. width: 690upx;
  141. background-color: #FFFFFF;
  142. box-shadow: 0rpx 20rpx 40rpx 0rpx #F2F2F2;
  143. border-radius: 30rpx;
  144. padding-bottom: 30upx;
  145. .addEvaluateText {
  146. color: #252744;
  147. font-size: 28rpx;
  148. font-weight: bold;
  149. }
  150. .addEvaluateTitle-box{
  151. .title-img{
  152. width: 90rpx;
  153. height: 90rpx;
  154. border-radius: 20rpx;
  155. }
  156. .title-textbox{
  157. width: 530upx;
  158. margin-left: 20upx;
  159. .sukValue {
  160. color: #90919C;
  161. font-weight: 400;
  162. }
  163. }
  164. }
  165. }
  166. .textarea-box{
  167. .textarea-text{
  168. width: 610upx;
  169. height: 200upx;
  170. background-color: #FAFAFA;
  171. font-size: 28rpx;
  172. padding: 20rpx 20rpx;
  173. border-radius: 20rpx;
  174. }
  175. }
  176. .addPicture-box{
  177. background-color: #F5F5F5;
  178. width: 40upx;
  179. height: 40upx;
  180. margin-top: 100upx;
  181. margin-left: 100upx;
  182. border-radius: 10upx;
  183. display: flex;
  184. justify-content: center;
  185. align-items: center;
  186. color: #BBBBBB;
  187. }
  188. }
  189. .butBox{
  190. position: absolute;
  191. bottom: 40rpx;
  192. .submitbut{
  193. height: 98rpx;
  194. width: 690rpx;
  195. background: #252744;
  196. color: #FFFFFF;
  197. font-size: 32rpx;
  198. text-align: center;
  199. line-height: 98rpx;
  200. border-radius: 50rpx;
  201. }
  202. }
  203. }
  204. </style>
  205. <style scoped>
  206. .evaluateImg /deep/ .u-upload .u-list-item {
  207. background: #FAFAFA;
  208. border-radius: 20rpx;
  209. }
  210. .evaluateImg /deep/ .u-upload .u-list-item .uicon-plus:before {
  211. content: '';
  212. height: 52rpx;
  213. width: 52rpx;
  214. background: url("http://36.138.125.206:8081/ceres-local-file/image/pic_add.png") no-repeat center center;
  215. display: block;
  216. background-size: contain;
  217. }
  218. </style>