detailsPageEdit.vue 57 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820
  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. import { contrastObj, contrastList } from "@/util/contrastData";
  478. export default {
  479. name: "detailsPage",
  480. props: {
  481. detailData: {
  482. type: Object
  483. }
  484. },
  485. data() {
  486. return {
  487. disabled: false,
  488. form: {},
  489. configuration: {
  490. multipleChoices: false,
  491. multiple: false,
  492. collapseTags: false,
  493. placeholder: '请点击右边按钮选择',
  494. dicData: []
  495. },
  496. data: [],
  497. policyForm: {},
  498. dataPolicy: [],
  499. contactsDataBuyFree: [],
  500. loadingCost: false,
  501. customerDivide: '',
  502. choiceData: false,
  503. commodityData: false,
  504. dataCost: [],
  505. treeDataPolicy: [],
  506. treeDataGoods: [],
  507. choiceIndex: '',
  508. dialogCost: false,
  509. treeDeptId: '',
  510. treeDeptIdCost: '',
  511. treePolicyId: '',
  512. pageCost: {
  513. pageSize: 10,
  514. currentPage: 1,
  515. total: 0
  516. },
  517. page: {
  518. pageSize: 10,
  519. currentPage: 1,
  520. total: 0
  521. },
  522. pagePolicy: {
  523. pageSize: 10,
  524. currentPage: 1,
  525. total: 0
  526. },
  527. loading: false,
  528. loadingPolicy: false,
  529. contactsForm: {},
  530. optionPolicy: optionPolicy,
  531. optionTwo: commodity,
  532. optionTwoCost: optionTwoCost,
  533. customerBuyFree: BuyFree,
  534. policyOption: {
  535. nodeKey: 'id',
  536. lazy: true,
  537. treeLoad: function (node, resolve) {
  538. const parentId = (node.level === 0) ? 0 : node.data.id;
  539. policyColumn(parentId).then(res => {
  540. resolve(res.data.data.map(item => {
  541. return {
  542. ...item,
  543. leaf: !item.hasChildren
  544. }
  545. }))
  546. });
  547. },
  548. addBtn: false,
  549. menu: false,
  550. size: 'small',
  551. props: {
  552. labelText: '标题',
  553. label: 'title',
  554. value: 'value',
  555. children: 'children'
  556. }
  557. },
  558. treeOptionCost: {
  559. nodeKey: 'id',
  560. lazy: true,
  561. treeLoad: function (node, resolve) {
  562. const parentId = (node.level === 0) ? 0 : node.data.id;
  563. getDeptLazyTree(parentId).then(res => {
  564. resolve(res.data.data.map(item => {
  565. return {
  566. ...item,
  567. leaf: !item.hasChildren
  568. }
  569. }))
  570. });
  571. },
  572. addBtn: false,
  573. menu: false,
  574. size: 'small',
  575. props: {
  576. labelText: '标题',
  577. label: 'title',
  578. value: 'value',
  579. children: 'children'
  580. }
  581. },
  582. treeOption: {
  583. nodeKey: 'id',
  584. lazy: true,
  585. treeLoad: function (node, resolve) {
  586. const parentId = (node.level === 0) ? 0 : node.data.id;
  587. getDeptLazyTreeTwo(parentId).then(res => {
  588. resolve(res.data.data.map(item => {
  589. return {
  590. ...item,
  591. leaf: !item.hasChildren
  592. }
  593. }))
  594. });
  595. },
  596. addBtn: false,
  597. menu: false,
  598. size: 'small',
  599. props: {
  600. labelText: '标题',
  601. label: 'title',
  602. value: 'value',
  603. children: 'children'
  604. }
  605. },
  606. dialogVisible: false,
  607. policyDialog: false,
  608. advantageProjectForm: {},
  609. selection: [],
  610. bankOfDepositForm: {},
  611. contactsData: [],
  612. advantageProjectData: [],
  613. bankOfDepositData: [],
  614. tableDataCost: [],
  615. dic: [],
  616. tableData: [],
  617. policyData: [],
  618. policyDataTwo: [],
  619. customerContact: {},
  620. advantageProject: {},
  621. bankOfDeposit: bankOfDeposit,
  622. contactInformation: {
  623. column: [
  624. {
  625. label: '销售金额',
  626. prop: 'orderAmount',
  627. rules: [
  628. {
  629. required: false,
  630. message: ' ',
  631. trigger: 'blur'
  632. }
  633. ]
  634. }, {
  635. label: '其他费用',
  636. prop: 'otherAmount',
  637. rules: [
  638. {
  639. required: false,
  640. message: ' ',
  641. trigger: 'blur'
  642. }
  643. ]
  644. }, {
  645. label: '溢付款',
  646. prop: 'overPayment',
  647. rules: [
  648. {
  649. required: false,
  650. message: ' ',
  651. trigger: 'blur'
  652. }
  653. ]
  654. },{
  655. label: '应收账款',
  656. prop: 'debitAmount',
  657. rules: [
  658. {
  659. required: false,
  660. message: ' ',
  661. trigger: 'blur'
  662. }
  663. ]
  664. }, {
  665. label: '已收款',
  666. prop: 'settlmentAmount',
  667. rules: [
  668. {
  669. required: false,
  670. message: ' ',
  671. trigger: 'blur'
  672. }
  673. ]
  674. }, {
  675. label: '应收未收款',
  676. prop: 'balanceAmount',//无
  677. disabled: true,
  678. rules: [
  679. {
  680. required: false,
  681. message: ' ',
  682. trigger: 'blur'
  683. }
  684. ]
  685. }, {
  686. label: '应收预付款',
  687. prop: 'advancePayment',
  688. rules: [
  689. {
  690. required: false,
  691. message: ' ',
  692. trigger: 'blur'
  693. }
  694. ]
  695. }, {
  696. label: '保证金',
  697. prop: 'deposit',
  698. rules: [
  699. {
  700. required: false,
  701. message: ' ',
  702. trigger: 'blur'
  703. }
  704. ]
  705. }, {
  706. label: '逾期账款',
  707. prop: 'overDueAccounts',
  708. rules: [
  709. {
  710. required: false,
  711. message: ' ',
  712. trigger: 'blur'
  713. }
  714. ]
  715. }, {
  716. label: '所属公司',
  717. prop: 'belongToCorpId',
  718. rules: [
  719. {
  720. required: false,
  721. message: ' ',
  722. trigger: 'blur'
  723. }
  724. ]
  725. }, {
  726. label: '合同日期',
  727. prop: 'businesDate',
  728. type: 'datetime',
  729. rules: [
  730. {
  731. required: false,
  732. message: ' ',
  733. trigger: 'blur'
  734. }
  735. ]
  736. }, {
  737. label: '实际发货日期',
  738. prop: 'actualDeliveryDate',
  739. type: 'datetime',
  740. rules: [
  741. {
  742. required: false,
  743. message: ' ',
  744. trigger: 'blur'
  745. }
  746. ]
  747. }, {
  748. label: '毛利率',
  749. prop: 'grossProfitRate',
  750. rules: [
  751. {
  752. required: false,
  753. message: ' ',
  754. trigger: 'blur'
  755. }
  756. ]
  757. }, {
  758. label: '毛利额',
  759. prop: 'grossProfit',
  760. rules: [
  761. {
  762. required: false,
  763. message: ' ',
  764. trigger: 'blur'
  765. }
  766. ]
  767. }, {
  768. label: '历史运费(元/条)',
  769. prop: 'freightAmountHistory',
  770. rules: [
  771. {
  772. required: false,
  773. message: ' ',
  774. trigger: 'blur'
  775. }
  776. ]
  777. }, {
  778. label: '到货日期',
  779. prop: 'arrivalDate',
  780. type: 'datetime',
  781. rules: [
  782. {
  783. required: false,
  784. message: ' ',
  785. trigger: 'blur'
  786. }
  787. ]
  788. }, {
  789. label: '预收款日期',
  790. type: 'datetime',
  791. prop: 'advanceCollectionDate',
  792. rules: [
  793. {
  794. required: false,
  795. message: ' ',
  796. trigger: 'blur'
  797. }
  798. ]
  799. }, {
  800. label: '积分倍数',
  801. prop: 'pointMutiple',
  802. rules: [
  803. {
  804. required: false,
  805. message: ' ',
  806. trigger: 'blur'
  807. }
  808. ]
  809. }, {
  810. label: '单据状态',
  811. prop: 'orderStatus',
  812. rules: [
  813. {
  814. required: false,
  815. message: ' ',
  816. trigger: 'blur'
  817. }
  818. ]
  819. },{
  820. label: '制单日期',
  821. prop: 'createTime',
  822. type: 'datetime',
  823. disabled:true,
  824. rules: [
  825. {
  826. required: false,
  827. message: ' ',
  828. trigger: 'blur'
  829. }
  830. ]
  831. }, {
  832. label: '制单人',
  833. prop: 'createUserName',
  834. disabled: true,
  835. span: 24,
  836. rules: [
  837. {
  838. required: false,
  839. message: ' ',
  840. trigger: 'blur'
  841. }
  842. ]
  843. },{
  844. label: '特别提醒',
  845. prop: 'specialRemarks',
  846. type: 'textarea',
  847. span: 24,
  848. rules: [
  849. {
  850. required: false,
  851. message: ' ',
  852. trigger: 'blur'
  853. }
  854. ]
  855. }
  856. ]
  857. },
  858. basicData: {
  859. column: [
  860. {
  861. label: '销售订单号',
  862. prop: 'orderNo',
  863. disabled: true,
  864. rules: [
  865. {
  866. required: true,
  867. message: ' ',
  868. trigger: 'blur'
  869. }
  870. ]
  871. }, {
  872. label: '主订单号',
  873. prop: 'morderNo',
  874. rules: [
  875. {
  876. required: true,
  877. message: ' ',
  878. trigger: 'blur'
  879. }
  880. ]
  881. }, {
  882. label: '发货地址',
  883. prop: 'shippingAddress',
  884. rules: [
  885. {
  886. required: true,
  887. message: ' ',
  888. trigger: 'blur'
  889. }
  890. ]
  891. }, {
  892. label: '客户全称',
  893. prop: 'corpId',
  894. rules: [
  895. {
  896. required: true,
  897. message: ' ',
  898. trigger: 'blur'
  899. }
  900. ]
  901. }, {
  902. label: '付款方式',
  903. prop: 'paymentType',
  904. rules: [
  905. {
  906. required: true,
  907. message: ' ',
  908. trigger: 'blur'
  909. }
  910. ]
  911. }, {
  912. label: '到货地址',
  913. prop: 'arrivalAddress',
  914. rules: [
  915. {
  916. required: true,
  917. message: ' ',
  918. trigger: 'blur'
  919. }
  920. ]
  921. }, {
  922. label: '包装要求',
  923. prop: 'packageRemarks',
  924. rules: [
  925. {
  926. required: true,
  927. message: ' ',
  928. trigger: 'blur'
  929. }
  930. ]
  931. }, {
  932. label: '运费',
  933. prop: 'oceanFreight',
  934. rules: [
  935. {
  936. required: true,
  937. message: ' ',
  938. trigger: 'blur'
  939. }
  940. ]
  941. }, {
  942. label: '银行帐号',
  943. prop: 'banks',
  944. rules: [
  945. {
  946. required: true,
  947. message: ' ',
  948. trigger: 'blur'
  949. }
  950. ]
  951. }, {
  952. label: '要求发货日期',
  953. prop: 'requiredDeliveryDate',
  954. type: 'datetime',
  955. rules: [
  956. {
  957. required: true,
  958. message: ' ',
  959. trigger: 'blur'
  960. }
  961. ]
  962. }, {
  963. label: '要求到货日期',
  964. prop: 'requiredArrivalDate',
  965. type: 'datetime',
  966. rules: [
  967. {
  968. required: true,
  969. message: ' ',
  970. trigger: 'blur'
  971. }
  972. ]
  973. }, {
  974. label: '公司户头',
  975. prop: 'banksAccountName',
  976. rules: [
  977. {
  978. required: false,
  979. message: ' ',
  980. trigger: 'blur'
  981. }
  982. ]
  983. }, {
  984. label: "订单备注",
  985. type: 'textarea',
  986. span: 24,
  987. prop: "orderRemark",
  988. mock: {
  989. type: 'county'
  990. }
  991. }
  992. ]
  993. },
  994. paymentOption: [],
  995. statusOption: [],
  996. // 费用信息排序的最大值
  997. maxFeeNum: 0,
  998. maxGoodsNum: 0,
  999. oldForm: {
  1000. orderStatus: "录入"
  1001. },
  1002. oldGoodsList: [],
  1003. oldFeesList: [],
  1004. oldUploadList: [],
  1005. }
  1006. },
  1007. //初始化查询
  1008. async created() {
  1009. this.customerContact = await this.getColumnData(this.getColumnName(15), customerContact);
  1010. this.advantageProject = await this.getColumnData(this.getColumnName(16), advantageProject);
  1011. this.getWorkDicts("payment_term").then(res => {
  1012. this.paymentOption = res.data.data
  1013. })
  1014. this.getWorkDicts("order_status").then(res => {
  1015. this.statusOption = res.data.data
  1016. })
  1017. this.$set(this.form, 'orderStatus', '录入')
  1018. // this.optionPolicy.selectable = function(row, index) {
  1019. // return false
  1020. // }
  1021. // this.customerBuyFree.selectable = function(row, index) {
  1022. // return false
  1023. // }
  1024. if (this.detailData.id) {
  1025. // let id = this.$route.query.id.replace(/\"/g, "")
  1026. this.queryData(this.detailData.id)
  1027. }
  1028. if (this.detailData.copyId) {
  1029. // let id = this.$route.query.copyId.replace(/\"/g, "")
  1030. this.queryData(this.detailData.copyId, true)
  1031. }
  1032. },
  1033. watch: {
  1034. // '$route'(to, from) {
  1035. // console.log(to, from);
  1036. // if (this.$route.query.id) {
  1037. // let id = JSON.parse(this.$route.query.id).replace(/\"/g, "")
  1038. // detail(id).then(res => {
  1039. // console.log(res.data.data)
  1040. // this.form = res.data.data;
  1041. // });
  1042. // } else {
  1043. // this.form = {}
  1044. // }
  1045. // },
  1046. },
  1047. methods: {
  1048. queryData(id, isCopy = false){
  1049. detail(id).then(res => {
  1050. console.log(res.data.data)
  1051. this.form = res.data.data;
  1052. this.contactsData = this.form.orderItemsList
  1053. this.advantageProjectData = this.form.orderFeesList
  1054. this.bankOfDepositData = this.form.orderFilesList
  1055. this.configuration.dicData = this.form.corpName
  1056. if (this.form.belongToCorpList) {
  1057. this.configuration.dicData = this.configuration.dicData.concat(this.form.belongToCorpList)
  1058. }
  1059. let feesData = []
  1060. this.form.orderFeesList.forEach(item => {
  1061. let a = {
  1062. cname: item.corpName,
  1063. id: item.corpId
  1064. }
  1065. feesData.push(a)
  1066. })
  1067. this.configuration.dicData = this.configuration.dicData.concat(feesData)
  1068. // 去重
  1069. this.removeRepeat()
  1070. delete this.form.orderItemsList
  1071. delete this.form.orderFeesList
  1072. delete this.form.orderFilesList
  1073. delete this.form.corpName
  1074. delete this.form.belongToCorpList
  1075. // 获取最大值
  1076. let num = []
  1077. this.advantageProjectData.forEach(item => {
  1078. num.push(item.sort)
  1079. })
  1080. if (num.length == 0) {
  1081. this.maxFeeNum = 0;
  1082. } else {
  1083. this.maxFeeNum = num.reduce((a, b) => {
  1084. return b > a? b: a;
  1085. })
  1086. }
  1087. let goodsNum = []
  1088. let purchaseAmount = 0
  1089. this.contactsData.forEach(item => {
  1090. goodsNum.push(item.sort)
  1091. purchaseAmount += Number(item.purchaseAmount)
  1092. })
  1093. if (Number(this.form.grossProfit) != 0) {
  1094. this.form.grossProfitRate = (((Number(this.form.grossProfit) - Number(purchaseAmount)) / Number(this.form.grossProfit)) * 100).toFixed(2)
  1095. } else {
  1096. this.form.grossProfitRate = '0.00'
  1097. }
  1098. if (goodsNum.length == 0) {
  1099. this.maxGoodsNum = 0;
  1100. } else {
  1101. this.maxGoodsNum = goodsNum.reduce((a, b) => {
  1102. return b > a? b: a;
  1103. })
  1104. }
  1105. this.oldForm = Object.assign({}, this.form)
  1106. this.oldGoodsList = []
  1107. this.oldFeesList = []
  1108. this.oldUploadList = []
  1109. this.oldGoodsList = this.oldGoodsList.concat(this.contactsData)
  1110. console.log(this.oldGoodsList)
  1111. this.oldFeesList = this.oldFeesList.concat(this.advantageProjectData)
  1112. this.oldUploadList = this.oldUploadList.concat(this.bankOfDepositData)
  1113. if (isCopy) {
  1114. this.$set(this.form, 'orderStatus', '录入')
  1115. delete this.form.id
  1116. this.contactsData.forEach(item => {
  1117. delete item.id
  1118. delete item.pid
  1119. })
  1120. this.advantageProjectData.forEach(item => {
  1121. delete item.id
  1122. delete item.pid
  1123. })
  1124. this.bankOfDepositData.forEach(item => {
  1125. delete item.id
  1126. delete item.pid
  1127. })
  1128. }
  1129. });
  1130. },
  1131. // 复制新单
  1132. copyOrder() {
  1133. this.queryData(this.form.id, true)
  1134. },
  1135. //点击行可编辑
  1136. handleRowClick(row, event, column) {
  1137. },
  1138. //商品编辑
  1139. rowCell(row, index) {
  1140. if (row.$cellEdit) {
  1141. if (Number(row.orderQuantity) < Number(row.actualQuantity)) {
  1142. return this.$message.error('订货数量不能小于发货数量')
  1143. }
  1144. }
  1145. this.$refs.crudContact.rowCell(row, index)
  1146. },
  1147. //费用编辑
  1148. rowCellTwo(row, index) {
  1149. console.log(row)
  1150. this.$refs.crudProject.rowCell(row, index)
  1151. },
  1152. //费用新增触发
  1153. costIncrease() {
  1154. this.dialogCost = !this.dialogCost
  1155. this.choiceData = false
  1156. },
  1157. //商品新增触发
  1158. commoditySelection() {
  1159. this.dialogVisible = !this.dialogVisible
  1160. this.tableData = []
  1161. this.commodityData = false
  1162. },
  1163. //政策价格导入
  1164. policy() {
  1165. this.policyDialog = !this.policyDialog
  1166. },
  1167. getShipmentD() {
  1168. if (this.$store.getters.inStatus) {
  1169. this.$alert("发货单存在,请保存发货单再进行操作", "温馨提示", {
  1170. confirmButtonText: "确定",
  1171. type: "warning",
  1172. callback: action => {
  1173. console.log(action);
  1174. }
  1175. });
  1176. } else {
  1177. this.generateShipmentD();
  1178. }
  1179. },
  1180. //生成发货单
  1181. generateShipmentD() {
  1182. let lsit = []
  1183. for (let item in this.selection) {
  1184. if (!this.selection[item].id) {
  1185. return this.$confirm('商品信息有未保存数据, 是否立即保存?', '提示', {
  1186. confirmButtonText: '确定',
  1187. cancelButtonText: '取消',
  1188. type: 'warning'
  1189. }).then(() => {
  1190. this.editCustomer(false)
  1191. }).catch(() => {
  1192. this.$message({
  1193. type: 'info',
  1194. message: '已取消'
  1195. });
  1196. });
  1197. } else {
  1198. lsit.push(this.selection[item].id)
  1199. }
  1200. }
  1201. let data = {
  1202. id: this.form.id,
  1203. orderItemIds: lsit
  1204. }
  1205. generateShipment(data).then(res => {
  1206. this.$router.$avueRouter.closeTag("/businessManagement/deliveryNotice/index");
  1207. this.$router.push({
  1208. path: "/businessManagement/deliveryNotice/index",
  1209. query: {form: JSON.stringify(res.data.data)},
  1210. });
  1211. })
  1212. },
  1213. //商品选中触发
  1214. productSelection(selection) {
  1215. this.selection = selection
  1216. },
  1217. //点击费用明细选择触发
  1218. choice(row) {
  1219. this.dialogCost = !this.dialogCost
  1220. this.choiceData = true
  1221. console.log(row)
  1222. this.choiceIndex = row.$index
  1223. },
  1224. // 去重
  1225. removeRepeat() {
  1226. let obj = []
  1227. this.configuration.dicData = this.configuration.dicData.reduce((current,next) => {
  1228. obj[next.id] ? '': obj[next.id] = true && current.push(next)
  1229. return current
  1230. }, [])
  1231. },
  1232. //
  1233. receiveList(data){
  1234. this.configuration.dicData = this.configuration.dicData.concat(data)
  1235. this.removeRepeat()
  1236. },
  1237. //点击商品明细选择触发
  1238. commodityChoice(row) {
  1239. this.dialogVisible = !this.dialogVisible
  1240. this.commodityData = true
  1241. console.log(row)
  1242. this.choiceIndexT = row.$index
  1243. },
  1244. //导入商品触发
  1245. importChoice() {
  1246. // this.contactsData = this.contactsData.concat(this.tableData)
  1247. if (this.tableData.length === 1) {
  1248. this.contactsData[this.choiceIndexT].cname = this.tableData[0].cname
  1249. this.contactsData[this.choiceIndexT].code = this.tableData[0].code
  1250. this.contactsData[this.choiceIndexT].typeno = this.tableData[0].typeno
  1251. this.contactsData[this.choiceIndexT].specificationAndModel = this.tableData[0].specificationAndModel
  1252. this.contactsData[this.choiceIndexT].itemId = this.tableData[0].id
  1253. this.contactsData[this.choiceIndexT].priceCategory = this.tableData[0].goodsTypeName
  1254. selectGoodsNum({
  1255. goodsId: this.tableData[0].id,
  1256. typeno: this.tableData[0].typeno
  1257. }).then(res => {
  1258. this.contactsData[this.choiceIndexT].storageQuantity = res.data.data
  1259. })
  1260. }
  1261. this.dialogVisible = !this.dialogVisible
  1262. this.commodityData = false
  1263. },
  1264. //费用编辑导入触发
  1265. choiceCost() {
  1266. if (this.tableDataCost.length === 1) {
  1267. this.advantageProjectData[this.choiceIndex].feeName = this.tableDataCost[0].cname
  1268. this.advantageProjectData[this.choiceIndex].itemId = this.tableDataCost[0].id
  1269. this.advantageProjectData[this.choiceIndex].code = this.tableDataCost[0].code
  1270. }
  1271. this.dialogCost = !this.dialogCost
  1272. this.choiceData = false
  1273. },
  1274. //费用导入触发
  1275. importCost() {
  1276. // this.advantageProjectForm = this.advantageProjectForm.concat(this.tableDataCost)
  1277. if (this.tableDataCost.length > 0) {
  1278. for (let item in this.tableDataCost) {
  1279. console.log(this.tableDataCost[item])
  1280. this.tableDataCost[item].itemId = this.tableDataCost[item].id
  1281. this.tableDataCost[item].feeName = this.tableDataCost[item].cname
  1282. this.$set(this.tableDataCost[item], 'amount', 0)
  1283. this.$set(this.tableDataCost[item], 'settlmentAmount', 0)
  1284. this.tableDataCost[item].sort = this.maxFeeNum + 1
  1285. this.maxFeeNum++
  1286. delete this.tableDataCost[item].id
  1287. this.$refs.crudProject.rowCellAdd(this.tableDataCost[item]);
  1288. this.$refs.crudProject.rowCell(this.tableDataCost[item], this.advantageProjectForm.length - 1)
  1289. }
  1290. }
  1291. this.tableDataCost = []
  1292. this.dialogCost = false
  1293. },
  1294. //确认导入触发
  1295. importGoods() {
  1296. // this.contactsData = this.contactsData.concat(this.tableData)
  1297. if (this.tableData.length > 0) {
  1298. for (let item in this.tableData) {
  1299. // this.$set(this.tableData[item], 'storageQuantity', 0)
  1300. selectGoodsNum({
  1301. goodsId: this.tableData[item].id,
  1302. typeno: this.tableData[item].typeno
  1303. }).then(res => {
  1304. this.tableData[item].priceCategory = this.tableData[item].goodsTypeName
  1305. this.tableData[item].storageQuantity = res.data.data
  1306. delete this.tableData[item].goodsTypeName
  1307. this.tableData[item].itemId = this.tableData[item].id
  1308. this.$set(this.tableData[item], 'specificationAndModel', this.tableData[item].specificationAndModel)
  1309. this.$set(this.tableData[item], 'priceType', '一般')
  1310. this.$set(this.tableData[item], 'orderQuantity', 0)
  1311. this.$set(this.tableData[item], 'actualQuantity', 0)
  1312. this.tableData[item].price = 0
  1313. this.tableData[item].amount = 0
  1314. this.tableData[item].sort = this.maxGoodsNum + 1
  1315. this.maxGoodsNum++
  1316. delete this.tableData[item].id
  1317. this.$refs.crudContact.rowCellAdd(this.tableData[item]);
  1318. this.$refs.crudContact.rowCell(this.tableData[item], this.contactsData.length - 1)
  1319. })
  1320. }
  1321. this.dialogVisible = false
  1322. }
  1323. },
  1324. closeGoods() {
  1325. this.treeDataGoods = [];
  1326. this.treeDeptId = "";
  1327. },
  1328. closeFees() {
  1329. this.treeDeptIdCost = "";
  1330. this.treeData = [];
  1331. },
  1332. closePolicy() {
  1333. this.treePolicyId = '';
  1334. this.dataPolicy = [];
  1335. this.policyForm = {};
  1336. this.contactsDataBuyFree = [];
  1337. this.policyData = []
  1338. this.policyDataTwo = []
  1339. },
  1340. //选中触发
  1341. selectionChange(list) {
  1342. this.tableData = list
  1343. },
  1344. //费用选中触发
  1345. selectionChangeCost(list) {
  1346. this.tableDataCost = list
  1347. },
  1348. //导入页左商品类型查询
  1349. nodeClick(data) {
  1350. this.treeDeptId = data.id;
  1351. this.page.currentPage = 1;
  1352. this.onLoad(this.page);
  1353. },
  1354. //导入页销售政策查询
  1355. policyNodeClick(data) {
  1356. this.treePolicyId = data.id
  1357. // detailList(data.id).then(res => {
  1358. // //特价促销
  1359. // this.dataPolicy = res.data.data.specialItemList
  1360. // //买赠促销
  1361. // this.contactsDataBuyFree = res.data.data.presentItemList
  1362. // })
  1363. this.policyOnLoad()
  1364. },
  1365. //导入页左费用类型查询
  1366. nodeClickCost(data) {
  1367. this.treeDeptIdCost = data.id;
  1368. this.pageCost.currentPage = 1;
  1369. this.onLoadCost(this.pageCost);
  1370. },
  1371. //刷新触发
  1372. refreshChange() {
  1373. this.page.currentPage = 1;
  1374. this.onLoad(this.page);
  1375. },
  1376. //销售政策特价促销选中触发
  1377. selectionChangePolicy(list) {
  1378. console.log(list)
  1379. this.policyData = this.policyData.concat(list)
  1380. // this.policyData.forEach(item => {
  1381. // this.$set(item, 'price', item.specialOffer)
  1382. // })
  1383. if (this.policyData.length > 0) {
  1384. this.customerBuyFree.selection = false
  1385. } else {
  1386. this.customerBuyFree.selection = true
  1387. }
  1388. },
  1389. //销售政策买赠促销选中触发
  1390. selectionChangePolicyTwo(list) {
  1391. this.policyDataTwo = this.policyDataTwo.concat(list)
  1392. // this.policyDataTwo.forEach(item => {
  1393. // this.$set(item, 'price', item.salesPrice)
  1394. // })
  1395. if (this.policyDataTwo.length > 0) {
  1396. this.optionPolicy.selection = false
  1397. } else {
  1398. this.optionPolicy.selection = true
  1399. }
  1400. },
  1401. //导入商品政策
  1402. importPolicy() {
  1403. let list = this.policyData.concat(this.policyDataTwo)
  1404. for (let item in list) {
  1405. selectGoodsNum({
  1406. goodsId: list[item].id,
  1407. typeno: list[item].typeno
  1408. }).then(res => {
  1409. this.$set(list[item], 'storageQuantity', res.data.data)
  1410. })
  1411. if (this.policyData.length > 0) {
  1412. this.$set(list[item], 'price', list[item].specialOffer)
  1413. } else {
  1414. this.$set(list[item], 'price', list[item].salesPrice)
  1415. }
  1416. this.$set(list[item], 'actualQuantity', 0)
  1417. this.$set(list[item], 'orderQuantity', 0)
  1418. this.$set(list[item], 'amount', 0)
  1419. this.$set(list[item], 'priceCategory', list[item].productCategory)
  1420. this.$set(list[item], 'priceType', this.policyForm.cname)
  1421. this.$set(list[item], 'cname', list[item].productCategory)
  1422. this.$set(list[item], 'sort', this.maxGoodsNum + 1)
  1423. this.maxGoodsNum++
  1424. this.$refs.crudContact.rowCellAdd(list[item]);
  1425. this.$refs.crudContact.rowCell(list[item], this.contactsData.length - 1)
  1426. }
  1427. this.policyDialog = false
  1428. },
  1429. //费用刷新触发
  1430. refreshChangeCost() {
  1431. this.treeDeptIdCost = '';
  1432. this.pageCost.currentPage = 1;
  1433. this.onLoadCost(this.pageCost);
  1434. },
  1435. //新增商品信息保存触发
  1436. rowSave(row, done, loading) {
  1437. console.log(row)
  1438. console.log(this.contactsData)
  1439. // this.contactsData.push(row)
  1440. done()
  1441. },
  1442. //修改商品信息触发
  1443. rowUpdate(row, index, done, loading) {
  1444. done(row);
  1445. },
  1446. //删除商品信息触发
  1447. rowDel(row, index, donerowDel) {
  1448. this.$confirm("确定将选择数据删除?", {
  1449. confirmButtonText: "确定",
  1450. cancelButtonText: "取消",
  1451. type: "warning"
  1452. }).then(() => {
  1453. //商品判断是否需要调用删除接口
  1454. if (row.id) {
  1455. corpsattn(row.id).then(res => {
  1456. this.$message({
  1457. type: "success",
  1458. message: "操作成功!"
  1459. });
  1460. this.contactsData.splice(index, 1);
  1461. })
  1462. } else {
  1463. this.$message({
  1464. type: "success",
  1465. message: "操作成功!"
  1466. });
  1467. this.contactsData.splice(index, 1);
  1468. }
  1469. })
  1470. },
  1471. //新增费用明细保存触发
  1472. rowSaveProject(row, done, loading) {
  1473. // this.advantageProjectData.push(row)
  1474. done()
  1475. },
  1476. //修改费用明细触发
  1477. rowUpdateProject(row, index, done, loading) {
  1478. done(row);
  1479. },
  1480. policyOnLoad(params = {}) {
  1481. // this.policyLoading = true;
  1482. detailList(this.treePolicyId).then(res => {
  1483. this.policyForm = res.data.data
  1484. //特价促销
  1485. this.dataPolicy = res.data.data.specialItemList
  1486. //买赠促销
  1487. this.contactsDataBuyFree = res.data.data.presentItemList
  1488. })
  1489. },
  1490. //商品列表查询
  1491. onLoad(page, params = {}) {
  1492. this.loading = true;
  1493. getList(page.currentPage, page.pageSize, Object.assign(params, this.query), this.treeDeptId).then(res => {
  1494. console.log(res)
  1495. const data = res.data.data;
  1496. this.page.total = data.total;
  1497. this.data = data.records;
  1498. this.loading = false;
  1499. });
  1500. },
  1501. //费用查询
  1502. onLoadCost(page, params = {}) {
  1503. this.loadingCost = true;
  1504. let queryParams = Object.assign({}, params, {
  1505. pageSize: page.pageSize,
  1506. pageNum: page.currentPage,
  1507. parentId: 0,
  1508. feesTypeId: this.treeDeptIdCost
  1509. })
  1510. customerList(queryParams).then(res => {
  1511. console.log(res)
  1512. const data = res.data.data;
  1513. this.pageCost.total = data.total;
  1514. this.dataCost = data.records;
  1515. this.loadingCost = false;
  1516. });
  1517. },
  1518. //删除费用明细触发
  1519. rowDelProject(row, index, donerowDel) {
  1520. this.$confirm("确定将选择数据删除?", {
  1521. confirmButtonText: "确定",
  1522. cancelButtonText: "取消",
  1523. type: "warning"
  1524. }).then(() => {
  1525. //费用判断是否需要调用删除接口
  1526. if (row.id) {
  1527. corpsitem(row.id).then(res => {
  1528. this.$message({
  1529. type: "success",
  1530. message: "操作成功!"
  1531. });
  1532. this.advantageProjectData.splice(index, 1);
  1533. })
  1534. } else {
  1535. this.$message({
  1536. type: "success",
  1537. message: "操作成功!"
  1538. });
  1539. this.advantageProjectData.splice(index, 1);
  1540. }
  1541. })
  1542. },
  1543. //新增附件上传保存触发
  1544. rowSaveBankOfDeposit(row, done, loading) {
  1545. this.bankOfDepositData.push(row)
  1546. done()
  1547. },
  1548. //修改附件上传触发
  1549. rowUpdateBankOfDeposit(row, index, done, loading) {
  1550. done(row);
  1551. },
  1552. //删除附件上传触发
  1553. rowDelBankOfDeposit(row, index, donerowDel) {
  1554. this.$confirm("确定将选择数据删除?", {
  1555. confirmButtonText: "确定",
  1556. cancelButtonText: "取消",
  1557. type: "warning"
  1558. }).then(() => {
  1559. //附件判断是否需要调用删除接口
  1560. if (row.id) {
  1561. corpsbank(row.id).then(res => {
  1562. this.$message({
  1563. type: "success",
  1564. message: "操作成功!"
  1565. });
  1566. this.bankOfDepositData.splice(index, 1);
  1567. })
  1568. } else {
  1569. this.$message({
  1570. type: "success",
  1571. message: "操作成功!"
  1572. });
  1573. this.bankOfDepositData.splice(index, 1);
  1574. }
  1575. })
  1576. },
  1577. uploadAfter(res, done) {
  1578. if (res.originalName) {
  1579. this.bankOfDepositForm.fileName = this.bankOfDepositForm.fileName
  1580. ? this.bankOfDepositForm.fileName
  1581. : res.originalName;
  1582. }
  1583. done();
  1584. },
  1585. //修改提交触发
  1586. editCustomer(isBack = false) {
  1587. this.$refs["form"].validate((valid) => {
  1588. if (valid) {
  1589. for (let item in this.contactsData) {
  1590. if (Number(this.contactsData[item].orderQuantity) < Number(this.contactsData[item].actualQuantity)) {
  1591. return this.$message.error('商品信息第'+ (parseInt(item) + 1) + '行订货数量不能小于发货数量')
  1592. }
  1593. }
  1594. // 计算毛利额
  1595. this.$set(this.form, 'grossProfit', 0)
  1596. this.$set(this.form, 'orderAmount', 0)
  1597. this.contactsData.forEach(item => {
  1598. this.form.grossProfit += Number(item.amount)
  1599. this.form.orderAmount += Number(item.amount)
  1600. })
  1601. if (this.form.orderAmount && this.form.overPayment) {
  1602. this.form.debitAmount = Number(this.form.orderAmount) - Number(this.form.overPayment)
  1603. }
  1604. if (this.form.orderAmount && this.form.settlmentAmount) {
  1605. this.$set(this.form, "balanceAmount", (Number(this.form.orderAmount) - Number(this.form.settlmentAmount)).toFixed(2));
  1606. }
  1607. // 计算毛利率
  1608. // if (this.form.orderAmount) {
  1609. // this.form.grossProfitRate = ((Number(this.form.grossProfit) / Number(this.form.orderAmount)) * 100).toFixed(2)
  1610. // }
  1611. // 计算应收账款
  1612. // this.$set(this.form, 'debitAmount', 0)
  1613. // this.contactsData.forEach(item => {
  1614. // this.form.debitAmount += Number(item.amount)
  1615. // })
  1616. //商品信息
  1617. this.form.orderItemsList = this.contactsData
  1618. this.form.orderFeesList = this.advantageProjectData
  1619. this.form.orderFilesList = this.bankOfDepositData
  1620. if (typeof this.form.corpsTypeId == 'object') {
  1621. this.form.corpsTypeId = this.form.corpsTypeId.join(",")
  1622. }
  1623. this.form.billType = 'XS'
  1624. this.disabled = true
  1625. typeSave(this.form).then(res => {
  1626. this.$message({type: "success", message: this.form.id ? "修改成功!" : "新增成功!"});
  1627. this.disabled = false
  1628. if (isBack) {
  1629. //成功关闭此页面回到列表页
  1630. this.$emit("goBack");
  1631. } else {
  1632. this.queryData(res.data.data.id)
  1633. }
  1634. })
  1635. } else {
  1636. return false;
  1637. }
  1638. });
  1639. },
  1640. // 计算应收未收款
  1641. computedCost() {
  1642. // 销售金额
  1643. let orderAmount = 0;
  1644. // 已收款
  1645. let settlmentAmount = 0;
  1646. if (this.form.orderAmount) {
  1647. orderAmount = this.form.orderAmount
  1648. }
  1649. if (this.form.settlmentAmount) {
  1650. settlmentAmount = this.form.settlmentAmount
  1651. }
  1652. this.$set(this.form, "balanceAmount", (Number(orderAmount) - Number(settlmentAmount)).toFixed(2));
  1653. },
  1654. quantityChange(row) {
  1655. if (!row.orderQuantity) {
  1656. row.orderQuantity = 0;
  1657. } else {
  1658. // row.amount = _.multiply(row.price, row.orderQuantity).toFixed(2);
  1659. row.amount = (row.price * row.orderQuantity).toFixed(2)
  1660. }
  1661. },
  1662. priceChange(row) {
  1663. if (!row.price) {
  1664. row.price = 0;
  1665. } else {
  1666. row.amount = (row.price * row.orderQuantity).toFixed(2)
  1667. }
  1668. },
  1669. //返回列表
  1670. backToList() {
  1671. console.log(contrastObj(this.form, this.oldForm))
  1672. console.log(contrastList(this.contactsData, this.oldGoodsList))
  1673. console.log(contrastList(this.advantageProjectData, this.oldFeesList))
  1674. console.log(contrastList(this.bankOfDepositData, this.oldUploadList))
  1675. if (contrastObj(this.form, this.oldForm) ||
  1676. contrastList(this.contactsData, this.oldGoodsList) ||
  1677. contrastList(this.advantageProjectData, this.oldFeesList) ||
  1678. contrastList(this.bankOfDepositData, this.oldUploadList)
  1679. ) {
  1680. this.$confirm("数据发生变化未有提交记录, 是否提交?", "提示", {
  1681. confirmButtonText: "确定",
  1682. cancelButtonText: "取消",
  1683. type: "warning"
  1684. }).then(() => {
  1685. this.editCustomer(true)
  1686. }).catch(() => {
  1687. this.$emit("goBack");
  1688. })
  1689. } else {
  1690. this.$emit("goBack");
  1691. }
  1692. },
  1693. // 保存列设置
  1694. async saveColumn(name) {
  1695. /**
  1696. * 已定义全局方法,直接使用,saveColumnData保存列数据方法,参数传值(表格名称,当前表格的option数据)
  1697. * 已定义全局方法,直接使用,getColumnName方法用来获取枚举值,参数根据自己定义的code值获取中文名
  1698. * 一定要执行异步操作,要等接口成功返回,才能执行下一行代码
  1699. */
  1700. if (name == 'goods') {
  1701. const inSave = await this.saveColumnData(
  1702. this.getColumnName(15),
  1703. this.customerContact
  1704. );
  1705. if (inSave) {
  1706. this.$message.success("保存成功");
  1707. //关闭窗口
  1708. this.$refs.crudContact.$refs.dialogColumn.columnBox = false;
  1709. }
  1710. } else if (name === 'fees') {
  1711. const inSave = await this.saveColumnData(
  1712. this.getColumnName(16),
  1713. this.advantageProject
  1714. );
  1715. if (inSave) {
  1716. this.$message.success("保存成功");
  1717. //关闭窗口
  1718. this.$refs.crudProject.$refs.dialogColumn.columnBox = false;
  1719. }
  1720. }
  1721. },
  1722. }
  1723. }
  1724. </script>
  1725. <style lang="scss" scoped>
  1726. .customer-head {
  1727. position: fixed;
  1728. top: 105px;
  1729. width: 100%;
  1730. margin-left: -10px;
  1731. height: 62px;
  1732. background: #ffffff;
  1733. box-shadow: 0 4px 12px 0px rgba(232, 232, 235, 1);
  1734. z-index: 999;
  1735. /* display: flex;
  1736. justify-content: left; */
  1737. }
  1738. .customer-back {
  1739. cursor: pointer;
  1740. line-height: 62px;
  1741. font-size: 16px;
  1742. color: #323233;
  1743. font-weight: 400;
  1744. }
  1745. .back-icon {
  1746. line-height: 64px;
  1747. font-size: 20px;
  1748. margin-right: 8px;
  1749. }
  1750. .add-customer-btn {
  1751. position: fixed;
  1752. right: 36px;
  1753. top: 115px;
  1754. }
  1755. ::v-deep .el-form-item {
  1756. margin-bottom: 0;
  1757. }
  1758. .el-dialogDeep {
  1759. ::v-deep .el-dialog {
  1760. margin: 1vh auto 0 !important;
  1761. padding-bottom: 10px !important;
  1762. .el-dialog__body, .el-dialog__footer {
  1763. padding-bottom: 0 !important;
  1764. padding-top: 0 !important;
  1765. }
  1766. }
  1767. }
  1768. .print-div {
  1769. color: #000;
  1770. }
  1771. .print_table {
  1772. table {
  1773. border-right: 1px solid #000;
  1774. border-bottom: 1px solid #000;
  1775. font-size: 12px;
  1776. margin-bottom: 5px;
  1777. }
  1778. table td {
  1779. border-left: 1px solid #000;
  1780. border-top: 1px solid #000;
  1781. vertical-align: middle;
  1782. padding: 2px;
  1783. text-align: center;
  1784. }
  1785. }
  1786. .table {
  1787. border-collapse: collapse;
  1788. border-spacing: 0;
  1789. background-color: transparent;
  1790. display: table;
  1791. width: 99%;
  1792. max-width: 100%;
  1793. margin: 0 auto;
  1794. }
  1795. .table td {
  1796. text-align: left;
  1797. vertical-align: middle;
  1798. font-size: 14px;
  1799. color: #000000;
  1800. padding: 10.5px 0 10.5px 30px;
  1801. //border: 1px solid #000;
  1802. }
  1803. </style>