| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237 |
- const _Http = getApp().globalData.http,
- currency = require("../../../../utils/currency"),
- CNY = value => currency(value, {
- symbol: "¥",
- precision: 2
- }).format();
- Component({
- properties: {
- disabled: {
- type: Boolean,
- value: false
- },
- isshowsalesfeesamount: {
- type: Boolean,
- value: false
- },
- isAdmin: {
- type: Boolean,
- value: false
- },
- expenseBreakdown: {
- type: Boolean,
- }
- },
- lifetimes: {
- attached() {
- getApp().globalData.Language.getLanguagePackage(this)
- }
- },
- options: {
- addGlobalClass: true
- },
- data: {
- sat_orderclueid: null,
- content: {
- nocache: true,
- pageNumber: 1,
- pageTotal: 1,
- pageSize: 20,
- total: null,
- where: {
- condition: ""
- }
- },
- showSearch: false,
- focus: false,
- condition: "",
- poputShow: false,
- followList: []
- },
- lifetimes: {
- attached: function () {
- this.setData({
- userid: wx.getStorageSync('userMsg').userid,
- })
- getApp().globalData.Language.getLanguagePackage(this)
- }
- },
- methods: {
- toSearch() {
- if (this.data.showSearch && this.data.content.where.condition) {
- this.data.content.where.condition = '';
- this.getList(this.data.sat_orderclueid, true);
- } else if (this.data.condition) {
- this.data.content.where.condition = this.data.condition;
- this.setData({
- condition: this.data.condition
- })
- this.getList(this.data.sat_orderclueid, true);
- }
- this.setData({
- showSearch: !this.data.showSearch
- })
- setTimeout(() => {
- this.setData({
- focus: this.data.showSearch
- })
- }, 300)
- },
- onChange({
- detail
- }) {
- this.data.condition = detail;
- },
- onSearch({
- detail
- }) {
- this.data.content.where.condition = detail;
- this.getList(this.data.sat_orderclueid, true)
- },
- getList(id, init = false) {
- let content = this.data.content;
- if (init) content.pageNumber = 1;
- content.sat_orderclueid = id;
- _Http.basic({
- id: 20221101094602,
- content
- }).then(res => {
- console.log('线索跟进', res);
- if (this.data.isshowsalesfeesamount) res.data = res.data.map(v => {
- v.showsalesfeesamount = CNY(v.salesfeesamount || 0)
- return v
- })
- this.setData({
- followList: res.pageNumber == 1 ? res.data : this.data.followList.concat(res.data),
- "content.pageNumber": res.pageNumber + 1,
- "content.pageTotal": res.pageTotal,
- "content.total": res.total,
- sat_orderclueid: id,
- userid: wx.getStorageSync('userMsg').userid
- })
- })
- },
- viewFiles(e) {
- const {
- item
- } = e.currentTarget.dataset;
- this.setData({
- poputShow: true
- })
- this.selectComponent("#Yl_Files").handleFiles(item.attinfo, true)
- },
- onClosePoput() {
- this.setData({
- poputShow: false
- })
- this.selectComponent("#Yl_Files").initData()
- },
- deleteItem(e) {
- const {
- item
- } = e.currentTarget.dataset,
- that = this;
- console.log(that.data)
- wx.showModal({
- title: getApp().globalData.Language.getMapText('提示'),
- content: getApp().globalData.Language.getMapText('是否确定删除该跟进记录'),
- cancelText: getApp().globalData.Language.getMapText('取消'),
- confirmText: getApp().globalData.Language.getMapText('确定'),
- complete: (res) => {
- if (res.confirm) _Http.basic({
- "id": 20221208112002,
- "content": {
- "sat_ordercluefollowuplogid": item.sat_ordercluefollowuplogid
- }
- }).then(res => {
- console.log("删除跟进记录", res)
- wx.showToast({
- title: res.code != '1' ? res.msg : getApp().globalData.Language.getMapText('删除成功'),
- icon: "none"
- });
- that.getReadList();
- })
- }
- })
- },
- getReadList() {
- let content = JSON.parse(JSON.stringify(this.data.content))
- content.pageSize = (content.pageNumber - 1) * content.pageSize;
- content.pageNumber = 1;
- _Http.basic({
- id: 20221101094602,
- content
- }).then(res => {
- console.log('线索跟进记录', res);
- this.setData({
- followList: res.data,
- "content.total": res.total
- });
- delete(_Http.changeItem)
- })
- },
- editItem(e) {
- const {
- item
- } = e.currentTarget.dataset;
- wx.navigateTo({
- url: '/packageA/publicClue/modules/follow/insert?data=' + JSON.stringify(item),
- })
- _Http.changeItem = this.getReadList.bind(this);
- },
- expenseBreakdown(e) {
- const {
- item,
- index
- } = e.currentTarget.dataset;
- wx.navigateTo({
- url: `/packageA/expenseBreakdown/index?ownertable=sat_orderclue&ownerid=${item.sat_ordercluefollowuplogid}&isAdmin=${this.data.isAdmin}&item=${
- JSON.stringify(item)
- }`,
- })
- _Http.updateEBList = function (salesfeesamount, showsalesfeesamount) {
- this.setData({
- [`followList[${index}].salesfeesamount`]: salesfeesamount,
- [`followList[${index}].showsalesfeesamount`]: showsalesfeesamount,
- })
- }.bind(this)
- },
- comment(e) {
- let page = this.selectComponent('#' + e.currentTarget.id);
- page.changeShow()
- },
- toAdd() {
- wx.navigateTo({
- url: `/packageA/publicClue/modules/follow/insert?sat_orderclueid=` + this.data.sat_orderclueid
- })
- _Http.changeItem = function () {
- this.getList(this.data.sat_orderclueid, true);
- }.bind(this)
- },
- updateCommentList({
- detail
- }) {
- console.log("detail", detail)
- detail.pageSize = 99999;
- _Http.basic({
- "id": 20240920092204,
- content: detail
- }).then(res => {
- console.log("更新评论列表", res)
- if (res.code == 1) {
- let idName = detail.ownertable + 'id';
- const index = this.data.followList.findIndex(v => v[idName] == detail.ownerid)
- if (index != -1) {
- let item = this.data.followList[index];
- item.commentqty = res.total == 0 ? 0 : res.data[0].totalqty;
- item.comment = res.data;
- this.setData({
- [`followList[${index}]`]: item
- })
- }
- }
- })
- }
- }
- })
|