CommodityList.vue 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543
  1. <template>
  2. <div id="goods-list-fragment">
  3. <div class="container" style="width: 1190px; padding: 0;">
  4. <div class="title-area">
  5. <div class="category-title">
  6. <span style="line-height: 34px;">产品分类</span>
  7. </div>
  8. <div class="category-content">
  9. <el-tree :data="kinds" :props="defaultProps" accordion :highlight-current="true" @current-change="handlerCurrentNode"></el-tree>
  10. </div>
  11. </div>
  12. <!-- 产品列表 -->
  13. <div class="goods-area">
  14. <div class="row" style="margin: 0;width: 970px;">
  15. <div class="col-md-3 btn-group btn-group-sm" style="padding: 0;">
  16. <a type="button" class="btn btn-default btn-line btn-info">产品列表</a>
  17. </div>
  18. <div class="col-md-4 col-md-offset-5" style="padding: 0;">
  19. <div class="input-group">
  20. <input type="search" class="form-control" id="search_input" title="code" placeholder="请输入要筛选的原厂型号"
  21. v-model="searchCode" @search="goodsSearch(searchCode)"/>
  22. <span class="input-group-btn">
  23. <button type="button" class="btn" id="search_btn" @click="goodsSearch(searchCode)">&nbsp;筛&nbsp;选&nbsp;</button>
  24. </span>
  25. </div>
  26. </div>
  27. </div>
  28. <!-- 列表展示 -->
  29. <table class="goodslist" style="width: 970px">
  30. <thead>
  31. <tr style="height: 40px;">
  32. <th width="90"></th>
  33. <th width="150">品牌/型号</th>
  34. <th width="100">包装/生产日期</th>
  35. <th width="90">库存</th>
  36. <th width="90">数量</th>
  37. <th width="90">香港交货<span style="font-size: 12px;">($)</span></th>
  38. <th width="100">大陆交货<span style="font-size: 12px;">(¥)</span></th>
  39. <th width="100">交期(天)</th>
  40. <th width="100">操作</th>
  41. </tr>
  42. </thead>
  43. <tbody id="goodslist-content">
  44. <tr v-for="commodity in commodities.content">
  45. <td class="commodity-icon">
  46. <a :href="'/store/' + commodity.storeid + '/' + commodity.batchCode" target="_blank">
  47. <div class="img"><img :src="commodity.img || '/images/store/common/default.png'"/></div>
  48. <img class="sellout-store-commodity" v-if="commodity.status === 602" src="/images/search/sellout-search.png" alt="">
  49. </a>
  50. </td>
  51. <td class="brand-code">
  52. <div class="brand" v-if="commodity.brandNameEn" v-text="commodity.brandNameEn"></div>
  53. <div class="brand" v-if="!commodity.brandNameEn">—</div>
  54. <div class="code" v-if="commodity.code" v-text="commodity.code"></div>
  55. <div class="code" v-if="!commodity.code">—</div>
  56. </td>
  57. <td>
  58. <div class="package" v-if="commodity.packaging" v-text="commodity.packaging"></div>
  59. <div class="package" v-if="!commodity.packaging && !commodity.produceDate">—</div>
  60. <div class="date" v-if='commodity.produceDate' v-text="commodity.produceDate">2016-12-01</div>
  61. </td>
  62. <td style="text-align: left;vertical-align: middle;">
  63. <div class="goods" v-if="commodity.reserve || commodity.status === 602">
  64. 库存:<span v-text="commodity.reserve"></span>
  65. </div>
  66. <div v-if="!commodity.reserve && commodity.status !== 602" style="text-align: center;margin-left: 0;"><span>—</span></div>
  67. <div class="from" v-if="commodity.reserve && commodity.reserve>0 || commodity.status === 602">
  68. 起拍:<span v-if="commodity.minBuyQty" v-text="commodity.minBuyQty">300</span>
  69. </div>
  70. <!--<div class="multiple">
  71. 倍数:<span>1</span>
  72. </div>-->
  73. <div class="can-div-sell" v-if="commodity.reserve || commodity.status === 602" v-text="commodity.breakUp?'可拆卖':'不可拆卖'"></div>
  74. </td>
  75. <td>
  76. <div v-for="price in commodity.prices" v-text="price.start + '+'"></div>
  77. </td>
  78. <td>
  79. <div v-show="commodity.currencyName.indexOf('USD')==-1 || !commodity.prices">
  80. <span>—</span>
  81. </div>
  82. <div v-for="price in commodity.prices">{{price.uSDPrice | currency}}</div>
  83. </td>
  84. <td>
  85. <div v-show="commodity.currencyName.indexOf('RMB')==-1 || !commodity.prices">
  86. <span>—</span>
  87. </div>
  88. <div v-for="price in commodity.prices" >{{price.rMBPrice | currency}}</div>
  89. </td>
  90. <td>
  91. <div v-if="commodity.b2cMinDelivery">交期:
  92. <!--{{commodity.b2cMinDelivery || 0}}-{{commodity.b2cMaxDelivery || 0}}天-->
  93. <span v-if="commodity.b2cMinDelivery != commodity.b2cMaxDelivery" v-text="commodity.b2cMinDelivery + '-' + commodity.b2cMaxDelivery"></span>
  94. <span v-if="commodity.b2cMinDelivery == commodity.b2cMaxDelivery" v-text="commodity.b2cMinDelivery"></span>
  95. </div>
  96. <div v-if="!commodity.b2cMinDelivery"><span>—</span></div>
  97. </td>
  98. <td>
  99. <buy :item="commodity" :disabledFlag="commodity.status === 602"></buy>
  100. </td>
  101. </tr>
  102. <tr v-if="!commodities.content || commodities.content.length == 0">
  103. <td colspan="10">
  104. <div class="text-center">
  105. <div class="col-xs-offset-3 col-xs-2">
  106. <img src="/images/all/empty-cart.png">
  107. </div>
  108. <div class="col-xs-4 txt-info">
  109. <p class="grey f16">暂无器件信息</p>
  110. <i class="iconfont">&#xe610;</i>&nbsp;<a href="/">返回首页</a>
  111. </div>
  112. </div>
  113. </td>
  114. </tr>
  115. </tbody>
  116. </table>
  117. <div style="float: right;">
  118. <page :total="commodities.totalElements" :page-size="pageParams.count"
  119. :current="pageParams.page" @childEvent="handleCurrentChange"></page>
  120. </div>
  121. </div>
  122. </div>
  123. </div>
  124. </template>
  125. <script>
  126. function getAllLeafIds (kind) {
  127. if (!kind) {
  128. return null
  129. }
  130. if (kind.isLeaf === 1) {
  131. return kind.id
  132. } else {
  133. if (!kind.children || kind.children.length === 0) {
  134. return null
  135. }
  136. let ids = []
  137. for (let i = 0; i < kind.children.length; i++) {
  138. ids.push(getAllLeafIds(kind.children[i]))
  139. }
  140. return ids.join(',')
  141. }
  142. }
  143. import Buy from '~components/common/buyOrCar/buyComponent.vue'
  144. import Page from '~components/common/page/pageComponent.vue'
  145. export default {
  146. name: 'commodity-list',
  147. props: ['kinds'],
  148. components: {
  149. Buy,
  150. Page
  151. },
  152. data () {
  153. return {
  154. defaultProps: {
  155. children: 'children',
  156. label: 'nameCn'
  157. },
  158. pageParams: {
  159. page: 1,
  160. count: 6
  161. },
  162. searchCode: '',
  163. parentKindId: 0,
  164. ids: null
  165. }
  166. },
  167. filters: {
  168. currency: function (num) {
  169. if (typeof num === 'number') {
  170. if (num <= 0.000001) {
  171. num = 0.000001
  172. } else {
  173. if (num.toString().indexOf('.') === -1) {
  174. num += '.00'
  175. } else {
  176. let inputStr = num.toString()
  177. let arr = inputStr.split('.')
  178. let floatNum = arr[1]
  179. if (floatNum.length > 6) {
  180. num = inputStr.substring(0, arr[0].length + 7)
  181. if (Number(floatNum.charAt(6)) > 4) {
  182. num = (Number(num) * 1000000 + 1) / 1000000
  183. }
  184. } else if (floatNum.length === 1) {
  185. num = num + '0'
  186. }
  187. }
  188. }
  189. }
  190. return num
  191. }
  192. },
  193. computed: {
  194. commodities () {
  195. return this.$store.state.shop.storeInfo.storeCommodity.data
  196. }
  197. },
  198. methods: {
  199. handlerCurrentNode (data, node) {
  200. this.searchCode = ''
  201. if (this.parentKindId === data.id) {
  202. this.parentKindId = 0
  203. this.ids = null
  204. } else {
  205. if (data.level === 1) {
  206. this.parentKindId = data.id
  207. }
  208. this.ids = getAllLeafIds(data)
  209. }
  210. this.pageParams.page = 1
  211. this.pageCommodity(this.pageParams, this.ids)
  212. },
  213. goodsSearch (keyword) {
  214. this.pageParams.page = 1
  215. this.pageCommodity(this.pageParams, this.ids, keyword)
  216. },
  217. async pageCommodity (pageParams, kindId, keyword) {
  218. // pageCommodity (pageParams, kindId, keyword) {
  219. let params = { storeid: this.$route.params.uuid, origin: 'store', kindUuid: kindId, code: keyword }
  220. params.page = pageParams.page
  221. params.count = pageParams.count
  222. try {
  223. let { data } = await this.$http.get('/api/commodity/commodities', { params })
  224. this.$store.commit('shop/storeInfo/GET_STORE_COMMODITY_SUCCESS', data)
  225. } catch (err) {
  226. this.$store.commit('shop/storeInfo/GET_STORE_COMMODITY_FAILURE', err)
  227. }
  228. // this.$http.get('/api/commodity/commodities', { params }).then(response => {
  229. // this.$store.commit('shop/storeInfo/GET_STORE_COMMODITY_SUCCESS', response)
  230. // }, err => {
  231. // this.$store.commit('shop/storeInfo/GET_STORE_COMMODITY_FAILURE', err)
  232. // })
  233. },
  234. handleCurrentChange (page) {
  235. this.pageParams.page = page
  236. this.pageCommodity(this.pageParams, this.ids, this.searchCode)
  237. }
  238. // goBack () {
  239. // this.$router.back(-1)
  240. // }
  241. }
  242. }
  243. </script>
  244. <style>
  245. /* 产品分类调整*/
  246. .category-content .el-tree{
  247. border: none;
  248. }
  249. .el-tree--highlight-current .el-tree-node.is-current>.el-tree-node__content,.el-tree-node:hover{
  250. background: none !important;
  251. }
  252. .el-tree-node__content:hover{
  253. background: none !important;
  254. }
  255. .el-tree-node__content:hover span{
  256. color: #5078cb;
  257. }
  258. .el-pagination .el-pager li.active{
  259. background-color: #5078cb;
  260. border-color: #337ab7;
  261. }
  262. .el-tree-node__expand-icon{
  263. font-family: "iconfont" !important;
  264. font-size: 14px;
  265. font-style: normal;
  266. -webkit-font-smoothing: antialiased;
  267. width: inherit;
  268. height: inherit;
  269. border: inherit;
  270. font-weight: bold;
  271. text-shadow: -1px 0px 0 #333;
  272. margin-right: 3px !important;
  273. }
  274. .el-tree-node__content{
  275. line-height: 30px;
  276. height: 30px;
  277. }
  278. .el-tree-node__expand-icon.is-leaf{
  279. visibility: hidden;
  280. }
  281. .el-tree-node__expand-icon:before{
  282. content: "\E621";
  283. }
  284. #goods-list-fragment .category-title {
  285. height: 34px;
  286. background-color: #5078cb;
  287. font-size: 14px;
  288. color: rgb(255,255,255);
  289. font-weight: 600;
  290. text-align: center;
  291. }
  292. #goods-list-fragment .category-content li {
  293. line-height: 33px;
  294. font-size: 14px;
  295. color: #333;
  296. float: left;
  297. width: 100%;
  298. padding-left: 10px;
  299. }
  300. #goods-list-fragment .category-content li a {
  301. display: block;
  302. padding-left: 15px;
  303. text-decoration: none;
  304. color: #333;
  305. /* background:url("static/img/store/default/openblackR.png") no-repeat left; */
  306. }
  307. #goods-list-fragment .category-content li a:hover{
  308. color: #5078cb;
  309. cursor: pointer;
  310. }
  311. #goods-list-fragment .category-content ul.list-body {
  312. display: none;
  313. color: #666;
  314. }
  315. #goods-list-fragment .category-content ul.list-body.active {
  316. display: block;
  317. }
  318. #goods-list-fragment .category-content ul.list-body li {
  319. float: none;
  320. background-image: none;
  321. min-height: 26px;
  322. line-height: 26px;
  323. font-size: 12px;
  324. }
  325. #goods-list-fragment .category-content ul.list-body li a {
  326. padding-left: 15px;
  327. display: block;
  328. color: rgb(50,50,50);
  329. background: none;
  330. }
  331. #goods-list-fragment .category-content ul.list-body li a:hover {
  332. color: #5078cb;
  333. cursor: pointer;
  334. }
  335. #goods-list-fragment .category-content ul.list-body li a.cur {
  336. text-decoration: none;
  337. font-size: 14px;
  338. /* background:url("static/img/store/default/openblackR.png") no-repeat left; */
  339. }
  340. #goods-list-fragment .title-area {
  341. margin-bottom: 30px;
  342. width: 200px;
  343. float: left;
  344. }
  345. #goods-list-fragment .category-content{
  346. border: 1px solid #e8e8e8;
  347. }
  348. /* goods-area */
  349. #goods-list-fragment .goods-area {
  350. margin-left: 20px;
  351. float: left;
  352. margin-bottom: 30px;
  353. }
  354. #goods-list-fragment .goods-area .btn-line {
  355. border-radius: 0;
  356. }
  357. #goods-list-fragment .btn-info.btn-line {
  358. background-color: #5078CB;
  359. color: #fff;
  360. font-weight: 600;
  361. }
  362. #goods-list-fragment .btn-line {
  363. height: 34px;
  364. width: 150px;
  365. border: 1px solid #5078cb;
  366. background-color: #fff;
  367. color: rgb(80,120,203);
  368. font-weight: 600;
  369. }
  370. #goods-list-fragment .btn-line:hover {
  371. background-color: #5078CB;
  372. color: #fff;
  373. }
  374. /* 物品列表 */
  375. #goods-list-fragment .goodslist .brand-code {
  376. font-size: 14px;
  377. text-align: center;
  378. }
  379. #goods-list-fragment #search_btn {
  380. background: #5078CB;
  381. color: #FFFFFF;
  382. }
  383. #goods-list-fragment #search_input {
  384. font-size: 14px;
  385. }
  386. #goods-list-fragment .brand-code .code {
  387. font-weight: 600;
  388. }
  389. #goods-list-fragment .goodslist th {
  390. color: rgb(50,50,50);
  391. font-size: 14px;
  392. font-weight: 600;
  393. background-color: #f7f7f7;
  394. text-align: center;
  395. }
  396. #goods-list-fragment .category-content a.selected-node,
  397. #goods-list-fragment .category-content ul.list-body li a.selected-node {
  398. color: #5078cb;
  399. }
  400. #goods-list-fragment .category-content a.selected-parent-node,
  401. #goods-list-fragment .category-content ul.list-body li a.selected-parent-node {
  402. /* background:url("static/img/store/default/openblack.png") no-repeat left; */
  403. }
  404. #goods-list-fragment .goodslist tbody>tr {
  405. border: 1px solid #e8e8e8;
  406. }
  407. #goods-list-fragment .goodslist tbody>tr td.commodity-icon {
  408. position: relative;
  409. }
  410. #goods-list-fragment .goodslist tbody>tr td.commodity-icon .img{
  411. border: 1px solid #e8e8e8;
  412. margin: 10px;
  413. width: 80px;
  414. height: 80px;
  415. overflow: hidden;
  416. line-height: 75px;
  417. }
  418. #goods-list-fragment .goodslist tbody>tr td.commodity-icon .img>img {
  419. width: 80px;
  420. height: 80px;
  421. }
  422. #goods-list-fragment .goodslist tbody>tr td.commodity-icon .sellout-store-commodity {
  423. position: absolute;
  424. right: -16px;
  425. bottom: -9px;
  426. }
  427. #goods-list-fragment .goodslist td {
  428. font-size: 12px;
  429. color: #333;
  430. text-align: center;
  431. line-height: 20px;
  432. }
  433. #goods-list-fragment .goodslist tbody>tr td .can-div-sell {
  434. color: #333;
  435. }
  436. /* 物品列表按钮 */
  437. #goods-list-fragment .btn-buy-now {
  438. background-color: #5078CB;
  439. color: #fff;
  440. width: 80px;
  441. height: 30px;
  442. font-size: 12px;
  443. border: 1px solid #5078cb;
  444. }
  445. #goods-list-fragment .btn-add-cart {
  446. margin-top: 10px;
  447. color: #214797;
  448. width: 80px;
  449. height: 30px;
  450. font-size: 12px;
  451. background-color: #fff;
  452. border: 1px solid #e8e8e8;
  453. }
  454. #goods-list-fragment .btn-buy-now:hover{
  455. background: #214797;
  456. }
  457. #goods-list-fragment .btn-add-cart:hover{
  458. background-color: #5078CB;
  459. color: #fff;
  460. }
  461. .category-content{
  462. min-height: 243px;
  463. }
  464. .no-record{
  465. font-size: 14px;
  466. color: #999;
  467. text-align: center;
  468. line-height: 200px;
  469. }
  470. .no-record i{
  471. margin-right: 5px;
  472. }
  473. .text-center{
  474. text-align: center;
  475. margin-top: 30px;
  476. }
  477. .text-center .col-xs-2 img{
  478. margin: 50px 0 50px 95px;
  479. vertical-align: middle;
  480. }
  481. .text-center .txt-info{
  482. font-size: 14px;
  483. margin-top: 70px;
  484. }
  485. .text-center .col-xs-4 p{
  486. color: #999;
  487. margin-top: 3px;
  488. margin-bottom: 2px;
  489. }
  490. .text-center .txt-info a{
  491. font-size: 14px;
  492. }
  493. .text-center .col-xs-4 i{
  494. color: #5078cb;
  495. font-size: 14px;
  496. }
  497. .goodslist{
  498. margin-bottom: 16px;
  499. }
  500. @font-face {
  501. font-family: 'iconfont'; /* project id 357960 */
  502. src: url('//at.alicdn.com/t/font_27kjyd082ezpk3xr.eot');
  503. src: url('//at.alicdn.com/t/font_27kjyd082ezpk3xr.eot?#iefix') format('embedded-opentype'),
  504. url('//at.alicdn.com/t/font_27kjyd082ezpk3xr.woff') format('woff'),
  505. url('//at.alicdn.com/t/font_27kjyd082ezpk3xr.ttf') format('truetype'),
  506. url('//at.alicdn.com/t/font_27kjyd082ezpk3xr.svg#iconfont') format('svg');
  507. }
  508. <!-- 分页 -->
  509. #goods-list-fragment .el-pagination .el-pager li.active {
  510. border-color: #5078cb !important;
  511. background-color: #5078cb !important;
  512. }
  513. </style>