extractBookCurr.vue 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480
  1. <template>
  2. <view class="extractBook">
  3. <u-navbar :customBack="goBack" back-text="返回" title="提取书币"></u-navbar>
  4. <view class="bookCurrs">
  5. <view class="topContent">
  6. <text class="title">书币提取</text>
  7. <text style="color: #FE604F;" @click="ruleShow = true">提取规则</text>
  8. </view>
  9. <view class="bottomContent">
  10. <view class="balance">余额:{{balance}}</view>
  11. <view class="bookCurrList">
  12. <view v-for="item in bookCurrList" :key="item.id" :class="item.id === bookCurrId ? 'select' : ''" @click="selectHandle(item)">
  13. <image src="../../static/gold.png" class="goldCoins" style="width: 68rpx;" mode="heightFix"></image>
  14. <text class="reward">{{item.value}}书币</text>
  15. </view>
  16. </view>
  17. <view class="bookCurrNum">{{bookCurrNum}}书币</view>
  18. <view class="extractButton" @click="extractHandle">
  19. 立即提取
  20. </view>
  21. <navigator :url="`../extractRecord/extractRecord?mpAppId=${mpData.mpAppId}&mpOpenId=${mpData.mpOpenId}`" class="extractRecord" v-if="mpData.mpAppId" hover-class="none">提取记录</navigator>
  22. </view>
  23. </view>
  24. <view style="margin: 20rpx 20rpx 20rpx" v-if="adConfig.videoPatch">
  25. <ad-custom-view :unitId="adConfig.videoPatch" adIntervals="200"></ad-custom-view>
  26. </view>
  27. <!-- 规则弹窗 -->
  28. <u-popup v-model="ruleShow" mode="center" :closeable="true" border-radius="18" close-icon-color="#FFF" @close="ruleShow=false" custom-style="{backgroundColor: #DC8182}">
  29. <view class="popupCenter" slot="content">
  30. <view class="popupTitle">提取书币规则</view>
  31. <view class="bottom">
  32. <view>
  33. 1.用户每日可解锁书币余额“提取”功能。
  34. </view>
  35. <view>
  36. 2.解锁提取功能后,我们为您提供多个固定提取额度,具体提取额度以当日提取页面提供的具体提取额度为准。
  37. </view>
  38. <view>
  39. 3.每次提取时,您可以选择所需的其中一档提取额度进行提取,剩余书币可在下次满足前述提取额度时申请提取。
  40. </view>
  41. <view>
  42. 4.点击“书币余额提取”后,请前往公众号点击链接领取书币(链接有效期为3天)。
  43. </view>
  44. <view>
  45. 5.书币领取链接通常会在24小时内到达公众号,若点击提取书币后2小时无反应,请前往公众号发送关键字“领取书币”。
  46. </view>
  47. <view>
  48. 6.请您理解并同意如遇到双休日,节假日或提取高峰期,书币提取链接发送时间可能会延长,请您耐心等待。
  49. </view>
  50. <view>
  51. 7.本活动解释权由开发者所有,有任何疑问请联系公众号内客服。
  52. </view>
  53. </view>
  54. </view>
  55. <view class="footer" slot="footer">
  56. <view class="ad">
  57. <ad-view :unitId="adConfig.bannerAd" adIntervals="200" v-if="adConfig.bannerAd"></ad-view>
  58. </view>
  59. </view>
  60. </u-popup>
  61. <!-- 次数用完弹窗 -->
  62. <u-popup v-model="countShow" mode="center" :closeable="true" border-radius="18" close-icon-color="#000" @close="countShow=false">
  63. <view class="popupCount" slot="content">
  64. <image src="../../static/noCountGold.png" mode="heightFix"></image>
  65. <text class="title">今日次数已用完,明日再来~</text>
  66. <text class="subTitle">提醒:每日只能提取一次</text>
  67. <button type="default" class="bt" @click="countShow=false">我知道了</button>
  68. </view>
  69. <view class="footer" slot="footer">
  70. <view class="ad">
  71. <ad-view :unitId="adConfig.bannerAd" adIntervals="200" v-if="adConfig.bannerAd"></ad-view>
  72. </view>
  73. </view>
  74. </u-popup>
  75. <!-- 提取成功弹窗 -->
  76. <view class="popup" v-if="succShow">
  77. <view class="ad">
  78. <ad-view :unitId="adConfig.bannerAd" adIntervals="200" v-if="adConfig.bannerAd"></ad-view>
  79. </view>
  80. <view class="popupContent">
  81. <view class="content">
  82. <image src="../../static/popupBack.png"></image>
  83. <view class="textCon">
  84. <text class="ts">书币已提取,请前往公众号点击链接领取书币</text> </br>
  85. <view class="bt" @click="succShow=false">我知道了</view>
  86. </view>
  87. </view>
  88. <image src="../../static/close.png" class="close" mode="widthFix" @click="succShow=false"></image>
  89. </view>
  90. </view>
  91. </view>
  92. </template>
  93. /**
  94. * 体现页面
  95. *
  96. ***/
  97. <script>
  98. import { config, getBalance, getQuotaList, setCoinRemove } from '@/api/api.js'
  99. import { videoPatch, bannerAd } from '@/utils/ad_config.js'
  100. import adView from '@/components/ad-view/ad-view.vue'
  101. import adCustomView from '@/components/ad-custom-view/ad-custom-view.vue'
  102. export default {
  103. components: {
  104. adView,
  105. adCustomView
  106. },
  107. data() {
  108. return {
  109. adConfig: {
  110. videoPatch,
  111. bannerAd
  112. },
  113. ruleShow: false, // 规则弹窗控制
  114. countShow: false, // 次数用完弹窗
  115. succShow: false, // 提取成功弹窗
  116. bookCurrList: [],// 数据列表
  117. bookCurrId: undefined, // 选择充值项
  118. bookCurrNum: 0, // 选择的书币数量
  119. balance: 0, // 余额
  120. mpData: {}
  121. }
  122. },
  123. onLoad(opt) {
  124. console.log(opt)
  125. this.mpData = opt
  126. this.getList()
  127. this.getData()
  128. },
  129. onUnload() {
  130. console.log('销毁')
  131. let pages = getCurrentPages();
  132. let prevPage = pages[pages.length - 2]; //上一个页面
  133. prevPage.$vm.getBookCurr();//重点$vm
  134. },
  135. methods: {
  136. goBack() {
  137. // let pages = getCurrentPages();
  138. // let prevPage = pages[pages.length - 2]; //上一个页面
  139. // prevPage.$vm.getBookCurr();//重点$vm
  140. uni.navigateBack();
  141. },
  142. selectHandle(item) {
  143. this.bookCurrNum = item.value
  144. this.bookCurrId = item.id
  145. },
  146. getData() {
  147. getBalance({...this.mpData, appId: config.appid}).then(res => {
  148. this.balance = res.data || 0
  149. })
  150. },
  151. getList() {
  152. getQuotaList({mpAppId: this.mpData.mpAppId}).then(res => {
  153. this.bookCurrList = res.data || []
  154. if(res.data.length > 0) {
  155. this.bookCurrId = res.data[0].id
  156. this.bookCurrNum = res.data[0].value
  157. }
  158. })
  159. },
  160. /** 提现*/
  161. extractHandle() {
  162. if (this.bookCurrNum > this.balance) {
  163. uni.showToast({
  164. title: '余额不足,请选择其它数量提取',
  165. icon: 'none'
  166. })
  167. return
  168. }
  169. setCoinRemove({...this.mpData, appId: config.appid, bookCoinId: this.bookCurrId}).then(res => {
  170. switch(res.data) {
  171. case 0:
  172. this.succShow = true
  173. this.getData()
  174. break;
  175. case 1:
  176. uni.showToast({
  177. title: '提取失败, 请在公众号发送任意消息预约, 再来提取',
  178. duration: 4000,
  179. icon: 'none'
  180. })
  181. break;
  182. case 2:
  183. this.countShow = true
  184. break;
  185. }
  186. })
  187. }
  188. }
  189. }
  190. </script>
  191. <style lang="scss">
  192. page {
  193. // background-color: #F2F2F2;
  194. background-color: #FC6E53;
  195. }
  196. .extractBook {
  197. .bookCurrs {
  198. background-color: #FFFFFF;
  199. margin: 30rpx 14rpx;
  200. border-radius: 22rpx;
  201. min-height: 200rpx;
  202. padding: 20rpx 0 30rpx;
  203. box-sizing: border-box;
  204. }
  205. .topContent {
  206. padding: 0 24rpx 20rpx;
  207. border-bottom: 1rpx solid #eee;
  208. display: flex;
  209. justify-content: space-between;
  210. align-items: center;
  211. .title {
  212. font-size: 38rpx;
  213. font-weight: 600;
  214. }
  215. }
  216. .bottomContent {
  217. padding: 40rpx 24rpx 0;
  218. .balance {
  219. font-size: 38rpx;
  220. font-weight: 600;
  221. }
  222. .bookCurrNum {
  223. color: #FE604F;
  224. font-size: 38rpx;
  225. font-weight: 600;
  226. margin-top: 26rpx;
  227. }
  228. .bookCurrList {
  229. margin-top: 20rpx;
  230. display: grid;
  231. grid-template-columns: 1fr 1fr 1fr 1fr;
  232. grid-gap: 20rpx;
  233. &>view{
  234. width: 152rpx;
  235. height: 168rpx;
  236. background-color: #FFFFFF;
  237. box-shadow: 0rpx 4rpx 8rpx 0rpx rgba(182, 182, 182, 0.3);
  238. border: 2rpx solid #ececec;
  239. border-radius: 16rpx;
  240. padding: 12rpx;
  241. box-sizing: border-box;
  242. display: flex;
  243. flex-direction: column;
  244. justify-content: flex-start;
  245. align-items: center;
  246. position: relative;
  247. &.select {
  248. background: #FFF7EF;
  249. box-shadow: 0rpx 4rpx 8rpx 0rpx rgba(254, 173, 165, 0.26);
  250. border: 2rpx solid #FFB35C;
  251. .reward{
  252. color: #FE604F;
  253. }
  254. }
  255. }
  256. .goldCoins {
  257. height: 68rpx;
  258. margin: 5rpx 0;
  259. }
  260. .reward{
  261. font-size: 28rpx;
  262. font-weight: 500;
  263. color: #000000;
  264. margin-top: 16rpx;
  265. }
  266. }
  267. .extractButton {
  268. // width: 456rpx;
  269. height: 80rpx;
  270. margin-top: 60rpx;
  271. font-size: 34rpx;
  272. color: #FFFFFF;
  273. font-weight: 500;
  274. text-align: center;
  275. display: flex;
  276. justify-content: center;
  277. align-items: center;
  278. border-radius: 40rpx;
  279. // background-color: #000000;
  280. background: linear-gradient(180deg, #FDC606 0%, #FF8D12 100%);
  281. box-sizing: border-box;
  282. }
  283. .extractRecord {
  284. text-align: center;
  285. color: #5084f5;
  286. margin-top: 24rpx;
  287. }
  288. }
  289. .popupCenter {
  290. width: 650rpx;
  291. // height: 800rpx;
  292. padding: 26rpx;
  293. background-color: #DC8182;
  294. color: #FFFFFF;
  295. .popupTitle {
  296. font-size: 36rpx;
  297. font-weight: 600;
  298. color: #FFFFFF;
  299. text-align: center;
  300. }
  301. .bottom {
  302. margin-top: 30rpx;
  303. padding: 0 28rpx 30rpx;
  304. box-sizing: border-box;
  305. &> view {
  306. margin-bottom: 12rpx;
  307. font-size: 28rpx;
  308. font-weight: 400;
  309. color: #FFFFFF;
  310. line-height: 46rpx;
  311. }
  312. }
  313. }
  314. .popupCount {
  315. width: 540rpx;
  316. padding: 60rpx 0 0;
  317. // background-color: #DC8182;
  318. // color: #FFFFFF;
  319. min-height: 100rpx;
  320. display: flex;
  321. flex-direction: column;
  322. align-items: center;
  323. &>image {
  324. height: 200rpx;
  325. }
  326. &>.title {
  327. margin-top: 28rpx;
  328. font-size: 36rpx;
  329. }
  330. &>.subTitle {
  331. color: #909090;
  332. margin-top: 20rpx;
  333. font-size: 24rpx;
  334. }
  335. &>.bt {
  336. margin-top: 30rpx;
  337. width: 100%;
  338. border-radius: 0;
  339. background-color: #FFFFFF;
  340. &::after {
  341. border-top-left-radius: 0;
  342. border-top-right-radius: 0;
  343. border-left-width: 0;
  344. border-right-width: 0;
  345. border-bottom-width: 0;
  346. }
  347. }
  348. }
  349. }
  350. .popup {
  351. position: fixed;
  352. width: 100%;
  353. height: 100vh;
  354. background: rgba(0, 0, 0, 0.8);
  355. top: 0;
  356. left: 0;
  357. right: 0;
  358. bottom: 0;
  359. z-index: 999999;
  360. .popupContent {
  361. width: 632rpx;
  362. position: absolute;
  363. top: 55%;
  364. left: 50%;
  365. transform: translate(-50%, -50%);
  366. text-align: center;
  367. z-index: 99999;
  368. &>.content {
  369. position: relative;
  370. &>image {
  371. width: 100%;
  372. height: 652rpx;
  373. }
  374. &>.textCon {
  375. position: absolute;
  376. width: 100%;
  377. top: 0;
  378. left: 0;
  379. right: 0;
  380. bottom: 0;
  381. padding: 192rpx 106rpx 0;
  382. box-sizing: border-box;
  383. display: flex;
  384. align-items: center;
  385. flex-direction: column;
  386. .ts {
  387. font-size: 40rpx;
  388. font-weight: 500;
  389. color: #F5631D;
  390. }
  391. .reward {
  392. height: 60rpx;
  393. background: #FFD9A2;
  394. border-radius: 31rpx;
  395. font-size: 32rpx;
  396. font-weight: 400;
  397. display: inline-block;
  398. padding: 0 32rpx;
  399. color: #F5631E;
  400. line-height: 60rpx;
  401. margin-top: 20rpx;
  402. }
  403. .doubleBt {
  404. width: 456rpx;
  405. height: 104rpx;
  406. margin-top: 90rpx;
  407. transition: all linear .5s;
  408. }
  409. .bt {
  410. width: 386rpx;
  411. height: 104rpx;
  412. text-align: center;
  413. line-height: 104rpx;
  414. margin-top: 184rpx;
  415. font-size: 36rpx;
  416. font-weight: 400;
  417. color: rgba(131, 25, 2, 1);
  418. box-shadow: 0rpx 3rpx 4rpx 0rpx rgba(211, 63, 22, 0.58);
  419. background-color: #fede77;
  420. border-radius: 52rpx;
  421. }
  422. }
  423. }
  424. &>.close {
  425. width: 54rpx;
  426. height: 54rpx;
  427. margin-top: 56rpx;
  428. }
  429. }
  430. .ad {
  431. position: absolute;
  432. top: 50rpx;
  433. width: 750rpx;
  434. padding: 0 30rpx;
  435. box-sizing: border-box;
  436. }
  437. }
  438. .footer {
  439. padding: 0 30rpx 28rpx;
  440. box-sizing: border-box;
  441. }
  442. </style>