FloorList.vue 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394
  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 v-if="purchaseManListData && false"></div>
  7. <div class="banner">
  8. <ul class="seek-banner">
  9. <li><a href="/store/33069557578d44e69bd91ad12d28a8d4" target="_blank"><img src="/images/all/banner-cuxiao01.png" alt=""></a></li>
  10. <li>
  11. <div class="banner-cuxiao">
  12. <div class="wrap">
  13. <p class="title"><span>最新求购</span><img src="/images/all/banner-cuxiao03.jpg" alt="">
  14. <nuxt-link to="/applyPurchase">查看更多</nuxt-link>
  15. </p>
  16. <div class="list-head">
  17. <span>发布时间</span>
  18. <span>买家名称</span>
  19. <span>型号</span>
  20. <span>操作</span>
  21. </div>
  22. <ul>
  23. <li v-for="(purchaseMan, index) in purchaseManList.content" :style="'top: -' + 32 * timerIndex + 'px'">
  24. <div>{{purchaseMan.date | date}}</div>
  25. <div>
  26. <span v-if="purchaseMan.inquiry && purchaseMan.inquiry.enterprise && purchaseMan.inquiry.enterprise.enName">{{purchaseMan.inquiry.enterprise.enName | enterpriseFilter}}</span>
  27. <span v-else>{{purchaseMan.userName | userNameFilter}}</span>
  28. </div>
  29. <div :title="purchaseMan.cmpCode">{{purchaseMan.cmpCode}}</div>
  30. <div>
  31. <div class="is-say-price" v-if="purchaseMan.remainingTime > 0 && purchaseMan.quoted == 1">已报价 <img src="/images/applyPurchase/green-check.png" alt=""></div>
  32. <a v-else @click="sayPrice(purchaseMan, index)">我要报价</a>
  33. </div>
  34. </li>
  35. </ul>
  36. </div>
  37. <nuxt-link to="/applyPurchase" class="purchase">我要求购</nuxt-link>
  38. </div>
  39. </li>
  40. </ul>
  41. </div>
  42. <floor :floor="defaultFloors[0]" :isDefault="true" v-if="!isEmpty"></floor>
  43. <floor :floor="defaultFloors[1]" :isDefault="true" v-if="!isEmpty"></floor>
  44. <floor v-for="(floor, index) in floors.data" :floor="floor" :isDefault="false" :key="index"></floor>
  45. </div>
  46. <span v-if="expandFloors && false">floor</span>
  47. <say-price :current="currentSayPriceIndex"
  48. :purchase="purchaseManList"
  49. @cancelSayPriceAction="cancelSayPrice"
  50. @resetListAction="resetList"
  51. @sayPriceIndexAction="setIndex(index)"
  52. ></say-price>
  53. </div>
  54. </template>
  55. <script>
  56. import Floor from './Floor.vue'
  57. import FloorBar from './FloorBar.vue'
  58. import SayPrice from '~components/applyPurchase/SayPrice.vue'
  59. export default {
  60. name: 'floor-list',
  61. components: {
  62. Floor,
  63. FloorBar,
  64. SayPrice
  65. },
  66. data () {
  67. return {
  68. defaultFloors: [
  69. {
  70. items: [
  71. {
  72. backGroundColor: '',
  73. body: '',
  74. hrefUrl: '/store/33069557578d44e69bd91ad12d28a8d4',
  75. pictureUrl: '/images/floor/banner1.jpg',
  76. size: 'large'
  77. }
  78. ]
  79. },
  80. {
  81. items: [
  82. {
  83. backGroundColor: '',
  84. body: '',
  85. hrefUrl: '/store/33069557578d44e69bd91ad12d28a8d4',
  86. pictureUrl: '/images/floor/banner2.jpg',
  87. size: 'large'
  88. }
  89. ]
  90. }
  91. ],
  92. timerIndex: 0,
  93. pageSize: 50,
  94. nowPage: 1,
  95. currentSayPriceIndex: -1,
  96. purchaseManList: {
  97. content: []
  98. },
  99. listTemplate: []
  100. }
  101. },
  102. mounted () {
  103. setInterval(() => {
  104. let _this = this
  105. _this.timerIndex ++
  106. if (_this.timerIndex % 45 === 0) {
  107. for (let i = 0; i < _this.listTemplate.content.length; i++) {
  108. this.purchaseManList.content.push(_this.listTemplate.content[i])
  109. }
  110. }
  111. }, 3000)
  112. },
  113. filters: {
  114. date: function (date) {
  115. const now = new Date().getDate()
  116. const day = (new Date(date).getDate() - now)
  117. return day <= 0 ? '今天' : day + '天前'
  118. },
  119. enterpriseFilter (str) {
  120. if (str) {
  121. return str.length > 4 ? str.substring(0, 2) + '**' + str.substring(str.length - 2, str.length) : str
  122. } else {
  123. return '-'
  124. }
  125. },
  126. userNameFilter (str) {
  127. return str ? str.substring(0, 1) + '**' : '-'
  128. }
  129. },
  130. computed: {
  131. floors () {
  132. return this.$store.state.floor.list
  133. },
  134. isProd () {
  135. return this.$store.state.option.url === 'http://www.usoftmall.com'
  136. },
  137. expandFloors () {
  138. let data = this.$store.state.floor.list_expand.data
  139. let _this = this
  140. for (let i = 0; i < data.length; i++) {
  141. let obj = {
  142. backGroundColor: '',
  143. body: '',
  144. hrefUrl: '',
  145. name: '',
  146. pictureUrl: '',
  147. size: '',
  148. price: '',
  149. currency: 'RMB'
  150. }
  151. if (data[i]) {
  152. obj.name = data[i].code
  153. obj.body = data[i].brandNameEn + '<br/>' + (data[i].kindNameCn || '其他')
  154. obj.hrefUrl = '/store/productDetail/' + data[i].batchCode
  155. obj.pictureUrl = '/images/floor/' + (this.isProd ? data[i].code : '2SD2704KT146') + '.png'
  156. obj.size = i % 3 === 0 ? 'medium' : 'small'
  157. obj.currency = data[i].currencyName
  158. obj.price = _this.getMinPrice(data[i].prices, data[i].currencyName)
  159. _this.defaultFloors[i < 6 ? 0 : 1].items.push(obj)
  160. }
  161. }
  162. return data
  163. },
  164. isEmpty () {
  165. let data = this.$store.state.floor.list_expand.data
  166. if (!data.length) {
  167. return true
  168. } else {
  169. for (let i = 0; i < data.length; i++) {
  170. if (!(data[0] && data[0] !== null)) {
  171. return true
  172. }
  173. }
  174. }
  175. return false
  176. },
  177. purchaseManListData () {
  178. let list = this.$store.state.applyPurchase.purchaseManList.purchaseManList.data
  179. for (let i = 0; i < list.content.length; i++) {
  180. this.purchaseManList.content.push(list.content[i])
  181. }
  182. this.listTemplate = list
  183. return list
  184. },
  185. user () {
  186. return this.$store.state.option.user
  187. }
  188. },
  189. methods: {
  190. getMinPrice: function (prices, currency) {
  191. for (let i = 0; i < prices.length; i++) {
  192. if (i === prices.length - 1) {
  193. return currency === 'RMB' ? prices[i].rMBPrice : prices[i].uSDPrice
  194. }
  195. }
  196. },
  197. setIndex: function (index) {
  198. this.currentSayPriceIndex = index
  199. },
  200. sayPrice: function (purchaseMan, index) {
  201. if (this.user.logged) {
  202. if (this.user.data.enterprise.uu) {
  203. if (this.user.data.enterprise.isVendor && this.user.data.enterprise.isVendor !== '1690') {
  204. purchaseMan.active = true
  205. this.currentSayPriceIndex = index
  206. } else {
  207. this.$message.error('抱歉,您需开通卖家功能才可报价')
  208. }
  209. } else {
  210. this.$message.error('个人账户不可报价')
  211. }
  212. } else {
  213. this.$router.push('/auth/login?returnUrl=' + window.location.href)
  214. }
  215. },
  216. resetList: function () {
  217. this.currentSayPriceIndex = -1
  218. this.timerIndex = 0
  219. this.$store.dispatch('applyPurchase/loadPurchaseManList', {pageNumber: this.nowPage, pageSize: this.pageSize, enUU: this.user.data.enterprise ? this.user.data.enterprise.uu : null})
  220. },
  221. cancelSayPrice: function () {
  222. this.purchaseManList.content[this.currentSayPriceIndex].active = false
  223. this.currentSayPriceIndex = -1
  224. }
  225. }
  226. }
  227. </script>
  228. <style lang="scss" scoped>
  229. @import '~assets/scss/variables';
  230. /*add*/
  231. .floor-list .container{
  232. padding: 0;
  233. }
  234. .floor-list {
  235. margin-bottom: $xlg-pad;
  236. }
  237. .floor-list .container > a > img {
  238. margin-top: 30px;
  239. }
  240. @keyframes myfirst {
  241. 0% {
  242. transform: translate(0px, 0px);
  243. }
  244. 50% {
  245. transform: translate(0px, -3px);
  246. }
  247. 100% {
  248. transform: translate(0px, 0px);
  249. }
  250. }
  251. .banner{
  252. width:1190px;
  253. height: 253px;
  254. margin-top: 20px;
  255. .seek-banner {
  256. > li{
  257. float: left;
  258. padding-left: 14px;
  259. position: relative;
  260. &:first-child{
  261. padding-left: 0;
  262. }
  263. }
  264. }
  265. .banner-cuxiao {
  266. width: 660px;
  267. height: 253px;
  268. background: url('/images/all/banner-cuxiao02.png') no-repeat;
  269. .wrap {
  270. width: 436px;
  271. .title {
  272. color: #f57a2e;
  273. font-size: 20px;
  274. font-weight: bold;
  275. padding: 10px 30px;
  276. margin: 0;
  277. img{
  278. position: relative;
  279. top: -7px;
  280. animation: myfirst 1s infinite;
  281. }
  282. a {
  283. font-size: 14px;
  284. color: #f57a2e;
  285. float: right;
  286. margin-top: 7px;
  287. }
  288. }
  289. .list-head {
  290. height: 30px;
  291. line-height: 30px;
  292. color: #fff;
  293. font-size: 14px;
  294. background-color: #f57a2e;
  295. text-align: center;
  296. span {
  297. display: inline-block;
  298. &:nth-child(1) {
  299. width: 70px;
  300. }
  301. &:nth-child(2) {
  302. width: 144px;
  303. }
  304. &:nth-child(3) {
  305. width: 106px;
  306. }
  307. &:nth-child(4) {
  308. width: 115px;
  309. }
  310. }
  311. }
  312. ul {
  313. max-height: 160px;
  314. overflow: hidden;
  315. position: relative;
  316. li {
  317. height: 32px;
  318. line-height: 32px;
  319. position: relative;
  320. top: 0;
  321. transition: top 1s;
  322. -moz-transition: top 1s; /* Firefox 4 */
  323. -webkit-transition: top 1s; /* Safari and Chrome */
  324. -o-transition: top 1s; /* Opera */
  325. > div {
  326. overflow: hidden;
  327. text-overflow: ellipsis;
  328. white-space: nowrap;
  329. display: inline-block;
  330. text-align: center;
  331. &:first-child {
  332. color: #f57a2e;
  333. }
  334. &:nth-child(1) {
  335. width: 70px;
  336. }
  337. &:nth-child(2) {
  338. width: 144px;
  339. }
  340. &:nth-child(3) {
  341. width: 106px;
  342. }
  343. &:nth-child(4) {
  344. width: 115px;
  345. }
  346. a {
  347. width: 64px;
  348. height: 22px;
  349. line-height: 22px;
  350. text-align: center;
  351. padding: 3px 5px;
  352. color: #fd3904;
  353. font-size: 12px;
  354. border-radius: 2px;
  355. border: 1px solid #fd3904;
  356. &:hover {
  357. border: 1px solid #fd3904;
  358. background-color: #fd3904;
  359. color: #fff;
  360. -moz-box-shadow: 0 3px 5px #f57a2e; /* 老的 Firefox */
  361. box-shadow: 0 3px 10px #f57a2e;
  362. }
  363. }
  364. .is-say-price {
  365. color: #39ae05;
  366. img {
  367. margin-bottom: 2px;
  368. }
  369. }
  370. }
  371. }
  372. }
  373. }
  374. .purchase {
  375. position: absolute;
  376. left: 515px;
  377. top: 184px;
  378. width: 100px;
  379. height: 28px;
  380. line-height: 28px;
  381. background-color: #fff;
  382. color: #f57a2e;
  383. border-radius: 25px;
  384. text-align: center;
  385. font-weight: bold;
  386. &:hover{
  387. background-color: #FB6102;
  388. color: #fff;
  389. box-shadow: 0px 3px 10px #fd863d;
  390. }
  391. }
  392. }
  393. }
  394. </style>