detailsPageEdit.vue 51 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519
  1. <template>
  2. <div class="borderless" v-loading="pageLoading">
  3. <div class="customer-head">
  4. <div class="customer-back">
  5. <!-- <i class="back-icon el-icon-arrow-left"></i><i style="font-style:normal">返回管理列表</i>-->
  6. <el-button type="danger" style="border: none;background: none;color: red" icon="el-icon-arrow-left"
  7. @click="backToList">返回列表
  8. </el-button>
  9. </div>
  10. <div class="add-customer-btn">
  11. <el-button
  12. v-if="detailData.seeDisabled"
  13. size="small"
  14. @click="detailData.seeDisabled = false"
  15. type="primary"
  16. >编辑</el-button>
  17. <el-button
  18. class="el-button--small-yh"
  19. type="primary"
  20. @click="revokeInGoods"
  21. size="small"
  22. v-if="form.deliveryStatus !== '录入'"
  23. :disabled="detailData.seeDisabled"
  24. >撤销收货</el-button>
  25. <el-button
  26. class="el-button--small-yh"
  27. type="primary"
  28. @click="sendInGoods"
  29. size="small"
  30. v-if="form.deliveryStatus == '录入'"
  31. :disabled="detailData.seeDisabled || !this.form.id"
  32. >确认收货</el-button>
  33. <el-button
  34. class="el-button--small-yh"
  35. size="small"
  36. type="success" @click="copyOrder"
  37. :disabled="detailData.seeDisabled || !this.form.id">
  38. 复制单据
  39. </el-button>
  40. <el-button
  41. class="el-button--small-yh"
  42. type="primary"
  43. :disabled="disabled || detailData.seeDisabled"
  44. @click="editCustomer(false)"
  45. size="small"
  46. :loading="saveLoading"
  47. >保 存
  48. </el-button>
  49. </div>
  50. </div>
  51. <div class="customer-main">
  52. <el-form :model="form" ref="form" label-width="130px" class="demo-ruleForm">
  53. <containerTitle title="基础资料"></containerTitle>
  54. <basic-container style="margin-bottom: 10px">
  55. <el-row>
  56. <el-col v-for="(item,index) in basicData.column" :key="index" :span="item.span?item.span:8">
  57. <el-form-item :label="item.label" :prop="item.prop" :rules="item.rules">
  58. <!-- <avue-input-tree v-if="item.prop === 'corpsTypeId'" leaf-only multiple :props="{label:'title'}" v-model="form[item.prop]" placeholder="请选择内容" type="tree" :dic="dic"-->
  59. <!-- ></avue-input-tree>-->
  60. <el-date-picker v-if="item.type === 'datetime'" style="width: 100%;" v-model="form[item.prop]"
  61. size="small" type="datetime" placeholder="选择日期" value-format="yyyy-MM-dd HH:mm:ss" :disabled="detailData.seeDisabled"/>
  62. <el-date-picker v-else-if="item.type === 'date'" style="width: 100%;" v-model="form[item.prop]"
  63. size="small" type="date" placeholder="选择日期"
  64. :disabled="detailData.seeDisabled"/>
  65. <crop-select
  66. v-else-if="item.prop === 'corpId'"
  67. v-model="form[item.prop]"
  68. corpType="GYS"
  69. :disabled="detailData.seeDisabled"
  70. ></crop-select>
  71. <crop-select
  72. v-else-if="item.prop === 'salesCompany'"
  73. v-model="form[item.prop]"
  74. corpType="GS"
  75. :disabled="detailData.seeDisabled"
  76. ></crop-select>
  77. <!-- <selectComponent v-else-if="item.prop === 'corpId'" v-model="form[item.prop]"-->
  78. <!-- :configuration="configuration" style="width: 100%" :disabled="detailData.seeDisabled"/>-->
  79. <!-- <selectComponent v-else-if="item.prop === 'salesCompany'" v-model="form[item.prop]"-->
  80. <!-- :configuration="companyConfiguration" style="width: 100%" :disabled="detailData.seeDisabled"/>-->
  81. <el-select v-else-if="item.prop === 'purchaseMode'" v-model="form[item.prop]" placeholder="请选择" clearable filterable style="width: 100%" size="small" :disabled="detailData.seeDisabled">
  82. <el-option v-for="(item,index) in procurementMethodOption" :key="index" :label="item.dictValue" :value="item.dictValue"></el-option>
  83. </el-select>
  84. <el-select v-else-if="item.prop === 'warehouseType'" v-model="form[item.prop]" placeholder="请选择" clearable filterable style="width: 100%" size="small" :disabled="detailData.seeDisabled">
  85. <el-option v-for="(item,index) in warehouseTypeOption" :key="index" :label="item.dictValue" :value="item.dictValue"></el-option>
  86. </el-select>
  87. <warehouse-select v-else-if="item.prop === 'storageId'" v-model="form[item.prop]"
  88. :configuration="configurationWarehouse" style="width: 100%" :disabled="detailData.seeDisabled"/>
  89. <el-input
  90. v-else-if="item.type == 'number'"
  91. placeholder="请输入"
  92. v-input-limit="2"
  93. size="small"
  94. :disabled="item.disabled || detailData.seeDisabled"
  95. v-model.trim="form[item.prop]"
  96. />
  97. <el-input type="textarea" v-else-if="item.type === 'textarea'" v-model.trim="form[item.prop]" size="small" autocomplete="off" :disabled="item.disabled || detailData.seeDisabled"></el-input>
  98. <el-input type="age" v-else v-model.trim="form[item.prop]" size="small" autocomplete="off" :disabled="item.disabled || detailData.seeDisabled"></el-input>
  99. </el-form-item>
  100. </el-col>
  101. </el-row>
  102. </basic-container>
  103. <containerTitle title="商品信息"></containerTitle>
  104. <basic-container style="margin-bottom: 10px">
  105. <avue-crud
  106. :option="customerContact"
  107. v-model="contactsForm"
  108. :data="contactsData"
  109. ref="crudContact"
  110. @row-save="rowSave"
  111. @row-click="handleRowClick"
  112. @row-update="rowUpdate"
  113. @row-del="rowDel"
  114. @saveColumn="saveColumn('goods')"
  115. @resetColumn="resetColumn"
  116. >
  117. <template slot="code" slot-scope="{row,index}">
  118. <el-button type="text" size="mini" style="padding:4px 10px;float:left" :disabled="detailData.seeDisabled || !row.$cellEdit" @click="commodityChoice(row)">选择</el-button>
  119. <span>{{ row.code }}</span>
  120. </template>
  121. <template slot-scope="{row,index}" slot="menu">
  122. <el-button
  123. type="text"
  124. size="small"
  125. @click="rowCell(row,index)"
  126. :disabled="detailData.seeDisabled"
  127. >{{ row.$cellEdit ? '保存' : '修改' }}
  128. </el-button>
  129. <el-button
  130. size="small"
  131. icon="el-icon-delete"
  132. type="text"
  133. @click="rowDel(row, index)"
  134. :disabled="detailData.seeDisabled"
  135. v-if="!row.$cellEdit"
  136. >删 除</el-button>
  137. </template>
  138. <template slot="actualQuantity" slot-scope="{ row }">
  139. <el-input
  140. v-if="row.$cellEdit"
  141. v-model.trim="row.actualQuantity"
  142. v-input-limit="0"
  143. @change="actualQuantityChange(row)"
  144. ></el-input>
  145. <span v-else>{{ row.actualQuantity | IntegerFormat }}</span>
  146. </template>
  147. <template slot="menuLeft" slot-scope="{size}">
  148. <el-button type="primary"
  149. icon="el-icon-plus"
  150. size="small"
  151. @click="commoditySelection"
  152. :disabled="detailData.seeDisabled"
  153. >录入明细
  154. </el-button>
  155. <el-button type="info" :size="size" icon="el-icon-printer">报 表</el-button>
  156. </template>
  157. </avue-crud>
  158. </basic-container>
  159. <fee-info
  160. ref="feeInfo"
  161. :orderFeesList="advantageProjectData"
  162. :disabled="detailData.seeDisabled"
  163. feeUrl="/blade-deliver-goods/deliveryfees/update"
  164. />
  165. <!-- <containerTitle title="费用明细"></containerTitle>-->
  166. <!-- <basic-container style="margin-bottom: 10px">-->
  167. <!-- <avue-crud-->
  168. <!-- :option="advantageProject"-->
  169. <!-- v-model="advantageProjectForm"-->
  170. <!-- :data="advantageProjectData"-->
  171. <!-- ref="crudProject"-->
  172. <!-- @row-save="rowSaveProject"-->
  173. <!-- @row-update="rowUpdateProject"-->
  174. <!-- @row-del="rowDelProject"-->
  175. <!-- @saveColumn="saveColumn('fees')"-->
  176. <!-- >-->
  177. <!-- <template slot="code" slot-scope="{row,index}">-->
  178. <!-- <el-button type="text" size="mini" style="padding:4px 10px;float:left" @click="choice(row)" :disabled="detailData.seeDisabled || !row.$cellEdit">选择</el-button>-->
  179. <!-- <span>{{ row.code }}</span>-->
  180. <!-- </template>-->
  181. <!-- <template slot="corpId" slot-scope="{ row }">-->
  182. <!-- <selectComponent v-if="row.$cellEdit" v-model="row.corpId"-->
  183. <!-- :configuration="configuration" @receiveList="receiveList"/>-->
  184. <!-- <span v-else>-->
  185. <!-- <span v-for="(item, index) in configuration.dicData" :key="index" v-if="item.id == row.corpId">{{ item.cname }}</span>-->
  186. <!-- </span>-->
  187. <!-- </template>-->
  188. <!-- <template slot="amount" slot-scope="{ row }">-->
  189. <!-- <el-input v-if="row.$cellEdit" v-model.trim="row.amount"-->
  190. <!-- size="small" v-input-limit="2"-->
  191. <!-- ></el-input>-->
  192. <!-- <span v-else>{{ row.amount }}</span>-->
  193. <!-- </template>-->
  194. <!-- <template slot="settlmentAmount" slot-scope="{ row }">-->
  195. <!-- <el-input v-if="row.$cellEdit" v-model.trim="row.settlmentAmount"-->
  196. <!-- size="small" v-input-limit="2"-->
  197. <!-- ></el-input>-->
  198. <!-- <span v-else>{{ row.settlmentAmount }}</span>-->
  199. <!-- </template>-->
  200. <!-- <template slot-scope="{row,index}" slot="menu">-->
  201. <!-- <el-button-->
  202. <!-- type="text"-->
  203. <!-- size="small"-->
  204. <!-- @click="rowCellTwo(row,index)"-->
  205. <!-- :disabled="detailData.seeDisabled"-->
  206. <!-- >{{ row.$cellEdit ? '保存' : '修改' }}-->
  207. <!-- </el-button>-->
  208. <!-- <el-button-->
  209. <!-- size="small"-->
  210. <!-- icon="el-icon-delete"-->
  211. <!-- type="text"-->
  212. <!-- @click="rowDelProject(row, index)"-->
  213. <!-- :disabled="detailData.seeDisabled"-->
  214. <!-- v-if="!row.$cellEdit"-->
  215. <!-- >删 除</el-button>-->
  216. <!-- </template>-->
  217. <!-- <template slot="menuLeft" slot-scope="{size}">-->
  218. <!-- <el-button type="primary"-->
  219. <!-- icon="el-icon-plus"-->
  220. <!-- size="small"-->
  221. <!-- @click="costIncrease"-->
  222. <!-- :disabled="detailData.seeDisabled"-->
  223. <!-- >录入明细-->
  224. <!-- </el-button>-->
  225. <!-- </template>-->
  226. <!-- </avue-crud>-->
  227. <!-- </basic-container>-->
  228. <containerTitle title="附件上传"></containerTitle>
  229. <basic-container style="margin-bottom: 40px">
  230. <avue-crud
  231. :option="bankOfDeposit"
  232. v-model="bankOfDepositForm"
  233. :data="bankOfDepositData"
  234. @row-save="rowSaveBankOfDeposit"
  235. @row-update="rowUpdateBankOfDeposit"
  236. @row-del="rowDelBankOfDeposit"
  237. :upload-after="uploadAfter"
  238. ref="uploadCrud"
  239. >
  240. <template slot="menuLeft">
  241. <el-button
  242. type="primary"
  243. icon="el-icon-plus"
  244. size="small"
  245. @click.stop="$refs.uploadCrud.rowAdd()"
  246. :disabled="detailData.seeDisabled"
  247. >上传</el-button
  248. >
  249. </template>
  250. <template slot="menu" slot-scope="{ row, index }">
  251. <el-button
  252. size="small"
  253. icon="el-icon-edit"
  254. type="text"
  255. @click="$refs.uploadCrud.rowEdit(row, index)"
  256. :disabled="detailData.seeDisabled"
  257. >编 辑</el-button
  258. >
  259. <el-button
  260. size="small"
  261. icon="el-icon-delete"
  262. type="text"
  263. @click="rowDelBankOfDeposit(row, index)"
  264. :disabled="detailData.seeDisabled"
  265. >删 除</el-button
  266. >
  267. </template>
  268. </avue-crud>
  269. </basic-container>
  270. </el-form>
  271. </div>
  272. <el-dialog
  273. title="导入商品"
  274. append-to-body
  275. class="el-dialogDeep"
  276. :visible.sync="dialogVisible"
  277. width="80%"
  278. :close-on-click-modal="false"
  279. :destroy-on-close="true"
  280. :close-on-press-escape="false"
  281. @close="closeGoods">
  282. <el-row :style="{height: rowHeight}">
  283. <el-col :span="5" style="height: 100%;overflow-y: auto">
  284. <div>
  285. <el-scrollbar>
  286. <basic-container>
  287. <avue-tree :option="treeOption" :data="treeDataGoods" @node-click="nodeClick"/>
  288. </basic-container>
  289. </el-scrollbar>
  290. </div>
  291. </el-col>
  292. <el-col :span="19">
  293. <basic-container>
  294. <avue-crud :option="optionTwo"
  295. :table-loading="loading"
  296. :data="data"
  297. ref="crud"
  298. @refresh-change="refreshChange"
  299. @selection-change="selectionChange"
  300. :page.sync="page"
  301. @search-change="goodsSearch"
  302. @on-load="onLoad"></avue-crud>
  303. </basic-container>
  304. </el-col>
  305. </el-row>
  306. <span slot="footer" class="dialog-footer">
  307. <el-button @click="dialogVisible = false">取 消</el-button>
  308. <el-button type="primary" @click="importGoods" v-if="commodityData !== true">导入</el-button>
  309. <el-button type="primary" @click="importChoice" v-if="commodityData === true"
  310. :disabled="tableData.length !== 1">导入</el-button>
  311. </span>
  312. </el-dialog>
  313. <el-dialog
  314. title="导入费用"
  315. append-to-body
  316. class="el-dialogDeep"
  317. :visible.sync="dialogCost"
  318. width="80%"
  319. :close-on-click-modal="false"
  320. :destroy-on-close="true"
  321. :close-on-press-escape="false"
  322. @close="closeFees">
  323. <el-row :style="{height: rowHeight}">
  324. <el-col :span="5" style="height: 100%;overflow-y: auto">
  325. <div>
  326. <el-scrollbar>
  327. <basic-container>
  328. <avue-tree :option="treeOptionCost" :data="treeData" @node-click="nodeClickCost"/>
  329. </basic-container>
  330. </el-scrollbar>
  331. </div>
  332. </el-col>
  333. <el-col :span="19">
  334. <basic-container>
  335. <avue-crud :option="optionTwoCost"
  336. :table-loading="loadingCost"
  337. :data="dataCost"
  338. ref="crud"
  339. @refresh-change="refreshChangeCost"
  340. @selection-change="selectionChangeCost"
  341. :page.sync="pageCost"
  342. @searchChange="feesSearch"
  343. @on-load="onLoadCost">
  344. </avue-crud>
  345. </basic-container>
  346. </el-col>
  347. </el-row>
  348. <span slot="footer" class="dialog-footer">
  349. <el-button @click="dialogCost = false">取 消</el-button>
  350. <el-button type="primary" @click="importCost" v-if="choiceData !== true">导入</el-button>
  351. <el-button type="primary" @click="choiceCost" v-if="choiceData === true"
  352. :disabled="tableDataCost.length !== 1">导入</el-button>
  353. </span>
  354. </el-dialog>
  355. </div>
  356. </template>
  357. <script>
  358. import {
  359. typeSave, detail, deleteDetails,
  360. corpstypeTree,
  361. corpsattn,
  362. corpsbank,
  363. corpsfiles,
  364. corpsitem,
  365. // getList,
  366. sendInGoods,
  367. revokeInGoods
  368. } from "@/api/basicData/receipt"
  369. import {getList} from "@/api/basicData/commodityType";
  370. import customerContact from "./configuration/customerContact.json"
  371. import advantageProject from "./configuration/advantageProject.json"
  372. import bankOfDeposit from "./configuration/bankOfDeposit.json"
  373. import commodity from "./configuration/commodity.json"
  374. import optionTwoCost from "./configuration/mainListCost.json"
  375. import {getDeptLazyTree, customerList,getDeptLazyTreeTwo} from "@/api/basicData/basicFeesDesc";
  376. import {customerList as wareHouseType} from "@/api/basicData/basicStorageType"
  377. import {customerList as selectWareHouse} from "@/api/basicData/basicStorageDesc"
  378. import {selectGoodsNum} from "@/api/basicData/inventoryAccount"
  379. import { contrastObj, contrastList } from "@/util/contrastData";
  380. import feeInfo from "@/components/fee-info/main";
  381. import {
  382. isDiscount,
  383. isPercentage,
  384. micrometerFormat,
  385. IntegerFormat
  386. } from "@/util/validate";
  387. export default {
  388. name: "detailsPage",
  389. props: {
  390. detailData: {
  391. type: Object
  392. }
  393. },
  394. components: {
  395. feeInfo,
  396. },
  397. data() {
  398. return {
  399. saveLoading: false,
  400. configuration: {
  401. multipleChoices: false,
  402. multiple: false,
  403. collapseTags: false,
  404. placeholder: '请点击右边按钮选择',
  405. dicData: []
  406. },
  407. companyConfiguration: {
  408. multipleChoices: false,
  409. multiple: false,
  410. collapseTags: false,
  411. placeholder: '请点击右边按钮选择',
  412. dicData: []
  413. },
  414. configurationWarehouse: {
  415. multipleChoices: false,
  416. multiple: false,
  417. collapseTags: false,
  418. placeholder: "请点击右边按钮选择",
  419. dicData: [],
  420. },
  421. form: {},
  422. data: [],
  423. loadingCost: false,
  424. choiceData: false,
  425. commodityData: false,
  426. dataCost: [],
  427. choiceIndex: '',
  428. dialogCost: false,
  429. treeDeptId: '',
  430. treeDeptIdCost: '',
  431. pageCost: {
  432. pageSize: 10,
  433. currentPage: 1,
  434. total: 0
  435. },
  436. page: {
  437. pageSize: 10,
  438. currentPage: 1,
  439. total: 0
  440. },
  441. loading: false,
  442. contactsForm: {},
  443. optionTwo: commodity,
  444. optionTwoCost: optionTwoCost,
  445. treeData: [],
  446. treeDataGoods: [],
  447. treeOptionCost: {
  448. nodeKey: 'id',
  449. lazy: true,
  450. treeLoad: function (node, resolve) {
  451. const parentId = (node.level === 0) ? 0 : node.data.id;
  452. getDeptLazyTree(parentId).then(res => {
  453. resolve(res.data.data.map(item => {
  454. return {
  455. ...item,
  456. leaf: !item.hasChildren
  457. }
  458. }))
  459. });
  460. },
  461. addBtn: false,
  462. menu: false,
  463. size: 'small',
  464. props: {
  465. labelText: '标题',
  466. label: 'title',
  467. value: 'value',
  468. children: 'children'
  469. }
  470. },
  471. treeOption: {
  472. nodeKey: 'id',
  473. lazy: true,
  474. treeLoad: function (node, resolve) {
  475. const parentId = (node.level === 0) ? 0 : node.data.id;
  476. getDeptLazyTreeTwo(parentId).then(res => {
  477. resolve(res.data.data.map(item => {
  478. return {
  479. ...item,
  480. leaf: !item.hasChildren
  481. }
  482. }))
  483. });
  484. },
  485. addBtn: false,
  486. menu: false,
  487. size: 'small',
  488. props: {
  489. labelText: '标题',
  490. label: 'title',
  491. value: 'value',
  492. children: 'children'
  493. }
  494. },
  495. dialogVisible: false,
  496. advantageProjectForm: {},
  497. bankOfDepositForm: {},
  498. contactsData: [],
  499. advantageProjectData: [],
  500. disabled: false,
  501. bankOfDepositData: [],
  502. tableDataCost: [],
  503. dic: [],
  504. tableData: [],
  505. customerContact: {},
  506. advantageProject: {},
  507. bankOfDeposit: bankOfDeposit,
  508. basicData: {
  509. column: [
  510. {
  511. label: '系统编号',//发货通知(点击)
  512. prop: 'sysNo',
  513. disabled: true,
  514. rules: [
  515. {
  516. required: false,
  517. message: ' ',
  518. trigger: 'blur'
  519. }
  520. ]
  521. }, {
  522. label: '供应商',
  523. prop: 'corpId',
  524. span: 16,
  525. rules: [
  526. {
  527. required: true,
  528. message: ' ',
  529. trigger: 'blur'
  530. }
  531. ]
  532. },{
  533. label: '采购方式',
  534. prop: 'purchaseMode',
  535. rules: [
  536. {
  537. required: true,
  538. message: ' ',
  539. trigger: 'blur'
  540. }
  541. ]
  542. }, {
  543. label: '所属公司',
  544. prop: 'salesCompany',
  545. span: 16,
  546. rules: [
  547. {
  548. required: true,
  549. message: ' ',
  550. trigger: 'blur'
  551. }
  552. ]
  553. },{
  554. label: '仓库类型',
  555. prop: 'warehouseType',//字典表
  556. rules: [
  557. {
  558. required: true,
  559. message: ' ',
  560. trigger: 'blur'
  561. }
  562. ]
  563. }, {
  564. label: '仓库名称',
  565. prop: 'storageId',
  566. span: 16,
  567. rules: [
  568. {
  569. required: true,
  570. message: ' ',
  571. trigger: 'blur'
  572. }
  573. ]
  574. }, {
  575. label: '匹配订单号',
  576. prop: 'srcOrderNo',
  577. rules: [
  578. {
  579. required: false,
  580. message: ' ',
  581. trigger: 'blur'
  582. }
  583. ]
  584. },{
  585. label: '入库金额',
  586. prop: 'deliveryAmount',
  587. disabled: true,
  588. rules: [
  589. {
  590. required: false,
  591. message: ' ',
  592. trigger: 'blur'
  593. }
  594. ]
  595. }, {
  596. label: '采购金额',
  597. prop: 'purchaseAmount',
  598. disabled: true,
  599. rules: [
  600. {
  601. required: false,
  602. message: ' ',
  603. trigger: 'blur'
  604. }
  605. ]
  606. },{
  607. label: '入库数量',
  608. prop: 'totalQuantity',
  609. disabled: true,
  610. rules: [
  611. {
  612. required: false,
  613. message: ' ',
  614. trigger: 'blur'
  615. }
  616. ]
  617. }, {
  618. label: '费用合计',
  619. type: 'number',
  620. prop: 'totalCost',
  621. rules: [
  622. {
  623. required: false,
  624. message: ' ',
  625. trigger: 'blur'
  626. }
  627. ]
  628. }, {
  629. label: '入库日期',
  630. prop: 'businessDate',
  631. type: 'datetime',
  632. rules: [
  633. {
  634. required: true,
  635. message: ' ',
  636. trigger: 'blur'
  637. }
  638. ]
  639. }, {
  640. label: '发货地址',
  641. prop: 'arrivalAddress',
  642. rules: [
  643. {
  644. required: false,
  645. message: ' ',
  646. trigger: 'blur'
  647. }
  648. ]
  649. }, {
  650. label: '发货人',
  651. prop: 'arrivalContact',
  652. rules: [
  653. {
  654. required: false,
  655. message: ' ',
  656. trigger: 'blur'
  657. }
  658. ]
  659. }, {
  660. label: '发货电话',
  661. prop: 'arrivalTel',
  662. rules: [
  663. {
  664. required: false,
  665. message: ' ',
  666. trigger: 'blur'
  667. }
  668. ]
  669. },{
  670. label: "入库单备注",
  671. span: 24,
  672. type: 'textarea',
  673. prop: "deliveryRemarks",
  674. mock: {
  675. type: 'county'
  676. }
  677. }
  678. ]
  679. },
  680. statusOption: [],
  681. procurementMethodOption: [],
  682. warehouseTypeOption: [],
  683. // 仓库类型
  684. warehouseType: [],
  685. // 仓库名称
  686. warehouseName: [],
  687. // 第一次进入
  688. firstComing: false,
  689. // 费用信息排序的最大值
  690. maxFeeNum: 0,
  691. maxGoodsNum: 0,
  692. oldForm: {
  693. orderStatus: "录入"
  694. },
  695. oldGoodsList: [],
  696. oldFeesList: [],
  697. oldUploadList: [],
  698. // 弹窗高度
  699. rowHeight: '',
  700. // 查询时loading页面
  701. pageLoading: false,
  702. }
  703. },
  704. mounted() {
  705. this.$nextTick(() => {
  706. // 监听浏览器高度变化,改变表格高度
  707. window.onresize = () => {
  708. this.rowHeight = (window.innerHeight - 130) + 'px'
  709. }
  710. })
  711. },
  712. filters: {
  713. IntegerFormat(num) {
  714. return IntegerFormat(num);
  715. }
  716. },
  717. //初始化查询
  718. async created() {
  719. this.rowHeight = (window.innerHeight - 130) + 'px'
  720. this.customerContact = await this.getColumnData(this.getColumnName(24), customerContact);
  721. this.advantageProject = await this.getColumnData(this.getColumnName(25), advantageProject);
  722. this.getWorkDicts("procurement_method").then(res => {
  723. this.procurementMethodOption = res.data.data
  724. })
  725. this.getWorkDicts("warehouseType").then(res => {
  726. this.warehouseTypeOption = res.data.data
  727. })
  728. wareHouseType().then(res => {
  729. this.warehouseType = res.data.data.records
  730. this.warehouseType.forEach(item => {
  731. this.$set(item, 'label', item.cname)
  732. this.$set(item, 'value', item.id)
  733. if (item.hasChildren) {
  734. this.$set(item, 'children', [])
  735. }
  736. })
  737. let result = [], temp = {}
  738. for(let i = 0; i < this.warehouseType.length;i++) {
  739. temp[this.warehouseType[i].id] = this.warehouseType[i]
  740. }
  741. for (let j = 0;j < this.warehouseType.length;j++) {
  742. let current = this.warehouseType[j]
  743. let tempCurrentParent = temp[current.parentId]
  744. if (tempCurrentParent) {
  745. if (!tempCurrentParent["children"]) {
  746. tempCurrentParent["children"] = []
  747. }
  748. tempCurrentParent["children"].push(current)
  749. } else {
  750. result.push(current)
  751. }
  752. }
  753. this.warehouseType = result
  754. });
  755. selectWareHouse().then(res => {
  756. this.warehouseName = res.data.data.records
  757. })
  758. this.form.deliveryAmount = 0
  759. this.form.totalQuantity = 0
  760. this.form.purchaseAmount = 0
  761. if (this.detailData.id) {
  762. this.queryData(this.detailData.id)
  763. }else if (this.detailData.form){
  764. this.form = JSON.parse(this.detailData.form);
  765. delete this.form.createTime
  766. delete this.form.id
  767. delete this.form.sysNo
  768. this.contactsData = this.form.orderItemsList
  769. delete this.form.orderItemsList
  770. this.configuration.dicData = this.form.corpName
  771. delete this.form.corpName
  772. this.$set(this.form, 'deliveryStatus', '录入')
  773. if (this.form.belongToCorpList) {
  774. this.$set(this.form, 'salesCompany', this.form.belongToCorpId)
  775. delete this.form.belongToCorpId
  776. this.companyConfiguration.dicData = this.companyConfiguration.dicData.concat(this.form.belongToCorpList)
  777. }
  778. delete this.form.belongToCorpList
  779. this.$set(this.form, 'deliveryAmount', 0)
  780. this.$set(this.form, 'totalQuantity', 0)
  781. this.$set(this.form, 'purchaseAmount', 0)
  782. this.contactsData.forEach(item => {
  783. this.$set(item, 'specificationAndModel', item.itemType)
  784. this.$set(item, 'orgOrderNo', this.form.orgOrderNo)
  785. this.$set(item, "inventoryNumber", item.storageQuantity)
  786. this.$set(item, "srcId", item.id)
  787. this.$set(item, "deliveryAmount", item.amount)
  788. this.$set(item, "purchaseAmount", item.price)
  789. this.$set(item, "purchaseQuantity", Number(item.orderQuantity))
  790. this.$set(item, "actualQuantity", (Number(item.orderQuantity) - Number(item.actualQuantity)))
  791. // 入库数量和入库金额的比例
  792. this.$set(item, 'scale', Number(item.deliveryAmount / item.actualQuantity))
  793. this.form.deliveryAmount = Number(this.form.deliveryAmount) + Number(item.deliveryAmount)
  794. this.form.totalQuantity = Number(this.form.totalQuantity) + Number(item.actualQuantity)
  795. this.form.purchaseAmount = Number(this.form.purchaseAmount) + Number(item.deliveryAmount)
  796. this.form.deliveryAmount = (this.form.deliveryAmount).toFixed(2)
  797. this.form.purchaseAmount = (this.form.purchaseAmount).toFixed(2)
  798. delete item.id
  799. delete item.pid
  800. })
  801. } else if (this.detailData.copyId) {
  802. this.queryData(this.detailData.copyId, true)
  803. }
  804. },
  805. watch: {
  806. },
  807. methods: {
  808. queryData(id, isCopy = false) {
  809. this.pageLoading = true
  810. detail(id).then(res => {
  811. this.form = res.data.data;
  812. this.contactsData = this.form.deliveryItemsList
  813. this.advantageProjectData = this.form.deliveryFeesList
  814. this.bankOfDepositData = this.form.deliveryFilesList
  815. this.configuration.dicData = this.form.corpName
  816. this.contactsData.forEach(item => {
  817. // this.form.deliveryAmount += Number(item.deliveryAmount)
  818. // this.form.totalQuantity += Number(item.actualQuantity)
  819. // 入库金额和入库数量的比例
  820. this.$set(item, 'scale', (item.deliveryAmount / item.actualQuantity))
  821. })
  822. let feesData = []
  823. this.form.deliveryFeesList.forEach(item => {
  824. let a = {
  825. cname: item.corpName,
  826. id: item.corpId
  827. }
  828. feesData.push(a)
  829. })
  830. this.configuration.dicData = this.configuration.dicData.concat(feesData)
  831. // 去重
  832. this.removeRepeat()
  833. if (this.form.companyName) {
  834. this.companyConfiguration.dicData = this.companyConfiguration.dicData.concat(this.form.companyName)
  835. }
  836. delete this.form.deliveryItemsList
  837. delete this.form.deliveryFeesList
  838. delete this.form.deliveryFilesList
  839. delete this.form.corpName
  840. delete this.form.companyName
  841. // 获取最大值
  842. let num = []
  843. this.advantageProjectData.forEach(item => {
  844. num.push(item.sort)
  845. })
  846. if (num.length == 0) {
  847. this.maxFeeNum = 0;
  848. } else {
  849. this.maxFeeNum = num.reduce((a, b) => {
  850. return b > a? b: a;
  851. })
  852. }
  853. let goodsNum = []
  854. this.contactsData.forEach(item => {
  855. goodsNum.push(item.sort)
  856. })
  857. if (goodsNum.length == 0) {
  858. this.maxGoodsNum = 0;
  859. } else {
  860. this.maxGoodsNum = goodsNum.reduce((a, b) => {
  861. return b > a? b: a;
  862. })
  863. }
  864. this.oldGoodsList = []
  865. this.oldFeesList = []
  866. this.oldUploadList = []
  867. this.oldForm = Object.assign({}, this.form)
  868. this.oldGoodsList = this.deepClone(this.contactsData)
  869. this.oldFeesList = this.deepClone(this.advantageProjectData)
  870. this.oldUploadList = this.deepClone(this.bankOfDepositData)
  871. if (isCopy) {
  872. delete this.form.id
  873. delete this.form.sysNo
  874. this.contactsData.forEach(item => {
  875. delete item.id
  876. delete item.pid
  877. })
  878. this.advantageProjectData.forEach(item => {
  879. delete item.id
  880. delete item.pid
  881. })
  882. this.bankOfDepositData.forEach(item => {
  883. delete item.id
  884. delete item.pid
  885. })
  886. this.form.deliveryStatus == '录入'
  887. }
  888. }).finally(() => {
  889. this.saveLoading = false
  890. this.pageLoading = false
  891. });
  892. },
  893. copyOrder() {
  894. this.queryData(this.form.id, true)
  895. },
  896. // 入库数量变化时调用
  897. actualQuantityChange(row) {
  898. if (Number(row.actualQuantity) > Number(row.purchaseQuantity)) {
  899. this.$message.error('入库数量不能超过采购数量')
  900. row.actualQuantity = 0
  901. }
  902. // if (row.scale) {
  903. // row.deliveryAmount = Number(row.actualQuantity) * Number(row.scale)
  904. // }
  905. },
  906. // 类别变换时触发
  907. warehouseTreeChange(id) {
  908. this.warehouseName = []
  909. if (this.firstComing) {
  910. if (!this.form.storageId) {
  911. this.$set(this.form, 'storageId', null)
  912. } else {
  913. this.form.storageId = null
  914. }
  915. }
  916. let data = {
  917. storageTypeId: id
  918. }
  919. selectWareHouse(data).then(res => {
  920. this.warehouseName = res.data.data.records
  921. })
  922. this.firstComing = true
  923. },
  924. //点击行可编辑
  925. handleRowClick(row, event, column) {
  926. console.log(row.$index)
  927. },
  928. //商品编辑
  929. rowCell(row, index) {
  930. console.log(row)
  931. this.$refs.crudContact.rowCell(row, index)
  932. },
  933. //费用编辑
  934. rowCellTwo(row, index) {
  935. console.log(row)
  936. this.$refs.crudProject.rowCell(row, index)
  937. },
  938. //费用新增触发
  939. costIncrease() {
  940. this.dialogCost = !this.dialogCost
  941. this.choiceData = false
  942. },
  943. //商品新增触发
  944. commoditySelection() {
  945. this.dialogVisible = !this.dialogVisible
  946. this.tableData = []
  947. this.commodityData = false
  948. },
  949. //点击费用明细选择触发
  950. choice(row) {
  951. this.dialogCost = !this.dialogCost
  952. this.choiceData = true
  953. console.log(row)
  954. this.choiceIndex = row.$index
  955. },
  956. //点击商品明细选择触发
  957. commodityChoice(row) {
  958. this.dialogVisible = !this.dialogVisible
  959. this.commodityData = true
  960. console.log(row)
  961. this.choiceIndexT = row.$index
  962. },
  963. //导入商品触发
  964. importChoice() {
  965. if (this.tableData.length === 1) {
  966. this.contactsData[this.choiceIndexT].cname = this.tableData[0].cname
  967. this.contactsData[this.choiceIndexT].code = this.tableData[0].code
  968. this.contactsData[this.choiceIndexT].typeno = this.tableData[0].typeno
  969. this.contactsData[this.choiceIndexT].specificationAndModel = this.tableData[0].typeno
  970. this.contactsData[this.choiceIndexT].itemId = this.tableData[0].id
  971. selectGoodsNum({
  972. goodsId: this.tableData[0].id,
  973. itemType: this.tableData[0].typeno
  974. }).then(res => {
  975. this.contactsData[this.choiceIndexT].storageQuantity = res.data.data
  976. })
  977. }
  978. this.dialogVisible = !this.dialogVisible
  979. this.commodityData = false
  980. },
  981. //费用编辑导入触发
  982. choiceCost() {
  983. console.log('1111')
  984. if (this.tableDataCost.length === 1) {
  985. this.advantageProjectData[this.choiceIndex].feeName = this.tableDataCost[0].cname
  986. this.advantageProjectData[this.choiceIndex].itemId = this.tableDataCost[0].id
  987. this.advantageProjectData[this.choiceIndex].code = this.tableDataCost[0].code
  988. }
  989. this.dialogCost = !this.dialogCost
  990. this.choiceData = false
  991. },
  992. //费用导入触发
  993. importCost() {
  994. console.log('111111')
  995. // this.advantageProjectForm = this.advantageProjectForm.concat(this.tableDataCost)
  996. if (this.tableDataCost.length > 0) {
  997. for (let item in this.tableDataCost) {
  998. console.log(this.tableDataCost[item])
  999. this.tableDataCost[item].itemId = this.tableDataCost[item].id
  1000. this.tableDataCost[item].feeName = this.tableDataCost[item].cname
  1001. this.tableDataCost[item].sort = this.maxFeeNum + 1
  1002. this.maxFeeNum++
  1003. delete this.tableDataCost[item].id
  1004. this.$refs.crudProject.rowCellAdd(this.tableDataCost[item]);
  1005. this.$refs.crudProject.rowCell(this.tableDataCost[item], this.advantageProjectForm.length - 1)
  1006. }
  1007. }
  1008. this.tableDataCost = []
  1009. this.dialogCost = false
  1010. },
  1011. //确认导入触发
  1012. importGoods() {
  1013. // this.contactsData = this.contactsData.concat(this.tableData)
  1014. if (this.tableData.length > 0) {
  1015. for (let item in this.tableData) {
  1016. selectGoodsNum({
  1017. goodsId: this.tableData[item].id,
  1018. itemType: this.tableData[item].typeno
  1019. }).then(res => {
  1020. this.tableData[item].storageQuantity = res.data.data
  1021. this.tableData[item].itemId = this.tableData[item].id
  1022. this.tableData[item].priceCategory = this.tableData[item].goodsTypeName
  1023. delete this.tableData[item].goodsTypeName
  1024. delete this.tableData[item].id
  1025. delete this.tableData[item].status
  1026. delete this.tableData[item].isDeleted
  1027. this.$set(this.tableData[item], 'specificationAndModel', this.tableData[item].typeno)
  1028. this.$set(this.tableData[item], 'purchaseQuantity', 0)
  1029. this.$set(this.tableData[item], 'actualQuantity', 0)
  1030. this.$set(this.tableData[item], 'purchaseAmount', 0)
  1031. this.$set(this.tableData[item], 'deliveryAmount', 0)
  1032. this.tableData[item].sort = this.maxGoodsNum + 1
  1033. this.maxGoodsNum++
  1034. this.$refs.crudContact.rowCellAdd(this.tableData[item]);
  1035. this.$refs.crudContact.rowCell(this.tableData[item], this.contactsData.length - 1)
  1036. })
  1037. }
  1038. }
  1039. this.dialogVisible = false
  1040. },
  1041. closeGoods() {
  1042. this.treeDataGoods = [];
  1043. this.treeDeptId = "";
  1044. },
  1045. closeFees() {
  1046. this.treeDeptIdCost = "";
  1047. this.treeData = [];
  1048. },
  1049. //选中触发
  1050. selectionChange(list) {
  1051. console.log(list);
  1052. this.tableData = list
  1053. },
  1054. //费用选中触发
  1055. selectionChangeCost(list) {
  1056. console.log(list);
  1057. this.tableDataCost = list
  1058. },
  1059. //导入页左商品类型查询
  1060. nodeClick(data) {
  1061. this.treeDeptId = data.id;
  1062. this.page.currentPage = 1;
  1063. this.onLoad(this.page);
  1064. },
  1065. //导入页左费用类型查询
  1066. nodeClickCost(data) {
  1067. this.treeDeptIdCost = data.id;
  1068. this.pageCost.currentPage = 1;
  1069. this.onLoadCost(this.pageCost);
  1070. },
  1071. //刷新触发
  1072. refreshChange() {
  1073. this.treeDeptId = '';
  1074. this.page.currentPage = 1;
  1075. this.onLoad(this.page);
  1076. },
  1077. //费用刷新触发
  1078. refreshChangeCost() {
  1079. this.treeDeptIdCost = '';
  1080. this.pageCost.currentPage = 1;
  1081. this.onLoadCost(this.pageCost);
  1082. },
  1083. //新增商品信息保存触发
  1084. rowSave(row, done, loading) {
  1085. // this.contactsData.push(row)
  1086. done()
  1087. },
  1088. //修改商品信息触发
  1089. rowUpdate(row, index, done, loading) {
  1090. done(row);
  1091. },
  1092. //删除商品信息触发
  1093. rowDel(row, index, donerowDel) {
  1094. this.$confirm("确定将选择数据删除?", {
  1095. confirmButtonText: "确定",
  1096. cancelButtonText: "取消",
  1097. type: "warning"
  1098. }).then(() => {
  1099. //商品判断是否需要调用删除接口
  1100. if (row.id) {
  1101. corpsattn(row.id).then(res => {
  1102. this.$message({
  1103. type: "success",
  1104. message: "操作成功!"
  1105. });
  1106. this.contactsData.splice(index, 1);
  1107. })
  1108. } else {
  1109. this.$message({
  1110. type: "success",
  1111. message: "操作成功!"
  1112. });
  1113. this.contactsData.splice(index, 1);
  1114. }
  1115. })
  1116. },
  1117. //新增费用明细保存触发
  1118. rowSaveProject(row, done, loading) {
  1119. // this.advantageProjectData.push(row)
  1120. done()
  1121. },
  1122. //修改费用明细触发
  1123. rowUpdateProject(row, index, done, loading) {
  1124. done(row);
  1125. },
  1126. goodsSearch(params, done) {
  1127. this.treeDeptId = '';
  1128. this.onLoad(this.page, params);
  1129. done()
  1130. },
  1131. //商品列表查询
  1132. onLoad(page, params = {}) {
  1133. this.loading = true;
  1134. getList(page.currentPage, page.pageSize, Object.assign(params, this.query), this.treeDeptId).then(res => {
  1135. console.log(res)
  1136. const data = res.data.data;
  1137. this.page.total = data.total;
  1138. this.data = data.records;
  1139. this.loading = false;
  1140. });
  1141. },
  1142. // 费用查询按钮
  1143. feesSearch(params, done) {
  1144. this.treeDeptIdCost = '';
  1145. this.onLoadCost(this.pageCost, params)
  1146. done()
  1147. },
  1148. //费用查询
  1149. onLoadCost(page, params = {}) {
  1150. this.loadingCost = true;
  1151. let queryParams = Object.assign({}, params, {
  1152. pageSize: page.pageSize,
  1153. pageNum: page.currentPage,
  1154. parentId: 0,
  1155. feesTypeId: this.treeDeptIdCost
  1156. })
  1157. customerList(queryParams).then(res => {
  1158. console.log(res)
  1159. const data = res.data.data;
  1160. this.pageCost.total = data.total;
  1161. this.dataCost = data.records;
  1162. this.loadingCost = false;
  1163. });
  1164. },
  1165. //删除费用明细触发
  1166. rowDelProject(row, index, donerowDel) {
  1167. this.$confirm("确定将选择数据删除?", {
  1168. confirmButtonText: "确定",
  1169. cancelButtonText: "取消",
  1170. type: "warning"
  1171. }).then(() => {
  1172. //费用判断是否需要调用删除接口
  1173. if (row.id) {
  1174. corpsitem(row.id).then(res => {
  1175. this.$message({
  1176. type: "success",
  1177. message: "操作成功!"
  1178. });
  1179. this.advantageProjectData.splice(index, 1);
  1180. })
  1181. } else {
  1182. this.$message({
  1183. type: "success",
  1184. message: "操作成功!"
  1185. });
  1186. this.advantageProjectData.splice(index, 1);
  1187. }
  1188. })
  1189. },
  1190. //新增附件上传保存触发
  1191. rowSaveBankOfDeposit(row, done, loading) {
  1192. this.bankOfDepositData.push(row)
  1193. done()
  1194. },
  1195. //修改附件上传触发
  1196. rowUpdateBankOfDeposit(row, index, done, loading) {
  1197. done(row);
  1198. },
  1199. //删除附件上传触发
  1200. rowDelBankOfDeposit(row, index, donerowDel) {
  1201. this.$confirm("确定将选择数据删除?", {
  1202. confirmButtonText: "确定",
  1203. cancelButtonText: "取消",
  1204. type: "warning"
  1205. }).then(() => {
  1206. //附件判断是否需要调用删除接口
  1207. if (row.id) {
  1208. corpsbank(row.id).then(res => {
  1209. this.$message({
  1210. type: "success",
  1211. message: "操作成功!"
  1212. });
  1213. this.bankOfDepositData.splice(index, 1);
  1214. })
  1215. } else {
  1216. this.$message({
  1217. type: "success",
  1218. message: "操作成功!"
  1219. });
  1220. this.bankOfDepositData.splice(index, 1);
  1221. }
  1222. })
  1223. },
  1224. uploadAfter(res, done) {
  1225. if (res.originalName) {
  1226. this.bankOfDepositForm.fileName = this.bankOfDepositForm.fileName
  1227. ? this.bankOfDepositForm.fileName
  1228. : res.originalName;
  1229. }
  1230. done();
  1231. },
  1232. // 去重
  1233. removeRepeat() {
  1234. let obj = []
  1235. this.configuration.dicData = this.configuration.dicData.reduce((current,next) => {
  1236. obj[next.id] ? '': obj[next.id] = true && current.push(next)
  1237. return current
  1238. }, [])
  1239. },
  1240. receiveList(data){
  1241. this.configuration.dicData = this.configuration.dicData.concat(data)
  1242. this.removeRepeat()
  1243. },
  1244. // 确认收货
  1245. sendInGoods() {
  1246. this.$refs["form"].validate((valid) => {
  1247. if (valid) {
  1248. if (this.contactsData.length == 0) {
  1249. return this.$message.error('商品信息为空')
  1250. }
  1251. if (contrastObj(this.form, this.oldForm) ||
  1252. contrastList(this.contactsData, this.oldGoodsList) ||
  1253. contrastList(this.advantageProjectData, this.oldFeesList) ||
  1254. contrastList(this.bankOfDepositData, this.oldUploadList)
  1255. ) {
  1256. this.$confirm("数据发生变化未有提交记录, 是否保存?", "提示", {
  1257. confirmButtonText: "确定",
  1258. cancelButtonText: "取消",
  1259. type: "warning"
  1260. }).then(async () => {
  1261. await this.editCustomer(false, '收货')
  1262. }).catch(() => {
  1263. this.$message.info('已取消')
  1264. })
  1265. } else {
  1266. //商品信息
  1267. this.form.deliveryItemsList = this.contactsData
  1268. this.form.deliveryFeesList = this.advantageProjectData
  1269. this.form.deliveryFilesList = this.bankOfDepositData
  1270. if (typeof this.form.corpsTypeId == 'object') {
  1271. this.form.corpsTypeId = this.form.corpsTypeId.join(",")
  1272. }
  1273. this.pageLoading = true
  1274. sendInGoods(this.form).then(res => {
  1275. this.$message.success('收货成功')
  1276. this.queryData(res.data.data.id)
  1277. }).finally(() => {
  1278. this.pageLoading = false
  1279. })
  1280. }
  1281. } else {
  1282. return false;
  1283. }
  1284. });
  1285. },
  1286. // 撤销收货
  1287. revokeInGoods() {
  1288. this.$refs["form"].validate((valid) => {
  1289. if (valid) {
  1290. //商品信息
  1291. this.form.deliveryItemsList = this.contactsData
  1292. this.form.deliveryFeesList = this.advantageProjectData
  1293. this.form.deliveryFilesList = this.bankOfDepositData
  1294. if (typeof this.form.corpsTypeId == 'object') {
  1295. this.form.corpsTypeId = this.form.corpsTypeId.join(",")
  1296. }
  1297. this.pageLoading = true
  1298. revokeInGoods(this.form).then(res => {
  1299. this.$message.success('撤销成功')
  1300. this.queryData(res.data.data.id)
  1301. }).finally(() => {
  1302. this.pageLoading = false
  1303. })
  1304. } else {
  1305. return false;
  1306. }
  1307. });
  1308. },
  1309. //修改提交触发
  1310. editCustomer(isBack = false, type) {
  1311. this.$refs["form"].validate((valid) => {
  1312. if (valid) {
  1313. this.form.deliveryAmount = 0
  1314. this.form.totalQuantity = 0
  1315. this.form.purchaseAmount = 0
  1316. this.contactsData.forEach(item => {
  1317. this.form.deliveryAmount = Number(this.form.deliveryAmount) + Number(item.deliveryAmount)
  1318. this.form.totalQuantity = Number(this.form.totalQuantity) + Number(item.actualQuantity)
  1319. this.form.purchaseAmount = Number(this.form.purchaseAmount) + Number(item.deliveryAmount)
  1320. this.form.deliveryAmount = (this.form.deliveryAmount).toFixed(2)
  1321. this.form.purchaseAmount = (this.form.purchaseAmount).toFixed(2)
  1322. })
  1323. //商品信息
  1324. this.form.deliveryItemsList = this.contactsData
  1325. // this.form.deliveryFeesList = this.advantageProjectData
  1326. this.form.deliveryFeesList = this.$refs.feeInfo.submitData()
  1327. this.form.deliveryFilesList = this.bankOfDepositData
  1328. if (typeof this.form.corpsTypeId == 'object') {
  1329. this.form.corpsTypeId = this.form.corpsTypeId.join(",")
  1330. }
  1331. this.saveLoading = true
  1332. typeSave(this.form).then(res => {
  1333. this.$message({type: "success", message: this.form.id ? "修改成功!" : "新增成功!"});
  1334. // this.saveLoading = false
  1335. if (isBack) {
  1336. //成功关闭此页面回到列表页
  1337. this.$emit("goBack");
  1338. } else {
  1339. this.queryData(res.data.data.id)
  1340. }
  1341. if (type == '收货') {
  1342. this.$nextTick(() => {
  1343. this.form.deliveryItemsList = this.contactsData
  1344. this.form.deliveryFeesList = this.advantageProjectData
  1345. this.form.deliveryFilesList = this.bankOfDepositData
  1346. if (typeof this.form.corpsTypeId == 'object') {
  1347. this.form.corpsTypeId = this.form.corpsTypeId.join(",")
  1348. }
  1349. this.pageLoading = true
  1350. sendInGoods(this.form).then(res => {
  1351. this.$message.success('收货成功')
  1352. this.queryData(res.data.data.id)
  1353. }).finally(() => {
  1354. this.pageLoading = false
  1355. })
  1356. })
  1357. }
  1358. })
  1359. }
  1360. });
  1361. },
  1362. //返回列表
  1363. backToList() {
  1364. if (contrastObj(this.form, this.oldForm) ||
  1365. contrastList(this.contactsData, this.oldGoodsList) ||
  1366. contrastList(this.advantageProjectData, this.oldFeesList) ||
  1367. contrastList(this.bankOfDepositData, this.oldUploadList)
  1368. ) {
  1369. this.$confirm("数据发生变化未有提交记录, 是否提交?", "提示", {
  1370. confirmButtonText: "确定",
  1371. cancelButtonText: "取消",
  1372. type: "warning"
  1373. }).then(() => {
  1374. this.editCustomer(true)
  1375. }).catch(() => {
  1376. this.$emit("goBack");
  1377. })
  1378. } else {
  1379. this.$emit("goBack");
  1380. }
  1381. },
  1382. // 保存列设置
  1383. async saveColumn(name) {
  1384. if (name == 'goods') {
  1385. const inSave = await this.saveColumnData(
  1386. this.getColumnName(24),
  1387. this.customerContact
  1388. );
  1389. if (inSave) {
  1390. this.$message.success("保存成功");
  1391. //关闭窗口
  1392. this.$refs.crudContact.$refs.dialogColumn.columnBox = false;
  1393. }
  1394. } else if (name === 'fees') {
  1395. const inSave = await this.saveColumnData(
  1396. this.getColumnName(25),
  1397. this.advantageProject
  1398. );
  1399. if (inSave) {
  1400. this.$message.success("保存成功");
  1401. //关闭窗口
  1402. this.$refs.crudProject.$refs.dialogColumn.columnBox = false;
  1403. }
  1404. }
  1405. },
  1406. async resetColumn() {
  1407. const inSave = await this.delColumnData(
  1408. this.getColumnName(24),
  1409. customerContact
  1410. );
  1411. if (inSave) {
  1412. this.$message.success("重置成功");
  1413. //关闭窗口
  1414. this.$refs.crud.$refs.dialogColumn.columnBox = false;
  1415. }
  1416. },
  1417. }
  1418. }
  1419. </script>
  1420. <style lang="scss" scoped>
  1421. //.customer-head {
  1422. // position: fixed;
  1423. // top: 105px;
  1424. // width: 100%;
  1425. // margin-left: -10px;
  1426. // height: 62px;
  1427. // background: #ffffff;
  1428. // box-shadow: 0 4px 12px 0px rgba(232, 232, 235, 1);
  1429. // z-index: 999;
  1430. // /* display: flex;
  1431. // justify-content: left; */
  1432. //}
  1433. //
  1434. //.customer-back {
  1435. // cursor: pointer;
  1436. // line-height: 62px;
  1437. // font-size: 16px;
  1438. // color: #323233;
  1439. // font-weight: 400;
  1440. //}
  1441. .back-icon {
  1442. line-height: 64px;
  1443. font-size: 20px;
  1444. margin-right: 8px;
  1445. }
  1446. //.add-customer-btn {
  1447. // position: fixed;
  1448. // right: 36px;
  1449. // top: 115px;
  1450. //}
  1451. ::v-deep .el-form-item {
  1452. margin-bottom: 0;
  1453. }
  1454. .el-dialogDeep {
  1455. ::v-deep .el-dialog {
  1456. margin: 1vh auto 0 !important;
  1457. padding-bottom: 10px !important;
  1458. .el-dialog__body, .el-dialog__footer {
  1459. padding-bottom: 0 !important;
  1460. padding-top: 0 !important;
  1461. }
  1462. }
  1463. }
  1464. .print-div {
  1465. color: #000;
  1466. }
  1467. .print_table {
  1468. table {
  1469. border-right: 1px solid #000;
  1470. border-bottom: 1px solid #000;
  1471. font-size: 12px;
  1472. margin-bottom: 5px;
  1473. }
  1474. table td {
  1475. border-left: 1px solid #000;
  1476. border-top: 1px solid #000;
  1477. vertical-align: middle;
  1478. padding: 2px;
  1479. text-align: center;
  1480. }
  1481. }
  1482. .table {
  1483. border-collapse: collapse;
  1484. border-spacing: 0;
  1485. background-color: transparent;
  1486. display: table;
  1487. width: 99%;
  1488. max-width: 100%;
  1489. margin: 0 auto;
  1490. }
  1491. .table td {
  1492. text-align: left;
  1493. vertical-align: middle;
  1494. font-size: 14px;
  1495. color: #000000;
  1496. padding: 10.5px 0 10.5px 30px;
  1497. //border: 1px solid #000;
  1498. }
  1499. ::v-deep .el-form-item {
  1500. margin-bottom: 0;
  1501. }
  1502. ::v-deep .el-form-item__content{
  1503. line-height: 32px;
  1504. }
  1505. </style>