ComponentGoods.vue 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378
  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. this.pageParams.page = 1
  186. this.pageCmpGoods(this.pageParams)
  187. },
  188. async pageCmpGoods (pageParams) {
  189. let params = {}
  190. params.filter = { kindid: pageParams.filter.kindid }
  191. if (pageParams.filter.brandid && pageParams.filter.brandid !== '') {
  192. params.filter.brandid = pageParams.filter.brandid
  193. }
  194. if (pageParams.filter.propertyJSON !== null && Object.getOwnPropertyNames(pageParams.filter.propertyJSON).length > 3) {
  195. params.filter.properties = pageParams.filter.propertyJSON
  196. }
  197. params.page = pageParams.page
  198. params.count = pageParams.count
  199. let { data } = await this.$http.get('/api/product/product/getCompGoodsByKindid', { params })
  200. this.$store.commit('product/component/GET_CMPGOODS_SUCCESS', data)
  201. },
  202. handleCurrentChange (page) {
  203. this.pageParams.page = page
  204. this.pageParams.filter.brandid = this.brandid
  205. this.pageParams.filter.propertyJSON = this.propertyJSON
  206. this.pageParams.filter.kindid = this.$route.params.id
  207. this.pageCmpGoods(this.pageParams)
  208. }
  209. }
  210. }
  211. </script>
  212. <style scoped>
  213. /**/
  214. .product-list tbody>tr .empty{
  215. overflow: hidden;
  216. margin: 0!important;
  217. height:130px;
  218. display:inline-flex;
  219. align-items: center;
  220. }
  221. .product-list tbody>tr .empty .empty-img{
  222. margin:0;
  223. border:0;
  224. min-width:143px;
  225. min-height:72px;
  226. }
  227. .product-list tbody>tr .empty .empty-img img {
  228. margin: 0;
  229. border: 0;
  230. min-width: 143px;
  231. min-height: 72px;
  232. }
  233. .product-list tbody>tr .empty-info{
  234. line-height: 14px;
  235. width: 143px;
  236. }
  237. .product-list tbody>tr .grey{
  238. color: #999;
  239. font-size: 14px;
  240. }
  241. .product-list tbody>tr .empty .empty-info>a{
  242. font-size: 14px;
  243. color: #5078cb;
  244. }
  245. .product-list tbody>tr .empty .empty-info i{
  246. margin-right:5px;
  247. }
  248. .product-list{
  249. width: 1190px;
  250. margin-bottom: 20px;
  251. }
  252. .product-list thead tr{
  253. border-top: #6493ff 2px solid;
  254. color: #323232;
  255. background: none;
  256. }
  257. /* 物品列表 */
  258. .product-list .brand-code {
  259. font-size: 14px;
  260. text-align: center;
  261. }
  262. .product-list .brand-code .code {
  263. font-weight: 600;
  264. }
  265. .product-list th {
  266. color: rgb(50,50,50);
  267. font-size: 14px;
  268. font-weight: 600;
  269. background-color: #f7f7f7;
  270. text-align: center;
  271. }
  272. .product-list tbody>tr {
  273. border: 1px solid #e8e8e8;
  274. }
  275. .product-list tbody>tr img {
  276. border: 1px solid #e8e8e8;
  277. margin: 10px 0 5px 0;
  278. max-width: 36px;
  279. max-height: 36px;
  280. }
  281. .product-list tbody>tr .contact{
  282. font-size: 14px;
  283. color: #5078cb;
  284. width: 90%;
  285. margin: 0 auto;
  286. display: inline-block;
  287. }
  288. .product-list tbody>tr .contact:hover{
  289. color: #d32526;
  290. }
  291. .product-list td {
  292. font-size: 12px;
  293. /*color: #333;*/
  294. text-align: center;
  295. line-height: 20px;
  296. }
  297. .product-list td a{
  298. color: #337ab7;
  299. max-width: 160px;
  300. overflow: hidden;
  301. text-overflow: ellipsis;
  302. display: block;
  303. }
  304. .product-list td a:hover {
  305. color: #23527c;
  306. }
  307. /* 物品列表按钮 */
  308. .product-list .btn-buy-now {
  309. background-color: #5078CB;
  310. color: #fff;
  311. width: 80px;
  312. height: 30px;
  313. font-size: 12px;
  314. border: 1px solid #5078cb;
  315. }
  316. .product-list .btn-add-cart {
  317. margin-top: 10px;
  318. color: #214797;
  319. width: 80px;
  320. height: 30px;
  321. font-size: 12px;
  322. background-color: #fff;
  323. border: 1px solid #e8e8e8;
  324. }
  325. .product-list .btn-buy-now:hover{
  326. background: #214797;
  327. }
  328. .product-list .btn-add-cart:hover{
  329. background-color: #5078CB;
  330. color: #fff;
  331. }
  332. .product-list .text-left{
  333. text-align: left;
  334. }
  335. .product-list .text-left div{
  336. margin-left: 30px;
  337. }
  338. .product-list tbody tr td{
  339. padding: 10px 0;
  340. }
  341. .product-list tbody tr td .can-div-sell {
  342. color: #333;
  343. }
  344. .product-list tbody tr td .sellout-flag {
  345. position: absolute;
  346. right: 0;
  347. bottom: 0;
  348. border: none;
  349. }
  350. .search-record{
  351. width: 100%;
  352. margin: 0 auto;
  353. height: 40px;
  354. font-size: 16px;
  355. line-height: 40px;
  356. margin-top: 20px;
  357. }
  358. .search-record span.red{
  359. color: #ff0909;
  360. }
  361. .el-pagination .el-pager li.active{
  362. background-color: #5078cb;
  363. border-color: #337ab7;
  364. }
  365. /*<!-- 分页 -->*/
  366. .el-pagination .el-pager li.active {
  367. border-color: #5078cb !important;
  368. background-color: #5078cb !important;
  369. }
  370. </style>