goods-list.vue 8.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246
  1. <template>
  2. <view class="margin-bottom zaiui-goods-list-box" :class="show?'show':''">
  3. <view class="flex flex-wrap ">
  4. <view class="basis-df padding-sm padding-right-xs ">
  5. <block v-for="(item,index) in list_data" :key="index" v-if="index%2==0">
  6. <view class="bg-white margin-bottom-sm list-radius" v-if="!item.type" @tap="listTap(item,index)">
  7. <view class="goods-img">
  8. <image :src="item.pic" mode="widthFix" lazy-load/>
  9. <text class="cuIcon-videofill text-white pay-view" v-if="item.pay"/>
  10. <view class="text-right service-view" v-if="item.service && item.service.length > 0">
  11. <block v-for="(items,indexs) in item.service" :key="indexs">
  12. <text class="cu-tag bg-blue radius sm">{{items}}</text>
  13. </block>
  14. </view>
  15. <view class="mold-view" v-if="item.mold && item.mold.length > 0">
  16. <block v-for="(items,indexs) in item.mold" :key="indexs">
  17. <text class="cu-tag radius sm" :class="['bg-' + items.bg]">{{items.name}}</text>
  18. </block>
  19. </view>
  20. </view>
  21. <view class="padding-xs">
  22. <view class="text-cut-2 text-black">{{item.name}}</view>
  23. <view class="margin-top-xs">
  24. <view class="flex">
  25. <view class="flex-sub">
  26. <text class="text-price text-red text-xl text-left">{{item.price.value}}</text>
  27. </view>
  28. <view class="flex-sub text-right" v-if="item.servicePlus">
  29. <text class="cu-tag light bg-red radius sm ">{{item.servicePlus}}</text>
  30. </view>
  31. </view>
  32. </view>
  33. <!-- <view class="margin-top-sm margin-bottom-xs text-gray user-info-box">
  34. <view class="flex">
  35. <view class="flex-sub">
  36. <view class="flex flex-wrap user-info">
  37. <view class="basis-xs">
  38. <image class="cu-avatar sm round img" :src="item.avatar" lazy-load mode="widthFix"/>
  39. </view>
  40. <view class="basis-xl text-cut line-height">
  41. <text class="text-sm margin-left-xs">{{item.username}}</text>
  42. </view>
  43. <image class="v-icon" src="/static/zaiui/img/v.png" lazy-load mode="widthFix" v-if="item.v"/>
  44. </view>
  45. </view>
  46. <view class="flex-sub text-right text-time">
  47. <text class="text-sm">{{item.time}}</text>
  48. </view>
  49. </view>
  50. </view> -->
  51. </view>
  52. </view>
  53. <view class="bg-white margin-bottom-sm list-radius padding-sm recommend-list-box" v-if="item.type=='recommend'">
  54. <view class="flex flex-wrap">
  55. <view class="basis-xs text-right">
  56. <image class="img-aat" src="/static/zaiui/img/aat.png" lazy-load mode="widthFix"/>
  57. </view>
  58. <view class="basis-lg text-center">
  59. <text class="text-black text-bold">您可能感兴趣</text>
  60. </view>
  61. <view class="basis-xs text-left">
  62. <image class="img-aat" src="/static/zaiui/img/aat.png" lazy-load mode="widthFix"/>
  63. </view>
  64. </view>
  65. <view class="grid col-2 text-center margin-top-sm">
  66. <block v-for="(items,indexs) in item.list" :key="indexs" v-if="item.list.length < 5">
  67. <view class="padding-xs" @tap="listTap(items,indexs)">
  68. <view class="img-goods" :style="[{backgroundImage:'url('+ items.img +')'}]"/>
  69. <view class="text-black text-sm margin-top-xs">{{items.title}}</view>
  70. </view>
  71. </block>
  72. </view>
  73. </view>
  74. </block>
  75. </view>
  76. <view class="basis-df padding-sm padding-left-xs">
  77. <block v-for="(item,index) in list_data" :key="index" v-if="index%2!=0">
  78. <view class="bg-white margin-bottom-sm list-radius" v-if="!item.type" @tap="listTap(item,index)">
  79. <view class="goods-img">
  80. <image :src="item.pic" mode="widthFix" lazy-load/>
  81. <text class="cuIcon-videofill text-white pay-view" v-if="item.pay"/>
  82. <view class="text-right service-view" v-if="item.service && item.service.length > 0">
  83. <block v-for="(items,indexs) in item.service" :key="indexs">
  84. <text class="cu-tag bg-blue radius sm">{{items}}</text>
  85. </block>
  86. </view>
  87. <view class="mold-view" v-if="item.mold && item.mold.length > 0">
  88. <block v-for="(items,indexs) in item.mold" :key="indexs">
  89. <text class="cu-tag radius sm" :class="['bg-' + items.bg]">{{items.name}}</text>
  90. </block>
  91. </view>
  92. </view>
  93. <view class="padding-xs">
  94. <view class="text-cut-2 text-black">{{item.name}}</view>
  95. <view class="margin-top-xs">
  96. <view class="flex">
  97. <view class="flex-sub">
  98. <text class="text-price text-red text-xl text-left">{{item.price.value}}</text>
  99. </view>
  100. <view class="flex-sub text-right" v-if="item.servicePlus">
  101. <text class="cu-tag light bg-red radius sm ">{{item.servicePlus}}</text>
  102. </view>
  103. </view>
  104. </view>
  105. <!-- <view class="margin-top-sm margin-bottom-xs text-gray user-info-box">
  106. <view class="flex">
  107. <view class="flex-sub">
  108. <view class="flex flex-wrap user-info">
  109. <view class="basis-xs">
  110. <image class="cu-avatar sm round img" :src="item.avatar" lazy-load mode="widthFix"/>
  111. </view>
  112. <view class="basis-xl text-cut line-height">
  113. <text class="text-sm margin-left-xs">{{item.username}}</text>
  114. </view>
  115. <image class="v-icon" src="/static/zaiui/img/v.png" lazy-load mode="widthFix" v-if="item.v"/>
  116. </view>
  117. </view>
  118. <view class="flex-sub text-right text-time">
  119. <text class="text-sm">{{item.time}}</text>
  120. </view>
  121. </view>
  122. </view> -->
  123. </view>
  124. </view>
  125. <view class="bg-white margin-bottom-sm list-radius padding-sm recommend-list-box" v-if="item.type=='recommend'">
  126. <view class="flex flex-wrap">
  127. <view class="basis-xs text-right">
  128. <image class="img-aat" src="/static/zaiui/img/aat.png" lazy-load mode="widthFix"/>
  129. </view>
  130. <view class="basis-lg text-center">
  131. <text class="text-black text-bold">您可能感兴趣</text>
  132. </view>
  133. <view class="basis-xs text-left">
  134. <image class="img-aat" src="/static/zaiui/img/aat.png" lazy-load mode="widthFix"/>
  135. </view>
  136. </view>
  137. <view class="grid col-2 text-center margin-top-sm">
  138. <block v-for="(items,indexs) in item.list" :key="indexs" v-if="item.list.length < 5">
  139. <view class="padding-xs" @tap="listTap(items,indexs)">
  140. <view class="img-goods" :style="[{backgroundImage:'url('+ items.img +')'}]"/>
  141. <view class="text-black text-sm margin-top-xs">{{items.title}}</view>
  142. </view>
  143. </block>
  144. </view>
  145. </view>
  146. </block>
  147. </view>
  148. </view>
  149. </view>
  150. </template>
  151. <script>
  152. import _tool from '@/static/zaiui/util/tools.js';
  153. export default {
  154. name: 'goods-list',
  155. props: {
  156. list_data: {
  157. type: Array,
  158. default: () => {
  159. return []
  160. }
  161. },
  162. show: {
  163. type: Boolean,
  164. default: true
  165. }
  166. },
  167. methods: {
  168. listTap(data,index) {
  169. this.$emit('listTap', {
  170. data,
  171. index
  172. });
  173. }
  174. }
  175. }
  176. </script>
  177. <style lang="scss" scoped>
  178. .zaiui-goods-list-box {
  179. position: relative;
  180. width: 100%;
  181. display: none;
  182. .list-radius {
  183. border-radius: 19upx;
  184. }
  185. .goods-img {
  186. position: relative;
  187. width: 100%;
  188. image {
  189. width: 100%;
  190. border-radius: 19upx 19upx 0 0;
  191. }
  192. .pay-view {
  193. position: absolute;
  194. top: 20upx;
  195. right: 20upx;
  196. font-size: 46upx;
  197. }
  198. .service-view {
  199. position: absolute;
  200. width: 100%;
  201. bottom: 7.5upx;
  202. right: 10upx;
  203. }
  204. .mold-view {
  205. position: absolute;
  206. width: 100%;
  207. bottom: 7.5upx;
  208. left: 10upx;
  209. }
  210. }
  211. .text-time {
  212. line-height: 47upx;
  213. }
  214. .recommend-list-box {
  215. .img-aat {
  216. width: 55upx;
  217. margin-top: 10upx;
  218. }
  219. .img-goods {
  220. font-variant: small-caps;
  221. margin: 0;
  222. padding: 0;
  223. display: inline-flex;
  224. text-align: center;
  225. -webkit-box-pack: center;
  226. justify-content: center;
  227. -webkit-box-align: center;
  228. align-items: center;
  229. white-space: nowrap;
  230. position: relative;
  231. width: 137upx;
  232. height: 137upx;
  233. background-size: cover;
  234. background-position: center;
  235. vertical-align: middle;
  236. border-radius: 12%;
  237. }
  238. }
  239. }
  240. .zaiui-goods-list-box.show {
  241. display: block;
  242. }
  243. </style>