GoodList.vue 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634
  1. <template>
  2. <div>
  3. <div>
  4. <div class="tab-filter" >
  5. <div class="fl">&nbsp;&nbsp;| 产品信息(<span class="text-num"></span><span class="text-num" v-text="good_list.total"></span>)</div>
  6. <div class="fr">
  7. <div @click="sortBy('normal1')" :class="activeTag==='normal1'?'active':''"><a >综合排序</a></div>
  8. <div @click="sortBy('normal2')" :class="activeTag==='normal2'?'active':''"><a >现货优选</a></div>
  9. <div @click="sortBy('type')" :class="activeTag==='type'?'active':''"><a >型号精确</a></div>
  10. <div style="display:none"><a href="">销量</a></div>
  11. <div style="display:none"><a href="">人气</a></div>
  12. <div style="display:none"><a href="">信用</a></div>
  13. <div @click="sortBy('price')" :class="activeTag==='price'?'active':''"><a>价格<i class="fa fa-long-arrow-down" v-show="price_asc"></i><i class="fa fa-long-arrow-up" v-show="!price_asc"></i></a></div>
  14. <div class="price-filter">
  15. <div class="price-input">
  16. <input type="number" min="0" step="0.01" v-model="min_price" class="form-control" placeholder="¥" onfocus="this.placeholder=''" onblur="this.placeholder='¥'" />
  17. <span>-</span>
  18. <input type="number" :min="min_price === ''?0:min_price" step="0.01" v-model="max_price" class="form-control" placeholder="¥" onfocus="this.placeholder=''" onblur="this.placeholder='¥'" />
  19. </div>
  20. <div class="price-hover">
  21. <a @click="clear_price">清空</a>
  22. <a @click="filter_price">确定</a>
  23. </div>
  24. </div>
  25. <div style="display:none;padding-top: 5px; margin-left: 0;">
  26. <select class="select-adder form-control" style="width: 120px;">
  27. <option value="1">发货地</option>
  28. </select>
  29. </div>
  30. <div class="off">
  31. <a @click="list_open=!list_open">
  32. <span v-text="list_open?'收起':'展开'"></span>
  33. <i class="fa fa-angle-down" v-show="!list_open"></i>
  34. <i class="fa fa-angle-up"v-show="list_open"></i>
  35. </a>
  36. </div>
  37. </div>
  38. </div>
  39. <div v-if="list_open">
  40. <table class="product-list" >
  41. <thead>
  42. <tr style="height: 40px;">
  43. <th width="80"></th>
  44. <th width="160">品牌/型号</th>
  45. <th width="90">类目</th>
  46. <th width="100">封装/生产日期</th>
  47. <th width="110">库存</th>
  48. <th width="90">阶梯</th>
  49. <th width="90" v-if="!crname_click_flag.rmb_click_flag">香港交货</th>
  50. <th width="110" v-if="!crname_click_flag.usd_click_flag">大陆交货<span style="font-size: 12px;">(含税)</span></th>
  51. <th width="110">货期<span style="font-size: 12px;">(工作日)</span></th>
  52. <th width="100">操作</th>
  53. </tr>
  54. </thead>
  55. <tbody id="productList-content">
  56. <tr v-for="item in good_list.components">
  57. <td>
  58. <nuxt-link :to="`/product/component/${item.uuid}`">
  59. <img width="80px" height="80px" :src="item.img?item.img:'http://static.usoftmall.com/img/all/default.png?_v=1499336134257'">
  60. </nuxt-link>
  61. </td>
  62. <td class="brand-code">
  63. <div class="brand"><nuxt-link :to="`/product/brand/${item.brand.uuid}`" class="text-num" v-text="item.brand.nameEn"></nuxt-link></div>
  64. <div class="code"><nuxt-link :to="`/product/component/${item.uuid}`" class="f16 text-bold text-num" v-text="item.code"></nuxt-link></div>
  65. </td>
  66. <td>
  67. <div><i class="fa fa-th-large f14" aria-hidden="true"></i>&nbsp;&nbsp;
  68. <nuxt-link :to="`/product/kind/${item.kindid}`" v-text="item.kind.nameCn">
  69. </nuxt-link>
  70. </div>
  71. </td>
  72. <td>
  73. <div class="package" v-text="item.packing?item.packing:'暂无包装方式信息'"></div>
  74. <div class="date" v-text="item.produceDate"></div>
  75. </td>
  76. <td class="text-left">
  77. <div class="goods">
  78. 库存:<span v-text="item.reserve || '暂无库存'"></span>
  79. </div>
  80. <div class="from" v-if="item.reserve > 0">
  81. 起拍:<span v-text="item.minBuyQty"></span>
  82. </div>
  83. <div class="multiple" v-if="item.reserve > 0">
  84. 倍数:<span v-text="item.minPackQty"></span>
  85. </div>
  86. </td>
  87. <td>
  88. <div v-show="!item.prices">
  89. <span>—</span>
  90. </div>
  91. <div v-for="price in item.prices">
  92. <span v-text="price.start"></span> +
  93. </div>
  94. </td>
  95. <td v-if="!crname_click_flag.usd_click_flag">
  96. <div v-show="!(item.currencyName == 'USD') || !item.prices">
  97. <span>—</span>
  98. </div>
  99. <div v-for="price in item.prices">
  100. <span>{{price.uSDPrice | currency}}</span>
  101. </div>
  102. </td>
  103. <td v-if="!crname_click_flag.rmb_click_flag">
  104. <div v-show="!(item.currencyName == 'RMB') || !item.prices">
  105. <span>—</span>
  106. </div>
  107. <div v-for="price in item.prices">
  108. <span>{{price.rMBPrice | currency}}</span>
  109. </div>
  110. </td>
  111. <td>
  112. <div v-show="!item.b2cMinDelivery">
  113. <span>—</span>
  114. </div>
  115. <div v-if="item.b2cMinDelivery">交期: <span v-text="item.b2cMinDelivery + '-' + item.b2cMaxDelivery"></span></div>
  116. </td>
  117. <td>
  118. <div v-show="!item.reserve">
  119. <span>—</span>
  120. </div>
  121. <div v-if="item.reserve > 0">
  122. <button class="btn btn-primary btn-buy-now" ><span class="watch">立即购买</span></button>
  123. </div>
  124. <div v-if="item.reserve > 0">
  125. <button class="btn btn-add-cart"><span class="watch">加入购物车</span></button>
  126. </div>
  127. </td>
  128. </tr>
  129. <tr v-if="good_list.components.length == 'undefined' ||good_list.components.length == 0">
  130. <td colspan="10" class="text-center" style="line-height: 40px; font-size: 20px;">
  131. <i class="fa fa-smile-o fa-lg"></i> 暂无产品信息
  132. </td>
  133. </tr>
  134. </tbody>
  135. </table>
  136. </div>
  137. <page :total="total_count" :page-size="pageSize"
  138. :current="nowPage" v-on:childEvent="listenPage"></page>
  139. </div>
  140. </div>
  141. </template>
  142. <script>
  143. import Page from '~components/common/page/pageComponent.vue'
  144. export default {
  145. data () {
  146. return {
  147. list_open: true,
  148. nowPage: 1,
  149. pageSize: 15,
  150. sorting: {},
  151. price_asc: true,
  152. min_price: '',
  153. max_price: '',
  154. filter: {},
  155. activeTag: 'normal1'
  156. }
  157. },
  158. components: {
  159. Page
  160. },
  161. props: ['crname_click_flag'],
  162. filters: {
  163. currency: function (input) {
  164. if (typeof input === 'number') {
  165. if (input.toString().indexOf('.') === -1) {
  166. input = input + '.00'
  167. }
  168. }
  169. return input
  170. }
  171. },
  172. computed: {
  173. good_lists () {
  174. return this.$store.state.searchData.searchList.lists
  175. },
  176. good_list () {
  177. return this.good_lists.data
  178. },
  179. total_count () {
  180. return Math.min(this.good_list.total, 100 * this.pageSize)
  181. }
  182. },
  183. methods: {
  184. listenPage: function (changedPage) {
  185. this.nowPage = changedPage
  186. this.$emit('pageEvent', this.nowPage)
  187. },
  188. sortBy: function (param) {
  189. if (param === 'normal1') {
  190. this.sorting = {'GO_RESERVE': 'DESC', 'GO_SEARCH': 'DESC'}
  191. this.activeTag = 'normal1'
  192. } else if (param === 'normal2') {
  193. this.sorting = {'GO_SEARCH': 'DESC', 'GO_RESERVE': 'DESC'}
  194. this.activeTag = 'normal2'
  195. } else if (param === 'type') {
  196. this.sorting = {'GO_SEARCH': 'DESC', 'GO_RESERVE': 'DESC'}
  197. this.activeTag = 'type'
  198. } else if (param === 'price') {
  199. if (this.price_asc) {
  200. this.sorting = {'GO_MINPRICERMB': 'ASC', 'GO_RESERVE': 'DESC', 'GO_SEARCH': 'DESC'}
  201. } else {
  202. this.sorting = {'GO_MINPRICERMB': 'DESC', 'GO_RESERVE': 'DESC', 'GO_SEARCH': 'DESC'}
  203. }
  204. this.activeTag = 'price'
  205. this.price_asc = !this.price_asc
  206. }
  207. this.$emit('sortEvent', this.sorting)
  208. },
  209. filter_price: function () {
  210. if (this.min_price === '' && this.max_price !== '') {
  211. this.filter.goods_maxpricermb = this.max_price
  212. } else if (this.min_price !== '' && this.max_price === '') {
  213. this.filter.goods_minpricermb = this.min_price
  214. } else if (this.min_price !== '' && this.max_price !== '') {
  215. if (this.min_price <= this.max_price) {
  216. this.filter.goods_minpricermb = this.min_price
  217. this.filter.goods_maxpricermb = this.max_price
  218. }
  219. } else {
  220. delete this.filter.goods_minpricermb
  221. delete this.filter.goods_maxpricermb
  222. }
  223. this.$emit('filterPriceEvent', this.filter)
  224. },
  225. clear_price: function () {
  226. this.min_price = ''
  227. this.max_price = ''
  228. }
  229. }
  230. }
  231. </script>
  232. <style scoped>
  233. .tab-filter {
  234. width: 1190px;
  235. height: 40px;
  236. margin: 0 auto;
  237. line-height: 40px;
  238. margin-top: 20px;
  239. margin-bottom: 10px;
  240. background: #f1efef;
  241. }
  242. .tab-filter .fl {
  243. font-size: 14px;
  244. }
  245. .tab-filter .fl, .tab-filter .fr {
  246. float: left;
  247. }
  248. .tab-filter .fl span {
  249. font-size: 14px;
  250. }
  251. .text-num {
  252. font-style: normal;
  253. font-family: verdana;
  254. }
  255. .tab-filter .fr {
  256. max-width: 1050px;
  257. }
  258. .tab-filter .fr div {
  259. float: left;
  260. margin: 0 5px;
  261. }
  262. .tab-filter .fr a {
  263. display: inline-block;
  264. padding: 1px 10px;
  265. border: #ccc 1px solid;
  266. line-height: 26px;
  267. font-size: 14px;
  268. text-align: center;
  269. color: #333;
  270. max-height: 30px;
  271. background: #fff;
  272. }
  273. .tab-filter .fr .price-filter {
  274. padding-top: 5px;
  275. width: 176px;
  276. margin: 0;
  277. }
  278. .price-filter {
  279. position: relative;
  280. }
  281. .price-filter .price-input {
  282. position: relative;
  283. z-index: 10;
  284. margin: 0 10px !important;
  285. width: 180px;
  286. }
  287. .tab-filter .fr .price-filter input, .tab-filter .fr .price-filter span {
  288. float: left;
  289. }
  290. .tab-filter .fr .form-control {
  291. width: 70px;
  292. height: 30px;
  293. border-radius: 0;
  294. padding-left: 5px;
  295. }
  296. .tab-filter .fr .price-filter span {
  297. margin: 0 5px;
  298. line-height: 30px;
  299. }
  300. .price-filter .price-hover {
  301. display: none;
  302. width: 165px;
  303. height: 25px;
  304. padding: 60px 6px 6px;
  305. margin: 0 10px;
  306. border: 1px solid #999;
  307. position: absolute;
  308. background: #fff;
  309. top: 0;
  310. -webkit-box-shadow: 1px 1px 2px rgba(0,0,0,.2);
  311. -moz-box-shadow: 1px 1px 2px rgba(0,0,0,.2);
  312. box-shadow: 1px 1px 2px rgba(0,0,0,.2);
  313. }
  314. .price-filter .price-hover a:first-child {
  315. position: absolute;
  316. top: 37px;
  317. left: 6px;
  318. width: 36px;
  319. height: 25px;
  320. line-height: 25px;
  321. text-align: center;
  322. color: #5078cb;
  323. display: inline-block;
  324. border: none;
  325. padding: 0;
  326. }
  327. .price-filter .price-hover a:last-child {
  328. position: absolute;
  329. top: 37px;
  330. right: 7px;
  331. width: 38px;
  332. height: 25px;
  333. line-height: 24px;
  334. border: 1px solid #ccc;
  335. text-align: center;
  336. background: #f7f7f7;
  337. color: #333;
  338. display: inline-block;
  339. padding: 0;
  340. }
  341. .tab-filter .fr .off {
  342. margin-left: 130px;
  343. float: right;
  344. }
  345. .tab-filter .fr .off a {
  346. border: none;
  347. text-align: right;
  348. padding-left: 360px;
  349. background: none;
  350. }
  351. .tab-filter .fr .off a i {
  352. font-size: 16px;
  353. }
  354. .product-list{
  355. width: 1190px;
  356. /*margin-bottom: 20px;*/
  357. }
  358. .product-list thead tr{
  359. /*border-top: #6493ff 2px solid;*/
  360. color: #323232;
  361. background: none;
  362. }
  363. /* 物品列表 */
  364. .product-list .brand-code {
  365. font-size: 14px;
  366. text-align: center;
  367. }
  368. .product-list .brand-code .code {
  369. font-weight: 600;
  370. }
  371. .product-list th {
  372. color: rgb(50,50,50);
  373. font-size: 14px;
  374. font-weight: 600;
  375. background-color: #f7f7f7;
  376. text-align: center;
  377. }
  378. .product-list tbody>tr {
  379. border: 1px solid #e8e8e8;
  380. }
  381. .product-list tbody>tr img {
  382. border: 1px solid #e8e8e8;
  383. margin: 10px 0 5px 0;
  384. width: 80px;
  385. height: 80px;
  386. }
  387. .product-list tbody>tr .contact{
  388. font-size: 14px;
  389. color: #5078cb;
  390. width: 90%;
  391. margin: 0 auto;
  392. display: inline-block;
  393. }
  394. .product-list tbody>tr .contact:hover{
  395. color: #d32526;
  396. }
  397. .product-list td {
  398. font-size: 12px;
  399. color: #333;
  400. text-align: center;
  401. line-height: 20px;
  402. }
  403. /* 物品列表按钮 */
  404. .product-list .btn-buy-now {
  405. background-color: #5078CB;
  406. color: #fff;
  407. width: 80px;
  408. height: 30px;
  409. font-size: 12px;
  410. border: 1px solid #5078cb;
  411. }
  412. .product-list .btn-add-cart {
  413. margin-top: 10px;
  414. color: #214797;
  415. width: 80px;
  416. height: 30px;
  417. font-size: 12px;
  418. background-color: #fff;
  419. border: 1px solid #e8e8e8;
  420. }
  421. .product-list .btn-buy-now:hover{
  422. background: #214797;
  423. }
  424. .product-list .btn-add-cart:hover{
  425. background-color: #5078CB;
  426. color: #fff;
  427. }
  428. .product-list .text-left{
  429. text-align: left;
  430. }
  431. .product-list .text-left div{
  432. margin-left: 30px;
  433. }
  434. .product-list tbody tr td{
  435. padding: 10px 0;
  436. }
  437. .search-record{
  438. width: 100%;
  439. margin: 0 auto;
  440. height: 40px;
  441. font-size: 16px;
  442. line-height: 40px;
  443. margin-top: 20px;
  444. }
  445. .search-record span.red{
  446. color: #ff0909;
  447. }
  448. .tab-filter{
  449. width: 1190px;
  450. height: 40px;
  451. margin: 0 auto;
  452. background: #fff;
  453. line-height: 40px;
  454. margin-top: 20px;
  455. margin-bottom: 10px;
  456. background: #f1efef;
  457. }
  458. .tab-filter .fl,.tab-filter .fr{
  459. float: left;
  460. }
  461. .tab-filter .fl{
  462. font-size: 14px;
  463. }
  464. .tab-filter .fr{
  465. max-width: 1050px;
  466. }
  467. .tab-filter .fl span{
  468. font-size: 14px;
  469. }
  470. .tab-filter .fr div{
  471. float: left;
  472. margin: 0 5px;
  473. }
  474. .tab-filter .fr div.active a{
  475. border: #5078cb 1px solid;
  476. color: #5078cb;
  477. }
  478. .tab-filter .fr a{
  479. display: inline-block;
  480. padding: 1px 10px;
  481. border: #ccc 1px solid;
  482. line-height: 26px;
  483. font-size: 14px;
  484. text-align: center;
  485. color: #333;
  486. max-height: 30px;
  487. background: #fff;
  488. }
  489. .tab-filter .fr a i{
  490. /*margin-left: 5px;*/
  491. }
  492. .tab-filter .fr a:hover{
  493. border: #5078cb 1px solid;
  494. color: #5078cb;
  495. }
  496. .tab-filter .fr .off{
  497. margin-left : 129px;
  498. float: right;
  499. }
  500. .tab-filter .fr .off a:hover{
  501. border: none;
  502. color: #5078cb;
  503. }
  504. .tab-filter .fr .off a{
  505. border: none;
  506. text-align: right;
  507. padding-left: 360px;
  508. background: none;
  509. }
  510. .tab-filter .fr .off a i{
  511. font-size: 16px;
  512. }
  513. .tab-filter .fr .form-control{
  514. width: 70px;
  515. height: 30px;
  516. border-radius: 0;
  517. padding-left: 5px;
  518. }
  519. .tab-filter .fr .price-filter input,.tab-filter .fr .price-filter span{
  520. float: left;
  521. }
  522. .tab-filter .fr select{
  523. -webkit-appearance: none;
  524. appearance: none;
  525. background: transparent;
  526. -o-appearance: none;
  527. -moz-appearance: none;
  528. -ms-appearance: none;
  529. width: 120px;
  530. }
  531. .tab-filter .fr .price-filter{
  532. padding-top: 5px;
  533. width: 176px;
  534. margin: 0;
  535. }
  536. .tab-filter .fr .price-filter span{
  537. margin: 0 5px;
  538. line-height: 30px;
  539. }
  540. .close{
  541. display: none;
  542. }
  543. .price-filter{
  544. position: relative;
  545. }
  546. .price-filter:hover .price-hover{
  547. display: block;
  548. }
  549. .price-filter .price-hover{
  550. background: transparent;
  551. }
  552. .price-filter .price-input{
  553. position: relative;
  554. z-index: 10;
  555. margin: 0 10px !important;
  556. }
  557. .price-filter .price-hover{
  558. display: none;
  559. width: 165px;
  560. height: 25px;
  561. padding: 60px 6px 6px;
  562. margin: 0 10px;
  563. border: 1px solid #999;
  564. position: absolute;
  565. background: #fff;
  566. top: 0;
  567. -webkit-box-shadow: 1px 1px 2px rgba(0,0,0,.2);
  568. -moz-box-shadow: 1px 1px 2px rgba(0,0,0,.2);
  569. box-shadow: 1px 1px 2px rgba(0,0,0,.2);
  570. }
  571. .price-filter .price-hover a:first-child{
  572. position: absolute;
  573. top: 37px;
  574. left: 6px;
  575. width: 36px;
  576. height: 25px;
  577. line-height: 25px;
  578. text-align: center;
  579. color: #5078cb;
  580. display: inline-block;
  581. border: none;
  582. padding: 0;
  583. }
  584. .price-filter .price-hover a:last-child{
  585. position: absolute;
  586. top: 37px;
  587. right: 7px;
  588. width: 38px;
  589. height: 25px;
  590. line-height: 24px;
  591. border: 1px solid #ccc;
  592. text-align: center;
  593. background: #f7f7f7;
  594. color: #333;
  595. display: inline-block;
  596. padding: 0;
  597. }
  598. .price-filter .price-hover a:last-child:hover{
  599. background: #5078cb;
  600. color: #fff;
  601. }
  602. div.ng-table-pager input.page-number {
  603. vertical-align: inherit;
  604. display: inline-block;
  605. width: 40px;
  606. height: 31px;
  607. padding: 6px 6px;
  608. font-size: 14px;
  609. line-height: 1.42857143;
  610. color: #9B9792;
  611. text-align: center;
  612. background-color: #F6F5F4;
  613. background-image: none;
  614. border: 1px solid #ccc;
  615. border-top-left-radius: 4px;
  616. border-bottom-left-radius: 4px;
  617. box-shadow: inset 0 1px 1px rgba(0,0,0,.075);
  618. transition: border-color ease-in-out .15s,box-shadow ease-in-out .15s;
  619. }
  620. div.ng-table-pager a.page-a{
  621. background: #5078cb !important;
  622. color: #fff;
  623. float: right;
  624. }
  625. </style>