ComponentDetail.vue 10 KB

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