upgradeTask.vue 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659
  1. <template>
  2. <view class="page">
  3. <!-- 页面背景图 -->
  4. <image class="backimage" src="/static/image/my/upgradeTask/back.png" mode=""></image>
  5. <!-- 头部标题 -->
  6. <view class="headers dis a-c j-start">
  7. <u-icon name="arrow-left" color="#333" size="38" @tap="back" :custom-style="{fontWeight:'bold'}"></u-icon>
  8. <text style="margin: auto;">升级任务</text>
  9. </view>
  10. <!-- 升级任务 -->
  11. <view class="contentArea">
  12. <!-- 装饰图 -->
  13. <view class="decoration dis a-c j-s">
  14. <view class="dis f-c">
  15. <image class="textimg" src="/static/image/my/upgradeTask/text.png" mode=""></image>
  16. <text class="text">完成任务 解锁更高等级身份</text>
  17. </view>
  18. <image class="logo" src="/static/image/my/upgradeTask/logo.png" mode=""></image>
  19. </view>
  20. <!-- 内容部分 -->
  21. <view class="Area"
  22. :style="{height:info.lockingState == '2'?'':'calc(100vh - 450rpx)',borderRadius: info.lockingState == '2'?'20rpx':'20rpx 20rpx 0 0 '}">
  23. <view class="header dis a-c ">
  24. <image class="logo" src="/static/image/my/upgradeTask/decoration1.png" mode=""></image>
  25. <view class="title">
  26. <text class="text">升级任务</text>
  27. <image class="line" src="/static/image/my/upgradeTask/decoration2.png" mode=""></image>
  28. </view>
  29. </view>
  30. <view class="message dis a-c j-c">{{upgradeTaskdata.assessmentEndDate}}前
  31. 满足下列{{upgradeTaskdata.appraise=='1'?'全部条件':'任意一条'}}即可升级
  32. </view>
  33. <!-- 任务列表 -->
  34. <view class="task mt-4 dis f-c ">
  35. <view class="item dis a-c j-s " v-if="item.checked" v-for="(item,index) in displayData"
  36. :key="item.id">
  37. <view class="task-icon">
  38. <image :src="`/static/image/my/upgradeTask/icon${index+1}.png`" mode=""></image>
  39. </view>
  40. <view class="task-progress">
  41. <!-- 任务标题 -->
  42. <text class="title " v-if="upgradeTaskdata.grade=='2'">
  43. {{ index==0 ? '邀请合伙人' :index==1? `${upgradeTaskdata.gradeName}下属成员出单保费`:'自己的出单保费' }}达{{item.min}}{{ index ? '元' : '人' }}
  44. </text>
  45. <text class="title " v-if="upgradeTaskdata.grade=='3'">
  46. {{ index==0 ? '邀请工作室' :index==1? `${upgradeTaskdata.gradeName}下属成员出单保费`:'自己的出单保费' }}达{{item.min}}{{ index ? '元' : '人' }}
  47. </text>
  48. <text class="title " v-if="upgradeTaskdata.grade=='4'">
  49. {{ index==0 ? '邀请团队长' :index==1? `${upgradeTaskdata.gradeName}下属成员出单保费`:'自己的出单保费' }}达{{item.min}}{{ index ? '元' : '人' }}
  50. </text>
  51. <text class="title " v-if="upgradeTaskdata.grade=='5'">
  52. {{ index==0 ? '邀请团队长' :index==1? `${upgradeTaskdata.gradeName}下属成员出单保费`:'自己的出单保费' }}达{{item.min}}{{ index ? '元' : '人' }}
  53. </text>
  54. <view class=" dis a-c">
  55. <!-- 进度条 -->
  56. <view class="progressBar">
  57. <view class="jindu"
  58. :style="{width: `${ Number(item.achieve) / Number(item.min) * 100}%`}">
  59. </view>
  60. </view>
  61. <!-- 进度条 -->
  62. <view class="task-data dis a-c ml-1">
  63. <text>{{item.achieve}}</text>
  64. <text class="ml-1 mr-1">/</text>
  65. <text>{{item.min}}</text>
  66. </view>
  67. </view>
  68. </view>
  69. <view :class="index==1?'task-btn1':'task-btn'" v-if="Number(item.achieve)>=Number(item.min)">
  70. 已完成
  71. </view>
  72. <view :class="index==1?'task-btn1':'task-btn'" v-else @click="incompleteTaskRedirect(index)">
  73. {{index==1?'未完成':'去完成'}}
  74. </view>
  75. </view>
  76. </view>
  77. </view>
  78. </view>
  79. <!-- 购买等级 -->
  80. <view class="purchaseLevels dis a-c j-c" v-if="info.lockingState == '2'">
  81. <view class="purchaseLevel">
  82. <!-- 头部 -->
  83. <view class="header dis a-c j-c mb-3">
  84. <!-- 星星装饰图 -->
  85. <image class="star" src="/static/image/my/upgradeTask/star-left.png" mode=""></image>
  86. <view class="title ">
  87. <text>满足升级条件或直接联系客服购买该等级</text>
  88. <view class="line"></view>
  89. </view>
  90. <image class="star" src="/static/image/my/upgradeTask/star-right.png" mode=""></image>
  91. </view>
  92. <!-- 内容 -->
  93. <view class="dis a-c j-s">
  94. <!-- 左侧红包样式 -->
  95. <view class="redPacket">
  96. <!-- 红包图片 -->
  97. <image class="redPacket-img" src="/static/image/my/upgradeTask/redPacket.png" mode="">
  98. </image>
  99. <!-- 锁定样式 -->
  100. <view class="lock">
  101. <image class="lock-img" src="/static/image/my/upgradeTask/lock.png" mode=""></image>
  102. </view>
  103. </view>
  104. <view class="redPacket-data dis f-c">
  105. <view class="dis a-c ">
  106. <text class="sum">¥{{info.lockCommission || 0 }}</text>
  107. <text class="days">(已锁定 {{info.zeroDays}}天清0)</text>
  108. </view>
  109. <text class="ml-1" style="font-size: 26rpx;color: #999;">支付<text
  110. style="color: #FFA008;">{{info.fallAmount}}</text>
  111. 元可解锁</text>
  112. </view>
  113. <view class="btn" @click="clickToUnlock">去解锁</view>
  114. </view>
  115. </view>
  116. </view>
  117. <u-popup v-model="contactServiceShow" mode="bottom" border-radius="20" :closeable="true">
  118. <view class=" dis a-c j-c " style="border-bottom: 1rpx solid #eee;padding: 16rpx;box-sizing: border-box;">
  119. <text class="font-weight" style="font-size: 36rpx;color: #333;">联系客服</text>
  120. </view>
  121. <view class="contactService dis a-c f-c">
  122. <!-- <view class="panelcanvas " id="panelcanvas">
  123. <image :src="serviceQRCodeImg" mode="widthFix" lazy-load></image>
  124. </view> -->
  125. <image :src="serviceQRCodeImg" mode=""></image>
  126. <view class="Servicebtn dis j-c" @click="saveImage">保存到相册</view>
  127. </view>
  128. </u-popup>
  129. </view>
  130. </template>
  131. <script>
  132. import {
  133. pathToBase64,
  134. base64ToPath
  135. } from '@/common/pdf.js'
  136. import QR from "@/common/wxqrcode.js"
  137. export default {
  138. data() {
  139. return {
  140. posterUrl: "", //二维码截图
  141. contactServiceShow: false, //客服弹窗
  142. serviceQRCodeImg: "",
  143. info: {}, //上个页面传参
  144. upgradeTaskdata: {}, //升级任务
  145. }
  146. },
  147. onShow() {
  148. },
  149. async onLoad(options) {
  150. let serviceQRCoderes = await this.$http.get('/partner/contactCustomerService')
  151. if (serviceQRCoderes.code == 200) {
  152. this.serviceQRCodeImg = serviceQRCoderes.msg;
  153. }
  154. this.info = JSON.parse(options.info);
  155. console.log(this.info);
  156. if (this.info.lockingState == '2') {
  157. let res = await this.$http.get('/partner/degradedTask?grade=' + this.info.grade); //保级任务
  158. this.upgradeTaskdata = res.data;
  159. } else {
  160. let grade = Number(this.info.grade + 1);
  161. let res = await this.$http.get('/partner/queryDowngradeTask?grade=' + grade); //升级任务
  162. this.upgradeTaskdata = res.data;
  163. }
  164. this.upgradeTaskdata.assessmentEndDate = this.formatDate(this.upgradeTaskdata.assessmentEndDate);
  165. },
  166. computed: {
  167. displayData() {
  168. if (this.upgradeTaskdata.requirement && this.upgradeTaskdata.requirement.length > 0) {
  169. return this.upgradeTaskdata.requirement;
  170. } else if (this.upgradeTaskdata.strategyArray && this.upgradeTaskdata.strategyArray.length > 0) {
  171. return this.upgradeTaskdata.strategyArray;
  172. }
  173. return []; // 或者返回默认数据
  174. }
  175. },
  176. methods: {
  177. //未完成任务跳转函数
  178. incompleteTaskRedirect(index) {
  179. switch (index) {
  180. case 0:
  181. uni.navigateTo({
  182. url: "/pages/institutional/invitationCode?grade=" + this.info.grade + "&info=" + JSON
  183. .stringify(this.info),
  184. })
  185. break;
  186. case 2:
  187. // 唤醒指定app
  188. if (plus.runtime.isApplicationExist({ //判断应用是否安装
  189. pname: 'uni.UNID4FE29A1' //包名
  190. })) {
  191. plus.runtime.launchApplication({ //调用三方程序
  192. pname: 'uni.UNID4FE29A',
  193. extra: {} // 可选参数
  194. }, (e) => {
  195. uni.showToast({
  196. title: '打开失败:' + e.message,
  197. icon: 'none',
  198. });
  199. });
  200. } else {
  201. if (typeof plus !== 'undefined') {
  202. const main = plus.android.runtimeMainActivity();
  203. const Intent = plus.android.importClass('android.content.Intent');
  204. const Uri = plus.android.importClass('android.net.Uri');
  205. const intent = new Intent(Intent.ACTION_VIEW, Uri.parse(
  206. 'https://sxzgkj.baoxianzhanggui.com/h5/#/'));
  207. intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
  208. if (main) {
  209. const chooser = Intent.createChooser(intent, "选择应用打开链接");
  210. try {
  211. main.startActivity(chooser);
  212. } catch (error) {
  213. console.error("打开选择应用对话框失败: ", error);
  214. }
  215. }
  216. } else {
  217. alert('请在真机环境中测试该功能');
  218. }
  219. }
  220. break;
  221. default:
  222. }
  223. },
  224. //日期格式化
  225. formatDate(dateStr) {
  226. const [year, month, day] = dateStr.split("-");
  227. return `${year}年${parseInt(month)}月${parseInt(day)}日`
  228. },
  229. //点击解锁生成二维码截图
  230. clickToUnlock() {
  231. this.contactServiceShow = true;
  232. },
  233. //保存图片
  234. saveImage() {
  235. base64ToPath(this.serviceQRCodeImg)
  236. .then(path => {
  237. uni.saveImageToPhotosAlbum({ //保存图片到系统相册。
  238. filePath: path, //图片文件路径
  239. success: function() {
  240. uni.showToast({
  241. title: '已保存到相册',
  242. icon: 'none',
  243. });
  244. },
  245. fail: function(e) {
  246. uni.showToast({
  247. title: '图片保存失败',
  248. icon: 'none',
  249. });
  250. }
  251. });
  252. })
  253. },
  254. back() {
  255. uni.navigateBack({
  256. delta: 1, // 返回的页面数,如果是1表示返回上一页
  257. success: function() {}
  258. });
  259. },
  260. //页面截图转路径
  261. receiveRenderData(val) {
  262. this.posterUrl = val.replace(/[\r\n]/g, ''); // 去除base64位中的空格
  263. // 将base64转化为临时地址
  264. // base64ToPath(imageStr).then(path => {
  265. // this.payImg = path;
  266. // }).catch(error => {
  267. // console.log(error);
  268. // });
  269. },
  270. showLoading() {
  271. uni.showLoading({
  272. title: '正在生成图片'
  273. });
  274. },
  275. hideLoading() {
  276. uni.hideLoading();
  277. },
  278. }
  279. }
  280. </script>
  281. <script module="canvasImage" lang="renderjs">
  282. import html2canvas from 'html2canvas'
  283. export default {
  284. data() {
  285. return {
  286. }
  287. },
  288. mounted() {
  289. },
  290. methods: {
  291. generateImage() {
  292. setTimeout(() => {
  293. this.$ownerInstance.callMethod('showLoading')
  294. const dom = document.getElementById('panelcanvas') // 需要生成图片内容的 dom 节点
  295. html2canvas(dom, {
  296. width: dom.clientWidth, //dom 原始宽度
  297. height: dom.clientHeight,
  298. scrollY: 0, // html2canvas默认绘制视图内的页面,需要把scrollY,scrollX设置为0
  299. scrollX: 0,
  300. useCORS: true, //支持跨域
  301. // allowTaint: false,
  302. scale: 2, // 设置生成图片的像素比例,默认是1,如果生成的图片模糊的话可以开启该配置项
  303. }).then((canvas) => {
  304. // 生成成功
  305. this.$ownerInstance.callMethod('hideLoading')
  306. this.$ownerInstance.callMethod('receiveRenderData', canvas.toDataURL('image/png'))
  307. }).catch(err => {
  308. // 生成失败 弹出提示弹窗
  309. this.$ownerInstance.callMethod('_errAlert', `【生成图片失败,请重试】${err}`)
  310. })
  311. }, 300)
  312. }
  313. },
  314. }
  315. </script>
  316. <style lang="scss" scoped>
  317. .page {
  318. background-color: #f8f8f8;
  319. height: calc(100vh);
  320. }
  321. .backimage {
  322. width: 100%;
  323. height: 702rpx;
  324. position: absolute;
  325. left: 0;
  326. top: 0;
  327. }
  328. .headers {
  329. position: fixed;
  330. top: 0;
  331. left: 0;
  332. height: auto;
  333. width: 100%;
  334. z-index: 999999;
  335. padding: 108rpx 30rpx 20rpx;
  336. text {
  337. font-size: 36rpx;
  338. font-weight: bold;
  339. color: #000;
  340. }
  341. .headers-activeTab {
  342. width: 80%;
  343. }
  344. }
  345. .contentArea {
  346. padding: 176rpx 30rpx 20rpx;
  347. box-sizing: border-box;
  348. position: relative;
  349. .decoration {
  350. .textimg {
  351. width: 348rpx;
  352. height: 76rpx;
  353. margin-top: 20rpx;
  354. }
  355. .text {
  356. font-size: 30rpx;
  357. color: #666;
  358. line-height: 1.4;
  359. margin-top: 28rpx;
  360. }
  361. .logo {
  362. width: 314rpx;
  363. height: 280rpx;
  364. }
  365. }
  366. // 任务进度
  367. .Area {
  368. position: relative;
  369. // height: calc(100vh - 450rpx);
  370. background: #fff;
  371. border-radius: 20rpx;
  372. padding: 27rpx 30rpx;
  373. box-sizing: border-box;
  374. margin-top: -27rpx;
  375. z-index: 9;
  376. .header {
  377. margin-bottom: 23rpx;
  378. .logo {
  379. width: 50rpx;
  380. height: 50rpx;
  381. }
  382. .title {
  383. position: relative;
  384. .text {
  385. font-size: 36rpx;
  386. color: #1968F3;
  387. font-weight: bold;
  388. position: relative;
  389. z-index: 2;
  390. }
  391. .line {
  392. position: absolute;
  393. bottom: 0;
  394. right: -8rpx;
  395. width: 80rpx;
  396. height: 24rpx;
  397. }
  398. }
  399. }
  400. .message {
  401. background: #F1FBFF;
  402. border-radius: 10rpx 10rpx 10rpx 10rpx;
  403. padding: 10rpx;
  404. box-sizing: border-box;
  405. font-size: 28rpx;
  406. color: #666;
  407. }
  408. .task {
  409. .item {
  410. width: 100%;
  411. margin-bottom: 40rpx;
  412. .task-icon {
  413. background: #F1FBFF;
  414. border-radius: 20rpx 20rpx 20rpx 20rpx;
  415. padding: 15rpx;
  416. box-sizing: border-box;
  417. image {
  418. width: 70rpx;
  419. height: 70rpx;
  420. }
  421. }
  422. .task-progress {
  423. flex: 1;
  424. height: 100%;
  425. margin-left: 20rpx;
  426. margin-right: 16rpx;
  427. .title {
  428. font-size: 28rpx;
  429. color: #333;
  430. font-weight: bold;
  431. }
  432. .progressBar {
  433. position: relative;
  434. width: 90rpx;
  435. height: 6rpx;
  436. background: #F0F0F0;
  437. border-radius: 100px;
  438. overflow: hidden;
  439. .jindu {
  440. position: absolute;
  441. left: 0;
  442. top: 0;
  443. height: 6rpx;
  444. background: #FFA008;
  445. border-radius: 100px;
  446. }
  447. }
  448. .task-data {
  449. font-size: 26rpx;
  450. text:nth-child(1) {
  451. color: #FFA008;
  452. }
  453. text:nth-child(2),
  454. text:nth-child(3) {
  455. color: #999999;
  456. }
  457. }
  458. }
  459. .task-btn {
  460. padding: 8rpx 20rpx;
  461. box-sizing: border-box;
  462. background: linear-gradient(132deg, #2DD9FF 0%, #2D6DFF 100%);
  463. border-radius: 50rpx 50rpx 50rpx 50rpx;
  464. font-size: 28rpx;
  465. color: #fff;
  466. line-height: 1.5;
  467. }
  468. .task-btn1 {
  469. padding: 8rpx 20rpx;
  470. box-sizing: border-box;
  471. background: transparent;
  472. border-radius: 50rpx 50rpx 50rpx 50rpx;
  473. font-size: 28rpx;
  474. color: #2D74FF;
  475. line-height: 1.5;
  476. }
  477. }
  478. .item:last-child {
  479. margin-bottom: 13rpx;
  480. }
  481. }
  482. }
  483. }
  484. // 购买等级
  485. .purchaseLevels {
  486. position: relative;
  487. background: linear-gradient(180deg, #FFD581 0%, #FFFFFF 70%);
  488. border-radius: 20rpx;
  489. margin: 0 30rpx;
  490. .purchaseLevel {
  491. width: 99.7%;
  492. margin-top: 2rpx;
  493. padding: 40rpx 30rpx;
  494. box-sizing: border-box;
  495. background: linear-gradient(0deg, #fff 20%, #FFF6EC 100%);
  496. border-radius: 20rpx;
  497. }
  498. .header {
  499. .star {
  500. width: 27rpx;
  501. height: 22rpx;
  502. }
  503. .title {
  504. position: relative;
  505. margin-left: 2rpx;
  506. margin-right: 2rpx;
  507. text-align: center;
  508. font-size: 30rpx;
  509. color: #333;
  510. font-weight: bold;
  511. text {
  512. position: relative;
  513. z-index: 9;
  514. margin: 0 4rpx;
  515. }
  516. .line {
  517. position: absolute;
  518. bottom: 6rpx;
  519. left: 0;
  520. right: 0;
  521. margin: auto;
  522. width: 90%;
  523. height: 13rpx;
  524. background: #FFE262;
  525. border-radius: 0rpx 0rpx 0rpx 0rpx;
  526. }
  527. }
  528. }
  529. // 红包样式
  530. .redPacket {
  531. position: relative;
  532. padding: 15rpx;
  533. box-sizing: border-box;
  534. background: #FFF0E8;
  535. border-radius: 20rpx 20rpx 20rpx 20rpx;
  536. .redPacket-img {
  537. width: 70rpx;
  538. height: 70rpx;
  539. }
  540. .lock {
  541. position: absolute;
  542. bottom: 0;
  543. right: 0;
  544. padding: 5rpx;
  545. z-index: 9;
  546. box-sizing: border-box;
  547. background: rgba(255, 163, 117, 0.3);
  548. border-radius: 20rpx 0rpx 20rpx 0rpx;
  549. backdrop-filter: blur(10rpx);
  550. .lock-img {
  551. width: 30rpx;
  552. height: 30rpx;
  553. }
  554. }
  555. }
  556. /* 锁定金额 */
  557. .redPacket-data {
  558. .sum {
  559. font-size: 36rpx;
  560. color: #F74141;
  561. font-weight: bold;
  562. }
  563. .days {
  564. font-size: 30rpx;
  565. color: #666;
  566. }
  567. }
  568. /* 去解锁按钮 */
  569. .btn {
  570. padding: 8rpx 20rpx;
  571. box-sizing: border-box;
  572. background: linear-gradient(132deg, #2DD9FF 0%, #2D6DFF 100%);
  573. border-radius: 50rpx 50rpx 50rpx 50rpx;
  574. font-size: 28rpx;
  575. color: #fff;
  576. line-height: 1.5;
  577. }
  578. }
  579. .contactService {
  580. padding: 30rpx 50rpx;
  581. box-sizing: border-box;
  582. .panelcanvas {
  583. position: relative;
  584. image {
  585. width: 250rpx;
  586. height: 250rpx;
  587. }
  588. }
  589. .Servicebtn {
  590. width: 100%;
  591. padding: 18rpx;
  592. box-sizing: border-box;
  593. background: linear-gradient(132deg, #2DD9FF 0%, #2D6DFF 100%);
  594. border-radius: 4rpx 4rpx 4rpx 4rpx;
  595. font-size: 32rpx;
  596. color: #fff;
  597. line-height: 1.4;
  598. margin-top: 60rpx;
  599. }
  600. }
  601. </style>