FloorList.vue 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457
  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-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 :floor="defaultFloors[0]" :isDefault="true" v-if="!isEmpty"></floor>
  53. <floor :floor="defaultFloors[1]" :isDefault="true" v-if="!isEmpty"></floor>
  54. <floor v-for="(floor, index) in floors.data" :floor="floor" :isDefault="false" :key="index"></floor>
  55. </div>
  56. <span v-if="expandFloors && false">floor</span>
  57. <say-price :current="currentSayPriceIndex"
  58. :purchase="purchaseManListData || {}"
  59. @cancelSayPriceAction="cancelSayPrice"
  60. @resetListAction="resetList"
  61. @sayPriceIndexAction="setIndex(index)"
  62. ></say-price>
  63. </div>
  64. </template>
  65. <script>
  66. import Floor from './Floor.vue'
  67. import FloorBar from './FloorBar.vue'
  68. import SayPrice from '~components/applyPurchase/SayPrice.vue'
  69. import { formatDate } from '~utils/baseUtils'
  70. export default {
  71. name: 'floor-list',
  72. components: {
  73. Floor,
  74. FloorBar,
  75. SayPrice
  76. },
  77. data () {
  78. return {
  79. defaultFloors: [
  80. {
  81. items: [
  82. {
  83. backGroundColor: '',
  84. body: '',
  85. hrefUrl: '/store/33069557578d44e69bd91ad12d28a8d4',
  86. pictureUrl: '/images/floor/banner01.jpg',
  87. size: 'large'
  88. }
  89. ]
  90. },
  91. {
  92. items: [
  93. {
  94. backGroundColor: '',
  95. body: '',
  96. hrefUrl: '/store/33069557578d44e69bd91ad12d28a8d4',
  97. pictureUrl: '/images/floor/banner02.jpg',
  98. size: 'large'
  99. }
  100. ]
  101. }
  102. ],
  103. timerIndex: 0,
  104. pageSize: 50,
  105. nowPage: 1,
  106. currentSayPriceIndex: -1,
  107. // purchaseManList: {
  108. // content: []
  109. // },
  110. // listTemplate: [],
  111. isChange: false,
  112. isTop: false, // 判断是否滚动至顶,
  113. timer: {} // 定时器实体
  114. }
  115. },
  116. mounted () {
  117. this.$nextTick(() => {
  118. this.changeInterval(true)
  119. })
  120. },
  121. filters: {
  122. date: function (date) {
  123. const now = formatDate('yyyy-MM-dd', Date.now())
  124. const day = Math.floor((now - date) / (1000 * 60 * 60 * 24))
  125. return day <= 0 ? '今天' : day + '天前'
  126. },
  127. enterpriseFilter ([str, user]) {
  128. if (!user.logged) {
  129. return str ? str.length > 4 ? str.substring(0, 2) + '**' + str.substring(str.length - 2, str.length) : str : '-'
  130. } else {
  131. return str || '-'
  132. }
  133. },
  134. userNameFilter ([str, user]) {
  135. if (!user.logged) {
  136. return str ? str.substring(0, 1) + '**' : '-'
  137. } else {
  138. return str || '-'
  139. }
  140. }
  141. },
  142. computed: {
  143. floors () {
  144. return this.$store.state.floor.list
  145. },
  146. isProd () {
  147. return this.$store.state.option.url === 'http://www.usoftmall.com'
  148. },
  149. expandFloors () {
  150. let data = this.$store.state.floor.list_expand.data
  151. let _this = this
  152. for (let i = 0; i < data.length; i++) {
  153. let obj = {
  154. backGroundColor: '',
  155. body: '',
  156. hrefUrl: '',
  157. name: '',
  158. pictureUrl: '',
  159. size: '',
  160. price: '',
  161. currency: 'RMB'
  162. }
  163. if (data[i]) {
  164. obj.name = data[i].code
  165. obj.body = data[i].brandNameEn + '<br/>' + (data[i].kindNameCn || '其他')
  166. obj.hrefUrl = '/store/productDetail/' + data[i].batchCode
  167. obj.pictureUrl = '/images/floor/' + (this.isProd ? data[i].code : '2SD2704KT146') + '.png'
  168. obj.currency = data[i].currencyName
  169. obj.price = _this.getMinPrice(data[i].prices, data[i].currencyName)
  170. } else {
  171. // 如果是空数据
  172. obj.isNull = true
  173. }
  174. obj.size = i % 3 === 0 ? 'medium' : 'small'
  175. _this.defaultFloors[i < 6 ? 0 : 1].items.push(obj)
  176. }
  177. return data
  178. },
  179. isEmpty () {
  180. let data = this.$store.state.floor.list_expand.data
  181. if (!data.length) {
  182. return true
  183. } else {
  184. for (let i = 0; i < data.length; i++) {
  185. if (!(data[0] && data[0] !== null)) {
  186. return true
  187. }
  188. }
  189. }
  190. return false
  191. },
  192. purchaseManListData () {
  193. // let list = this.$store.state.applyPurchase.purchaseManList.purchaseManList.data
  194. // if (this.isChange) {
  195. // this.purchaseManList.content = []
  196. // this.listTemplate = list
  197. // this.isChange = false
  198. // } else if (list.content) {
  199. // for (let i = 0; i < list.content.length; i++) {
  200. // this.purchaseManList.content.push(list.content[i])
  201. // }
  202. // this.listTemplate = list
  203. // }
  204. return this.$store.state.applyPurchase.purchaseManList.purchaseManList.data
  205. },
  206. user () {
  207. return this.$store.state.option.user
  208. }
  209. },
  210. methods: {
  211. getMinPrice: function (prices, currency) {
  212. for (let i = 0; i < prices.length; i++) {
  213. if (i === prices.length - 1) {
  214. return currency === 'RMB' ? prices[i].rMBPrice : prices[i].uSDPrice
  215. }
  216. }
  217. },
  218. setIndex: function (index) {
  219. this.currentSayPriceIndex = index
  220. },
  221. sayPriceStop: function () {
  222. this.$message.error('该求购已截止')
  223. },
  224. sayPriceSeft: function () {
  225. this.$message.error('此为贵公司的求购')
  226. },
  227. sayPrice: function (purchaseMan, index) {
  228. if (this.user.logged) {
  229. if (this.user.data.enterprise.uu) {
  230. if (this.user.data.enterprise.isVendor && this.user.data.enterprise.isVendor !== '1690') {
  231. // purchaseMan.active = true
  232. this.changeInterval(false)
  233. this.currentSayPriceIndex = index
  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. &:first-child {
  378. color: #f57a2e;
  379. }
  380. &:nth-child(1) {
  381. width: 97px;
  382. }
  383. &:nth-child(2) {
  384. width: 164px;
  385. }
  386. &:nth-child(3) {
  387. width: 139px;
  388. }
  389. &:nth-child(4) {
  390. width: 115px;
  391. }
  392. &:nth-child(5) {
  393. width: 160px;
  394. }
  395. &:nth-child(6) {
  396. width: 99px;
  397. }
  398. &:nth-child(7) {
  399. width: 91px;
  400. }
  401. a {
  402. width: 64px;
  403. height: 22px;
  404. line-height: 22px;
  405. text-align: center;
  406. padding: 3px 5px;
  407. color: #fd3904;
  408. font-size: 12px;
  409. border-radius: 2px;
  410. border: 1px solid #fd3904;
  411. &:hover {
  412. border: 1px solid #fd3904;
  413. background-color: #fd3904;
  414. color: #fff;
  415. -moz-box-shadow: 0 3px 5px #f57a2e; /* 老的 Firefox */
  416. box-shadow: 0 3px 10px #f57a2e;
  417. }
  418. &.is-same {
  419. background: #cccbcb;
  420. border: none;
  421. color: #fff;
  422. -webkit-box-shadow: none;
  423. -moz-box-shadow: none;
  424. box-shadow: none;
  425. }
  426. }
  427. .is-say-price {
  428. color: #39ae05;
  429. img {
  430. margin-bottom: 2px;
  431. }
  432. }
  433. }
  434. }
  435. }
  436. }
  437. .purchase {
  438. position: absolute;
  439. right: 101px;
  440. top: 175px;
  441. width: 100px;
  442. height: 28px;
  443. line-height: 28px;
  444. background-color: #fff;
  445. color: #f57a2e;
  446. border-radius: 25px;
  447. text-align: center;
  448. font-weight: bold;
  449. &:hover{
  450. background-color: #FB6102;
  451. color: #fff;
  452. box-shadow: 0px 3px 10px #fd863d;
  453. }
  454. }
  455. }
  456. }
  457. </style>