detailsPageEdit.vue 51 KB

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