modalDialog.vue 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560
  1. <template>
  2. <view>
  3. <u-modal
  4. v-model="isModalShow"
  5. :content-style="{ fontSize: '32rpx' }"
  6. @confirm="confirmModal"
  7. :confirm-text="confirmText"
  8. :cancel-text="editIsShowDlg ? '前去修改' : signupType == 'summaryIsHandel' || jurisdictionList.SignupStatus !== 'Success' ? '取消' : '不加入'"
  9. :show-cancel-button="show_cancel_button"
  10. @cancel="cancelModal"
  11. :show-title="false"
  12. :cancel-style="{ borderRight: '1rpx solid #EBEBEB' }"
  13. :confirm-style="{ fontWeight: '700' }"
  14. >
  15. <view class="slot-content">
  16. <rich-text :nodes="content"></rich-text>
  17. </view>
  18. </u-modal>
  19. <!-- 修改手机号 -->
  20. <block v-if="jurisdictionList.IsResearch">
  21. <u-modal
  22. v-model="showhasPermission"
  23. :content-style="{ fontSize: '32rpx' }"
  24. @confirm="showhasPermissionBtn"
  25. :show-cancel-button="!jurisdictionList.IsResearchSpecial"
  26. :confirm-text="!jurisdictionList.IsResearchSpecial ? '提交申请' : '知道了'"
  27. @cancel="showhasPermissionCancel"
  28. :show-title="false"
  29. :cancel-style="{ borderRight: '1rpx solid #EBEBEB' }"
  30. :confirm-style="{ fontWeight: '700' }"
  31. >
  32. <view class="slot-content" v-if="jurisdictionList.IsResearch">
  33. <rich-text :nodes="jurisdictionList.PopupMsg || ''"></rich-text>
  34. </view>
  35. </u-modal>
  36. </block>
  37. <block v-else>
  38. <!-- 拨打电话 -->
  39. <u-modal
  40. v-model="showhasPermission"
  41. :content-style="{ fontSize: '32rpx' }"
  42. @confirm="showhasPermissionBtn"
  43. :show-cancel-button="true"
  44. confirm-text="提交申请"
  45. @cancel="showhasPermissionCancel"
  46. :show-title="false"
  47. :cancel-style="{ borderRight: '1rpx solid #EBEBEB' }"
  48. :confirm-style="{ fontWeight: '700' }"
  49. >
  50. <view class="slot-content">
  51. <!-- 2 - 活动视频 3 - 产业视频 -->
  52. <block v-if="jurisdictionList.isAudioVideo == 2 || jurisdictionList.isAudioVideo == 3">
  53. <text>您暂无权限查看此视频</text>
  54. <text>若想查看可以联系对口销售</text>
  55. </block>
  56. <block v-else>
  57. <text>您暂无权限参加此活动</text>
  58. <text>若想参加可以联系对口销售</text>
  59. </block>
  60. <view
  61. >{{ jurisdictionList.SellerName }} : <text @click="mobileDial" class="seller-mobile"> {{ jurisdictionList.SellerMobile }}</text></view
  62. >
  63. <text>申请开通对应的试用权限</text>
  64. </view>
  65. </u-modal>
  66. </block>
  67. </view>
  68. </template>
  69. <script>
  70. import { User, activity, FreeButton } from "@/config/api.js";
  71. export default {
  72. data() {
  73. return {
  74. goFollowShow: false,
  75. show: false,
  76. cancelShow: false,
  77. applyIsShow: false,
  78. showhasPermission: false,
  79. accounts: "",
  80. jurisdictionText: "",
  81. hasPermissionText: "",
  82. editIsShowAccounts: "",
  83. editIsShowDlg: false,
  84. mailboxBindingDlg: false,
  85. isShowAlert: false, //获取权限弹窗是否展示免费月卡接口
  86. contentType: "",
  87. };
  88. },
  89. props: {
  90. isShow: {
  91. type: Boolean,
  92. default: false,
  93. },
  94. signupType: {
  95. // type: Number,
  96. },
  97. goFollow: {
  98. type: Boolean,
  99. },
  100. isCancelShow: {
  101. type: Boolean,
  102. default: false,
  103. },
  104. idTypeCancel: {
  105. type: Object,
  106. },
  107. jurisdictionList: {
  108. type: Object,
  109. },
  110. applyForIsShow: {
  111. //潜在用户
  112. type: Boolean,
  113. },
  114. isShowhasPermission: {
  115. //联系销售
  116. type: Boolean,
  117. },
  118. hasPermission: {
  119. //权限字段
  120. type: String,
  121. },
  122. editIsShow: {
  123. type: Boolean,
  124. },
  125. countryCode: {
  126. type: String,
  127. },
  128. mobileEdit: {
  129. type: String,
  130. },
  131. goOnNextStep: {
  132. type: Boolean,
  133. default: false,
  134. },
  135. mailboxBinding: {
  136. type: Boolean,
  137. default: false,
  138. },
  139. },
  140. watch: {
  141. mailboxBinding() {
  142. this.mailboxBindingDlg = this.mailboxBinding;
  143. },
  144. editIsShow(newVal) {
  145. this.editIsShowDlg = newVal;
  146. if (newVal) {
  147. this.editIsShowAccounts = `
  148. 默认外呼号码是您当前绑定的手机号:<br />
  149. ${this.countryCode}-${this.mobileEdit}<br/><br/>
  150. 是否需要修改您的外呼号码?
  151. `;
  152. }
  153. },
  154. goFollow() {
  155. this.goFollowShow = this.goFollow;
  156. },
  157. isShow() {
  158. this.show = this.isShow;
  159. },
  160. isCancelShow() {
  161. this.cancelShow = this.isCancelShow;
  162. },
  163. applyForIsShow() {
  164. this.content = this.isShowAlert ? "上传名片并填写简单信息,24小时内我们会为您开通一个月的免费月卡" : this.jurisdictionList.PopupMsg;
  165. this.applyIsShow = this.applyForIsShow;
  166. },
  167. isShowhasPermission() {
  168. this.hasPermissionText = this.jurisdictionList.PopupMsg;
  169. this.showhasPermission = this.isShowhasPermission;
  170. },
  171. },
  172. computed: {
  173. isModalShow: {
  174. get() {
  175. let isShow = this.show || this.cancelShow || this.goFollowShow || this.applyIsShow || this.mailboxBindingDlg || this.editIsShowDlg;
  176. return isShow;
  177. },
  178. set() {},
  179. },
  180. confirmText() {
  181. let text = this.mailboxBindingDlg
  182. ? "设置"
  183. : this.applyIsShow && this.isShowAlert
  184. ? "立即上传"
  185. : this.applyIsShow && !this.isShowAlert
  186. ? "立即申请"
  187. : this.editIsShowDlg
  188. ? "无需修改"
  189. : this.goFollowShow
  190. ? "去关注"
  191. : this.show
  192. ? this.jurisdictionList.SignupStatus !== "Success" || this.signupType == "summaryIsHandel"
  193. ? "知道了"
  194. : "加入"
  195. : "";
  196. return text;
  197. },
  198. content: {
  199. get() {
  200. let str = this.mailboxBindingDlg
  201. ? "您当前绑定的联系方式为邮箱,请先设置您的外呼号码"
  202. : this.editIsShowDlg
  203. ? this.editIsShowAccounts
  204. : this.applyIsShow || this.goFollowShow || this.show
  205. ? this.jurisdictionList.PopupMsg
  206. : "";
  207. return str;
  208. },
  209. set() {},
  210. },
  211. show_cancel_button() {
  212. return this.content == "该活动为非公开活动,如有专家访谈需求请联系对口销售" ? false : true;
  213. },
  214. },
  215. methods: {
  216. /**
  217. *
  218. *
  219. *
  220. * 确定
  221. *
  222. *
  223. */
  224. confirmModal() {
  225. this.show
  226. ? this.contentBtn()
  227. : this.goFollowShow
  228. ? this.goFollowShowBtn()
  229. : this.cancelShow
  230. ? this.cancelShowBtn()
  231. : this.applyIsShow
  232. ? this.applyIsShowBtn()
  233. : this.mailboxBindingDlg
  234. ? this.gmailboxBindingDlgBtn()
  235. : this.editIsShowDlg
  236. ? this.GoOutboundMobileBtn()
  237. : "";
  238. this.initData();
  239. if (this.jurisdictionList.isActivityDetail) {
  240. this.$parent.getActivityDetail();
  241. }
  242. },
  243. /**
  244. *
  245. *
  246. *
  247. * 取消
  248. *
  249. *
  250. */
  251. cancelModal() {
  252. if (this.editIsShowDlg) {
  253. this.GoOutboundMobileIsGo();
  254. } else {
  255. this.initData();
  256. this.$emit("cancelShowBtn");
  257. }
  258. if (this.jurisdictionList.isActivityDetail) {
  259. this.$parent.getActivityDetail();
  260. }
  261. },
  262. /**
  263. *
  264. *
  265. *
  266. * 重置
  267. *
  268. *
  269. */
  270. initData() {
  271. this.$parent.isShow = false;
  272. this.show = false;
  273. this.$parent.goFollow = false;
  274. this.goFollowShow = false;
  275. this.applyIsShow = false;
  276. this.$parent.applyForIsShow = false;
  277. this.$parent.mailboxBinding = false;
  278. this.mailboxBindingDlg = false;
  279. this.$parent.signupType = "";
  280. this.$parent.isCancelShow = false;
  281. this.cancelShow = false;
  282. this.editIsShowDlg = false;
  283. },
  284. async showhasPermissionBtn() {
  285. if (this.jurisdictionList.IsResearchSpecial) {
  286. } else {
  287. // isAudioVideo -- 3 产业视频
  288. let type =
  289. this.jurisdictionList.isAudioVideo == 1 ? "MicroAudio" : this.jurisdictionList.isAudioVideo == 2 ? "ActivityVideo" : this.jurisdictionList.isAudioVideo == 3 ? "MicroVideo" : "Activity";
  290. const res = await User.applyTry({
  291. TryType: type,
  292. DetailId: this.jurisdictionList.ActivityId,
  293. });
  294. if (res.Ret === 200) {
  295. uni.showModal({
  296. title: "",
  297. content: "提交申请成功,请耐心等待",
  298. showCancel: false,
  299. confirmColor: "#376cbb",
  300. });
  301. }
  302. }
  303. this.showhasPermission = false;
  304. this.$parent.isShowhasPermission = false;
  305. },
  306. mobileDial() {
  307. uni.makePhoneCall({
  308. phoneNumber: this.jurisdictionList.SellerMobile, // 拨打电话
  309. });
  310. this.showhasPermission = false;
  311. this.$parent.isShowhasPermission = false;
  312. },
  313. GoOutboundMobileBtn() {
  314. this.$parent.editIsShow = false;
  315. this.editIsShowDlg = false;
  316. if (this.goOnNextStep) {
  317. this.goFollowShow = true;
  318. } else {
  319. this.show = true;
  320. }
  321. },
  322. gmailboxBindingDlgBtn() {
  323. this.$parent.mailboxBinding = false;
  324. this.mailboxBindingDlg = false;
  325. this.$parent.signupType = "";
  326. uni.navigateTo({
  327. url: "/activityPages/editOutbound/editOutbound?title=设置外呼号码&identification=邮箱&goOnNextStep=" + this.goOnNextStep + "&id=" + this.idTypeCancel.cutId,
  328. });
  329. },
  330. //获取权限弹窗是否展示免费月卡接口
  331. async userIsShowAlert() {
  332. const res = await FreeButton.userIsShowAlert();
  333. if (res.Ret === 200) {
  334. this.isShowAlert = res.Data.IsShow;
  335. }
  336. },
  337. /**
  338. * 取消
  339. * */
  340. cancelMailboxBindingDlg() {
  341. this.$parent.mailboxBinding = false;
  342. this.mailboxBindingDlg = false;
  343. },
  344. GoOutboundMobileIsGo() {
  345. this.$parent.editIsShow = false;
  346. this.editIsShowDlg = false;
  347. uni.navigateTo({
  348. url:
  349. "/activityPages/editOutbound/editOutbound?title=修改外呼号码&identification=修改&goOnNextStep=" +
  350. this.goOnNextStep +
  351. "&id=" +
  352. this.idTypeCancel.cutId +
  353. "&cellphone=" +
  354. this.countryCode +
  355. "-" +
  356. this.mobileEdit,
  357. });
  358. },
  359. //获取权限弹窗是否展示免费月卡接口
  360. async userIsShowAlert() {
  361. const res = await FreeButton.userIsShowAlert();
  362. if (res.Ret === 200) {
  363. this.isShowAlert = res.Data.IsShow;
  364. }
  365. },
  366. /**
  367. *
  368. *
  369. *
  370. *
  371. *
  372. *confirm 模块
  373. *
  374. *
  375. *
  376. *
  377. *
  378. *
  379. */
  380. //正常的
  381. contentBtn() {
  382. this.$emit("cancelShowBtn", this.idTypeCancel, this.signupType, this.idTypeCancel.isNum);
  383. if (this.signupType == "summaryIsHandel" || this.jurisdictionList.SignupStatus !== "Success") return;
  384. this.addCalendarHandler();
  385. },
  386. //去关注
  387. goFollowShowBtn() {
  388. this.$emit("cancelShowBtn", this.idTypeCancel, this.signupType, this.idTypeCancel.isNum);
  389. uni.navigateTo({
  390. url: "/activityPages/accountsOfficial/accountsOfficial",
  391. });
  392. },
  393. async cancelShowBtn() {
  394. const res = await activity.signupCancel({
  395. ActivityId: this.idTypeCancel.id,
  396. SignupType: this.idTypeCancel.type,
  397. });
  398. if (res.Ret == 200) {
  399. this.idTypeCancel.cutId = res.Data.ActivityId;
  400. if (this.signupType == 1) {
  401. uni.showToast({
  402. title: "预约外呼已取消",
  403. duration: 2000,
  404. });
  405. } else {
  406. uni.showToast({
  407. title: "已取消报名",
  408. duration: 2000,
  409. });
  410. }
  411. this.$emit("cancelShowBtn", this.idTypeCancel, this.signupType, this.idTypeCancel.isNum);
  412. }
  413. this.$parent.isCancelShow = false;
  414. this.cancelShow = false;
  415. },
  416. //立即申请
  417. applyIsShowBtn() {
  418. if (this.hasPermission == 3) {
  419. uni.navigateTo({
  420. url: "/pageMy/applyTrial/applyTrial?tryType=Activity&detailId=" + this.jurisdictionList.ActivityId,
  421. });
  422. } else if (this.hasPermission == 4) {
  423. uni.showModal({
  424. content: "申请已提交,请等待销售人员与您联系",
  425. confirmText: "知道了",
  426. showCancel: false,
  427. confirmColor: "#376cbb",
  428. });
  429. } else if (this.hasPermission == 5) {
  430. this.showhasPermissionBtn();
  431. }
  432. },
  433. //去设置
  434. gmailboxBindingDlgBtn() {
  435. uni.navigateTo({
  436. url: "/activityPages/editOutbound/editOutbound?title=设置外呼号码&identification=邮箱&goOnNextStep=" + this.goOnNextStep + "&id=" + this.idTypeCancel.cutId,
  437. });
  438. },
  439. // 拨打电话的取消弹框
  440. showhasPermissionCancel() {
  441. this.showhasPermission = false;
  442. this.$parent.isShowhasPermission = false;
  443. },
  444. handleAddCalendar() {
  445. wx.getSetting({
  446. success: (res) => {
  447. // 判断是否已经授权
  448. if (!res.authSetting["scope.addPhoneCalendar"]) {
  449. wx.authorize({
  450. scope: "scope.addPhoneCalendar",
  451. success: () => {
  452. // 用户已授权,调用添加日程 API
  453. wx.showModal({
  454. title: "提示",
  455. content: "日历授权成功",
  456. confirmText: "加入日历",
  457. confirmColor: "#376cbb",
  458. success: (res) => {
  459. if (res.confirm) {
  460. this.addCalendarHandler();
  461. }
  462. },
  463. });
  464. },
  465. fail(res) {
  466. // 用户拒绝授权,提示用户授权
  467. wx.showModal({
  468. title: "提示",
  469. content: "需要获取用户日历权限",
  470. confirmText: "前往设置",
  471. confirmColor: "#376cbb",
  472. success(res) {
  473. if (res.confirm) {
  474. wx.openSetting(); // 打开小程序设置页面,可以让用户开启需要的权限
  475. }
  476. },
  477. });
  478. },
  479. });
  480. } else {
  481. this.addCalendarHandler();
  482. }
  483. },
  484. });
  485. },
  486. addCalendarHandler() {
  487. // 已经授权,调用添加日程 API
  488. let dateTime = new Date(this.jurisdictionList.ActivityTime);
  489. let timeOffset = this.jurisdictionList.ActivityType == 1 ? 900 : 7200;
  490. wx.addPhoneCalendar({
  491. title: this.jurisdictionList.ActivityTypeName, // 日程标题,必填项
  492. startTime: dateTime.getTime() / 1000, // 日程开始时间,必填项
  493. alarmOffset: timeOffset, // 线下活动,活动开始时间前2小时 || 线上活动,活动开始时间前15分钟
  494. success(res) {
  495. // 日程添加成功的回调函数
  496. wx.showToast({
  497. title: "添加日程成功",
  498. icon: "success",
  499. duration: 2000,
  500. });
  501. },
  502. fail(res) {
  503. console.log(res);
  504. // 日程添加失败的回调函数
  505. if (res.errMsg == "addPhoneCalendar:fail authorization refuesed") {
  506. wx.showToast({
  507. title: "添加失败,请确认系统日历已开启",
  508. icon: "none",
  509. duration: 2000,
  510. });
  511. }else if (res.errMsg == "addPhoneCalendar:fail auth deny") {
  512. wx.showToast({
  513. title: "添加失败,请确认允许小程序添加日历",
  514. icon: "none",
  515. duration: 2000,
  516. });
  517. } else {
  518. wx.showToast({
  519. title: "已取消添加",
  520. icon: "none",
  521. duration: 2000,
  522. });
  523. }
  524. },
  525. });
  526. },
  527. },
  528. mounted() {
  529. // 免费送月卡
  530. // this.userIsShowAlert();
  531. },
  532. };
  533. </script>
  534. <style lang="scss">
  535. .slot-content {
  536. width: 100%;
  537. padding: 50rpx;
  538. text-align: center;
  539. font-size: 32rpx;
  540. color: #0f1826;
  541. line-height: 48rpx;
  542. }
  543. .seller-mobile {
  544. display: inline-block;
  545. color: #376cbb;
  546. }
  547. .u-model__footer__button.data-v-3626fcec {
  548. border-right: 1rpx solid #333;
  549. }
  550. </style>