FloorList.vue 8.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303
  1. <template>
  2. <div class="floor-list">
  3. <div class="container">
  4. <floor-bar :floors="floors"></floor-bar>
  5. <a href="/store/33069557578d44e69bd91ad12d28a8d4" target="_blank"><img src="/images/all/banner-cuxiao.png" alt=""></a>
  6. <!-- <div class="banner">
  7. <ul>
  8. <li><a href="/store/33069557578d44e69bd91ad12d28a8d4" target="_blank"><img src="/images/all/banner-cuxiao01.png" alt=""></a></li>
  9. <li>
  10. <div class="banner-cuxiao">
  11. <table>
  12. <caption><span>最新求购</span><img src="/images/all/banner-cuxiao03.jpg" alt=""></caption>
  13. <thead>
  14. <tr>
  15. <th>发布时间</th>
  16. <th>买家名称</th>
  17. <th>型号</th>
  18. <th>操作</th>
  19. </tr>
  20. </thead>
  21. <tbody>
  22. <tr v-for="data in tableData">
  23. <td>{{data.publicTime}}</td>
  24. <td>{{data.name.slice(0, 1) + '**'}}</td>
  25. <td>{{data.productModel | titleFilter}}</td>
  26. <td><a>我要报价</a></td>
  27. </tr>
  28. </tbody>
  29. </table>
  30. <a class="purchase">我要求购</a>
  31. </div>
  32. </li>
  33. </ul>
  34. </div>-->
  35. <floor :floor="defaultFloors[0]" :isDefault="true" v-if="!isEmpty"></floor>
  36. <floor :floor="defaultFloors[1]" :isDefault="true" v-if="!isEmpty"></floor>
  37. <floor v-for="(floor, index) in floors.data" :floor="floor" :isDefault="false" :key="index"></floor>
  38. </div>
  39. <span v-if="expandFloors && false">floor</span>
  40. </div>
  41. </template>
  42. <script>
  43. import Floor from './Floor.vue'
  44. import FloorBar from './FloorBar.vue'
  45. export default {
  46. name: 'floor-list',
  47. components: {
  48. Floor,
  49. FloorBar
  50. },
  51. data () {
  52. return {
  53. tableData: [{
  54. publicTime: '7分钟前',
  55. name: '杨某某',
  56. productModel: '9w8r9r'
  57. }, {
  58. publicTime: '7分钟前',
  59. name: '杨某某',
  60. productModel: '9w8r9r8r78e'
  61. }, {
  62. publicTime: '7分钟前',
  63. name: '杨某某',
  64. productModel: '9w8r9r8r78e'
  65. }, {
  66. publicTime: '7分钟前',
  67. name: '杨某某',
  68. productModel: '9w8r9r8r78e'
  69. }, {
  70. publicTime: '7分钟前',
  71. name: '杨某某',
  72. productModel: '9w8r9r8r78e'
  73. }],
  74. defaultFloors: [
  75. {
  76. items: [
  77. {
  78. backGroundColor: '',
  79. body: '',
  80. hrefUrl: '/store/33069557578d44e69bd91ad12d28a8d4',
  81. pictureUrl: '/images/floor/banner1.jpg',
  82. size: 'large'
  83. }
  84. ]
  85. },
  86. {
  87. items: [
  88. {
  89. backGroundColor: '',
  90. body: '',
  91. hrefUrl: '/store/33069557578d44e69bd91ad12d28a8d4',
  92. pictureUrl: '/images/floor/banner2.jpg',
  93. size: 'large'
  94. }
  95. ]
  96. }
  97. ]
  98. }
  99. },
  100. computed: {
  101. floors () {
  102. return this.$store.state.floor.list
  103. },
  104. isProd () {
  105. return this.$store.state.option.url === 'http://www.usoftmall.com'
  106. },
  107. expandFloors () {
  108. let data = this.$store.state.floor.list_expand.data
  109. let _this = this
  110. for (let i = 0; i < data.length; i++) {
  111. let obj = {
  112. backGroundColor: '',
  113. body: '',
  114. hrefUrl: '',
  115. name: '',
  116. pictureUrl: '',
  117. size: '',
  118. price: '',
  119. currency: 'RMB'
  120. }
  121. if (data[i]) {
  122. obj.name = data[i].code
  123. obj.body = data[i].brandNameEn + '<br/>' + (data[i].kindNameCn || '其他')
  124. obj.hrefUrl = '/store/productDetail/' + data[i].batchCode
  125. obj.pictureUrl = '/images/floor/' + (this.isProd ? data[i].code : '2SD2704KT146') + '.png'
  126. obj.size = i % 3 === 0 ? 'medium' : 'small'
  127. obj.currency = data[i].currencyName
  128. obj.price = _this.getMinPrice(data[i].prices, data[i].currencyName)
  129. _this.defaultFloors[i < 6 ? 0 : 1].items.push(obj)
  130. }
  131. }
  132. return data
  133. },
  134. isEmpty () {
  135. let data = this.$store.state.floor.list_expand.data
  136. if (!data.length) {
  137. return true
  138. } else {
  139. for (let i = 0; i < data.length; i++) {
  140. if (!(data[0] && data[0] !== null)) {
  141. return true
  142. }
  143. }
  144. }
  145. return false
  146. }
  147. },
  148. methods: {
  149. getMinPrice: function (prices, currency) {
  150. for (let i = 0; i < prices.length; i++) {
  151. if (i === prices.length - 1) {
  152. return currency === 'RMB' ? prices[i].rMBPrice : prices[i].uSDPrice
  153. }
  154. }
  155. }
  156. },
  157. filters: {
  158. titleFilter: function (title) {
  159. if (title === '') {
  160. return title
  161. }
  162. let len = 0
  163. let index = 0
  164. for (let i = 0; i < title.length; i++) {
  165. if (index === 0 && title.charAt(i).charCodeAt(0) > 255) {
  166. len = len + 2
  167. } else {
  168. len++
  169. }
  170. if (len > 50) {
  171. index = i
  172. break
  173. }
  174. }
  175. if (index > 0) {
  176. return title.substring(0, index) + '...'
  177. } else {
  178. return title
  179. }
  180. }
  181. }
  182. }
  183. </script>
  184. <style lang="scss" scoped>
  185. @import '~assets/scss/variables';
  186. /*add*/
  187. .floor-list .container{
  188. padding: 0;
  189. }
  190. .floor-list {
  191. margin-bottom: $xlg-pad;
  192. }
  193. .floor-list .container > a > img {
  194. margin-top: 30px;
  195. }
  196. @keyframes myfirst {
  197. 0% {
  198. transform: translate(0px, 0px);
  199. }
  200. 50% {
  201. transform: translate(0px, -3px);
  202. }
  203. 100% {
  204. transform: translate(0px, 0px);
  205. }
  206. }
  207. .banner{
  208. width:1190px;
  209. height: 253px;
  210. margin-top: 20px;
  211. li{
  212. float: left;
  213. padding-left: 14px;
  214. position: relative;
  215. &:first-child{
  216. padding-left: 0px;
  217. }
  218. }
  219. .banner-cuxiao {
  220. width: 660px;
  221. height: 253px;
  222. background: url('/images/all/banner-cuxiao02.png') no-repeat;
  223. table {
  224. width: 436px;
  225. caption {
  226. color: #f57a2e;
  227. font-size: 20px;
  228. font-weight: bold;
  229. padding: 10px 30px;
  230. img{
  231. position: relative;
  232. top: -7px;
  233. animation: myfirst 1s infinite;
  234. }
  235. }
  236. thead tr th {
  237. height: 30px;
  238. color: #fff;
  239. font-size: 14px;
  240. background-color: #f57a2e;
  241. }
  242. tr th, tr td {
  243. height: 30px;
  244. &:first-child {
  245. padding: 6px 7px 6px 16px;
  246. }
  247. &:nth-child(2) {
  248. padding-right: 7px;
  249. }
  250. &:nth-child(3) {
  251. text-align: center;
  252. padding: 6px 10px 6px 10px;
  253. }
  254. &:nth-child(4) {
  255. text-align: center;
  256. padding: 6px 10px 6px 10px;
  257. }
  258. a {
  259. width: 64px;
  260. height: 22px;
  261. line-height: 22px;
  262. text-align: center;
  263. padding: 3px 5px;
  264. color: #fd3904;
  265. font-size: 12px;
  266. border-radius: 2px;
  267. border: 1px solid #fd3904;
  268. &:hover {
  269. border: 1px solid #fd3904;
  270. background-color: #fd3904;
  271. color: #fff;
  272. -moz-box-shadow: 0px 3px 5px #f57a2e; /* 老的 Firefox */
  273. box-shadow: 0px 3px 10px #f57a2e;
  274. }
  275. }
  276. }
  277. tr td{
  278. &:first-child {
  279. color: #f57a2e;
  280. }
  281. }
  282. }
  283. .purchase {
  284. position: absolute;
  285. left: 515px;
  286. top: 184px;
  287. width: 100px;
  288. height: 28px;
  289. line-height: 28px;
  290. background-color: #fff;
  291. color: #f57a2e;
  292. border-radius: 25px;
  293. text-align: center;
  294. font-weight: bold;
  295. &:hover{
  296. background-color: #FB6102;
  297. color: #fff;
  298. box-shadow: 0px 3px 10px #fd863d;
  299. }
  300. }
  301. }
  302. }
  303. </style>