FloorList.vue 8.2 KB

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