ComponentGoods.vue 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379
  1. <template>
  2. <div class="component-table">
  3. <!-- 筛选结果展示 -->
  4. <div class="search-record">
  5. 筛选后现为您找到以下<span class="red">{{componentGoods.totalElements}}</span>个结果
  6. </div>
  7. <!-- 列表展示 -->
  8. <table class="product-list">
  9. <thead>
  10. <tr style="height: 40px;">
  11. <th width="80"></th>
  12. <th width="160">品牌/型号</th>
  13. <th width="100">包装/生产日期</th>
  14. <th width="110">库存</th>
  15. <th width="90">梯度/pcs</th>
  16. <th width="90">香港交货<span style="font-size: 12px;">($)</span></th>
  17. <th width="100">大陆交货<span style="font-size: 12px;">(¥)</span></th>
  18. <th width="100">交期(天)</th>
  19. <th width="100">操作</th>
  20. </tr>
  21. </thead>
  22. <tbody id="productList-content">
  23. <!--| orderBy : dir + orderType ng-class="{'tr-even' : !compGoods.isOdd}"-->
  24. <tr v-for="compGoods in componentGoods.content">
  25. <td style="position: relative">
  26. <img class="sellout-flag" v-if="compGoods.status === 602" src="/images/search/sellout-search.png" alt="">
  27. <!--store/{{compGoods.storeId}}#/batchInfo/{{compGoods.batchCode}}-->
  28. <nuxt-link v-if="compGoods.batchCode" :to="`/store/productDetail/${compGoods.batchCode}`" target="_blank">
  29. <img :src="compGoods.img?compGoods.img:compGoods.brand&&compGoods.brand.logoUrl?compGoods.brand.logoUrl:'/images/all/default.png'"/>
  30. </nuxt-link>
  31. <img v-if="!compGoods.batchCode" :src="compGoods.img?compGoods.img:compGoods.brand&&compGoods.brand.logoUrl?compGoods.brand.logoUrl:'/images/all/default.png'"/>
  32. <!--store/{{compGoods.storeId}}#/home-->
  33. <nuxt-link :to="'/store/' + compGoods.storeId" class="contact" :title="compGoods.storeName" target="_blank">{{compGoods.storeName}}</nuxt-link>
  34. </td>
  35. <td class="brand-code">
  36. <div class="brand" v-if="compGoods.brand.nameEn"><nuxt-link :to="`/product/brand/${compGoods.brand.uuid}/`" title="compGoods.brand.nameEn">{{compGoods.brand.nameEn}}</nuxt-link></div>
  37. <div class="brand" v-if="!compGoods.brand.nameEn">—</div>
  38. <div class="code" v-if="compGoods.code"><nuxt-link :to="`/product/component/${compGoods.uuid}/`" :title="compGoods.code">{{compGoods.code}}</nuxt-link></div>
  39. <div class="code" v-if="!compGoods.code">—</div>
  40. </td>
  41. <td>
  42. <div class="package" v-if="compGoods.packaging">{{compGoods.packaging}}</div>
  43. <div v-if="!compGoods.produceDate && !compGoods.packaging">—</div>
  44. <div class="date" v-if="compGoods.produceDate">{{compGoods.produceDate}}</div>
  45. </td>
  46. <td class="text-left">
  47. <div class="goods" v-if="compGoods.reserve">
  48. 库存:<span>{{compGoods.reserve}}</span>
  49. </div>
  50. <div v-if="!compGoods.reserve" style="text-align: center;margin-left: 0;"><span>—</span></div>
  51. <div class="from" v-if="compGoods.reserve && compGoods.reserve > 0">
  52. 起拍:<span v-if="compGoods.minBuyQty">{{compGoods.minBuyQty}}</span>
  53. </div>
  54. <!--<div class="multiple" v-if="compGoods.reserve > 0">
  55. 倍数:<span>{{compGoods.minPackQty}}</span>
  56. </div>-->
  57. <div class="can-div-sell" v-if="compGoods.reserve && compGoods.breakUp" v-text="compGoods.breakUp?'可拆卖':'不可拆卖'"></div>
  58. </td>
  59. <td>
  60. <div v-if="!compGoods.prices">
  61. <span>—</span>
  62. </div>
  63. <div v-for="price in compGoods.prices">
  64. <!--| number-->
  65. <span>{{price.start}}</span> +
  66. </div>
  67. </td>
  68. <td>
  69. <div v-if="(compGoods.currencyName && compGoods.currencyName.indexOf('USD')==-1) || !compGoods.prices">
  70. <span>—</span>
  71. </div>
  72. <div v-for="price in compGoods.prices">
  73. <!--| formateNumber : 6-->
  74. <span>{{price.uSDPrice | currency}}</span>
  75. </div>
  76. </td>
  77. <td>
  78. <div v-if="(compGoods.currencyName && compGoods.currencyName.indexOf('RMB')==-1) || !compGoods.prices">
  79. <span>—</span>
  80. </div>
  81. <div v-for="price in compGoods.prices">
  82. <!--formateNumber : 6-->
  83. <span>{{price.rMBPrice | currency}}</span>
  84. </div>
  85. </td>
  86. <td>
  87. <div v-if="!compGoods.b2cMinDelivery">
  88. <span>—</span>
  89. </div>
  90. <div v-if="compGoods.b2cMinDelivery">交期:<span v-if="compGoods.b2cMinDelivery != compGoods.b2cMaxDelivery">{{compGoods.b2cMinDelivery + '-' + compGoods.b2cMaxDelivery}}</span>
  91. <span v-if="compGoods.b2cMinDelivery == compGoods.b2cMaxDelivery">{{compGoods.b2cMinDelivery}}</span>
  92. </div>
  93. </td>
  94. <td>
  95. <div v-show="!compGoods.reserve">
  96. <span>—</span>
  97. </div>
  98. <div v-if="compGoods.reserve > 0">
  99. <buy :item="compGoods" :disabledFlag="compGoods.status === 602"></buy>
  100. </div>
  101. </td>
  102. </tr>
  103. <tr v-if="componentGoods.totalElements == 0">
  104. <td colspan="12">
  105. <div class="empty">
  106. <p class="empty-img">
  107. <img src="/images/brandList/empty-cart.png">
  108. </p>
  109. <div class="empty-info">
  110. <p class="grey"> 暂无产品信息 </p>
  111. <a href="javascript:history.go(-1)"><i class="fa fa-mail-reply fa-xs"></i>返回上一页</a>
  112. </div>
  113. </div>
  114. </td>
  115. </tr>
  116. </tbody>
  117. </table>
  118. <div style="float: right; margin-bottom: 15px;">
  119. <page :total="componentGoods.totalElements" :page-size="pageParams.count"
  120. :current="pageParams.page" @childEvent="handleCurrentChange"></page>
  121. </div>
  122. </div>
  123. </template>
  124. <script>
  125. import Buy from '~components/common/buyOrCar/buyComponent.vue'
  126. import Page from '~components/common/page/pageComponent.vue'
  127. export default {
  128. layout: 'mian',
  129. props: ['brandid', 'propertyJSON'],
  130. components: {
  131. Buy,
  132. Page
  133. },
  134. data () {
  135. return {
  136. pageParams: {
  137. page: 1,
  138. count: 10,
  139. filter: {
  140. kindid: this.$route.params.id,
  141. brandid: this.brandid,
  142. propertyJSON: this.propertyJSON
  143. }
  144. }
  145. }
  146. },
  147. computed: {
  148. componentGoods () {
  149. let goodsPage = this.$store.state.product.component.componentGoods.data
  150. this.pageParams.page = goodsPage.number
  151. return goodsPage
  152. }
  153. },
  154. filters: {
  155. currency: function (num) {
  156. if (typeof num === 'number') {
  157. if (num <= 0.000001) {
  158. num = 0.000001
  159. } else {
  160. if (num.toString().indexOf('.') === -1) {
  161. num += '.00'
  162. } else {
  163. let inputStr = num.toString()
  164. let arr = inputStr.split('.')
  165. let floatNum = arr[1]
  166. if (floatNum.length > 6) {
  167. num = inputStr.substring(0, arr[0].length + 7)
  168. if (Number(floatNum.charAt(6)) > 4) {
  169. num = (Number(num) * 1000000 + 1) / 1000000
  170. }
  171. } else if (floatNum.length === 1) {
  172. num = num + '0'
  173. }
  174. }
  175. }
  176. }
  177. return num
  178. }
  179. },
  180. methods: {
  181. addToCart: function (goods, buyNow) {
  182. return null
  183. },
  184. handlerCurrentNode (data, node) {
  185. console.log(this.pageParams)
  186. this.pageParams.page = 1
  187. this.pageCmpGoods(this.pageParams)
  188. },
  189. async pageCmpGoods (pageParams) {
  190. let params = {}
  191. params.filter = { kindid: pageParams.filter.kindid }
  192. if (pageParams.filter.brandid && pageParams.filter.brandid !== '') {
  193. params.filter.brandid = pageParams.filter.brandid
  194. }
  195. if (pageParams.filter.propertyJSON !== null && Object.getOwnPropertyNames(pageParams.filter.propertyJSON).length > 3) {
  196. params.filter.properties = pageParams.filter.propertyJSON
  197. }
  198. params.page = pageParams.page
  199. params.count = pageParams.count
  200. let { data } = await this.$http.get('/api/product/product/getCompGoodsByKindid', { params })
  201. this.$store.commit('product/component/GET_CMPGOODS_SUCCESS', data)
  202. },
  203. handleCurrentChange (page) {
  204. this.pageParams.page = page
  205. this.pageParams.filter.brandid = this.brandid
  206. this.pageParams.filter.propertyJSON = this.propertyJSON
  207. this.pageParams.filter.kindid = this.$route.params.id
  208. this.pageCmpGoods(this.pageParams)
  209. }
  210. }
  211. }
  212. </script>
  213. <style scoped>
  214. /**/
  215. .product-list tbody>tr .empty{
  216. overflow: hidden;
  217. margin: 0!important;
  218. height:130px;
  219. display:inline-flex;
  220. align-items: center;
  221. }
  222. .product-list tbody>tr .empty .empty-img{
  223. margin:0;
  224. border:0;
  225. min-width:143px;
  226. min-height:72px;
  227. }
  228. .product-list tbody>tr .empty .empty-img img {
  229. margin: 0;
  230. border: 0;
  231. min-width: 143px;
  232. min-height: 72px;
  233. }
  234. .product-list tbody>tr .empty-info{
  235. line-height: 14px;
  236. width: 143px;
  237. }
  238. .product-list tbody>tr .grey{
  239. color: #999;
  240. font-size: 14px;
  241. }
  242. .product-list tbody>tr .empty .empty-info>a{
  243. font-size: 14px;
  244. color: #5078cb;
  245. }
  246. .product-list tbody>tr .empty .empty-info i{
  247. margin-right:5px;
  248. }
  249. .product-list{
  250. width: 1190px;
  251. margin-bottom: 20px;
  252. }
  253. .product-list thead tr{
  254. border-top: #6493ff 2px solid;
  255. color: #323232;
  256. background: none;
  257. }
  258. /* 物品列表 */
  259. .product-list .brand-code {
  260. font-size: 14px;
  261. text-align: center;
  262. }
  263. .product-list .brand-code .code {
  264. font-weight: 600;
  265. }
  266. .product-list th {
  267. color: rgb(50,50,50);
  268. font-size: 14px;
  269. font-weight: 600;
  270. background-color: #f7f7f7;
  271. text-align: center;
  272. }
  273. .product-list tbody>tr {
  274. border: 1px solid #e8e8e8;
  275. }
  276. .product-list tbody>tr img {
  277. border: 1px solid #e8e8e8;
  278. margin: 10px 0 5px 0;
  279. max-width: 36px;
  280. max-height: 36px;
  281. }
  282. .product-list tbody>tr .contact{
  283. font-size: 14px;
  284. color: #5078cb;
  285. width: 90%;
  286. margin: 0 auto;
  287. display: inline-block;
  288. }
  289. .product-list tbody>tr .contact:hover{
  290. color: #d32526;
  291. }
  292. .product-list td {
  293. font-size: 12px;
  294. /*color: #333;*/
  295. text-align: center;
  296. line-height: 20px;
  297. }
  298. .product-list td a{
  299. color: #337ab7;
  300. max-width: 160px;
  301. overflow: hidden;
  302. text-overflow: ellipsis;
  303. display: block;
  304. }
  305. .product-list td a:hover {
  306. color: #23527c;
  307. }
  308. /* 物品列表按钮 */
  309. .product-list .btn-buy-now {
  310. background-color: #5078CB;
  311. color: #fff;
  312. width: 80px;
  313. height: 30px;
  314. font-size: 12px;
  315. border: 1px solid #5078cb;
  316. }
  317. .product-list .btn-add-cart {
  318. margin-top: 10px;
  319. color: #214797;
  320. width: 80px;
  321. height: 30px;
  322. font-size: 12px;
  323. background-color: #fff;
  324. border: 1px solid #e8e8e8;
  325. }
  326. .product-list .btn-buy-now:hover{
  327. background: #214797;
  328. }
  329. .product-list .btn-add-cart:hover{
  330. background-color: #5078CB;
  331. color: #fff;
  332. }
  333. .product-list .text-left{
  334. text-align: left;
  335. }
  336. .product-list .text-left div{
  337. margin-left: 30px;
  338. }
  339. .product-list tbody tr td{
  340. padding: 10px 0;
  341. }
  342. .product-list tbody tr td .can-div-sell {
  343. color: #333;
  344. }
  345. .product-list tbody tr td .sellout-flag {
  346. position: absolute;
  347. right: 0;
  348. bottom: 0;
  349. border: none;
  350. }
  351. .search-record{
  352. width: 100%;
  353. margin: 0 auto;
  354. height: 40px;
  355. font-size: 16px;
  356. line-height: 40px;
  357. margin-top: 20px;
  358. }
  359. .search-record span.red{
  360. color: #ff0909;
  361. }
  362. .el-pagination .el-pager li.active{
  363. background-color: #5078cb;
  364. border-color: #337ab7;
  365. }
  366. /*<!-- 分页 -->*/
  367. .el-pagination .el-pager li.active {
  368. border-color: #5078cb !important;
  369. background-color: #5078cb !important;
  370. }
  371. </style>