crm_second_opening_mini/pages/index/groupCompany/contract/editContract.js

1 line
7.1 KiB
JavaScript

(global["webpackJsonp"]=global["webpackJsonp"]||[]).push([["pages/index/groupCompany/contract/editContract"],{"00fd":function(t,n,i){"use strict";i.r(n);var e=i("fbfb"),s=i("f1a7");for(var o in s)["default"].indexOf(o)<0&&function(t){i.d(n,t,(function(){return s[t]}))}(o);i("0fee");var c=i("f0c5"),a=Object(c["a"])(s["default"],e["b"],e["c"],!1,null,"ed77a604",null,!1,e["a"],void 0);n["default"]=a.exports},"029f":function(t,n,i){"use strict";(function(t){Object.defineProperty(n,"__esModule",{value:!0}),n.default=void 0;var e=i("76dd"),s=i("dc92"),o=i("0c59"),c=i("8683"),a={mixins:[c.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)},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{id:"",BASE_IMG_URL:o.BASE_IMG_URL,order_staff_id:"",staffname:"",staffList:[],staffIndex:null,customer_id:"",contacts_id:"",contactname:"",contactList:[],contactName:"",contactIndex:null,customerlist:[],customerName:"",cuslist:[],cusIndex:null,dateTime:null,dateTimeArray:null,startYear:2e3,remindPeople:[],remindType:"contract",info:{},listForm:[],productList:[],total_price:0,configIndex:null,approvalPro:{},businessObj:{}}},onLoad:function(t){this.customer_id=t.kehuid,this.id=t.id,this.getCustomerList(),this.getStaffList(),this.getContractDetail(),this.getProcess()},methods:{changeBusiness:function(){this.customer_id?this.$refs.businessChild.init(this.customer_id):t.showToast({title:"请先选择客户",icon:"none"})},sureBusiness:function(t){this.businessObj=t},getProcess:function(){var t=this;(0,s.netApprovalProcess)({type:"contract"}).then((function(n){t.approvalPro=n.data}))},getContractDetail:function(){var t=this;(0,e.netContractDetail)({id:this.id}).then((function(n){n=n.data,t.info=n,n.contacts&&(t.contacts_id=n.contacts.id,t.contactname=n.contacts.name),n.owner_staff&&(t.order_staff_id=n.owner_staff.id,t.staffname=n.owner_staff.name),t.businessObj=n.business,t.productList=n.product,t.handleTotalMoney(),t.getForm()}))},getForm:function(){var t=this;(0,s.netSetForm)({type:"contract"}).then((function(n){n=n.data.data,n.forEach((function(n){n.value=t.info[n.id]})),t.listForm=n}))},changeOtherData:function(t,n,i){var e=this,s=this.listForm;s.forEach((function(t,s){t.id==i.id&&(t.value=n,e.$set(e.listForm,s,t))}))},getStaffList:function(){var t=this;(0,e.netStaffList)().then((function(n){t.staffList=n.data}))},getCustomerList:function(){var t=this;(0,e.netPrevCustomer)().then((function(n){t.customerlist=n.data,t.handleCus(n.data)}))},handleCus:function(t){var n=[];t.forEach((function(t){n.push(t.name)})),this.cuslist=n,this.setDefaultKehu()},setDefaultKehu:function(){var t=this,n=this.customer_id;this.customerlist.forEach((function(i,e){i.id==n&&(t.customerName=i.name,t.cusIndex=e)})),this.getLianxiren()},changeCus:function(t){this.cusIndex=t.detail.value,this.customerName=this.customerlist[t.detail.value].name,this.customer_id=this.customerlist[t.detail.value].id,this.getLianxiren()},getLianxiren:function(){var t=this,n={customer_id:this.customer_id};(0,e.netLianxiren)(n).then((function(n){t.contactList=n.data}))},changeContact:function(t){this.contactIndex=t.detail.value,this.contacts_id=this.contactList[t.detail.value].id,this.contactname=this.contactList[t.detail.value].name},changeStaff:function(t){this.staffIndex=t.detail.value,this.order_staff_id=this.staffList[t.detail.value].id,this.staffname=this.staffList[t.detail.value].name},moreClick:function(){t.navigateTo({url:"/pagesA/crm/selectMember/selectMember"})},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 n=0;n<t.length-1;n++)for(var i=n+1;i<t.length;i++)t[n].id==t[i].id&&(t.splice(i,1),i--);return t},changeProductPrice:function(){this.handleTotalMoney()},changeNumber:function(t,n){var i=this.productList[n];i.number=t,this.$set(this.productList,n,i),this.handleTotalMoney()},delProduct:function(t){this.productList.splice(t,1),this.handleTotalMoney()},handleTotalMoney:function(){var t=0;this.productList.forEach((function(n){t+=Number(n.price)*n.number})),this.total_price=t;this.listForm.forEach((function(n){"money"==n.id&&n.value<t?n.lessthan=!0:n.lessthan=!1}))},toSelectConfig:function(t,n){this.configIndex=n,this.$refs.productConfig.init(t.id)},configList:function(t){var n=this.productList[this.configIndex];n.parts=this.deWeight(n.parts.concat(t)),this.$set(this.productList,this.configIndex,n)},changeConfigNumber:function(t,n,i){var e=this.productList[i];e.parts[n].number=t,this.$set(this.productList,i,e)},delPeizhi:function(t,n){var i=this.productList[t];i.parts.splice(n,1),this.$set(this.productList,t,i)},toSave:function(){var n=this.id,i=this.order_staff_id,s=this.customer_id,o=this.contacts_id,c=this.remindPeople,a=this.checkCommonForm(this.listForm);if(a)if(c&&0!=c.length||0!=this.approvalPro.status){var r=[];this.productList.length>0&&this.productList.forEach((function(t){r.push({product_id:t.product_id,price:t.price,number:t.number,parts:t.parts,min_price:t.min_price})}));var u=[];c.forEach((function(t){u.push(t.id)})),a=Object.assign({},a,{id:n,order_staff_id:i,customer_id:s,contacts_id:o,product:r,business_id:this.businessObj?this.businessObj.id:"",flow_staff_ids:0==this.approvalPro.status?u.join(","):""}),(0,e.netEditContract)(a).then((function(n){t.showToast({title:n.msg,icon:"none",duration:2e3}),setTimeout((function(){t.navigateBack({delta:1})}),2e3)}))}else t.showToast({title:"请选择审核人",icon:"none"})}}};n.default=a}).call(this,i("543d")["default"])},"0fee":function(t,n,i){"use strict";var e=i("241c"),s=i.n(e);s.a},"241c":function(t,n,i){},9137:function(t,n,i){"use strict";(function(t,n){var e=i("4ea4");i("8886");e(i("66fd"));var s=e(i("00fd"));t.__webpack_require_UNI_MP_PLUGIN__=i,n(s.default)}).call(this,i("bc2e")["default"],i("543d")["createPage"])},f1a7:function(t,n,i){"use strict";i.r(n);var e=i("029f"),s=i.n(e);for(var o in e)["default"].indexOf(o)<0&&function(t){i.d(n,t,(function(){return e[t]}))}(o);n["default"]=s.a},fbfb:function(t,n,i){"use strict";i.d(n,"b",(function(){return s})),i.d(n,"c",(function(){return o})),i.d(n,"a",(function(){return e}));var e={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,n=(this._self._c,this.productList.length);this.$mp.data=Object.assign({},{$root:{g0:n}})},o=[]}},[["9137","common/runtime","common/vendor"]]]);