appraise.vue 5.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266
  1. <template>
  2. <mobile-frame>
  3. <view class="main">
  4. <view class="one">
  5. <view class="one_1">
  6. <view class="text1">{{info.goods.name}}{{info.specs[0].name}}</view>
  7. <view class="text2">好评率 <text>{{info.rate||100}}%</text></view>
  8. </view>
  9. <view class="one_2">
  10. <view class="one_2_1" v-for="(item,index) in btnlist" :key="index">
  11. <text>{{item.name}}</text><text>({{item.num||0}})</text>
  12. </view>
  13. </view>
  14. </view>
  15. <view class="two">
  16. <scroll-view scroll-y="true" class="scroll-view" @scrolltolower="toPage">
  17. <view class="list-scroll-view">
  18. <view class="list" v-for="(item, index) in list" :key="index">
  19. <image v-if="item.file&&item.file.length>0" class="image"
  20. :src="item.file&&item.file.length>0?item.file[0].url:''" mode="">
  21. </image>
  22. <text v-else class="iconfont icon-top"></text>
  23. <view class="list_1">
  24. <view class="other">
  25. <text>{{item.phone}}</text>
  26. <text>{{item.time}}</text>
  27. </view>
  28. <view class="stars">
  29. <uni-rate size="18" :readonly="true" :value="5" />
  30. </view>
  31. <view class="other1">{{item.content}}</view>
  32. <view class="other2">规格:{{item.specs}}</view>
  33. </view>
  34. </view>
  35. </view>
  36. </scroll-view>
  37. </view>
  38. </view>
  39. </mobile-frame>
  40. </template>
  41. <script>
  42. export default {
  43. data() {
  44. return {
  45. id: '',
  46. user: {},
  47. btnlist: [{
  48. name: '全部好评',
  49. num: '10',
  50. code: '0'
  51. },
  52. {
  53. name: '好评',
  54. num: '10',
  55. code: '0'
  56. },
  57. {
  58. name: '中评',
  59. num: '0',
  60. code: '0'
  61. },
  62. {
  63. name: '差评',
  64. num: '0',
  65. code: '0'
  66. }
  67. ],
  68. info: {},
  69. list: [{
  70. phone: '150********',
  71. content: '好评!',
  72. specs: '标准',
  73. time: '2022-10-04 06:35:10'
  74. },
  75. {
  76. phone: '132********',
  77. content: '好评!',
  78. specs: '标准',
  79. time: '2022-10-06 16:09:20'
  80. },
  81. {
  82. phone: '188********',
  83. content: '好评!',
  84. specs: '标准',
  85. time: '2022-10-07 16:15:08'
  86. },
  87. {
  88. phone: '137********',
  89. content: '好评!',
  90. specs: '标准',
  91. time: '2022-10-07 14:26:10'
  92. }
  93. ],
  94. total: 0,
  95. skip: 0,
  96. limit: 6,
  97. page: 0
  98. };
  99. },
  100. onLoad: function(e) {
  101. const that = this;
  102. that.$set(that, `id`, e.id || '');
  103. that.watchLogin()
  104. },
  105. methods: {
  106. // 监听用户是否登录
  107. watchLogin() {
  108. const that = this;
  109. uni.getStorage({
  110. key: 'token',
  111. success: function(res) {
  112. let user = that.$jwt(res.data);
  113. that.$set(that, `user`, user);
  114. that.search()
  115. },
  116. fail: function(err) {
  117. uni.reLaunch({
  118. url: `/pages/login/index`
  119. })
  120. }
  121. })
  122. },
  123. // 查询列表
  124. async search() {
  125. const that = this;
  126. let user = that.user;
  127. let res = await that.$api(`/viewGoods/goodsDetail`, `POST`, {
  128. id: that.id
  129. });
  130. if (res.errcode == '0') {
  131. that.$set(that, `info`, res.data)
  132. }
  133. },
  134. // 分页
  135. toPage(e) {
  136. const that = this;
  137. let list = that.list;
  138. let limit = that.limit;
  139. if (that.total > list.length) {
  140. uni.showLoading({
  141. title: '加载中',
  142. mask: true
  143. })
  144. let page = that.page + 1;
  145. that.$set(that, `page`, page)
  146. let skip = page * limit;
  147. that.$set(that, `skip`, skip)
  148. that.search();
  149. uni.hideLoading();
  150. } else uni.showToast({
  151. title: '没有更多数据了'
  152. });
  153. },
  154. // 清空列表
  155. clearPage() {
  156. const that = this;
  157. that.$set(that, `list`, [])
  158. that.$set(that, `skip`, 0)
  159. that.$set(that, `limit`, 6)
  160. that.$set(that, `page`, 0)
  161. }
  162. }
  163. }
  164. </script>
  165. <style lang="scss">
  166. .main {
  167. display: flex;
  168. flex-direction: column;
  169. width: 100vw;
  170. height: 100vh;
  171. background-color: var(--f1Color);
  172. .one {
  173. margin: 0 0 2vw 0;
  174. .one_1 {
  175. display: flex;
  176. justify-content: space-around;
  177. background-color: var(--mainColor);
  178. margin: 0 0 0.5vw 0;
  179. padding: 2vw;
  180. .text1 {
  181. width: 65vw;
  182. font-size: var(--font16Szie);
  183. }
  184. .text2 {
  185. font-size: var(--font16Szie);
  186. color: var(--f85Color);
  187. text {
  188. margin: 0 0 0 1vw;
  189. color: var(--ff0Color);
  190. }
  191. }
  192. }
  193. .one_2 {
  194. display: flex;
  195. justify-content: space-around;
  196. padding: 2vw;
  197. background-color: var(--mainColor);
  198. }
  199. }
  200. .two {
  201. position: relative;
  202. flex-grow: 1;
  203. .list {
  204. display: flex;
  205. justify-content: space-around;
  206. align-items: flex-start;
  207. background-color: var(--mainColor);
  208. margin: 0 0 2vw 0;
  209. padding: 4vw;
  210. .iconfont {
  211. font-size: 30px;
  212. }
  213. .list_1 {
  214. flex-grow: 1;
  215. margin: 0 0 0 2vw;
  216. font-size: var(--font14Size);
  217. .other {
  218. display: flex;
  219. justify-content: space-between;
  220. text:last-child {
  221. font-size: var(--font12Size);
  222. color: var(--f85Color);
  223. }
  224. }
  225. .other1 {
  226. margin: 1vw 0 0 0;
  227. }
  228. .other2 {
  229. font-size: var(--font12Size);
  230. color: var(--f85Color);
  231. margin: 2vw 0 0 0;
  232. }
  233. }
  234. }
  235. }
  236. }
  237. .scroll-view {
  238. position: absolute;
  239. top: 0;
  240. left: 0;
  241. right: 0;
  242. bottom: 0;
  243. .list-scroll-view {
  244. display: flex;
  245. flex-direction: column;
  246. }
  247. }
  248. </style>