points.vue 30 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089
  1. <template>
  2. <view class="container">
  3. <view class="uni-nav-bar">
  4. <view :style="{height: statusBarHeight,width: '100%'}"></view>
  5. <view class="uni-nav-barbox">
  6. <view class="uni-nav-back" @click="$navBack()">
  7. <image src="@/static/images/back_white_icon.png" mode="aspectFill"></image>
  8. </view>
  9. <view class="uni-nav-title" style="flex: 1;text-align: center;">我的芳华币</view>
  10. </view>
  11. <image class="uni-nav-bar_bg" src="@/static/images/integral/integral_top_bg.png" mode="widthFix"></image>
  12. </view>
  13. <image class="integral_top_bg" src="@/static/images/integral/integral_top_bg.png" mode="widthFix"></image>
  14. <view class="container-body">
  15. <view class="pointsbox">
  16. <view class="pointsbox-left">
  17. <view>我的芳华币</view>
  18. <view class="pointsbox-num">
  19. <text>{{integral}}</text>
  20. <text class="pointsbox-detail" @click="handleDetail">明细</text>
  21. </view>
  22. <view class="pointsbox-desc">可抵现金{{money}}元,最高可100%抵扣</view>
  23. </view>
  24. <image class="pointsbox-right" src="@/static/images/integral/integral_img.png" mode="aspectFill"></image>
  25. </view>
  26. <view style="padding: 0 24rpx;">
  27. <!-- 签到 -->
  28. <view class="signbox box">
  29. <view class="signbox-head">
  30. <text class="box-title">连续签到领芳华币</text>
  31. <view class="signbox-head-r">已签到<text>{{signNum}}</text>天</view>
  32. </view>
  33. <view class="signbox-con">
  34. <view class="signbox-item" v-for="(item,index) in sign" :key="index">
  35. <block v-if="index<6" >
  36. <view class="imgbox">
  37. <view v-if="index + 1 <= signNum" class="signdaybox">
  38. <view class="signday">+{{item.signNum}}</view>
  39. <image src="@/static/images/integral/sign_in_on_icon.png" mode="aspectFill"></image>
  40. </view>
  41. <view v-else class="integral-box">
  42. <view class="integral-box-line">
  43. <view class="integral-box-con">
  44. +{{item.signNum}}
  45. </view>
  46. </view>
  47. </view>
  48. </view>
  49. <view :style="{color: index + 1 <= signNum ? '#FF5C03':''}">第{{index + 1}}天</view>
  50. </block>
  51. <block v-else>
  52. <view class="imgbox">
  53. <image class="imgbox" src="@/static/images/integral/gift_img.png" mode="aspectFill"></image>
  54. </view>
  55. <view :style="{color: 7 <= signNum ? '#FF5C03':''}">芳华礼包</view>
  56. </block>
  57. </view>
  58. </view>
  59. <view class="signbox-footer">
  60. <button class="signbox-footer-btn" :loading="signLoading" :disabled="signLoading" @click="doSign()">立即签到</button>
  61. </view>
  62. </view>
  63. <!-- 福利兑换 -->
  64. <view class="benefit box">
  65. <text class="box-title">福利兑换</text>
  66. <view class="benefit-box">
  67. <view class="benefit-item" v-for="(item,index) in benefitList" @click="handleMenu(item)" :key="index">
  68. <image :src="item.icon" mode="aspectFill"></image>
  69. <view>{{item.name}}</view>
  70. </view>
  71. </view>
  72. </view>
  73. <!-- 新人福利 -->
  74. <view class="task box">
  75. <text class="box-title">新人福利</text>
  76. <view class="newusertask-box task-box" v-for="(item,index) in newUserTask" :key="index">
  77. <view class="newusertask-list task-list">
  78. <image class="task-list-icon" :src="item.icon" mode="aspectFill"></image>
  79. <view class="task-list-r">
  80. <!-- <block v-if="index<newUserTask.length-1">
  81. <view v-if="index==0" class="task-btn" :class="isBindMobile?'task-btn-disable':''" @tap="handleNewTask(index)">{{isBindMobile?"已完成":"去完成"}}</view>
  82. <view v-if="index==1" class="task-btn" :class="isBindMobile?'task-btn-disable':''" @tap="handleNewTask(index)">{{isBindMobile?"已完成":"去完成"}}</view>
  83. <view v-else class="task-btn" >{{item.btntxt}}</view>
  84. </block> -->
  85. <block v-if="index==0">
  86. <view>
  87. <view class="task-title">{{item.title}}</view>
  88. <view v-html="item.desc"></view>
  89. </view>
  90. <view class="task-btn" :class="isBindMobile?'task-btn-finish':''" @tap="handleNewTask(index)">{{isBindMobile?"已完成":"去完成"}}</view>
  91. </block>
  92. <!--专家免费咨询-->
  93. <block v-else-if="index==1">
  94. <view>
  95. <view class="task-title">{{item.title}} </view>
  96. <view v-html="item.desc"></view>
  97. <view v-if="isNewUser && userBenefits.taskTwo==0" class="es-mt-5">截止时间:{{ countdownText }}</view>
  98. </view>
  99. <view v-if="isNewUser && userBenefits.taskTwo==0" class="task-btn" @tap="goToCourse()" >{{ "去完成" }}</view>
  100. <view v-else-if="userBenefits.taskTwo==1" class="task-btn task-btn-finish">{{ "已完成" }}</view>
  101. <view v-else-if="!isNewUser&& userBenefits.taskFive==0" class="task-btn task-btn-disable">{{ "已过期" }}</view>
  102. </block>
  103. <block v-else-if="index==2">
  104. <view>
  105. <view class="task-title">{{item.title}}</view>
  106. <view v-html="item.desc"></view>
  107. <view v-if="isNewUser && userBenefits.taskThree==0" class="es-mt-5">截止时间:{{countdownText}}</view>
  108. </view>
  109. <view v-if="isNewUser && userBenefits.taskThree==0" class="task-btn" @tap="loginNavTo(item.pageUrl)" >{{ "去完成" }}</view>
  110. <view v-else-if="userBenefits.taskThree==1" class="task-btn task-btn-finish">{{ "已完成" }}</view>
  111. <view v-else-if="!isNewUser&& userBenefits.taskFive==0" class="task-btn task-btn-disable">{{ "已过期" }}</view>
  112. </block>
  113. <block v-else-if="index==3">
  114. <view>
  115. <view class="task-title">{{item.title}}</view>
  116. <view v-html="item.desc"></view>
  117. <view v-if="isNewUser && userBenefits.taskTwo==0" class="es-mt-5">截止时间:{{ countdownText }}</view>
  118. </view>
  119. <view v-if="isNewUser && userBenefits.taskFour==0" class="task-btn" @tap="loginNavTo(item.pageUrl)" >{{ "去完成" }}</view>
  120. <view v-else-if="userBenefits.taskFour==1" class="task-btn task-btn-finish">{{ "已完成" }}</view>
  121. <view v-else-if="!isNewUser&& userBenefits.taskFive==0" class="task-btn task-btn-disable">{{ "已过期" }}</view>
  122. </block>
  123. <block v-else-if="index==4">
  124. <view>
  125. <view class="task-title">{{item.title}}</view>
  126. <view v-html="item.desc"></view>
  127. <view v-if="isNewUser && userBenefits.taskTwo==0" class="es-mt-5">截止时间:{{ countdownText }}</view>
  128. </view>
  129. <view v-if="isNewUser && userBenefits.taskFive==0" class="task-btn" @tap="loginNavTo(item.pageUrl)" >{{ "去完成" }}</view>
  130. <view v-else-if="userBenefits.taskFive==1" class="task-btn task-btn-finish">{{ "已完成" }}</view>
  131. <view v-else-if="!isNewUser&& userBenefits.taskFive==0" class="task-btn task-btn-disable">{{ "已过期" }}</view>
  132. </block>
  133. <block v-else>
  134. <view>
  135. <view class="task-title">{{item.title}}</view>
  136. <view v-html="item.desc"></view>
  137. </view>
  138. <view class="task-btn" v-if="item.title !='填写朋友邀请码'" @tap="loginNavTo(item.pageUrl)" >{{item.btntxt}}</view>
  139. </block>
  140. </view>
  141. </view>
  142. <view v-if="item.title =='填写朋友邀请码'" class="invitation-code">
  143. <view>
  144. <input class="input" v-model.trim="invitationCode" maxlength="50" :placeholder-style="placeholderStyle" placeholder="填码得芳华币" />
  145. </view>
  146. <button :class="!invitationCode ? 'task-btn task-btn-disable':'task-btn'" :disabled="bindLoading" :loading="bindLoading" @click="bindCode">{{item.btntxt}}</button>
  147. </view>
  148. </view>
  149. </view>
  150. <!-- 每日任务 -->
  151. <view class="task box">
  152. <text class="box-title">每日任务</text>
  153. <view class="task-box" v-for="(item,index) in taskList" :key="index">
  154. <view class="task-list">
  155. <image class="task-list-icon" :src="item.icon" mode="aspectFill"></image>
  156. <view class="task-list-r">
  157. <view>
  158. <view class="task-title">
  159. <text>{{item.title}}</text>
  160. <text class="title-tip" v-if="item.title =='邀请好友享福利'">最高一万元</text>
  161. </view>
  162. <view v-html="item.desc"></view>
  163. </view>
  164. <view class="task-btn" @tap="handleDayTask(item)">{{item.btntxt}}</view>
  165. </view>
  166. </view>
  167. <view v-if="item.title =='邀请好友享福利'" class="task-footer">
  168. <button class="task-footer-btn" @click="copyCode">
  169. <image src="@/static/images/integral/copy_icon.png" mode="aspectFill"></image>
  170. <text>复制邀请码</text>
  171. </button>
  172. <button class="task-footer-btn" style="margin-left: 22rpx;" @click="handleInvite">
  173. <image src="@/static/images/integral/weixin_icon.png" mode="aspectFill"></image>
  174. <text>邀请好友</text>
  175. </button>
  176. </view>
  177. </view>
  178. </view>
  179. </view>
  180. </view>
  181. <!-- 邀请海报 -->
  182. <uni-popup ref="invitePopup" type="center" style="z-index: 9999;">
  183. <view class="invite" @click="closepop">
  184. <image :src="downUrlImg" mode="aspectFit" show-menu-by-longpress="true" @click.stop @longpress="longpressImg"></image>
  185. <button class="downtbn" @click.stop="downImg">保存图片</button>
  186. </view>
  187. </uni-popup>
  188. </view>
  189. </template>
  190. <script>
  191. import {getDictByKey} from '@/api/common.js'
  192. import {getUserSign,getUserIntegralLogsList,doSign,getNewcomerBenefits,getDownloadPoster,invited} from '@/api/integral';
  193. import {getUserInfo} from '@/api/user'
  194. import Loading from "@/components/Loading";
  195. export default {
  196. data() {
  197. return {
  198. statusBarHeight: uni.getSystemInfoSync().statusBarHeight + 'px',
  199. signLoading: false,
  200. signList: [10,10,10,50,50,60],
  201. typeOptions:[],
  202. isDaySign:false,
  203. signNum:0,
  204. integral:0,
  205. sign:[],
  206. timer:null,
  207. user:{"phone":""},
  208. isBindMobile:false,
  209. expireTime: "",
  210. countdownText: '',
  211. userBenefits:{},
  212. isNewUser: 0,
  213. benefitList: [
  214. {
  215. icon: '/static/images/integral/go_consultation_icon.png',
  216. name: '去问诊',
  217. pageUrl:"/pages/doctor/doctorList"
  218. },{
  219. icon: '/static/images/integral/go_exchange_icon.png',
  220. name: '去兑换',
  221. pageUrl:"/pages/user/integral/integralGoodsList"
  222. },{
  223. icon: '/static/images/integral/go_buy_medicine_icon.png',
  224. name: '去购药',
  225. pageUrl:"/pages/store/packageList"
  226. },{
  227. icon: '/static/images/integral/go_change_course_icon.png',
  228. isCourse:true,
  229. name: '去换课'
  230. }
  231. ],
  232. newUserTask: [
  233. {
  234. icon: '/static/images/integral/member_icon.png',
  235. title: '10天会员限时领',
  236. desc: "首次注册,完成<span style='color:#FF5C03'>手机号绑定</span>领取",
  237. btntxt: '去完成',
  238. },{
  239. icon: '/static/images/integral/consult_icon.png',
  240. title: '专家免费咨询',
  241. desc: "观看<span style='color:#FF5C03'>10分钟</span>课程领取",
  242. btntxt: '去学习',
  243. },{
  244. icon: '/static/images/integral/first_order_icon.png',
  245. pageUrl:"/pages/store/packageList",
  246. title: '首单立返',
  247. desc: "下单后返现<span style='color:#FF5C03'>5000</span>芳华币",
  248. btntxt: '去下单',
  249. },{
  250. icon: '/static/images/integral/patient_information_icon.png',
  251. pageUrl:"/pages/user/patient",
  252. title: '填写就诊人信息',
  253. desc: "填写即送<span style='color:#FF5C03'>+1000</span>芳华币",
  254. btntxt: '去填写',
  255. },{
  256. icon: '/static/images/integral/address_icon.png',
  257. pageUrl:"/pages/user/address",
  258. title: '填写收货地址',
  259. desc: "填写即送<span style='color:#FF5C03'>+1000</span>芳华币",
  260. btntxt: '去填写',
  261. },{
  262. icon: '/static/images/integral/invitation_code_icon.png',
  263. title: '填写朋友邀请码',
  264. desc: "填码即得<span style='color:#FF5C03'>+2000</span>芳华币",
  265. btntxt: '领奖励',
  266. }
  267. ],
  268. invitationCode: "",
  269. placeholderStyle: 'font-family: PingFang SC, PingFang SC;font-weight: 400;font-size: 26rpx;color: #999999;',
  270. taskList: [
  271. {
  272. icon: '/static/images/integral/ssp_icon.png',
  273. title: '刷视频',
  274. desc: "每次浏览<span style='color:#FF5C03'>10秒</span>可获取1次芳华币",
  275. btntxt: '去逛逛',
  276. isVideo:true,
  277. },{
  278. icon: '/static/images/integral/kzb_icon.png',
  279. title: '看直播',
  280. desc: "每次浏览<span style='color:#FF5C03'>10秒</span>可获取1次芳华币",
  281. btntxt: '去观看',
  282. isLive:true,
  283. },{
  284. icon: '/static/images/integral/xxkc_icon.png',
  285. title: '学习课程',
  286. desc: "每集<span style='color:#FF5C03'>+200</span>芳华币",
  287. btntxt: '去学习',
  288. isCourse:true,
  289. },{
  290. icon: '/static/images/integral/xfdjf_icon.png',
  291. title: '消费得芳华币',
  292. desc: "实际消费满1元<span style='color:#FF5C03'>+1</span>芳华币",
  293. btntxt: '去逛逛',
  294. pageUrl:"/pages/store/packageList"
  295. },{
  296. icon: '/static/images/integral/txyysf_icon.png',
  297. title: '填写用药随访',
  298. desc: "填写即送<span style='color:#FF5C03'>+50芳华币/条</span>",
  299. btntxt: '去填写',
  300. pageUrl:"/pages/user/followList"
  301. },{
  302. icon: '/static/images/integral/fxjkzs_icon.png',
  303. title: '分享健康知识',
  304. desc: "分享至微信、朋友圈<span style='color:#FF5C03'>+10芳华币/条</span>",
  305. btntxt: '去分享',
  306. },{
  307. icon: '/static/images/integral/yqhyxfl_icon.png',
  308. title: '邀请好友享福利',
  309. desc: "先复制邀请码,再邀请好友",
  310. btntxt: '去邀请',
  311. }
  312. ],
  313. downUrlImg: "",
  314. bindLoading: false,
  315. }
  316. },
  317. computed: {
  318. money() {
  319. const num = Number(this.integral || 0) / 1000
  320. return num.toFixed(2)
  321. }
  322. },
  323. onLoad(option) {
  324. this.getDictByKey("sys_integral_log_type");
  325. this.user = this.$getUserInfo();
  326. this.isBindMobile=!this.$isEmpty(this.user.phone);
  327. this.getNewcomerBenefits();
  328. //this.getUserIntegralLogsList()
  329. },
  330. onShow() {
  331. this.getUserSign();
  332. },
  333. methods: {
  334. handleDetail() {
  335. uni.navigateTo({
  336. url: '/pages/user/integral/integralLogsList'
  337. })
  338. },
  339. getDictByKey(key){
  340. var data={key:key}
  341. getDictByKey(data).then(
  342. res => {
  343. if(res.code==200){
  344. this.typeOptions=res.data;
  345. }
  346. },
  347. err => {
  348. }
  349. );
  350. },
  351. doSign(){
  352. // if(this.isDaySign){
  353. // uni.showToast({
  354. // title:"今日已签到",
  355. // icon:"none",
  356. // duration:2000
  357. // })
  358. // return;
  359. // }
  360. uni.showLoading({
  361. title:"正在加载中..."
  362. });
  363. var data={};
  364. let that=this;
  365. doSign(data).then(res => {
  366. uni.hideLoading()
  367. if(res.code==200){
  368. uni.showToast({icon:'success',title: res.msg});
  369. setTimeout(e=>{
  370. that.getUserInfo();
  371. that.getUserSign();
  372. uni.$emit('refreshUserSign',{});
  373. },1000);
  374. }else{
  375. uni.showToast({
  376. icon:'none',
  377. title: res.msg,
  378. });
  379. }
  380. },
  381. rej => {}
  382. );
  383. },
  384. getUserSign(){
  385. getUserSign().then(res => {
  386. if(res.code==200){
  387. this.data=res.member;
  388. this.signNum=res.signNum;
  389. this.isDaySign=res.isDaySign;
  390. this.integral=res.integral;
  391. this.sign=JSON.parse(res.sign);
  392. }else{
  393. uni.showToast({
  394. icon:'none',
  395. title: "请求失败",
  396. });
  397. }
  398. },
  399. rej => {}
  400. );
  401. },
  402. getNewcomerBenefits(){
  403. getNewcomerBenefits().then(res => {
  404. if(res.code==200){
  405. this.userBenefits=res.data;
  406. console.log("qxj userBenefits:"+JSON.stringify(this.userBenefits));
  407. this.expireTime=this.$timeFormat(res.createTime,"yyyy-mm-dd hh:MM:ss");
  408. this.isNewUser=res.isNewUser;
  409. this.calculateCountdown();
  410. if(!this.timer){
  411. this.timer=setInterval(() => {
  412. this.calculateCountdown();
  413. }, 1000);
  414. }
  415. }else{
  416. uni.showToast({
  417. icon:'none',
  418. title: "请求失败",
  419. });
  420. }
  421. },
  422. rej => {}
  423. );
  424. },
  425. getUserIntegralLogsList() {
  426. let that = this;
  427. if (that.loaded == true || that.loading == true) return;
  428. that.loading = true;
  429. uni.showLoading({
  430. title:"加载中..."
  431. });
  432. getUserIntegralLogsList(that.page).then(res => {
  433. that.loading = false;
  434. that.loaded = res.data.list.length < that.page.pageSize;
  435. that.page.page = that.page.page + 1;
  436. that.list.push.apply(that.list, res.data.list);
  437. uni.hideLoading()
  438. },
  439. err => {
  440. uni.hideLoading();
  441. uni.showToast({
  442. title: err.msg ,
  443. icon: 'none',
  444. duration: 2000
  445. });
  446. }
  447. );
  448. },
  449. getUserInfo(){
  450. let that=this;
  451. getUserInfo().then(res => {
  452. if(res.code==200){
  453. if(res.user!=null){
  454. uni.setStorageSync('userInfo',JSON.stringify(res.user));
  455. this.user=res.user;
  456. }
  457. else{
  458. uni.showToast({
  459. icon:'none',
  460. title: res.msg,
  461. });
  462. }
  463. }
  464. },
  465. rej => {}
  466. );
  467. },
  468. handleMenu(item) {
  469. console.log("qxj handleMenu:"+JSON.stringify(item));
  470. if(item.isCourse!=undefined && item.isCourse){
  471. this.goToCourse();
  472. }
  473. else if(item.isVideo!=undefined && item.isVideo){
  474. uni.switchTab({url: '/pages/course/video/living-app' });
  475. }
  476. else if(item.isLive!=undefined && item.isLive){
  477. this.goToCourse();
  478. }else{
  479. this.loginNavTo(item.pageUrl);
  480. }
  481. },
  482. goToCourse(){
  483. uni.switchTab({url: '/pages/course/index' });
  484. },
  485. handleNewTask(index){ //新人福利任务
  486. },
  487. handleDayTask(item){ //每日任务
  488. if(item.isCourse!=undefined && item.isCourse){
  489. this.goToCourse();
  490. }else if(item.isVideo!=undefined && item.isVideo){
  491. uni.switchTab({url: '/pages/course/video/living-app' });
  492. }
  493. else if(item.isLive!=undefined && item.isLive){
  494. this.goToCourse();
  495. }else if(item.title == '分享健康知识') {
  496. const list = [{
  497. name: "药膳食疗",
  498. pageUrl:"/pages/article/medicatedFoodList"
  499. },
  500. {
  501. name: "经络穴位",
  502. pageUrl:"/pages/article/vesselList"
  503. }, {
  504. name: "问答专区",
  505. pageUrl:"/pages/article/questionsList"
  506. }, {
  507. name: "疾病",
  508. pageUrl:"/pages/article/diseaseList"
  509. }, {
  510. name: "中药图解",
  511. pageUrl:"/pages/article/chineseMedicineList"
  512. },
  513. {
  514. name: "名方今用",
  515. pageUrl:"/pages/article/famousPrescribeList"
  516. }, {
  517. name: "养生讲堂",
  518. pageUrl:"/pages/doctor/doctorArticleList"
  519. }, {
  520. name: "养生干货",
  521. pageUrl:"/pages/article/articleList"
  522. }]
  523. const num = Math.floor(Math.random() * list.length);
  524. this.loginNavTo(list[num].pageUrl);
  525. }else if(item.title == '邀请好友享福利'){
  526. this.handleInvite()
  527. }else{
  528. this.loginNavTo(item.pageUrl);
  529. }
  530. },
  531. calculateCountdown() {
  532. const currentTime = new Date();
  533. const expireDate = new Date(this.expireTime.replace(/-/g, '/'));
  534. const timeDiff = currentTime-expireDate ; // 时间差(毫秒)
  535. if (timeDiff > 7 * 24 * 60 * 60 * 1000) { // 如果时间差超过7天
  536. this.countdownText = '已过期';
  537. clearInterval(this.timer);
  538. } else {
  539. const days = Math.floor(timeDiff / (24 * 60 * 60 * 1000));
  540. const hours = Math.floor((timeDiff % (24 * 60 * 60 * 1000)) / (60 * 60 * 1000));
  541. const minutes = Math.floor((timeDiff % (60 * 60 * 1000)) / (60 * 1000));
  542. const seconds = Math.floor((timeDiff % (60 * 1000)) / 1000);
  543. this.countdownText = `${days}天${this.padZero(hours)}:${this.padZero(minutes)}:${this.padZero(seconds)}`;
  544. }
  545. },
  546. padZero(num) {
  547. return num < 10 ? '0' + num : num;
  548. },
  549. loginNavTo(url){
  550. if(!this.$isLogin()){
  551. this.$showLoginPage();
  552. return;
  553. }
  554. uni.navigateTo({
  555. url: url
  556. });
  557. },
  558. // 绑定邀请码领奖励
  559. bindCode() {
  560. if(!uni.$u.test.digits(this.invitationCode)) {
  561. uni.showToast({
  562. title:'请输入正确的邀请码',
  563. icon:'none'
  564. })
  565. return
  566. }
  567. this.bindLoading = true
  568. invited({userId: this.invitationCode}).then(res=>{
  569. this.bindLoading = false
  570. if(res.code == 200) {
  571. this.invitationCode = ""
  572. uni.showToast({
  573. title:'领取成功',
  574. icon:'none'
  575. })
  576. this.getUserSign();
  577. } else {
  578. uni.showToast({
  579. title:res.msg,
  580. icon:'none'
  581. })
  582. }
  583. }).catch(()=>{
  584. this.bindLoading = false
  585. })
  586. },
  587. copyCode() {
  588. let user=JSON.parse(uni.getStorageSync('userInfo')) ;
  589. uni.setClipboardData({
  590. data: user.userId,
  591. success:()=>{
  592. uni.showToast({
  593. title:'邀请码复制成功',
  594. icon:'none'
  595. })
  596. }
  597. });
  598. },
  599. // 邀请
  600. handleInvite() {
  601. uni.showLoading({
  602. title: "海报生成中"
  603. })
  604. getDownloadPoster().then(res=>{
  605. uni.hideLoading()
  606. if(res.code == 200) {
  607. this.downUrlImg = res.msg
  608. this.$refs.invitePopup.open()
  609. } else {
  610. uni.showToast({
  611. title:'生成海报失败',
  612. icon:'none'
  613. })
  614. }
  615. }).catch(()=>{
  616. uni.hideLoading()
  617. uni.showToast({
  618. title:'生成海报失败',
  619. icon:'none'
  620. })
  621. })
  622. },
  623. closepop() {
  624. this.$refs.invitePopup.close()
  625. },
  626. longpressImg() {
  627. // #ifndef MP-WEIXIN
  628. uni.showActionSheet({
  629. title: "",
  630. itemList: ["保存图片"],
  631. success: (res)=> {
  632. console.log("保存图片")
  633. this.downImg()
  634. }
  635. });
  636. // #endif
  637. },
  638. downImg() {
  639. uni.showLoading({
  640. title: "图片保存中..."
  641. })
  642. uni.downloadFile({
  643. url: this.downUrlImg,
  644. fail: function(res) {
  645. uni.showModal({
  646. title: '提示',
  647. content: '保存失败',
  648. })
  649. uni.hideLoading();
  650. },
  651. success: function(res) {
  652. var tempFilePath = res.tempFilePath;
  653. uni.saveImageToPhotosAlbum({
  654. filePath: tempFilePath,
  655. success:()=> {
  656. uni.showToast({
  657. title: "保存成功",
  658. duration: 2000
  659. })
  660. },
  661. fail:()=>{
  662. console.log("保存失败");
  663. uni.showToast({
  664. title: "保存失败",
  665. duration: 2000,
  666. icon: "error"
  667. })
  668. uni.hideLoading();
  669. },
  670. complete: function() {
  671. uni.hideLoading();
  672. }
  673. })
  674. },
  675. })
  676. }
  677. }
  678. }
  679. </script>
  680. <style lang="scss" scoped>
  681. @mixin u-flex($flexD, $alignI, $justifyC) {
  682. display: flex;
  683. flex-direction: $flexD;
  684. align-items: $alignI;
  685. justify-content: $justifyC;
  686. }
  687. .invite {
  688. width: 100vw;
  689. height: calc(100vh - var(--status-bar-height) - 88rpx);
  690. @include u-flex(column, center, center);
  691. image {
  692. width: 100%;
  693. flex: 1;
  694. }
  695. .downtbn {
  696. margin-top: 24rpx;
  697. min-width: 254rpx;
  698. min-height: 88rpx;
  699. padding: 0 16rpx;
  700. box-sizing: border-box;
  701. border-radius: 44rpx 44rpx 44rpx 44rpx;
  702. border: 2rpx solid #FF5C03;
  703. font-family: PingFang SC, PingFang SC;
  704. font-weight: 400;
  705. font-size: 32rpx;
  706. color: #FF5C03;
  707. @include u-flex(column, center, center);
  708. &::after {
  709. border: none;
  710. }
  711. }
  712. }
  713. .container {
  714. position: relative;
  715. font-family: PingFang SC, PingFang SC;
  716. font-weight: 400;
  717. font-size: 24rpx;
  718. color: #222222;
  719. &-body {
  720. position: relative;
  721. padding-top: calc(var(--status-bar-height) + 88rpx);
  722. padding-bottom: calc(var(--window-bottom) + 50rpx);
  723. }
  724. }
  725. .integral_top_bg {
  726. position: absolute;
  727. top: 0;
  728. left: 0;
  729. width: 100%;
  730. height: auto;
  731. }
  732. .uni-nav-bar {
  733. position: fixed;
  734. top: 0;
  735. left: 0;
  736. width: 100%;
  737. z-index: 999;
  738. overflow: hidden;
  739. font-family: PingFang SC, PingFang SC;
  740. font-weight: 500;
  741. color: #FFFFFF;
  742. .uni-nav-bar_bg {
  743. width: 100%;
  744. position: absolute;
  745. top: 0;
  746. left: 0;
  747. z-index: -1;
  748. }
  749. .uni-nav-barbox {
  750. width: 100%;
  751. height: 88rpx;
  752. @include u-flex(row, center, center);
  753. position: relative;
  754. font-size: 24rpx;
  755. }
  756. .uni-nav-title {
  757. /* #ifdef APP-PLUS */
  758. font-size: 34rpx;
  759. /* #endif */
  760. /* #ifndef APP-PLUS */
  761. font-size: 16px;
  762. /* #endif */
  763. }
  764. .uni-nav-back {
  765. position: absolute;
  766. bottom: 0;
  767. left: 20rpx;
  768. height: 88rpx;
  769. @include u-flex(row, center, flex-start);
  770. image {
  771. height: 58rpx;
  772. width: 58rpx;
  773. }
  774. }
  775. }
  776. .box {
  777. margin-bottom: 20rpx;
  778. padding: 28rpx 24rpx 40rpx 24rpx;
  779. box-sizing: border-box;
  780. background: #FFFFFF;
  781. border-radius: 16rpx 16rpx 16rpx 16rpx;
  782. }
  783. .box-title {
  784. font-family: PingFang SC, PingFang SC;
  785. font-weight: 600;
  786. font-size: 36rpx;
  787. color: #222222;
  788. }
  789. .pointsbox {
  790. width: 100%;
  791. padding-left: 24rpx;
  792. box-sizing: border-box;
  793. overflow: hidden;
  794. @include u-flex(row, center, space-between);
  795. &-left {
  796. font-weight: 500;
  797. font-size: 28rpx;
  798. color: #FFFFFF;
  799. }
  800. &-num {
  801. font-family: DIN, DIN;
  802. font-weight: bold;
  803. font-size: 80rpx;
  804. line-height: 60rpx;
  805. margin-top: 34rpx;
  806. margin-bottom: 34rpx;
  807. }
  808. &-detail {
  809. font-weight: 400;
  810. font-size: 24rpx;
  811. margin-left: 20rpx;
  812. text-decoration: underline;
  813. }
  814. &-desc {
  815. font-weight: 400;
  816. font-size: 24rpx;
  817. }
  818. &-right {
  819. flex-shrink: 0;
  820. width: 302rpx;
  821. height: 304rpx;
  822. margin-right: -18rpx;
  823. }
  824. }
  825. .signbox {
  826. &-head{
  827. @include u-flex(row, center, space-between);
  828. font-weight: 600;
  829. font-size: 36rpx;
  830. &-r {
  831. font-weight: 400;
  832. font-size: 26rpx;
  833. color: #757575;
  834. text {
  835. color: #FF5C03;
  836. padding: 0 10rpx;
  837. }
  838. }
  839. }
  840. &-con {
  841. margin: 38rpx 0 38rpx 0;
  842. @include u-flex(row, center, space-between);
  843. font-weight: 400;
  844. font-size: 24rpx;
  845. color: #757575;
  846. }
  847. &-item {
  848. text-align: center;
  849. .imgbox {
  850. flex-shrink: 0;
  851. height: 92rpx;
  852. width: 92rpx;
  853. margin-bottom: 4rpx;
  854. @include u-flex(row, center, center);
  855. }
  856. .signdaybox {
  857. position: relative;
  858. image {
  859. width: 24rpx;
  860. height: 24rpx;
  861. position: absolute;
  862. right: 0;
  863. bottom: 0;
  864. }
  865. }
  866. .signday {
  867. flex-shrink: 0;
  868. width: 72rpx;
  869. height: 72rpx;
  870. @include u-flex(row, center, center);
  871. box-sizing: border-box;
  872. background: #FCF0E7;
  873. border-radius: 0rpx 0rpx 0rpx 0rpx;
  874. border: 2rpx dashed rgba(255,92,3,0.5);
  875. border-radius: 50%;
  876. font-weight: 500;
  877. font-size: 22rpx;
  878. color: #FF5C03;
  879. }
  880. .integral-box {
  881. width: 72rpx;
  882. height: 72rpx;
  883. background: linear-gradient( 180deg, #FBE69B 0%, #F2A54E 100%);
  884. border-radius: 50%;
  885. @include u-flex(row, center, center);
  886. &-line {
  887. width: 64rpx;
  888. height: 64rpx;
  889. @include u-flex(row, center, center);
  890. font-weight: 500;
  891. font-size: 22rpx;
  892. color: #FFFFFF;
  893. border-radius: 50%;
  894. position: relative;
  895. background: linear-gradient(180deg, rgba(241, 161, 75, 1), rgba(249, 225, 137, 1));
  896. }
  897. &-con {
  898. width: 60rpx;
  899. height: 60rpx;
  900. border-radius: 50%;
  901. @include u-flex(row, center, center);
  902. background: linear-gradient( 180deg, #FFCD88 0%, #F4B55C 47%, #F49C49 100%);
  903. }
  904. }
  905. }
  906. &-footer {
  907. &-btn {
  908. width: 598rpx;
  909. height: 72rpx;
  910. @include u-flex(row, center, center);
  911. background: linear-gradient( 90deg, #FF5701 0%, #FFB501 100%);
  912. box-shadow: 0rpx 8rpx 8rpx 0rpx rgba(238,124,80,0.2);
  913. border-radius: 36rpx 36rpx 36rpx 36rpx;
  914. font-weight: 500;
  915. font-size: 28rpx;
  916. color: #FFFFFF;
  917. &::after {
  918. border: none;
  919. }
  920. }
  921. }
  922. }
  923. .benefit {
  924. &-box {
  925. margin-top: 38rpx;
  926. @include u-flex(row, center, space-around);
  927. }
  928. &-item {
  929. width: 104rpx;
  930. height: 104rpx;
  931. text-align: center;
  932. image {
  933. width: 64rpx;
  934. height: 64rpx;
  935. margin-bottom: 6rpx;
  936. }
  937. }
  938. }
  939. .newusertask-box {
  940. background: #FAFAFA !important;
  941. border: none !important;
  942. .task-list-icon {
  943. width: 88rpx !important;
  944. height: 88rpx !important;
  945. margin-right: 22rpx !important;
  946. }
  947. }
  948. .title-tip {
  949. min-width: 134rpx;
  950. height: 38rpx;
  951. margin-left: 8rpx;
  952. padding: 8rpx 12rpx;
  953. box-sizing: border-box;
  954. background: #FCF0E7;
  955. border-radius: 24rpx 24rpx 24rpx 24rpx;
  956. font-family: PingFang SC, PingFang SC;
  957. font-weight: 400;
  958. font-size: 22rpx;
  959. color: #FF5C03;
  960. }
  961. .task-footer {
  962. margin-top: 32rpx;
  963. margin-left: 80rpx;
  964. @include u-flex(row, center, flex-start);
  965. &-btn {
  966. width: 252rpx;
  967. height: 80rpx;
  968. margin: 0;
  969. @include u-flex(row, center, center);
  970. background: #F5F7FA;
  971. border-radius: 40rpx 40rpx 40rpx 40rpx;
  972. font-family: PingFang SC, PingFang SC;
  973. font-weight: 500;
  974. font-size: 26rpx;
  975. color: #222222;
  976. position: relative;
  977. &::after {
  978. border: none;
  979. }
  980. image {
  981. flex-shrink: 0;
  982. width: 48rpx;
  983. height: 48rpx;
  984. margin-right: 8rpx;
  985. }
  986. }
  987. }
  988. .task{
  989. &-box {
  990. padding: 24rpx;
  991. margin-top: 20rpx;
  992. background: #fff;
  993. border-radius: 16rpx 16rpx 16rpx 16rpx;
  994. border: 2rpx solid #F5F7FA;
  995. &:first-of-type {
  996. margin-top: 36rpx;
  997. }
  998. .invitation-code {
  999. margin-left: 100rpx;
  1000. margin-top: 22rpx;
  1001. margin-bottom: 16rpx;
  1002. width: 496rpx;
  1003. height: 80rpx;
  1004. padding: 8rpx 8rpx 8rpx 24rpx;
  1005. box-sizing: border-box;
  1006. background: #ECECEC;
  1007. border-radius: 40rpx 40rpx 40rpx 40rpx;
  1008. @include u-flex(row, center, space-between);
  1009. }
  1010. .input {
  1011. font-family: PingFang SC, PingFang SC;
  1012. font-weight: 400;
  1013. font-size: 26rpx;
  1014. color: #222;
  1015. }
  1016. }
  1017. &-list {
  1018. @include u-flex(row, center, space-between);
  1019. &-icon {
  1020. width: 54rpx;
  1021. height: 54rpx;
  1022. margin-right: 24rpx;
  1023. }
  1024. &-r {
  1025. flex: 1;
  1026. @include u-flex(row, center, space-between);
  1027. font-weight: 400;
  1028. font-size: 24rpx;
  1029. color: #999999;
  1030. }
  1031. }
  1032. &-title {
  1033. margin-bottom: 8rpx;
  1034. font-weight: 500;
  1035. font-size: 32rpx;
  1036. color: #222222;
  1037. line-height: 38rpx;
  1038. }
  1039. &-btn {
  1040. flex-shrink: 0;
  1041. min-width: 132rpx;
  1042. height: 64rpx;
  1043. margin: 0 0 0 12rpx;
  1044. padding:0 14rpx;
  1045. background: #FF5C03 !important;
  1046. border-radius: 32rpx 32rpx 32rpx 32rpx;
  1047. text-align: center;
  1048. @include u-flex(row, center, center);
  1049. font-weight: 500;
  1050. font-size: 28rpx;
  1051. color: #FFFFFF !important;
  1052. &::after {
  1053. border: none;
  1054. }
  1055. &-disable {
  1056. background-color: #FDAB8D !important;
  1057. }
  1058. &-finish {
  1059. background:#FAFAFA;
  1060. color:#FF5C03 ;
  1061. }
  1062. }
  1063. }
  1064. </style>