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

424 lines
14 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
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. <!-- 骨架屏 -->
  4. <Skeleton
  5. el-color="#f1f3f4"
  6. bg-color="#fff"
  7. :loading="loading"
  8. :animation="true"
  9. ></Skeleton>
  10. <global-loading />
  11. <view class="u-skeleton">
  12. <!-- 我的评论 -->
  13. <view class="evaluateTitle-box flex-row-plus flex-sp-around u-skeleton-fillet">
  14. <view class="allEvaluate"
  15. :class="{'evaluateTitle-on' : evaluateTitleFlag == 1}"
  16. @click="evaluateTitleClick(1)"
  17. >全部评价({{ myCommentList.total || 0}})</view>
  18. <view class="font-color-BCBDC6">|</view>
  19. <view
  20. :class="{'evaluateTitle-on' : evaluateTitleFlag == 2}"
  21. @click="evaluateTitleClick(2)"
  22. >有图({{ myCommentList.imageTotal || 0}})</view>
  23. </view>
  24. <view v-if="evaluateTitleFlag == 1" class="mar-top-20">
  25. <template>
  26. <view
  27. class="evaluate-contentbox u-skeleton-fillet evaluate-item"
  28. v-for="(item, index) in commentVOList"
  29. :key="index"
  30. @click="commentDetails(index)"
  31. >
  32. <view class="evaluate-content flex-items flex-row flex-sp-between ">
  33. <view class="flex-items">
  34. <image class="user-headSmallImg u-skeleton-circle" v-if="item.headImage" :src="item.headImage"></image>
  35. <image class="user-headSmallImg u-skeleton-circle" src="http://36.138.125.206:8081/ceres-local-file/static/images/storeLogo.png" v-else></image>
  36. <view class="skuValue u-skeleton-fillet">
  37. <label class="fs28 font-color-252744" v-if="item.name">{{item.name}}</label>
  38. <label class="fs28 font-color-252744" v-else>匿名</label>
  39. <view class="fs22 font-color-90919C mar-top-10">
  40. {{item.value}}
  41. </view>
  42. </view>
  43. </view>
  44. <view class="addCommentsBut" v-if="item.addComment == ''" @click.stop="addCommentsClick(index)">追加评价</view>
  45. </view>
  46. <view class="fs28 pad-topbot-20 u-skeleton-fillet font-color-252744" style="margin-top: 10rpx">{{item.comment}}</view>
  47. <view class="evaluateImg-box" v-if="item.image">
  48. <view v-for="(cItem, index) in commentImgData(item.image)" :key="index">
  49. <image class="evaluate-Img" :src="cItem"></image>
  50. </view>
  51. </view>
  52. <view class="addComments-box flex-column-plus" v-if="item.addComment">
  53. <label class="font-color-C5AA7B mar-top-30">用户追评</label>
  54. <label class="mar-top-20">{{item.addComment}}</label>
  55. <view class="evaluateImg-box mar-top-20" v-if="item.addImage">
  56. <view v-for="(dItem, index) in commentImgData(item.addImage)" :key="index">
  57. <image class="evaluate-Img" :src="dItem"></image>
  58. </view>
  59. </view>
  60. </view>
  61. <view class="goodsDes-box u-skeleton-fillet flex-column-plus mar-top-30">
  62. <view class="flex-row-plus" @click.stop="goGoodsDetails(item.shopId,item.productId,item.skuId)">
  63. <image class="goodsDes-img default-img"
  64. onerror="this.src='url(http://36.138.125.206:8081/ceres-local-file/image/default.png) no-repeat center';this.οnerrοr=null"
  65. :src="item.productImage"></image>
  66. <view class="goodsDesText-box">
  67. <label class="fs28 font-color-252744">{{item.productName}}</label>
  68. <view class="mar-top-70">
  69. <label class="fs32 font-color-252744">¥ {{item.productPrice}}</label>
  70. </view>
  71. </view>
  72. </view>
  73. </view>
  74. <view class="flex-items flex-row mar-top-30 flex-sp-between">
  75. <view class="font-color-90919C fs22">{{item.createTime}}</view>
  76. <view class="praise-box flex-items flex-row">
  77. <image class="praise-icon" @click.stop="zanTap(index,item.commentId,0)" src="http://36.138.125.206:8081/ceres-local-file/image/evaluate_like_active.png"
  78. v-if="item.ifLike"></image>
  79. <image class="praise-icon" @click.stop="zanTap(index,item.commentId,1)" src="http://36.138.125.206:8081/ceres-local-file/image/evaluate_like_normal.png"
  80. v-else></image>
  81. <label class="fs22 font-color-252744 mar-left-10">{{item.likes}}</label>
  82. </view>
  83. </view>
  84. </view>
  85. </template>
  86. <view v-if="evaluateEmpty" class="emptyOrder-box flex-items-plus flex-column">
  87. <image class="emptyOrder-img" src="http://36.138.125.206:8081/ceres-local-file/static/img/bgnull.png"></image>
  88. <label class="font-color-90919C fs26 mar-top-30">你还没有评论哦</label>
  89. </view>
  90. </view>
  91. <view v-if="evaluateTitleFlag == 2" class="mar-top-20">
  92. <template>
  93. <view
  94. class="evaluate-contentbox"
  95. v-for="(item, index) in commentVOList"
  96. :key="index"
  97. >
  98. <view class="evaluate-content flex-column" @click="commentDetails(index)" >
  99. <view class="flex-items">
  100. <image class="user-headSmallImg" v-if="item.headImage" :src="item.headImage"></image>
  101. <image class="user-headSmallImg" src="http://36.138.125.206:8081/ceres-local-file/static/images/storeLogo.png" v-else></image>
  102. <label class="fs28 mar-left-20 font-color-252744" v-if="item.name">{{item.name}}</label>
  103. <label class="fs28 mar-left-20 font-color-252744" v-else>匿名</label>
  104. </view>
  105. <view class="fs22 font-color-90919C mar-top-10">
  106. {{item.value}}
  107. </view>
  108. <view class="fs28 pad-topbot-20 font-color-252744">{{item.comment}}</view>
  109. <view class="evaluateImg-box" v-if="item.image">
  110. <view v-for="(cItem, index) in commentImgData(item.image)" :key="index">
  111. <image class="evaluate-Img" :src="cItem"></image>
  112. </view>
  113. </view>
  114. <view class="addComments-box flex-column-plus" v-if="item.addComment">
  115. <label class="font-color-C5AA7B mar-top-30">用户追评</label>
  116. <label class="mar-top-20">{{item.addComment}}</label>
  117. <view class="evaluateImg-box mar-top-20" v-if="item.addImage">
  118. <view v-for="(dItem, index) in commentImgData(item.addImage)" :key="index">
  119. <image class="evaluate-Img" :src="dItem"></image>
  120. </view>
  121. </view>
  122. </view>
  123. <view class="flex-items flex-row mar-top-30 flex-sp-between">
  124. <view class="font-color-90919C fs22">{{item.createTime}}</view>
  125. <view class="praise-box flex-items flex-row">
  126. <image class="praise-icon" @click.stop="zanTap(index,item.commentId,0)" src="http://36.138.125.206:8081/ceres-local-file/image/evaluate_like_active.png"
  127. v-if="item.ifLike"></image>
  128. <image class="praise-icon" @click.stop="zanTap(index,item.commentId,1)" src="http://36.138.125.206:8081/ceres-local-file/image/evaluate_like_normal.png"
  129. v-else></image>
  130. <label class="fs22 font-color-252744 mar-left-10">{{item.likes}}</label>
  131. </view>
  132. </view>
  133. </view>
  134. </view>
  135. </template>
  136. <view v-if="evaluateEmpty" class="emptyOrder-box flex-items-plus flex-column">
  137. <image class="emptyOrder-img" src="http://36.138.125.206:8081/ceres-local-file/static/img/bgnull.png"></image>
  138. <label class="font-color-90919C fs26 mar-top-30">你还没有评论哦</label>
  139. </view>
  140. </view>
  141. </view>
  142. </view>
  143. </template>
  144. <script>
  145. import Skeleton from "../../components/Skeleton";
  146. const NET = require('../../utils/request')
  147. const API = require('../../config/api')
  148. export default {
  149. components: {Skeleton},
  150. data() {
  151. return {
  152. loading:true,
  153. evaluateTitleFlag: 1,
  154. myCommentList: [],
  155. commentVOList: [],
  156. state:"",
  157. page:1,//当前页
  158. pageSize:20,//每页记录数
  159. loadingType:0,
  160. topLeft: 0,
  161. evaluateEmpty: false
  162. }
  163. },
  164. onShow(){
  165. this.commentVOList = [{
  166. isLoading:true,
  167. name:'',
  168. comment:''
  169. },{
  170. isLoading:true,
  171. name:'',
  172. comment:''
  173. },{
  174. isLoading:true,
  175. name:'',
  176. comment:''
  177. },{
  178. isLoading:true,
  179. name:'',
  180. comment:''
  181. },{
  182. isLoading:true,
  183. name:'',
  184. comment:''
  185. }]
  186. this.getMyCommentList()
  187. },
  188. // onLoad() {
  189. // this.getMyCommentList()
  190. // },
  191. onReachBottom(){
  192. if(this.loadingType == 1){
  193. uni.stopPullDownRefresh()
  194. }else{
  195. this.page = this.page+1
  196. this.getMyCommentList()
  197. }
  198. },
  199. onBackPress(e) {
  200. if (e.from === 'navigateBack') {
  201. return false;
  202. }
  203. this.back();
  204. return true;
  205. },
  206. methods: {
  207. goGoodsDetails(shopId,productId,skuId){
  208. uni.navigateTo({
  209. url:'goodsDetails?shopId='+shopId+'&productId='+productId+'&skuId='+skuId
  210. })
  211. },
  212. back(){
  213. uni.switchTab({
  214. url:'../../pages/tabbar/user/index'
  215. });
  216. },
  217. commentImgData(imgData) {
  218. let imgDataResult = []
  219. imgDataResult = imgData.split(",");
  220. return imgDataResult
  221. },
  222. evaluateTitleClick(type) {
  223. this.evaluateEmpty = false
  224. if(type == 1){
  225. this.state = ''
  226. }else{
  227. this.state = "1"
  228. }
  229. this.page = 1
  230. this.commentVOList = []
  231. this.evaluateTitleFlag = type
  232. this.getMyCommentList()
  233. },
  234. //我的评价列表
  235. getMyCommentList() {
  236. this.$showLoading()
  237. this.loading = true
  238. NET.request(API.MyCommentList, {
  239. page: this.page,
  240. pageSize: this.pageSize,
  241. state: this.state
  242. }, 'GET').then(res => {
  243. uni.hideLoading()
  244. if(res.data.page.list.length == 0){
  245. this.loadingType = 1
  246. this.page = this.page
  247. }
  248. this.myCommentList = res.data
  249. this.commentVOList = this.commentVOList.concat(res.data.page.list)
  250. this.commentVOList = this.commentVOList.filter(item=>!item.isLoading)
  251. if (this.commentVOList.length === 0) {
  252. this.evaluateEmpty = true
  253. }
  254. }).catch(res => {
  255. uni.hideLoading()
  256. uni.showToast({
  257. title: res.data.message,
  258. duration: 2000,
  259. icon: 'none'
  260. });
  261. }).finally(()=>{
  262. this.loading = false
  263. this.$hideLoading()
  264. })
  265. },
  266. //点赞
  267. zanTap(index, likeId, actionType) {
  268. this.$showLoading()
  269. NET.request(API.LikeOrUnLikeComment, {
  270. commentId: likeId,
  271. ifLike: actionType
  272. }, 'POST').then(res => {
  273. this.commentVOList[index].ifLike = !this.commentVOList[index].ifLike
  274. this.commentVOList[index].likes = this.commentVOList[index].ifLike ? this.commentVOList[index].likes + 1 : this.commentVOList[index].likes - 1
  275. // this.commentVOList = []
  276. // this.page = 1
  277. // this.getMyCommentList()
  278. }).catch(res => {
  279. this.$hideLoading()
  280. // uni.hideLoading()
  281. })
  282. },
  283. commentDetails(id) {
  284. uni.setStorageSync('commentVOList', this.commentVOList[id]);
  285. uni.navigateTo({
  286. url: 'evaluateDetails'
  287. })
  288. },
  289. //追加评论
  290. addCommentsClick(id) {
  291. uni.setStorageSync('addCommentVOList', this.commentVOList[id]);
  292. uni.navigateTo({
  293. url: 'addEvaluate?type=2'
  294. })
  295. }
  296. }
  297. }
  298. </script>
  299. <style lang="scss" scoped>
  300. page {
  301. background-color: #FAFAFA;
  302. }
  303. .container {
  304. .emptyOrder-box {
  305. margin-top: 70upx;
  306. .emptyOrder-img {
  307. margin-top: 45%;
  308. width: 113upx;
  309. height: 98upx;
  310. }
  311. }
  312. .evaluateTitle-box {
  313. background: #FFFFFF;
  314. color: #90919C;
  315. padding-top: 26upx;
  316. //border-bottom: 20rpx solid #FAFAFA;
  317. .evaluateTitle-on {
  318. padding-bottom: 20upx;
  319. border-bottom: 6rpx solid #252744;
  320. border-radius: 3rpx;
  321. color: #252744;
  322. font-weight: bold;
  323. }
  324. }
  325. .evaluate-item{
  326. background: #FFFFFF;
  327. border-radius: 30rpx;
  328. box-shadow: 0rpx 15rpx 30rpx 0rpx #F2F2F2;
  329. }
  330. .evaluate-contentbox {
  331. display: flex;
  332. justify-content: center;
  333. flex-direction: column;
  334. padding: 30upx 30upx;
  335. margin: 20rpx 30rpx;
  336. //background-color: #FFFFFF;
  337. //border-bottom: 2rpx solid #F3F4F5;
  338. .evaluate-content {
  339. width: 670upx;
  340. display: flex;
  341. justify-content: space-between;
  342. .user-headSmallImg {
  343. width: 64rpx;
  344. height: 64rpx;
  345. border-radius: 50%;
  346. }
  347. .skuValue {
  348. text-align: left;
  349. padding-left: 30rpx;
  350. }
  351. }
  352. .evaluateImg-box {
  353. display: flex;
  354. flex-direction: row;
  355. flex-wrap: wrap;
  356. margin-left: -9upx;
  357. .evaluate-Img {
  358. width: 224upx;
  359. height: 224upx;
  360. border-radius: 10upx;
  361. margin-left: 9upx;
  362. margin-top: 9upx;
  363. }
  364. }
  365. .goodsDes-box {
  366. background-color: #FAFAFA;
  367. border-radius: 30rpx;
  368. padding: 20upx 44upx 20upx 20upx;
  369. .goodsDes-img {
  370. width: 152rpx;
  371. height: 152rpx;
  372. border-radius: 30rpx;
  373. }
  374. .goodsDesText-box {
  375. width: 416upx;
  376. margin-left: 30upx;
  377. }
  378. .praise-box {
  379. .praise-icon {
  380. width: 28rpx;
  381. height: 26rpx;
  382. }
  383. }
  384. }
  385. .addComments-box {
  386. border-top: 1upx solid #EEEEEE;
  387. margin-top: 35upx;
  388. }
  389. }
  390. }
  391. .praise-icon {
  392. width: 28rpx;
  393. height: 26rpx;
  394. }
  395. .addCommentsBut {
  396. background: #252744;
  397. height: 50rpx;
  398. line-height: 48rpx;
  399. font-size: 26rpx;
  400. padding: 0rpx 25rpx;
  401. border-radius: 30rpx;
  402. margin-right: 30rpx;
  403. text-align: center;
  404. color: #FFFFFF;
  405. }
  406. </style>