detailsPageEdit.vue 50 KB

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