StoreDetail.vue 19 KB

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