index.vue 5.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267
  1. <template>
  2. <div class="conatainer">
  3. <div class="header">
  4. <h2 class="title">您好,{{ userInfo.partnerName }}</h2>
  5. <p class="nav-wrap">
  6. <router-link
  7. :to="{path: '/partner/goods' + '?partnerId=' + userInfo.id + '&partnerName=' + userInfo.partnerName + '&partnerImgUrl=' + userInfo.partnerImgUrl}">
  8. <img src="./image/bg_xindai_tuiguang@2x.png" alt="">
  9. </router-link>
  10. <a href="javascript:;" @click="funJumpParterExplain">
  11. <img src="./image/bg_hehuoren_zhaomu@2x.png" alt="">
  12. </a>
  13. </p>
  14. </div>
  15. <div class="my-customer border-bottom-1px">
  16. <div class="top">
  17. <p class="label">我的客户</p>
  18. <p class="nav-wrap">
  19. <a href="javascript:;" :class="{'active': $route.name === 'partnerCustomer'}"
  20. @click="funJump('/partner')">客户</a>
  21. <a href="javascript:;" :class="{'active': $route.name === 'partnerAll'}"
  22. @click="funJump('/partner/business')">门店业务</a>
  23. </p>
  24. </div>
  25. <van-search
  26. :show-action="true"
  27. v-model="searChValue"
  28. @search="searchHandle"
  29. @clear="clearHandle"
  30. placeholder="输入姓名、手机号">
  31. <template #action>
  32. <span @click="searchHandle">搜索</span>
  33. </template>
  34. </van-search>
  35. </div>
  36. <keep-alive>
  37. <router-view v-if="$route.meta.keepAlive"></router-view>
  38. </keep-alive>
  39. <router-view v-if="!$route.meta.keepAlive"></router-view>
  40. <Poster :posterBg="posterBg"
  41. :codeParams="codeParams"
  42. ref="myPoster"/>
  43. </div>
  44. </template>
  45. <script>
  46. import { Search } from 'vant'
  47. import Poster from '../poster'
  48. import { mapGetters } from 'vuex'
  49. export default {
  50. name: 'marketing',
  51. components: {
  52. 'van-search': Search,
  53. Poster
  54. },
  55. data () {
  56. return {
  57. posterBg: require('./image/poster_partner_20221104.png'),
  58. codeParams: {
  59. canvasWidth: 668,
  60. canvasHeight: 1167,
  61. partnerImgUrl: '',
  62. partnerName: '',
  63. link: '',
  64. x: 106,
  65. y: 930,
  66. width: 185,
  67. height: 185,
  68. partnerLabelY: 885,
  69. partnerImgUrlY: 855
  70. }
  71. }
  72. },
  73. computed: {
  74. ...mapGetters({
  75. userInfo: 'partnerMine/userInfo'
  76. }),
  77. searChValue: {
  78. get () {
  79. let result = ''
  80. switch (this.$route.name) {
  81. case 'partnerCustomer':
  82. result = this.$store.getters['business/searchValueOfMyCustomer']
  83. break
  84. case 'partnerAll':
  85. result = this.$store.getters['business/searchValueOfPartner']
  86. break
  87. }
  88. return result
  89. },
  90. set (val) {
  91. switch (this.$route.name) {
  92. case 'partnerCustomer':
  93. this.$store.dispatch('business/setSearchValueOfMyCustomer', val)
  94. break
  95. case 'partnerAll':
  96. this.$store.dispatch('business/setSearchValueOfPartner', val)
  97. break
  98. }
  99. }
  100. }
  101. },
  102. methods: {
  103. funJumpParterExplain () {
  104. const { partnerImgUrl, partnerName, inviteCode } = this.userInfo
  105. this.$set(this.codeParams, 'partnerImgUrl', partnerImgUrl)
  106. this.$set(this.codeParams, 'partnerName', partnerName)
  107. this.$set(this.codeParams, 'link', `${location.origin}/partner/explain?inviteCode=${inviteCode}`)
  108. this.$nextTick(() => {
  109. this.$refs.myPoster.createQRCode()
  110. })
  111. },
  112. funJump (path) {
  113. this.$router.replace({ path: path })
  114. },
  115. searchHandle () {
  116. switch (this.$route.name) {
  117. case 'partnerCustomer':
  118. this.$store.dispatch('business/setIsSearchOfMyCustomer', 1)
  119. break
  120. case 'partnerAll':
  121. this.$store.dispatch('business/setIsSearchOfPartner', 1)
  122. break
  123. }
  124. },
  125. clearHandle () {
  126. this.searchHandle()
  127. }
  128. }
  129. }
  130. </script>
  131. <style lang="scss" scoped>
  132. .conatainer {
  133. position: relative;
  134. left: 0;
  135. top: 0;
  136. display: flex;
  137. flex-direction: column;
  138. align-items: center;
  139. width: 100%;
  140. }
  141. .header {
  142. display: flex;
  143. flex-direction: column;
  144. width: 100%;
  145. padding: 24px 0 22px;
  146. .title {
  147. width: 100%;
  148. padding-left: 24px;
  149. line-height: 33px;
  150. font-size: 24px;
  151. font-weight: 500;
  152. color: #333;
  153. }
  154. .nav-wrap {
  155. display: flex;
  156. align-items: center;
  157. padding-left: 17px;
  158. margin-top: 12px;
  159. a:nth-of-type(2) {
  160. margin-left: 18px;
  161. }
  162. }
  163. img {
  164. display: block;
  165. width: 163px;
  166. height: 88px;
  167. }
  168. }
  169. .my-customer {
  170. width: 100%;
  171. margin-bottom: 12px;
  172. background: #fff;
  173. .top {
  174. display: flex;
  175. align-items: center;
  176. justify-content: space-between;
  177. padding: 10px 40px 15px 24px;
  178. @include border-bottom-1px(#E0E0E0);
  179. }
  180. .label {
  181. line-height: 25px;
  182. font-size: 18px;
  183. font-weight: 500;
  184. color: #333;
  185. }
  186. .nav-wrap {
  187. display: flex;
  188. align-items: center;
  189. }
  190. a {
  191. position: relative;
  192. left: 0;
  193. top: 0;
  194. padding: 0 9px;
  195. line-height: 22px;
  196. font-size: 16px;
  197. font-weight: 500;
  198. color: #333;
  199. &:nth-of-type(2) {
  200. margin-left: 27px;
  201. }
  202. &.active:after {
  203. position: absolute;
  204. left: 0;
  205. bottom: -2px;
  206. display: block;
  207. content: '';
  208. width: 100%;
  209. height: 2px;
  210. background: linear-gradient(90deg, #DBC3A9 0%, #C7AB8A 100%);
  211. border-radius: 2px;
  212. }
  213. }
  214. }
  215. ::v-deep .van-search {
  216. width: 327px;
  217. height: 40px;
  218. padding-left: 0;
  219. margin: 10px auto 11px;
  220. .van-search__content {
  221. border-radius: 20px;
  222. background: #F2F2F2;
  223. }
  224. .van-cell {
  225. align-items: center;
  226. }
  227. .van-icon-search {
  228. font-size: 22px;
  229. color: #DDDDDD;
  230. }
  231. .van-field__control {
  232. line-height: 17px;
  233. font-size: 12px;
  234. color: #333;
  235. overflow: hidden;
  236. background: transparent;
  237. -webkit-text-fill-color: #333;
  238. opacity: 1;
  239. &::-webkit-input-placeholder {
  240. color: #999;
  241. -webkit-text-fill-color: #999;
  242. opacity: 1;
  243. }
  244. }
  245. }
  246. </style>