FloorList.vue 17 KB

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