CommodityList.vue 15 KB

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