myAppraise.vue 6.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306
  1. <template>
  2. <view class="content">
  3. <!-- 列表 -->
  4. <view class="itemContent">
  5. <view v-for="(item,index) in itemData" :key="index" @click="goDetail(item)">
  6. <view class="item">
  7. <view class="leftView">
  8. <image :src='item.PhotoPath' v-if="item.PhotoPath" class="storeImg"></image>
  9. <image src="../../static/img/pic_def_ava.png" mode="" class="storeImg" v-else></image>
  10. </view>
  11. <view class="rightView">
  12. <!-- 第一行 -->
  13. <view class="firstView">
  14. <view class="shopName">{{item.ShopName}}</view>
  15. <!-- 时间截取 -->
  16. <!-- <view class="time">2021-9-05</view> -->
  17. <view class="time">{{item.CreateTime.slice(0,item.CreateTime.length-8)}}</view>
  18. </view>
  19. <!-- 第2行 -->
  20. <view class="secondView">
  21. <!-- 星星 -->
  22. <uni-rate :value="item.Overallevaluation" :max="5" color="#EEEEEE" active-color="#FF4F00"
  23. :size="16" :margin="4" :readonly="true" />
  24. <image src="../../static/img/review_icon_del@2x.png" class="deleteBtn"
  25. @click.stop="deleteItem(item, index)"></image>
  26. </view>
  27. <view class="contentMes">{{item.EContent}}</view>
  28. <!-- 照片 -->
  29. <view class="imgBg">
  30. <view v-for="(itemImg,indexImg) in item.imgs" :key="indexImg">
  31. <image :src="itemImg.imageUrl" class="img"
  32. @click.stop="previewImage(itemImg.imageUrl,item.imgs)"></image>
  33. </view>
  34. </view>
  35. <!-- 商家回复 -->
  36. <view class="writeBack" v-if="item.ReplyContent">商家回复:{{item.ReplyContent}}</view>
  37. </view>
  38. </view>
  39. </view>
  40. </view>
  41. <!-- 上拉 加载更多 -->
  42. <view class="noMore" v-if="noMoreShow">没有更多数据</view>
  43. <!-- 无数据空白页 -->
  44. <nodata v-if="itemData.length==0"></nodata>
  45. </view>
  46. </template>
  47. <script>
  48. import nodata from '../../components/nodata/nodata.vue'
  49. export default {
  50. components: {
  51. nodata,
  52. },
  53. data() {
  54. return {
  55. itemData: [],
  56. page: 1,
  57. noMoreShow: false,
  58. imgArr: [],
  59. }
  60. },
  61. onLoad(opt) {
  62. },
  63. onShow() {
  64. this.itemData=[]
  65. this.page = 1
  66. this.getItemData()
  67. },
  68. methods: {
  69. goDetail(item){
  70. uni.navigateTo({
  71. url:'myAppraiseDetail?id='+item.SheetID
  72. })
  73. },
  74. previewImage(img, arrDic) {
  75. var arr = [];
  76. arrDic.forEach(item => {
  77. arr.push(item.imageUrl)
  78. })
  79. // 预览图片
  80. uni.previewImage({
  81. urls: arr,
  82. current: img,
  83. longPressActions: {
  84. itemList: ['发送给朋友', '保存图片', '收藏'],
  85. success: function(data) {
  86. console.log('选中了第' + (data.tapIndex + 1) + '个按钮,第' + (data.index + 1) + '张图片');
  87. },
  88. fail: function(err) {
  89. console.log(err.errMsg);
  90. }
  91. }
  92. });
  93. },
  94. deleteItem(item, index) {
  95. var that=this;
  96. uni.showModal({
  97. title: '提示',
  98. content: '确定删除该条评价吗?',
  99. success: function (res) {
  100. if (res.confirm) {
  101. that.itemData.splice(index, 1);
  102. uni.showLoading({
  103. title: '删除中'
  104. })
  105. let url = 'miniAppMyBMemberCar/deleteMyBMEvaluate',
  106. params = {
  107. id: item.ID,
  108. }
  109. that.$http(url, params, 'POST').then(res => {
  110. uni.hideLoading();
  111. that.page = 1
  112. that.getItemData()
  113. })
  114. }
  115. }
  116. });
  117. },
  118. getItemData() {
  119. uni.showLoading({
  120. title: '加载中'
  121. })
  122. let url = 'miniAppMyBMemberCar/listBMEvaluatePage',
  123. params = {
  124. page: this.page,
  125. limit: 20,
  126. }
  127. this.$http(url, params, 'GET').then(res => {
  128. uni.hideLoading();
  129. var list = res.data.Items
  130. // 处理 undefined和null转为空白字符串
  131. list.forEach((item, index) => {
  132. for (const key in item) {
  133. item[key] = this.$praseStrEmpty(item[key])
  134. }
  135. })
  136. if (this.page == 1) {
  137. this.itemData = list
  138. } else {
  139. this.itemData = this.itemData.concat(list)
  140. }
  141. if (list.length < 10) {
  142. this.noMoreShow = false
  143. } else {
  144. this.noMoreShow = true
  145. }
  146. })
  147. },
  148. },
  149. // 下拉刷新 上拉加载更多
  150. onPullDownRefresh() {
  151. this.page = 1
  152. this.getItemData()
  153. setTimeout(function() {
  154. uni.stopPullDownRefresh();
  155. }, 1000);
  156. },
  157. onReachBottom() {
  158. this.page++;
  159. this.getItemData()
  160. },
  161. }
  162. </script>
  163. <style scoped>
  164. .content {
  165. background: #FFFFFF;
  166. min-height: 100vh;
  167. }
  168. .item {
  169. display: flex;
  170. justify-content: flex-start;
  171. padding: 0 24rpx;
  172. background-color: #FFFFFF;
  173. }
  174. .leftView {
  175. width: 117rpx;
  176. padding-right: 20rpx;
  177. }
  178. .storeImg {
  179. width: 72rpx;
  180. height: 72rpx;
  181. border-radius: 8rpx;
  182. margin-top: 30rpx;
  183. }
  184. .rightView {
  185. border-bottom: 1rpx #EEEEEE solid;
  186. width: 100vw;
  187. }
  188. .firstView,
  189. .secondView {
  190. display: flex;
  191. justify-content: space-between;
  192. align-items: center;
  193. }
  194. .firstView {
  195. padding-top: 30rpx;
  196. }
  197. .secondView {
  198. padding-top: 12rpx;
  199. padding-bottom: 20rpx;
  200. }
  201. .shopName {
  202. /* padding-top: 30rpx;
  203. padding-bottom: 10rpx; */
  204. font-size: 26rpx;
  205. font-weight: bold;
  206. color: #333333;
  207. }
  208. .time {
  209. font-size: 26rpx;
  210. color: #999999;
  211. }
  212. .deleteBtn {
  213. width: 36rpx;
  214. height: 36rpx;
  215. }
  216. .contentMes {
  217. font-size: 26rpx;
  218. color: #666666;
  219. line-height: 37rpx;
  220. /* padding-top: 20rpx; */
  221. }
  222. .imgBg {
  223. display: flex;
  224. justify-content: flex-start;
  225. padding: 30rpx 0rpx;
  226. flex-wrap: wrap;
  227. }
  228. .img {
  229. width: 140rpx;
  230. height: 140rpx;
  231. margin-right: 5rpx;
  232. border-radius: 8rpx;
  233. }
  234. .writeBack {
  235. font-size: 26rpx;
  236. color: #666666;
  237. line-height: 37rpx;
  238. padding: 20rpx;
  239. background-color: #F4F5F7;
  240. padding-bottom: 20rpx;
  241. }
  242. .noMore {
  243. text-align: center;
  244. line-height: 50rpx;
  245. color: #999999;
  246. font-size: 28rpx;
  247. }
  248. </style>