detailsPageEdit.vue 48 KB

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