reportDetail.vue 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422
  1. <template>
  2. <view class="container reportDetail-container">
  3. <block v-if="haveAuth === 1">
  4. <!-- 链接地址 -->
  5. <web-view :src="linkurl + '?id=' + id + '&fromType=mpwechat&token=' + access_token"></web-view>
  6. </block>
  7. <view class="noauth-cont" v-else-if="haveAuth === 2 || haveAuth === 3 || haveAuth === 4 || haveAuth === 5">
  8. <block v-if="!isShowAlert">
  9. <image src="https://hzstatic.hzinsights.com/cygx/czbk/noauth.png" class="noauth-ico"></image>
  10. <block v-if="haveAuth !== 3">
  11. <view class="tip">您暂无权限查看此报告内容,若想查看可以申请开通对应的试用权限</view>
  12. <view class="btn-cont" @click="applyAuth">{{ isShowAlert ? "立即上传" : "立即申请" }} </view>
  13. </block>
  14. <view class="tip" v-if="haveAuth === 3">
  15. 您暂无权限查看此报告内容
  16. <view class="contract">
  17. 若想查看可以联系对口销售
  18. <text @click="callPhone(sale_number)"
  19. >{{ sale_name }}:<text style="color: #d4bf86">{{ sale_number }}</text></text
  20. >
  21. </view>
  22. <view>申请开通对应的试用权限</view>
  23. </view>
  24. <view v-if="haveAuth === 3" class="btn-cont" @click="sellerApplyAuth"> 立即申请</view>
  25. <view class="btn-cont back-btn" @click="backIndex"> 返回 </view>
  26. </block>
  27. <block v-else>
  28. <text class="moneh-text"> 上传名片并填写简单信息,24小时内我们会为您开通一个月的免费月卡 </text>
  29. <img src="https://hzchart.oss-cn-shanghai.aliyuncs.com/cygx/czbk/month_card.png" class="month_card" alt="" />
  30. <view class="btn-cont btn-dl" @click="applyAuth"> 立即上传 </view>
  31. <view class="btn-cont month-back" @click="backIndex"> 返回</view>
  32. </block>
  33. </view>
  34. </view>
  35. </template>
  36. <script>
  37. import { Report, User, Reports, FreeButton } from "@/config/api.js";
  38. import { reportLinkUrl } from "@/config/config";
  39. let app = getApp({ allowDefault: true });
  40. export default {
  41. data() {
  42. return {
  43. haveAuth: false,
  44. access_token: "", //用户标识
  45. isIphoneX: false, //判断机型
  46. reportInfo: "",
  47. showNav: false,
  48. id: "",
  49. isShowTip: false,
  50. sale_name: "", //可联系销售名称
  51. sale_number: "", //可联系销售电话
  52. industry: "", //行业
  53. readTiem: 0,
  54. setIntervalTiem: null,
  55. isShowAlert: false,
  56. };
  57. },
  58. computed: {
  59. linkurl() {
  60. return reportLinkUrl;
  61. },
  62. },
  63. methods: {
  64. /* 获取详情 */
  65. getDetail() {
  66. Report.reportDtl({
  67. ArticleId: Number(this.id),
  68. }).then((res) => {
  69. if (res.Ret === 200) {
  70. uni.setNavigationBarTitle({
  71. title: res.Data.Detail.IsSummary == 1 ? "纪要详情" : "报告详情",
  72. });
  73. this.haveAuth = res.Data.HasPermission;
  74. this.isShowWriter = res.Data.IsShow;
  75. this.industry = res.Data.Detail.CategoryName;
  76. this.sale_name = res.Data.Detail.SellerName;
  77. this.sale_number = res.Data.Detail.SellerMobile;
  78. if (res.Data.HasPermission === 1) {
  79. //有访问权限
  80. if (res.Data.Detail.IsNeedJump) {
  81. uni.redirectTo({
  82. url: "/pageMy/reportPage/reportPage?id=" + this.id,
  83. });
  84. }
  85. this.reportInfo = res.Data.Detail;
  86. this.access_token = this.access_token || this.$db.get("access_token");
  87. this.$store.dispatch("statistics", { PageType: "ReportParticulars", DetailId: this.id });
  88. }
  89. }
  90. });
  91. },
  92. /* 无权限申请开通权限 */
  93. applyAuth() {
  94. /* 区分是否是潜在用户 */
  95. this.haveAuth === 2
  96. ? User.applyTry({
  97. ApplyMethod: 3,
  98. TryType: "Article",
  99. DetailId: Number(this.id),
  100. }).then((res) => {
  101. if (res.Ret === 200) {
  102. uni.navigateTo({
  103. url: "/pageMy/applyResult/applyResult",
  104. });
  105. }
  106. })
  107. : this.haveAuth === 4
  108. ? uni.navigateTo({
  109. url: "/pageMy/applyTrial/applyTrial?tryType=Article&detailId=" + this.id,
  110. })
  111. : uni.showModal({
  112. title: "",
  113. content: "您已经提交过申请了,请耐心等待",
  114. showCancel: false,
  115. confirmColor: "#365595",
  116. success: function (res) {},
  117. });
  118. },
  119. //销售的立即申请
  120. sellerApplyAuth() {
  121. User.applyTry({
  122. TryType: "Article",
  123. DetailId: Number(this.id),
  124. }).then((res) => {
  125. if (res.Ret === 200) {
  126. uni.showModal({
  127. title: "",
  128. content: "提交申请成功,请耐心等待",
  129. showCancel: false,
  130. confirmColor: "#365595",
  131. success: function (res) {
  132. this.backIndex();
  133. },
  134. });
  135. }
  136. });
  137. },
  138. // 返回首頁
  139. backIndex() {
  140. uni.navigateBack({
  141. fail() {
  142. uni.switchTab({
  143. url: "/pages/index/index",
  144. });
  145. },
  146. });
  147. },
  148. callPhone(num) {
  149. uni.makePhoneCall({
  150. phoneNumber: num,
  151. });
  152. },
  153. /* 申请访谈 */
  154. applyHandle() {
  155. // 申请访谈
  156. !this.reportInfo.IsInterviewApply &&
  157. this.$util.modal("", "专家访谈申请会提交给您的对口销售,销售会线下与您取得联系,确定申请吗?", () => {
  158. this.interviewApi();
  159. });
  160. // 取消申请访谈 区分状态 '待邀请','待访谈','已完成','已取消'
  161. if (this.reportInfo.IsInterviewApply) {
  162. // this.reportInfo.InterviewApplyStatus
  163. this.$util.modal(
  164. "",
  165. this.reportInfo.InterviewApplyStatus == "待访谈"
  166. ? "当前无法取消访谈,若有疑问,请联系对口销售"
  167. : this.reportInfo.InterviewApplyStatus == "待邀请"
  168. ? "您要取消此次访谈申请吗?"
  169. : "该访谈已完成",
  170. () => {
  171. this.reportInfo.InterviewApplyStatus == "待邀请"
  172. ? this.interviewApi()
  173. : this.reportInfo.InterviewApplyStatus == "待访谈"
  174. ? uni.makePhoneCall({
  175. phoneNumber: "18767183922",
  176. })
  177. : "";
  178. }
  179. );
  180. }
  181. },
  182. /* 访谈接口 */
  183. interviewApi() {
  184. Report.applyRpt({
  185. ArticleId: Number(this.id),
  186. }).then((res) => {
  187. this.reportInfo.IsInterviewApply = !this.reportInfo.IsInterviewApply;
  188. });
  189. },
  190. /* 收藏 */
  191. collectHandle() {
  192. Report.collectRpt({
  193. ArticleId: Number(this.id),
  194. }).then((res) => {
  195. this.reportInfo.IsCollect = !this.reportInfo.IsCollect;
  196. this.$util.toast(res.Msg);
  197. });
  198. },
  199. /* 错误 */
  200. errorDetails() {
  201. uni.showModal({
  202. confirmText: "知道了",
  203. showCancel: false,
  204. confirmColor: "#3385FF",
  205. content: "网络不好,请刷新重试",
  206. success: (res) => {
  207. uni.navigateBack({
  208. fail() {
  209. uni.switchTab({
  210. url: "/pages/index/index",
  211. });
  212. },
  213. });
  214. },
  215. });
  216. },
  217. //获取权限弹窗是否展示免费月卡接口
  218. async userIsShowAlert() {
  219. const res = await FreeButton.userIsShowAlert();
  220. if (res.Ret === 200) {
  221. this.isShowAlert = res.Data.IsShow;
  222. }
  223. },
  224. },
  225. async onShow() {
  226. this.readTiem = 0;
  227. this.setIntervalTiem = setInterval(() => {
  228. this.readTiem++;
  229. }, 1000);
  230. let page = getCurrentPages(); //查看路径
  231. if (page.length === 1) {
  232. await this.$store.dispatch("checkHandle");
  233. if (!this.$store.state.isAuth && !this.$store.state.isBind) this.getDetail();
  234. } else {
  235. // 跳转入口
  236. this.getDetail();
  237. }
  238. },
  239. onLoad(option) {
  240. this.id = option.id ? option.id : "";
  241. if (!this.id && !+this.id > 0) {
  242. this.errorDetails();
  243. }
  244. this.userIsShowAlert();
  245. },
  246. /**
  247. * 用户点击分享
  248. */
  249. onShareAppMessage: function (res) {
  250. if (this.id) {
  251. return {
  252. title: this.isHorzMobile ? "好友向您推荐此内容,上传名片享查研观向免费月卡!" : this.reportInfo.Title,
  253. path: "/pageMy/reportDetail/reportDetail?id=" + this.id,
  254. success: (res) => {},
  255. fail: (err) => {},
  256. };
  257. }
  258. },
  259. onHide() {
  260. //页面退出
  261. if (this.id && +this.id > 0) {
  262. clearInterval(this.setIntervalTiem);
  263. Reports.addStopTime({
  264. ArticleId: Number(this.id),
  265. StopTime: this.readTiem,
  266. OutType: 2,
  267. Source: "MOBILE",
  268. }).then((res) => {});
  269. }
  270. },
  271. onUnload() {
  272. if (this.id && +this.id > 0) {
  273. //页面返回
  274. clearInterval(this.setIntervalTiem);
  275. Reports.addStopTime({
  276. ArticleId: Number(this.id),
  277. StopTime: this.readTiem,
  278. OutType: 1,
  279. Source: "MOBILE",
  280. }).then((res) => {});
  281. }
  282. },
  283. };
  284. </script>
  285. <style lang="scss" scoped>
  286. .reportDetail-container {
  287. background-color: #fff;
  288. padding: 20rpx 34rpx 134rpx;
  289. .report-top {
  290. color: #999999;
  291. .report-title {
  292. color: #4a4a4a;
  293. font-size: 34rpx;
  294. }
  295. .report_desc {
  296. display: flex;
  297. justify-content: space-between;
  298. align-items: center;
  299. margin: 20rpx 0;
  300. }
  301. .tip {
  302. color: #586eb5;
  303. display: inline;
  304. }
  305. }
  306. .detail-report {
  307. padding: 40rpx 0;
  308. }
  309. .statement {
  310. max-width: 670rpx;
  311. max-height: 900rpx;
  312. line-height: 42rpx;
  313. overflow-y: auto;
  314. padding: 40rpx;
  315. }
  316. .fixed_cont {
  317. width: 100%;
  318. // height: 114rpx;
  319. padding: 10rpx 0;
  320. position: fixed;
  321. bottom: 0;
  322. left: 0;
  323. z-index: 99999;
  324. display: flex;
  325. justify-content: center;
  326. align-items: center;
  327. flex-direction: row;
  328. background-color: #fff;
  329. box-shadow: 0 -3rpx 6rpx rgba($color: #6a6a6a, $alpha: 0.16);
  330. .handle-item {
  331. font-size: 24rpx;
  332. color: #d0cfd5;
  333. text-align: center;
  334. margin-right: 130rpx;
  335. &:last-child {
  336. margin-right: 0;
  337. }
  338. .img_ico {
  339. width: 56rpx;
  340. height: 54rpx;
  341. margin: 0 auto;
  342. }
  343. }
  344. .button-item {
  345. background-color: transparent;
  346. line-height: normal;
  347. }
  348. }
  349. .noauth-cont {
  350. padding-top: 150rpx;
  351. text-align: center;
  352. font-size: 28rpx;
  353. .noauth-ico {
  354. width: 365rpx;
  355. height: 229rpx;
  356. margin-bottom: 70rpx;
  357. }
  358. .tip {
  359. width: 532rpx;
  360. margin: 0 auto 100rpx;
  361. .contract {
  362. padding: 40rpx 90rpx 0;
  363. line-height: 44rpx;
  364. text {
  365. display: inline-block;
  366. }
  367. }
  368. }
  369. .btn-cont {
  370. width: 368rpx;
  371. height: 80rpx;
  372. // position: relative;
  373. background: linear-gradient(268deg, #2ddbff 0%, #1599ff 49%, #005eff 100%);
  374. color: #fff;
  375. font-size: 34rpx;
  376. margin: 0 auto;
  377. text-align: center;
  378. line-height: 80rpx;
  379. &.back-btn {
  380. background: #fff !important;
  381. color: #2c83ff;
  382. border: 1px solid #2c83ff;
  383. margin-top: 30rpx;
  384. }
  385. .btn_bg {
  386. width: 100%;
  387. height: 80rpx;
  388. position: absolute;
  389. left: 0;
  390. top: 0;
  391. }
  392. .btn-txt {
  393. width: 100%;
  394. position: absolute;
  395. z-index: 1;
  396. }
  397. }
  398. }
  399. .month_card {
  400. width: 100%;
  401. height: 565rpx;
  402. padding-left: -20rpx;
  403. }
  404. .btn-dl {
  405. background: linear-gradient(253deg, #fcf3e9 0%, #eedec8 100%) !important;
  406. color: #333 !important;
  407. margin: 30rpx auto !important;
  408. }
  409. .month-back {
  410. background: #f6f6f6 !important;
  411. color: #999 !important;
  412. }
  413. .moneh-text {
  414. text-align: center;
  415. width: 632rpx;
  416. margin: 0 auto 20rpx;
  417. color: #999999;
  418. }
  419. }
  420. </style>