ComponentDetail.vue 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374
  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. // stores () {
  112. // console.log(this.$store.state.componentStore.store.data)
  113. // return this.$store.state.componentStore.store.data
  114. // },
  115. storeList () {
  116. let storeList = this.$store.state.componentInformation.information.data
  117. let _self = this
  118. if (storeList.content) {
  119. storeList.content.forEach(function (item) {
  120. _self.storeIds.push(item.storeid)
  121. })
  122. }
  123. if (this.storeIds.length > 0) {
  124. if (this.storeIds.indexOf(this.storeId) === -1) {
  125. this.storeExist = true
  126. } else {
  127. this.storeIds.splice(this.storeIds.indexOf(this.storeId), 1)
  128. if (this.storeIds.length > 0) {
  129. this.storeExist = true
  130. }
  131. this.UmallExist = true
  132. }
  133. }
  134. return storeList
  135. }
  136. },
  137. filters: {
  138. currency: function (num) {
  139. if (typeof num === 'number') {
  140. if (num <= 0.000001) {
  141. num = 0.000001
  142. } else {
  143. if (num.toString().indexOf('.') === -1) {
  144. num += '.00'
  145. } else {
  146. let inputStr = num.toString()
  147. let arr = inputStr.split('.')
  148. let floatNum = arr[1]
  149. if (floatNum.length > 6) {
  150. num = inputStr.substring(0, arr[0].length + 7)
  151. if (Number(floatNum.charAt(6)) > 4) {
  152. num = (Number(num) * 1000000 + 1) / 1000000
  153. }
  154. } else if (floatNum.length === 1) {
  155. num = num + '0'
  156. }
  157. }
  158. }
  159. }
  160. return num
  161. }
  162. },
  163. methods: {
  164. goAttach: function (url) {
  165. if (url !== '1') {
  166. window.location.href = url
  167. }
  168. }
  169. }
  170. }
  171. </script>
  172. <style lang="scss" scoped>
  173. .component-detail {
  174. font-size: .28rem;
  175. margin-top: .88rem;
  176. margin-bottom: 1.2rem;
  177. .base-detail {
  178. margin: 0 .66rem .34rem .40rem;
  179. padding-top: .34rem;
  180. .base-detail-item {
  181. margin-bottom: .3rem;
  182. position: relative;
  183. &.attach {
  184. display: inline-block;
  185. }
  186. i {
  187. font-size: .55rem;
  188. color: #6fcafe;
  189. position: absolute;
  190. top: -.13rem;
  191. }
  192. &:last-child {
  193. margin-bottom: 0;
  194. }
  195. .description {
  196. line-height: .4rem;
  197. max-height: 1.2rem;
  198. word-break: break-all;
  199. overflow : hidden;
  200. text-overflow: ellipsis;
  201. display: -webkit-box;
  202. -webkit-line-clamp: 3;
  203. -webkit-box-orient: vertical;
  204. }
  205. }
  206. }
  207. .product-switch-item {
  208. text-align: center;
  209. .mobile-switch-btn {
  210. background: #e75610;
  211. color: #fff;
  212. display: inline-block;
  213. height: .68rem;
  214. font-size: .28rem;
  215. padding: .19rem .53rem;
  216. position: relative;
  217. &:first-child {
  218. background: #fff;
  219. color: #e75610;
  220. border: .01rem solid #e75610;
  221. border-left: none;
  222. padding-left: .30rem;
  223. }
  224. &:first-child.active {
  225. background: #e75610;
  226. color: #fff;
  227. border: .01rem solid #e75610;
  228. padding-left: .30rem;
  229. }
  230. &:last-child {
  231. background: #fff;
  232. color: #e75610;
  233. border: .01rem solid #e75610;
  234. border-right: none;
  235. padding-right: .35rem;
  236. }
  237. &:last-child.active {
  238. background: #e75610;
  239. color: #fff;
  240. border: .01rem solid #e75610;
  241. border-right: none;
  242. padding-right: .35rem;
  243. }
  244. &:first-child:before {
  245. content: '';
  246. background: #fff;
  247. border: .01rem solid #e75610;
  248. width: .64rem;
  249. height: .68rem;
  250. border-radius: 100%;
  251. position: absolute;
  252. left: -.33rem;
  253. top: -.01rem;
  254. z-index: -5;
  255. }
  256. &:first-child.active:before {
  257. content: '';
  258. background: #e75610;
  259. border: .01rem solid #e75610;
  260. width: .64rem;
  261. height: .68rem;
  262. border-radius: 100%;
  263. position: absolute;
  264. left: -.33rem;
  265. top: -.01rem;
  266. }
  267. &:last-child:before {
  268. content: '';
  269. background: #fff;
  270. width: .64rem;
  271. height: .68rem;
  272. border-radius: 100%;
  273. position: absolute;
  274. border: .01rem solid #e75610;
  275. left: 1.04rem;
  276. z-index: -5;
  277. top: -.01rem;
  278. }
  279. &:last-child.active:before {
  280. content: '';
  281. background: #e75610;
  282. width: .64rem;
  283. height: .68rem;
  284. border-radius: 100%;
  285. position: absolute;
  286. border: .01rem solid #e75610;
  287. left: 1.04rem;
  288. z-index: -5;
  289. top: -.01rem;
  290. }
  291. }
  292. }
  293. .product-params {
  294. line-height: .28rem;
  295. margin-top: .19rem;
  296. .param-item {
  297. padding: .19rem .4rem;
  298. &:nth-child(even) {
  299. background: #eee;
  300. }
  301. .prop-name {
  302. width: 3.72rem;
  303. display: inline-block;
  304. text-overflow: ellipsis;
  305. overflow: hidden;
  306. white-space: nowrap;
  307. }
  308. .prop-value {
  309. text-overflow: ellipsis;
  310. overflow: hidden;
  311. white-space: nowrap;
  312. display: inline-block;
  313. width: 2.69rem;
  314. float: right;
  315. }
  316. }
  317. }
  318. .product-store {
  319. margin: .38rem .2rem;
  320. table {
  321. width: 100%;
  322. font-size: .28rem;
  323. thead {
  324. tr {
  325. th {
  326. padding-bottom: .2rem;
  327. font-weight: bold;
  328. text-align: center;
  329. }
  330. }
  331. }
  332. tbody {
  333. tr {
  334. border-top: .01rem solid rgb(174,175,176);
  335. td {
  336. padding-top: .2rem;
  337. div {
  338. padding-left: .4rem;
  339. overflow: hidden;
  340. text-overflow: ellipsis;
  341. white-space: nowrap;
  342. margin-bottom: .2rem;
  343. &:last-child {
  344. margin-bottom: 0;
  345. }
  346. }
  347. }
  348. }
  349. }
  350. }
  351. .no-store {
  352. margin-top: .89rem;
  353. img {
  354. display: block;
  355. text-align: center;
  356. margin: 0 auto;
  357. margin-bottom: .45rem;
  358. width: 1.97rem;
  359. height: 1.8rem;
  360. }
  361. div {
  362. width: 5.27rem;
  363. margin: 0 auto;
  364. text-align: center;
  365. line-height: .4rem;
  366. .link-url {
  367. color: #01a44e;
  368. }
  369. }
  370. }
  371. }
  372. }
  373. </style>