ComponentGoods.vue 12 KB

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