StoreDetail.vue 18 KB

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