points.vue 34 KB

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