StoreDetail.vue 19 KB

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