FloorList.vue 8.0 KB

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