|
|
@@ -0,0 +1,388 @@
|
|
|
+const app = getApp();
|
|
|
+const api = require('../../../utils/api.js');
|
|
|
+const Constants = require('../../../utils/Constants.js');
|
|
|
+const util = require('../../../utils/util.js')
|
|
|
+Page({
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 页面的初始数据
|
|
|
+ */
|
|
|
+ data: {
|
|
|
+ form: {
|
|
|
+ CustomerName: '', //客户名称
|
|
|
+ reportUserName: '', //业务员
|
|
|
+ NextFollowPlan: '', //下次跟进计划
|
|
|
+ NextFollowTime: '', //下次跟进时间
|
|
|
+ },
|
|
|
+ customerName: '刘总',
|
|
|
+ staffName: '马凯',
|
|
|
+ selectPeriodvalue: '',
|
|
|
+ startChecked: false,
|
|
|
+ selectPeriodFlg: false,
|
|
|
+ dayWeekFlg: true,
|
|
|
+ stepper: 0,
|
|
|
+ skipSaturday: false,
|
|
|
+ skipSunday: false,
|
|
|
+ mess: '请选择',
|
|
|
+ weekValueitem: '',
|
|
|
+ vMonday: false,
|
|
|
+ vThuesday: false,
|
|
|
+ vWednesday: false,
|
|
|
+ vThursday: false,
|
|
|
+ vFriday: false,
|
|
|
+ vSaturday: false,
|
|
|
+ vSunday: false,
|
|
|
+ strLength: 0,
|
|
|
+ minDate: new Date().getTime(),
|
|
|
+ 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;
|
|
|
+ },
|
|
|
+ },
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 生命周期函数--监听页面加载
|
|
|
+ */
|
|
|
+ onLoad: function (options) {
|
|
|
+ let form = this.data.form
|
|
|
+ form.reportUserName = app.globalData.user.userName
|
|
|
+ form.reportUser = app.globalData.user.userId
|
|
|
+ form.orgName = app.globalData.user.jobName
|
|
|
+ form.orgId = app.globalData.user.jobId
|
|
|
+ let item = JSON.parse(decodeURIComponent(options.item))
|
|
|
+ form.CustomerName = item.customerName
|
|
|
+ form.CustomerId = item.customerId
|
|
|
+ form.FollowId = item.followId //跟进ID
|
|
|
+ form.saleStatus = item.saleStatus//客成状态
|
|
|
+ this.setData({
|
|
|
+ form
|
|
|
+ })
|
|
|
+ },
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 生命周期函数--监听页面初次渲染完成
|
|
|
+ */
|
|
|
+ onReady: function () {
|
|
|
+
|
|
|
+ },
|
|
|
+ //下次跟进时间
|
|
|
+ onChangePickDate() {
|
|
|
+ this.setData({
|
|
|
+ show: true
|
|
|
+ })
|
|
|
+ },
|
|
|
+ /**
|
|
|
+ * @desc : 选择业务员
|
|
|
+ * @author : 于继渤
|
|
|
+ * @date : 2022/5/26 12:16
|
|
|
+ */
|
|
|
+ openStaffDropdown() {
|
|
|
+ this.setData({
|
|
|
+ staffFlag: true
|
|
|
+ })
|
|
|
+
|
|
|
+ },
|
|
|
+ /**
|
|
|
+ * @desc : 下拉单选确认事件
|
|
|
+ * @author : 于继渤
|
|
|
+ * @date : 2022/5/26 12:16
|
|
|
+ */
|
|
|
+ singleSearchAll(e) {
|
|
|
+ let form = this.data.form
|
|
|
+ form.reportUserName = e.detail.name
|
|
|
+ form.reportUser = e.detail.id
|
|
|
+ this.setData({
|
|
|
+ form
|
|
|
+ })
|
|
|
+ },
|
|
|
+ /**
|
|
|
+ * @desc : 下拉单选关闭事件
|
|
|
+ * @author : 于继渤
|
|
|
+ * @date : 2022/5/26 12:16
|
|
|
+ */
|
|
|
+ singleCloseAll(e) {},
|
|
|
+ /**
|
|
|
+ * 下次跟进时间
|
|
|
+ * @param {} e
|
|
|
+ */
|
|
|
+ onConfirmChooseDate(e) {
|
|
|
+ let form = this.data.form
|
|
|
+ form.NextFollowTime = util.formatDataTime(new Date(this.data.nextFollowTimeSearch))
|
|
|
+ this.setData({
|
|
|
+ form: form,
|
|
|
+ show: false
|
|
|
+ })
|
|
|
+ },
|
|
|
+ /**
|
|
|
+ * 下次跟进时间关闭
|
|
|
+ * @param {} e
|
|
|
+ */
|
|
|
+ onCloseChooseDate() {
|
|
|
+ this.setData({
|
|
|
+ show: false
|
|
|
+ })
|
|
|
+ },
|
|
|
+ /**
|
|
|
+ * @desc : 标识日期变化事件
|
|
|
+ * @author : 秦祺
|
|
|
+ * @date : 2022/5/26 17:16
|
|
|
+ */
|
|
|
+ changeDate(e) {
|
|
|
+ let key = e.currentTarget.dataset.key
|
|
|
+ //量尺时间
|
|
|
+ if (key === 'nextFollowTime') {
|
|
|
+ this.setData({
|
|
|
+ nextFollowTimeSearch: e.detail
|
|
|
+ })
|
|
|
+ }
|
|
|
+ },
|
|
|
+ /**
|
|
|
+ * 下次跟进计划
|
|
|
+ * @param {} event
|
|
|
+ */
|
|
|
+ onMeasureRemarksChange(event) {
|
|
|
+ let form = this.data.form
|
|
|
+ form.NextFollowPlan = event.detail
|
|
|
+ // strLength = event.detail.value.length
|
|
|
+ this.setData({
|
|
|
+ form: form,
|
|
|
+ // strLength
|
|
|
+ })
|
|
|
+ },
|
|
|
+ /**
|
|
|
+ * 保存
|
|
|
+ *
|
|
|
+ */
|
|
|
+ submit() {
|
|
|
+ return
|
|
|
+ let result = this.checkForm();
|
|
|
+ if (result.flag) {
|
|
|
+ let param = {}
|
|
|
+ param.customerId = this.data.form.CustomerId //客户名称
|
|
|
+ param.followId = this.data.form.FollowId //跟进ID
|
|
|
+ param.followUser = this.data.form.reportUser //跟进人
|
|
|
+ param.nextFollowPlan = this.data.form.NextFollowPlan //下次跟进计划
|
|
|
+ param.nextFollowTime = this.data.form.NextFollowTime //下次跟进时间
|
|
|
+ param.xxlJobId = 1 //提醒中间件ID
|
|
|
+ param.cpId = app.globalData.user.cpId //所属公司
|
|
|
+ param.planType = 0
|
|
|
+ param.saleStatus = this.data.form.saleStatus //客成状态
|
|
|
+ this.setData({
|
|
|
+ loading: true,
|
|
|
+ loadingButtonFlag: true,
|
|
|
+ })
|
|
|
+ api.request(Constants.SALE_CUSTOMERFOLLOW_PLAN_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,
|
|
|
+ loadingButtonFlag: false
|
|
|
+ })
|
|
|
+ }
|
|
|
+
|
|
|
+ },
|
|
|
+ /* 表单校验 */
|
|
|
+ checkForm() {
|
|
|
+ if (!this.data.form.NextFollowTime) {
|
|
|
+ return {
|
|
|
+ flag: false,
|
|
|
+ msg: '下次跟进时间为空'
|
|
|
+ };
|
|
|
+ }
|
|
|
+ return {
|
|
|
+ flag: true,
|
|
|
+ msg: '表单校验通过'
|
|
|
+ }
|
|
|
+ },
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 下面的代码着实不到是干嘛的,但是也没敢删除 视图上也有相应事件
|
|
|
+ *
|
|
|
+ */
|
|
|
+ setDayMessage(e) {
|
|
|
+ let mess = ""
|
|
|
+ if (this.data.vMonday) {
|
|
|
+ mess += "周一,"
|
|
|
+ }
|
|
|
+ if (this.data.vThuesday) {
|
|
|
+ mess += "周二,"
|
|
|
+ }
|
|
|
+ if (this.data.vWednesday) {
|
|
|
+ mess += "周三,"
|
|
|
+ }
|
|
|
+ if (this.data.vThursday) {
|
|
|
+ mess += "周四,"
|
|
|
+ }
|
|
|
+ if (this.data.vFriday) {
|
|
|
+ mess += "周五,"
|
|
|
+ }
|
|
|
+ if (this.data.vSaturday) {
|
|
|
+ mess += "周六,"
|
|
|
+ }
|
|
|
+ if (this.data.vSunday) {
|
|
|
+ mess += "周天,"
|
|
|
+ }
|
|
|
+ this.setData({
|
|
|
+ mess: mess
|
|
|
+ })
|
|
|
+ },
|
|
|
+ clickvMonday(e) {
|
|
|
+ this.setData({
|
|
|
+ vMonday: !this.data.vMonday
|
|
|
+ })
|
|
|
+ this.setDayMessage()
|
|
|
+ },
|
|
|
+ clickvThuesday(e) {
|
|
|
+ this.setData({
|
|
|
+ vThuesday: !this.data.vThuesday
|
|
|
+ })
|
|
|
+ this.setDayMessage()
|
|
|
+ },
|
|
|
+ clickvWednesday(e) {
|
|
|
+ this.setData({
|
|
|
+ vWednesday: !this.data.vWednesday
|
|
|
+ })
|
|
|
+
|
|
|
+ this.setDayMessage()
|
|
|
+ },
|
|
|
+ clickvThursday(e) {
|
|
|
+ this.setData({
|
|
|
+ vThursday: !this.data.vThursday
|
|
|
+ })
|
|
|
+
|
|
|
+ this.setDayMessage()
|
|
|
+ },
|
|
|
+ clickvFriday(e) {
|
|
|
+ this.setData({
|
|
|
+ vFriday: !this.data.vFriday
|
|
|
+ })
|
|
|
+ this.setDayMessage()
|
|
|
+ },
|
|
|
+ clickvSaturday(e) {
|
|
|
+ this.setData({
|
|
|
+ vSaturday: !this.data.vSaturday
|
|
|
+ })
|
|
|
+ this.setDayMessage()
|
|
|
+ },
|
|
|
+ clickvSunday(e) {
|
|
|
+ this.setData({
|
|
|
+ vSunday: !this.data.vSunday
|
|
|
+ })
|
|
|
+ this.setDayMessage()
|
|
|
+ },
|
|
|
+ clickWeekValue(e) {
|
|
|
+ this.setData({
|
|
|
+ weekValueitem: e.target.dataset.item
|
|
|
+ })
|
|
|
+ weekValue[e.target.dataset.item] = true
|
|
|
+ },
|
|
|
+
|
|
|
+ setMessage() {
|
|
|
+ let mess = "每隔" + this.data.stepper + "天重复"
|
|
|
+ if (this.data.skipSaturday) {
|
|
|
+ mess += ",跳过周六重复"
|
|
|
+ }
|
|
|
+ if (this.data.skipSunday) {
|
|
|
+ mess += ",跳过周天重复"
|
|
|
+ }
|
|
|
+ this.setData({
|
|
|
+ mess: mess
|
|
|
+ })
|
|
|
+ },
|
|
|
+ onChangeSunday(e) {
|
|
|
+ this.setData({
|
|
|
+ skipSunday: e.detail
|
|
|
+ })
|
|
|
+ this.setMessage()
|
|
|
+ },
|
|
|
+ onChangeSaturday(e) {
|
|
|
+ this.setData({
|
|
|
+ skipSaturday: e.detail
|
|
|
+ })
|
|
|
+ this.setMessage()
|
|
|
+ },
|
|
|
+ onChangeStepper(e) {
|
|
|
+ this.setData({
|
|
|
+ stepper: e.detail
|
|
|
+ })
|
|
|
+ this.setMessage()
|
|
|
+
|
|
|
+ },
|
|
|
+ clickDay(e) {
|
|
|
+ this.setData({
|
|
|
+ dayWeekFlg: true,
|
|
|
+ mess: '请选择'
|
|
|
+ })
|
|
|
+ },
|
|
|
+
|
|
|
+ clickWeek(e) {
|
|
|
+ this.setData({
|
|
|
+ dayWeekFlg: false,
|
|
|
+ mess: '请选择'
|
|
|
+ })
|
|
|
+ },
|
|
|
+
|
|
|
+ selectPeriodOk(e) {
|
|
|
+ this.setData({
|
|
|
+ selectPeriodFlg: false
|
|
|
+ })
|
|
|
+ },
|
|
|
+ selectPeriodCancel(e) {
|
|
|
+ this.setData({
|
|
|
+ selectPeriodFlg: false
|
|
|
+ })
|
|
|
+ },
|
|
|
+})
|