modalDialog.vue 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543
  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 ? '前去修改' : '不加入'"
  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. ? "加入"
  193. : "";
  194. return text;
  195. },
  196. content: {
  197. get() {
  198. let str = this.mailboxBindingDlg
  199. ? "您当前绑定的联系方式为邮箱,请先设置您的外呼号码"
  200. : this.editIsShowDlg
  201. ? this.editIsShowAccounts
  202. : this.applyIsShow || this.goFollowShow || this.show
  203. ? this.jurisdictionList.PopupMsg
  204. : "";
  205. return str;
  206. },
  207. set() {},
  208. },
  209. show_cancel_button() {
  210. return this.content == "该活动为非公开活动,如有专家访谈需求请联系对口销售" ? false : true;
  211. },
  212. },
  213. methods: {
  214. /**
  215. *
  216. *
  217. *
  218. * 确定
  219. *
  220. *
  221. */
  222. confirmModal() {
  223. this.show
  224. ? this.contentBtn()
  225. : this.goFollowShow
  226. ? this.goFollowShowBtn()
  227. : this.cancelShow
  228. ? this.cancelShowBtn()
  229. : this.applyIsShow
  230. ? this.applyIsShowBtn()
  231. : this.mailboxBindingDlg
  232. ? this.gmailboxBindingDlgBtn()
  233. : this.editIsShowDlg
  234. ? this.GoOutboundMobileBtn()
  235. : "";
  236. this.initData();
  237. if (this.jurisdictionList.isActivityDetail) {
  238. this.$parent.getActivityDetail();
  239. }
  240. },
  241. /**
  242. *
  243. *
  244. *
  245. * 取消
  246. *
  247. *
  248. */
  249. cancelModal() {
  250. if (this.editIsShowDlg) {
  251. this.GoOutboundMobileIsGo();
  252. } else {
  253. this.initData();
  254. this.$emit("cancelShowBtn");
  255. }
  256. if (this.jurisdictionList.isActivityDetail) {
  257. this.$parent.getActivityDetail();
  258. }
  259. },
  260. /**
  261. *
  262. *
  263. *
  264. * 重置
  265. *
  266. *
  267. */
  268. initData() {
  269. this.$parent.isShow = false;
  270. this.show = false;
  271. this.$parent.goFollow = false;
  272. this.goFollowShow = false;
  273. this.applyIsShow = false;
  274. this.$parent.applyForIsShow = false;
  275. this.$parent.mailboxBinding = false;
  276. this.mailboxBindingDlg = false;
  277. this.$parent.signupType = "";
  278. this.$parent.isCancelShow = false;
  279. this.cancelShow = false;
  280. this.editIsShowDlg = false;
  281. },
  282. async showhasPermissionBtn() {
  283. if (this.jurisdictionList.IsResearchSpecial) {
  284. } else {
  285. // isAudioVideo -- 3 产业视频
  286. let type =
  287. this.jurisdictionList.isAudioVideo == 1 ? "MicroAudio" : this.jurisdictionList.isAudioVideo == 2 ? "ActivityVideo" : this.jurisdictionList.isAudioVideo == 3 ? "MicroVideo" : "Activity";
  288. const res = await User.applyTry({
  289. TryType: type,
  290. DetailId: this.jurisdictionList.ActivityId,
  291. });
  292. if (res.Ret === 200) {
  293. uni.showModal({
  294. title: "",
  295. content: "提交申请成功,请耐心等待",
  296. showCancel: false,
  297. confirmColor: "#376cbb",
  298. });
  299. }
  300. }
  301. this.showhasPermission = false;
  302. this.$parent.isShowhasPermission = false;
  303. },
  304. mobileDial() {
  305. uni.makePhoneCall({
  306. phoneNumber: this.jurisdictionList.SellerMobile, // 拨打电话
  307. });
  308. this.showhasPermission = false;
  309. this.$parent.isShowhasPermission = false;
  310. },
  311. GoOutboundMobileBtn() {
  312. this.$parent.editIsShow = false;
  313. this.editIsShowDlg = false;
  314. if (this.goOnNextStep) {
  315. this.goFollowShow = true;
  316. } else {
  317. this.show = true;
  318. }
  319. },
  320. gmailboxBindingDlgBtn() {
  321. this.$parent.mailboxBinding = false;
  322. this.mailboxBindingDlg = false;
  323. this.$parent.signupType = "";
  324. uni.navigateTo({
  325. url: "/activityPages/editOutbound/editOutbound?title=设置外呼号码&identification=邮箱&goOnNextStep=" + this.goOnNextStep + "&id=" + this.idTypeCancel.cutId,
  326. });
  327. },
  328. //获取权限弹窗是否展示免费月卡接口
  329. async userIsShowAlert() {
  330. const res = await FreeButton.userIsShowAlert();
  331. if (res.Ret === 200) {
  332. this.isShowAlert = res.Data.IsShow;
  333. }
  334. },
  335. /**
  336. * 取消
  337. * */
  338. cancelMailboxBindingDlg() {
  339. this.$parent.mailboxBinding = false;
  340. this.mailboxBindingDlg = false;
  341. },
  342. GoOutboundMobileIsGo() {
  343. this.$parent.editIsShow = false;
  344. this.editIsShowDlg = false;
  345. uni.navigateTo({
  346. url:
  347. "/activityPages/editOutbound/editOutbound?title=修改外呼号码&identification=修改&goOnNextStep=" +
  348. this.goOnNextStep +
  349. "&id=" +
  350. this.idTypeCancel.cutId +
  351. "&cellphone=" +
  352. this.countryCode +
  353. "-" +
  354. this.mobileEdit,
  355. });
  356. },
  357. //获取权限弹窗是否展示免费月卡接口
  358. async userIsShowAlert() {
  359. const res = await FreeButton.userIsShowAlert();
  360. if (res.Ret === 200) {
  361. this.isShowAlert = res.Data.IsShow;
  362. }
  363. },
  364. /**
  365. *
  366. *
  367. *
  368. *
  369. *
  370. *confirm 模块
  371. *
  372. *
  373. *
  374. *
  375. *
  376. *
  377. */
  378. //正常的
  379. contentBtn() {
  380. this.$emit("cancelShowBtn", this.idTypeCancel, this.signupType, this.idTypeCancel.isNum);
  381. this.addCalendarHandler();
  382. },
  383. //去关注
  384. goFollowShowBtn() {
  385. this.$emit("cancelShowBtn", this.idTypeCancel, this.signupType, this.idTypeCancel.isNum);
  386. uni.navigateTo({
  387. url: "/activityPages/accountsOfficial/accountsOfficial",
  388. });
  389. },
  390. async cancelShowBtn() {
  391. const res = await activity.signupCancel({
  392. ActivityId: this.idTypeCancel.id,
  393. SignupType: this.idTypeCancel.type,
  394. });
  395. if (res.Ret == 200) {
  396. this.idTypeCancel.cutId = res.Data.ActivityId;
  397. if (this.signupType == 1) {
  398. uni.showToast({
  399. title: "预约外呼已取消",
  400. duration: 2000,
  401. });
  402. } else {
  403. uni.showToast({
  404. title: "已取消报名",
  405. duration: 2000,
  406. });
  407. }
  408. this.$emit("cancelShowBtn", this.idTypeCancel, this.signupType, this.idTypeCancel.isNum);
  409. }
  410. this.$parent.isCancelShow = false;
  411. this.cancelShow = false;
  412. },
  413. //立即申请
  414. applyIsShowBtn() {
  415. if (this.hasPermission == 3) {
  416. uni.navigateTo({
  417. url: "/pageMy/applyTrial/applyTrial?tryType=Activity&detailId=" + this.jurisdictionList.ActivityId,
  418. });
  419. } else if (this.hasPermission == 4) {
  420. uni.showModal({
  421. content: "申请已提交,请等待销售人员与您联系",
  422. confirmText: "知道了",
  423. showCancel: false,
  424. confirmColor: "#376cbb",
  425. });
  426. } else if (this.hasPermission == 5) {
  427. this.showhasPermissionBtn();
  428. }
  429. },
  430. //去设置
  431. gmailboxBindingDlgBtn() {
  432. uni.navigateTo({
  433. url: "/activityPages/editOutbound/editOutbound?title=设置外呼号码&identification=邮箱&goOnNextStep=" + this.goOnNextStep + "&id=" + this.idTypeCancel.cutId,
  434. });
  435. },
  436. // 拨打电话的取消弹框
  437. showhasPermissionCancel() {
  438. this.showhasPermission = false;
  439. this.$parent.isShowhasPermission = false;
  440. },
  441. handleAddCalendar() {
  442. wx.getSetting({
  443. success: (res) => {
  444. // 判断是否已经授权
  445. if (!res.authSetting["scope.addPhoneCalendar"]) {
  446. wx.authorize({
  447. scope: "scope.addPhoneCalendar",
  448. success: () => {
  449. // 用户已授权,调用添加日程 API
  450. wx.showModal({
  451. title: "提示",
  452. content: "日历授权成功",
  453. confirmText: "加入日历",
  454. confirmColor: "#376cbb",
  455. success: (res) => {
  456. if (res.confirm) {
  457. this.addCalendarHandler();
  458. }
  459. },
  460. });
  461. },
  462. fail(res) {
  463. // 用户拒绝授权,提示用户授权
  464. wx.showModal({
  465. title: "提示",
  466. content: "需要获取用户日历权限",
  467. confirmText: "前往设置",
  468. confirmColor: "#376cbb",
  469. success(res) {
  470. if (res.confirm) {
  471. wx.openSetting(); // 打开小程序设置页面,可以让用户开启需要的权限
  472. }
  473. },
  474. });
  475. },
  476. });
  477. } else {
  478. this.addCalendarHandler();
  479. }
  480. },
  481. });
  482. },
  483. addCalendarHandler() {
  484. // 已经授权,调用添加日程 API
  485. let dateTime = new Date(this.jurisdictionList.ActivityTime);
  486. let timeOffset = this.jurisdictionList.ActivityType == 1 ? 7200 : 900;
  487. wx.addPhoneCalendar({
  488. title: this.jurisdictionList.ActivityTypeName, // 日程标题,必填项
  489. startTime: dateTime.getTime() / 1000, // 日程开始时间,必填项
  490. alarmOffset: timeOffset, // 线下活动,活动开始时间前2小时 || 线上活动,活动开始时间前15分钟
  491. success(res) {
  492. // 日程添加成功的回调函数
  493. wx.showToast({
  494. title: "添加日程成功",
  495. icon: "success",
  496. duration: 2000,
  497. });
  498. },
  499. fail(res) {
  500. console.log(res);
  501. // 日程添加失败的回调函数
  502. wx.showToast({
  503. title: "添加日程失败",
  504. icon: "none",
  505. duration: 2000,
  506. });
  507. },
  508. });
  509. },
  510. },
  511. mounted() {
  512. // 免费送月卡
  513. // this.userIsShowAlert();
  514. },
  515. };
  516. </script>
  517. <style lang="scss">
  518. .slot-content {
  519. width: 100%;
  520. padding: 50rpx;
  521. text-align: center;
  522. font-size: 32rpx;
  523. color: #0f1826;
  524. line-height: 48rpx;
  525. }
  526. .seller-mobile {
  527. display: inline-block;
  528. color: #376cbb;
  529. }
  530. .u-model__footer__button.data-v-3626fcec {
  531. border-right: 1rpx solid #333;
  532. }
  533. </style>