ComponentDetail.vue 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350
  1. <template>
  2. <div class="component-detail">
  3. <div class="base-detail">
  4. <div class="base-detail-item">
  5. <span>类目:</span>
  6. <span>{{component.kind.nameCn}}</span>
  7. </div>
  8. <div class="base-detail-item">
  9. <span>品牌:</span>
  10. <span>{{component.brand.nameCn}}</span>
  11. </div>
  12. <div class="base-detail-item">
  13. <span>规格书:</span>
  14. <img src="/images/mobile/@2x/productDetail/view@2x.png" alt="">
  15. </div>
  16. <div class="base-detail-item">
  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-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="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. }
  164. </script>
  165. <style lang="scss" scoped>
  166. .component-detail {
  167. font-size: .28rem;
  168. margin-top: .88rem;
  169. margin-bottom: .98rem;
  170. .base-detail {
  171. margin: .34rem .66rem .34rem .40rem;
  172. .base-detail-item {
  173. margin-bottom: .3rem;
  174. &:last-child {
  175. margin-bottom: 0;
  176. }
  177. .description {
  178. line-height: .4rem;
  179. max-height: 1.2rem;
  180. word-break: break-all;
  181. overflow : hidden;
  182. text-overflow: ellipsis;
  183. display: -webkit-box;
  184. -webkit-line-clamp: 3;
  185. -webkit-box-orient: vertical;
  186. }
  187. }
  188. }
  189. .product-switch-item {
  190. text-align: center;
  191. .mobile-switch-btn {
  192. background: #e75610;
  193. color: #fff;
  194. display: inline-block;
  195. height: .68rem;
  196. font-size: .28rem;
  197. padding: .19rem .53rem;
  198. position: relative;
  199. &:first-child {
  200. background: #fff;
  201. color: #e75610;
  202. border: .01rem solid #e75610;
  203. border-left: none;
  204. padding-left: .30rem;
  205. }
  206. &:first-child.active {
  207. background: #e75610;
  208. color: #fff;
  209. border: .01rem solid #e75610;
  210. padding-left: .30rem;
  211. }
  212. &:last-child {
  213. background: #fff;
  214. color: #e75610;
  215. border: .01rem solid #e75610;
  216. border-right: none;
  217. padding-right: .35rem;
  218. }
  219. &:last-child.active {
  220. background: #e75610;
  221. color: #fff;
  222. border: .01rem solid #e75610;
  223. border-right: none;
  224. padding-right: .35rem;
  225. }
  226. &:first-child:before {
  227. content: '';
  228. background: #fff;
  229. border: .01rem solid #e75610;
  230. width: .64rem;
  231. height: .68rem;
  232. border-radius: 100%;
  233. position: absolute;
  234. left: -.33rem;
  235. top: -.01rem;
  236. z-index: -5;
  237. }
  238. &:first-child.active:before {
  239. content: '';
  240. background: #e75610;
  241. border: .01rem solid #e75610;
  242. width: .64rem;
  243. height: .68rem;
  244. border-radius: 100%;
  245. position: absolute;
  246. left: -.33rem;
  247. top: -.01rem;
  248. }
  249. &:last-child:before {
  250. content: '';
  251. background: #fff;
  252. width: .64rem;
  253. height: .68rem;
  254. border-radius: 100%;
  255. position: absolute;
  256. border: .01rem solid #e75610;
  257. left: 1.04rem;
  258. z-index: -5;
  259. top: -.01rem;
  260. }
  261. &:last-child.active:before {
  262. content: '';
  263. background: #e75610;
  264. width: .64rem;
  265. height: .68rem;
  266. border-radius: 100%;
  267. position: absolute;
  268. border: .01rem solid #e75610;
  269. left: 1.04rem;
  270. z-index: -5;
  271. top: -.01rem;
  272. }
  273. }
  274. }
  275. .product-params {
  276. line-height: .28rem;
  277. .param-item {
  278. margin: .38rem .4rem;
  279. .prop-name {
  280. width: 3.72rem;
  281. display: inline-block;
  282. text-overflow: ellipsis;
  283. overflow: hidden;
  284. white-space: nowrap;
  285. }
  286. .prop-value {
  287. text-overflow: ellipsis;
  288. overflow: hidden;
  289. white-space: nowrap;
  290. display: inline-block;
  291. width: 2.69rem;
  292. float: right;
  293. }
  294. }
  295. }
  296. .product-store {
  297. margin: .38rem .2rem;
  298. table {
  299. width: 100%;
  300. font-size: .28rem;
  301. thead {
  302. tr {
  303. th {
  304. padding-bottom: .2rem;
  305. font-weight: bold;
  306. text-align: center;
  307. }
  308. }
  309. }
  310. tbody {
  311. tr {
  312. border-top: .01rem solid rgb(174,175,176);
  313. td {
  314. padding-top: .2rem;
  315. div {
  316. padding-left: .4rem;
  317. overflow: hidden;
  318. text-overflow: ellipsis;
  319. white-space: nowrap;
  320. margin-bottom: .2rem;
  321. &:last-child {
  322. margin-bottom: 0;
  323. }
  324. }
  325. }
  326. }
  327. }
  328. }
  329. .no-store {
  330. margin-top: .89rem;
  331. img {
  332. display: block;
  333. text-align: center;
  334. margin: 0 auto;
  335. margin-bottom: .45rem;
  336. }
  337. div {
  338. width: 5.27rem;
  339. margin: 0 auto;
  340. text-align: center;
  341. line-height: .4rem;
  342. .link-url {
  343. color: #01a44e;
  344. }
  345. }
  346. }
  347. }
  348. }
  349. </style>