detailsPageEdit.vue 73 KB

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