StoreDetail.vue 9.7 KB

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