StoreDetail.vue 9.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328
  1. <template>
  2. <div class="store-detail">
  3. <div class="store-logo">
  4. <div class="store-logo-box">
  5. <img :src="store.logoUrl || '/images/component/default.png'"/>
  6. <i 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=='detail'?'mobile-switch-btn active':'mobile-switch-btn'" @click="activeType='detail'">介绍</span>
  11. <span :class="activeType=='product'?'mobile-switch-btn active':'mobile-switch-btn'" @click="activeType='product'">产品</span>
  12. </div>
  13. <div class="store-description" v-if="activeType=='detail'">
  14. <p>
  15. {{store.description}}
  16. </p>
  17. </div>
  18. <div class="product-store" v-if="activeType == 'product'">
  19. <table v-if="commodities.content&&commodities.content.length > 0">
  20. <thead>
  21. <tr>
  22. <th>型号/品牌</th>
  23. <th>包装</th>
  24. <th>数量</th>
  25. <th>单价</th>
  26. <th>交期(天)</th>
  27. </tr>
  28. </thead>
  29. <tbody>
  30. <tr v-for="commodity in commodities.content" @click="goProductDetail(commodity.uuid)">
  31. <td class="store-name">
  32. <div>{{commodity.kindNameCn}}</div>
  33. <div>{{commodity.brandNameCn}}</div>
  34. </td>
  35. <td>
  36. <div v-if="!commodity.packaging && !commodity.breakUp && !commodity.produceDate">-</div>
  37. <div>{{commodity.packaging}}</div>
  38. <div>{{commodity.breakUp?'可拆卖':'不可拆卖'}}</div>
  39. <div>{{commodity.produceDate}}</div>
  40. </td>
  41. <td>
  42. <div v-if="!commodity.prices || commodity.prices.length == 0">-</div>
  43. <div v-for="price in commodity.prices">{{price.start}}+</div>
  44. </td>
  45. <td>
  46. <div v-if="!commodity.prices || commodity.prices.length == 0">
  47. <span>—</span>
  48. </div>
  49. <div v-for="price in commodity.prices" class="price-level">
  50. <span v-if="commodity.currencyName.indexOf('RMB')!==-1">¥{{price.rMBPrice | currency}}</span>
  51. <span v-if="commodity.currencyName.indexOf('USD')!==-1">${{price.uSDPrice | currency}}</span>
  52. </div>
  53. </td>
  54. <td>
  55. <div v-if="commodity.b2cMinDelivery">
  56. <span>交期:</span>
  57. <span>{{commodity.b2cMinDelivery}}</span>
  58. <span v-if="commodity.b2cMaxDelivery && commodity.b2cMaxDelivery !== commodity.b2cMinDelivery">-</span>
  59. <span v-if="commodity.b2cMaxDelivery && commodity.b2cMaxDelivery !== commodity.b2cMinDelivery">{{commodity.b2cMaxDelivery}}</span>
  60. </div>
  61. <div v-if="commodity.minBuyQty"><span class="order-tag">订</span>{{commodity.minBuyQty}}起订</div>
  62. <div v-if="!commodity.b2cMinDelivery">
  63. <span>—</span>
  64. </div>
  65. </td>
  66. </tr>
  67. </tbody>
  68. </table>
  69. <div v-if="!commodities.content || commodities.content.length == 0" class="no-product">
  70. <img src="/images/mobile/@2x/car@2x.png" alt="">
  71. <div>抱歉,暂无产品信息</div>
  72. </div>
  73. </div>
  74. <remind-box :title="collectResult" :timeoutCount="timeoutCount"></remind-box>
  75. </div>
  76. </template>
  77. <script>
  78. import RemindBox from '~components/mobile/common/RemindBox.vue'
  79. export default {
  80. data () {
  81. return {
  82. activeType: 'product',
  83. collectResult: '收藏成功',
  84. timeoutCount: 0
  85. }
  86. },
  87. components: {
  88. RemindBox
  89. },
  90. filters: {
  91. currency: function (num) {
  92. if (typeof num === 'number') {
  93. if (num <= 0.000001) {
  94. num = 0.000001
  95. } else {
  96. if (num.toString().indexOf('.') === -1) {
  97. num += '.00'
  98. } else {
  99. let inputStr = num.toString()
  100. let arr = inputStr.split('.')
  101. let floatNum = arr[1]
  102. if (floatNum.length > 6) {
  103. num = inputStr.substring(0, arr[0].length + 7)
  104. if (Number(floatNum.charAt(6)) > 4) {
  105. num = (Number(num) * 1000000 + 1) / 1000000
  106. }
  107. } else if (floatNum.length === 1) {
  108. num = num + '0'
  109. }
  110. }
  111. }
  112. }
  113. return num
  114. }
  115. },
  116. computed: {
  117. store () {
  118. return this.$store.state.shop.storeInfo.store.data
  119. },
  120. commodities () {
  121. return this.$store.state.shop.storeInfo.storeCommodity.data
  122. },
  123. isFocus () {
  124. return this.$store.state.shop.storeInfo.focusList.data
  125. }
  126. },
  127. methods: {
  128. goProductDetail: function (uuid) {
  129. this.$router.push('/mobile/brand/componentDetail/' + uuid)
  130. },
  131. collectStore: function () {
  132. if (this.isFocus === 'false') {
  133. this.$store.dispatch('shop/StoreFocus', {storeName: this.store.storeName, storeid: this.store.id})
  134. .then(response => {
  135. this.$store.dispatch('shop/StoreFocusList', {id: this.store.id})
  136. this.collectResult = '收藏成功'
  137. this.timeoutCount++
  138. })
  139. } else if (this.isFocus === 'true') {
  140. this.$http.post('/trade/storeFocus/delete/storeId', [this.store.id])
  141. .then(response => {
  142. this.$store.dispatch('shop/StoreFocusList', {id: this.store.id})
  143. this.collectResult = '取消成功'
  144. this.timeoutCount++
  145. })
  146. }
  147. }
  148. }
  149. }
  150. </script>
  151. <style lang="scss" scoped>
  152. .store-detail {
  153. margin: 0 auto;
  154. margin-bottom: 1.2rem;
  155. text-align: center;
  156. background: #f7f7f7;
  157. height: 100%;
  158. .store-logo {
  159. height: 3.17rem;
  160. width: 6.96rem;
  161. display: inline-block;
  162. margin: .38rem auto .18rem;
  163. line-height: 2.13rem;
  164. background: #fff;
  165. text-align: center;
  166. border-radius: .1rem;
  167. background: url('/images/mobile/@2x/brand-bg.png') no-repeat;
  168. background-size: cover;
  169. .store-logo-box {
  170. border: .01rem solid #c7e5fd;
  171. border-radius: .1rem;
  172. height: 2.21rem;
  173. width: 3.73rem;
  174. margin: .5rem auto 0;
  175. background: #fff;
  176. position: relative;
  177. img {
  178. max-height: 2.13rem;
  179. max-width: 3.7rem;
  180. }
  181. >i {
  182. position: absolute;
  183. font-size: .4rem;
  184. background: #fff;
  185. width: .6rem;
  186. height: .6rem;
  187. line-height: .6rem;
  188. border-radius: 100%;
  189. box-shadow: 0 0 5px #aaa;
  190. right: -1.44rem;
  191. top: .75rem;
  192. text-align: center;
  193. }
  194. }
  195. }
  196. .store-switch-item {
  197. text-align: center;
  198. background: #fff;
  199. .mobile-switch-btn {
  200. background: #fff;
  201. color: #666;
  202. display: inline-block;
  203. height: .64rem;
  204. font-size: .34rem;
  205. line-height: .64rem;
  206. width: 1.4rem;
  207. &:first-child {
  208. margin-right: 1.78rem;
  209. }
  210. &.active {
  211. color: #fc5708;
  212. border-bottom: .01rem solid #fc5708;
  213. }
  214. }
  215. }
  216. .store-description {
  217. background: #f7f7f7;
  218. p {
  219. background: #fff;
  220. margin: .2rem .5rem;
  221. padding: .4rem .2rem;
  222. font-size: .28rem;
  223. color: #666;
  224. text-align: left;
  225. }
  226. }
  227. .product-store {
  228. margin: .2rem 0;
  229. table {
  230. width: 100%;
  231. font-size: .28rem;
  232. thead {
  233. background: #d5e5fb;
  234. tr {
  235. th {
  236. font-weight: bold;
  237. text-align: center;
  238. height: .78rem;
  239. line-height: .78rem;
  240. }
  241. }
  242. }
  243. tbody {
  244. tr {
  245. background: #fff;
  246. border-top: .01rem solid rgb(174,175,176);
  247. td {
  248. padding: .2rem .1rem;
  249. text-align: left;
  250. div {
  251. overflow: hidden;
  252. text-overflow: ellipsis;
  253. white-space: nowrap;
  254. margin-bottom: .2rem;
  255. max-width: 1.58rem;
  256. &:last-child {
  257. margin-bottom: 0;
  258. }
  259. }
  260. .price-level:last-child {
  261. color: #fc5708;
  262. }
  263. .order-tag {
  264. display: inline-block;
  265. font-size: .18rem;
  266. color: #fff;
  267. font-weight: bold;
  268. background: #ee1717;
  269. height: .27rem;
  270. width: .27rem;
  271. line-height: .27rem;
  272. text-align: center;
  273. border-radius: .05rem;
  274. position: relative;
  275. top: -.03rem;
  276. }
  277. }
  278. &:active {
  279. background: #e1e1e1;
  280. }
  281. }
  282. }
  283. }
  284. .no-store {
  285. background: #fff;
  286. padding-top: 1rem;
  287. img {
  288. display: block;
  289. text-align: center;
  290. margin: 0 auto;
  291. margin-bottom: .45rem;
  292. width: 3.31rem;
  293. height: 2.13rem;
  294. }
  295. div {
  296. width: 5.27rem;
  297. margin: 0 auto;
  298. text-align: center;
  299. line-height: .4rem;
  300. color: #999;
  301. .link-url {
  302. color: #01a44e;
  303. }
  304. }
  305. }
  306. }
  307. .no-product {
  308. background: #fff;
  309. padding-top: 1rem;
  310. img {
  311. display: block;
  312. text-align: center;
  313. margin: 0 auto;
  314. margin-bottom: .45rem;
  315. width: 3.31rem;
  316. height: 2.13rem;
  317. }
  318. div {
  319. width: 5.27rem;
  320. margin: 0 auto;
  321. text-align: center;
  322. line-height: .4rem;
  323. font-size: .32rem;
  324. color: #999;
  325. }
  326. }
  327. }
  328. </style>