detailsPageEdit.vue 56 KB

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