FloorList.vue 14 KB

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