detailsPageEdit.vue 54 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741
  1. <template>
  2. <div class="borderless">
  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. <el-button
  11. class="el-button--small-yh add-customer-btn"
  12. type="success" style="right: 140px;" @click="copyOrder">
  13. 复制新单
  14. </el-button>
  15. <el-button
  16. class="el-button--small-yh add-customer-btn"
  17. type="primary"
  18. :disabled="disabled"
  19. @click="editCustomer(false)"
  20. >{{ form.id ? '确认修改' : '确认新增' }}
  21. </el-button>
  22. </div>
  23. <div style="margin-top: 60px">
  24. <el-form :model="form" ref="form" label-width="130px" class="demo-ruleForm">
  25. <containerTitle title="基础资料"></containerTitle>
  26. <basic-container style="margin-bottom: 10px">
  27. <el-row>
  28. <el-col v-for="(item,index) in basicData.column" :key="index" :span="item.span?item.span:8">
  29. <el-form-item :label="item.label" :prop="item.prop" :rules="item.rules">
  30. <el-date-picker v-if="item.type === 'datetime'" style="width: 100%;" v-model="form[item.prop]"
  31. size="small" type="datetime" placeholder="选择日期" value-format="yyyy-MM-dd HH:mm:ss"/>
  32. <selectComponent v-else-if="item.prop === 'corpId'" v-model="form[item.prop]"
  33. :configuration="configuration" style="width: 100%"/>
  34. <el-select v-else-if="item.prop === 'paymentType'" v-model="form[item.prop]" placeholder="请选择" clearable filterable style="width: 100%" size="small">
  35. <el-option v-for="(item,index) in paymentOption" :key="index" :label="item.dictValue" :value="item.dictValue"></el-option>
  36. </el-select>
  37. <el-input type="textarea" v-else-if="item.type === 'textarea'" v-model="form[item.prop]" size="small" autocomplete="off" :disabled="item.disabled"></el-input>
  38. <el-input type="age" v-else v-model="form[item.prop]" size="small" autocomplete="off" :disabled="item.disabled"></el-input>
  39. </el-form-item>
  40. </el-col>
  41. </el-row>
  42. </basic-container>
  43. <containerTitle title="发货信息"></containerTitle>
  44. <basic-container style="margin-bottom: 10px">
  45. <el-row>
  46. <el-col v-for="(item,index) in contactInformation.column" :key="index" :span="item.span?item.span:8">
  47. <el-form-item :label="item.label" :prop="item.prop" :rules="item.rules">
  48. <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"/>
  49. <selectComponent v-else-if="item.prop === 'belongToCorpId'" v-model="form[item.prop]" :configuration="configuration" style="width: 100%"/>
  50. <el-input v-else-if="(item.prop === 'advancePayment') || (item.prop === 'settlmentAmount')" v-model="form[item.prop]" size="small" autocomplete="off" @change="computedCost"></el-input>
  51. <el-select v-else-if="item.prop === 'orderStatus'" v-model="form[item.prop]" placeholder="请选择" clearable filterable style="width: 100%" size="small">
  52. <el-option v-for="(item,index) in statusOption" :key="index" :label="item.dictValue" :value="item.dictValue"></el-option>
  53. </el-select>
  54. <el-input type="textarea" v-else-if="item.type === 'textarea'" v-model="form[item.prop]" size="small" autocomplete="off" :disabled="item.disabled"></el-input>
  55. <el-input v-else type="age" v-model="form[item.prop]" size="small" autocomplete="off" :disabled="item.disabled"></el-input>
  56. </el-form-item>
  57. </el-col>
  58. </el-row>
  59. </basic-container>
  60. <containerTitle title="商品信息"></containerTitle>
  61. <basic-container style="margin-bottom: 10px">
  62. <avue-crud
  63. :option="customerContact"
  64. v-model="contactsForm"
  65. :data="contactsData"
  66. ref="crudContact"
  67. @row-save="rowSave"
  68. @row-click="handleRowClick"
  69. @row-update="rowUpdate"
  70. @selection-change="productSelection"
  71. @row-del="rowDel"
  72. >
  73. <template slot="code" slot-scope="{row,index}">
  74. <span style="float: left;padding-top: 2px">{{ row.code }}</span>
  75. <el-button type="text" size="mini" style="float: right" @click="commodityChoice(row)">选择</el-button>
  76. </template>
  77. <template slot="orderQuantity" slot-scope="{ row }">
  78. <el-input
  79. v-if="row.$cellEdit"
  80. v-model="row.orderQuantity"
  81. oninput='this.value=this.value.replace(/[^\-?\d.]/g,"").replace(/^(\-)*(\d+)\.(\d\d).*$/, "$1$2.$3")'
  82. size="small"
  83. @input="quantityChange(row)"
  84. ></el-input>
  85. <span v-else>{{ row.orderQuantity }}</span>
  86. </template>
  87. <template slot="price" slot-scope="{ row }">
  88. <el-input
  89. v-if="row.$cellEdit"
  90. v-model="row.price"
  91. size="small"
  92. oninput='this.value=this.value.replace(/[^\-?\d.]/g,"").replace(/^(\-)*(\d+)\.(\d\d).*$/, "$1$2.$3")'
  93. @input="priceChange(row)"
  94. ></el-input>
  95. <span v-else>{{ row.price }}</span>
  96. </template>
  97. <template slot="storageQuantity" slot-scope="{ row }">
  98. <el-input
  99. v-if="row.$cellEdit"
  100. v-model="row.storageQuantity"
  101. size="small"
  102. oninput='this.value=this.value.replace(/[^\-?\d.]/g,"").replace(/^(\-)*(\d+)\.(\d\d).*$/, "$1$2.$3")'
  103. ></el-input>
  104. <span v-else>{{ row.storageQuantity }}</span>
  105. </template>
  106. <template slot="actualQuantity" slot-scope="{ row }">
  107. <el-input
  108. v-if="row.$cellEdit"
  109. v-model="row.actualQuantity"
  110. size="small"
  111. oninput='this.value=this.value.replace(/[^\-?\d.]/g,"").replace(/^(\-)*(\d+)\.(\d\d).*$/, "$1$2.$3")'
  112. ></el-input>
  113. <span v-else>{{ row.actualQuantity }}</span>
  114. </template>
  115. <!-- <template slot="specificationAndModel" slot-scope="{ row }">-->
  116. <!-- <el-select-->
  117. <!-- v-if="row.$cellEdit && row.typeData.length > 0"-->
  118. <!-- v-model="row.specificationAndModel"-->
  119. <!-- size="small"-->
  120. <!-- ></el-select>-->
  121. <!-- <el-input-->
  122. <!-- v-else-if="row.$cellEdit && row.typeData.length == 0"-->
  123. <!-- v-model="row.specificationAndModel"-->
  124. <!-- size="small"-->
  125. <!-- ></el-input>-->
  126. <!-- <span v-else>{{ row.specificationAndModel }}</span>-->
  127. <!-- </template>-->
  128. <template slot-scope="{row,index}" slot="menu">
  129. <el-button
  130. type="text"
  131. size="small"
  132. @click="rowCell(row,index)"
  133. >{{ row.$cellEdit ? '保存' : '修改' }}
  134. </el-button>
  135. </template>
  136. <template slot="menuLeft" slot-scope="{size}">
  137. <el-button type="primary"
  138. icon="el-icon-plus"
  139. size="small"
  140. @click="commoditySelection">录入明细
  141. </el-button>
  142. <el-button type="primary"
  143. icon="el-icon-plus"
  144. size="small"
  145. @click="policy">政策
  146. </el-button>
  147. <el-button type="warning"
  148. icon="el-icon-plus"
  149. size="small"
  150. :disabled="selection.length < 1"
  151. @click="generateShipmentD">生成发货单
  152. </el-button>
  153. <el-button type="info" :size="size" icon="el-icon-printer">报 表</el-button>
  154. </template>
  155. </avue-crud>
  156. </basic-container>
  157. <containerTitle title="费用明细"></containerTitle>
  158. <basic-container style="margin-bottom: 10px">
  159. <avue-crud
  160. :option="advantageProject"
  161. v-model="advantageProjectForm"
  162. :data="advantageProjectData"
  163. ref="crudProject"
  164. @row-save="rowSaveProject"
  165. @row-update="rowUpdateProject"
  166. @row-del="rowDelProject"
  167. >
  168. <template slot="code" slot-scope="{row,index}">
  169. <span style="float: left;padding-top: 2px">{{ row.code }}</span>
  170. <el-button type="text" size="mini" style="float: right" @click="choice(row)">选择</el-button>
  171. </template>
  172. <template slot="corpId" slot-scope="{ row }">
  173. <selectComponent v-if="row.$cellEdit" v-model="row.corpId"
  174. :configuration="configuration" @receiveList="receiveList"/>
  175. <span v-else>
  176. <span v-for="item in configuration.dicData" v-if="item.id == row.corpId">{{ item.cname }}</span>
  177. </span>
  178. </template>
  179. <template slot-scope="{row,index}" slot="menu">
  180. <el-button
  181. type="text"
  182. size="small"
  183. @click="rowCellTwo(row,index)"
  184. >{{ row.$cellEdit ? '保存' : '修改' }}
  185. </el-button>
  186. </template>
  187. <template slot="menuLeft" slot-scope="{size}">
  188. <el-button type="primary"
  189. icon="el-icon-plus"
  190. size="small"
  191. @click="costIncrease"
  192. >录入明细
  193. </el-button>
  194. </template>
  195. </avue-crud>
  196. </basic-container>
  197. <containerTitle title="附件上传"></containerTitle>
  198. <basic-container style="margin-bottom: 40px">
  199. <avue-crud
  200. :option="bankOfDeposit"
  201. v-model="bankOfDepositForm"
  202. :data="bankOfDepositData"
  203. @row-save="rowSaveBankOfDeposit"
  204. @row-update="rowUpdateBankOfDeposit"
  205. @row-del="rowDelBankOfDeposit"
  206. :upload-after="uploadAfter"
  207. ></avue-crud>
  208. </basic-container>
  209. </el-form>
  210. </div>
  211. <el-dialog
  212. title="导入商品"
  213. append-to-body
  214. class="el-dialogDeep"
  215. :visible.sync="dialogVisible"
  216. width="80%"
  217. :close-on-click-modal="false"
  218. :destroy-on-close="true"
  219. :close-on-press-escape="false"
  220. @close="closeGoods">
  221. <el-row style="height: 0;">
  222. <el-col :span="5">
  223. <div>
  224. <el-scrollbar>
  225. <basic-container>
  226. <avue-tree :option="treeOption" :data="treeDataGoods" @node-click="nodeClick"/>
  227. </basic-container>
  228. </el-scrollbar>
  229. </div>
  230. </el-col>
  231. <el-col :span="19">
  232. <basic-container>
  233. <avue-crud :option="optionTwo"
  234. :table-loading="loading"
  235. :data="data"
  236. ref="crud"
  237. @refresh-change="refreshChange"
  238. @selection-change="selectionChange"
  239. :page.sync="page"
  240. @on-load="onLoad"></avue-crud>
  241. </basic-container>
  242. </el-col>
  243. </el-row>
  244. <span slot="footer" class="dialog-footer">
  245. <el-button @click="dialogVisible = false">取 消</el-button>
  246. <el-button type="primary" @click="importGoods" v-if="commodityData !== true">导入</el-button>
  247. <el-button type="primary" @click="importChoice" v-if="commodityData === true"
  248. :disabled="tableData.length !== 1">导入</el-button>
  249. </span>
  250. </el-dialog>
  251. <el-dialog
  252. title="导入"
  253. append-to-body
  254. class="el-dialogDeep"
  255. :visible.sync="policyDialog"
  256. width="80%"
  257. :close-on-click-modal="false"
  258. :destroy-on-close="true"
  259. :close-on-press-escape="false"
  260. @close="closePolicy">
  261. <el-row style="height: 0;">
  262. <el-col :span="5">
  263. <div>
  264. <el-scrollbar>
  265. <basic-container>
  266. <avue-tree :option="policyOption" :data="treeDataPolicy" @node-click="policyNodeClick"/>
  267. </basic-container>
  268. </el-scrollbar>
  269. </div>
  270. </el-col>
  271. <el-col :span="19">
  272. <containerTitle title="特价促销"></containerTitle>
  273. <basic-container style="margin-bottom: 10px">
  274. <avue-crud :option="optionPolicy"
  275. :table-loading="loadingPolicy"
  276. :data="dataPolicy"
  277. ref="crud"
  278. @selection-change="selectionChangePolicy"
  279. :page.sync="pagePolicy">
  280. </avue-crud>
  281. </basic-container>
  282. <containerTitle title="买赠促销"></containerTitle>
  283. <basic-container>
  284. <avue-crud
  285. :option="customerBuyFree"
  286. :data="contactsDataBuyFree"
  287. @selection-change="selectionChangePolicyTwo"
  288. ref="crudContactE">
  289. </avue-crud>
  290. </basic-container>
  291. </el-col>
  292. </el-row>
  293. <span slot="footer" class="dialog-footer">
  294. <el-button @click="policyDialog = false">取 消</el-button>
  295. <el-button type="primary" @click="importPolicy">导入</el-button>
  296. </span>
  297. </el-dialog>
  298. <el-dialog
  299. title="导入费用"
  300. append-to-body
  301. class="el-dialogDeep"
  302. :visible.sync="dialogCost"
  303. width="80%"
  304. top="8vh"
  305. :close-on-click-modal="false"
  306. :destroy-on-close="true"
  307. :close-on-press-escape="false"
  308. @close="closeFees">
  309. <el-row style="height: 0;">
  310. <el-col :span="5">
  311. <div>
  312. <el-scrollbar>
  313. <basic-container>
  314. <avue-tree :option="treeOptionCost" :data="treeData" @node-click="nodeClickCost"/>
  315. </basic-container>
  316. </el-scrollbar>
  317. </div>
  318. </el-col>
  319. <el-col :span="19">
  320. <basic-container>
  321. <avue-crud :option="optionTwoCost"
  322. :table-loading="loadingCost"
  323. :data="dataCost"
  324. ref="crud"
  325. @refresh-change="refreshChangeCost"
  326. @selection-change="selectionChangeCost"
  327. :page.sync="pageCost"
  328. @on-load="onLoadCost">
  329. </avue-crud>
  330. </basic-container>
  331. </el-col>
  332. </el-row>
  333. <span slot="footer" class="dialog-footer">
  334. <el-button @click="dialogCost = false">取 消</el-button>
  335. <el-button type="primary" @click="importCost" v-if="choiceData !== true">导入</el-button>
  336. <el-button type="primary" @click="choiceCost" v-if="choiceData === true"
  337. :disabled="tableDataCost.length !== 1">导入</el-button>
  338. </span>
  339. </el-dialog>
  340. <!-- 打印-->
  341. <el-dialog
  342. title="打印单"
  343. append-to-body
  344. class="el-dialogDeep"
  345. :visible.sync="printVisible"
  346. width="100%"
  347. fullscreen
  348. :close-on-click-modal="false"
  349. :close-on-press-escape="false">
  350. <div class="print-div">
  351. <div
  352. style="
  353. display: flex;
  354. flex-direction: column;
  355. justify-content: center;
  356. align-item: center;
  357. font-size: 24px;
  358. margin-bottom: 5px;
  359. width: 100%;
  360. text-align: center;
  361. "
  362. >
  363. <div><b>VITAL INDUSTRIAL GROUP LIMITED</b></div>
  364. <div>NO.37 DONGHAI ROAD, QINGDAO, CHINA</div>
  365. <div>TEL:0086-532-86019080 FAX:0086-532-86019080</div>
  366. <div>
  367. <b>COMMERCIAL INVOICE</b>
  368. <span style="float: right">ORIGINAL</span>
  369. </div>
  370. </div>
  371. <div class="print_table" style="display: flex">
  372. <table
  373. border="0"
  374. cellspacing="0"
  375. cellpadding="0"
  376. style="width: 100%; line-height: 30px"
  377. >
  378. <tr>
  379. <td colspan="5" rowspan="3">MESSERS:</td>
  380. <td colspan="2">INVOICE NO.</td>
  381. <td colspan="3"></td>
  382. </tr>
  383. <tr>
  384. <td colspan="2">DATE</td>
  385. <td colspan="3"></td>
  386. </tr>
  387. <tr>
  388. <td colspan="2">INCOTERM .</td>
  389. <td colspan="3"></td>
  390. </tr>
  391. <tr>
  392. <td colspan="5">PI NO.:</td>
  393. <td colspan="2">DELIVERY PORT</td>
  394. <td colspan="3"></td>
  395. </tr>
  396. <tr>
  397. <td rowspan="2">NO.</td>
  398. <td rowspan="2">DESCRIPTION</td>
  399. <td>THICK</td>
  400. <td>LENGTH</td>
  401. <td>WIDTH</td>
  402. <td rowspan="2">SHEETS</td>
  403. <td rowspan="2">CRATES</td>
  404. <td>UNIT PRICE</td>
  405. <td>TOTAL</td>
  406. <td>T. AMOUNT</td>
  407. </tr>
  408. <tr>
  409. <td>mm</td>
  410. <td>mm</td>
  411. <td>mm</td>
  412. <td>US$/M²</td>
  413. <td>M²</td>
  414. <td>US$</td>
  415. </tr>
  416. <tr>
  417. <td>1</td>
  418. <td></td>
  419. <td></td>
  420. <td></td>
  421. <td></td>
  422. <td></td>
  423. <td></td>
  424. <td></td>
  425. <td></td>
  426. <td></td>
  427. </tr>
  428. <tr>
  429. <td>2</td>
  430. <td></td>
  431. <td></td>
  432. <td></td>
  433. <td></td>
  434. <td></td>
  435. <td></td>
  436. <td></td>
  437. <td></td>
  438. <td></td>
  439. </tr>
  440. <tr>
  441. <td>3</td>
  442. <td></td>
  443. <td></td>
  444. <td></td>
  445. <td></td>
  446. <td></td>
  447. <td></td>
  448. <td></td>
  449. <td></td>
  450. <td></td>
  451. </tr>
  452. <tr>
  453. <td colspan="9" style="text-align: right">FUMIGATION COST:</td>
  454. <td></td>
  455. </tr>
  456. <tr>
  457. <td colspan="9" style="text-align: right">INSURANCE:</td>
  458. <td></td>
  459. </tr>
  460. <tr>
  461. <td colspan="9" style="text-align: right">TOTAL:</td>
  462. <td>0.00</td>
  463. </tr>
  464. </table>
  465. </div>
  466. <div class="print-footer" style="margin-top: 8px">
  467. <div style="font-weight: bold">TOTAL AMOUNT: U.S. DOLLARS NINE THOUSAND FORTY SIX CENTS TWENTY FIVE ONLY.
  468. </div>
  469. </div>
  470. </div>
  471. </el-dialog>
  472. </div>
  473. </template>
  474. <script>
  475. import {
  476. typeSave, detail, deleteDetails,
  477. corpstypeTree,
  478. corpsattn,
  479. corpsbank,
  480. corpsfiles,
  481. corpsitem,
  482. getList,
  483. detailList,
  484. generateShipment,
  485. } from "@/api/basicData/configuration"
  486. import {selectGoodsNum} from "@/api/basicData/inventoryAccount"
  487. import customerContact from "./configuration/customerContact.json"
  488. import advantageProject from "./configuration/advantageProject.json"
  489. import bankOfDeposit from "./configuration/bankOfDeposit.json"
  490. import commodity from "./configuration/commodity.json"
  491. import optionTwoCost from "./configuration/mainListCost.json"
  492. import optionPolicy from "./configuration/optionPolicy.json"
  493. import BuyFree from "./configuration/BuyFree.json"
  494. import {
  495. getDeptLazyTree,
  496. getDeptLazyTreeTwo,
  497. customerList,
  498. policyList,
  499. policyColumn
  500. } from "@/api/basicData/basicFeesDesc";
  501. import _ from "lodash";
  502. export default {
  503. name: "detailsPage",
  504. props: {
  505. detailData: {
  506. type: Object
  507. }
  508. },
  509. data() {
  510. return {
  511. disabled: false,
  512. form: {},
  513. configuration: {
  514. multipleChoices: false,
  515. multiple: false,
  516. collapseTags: false,
  517. placeholder: '请点击右边按钮选择',
  518. dicData: []
  519. },
  520. data: [],
  521. policyForm: {},
  522. dataPolicy: [],
  523. contactsDataBuyFree: [],
  524. loadingCost: false,
  525. customerDivide: '',
  526. choiceData: false,
  527. commodityData: false,
  528. dataCost: [],
  529. treeDataPolicy: [],
  530. treeDataGoods: [],
  531. choiceIndex: '',
  532. dialogCost: false,
  533. treeDeptId: '',
  534. treeDeptIdCost: '',
  535. treePolicyId: '',
  536. pageCost: {
  537. pageSize: 10,
  538. currentPage: 1,
  539. total: 0
  540. },
  541. page: {
  542. pageSize: 10,
  543. currentPage: 1,
  544. total: 0
  545. },
  546. pagePolicy: {
  547. pageSize: 10,
  548. currentPage: 1,
  549. total: 0
  550. },
  551. loading: false,
  552. loadingPolicy: false,
  553. contactsForm: {},
  554. optionPolicy: optionPolicy,
  555. optionTwo: commodity,
  556. optionTwoCost: optionTwoCost,
  557. customerBuyFree: BuyFree,
  558. policyOption: {
  559. nodeKey: 'id',
  560. lazy: true,
  561. treeLoad: function (node, resolve) {
  562. const parentId = (node.level === 0) ? 0 : node.data.id;
  563. policyColumn(parentId).then(res => {
  564. resolve(res.data.data.map(item => {
  565. return {
  566. ...item,
  567. leaf: !item.hasChildren
  568. }
  569. }))
  570. });
  571. },
  572. addBtn: false,
  573. menu: false,
  574. size: 'small',
  575. props: {
  576. labelText: '标题',
  577. label: 'title',
  578. value: 'value',
  579. children: 'children'
  580. }
  581. },
  582. treeOptionCost: {
  583. nodeKey: 'id',
  584. lazy: true,
  585. treeLoad: function (node, resolve) {
  586. const parentId = (node.level === 0) ? 0 : node.data.id;
  587. getDeptLazyTree(parentId).then(res => {
  588. resolve(res.data.data.map(item => {
  589. return {
  590. ...item,
  591. leaf: !item.hasChildren
  592. }
  593. }))
  594. });
  595. },
  596. addBtn: false,
  597. menu: false,
  598. size: 'small',
  599. props: {
  600. labelText: '标题',
  601. label: 'title',
  602. value: 'value',
  603. children: 'children'
  604. }
  605. },
  606. treeOption: {
  607. nodeKey: 'id',
  608. lazy: true,
  609. treeLoad: function (node, resolve) {
  610. const parentId = (node.level === 0) ? 0 : node.data.id;
  611. getDeptLazyTreeTwo(parentId).then(res => {
  612. resolve(res.data.data.map(item => {
  613. return {
  614. ...item,
  615. leaf: !item.hasChildren
  616. }
  617. }))
  618. });
  619. },
  620. addBtn: false,
  621. menu: false,
  622. size: 'small',
  623. props: {
  624. labelText: '标题',
  625. label: 'title',
  626. value: 'value',
  627. children: 'children'
  628. }
  629. },
  630. dialogVisible: false,
  631. policyDialog: false,
  632. advantageProjectForm: {},
  633. selection: [],
  634. bankOfDepositForm: {},
  635. contactsData: [],
  636. advantageProjectData: [],
  637. bankOfDepositData: [],
  638. tableDataCost: [],
  639. dic: [],
  640. tableData: [],
  641. policyData: [],
  642. policyDataTwo: [],
  643. customerContact: customerContact,
  644. advantageProject: advantageProject,
  645. bankOfDeposit: bankOfDeposit,
  646. contactInformation: {
  647. column: [
  648. {
  649. label: '销售金额',
  650. prop: 'orderAmount',
  651. rules: [
  652. {
  653. required: false,
  654. message: ' ',
  655. trigger: 'blur'
  656. }
  657. ]
  658. }, {
  659. label: '其他费用',
  660. prop: 'otherAmount',
  661. rules: [
  662. {
  663. required: false,
  664. message: ' ',
  665. trigger: 'blur'
  666. }
  667. ]
  668. }, {
  669. label: '溢付款',
  670. prop: 'overPayment',
  671. rules: [
  672. {
  673. required: false,
  674. message: ' ',
  675. trigger: 'blur'
  676. }
  677. ]
  678. },{
  679. label: '应收账款',
  680. prop: 'debitAmount',
  681. rules: [
  682. {
  683. required: false,
  684. message: ' ',
  685. trigger: 'blur'
  686. }
  687. ]
  688. }, {
  689. label: '已收款',
  690. prop: 'settlmentAmount',
  691. rules: [
  692. {
  693. required: false,
  694. message: ' ',
  695. trigger: 'blur'
  696. }
  697. ]
  698. }, {
  699. label: '应收未收款',
  700. prop: 'accountsReceivable',//无
  701. disabled: true,
  702. rules: [
  703. {
  704. required: false,
  705. message: ' ',
  706. trigger: 'blur'
  707. }
  708. ]
  709. }, {
  710. label: '应收预付款',
  711. prop: 'advancePayment',
  712. rules: [
  713. {
  714. required: false,
  715. message: ' ',
  716. trigger: 'blur'
  717. }
  718. ]
  719. }, {
  720. label: '保证金',
  721. prop: 'deposit',
  722. rules: [
  723. {
  724. required: false,
  725. message: ' ',
  726. trigger: 'blur'
  727. }
  728. ]
  729. }, {
  730. label: '逾期账款',
  731. prop: 'overDueAccounts',
  732. rules: [
  733. {
  734. required: false,
  735. message: ' ',
  736. trigger: 'blur'
  737. }
  738. ]
  739. }, {
  740. label: '所属公司',
  741. prop: 'belongToCorpId',
  742. rules: [
  743. {
  744. required: false,
  745. message: ' ',
  746. trigger: 'blur'
  747. }
  748. ]
  749. }, {
  750. label: '合同日期',
  751. prop: 'businesDate',
  752. type: 'datetime',
  753. rules: [
  754. {
  755. required: false,
  756. message: ' ',
  757. trigger: 'blur'
  758. }
  759. ]
  760. }, {
  761. label: '实际发货日期',
  762. prop: 'actualDeliveryDate',
  763. type: 'datetime',
  764. rules: [
  765. {
  766. required: false,
  767. message: ' ',
  768. trigger: 'blur'
  769. }
  770. ]
  771. }, {
  772. label: '毛利率',
  773. prop: 'grossProfitRate',
  774. rules: [
  775. {
  776. required: false,
  777. message: ' ',
  778. trigger: 'blur'
  779. }
  780. ]
  781. }, {
  782. label: '毛利额',
  783. prop: 'grossProfit',
  784. rules: [
  785. {
  786. required: false,
  787. message: ' ',
  788. trigger: 'blur'
  789. }
  790. ]
  791. }, {
  792. label: '历史运费(元/条)',
  793. prop: 'freightAmountHistory',
  794. rules: [
  795. {
  796. required: false,
  797. message: ' ',
  798. trigger: 'blur'
  799. }
  800. ]
  801. }, {
  802. label: '到货日期',
  803. prop: 'arrivalDate',
  804. type: 'datetime',
  805. rules: [
  806. {
  807. required: false,
  808. message: ' ',
  809. trigger: 'blur'
  810. }
  811. ]
  812. }, {
  813. label: '预收款日期',
  814. type: 'datetime',
  815. prop: 'advanceCollectionDate',
  816. rules: [
  817. {
  818. required: false,
  819. message: ' ',
  820. trigger: 'blur'
  821. }
  822. ]
  823. }, {
  824. label: '积分倍数',
  825. prop: 'pointMutiple',
  826. rules: [
  827. {
  828. required: false,
  829. message: ' ',
  830. trigger: 'blur'
  831. }
  832. ]
  833. }, {
  834. label: '单据状态',
  835. prop: 'orderStatus',
  836. rules: [
  837. {
  838. required: false,
  839. message: ' ',
  840. trigger: 'blur'
  841. }
  842. ]
  843. },{
  844. label: '制单日期',
  845. prop: 'createTime',
  846. type: 'datetime',
  847. disabled:true,
  848. rules: [
  849. {
  850. required: false,
  851. message: ' ',
  852. trigger: 'blur'
  853. }
  854. ]
  855. }, {
  856. label: '制单人',
  857. prop: 'createUserName',
  858. disabled: true,
  859. span: 24,
  860. rules: [
  861. {
  862. required: false,
  863. message: ' ',
  864. trigger: 'blur'
  865. }
  866. ]
  867. },{
  868. label: '特别提醒',
  869. prop: 'specialRemarks',
  870. type: 'textarea',
  871. span: 24,
  872. rules: [
  873. {
  874. required: false,
  875. message: ' ',
  876. trigger: 'blur'
  877. }
  878. ]
  879. }
  880. ]
  881. },
  882. basicData: {
  883. column: [
  884. {
  885. label: '销售订单号',
  886. prop: 'orderNo',
  887. rules: [
  888. {
  889. required: true,
  890. message: ' ',
  891. trigger: 'blur'
  892. }
  893. ]
  894. }, {
  895. label: '主订单号',
  896. prop: 'morderNo',
  897. rules: [
  898. {
  899. required: true,
  900. message: ' ',
  901. trigger: 'blur'
  902. }
  903. ]
  904. }, {
  905. label: '发货地址',
  906. prop: 'shippingAddress',
  907. rules: [
  908. {
  909. required: true,
  910. message: ' ',
  911. trigger: 'blur'
  912. }
  913. ]
  914. }, {
  915. label: '客户全称',
  916. prop: 'corpId',
  917. rules: [
  918. {
  919. required: true,
  920. message: ' ',
  921. trigger: 'blur'
  922. }
  923. ]
  924. }, {
  925. label: '付款方式',
  926. prop: 'paymentType',
  927. rules: [
  928. {
  929. required: true,
  930. message: ' ',
  931. trigger: 'blur'
  932. }
  933. ]
  934. }, {
  935. label: '到货地址',
  936. prop: 'arrivalAddress',
  937. rules: [
  938. {
  939. required: true,
  940. message: ' ',
  941. trigger: 'blur'
  942. }
  943. ]
  944. }, {
  945. label: '包装要求',
  946. prop: 'packageRemarks',
  947. rules: [
  948. {
  949. required: true,
  950. message: ' ',
  951. trigger: 'blur'
  952. }
  953. ]
  954. }, {
  955. label: '运费',
  956. prop: 'oceanFreight',
  957. rules: [
  958. {
  959. required: true,
  960. message: ' ',
  961. trigger: 'blur'
  962. }
  963. ]
  964. }, {
  965. label: '银行帐号',
  966. prop: 'banks',
  967. rules: [
  968. {
  969. required: true,
  970. message: ' ',
  971. trigger: 'blur'
  972. }
  973. ]
  974. }, {
  975. label: '要求发货日期',
  976. prop: 'requiredDeliveryDate',
  977. type: 'datetime',
  978. rules: [
  979. {
  980. required: true,
  981. message: ' ',
  982. trigger: 'blur'
  983. }
  984. ]
  985. }, {
  986. label: '要求到货日期',
  987. prop: 'requiredArrivalDate',
  988. type: 'datetime',
  989. rules: [
  990. {
  991. required: true,
  992. message: ' ',
  993. trigger: 'blur'
  994. }
  995. ]
  996. }, {
  997. label: '公司户头',
  998. prop: 'banksAccountName',
  999. rules: [
  1000. {
  1001. required: false,
  1002. message: ' ',
  1003. trigger: 'blur'
  1004. }
  1005. ]
  1006. }, {
  1007. label: "订单备注",
  1008. type: 'textarea',
  1009. span: 24,
  1010. prop: "orderRemark",
  1011. mock: {
  1012. type: 'county'
  1013. }
  1014. }
  1015. ]
  1016. },
  1017. paymentOption: [],
  1018. statusOption: [],
  1019. // 费用信息排序的最大值
  1020. maxFeeNum: 0,
  1021. maxGoodsNum: 0,
  1022. }
  1023. },
  1024. //初始化查询
  1025. created() {
  1026. this.getWorkDicts("payment_term").then(res => {
  1027. this.paymentOption = res.data.data
  1028. })
  1029. this.getWorkDicts("order_status").then(res => {
  1030. this.statusOption = res.data.data
  1031. })
  1032. this.$set(this.form, 'orderStatus', '录入')
  1033. // this.optionPolicy.selectable = function(row, index) {
  1034. // return false
  1035. // }
  1036. // this.customerBuyFree.selectable = function(row, index) {
  1037. // return false
  1038. // }
  1039. if (this.detailData.id) {
  1040. // let id = this.$route.query.id.replace(/\"/g, "")
  1041. this.queryData(this.detailData.id)
  1042. }
  1043. if (this.detailData.copyId) {
  1044. // let id = this.$route.query.copyId.replace(/\"/g, "")
  1045. this.queryData(this.detailData.copyId, true)
  1046. }
  1047. },
  1048. watch: {
  1049. // '$route'(to, from) {
  1050. // console.log(to, from);
  1051. // if (this.$route.query.id) {
  1052. // let id = JSON.parse(this.$route.query.id).replace(/\"/g, "")
  1053. // detail(id).then(res => {
  1054. // console.log(res.data.data)
  1055. // this.form = res.data.data;
  1056. // });
  1057. // } else {
  1058. // this.form = {}
  1059. // }
  1060. // },
  1061. },
  1062. methods: {
  1063. queryData(id, isCopy = false){
  1064. detail(id).then(res => {
  1065. console.log(res.data.data)
  1066. this.form = res.data.data;
  1067. this.contactsData = this.form.orderItemsList
  1068. this.advantageProjectData = this.form.orderFeesList
  1069. this.bankOfDepositData = this.form.orderFilesList
  1070. this.configuration.dicData = this.form.corpName
  1071. if (this.form.belongToCorpList) {
  1072. this.configuration.dicData = this.configuration.dicData.concat(this.form.belongToCorpList)
  1073. }
  1074. let feesData = []
  1075. this.form.orderFeesList.forEach(item => {
  1076. let a = {
  1077. cname: item.corpName,
  1078. id: item.corpId
  1079. }
  1080. feesData.push(a)
  1081. })
  1082. this.configuration.dicData = this.configuration.dicData.concat(feesData)
  1083. // 去重
  1084. this.removeRepeat()
  1085. delete this.form.orderItemsList
  1086. delete this.form.orderFeesList
  1087. delete this.form.orderFilesList
  1088. delete this.form.corpName
  1089. delete this.form.belongToCorpList
  1090. // 获取最大值
  1091. let num = []
  1092. this.advantageProjectData.forEach(item => {
  1093. num.push(item.sort)
  1094. })
  1095. if (num.length == 0) {
  1096. this.maxFeeNum = 0;
  1097. } else {
  1098. this.maxFeeNum = num.reduce((a, b) => {
  1099. return b > a? b: a;
  1100. })
  1101. }
  1102. let goodsNum = []
  1103. this.contactsData.forEach(item => {
  1104. goodsNum.push(item.sort)
  1105. })
  1106. if (goodsNum.length == 0) {
  1107. this.maxGoodsNum = 0;
  1108. } else {
  1109. this.maxGoodsNum = goodsNum.reduce((a, b) => {
  1110. return b > a? b: a;
  1111. })
  1112. }
  1113. if (isCopy) {
  1114. delete this.form.id
  1115. this.contactsData.forEach(item => {
  1116. delete item.id
  1117. delete item.pid
  1118. })
  1119. this.advantageProjectData.forEach(item => {
  1120. delete item.id
  1121. delete item.pid
  1122. })
  1123. this.bankOfDepositData.forEach(item => {
  1124. delete item.id
  1125. delete item.pid
  1126. })
  1127. }
  1128. });
  1129. },
  1130. // 复制新单
  1131. copyOrder() {
  1132. this.queryData(this.form.id, true)
  1133. },
  1134. //点击行可编辑
  1135. handleRowClick(row, event, column) {
  1136. },
  1137. //商品编辑
  1138. rowCell(row, index) {
  1139. if (row.$cellEdit) {
  1140. if (Number(row.orderQuantity) < Number(row.actualQuantity)) {
  1141. return this.$message.error('订货数量不能小于发货数量')
  1142. }
  1143. }
  1144. this.$refs.crudContact.rowCell(row, index)
  1145. },
  1146. //费用编辑
  1147. rowCellTwo(row, index) {
  1148. console.log(row)
  1149. this.$refs.crudProject.rowCell(row, index)
  1150. },
  1151. //费用新增触发
  1152. costIncrease() {
  1153. this.dialogCost = !this.dialogCost
  1154. this.choiceData = false
  1155. },
  1156. //商品新增触发
  1157. commoditySelection() {
  1158. this.dialogVisible = !this.dialogVisible
  1159. this.commodityData = false
  1160. },
  1161. //政策价格导入
  1162. policy() {
  1163. this.policyDialog = !this.policyDialog
  1164. },
  1165. //生成发货单
  1166. generateShipmentD() {
  1167. let lsit = []
  1168. for (let item in this.selection) {
  1169. if (!this.selection[item].id) {
  1170. return this.$confirm('商品信息有未保存数据, 是否立即保存?', '提示', {
  1171. confirmButtonText: '确定',
  1172. cancelButtonText: '取消',
  1173. type: 'warning'
  1174. }).then(() => {
  1175. this.editCustomer(false)
  1176. }).catch(() => {
  1177. this.$message({
  1178. type: 'info',
  1179. message: '已取消'
  1180. });
  1181. });
  1182. } else {
  1183. lsit.push(this.selection[item].id)
  1184. }
  1185. }
  1186. let data = {
  1187. id: this.form.id,
  1188. orderItemIds: lsit
  1189. }
  1190. generateShipment(data).then(res => {
  1191. console.log(res.data.data)
  1192. this.$router.push({
  1193. path: "/businessManagement/deliveryNotice/index",
  1194. query: {form: JSON.stringify(res.data.data)},
  1195. });
  1196. })
  1197. },
  1198. //商品选中触发
  1199. productSelection(selection) {
  1200. this.selection = selection
  1201. },
  1202. //点击费用明细选择触发
  1203. choice(row) {
  1204. this.dialogCost = !this.dialogCost
  1205. this.choiceData = true
  1206. console.log(row)
  1207. this.choiceIndex = row.$index
  1208. },
  1209. // 去重
  1210. removeRepeat() {
  1211. let obj = []
  1212. this.configuration.dicData = this.configuration.dicData.reduce((current,next) => {
  1213. obj[next.id] ? '': obj[next.id] = true && current.push(next)
  1214. return current
  1215. }, [])
  1216. },
  1217. //
  1218. receiveList(data){
  1219. this.configuration.dicData = this.configuration.dicData.concat(data)
  1220. this.removeRepeat()
  1221. },
  1222. //点击商品明细选择触发
  1223. commodityChoice(row) {
  1224. this.dialogVisible = !this.dialogVisible
  1225. this.commodityData = true
  1226. console.log(row)
  1227. this.choiceIndexT = row.$index
  1228. },
  1229. //导入商品触发
  1230. importChoice() {
  1231. // this.contactsData = this.contactsData.concat(this.tableData)
  1232. if (this.tableData.length === 1) {
  1233. this.contactsData[this.choiceIndexT].cname = this.tableData[0].cname
  1234. this.contactsData[this.choiceIndexT].code = this.tableData[0].code
  1235. this.contactsData[this.choiceIndexT].typeno = this.tableData[0].typeno
  1236. this.contactsData[this.choiceIndexT].specificationAndModel = this.tableData[0].specs
  1237. this.contactsData[this.choiceIndexT].itemId = this.tableData[0].id
  1238. this.contactsData[this.choiceIndexT].priceCategory = this.tableData[0].goodsTypeName
  1239. this.contactsData[this.choiceIndexT].orderQuantity = 0
  1240. this.contactsData[this.choiceIndexT].price = 0
  1241. this.contactsData[this.choiceIndexT].amount = 0
  1242. }
  1243. this.dialogVisible = !this.dialogVisible
  1244. this.commodityData = false
  1245. },
  1246. //费用编辑导入触发
  1247. choiceCost() {
  1248. if (this.tableDataCost.length === 1) {
  1249. this.advantageProjectData[this.choiceIndex].feeName = this.tableDataCost[0].cname
  1250. this.advantageProjectData[this.choiceIndex].itemId = this.tableDataCost[0].id
  1251. this.advantageProjectData[this.choiceIndex].code = this.tableDataCost[0].code
  1252. }
  1253. this.dialogCost = !this.dialogCost
  1254. this.choiceData = false
  1255. },
  1256. //费用导入触发
  1257. importCost() {
  1258. // this.advantageProjectForm = this.advantageProjectForm.concat(this.tableDataCost)
  1259. if (this.tableDataCost.length > 0) {
  1260. for (let item in this.tableDataCost) {
  1261. console.log(this.tableDataCost[item])
  1262. this.tableDataCost[item].itemId = this.tableDataCost[item].id
  1263. this.tableDataCost[item].feeName = this.tableDataCost[item].cname
  1264. this.tableDataCost[item].sort = this.maxFeeNum + 1
  1265. this.maxFeeNum++
  1266. delete this.tableDataCost[item].id
  1267. this.$refs.crudProject.rowCellAdd(this.tableDataCost[item]);
  1268. this.$refs.crudProject.rowCell(this.tableDataCost[item], this.advantageProjectForm.length - 1)
  1269. }
  1270. }
  1271. this.tableDataCost = []
  1272. this.dialogCost = false
  1273. },
  1274. //确认导入触发
  1275. importGoods() {
  1276. // this.contactsData = this.contactsData.concat(this.tableData)
  1277. if (this.tableData.length > 0) {
  1278. for (let item in this.tableData) {
  1279. let data = {
  1280. goodsId: this.tableData[item].id,
  1281. typeno: this.tableData[item].specs
  1282. }
  1283. selectGoodsNum(data).then(res => {
  1284. console.log(res.data)
  1285. })
  1286. this.tableData[item].priceCategory = this.tableData[item].goodsTypeName
  1287. delete this.tableData[item].goodsTypeName
  1288. this.tableData[item].itemId = this.tableData[item].id
  1289. this.$set(this.tableData[item], 'specificationAndModel', this.tableData[item].specs)
  1290. this.$set(this.tableData[item], 'priceType', '一般')
  1291. this.$set(this.tableData[item], 'orderQuantity', 0)
  1292. this.$set(this.tableData[item], 'actualQuantity', 0)
  1293. this.$set(this.tableData[item], 'storageQuantity', 0)
  1294. this.tableData[item].price = 0
  1295. this.tableData[item].amount = 0
  1296. this.tableData[item].sort = this.maxGoodsNum + 1
  1297. this.maxGoodsNum++
  1298. delete this.tableData[item].id
  1299. this.$refs.crudContact.rowCellAdd(this.tableData[item]);
  1300. this.$refs.crudContact.rowCell(this.tableData[item], this.contactsData.length - 1)
  1301. }
  1302. }
  1303. this.tableData = []
  1304. this.dialogVisible = false
  1305. },
  1306. closeGoods() {
  1307. this.treeDataGoods = [];
  1308. this.treeDeptId = "";
  1309. },
  1310. closeFees() {
  1311. this.treeDeptIdCost = "";
  1312. this.treeData = [];
  1313. },
  1314. closePolicy() {
  1315. this.treePolicyId = '';
  1316. this.dataPolicy = [];
  1317. this.policyForm = {};
  1318. this.contactsDataBuyFree = [];
  1319. this.policyData = []
  1320. this.policyDataTwo = []
  1321. },
  1322. //选中触发
  1323. selectionChange(list) {
  1324. this.tableData = list
  1325. },
  1326. //费用选中触发
  1327. selectionChangeCost(list) {
  1328. this.tableDataCost = list
  1329. },
  1330. //导入页左商品类型查询
  1331. nodeClick(data) {
  1332. this.treeDeptId = data.id;
  1333. this.page.currentPage = 1;
  1334. this.onLoad(this.page);
  1335. },
  1336. //导入页销售政策查询
  1337. policyNodeClick(data) {
  1338. this.treePolicyId = data.id
  1339. // detailList(data.id).then(res => {
  1340. // //特价促销
  1341. // this.dataPolicy = res.data.data.specialItemList
  1342. // //买赠促销
  1343. // this.contactsDataBuyFree = res.data.data.presentItemList
  1344. // })
  1345. this.policyOnLoad()
  1346. },
  1347. //导入页左费用类型查询
  1348. nodeClickCost(data) {
  1349. this.treeDeptIdCost = data.id;
  1350. this.pageCost.currentPage = 1;
  1351. this.onLoadCost(this.pageCost);
  1352. },
  1353. //刷新触发
  1354. refreshChange() {
  1355. this.page.currentPage = 1;
  1356. this.onLoad(this.page);
  1357. },
  1358. //销售政策特价促销选中触发
  1359. selectionChangePolicy(list) {
  1360. console.log(list)
  1361. this.policyData = this.policyData.concat(list)
  1362. // this.policyData.forEach(item => {
  1363. // this.$set(item, 'price', item.specialOffer)
  1364. // })
  1365. if (this.policyData.length > 0) {
  1366. this.customerBuyFree.selection = false
  1367. } else {
  1368. this.customerBuyFree.selection = true
  1369. }
  1370. },
  1371. //销售政策买赠促销选中触发
  1372. selectionChangePolicyTwo(list) {
  1373. this.policyDataTwo = this.policyDataTwo.concat(list)
  1374. // this.policyDataTwo.forEach(item => {
  1375. // this.$set(item, 'price', item.salesPrice)
  1376. // })
  1377. if (this.policyDataTwo.length > 0) {
  1378. this.optionPolicy.selection = false
  1379. } else {
  1380. this.optionPolicy.selection = true
  1381. }
  1382. },
  1383. //导入商品政策
  1384. importPolicy() {
  1385. let list = this.policyData.concat(this.policyDataTwo)
  1386. for (let item in list) {
  1387. console.log(list[item])
  1388. if (this.policyData.length > 0) {
  1389. this.$set(list[item], 'price', list[item].specialOffer)
  1390. } else {
  1391. this.$set(list[item], 'price', list[item].salesPrice)
  1392. }
  1393. this.$set(list[item], 'actualQuantity', 0)
  1394. this.$set(list[item], 'storageQuantity', 0)
  1395. this.$set(list[item], 'orderQuantity', 0)
  1396. this.$set(list[item], 'amount', 0)
  1397. this.$set(list[item], 'priceCategory', this.policyForm.cname)
  1398. this.$set(list[item], 'priceType', this.policyForm.cname)
  1399. this.$set(list[item], 'cname', list[item].productCategory)
  1400. this.$set(list[item], 'sort', this.maxGoodsNum + 1)
  1401. this.maxGoodsNum++
  1402. this.$refs.crudContact.rowCellAdd(list[item]);
  1403. this.$refs.crudContact.rowCell(list[item], this.contactsData.length - 1)
  1404. }
  1405. this.policyDialog = false
  1406. },
  1407. //费用刷新触发
  1408. refreshChangeCost() {
  1409. this.treeDeptIdCost = '';
  1410. this.pageCost.currentPage = 1;
  1411. this.onLoadCost(this.pageCost);
  1412. },
  1413. //新增商品信息保存触发
  1414. rowSave(row, done, loading) {
  1415. console.log(row)
  1416. console.log(this.contactsData)
  1417. // this.contactsData.push(row)
  1418. done()
  1419. },
  1420. //修改商品信息触发
  1421. rowUpdate(row, index, done, loading) {
  1422. done(row);
  1423. },
  1424. //删除商品信息触发
  1425. rowDel(row, index, donerowDel) {
  1426. this.$confirm("确定将选择数据删除?", {
  1427. confirmButtonText: "确定",
  1428. cancelButtonText: "取消",
  1429. type: "warning"
  1430. }).then(() => {
  1431. //商品判断是否需要调用删除接口
  1432. if (row.id) {
  1433. corpsattn(row.id).then(res => {
  1434. this.$message({
  1435. type: "success",
  1436. message: "操作成功!"
  1437. });
  1438. this.contactsData.splice(index, 1);
  1439. })
  1440. } else {
  1441. this.$message({
  1442. type: "success",
  1443. message: "操作成功!"
  1444. });
  1445. this.contactsData.splice(index, 1);
  1446. }
  1447. })
  1448. },
  1449. //新增费用明细保存触发
  1450. rowSaveProject(row, done, loading) {
  1451. // this.advantageProjectData.push(row)
  1452. done()
  1453. },
  1454. //修改费用明细触发
  1455. rowUpdateProject(row, index, done, loading) {
  1456. done(row);
  1457. },
  1458. policyOnLoad(params = {}) {
  1459. // this.policyLoading = true;
  1460. detailList(this.treePolicyId).then(res => {
  1461. this.policyForm = res.data.data
  1462. //特价促销
  1463. this.dataPolicy = res.data.data.specialItemList
  1464. //买赠促销
  1465. this.contactsDataBuyFree = res.data.data.presentItemList
  1466. })
  1467. },
  1468. //商品列表查询
  1469. onLoad(page, params = {}) {
  1470. this.loading = true;
  1471. getList(page.currentPage, page.pageSize, Object.assign(params, this.query), this.treeDeptId).then(res => {
  1472. console.log(res)
  1473. const data = res.data.data;
  1474. this.page.total = data.total;
  1475. this.data = data.records;
  1476. this.loading = false;
  1477. });
  1478. },
  1479. //费用查询
  1480. onLoadCost(page, params = {}) {
  1481. this.loadingCost = true;
  1482. let queryParams = Object.assign({}, params, {
  1483. pageSize: page.pageSize,
  1484. pageNum: page.currentPage,
  1485. parentId: 0,
  1486. feesTypeId: this.treeDeptIdCost
  1487. })
  1488. customerList(queryParams).then(res => {
  1489. console.log(res)
  1490. const data = res.data.data;
  1491. this.pageCost.total = data.total;
  1492. this.dataCost = data.records;
  1493. this.loadingCost = false;
  1494. });
  1495. },
  1496. //删除费用明细触发
  1497. rowDelProject(row, index, donerowDel) {
  1498. this.$confirm("确定将选择数据删除?", {
  1499. confirmButtonText: "确定",
  1500. cancelButtonText: "取消",
  1501. type: "warning"
  1502. }).then(() => {
  1503. //费用判断是否需要调用删除接口
  1504. if (row.id) {
  1505. corpsitem(row.id).then(res => {
  1506. this.$message({
  1507. type: "success",
  1508. message: "操作成功!"
  1509. });
  1510. this.advantageProjectData.splice(index, 1);
  1511. })
  1512. } else {
  1513. this.$message({
  1514. type: "success",
  1515. message: "操作成功!"
  1516. });
  1517. this.advantageProjectData.splice(index, 1);
  1518. }
  1519. })
  1520. },
  1521. //新增附件上传保存触发
  1522. rowSaveBankOfDeposit(row, done, loading) {
  1523. this.bankOfDepositData.push(row)
  1524. done()
  1525. },
  1526. //修改附件上传触发
  1527. rowUpdateBankOfDeposit(row, index, done, loading) {
  1528. done(row);
  1529. },
  1530. //删除附件上传触发
  1531. rowDelBankOfDeposit(row, index, donerowDel) {
  1532. this.$confirm("确定将选择数据删除?", {
  1533. confirmButtonText: "确定",
  1534. cancelButtonText: "取消",
  1535. type: "warning"
  1536. }).then(() => {
  1537. //附件判断是否需要调用删除接口
  1538. if (row.id) {
  1539. corpsbank(row.id).then(res => {
  1540. this.$message({
  1541. type: "success",
  1542. message: "操作成功!"
  1543. });
  1544. this.bankOfDepositData.splice(index, 1);
  1545. })
  1546. } else {
  1547. this.$message({
  1548. type: "success",
  1549. message: "操作成功!"
  1550. });
  1551. this.bankOfDepositData.splice(index, 1);
  1552. }
  1553. })
  1554. },
  1555. uploadAfter(res, done) {
  1556. if (res.originalName) {
  1557. this.bankOfDepositForm.fileName = this.bankOfDepositForm.fileName
  1558. ? this.bankOfDepositForm.fileName
  1559. : res.originalName;
  1560. }
  1561. done();
  1562. },
  1563. //修改提交触发
  1564. editCustomer(isBack = false) {
  1565. console.log(this.form)
  1566. this.$refs["form"].validate((valid) => {
  1567. if (valid) {
  1568. for (let item in this.contactsData) {
  1569. if (Number(this.contactsData[item].orderQuantity) < Number(this.contactsData[item].actualQuantity)) {
  1570. return this.$message.error('商品信息第'+ (parseInt(item) + 1) + '行订货数量不能小于发货数量')
  1571. }
  1572. }
  1573. //商品信息
  1574. this.form.orderItemsList = this.contactsData
  1575. this.form.orderFeesList = this.advantageProjectData
  1576. this.form.orderFilesList = this.bankOfDepositData
  1577. if (typeof this.form.corpsTypeId == 'object') {
  1578. this.form.corpsTypeId = this.form.corpsTypeId.join(",")
  1579. }
  1580. this.form.billType = 'XS'
  1581. this.disabled = true
  1582. typeSave(this.form).then(res => {
  1583. this.$message({type: "success", message: this.form.id ? "修改成功!" : "新增成功!"});
  1584. this.disabled = false
  1585. if (isBack) {
  1586. //成功关闭此页面回到列表页
  1587. this.$emit("goBack");
  1588. } else {
  1589. this.queryData(res.data.data.id)
  1590. }
  1591. })
  1592. } else {
  1593. return false;
  1594. }
  1595. });
  1596. },
  1597. // 计算应收未收款
  1598. computedCost() {
  1599. // 应收预付款
  1600. let advancePayment = 0;
  1601. // 已收款
  1602. let settlmentAmount = 0;
  1603. if (this.form.advancePayment) {
  1604. advancePayment = this.form.advancePayment
  1605. }
  1606. if (this.form.settlmentAmount) {
  1607. settlmentAmount = this.form.settlmentAmount
  1608. }
  1609. this.$set(this.form, "accountsReceivable", Number(advancePayment) - Number(settlmentAmount)).toFixed(2);
  1610. },
  1611. quantityChange(row) {
  1612. if (!row.orderQuantity) {
  1613. row.orderQuantity = 0;
  1614. } else {
  1615. // row.amount = _.multiply(row.price, row.orderQuantity).toFixed(2);
  1616. row.amount = (row.price * row.orderQuantity).toFixed(2)
  1617. }
  1618. },
  1619. priceChange(row) {
  1620. if (!row.price) {
  1621. row.price = 0;
  1622. } else {
  1623. row.amount = (row.price * row.orderQuantity).toFixed(2)
  1624. }
  1625. },
  1626. //返回列表
  1627. backToList() {
  1628. this.$confirm("是否保存当前页面?", "提示", {
  1629. confirmButtonText: "保存",
  1630. cancelButtonText: "取消",
  1631. type: "warning",
  1632. }).then(() => {
  1633. this.editCustomer(true)
  1634. }).catch(() => {
  1635. // this.$router.$avueRouter.closeTag();
  1636. // this.$router.push({
  1637. // path: '/businessManagement/salesOrder/index',
  1638. // query: {}
  1639. // });
  1640. this.$emit("goBack");
  1641. })
  1642. }
  1643. }
  1644. }
  1645. </script>
  1646. <style lang="scss" scoped>
  1647. .customer-head {
  1648. position: fixed;
  1649. top: 105px;
  1650. width: 100%;
  1651. margin-left: -10px;
  1652. height: 62px;
  1653. background: #ffffff;
  1654. box-shadow: 0 4px 12px 0px rgba(232, 232, 235, 1);
  1655. z-index: 999;
  1656. /* display: flex;
  1657. justify-content: left; */
  1658. }
  1659. .customer-back {
  1660. cursor: pointer;
  1661. line-height: 62px;
  1662. font-size: 16px;
  1663. color: #323233;
  1664. font-weight: 400;
  1665. }
  1666. .back-icon {
  1667. line-height: 64px;
  1668. font-size: 20px;
  1669. margin-right: 8px;
  1670. }
  1671. .add-customer-btn {
  1672. position: fixed;
  1673. right: 36px;
  1674. top: 115px;
  1675. }
  1676. ::v-deep .el-form-item {
  1677. margin-bottom: 0;
  1678. }
  1679. .el-dialogDeep {
  1680. ::v-deep .el-dialog {
  1681. margin: 1vh auto 0 !important;
  1682. padding-bottom: 10px !important;
  1683. .el-dialog__body, .el-dialog__footer {
  1684. padding-bottom: 0 !important;
  1685. padding-top: 0 !important;
  1686. }
  1687. }
  1688. }
  1689. .print-div {
  1690. color: #000;
  1691. }
  1692. .print_table {
  1693. table {
  1694. border-right: 1px solid #000;
  1695. border-bottom: 1px solid #000;
  1696. font-size: 12px;
  1697. margin-bottom: 5px;
  1698. }
  1699. table td {
  1700. border-left: 1px solid #000;
  1701. border-top: 1px solid #000;
  1702. vertical-align: middle;
  1703. padding: 2px;
  1704. text-align: center;
  1705. }
  1706. }
  1707. .table {
  1708. border-collapse: collapse;
  1709. border-spacing: 0;
  1710. background-color: transparent;
  1711. display: table;
  1712. width: 99%;
  1713. max-width: 100%;
  1714. margin: 0 auto;
  1715. }
  1716. .table td {
  1717. text-align: left;
  1718. vertical-align: middle;
  1719. font-size: 14px;
  1720. color: #000000;
  1721. padding: 10.5px 0 10.5px 30px;
  1722. //border: 1px solid #000;
  1723. }
  1724. </style>