StoreDetail.vue 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566
  1. <template>
  2. <div class="store-detail mobile-content">
  3. <div class="store-logo">
  4. <div class="store-logo-box">
  5. <img :src="store.logoUrl || '/images/component/default.png'"/>
  6. <i v-if="showIcon" class="iconfont icon-shoucang" :style="isFocus === 'true'?'color:#ff7800':'color: #ddd'" @click="collectStore"></i>
  7. </div>
  8. </div>
  9. <div class="store-switch-item">
  10. <span :class="activeType=='product'?'mobile-switch-btn active':'mobile-switch-btn'" @click="activeType='product'">产品</span>
  11. <span :class="activeType=='detail'?'mobile-switch-btn active':'mobile-switch-btn'" @click="activeType='detail'">介绍</span>
  12. </div>
  13. <div class="store-info" v-if="activeType=='detail'">
  14. <div class="store-description">
  15. <h4>主营产品</h4>
  16. <p class="content" v-if="store.description">
  17. {{store.description}}
  18. </p>
  19. <div class="com-none-state" v-else>
  20. <p>抱歉,暂无主营产品信息</p>
  21. </div>
  22. </div>
  23. <div class="contact-info">
  24. <h4>联系我们</h4>
  25. <ul class="list-unstyled clearfix">
  26. <li>
  27. <div>电&nbsp;&nbsp;话:</div>
  28. <div v-if="store.enterprise.enTel"><a :href="'tel:' + store.enterprise.enTel" @click="clickTel = true" :class="{'click-tel': clickTel}">{{store.enterprise.enTel}}</a></div>
  29. <div v-else><span>-</span></div>
  30. </li>
  31. <li>
  32. <div>传&nbsp;&nbsp;真:</div>
  33. <div v-if="store.enterprise.enFax"> {{store.enterprise.enFax}}</div>
  34. <div v-else><span>-</span></div>
  35. </li>
  36. <li>
  37. <div>手&nbsp;&nbsp;机:</div>
  38. <div v-if="store.enterprise.enPhone"> <a :href="'tel:' + store.enterprise.enPhone" @click="clickPhone = true" :class="{'click-phone': clickPhone}">{{store.enterprise.enPhone}}</a></div>
  39. <div v-else><span>-</span></div>
  40. </li>
  41. <li>
  42. <div>微&nbsp;&nbsp;信:</div>
  43. <div v-if="store.enterprise.enWeixin"> {{store.enterprise.enWeixin}}</div>
  44. <div v-else><span>-</span></div>
  45. </li>
  46. <li>
  47. <div>Q&nbsp;&nbsp;&nbsp;Q:</div>
  48. <div v-if="store.enterprise.enQQ"> {{store.enterprise.enQQ}}</div>
  49. <div v-else><span>-</span></div>
  50. </li>
  51. <li>
  52. <div>店铺地址:</div>
  53. <div v-if="store.enterprise.address">{{store.enterprise.address}}</div>
  54. <div v-else><span>-</span></div>
  55. </li>
  56. </ul>
  57. </div>
  58. <div class="store-description">
  59. <h4>企业简介</h4>
  60. <p class="content" v-if="store.enterprise.description">
  61. {{store.enterprise.description}}
  62. </p>
  63. <div class="com-none-state" v-else>
  64. <p>抱歉,暂无企业简介</p>
  65. </div>
  66. </div>
  67. </div>
  68. <!-- <div class="com-none-state" v-if="activeType=='detail'">
  69. <img src="/images/mobile/@2x/empty-collect.png">
  70. <p>抱歉,暂无店铺简介</p>
  71. <nuxt-link to="/">返回首页</nuxt-link>
  72. </div>-->
  73. <div class="product-store" v-if="activeType == 'product'">
  74. <table v-if="commodities.content&&commodities.content.length > 0">
  75. <thead id="product-head" >
  76. <tr>
  77. <th style="width: 1.77rem;">型号/品牌</th>
  78. <th style="width: 1.75rem;">包装</th>
  79. <th style="width: 2.2rem;">价格梯度</th>
  80. <th style="width: 1.77rem;">交期(天)</th>
  81. </tr>
  82. </thead>
  83. <thead class="active" v-show="isScrollOverTab">
  84. <tr>
  85. <th style="width: 1.77rem;">型号/品牌</th>
  86. <th style="width: 1.75rem;">包装</th>
  87. <th style="width: 2.2rem;">价格梯度</th>
  88. <th style="width: 1.77rem;">交期(天)</th>
  89. </tr>
  90. </thead>
  91. <tbody id="product-body">
  92. <tr v-for="commodity in searchLists" @click="goProductDetail(commodity.uuid)">
  93. <td class="store-name">
  94. <div>{{commodity.code}}</div>
  95. <div>{{commodity.brandNameCn}}</div>
  96. </td>
  97. <td>
  98. <div v-if="!commodity.packaging && !commodity.breakUp && !commodity.produceDate">-</div>
  99. <div>{{commodity.packaging}}</div>
  100. <div>{{commodity.breakUp?'可拆卖':'不可拆卖'}}</div>
  101. <div>{{commodity.produceDate}}</div>
  102. </td>
  103. <td class="price-level-wrap">
  104. <div v-if="!commodity.prices || commodity.prices.length == 0">-</div>
  105. <div class="price-number fl">
  106. <div v-for="price in commodity.prices">{{price.start}}+</div>
  107. </div>
  108. <div class="price-number fr">
  109. <div v-for="price in commodity.prices" class="price-level">
  110. <span v-if="commodity.currencyName.indexOf('RMB')!==-1">¥{{price.rMBPrice | currency}}</span>
  111. <span v-if="commodity.currencyName.indexOf('USD')!==-1">${{price.uSDPrice | currency}}</span>
  112. </div>
  113. </div>
  114. </td>
  115. <td>
  116. <div v-if="commodity.b2cMinDelivery">
  117. <span>{{commodity.b2cMinDelivery}}</span>
  118. <span v-if="commodity.b2cMaxDelivery && commodity.b2cMaxDelivery !== commodity.b2cMinDelivery">-</span>
  119. <span v-if="commodity.b2cMaxDelivery && commodity.b2cMaxDelivery !== commodity.b2cMinDelivery">{{commodity.b2cMaxDelivery}}</span>
  120. </div>
  121. <div v-if="commodity.minBuyQty"><span class="order-tag">订</span>{{commodity.minBuyQty}}起订</div>
  122. <div v-if="commodity.reserve"><span class="order-tag reserve-tag">库</span>{{commodity.reserve}}</div>
  123. <div v-if="!commodity.b2cMinDelivery">
  124. <span>—</span>
  125. </div>
  126. </td>
  127. </tr>
  128. </tbody>
  129. </table>
  130. <div v-if="!commodities.content || commodities.content.length == 0" class="no-product">
  131. <img src="/images/mobile/@2x/car@2x.png" alt="">
  132. <div>抱歉,暂无上架产品信息</div>
  133. </div>
  134. </div>
  135. <remind-box :title="collectResult" :timeoutCount="timeoutCount"></remind-box>
  136. <loading v-show="isSearchingMore"></loading>
  137. <login-box @onLoginBoxClose="showLoginBox = false" v-if="showLoginBox" :url="url"></login-box>
  138. </div>
  139. </template>
  140. <script>
  141. import {RemindBox, Loading, LoginBox} from '~components/mobile/common'
  142. export default {
  143. data () {
  144. return {
  145. activeType: 'product',
  146. collectResult: '收藏成功',
  147. timeoutCount: 0,
  148. clickTel: false,
  149. clickPhone: false,
  150. isSearchingMore: false,
  151. searchLists: [],
  152. page: 1,
  153. showLoginBox: false,
  154. isScrollOverTab: false,
  155. url: ''
  156. }
  157. },
  158. components: {
  159. RemindBox,
  160. Loading,
  161. LoginBox
  162. },
  163. mounted: function () {
  164. let _this = this
  165. _this.$nextTick(function () {
  166. window.addEventListener('scroll', function () {
  167. _this.scroll()
  168. }, false)
  169. })
  170. },
  171. filters: {
  172. currency: function (num) {
  173. if (typeof num === 'number') {
  174. if (num <= 0.000001) {
  175. num = 0.000001
  176. } else {
  177. if (num.toString().indexOf('.') === -1) {
  178. num += '.00'
  179. } else {
  180. let inputStr = num.toString()
  181. let arr = inputStr.split('.')
  182. let floatNum = arr[1]
  183. if (floatNum.length > 6) {
  184. num = inputStr.substring(0, arr[0].length + 7)
  185. if (Number(floatNum.charAt(6)) > 4) {
  186. num = (Number(num) * 1000000 + 1) / 1000000
  187. }
  188. } else if (floatNum.length === 1) {
  189. num = num + '0'
  190. }
  191. }
  192. }
  193. }
  194. return num
  195. }
  196. },
  197. created () {
  198. this.clickTel = false
  199. this.clickPhone = false
  200. },
  201. computed: {
  202. store () {
  203. return this.$store.state.shop.storeInfo.store.data
  204. },
  205. commodities () {
  206. let list = this.$store.state.shop.storeInfo.storeCommodity.data
  207. this.searchLists = this.searchLists.concat(list.content)
  208. this.isSearchingMore = false
  209. return list
  210. },
  211. allPage () {
  212. return this.commodities.totalPages
  213. },
  214. isFocus () {
  215. return this.$store.state.shop.storeInfo.focusList.data
  216. },
  217. user () {
  218. return this.$store.state.option.user
  219. },
  220. showIcon() {
  221. return this.store.uuid !== this.$store.state.option.storeStatus.data.uuid
  222. }
  223. },
  224. methods: {
  225. scroll: function () {
  226. let scrolled = document.documentElement.scrollTop || window.pageYOffset || document.body.scrollTop
  227. if (Math.ceil(scrolled + window.screen.availHeight) >= document.body.scrollHeight && !this.isSearchingMore && this.page < this.allPage && this.activeType === 'product') {
  228. this.getMoreCom()
  229. }
  230. let tbodyObj = document.getElementById('product-body')
  231. let theadObj = document.getElementById('product-head')
  232. if (theadObj) {
  233. this.isScrollOverTab = tbodyObj.getBoundingClientRect().top - theadObj.getBoundingClientRect().height - 5 <= theadObj.getBoundingClientRect().height
  234. }
  235. },
  236. getMoreCom: function () {
  237. if (!this.isSearchingMore) {
  238. this.page++
  239. this.isSearchingMore = true
  240. this.pageCommodity({ page: this.page, count: 6 })
  241. }
  242. },
  243. async pageCommodity (pageParams, kindId, keyword) {
  244. let params = { storeid: this.$route.params.uuid, origin: 'store', kindUuid: kindId, code: keyword }
  245. params.page = pageParams.page
  246. params.count = pageParams.count
  247. try {
  248. let { data } = await this.$http.get('/api/commodity/commodities', { params })
  249. this.$store.commit('shop/storeInfo/GET_STORE_COMMODITY_SUCCESS', data)
  250. } catch (err) {
  251. this.$store.commit('shop/storeInfo/GET_STORE_COMMODITY_FAILURE', err)
  252. }
  253. },
  254. goProductDetail: function (uuid) {
  255. if (uuid) {
  256. this.$router.push('/mobile/brand/componentDetail/' + uuid)
  257. } else {
  258. this.collectResult = '卖家上传的产品暂无参数,请联系卖家了解具体详情。'
  259. this.timeoutCount ++
  260. }
  261. },
  262. collectStore: function () {
  263. if (this.user.logged) {
  264. if (this.isFocus === 'false') {
  265. this.$store.dispatch('shop/StoreFocus', {storeName: this.store.storeName, storeid: this.store.id})
  266. .then(response => {
  267. this.$store.dispatch('shop/StoreFocusList', {id: this.store.id})
  268. this.collectResult = '收藏成功'
  269. this.timeoutCount++
  270. })
  271. } else if (this.isFocus === 'true') {
  272. this.$http.post('/trade/storeFocus/delete/storeId', [this.store.id])
  273. .then(response => {
  274. this.$store.dispatch('shop/StoreFocusList', {id: this.store.id})
  275. this.collectResult = '取消成功'
  276. this.timeoutCount++
  277. })
  278. }
  279. } else {
  280. this.url = this.$route.fullPath
  281. this.showLoginBox = true
  282. }
  283. }
  284. }
  285. }
  286. </script>
  287. <style lang="scss" scoped>
  288. .store-detail {
  289. margin: 0 auto;
  290. margin-bottom: 1.2rem;
  291. text-align: center;
  292. background: #f7f7f7;
  293. height: 100%;
  294. .store-logo {
  295. height: 3.17rem;
  296. width: 6.96rem;
  297. display: inline-block;
  298. margin: .2rem auto;
  299. line-height: 2.13rem;
  300. background: #fff;
  301. text-align: center;
  302. border-radius: .1rem;
  303. background: url('/images/mobile/@2x/brand-bg.png') no-repeat;
  304. background-size: cover;
  305. .store-logo-box {
  306. border: .04rem solid #c7e5fd;
  307. border-radius: .1rem;
  308. height: 2.21rem;
  309. width: 3.73rem;
  310. margin: .5rem auto 0;
  311. background: #fff;
  312. position: relative;
  313. img {
  314. max-height: 2.1rem;
  315. max-width: 3.6rem;
  316. }
  317. >i {
  318. position: absolute;
  319. font-size: .4rem;
  320. background: #fff;
  321. width: .6rem;
  322. height: .6rem;
  323. line-height: .6rem;
  324. border-radius: 100%;
  325. box-shadow: 0 0 .05rem #aaa;
  326. right: -1.44rem;
  327. top: .75rem;
  328. text-align: center;
  329. }
  330. }
  331. }
  332. .store-switch-item {
  333. text-align: center;
  334. background: #fff;
  335. .mobile-switch-btn {
  336. background: #fff;
  337. color: #666;
  338. display: inline-block;
  339. height: .64rem;
  340. font-size: .34rem;
  341. line-height: .64rem;
  342. width: 1.4rem;
  343. &:first-child {
  344. margin-right: 1.78rem;
  345. }
  346. &.active {
  347. color: #fc5708;
  348. border-bottom: .04rem solid #fc5708;
  349. }
  350. }
  351. }
  352. .store-info {
  353. background: #f7f7f7;
  354. width: 100%;
  355. h4{
  356. width: 100%;
  357. text-align: left;
  358. font-size: 0.3rem;
  359. line-height: 0.6rem;
  360. height: 0.6rem;
  361. letter-spacing: 0px;
  362. color: #333;
  363. font-weight: normal;
  364. border-bottom: 1px solid #efeded;
  365. padding-left: 0.11rem;
  366. &:before{
  367. content: '';
  368. display: inline-block;
  369. width: 0.08rem;
  370. height: 0.26rem;
  371. background-color: #145dee;
  372. margin-right: 0.13rem;
  373. position: relative;
  374. top: 0.02rem;
  375. }
  376. }
  377. .contact-info{
  378. background: #fff;
  379. width: 6.96rem;
  380. margin: .2rem auto;
  381. border-radius: .1rem;
  382. ul{
  383. padding: 0.22rem 0rem;
  384. li{
  385. div{
  386. float: left;
  387. font-size: .28rem;
  388. color: #666;
  389. line-height: .53rem;
  390. width:80%;
  391. text-align: left;
  392. &:first-child{
  393. width: 20%;
  394. padding-left: 0.36rem;
  395. text-align: justify;
  396. }
  397. a{
  398. color: #145dee;
  399. }
  400. .click-tel, .click-phone{
  401. color: #f44336;
  402. }
  403. }
  404. &:last-child{
  405. div{
  406. width: 74%;
  407. padding-right:.34rem;
  408. word-wrap: break-word;
  409. &:first-child{
  410. text-align: left;
  411. padding: 0rem 0rem 0rem .36rem;
  412. width: 26%;
  413. }
  414. }
  415. }
  416. }
  417. }
  418. }
  419. .store-description{
  420. background: #fff;
  421. width: 6.96rem;
  422. margin: .2rem auto;
  423. border-radius: .1rem;
  424. .content {
  425. text-indent:2em;
  426. background: #fff;
  427. margin: .2rem auto 0;
  428. padding: .04rem .34rem .4rem .34rem;
  429. width: 100%;
  430. font-size: .28rem;
  431. color: #666;
  432. text-align: left;
  433. height: 95%;
  434. /*box-shadow: 0 .03rem .01rem 0 #cdcbcb96;*/
  435. line-height: .5rem;
  436. word-break: break-all;
  437. }
  438. }
  439. }
  440. .product-store {
  441. margin: .2rem 0 0 0;
  442. table {
  443. width: 100%;
  444. font-size: .28rem;
  445. thead {
  446. background: #d5e5fb;
  447. &.active {
  448. position: fixed;
  449. top: .88rem;
  450. z-index: 2;
  451. }
  452. tr {
  453. th {
  454. font-weight: bold;
  455. text-align: center;
  456. height: .78rem;
  457. line-height: .78rem;
  458. }
  459. }
  460. }
  461. tbody {
  462. tr {
  463. background: #fff;
  464. border-bottom: 0.2rem solid #f7f7f7;
  465. td {
  466. padding: .2rem .1rem;
  467. text-align: left;
  468. &.price-level-wrap {
  469. text-align: center;
  470. }
  471. div {
  472. overflow: hidden;
  473. text-overflow: ellipsis;
  474. white-space: nowrap;
  475. margin-bottom: .2rem;
  476. max-width: 1.58rem;
  477. &:last-child {
  478. margin-bottom: 0;
  479. }
  480. }
  481. .price-level:last-child {
  482. color: #fc5708;
  483. }
  484. .price-number {
  485. display: inline-block;
  486. vertical-align: middle;
  487. margin-bottom: 0;
  488. width: .9rem;
  489. }
  490. .order-tag {
  491. display: inline-block;
  492. font-size: .18rem;
  493. color: #fff;
  494. font-weight: bold;
  495. background: #ee1717;
  496. height: .27rem;
  497. width: .27rem;
  498. line-height: .27rem;
  499. text-align: center;
  500. border-radius: .05rem;
  501. position: relative;
  502. top: -.05rem;
  503. margin-right: .05rem;
  504. &.reserve-tag {
  505. background: #07bb1c;
  506. }
  507. }
  508. }
  509. &:active {
  510. background: #e1e1e1;
  511. }
  512. }
  513. }
  514. }
  515. .no-store {
  516. background: #fff;
  517. padding-top: 1rem;
  518. img {
  519. display: block;
  520. text-align: center;
  521. margin: 0 auto;
  522. margin-bottom: .45rem;
  523. width: 3.31rem;
  524. height: 2.13rem;
  525. }
  526. div {
  527. width: 5.27rem;
  528. margin: 0 auto;
  529. text-align: center;
  530. line-height: .4rem;
  531. color: #999;
  532. .link-url {
  533. color: #01a44e;
  534. }
  535. }
  536. }
  537. }
  538. .no-product {
  539. background: #fff;
  540. padding-top: 1rem;
  541. img {
  542. display: block;
  543. text-align: center;
  544. margin: 0 auto;
  545. margin-bottom: .45rem;
  546. width: 3.31rem;
  547. height: 2.13rem;
  548. }
  549. div {
  550. width: 5.27rem;
  551. margin: 0 auto;
  552. text-align: center;
  553. line-height: .4rem;
  554. font-size: .32rem;
  555. color: #999;
  556. }
  557. }
  558. }
  559. .com-none-state {
  560. padding: .6rem;
  561. p {
  562. margin: 0;
  563. font-size: .28rem;
  564. }
  565. }
  566. </style>