123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457 |
- // customer/pages/brokershareinfo/brokershareinfo.js
- const app = getApp();
- var utils = require("../../../utils/http");
- var time = 0;
- var timer = null;
- Page({
- /**
- * 页面的初始数据
- */
- data: {
- loginFlag: false,
- datashow: false,
- mobileflag: false,
- showAction: false,
- showdesc: false,
- priceflag: false,
- isAgree: false,
- imgUrl: app.globalData.imgUrl,
- cid: "",
- agid: "",
- shareid: "",
- clientype: "",
- fromType: "",
- platform: "",
- personMsg: {},
- sharepersonMsg: {},
- shareArticleInfo: {},
- companyobj: {},
- showMask: false,
- fPhone: "",
- type: "",
- xhwwidth: '',
- bottom: 26,
- },
- /**
- * 生命周期函数--监听页面加载
- */
- onLoad(options) {
- wx.hideHomeButton();
- let that = this;
- if (!!options.scene) {
- options = unescape(options.scene);
- let arr = options.split('&');
- let obj = {};
- for (let i = 0; i < arr.length; i++) {
- let arr1 = arr[i].split('=');
- obj[arr1[0]] = arr1[1];
- }
- that.setData({
- cid: obj.c,
- shareid: obj.u,
- agid: obj.ag,
- fromType: obj.f
- })
- app.globalData.clientype = obj.ct;
- app.globalData.shareuserid = obj.u;
- } else {
- if (!!options.ctp) {
- app.globalData.clientype = options.ctp;
- }
- if (!!options.uid) {
- app.globalData.shareuserid = options.uid;
- }
- if (!!options.cid) {
- that.setData({
- clientype: options.ctp,
- cid: options.cid,
- shareid: options.uid,
- agid: options.agid,
- fromType: options.f
- })
- }
- }
- },
- //用户同意隐私协议
- agreePrivacy() {
- this.setData({
- isAgree: true
- })
- this.logindata();
- },
- logindata: function () {
- var that = this;
- wx.showLoading();
- wx.login({
- success: function (data) {
- if (data.errMsg == 'login:ok') {
- utils.$post({
- url: app.globalData.webUrl + 'api/users/code2session',
- data: {
- client_type: that.data.clientype,
- code: data.code,
- share: app.globalData.shareuserid,
- share_agent_id: that.data.agid
- },
- success: function (r) {
- if (r.data.code == '0') {
- app.globalData.sharepersonobj = r.data.share;
- app.globalData.token = r.data.token;
- that.sharecompany();
-
- that.setData({
- sharepersonMsg: app.globalData.sharepersonobj,
- })
- if (!!r.data.user.phone) {
- app.globalData.use_id = r.data.user.id;
- app.globalData.personMsg = r.data.user;
- app.globalData.userflag = false; //有个人信息
- var nickname = r.data.user.nickname;
- var phone = r.data.user.phone;
- that.setData({
- fPhone: phone,
- loginFlag: false,
- datashow: true,
- personMsg:r.data.user,
- mobileflag: false,
- })
- that.getShareArticleInfo();
- } else {
- that.getShareArticleInfo();
- wx.hideLoading();
- that.setData({
- loginFlag: false,
- mobileflag: true
- })
- }
- }
- }
- })
- }
- wx.hideLoading();
- }
- })
- },
- presharelooktap() {
- if (!app.globalData.sharepersonobj.qrcode) {
- wx.showToast({
- title: "当前专属客服的二维码为空!",
- icon: 'none',
- duration: 2000
- })
- return false;
- }
- wx.previewImage({
- current: app.globalData.imgUrl + app.globalData.sharepersonobj.qrcode, // 当前显示图片的http链接
- urls: [app.globalData.imgUrl + app.globalData.sharepersonobj.qrcode]// 需要预览的图片http链接列表
- })
- },
- previewImage(e) {
- let index = e.currentTarget.dataset.index;
- wx.previewImage({
- urls: this.data.shareArticleInfo.file,
- current: this.data.shareArticleInfo.file[index]
- })
- },
- hiddenMaskFunc() {
- this.setData({
- showMask: false
- })
- },
- getPhoneNumberTap: function (res) {
- var that = this;
- if (res.detail.errMsg == 'getPhoneNumber:ok') {
- utils.$post({
- url: app.globalData.webUrl + 'api/users/setUserMobile',
- data: {
- encryptedData: res.detail.encryptedData,
- iv: res.detail.iv
- },
- header: {
- 'Authorization': 'bearer ' + app.globalData.token
- },
- success: function (r) {
- if (r.data.code == '0') {
- that.setData({
- fPhone: r.data.mobile,
- })
- if (res.currentTarget.dataset.type == 'broker') {
- that.setData({
- showMask: true
- })
- if (that.data.shareArticleInfo.type == 4) {
- that.signUpCustomer(that.data.fPhone);
- }
- }
- }
- }
- })
- } else {
- this.setData({
- showMask: true
- })
- }
- },
- signUpCustomer(fPhone) {
- const that = this;
- utils.$post({
- url: app.globalData.webUrl + 'client/index/add_customer',
- data: {
- name: '',
- phone: fPhone,
- community_name: '',
- agent_id: that.data.agid
- },
- header: {
- 'Authorization': 'bearer ' + app.globalData.token
- },
- success: function (r) {
- if (r.data.code == '0') {
- wx.showToast({
- title: '报名成功',
- icon: "none",
- duration: 1000
- })
- }
- }
- })
- },
- viewdescFunc() {
- console.log(this.data.showdesc);
- this.data.showdesc = !this.data.showdesc;
- this.setData({
- showdesc: this.data.showdesc
- })
- },
- priceshowtap() {
- this.setData({
- priceflag: true
- })
- },
- closepricetap() {
- this.setData({
- priceflag: false
- })
- },
- setype(){
- let webUrl = "";
- if (this.data.shareArticleInfo.type == 4) {
- webUrl = this.data.shareArticleInfo.vr_group_url;
- } else {
- webUrl = this.data.shareArticleInfo.files;
- }
- let redurltest='https://hnweizhihui.xiaohongwu.nczyzs.com';//41
- let kjlurltest="https://pano337.p.kujiale.com";
- let jeajurltest="https://vr-17.justeasy.nczyzs.com";
- let jeajurltest1="https://vr.justeasy.nczyzs.com";
- let wlurltest1="https://panorama.m2m88.com";//26
- let wlurltest2="https://panorama.wlwno1.com";//27
- let nowurl="https://wzh.nczyzs.com";//22
- let wl360="https://vr.3d66.nczyzs.com"//26
- if(webUrl.substr(0, 41)==redurltest){
- wx.getSystemInfo({
- success (res) {
- let width=(res.windowWidth-16)*0.48;
- that.setData({
- xhwwidth:width,
- bottom:res.platform=='android'?'26':36
- })
- }
- })
- this.setData({
- type:1,
- platform:app.globalData.platform,
- })
- }else if(webUrl.substr(0, 29)==kjlurltest){
- this.setData({
- type:2,
- platform:app.globalData.platform,
- })
- }else if(webUrl.substr(0, 33)==jeajurltest||webUrl.substr(0, 30)==jeajurltest1){
- this.setData({
- type:3,
- platform:app.globalData.platform,
- })
-
- }else if(webUrl.substr(0, 26)==wlurltest1||webUrl.substr(0, 27)==wlurltest2||webUrl.substr(0, 26)==wl360){
- this.setData({
- type:4,
- platform:app.globalData.platform,
- })
- } else if (webUrl.substr(0, 22)==nowurl){
- this.setData({
- type:5,
- platform:app.globalData.platform,
- })
- }
- },
- /**
- * 前往个人名片
- */
- toPageNameCard() {
- wx.navigateTo({
- url: '/share/pages/shareCard/shareCard?uid='+ app.globalData.shareuserid + '&ctp=' + app.globalData.clientype + '&empid=' + app.globalData.sharempid + '&ftype=share',
- })
- },
- callphonetap: function () {
- console.log()
- wx.makePhoneCall({
- phoneNumber: app.globalData.sharepersonobj.phone //仅为示例,并非真实的电话号码
- })
- },
- sharecompany: function () {
- const that = this;
- utils.$post({
- url: app.globalData.webUrl + 'client/index/content_belong_company',
- header: {
- 'Authorization': 'bearer ' + app.globalData.token
- },
- data: {
- client_type: app.globalData.clientype,
- uid: app.globalData.shareuserid
- },
- success: function (res) {
- if (res.data.code == '0') {
- app.globalData.companyobj=res.data.data;
- app.globalData.sharempid = res.data.data.employee_id;
- that.setData({
- companyobj: res.data.data
- })
- }
- },
- complete(res) {
- wx.hideLoading()
- }
- })
- },
- cancelGetPhone() {},
- getShareArticleInfo() {
- let that = this;
- utils.$post({
- url: app.globalData.webUrl + 'client/agent/info',
- header: {
- 'Authorization': 'bearer ' + app.globalData.token
- },
- data: {
- article_id: that.data.cid
- },
- success: function (res) {
- wx.hideLoading();
- if (res.data.code == '0') {
- that.setData({
- shareArticleInfo: res.data.data
- })
- wx.setNavigationBarTitle({
- title: that.data.shareArticleInfo.title,
- })
- that.setype();
- }
- }
- })
- },
- dothis: function() {},
- visitimefun() {
- if (!this.data.isAgree) {
- return false;
- }
- const that = this;
- utils.$post({
- url: app.globalData.webUrl + 'client/index/visit_due_time',
- header: {
- 'Authorization': 'bearer ' + app.globalData.token
- },
- data: {
- id: that.data.cid,
- pipe_type: 'agentArticle',
- time: time,
- },
- success: function (res) {
- }
- })
- },
- /**
- * 生命周期函数--监听页面初次渲染完成
- */
- onReady() {
- },
- /**
- * 生命周期函数--监听页面显示
- */
- onShow() {
- time = 0;
- timer = setInterval(function () {
- time = time * 1 + 1;
- }, 1000)
- },
- /**
- * 生命周期函数--监听页面隐藏
- */
- onHide() {
- if (timer) {
- clearInterval(timer);
- }
- this.visitimefun();
- },
- /**
- * 生命周期函数--监听页面卸载
- */
- onUnload() {
- if (timer) {
- clearInterval(timer);
- }
- this.visitimefun();
- },
- /**
- * 页面相关事件处理函数--监听用户下拉动作
- */
- onPullDownRefresh() {
- },
- /**
- * 页面上拉触底事件的处理函数
- */
- onReachBottom() {
- },
- addsharetap: function () {
- let that = this;
- utils.$post({
- url: app.globalData.webUrl + 'api/agentsWork/agent_sharelog',
- header: {
- 'Authorization': 'bearer ' + app.globalData.token
- },
- data: {
- article_id: that.data.cid,
- },
- success: function (r) {}
- })
- },
- /**
- * 用户点击右上角分享
- */
- onShareAppMessage() {
- this.addsharetap();
- let imgUrl = '';
- if (this.data.shareArticleInfo.type == 1) {
- imgUrl = `${this.data.shareArticleInfo.file[0]}?x-oss-process=video/snapshot,t_100,f_jpg,w_200,m_fast`;
- } else if (this.data.shareArticleInfo.type == 3||this.data.shareArticleInfo.type == 4) {
- imgUrl = this.data.shareArticleInfo.file_img;
- } else {
- imgUrl = this.data.shareArticleInfo.file[0];
- }
- return {
- title: this.data.shareArticleInfo.title,
- img: imgUrl,
- path: "/share/pages/brokershareinfo/brokershareinfo?ctp=" + app.globalData.clientype + '&cid=' + this.data.shareArticleInfo.id + "&uid=" + app.globalData.shareuserid + '&agid=' + this.data.agid + '&f=' + this.data.fromType
- }
- }
- })
|