CommodityList.vue 14 KB

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