| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220 |
- const deleteMark = require("../../utils/deleteMark"),
- getTime = require("../../utils/getTime"),
- _Http = getApp().globalData.http,
- QQMapWX = require('../../utils/qqmap-wx-jssdk.min'),
- qqmapsdk = new QQMapWX({
- key: 'QF6BZ-4IQC5-SN2IH-QL5BW-U4IJO-R3BY4' // 必填
- });
- Page({
- data: {
- sat_orderclueid: null,
- deleteItem: false,
- actionShow: false,
- date1: getTime.formatTime(new Date(), '-').split(' ')[0],
- time: getTime.formatTime(new Date(), '-').split(' ')[1],
- actions: [],
- disabled: true,
- loading: false,
- },
- onLoad(options) {
- if (options.sat_orderclueid) this.setData({
- sat_orderclueid: options.sat_orderclueid
- })
- this.getFollowType()
- this.init();
- },
- bindDateChange: function (e) {
- this.setData({
- date1: e.detail.value
- })
- },
- bindTimeChange(e) {
- this.setData({
- time: e.detail.value+":00"
- })
- },
- /* 跟进初始化 */
- init() {
- let that = this;
- _Http.basic({
- id: "20221208100602",
- "content": {
- sat_orderclueid: this.data.sat_orderclueid,
- sat_ordercluefollowuplogid: 0,
- "content": "",
- "followupmode": "",
- "logtype": "",
- "competitor": "",
- latitude: "", //经度
- longitude: "", //纬度
- address: "", //逆解析位置
- }
- }).then(res => {
- console.log("初始化", res)
- if (res.msg != '成功') {
- wx.showToast({
- title: '初始化失败!请稍后再试',
- icon: "none"
- });
- setTimeout(() => {
- wx.navigateBack()
- }, 300)
- return
- } else {
- that.setData({
- content: res.data,
- deleteItem: true,
- });
- wx.getLocation({
- type: 'wgs84',
- altitude: true,
- isHighAccuracy: true,
- highAccuracyExpireTime: 5000,
- success({
- latitude,
- longitude
- }) {
- that.setData({
- "content.latitude": latitude,
- "content.longitude": longitude
- })
- qqmapsdk.reverseGeocoder({
- location: {
- latitude,
- longitude
- },
- success(s) {
- console.log("逆解析", s)
- that.setData({
- "content.address": s.result.address,
- })
- }
- })
- },
- fail(err) {
- console.log(err)
- }
- })
- }
- })
- },
- submit() {
- if (this.data.loading) return;
- let content = this.data.content;
- content.createdate = this.data.date1 + " " + this.data.time
- this.setData({
- loading: true
- })
- content.logtype = '跟进';
- _Http.basic({
- id: "20221208100602",
- content
- }).then(res => {
- this.setData({
- loading: false
- })
- if (res.msg != '成功') return wx.showToast({
- title: res.msg,
- icon: "none"
- });
- this.setData({
- deleteItem: false
- })
- wx.showToast({
- title: '保存成功!',
- })
- setTimeout(() => {
- let page = getCurrentPages().find(v => v.__route__ == 'packageA/saleClue/detail');
- page.selectComponent("#follow").getList(page.data.sat_orderclueid, true);
- page.getDetail();
- wx.navigateBack();
- }, 300)
- })
- },
- /* 绑定媒体 */
- insertImgEdit({
- detail
- }) {
- _Http.basic({
- "classname": "system.attachment.Attachment",
- "method": "createFileLink",
- "content": {
- "ownertable": "sat_ordercluefollowuplog",
- "ownerid": this.data.content.sat_ordercluefollowuplogid,
- "usetype": "default",
- "attachmentids": detail
- }
- }).then(res => {
- console.log('跟进记录绑定附件', res)
- if (res.msg != '成功') return wx.showToast({
- title: res.msg,
- icon: "none"
- })
- this.selectComponent("#Yl_Files").handleFiles(res.data)
- })
- },
- /* 获取跟进方式 */
- async getFollowType() {
- let res = await _Http.basic({
- "classname": "sysmanage.develop.optiontype.optiontype",
- "method": "optiontypeselect",
- "content": {
- "typename": 'followupmode'
- }
- })
- let Arr = res.data.map(item => {
- return {
- name: item.value
- }
- })
- this.setData({
- actions: Arr
- })
- },
- /* 打开选择跟进方式 */
- selectWay() {
- this.setData({
- actionShow: !this.data.actionShow
- })
- },
- /* 选择方式 */
- onSelect(e) {
- this.setData({
- "content.followupmode": e.detail.name
- })
- this.isDisabled();
- },
- /* 选择结果 */
- changeType(e) {
- if (e.target.dataset.name) this.setData({
- 'content.logtype': e.target.dataset.name
- })
- this.isDisabled();
- },
- /* 输入框输入内容 */
- inputChange(e) {
- let text = e.type == 'input' ? e.detail.value : e.detail;
- this.setData({
- "content.content": deleteMark.queryStr(text)
- })
- this.isDisabled();
- },
- isDisabled() {
- let data = this.data.content;
- this.setData({
- disabled: (data.followupmode != '' && data.content != '') ? false : true
- })
- },
- onUnload() {
- if (this.data.deleteItem) _Http.basic({
- "id": 20221208112002,
- "content": {
- "sat_ordercluefollowuplogid": this.data.content.sat_ordercluefollowuplogid
- }
- }).then(res => {
- console.log("删除未提交", res)
- })
- }
- })
|