1
0

app-my-share.vue 7.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245
  1. <template>
  2. <view class="app-my-share" v-if="shareInfo.parent_id"
  3. :class="fixed?'fixed':''"
  4. :style="{backgroundColor: newData.background}">
  5. <view class="share-info">
  6. <view class="headimg">
  7. <image :src="shareInfo.parent_headimg"></image>
  8. </view>
  9. <text class="nickname" :style="{color:newData.color}">{{shareInfo.parent_name}}为您服务</text>
  10. <view class="contact" @click="showQrCode" :style="{borderColor:newData.color,color:newData.color}">
  11. <image src="../../../static/image/icon/wechat-white.png"></image> 联系
  12. </view>
  13. </view>
  14. <view class="show-qrcode" v-if="showQrCodeStatus">
  15. <div class="info">
  16. <view class="close" @click="showQrCode">
  17. <image src="../../../static/image/icon/invalid.png"></image>
  18. </view>
  19. <view class="share">
  20. <view class="headimg">
  21. <image :src="shareInfo.parent_headimg"></image>
  22. </view>
  23. <view class="nickname">
  24. <view>{{shareInfo.parent_name}}</view>
  25. <view class="desc">加我微信,随时为您服务</view>
  26. </view>
  27. </view>
  28. <image class="qrcode" :src="shareInfo.parent_qr_code"></image>
  29. <view class="saoyisao">扫一扫上面的二维码图案,加我微信</view>
  30. </div>
  31. <view class="save-btn" @click="saveImg">保存二维码</view>
  32. </view>
  33. </view>
  34. <view class="app-my-share" v-else
  35. :class="fixed?'fixed':''"
  36. :style="{backgroundColor: newData.background}">
  37. <view class="share-info">
  38. <text class="nickname" :style="{color:newData.color}">{{mall.name}}</text>
  39. </view>
  40. </view>
  41. </template>
  42. <script>
  43. import {mapState, mapGetters} from 'vuex';
  44. export default {
  45. name: "app-my-share",
  46. props:{
  47. shareInfo:{
  48. type: Object,
  49. default(){
  50. return {
  51. }
  52. }
  53. },
  54. fixed: {
  55. type:Boolean,
  56. default(){
  57. return false;
  58. }
  59. },
  60. value: {
  61. type: Object,
  62. default: function() {
  63. return {
  64. background: `#efeff4`,
  65. color: '#ffffff',
  66. }
  67. }
  68. },
  69. tabBarNavs: {
  70. type: Object,
  71. default() {
  72. return {};
  73. }
  74. },
  75. mall: {
  76. type: Object,
  77. default() {
  78. return {};
  79. }
  80. },
  81. },
  82. data(){
  83. return {
  84. showQrCodeStatus: false,
  85. }
  86. },
  87. methods: {
  88. showQrCode(){
  89. console.log(this.homePages)
  90. this.showQrCodeStatus = !this.showQrCodeStatus;
  91. },
  92. saveImg(){
  93. uni.downloadFile({
  94. url: this.shareInfo.qrcode,
  95. success: (res) =>{
  96. if (res.statusCode === 200){
  97. uni.saveImageToPhotosAlbum({
  98. filePath: res.tempFilePath,
  99. success: function() {
  100. uni.showToast({
  101. title: "保存成功",
  102. icon: "none"
  103. });
  104. },
  105. fail: function() {
  106. uni.showToast({
  107. title: "保存失败",
  108. icon: "none"
  109. });
  110. }
  111. });
  112. }
  113. }
  114. });
  115. },
  116. },
  117. computed: {
  118. ...mapState('mallConfig', {
  119. setting: state => state.mall.setting
  120. }),
  121. ...mapGetters('mallConfig', {
  122. getTheme: 'getTheme',
  123. }),
  124. newData() {
  125. let value = this.value;
  126. if(this.tabBarNavs){
  127. this.value.background = this.tabBarNavs.top_background_color;
  128. this.value.top_text_color = this.tabBarNavs.top_text_color;
  129. }
  130. return value;
  131. },
  132. },
  133. }
  134. </script>
  135. <style scoped lang="scss">
  136. .app-my-share{
  137. width: 100%;
  138. height: #{124rpx};
  139. z-index: 9999999;
  140. background: #ffffff;
  141. font-size: #{26rpx};
  142. padding: 40rpx #{30rpx} 0;
  143. &.fixed{
  144. position: fixed;
  145. }
  146. .share-info{
  147. display: flex;
  148. align-items: center;
  149. height: 100%;
  150. .headimg{
  151. border-radius: 50%;
  152. width: #{50rpx};
  153. height: #{50rpx};
  154. overflow: hidden;
  155. margin-right: #{10rpx};
  156. image{
  157. width: 100%;
  158. height: 100%;
  159. }
  160. }
  161. .contact{
  162. border: #{1rpx} solid #ccc;
  163. border-radius: #{20rpx};
  164. padding: #{2rpx} #{15rpx};
  165. display: flex;
  166. align-items: center;
  167. margin-left: #{10rpx};
  168. image{
  169. width: #{30rpx};
  170. height: #{30rpx};
  171. margin-right: #{10rpx};
  172. }
  173. }
  174. }
  175. .show-qrcode{
  176. position: fixed;
  177. width: 100%;
  178. height: 100%;
  179. left: 0;
  180. top: 0;
  181. background: rgba(0,0,0,.3);
  182. padding-top: #{150rpx};
  183. display: flex;
  184. flex-direction: column;
  185. align-items: center;
  186. z-index: 999999999;
  187. image{
  188. height: 100%;
  189. width: 100%;
  190. }
  191. .info{
  192. background: #ffffff;
  193. padding: #{60rpx} #{70rpx};
  194. border-radius: #{30rpx};
  195. .close{
  196. float: right;
  197. width: #{40rpx};
  198. height: #{40rpx};
  199. position: relative;
  200. top: -30rpx;
  201. right: -30rpx;
  202. }
  203. .share{
  204. display: flex;
  205. align-items: center;
  206. margin-top: #{30rpx};
  207. .headimg{
  208. width: #{80rpx};
  209. height: #{80rpx};
  210. border-radius: 50%;
  211. overflow: hidden;
  212. }
  213. .nickname{
  214. display: flex;
  215. flex-direction: column;
  216. margin-left: #{15rpx};
  217. .desc{
  218. font-size: #{20rpx};
  219. color: #888888;
  220. }
  221. }
  222. }
  223. .qrcode{
  224. width: #{450rpx};
  225. height: #{450rpx};
  226. }
  227. .saoyisao{
  228. color: #888888;
  229. text-align: center;
  230. font-size: #{20rpx};
  231. }
  232. }
  233. .save-btn{
  234. background: #FE3666;
  235. color: #ffffff;
  236. font-size: #{28rpx};
  237. margin-top: #{40rpx};
  238. padding: #{20rpx} #{100rpx};
  239. border-radius: #{30rpx};
  240. }
  241. }
  242. }
  243. </style>