FloorList.vue 13 KB

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