detailsPage.vue 32 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035
  1. <template>
  2. <div class="borderless">
  3. <div class="customer-head">
  4. <div class="customer-back">
  5. <el-button type="danger" style="border: none;background: none;color: red" icon="el-icon-arrow-left"
  6. @click="backToList">返回列表
  7. </el-button>
  8. </div>
  9. <el-button type="success"
  10. class="el-button--small-yh add-customer-btn-two"
  11. :disabled="true"
  12. @click.stop="">复制新单
  13. </el-button>
  14. <el-button
  15. class="el-button--small-yh add-customer-btn"
  16. type="primary"
  17. :disabled="disabled"
  18. @click="editCustomer"
  19. :loading="butLoading"
  20. >{{form.id?'确认修改':'确认新增'}}
  21. </el-button>
  22. </div>
  23. <div style="margin-top: 60px">
  24. <el-form :model="form" ref="form" label-width="130px">
  25. <containerTitle title="基础信息"></containerTitle>
  26. <basic-container style="margin-bottom: 10px">
  27. <el-row>
  28. <el-col v-for="(item, index) in basicData.column" :span="item.span?item.span:8" :key="index">
  29. <el-form-item :label="item.label" :prop="item.prop" :rules="item.rules">
  30. <el-date-picker v-if="item.type === 'date'" style="width: 100%;" v-model="form[item.prop]" size="small" type="date" placeholder="选择日期" value-format="yyyy-MM-dd HH:mm:ss"/>
  31. <el-select v-else-if="item.type === 'select'" style="width: 100%" v-model="form[item.prop]" size="small" placeholder="请选择" clearable filterable>
  32. <el-option
  33. v-for="(data, index) in item.dicData"
  34. :key="index"
  35. :label="data.label"
  36. :value="data.value"
  37. ></el-option>
  38. </el-select>
  39. <selectComponent v-else-if="item.prop === 'corpId'" v-model="form[item.prop]" :configuration="configuration"/>
  40. <selectComponent v-else-if="item.prop === 'purchaserId'" v-model="form[item.prop]" :configuration="pConfiguration"/>
  41. <el-select v-else-if="item.prop === 'orderType'" style="width: 100%" v-model="form[item.prop]" size="small" placeholder="请选择" clearable filterable>
  42. <el-option v-for="(item,index) in contractTypeDic" :key="index" :label="item.dictValue" :value="item.dictValue"></el-option>
  43. </el-select>
  44. <el-select v-else-if="item.prop === 'currency'" style="width: 100%" v-model="form[item.prop]" size="small" placeholder="请选择" clearable filterable>
  45. <el-option v-for="(item,index) in currencyDic" :key="index" :label="item.dictValue" :value="item.dictValue"></el-option>
  46. </el-select>
  47. <el-select v-else-if="item.prop === 'paymentType'" style="width: 100%" v-model="form[item.prop]" size="small" placeholder="请选择" clearable filterable>
  48. <el-option v-for="(item,index) in paymentTypeDic" :key="index" :label="item.dictValue" :value="item.dictValue"></el-option>
  49. </el-select>
  50. <el-input type="textarea" v-else-if="(item.prop === 'orderRemark')" v-model="form[item.prop]" size="small" autocomplete="off" placeholder="请输入"></el-input>
  51. <el-input type="age" v-else v-model="form[item.prop]" :disabled="item.disabled?true:false" size="small" autocomplete="off" placeholder="请输入"></el-input>
  52. </el-form-item>
  53. </el-col>
  54. </el-row>
  55. </basic-container>
  56. <!-- 采购明细-->
  57. <containerTitle title="采购明细"></containerTitle>
  58. <basic-container style="margin-bottom: 10px">
  59. <avue-crud
  60. :option="customerContact"
  61. v-model="contactsForm"
  62. :data="contactsData"
  63. ref="crudContact"
  64. @row-save="rowSave"
  65. @selection-change="selectionContact"
  66. @row-click="handleRowClick"
  67. @row-update="rowUpdate"
  68. @row-del="rowDel"
  69. >
  70. <template slot="price" slot-scope="{ row }">
  71. <el-input
  72. v-if="row.$cellEdit"
  73. v-model="row.price"
  74. placeholder="请输入"
  75. size="small"
  76. oninput='this.value=this.value.replace(/[^(\d.)]/g,"").replace(/^(\d+)\.(\d\d).*$/, "$1.$2")'
  77. @input="priceChange(row)"
  78. ></el-input>
  79. <span v-else>{{ row.price }}</span>
  80. </template>
  81. <template slot="purchaseQuantity" slot-scope="{ row }">
  82. <el-input
  83. v-if="row.$cellEdit"
  84. v-model="row.purchaseQuantity"
  85. placeholder="请输入"
  86. size="small"
  87. oninput='this.value=this.value.replace(/[^(\d.)]/g,"").replace(/^(\d+)\.(\d\d).*$/, "$1.$2")'
  88. @input="quantityChange(row)"
  89. ></el-input>
  90. <span v-else>{{ row.purchaseQuantity }}</span>
  91. </template>
  92. <template slot-scope="{row,index}" slot="menu">
  93. <el-button
  94. type="text"
  95. size="small"
  96. @click="rowCell(row,index)"
  97. >{{ row.$cellEdit ? '修改完成' : '修改' }}
  98. </el-button>
  99. </template>
  100. <template slot="menuLeft" slot-scope="{size}">
  101. <el-button type="primary"
  102. icon="el-icon-plus"
  103. size="small"
  104. @click="commoditySelection"
  105. >录入明细
  106. </el-button>
  107. <el-button type="warning"
  108. icon="el-icon-s-check"
  109. size="small"
  110. :disabled="selectContact.length == 0"
  111. @click="beforePage(true)"
  112. >申请付款(开证)
  113. </el-button>
  114. <el-button type="warning"
  115. size="small"
  116. :disabled="selectContact.length == 0"
  117. @click="beforePage(false)"
  118. >收货单
  119. </el-button>
  120. <el-button type="info"
  121. size="small"
  122. @click=""
  123. >查看申请记录
  124. </el-button>
  125. </template>
  126. <template slot="priceCategory" slot-scope="{row,index}">
  127. <span style="margin-left: 12px;padding-top: 2px">{{ row.priceCategoryNames }}</span>
  128. <el-button v-if="row.$cellEdit" type="text" size="mini" style="float: right" @click="choice(row)">选择</el-button>
  129. </template>
  130. </avue-crud>
  131. </basic-container>
  132. <fee-info
  133. ref="feeInfo"
  134. :orderFeesList="orderFeesList"
  135. feeUrl=""
  136. />
  137. <upload-file
  138. ref="uploadFile"
  139. title="合同附件"
  140. :orderFilesList="orderFilesList"
  141. delUrl=""
  142. />
  143. </el-form>
  144. </div>
  145. <el-dialog
  146. title="导入商品详情"
  147. append-to-body
  148. class="el-dialogDeep"
  149. :visible.sync="dialogVisible"
  150. width="80%"
  151. :close-on-click-modal="false"
  152. :destroy-on-close="true"
  153. :close-on-press-escape="false">
  154. <el-row style="height: 0;">
  155. <el-col :span="5">
  156. <div>
  157. <el-scrollbar>
  158. <basic-container>
  159. <avue-tree :option="treeOption" :data="treeData" @node-click="nodeClick"/>
  160. </basic-container>
  161. </el-scrollbar>
  162. </div>
  163. </el-col>
  164. <el-col :span="19">
  165. <basic-container>
  166. <avue-crud :option="optionTwo"
  167. :table-loading="loading"
  168. :data="data"
  169. ref="crud"
  170. @refresh-change="refreshChange"
  171. @selection-change="selectionChange"
  172. :page.sync="page"
  173. @on-load="onLoad"></avue-crud>
  174. </basic-container>
  175. </el-col>
  176. </el-row>
  177. <span slot="footer" class="dialog-footer">
  178. <el-button @click="dialogVisible = false , selectKind = -1">取 消</el-button>
  179. <el-button type="primary" @click="commodityConfirm" v-if="selectKind != -1" :disabled="tableData.length !== 1">确定</el-button>
  180. <el-button type="primary" @click="importGoods" v-if="commodityData !== true && selectKind == -1" :disabled="tableData.length !== 1">导入</el-button>
  181. <el-button type="primary" @click="importChoice" v-if="commodityData === true && selectKind == -1"
  182. :disabled="tableData.length !== 1">导入<</el-button>
  183. </span>
  184. </el-dialog>
  185. </div>
  186. </template>
  187. <script>
  188. import customerContact from "./config/customerContact.json"
  189. import uploadList from './config/uploadList.json'
  190. import advantageProject from "./config/advantageProject.json"
  191. import {getDeptLazyTree,customerList} from "@/api/basicData/basicFeesDesc";
  192. import optionTwoCost from "./config/mainListCost.json"
  193. import {detailListData, submitData,getSysNo} from "@/api/importTrade/purchase";
  194. import commodity from "./config/commodity.json"
  195. import feeInfo from "@/components/fee-info/main";
  196. import uploadFile from "@/components/upload-file/main";
  197. //商品详情接口
  198. import {corpsattn, corpsbank, getDeptLazyTreeS} from "@/api/basicData/configuration"
  199. import { getList } from "@/api/basicData/commodityType"
  200. export default {
  201. name: "detailsPage",
  202. props: {
  203. detailData: {
  204. type: Object
  205. }
  206. },
  207. data() {
  208. return {
  209. form: {},
  210. disabled: false,
  211. customerContact: customerContact,
  212. contactsForm: {},
  213. contactsData: [],
  214. dialogVisible:false,
  215. commodityData: false,
  216. tableData: [],
  217. optionTwo: commodity,
  218. loading: false,
  219. data: [],
  220. page: {
  221. pageSize: 10,
  222. currentPage: 1,
  223. total: 0
  224. },
  225. contractTypeDic:[],
  226. currencyDic:[],
  227. selectContact:[],//选中采购明细
  228. selectKind: -1,//选择采购明细的货品
  229. paymentTypeDic:[],
  230. orderFeesList:[],
  231. orderFilesList:[],
  232. treeDeptId: '',
  233. treeOption: {
  234. nodeKey: 'id',
  235. lazy: true,
  236. treeLoad: function (node, resolve) {
  237. const parentId = (node.level === 0) ? 0 : node.data.id;
  238. getDeptLazyTreeS(parentId).then(res => {
  239. resolve(res.data.data.map(item => {
  240. return {
  241. ...item,
  242. leaf: !item.hasChildren
  243. }
  244. }))
  245. });
  246. },
  247. addBtn: false,
  248. menu: false,
  249. size: 'small',
  250. props: {
  251. labelText: '标题',
  252. label: 'title',
  253. value: 'value',
  254. children: 'children'
  255. }
  256. },
  257. configuration:{
  258. multipleChoices:false,
  259. multiple:false,
  260. disabled:false,
  261. searchShow:true,
  262. collapseTags:false,
  263. placeholder:'请点击右边按钮选择',
  264. dicData:[]
  265. },
  266. pConfiguration:{
  267. multipleChoices:false,
  268. multiple:false,
  269. disabled:false,
  270. searchShow:true,
  271. collapseTags:false,
  272. placeholder:'请点击右边按钮选择',
  273. dicData:[]
  274. },
  275. // 合同上传数据
  276. uploadList: uploadList,
  277. // 合同数据
  278. bankOfDepositData: [],
  279. bankOfDepositForm: {},
  280. // 其他费用
  281. advantageProject: advantageProject,
  282. advantageProjectData: [],
  283. advantageProjectForm: {},
  284. dialogCost: false,
  285. choiceData: false,
  286. treeOptionCost:{
  287. nodeKey: 'id',
  288. lazy: true,
  289. treeLoad: function (node, resolve) {
  290. const parentId = (node.level === 0) ? 0 : node.data.id;
  291. getDeptLazyTree(parentId).then(res => {
  292. resolve(res.data.data.map(item => {
  293. return {
  294. ...item,
  295. leaf: !item.hasChildren
  296. }
  297. }))
  298. });
  299. },
  300. addBtn: false,
  301. menu: false,
  302. size: 'small',
  303. props: {
  304. labelText: '标题',
  305. label: 'title',
  306. value: 'value',
  307. children: 'children'
  308. }
  309. },
  310. // 导入其他费用配置
  311. optionTwoCost: optionTwoCost,
  312. loadingCost: false,
  313. dataCost:[],
  314. pageCost:{
  315. pageSize: 10,
  316. currentPage: 1,
  317. total: 0
  318. },
  319. tableDataCost: [],
  320. treeDeptIdCost: '',
  321. choiceIndex: '',
  322. // 基础信息
  323. basicData: {
  324. column: [
  325. {
  326. label: '系统编号',
  327. prop: 'sysNo',
  328. disabled:true,
  329. rules: [
  330. {
  331. required: false,
  332. message: ' ',
  333. trigger: 'blur'
  334. }
  335. ]
  336. }, {
  337. label: '供应商',
  338. prop: 'corpId',
  339. dicData: [],
  340. rules: [
  341. {
  342. required: true,
  343. message: ' ',
  344. trigger: 'blur'
  345. }
  346. ]
  347. }, {
  348. label: '采购商',
  349. prop: 'purchaserId',
  350. dicData: [],
  351. rules: [
  352. {
  353. required: true,
  354. message: ' ',
  355. trigger: 'blur'
  356. }
  357. ]
  358. },{
  359. label: '合同号',
  360. prop: 'orderNo',
  361. rules: [
  362. {
  363. required: false,
  364. message: ' ',
  365. trigger: 'blur'
  366. }
  367. ]
  368. }, {
  369. label: '合同日期',
  370. prop: 'businesDate',
  371. type:'date',
  372. rules: [
  373. {
  374. required: false,
  375. message: ' ',
  376. trigger: 'blur'
  377. }
  378. ]
  379. }, {
  380. label: '合同类型',
  381. prop: 'orderType',
  382. // type:'select',
  383. dicData: [],
  384. rules: [
  385. {
  386. required: false,
  387. message: ' ',
  388. trigger: 'blur'
  389. }
  390. ]
  391. }, {
  392. label: '合同金额',
  393. prop: 'orderAmount',
  394. rules: [
  395. {
  396. pattern: /(^[1-9]([0-9]+)?(\.[0-9]{1,2})?$)|(^(0){1}$)|(^[0-9]\.[0-9]([0-9])?$)/,
  397. message: ' ',
  398. trigger: 'blur'
  399. }
  400. ]
  401. }, {
  402. label: '合同重量',
  403. prop: 'contractWeight',
  404. rules: [
  405. {
  406. required: false,
  407. message: ' ',
  408. trigger: 'blur'
  409. }
  410. ]
  411. }, {
  412. label: '业务员',
  413. prop: 'salesName',
  414. dicData: [],
  415. rules: [
  416. {
  417. required: false,
  418. message: ' ',
  419. trigger: 'blur'
  420. }
  421. ]
  422. },{
  423. label: '要求发货日期',
  424. prop: 'requiredDeliveryDate',
  425. type:'date',
  426. rules: [
  427. {
  428. required: true,
  429. message: ' ',
  430. trigger: 'blur'
  431. }
  432. ]
  433. }, {
  434. label: '要求到货日期',
  435. prop: 'requiredArrivalDate',
  436. type:'date',
  437. rules: [
  438. {
  439. required: true,
  440. message: ' ',
  441. trigger: 'blur'
  442. }
  443. ]
  444. },{
  445. label: '到港日期',
  446. prop: 'dateOfArrival',
  447. type:'date',
  448. rules: [
  449. {
  450. required: false,
  451. message: ' ',
  452. trigger: 'blur'
  453. }
  454. ]
  455. }, {
  456. label: '单价',
  457. prop: 'salesPrice',
  458. rules: [
  459. {
  460. pattern: /(^[1-9]([0-9]+)?(\.[0-9]{1,2})?$)|(^(0){1}$)|(^[0-9]\.[0-9]([0-9])?$)/,
  461. message: ' ',
  462. trigger: 'blur'
  463. }
  464. ]
  465. }, {
  466. label: '币别',
  467. prop: 'currency'
  468. }, {
  469. label: '汇率',
  470. prop: 'exchangeRate',
  471. }, {
  472. label: '人民币金额',
  473. prop: 'rmbAmount',
  474. rules: [
  475. {
  476. pattern: /(^[1-9]([0-9]+)?(\.[0-9]{1,2})?$)|(^(0){1}$)|(^[0-9]\.[0-9]([0-9])?$)/,
  477. message: ' ',
  478. trigger: 'blur'
  479. }
  480. ]
  481. }, {
  482. label: '付款方式',
  483. prop: 'paymentType',
  484. }, {
  485. label: '付款/开证日期',
  486. prop: 'accountsCollectionDate',
  487. type:'date',
  488. rules: [
  489. {
  490. required: false,
  491. message: ' ',
  492. trigger: 'blur'
  493. }
  494. ]
  495. }, {
  496. label: '预付(保证)金额',
  497. prop: 'advancePayment',
  498. rules: [
  499. {
  500. pattern: /(^[1-9]([0-9]+)?(\.[0-9]{1,2})?$)|(^(0){1}$)|(^[0-9]\.[0-9]([0-9])?$)/,
  501. message: ' ',
  502. trigger: 'blur'
  503. }
  504. ]
  505. },{
  506. label: '已付金额',
  507. prop: 'settlmentAmount',
  508. rules: [
  509. {
  510. pattern: /(^[1-9]([0-9]+)?(\.[0-9]{1,2})?$)|(^(0){1}$)|(^[0-9]\.[0-9]([0-9])?$)/,
  511. message: ' ',
  512. trigger: 'blur'
  513. }
  514. ]
  515. }, {
  516. label: '信用证到期日',
  517. prop: 'creditDate',
  518. type:'date',
  519. rules: [
  520. {
  521. required: false,
  522. message: ' ',
  523. trigger: 'blur'
  524. }
  525. ]
  526. }, {
  527. label: '码单重量',
  528. prop: 'billWeight',
  529. rules: [
  530. {
  531. required: false,
  532. message: ' ',
  533. trigger: 'blur'
  534. }
  535. ]
  536. }, {
  537. label: "订单备注",
  538. span: 24,
  539. prop: "orderRemark",
  540. mock: {
  541. type: 'county'
  542. }
  543. }
  544. ],
  545. },
  546. }
  547. },
  548. created() {
  549. //币别
  550. this.getWorkDicts("currency").then(res =>{
  551. this.currencyDic = res.data.data
  552. })
  553. this.getWorkDicts("contractType").then(res =>{
  554. this.contractTypeDic = res.data.data
  555. })
  556. this.getWorkDicts("payment_term").then(res =>{
  557. this.paymentTypeDic = res.data.data
  558. })
  559. if (this.detailData.id) {
  560. let id = this.detailData.id.replace(/\"/g, "")
  561. detailListData(id).then(res => {
  562. this.form = res.data.data;
  563. this.configuration.dicData = this.form.corpsName
  564. this.pConfiguration.dicData = this.form.purchaserName
  565. if(res.data.data.itemsVOList){
  566. this.contactsData = res.data.data.itemsVOList
  567. }
  568. if(res.data.data.orderFeesList){
  569. this.orderFeesList = res.data.data.orderFeesList
  570. }
  571. if( res.data.data.orderFilesList){
  572. this.orderFilesList = res.data.data.orderFilesList
  573. }
  574. })
  575. }else{
  576. getSysNo("JK-CG").then(res =>{
  577. this.$set(this.form,"sysNo", res.data.data)
  578. })
  579. }
  580. },
  581. components: {
  582. feeInfo,
  583. uploadFile
  584. },
  585. methods: {
  586. //单价
  587. priceChange(row) {
  588. if (!row.price) {
  589. row.price = "";
  590. row.amount = 0
  591. } else {
  592. row.amount = (row.purchaseQuantity * row.price).toFixed(2);
  593. }
  594. },
  595. //件数
  596. quantityChange(row) {
  597. if (!row.purchaseQuantity) {
  598. row.purchaseQuantity = "";
  599. row.amount = 0
  600. } else {
  601. row.amount = (row.purchaseQuantity * row.price).toFixed(2);
  602. }
  603. },
  604. //修改提交触发
  605. editCustomer(status) {
  606. this.$refs["form"].validate((valid) => {
  607. if (valid) {
  608. let orderFeesList = this.$refs.feeInfo.submitData();
  609. for (let i = 0; i < orderFeesList.length; i++) {
  610. if (orderFeesList[i].corpId == null) {
  611. return this.$message.error(`请输入第${i + 1}行的结算中心`);
  612. }
  613. if (orderFeesList[i].price == 0) {
  614. return this.$message.error(`请正确输入第${i + 1}行的价格`);
  615. }
  616. if (orderFeesList[i].orderQuantity == 0) {
  617. return this.$message.error(`请正确输入第${i + 1}行的数量`);
  618. }
  619. }
  620. const orderFilesList = this.$refs.uploadFile.submitData();
  621. for (let j = 0; j < this.contactsData.length; j++) {
  622. if (this.contactsData[j].billNo == null) {
  623. return this.$message.error(`请输入第${j + 1}行的提单号`);
  624. }
  625. }
  626. let submitDto = {
  627. ...this.form,
  628. tradeType:"JK",
  629. billType:"CG",
  630. itemsVOList: this.contactsData,
  631. orderFeesList: orderFeesList,
  632. orderFilesList: orderFilesList
  633. };
  634. submitData(submitDto).then(res => {
  635. if(res.data.success){
  636. this.form.id = res.data.data
  637. this.$message.success("操作成功!")
  638. detailListData(this.form.id).then(res => {
  639. this.form = res.data.data;
  640. this.configuration.dicData = this.form.corpsName
  641. this.pConfiguration.dicData = this.form.purchaserName
  642. if(res.data.data.itemsVOList){
  643. this.contactsData = res.data.data.itemsVOList
  644. }
  645. if(res.data.data.orderFeesList){
  646. this.orderFeesList = res.data.data.orderFeesList
  647. }
  648. if( res.data.data.orderFilesList){
  649. this.orderFilesList = res.data.data.orderFilesList
  650. }
  651. })
  652. }
  653. })
  654. setTimeout(() =>{
  655. },1000);
  656. this.butLoading = false;
  657. if(status === true){
  658. this.$emit("goBack");
  659. }
  660. } else {
  661. return false;
  662. }
  663. });
  664. },
  665. selectionContact(row){
  666. this.selectContact = row;
  667. },
  668. beforePage(type){
  669. let list = []
  670. for (let item in this.selectContact){
  671. if (!this.selectContact[item].id){
  672. return this.$confirm('商品信息有未保存数据, 是否立即保存?', '提示', {
  673. confirmButtonText: '确定',
  674. cancelButtonText: '取消',
  675. type: 'warning'
  676. }).then(() => {
  677. this.editCustomer();
  678. })
  679. }else {
  680. list.push(this.selectContact[item].$index)
  681. }
  682. }
  683. const params = {
  684. id:this.form.id,
  685. orderItemIds:list
  686. }
  687. if(type){
  688. this.$router.push({
  689. path: "/financialManagement/payment",
  690. query: {params: params},
  691. });
  692. }else{
  693. this.$router.push({
  694. path: "/importTrade/receipt/index",
  695. query: {params: params},
  696. });
  697. }
  698. },
  699. //选择货物品种
  700. choice(row){
  701. this.dialogVisible = true;
  702. this.selectKind = row.$index;
  703. },
  704. //选择货品
  705. commodityConfirm(){
  706. if(this.tableData){
  707. this.contactsData[this.selectKind].priceCategory = this.tableData[0].id;
  708. this.$set(this.contactsData[this.selectKind],'priceCategoryNames',this.tableData[0].cname)
  709. this.dialogVisible = !this.dialogVisible
  710. this.selectKind = -1
  711. }
  712. },
  713. //新增商品明细保存触发
  714. rowSave(row, done, loading) {
  715. // this.contactsData.push(row)
  716. done()
  717. },
  718. //修改商品信息触发
  719. rowUpdate(row, index, done, loading) {
  720. done(row);
  721. },
  722. //删除商品信息触发
  723. rowDel(row, index, donerowDel) {
  724. this.$confirm("确定将选择数据删除?", {
  725. confirmButtonText: "确定",
  726. cancelButtonText: "取消",
  727. type: "warning"
  728. }).then(() => {
  729. //商品判断是否需要调用删除接口
  730. if (row.id) {
  731. corpsattn(row.id).then(res => {
  732. this.$message({
  733. type: "success",
  734. message: "操作成功!"
  735. });
  736. this.contactsData.splice(index, 1);
  737. })
  738. } else {
  739. this.$message({
  740. type: "success",
  741. message: "操作成功!"
  742. });
  743. this.contactsData.splice(index, 1);
  744. }
  745. })
  746. },
  747. //点击商品明细选择触发
  748. commodityChoice(row) {
  749. this.dialogVisible = !this.dialogVisible
  750. this.commodityData = true
  751. this.choiceIndexT = row.$index
  752. },
  753. //商品编辑
  754. rowCell(row, index) {
  755. this.$refs.crudContact.rowCell(row, index)
  756. },
  757. //商品新增触发
  758. commoditySelection() {
  759. this.dialogVisible = !this.dialogVisible
  760. this.commodityData = false
  761. },
  762. //点击行可编辑
  763. handleRowClick(row, event, column) {
  764. },
  765. //刷新触发
  766. refreshChange() {
  767. this.treeDeptId = '';
  768. this.page.currentPage = 1;
  769. this.onLoad(this.page);
  770. },
  771. //选中触发
  772. selectionChange(list) {
  773. this.tableData = list
  774. },
  775. //导入页左商品类型查询
  776. nodeClick(data) {
  777. this.treeDeptId = data.id;
  778. this.page.currentPage = 1;
  779. this.onLoad(this.page);
  780. },
  781. //商品详情list
  782. onLoad(page, params = {}) {
  783. this.loading = true;
  784. getList(page.currentPage, page.pageSize, Object.assign(params, this.query), this.treeDeptId).then(res => {
  785. const data = res.data.data;
  786. this.page.total = data.total;
  787. this.data = data.records;
  788. this.loading = false;
  789. });
  790. },
  791. //确认导入触发
  792. importGoods() {
  793. if (this.tableData.length > 0) {
  794. for (let item in this.tableData) {
  795. const params ={
  796. priceCategory:this.tableData[item].code,
  797. priceCategoryNames:this.tableData[item].cname,
  798. itemId:this.tableData[item].id,
  799. cname:this.tableData[item].cname
  800. }
  801. this.$refs.crudContact.rowCellAdd(params);
  802. this.$refs.crudContact.rowCell(params,this.contactsData.length - 1)
  803. }
  804. }
  805. this.tableData = []
  806. this.dialogVisible = false
  807. },
  808. //导入商品触发
  809. importChoice() {
  810. if (this.tableData.length === 1) {
  811. this.contactsData[this.choiceIndexT].cname = this.tableData[0].cname
  812. this.contactsData[this.choiceIndexT].code = this.tableData[0].code
  813. this.contactsData[this.choiceIndexT].typeno = this.tableData[0].typeno
  814. this.contactsData[this.choiceIndexT].specificationAndModel = this.tableData[0].specificationAndModel
  815. this.contactsData[this.choiceIndexT].itemId = this.tableData[0].id
  816. this.contactsData[this.choiceIndexT].priceCategory = this.tableData[0].goodsTypeName
  817. }
  818. this.dialogVisible = !this.dialogVisible
  819. this.commodityData = false
  820. },
  821. //其他费用编辑
  822. rowCellTwo(row, index) {
  823. this.$refs.crudProject.rowCell(row, index)
  824. },
  825. //新增明细保存触发
  826. rowSaveProject(row, done, loading){
  827. // this.advantageProjectData.push(row)
  828. done()
  829. },
  830. //修改明细触发
  831. rowUpdateProject(row, index, done, loading) {
  832. done(row);
  833. },
  834. //删除明细触发
  835. rowDelProject(row, index, donerowDel) {
  836. this.$confirm("确定将选择数据删除?", {
  837. confirmButtonText: "确定",
  838. cancelButtonText: "取消",
  839. type: "warning"
  840. }).then(() => {
  841. if (row.id){
  842. // corpsitem(row.id).then(res=>{
  843. // this.$message({
  844. // type: "success",
  845. // message: "操作成功!"
  846. // });
  847. // this.detailedData.splice(index, 1);
  848. // })
  849. }else {
  850. this.$message({
  851. type: "success",
  852. message: "操作成功!"
  853. });
  854. this.detailedData.splice(index, 1);
  855. }
  856. })
  857. },
  858. // 修改其他费用明细
  859. rowUpdateAdvantageProject(row, index, done, loading) {
  860. done(row);
  861. },
  862. // 删除其他费用明细
  863. rowDelAdvantageProject(row, index, donerowDel) {
  864. this.$confirm("确定将选择数据删除?", {
  865. confirmButtonText: "确定",
  866. cancelButtonText: "取消",
  867. type: "warning"
  868. }).then(() => {
  869. if (row.id){
  870. // corpsitem(row.id).then(res=>{
  871. // this.$message({
  872. // type: "success",
  873. // message: "操作成功!"
  874. // });
  875. // this.detailedData.splice(index, 1);
  876. // })
  877. }else {
  878. this.$message({
  879. type: "success",
  880. message: "操作成功!"
  881. });
  882. this.advantageProjectData.splice(index, 1);
  883. }
  884. })
  885. },
  886. //其他费用新增触发
  887. costIncrease(){
  888. this.dialogCost = !this.dialogCost
  889. this.choiceData = false
  890. },
  891. //新增附件上传保存触发
  892. rowSaveBankOfDeposit(row, done, loading){
  893. this.bankOfDepositData.push(row)
  894. done()
  895. },
  896. //修改附件上传触发
  897. rowUpdateBankOfDeposit(row, index, done, loading) {
  898. done(row);
  899. },
  900. //删除附件上传触发
  901. rowDelBankOfDeposit(row, index, donerowDel) {
  902. this.$confirm("确定将选择数据删除?", {
  903. confirmButtonText: "确定",
  904. cancelButtonText: "取消",
  905. type: "warning"
  906. }).then(() => {
  907. if (row.id){
  908. corpsbank(row.id).then(res=>{
  909. this.$message({
  910. type: "success",
  911. message: "操作成功!"
  912. });
  913. this.bankOfDepositData.splice(index, 1);
  914. })
  915. }else {
  916. this.$message({
  917. type: "success",
  918. message: "操作成功!"
  919. });
  920. this.bankOfDepositData.splice(index, 1);
  921. }
  922. })
  923. },
  924. //费用查询
  925. onLoadCost(page, params = {}) {
  926. this.loadingCost = true;
  927. let queryParams = Object.assign({}, params, {pageSize: page.pageSize, pageNum: page.currentPage,parentId:0,feesTypeId:this.treeDeptIdCost})
  928. customerList(queryParams).then(res => {
  929. const data = res.data.data;
  930. this.pageCost.total = data.total;
  931. this.dataCost = data.records;
  932. this.loadingCost = false;
  933. });
  934. },
  935. nodeClickCost(data){
  936. this.treeDeptIdCost = data.id;
  937. this.pageCost.currentPage = 1;
  938. this.onLoadCost(this.pageCost);
  939. },
  940. //费用刷新触发
  941. refreshChangeCost() {
  942. this.treeDeptIdCost = '';
  943. this.pageCost.currentPage = 1;
  944. this.onLoadCost(this.pageCost);
  945. },
  946. //费用选中触发
  947. selectionChangeCost(list){
  948. this.tableDataCost = list
  949. },
  950. //费用导入触发
  951. importCost(){
  952. // this.advantageProjectForm = this.advantageProjectForm.concat(this.tableDataCost)
  953. if (this.tableDataCost.length>0){
  954. for(let item in this.tableDataCost){
  955. this.tableDataCost[item].itemId = this.tableDataCost[item].id
  956. this.tableDataCost[item].feeName = this.tableDataCost[item].cname
  957. delete this.tableDataCost[item].id
  958. this.$refs.crudProject.rowCellAdd(this.tableDataCost[item]);
  959. this.$refs.crudProject.rowCell(this.tableDataCost[item], this.advantageProjectForm.length-1)
  960. }
  961. }
  962. this.tableDataCost = []
  963. this.dialogCost = false
  964. },
  965. //费用编辑导入触发
  966. choiceCost(){
  967. if (this.tableDataCost.length === 1){
  968. this.advantageProjectData[this.choiceIndex].feeName = this.tableDataCost[0].cname
  969. this.advantageProjectData[this.choiceIndex].itemId = this.tableDataCost[0].id
  970. this.advantageProjectData[this.choiceIndex].code = this.tableDataCost[0].code
  971. }
  972. this.dialogCost = !this.dialogCost
  973. this.choiceData = false
  974. },
  975. // 发货
  976. sendHandle() {
  977. this.$message.success('发货成功')
  978. },
  979. backToList() {
  980. this.$confirm("是否保存当前页面?", "提示", {
  981. confirmButtonText: "保存",
  982. cancelButtonText: "取消",
  983. type: "warning",
  984. }).then(() => {
  985. this.editCustomer(true)
  986. }).catch(() => {
  987. this.$emit("goBack");
  988. })
  989. },
  990. }
  991. }
  992. </script>
  993. <style scoped lang="scss">
  994. .customer-head {
  995. position: fixed;
  996. top: 105px;
  997. width: 100%;
  998. margin-left: -10px;
  999. height: 62px;
  1000. background: #ffffff;
  1001. box-shadow: 0 4px 12px 0px rgba(232, 232, 235, 1);
  1002. z-index: 999;
  1003. /* display: flex;
  1004. justify-content: left; */
  1005. }
  1006. .customer-back {
  1007. cursor: pointer;
  1008. line-height: 62px;
  1009. font-size: 16px;
  1010. color: #323233;
  1011. font-weight: 400;
  1012. }
  1013. .add-customer-btn-two {
  1014. position: fixed;
  1015. right: 150px;
  1016. top: 115px;
  1017. }
  1018. .add-customer-btn {
  1019. position: fixed;
  1020. right: 36px;
  1021. top: 115px;
  1022. }
  1023. ::v-deep .el-form-item {
  1024. margin-bottom: 0;
  1025. }
  1026. //el-icon-plus avue-upload__icon
  1027. .avue-upload /deep/ .avue-upload__icon {
  1028. line-height: 178px !important;
  1029. }
  1030. </style>