index.vue 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194
  1. <template>
  2. <div class="shopDetails">
  3. <div class="header container">
  4. <img class="logo fl" :src="`${$basePath}${shopInfo.defaultImgUrl}`" />
  5. <div class="desc fl">
  6. <h3>{{ shopInfo.companyName }}</h3>
  7. <span class="rz">{{
  8. $t("page.views.shops.details.index.certified")
  9. }}</span>
  10. <div v-if="shopInfo.isFollow">
  11. <img src="@assets/guanzhu-2.png" />
  12. <span class="gz">{{
  13. $t("page.views.shops.details.index.alreadyConcerned")
  14. }}</span>
  15. </div>
  16. <div v-else @click="gz">
  17. <img src="@assets/guanzhu.png" />
  18. <span class="gz t">{{
  19. $t("page.views.shops.details.index.focusBusinesses")
  20. }}</span>
  21. </div>
  22. </div>
  23. <div class="fr search">
  24. <el-input
  25. class="input"
  26. :placeholder="
  27. `${$t(`inputPlaceholder`)}${$t(
  28. `page.views.shops.details.index.keyWord`
  29. )}`
  30. "
  31. prefix-icon="el-icon-search"
  32. v-model="searchVal"
  33. />
  34. <router-link class="fr qz" :to="`/mall/${searchVal}`">
  35. {{ $t("page.views.shops.details.index.searchWholeStation") }}
  36. </router-link>
  37. <div class="fr bd" @click="search">
  38. {{ $t("page.views.shops.details.index.searchShop") }}
  39. </div>
  40. </div>
  41. </div>
  42. <div class="navs ">
  43. <div class="container">
  44. <router-link
  45. class="nav "
  46. :to="`/shop/${sid}/products`"
  47. @click.native="refresh"
  48. >
  49. {{ $t("page.views.shops.details.index.home") }}
  50. </router-link>
  51. <router-link class="nav " :to="`/shop/${sid}/profile`"
  52. >{{ $t("page.views.shops.details.index.companyIntroduction") }}
  53. </router-link>
  54. <router-link class="nav " :to="`/shop/${sid}/honor`"
  55. >{{ $t("page.views.shops.details.index.qualificationHonor") }}
  56. </router-link>
  57. </div>
  58. </div>
  59. <keep-alive>
  60. <router-view :shopInfo="shopInfo" :keyWord="keyWord" />
  61. </keep-alive>
  62. </div>
  63. </template>
  64. <script lang="ts">
  65. import { Component, Vue, Watch, Prop } from "vue-property-decorator";
  66. import user from "@/store/modules/user";
  67. @Component
  68. export default class extends Vue {
  69. private shopInfo: IAny = {};
  70. private searchVal = "";
  71. private keyWord = "";
  72. @Prop(String)
  73. private sid!: string;
  74. @Watch("$i18n.locale")
  75. @Watch("sid", { immediate: true })
  76. async load() {
  77. this.searchVal = this.keyWord = "";
  78. if (!this.sid) return;
  79. const [err, data] = await this.$post("/company/details", { id: this.sid });
  80. if (err) return;
  81. this.shopInfo = data;
  82. }
  83. search() {
  84. this.keyWord = this.searchVal;
  85. const url = `/shop/${this.shopInfo.id}/products`;
  86. if (this.$route.path === url) return;
  87. this.$router.push(url);
  88. }
  89. async gz() {
  90. if (!user.UserInfo)
  91. return this.$message.warning(`${this.$i18n.t("message.warning.login")}`);
  92. const [err, data] = await this.$post("/member/follow/addMemberFollow", {
  93. companyId: this.sid
  94. });
  95. if (err) return;
  96. this.shopInfo.isFollow = 1;
  97. this.$message.success(
  98. `${this.$i18n.t("page.views.shops.details.index.followSuccess")}`
  99. );
  100. }
  101. refresh() {
  102. this.shopInfo = { ...this.shopInfo };
  103. }
  104. }
  105. </script>
  106. <style lang="scss" scoped>
  107. .shopDetails {
  108. background: #fff;
  109. .header {
  110. height: 137px;
  111. box-sizing: border-box;
  112. overflow: hidden;
  113. padding: 30px 0;
  114. .logo {
  115. width: 142px;
  116. height: 80px;
  117. }
  118. .desc {
  119. margin-left: 20px;
  120. h3 {
  121. font-size: 18px;
  122. color: rgb(51, 51, 51);
  123. margin-bottom: 20px;
  124. width: 300px;
  125. }
  126. .rz {
  127. margin-right: 20px;
  128. background: rgb(253, 85, 34);
  129. color: #fff;
  130. padding: 5px 10px;
  131. border-radius: 4px;
  132. font-size: 12px;
  133. }
  134. .gz {
  135. // margin-left: 5px;
  136. font-size: 12px;
  137. color: rgb(51, 51, 51);
  138. &.t {
  139. cursor: pointer;
  140. }
  141. }
  142. div {
  143. display: inline-block;
  144. }
  145. }
  146. .search {
  147. margin-top: 20px;
  148. .input {
  149. width: 440px;
  150. height: 40px;
  151. }
  152. .fr {
  153. white-space: nowrap;
  154. width: 110px;
  155. height: 40px;
  156. line-height: 40px;
  157. text-align: center;
  158. border-radius: 4px;
  159. cursor: pointer;
  160. &.bd {
  161. background: rgb(253, 85, 34);
  162. color: #fff;
  163. margin: 0 10px;
  164. }
  165. &.qz {
  166. border: 1px solid #fd5522;
  167. color: #fd5522;
  168. }
  169. }
  170. }
  171. }
  172. .navs {
  173. background: rgb(253, 85, 34);
  174. height: 40px;
  175. line-height: 40px;
  176. .nav {
  177. color: #fff;
  178. display: inline-block;
  179. text-align: center;
  180. border-left: 1px solid #ff672e;
  181. padding: 0 20px;
  182. &:last-child {
  183. border-right: 1px solid #ff672e;
  184. }
  185. &.router-link-exact-active {
  186. background: rgb(237, 68, 17);
  187. }
  188. }
  189. }
  190. }
  191. </style>