ComponentGoods.vue 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329
  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">数量</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:'/images/all/default.png'"/>
  29. </nuxt-link>
  30. <img v-if="!compGoods.batchCode" :src="compGoods.img || '/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="10" class="text-center" style="line-height: 40px; font-size: 20px;">
  104. <i class="fa fa-smile-o fa-lg"></i> 暂无产品信息
  105. </td>
  106. </tr>
  107. </tbody>
  108. </table>
  109. <div style="float: right; margin-bottom: 15px;">
  110. <page :total="componentGoods.totalElements" :page-size="pageParams.count"
  111. :current="pageParams.page" @childEvent="handleCurrentChange"></page>
  112. </div>
  113. </div>
  114. </template>
  115. <script>
  116. import Buy from '~components/common/buyOrCar/buyComponent.vue'
  117. import Page from '~components/common/page/pageComponent.vue'
  118. export default {
  119. layout: 'mian',
  120. props: ['brandid', 'propertyJSON'],
  121. components: {
  122. Buy,
  123. Page
  124. },
  125. data () {
  126. return {
  127. pageParams: {
  128. page: 1,
  129. count: 10,
  130. filter: {
  131. kindid: this.$route.params.id,
  132. brandid: this.brandid,
  133. propertyJSON: this.propertyJSON
  134. }
  135. }
  136. }
  137. },
  138. computed: {
  139. componentGoods () {
  140. let goodsPage = this.$store.state.product.component.componentGoods.data
  141. this.pageParams.page = goodsPage.number
  142. return goodsPage
  143. }
  144. },
  145. filters: {
  146. currency: function (num) {
  147. if (typeof num === 'number') {
  148. if (num <= 0.000001) {
  149. num = 0.000001
  150. } else {
  151. if (num.toString().indexOf('.') === -1) {
  152. num += '.00'
  153. } else {
  154. let inputStr = num.toString()
  155. let floatNum = inputStr.split('.')[1]
  156. if (floatNum.length > 6) {
  157. num = inputStr.substring(0, inputStr.length - 1)
  158. if (Number(floatNum.charAt(6)) > 4) {
  159. num = Number(num) + 0.000001
  160. }
  161. } else if (floatNum.length === 1) {
  162. num = num + '0'
  163. }
  164. }
  165. }
  166. }
  167. return num
  168. }
  169. },
  170. methods: {
  171. addToCart: function (goods, buyNow) {
  172. return null
  173. },
  174. handlerCurrentNode (data, node) {
  175. console.log(this.pageParams)
  176. this.pageParams.page = 1
  177. this.pageCmpGoods(this.pageParams)
  178. },
  179. async pageCmpGoods (pageParams) {
  180. let params = {}
  181. params.filter = { kindid: pageParams.filter.kindid }
  182. if (pageParams.filter.brandid && pageParams.filter.brandid !== '') {
  183. params.filter.brandid = pageParams.filter.brandid
  184. }
  185. if (pageParams.filter.propertyJSON !== null && Object.getOwnPropertyNames(pageParams.filter.propertyJSON).length > 3) {
  186. params.filter.properties = pageParams.filter.propertyJSON
  187. }
  188. params.page = pageParams.page
  189. params.count = pageParams.count
  190. let { data } = await this.$http.get('/api/product/product/getCompGoodsByKindid', { params })
  191. this.$store.commit('product/component/GET_CMPGOODS_SUCCESS', data)
  192. },
  193. handleCurrentChange (page) {
  194. this.pageParams.page = page
  195. this.pageParams.filter.brandid = this.brandid
  196. this.pageParams.filter.propertyJSON = this.propertyJSON
  197. this.pageParams.filter.kindid = this.$route.params.id
  198. this.pageCmpGoods(this.pageParams)
  199. }
  200. }
  201. }
  202. </script>
  203. <style scoped>
  204. .product-list{
  205. width: 1190px;
  206. margin-bottom: 20px;
  207. }
  208. .product-list thead tr{
  209. border-top: #6493ff 2px solid;
  210. color: #323232;
  211. background: none;
  212. }
  213. /* 物品列表 */
  214. .product-list .brand-code {
  215. font-size: 14px;
  216. text-align: center;
  217. }
  218. .product-list .brand-code .code {
  219. font-weight: 600;
  220. }
  221. .product-list th {
  222. color: rgb(50,50,50);
  223. font-size: 14px;
  224. font-weight: 600;
  225. background-color: #f7f7f7;
  226. text-align: center;
  227. }
  228. .product-list tbody>tr {
  229. border: 1px solid #e8e8e8;
  230. }
  231. .product-list tbody>tr img {
  232. border: 1px solid #e8e8e8;
  233. margin: 10px 0 5px 0;
  234. width: 36px;
  235. height: 36px;
  236. }
  237. .product-list tbody>tr .contact{
  238. font-size: 14px;
  239. color: #5078cb;
  240. width: 90%;
  241. margin: 0 auto;
  242. display: inline-block;
  243. }
  244. .product-list tbody>tr .contact:hover{
  245. color: #d32526;
  246. }
  247. .product-list td {
  248. font-size: 12px;
  249. /*color: #333;*/
  250. text-align: center;
  251. line-height: 20px;
  252. }
  253. .product-list td a{
  254. color: #337ab7;
  255. max-width: 160px;
  256. overflow: hidden;
  257. text-overflow: ellipsis;
  258. display: block;
  259. }
  260. .product-list td a:hover {
  261. color: #23527c;
  262. }
  263. /* 物品列表按钮 */
  264. .product-list .btn-buy-now {
  265. background-color: #5078CB;
  266. color: #fff;
  267. width: 80px;
  268. height: 30px;
  269. font-size: 12px;
  270. border: 1px solid #5078cb;
  271. }
  272. .product-list .btn-add-cart {
  273. margin-top: 10px;
  274. color: #214797;
  275. width: 80px;
  276. height: 30px;
  277. font-size: 12px;
  278. background-color: #fff;
  279. border: 1px solid #e8e8e8;
  280. }
  281. .product-list .btn-buy-now:hover{
  282. background: #214797;
  283. }
  284. .product-list .btn-add-cart:hover{
  285. background-color: #5078CB;
  286. color: #fff;
  287. }
  288. .product-list .text-left{
  289. text-align: left;
  290. }
  291. .product-list .text-left div{
  292. margin-left: 30px;
  293. }
  294. .product-list tbody tr td{
  295. padding: 10px 0;
  296. }
  297. .product-list tbody tr td .can-div-sell {
  298. color: #333;
  299. }
  300. .search-record{
  301. width: 100%;
  302. margin: 0 auto;
  303. height: 40px;
  304. font-size: 16px;
  305. line-height: 40px;
  306. margin-top: 20px;
  307. }
  308. .search-record span.red{
  309. color: #ff0909;
  310. }
  311. .el-pagination .el-pager li.active{
  312. background-color: #5078cb;
  313. border-color: #337ab7;
  314. }
  315. /*<!-- 分页 -->*/
  316. .el-pagination .el-pager li.active {
  317. border-color: #5078cb !important;
  318. background-color: #5078cb !important;
  319. }
  320. </style>