FloorList.vue 17 KB

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