FloorList.vue 13 KB

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