CommodityList.vue 13 KB

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