points.vue 34 KB

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