FloorList.vue 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462
  1. <template>
  2. <div class="floor-list">
  3. <div class="container">
  4. <floor-bar :floors="floorsList"></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-cuxiao001.jpg" alt=""></a></li>-->
  10. <li>
  11. <div class="banner-cuxiao">
  12. <div class="wrap">
  13. <p class="title"><span>最新求购</span><img class="new-animate" 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. <span>型号</span>
  22. <span>规格</span>
  23. <span>操作</span>
  24. </div>
  25. <ul>
  26. <li v-for="(purchaseMan, index) in purchaseManListData.content" :style="'top: -' + 32 * timerIndex + 'px'" :class="{'top': isTop}">
  27. <div>{{purchaseMan.date | date}}</div>
  28. <div>
  29. <span :title="user.logged ? purchaseMan.inquiry.enterprise.enName : null" v-if="purchaseMan.inquiry && purchaseMan.inquiry.enterprise && purchaseMan.inquiry.enterprise.enName">{{[purchaseMan.inquiry.enterprise.enName, user] | enterpriseFilter}}</span>
  30. <span :title="user.logged ? purchaseMan.userName : null" v-else>{{[purchaseMan.userName, user] | userNameFilter}}</span>
  31. </div>
  32. <div :title="purchaseMan.inbrand">{{purchaseMan.inbrand || '-'}}</div>
  33. <div :title="purchaseMan.prodTitle">{{purchaseMan.prodTitle || '-'}}</div>
  34. <div :title="purchaseMan.cmpCode">{{purchaseMan.cmpCode || '-'}}</div>
  35. <div :title="purchaseMan.spec">{{purchaseMan.spec || '-'}}</div>
  36. <div>
  37. <div class="is-say-price" v-if="purchaseMan.remainingTime > 0 && purchaseMan.quoted == 1">已报价 <img src="/images/applyPurchase/green-check.png" alt=""></div>
  38. <div v-else>
  39. <a title="该求购已截止" v-if="!purchaseMan.remainingTime || purchaseMan.remainingTime <= 0" class="is-same" @click="sayPriceStop">我要报价</a>
  40. <a title="此为贵公司的求购" v-if="purchaseMan.remainingTime > 0 && (!purchaseMan.quoted || purchaseMan.quoted != 1) && (user.logged && ((purchaseMan.inquiry.enterprise && user.data.enterprise && (purchaseMan.inquiry.enterprise.uu === user.data.enterprise.uu)) || (!user.data.enterprise.uu && purchaseMan.userUU == user.data.userUU && !purchaseMan.inquiry.enterprise)))" class="is-same" @click="sayPriceSeft">我要报价</a>
  41. <a v-if="purchaseMan.remainingTime > 0 && (!purchaseMan.quoted || purchaseMan.quoted != 1) && !(user.logged && ((purchaseMan.inquiry.enterprise && user.data.enterprise && (purchaseMan.inquiry.enterprise.uu === user.data.enterprise.uu)) || (!user.data.enterprise.uu && purchaseMan.userUU == user.data.userUU && !purchaseMan.inquiry.enterprise)))" @click="sayPrice(purchaseMan, index)">我要报价</a>
  42. </div>
  43. </div>
  44. </li>
  45. </ul>
  46. </div>
  47. <nuxt-link to="/applyPurchase" class="purchase">我要求购</nuxt-link>
  48. </div>
  49. </li>
  50. </ul>
  51. </div>
  52. <floor v-for="floor in expandList" :floor="floor" :isDefault="true"></floor>
  53. <floor v-for="floor in floorsList" :floor="floor" :isDefault="false"></floor>
  54. </div>
  55. <say-price :current="currentSayPriceIndex"
  56. :purchase="purchaseManListData || {}"
  57. @cancelSayPriceAction="cancelSayPrice"
  58. @resetListAction="resetList"
  59. @sayPriceIndexAction="setIndex(index)"
  60. ></say-price>
  61. </div>
  62. </template>
  63. <script>
  64. import Floor from './Floor.vue'
  65. import FloorBar from './FloorBar.vue'
  66. import SayPrice from '~components/applyPurchase/SayPrice.vue'
  67. import baseUtils from '~utils/baseUtils'
  68. export default {
  69. name: 'floor-list',
  70. components: {
  71. Floor,
  72. FloorBar,
  73. SayPrice
  74. },
  75. data () {
  76. return {
  77. timerIndex: 0,
  78. pageSize: 50,
  79. nowPage: 1,
  80. currentSayPriceIndex: -1,
  81. // purchaseManList: {
  82. // content: []
  83. // },
  84. // listTemplate: [],
  85. isChange: false,
  86. isTop: false, // 判断是否滚动至顶,
  87. timer: {} // 定时器实体
  88. }
  89. },
  90. mounted () {
  91. this.$nextTick(() => {
  92. this.changeInterval(true)
  93. })
  94. },
  95. filters: {
  96. date: function (date) {
  97. const now = baseUtils.formatDate(new Date(), 'yyyy-MM-dd')
  98. const day = Math.floor((new Date(now).getTime() - new Date(baseUtils.formatDate(new Date(date), 'yyyy-MM-dd')).getTime()) / (1000 * 60 * 60 * 24))
  99. return day <= 0 ? '今天' : day + '天前'
  100. },
  101. enterpriseFilter ([str, user]) {
  102. if (!user.logged) {
  103. return str ? str.length > 4 ? str.substring(0, 2) + '**' + str.substring(str.length - 2, str.length) : str : '-'
  104. } else {
  105. return str || '-'
  106. }
  107. },
  108. userNameFilter ([str, user]) {
  109. if (!user.logged) {
  110. return str ? str.substring(0, 1) + '**' : '-'
  111. } else {
  112. return str || '-'
  113. }
  114. }
  115. },
  116. computed: {
  117. floorsF1 () {
  118. return this.$store.state.floor.list_v3.data.data.home_floor_f1
  119. },
  120. floorsF2 () {
  121. return this.$store.state.floor.list_v3.data.data.home_floor_f2
  122. },
  123. floorsF3 () {
  124. return this.$store.state.floor.list_v3.data.data.home_floor_f3
  125. },
  126. floorsF4 () {
  127. return this.$store.state.floor.list_v3.data.data.home_floor_f4
  128. },
  129. floorsF5 () {
  130. return this.$store.state.floor.list_v3.data.data.home_floor_f5
  131. },
  132. expandF1 () {
  133. return this.$store.state.floor.list_v3.data.data.home_expand_f1
  134. },
  135. expandF2 () {
  136. return this.$store.state.floor.list_v3.data.data.home_expand_f2
  137. },
  138. floorsList () {
  139. let lists = []
  140. let floorName = ['传感器件', '连接器件', '分立器件', '被动器件', '电源产品']
  141. for (let i = 0; i < floorName.length; i++) {
  142. lists.push({'floorNumber': i + 1, 'name': floorName[i]})
  143. }
  144. lists[0].items = this.floorsF1
  145. lists[1].items = this.floorsF2
  146. lists[2].items = this.floorsF3
  147. lists[3].items = this.floorsF4
  148. lists[4].items = this.floorsF5
  149. lists.slice().forEach(function(value) {
  150. let lengs = value.items.length
  151. for (let j = 0; j < lengs; j++) {
  152. value.items[j].backGroundColor = value.items[j].metadatas.contExp_select
  153. value.items[j].body = value.items[j].metadatas.contExp_remark
  154. value.items[j].name = value.items[j].metadatas.contExp_abstract
  155. value.items[j].size = value.items[j].metadatas.contExp_spec
  156. value.items[j].hrefUrl = value.items[j].detailsLink
  157. value.items[j].pictureUrl = value.items[j].pictureLink
  158. value.items[j].price = value.items[j].remark
  159. value.items[j].isNull = value.items[j].pictureLink === null
  160. }
  161. })
  162. return lists
  163. },
  164. expandList () {
  165. let lists = []
  166. let floorName = ['特价1', '特价2']
  167. for (let i = 0; i < floorName.length; i++) {
  168. lists.push({'floorNumber': i + 1, 'name': floorName[i]})
  169. }
  170. lists[0].items = this.expandF1
  171. lists[1].items = this.expandF2
  172. lists.slice().forEach(function(value) {
  173. let lengs = value.items.length
  174. for (let j = 0; j < lengs; j++) {
  175. value.items[j].backGroundColor = value.items[j].metadatas.contExp_select
  176. value.items[j].body = value.items[j].metadatas.contExp_remark
  177. value.items[j].name = value.items[j].metadatas.contExp_abstract
  178. value.items[j].size = value.items[j].metadatas.contExp_spec
  179. value.items[j].hrefUrl = value.items[j].detailsLink
  180. value.items[j].pictureUrl = value.items[j].pictureLink
  181. value.items[j].price = value.items[j].remark
  182. value.items[j].isNull = value.items[j].pictureLink === null
  183. }
  184. })
  185. return lists
  186. },
  187. isProd () {
  188. return this.$store.state.option.url === 'http://www.usoftmall.com'
  189. },
  190. purchaseManListData () {
  191. // let list = this.$store.state.applyPurchase.purchaseManList.purchaseManList.data
  192. // if (this.isChange) {
  193. // this.purchaseManList.content = []
  194. // this.listTemplate = list
  195. // this.isChange = false
  196. // } else if (list.content) {
  197. // for (let i = 0; i < list.content.length; i++) {
  198. // this.purchaseManList.content.push(list.content[i])
  199. // }
  200. // this.listTemplate = list
  201. // }
  202. return this.$store.state.applyPurchase.purchaseManList.purchaseManList.data
  203. },
  204. user () {
  205. return this.$store.state.option.user
  206. }
  207. },
  208. methods: {
  209. getMinPrice: function (prices, currency) {
  210. for (let i = 0; i < prices.length; i++) {
  211. if (i === prices.length - 1) {
  212. return currency === 'RMB' ? prices[i].rMBPrice : prices[i].uSDPrice
  213. }
  214. }
  215. },
  216. setIndex: function (index) {
  217. this.currentSayPriceIndex = index
  218. },
  219. sayPriceStop: function () {
  220. this.$message.error('该求购已截止')
  221. },
  222. sayPriceSeft: function () {
  223. this.$message.error('此为贵公司的求购')
  224. },
  225. sayPrice: function (purchaseMan, index) {
  226. if (this.user.logged) {
  227. if (this.user.data.enterprise.uu) {
  228. if (this.user.data.enterprise.isVendor && this.user.data.enterprise.isVendor !== '1690') {
  229. // purchaseMan.active = true
  230. this.authorityInterceptor(this.baseUrls.vendorBusinessSayPrice, () => {
  231. this.changeInterval(false)
  232. this.currentSayPriceIndex = index
  233. })
  234. } else {
  235. this.$message.error('抱歉,您需开通卖家功能才可报价')
  236. }
  237. } else {
  238. this.$message.error('个人账户暂不可报价')
  239. }
  240. } else {
  241. this.$router.push('/auth/login?returnUrl=' + window.location.href)
  242. }
  243. },
  244. resetList: function () {
  245. this.currentSayPriceIndex = -1
  246. this.timerIndex = 0
  247. this.isChange = true
  248. this.$store.dispatch('applyPurchase/loadPurchaseManList', {pageNumber: this.nowPage, pageSize: this.pageSize, enUU: this.user.data.enterprise ? this.user.data.enterprise.uu : null})
  249. },
  250. cancelSayPrice: function () {
  251. // this.purchaseManList.content[this.currentSayPriceIndex].active = false
  252. this.currentSayPriceIndex = -1
  253. this.changeInterval(true)
  254. },
  255. changeInterval: function (flag) {
  256. if (flag) {
  257. this.timer = setInterval(() => {
  258. this.timerIndex ++
  259. this.isTop = (this.timerIndex % 45 === 0)
  260. if (this.isTop) {
  261. // for (let i = 0; i < _this.listTemplate.content.length; i++) {
  262. // this.purchaseManList.content.push(_this.listTemplate.content[i])
  263. // }
  264. this.timerIndex = 0
  265. }
  266. }, 3000)
  267. } else {
  268. clearInterval(this.timer)
  269. }
  270. }
  271. }
  272. }
  273. </script>
  274. <style lang="scss" scoped>
  275. @import '~assets/scss/variables';
  276. /*add*/
  277. .floor-list .container{
  278. padding: 0;
  279. }
  280. .floor-list {
  281. margin-bottom: $xlg-pad;
  282. }
  283. .floor-list .container > a > img {
  284. margin-top: 30px;
  285. }
  286. .banner{
  287. width:1190px;
  288. height: 253px;
  289. margin-top: 20px;
  290. .seek-banner {
  291. > li{
  292. /*float: left;*/
  293. /*padding-left: 14px;*/
  294. position: relative;
  295. /*&:first-child{*/
  296. /*padding-left: 0;*/
  297. /*}*/
  298. }
  299. }
  300. .banner-cuxiao {
  301. width: 1190px;
  302. height: 253px;
  303. background: url('/images/all/home-apply.jpg') no-repeat;
  304. /*background-size: 1190px auto;*/
  305. .wrap {
  306. width: 874px;
  307. .title {
  308. color: #f57a2e;
  309. font-size: 20px;
  310. font-weight: bold;
  311. padding: 10px 30px;
  312. margin: 0;
  313. a {
  314. font-size: 14px;
  315. color: #f57a2e;
  316. float: right;
  317. margin-top: 7px;
  318. }
  319. }
  320. .list-head {
  321. height: 30px;
  322. line-height: 30px;
  323. color: #fff;
  324. font-size: 14px;
  325. background-color: #f57a2e;
  326. text-align: center;
  327. span {
  328. display: inline-block;
  329. &:nth-child(1) {
  330. width: 97px;
  331. }
  332. &:nth-child(2) {
  333. width: 164px;
  334. }
  335. &:nth-child(3) {
  336. width: 139px;
  337. }
  338. &:nth-child(4) {
  339. width: 115px;
  340. }
  341. &:nth-child(5) {
  342. width: 160px;
  343. }
  344. &:nth-child(6) {
  345. width: 99px;
  346. }
  347. &:nth-child(7) {
  348. width: 91px;
  349. }
  350. }
  351. }
  352. ul {
  353. max-height: 160px;
  354. overflow: hidden;
  355. position: relative;
  356. li {
  357. height: 32px;
  358. line-height: 32px;
  359. position: relative;
  360. top: 0;
  361. transition: top 1s;
  362. -moz-transition: top 1s; /* Firefox 4 */
  363. -webkit-transition: top 1s; /* Safari and Chrome */
  364. -o-transition: top 1s; /* Opera */
  365. &.top {
  366. transition: top 0s;
  367. -moz-transition: top 0s; /* Firefox 4 */
  368. -webkit-transition: top 0s; /* Safari and Chrome */
  369. -o-transition: top 0s; /* Opera */
  370. }
  371. > div {
  372. overflow: hidden;
  373. text-overflow: ellipsis;
  374. white-space: nowrap;
  375. display: inline-block;
  376. text-align: center;
  377. padding: 0px 10px;
  378. &:first-child {
  379. color: #f57a2e;
  380. }
  381. &:nth-child(1) {
  382. width: 97px;
  383. }
  384. &:nth-child(2) {
  385. width: 164px;
  386. }
  387. &:nth-child(3) {
  388. width: 139px;
  389. }
  390. &:nth-child(4) {
  391. width: 115px;
  392. }
  393. &:nth-child(5) {
  394. width: 160px;
  395. }
  396. &:nth-child(6) {
  397. width: 99px;
  398. }
  399. &:nth-child(7) {
  400. width: 91px;
  401. }
  402. a {
  403. width: 64px;
  404. height: 22px;
  405. line-height: 22px;
  406. text-align: center;
  407. padding: 3px 5px;
  408. color: #fd3904;
  409. font-size: 12px;
  410. border-radius: 2px;
  411. border: 1px solid #fd3904;
  412. &:hover {
  413. border: 1px solid #fd3904;
  414. background-color: #fd3904;
  415. color: #fff;
  416. -moz-box-shadow: 0 3px 5px #f57a2e; /* 老的 Firefox */
  417. box-shadow: 0 3px 10px #f57a2e;
  418. }
  419. &.is-same {
  420. background: #cccbcb;
  421. border: none;
  422. color: #fff;
  423. -webkit-box-shadow: none;
  424. -moz-box-shadow: none;
  425. box-shadow: none;
  426. }
  427. }
  428. .is-say-price {
  429. color: #39ae05;
  430. img {
  431. margin-bottom: 2px;
  432. }
  433. }
  434. }
  435. }
  436. }
  437. }
  438. .purchase {
  439. position: absolute;
  440. right: 88px;
  441. top: 170px;
  442. width: 114px;
  443. height: 32px;
  444. font-size: 16px;
  445. line-height: 32px;
  446. background-color: rgba(255, 255, 255, 0.98);
  447. box-shadow: 0px 1px 1px 1px rgba(244, 94, 2, 0.8);
  448. border-radius: 14px;
  449. opacity: 0.98;
  450. background-color: #fff;
  451. color: #f57a2e;
  452. text-align: center;
  453. font-weight: bold;
  454. &:hover{
  455. background-color: #FB6102;
  456. color: #fff;
  457. box-shadow: 0px 3px 10px #fd863d;
  458. }
  459. }
  460. }
  461. }
  462. </style>