detailsPageEdit.vue 58 KB

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