detailsPageEdit.vue 56 KB

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