detailsPageEdit.vue 73 KB

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