ComponentGoods.vue 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372
  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>
  26. <!--store/{{compGoods.storeId}}#/batchInfo/{{compGoods.batchCode}}-->
  27. <nuxt-link v-if="compGoods.batchCode" :to="`/store/${compGoods.storeId}/${compGoods.batchCode}`" target="_blank">
  28. <img :src="compGoods.img?compGoods.img:compGoods.brand&&compGoods.brand.logoUrl?compGoods.brand.logoUrl:'/images/all/default.png'"/>
  29. </nuxt-link>
  30. <img v-if="!compGoods.batchCode" :src="compGoods.img?compGoods.img:compGoods.brand&&compGoods.brand.logoUrl?compGoods.brand.logoUrl:'/images/all/default.png'"/>
  31. <!--store/{{compGoods.storeId}}#/home-->
  32. <nuxt-link :to="'/store/' + compGoods.storeId" class="contact" :title="compGoods.storeName" target="_blank">{{compGoods.storeName}}</nuxt-link>
  33. </td>
  34. <td class="brand-code">
  35. <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>
  36. <div class="brand" v-if="!compGoods.brand.nameEn">—</div>
  37. <div class="code" v-if="compGoods.code"><nuxt-link :to="`/product/component/${compGoods.uuid}/`" :title="compGoods.code">{{compGoods.code}}</nuxt-link></div>
  38. <div class="code" v-if="!compGoods.code">—</div>
  39. </td>
  40. <td>
  41. <div class="package" v-if="compGoods.packaging">{{compGoods.packaging}}</div>
  42. <div v-if="!compGoods.produceDate && !compGoods.packaging">—</div>
  43. <div class="date" v-if="compGoods.produceDate">{{compGoods.produceDate}}</div>
  44. </td>
  45. <td class="text-left">
  46. <div class="goods" v-if="compGoods.reserve">
  47. 库存:<span>{{compGoods.reserve}}</span>
  48. </div>
  49. <div v-if="!compGoods.reserve" style="text-align: center;margin-left: 0;"><span>—</span></div>
  50. <div class="from" v-if="compGoods.reserve && compGoods.reserve > 0">
  51. 起拍:<span v-if="compGoods.minBuyQty">{{compGoods.minBuyQty}}</span>
  52. </div>
  53. <!--<div class="multiple" v-if="compGoods.reserve > 0">
  54. 倍数:<span>{{compGoods.minPackQty}}</span>
  55. </div>-->
  56. <div class="can-div-sell" v-if="compGoods.reserve" v-text="compGoods.breakUp?'可拆卖':'不可拆卖'"></div>
  57. </td>
  58. <td>
  59. <div v-if="!compGoods.prices">
  60. <span>—</span>
  61. </div>
  62. <div v-for="price in compGoods.prices">
  63. <!--| number-->
  64. <span>{{price.start}}</span> +
  65. </div>
  66. </td>
  67. <td>
  68. <div v-if="(compGoods.currencyName && compGoods.currencyName.indexOf('USD')==-1) || !compGoods.prices">
  69. <span>—</span>
  70. </div>
  71. <div v-for="price in compGoods.prices">
  72. <!--| formateNumber : 6-->
  73. <span>{{price.uSDPrice | currency}}</span>
  74. </div>
  75. </td>
  76. <td>
  77. <div v-if="(compGoods.currencyName && compGoods.currencyName.indexOf('RMB')==-1) || !compGoods.prices">
  78. <span>—</span>
  79. </div>
  80. <div v-for="price in compGoods.prices">
  81. <!--formateNumber : 6-->
  82. <span>{{price.rMBPrice | currency}}</span>
  83. </div>
  84. </td>
  85. <td>
  86. <div v-if="!compGoods.b2cMinDelivery">
  87. <span>—</span>
  88. </div>
  89. <div v-if="compGoods.b2cMinDelivery">交期:<span v-if="compGoods.b2cMinDelivery != compGoods.b2cMaxDelivery">{{compGoods.b2cMinDelivery + '-' + compGoods.b2cMaxDelivery}}</span>
  90. <span v-if="compGoods.b2cMinDelivery == compGoods.b2cMaxDelivery">{{compGoods.b2cMinDelivery}}</span>
  91. </div>
  92. </td>
  93. <td>
  94. <div v-show="!compGoods.reserve">
  95. <span>—</span>
  96. </div>
  97. <div v-if="compGoods.reserve > 0">
  98. <buy :item="compGoods"></buy>
  99. </div>
  100. </td>
  101. </tr>
  102. <tr v-if="componentGoods.totalElements == 0">
  103. <td colspan="12">
  104. <div class="empty">
  105. <p class="empty-img">
  106. <img src="/images/brandList/empty-cart.png">
  107. </p>
  108. <div class="empty-info">
  109. <p class="grey"> 暂无产品信息 </p>
  110. <a href="javascript:history.go(-1)"><i class="fa fa-mail-reply fa-xs"></i>返回上一页</a>
  111. </div>
  112. </div>
  113. </td>
  114. </tr>
  115. </tbody>
  116. </table>
  117. <div style="float: right; margin-bottom: 15px;">
  118. <page :total="componentGoods.totalElements" :page-size="pageParams.count"
  119. :current="pageParams.page" @childEvent="handleCurrentChange"></page>
  120. </div>
  121. </div>
  122. </template>
  123. <script>
  124. import Buy from '~components/common/buyOrCar/buyComponent.vue'
  125. import Page from '~components/common/page/pageComponent.vue'
  126. export default {
  127. layout: 'mian',
  128. props: ['brandid', 'propertyJSON'],
  129. components: {
  130. Buy,
  131. Page
  132. },
  133. data () {
  134. return {
  135. pageParams: {
  136. page: 1,
  137. count: 10,
  138. filter: {
  139. kindid: this.$route.params.id,
  140. brandid: this.brandid,
  141. propertyJSON: this.propertyJSON
  142. }
  143. }
  144. }
  145. },
  146. computed: {
  147. componentGoods () {
  148. let goodsPage = this.$store.state.product.component.componentGoods.data
  149. this.pageParams.page = goodsPage.number
  150. return goodsPage
  151. }
  152. },
  153. filters: {
  154. currency: function (num) {
  155. if (typeof num === 'number') {
  156. if (num <= 0.000001) {
  157. num = 0.000001
  158. } else {
  159. if (num.toString().indexOf('.') === -1) {
  160. num += '.00'
  161. } else {
  162. let inputStr = num.toString()
  163. let arr = inputStr.split('.')
  164. let floatNum = arr[1]
  165. if (floatNum.length > 6) {
  166. num = inputStr.substring(0, arr[0].length + 7)
  167. if (Number(floatNum.charAt(6)) > 4) {
  168. num = (Number(num) * 1000000 + 1) / 1000000
  169. }
  170. } else if (floatNum.length === 1) {
  171. num = num + '0'
  172. }
  173. }
  174. }
  175. }
  176. return num
  177. }
  178. },
  179. methods: {
  180. addToCart: function (goods, buyNow) {
  181. return null
  182. },
  183. handlerCurrentNode (data, node) {
  184. console.log(this.pageParams)
  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. .search-record{
  345. width: 100%;
  346. margin: 0 auto;
  347. height: 40px;
  348. font-size: 16px;
  349. line-height: 40px;
  350. margin-top: 20px;
  351. }
  352. .search-record span.red{
  353. color: #ff0909;
  354. }
  355. .el-pagination .el-pager li.active{
  356. background-color: #5078cb;
  357. border-color: #337ab7;
  358. }
  359. /*<!-- 分页 -->*/
  360. .el-pagination .el-pager li.active {
  361. border-color: #5078cb !important;
  362. background-color: #5078cb !important;
  363. }
  364. </style>