detailsPageEdit.vue 54 KB

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