detailsPageEdit.vue 59 KB

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