detailsPageEdit.vue 50 KB

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