ComponentDetail.vue 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369
  1. <template>
  2. <div class="component-detail">
  3. <div class="base-detail">
  4. <div class="base-detail-item" v-if="component.kind.nameCn">
  5. <span>类目:</span>
  6. <span>{{component.kind.nameCn}}</span>
  7. </div>
  8. <div class="base-detail-item" v-if="component.brand.nameCn">
  9. <span>品牌:</span>
  10. <span>{{component.brand.nameCn}}</span>
  11. </div>
  12. <div class="base-detail-item attach" @click="goAttach(component.attach)">
  13. <span>规格书:</span>
  14. <i class="icon-chakan iconfont"></i>
  15. </div>
  16. <div class="base-detail-item" v-if="component.description">
  17. <span class="description">产品描述:{{component.description}}</span>
  18. </div>
  19. </div>
  20. <div class="product-switch-item">
  21. <span :class="activeType=='param'?'mobile-switch-btn active':'mobile-switch-btn'" @click="activeType='param'">参数</span>
  22. <span :class="activeType=='store'?'mobile-switch-btn active':'mobile-switch-btn'" @click="activeType='store'">商家</span>
  23. </div>
  24. <div class="product-params" v-if="activeType == 'param'">
  25. <div class="param-item" v-if="prop.value && prop.value!=''" v-for="prop in component.properties">
  26. <span class="prop-name">{{prop.property.labelCn}}</span>
  27. <span class="prop-value">{{prop.value}}</span>
  28. </div>
  29. </div>
  30. <div class="product-store" v-if="activeType == 'store'">
  31. <table v-if="storeList.content&&storeList.content.length > 0">
  32. <thead>
  33. <tr>
  34. <th>商家</th>
  35. <th>包装</th>
  36. <th>数量</th>
  37. <th>单价</th>
  38. <th>交期(天)</th>
  39. </tr>
  40. </thead>
  41. <tbody>
  42. <tr v-for="store in storeList.content">
  43. <td>{{store.storeName || '-'}}</td>
  44. <td>
  45. <div v-if="!store.packaging && !store.breakUp && !store.produceDate">-</div>
  46. <div>{{store.packaging}}</div>
  47. <div>{{store.breakUp?'可拆卖':'不可拆卖'}}</div>
  48. <div>{{store.produceDate}}</div>
  49. </td>
  50. <td>
  51. <div v-if="!store.prices || store.prices.length == 0">-</div>
  52. <div v-for="price in store.prices">{{price.start}}+</div>
  53. </td>
  54. <td>
  55. <div v-if="!store.prices || store.prices.length == 0">
  56. <span>—</span>
  57. </div>
  58. <div v-for="price in store.prices">
  59. <span v-if="store.currencyName.indexOf('RMB')!==-1">¥{{price.rMBPrice | currency}}</span>
  60. <span v-if="store.currencyName.indexOf('USD')!==-1">${{price.uSDPrice | currency}}</span>
  61. </div>
  62. </td>
  63. <td>
  64. <div v-if="store.b2cMinDelivery">
  65. <span>交期:</span>
  66. <span>{{store.b2cMinDelivery}}</span>
  67. <span v-if="store.b2cMaxDelivery && store.b2cMaxDelivery !== store.b2cMinDelivery">-</span>
  68. <span v-if="store.b2cMaxDelivery && store.b2cMaxDelivery !== store.b2cMinDelivery">{{store.b2cMaxDelivery}}</span>
  69. </div>
  70. <div v-if="store.minBuyQty">{{store.minBuyQty}}起订</div>
  71. <div v-if="!store.b2cMinDelivery">
  72. <span>—</span>
  73. </div>
  74. </td>
  75. </tr>
  76. </tbody>
  77. </table>
  78. <div v-if="!storeList.content || storeList.content.length == 0" class="no-store">
  79. <img src="/images/mobile/@2x/car@2x.png" alt="">
  80. <div>抱歉,暂无商家出售此型号!</div>
  81. <div>您可前往<a href="http://www.usoftmall.com" class="link-url">www.usoftmall.com</a>网页版进行“发布求购”或“产品上架”操作!</div>
  82. </div>
  83. </div>
  84. </div>
  85. </template>
  86. <script>
  87. export default {
  88. data () {
  89. return {
  90. activeType: 'param',
  91. storeIds: [],
  92. UmallExist: false,
  93. storeExist: false,
  94. params: {
  95. count: 10,
  96. page: 1,
  97. sorting: {'minPriceRMB': 'ASC'},
  98. filter: {
  99. uuid: this.$route.params.uuid,
  100. ignoreUMall: false,
  101. ignoreStore: false,
  102. storeIds: ''
  103. }
  104. }
  105. }
  106. },
  107. computed: {
  108. component () {
  109. return this.$store.state.componentDetail.detail.data
  110. },
  111. storeList () {
  112. let storeList = this.$store.state.componentInformation.information.data
  113. let _self = this
  114. if (storeList.content) {
  115. storeList.content.forEach(function (item) {
  116. _self.storeIds.push(item.storeid)
  117. })
  118. }
  119. if (this.storeIds.length > 0) {
  120. if (this.storeIds.indexOf(this.storeId) === -1) {
  121. this.storeExist = true
  122. } else {
  123. this.storeIds.splice(this.storeIds.indexOf(this.storeId), 1)
  124. if (this.storeIds.length > 0) {
  125. this.storeExist = true
  126. }
  127. this.UmallExist = true
  128. }
  129. }
  130. return storeList
  131. }
  132. },
  133. filters: {
  134. currency: function (num) {
  135. if (typeof num === 'number') {
  136. if (num <= 0.000001) {
  137. num = 0.000001
  138. } else {
  139. if (num.toString().indexOf('.') === -1) {
  140. num += '.00'
  141. } else {
  142. let inputStr = num.toString()
  143. let arr = inputStr.split('.')
  144. let floatNum = arr[1]
  145. if (floatNum.length > 6) {
  146. num = inputStr.substring(0, arr[0].length + 7)
  147. if (Number(floatNum.charAt(6)) > 4) {
  148. num = (Number(num) * 1000000 + 1) / 1000000
  149. }
  150. } else if (floatNum.length === 1) {
  151. num = num + '0'
  152. }
  153. }
  154. }
  155. }
  156. return num
  157. }
  158. },
  159. methods: {
  160. goAttach: function (url) {
  161. if (url !== '1') {
  162. window.location.href = url
  163. }
  164. }
  165. }
  166. }
  167. </script>
  168. <style lang="scss" scoped>
  169. .component-detail {
  170. font-size: .28rem;
  171. margin-bottom: 1.2rem;
  172. .base-detail {
  173. margin: 0 .66rem .34rem .40rem;
  174. padding-top: .34rem;
  175. .base-detail-item {
  176. margin-bottom: .3rem;
  177. position: relative;
  178. &.attach {
  179. display: inline-block;
  180. }
  181. i {
  182. font-size: .55rem;
  183. color: #6fcafe;
  184. position: absolute;
  185. top: -.13rem;
  186. }
  187. &:last-child {
  188. margin-bottom: 0;
  189. }
  190. .description {
  191. line-height: .4rem;
  192. max-height: 1.2rem;
  193. word-break: break-all;
  194. overflow : hidden;
  195. text-overflow: ellipsis;
  196. display: -webkit-box;
  197. -webkit-line-clamp: 3;
  198. -webkit-box-orient: vertical;
  199. }
  200. }
  201. }
  202. .product-switch-item {
  203. text-align: center;
  204. .mobile-switch-btn {
  205. background: #e75610;
  206. color: #fff;
  207. display: inline-block;
  208. height: .68rem;
  209. font-size: .28rem;
  210. padding: .19rem .53rem;
  211. position: relative;
  212. &:first-child {
  213. background: #fff;
  214. color: #e75610;
  215. border: .01rem solid #e75610;
  216. border-left: none;
  217. padding-left: .30rem;
  218. }
  219. &:first-child.active {
  220. background: #e75610;
  221. color: #fff;
  222. border: .01rem solid #e75610;
  223. padding-left: .30rem;
  224. }
  225. &:last-child {
  226. background: #fff;
  227. color: #e75610;
  228. border: .01rem solid #e75610;
  229. border-right: none;
  230. padding-right: .35rem;
  231. }
  232. &:last-child.active {
  233. background: #e75610;
  234. color: #fff;
  235. border: .01rem solid #e75610;
  236. border-right: none;
  237. padding-right: .35rem;
  238. }
  239. &:first-child:before {
  240. content: '';
  241. background: #fff;
  242. border: .01rem solid #e75610;
  243. width: .64rem;
  244. height: .68rem;
  245. border-radius: 100%;
  246. position: absolute;
  247. left: -.33rem;
  248. top: -.01rem;
  249. z-index: -5;
  250. }
  251. &:first-child.active:before {
  252. content: '';
  253. background: #e75610;
  254. border: .01rem solid #e75610;
  255. width: .64rem;
  256. height: .68rem;
  257. border-radius: 100%;
  258. position: absolute;
  259. left: -.33rem;
  260. top: -.01rem;
  261. }
  262. &:last-child:before {
  263. content: '';
  264. background: #fff;
  265. width: .64rem;
  266. height: .68rem;
  267. border-radius: 100%;
  268. position: absolute;
  269. border: .01rem solid #e75610;
  270. left: 1.04rem;
  271. z-index: -5;
  272. top: -.01rem;
  273. }
  274. &:last-child.active:before {
  275. content: '';
  276. background: #e75610;
  277. width: .64rem;
  278. height: .68rem;
  279. border-radius: 100%;
  280. position: absolute;
  281. border: .01rem solid #e75610;
  282. left: 1.04rem;
  283. z-index: -5;
  284. top: -.01rem;
  285. }
  286. }
  287. }
  288. .product-params {
  289. line-height: .28rem;
  290. margin-top: .19rem;
  291. .param-item {
  292. padding: .19rem .4rem;
  293. &:nth-child(even) {
  294. background: #efeeee;
  295. }
  296. .prop-name {
  297. width: 3.72rem;
  298. display: inline-block;
  299. text-overflow: ellipsis;
  300. overflow: hidden;
  301. white-space: nowrap;
  302. }
  303. .prop-value {
  304. text-overflow: ellipsis;
  305. overflow: hidden;
  306. white-space: nowrap;
  307. display: inline-block;
  308. width: 2.69rem;
  309. float: right;
  310. }
  311. }
  312. }
  313. .product-store {
  314. margin: .38rem .2rem;
  315. table {
  316. width: 100%;
  317. font-size: .28rem;
  318. thead {
  319. tr {
  320. th {
  321. padding-bottom: .2rem;
  322. font-weight: bold;
  323. text-align: center;
  324. }
  325. }
  326. }
  327. tbody {
  328. tr {
  329. border-top: .01rem solid rgb(174,175,176);
  330. td {
  331. padding-top: .2rem;
  332. div {
  333. padding-left: .4rem;
  334. overflow: hidden;
  335. text-overflow: ellipsis;
  336. white-space: nowrap;
  337. margin-bottom: .2rem;
  338. &:last-child {
  339. margin-bottom: 0;
  340. }
  341. }
  342. }
  343. }
  344. }
  345. }
  346. .no-store {
  347. margin-top: .89rem;
  348. img {
  349. display: block;
  350. text-align: center;
  351. margin: 0 auto;
  352. margin-bottom: .45rem;
  353. width: 1.97rem;
  354. height: 1.8rem;
  355. }
  356. div {
  357. width: 5.27rem;
  358. margin: 0 auto;
  359. text-align: center;
  360. line-height: .4rem;
  361. .link-url {
  362. color: #01a44e;
  363. }
  364. }
  365. }
  366. }
  367. }
  368. </style>