FloorList.vue 14 KB

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