CommodityList.vue 13 KB

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