detailsPageEdit.vue 51 KB

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