detailsPageEdit.vue 70 KB

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