detailsPageEdit.vue 55 KB

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