ProjectQuotationAdd.vue 28 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750
  1. <template>
  2. <div>
  3. <el-drawer
  4. :title="title"
  5. :visible.sync="drawer"
  6. size="600px"
  7. direction="rtl"
  8. append-to-body
  9. :show-close="false"
  10. @close="onClose">
  11. <div class="drawer__panel" style="margin-bottom: 0px">
  12. <el-row style="margin-top: 10px" :gutter="10">
  13. <el-form :model="form" :rules="rules" ref="form" size="mini" label-position="right">
  14. <el-col :span="24">
  15. <el-form-item label="报价类型:" label-width="100px" >
  16. <el-input v-model="form.type" autocomplete="off" placeholder="报价类型" disabled></el-input>
  17. </el-form-item>
  18. </el-col>
  19. <!-- <el-col :span="24">
  20. <el-form-item label="是否特价:" label-width="100px" >
  21. <el-input v-model="form.specialOffer" autocomplete="off" placeholder="是否特价" disabled></el-input>
  22. </el-form-item>
  23. </el-col>-->
  24. <el-col :span="24" v-if="isQuotedPrice">
  25. <el-form-item label="项目名称:" label-width="100px" prop="projectname">
  26. <el-popover
  27. placement="bottom"
  28. width="700"
  29. trigger="click"
  30. v-model="projectShow"
  31. @show="projectList">
  32. <el-input
  33. style="width:300px;margin-bottom: 10px"
  34. placeholder="请输入内容"
  35. v-model="projectParam.content.where.condition"
  36. clearable
  37. @clear="projectList(projectParam.content.pageNumber = 1)"
  38. size="mini"
  39. @keyup.enter.native="projectList(projectParam.content.pageNumber = 1)">
  40. <i slot="prefix" class="el-icon-search" @click="projectList(projectParam.content.pageNumber = 1)"></i>
  41. </el-input>
  42. <el-table :data="project.projectData" @row-click="projectData" height="396px" :header-cell-style="{background:'#EEEEEE',color:'#333'}" size="mini">
  43. <el-table-column
  44. label="项目编号"
  45. width="180">
  46. <template slot-scope="scope">
  47. <span style="margin-left: 10px">{{ scope.row.projectnum?scope.row.projectnum:'--' }}</span>
  48. </template>
  49. </el-table-column>
  50. <el-table-column
  51. label="项目名称"
  52. width="180">
  53. <template slot-scope="scope">
  54. <span style="margin-left: 10px">{{ scope.row.projectname?scope.row.projectname:'--' }}</span>
  55. </template>
  56. </el-table-column>
  57. <el-table-column
  58. label="地址"
  59. >
  60. <template slot-scope="scope">
  61. <span style="margin-left: 10px">{{ scope.row.address?scope.row.address:'--' }}</span>
  62. </template>
  63. </el-table-column>
  64. </el-table>
  65. <div class="container normal-panel" style="text-align:right">
  66. <el-pagination
  67. background
  68. small
  69. @size-change="handleSizeChangeProject"
  70. @current-change="handleCurrentChangeProject"
  71. :page-sizes="[10,20,50,100,]"
  72. layout="total,sizes, prev, pager, next, jumper"
  73. :current-page="project.currentPage"
  74. :total="project.total">
  75. </el-pagination>
  76. </div>
  77. <el-input slot="reference" :readonly="true" v-model="form.projectname" autocomplete="off" placeholder="请选择项目" @input="selectProject"></el-input>
  78. </el-popover>
  79. </el-form-item>
  80. </el-col>
  81. <el-col :span="24" v-if="isQuotedPrice">
  82. <el-form-item label="项目编号:" label-width="100px" >
  83. <el-input v-model="form.projectnum" autocomplete="off" placeholder="项目编号" disabled></el-input>
  84. </el-form-item>
  85. </el-col>
  86. <el-col :span="24">
  87. <el-form-item label="客户名称:" label-width="100px" prop="enterprisename">
  88. <el-popover
  89. placement="bottom"
  90. width="700"
  91. trigger="click"
  92. v-model="customerShow"
  93. @show="customerList">
  94. <el-input
  95. style="width:300px;margin-bottom: 10px"
  96. placeholder="请输入内容"
  97. v-model="customerParam.content.where.condition"
  98. clearable
  99. @clear="customerList(customerParam.content.pageNumber = 1)"
  100. size="mini"
  101. @keyup.enter.native="customerList(customerParam.content.pageNumber = 1)">
  102. <i slot="prefix" class="el-icon-search" @click="customerList(customerParam.content.pageNumber = 1)"></i>
  103. </el-input>
  104. <el-table :data="customer.customerData" @row-click="customerData" height="396px" :header-cell-style="{background:'#EEEEEE',color:'#333'}" size="mini">
  105. <el-table-column
  106. label="客户编号"
  107. width="180">
  108. <template slot-scope="scope">
  109. <span style="margin-left: 10px">{{ scope.row.sa_customersid?scope.row.sa_customersid:'--' }}</span>
  110. </template>
  111. </el-table-column>
  112. <el-table-column
  113. label="客户名称"
  114. width="200">
  115. <template slot-scope="scope">
  116. <span style="margin-left: 10px">{{ scope.row.enterprisename?scope.row.enterprisename:'--'}}</span>
  117. </template>
  118. </el-table-column>
  119. <el-table-column
  120. label="地址"
  121. >
  122. <template slot-scope="scope">
  123. <span style="margin-left: 10px">{{ scope.row.address?scope.row.address:'--' }}</span>
  124. </template>
  125. </el-table-column>
  126. </el-table>
  127. <div class="container normal-panel" style="text-align:right">
  128. <el-pagination
  129. background
  130. small
  131. @size-change="handleSizeChangeCustomer"
  132. @current-change="handleCurrentChangeCustomer"
  133. :page-sizes="[10,20,50,100,]"
  134. layout="total,sizes, prev, pager, next, jumper"
  135. :current-page="customer.currentPage"
  136. :total="customer.total">
  137. </el-pagination>
  138. </div>
  139. <el-input slot="reference" :readonly="true" v-model="form.enterprisename" autocomplete="off" placeholder="请选择客户" @input="selectCustomer"></el-input>
  140. </el-popover>
  141. </el-form-item>
  142. </el-col>
  143. <el-col :span="24">
  144. <el-form-item label="电话:" label-width="100px" >
  145. <el-input v-model="form.telephone" autocomplete="off" placeholder="输入电话" disabled></el-input>
  146. </el-form-item>
  147. </el-col>
  148. <el-col :span="24">
  149. <el-form-item label="联系人:" label-width="100px" prop="name">
  150. <el-popover
  151. placement="bottom"
  152. width="700"
  153. trigger="click"
  154. v-model="contactsShow"
  155. @show="contactsList">
  156. <el-input
  157. style="width:300px;margin-bottom: 10px"
  158. placeholder="请输入内容"
  159. v-model="contactsParam.content.where.condition"
  160. clearable
  161. @clear="contactsList(contactsParam.content.pageNumber = 1)"
  162. size="mini"
  163. @keyup.enter.native="contactsList(contactsParam.content.pageNumber = 1)">
  164. <i slot="prefix" class="el-icon-search" @click="contactsList(contactsParam.content.pageNumber = 1)"></i>
  165. </el-input>
  166. <el-table :data="contacts.contactsData" @row-click="contactsData" height="396px" :header-cell-style="{background:'#EEEEEE',color:'#333'}" size="mini">
  167. <el-table-column
  168. label="姓名"
  169. width="180">
  170. <template slot-scope="scope">
  171. <span style="margin-left: 10px">{{ scope.row.name?scope.row.name:'--' }}</span>
  172. </template>
  173. </el-table-column>
  174. <el-table-column
  175. label="手机号"
  176. width="180">
  177. <template slot-scope="scope">
  178. <span style="margin-left: 10px">{{ scope.row.phonenumber?scope.row.phonenumber:'--' }}</span>
  179. </template>
  180. </el-table-column>
  181. <el-table-column
  182. label="邮箱"
  183. width="180">
  184. <template slot-scope="scope">
  185. <span style="margin-left: 10px">{{ scope.row.email?scope.row.email:'--' }}</span>
  186. </template>
  187. </el-table-column>
  188. <el-table-column
  189. label="地址"
  190. >
  191. <template slot-scope="scope">
  192. <span style="margin-left: 10px">{{ scope.row.address?scope.row.address:'--' }}</span>
  193. </template>
  194. </el-table-column>
  195. </el-table>
  196. <div class="container normal-panel" style="text-align:right">
  197. <el-pagination
  198. background
  199. small
  200. @size-change="handleSizeChangeContacts"
  201. @current-change="handleCurrentChangeContacts"
  202. :page-sizes="[10,20,50,100,]"
  203. layout="total,sizes, prev, pager, next, jumper"
  204. :current-page="contacts.currentPage"
  205. :total="contacts.total">
  206. </el-pagination>
  207. </div>
  208. <el-input slot="reference" :readonly="true" v-model="form.name" autocomplete="off" placeholder="请选择联系人" @input="selectContacts"></el-input>
  209. </el-popover>
  210. </el-form-item>
  211. </el-col>
  212. <el-col :span="24">
  213. <el-form-item label="联系人手机号:" label-width="100px" >
  214. <el-input v-model="form.phonenumber" autocomplete="off" placeholder="手机号" disabled></el-input>
  215. </el-form-item>
  216. </el-col>
  217. <el-col :span="24">
  218. <el-form-item label="报价日期:" label-width="100px">
  219. <el-date-picker
  220. v-model="form.billdate"
  221. style="width: 100%"
  222. type="date"
  223. value-format="yyyy-MM-dd"
  224. placeholder="选择日期"
  225. :picker-options="pickerOptions">
  226. </el-date-picker>
  227. </el-form-item>
  228. </el-col>
  229. <el-col :span="24">
  230. <el-form-item label="有效期:" label-width="100px" prop="date">
  231. <el-date-picker
  232. v-model="form.date"
  233. style="width: 100%"
  234. type="daterange"
  235. value-format="yyyy-MM-dd"
  236. range-separator="至"
  237. start-placeholder="开始日期"
  238. end-placeholder="结束日期"
  239. :picker-options="pickerOptions">
  240. </el-date-picker>
  241. </el-form-item>
  242. </el-col>
  243. <el-col :span="24" >
  244. <el-form-item label="产品系列:" label-width="100px" prop="itemtype">
  245. <el-select
  246. ref="sle"
  247. style="width:100%;"
  248. v-model="form.itemtype"
  249. multiple
  250. placeholder="请选择产品系列"
  251. size="mini"
  252. >
  253. <el-option
  254. v-for="item in itemtype"
  255. :key="item.index"
  256. :label="item.value"
  257. :value="item.value"
  258. >
  259. <span style="float: left">{{ item.value }}</span>
  260. <span style="float: right; color: #8492a6; font-size: 12px">{{ item.remarks?item.remarks:'暂无描述' }}</span>
  261. </el-option>
  262. </el-select>
  263. </el-form-item>
  264. </el-col>
  265. <!-- <el-col :span="24">
  266. <el-form-item label="折扣(%):" label-width="100px" prop="discountrate">
  267. <el-input type="number" v-model="form.discountrate" autocomplete="off" placeholder="请输入0-100%" @change="discountrateChange"></el-input>
  268. </el-form-item>
  269. </el-col>-->
  270. <el-col :span="24">
  271. <el-form-item label="业务员:" label-width="100px" prop="salername">
  272. <el-popover
  273. placement="bottom"
  274. trigger="manual"
  275. v-model="salesmanVisible"
  276. width="500">
  277. <selectSalesman ref="selectSalesman" :radio="true" @onSelect="salesmanChange" @onCancel="salesmanVisible = false"></selectSalesman>
  278. <el-input readonly type="text" slot="reference" size="small" @focus="showChange" v-model="form.salername" placeholder="请选择业务员"></el-input>
  279. </el-popover>
  280. </el-form-item>
  281. </el-col>
  282. <el-col :span="24">
  283. <el-form-item label="备注:" label-width="100px" prop="remarks">
  284. <el-input v-model="form.remarks" autocomplete="off" placeholder="请输入备注信息" type="textarea" autosize></el-input>
  285. </el-form-item>
  286. </el-col>
  287. </el-form>
  288. </el-row>
  289. </div>
  290. <!-- <div >
  291. <el-divider></el-divider>
  292. </div>
  293. <div style="margin:20px 20px 20px 20px">
  294. <quoted_price_product :sa_projectid="form.sa_projectid" :type="form.type" ref="quoterPrice" @checkFormImport="onCheckFormImport" @checkForm="onSubmit" @checkFormProject="onSubmit" @productData="productDataChange"></quoted_price_product>
  295. </div>-->
  296. <div class="fixed__btn__panel">
  297. <el-button size="small" @click="onClose" class="normal-btn-width">取 消</el-button>
  298. <el-button size="small" type="primary" @click="getSubmit" class="normal-btn-width">确 定</el-button>
  299. </div>
  300. </el-drawer>
  301. </div>
  302. </template>
  303. <script>
  304. import quoted_price_product from '../components/quotedPriceProduct'
  305. import selectSalesman from '../components/selectSalesman'
  306. export default {
  307. name: "ProjectQuotationAdd",
  308. props:["drawerShow","typeData"],
  309. components:{quoted_price_product,selectSalesman},
  310. data(){
  311. var discountrate = (rule,value,callback) =>{
  312. if (this.form.discountrate < 0 || this.form.discountrate > 100){
  313. callback(new Error('请输入0-100%'))
  314. } else {
  315. callback();
  316. }
  317. }
  318. return {
  319. search:'',
  320. title:'',
  321. projectShow:false,
  322. customerShow:false,
  323. contactsShow:false,
  324. salesmanVisible:false,
  325. projectParam:{
  326. "id": 20221020143503,
  327. "content": {
  328. "pageNumber": 1,
  329. "pageSize": 10,
  330. "type":1, // 1:我负责的;2:我参与的;3:我下属负责的;4:我下属参与的
  331. "where": {
  332. "condition": "",
  333. "startdate": "",
  334. "enddate": "",
  335. "status":"",//跟进中、已成交、已失败
  336. "projecttype":"",
  337. "stagename":"",
  338. "tag":""
  339. }
  340. },
  341. },
  342. project:{
  343. projectData:[],
  344. total:0,
  345. currentPage:0,
  346. },
  347. customerParam:{
  348. "id": 20220920083901,
  349. "content": {
  350. "pageNumber": 1,
  351. "pageSize": 10,
  352. "where": {
  353. "condition": "",
  354. "type":4,
  355. "sa_projectid":""
  356. }
  357. }
  358. },
  359. customer:{
  360. customerData:[],
  361. total:0,
  362. currentPage:0,
  363. },
  364. contactsParam:{
  365. "id": "20221022165503",
  366. "version": 1,
  367. "content": {
  368. "sys_enterpriseid":"",
  369. "pageNumber": 1,
  370. "pageSize": 10,
  371. "where": {
  372. "condition": "",
  373. "workaddress": 0//0表示人,1表示地址
  374. }
  375. }
  376. },
  377. salerParam:{
  378. "id":20230306144402,
  379. "content":{
  380. "type":'',////type:1客户2:项目
  381. "sys_enterpriseid":'',//type=1
  382. "sa_projectid":'' //type=2时传
  383. }
  384. },
  385. contacts:{
  386. contactsData:[],
  387. total:0,
  388. currentPage:0,
  389. },
  390. pickerOptions: {
  391. disabledDate(time) {
  392. return time.getTime() + 3600 * 1000 * 24 < Date.now() ;
  393. },
  394. },
  395. drawer:false,
  396. isQuotedPrice:false,
  397. date:[],
  398. productObj:{},
  399. form:{
  400. date:[],
  401. totalPrice:'',
  402. type:'',
  403. projectnum:'',
  404. enterprisename:'',
  405. name:'',
  406. phonenumber:'',
  407. fax:'',
  408. telephone:'',
  409. specialOffer:'否',
  410. sa_quotedpriceid:0, //sat_notice_classid<=0时 为新增
  411. sys_enterpriseid: "",
  412. contactsid:0,
  413. sa_projectid: "0",
  414. discountrate: '',
  415. remarks: "",
  416. invaliddate: "",
  417. projectname: "",
  418. address: "",
  419. billdate:"",
  420. enddate:'',
  421. begdate:'',
  422. saler_hrid:'',
  423. salername:'',
  424. itemtype:[],
  425. quotedpricenotes: [
  426. "1、报价为含税13%税率, 含运费 ",
  427. "2、报价有限期 2023-02-02 13:16:47至2023-02-22 13:16:47",
  428. ]
  429. },
  430. rules:{
  431. projectname:[
  432. { required: true, message: '请选择项目', trigger: 'change'},
  433. ],
  434. enterprisename:[
  435. { required: true, message: '请选择客户', trigger: 'change'},
  436. ],
  437. date:[
  438. { required: true, message: '请选择有效期', trigger: 'change'},
  439. ],
  440. itemtype:[
  441. { required: true, message: '请选择产品系列', trigger: 'change'},
  442. ],
  443. discountrate:[
  444. { required: false, validator: discountrate, trigger: 'change'},
  445. ],
  446. /*name:[
  447. { required: true, message: '请选择联系人', trigger: 'change'},
  448. ]*/
  449. },
  450. itemtype:[]
  451. }
  452. },
  453. methods:{
  454. onClose(){
  455. this.drawer = false
  456. this.$emit('addSuccess')
  457. },
  458. /*创建报价单,获取商品信息*/
  459. onSubmit(type){
  460. console.log(this.form.date,'date')
  461. if (this.form.date.length === 0){
  462. this.form.begdate = ''
  463. this.form.enddate = ''
  464. this.form.sa_quotedpriceid = 0
  465. }else {
  466. this.form.begdate = this.form.date[0]
  467. this.form.enddate = this.form.date[1]
  468. this.form.sa_quotedpriceid = 0
  469. this.form.quotedpricenotes[1] = "2、报价有限期" + this.form.begdate + "至" + this.form.enddate
  470. }
  471. console.log(this.form,'form')
  472. this.$refs.form.validate(async (valid) => {
  473. if (!valid) return false
  474. this.form.discountrate = (this.form.discountrate /100).toFixed(3)
  475. const res = await this.$api.requested({
  476. "id": 20221020164803,
  477. "content": this.form
  478. })
  479. setTimeout(()=>{
  480. this.$refs.quoterPrice.quoterPrice(res.data.sa_quotedpriceid,this.form.type,type)
  481. this.form.sa_quotedpriceid = res.data.sa_quotedpriceid
  482. },500)
  483. })
  484. },
  485. /*导入创建报价单校验*/
  486. onCheckFormImport(){
  487. if (this.form.date.length === 0){
  488. this.form.begdate = ''
  489. this.form.enddate = ''
  490. }else {
  491. this.form.begdate = this.form.date[0]
  492. this.form.enddate = this.form.date[1]
  493. this.form.quotedpricenotes[1] = "2、报价有限期" + this.form.begdate + "至" + this.form.enddate
  494. }
  495. this.$refs.form.validate(async (valid) => {
  496. if (!valid) return false
  497. const res = await this.$api.requested({
  498. "id": 20221020164803,
  499. "content": this.form
  500. })
  501. this.$refs.quoterPrice.quoterImport(res.data.sa_quotedpriceid,this.form.type)
  502. this.form.sa_quotedpriceid = res.data.sa_quotedpriceid
  503. })
  504. },
  505. /*提交*/
  506. getSubmit(){
  507. if (this.form.date.length === 0){
  508. this.form.begdate = ''
  509. this.form.enddate = ''
  510. }else {
  511. this.form.begdate = this.form.date[0]
  512. this.form.enddate = this.form.date[1]
  513. this.form.quotedpricenotes[1] = "2、报价有限期" + this.form.begdate + "至" + this.form.enddate
  514. }
  515. this.$refs.form.validate(async (valid) => {
  516. if (!valid) return false
  517. this.form.discountrate = this.form.discountrate?(this.form.discountrate / 100).toFixed(4):''
  518. const res = await this.$api.requested({
  519. "id": 20221020164803,
  520. "content": this.form
  521. })
  522. this.tool.showMessage(res,() => {
  523. this.drawer = false
  524. this.$emit('addSuccess')
  525. this.$store.dispatch('changeDetailDrawer',true)
  526. this.$router.push({path:'/quotedPriceDetail',query:{id:res.data.sa_quotedpriceid,rowindex:res.data.rowindex}})
  527. })
  528. })
  529. },
  530. /*修改后的产品数据*/
  531. productDataChange(val){
  532. let obj = val.map(e=>{
  533. return {
  534. sa_quotedprice_itemsid:e.sa_quotedprice_itemsid,
  535. itemid:e.itemid,
  536. oldprice:e.marketprice,
  537. price:e.price,
  538. discountrate:(e.discountrate/100).toFixed(4),
  539. qty:e.qty
  540. }
  541. })
  542. this.productObj = obj
  543. },
  544. async changeData(obj){
  545. const res = await this.$api.requested({
  546. "id": 20221021095403,
  547. "content": {
  548. "sa_quotedpriceid":this.form.sa_quotedpriceid, //sat_notice_classid<=0时 为新增
  549. "items":obj
  550. }
  551. })
  552. this.$emit('addSuccess')
  553. },
  554. async projectList(){
  555. const res = await this.$api.requested(this.projectParam)
  556. this.project.projectData = res.data
  557. this.project.total = res.total
  558. this.project.currentPage = res.pageNumber
  559. },
  560. async selectProject(){
  561. this.projectParam.content.where.condition = this.form.projectname
  562. this.projectList()
  563. },
  564. async customerList(){
  565. if (this.form.sa_projectid === '0' && this.form.type === '客户报价'){
  566. this.customerParam.content.where.type = 7
  567. }else {
  568. this.customerParam.content.where.type = 4
  569. this.customerParam.content.where.sa_projectid = this.form.sa_projectid
  570. }
  571. const res = await this.$api.requested(this.customerParam)
  572. this.customer.customerData = res.data
  573. this.customer.total = res.total
  574. this.customer.currentPage = res.pageNumber
  575. },
  576. selectCustomer(){
  577. this.customerParam.content.where.condition = this.form.enterprisename
  578. this.customerList()
  579. },
  580. async contactsList(){
  581. this.contactsParam.content.sys_enterpriseid = this.form.sys_enterpriseid
  582. const res = await this.$api.requested(this.contactsParam)
  583. this.contacts.contactsData = res.data
  584. this.contacts.total = res.total
  585. this.contacts.currentPage = res.pageNumber
  586. },
  587. selectContacts(){
  588. this.contactsParam.content.where.condition = this.form.name
  589. this.contactsList()
  590. },
  591. /*项目选择信息*/
  592. projectData(val){
  593. this.form.sa_projectid = val.sa_projectid
  594. this.form.projectname = val.projectname
  595. this.form.projectnum = val.projectnum
  596. this.form.sys_enterpriseid = ''
  597. this.form.enterprisename = ''
  598. this.form.contactsid = 0
  599. this.form.name = ''
  600. this.form.phonenumber = ''
  601. this.form.fax = ''
  602. this.form.telephone = ''
  603. this.projectShow = false
  604. this.salerParam.content.type = 2
  605. this.salerParam.content.sa_projectid = this.form.sa_projectid
  606. this.querySalesman()
  607. },
  608. /*客户选择信息*/
  609. customerData(val){
  610. this.form.sys_enterpriseid = val.sys_enterpriseid
  611. this.form.enterprisename = val.enterprisename
  612. this.form.contactsid = 0
  613. this.form.name = ''
  614. this.form.phonenumber = ''
  615. this.form.fax = ''
  616. this.form.telephone = ''
  617. this.customerShow = false
  618. if (!this.isQuotedPrice){
  619. this.salerParam.content.type = 1
  620. this.salerParam.content.sys_enterpriseid = this.form.sys_enterpriseid
  621. this.querySalesman()
  622. }
  623. },
  624. /*联系人选择信息*/
  625. contactsData(val){
  626. this.form.contactsid = val.contactsid
  627. this.form.name = val.name
  628. this.form.phonenumber = val.phonenumber
  629. this.form.fax = val.fax
  630. this.form.telephone = val.telephone
  631. this.contactsShow = false
  632. },
  633. /*项目分页*/
  634. handleSizeChangeProject(val) {
  635. // console.log(`每页 ${val} 条`);
  636. this.projectParam.content.pageSize = val
  637. this.projectList()
  638. },
  639. handleCurrentChangeProject(val) {
  640. // console.log(`当前页: ${val}`);
  641. this.projectParam.content.pageNumber = val
  642. this.projectList()
  643. },
  644. /*客户分页*/
  645. handleSizeChangeCustomer(val) {
  646. // console.log(`每页 ${val} 条`);
  647. console.log(val)
  648. this.customerParam.content.pageSize = val
  649. this.customerList()
  650. },
  651. handleCurrentChangeCustomer(val) {
  652. // console.log(`当前页: ${val}`);
  653. console.log(val)
  654. this.customerParam.content.pageNumber = val
  655. this.customerList()
  656. },
  657. /*联系人分页*/
  658. handleSizeChangeContacts(val) {
  659. // console.log(`每页 ${val} 条`);
  660. this.contactsParam.content.pageSize = val
  661. this.contactsList()
  662. },
  663. handleCurrentChangeContacts(val) {
  664. // console.log(`当前页: ${val}`);
  665. this.contactsParam.content.pageNumber = val
  666. this.contactsList()
  667. },
  668. /*查询产品系列*/
  669. queryItemType(){
  670. this.$store.dispatch('optiontypeselect','itemtype').then(res => {
  671. this.itemtype = res.data
  672. })
  673. },
  674. /*业务员*/
  675. showChange(){
  676. this.salesmanVisible = true
  677. if (this.isQuotedPrice){
  678. this.$refs.selectSalesman.param.content.type = 2
  679. this.$refs.selectSalesman.param.content.sa_projectid = this.form.sa_projectid
  680. this.$refs.selectSalesman.listData()
  681. }else {
  682. this.$refs.selectSalesman.param.content.type = 1
  683. this.$refs.selectSalesman.param.content.sys_enterpriseid = this.form.sys_enterpriseid
  684. this.$refs.selectSalesman.listData()
  685. }
  686. },
  687. salesmanChange(data){
  688. console.log(data,"业务员")
  689. this.form.saler_hrid = data[0].hrid
  690. this.form.salername = data[0].name
  691. this.salesmanVisible = false
  692. /* this.form.salername = data[0].name
  693. this.form.saler_hrid = data[0].hrid
  694. this.salesmanVisible = false*/
  695. },
  696. async querySalesman(){
  697. const res = await this.$api.requested(this.salerParam)
  698. this.form.salername = res.data[0].name
  699. this.form.saler_hrid = res.data[0].hrid
  700. },
  701. /*修改折扣数据*/
  702. discountrateChange(){
  703. this.form.discountrate = Math.round(this.form.discountrate * 100)/100
  704. }
  705. /*isSpecial(val){
  706. console.log("获取")
  707. console.log(val,'是否特价')
  708. }*/
  709. },
  710. mounted() {
  711. if (this.drawerShow){this.drawer = true}
  712. this.form.type = this.typeData
  713. if (this.typeData === '项目报价'){
  714. this.isQuotedPrice = true
  715. this.title = '新建项目报价单'
  716. }else {
  717. this.isQuotedPrice = false
  718. this.title = '新建客户报价单'
  719. }
  720. const date = new Date()
  721. this.form.billdate = date.getFullYear() + '-' + (date.getMonth() + 1) + '-' + date.getDate()
  722. this.form.sa_quotedpriceid = 0
  723. this.queryItemType()
  724. },
  725. created() {
  726. }
  727. }
  728. </script>
  729. <style scoped>
  730. >>> .el-divider--horizontal {
  731. height: 1px;
  732. width: 100%;
  733. margin: 0px;
  734. }
  735. /deep/.el-input__prefix {
  736. display: flex;
  737. align-items: center;
  738. }
  739. </style>