detailsPageEdit.vue 61 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884
  1. <template>
  2. <div class="borderless" v-loading="pageLoading">
  3. <div class="customer-head">
  4. <div class="customer-back">
  5. <!-- <i class="back-icon el-icon-arrow-left"></i><i style="font-style:normal">返回管理列表</i>-->
  6. <el-button type="danger" style="border: none;background: none;color: red" icon="el-icon-arrow-left"
  7. @click="backToList">返回列表
  8. </el-button>
  9. </div>
  10. <div class="add-customer-btn">
  11. <el-button
  12. v-if="detailData.seeDisabled"
  13. size="small"
  14. @click="editHandle"
  15. type="primary"
  16. style="margin-right: 8px"
  17. :loading="saveLoading"
  18. >编 辑</el-button>
  19. <el-dropdown style="margin-right: 8px;">
  20. <el-button
  21. type="warning"
  22. size="small"
  23. >
  24. 账单处理<i class="el-icon-arrow-down el-icon--right"></i>
  25. </el-button>
  26. <el-dropdown-menu slot="dropdown">
  27. <el-dropdown-item
  28. :disabled="detailData.seeDisabled || !form.id"
  29. @click.native="applyPayment('申请')"
  30. >
  31. 申请货款
  32. </el-dropdown-item>
  33. <!-- <el-dropdown-item-->
  34. <!-- @click.stop.native="applyPayment('收费')"-->
  35. <!-- :disabled="!this.form.id"-->
  36. <!-- >申请退款-->
  37. <!-- </el-dropdown-item>-->
  38. <el-dropdown-item
  39. @click.native="openApplicationDialog"
  40. :disabled="!form.id"
  41. >查看账单
  42. </el-dropdown-item>
  43. </el-dropdown-menu>
  44. </el-dropdown>
  45. <el-button type="primary"
  46. size="small"
  47. :disabled="detailData.seeDisabled || !form.id"
  48. @click="postMessage"
  49. >发送消息</el-button>
  50. <el-button
  51. size="small"
  52. class="el-button--small-yh"
  53. type="success"
  54. @click="copyOrder"
  55. :disabled="detailData.seeDisabled || !this.form.id"
  56. >
  57. 复制单据
  58. </el-button>
  59. <el-button
  60. size="small"
  61. class="el-button--small-yh"
  62. type="primary"
  63. :disabled="disabled || detailData.seeDisabled"
  64. @click="editCustomer(false)"
  65. :loading="saveLoading"
  66. >保 存
  67. </el-button>
  68. <div v-if="checkDisabled" style="float: right;margin-left: 8px">
  69. <el-button type="primary"
  70. size="small"
  71. class="el-button--small-yh"
  72. @click.stop="openCheckDialog">
  73. 审批
  74. </el-button>
  75. </div>
  76. </div>
  77. </div>
  78. <div class="customer-main">
  79. <el-form :model="form" ref="form" label-width="130px" class="demo-ruleForm">
  80. <containerTitle title="基础资料"></containerTitle>
  81. <basic-container :showBtn="true">
  82. <el-row>
  83. <el-col v-for="(item,index) in basicData.column" :key="index" :span="item.span?item.span:8">
  84. <el-form-item :label="item.label" :prop="item.prop" :rules="item.rules">
  85. <!-- <avue-input-tree v-if="item.prop === 'corpsTypeId'" leaf-only multiple :props="{label:'title'}" v-model="form[item.prop]" placeholder="请选择内容" type="tree" :dic="dic"-->
  86. <!-- ></avue-input-tree>-->
  87. <el-date-picker v-if="item.type === 'datetime'" style="width: 100%;" v-model="form[item.prop]"
  88. size="small" type="datetime" placeholder="选择日期" value-format="yyyy-MM-dd HH:mm:ss" :disabled="detailData.seeDisabled"/>
  89. <el-date-picker v-else-if="item.type === 'date'" style="width: 100%;" v-model="form[item.prop]"
  90. size="small" type="date" placeholder="选择日期"
  91. :disabled="detailData.seeDisabled"/>
  92. <el-select v-else-if="item.prop === 'paymentType'" v-model="form[item.prop]" placeholder="请选择" clearable filterable style="width: 100%" size="small" :disabled="detailData.seeDisabled">
  93. <el-option v-for="(item,index) in paymentOption" :key="index" :label="item.dictValue" :value="item.dictValue"></el-option>
  94. </el-select>
  95. <crop-select
  96. v-else-if="item.prop === 'corpId'"
  97. v-model="form[item.prop]"
  98. corpType="GYS"
  99. @getCorpData="returnBack"
  100. :disabled="detailData.seeDisabled"
  101. ></crop-select>
  102. <crop-select
  103. v-else-if="item.prop === 'belongToCorpId'"
  104. v-model="form[item.prop]"
  105. corpType="GS"
  106. :disabled="detailData.seeDisabled"
  107. @getCorpData="getGSName"
  108. ></crop-select>
  109. <el-select v-else-if="item.prop === 'banks'"
  110. v-model="form[item.prop]" placeholder="请选择"
  111. clearable
  112. filterable
  113. allow-create
  114. default-first-option
  115. size="small"
  116. style="width: 100%;"
  117. @change="banksChange"
  118. :disabled="detailData.seeDisabled">
  119. <el-option v-for="(item,index) in bankList" :key="index" :label="item.accountNo" :value="item.accountNo"></el-option>
  120. </el-select>
  121. <el-input
  122. v-else-if="item.type == 'number'"
  123. placeholder="请输入"
  124. v-input-limit="2"
  125. size="small"
  126. :disabled="item.disabled || detailData.seeDisabled"
  127. v-model.trim="form[item.prop]"
  128. />
  129. <el-select v-else-if="item.prop === 'packageRemarks'" v-model="form[item.prop]" placeholder="请选择" clearable filterable style="width: 100%" size="small" :disabled="detailData.seeDisabled">
  130. <el-option v-for="(item,index) in packageOptions" :key="index" :label="item.dictValue" :value="item.dictValue"></el-option>
  131. </el-select>
  132. <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>
  133. <el-input type="age" v-else v-model.trim="form[item.prop]" size="small" autocomplete="off" :disabled="item.disabled || detailData.seeDisabled" placeholder="请输入"></el-input>
  134. </el-form-item>
  135. </el-col>
  136. </el-row>
  137. </basic-container>
  138. <containerTitle title="商品信息"></containerTitle>
  139. <basic-container>
  140. <avue-crud
  141. :option="customerContact"
  142. v-model="contactsForm"
  143. :data="contactsData"
  144. ref="crudContact"
  145. @row-save="rowSave"
  146. @row-click="handleRowClick"
  147. @row-update="rowUpdate"
  148. @row-del="rowDel"
  149. @selection-change="productSelection"
  150. @saveColumn="saveColumn('goods')"
  151. @resetColumn="resetColumn"
  152. >
  153. <template slot="headerSerial" slot-scope="{column}">
  154. <el-button type="primary" icon="el-icon-circle-plus-outline" circle size="mini" @click="$refs.crudContact.rowCellAdd()"></el-button>
  155. </template>
  156. <template slot="cname" slot-scope="{ row }">
  157. <goods-select v-if="row.$cellEdit" v-model="row.cname" @getRow="getGoodsRow($event, row)"
  158. :configuration="goodsConfiguration" @receiveList="receiveGoodList" @returnRow="getRow($event, row)"/>
  159. <span v-else>
  160. {{ row.cname }}
  161. <!-- <span v-for="item in goodsConfiguration.dicData" v-if="item.cname == row.cname">{{ item.cname }}</span>-->
  162. </span>
  163. </template>
  164. <template slot="orderQuantity" slot-scope="{ row }">
  165. <el-input
  166. v-if="row.$cellEdit"
  167. v-model.trim="row.orderQuantity"
  168. oninput='this.value=this.value.replace(/[^(\d)]/g,"")' size="small"
  169. @input="changeContractAmt(row)"
  170. ></el-input>
  171. <span v-else>{{ row.orderQuantity | IntegerFormat }}</span>
  172. </template>
  173. <template slot="purchaseAmount" slot-scope="{ row }">
  174. <el-select
  175. v-if="row.$cellEdit"
  176. v-model="row.purchaseAmount"
  177. @focus="changeContractAmt(row)"
  178. allow-create
  179. filterable
  180. v-input-limit="2"
  181. default-first-option
  182. >
  183. <el-option
  184. v-for="(item, index) in purchasePriceOption"
  185. :key="index"
  186. :label="item.purchasePrice"
  187. :value="item.purchasePrice"></el-option>
  188. </el-select>
  189. <span v-else>{{ row.purchaseAmount | decimalFormat }}</span>
  190. </template>
  191. <template slot="amount" slot-scope="{ row }">
  192. <span>{{ row.amount | decimalFormat }}</span>
  193. </template>
  194. <template slot="actualQuantity" slot-scope="{ row }">
  195. <span>{{ row.actualQuantity | IntegerFormat }}</span>
  196. </template>
  197. <template slot="storageQuantity" slot-scope="{ row }">
  198. <span>{{ row.storageQuantity | IntegerFormat }}</span>
  199. </template>
  200. <template slot="code" slot-scope="{row,index}">
  201. <el-button type="text" size="mini" style="padding:4px 10px;float:left" @click="commodityChoice(row)" :disabled="detailData.seeDisabled || !row.$cellEdit">选择</el-button>
  202. <span>{{ row.code }}</span>
  203. </template>
  204. <template slot-scope="{row,index}" slot="menu">
  205. <el-button
  206. type="text"
  207. size="small"
  208. @click="rowCell(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="rowDel(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="commoditySelection"
  226. :disabled="detailData.seeDisabled"
  227. >录入明细
  228. </el-button>
  229. <el-button type="warning"
  230. icon="el-icon-plus"
  231. size="small"
  232. :disabled="selection.length < 1 || detailData.seeDisabled"
  233. @click="getShipmentC">生成工厂发货
  234. </el-button>
  235. <el-button type="info" :size="size" icon="el-icon-printer" @click.stop="openReport()">报 表</el-button>
  236. </template>
  237. </avue-crud>
  238. </basic-container>
  239. <fee-info
  240. ref="feeInfo"
  241. :orderFeesList="advantageProjectData"
  242. :disabled="detailData.seeDisabled"
  243. feeUrl="/trade-purchase/purchase-order/removeByFees"
  244. optionType="GN"
  245. itemType="采购"
  246. @beforeFinance="beforeFinance"
  247. :corpId="form.corpId"
  248. />
  249. <containerTitle title="附件上传"></containerTitle>
  250. <c-upload
  251. :data="bankOfDepositData"
  252. deleteUrl="/api/trade-purchase/purchase-order/removeByFiles"
  253. :enumerationValue="77"
  254. />
  255. </el-form>
  256. </div>
  257. <el-dialog
  258. title="导入商品"
  259. append-to-body
  260. class="el-dialogDeep"
  261. :visible.sync="dialogVisible"
  262. width="80%"
  263. :close-on-click-modal="false"
  264. :destroy-on-close="true"
  265. :close-on-press-escape="false"
  266. @close="closeGoods">
  267. <el-row :style="{height: rowHeight}">
  268. <el-col :span="5" style="height: 100%;overflow-y: auto">
  269. <div>
  270. <el-scrollbar>
  271. <basic-container>
  272. <avue-tree :option="treeOption" :data="treeDataGoods" @node-click="nodeClick"/>
  273. </basic-container>
  274. </el-scrollbar>
  275. </div>
  276. </el-col>
  277. <el-col :span="19">
  278. <basic-container>
  279. <avue-crud :option="optionTwo"
  280. :table-loading="loading"
  281. :data="goodsListShow"
  282. ref="crud"
  283. @refresh-change="refreshChange"
  284. @selection-change="selectionChange"
  285. :page.sync="page"
  286. @search-change="goodsSearch"
  287. @on-load="onLoad">
  288. <template slot="menuLeft" slot-scope="{size}">
  289. <el-tabs v-model="activeName" @tab-click="tabHandle">
  290. <el-tab-pane label="查询结果" name="searchList"></el-tab-pane>
  291. <el-tab-pane label="已选定数据" name="importStaging"></el-tab-pane>
  292. </el-tabs>
  293. </template>
  294. <template slot-scope="scope" slot="menu">
  295. <el-button
  296. type="text"
  297. icon="el-icon-edit"
  298. size="small"
  299. @click.stop="importStagList(scope.row,scope.index)"
  300. v-if="activeName=='searchList'"
  301. :disabled="goodsListSave.findIndex(item => item.id == scope.row.id) !== -1"
  302. >选择
  303. </el-button>
  304. <el-button
  305. type="text"
  306. icon="el-icon-delete"
  307. size="small"
  308. @click.stop="removeStagList(scope.row,scope.index)"
  309. v-else
  310. >移除
  311. </el-button>
  312. </template>
  313. </avue-crud>
  314. </basic-container>
  315. </el-col>
  316. </el-row>
  317. <span slot="footer" class="dialog-footer">
  318. <el-button @click="dialogVisible = false">取 消</el-button>
  319. <el-button type="primary" @click="importGoods" v-if="commodityData !== true">导入</el-button>
  320. <el-button type="primary" @click="importChoice" v-if="commodityData === true"
  321. :disabled="tableData.length !== 1">导入</el-button>
  322. </span>
  323. </el-dialog>
  324. <el-dialog
  325. title="导入费用"
  326. append-to-body
  327. class="el-dialogDeep"
  328. :visible.sync="dialogCost"
  329. width="80%"
  330. :close-on-click-modal="false"
  331. :destroy-on-close="true"
  332. :close-on-press-escape="false"
  333. @close="closeFees">
  334. <el-row :style="{height: rowHeight}">
  335. <el-col :span="5" style="height: 100%;overflow-y: auto">
  336. <div>
  337. <el-scrollbar>
  338. <basic-container>
  339. <avue-tree :option="treeOptionCost" :data="treeData" @node-click="nodeClickCost"/>
  340. </basic-container>
  341. </el-scrollbar>
  342. </div>
  343. </el-col>
  344. <el-col :span="19">
  345. <basic-container>
  346. <avue-crud :option="optionTwoCost"
  347. :table-loading="loadingCost"
  348. :data="dataCost"
  349. ref="crud"
  350. @refresh-change="refreshChangeCost"
  351. @selection-change="selectionChangeCost"
  352. :page.sync="pageCost"
  353. @searchChange="feesSearch"
  354. @on-load="onLoadCost">
  355. </avue-crud>
  356. </basic-container>
  357. </el-col>
  358. </el-row>
  359. <span slot="footer" class="dialog-footer">
  360. <el-button @click="dialogCost = false">取 消</el-button>
  361. <el-button type="primary" @click="importCost" v-if="choiceData !== true">导入</el-button>
  362. <el-button type="primary" @click="choiceCost" v-if="choiceData === true"
  363. :disabled="tableDataCost.length !== 1">导入</el-button>
  364. </span>
  365. </el-dialog>
  366. <el-dialog
  367. title="账单"
  368. append-to-body
  369. class="el-dialogDeep"
  370. :visible.sync="applyPaymentDialog"
  371. width="60%"
  372. :close-on-click-modal="false"
  373. :destroy-on-close="true"
  374. :close-on-press-escape="false"
  375. v-dialog-drag
  376. >
  377. <apply-payment
  378. :billType="billType"
  379. :billData="billData"
  380. itemType="采购"
  381. @choceFun="choceFun"
  382. >
  383. </apply-payment>
  384. </el-dialog>
  385. <el-dialog
  386. append-to-body
  387. title="账单"
  388. class="el-dialogDeep"
  389. :visible.sync="financialAccountDialog"
  390. width="70%"
  391. :close-on-click-modal="false"
  392. :destroy-on-close="true"
  393. :close-on-press-escape="false"
  394. v-dialog-drag
  395. >
  396. <financial-account
  397. :billType="billType"
  398. :billData="{}"
  399. :arrList="applyPaymentList"
  400. :checkData="financeData"
  401. @choceFun="choceFun"
  402. >
  403. </financial-account>
  404. </el-dialog>
  405. <el-dialog
  406. title="申请记录"
  407. append-to-body
  408. class="el-dialogDeep"
  409. :visible.sync="applicationDialog"
  410. width="60%"
  411. :close-on-click-modal="false"
  412. :destroy-on-close="true"
  413. :close-on-press-escape="false"
  414. v-dialog-drag
  415. >
  416. <bill-application
  417. :billId="form.id"
  418. @choceApplication="choceApplication"
  419. >
  420. </bill-application>
  421. </el-dialog>
  422. <report-dialog
  423. :switchDialog="switchDialog"
  424. :reportId="form.id"
  425. reportName="发货通知单"
  426. @onClose="onClose()"
  427. ></report-dialog>
  428. <el-dialog
  429. append-to-body
  430. title="审批"
  431. class="el-dialogDeep"
  432. :visible.sync="checkDialog"
  433. width="50%"
  434. :close-on-click-modal="false"
  435. :destroy-on-close="true"
  436. :close-on-press-escape="false"
  437. v-dialog-drag
  438. >
  439. <check
  440. :checkData="checkData"
  441. :checkDetail="false"
  442. :idList="[]"
  443. @choceCheckFun="choceCheckFun"
  444. >
  445. </check>
  446. </el-dialog>
  447. <el-dialog
  448. append-to-body
  449. title="审批进度"
  450. class="el-dialogDeep"
  451. :visible.sync="checkScheduleDialog"
  452. width="40%"
  453. :close-on-click-modal="false"
  454. :destroy-on-close="true"
  455. :close-on-press-escape="false"
  456. v-dialog-drag
  457. >
  458. <check-schedule
  459. :checkId="checkId"
  460. :batchNo="batchNo"
  461. @choceScheduleFun="choceScheduleFun"
  462. >
  463. </check-schedule>
  464. </el-dialog>
  465. <messagePost
  466. v-if="messageVisble"
  467. ref="messagePost"
  468. @closeDialog="closeDialog"
  469. ></messagePost>
  470. </div>
  471. </template>
  472. <script>
  473. import {
  474. typeSave,
  475. detail,
  476. corpsattn,
  477. corpsbank,
  478. corpsitem,
  479. // getList,
  480. getDeptLazyTreeS,
  481. getSysNo,
  482. generateShipment
  483. } from "@/api/basicData/purchaseOrder"
  484. import {getList} from "@/api/basicData/commodityType";
  485. import customerContact from "./configuration/customerContact.json"
  486. import advantageProject from "./configuration/advantageProject.json"
  487. import bankOfDeposit from "./configuration/bankOfDeposit.json"
  488. import commodity from "./configuration/commodity.json"
  489. import optionTwoCost from "./configuration/mainListCost.json"
  490. import {getDeptLazyTree, customerList} from "@/api/basicData/basicFeesDesc";
  491. import {selectGoodsNum} from "@/api/basicData/inventoryAccount"
  492. import { contrastObj, contrastList } from "@/util/contrastData";
  493. //账单组件
  494. import ApplyPayment from "../../../components/finance/applyPayment";
  495. import billApplication from "@/components/bill/billApplication";
  496. import { getlistBankBy, pleaseCheck, } from "@/api/basicData/configuration"
  497. import feeInfo from "@/components/fee-info/main";
  498. import {
  499. isDiscount,
  500. isPercentage,
  501. micrometerFormat,
  502. IntegerFormat
  503. } from "@/util/validate";
  504. import financialAccount from "../../../components/finance/financialAccount";
  505. import reportDialog from "@/components/report-dialog/main";
  506. import check from "@/components/check/check";
  507. import checkSchedule from "@/components/check/checkSchedule";
  508. import { customerList as feeList } from "@/api/basicData/basicFeesDesc";
  509. import { getMarketPrice, getPurchasePrice } from "@/api/basicData/fees";
  510. export default {
  511. name: "detailsPage",
  512. props: {
  513. detailData: {
  514. type: Object,
  515. default: {
  516. seeDisabled: false
  517. }
  518. }
  519. },
  520. components:{
  521. ApplyPayment,
  522. billApplication,
  523. feeInfo,
  524. financialAccount,
  525. reportDialog,
  526. check,
  527. checkSchedule,
  528. },
  529. data() {
  530. return {
  531. configuration: {
  532. multipleChoices: false,
  533. multiple: false,
  534. collapseTags: false,
  535. placeholder: '请点击右边按钮选择',
  536. dicData: []
  537. },
  538. goodsConfiguration: {
  539. multipleChoices: false,
  540. multiple: false,
  541. collapseTags: false,
  542. placeholder: '请点击右边按钮选择',
  543. dicData: []
  544. },
  545. form: {},
  546. data: [],
  547. loadingCost: false,
  548. choiceData: false,
  549. commodityData: false,
  550. financialAccountDialog:false,
  551. dataCost: [],
  552. choiceIndex: '',
  553. dialogCost: false,
  554. treeDeptId: '',
  555. treeDeptIdCost: '',
  556. pageCost: {
  557. pageSize: 10,
  558. currentPage: 1,
  559. total: 0
  560. },
  561. page: {
  562. pageSize: 10,
  563. currentPage: 1,
  564. total: 0
  565. },
  566. loading: false,
  567. contactsForm: {},
  568. optionTwo: commodity,
  569. optionTwoCost: optionTwoCost,
  570. treeDataGoods: [],
  571. treeData: [],
  572. treeOptionCost: {
  573. nodeKey: 'id',
  574. lazy: true,
  575. treeLoad: function (node, resolve) {
  576. const parentId = (node.level === 0) ? 0 : node.data.id;
  577. getDeptLazyTree(parentId).then(res => {
  578. resolve(res.data.data.map(item => {
  579. return {
  580. ...item,
  581. leaf: !item.hasChildren
  582. }
  583. }))
  584. });
  585. },
  586. addBtn: false,
  587. menu: false,
  588. size: 'small',
  589. props: {
  590. labelText: '标题',
  591. label: 'title',
  592. value: 'value',
  593. children: 'children'
  594. }
  595. },
  596. treeOption: {
  597. nodeKey: 'id',
  598. lazy: true,
  599. treeLoad: function (node, resolve) {
  600. const parentId = (node.level === 0) ? 0 : node.data.id;
  601. getDeptLazyTreeS(parentId).then(res => {
  602. resolve(res.data.data.map(item => {
  603. return {
  604. ...item,
  605. leaf: !item.hasChildren
  606. }
  607. }))
  608. });
  609. },
  610. addBtn: false,
  611. menu: false,
  612. size: 'small',
  613. props: {
  614. labelText: '标题',
  615. label: 'title',
  616. value: 'value',
  617. children: 'children'
  618. }
  619. },
  620. billType:"申请", //账单类型
  621. billData:{}, //账单需要数据
  622. financeData: {}, // 账单请核需要的路由
  623. applyPaymentDialog:false,//生成账单组件
  624. applicationDialog: false,// 申请记录
  625. dialogVisible: false,
  626. advantageProjectForm: {},
  627. bankOfDepositForm: {},
  628. contactsData: [],
  629. advantageProjectData: [],
  630. saveLoading: false,
  631. disabled: false,
  632. bankOfDepositData: [],
  633. tableDataCost: [],
  634. dic: [],
  635. tableData: [],
  636. customerContact: {},
  637. advantageProject: {},
  638. bankOfDeposit: bankOfDeposit,
  639. basicData: {
  640. column: [
  641. {
  642. label: '供应商',
  643. prop: 'corpId',
  644. span: 16,
  645. rules: [
  646. {
  647. required: true,
  648. message: ' ',
  649. trigger: 'blur'
  650. }
  651. ]
  652. },{
  653. label: '付款方式',
  654. prop: 'paymentType',
  655. rules: [
  656. {
  657. required: true,
  658. message: ' ',
  659. trigger: 'blur'
  660. }
  661. ]
  662. },{
  663. label: '所属公司',
  664. prop: 'belongToCorpId',
  665. span: 16,
  666. rules: [
  667. {
  668. required: true,
  669. message: ' ',
  670. trigger: 'blur'
  671. }
  672. ]
  673. },{
  674. label: '要求到货日期',
  675. prop: 'requiredArrivalDate',
  676. type: 'datetime',
  677. rules: [
  678. {
  679. required: true,
  680. message: ' ',
  681. trigger: 'blur'
  682. }
  683. ]
  684. },{
  685. label: '银行账号',
  686. prop: 'banks',
  687. rules: [
  688. {
  689. required: true,
  690. message: ' ',
  691. trigger: 'blur'
  692. }
  693. ]
  694. }, {
  695. label: '公司户头',
  696. prop: 'banksAccountName',
  697. rules: [
  698. {
  699. required: false,
  700. message: ' ',
  701. trigger: 'blur'
  702. }
  703. ]
  704. }, {
  705. label: '包装要求',
  706. prop: 'packageRemarks',
  707. rules: [
  708. {
  709. required: false,
  710. message: ' ',
  711. trigger: 'blur'
  712. }
  713. ]
  714. },
  715. {
  716. label: '系统编号',
  717. prop: 'sysNo',
  718. disabled: true,
  719. rules: [
  720. {
  721. required: false,
  722. message: ' ',
  723. trigger: 'blur'
  724. }
  725. ]
  726. }, {
  727. label: '来源单号',
  728. prop: 'orgOrderNo',
  729. disabled: true,
  730. rules: [
  731. {
  732. required: false,
  733. message: ' ',
  734. trigger: 'blur'
  735. }
  736. ]
  737. },
  738. // {
  739. // label: '预估运费',
  740. // prop: 'predictOceanFreight',
  741. // type: 'number',
  742. // rules: [
  743. // {
  744. // required: false,
  745. // message: ' ',
  746. // trigger: 'blur'
  747. // }
  748. // ]
  749. // },
  750. {
  751. label: '应付金额',
  752. prop: 'debitAmount',
  753. type: 'number',
  754. disabled: true,
  755. rules: [
  756. {
  757. required: false,
  758. message: ' ',
  759. trigger: 'blur'
  760. }
  761. ]
  762. },
  763. {
  764. label: '已付金额',
  765. prop: 'settlmentAmount',
  766. type: 'number',
  767. disabled: true,
  768. rules: [
  769. {
  770. required: false,
  771. message: ' ',
  772. trigger: 'blur'
  773. }
  774. ]
  775. },{
  776. label: "备注",
  777. span: 24,
  778. prop: "orderRemark",
  779. type: 'textarea',
  780. mock: {
  781. type: 'county'
  782. }
  783. }
  784. ]
  785. },
  786. paymentOption: [],
  787. maxFeeNum: 0,
  788. maxGoodsNum: 0,
  789. selection: [],
  790. oldForm: {
  791. orderStatus: "录入"
  792. },
  793. oldGoodsList: [],
  794. oldFeesList: [],
  795. oldUploadList: [],
  796. // 弹窗高度
  797. rowHeight: '',
  798. // 查询时loading页面
  799. pageLoading: false,
  800. // 银行账号下拉
  801. bankList: [],
  802. activeName: 'searchList',
  803. // 商品列表数据合计
  804. goodsListShow: [],
  805. // 商品列表暂存
  806. goodsListSave: [],
  807. goodsListTotal: 0,
  808. goodsListSaveTotal: 0,
  809. pageList: {
  810. pageSize: 10,
  811. currentPage: 1,
  812. total: 0
  813. },
  814. itemType: '采购',
  815. packageOptions: [],
  816. switchDialog: false,
  817. // 请核状态禁用
  818. browse: false,
  819. checkDisabled: false,
  820. checkData: {},
  821. checkDialog: false,
  822. checkScheduleDialog: false,
  823. checkId: '',
  824. batchNo:'',
  825. feesOption: [],
  826. applyPaymentList: [],
  827. messageVisble: false,
  828. purchasePriceOption: [],
  829. }
  830. },
  831. mounted() {
  832. this.$nextTick(() => {
  833. // 监听浏览器高度变化,改变表格高度
  834. window.onresize = () => {
  835. this.rowHeight = (window.innerHeight - 130) + 'px'
  836. }
  837. })
  838. },
  839. filters: {
  840. IntegerFormat(num) {
  841. return IntegerFormat(num);
  842. },
  843. decimalFormat(num) {
  844. return num ? Number(num).toFixed(2) : "0.00";
  845. },
  846. },
  847. //初始化查询
  848. async created() {
  849. this.rowHeight = (window.innerHeight - 130) + 'px'
  850. this.customerContact = customerContact
  851. // this.customerContact = await this.getColumnData(this.getColumnName(18), customerContact);
  852. this.advantageProject = await this.getColumnData(this.getColumnName(19), advantageProject);
  853. this.getWorkDicts("payment_term").then(res => {
  854. this.paymentOption = res.data.data
  855. })
  856. this.getWorkDicts("packageRemarks").then(res => {
  857. this.packageOptions = res.data.data;
  858. });
  859. feeList().then(res => {
  860. this.feesOption = res.data.data.records
  861. })
  862. if (this.detailData.check) {
  863. this.checkDisabled = true
  864. this.batchNo = this.detailData.check.batchNo
  865. }
  866. if (this.detailData.id) {
  867. this.queryData(this.detailData.id)
  868. } else if(this.detailData.copyId) {
  869. this.queryData(this.detailData.copyId, true)
  870. } else {
  871. }
  872. },
  873. watch: {
  874. },
  875. methods: {
  876. // 明细查询
  877. queryData(id, isCopy = false) {
  878. this.pageLoading = true
  879. detail(id).then(res => {
  880. this.form = res.data.data;
  881. this.browse = this.form.status > 0? true: false
  882. this.contactsData = this.form.itemsVOList? this.form.itemsVOList: []
  883. this.advantageProjectData = this.form.orderFeesList? this.form.orderFeesList: []
  884. this.bankOfDepositData = this.form.orderFilesList? this.form.orderFilesList: []
  885. if (!this.form.itemsVOList) {
  886. this.contactsData = []
  887. } else {
  888. this.contactsData = this.form.itemsVOList
  889. }
  890. // if (!this.form.orderFeesList) {
  891. // this.advantageProjectData = []
  892. // } else {
  893. // this.advantageProjectData = this.form.orderFeesList
  894. // }
  895. // if (!this.form.orderFilesList) {
  896. // this.bankOfDepositData = []
  897. // } else {
  898. // this.bankOfDepositData = this.form.orderFilesList
  899. // }
  900. if (this.form.corpsName) {
  901. this.configuration.dicData = this.form.corpsName
  902. }
  903. let feesData = []
  904. this.advantageProjectData.forEach(item => {
  905. let a = {
  906. cname: item.corpName,
  907. id: item.corpId
  908. }
  909. feesData.push(a)
  910. })
  911. this.configuration.dicData = this.configuration.dicData.concat(feesData)
  912. // 去重
  913. this.removeRepeat()
  914. let goodsData = []
  915. this.form.orderItemsList = this.form.orderItemsList? this.form.orderItemsList: []
  916. this.form.orderItemsList.forEach(item => {
  917. let a = {
  918. cname: item.cname,
  919. }
  920. goodsData.push(a)
  921. })
  922. this.goodsConfiguration.dicData = [].concat(goodsData)
  923. this.removeGoodsRepeat()
  924. delete this.form.itemsVOList
  925. delete this.form.orderFeesList
  926. delete this.form.orderFilesList
  927. // delete this.form.corpsName
  928. // 获取最大值
  929. let num = []
  930. this.advantageProjectData.forEach(item => {
  931. num.push(item.sort)
  932. })
  933. if (num.length == 0) {
  934. this.maxFeeNum = 0;
  935. } else {
  936. this.maxFeeNum = num.reduce((a, b) => {
  937. return b > a? b: a;
  938. })
  939. }
  940. let goodsNum = []
  941. this.contactsData.forEach(item => {
  942. goodsNum.push(item.sort)
  943. })
  944. if (goodsNum.length == 0) {
  945. this.maxGoodsNum = 0;
  946. } else {
  947. this.maxGoodsNum = goodsNum.reduce((a, b) => {
  948. return b > a? b: a;
  949. })
  950. }
  951. this.oldGoodsList = []
  952. this.oldFeesList = []
  953. this.oldUploadList = []
  954. this.oldForm = Object.assign({}, this.form)
  955. this.oldGoodsList = this.deepClone(this.contactsData)
  956. this.oldFeesList = this.deepClone(this.advantageProjectData)
  957. this.oldUploadList = this.deepClone(this.bankOfDepositData)
  958. if (isCopy) {
  959. delete this.form.sysNo;
  960. delete this.form.id
  961. this.form.status = 0
  962. this.browse = false
  963. this.contactsData.forEach(item => {
  964. delete item.id
  965. delete item.pid
  966. delete item.itemId
  967. })
  968. this.advantageProjectData.forEach(item => {
  969. delete item.id
  970. delete item.pid
  971. })
  972. this.bankOfDepositData.forEach(item => {
  973. delete item.id
  974. delete item.pid
  975. })
  976. }
  977. }).finally(() => {
  978. this.saveLoading = false
  979. this.pageLoading = false
  980. });
  981. },
  982. copyOrder() {
  983. this.queryData(this.form.id, true)
  984. },
  985. getGoodsRow(event,row) {
  986. row.priceCategory = event.goodsTypeName
  987. row.code = event.code
  988. row.typeno = event.typeno
  989. row.itemType = event.typeno
  990. row.itemId = event.id
  991. },
  992. receiveGoodList(data) {
  993. this.goodsConfiguration.dicData = this.goodsConfiguration.dicData.concat(data)
  994. this.removeGoodsRepeat()
  995. },
  996. getRow(event,row) {
  997. row.priceCategory = event[0].goodsTypeName
  998. row.code = event[0].code
  999. row.typeno = event[0].typeno
  1000. row.itemType = event[0].typeno
  1001. row.itemId = event[0].id
  1002. },
  1003. removeGoodsRepeat() {
  1004. let obj = []
  1005. this.goodsConfiguration.dicData = this.goodsConfiguration.dicData.reduce((current,next) => {
  1006. obj[next.cname] ? '': obj[next.cname] = true && current.push(next)
  1007. return current
  1008. }, [])
  1009. },
  1010. getShipmentC() {
  1011. for (let item in this.selection) {
  1012. if (!this.selection[item].id) {
  1013. return this.$message.error('选中数据有新数据,请先保存')
  1014. }
  1015. }
  1016. if (this.$store.getters.domTakeStatus) {
  1017. this.$alert("收货单存在,请保存发货单再进行操作", "温馨提示", {
  1018. confirmButtonText: "确定",
  1019. type: "warning",
  1020. callback: action => {
  1021. console.log(action);
  1022. }
  1023. });
  1024. } else {
  1025. this.generateShipmentC();
  1026. }
  1027. },
  1028. //生成收货单
  1029. generateShipmentC() {
  1030. let lsit = []
  1031. if (contrastObj(this.form, this.oldForm) ||
  1032. contrastList(this.contactsData, this.oldGoodsList) ||
  1033. contrastList(this.advantageProjectData, this.oldFeesList) ||
  1034. contrastList(this.bankOfDepositData, this.oldUploadList)
  1035. ) {
  1036. this.$confirm("数据发生变化未有提交记录, 是否保存?", "提示", {
  1037. confirmButtonText: "确定",
  1038. cancelButtonText: "取消",
  1039. type: "warning"
  1040. }).then(async () => {
  1041. await this.editCustomer(false, '收货')
  1042. }).catch(() => {
  1043. this.$message({
  1044. type: 'info',
  1045. message: '已取消'
  1046. });
  1047. })
  1048. } else {
  1049. this.selection.forEach(item => {
  1050. lsit.push(item.id)
  1051. })
  1052. let data = {
  1053. id: this.form.id,
  1054. orderItemIds: lsit
  1055. }
  1056. generateShipment(data).then(res => {
  1057. this.$router.$avueRouter.closeTag("/businessManagement/receipt/index");
  1058. this.$router.push({
  1059. path: "/businessManagement/receipt/index",
  1060. query: {form: JSON.stringify(res.data.data)},
  1061. });
  1062. })
  1063. }
  1064. },
  1065. //点击行可编辑
  1066. handleRowClick(row, event, column) {
  1067. },
  1068. //商品编辑
  1069. rowCell(row, index) {
  1070. if (row.$cellEdit) {
  1071. if (Number(row.orderQuantity) < Number(row.actualQuantity)) {
  1072. return this.$message.error('订货数量不能小于发货数量')
  1073. }
  1074. }
  1075. this.$refs.crudContact.rowCell(row, row.$index)
  1076. },
  1077. //费用编辑
  1078. rowCellTwo(row, index) {
  1079. this.$refs.crudProject.rowCell(row, row.$index)
  1080. },
  1081. //商品选中触发
  1082. productSelection(selection) {
  1083. this.selection = selection
  1084. },
  1085. //费用新增触发
  1086. costIncrease() {
  1087. this.dialogCost = !this.dialogCost
  1088. this.choiceData = false
  1089. },
  1090. //商品新增触发
  1091. commoditySelection() {
  1092. this.dialogVisible = !this.dialogVisible
  1093. this.tableData = []
  1094. this.commodityData = false
  1095. this.goodsListSave = [];
  1096. },
  1097. //点击费用明细选择触发
  1098. choice(row) {
  1099. this.dialogCost = !this.dialogCost
  1100. this.choiceData = true
  1101. this.choiceIndex = row.$index
  1102. },
  1103. //点击商品明细选择触发
  1104. commodityChoice(row) {
  1105. this.dialogVisible = !this.dialogVisible
  1106. this.commodityData = true
  1107. this.choiceIndexT = row.$index
  1108. },
  1109. //导入商品触发
  1110. importChoice() {
  1111. if (this.tableData.length === 1) {
  1112. this.contactsData[this.choiceIndexT].cname = this.tableData[0].cname
  1113. this.contactsData[this.choiceIndexT].code = this.tableData[0].code
  1114. this.contactsData[this.choiceIndexT].typeno = this.tableData[0].typeno
  1115. this.contactsData[this.choiceIndexT].itemType = this.tableData[0].typeno
  1116. this.contactsData[this.choiceIndexT].itemId = this.tableData[0].id
  1117. this.contactsData[this.choiceIndexT].priceCategory = this.tableData[0].goodsTypeName
  1118. this.contactsData[this.choiceIndexT].orderQuantity = 0
  1119. this.contactsData[this.choiceIndexT].price = 0
  1120. this.contactsData[this.choiceIndexT].amount = 0
  1121. getPurchasePrice({code: this.contactsData[this.choiceIndexT].code}).then(res => {
  1122. if (res.data.data.length > 0) {
  1123. this.$set(this.contactsData[this.choiceIndexT], 'purchaseAmount', res.data.data[0].purchasePrice)
  1124. } else {
  1125. this.$set(this.contactsData[this.choiceIndexT], 'purchaseAmount', '0')
  1126. }
  1127. })
  1128. selectGoodsNum({
  1129. goodsId: this.tableData[0].id,
  1130. itemType: this.tableData[0].typeno
  1131. }).then(res => {
  1132. this.contactsData[this.choiceIndexT].storageQuantity = res.data.data
  1133. })
  1134. }
  1135. this.dialogVisible = !this.dialogVisible
  1136. this.commodityData = false
  1137. },
  1138. //费用编辑导入触发
  1139. choiceCost() {
  1140. if (this.tableDataCost.length === 1) {
  1141. this.advantageProjectData[this.choiceIndex].feeName = this.tableDataCost[0].cname
  1142. this.advantageProjectData[this.choiceIndex].itemId = this.tableDataCost[0].id
  1143. this.advantageProjectData[this.choiceIndex].code = this.tableDataCost[0].code
  1144. }
  1145. this.dialogCost = !this.dialogCost
  1146. this.choiceData = false
  1147. },
  1148. //费用导入触发
  1149. importCost() {
  1150. // this.advantageProjectForm = this.advantageProjectForm.concat(this.tableDataCost)
  1151. if (this.tableDataCost.length > 0) {
  1152. for (let item in this.tableDataCost) {
  1153. this.tableDataCost[item].itemId = this.tableDataCost[item].id
  1154. this.tableDataCost[item].feeName = this.tableDataCost[item].cname
  1155. this.tableDataCost[item].sort = this.maxFeeNum + 1
  1156. this.maxFeeNum++
  1157. delete this.tableDataCost[item].id
  1158. this.$refs.crudProject.rowCellAdd(this.tableDataCost[item]);
  1159. this.$refs.crudProject.rowCell(this.tableDataCost[item], this.advantageProjectForm.length - 1)
  1160. }
  1161. }
  1162. this.tableDataCost = []
  1163. this.dialogCost = false
  1164. },
  1165. //确认导入触发
  1166. importGoods() {
  1167. if (this.goodsListSave.length > 0) {
  1168. for (let item in this.goodsListSave) {
  1169. getPurchasePrice({code: this.goodsListSave[item].code}).then(res => {
  1170. if (res.data.data.length > 0) {
  1171. this.$set(this.goodsListSave[item], 'purchaseAmount', res.data.data[0].purchasePrice)
  1172. } else {
  1173. this.$set(this.goodsListSave[item], 'purchaseAmount', '0')
  1174. }
  1175. })
  1176. selectGoodsNum({
  1177. goodsId: this.goodsListSave[item].id,
  1178. itemType: this.goodsListSave[item].typeno
  1179. }).then(res => {
  1180. this.$set(this.goodsListSave[item], 'storageQuantity', res.data.data)
  1181. this.goodsListSave[item].itemId = this.goodsListSave[item].id
  1182. this.goodsListSave[item].priceCategory = this.goodsListSave[item].goodsTypeName
  1183. delete this.goodsListSave[item].id
  1184. this.$set(this.goodsListSave[item], 'itemType', this.goodsListSave[item].typeno)
  1185. this.$set(this.goodsListSave[item], 'specificationAndModel', this.goodsListSave[item].typeno)
  1186. this.$set(this.goodsListSave[item], 'priceType', '一般')
  1187. this.$set(this.goodsListSave[item], 'orderQuantity', 0)
  1188. this.$set(this.goodsListSave[item], 'actualQuantity', 0)
  1189. this.goodsListSave[item].price = 0
  1190. this.goodsListSave[item].amount = 0
  1191. this.goodsListSave[item].sort = this.maxGoodsNum + 1
  1192. this.maxGoodsNum++
  1193. this.$refs.crudContact.rowCellAdd(this.goodsListSave[item]);
  1194. // this.$refs.crudContact.rowCell(this.goodsListSave[item], this.goodsListSave.length - 1)
  1195. })
  1196. }
  1197. } else {
  1198. for (let item in this.tableData) {
  1199. getPurchasePrice({code: this.tableData[item].code}).then(res => {
  1200. if (res.data.data.length > 0) {
  1201. this.$set(this.tableData[item], 'purchaseAmount', res.data.data[0].purchasePrice)
  1202. } else {
  1203. this.$set(this.tableData[item], 'purchaseAmount', '0')
  1204. }
  1205. })
  1206. selectGoodsNum({
  1207. goodsId: this.tableData[item].id,
  1208. itemType: this.tableData[item].typeno
  1209. }).then(res => {
  1210. this.$set(this.tableData[item], 'storageQuantity', res.data.data)
  1211. this.tableData[item].itemId = this.tableData[item].id
  1212. this.tableData[item].priceCategory = this.tableData[item].goodsTypeName
  1213. delete this.tableData[item].id
  1214. this.$set(this.tableData[item], 'itemType', this.tableData[item].typeno)
  1215. this.$set(this.tableData[item], 'specificationAndModel', this.tableData[item].typeno)
  1216. this.$set(this.tableData[item], 'priceType', '一般')
  1217. this.$set(this.tableData[item], 'orderQuantity', 0)
  1218. this.$set(this.tableData[item], 'actualQuantity', 0)
  1219. this.tableData[item].price = 0
  1220. this.tableData[item].amount = 0
  1221. this.tableData[item].sort = this.maxGoodsNum + 1
  1222. this.maxGoodsNum++
  1223. this.$refs.crudContact.rowCellAdd(this.tableData[item]);
  1224. // this.$refs.crudContact.rowCell(this.tableData[item], this.tableData.length - 1)
  1225. })
  1226. }
  1227. }
  1228. if (this.tableData.length > 0) {
  1229. }
  1230. this.dialogVisible = false
  1231. },
  1232. closeGoods() {
  1233. this.treeDataGoods = [];
  1234. this.treeDeptId = "";
  1235. this.activeName = "searchList";
  1236. },
  1237. closeFees() {
  1238. this.treeDeptIdCost = "";
  1239. this.treeData = [];
  1240. },
  1241. //选中触发
  1242. selectionChange(list) {
  1243. this.tableData = list
  1244. },
  1245. //费用选中触发
  1246. selectionChangeCost(list) {
  1247. this.tableDataCost = list
  1248. },
  1249. //导入页左商品类型查询
  1250. nodeClick(data) {
  1251. this.treeDeptId = data.id;
  1252. this.page.currentPage = 1;
  1253. this.onLoad(this.page);
  1254. },
  1255. //导入页左费用类型查询
  1256. nodeClickCost(data) {
  1257. this.treeDeptIdCost = data.id;
  1258. this.pageCost.currentPage = 1;
  1259. this.onLoadCost(this.pageCost);
  1260. },
  1261. //刷新触发
  1262. refreshChange() {
  1263. this.treeDeptId = '';
  1264. this.page.currentPage = 1;
  1265. this.onLoad(this.page);
  1266. },
  1267. //费用刷新触发
  1268. refreshChangeCost() {
  1269. this.treeDeptIdCost = '';
  1270. this.pageCost.currentPage = 1;
  1271. this.onLoadCost(this.pageCost);
  1272. },
  1273. //新增商品信息保存触发
  1274. rowSave(row, done, loading) {
  1275. // this.contactsData.push(row)
  1276. done()
  1277. },
  1278. //修改商品信息触发
  1279. rowUpdate(row, index, done, loading) {
  1280. done(row);
  1281. },
  1282. //删除商品信息触发
  1283. rowDel(row, index, donerowDel) {
  1284. this.$confirm("确定将选择数据删除?", {
  1285. confirmButtonText: "确定",
  1286. cancelButtonText: "取消",
  1287. type: "warning"
  1288. }).then(() => {
  1289. //商品判断是否需要调用删除接口
  1290. if (row.id) {
  1291. corpsattn(row.id).then(res => {
  1292. this.$message({
  1293. type: "success",
  1294. message: "操作成功!"
  1295. });
  1296. this.contactsData.splice(row.$index, 1);
  1297. })
  1298. } else {
  1299. this.$message({
  1300. type: "success",
  1301. message: "操作成功!"
  1302. });
  1303. this.contactsData.splice(row.$index, 1);
  1304. }
  1305. })
  1306. },
  1307. //新增费用明细保存触发
  1308. rowSaveProject(row, done, loading) {
  1309. // this.advantageProjectData.push(row)
  1310. done()
  1311. },
  1312. //修改费用明细触发
  1313. rowUpdateProject(row, index, done, loading) {
  1314. done(row);
  1315. },
  1316. goodsSearch(params, done) {
  1317. this.treeDeptId = '';
  1318. this.onLoad(this.page, params);
  1319. done()
  1320. },
  1321. //商品列表查询
  1322. onLoad(page, params = {}) {
  1323. this.loading = true;
  1324. getList(page.currentPage, page.pageSize, Object.assign(params, this.query), this.treeDeptId).then(res => {
  1325. const data = res.data.data;
  1326. this.page.total = data.total;
  1327. this.data = data.records;
  1328. this.goodsListShow = data.records;
  1329. this.loading = false;
  1330. });
  1331. },
  1332. // 费用查询按钮
  1333. feesSearch(params, done) {
  1334. this.treeDeptIdCost = '';
  1335. this.onLoadCost(this.pageCost, params)
  1336. done()
  1337. },
  1338. //费用查询
  1339. onLoadCost(page, params = {}) {
  1340. this.loadingCost = true;
  1341. let queryParams = Object.assign({}, params, {
  1342. pageSize: page.pageSize,
  1343. pageNum: page.currentPage,
  1344. parentId: 0,
  1345. feesTypeId: this.treeDeptIdCost
  1346. })
  1347. customerList(queryParams).then(res => {
  1348. const data = res.data.data;
  1349. this.pageCost.total = data.total;
  1350. this.dataCost = data.records;
  1351. this.loadingCost = false;
  1352. });
  1353. },
  1354. //删除费用明细触发
  1355. rowDelProject(row, index, donerowDel) {
  1356. this.$confirm("确定将选择数据删除?", {
  1357. confirmButtonText: "确定",
  1358. cancelButtonText: "取消",
  1359. type: "warning"
  1360. }).then(() => {
  1361. //费用判断是否需要调用删除接口
  1362. if (row.id) {
  1363. corpsitem(row.id).then(res => {
  1364. this.$message({
  1365. type: "success",
  1366. message: "操作成功!"
  1367. });
  1368. this.advantageProjectData.splice(row.$index, 1);
  1369. })
  1370. } else {
  1371. this.$message({
  1372. type: "success",
  1373. message: "操作成功!"
  1374. });
  1375. this.advantageProjectData.splice(row.$index, 1);
  1376. }
  1377. })
  1378. },
  1379. // 计算费用
  1380. changeContractAmt(row) {
  1381. getPurchasePrice({code: row.code}).then(res => {
  1382. this.purchasePriceOption = res.data.data
  1383. })
  1384. let orderQuantity = 0;
  1385. let purchaseAmount = 0;
  1386. if (row.purchaseAmount) {
  1387. purchaseAmount = row.purchaseAmount;
  1388. }
  1389. if (row.orderQuantity) {
  1390. orderQuantity = row.orderQuantity;
  1391. }
  1392. this.$set(row, "amount", Number(orderQuantity) * Number(purchaseAmount)).toFixed(2);
  1393. },
  1394. // 去重
  1395. removeRepeat() {
  1396. let obj = []
  1397. this.configuration.dicData = this.configuration.dicData.reduce((current,next) => {
  1398. obj[next.id] ? '': obj[next.id] = true && current.push(next)
  1399. return current
  1400. }, [])
  1401. },
  1402. receiveList(data){
  1403. this.configuration.dicData = this.configuration.dicData.concat(data)
  1404. this.removeRepeat()
  1405. },
  1406. //修改提交触发
  1407. editCustomer(isBack = false, type) {
  1408. this.$refs["form"].validate((valid) => {
  1409. if (valid) {
  1410. for (let item in this.contactsData) {
  1411. if (Number(this.contactsData[item].orderQuantity) < Number(this.contactsData[item].actualQuantity)) {
  1412. return this.$message.error('商品信息第'+ (parseInt(item) + 1) + '行订货数量不能小于发货数量')
  1413. }
  1414. }
  1415. this.form.orderAmount = 0;
  1416. this.$set(this.form, 'debitAmount', 0)
  1417. this.contactsData.forEach(item => {
  1418. this.form.orderAmount = Number(this.form.orderAmount) + Number(item.amount)
  1419. this.form.debitAmount = Number(this.form.debitAmount) + Number(item.amount)
  1420. })
  1421. //商品信息
  1422. this.form.itemsVOList = this.contactsData
  1423. // this.form.orderFeesList = this.advantageProjectData
  1424. this.form.orderFeesList = this.$refs.feeInfo.submitData()
  1425. this.form.orderFilesList = this.bankOfDepositData
  1426. if (typeof this.form.corpsTypeId == 'object') {
  1427. this.form.corpsTypeId = this.form.corpsTypeId.join(",")
  1428. }
  1429. this.saveLoading = true
  1430. this.form.billType = 'CG'
  1431. this.$set(this.form, 'tradeType', 'GN')
  1432. // 如果有id解锁,没有跳过
  1433. // this.form.id && this.unLock({moduleName: 'cg',tableName: 'business_order', billId: this.form.id})
  1434. typeSave(this.form).then(res => {
  1435. this.$message({type: "success", message: this.form.id ? "修改成功!" : "新增成功!"});
  1436. // this.$set(this.detailData, 'seeDisabled', true);
  1437. if (isBack) {
  1438. //成功关闭此页面回到列表页
  1439. this.$emit("goBack");
  1440. this.leaveDetailsKey(this.$route.name)
  1441. } else {
  1442. this.queryData(res.data.data)
  1443. }
  1444. if (type == '收货') {
  1445. let lsit = []
  1446. this.selection.forEach(item => {
  1447. lsit.push(item.id)
  1448. })
  1449. let data = {
  1450. id: this.form.id,
  1451. orderItemIds: lsit
  1452. }
  1453. generateShipment(data).then(res => {
  1454. this.$router.$avueRouter.closeTag("/businessManagement/receipt/index");
  1455. this.$router.push({
  1456. path: "/businessManagement/receipt/index",
  1457. query: {form: JSON.stringify(res.data.data)},
  1458. });
  1459. })
  1460. }
  1461. }).catch(() => {
  1462. this.pageLoading = false
  1463. this.saveLoading = false
  1464. })
  1465. } else {
  1466. return false;
  1467. }
  1468. });
  1469. },
  1470. beforeBillData(bool,type){
  1471. this.applyPaymentList = [];
  1472. let arr = [];
  1473. this.billType = type
  1474. this.financeData = {
  1475. url:"/financialManagement/paymentRequest/index",
  1476. pageStatus:"this.$store.getters.pqStatus",
  1477. pageLabel:"付费申请",
  1478. checkType: 'ffsq'
  1479. }
  1480. this.contactsData.map(e => {
  1481. const form = {
  1482. belongCompany: this.form.belongCompany,
  1483. srcOrderno:this.form.orderNo,
  1484. itemType:"采购",
  1485. corpsName:this.form.corpsName,
  1486. corpId:this.form.corpId,
  1487. srcParentId: this.form.id,
  1488. currency: 'CNY',
  1489. exchangeRate: '1',
  1490. taxRate: '0',
  1491. accDate: this.form.businesDate,
  1492. srcType: 1, // 1.采购or销售主表货款申请 2. 采购or销售-费用明细申请 3.收发货-费用明细
  1493. tradeType: 'GN',
  1494. optionType: 'GN',
  1495. amount: e.amount,
  1496. goodName: e.cname,
  1497. price: e.price,
  1498. unit: e.unit,
  1499. quantity: e.orderQuantity,
  1500. srcFeesId: e.id,
  1501. costType: this.feesOption.find(e => e.cname == '货款')? this.feesOption.find(e => e.cname == '货款').id: null,
  1502. }
  1503. arr.push(form)
  1504. })
  1505. let getFeeList = this.$refs.feeInfo.submitData().filter(item => item.feesType == 2)
  1506. getFeeList.forEach(item => {
  1507. let form = {
  1508. srcOrderno:this.form.orgOrderNo,
  1509. itemType:"采购",
  1510. corpsName:item.corpName,
  1511. corpId: item.corpId,
  1512. srcParentId: this.form.id,
  1513. currency: 'CNY',
  1514. exchangeRate: '1',
  1515. taxRate: '0',
  1516. accDate: this.form.businesDate,
  1517. srcType: 2,
  1518. tradeType: 'GN',
  1519. optionType: 'GN',
  1520. chargeMember: this.form.chargeMember,
  1521. parentId: this.form.id,
  1522. amount: item.amount,
  1523. costType: item.itemId,
  1524. srcFeesId: item.id,
  1525. quantity: item.quantity, // 数量
  1526. price: item.price,
  1527. }
  1528. arr.push(form)
  1529. })
  1530. this.applyPaymentList = [...arr]
  1531. if(bool){ //申请货款
  1532. // this.billData.srcId = -1
  1533. }
  1534. },
  1535. // 查看申请记录
  1536. openApplicationDialog(){
  1537. this.applicationDialog = true
  1538. },
  1539. //关闭申记录
  1540. choceApplication(){
  1541. this.applicationDialog = false
  1542. },
  1543. //申请货款
  1544. applyPayment(type){
  1545. // if (contrastObj(this.form, this.oldForm) ||
  1546. // contrastList(this.contactsData, this.oldGoodsList) ||
  1547. // contrastList(this.advantageProjectData, this.oldFeesList) ||
  1548. // contrastList(this.bankOfDepositData, this.oldUploadList)
  1549. // ) {
  1550. // this.$confirm("您已改动数据,是否先保存在进行操作!", {
  1551. // confirmButtonText: "保存",
  1552. // cancelButtonText: "取消",
  1553. // type: "warning"
  1554. // }).then(() => {
  1555. // this.editCustomer();
  1556. // })
  1557. // }else{
  1558. this.beforeBillData(true,type);
  1559. this.financialAccountDialog = true;
  1560. // }
  1561. },
  1562. //关闭账单
  1563. choceFun(){
  1564. this.financialAccountDialog = false
  1565. },
  1566. //返回列表
  1567. backToList() {
  1568. if (contrastObj(this.form, this.oldForm) ||
  1569. contrastList(this.contactsData, this.oldGoodsList) ||
  1570. contrastList(this.advantageProjectData, this.oldFeesList) ||
  1571. contrastList(this.bankOfDepositData, this.oldUploadList)
  1572. ) {
  1573. this.$confirm("数据发生变化未有提交记录, 是否提交?", "提示", {
  1574. confirmButtonText: "确定",
  1575. cancelButtonText: "取消",
  1576. type: "warning"
  1577. }).then(() => {
  1578. this.editCustomer(true)
  1579. }).catch(() => {
  1580. !this.detailData.seeDisabled && this.form.id && this.unLock({moduleName: 'cg',tableName: 'business_order', billId: this.form.id})
  1581. this.$emit("goBack");
  1582. this.leaveDetailsKey(this.$route.name)
  1583. })
  1584. } else {
  1585. !this.detailData.seeDisabled && this.form.id && this.unLock({moduleName: 'cg',tableName: 'business_order', billId: this.form.id})
  1586. this.$emit("goBack");
  1587. this.leaveDetailsKey(this.$route.name)
  1588. }
  1589. },
  1590. // 保存列设置
  1591. async saveColumn(name) {
  1592. if (name == 'goods') {
  1593. const inSave = await this.saveColumnData(
  1594. this.getColumnName(18),
  1595. this.customerContact
  1596. );
  1597. if (inSave) {
  1598. this.$message.success("保存成功");
  1599. //关闭窗口
  1600. this.$refs.crudContact.$refs.dialogColumn.columnBox = false;
  1601. this.$nextTick(() => {
  1602. this.$refs.crudContact.doLayout()
  1603. })
  1604. }
  1605. } else if (name === 'fees') {
  1606. const inSave = await this.saveColumnData(
  1607. this.getColumnName(19),
  1608. this.advantageProject
  1609. );
  1610. if (inSave) {
  1611. this.$message.success("保存成功");
  1612. //关闭窗口
  1613. this.$refs.crudProject.$refs.dialogColumn.columnBox = false;
  1614. }
  1615. }
  1616. },
  1617. async resetColumn() {
  1618. this.customerContact = customerContact
  1619. const inSave = await this.delColumnData(
  1620. this.getColumnName(18),
  1621. customerContact
  1622. );
  1623. if (inSave) {
  1624. this.$nextTick(() => {
  1625. this.$refs.crudContact.doLayout()
  1626. })
  1627. this.$message.success("重置成功");
  1628. //关闭窗口
  1629. this.$refs.crudContact.$refs.dialogColumn.columnBox = false;
  1630. }
  1631. },
  1632. returnBack(row) {
  1633. if (row.belongtocompany) {
  1634. // this.form.belongToCorpId = row.belongtocompany
  1635. }
  1636. this.$set(this.form, 'paymentType', row.paymentType)
  1637. this.$set(this.form, 'packageRemarks', row.packageRemarks)
  1638. getlistBankBy(row.id).then(res =>{
  1639. this.$set(this.form, 'banks', null)
  1640. this.$set(this.form, 'banksAccountName', null)
  1641. this.$set(this.form, 'accountBank', null)
  1642. this.bankList = res.data
  1643. if (this.bankList.length > 0) {
  1644. this.form.banks = this.bankList[0].accountNo
  1645. this.form.banksAccountName = this.bankList[0].accountName
  1646. this.form.accountBank = this.bankList[0].accountBank
  1647. }
  1648. })
  1649. },
  1650. // 银行账号变化
  1651. banksChange(val) {
  1652. let isTrue = false
  1653. this.bankList.forEach(item => {
  1654. if (val == item.accountNo) {
  1655. this.$set(this.form, 'banksAccountName', item.accountName)
  1656. this.$set(this.form, 'accountBank', item.accountBank)
  1657. isTrue = true
  1658. }
  1659. })
  1660. if (!isTrue) {
  1661. this.$set(this.form, 'banksAccountName', null)
  1662. this.$set(this.form, 'accountBank', null)
  1663. }
  1664. },
  1665. // 标签页切换
  1666. tabHandle(data) {
  1667. if (data.name == 'searchList') {
  1668. this.goodsListShow = this.data;
  1669. this.page.total = this.pageList.total
  1670. } else if (data.name == 'importStaging') {
  1671. this.goodsListShow = this.goodsListSave;
  1672. this.page.total = 0
  1673. }
  1674. },
  1675. removeStagList(row, index) {
  1676. this.goodsListSave.splice(row.$index, 1)
  1677. },
  1678. importStagList(row, index) {
  1679. this.goodsListSave.push(row);
  1680. },
  1681. beforeFinance(feesData,callback) {
  1682. this.advantageProjectData = feesData;
  1683. let params = {}
  1684. params.valid = true
  1685. params.parentId = this.form.id
  1686. params.srcOrderno = this.form.orderNo
  1687. callback(params)
  1688. },
  1689. // 报表
  1690. openReport() {
  1691. this.switchDialog =! this.switchDialog;
  1692. },
  1693. onClose(val) {
  1694. this.switchDialog = val;
  1695. },
  1696. //请核
  1697. pleaseCheck() {
  1698. // this.verification()
  1699. if (this.verification()) {
  1700. this.$confirm("您确定提交此次申请吗?", {
  1701. confirmButtonText: "确定",
  1702. cancelButtonText: "取消",
  1703. type: "warning"
  1704. }).then(() => {
  1705. const data = {
  1706. id : this.form.id,
  1707. checkType: 'cgqh',
  1708. url: '/businessManagement/purchaseOrder/index',
  1709. pageStatus:"this.$store.getters.domPurStatus",
  1710. pageLabel:"采购订单(N)",
  1711. checkFlag: 1,
  1712. }
  1713. this.pageLoading = true
  1714. pleaseCheck(data).then(res => {
  1715. this.$message.success('请核成功')
  1716. // this.pageLoading = false
  1717. this.saveActives = ''
  1718. this.queryData(this.form.id)
  1719. }).finally(() => {
  1720. this.pageLoading = false
  1721. })
  1722. })
  1723. } else {
  1724. }
  1725. },
  1726. verification() {
  1727. let getFeeList = this.$refs.feeInfo.submitData()
  1728. if (contrastObj(this.form, this.oldForm) ||
  1729. contrastList(this.contactsData, this.oldGoodsList) ||
  1730. // contrastList(getFeeList, this.oldFeesList) ||
  1731. contrastList(this.bankOfDepositData, this.oldUploadList)
  1732. ) {
  1733. this.$confirm("数据发生变化未有提交记录, 是否提交?", "提示", {
  1734. confirmButtonText: "确定",
  1735. cancelButtonText: "取消",
  1736. type: "warning"
  1737. }).then(() => {
  1738. this.editCustomer(false)
  1739. }).catch(() => {
  1740. return false; //取消改动数据
  1741. })
  1742. } else {
  1743. return true; //没有动过数据
  1744. }
  1745. },
  1746. //打开审核
  1747. openCheckDialog(){
  1748. this.checkData = this.detailData.check
  1749. this.checkDialog = true;
  1750. },
  1751. //关闭审核
  1752. choceCheckFun(){
  1753. this.checkDialog = false;
  1754. },
  1755. choceScheduleFun(){
  1756. this.checkScheduleDialog = false
  1757. },
  1758. editHandle() {
  1759. const data = {
  1760. moduleName: 'cg',
  1761. tableName: 'business_order',
  1762. billId: this.form.id,
  1763. no: localStorage.getItem('browserID'),
  1764. billNo: this.form.orderNo
  1765. }
  1766. this.saveLoading = true
  1767. this.checkLock(data).then(res => {
  1768. if (res.data.code == 200) {
  1769. this.onLock(data).then(response => {
  1770. this.queryData(this.form.id)
  1771. })
  1772. this.inDetailsKey(this.$route.name, {
  1773. moduleName: 'cg',
  1774. tableName: 'business_order',
  1775. billId: this.form.id,
  1776. })
  1777. this.detailData.seeDisabled = false;
  1778. }
  1779. }).catch(error => {
  1780. }).finally(() => {
  1781. this.saveLoading = false
  1782. })
  1783. },
  1784. getGSName(row) {
  1785. this.form.belongCompany = row.cname
  1786. },
  1787. // 发送消息
  1788. postMessage() {
  1789. this.messageVisble = true
  1790. this.$nextTick(() => {
  1791. this.$refs.messagePost.init()
  1792. })
  1793. },
  1794. closeDialog() {
  1795. this.messageVisble = false
  1796. },
  1797. }
  1798. }
  1799. </script>
  1800. <style lang="scss" scoped>
  1801. .back-icon {
  1802. line-height: 64px;
  1803. font-size: 20px;
  1804. margin-right: 8px;
  1805. }
  1806. //.add-customer-btn {
  1807. // position: fixed;
  1808. // right: 36px;
  1809. // top: 115px;
  1810. //}
  1811. ::v-deep .el-form-item {
  1812. margin-bottom: 0;
  1813. }
  1814. .el-dialogDeep {
  1815. ::v-deep .el-dialog {
  1816. margin: 1vh auto 0 !important;
  1817. padding-bottom: 10px !important;
  1818. .el-dialog__body, .el-dialog__footer {
  1819. padding-bottom: 0 !important;
  1820. padding-top: 0 !important;
  1821. }
  1822. }
  1823. }
  1824. .print-div {
  1825. color: #000;
  1826. }
  1827. .print_table {
  1828. table {
  1829. border-right: 1px solid #000;
  1830. border-bottom: 1px solid #000;
  1831. font-size: 12px;
  1832. margin-bottom: 5px;
  1833. }
  1834. table td {
  1835. border-left: 1px solid #000;
  1836. border-top: 1px solid #000;
  1837. vertical-align: middle;
  1838. padding: 2px;
  1839. text-align: center;
  1840. }
  1841. }
  1842. .table {
  1843. border-collapse: collapse;
  1844. border-spacing: 0;
  1845. background-color: transparent;
  1846. display: table;
  1847. width: 99%;
  1848. max-width: 100%;
  1849. margin: 0 auto;
  1850. }
  1851. .table td {
  1852. text-align: left;
  1853. vertical-align: middle;
  1854. font-size: 14px;
  1855. color: #000000;
  1856. padding: 10.5px 0 10.5px 30px;
  1857. //border: 1px solid #000;
  1858. }
  1859. ::v-deep .el-form-item {
  1860. margin-bottom: 0;
  1861. }
  1862. ::v-deep .el-form-item__content{
  1863. line-height: 32px;
  1864. }
  1865. </style>