FloorList.vue 13 KB

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