detailsPageEdit.vue 70 KB

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