cm-seller-modal.vue 7.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234
  1. <template>
  2. <view class="seller-card" v-if="userId > 0">
  3. <view class="seller-card-mine" v-if="!modal" @click="changeModal">
  4. <image
  5. :src="
  6. userInfo.image && userInfo.image.length > 12
  7. ? userInfo.image
  8. : 'https://static.caimei365.com/app/img/icon/default-head-new.png'
  9. "
  10. style="width: 100%;height: 100%;object-fit: contain;border-radius: 50%;"
  11. mode=""
  12. ></image>
  13. </view>
  14. <tui-modal class="sellerMode" @cancel="hideModal" :show="modal" custom>
  15. <view class="tui-modal-custom">
  16. <view class="close" @click="changeModal">
  17. <image
  18. src="https://static.caimei365.com/app/img/supplier-login/close.png"
  19. style="width: 100%;height: 100%;"
  20. mode=""
  21. ></image>
  22. </view>
  23. <view class="card" :style="{ backgroundImage: `url(${imgUrl})`, backgroundSize: '100% 100%' }">
  24. <view class="logo">
  25. <image
  26. src="https://static.caimei365.com/app/img/icon/logo-fanbai.png"
  27. mode=""
  28. class="titleImgUrl"
  29. ></image>
  30. </view>
  31. <view class="card-contain">
  32. <view style="display: flex;">
  33. <view class="card-head">
  34. <image
  35. :src="
  36. userInfo.image && userInfo.image.length > 12
  37. ? userInfo.image
  38. : 'https://static.caimei365.com/app/img/icon/default-head-new.png'
  39. "
  40. mode=""
  41. class="head"
  42. ></image>
  43. </view>
  44. <view class="card-info">
  45. <view class="card-info-head">
  46. <view class="card-name">{{ userInfo.linkMan }}</view>
  47. <view class="card-info-tab">客户经理</view>
  48. </view>
  49. <view class="card-info-iphone">
  50. {{
  51. userInfo.contractMobile &&
  52. userInfo.contractMobile.replace(/(?=(\d{4})+$)/g, '-')
  53. }}
  54. </view>
  55. </view>
  56. </view>
  57. <view class="card-qrcode">
  58. <view class="qrcode-message">
  59. <image
  60. :show-menu-by-longpress="true"
  61. :src="userInfo.qrCode || ''"
  62. class="qrcode"
  63. mode=""
  64. ></image>
  65. </view>
  66. <view class="tips">
  67. <view>长按或扫二维码</view>
  68. <view style="white-space: nowrap;">——联系我——</view>
  69. </view>
  70. </view>
  71. </view>
  72. </view>
  73. </view>
  74. </tui-modal>
  75. </view>
  76. </template>
  77. <script>
  78. export default {
  79. props: {
  80. suid: {
  81. type: Number,
  82. default: 0
  83. }
  84. },
  85. data() {
  86. return {
  87. modal: false,
  88. imgUrl: 'https://static.caimei365.com/app/img/icon/bg-card.png',
  89. userInfo: {},
  90. userId: ''
  91. }
  92. },
  93. mounted() {
  94. if (!uni.getStorageSync('sellerCardChange')) {
  95. uni.setStorageSync('sellerCardChange', 1)
  96. }
  97. this.initData()
  98. },
  99. methods: {
  100. hideModal() {
  101. this.modal = false
  102. uni.setStorageSync('sellerCardChange', 2)
  103. },
  104. initData() {
  105. this.userId = this.suid || uni.getStorageSync('suid')
  106. if(this.userId > 0) {
  107. this.getUserInfo()
  108. if (uni.getStorageSync('sellerCardChange') === 1) {
  109. this.modal = true
  110. } else {
  111. this.modal = false
  112. }
  113. }
  114. },
  115. async getUserInfo() {
  116. const { data } = await this.SellerService.GetSellerHome({ userId: this.userId })
  117. this.userInfo = data
  118. },
  119. changeModal() {
  120. this.modal = !this.modal
  121. uni.setStorageSync('sellerCardChange', this.modal ? 1 : 2)
  122. }
  123. }
  124. }
  125. </script>
  126. <style lang="scss" scoped>
  127. .seller-card-mine {
  128. position: fixed;
  129. right: 20rpx;
  130. width: 80rpx;
  131. height: 80rpx;
  132. z-index: 99;
  133. bottom: 460rpx;
  134. border-radius: 50%;
  135. &::after {
  136. content: '客户经理';
  137. width: 100rpx;
  138. height: 30rpx;
  139. position: absolute;
  140. color: #fff;
  141. font-size: 18rpx;
  142. font-weight: bold;
  143. background-color: #ff5b00;
  144. bottom: 0;
  145. left: 0;
  146. border-radius: 20rpx;
  147. text-align: center;
  148. line-height: 30rpx;
  149. box-shadow: 0rpx 3rpx 6rpx 1rpx rgba(255, 92, 0, 0.16);
  150. transform: translate(-12%, 70%);
  151. }
  152. }
  153. .tui-modal-custom {
  154. .close {
  155. position: fixed;
  156. right: -20px;
  157. top: -200rpx;
  158. width: 60rpx;
  159. height: 60rpx;
  160. }
  161. }
  162. .card {
  163. position: fixed;
  164. left: -34rpx;
  165. top: -150%;
  166. width: 702rpx;
  167. height: 340rpx;
  168. background: #ff5b00;
  169. border-radius: 16rpx;
  170. opacity: 1;
  171. margin: 0 auto;
  172. box-sizing: border-box;
  173. padding: 16rpx 32rpx;
  174. .titleImgUrl {
  175. width: 241rpx;
  176. height: 80rpx;
  177. }
  178. .card-contain {
  179. display: flex;
  180. align-items: center;
  181. justify-content: space-between;
  182. .head {
  183. width: 128rpx;
  184. height: 128rpx;
  185. border-radius: 50%;
  186. object-fit: contain;
  187. }
  188. .card-info {
  189. height: 128rpx;
  190. margin-left: 30rpx;
  191. }
  192. .card-info-head {
  193. display: flex;
  194. align-items: center;
  195. margin-bottom: 13rpx;
  196. .card-name {
  197. color: #ffffff;
  198. font-size: 40rpx;
  199. font-weight: bold;
  200. }
  201. .card-info-tab {
  202. width: 88rpx;
  203. height: 31rpx;
  204. background-color: #ffbb00;
  205. color: #fff;
  206. font-size: 22rpx;
  207. padding: 0 8rpx;
  208. margin-left: 10rpx;
  209. }
  210. }
  211. .card-info-iphone {
  212. color: #ffffff;
  213. font-size: 28rpx;
  214. }
  215. .card-qrcode {
  216. .qrcode {
  217. width: 126rpx;
  218. height: 126rpx;
  219. object-fit: contain;
  220. margin-bottom: 6rpx;
  221. }
  222. .tips {
  223. font-size: 18rpx;
  224. color: #fff;
  225. text-align: center;
  226. width: 126rpx;
  227. line-height: 24rpx;
  228. }
  229. }
  230. }
  231. }
  232. </style>