detailsPageEdit.vue 52 KB

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