GoodList.vue 18 KB

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