|
@@ -1,1251 +1,34 @@
|
|
|
-const api = require('../../../utils/api.js');
|
|
|
|
|
-const Constants = require('../../../utils/Constants.js');
|
|
|
|
|
-const util = require('../../../utils/util.js')
|
|
|
|
|
-const common = require('../../../utils/common');
|
|
|
|
|
-const config = require('../../../config/config.js');
|
|
|
|
|
-const app = getApp();
|
|
|
|
|
|
|
+/*******************************************************************************
|
|
|
|
|
+ * Copyright(c) 2022 dongke All rights reserved. / Confidential
|
|
|
|
|
+ * 类的信息:
|
|
|
|
|
+ * 1.程序名称:
|
|
|
|
|
+ * 编辑履历:
|
|
|
|
|
+ * 作者 日期 版本 修改内容
|
|
|
|
|
+ * 于继渤 2024-1-23 1.00 客户跟进
|
|
|
|
|
+ *******************************************************************************/
|
|
|
|
|
+const Constants = require('@/utils/Constants.js');
|
|
|
|
|
+const util = require('@/utils/util.js')
|
|
|
|
|
+const mixins = require('@/mixins/index.js')
|
|
|
|
|
+const app = getApp()
|
|
|
Page({
|
|
Page({
|
|
|
-
|
|
|
|
|
|
|
+ mixins: [mixins],
|
|
|
/**
|
|
/**
|
|
|
* 页面的初始数据
|
|
* 页面的初始数据
|
|
|
*/
|
|
*/
|
|
|
data: {
|
|
data: {
|
|
|
-
|
|
|
|
|
- jobIds: [-101, -102], //销售顾问 设计师 -2022/08/20 于继渤
|
|
|
|
|
- checked_1: false,
|
|
|
|
|
- checked_2: false,
|
|
|
|
|
- checked_3: false,
|
|
|
|
|
- checked_4: false,
|
|
|
|
|
- checked_5: false,
|
|
|
|
|
- checked_6: false,
|
|
|
|
|
- checked_7: false,
|
|
|
|
|
- checked_8: false,
|
|
|
|
|
- //数量
|
|
|
|
|
- quantity_1: '0',
|
|
|
|
|
- quantity_2: '0',
|
|
|
|
|
- quantity_3: '0',
|
|
|
|
|
- quantity_4: '0',
|
|
|
|
|
- quantity_5: '0',
|
|
|
|
|
- quantity_6: '0',
|
|
|
|
|
- quantity_7: '0',
|
|
|
|
|
- quantity_8: '0',
|
|
|
|
|
- show: false,
|
|
|
|
|
-
|
|
|
|
|
- form: {
|
|
|
|
|
- CustomerName: '', //客户名称
|
|
|
|
|
- CustomerPhone: '', //客户电话
|
|
|
|
|
- AddressName: '', //住址
|
|
|
|
|
- AddressNo: '', //门牌号
|
|
|
|
|
- CustomerIntentionsName: '', //客户意向
|
|
|
|
|
- CompetitionBrand: '', //竞品品牌
|
|
|
|
|
- FollowUpContent: '', //跟进内容
|
|
|
|
|
- NextFollowUpPlan: '', //下次跟进计划
|
|
|
|
|
- InviteResult: '', //邀约结果
|
|
|
|
|
- NextFollowTime: '', //提醒时间
|
|
|
|
|
- InviteTime: '', //邀约到店时间
|
|
|
|
|
- DesignUser: '', //设计师
|
|
|
|
|
- DesignUserId: 0, //设计师
|
|
|
|
|
- FollowTypeName: '', //跟进方式
|
|
|
|
|
- loseReasonIds: [],//流失原因
|
|
|
|
|
- OtherName: '其他',
|
|
|
|
|
- addressArea: {
|
|
|
|
|
- province: '',
|
|
|
|
|
- city: '',
|
|
|
|
|
- district: '',
|
|
|
|
|
- // name: ''
|
|
|
|
|
- },
|
|
|
|
|
- competitionBrandFlag: false,
|
|
|
|
|
-
|
|
|
|
|
- },
|
|
|
|
|
- minDate: new Date().getTime(),
|
|
|
|
|
- activeNames: [],
|
|
|
|
|
- activeNameOthers: [],
|
|
|
|
|
- radio_follow_up: '1',
|
|
|
|
|
- customerIntentionsFlag: false,
|
|
|
|
|
- inviteFollowTypeFlag: false,
|
|
|
|
|
- inviteResultFlag: false,
|
|
|
|
|
- followTypeFlag: false,
|
|
|
|
|
- designFlag: false,
|
|
|
|
|
- otherFlag: false,
|
|
|
|
|
- //提醒时间
|
|
|
|
|
- nextFollowTimeFlag: true,
|
|
|
|
|
- //邀约到店时间
|
|
|
|
|
- inviteTimeFlag: true,
|
|
|
|
|
-
|
|
|
|
|
- inviteTimeSearch: new Date().getTime() + 100,
|
|
|
|
|
- nextFollowTimeSearch: new Date().getTime() + 100,
|
|
|
|
|
- formatter(type, value) {
|
|
|
|
|
- if (type === 'year') {
|
|
|
|
|
- return `${value}年`;
|
|
|
|
|
- }
|
|
|
|
|
- if (type === 'month') {
|
|
|
|
|
- return `${value}月`;
|
|
|
|
|
- }
|
|
|
|
|
- if (type === 'day') {
|
|
|
|
|
- return `${value}日`;
|
|
|
|
|
- }
|
|
|
|
|
- if (type === 'hour') {
|
|
|
|
|
- return `${value}时`;
|
|
|
|
|
- }
|
|
|
|
|
- if (type === 'minute') {
|
|
|
|
|
- return `${value}分`;
|
|
|
|
|
- }
|
|
|
|
|
- return value;
|
|
|
|
|
- },
|
|
|
|
|
- fileList: [], //图片
|
|
|
|
|
- },
|
|
|
|
|
-
|
|
|
|
|
- /**
|
|
|
|
|
- * 生命周期函数--监听页面显示
|
|
|
|
|
- */
|
|
|
|
|
- onShow: function () {
|
|
|
|
|
-
|
|
|
|
|
- const location = chooseLocation.getLocation();
|
|
|
|
|
- if (location) {
|
|
|
|
|
- if (!location.province && !location.city) {
|
|
|
|
|
- wx.showToast({
|
|
|
|
|
- title: '地址无效',
|
|
|
|
|
- duration: 2000
|
|
|
|
|
- })
|
|
|
|
|
- return;
|
|
|
|
|
- }
|
|
|
|
|
- //直辖市省变更(去掉市)
|
|
|
|
|
- let provinceTemp = util.updateProvince(location)
|
|
|
|
|
- location.province = provinceTemp ? provinceTemp : location.province
|
|
|
|
|
- location.district = location.district == undefined ? '' : location.district
|
|
|
|
|
- let temp = this.data.form;
|
|
|
|
|
- // 小区或POI
|
|
|
|
|
- temp['addressName'] = location.name;
|
|
|
|
|
- temp['addressFull'] = location.address + location.name; //全路径
|
|
|
|
|
- temp['addressGcj02'] = {
|
|
|
|
|
- latitude: location.latitude,
|
|
|
|
|
- longitude: location.longitude
|
|
|
|
|
- };
|
|
|
|
|
- // 行政区划
|
|
|
|
|
- temp['addressArea'] = {
|
|
|
|
|
- province: location.province,
|
|
|
|
|
- city: location.city,
|
|
|
|
|
- district: location.district == undefined || !location.district? location.city : location.district,
|
|
|
|
|
- }
|
|
|
|
|
- this.setData({
|
|
|
|
|
- form: temp,
|
|
|
|
|
- })
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- },
|
|
|
|
|
- /**
|
|
|
|
|
- * 生命周期函数--监听页面卸载
|
|
|
|
|
- */
|
|
|
|
|
- onUnload: function () {
|
|
|
|
|
- // 页面卸载时设置插件选点数据为null,防止再次进入页面,geLocation返回的是上次选点结果
|
|
|
|
|
- chooseLocation.setLocation(null);
|
|
|
|
|
- },
|
|
|
|
|
- /**
|
|
|
|
|
- * @desc : 调取企业微信会话
|
|
|
|
|
- * @date : 2022/5/18 15:49
|
|
|
|
|
- * @author : 于继渤
|
|
|
|
|
- */
|
|
|
|
|
- openWeChat(e) {
|
|
|
|
|
- let designuser = e.currentTarget.dataset.designuser
|
|
|
|
|
- let qvChatId = this.data.form.qvChatId
|
|
|
|
|
- let that = this
|
|
|
|
|
- let qvexternaluserid = e.currentTarget.dataset.qvexternaluserid
|
|
|
|
|
- let qvuserid = e.currentTarget.dataset.qvuserid
|
|
|
|
|
- let staffqvuserid = e.currentTarget.dataset.staffqvuserid
|
|
|
|
|
- let customerId = e.currentTarget.dataset.customerid
|
|
|
|
|
- let CustomerName = e.currentTarget.dataset.customername
|
|
|
|
|
- if (designuser == '' && qvChatId == null) {
|
|
|
|
|
- wx.showToast({
|
|
|
|
|
- title: '请选择设计师',
|
|
|
|
|
- image: '/static/image/warning.png',
|
|
|
|
|
- duration: 1000
|
|
|
|
|
- })
|
|
|
|
|
- return
|
|
|
|
|
- }
|
|
|
|
|
- if (qvexternaluserid == null || qvexternaluserid == undefined) {
|
|
|
|
|
- wx.showToast({
|
|
|
|
|
- title: '与该客户非好友关系',
|
|
|
|
|
- image: '/static/image/warning.png',
|
|
|
|
|
- duration: 1000
|
|
|
|
|
- })
|
|
|
|
|
- return
|
|
|
|
|
- }
|
|
|
|
|
- if (!app.globalData.SystemInfo.environment) {
|
|
|
|
|
- wx.showToast({
|
|
|
|
|
- title: '请在企业微信模式下运行',
|
|
|
|
|
- icon: 'none'
|
|
|
|
|
- })
|
|
|
|
|
- return
|
|
|
|
|
- }
|
|
|
|
|
- if (qvChatId == null && qvChatId == undefined) {
|
|
|
|
|
- wx.qy.openEnterpriseChat({
|
|
|
|
|
- // 注意:userIds和externalUserIds至少选填一个,且userIds+externalUserIds总数不能超过2000,如果externalUserIds有微信联系人,则总数不能超过40人。
|
|
|
|
|
- userIds: qvuserid + ';' + staffqvuserid + ';', //参与会话的企业成员列表,格式为userid1;userid2;...,用分号隔开。
|
|
|
|
|
- // 参与会话的外部联系人列表,格式为userId1;userId2;…,用分号隔开。
|
|
|
|
|
- externalUserIds: qvexternaluserid,
|
|
|
|
|
- groupName: '讨论组' + '-' + CustomerName, // 必填,会话名称。单聊时该参数传入空字符串""即可。
|
|
|
|
|
- chatId: "", //新建会话时,chatId必须为空串
|
|
|
|
|
- success: function (res) {
|
|
|
|
|
- // 回调
|
|
|
|
|
- var chatId = res.chatId; //返回chatId仅在企业微信3.0.36及以后版本支持;
|
|
|
|
|
- let param = {}
|
|
|
|
|
- param.qvChatId = chatId
|
|
|
|
|
- param.customerId = customerId
|
|
|
|
|
- api.request(Constants.SALE_CUSTOMER_API + 'update_customer_qvChatId', 'POST', param).then(res => {
|
|
|
|
|
- if (res.data.code === 200) {
|
|
|
|
|
- let form = that.data.form
|
|
|
|
|
- form.qvChatId = chatId
|
|
|
|
|
- that.setData({
|
|
|
|
|
- form: form
|
|
|
|
|
- })
|
|
|
|
|
- }
|
|
|
|
|
- })
|
|
|
|
|
- },
|
|
|
|
|
- fail: function (res) {
|
|
|
|
|
- // 失败处理
|
|
|
|
|
- wx.showToast({
|
|
|
|
|
- title: res.data,
|
|
|
|
|
- icon: 'none'
|
|
|
|
|
- })
|
|
|
|
|
- }
|
|
|
|
|
- });
|
|
|
|
|
- } else {
|
|
|
|
|
- wx.qy.openEnterpriseChat({
|
|
|
|
|
- // 注意:userIds和externalUserIds至少选填一个,且userIds+externalUserIds总数不能超过2000,如果externalUserIds有微信联系人,则总数不能超过40人。
|
|
|
|
|
- userIds: '', //参与会话的企业成员列表,格式为userid1;userid2;...,用分号隔开。
|
|
|
|
|
- // 参与会话的外部联系人列表,格式为userId1;userId2;…,用分号隔开。
|
|
|
|
|
- externalUserIds: '',
|
|
|
|
|
- groupName: '' + '-' + CustomerName, // 必填,会话名称。单聊时该参数传入空字符串""即可。
|
|
|
|
|
- chatId: qvChatId, //新建会话时,chatId必须为空串
|
|
|
|
|
- success: function (res) {
|
|
|
|
|
- // 回调
|
|
|
|
|
- var chatId = res.chatId; //返回chatId仅在企业微信3.0.36及以后版本支持;
|
|
|
|
|
- },
|
|
|
|
|
- fail: function (res) {
|
|
|
|
|
- // 失败处理
|
|
|
|
|
- wx.showToast({
|
|
|
|
|
- title: res.data,
|
|
|
|
|
- icon: 'none'
|
|
|
|
|
- })
|
|
|
|
|
- }
|
|
|
|
|
- });
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- },
|
|
|
|
|
- /**
|
|
|
|
|
- * 小程序地图调用
|
|
|
|
|
- */
|
|
|
|
|
- onClickWxchartAddress() {
|
|
|
|
|
- // if (this.data.EditFlag) {
|
|
|
|
|
- // return
|
|
|
|
|
- // }
|
|
|
|
|
- // 跳转新建地图实例
|
|
|
|
|
- common.onClickWxchartAddress();
|
|
|
|
|
- },
|
|
|
|
|
- /**
|
|
|
|
|
- * 联系电话 拨打
|
|
|
|
|
- */
|
|
|
|
|
- onClickphone(e) {
|
|
|
|
|
- let telephone = e.currentTarget.dataset.telephone
|
|
|
|
|
- // 拨打电话
|
|
|
|
|
- wx.makePhoneCall({
|
|
|
|
|
- phoneNumber: telephone,
|
|
|
|
|
- })
|
|
|
|
|
- },
|
|
|
|
|
-
|
|
|
|
|
- onnavigateToAddCustomer: function (e) {
|
|
|
|
|
- if (!app.globalData.SystemInfo.environment) {
|
|
|
|
|
- wx.showToast({
|
|
|
|
|
- title: '请在企业微信模式下运行',
|
|
|
|
|
- icon: 'none'
|
|
|
|
|
- })
|
|
|
|
|
- return
|
|
|
|
|
- }
|
|
|
|
|
- wx.qy.navigateToAddCustomer({
|
|
|
|
|
- success: (res) => {
|
|
|
|
|
- },
|
|
|
|
|
- fail: (res) => {
|
|
|
|
|
- },
|
|
|
|
|
- complete: (res) => {
|
|
|
|
|
- }
|
|
|
|
|
- })
|
|
|
|
|
-
|
|
|
|
|
- },
|
|
|
|
|
- /* 上传方法 */
|
|
|
|
|
- afterRead(event) {
|
|
|
|
|
- const _this = this;
|
|
|
|
|
- const {
|
|
|
|
|
- file
|
|
|
|
|
- } = event.detail;
|
|
|
|
|
- file.forEach(res => {
|
|
|
|
|
- // 当设置 mutiple 为 true 时, file 为数组格式,否则为对象格式
|
|
|
|
|
- wx.uploadFile({
|
|
|
|
|
- url: `${config.server_add}:${config.server_port}` + '/basic-server/file/upload',
|
|
|
|
|
- filePath: res.path,
|
|
|
|
|
- name: 'file',
|
|
|
|
|
- formData: {
|
|
|
|
|
- 'folder': 't_csm_follow/annex_paths'
|
|
|
|
|
- },
|
|
|
|
|
- header: {
|
|
|
|
|
- 'Authorization': 'Bearer ' + app.globalData.token
|
|
|
|
|
- },
|
|
|
|
|
- success(res) {
|
|
|
|
|
- res.data = JSON.parse(res.data)
|
|
|
|
|
- if (res.data.code === 200) {
|
|
|
|
|
- let arr = _this.data.fileList;
|
|
|
|
|
- arr.push({
|
|
|
|
|
- url: res.data.data.absolutelyPath,
|
|
|
|
|
- FilePath: res.data.data.relativePath,
|
|
|
|
|
- deletable: true
|
|
|
|
|
- })
|
|
|
|
|
- _this.setData({
|
|
|
|
|
- fileList: arr
|
|
|
|
|
- })
|
|
|
|
|
- }
|
|
|
|
|
- },
|
|
|
|
|
- })
|
|
|
|
|
- })
|
|
|
|
|
- },
|
|
|
|
|
-
|
|
|
|
|
- /**
|
|
|
|
|
- * 删除图片
|
|
|
|
|
- */
|
|
|
|
|
- deleteImg(e) {
|
|
|
|
|
- let index = e.detail.index;
|
|
|
|
|
- let arr = this.data.fileList;
|
|
|
|
|
- arr.splice(index, 1);
|
|
|
|
|
- this.setData({
|
|
|
|
|
- fileList: arr
|
|
|
|
|
- })
|
|
|
|
|
- },
|
|
|
|
|
- /**
|
|
|
|
|
- * 获取意向品类数据源
|
|
|
|
|
- */
|
|
|
|
|
- getGoodsSpecs() {
|
|
|
|
|
- let param = {
|
|
|
|
|
- dataSourceCode: "商品规格分类"
|
|
|
|
|
- }
|
|
|
|
|
- param.cpId = app.globalData.user.cpId
|
|
|
|
|
- api.request(Constants.BASIC_COMMON_API + 'get_wx_init_data', 'POST', param).then(res => {
|
|
|
|
|
- if (res.data.code === 200) {
|
|
|
|
|
- let specsList = []
|
|
|
|
|
- specsList = res.data.data
|
|
|
|
|
- if (this.data.EditFlag) { //编辑的时候进
|
|
|
|
|
- let itemList = this.data.item.intentionInfo
|
|
|
|
|
- // 把数据库里的选择 赋值到控件上 编辑进
|
|
|
|
|
- //todo 其他分类特殊
|
|
|
|
|
- specsList.forEach(function (item) {
|
|
|
|
|
- item.quantity = 0
|
|
|
|
|
- item.checked = false
|
|
|
|
|
- item.other = false
|
|
|
|
|
- if (itemList) {
|
|
|
|
|
- itemList.forEach(element => {
|
|
|
|
|
- if (item.id === element.specsId) {
|
|
|
|
|
- item.quantity = element.count
|
|
|
|
|
- item.checked = element.value
|
|
|
|
|
- }
|
|
|
|
|
- if ((item.name == "其他分类") && element.other) { //其他品类
|
|
|
|
|
- item.other = element.other
|
|
|
|
|
- item.quantity = element.count
|
|
|
|
|
- item.checked = element.value
|
|
|
|
|
- item.id = element.specsId
|
|
|
|
|
- item.name = element.specsName
|
|
|
|
|
- }
|
|
|
|
|
- });
|
|
|
|
|
- }
|
|
|
|
|
- });
|
|
|
|
|
- }
|
|
|
|
|
- this.setData({
|
|
|
|
|
- specsList
|
|
|
|
|
- })
|
|
|
|
|
- }
|
|
|
|
|
- })
|
|
|
|
|
- },
|
|
|
|
|
- /**
|
|
|
|
|
- * 提交保存
|
|
|
|
|
- */
|
|
|
|
|
- submit() {
|
|
|
|
|
- let onRadio_Follow_Up = this.data.onRadio_Follow_Up
|
|
|
|
|
- let result = this.checkForm();
|
|
|
|
|
- let specsList = this.data.specsList
|
|
|
|
|
- let specsList_ = []
|
|
|
|
|
- if (specsList) {
|
|
|
|
|
- specsList.forEach(function (item) {
|
|
|
|
|
- if (item.checked) {
|
|
|
|
|
- specsList_.push({
|
|
|
|
|
- "specsId": item.id,
|
|
|
|
|
- "specsName": item.name,
|
|
|
|
|
- "count": item.quantity,
|
|
|
|
|
- "value": item.checked,
|
|
|
|
|
- "other": item.other ? item.other : false
|
|
|
|
|
- })
|
|
|
|
|
- }
|
|
|
|
|
- });
|
|
|
|
|
- }
|
|
|
|
|
- if (result.flag) {
|
|
|
|
|
- let param = {}
|
|
|
|
|
- param.ascpId = app.globalData.user.ascpId
|
|
|
|
|
- param.sale1Id = app.globalData.user.sale1Id
|
|
|
|
|
- param.sale2Id = app.globalData.user.sale2Id
|
|
|
|
|
- if (this.data.radio_follow_up == '1') {
|
|
|
|
|
- param.followStatus = '跟进状态-跟进' //跟进状态
|
|
|
|
|
- param.followType = '跟进方式-' + this.data.form.FollowTypeName //跟进方式
|
|
|
|
|
- } else if (this.data.radio_follow_up == '3') {
|
|
|
|
|
- param.followStatus = '跟进状态-邀约' //跟进状态
|
|
|
|
|
- param.followType = '跟进方式-微信' //跟进方式
|
|
|
|
|
- } else if (this.data.radio_follow_up == '5') {
|
|
|
|
|
- param.followStatus = '跟进状态-约尺' //跟进状态
|
|
|
|
|
- param.followType = '跟进方式-上门' //跟进方式
|
|
|
|
|
- }
|
|
|
|
|
- param.customerId = this.data.form.CustomerId //客户名称
|
|
|
|
|
- param.customerPhone = this.data.form.CustomerPhone //客户电话
|
|
|
|
|
- param.customerName = this.data.form.CustomerName //客户名称
|
|
|
|
|
- param.addressName = this.data.form.addressName //客户地址
|
|
|
|
|
- param.addressNo = this.data.form.AddressNo //门牌号
|
|
|
|
|
- if (this.data.form.addressArea != null) {
|
|
|
|
|
- param.addressFull = (this.data.form.addressArea.province + this.data.form.addressArea.city + this.data.form.addressArea.district + this.data.form.addressName + this.data.form.AddressNo) ? (this.data.form.addressArea.province + this.data.form.addressArea.city + this.data.form.addressArea.district + this.data.form.addressName + this.data.form.AddressNo) : '' //全路径
|
|
|
|
|
- // param.addressFull = this.data.form.addressFull + this.data.form.AddressNo //全路径
|
|
|
|
|
- param.addressArea = this.data.form.addressArea //行政规划 省市区
|
|
|
|
|
- param.addressGcj02 = this.data.form.addressGcj02
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- param.followData = this.data.form.FollowUpContent //跟进内容
|
|
|
|
|
- param.nextFollowPlan = this.data.form.NextFollowUpPlan //下次跟进计划
|
|
|
|
|
-
|
|
|
|
|
- if (this.data.radio_follow_up != 1) {
|
|
|
|
|
- let InviteResult = this.data.form.InviteResult
|
|
|
|
|
- if ((InviteResult == '接受邀约') && (InviteResult != '')) {
|
|
|
|
|
- param.inviteResult = '邀约结果-接受'
|
|
|
|
|
- } else if ((InviteResult == '拒绝邀约') && (InviteResult != '')) {
|
|
|
|
|
- param.inviteResult = '邀约结果-拒绝'
|
|
|
|
|
- }
|
|
|
|
|
- } //邀约结果
|
|
|
|
|
- param.designUser = this.data.form.DesignUserId //设计师
|
|
|
|
|
- if (this.data.radio_follow_up != 5) {
|
|
|
|
|
- param.intention = '客户意向-' + this.data.form.CustomerIntentionsName //客户意向
|
|
|
|
|
- }
|
|
|
|
|
- //客户意向是放入公海时,客成状态改为公海
|
|
|
|
|
- if (this.data.form.CustomerIntentionsName == '放入公海') {
|
|
|
|
|
- param.saleStatus = '客成状态-公海'
|
|
|
|
|
- }
|
|
|
|
|
- //客户意向是流失时,客成状态改为流失
|
|
|
|
|
- else if (this.data.form.CustomerIntentionsName == '已流失') {
|
|
|
|
|
- param.saleStatus = '客成状态-流失'
|
|
|
|
|
- }
|
|
|
|
|
- //如果原来客户为公海或流失,跟进之后为潜客
|
|
|
|
|
- else if (this.data.form.saleStatus == '客成状态-公海' || this.data.form.saleStatus == '客成状态-流失') {
|
|
|
|
|
- param.saleStatus = '客成状态-潜客'
|
|
|
|
|
- }
|
|
|
|
|
- else {
|
|
|
|
|
- param.saleStatus = this.data.form.saleStatus
|
|
|
|
|
- }
|
|
|
|
|
- param.competitiveBrands = this.data.form.CompetitionBrand //竞品品牌
|
|
|
|
|
- param.loseReasonIds = this.data.form.loseReasonIds //流失原因
|
|
|
|
|
- param.inviteTime = this.data.form.InviteTime ? (this.data.form.InviteTime.length == 16 ? this.data.form.InviteTime + ":00" : this.data.form.InviteTime) : '' //邀约到店时间
|
|
|
|
|
- param.nextFollowTime = this.data.form.NextFollowTime ? (this.data.form.NextFollowTime.length == 16 ? this.data.form.NextFollowTime + ":00" : this.data.form.NextFollowTime) : '' //提醒时间
|
|
|
|
|
- param.cpId = app.globalData.user.cpId
|
|
|
|
|
- param.followOrg = app.globalData.user.orgId
|
|
|
|
|
- let fileList_ = this.data.fileList
|
|
|
|
|
- let fileList = []
|
|
|
|
|
- fileList_.forEach(item => {
|
|
|
|
|
- fileList.push(item.FilePath)
|
|
|
|
|
- })
|
|
|
|
|
- // 跟进附件 20220613
|
|
|
|
|
- param.annexPaths = {
|
|
|
|
|
- annexPaths: fileList
|
|
|
|
|
- }
|
|
|
|
|
- param.intentionInfo = specsList_
|
|
|
|
|
- this.setData({
|
|
|
|
|
- loading: true,
|
|
|
|
|
- loadingButtonFlag: true //防止重复点击
|
|
|
|
|
- })
|
|
|
|
|
- if (this.data.EditFlag) { //true 编辑update false 为新建 insert
|
|
|
|
|
- param.followId = this.data.form.FollowId
|
|
|
|
|
- api.request(Constants.SALE_CUSTOMERFOLLOW_API + 'update', 'POST', param).then(res => {
|
|
|
|
|
-
|
|
|
|
|
- if (res.data.code === 200) {
|
|
|
|
|
- wx.showToast({
|
|
|
|
|
- title: '保存成功',
|
|
|
|
|
- image: '/static/image/success.png',
|
|
|
|
|
- duration: 1000
|
|
|
|
|
- })
|
|
|
|
|
- var pages = getCurrentPages();
|
|
|
|
|
- var prevPage = pages[pages.length - 2];
|
|
|
|
|
- setTimeout(function () {
|
|
|
|
|
- wx.navigateBack({
|
|
|
|
|
- delta: 1
|
|
|
|
|
- })
|
|
|
|
|
- }, 1500)
|
|
|
|
|
- } else {
|
|
|
|
|
- this.setData({
|
|
|
|
|
- loading: false,
|
|
|
|
|
- loadingButtonFlag: false,
|
|
|
|
|
- })
|
|
|
|
|
- }
|
|
|
|
|
- })
|
|
|
|
|
- } else {
|
|
|
|
|
- api.request(Constants.SALE_CUSTOMERFOLLOW_API + 'insert', 'POST', param).then(res => {
|
|
|
|
|
- if (res.data.code === 200) {
|
|
|
|
|
- wx.showToast({
|
|
|
|
|
- title: '保存成功',
|
|
|
|
|
- image: '/static/image/success.png',
|
|
|
|
|
- duration: 1000
|
|
|
|
|
- })
|
|
|
|
|
- var pages = getCurrentPages();
|
|
|
|
|
- var prevPage = pages[pages.length - 2];
|
|
|
|
|
-
|
|
|
|
|
- prevPage.setData({
|
|
|
|
|
- selectflag: true
|
|
|
|
|
- })
|
|
|
|
|
- setTimeout(function () {
|
|
|
|
|
- wx.navigateBack({
|
|
|
|
|
- delta: 1
|
|
|
|
|
- })
|
|
|
|
|
- }, 1500)
|
|
|
|
|
- } else {
|
|
|
|
|
- this.setData({
|
|
|
|
|
- loading: false,
|
|
|
|
|
- loadingButtonFlag: false,
|
|
|
|
|
- })
|
|
|
|
|
- }
|
|
|
|
|
- })
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- } else {
|
|
|
|
|
- wx.showToast({
|
|
|
|
|
- title: result.msg,
|
|
|
|
|
- image: '/static/image/warning.png',
|
|
|
|
|
- duration: 1000
|
|
|
|
|
- })
|
|
|
|
|
- this.setData({
|
|
|
|
|
- loading: false
|
|
|
|
|
- })
|
|
|
|
|
- }
|
|
|
|
|
- },
|
|
|
|
|
- /**
|
|
|
|
|
- * 跟进内容
|
|
|
|
|
- * @param {} event
|
|
|
|
|
- */
|
|
|
|
|
- onFollowUpContentChange(event) {
|
|
|
|
|
- let form = this.data.form
|
|
|
|
|
- form.FollowUpContent = event.detail
|
|
|
|
|
- this.setData({
|
|
|
|
|
- form: form
|
|
|
|
|
- })
|
|
|
|
|
- },
|
|
|
|
|
- /**
|
|
|
|
|
- * 客户地址
|
|
|
|
|
- * @param {*} event
|
|
|
|
|
- */
|
|
|
|
|
- onAddressNameChange(event) {
|
|
|
|
|
- let form = this.data.form
|
|
|
|
|
- form.AddressName = event.detail
|
|
|
|
|
- this.setData({
|
|
|
|
|
- form: form
|
|
|
|
|
- })
|
|
|
|
|
- },
|
|
|
|
|
- /**
|
|
|
|
|
- * 门牌号
|
|
|
|
|
- * @param {*} event
|
|
|
|
|
- */
|
|
|
|
|
- onAddressNoChange(event) {
|
|
|
|
|
- let form = this.data.form
|
|
|
|
|
- form.AddressNo = event.detail
|
|
|
|
|
- this.setData({
|
|
|
|
|
- form: form
|
|
|
|
|
- })
|
|
|
|
|
- },
|
|
|
|
|
- /**
|
|
|
|
|
- * 竞品品牌
|
|
|
|
|
- * @param {*} event
|
|
|
|
|
- */
|
|
|
|
|
- onCompetitionBrandChange(event) {
|
|
|
|
|
- let form = this.data.form
|
|
|
|
|
- form.CompetitionBrand = event.detail
|
|
|
|
|
- this.setData({
|
|
|
|
|
- form: form
|
|
|
|
|
- })
|
|
|
|
|
- },
|
|
|
|
|
- /**
|
|
|
|
|
- * 下次跟进计划
|
|
|
|
|
- * @param {} event
|
|
|
|
|
- */
|
|
|
|
|
- onNextFollowUpPlanChange(event) {
|
|
|
|
|
- let form = this.data.form
|
|
|
|
|
- form.NextFollowUpPlan = event.detail
|
|
|
|
|
- this.setData({
|
|
|
|
|
- form: form
|
|
|
|
|
- })
|
|
|
|
|
- },
|
|
|
|
|
- /* 表单校验 */
|
|
|
|
|
- checkForm() {
|
|
|
|
|
- if (!this.data.form.CustomerName) {
|
|
|
|
|
- return {
|
|
|
|
|
- flag: false,
|
|
|
|
|
- msg: '客户名称为空'
|
|
|
|
|
- };
|
|
|
|
|
- }
|
|
|
|
|
- if(!this.data.form.noTelephone){
|
|
|
|
|
- if ( !this.data.form.CustomerPhone) {
|
|
|
|
|
- return {
|
|
|
|
|
- flag: false,
|
|
|
|
|
- msg: '联系电话为空'
|
|
|
|
|
- };
|
|
|
|
|
- }
|
|
|
|
|
- if (!util.isPoneAvailable(this.data.form.CustomerPhone)) {
|
|
|
|
|
- return {
|
|
|
|
|
- flag: false,
|
|
|
|
|
- msg: '电话格式不正确'
|
|
|
|
|
- };
|
|
|
|
|
- }
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- if (!this.data.form.FollowUpContent) {
|
|
|
|
|
- return {
|
|
|
|
|
- flag: false,
|
|
|
|
|
- msg: '跟进内容为空'
|
|
|
|
|
- };
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- //日常跟进
|
|
|
|
|
- if (this.data.radio_follow_up == 1) {
|
|
|
|
|
- if (!this.data.form.CustomerIntentionsName) {
|
|
|
|
|
- return {
|
|
|
|
|
- flag: false,
|
|
|
|
|
- msg: '客户意向为空'
|
|
|
|
|
- };
|
|
|
|
|
- }
|
|
|
|
|
- if (this.data.form.CustomerIntentionsName == '已流失' && this.data.form.loseReasonIds.length == 0) {
|
|
|
|
|
- return {
|
|
|
|
|
- flag: false,
|
|
|
|
|
- msg: '流失原因为空'
|
|
|
|
|
- };
|
|
|
|
|
- }
|
|
|
|
|
- if (!this.data.form.FollowTypeName) {
|
|
|
|
|
- return {
|
|
|
|
|
- flag: false,
|
|
|
|
|
- msg: '跟进方式为空'
|
|
|
|
|
- };
|
|
|
|
|
- }
|
|
|
|
|
- if (!this.data.form.NextFollowTime && this.data.form.CustomerIntentionsName != '已流失') {
|
|
|
|
|
- return {
|
|
|
|
|
- flag: false,
|
|
|
|
|
- msg: '提醒时间为空'
|
|
|
|
|
- };
|
|
|
|
|
- }
|
|
|
|
|
- } else if (this.data.radio_follow_up == 3) {
|
|
|
|
|
- if (!this.data.form.InviteResult) {
|
|
|
|
|
- return {
|
|
|
|
|
- flag: false,
|
|
|
|
|
- msg: '邀约结果为空'
|
|
|
|
|
- };
|
|
|
|
|
- }
|
|
|
|
|
- if (this.data.form.InviteResult == '接受邀约' && !this.data.form.InviteTime) {
|
|
|
|
|
- return {
|
|
|
|
|
- flag: false,
|
|
|
|
|
- msg: '邀约到店时间为空'
|
|
|
|
|
- };
|
|
|
|
|
- }
|
|
|
|
|
- if (this.data.form.InviteResult == '拒绝邀约' && !this.data.form.NextFollowTime) {
|
|
|
|
|
- return {
|
|
|
|
|
- flag: false,
|
|
|
|
|
- msg: '提醒时间为空'
|
|
|
|
|
- };
|
|
|
|
|
- }
|
|
|
|
|
- if (!this.data.form.CustomerIntentionsName) {
|
|
|
|
|
- return {
|
|
|
|
|
- flag: false,
|
|
|
|
|
- msg: '客户意向为空'
|
|
|
|
|
- };
|
|
|
|
|
- }
|
|
|
|
|
- if (this.data.form.CustomerIntentionsName == '已流失' && this.data.form.loseReasonIds.length == 0) {
|
|
|
|
|
- return {
|
|
|
|
|
- flag: false,
|
|
|
|
|
- msg: '流失原因为空'
|
|
|
|
|
- };
|
|
|
|
|
- }
|
|
|
|
|
- } else if (this.data.radio_follow_up == 5) {
|
|
|
|
|
- if (!this.data.form.DesignUser) {
|
|
|
|
|
- return {
|
|
|
|
|
- flag: false,
|
|
|
|
|
- msg: '设计师为空'
|
|
|
|
|
- };
|
|
|
|
|
- }
|
|
|
|
|
- if (!this.data.form.InviteResult) {
|
|
|
|
|
- return {
|
|
|
|
|
- flag: false,
|
|
|
|
|
- msg: '邀约结果为空'
|
|
|
|
|
- };
|
|
|
|
|
- }
|
|
|
|
|
- if (this.data.form.InviteResult == '接受邀约' && !this.data.form.InviteTime) {
|
|
|
|
|
- return {
|
|
|
|
|
- flag: false,
|
|
|
|
|
- msg: '服务时间为空'
|
|
|
|
|
- };
|
|
|
|
|
- }
|
|
|
|
|
- if (this.data.form.InviteResult == '拒绝邀约' && !this.data.form.NextFollowTime) {
|
|
|
|
|
- return {
|
|
|
|
|
- flag: false,
|
|
|
|
|
- msg: '提醒时间为空'
|
|
|
|
|
- };
|
|
|
|
|
- }
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- return {
|
|
|
|
|
- flag: true,
|
|
|
|
|
- msg: '表单校验通过'
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ radioFollowUp: '1',
|
|
|
|
|
+ routeObjName:'cusFollow',
|
|
|
},
|
|
},
|
|
|
|
|
|
|
|
- /**
|
|
|
|
|
- * 客户名称
|
|
|
|
|
- * @param {*} event
|
|
|
|
|
- */
|
|
|
|
|
- onCustomerNameChange(event) {
|
|
|
|
|
- let form = this.data.form
|
|
|
|
|
- form.CustomerName = event.detail
|
|
|
|
|
- this.setData({
|
|
|
|
|
- form: form
|
|
|
|
|
- })
|
|
|
|
|
- },
|
|
|
|
|
- /**
|
|
|
|
|
- * 跟进方式单选
|
|
|
|
|
- * @param {} event
|
|
|
|
|
- */
|
|
|
|
|
- onRadio_Follow_Up(event) {
|
|
|
|
|
- if (this.data.EditFlag) { //编辑界面 不让修改跟进方式
|
|
|
|
|
- return
|
|
|
|
|
- }
|
|
|
|
|
- this.setData({
|
|
|
|
|
- radio_follow_up: event.detail,
|
|
|
|
|
- });
|
|
|
|
|
- },
|
|
|
|
|
- /**
|
|
|
|
|
- * 客户意向
|
|
|
|
|
- */
|
|
|
|
|
- showCustomerIntentionsPopup() {
|
|
|
|
|
- this.setData({
|
|
|
|
|
- customerIntentionsFlag: true
|
|
|
|
|
- });
|
|
|
|
|
- },
|
|
|
|
|
- /**
|
|
|
|
|
- * 邀约进店的客户意向
|
|
|
|
|
- */
|
|
|
|
|
- showCustomerIntentionsPopupInvite() {
|
|
|
|
|
- this.setData({
|
|
|
|
|
- inviteFollowTypeFlag: true
|
|
|
|
|
- });
|
|
|
|
|
- },
|
|
|
|
|
- /**
|
|
|
|
|
- * 流失原因
|
|
|
|
|
- */
|
|
|
|
|
- showLoseReason() {
|
|
|
|
|
- this.setData({
|
|
|
|
|
- loseReasonFlag: true
|
|
|
|
|
- });
|
|
|
|
|
- },
|
|
|
|
|
- /**
|
|
|
|
|
- * @desc : 下拉多选确定
|
|
|
|
|
- * @author : 于继渤
|
|
|
|
|
- * @date : 2022/5/26 12:16
|
|
|
|
|
- */
|
|
|
|
|
- mutiSearchAll(e) {
|
|
|
|
|
- let id = e.currentTarget.id
|
|
|
|
|
- let form = this.data.form
|
|
|
|
|
- if (id === 'loseReason') {
|
|
|
|
|
- form.loseReasonIds = e.detail.idList
|
|
|
|
|
- form.loseReasonNames = e.detail.names
|
|
|
|
|
- this.setData({
|
|
|
|
|
- loseReasonFlag: false,
|
|
|
|
|
- form: form
|
|
|
|
|
- })
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- },
|
|
|
|
|
/**
|
|
/**
|
|
|
- * @desc : 下拉多选关闭
|
|
|
|
|
|
|
+ * @desc : 顶部选择
|
|
|
|
|
+ * @date : 2024/2/1 15:49
|
|
|
* @author : 于继渤
|
|
* @author : 于继渤
|
|
|
- * @date : 2022/5/26 12:16
|
|
|
|
|
*/
|
|
*/
|
|
|
- muticloseAll(e) {
|
|
|
|
|
- let id = e.currentTarget.id
|
|
|
|
|
- if (id === 'loseReason') {
|
|
|
|
|
- this.setData({
|
|
|
|
|
- loseReasonFlag: false
|
|
|
|
|
- })
|
|
|
|
|
- }
|
|
|
|
|
- },
|
|
|
|
|
- /**
|
|
|
|
|
- * 邀约结果
|
|
|
|
|
- */
|
|
|
|
|
- showInviteResultPopup() {
|
|
|
|
|
- this.setData({
|
|
|
|
|
- inviteResultFlag: true
|
|
|
|
|
- });
|
|
|
|
|
- },
|
|
|
|
|
- /**
|
|
|
|
|
- * 跟进方式
|
|
|
|
|
- */
|
|
|
|
|
- showFollowTypePopup() {
|
|
|
|
|
- this.setData({
|
|
|
|
|
- followTypeFlag: true
|
|
|
|
|
- });
|
|
|
|
|
- },
|
|
|
|
|
- /**
|
|
|
|
|
- * 设计师
|
|
|
|
|
- */
|
|
|
|
|
- showDesignPopup() {
|
|
|
|
|
|
|
+ onRadioFollowUp(e) {
|
|
|
this.setData({
|
|
this.setData({
|
|
|
- designFlag: true
|
|
|
|
|
|
|
+ radioFollowUp: e.detail,
|
|
|
});
|
|
});
|
|
|
},
|
|
},
|
|
|
|
|
|
|
|
- /**
|
|
|
|
|
- *手风琴 复选框 数据源监听事件
|
|
|
|
|
- */
|
|
|
|
|
- onDataChange(e) {
|
|
|
|
|
- this.setData({
|
|
|
|
|
- specsList: e.detail.dataList
|
|
|
|
|
- })
|
|
|
|
|
- },
|
|
|
|
|
- //组件单选确定
|
|
|
|
|
- mutiSearch(e) {
|
|
|
|
|
- let id = e.target.id
|
|
|
|
|
- let form = this.data.form
|
|
|
|
|
- if (id === 'customerIntentions') {
|
|
|
|
|
- form.CustomerIntentionsName = e.detail.name
|
|
|
|
|
- }
|
|
|
|
|
- if (id === 'followType') {
|
|
|
|
|
- form.FollowTypeName = e.detail.name
|
|
|
|
|
-
|
|
|
|
|
- }
|
|
|
|
|
- if (id === 'other') {
|
|
|
|
|
- let specsList = this.data.specsList
|
|
|
|
|
- specsList[this.data.otherIndex].id = e.detail.id
|
|
|
|
|
- specsList[this.data.otherIndex].name = e.detail.name
|
|
|
|
|
- this.setData({
|
|
|
|
|
- specsList
|
|
|
|
|
- })
|
|
|
|
|
- }
|
|
|
|
|
- if (id === 'staff') {
|
|
|
|
|
- form.DesignUser = e.detail.name
|
|
|
|
|
- form.DesignUserId = e.detail.id
|
|
|
|
|
- form.staffQvUserId = e.detail.qvUserid
|
|
|
|
|
- }
|
|
|
|
|
- //邀约结果
|
|
|
|
|
- if (id === 'inviteResult') {
|
|
|
|
|
- form.InviteResult = e.detail.name
|
|
|
|
|
- }
|
|
|
|
|
- this.setData({
|
|
|
|
|
- form: form
|
|
|
|
|
- })
|
|
|
|
|
-
|
|
|
|
|
- if (form.CustomerIntentionsName == '已流失') {
|
|
|
|
|
- this.setData({
|
|
|
|
|
- competitionBrandFlag: true,
|
|
|
|
|
- nextFollowTimeFlag: false,
|
|
|
|
|
- })
|
|
|
|
|
- } else if (form.CustomerIntentionsName == '放入公海') {
|
|
|
|
|
- this.setData({
|
|
|
|
|
- nextFollowTimeFlag: false,
|
|
|
|
|
- })
|
|
|
|
|
- } else {
|
|
|
|
|
- this.setData({
|
|
|
|
|
- competitionBrandFlag: false,
|
|
|
|
|
- nextFollowTimeFlag: true,
|
|
|
|
|
- })
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- if (form.InviteResult == '接受邀约') {
|
|
|
|
|
- this.setData({
|
|
|
|
|
- nextFollowTimeFlag: false,
|
|
|
|
|
- inviteTimeFlag: true,
|
|
|
|
|
- })
|
|
|
|
|
- } else if (form.InviteResult == '拒绝邀约') {
|
|
|
|
|
- this.setData({
|
|
|
|
|
- nextFollowTimeFlag: true,
|
|
|
|
|
- inviteTimeFlag: false,
|
|
|
|
|
- })
|
|
|
|
|
- }
|
|
|
|
|
- },
|
|
|
|
|
-
|
|
|
|
|
- /**
|
|
|
|
|
- * 通过cpid 外部联系人userid 查询客户
|
|
|
|
|
- * @param {*} cpid
|
|
|
|
|
- */
|
|
|
|
|
- getCurExternalContact(cpid) {
|
|
|
|
|
- let that = this
|
|
|
|
|
- // 需要从特定入口进入页面才可调用
|
|
|
|
|
- // 获取当前外部联系人userid
|
|
|
|
|
- wx.qy.getCurExternalContact({
|
|
|
|
|
- success: function (res) {
|
|
|
|
|
- var userId = res.userId //返回当前外部联系人userId
|
|
|
|
|
-
|
|
|
|
|
- let param = {
|
|
|
|
|
- qvExternalUserid: userId,
|
|
|
|
|
- cpId: cpid,
|
|
|
|
|
- }
|
|
|
|
|
- api.request(Constants.SALE_CUSTOMER_API + 'select_customer_detail', 'POST', param).then(res => {
|
|
|
|
|
- if (res.data.code === 200) {
|
|
|
|
|
- let form = that.data.form || {}
|
|
|
|
|
- let item = res.data.data
|
|
|
|
|
- form.CustomerId = item.customerId
|
|
|
|
|
- form.CustomerName = item.customerName
|
|
|
|
|
- form.CustomerPhone = item.customerPhone
|
|
|
|
|
- form.addressName = item.addressName
|
|
|
|
|
- form.addressArea = item.addressArea
|
|
|
|
|
- form.AddressNo = item.addressNo
|
|
|
|
|
- form.addressFull = item.addressFull
|
|
|
|
|
- form.qvExternalUserid = item.qvExternalUserid
|
|
|
|
|
- form.qvChatId = item.qvChatId
|
|
|
|
|
- form.qvUserid = app.globalData.user.qvUserid
|
|
|
|
|
- form.saleStatus = item.saleStatus
|
|
|
|
|
- form.noTelephone = false;
|
|
|
|
|
- if (form.qvExternalUserid && !form.CustomerPhone) {
|
|
|
|
|
- form.noTelephone = true;
|
|
|
|
|
- }
|
|
|
|
|
- that.setData({
|
|
|
|
|
- form: form,
|
|
|
|
|
- loading: false,
|
|
|
|
|
- })
|
|
|
|
|
- }
|
|
|
|
|
- })
|
|
|
|
|
- },
|
|
|
|
|
- fail: function (res) {
|
|
|
|
|
- }
|
|
|
|
|
- });
|
|
|
|
|
- },
|
|
|
|
|
-
|
|
|
|
|
- /**
|
|
|
|
|
- * 解密当前用户信息数据后 返回改用户的cpid
|
|
|
|
|
- * @param {*} e
|
|
|
|
|
- */
|
|
|
|
|
- onBindGetEnterpriseUserInfo: function (e) {
|
|
|
|
|
- let that = this
|
|
|
|
|
- wx.qy.getEnterpriseUserInfo({
|
|
|
|
|
- success: function (res) {
|
|
|
|
|
- let param = {
|
|
|
|
|
- encrypted: res.encryptedData,
|
|
|
|
|
- sessionKey: app.globalData.code_to_session.session_key,
|
|
|
|
|
- iv: res.iv,
|
|
|
|
|
- }
|
|
|
|
|
- api.request(Constants.SALE_CUSTOMER_API + 'wx_decrypt_customer_return_cpid', 'POST', param).then(res => {
|
|
|
|
|
- if (res.data.code === 200) {
|
|
|
|
|
- let cpid = res.data.data;
|
|
|
|
|
- that.getCurExternalContact(cpid);
|
|
|
|
|
- }
|
|
|
|
|
- })
|
|
|
|
|
- },
|
|
|
|
|
- fail: function (res) {
|
|
|
|
|
- }
|
|
|
|
|
- })
|
|
|
|
|
- },
|
|
|
|
|
-
|
|
|
|
|
- /**
|
|
|
|
|
- * 生命周期函数--监听页面加载
|
|
|
|
|
- */
|
|
|
|
|
- onLoad: function (options) {
|
|
|
|
|
- if (app.globalData.user == undefined) { //如果 user为空 跳回登录页再重新进入本页面获取
|
|
|
|
|
- wx.reLaunch({
|
|
|
|
|
- url: 'pages/login/login?loginType=5',
|
|
|
|
|
- })
|
|
|
|
|
- return
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- let customerfollowup = wx.getStorageSync('customer-follow-up')
|
|
|
|
|
-
|
|
|
|
|
- if (options.customerFlag === "true") { //客户详细界面过来的进
|
|
|
|
|
- // let item = JSON.parse(options.item)
|
|
|
|
|
- let item = JSON.parse(decodeURIComponent(options.item))
|
|
|
|
|
- let form = this.data.form
|
|
|
|
|
- form.CustomerId = item.customerId
|
|
|
|
|
- form.CustomerName = item.customerName
|
|
|
|
|
- form.CustomerPhone = item.customerPhone
|
|
|
|
|
- form.addressName = item.addressName
|
|
|
|
|
- form.addressArea = item.addressArea
|
|
|
|
|
- form.AddressNo = item.addressNo
|
|
|
|
|
- form.FollowUpContent = item.followData
|
|
|
|
|
- form.CustomerIntentionsName = item.intention
|
|
|
|
|
- form.FollowTypeName = item.followType
|
|
|
|
|
- form.NextFollowUpPlan = item.nextFollowPlan
|
|
|
|
|
- form.NextFollowTime = item.nextFollowTime
|
|
|
|
|
- form.InviteResult = item.inviteResult
|
|
|
|
|
- form.InviteTime = item.inviteTime
|
|
|
|
|
- form.qvExternalUserid = item.qvExternalUserid
|
|
|
|
|
- form.noTelephone = false;
|
|
|
|
|
- if (form.qvExternalUserid && !form.CustomerPhone) {
|
|
|
|
|
- form.noTelephone = true;
|
|
|
|
|
- }
|
|
|
|
|
- let radio_follow_up = ''
|
|
|
|
|
- if (item.followStatus == "跟进状态-跟进") {
|
|
|
|
|
- radio_follow_up = '1'
|
|
|
|
|
- }
|
|
|
|
|
- if (item.followStatus == "跟进状态-邀约") {
|
|
|
|
|
- radio_follow_up = '3'
|
|
|
|
|
- }
|
|
|
|
|
- if (item.followStatus == "跟进状态-约尺") {
|
|
|
|
|
- radio_follow_up = '5'
|
|
|
|
|
- }
|
|
|
|
|
- this.setData({
|
|
|
|
|
- form: form,
|
|
|
|
|
- radio_follow_up,
|
|
|
|
|
- fileList: item.annexPaths ? item.annexPaths.annexPaths : [],
|
|
|
|
|
- customerFlag: options.customerFlag
|
|
|
|
|
- })
|
|
|
|
|
- }
|
|
|
|
|
- if (options.flg === "true") { //ture 为编辑 false 为新建
|
|
|
|
|
- // let item = JSON.parse(options.item)
|
|
|
|
|
- let item = JSON.parse(decodeURIComponent(options.item))
|
|
|
|
|
- let form = this.data.form
|
|
|
|
|
- form.CustomerId = item.customerId
|
|
|
|
|
- form.CustomerName = item.customerName
|
|
|
|
|
- form.CustomerPhone = item.customerPhone
|
|
|
|
|
- form.addressName = item.addressName
|
|
|
|
|
- form.addressArea = item.addressArea
|
|
|
|
|
- form.AddressNo = item.addressNo
|
|
|
|
|
- form.addressFull = item.addressFull
|
|
|
|
|
- form.CustomerIntentionsName = item.intentionName
|
|
|
|
|
- form.CompetitionBrand = item.competitiveBrands
|
|
|
|
|
- form.FollowTypeName = item.followTypeName
|
|
|
|
|
- form.FollowUpContent = item.followData
|
|
|
|
|
- form.NextFollowUpPlan = item.nextFollowPlan
|
|
|
|
|
- form.NextFollowTime = item.nextFollowTime
|
|
|
|
|
- form.saleStatus = item.saleStatus
|
|
|
|
|
- if (item.inviteResult) {
|
|
|
|
|
- if (item.inviteResult == '邀约结果-接受') {
|
|
|
|
|
- form.InviteResult = '接受邀约'
|
|
|
|
|
- } else if (item.inviteResult == '邀约结果-拒绝') {
|
|
|
|
|
- form.InviteResult = '拒绝邀约'
|
|
|
|
|
- }
|
|
|
|
|
- }
|
|
|
|
|
- form.InviteTime = item.inviteTime
|
|
|
|
|
- form.DesignUserId = item.designUser
|
|
|
|
|
- form.DesignUser = item.designName
|
|
|
|
|
- form.FollowId = item.followId
|
|
|
|
|
- form.qvExternalUserid = item.qvExternalUserid
|
|
|
|
|
- form.qvChatId = item.qvChatId
|
|
|
|
|
- form.qvUserid = app.globalData.user.qvUserid
|
|
|
|
|
- form.noTelephone = false;
|
|
|
|
|
- if (form.qvExternalUserid && !form.CustomerPhone) {
|
|
|
|
|
- form.noTelephone = true;
|
|
|
|
|
- }
|
|
|
|
|
- let fileList = options.fileList ? JSON.parse(options.fileList) : []
|
|
|
|
|
- let radio_follow_up = ''
|
|
|
|
|
-
|
|
|
|
|
- if (item.followStatus == "跟进状态-跟进") {
|
|
|
|
|
- radio_follow_up = '1'
|
|
|
|
|
- }
|
|
|
|
|
- if (item.followStatus == "跟进状态-邀约") {
|
|
|
|
|
- radio_follow_up = '3'
|
|
|
|
|
- }
|
|
|
|
|
- if (item.followStatus == "跟进状态-约尺") {
|
|
|
|
|
- radio_follow_up = '5'
|
|
|
|
|
- }
|
|
|
|
|
- this.setData({
|
|
|
|
|
- form: form,
|
|
|
|
|
- item,
|
|
|
|
|
- EditFlag: true,
|
|
|
|
|
- radio_follow_up,
|
|
|
|
|
- fileList
|
|
|
|
|
- })
|
|
|
|
|
- } else if (options.flg === "false") {
|
|
|
|
|
- // let item = JSON.parse(options.item)
|
|
|
|
|
- let item = JSON.parse(decodeURIComponent(options.item))
|
|
|
|
|
- let form = this.data.form
|
|
|
|
|
- form.CustomerId = item.customerId
|
|
|
|
|
- form.CustomerName = item.customerName
|
|
|
|
|
- form.CustomerPhone = item.customerPhone
|
|
|
|
|
- form.addressName = item.addressName
|
|
|
|
|
- form.addressArea = item.addressArea
|
|
|
|
|
- form.AddressNo = item.addressNo
|
|
|
|
|
- form.addressFull = item.addressFull
|
|
|
|
|
- form.qvExternalUserid = item.qvExternalUserid
|
|
|
|
|
- form.qvChatId = item.qvChatId
|
|
|
|
|
- form.qvUserid = app.globalData.user.qvUserid
|
|
|
|
|
- form.saleStatus = item.saleStatus
|
|
|
|
|
- form.noTelephone = false;
|
|
|
|
|
- if (form.qvExternalUserid && !form.CustomerPhone) {
|
|
|
|
|
- form.noTelephone = true;
|
|
|
|
|
- }
|
|
|
|
|
- this.setData({
|
|
|
|
|
- form: form,
|
|
|
|
|
- })
|
|
|
|
|
- } else {
|
|
|
|
|
- this.getCurExternalContact(app.globalData.user.cpId)
|
|
|
|
|
- }
|
|
|
|
|
- this.getGoodsSpecs()
|
|
|
|
|
- },
|
|
|
|
|
-
|
|
|
|
|
- /**
|
|
|
|
|
- * 加载数据
|
|
|
|
|
- * @param {*} options
|
|
|
|
|
- */
|
|
|
|
|
- initData(options) {
|
|
|
|
|
- // 清除登录信息 user
|
|
|
|
|
- app.globalData.user = null;
|
|
|
|
|
- this.setData({
|
|
|
|
|
- loading: true,
|
|
|
|
|
- })
|
|
|
|
|
- let param = {
|
|
|
|
|
- corpid: config.corpid, //'ww796c5d1684937b2f', //先用集团的id
|
|
|
|
|
- corpsecret: config.corpsecret,//'19mqS_rUn8YzK47LUmjIDEl6PAx1gcn9v0BRIbEAJXU', //集团
|
|
|
|
|
- }
|
|
|
|
|
- //校验企业id和应用corpsecret是否正确
|
|
|
|
|
- app.qy_login_is_true(param).then(res => {
|
|
|
|
|
- // 解密当前用户信息数据后 返回改用户的cpid
|
|
|
|
|
- // 在查询客户信息
|
|
|
|
|
- this.onBindGetEnterpriseUserInfo();
|
|
|
|
|
- })
|
|
|
|
|
- },
|
|
|
|
|
- /**
|
|
|
|
|
- * 提醒时间展开
|
|
|
|
|
- *
|
|
|
|
|
- */
|
|
|
|
|
- onChangePickDate() {
|
|
|
|
|
- this.setData({
|
|
|
|
|
- show: true,
|
|
|
|
|
- nextFollowTimeSearch: new Date().getTime() + 100
|
|
|
|
|
- })
|
|
|
|
|
- },
|
|
|
|
|
- /**
|
|
|
|
|
- * 提醒时间
|
|
|
|
|
- * @param {} e
|
|
|
|
|
- */
|
|
|
|
|
- onConfirmChooseDate(e) {
|
|
|
|
|
- let form = this.data.form
|
|
|
|
|
- form.NextFollowTime = util.formatDataTime(new Date(this.data.nextFollowTimeSearch))
|
|
|
|
|
- this.setData({
|
|
|
|
|
- form: form,
|
|
|
|
|
- show: false
|
|
|
|
|
- })
|
|
|
|
|
- },
|
|
|
|
|
- /**
|
|
|
|
|
- * 提醒时间关闭
|
|
|
|
|
- *
|
|
|
|
|
- */
|
|
|
|
|
- onCloseChooseDate() {
|
|
|
|
|
- this.setData({
|
|
|
|
|
- show: false
|
|
|
|
|
- })
|
|
|
|
|
-
|
|
|
|
|
-
|
|
|
|
|
- },
|
|
|
|
|
- /**
|
|
|
|
|
- * 页面取消
|
|
|
|
|
- */
|
|
|
|
|
- cancle() {
|
|
|
|
|
- wx.navigateBack({
|
|
|
|
|
- delta: -1
|
|
|
|
|
- });
|
|
|
|
|
- },
|
|
|
|
|
- /**
|
|
|
|
|
- * 邀约到店时间展示
|
|
|
|
|
- */
|
|
|
|
|
- onChangePickDate_Month() {
|
|
|
|
|
- this.setData({
|
|
|
|
|
- show_Month: true
|
|
|
|
|
- })
|
|
|
|
|
- },
|
|
|
|
|
- /**
|
|
|
|
|
- * 邀约到店时间关闭
|
|
|
|
|
- */
|
|
|
|
|
- onCloseChooseDate_Month() {
|
|
|
|
|
- this.setData({
|
|
|
|
|
- show_Month: false
|
|
|
|
|
- })
|
|
|
|
|
- },
|
|
|
|
|
- /**
|
|
|
|
|
- * 邀约到店时间确定
|
|
|
|
|
- */
|
|
|
|
|
- onConfirmChooseDate_Month() {
|
|
|
|
|
- let form = this.data.form
|
|
|
|
|
- form.InviteTime = util.formatDataTime(new Date(this.data.inviteTimeSearch))
|
|
|
|
|
- this.setData({
|
|
|
|
|
- form: form,
|
|
|
|
|
- show_Month: false
|
|
|
|
|
- })
|
|
|
|
|
- },
|
|
|
|
|
-
|
|
|
|
|
- /**
|
|
|
|
|
- * @desc : 标识日期变化事件
|
|
|
|
|
- * @author : 秦祺
|
|
|
|
|
- * @date : 2022/5/26 17:16
|
|
|
|
|
- */
|
|
|
|
|
- changeDate(e) {
|
|
|
|
|
- let key = e.currentTarget.dataset.key
|
|
|
|
|
- if (key === 'inviteTime') {
|
|
|
|
|
- this.setData({
|
|
|
|
|
- inviteTimeSearch: e.detail
|
|
|
|
|
- })
|
|
|
|
|
- }
|
|
|
|
|
- //提醒时间
|
|
|
|
|
- if (key === 'nextFollowTime') {
|
|
|
|
|
- this.setData({
|
|
|
|
|
- nextFollowTimeSearch: e.detail
|
|
|
|
|
- })
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- },
|
|
|
|
|
-
|
|
|
|
|
- /**
|
|
|
|
|
- * 客户名称跳转客户详细
|
|
|
|
|
- */
|
|
|
|
|
- test01(e) {
|
|
|
|
|
- if (this.data.customerFlag) {
|
|
|
|
|
- return
|
|
|
|
|
- }
|
|
|
|
|
- wx.navigateTo({
|
|
|
|
|
- url: '/package3/pages/customer/detail/detail?ID=' + JSON.stringify(e.currentTarget.dataset.item.CustomerId),
|
|
|
|
|
- })
|
|
|
|
|
- },
|
|
|
|
|
- /**
|
|
|
|
|
- * 意向品类勾选
|
|
|
|
|
- * @param {*} event
|
|
|
|
|
- */
|
|
|
|
|
- checkBoxChange(event) {
|
|
|
|
|
- this.setData({
|
|
|
|
|
- result: event.detail,
|
|
|
|
|
- });
|
|
|
|
|
- },
|
|
|
|
|
- /**
|
|
|
|
|
-* @desc : 联系电话输入事件
|
|
|
|
|
-* @author : 于继渤
|
|
|
|
|
-* @date : 2022/5/24 12:16
|
|
|
|
|
-*/
|
|
|
|
|
- changeCustomerFormFieldPhone(e) {
|
|
|
|
|
- let key = e.detail.currentTarget.dataset.key
|
|
|
|
|
- let form = this.data.form
|
|
|
|
|
- form.CustomerPhone = e.detail.detail
|
|
|
|
|
- this.setData({
|
|
|
|
|
- form: form
|
|
|
|
|
- })
|
|
|
|
|
- },
|
|
|
|
|
- /**
|
|
|
|
|
- * 输入框 文字改变监听事件
|
|
|
|
|
- */
|
|
|
|
|
- fieldChange(e) {
|
|
|
|
|
- let form = this.data.form
|
|
|
|
|
- let type = e.currentTarget.dataset.key
|
|
|
|
|
- if (type === "name") {
|
|
|
|
|
- form.customerName = e.detail
|
|
|
|
|
- }
|
|
|
|
|
- if (type === "tephone") {
|
|
|
|
|
- form.CustomerPhone = e.detail
|
|
|
|
|
- }
|
|
|
|
|
- if (type === "address") {
|
|
|
|
|
- form.addressName = e.detail
|
|
|
|
|
- }
|
|
|
|
|
- if (type === "result") {
|
|
|
|
|
- form.AddressNo = e.detail
|
|
|
|
|
- }
|
|
|
|
|
- if (type === "ortherName") {
|
|
|
|
|
- form.ortherName = e.detail
|
|
|
|
|
- }
|
|
|
|
|
- if (type === "ortherPhone") {
|
|
|
|
|
- form.ortherPhone = e.detail
|
|
|
|
|
- }
|
|
|
|
|
- this.setData({
|
|
|
|
|
- form: form
|
|
|
|
|
- })
|
|
|
|
|
- },
|
|
|
|
|
})
|
|
})
|