upgradeTask.vue 18 KB

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