list.vue 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254
  1. <template>
  2. <view class="content">
  3. <view class="good-list">
  4. <view class="good" v-for="item in list" @click="navTo('/pages/goods_details/index?id=' + (type == 1 ? item.product_id :item.product.id))" :style="{'height': type == 1 ? '450rpx': '500rpx'}">
  5. <image :src="type == 1?item.image : item.slider_image" mode="" class="good-image"></image>
  6. <view class="good-name ">
  7. <view class="clamp" v-if="type !=1">
  8. {{item.store_name}}
  9. </view>
  10. <view class="clamp" v-else>
  11. {{item.card_name}}
  12. </view>
  13. </view>
  14. <view class="time-wrap" v-if="type != 1">
  15. <view class="time" v-if="item.product.keyword">
  16. 时间:{{item.product.keyword}}
  17. </view>
  18. </view>
  19. <view class="good-price">
  20. <view class="price" v-if="type != 1">
  21. ¥{{item.product.price}}
  22. </view>
  23. <view class="price" v-else>
  24. ¥{{item.card_price}}
  25. </view>
  26. <view class="xl" v-if="type != 1 &&item.product.ot_price*1 > item.product.price ">
  27. ¥{{item.product.ot_price}}
  28. </view>
  29. <!-- <view class="xl" v-if="type == 1 && item.card_price ">
  30. ¥{{item.card_price}}
  31. </view> -->
  32. </view>
  33. </view>
  34. </view>
  35. <view v-if="list.length == 0 && loadingType=='nomore'">
  36. <emptyPage title="暂无订单信息~"></emptyPage>
  37. </view>
  38. </view>
  39. </template>
  40. <script>
  41. import {
  42. getServeItem,
  43. getSeverCardList
  44. } from "@/api/store.js"
  45. import emptyPage from '@/components/emptyPage.vue';
  46. export default {
  47. components: {
  48. emptyPage
  49. },
  50. data() {
  51. return {
  52. list: [],
  53. type: 0,
  54. page: 1,
  55. limit: 100,
  56. loadingType: 'loadmore'
  57. }
  58. },
  59. onLoad(opt) {
  60. if (opt.type) {
  61. this.type = opt.type
  62. }
  63. },
  64. onShow() {
  65. this.getList()
  66. },
  67. onReachBottom() {
  68. // this.getList()
  69. },
  70. onReady() {
  71. },
  72. methods: {
  73. navTo(url) {
  74. uni.navigateTo({
  75. url
  76. });
  77. },
  78. getList() {
  79. let that = this;
  80. let getList;
  81. if (that.loadingType == 'loading' || that.loadingType == 'nomore') {
  82. return
  83. }
  84. that.loadingType = 'loading'
  85. if (that.type == 0) {
  86. getList = getServeItem
  87. }else {
  88. getList = getSeverCardList
  89. }
  90. getList({
  91. page: that.page,
  92. pageSize: that.limit,
  93. service_card_id: 0
  94. }).then(res => {
  95. console.log(res)
  96. let arr = res.data.list
  97. that.list = that.list.concat(arr)
  98. console.log(that.list)
  99. that.page++
  100. if (arr.length == that.limit) {
  101. that.loadingType = 'loadmore'
  102. } else {
  103. that.loadingType = 'nomore'
  104. }
  105. })
  106. }
  107. }
  108. }
  109. </script>
  110. <style lang="scss">
  111. .gq-list {
  112. display: flex;
  113. flex-wrap: wrap;
  114. justify-content: flex-start;
  115. // justify-content: space-between;
  116. padding: 20rpx 0 20rpx 20rpx;
  117. }
  118. .gq-item {
  119. margin: 0 0 20rpx 14rpx;
  120. width: 227rpx;
  121. // height: 425rpx;
  122. background: #FFFFFF;
  123. box-shadow: 0px 5rpx 5rpx 0px rgba(35, 24, 21, 0.06);
  124. border-radius: 10rpx;
  125. display: flex;
  126. flex-direction: column;
  127. align-items: center;
  128. justify-content: space-between;
  129. padding: 15rpx 14rpx;
  130. .gq-logo {
  131. width: 182rpx;
  132. height: 192rpx;
  133. display: flex;
  134. justify-content: center;
  135. align-items: center;
  136. margin-bottom: 20rpx;
  137. image {
  138. width: 182rpx;
  139. height: 192rpx;
  140. background-color: #eee;
  141. }
  142. }
  143. .store-name {
  144. padding-top: 10rpx;
  145. text-align: center;
  146. width: 100%;
  147. font-size: 26rpx;
  148. font-weight: 500;
  149. color: #262261;
  150. overflow: hidden;
  151. }
  152. .info {
  153. width: 100%;
  154. display: flex;
  155. padding: 5rpx 0;
  156. .info-tit {
  157. font-size: 18rpx;
  158. flex-shrink: 0;
  159. }
  160. .info-val {
  161. flex-grow: 1;
  162. text-align: center;
  163. font-size: 20rpx;
  164. width: 140rpx;
  165. border-bottom: 1px #C7C7C7 solid;
  166. }
  167. }
  168. }
  169. .good-list {
  170. display: flex;
  171. justify-content: space-between;
  172. flex-wrap: wrap;
  173. padding: 20rpx 28rpx;
  174. .good {
  175. width: 336rpx;
  176. height: 500rpx;
  177. background: #FFFFFF;
  178. box-shadow: 0px 0px 6rpx 0px rgba(0, 0, 0, 0.1);
  179. border-radius: 14rpx;
  180. margin-bottom: 20rpx;
  181. position: relative;
  182. .good-image {
  183. width: 336rpx;
  184. height: 336rpx;
  185. background-color: #eee;
  186. border-radius: 14rpx 14rpx 0 0;
  187. }
  188. .good-name {
  189. font-size: 28rpx;
  190. font-weight: bold;
  191. color: #333333;
  192. padding: 0 20rpx;
  193. }
  194. .good-key {
  195. font-size: 22rpx;
  196. font-weight: 500;
  197. color: #999999;
  198. padding-left: 20rpx
  199. }
  200. .time {
  201. padding: 5rpx 10rpx;
  202. border: 1px solid #ff6973;
  203. color: #ff6973;
  204. display: inline-block;
  205. margin: 10rpx 0;
  206. margin-left: 20rpx;
  207. }
  208. .good-price {
  209. display: flex;
  210. width: 336rpx;
  211. justify-content: flex-start;
  212. align-items: flex-end;
  213. font-size: 28rpx;
  214. font-weight: bold;
  215. color: #ff6973;
  216. position: absolute;
  217. bottom: 20rpx;
  218. padding: 0 20rpx;
  219. .xl {
  220. padding-left: 10rpx;
  221. font-size: 20rpx;
  222. font-weight: bold;
  223. color: #999999;
  224. text-decoration: line-through;
  225. }
  226. }
  227. }
  228. }
  229. .clamp {
  230. white-space: nowrap;
  231. overflow: hidden;
  232. text-overflow: ellipsis;
  233. }
  234. </style>