crm_second_opening_mini/pagesA/crm/contract/contract.js

454 lines
24 KiB
JavaScript
Raw Normal View History

2023-03-15 08:28:08 +00:00
require('../../common/vendor.js');
(global["webpackJsonp"] = global["webpackJsonp"] || []).push([
["pagesA/crm/contract/contract"], {
"0d83": function(t, e, i) {
"use strict";
i.d(e, "b", (function() {
return s
})), i.d(e, "c", (function() {
return o
})), i.d(e, "a", (function() {
return n
}));
var n = {
uniNumberBox: function() {
return i.e("uni_modules/uni-number-box/components/uni-number-box/uni-number-box").then(i.bind(null, "2e8f"))
}
},
s = function() {
var t = this.$createElement,
e = (this._self._c, this.productList.length),
i = 1 != this.customerTeam.length && 0 != this.customerTeam.length && 0 != this.methodArr.length && !this.isRequired,
n = this.distributionArr.length;
this.$mp.data = Object.assign({}, {
$root: {
g0: e,
g1: i,
g2: n
}
})
},
o = []
},
"16cd": function(t, e, i) {
"use strict";
(function(t, e) {
var n = i("4ea4");
i("8886");
n(i("66fd"));
var s = n(i("ce7b"));
t.__webpack_require_UNI_MP_PLUGIN__ = i, e(s.default)
}).call(this, i("bc2e")["default"], i("543d")["createPage"])
},
"2d8e": function(t, e, i) {},
"9fe1": function(t, e, i) {
"use strict";
(function(t) {
Object.defineProperty(e, "__esModule", {
value: !0
}), e.default = void 0;
var n = i("0c59"),
s = i("dc92"),
o = i("76dd"),
r = (i("c7eb"), i("8683")),
c = {
mixins: [r.commonF],
components: {
formItem: function() {
Promise.all([i.e("common/vendor"), i.e("components/form/formitem")]).then(function() {
return resolve(i("d7bf"))
}.bind(null, i)).catch(i.oe)
},
popupList: function() {
Promise.all([i.e("common/vendor"), i.e("components/selectProduct/index")]).then(function() {
return resolve(i("a99f"))
}.bind(null, i)).catch(i.oe)
},
popupProductConfig: function() {
i.e("components/selectProductConfig/index").then(function() {
return resolve(i("55ad"))
}.bind(null, i)).catch(i.oe)
},
fixedApproval: function() {
i.e("components/fixedApproval").then(function() {
return resolve(i("d3f7"))
}.bind(null, i)).catch(i.oe)
},
selectCustomer: function() {
Promise.all([i.e("common/vendor"), i.e("components/selectCustomer")]).then(function() {
return resolve(i("5bcd"))
}.bind(null, i)).catch(i.oe)
},
selectLink: function() {
i.e("components/selectLink").then(function() {
return resolve(i("4c35"))
}.bind(null, i)).catch(i.oe)
},
selectStaff: function() {
Promise.all([i.e("common/vendor"), i.e("components/selectStaff")]).then(function() {
return resolve(i("16c8"))
}.bind(null, i)).catch(i.oe)
},
selectTeamMembers: function() {
i.e("components/selectTeammembers").then(function() {
return resolve(i("7398"))
}.bind(null, i)).catch(i.oe)
},
selectBusiness: function() {
Promise.all([i.e("common/vendor"), i.e("components/selectBusiness")]).then(function() {
return resolve(i("be33"))
}.bind(null, i)).catch(i.oe)
}
},
data: function() {
return {
noClick: !0,
name: "",
num: "",
order_date: "",
money: "",
start_time: "",
end_time: "",
order_staff_id: "",
staffName: "",
customerlist: [],
customer_id: "",
customerName: "",
contacts_id: "",
contactName: "",
dateTime: null,
dateTimeArray: null,
dateArr: null,
startYear: 2e3,
BASE_IMG_URL: n.BASE_IMG_URL,
DefaultRemind: [],
remindPeople: [],
remindType: "contract",
listForm: [],
productList: [],
total_price: 0,
configIndex: null,
approvalPro: {},
methodArr: ["五五", "三六一", "三七"],
methodIndex: null,
distributionArr: [],
distributionIndex: null,
customerTeam: [],
businessObj: {},
business_id: "",
isRequired: !1
}
},
onLoad: function(t) {
this.customer_id = t.id, t.businessid && (this.business_id = t.businessid, this.getDefaultBusiness(), this.getBusinessProduct()), this.getNumber(), this.getCustomerList(), this.getProcess(), this.getdisType()
},
methods: {
changeRequired: function(t) {
this.isRequired = t.detail.value
},
getDefaultBusiness: function() {
var t = this;
(0, s.netRelationBusiness)({
customer_id: this.customer_id
}).then((function(e) {
var i = e.data;
i.forEach((function(e) {
e.id == t.business_id && (t.businessObj = e)
}))
}))
},
getBusinessProduct: function() {
var t = this;
(0, s.netBusinessDetail)({
id: this.business_id
}).then((function(e) {
var i = e.data.product;
i.forEach((function(t) {
t.id = t.product_id
})), t.productList = i
}))
},
changeBusiness: function() {
this.customer_id ? this.$refs.businessChild.init(this.customer_id) : t.showToast({
title: "请先选择客户",
icon: "none"
})
},
sureBusiness: function(t) {
this.businessObj = t
},
getdisType: function() {
var t = this;
(0, s.netDistributionType)().then((function(e) {
t.methodArr = e.data
}))
},
changeMethod: function(t) {
var e = this;
this.methodIndex = t.detail.value;
var i = this.methodArr[this.methodIndex].ratio;
this.distributionArr = [], i.forEach((function(t) {
e.distributionArr.push({
name: t.ratio,
staff: {}
})
}))
},
delDistribution: function() {
this.distributionArr = [], this.methodIndex = null
},
delDisStaff: function(t) {
var e = this.distributionArr[t];
e.staff = {}, this.$set(this.distributionArr, t, e)
},
selectTeam: function(e) {
this.customer_id ? (this.distributionIndex = e, this.$refs.teamChild.init(this.customer_id)) : t.showToast({
title: "请先选择客户",
icon: "none"
})
},
sureTeam: function(t) {
console.log(t, "选择");
var e = this.distributionArr[this.distributionIndex];
e.staff = t, this.$set(this.distributionArr, this.distributionIndex, e), console.log(this.distributionArr, "数据")
},
getProcess: function() {
var t = this;
(0, s.netApprovalProcess)({
type: "contract"
}).then((function(e) {
t.approvalPro = e.data
}))
},
getForm: function() {
var t = this,
e = this;
(0, s.netSetForm)({
type: "contract"
}).then((function(i) {
i = i.data.data, i.forEach((function(t) {
"num" == t.id && "合同编号" == t.config.label ? t.value = e.num : t.value = ""
})), t.listForm = i
}))
},
changeOtherData: function(t, e, i) {
var n = this,
s = this.listForm;
s.forEach((function(t, s) {
t.id == i.id && (t.value = e, n.$set(n.listForm, s, t))
}))
},
getCustomerList: function() {
var t = this;
(0, o.netPrevCustomer)().then((function(e) {
t.customerlist = e.data, t.setDefaultKehu()
}))
},
setDefaultKehu: function() {
var t = this,
e = this.customer_id;
this.customerlist.forEach((function(i, n) {
i.id == e && (t.customerName = i.name, t.getLianxiren())
}))
},
changeCus: function(t) {
this.$refs.customerChild.init()
},
sureSelect: function(t) {
this.customerName = t.name, this.customer_id = t.id, this.contacts_id = "", this.contactName = "", this.getTeamNum()
},
getTeamNum: function() {
var t = this,
e = {
id: this.customer_id
};
(0, s.netTeamList)(e).then((function(e) {
t.customerTeam = e.data
}))
},
getLianxiren: function() {
var e = this,
i = {
customer_id: this.customer_id
};
(0, o.netLianxiren)(i).then((function(i) {
if (0 != i.data.length) {
var n = i.data[0];
e.contacts_id = n.id, e.contactName = n.name
} else t.showToast({
title: "此客户没有联系人,请前去添加",
icon: "none"
})
}))
},
changeContact: function(t) {
this.$refs.linkChild.init(this.customer_id)
},
sureLink: function(t) {
this.contacts_id = t.id, this.contactName = t.name
},
changeStaff: function(t) {
this.$refs.staffChild.init()
},
sureStaff: function(t) {
this.order_staff_id = t.id, this.staffName = t.name
},
moreClick: function() {
t.navigateTo({
url: "/pagesA/crm/selectMember/selectMember"
})
},
getNumber: function() {
var t = this;
(0, o.netContractNum)().then((function(e) {
t.num = e.data.number, t.listForm = [], t.getForm()
}))
},
addPart: function() {
this.$refs.productChild.init()
},
closePop: function() {
this.showProduct = !1
},
selectList: function(t) {
this.showProduct = !1, t.forEach((function(t) {
t.minprice = t.price, t.parts = []
})), this.productList = this.deWeight(t.concat(this.productList)), this.handleTotalMoney()
},
deWeight: function(t) {
for (var e = 0; e < t.length - 1; e++)
for (var i = e + 1; i < t.length; i++) t[e].id == t[i].id && (t.splice(i, 1), i--);
return t
},
changeProductPrice: function() {
this.handleTotalMoney()
},
changeNumber: function(t, e) {
var i = this.productList[e];
i.number = t, this.$set(this.productList, e, i), this.handleTotalMoney()
},
delProduct: function(t) {
this.productList.splice(t, 1), this.handleTotalMoney()
},
handleTotalMoney: function() {
var t = 0;
this.productList.forEach((function(e) {
t += Number(e.price) * e.number
})), this.total_price = t;
this.listForm.forEach((function(e) {
"money" == e.id && e.value < t ? e.lessthan = !0 : e.lessthan = !1
}))
},
toSelectConfig: function(t, e) {
this.configIndex = e, this.$refs.productConfig.init(t.id)
},
configList: function(t) {
var e = this.productList[this.configIndex];
e.parts = this.deWeight(e.parts.concat(t)), this.$set(this.productList, this.configIndex, e)
},
changeConfigNumber: function(t, e, i) {
var n = this.productList[i];
n.parts[e].number = t, this.$set(this.productList, i, n)
},
delPeizhi: function(t, e) {
var i = this.productList[t];
i.parts.splice(e, 1), this.$set(this.productList, t, i)
},
toSave: function() {
var e = this.order_staff_id,
i = this.customer_id,
n = this.contacts_id,
s = this.remindPeople;
var r = this.checkCommonForm(this.listForm);
if (r)
if (0 != s.length || 0 != this.approvalPro.status) {
var c = [];
s.forEach((function(t) {
c.push(t.id)
}));
var u = [];
this.productList.length > 0 && this.productList.forEach((function(t) {
u.push({
product_id: t.id,
price: t.price,
number: t.number,
parts: t.parts
})
}));
var a = [],
d = !1;
this.distributionArr.forEach((function(t) {
t.staff && t.staff.id ? a.push({
ratio: t.name,
staff_id: t.staff.id
}) : d = !0
})), d ? t.showToast({
title: "请选择业绩分配的成员",
icon: "none"
}) : (r = Object.assign({}, r, {
order_staff_id: e,
customer_id: i,
contacts_id: n,
product: u,
ratios: a,
business_id: this.businessObj.id,
flow_staff_ids: 0 == this.approvalPro.status ? c.join(",") : ""
}), (0, o.netCreateContract)(r).then((function(e) {
t.showToast({
title: e.msg,
icon: "none",
duration: 2e3
}), setTimeout((function() {
t.navigateBack({
delta: 1
})
}), 2e3)
})))
} else t.showToast({
title: "请选择审核人",
icon: "none"
})
}
}
};
e.default = c
}).call(this, i("543d")["default"])
},
ce7b: function(t, e, i) {
"use strict";
i.r(e);
var n = i("0d83"),
s = i("e091");
for (var o in s)["default"].indexOf(o) < 0 && function(t) {
i.d(e, t, (function() {
return s[t]
}))
}(o);
i("dd7b");
var r = i("f0c5"),
c = Object(r["a"])(s["default"], n["b"], n["c"], !1, null, "63eed792", null, !1, n["a"], void 0);
e["default"] = c.exports
},
dd7b: function(t, e, i) {
"use strict";
var n = i("2d8e"),
s = i.n(n);
s.a
},
e091: function(t, e, i) {
"use strict";
i.r(e);
var n = i("9fe1"),
s = i.n(n);
for (var o in n)["default"].indexOf(o) < 0 && function(t) {
i.d(e, t, (function() {
return n[t]
}))
}(o);
e["default"] = s.a
}
},
[
["16cd", "common/runtime", "common/vendor"]
]
]);