invite.vue 8.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336
  1. <template>
  2. <view class="page">
  3. <view class="qr-card">
  4. <view class="title">
  5. 邀请好友加入慧研学惠生活
  6. </view>
  7. <view class="qrcode-box">
  8. <u--image width="360rpx" height="360rpx" :src="src">
  9. <template v-slot:loading>
  10. <u-loading-icon size="56rpx" color="#0C6FFE"></u-loading-icon>
  11. </template>
  12. </u--image>
  13. </view>
  14. <view class="save-btn">
  15. <view style="width: 480rpx">
  16. <u-button shape="circle" @click="save">保存二维码</u-button>
  17. </view>
  18. </view>
  19. </view>
  20. <view class="rules">
  21. <view class="title">
  22. 慧研学惠生活用户邀请活动奖励规则
  23. </view>
  24. <view class="rules-content">
  25. <view class="sub-title">
  26. 一、返利激励机制
  27. </view>
  28. <view class="label">
  29. 1. 订购奖励:
  30. </view>
  31. <view class="value">
  32. 当被推荐的新用户首次订购慧研学惠生活任意档会员,推荐者将从新用户订购期内的月会员费中获得10%的返利激励;
  33. </view>
  34. <view class="label">
  35. 2. 持续激励:
  36. </view>
  37. <view class="value">
  38. 被推荐的新用户持续订购会员,推荐者每月都能享受返利;
  39. </view>
  40. <view class="label">
  41. 3. 推荐人数无上限:
  42. </view>
  43. <view class="value">
  44. 每个慧研学惠生活用户可以推荐的新用户人数没有上限;
  45. </view>
  46. <view class="label">
  47. 4. 停止激励:
  48. </view>
  49. <view class="value">
  50. 新用户在取消会员订购后,推荐者停止获得返利;
  51. </view>
  52. <view class="label">
  53. 5. 取消后再订购:
  54. </view>
  55. <view class="value">
  56. 新用户在取消会员订购后再次订购会员,原推荐者无法继续获得返利;
  57. </view>
  58. <view class="sub-title">
  59. 二、返利发放条件与时间
  60. </view>
  61. <view class="label">
  62. 1. 新用户定义:
  63. </view>
  64. <view class="value">
  65. 被邀请者须是邀请前未注册、登录过慧研学惠生活平台的用户。
  66. </view>
  67. <view class="label">
  68. 2. 确认订购:
  69. </view>
  70. <view class="value">
  71. 新用户被邀请后的48小时内订购成功,且在5天内无退订行为,系统将自动确认发放返利资格。
  72. </view>
  73. <view class="label">
  74. 3. 发放时间:
  75. </view>
  76. <view class="value">
  77. 当月返利将在次月发放至慧研学惠生活个人账号。
  78. </view>
  79. <view class="label">
  80. 4. 提现时间:
  81. </view>
  82. <view class="value">
  83. 每月25日,推荐者可进行上月返利的提现操作。
  84. </view>
  85. <text>
  86. *最终解释权归本平台所有。
  87. </text>
  88. </view>
  89. </view>
  90. </view>
  91. </template>
  92. <script>
  93. import { BASE_URL } from '@/utils/config.js'
  94. export default {
  95. data() {
  96. return {
  97. src: '',
  98. userInfo: {}
  99. }
  100. },
  101. methods: {
  102. save() {
  103. // uni.getImageInfo({
  104. // src:this.src,
  105. // success: function (image) {
  106. // uni.saveImageToPhotosAlbum({
  107. // filePath:image.path
  108. // })
  109. // }
  110. // })
  111. uni.showLoading({
  112. title: '正在保存图片...'
  113. });
  114. //获取用户的当前设置。获取相册权限
  115. uni.getSetting({
  116. success: (res) => {
  117. //如果没有相册权限
  118. if (!res.authSetting["scope.writePhotosAlbum"]) {
  119. //向用户发起授权请求
  120. uni.authorize({
  121. scope: "scope.writePhotosAlbum",
  122. success: () => {
  123. //授权成功保存图片到系统相册
  124. // uni.saveImageToPhotosAlbum({
  125. // //图片路径,不支持网络图片路径
  126. // filePath: url,
  127. // success: (res) => {
  128. // uni.hideLoading();
  129. // return uni.showToast({
  130. // title: "保存成功!",
  131. // });
  132. // },
  133. // fail: (res) => {
  134. // console.log(res.errMsg);
  135. // return uni.showToast({
  136. // title: res.errMsg,
  137. // });
  138. // },
  139. // complete: (res) => { uni.hideLoading(); },
  140. // });
  141. console.log(this.src.slice(22))
  142. console.log(this.src)
  143. console.log(wx.env.USER_DATA_PATH + '/pic' + number + '.png')
  144. const number = Math.random()
  145. wx.getFileSystemManager().writeFile({
  146. filePath: wx.env.USER_DATA_PATH + '/pic' + number + '.png',
  147. data: this.src.slice(22),
  148. encoding: 'base64',
  149. success: res => {
  150. wx.saveImageToPhotosAlbum({
  151. filePath: wx.env.USER_DATA_PATH + '/pic' + number + '.png',
  152. success: function (res) {
  153. wx.showToast({ title: '保存成功', })
  154. },
  155. fail: function (err) {
  156. console.log(err)
  157. }
  158. })
  159. console.log(res)
  160. }, fail: err => {
  161. console.log(err)
  162. }
  163. })
  164. },
  165. //授权失败
  166. fail: () => {
  167. uni.hideLoading();
  168. uni.showModal({
  169. title: "您已拒绝获取相册权限",
  170. content: "是否进入权限管理,调整授权?",
  171. success: (res) => {
  172. if (res.confirm) {
  173. //调起客户端小程序设置界面,返回用户设置的操作结果。(重新让用户授权)
  174. uni.openSetting({
  175. success: (res) => {
  176. console.log(res.authSetting);
  177. },
  178. });
  179. } else if (res.cancel) {
  180. return uni.showToast({
  181. title: "已取消!",
  182. });
  183. }
  184. },
  185. });
  186. },
  187. });
  188. } else {
  189. //如果已有相册权限,直接保存图片到系统相册
  190. // uni.saveImageToPhotosAlbum({
  191. // filePath: url,
  192. // success: (res) => {
  193. // uni.hideLoading();
  194. // return uni.showToast({
  195. // title: "保存成功!",
  196. // });
  197. // },
  198. // fail: (res) => {
  199. // uni.hideLoading();
  200. // console.log(res.errMsg);
  201. // return uni.showToast({
  202. // title: res.errMsg,
  203. // });
  204. // },
  205. // //无论成功失败都走的回调
  206. // complete: (res) => { uni.hideLoading(); },
  207. // });
  208. const number = Math.random()
  209. wx.getFileSystemManager().writeFile({
  210. filePath: wx.env.USER_DATA_PATH + '/pic' + number + '.png',
  211. data: this.src.slice(22),
  212. encoding: 'base64',
  213. success: res => {
  214. wx.saveImageToPhotosAlbum({
  215. filePath: wx.env.USER_DATA_PATH + '/pic' + number + '.png',
  216. success: function (res) {
  217. wx.showToast({ title: '保存成功', })
  218. },
  219. fail: function (err) {
  220. console.log(err)
  221. }
  222. })
  223. console.log(res)
  224. }, fail: err => {
  225. console.log(err)
  226. }
  227. })
  228. }
  229. },
  230. fail: (res) => { },
  231. });
  232. },
  233. },
  234. created() {
  235. this.userInfo = JSON.parse(uni.getStorageSync('userInfo'))
  236. uni.request({
  237. url: BASE_URL + '/zswl-cloud-bdb/promotion/qrcode',
  238. method: "post",
  239. data: {
  240. "scene": JSON.parse(uni.getStorageSync('userInfo')).userId,
  241. },
  242. responseType: 'arraybuffer'
  243. }).then(res => {
  244. this.src = 'data:image/png;base64,' + uni.arrayBufferToBase64(res.data)
  245. })
  246. }
  247. }
  248. </script>
  249. <style lang="scss" scoped>
  250. .page {
  251. background: #F9F9F9;
  252. min-height: 100vh;
  253. padding: 24rpx 20rpx;
  254. .qr-card {
  255. padding: 42rpx;
  256. display: flex;
  257. flex-direction: column;
  258. justify-items: center;
  259. justify-content: center;
  260. background: #FFFFFF;
  261. border-radius: 16rpx;
  262. .title {
  263. font-size: 36rpx;
  264. color: #222222;
  265. font-weight: Bold;
  266. margin-bottom: 36rpx;
  267. text-align: center;
  268. }
  269. .qrcode-box {
  270. display: flex;
  271. justify-content: center;
  272. margin-bottom: 78rpx;
  273. }
  274. .save-btn {
  275. display: flex;
  276. justify-content: center;
  277. margin-bottom: 16rpx;
  278. }
  279. }
  280. .rules {
  281. color: #222222;
  282. font-size: 36rpx;
  283. font-weight: Bold;
  284. margin-top: 30rpx;
  285. background: #FFFFFF;
  286. border-radius: 16rpx;
  287. padding: 30rpx 24rpx;
  288. .sub-title{
  289. font-weight: bold;
  290. font-size: 28rpx;
  291. color: #222222;
  292. margin-bottom: 20rpx;
  293. margin-top: 20rpx;
  294. }
  295. .label{
  296. color: #222222!important;
  297. margin: 20rpx 0 10rpx 0;
  298. font-size: 28rpx;
  299. }
  300. .rules-content {
  301. color: #CCCCCC;
  302. font-size: 28rpx;
  303. margin-top: 16rpx;
  304. font-weight: 400;
  305. }
  306. }
  307. }
  308. </style>