CommodityList.vue 14 KB

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