| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116 |
- const _Http = getApp().globalData.http;
- Page({
- data: {
- list: [],
- params: {
- classname: "webmanage.saletool.orderclue.publicclue.PublicClue",
- "method": "getMatchAgentList",
- "content": {
- "nocache": true,
- "pageNumber": 1,
- "pageSize": 20,
- "sat_orderclueid": '',
- "where": {
- "condition": ""
- }
- },
- },
- detail: {}
- },
- onLoad(options) {
- getApp().globalData.Language.getLanguagePackage(this, '分配线索');
- let data = JSON.parse(options.data)
- this.setData({
- detail: data,
- 'params.content.sat_orderclueid': data.sat_orderclueid
- })
- this.getList();
- },
- /* 开始搜索 */
- onSearch({
- detail
- }) {
- console.log(detail);
- if (this.data.params.content.where.condition == detail) return;
- this.setData({
- 'params.content.where.condition': detail
- });
- this.getList(true)
- },
- onClear() {
- this.setData({
- 'params.content.where.condition': ""
- });
- this.getList(true)
- },
- /* 选中 */
- onChange(e) {
- const {
- item
- } = e.currentTarget.dataset;
- wx.showModal({
- title: getApp().globalData.Language.getMapText('提示'),
- content: getApp().globalData.Language.getMapText('是否将线索分配给') + ' ' + item.name + '?',
- cancelText: getApp().globalData.Language.getMapText('取消'),
- confirmText: getApp().globalData.Language.getMapText('确定'),
- complete: ({
- confirm
- }) => {
- if (confirm) _Http.basic({
- classname: "webmanage.saletool.orderclue.publicclue.PublicClue",
- "method": this.data.detail.cluetype == '经销商' ? 'matchAgent' : 'matchAgent_Sales',
- "content": {
- matchlist: [{
- sat_orderclueid: this.data.detail.sat_orderclueid,
- [this.data.detail.cluetype == '经销商' ? 'sa_agentsid' : 'hrid']: item.hrid
- }]
- }
- }).then(res => {
- console.log("分配线索", res)
- wx.showToast({
- title: res.code == '1' ? getApp().globalData.Language.getMapText('分配成功') : res.msg,
- icon: "none",
- mask: true
- });
- if (res.code != '1') return;
- setTimeout(() => {
- getCurrentPages().forEach(v => {
- if (v.__route__ == "packageA/publicClue/index" || v.__route__ == "packageA/saleAdmin/index") {
- v.getList(true)
- } else if (v.__route__ == "packageA/publicClue/detail" || v.__route__ == "packageA/saleAdmin/detail") {
- v.getDetail();
- }
- })
- wx.navigateBack()
- }, 500)
- })
- }
- })
- },
- //获取列表
- getList(init = false) {
- let params = this.data.params;
- if (init) params.content.pageNumber = 1;
- if (params.content.pageNumber > params.content.pageTotal) return;
- if (this.data.detail.cluetype == '业务员') {
- params.method = 'getMatchSalesList'
- } else {
- params.method = 'getMatchAgentList'
- }
- _Http.basic(params).then(res => {
- console.log("联系人", res)
- if (res.code != '1') return wx.showToast({
- title: res.data,
- icon: "none"
- });
- this.setData({
- list: res.pageNumber == 1 ? res.data : this.data.list.concat(res.data),
- "params.content.pageNumber": res.pageNumber + 1,
- "params.content.pageTotal": res.pageTotal,
- })
- })
- },
- onReachBottom() {
- this.getList();
- }
- })
|