detailsPageEdit.vue 70 KB

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