CommodityList.vue 13 KB

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