detailsPageEdit.vue 77 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363
  1. <template>
  2. <div class="borderless" v-loading="pageLoading">
  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. <div class="add-customer-btn">
  11. <el-button
  12. v-if="detailData.seeDisabled"
  13. size="small"
  14. @click="detailData.seeDisabled = false"
  15. type="primary"
  16. >编辑</el-button>
  17. <el-button
  18. class="el-button--small-yh"
  19. type="warning"
  20. :disabled="detailData.seeDisabled"
  21. size="small"
  22. @click="applySettlement"
  23. >生成账单</el-button>
  24. <el-button
  25. class="el-button--small-yh"
  26. type="primary"
  27. :disabled="detailData.seeDisabled"
  28. size="small"
  29. @click="saveSell"
  30. >生成采购单</el-button>
  31. <el-button
  32. class="el-button--small-yh"
  33. type="success" @click="copyOrder"
  34. size="small"
  35. :disabled="detailData.seeDisabled || !this.form.id">
  36. 复制新单
  37. </el-button>
  38. <el-button
  39. class="el-button--small-yh"
  40. type="primary"
  41. :disabled="disabled || detailData.seeDisabled"
  42. :loading="saveLoading"
  43. size="small"
  44. @click="editCustomer(false)"
  45. >{{ form.id ? '确认修改' : '确认新增' }}
  46. </el-button>
  47. </div>
  48. </div>
  49. <div class="customer-main">
  50. <el-form :model="form" ref="form" label-width="130px" class="demo-ruleForm">
  51. <containerTitle title="基础资料"></containerTitle>
  52. <basic-container style="margin-bottom: 10px">
  53. <el-row>
  54. <el-col v-for="(item,index) in basicData.column" :key="index" :span="item.span?item.span:8">
  55. <el-form-item :label="item.label" :prop="item.prop" :rules="item.rules">
  56. <el-date-picker v-if="item.type === 'datetime'" style="width: 100%;" v-model="form[item.prop]"
  57. size="small" type="datetime" placeholder="选择日期" value-format="yyyy-MM-dd HH:mm:ss" :disabled="detailData.seeDisabled"/>
  58. <el-date-picker v-else-if="item.type === 'date'" style="width: 100%;" v-model="form[item.prop]"
  59. size="small" type="date" placeholder="选择日期"
  60. value-format="yyyy-MM-dd HH:mm:ss"
  61. :disabled="detailData.seeDisabled"/>
  62. <selectComponent v-else-if="item.prop === 'corpId'" v-model="form[item.prop]"
  63. :configuration="configuration" style="width: 100%" :disabled="detailData.seeDisabled"
  64. @getRow="getCorpRow"
  65. />
  66. <!-- 所属公司带出银行信息-->
  67. <selectComponent v-else-if="item.prop === 'belongToCorpId'"
  68. v-model="form[item.prop]" :configuration="companyConfiguration"
  69. style="width: 100%"
  70. :disabled="detailData.seeDisabled"
  71. @returnBack="returnBack"/>
  72. <!-- 生产工厂-->
  73. <selectComponent v-else-if="item.prop === 'productionPlant'"
  74. v-model="form[item.prop]" :configuration="plantConfiguration"
  75. style="width: 100%"
  76. :disabled="detailData.seeDisabled"
  77. @getRow="getPlantRow"/>
  78. <el-select v-else-if="item.prop === 'paymentType'" v-model="form[item.prop]" placeholder="请选择" clearable filterable style="width: 100%" size="small" :disabled="detailData.seeDisabled">
  79. <el-option v-for="(item,index) in paymentOption" :key="index" :label="item.dictValue" :value="item.dictValue"></el-option>
  80. </el-select>
  81. <el-select v-else-if="item.prop === 'banks'"
  82. v-model="form[item.prop]" placeholder="请选择"
  83. clearable
  84. filterable
  85. allow-create
  86. default-first-option
  87. size="small"
  88. style="width: 100%;"
  89. @change="banksChange"
  90. :disabled="detailData.seeDisabled">
  91. <el-option v-for="(item,index) in bankList" :key="index" :label="item.accountNo" :value="item.accountNo"></el-option>
  92. </el-select>
  93. <el-input
  94. v-else-if="item.type == 'number'"
  95. placeholder="请输入"
  96. v-input-limit="2"
  97. size="small"
  98. :disabled="item.disabled || detailData.seeDisabled"
  99. v-model="form[item.prop]"
  100. />
  101. <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>
  102. <el-input type="age" v-else v-model="form[item.prop]" size="small" autocomplete="off" :disabled="item.disabled || detailData.seeDisabled" clearable></el-input>
  103. </el-form-item>
  104. </el-col>
  105. </el-row>
  106. </basic-container>
  107. <containerTitle title="发货信息"></containerTitle>
  108. <basic-container style="margin-bottom: 10px">
  109. <el-row>
  110. <el-col v-for="(item,index) in contactInformation.column" :key="index" :span="item.span?item.span:8">
  111. <el-form-item :label="item.label" :prop="item.prop" :rules="item.rules">
  112. <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"/>
  113. <el-date-picker v-else-if="item.type === 'date'" style="width: 100%;" v-model="form[item.prop]"
  114. size="small" type="date" placeholder="选择日期"
  115. value-format="yyyy-MM-dd HH:mm:ss"
  116. :disabled="detailData.seeDisabled"/>
  117. <el-input
  118. v-else-if="(item.prop === 'advancePayment') || (item.prop === 'settlmentAmount') || (item.prop === 'overPayment')"
  119. v-model="form[item.prop]" size="small" autocomplete="off"
  120. @change="computedCost"
  121. :disabled="detailData.seeDisabled"
  122. v-input-limit="2"
  123. ></el-input>
  124. <el-select v-else-if="item.prop === 'orderStatus'" v-model="form[item.prop]" placeholder="请选择" clearable filterable style="width: 100%" size="small" :disabled="detailData.seeDisabled">
  125. <el-option v-for="(item,index) in statusOption" :key="index" :label="item.dictValue" :value="item.dictValue"></el-option>
  126. </el-select>
  127. <el-input type="age" v-else-if="item.prop === 'grossProfitRate'" v-model="form[item.prop]" size="small" autocomplete="off" placeholder="请输入" :disabled="detailData.seeDisabled" v-input-limit="2">
  128. <template slot="append">%</template>
  129. </el-input>
  130. <el-input
  131. v-else-if="item.type == 'number'"
  132. placeholder="请输入"
  133. v-input-limit="2"
  134. size="small"
  135. :disabled="item.disabled || detailData.seeDisabled"
  136. v-model="form[item.prop]"
  137. />
  138. <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>
  139. <el-input v-else type="age" v-model="form[item.prop]" size="small" autocomplete="off" :disabled="item.disabled || detailData.seeDisabled"></el-input>
  140. </el-form-item>
  141. </el-col>
  142. </el-row>
  143. </basic-container>
  144. <containerTitle title="商品信息"></containerTitle>
  145. <basic-container style="margin-bottom: 10px">
  146. <avue-crud
  147. :option="customerContact"
  148. v-model="contactsForm"
  149. :data="contactsData"
  150. ref="crudContact"
  151. @row-save="rowSave"
  152. @row-click="handleRowClick"
  153. @row-update="rowUpdate"
  154. @selection-change="productSelection"
  155. @row-del="rowDel"
  156. @saveColumn="saveColumn('goods')"
  157. >
  158. <template slot="corpId" slot-scope="{ row, index }">
  159. <customer-dialog
  160. v-if="row.$cellEdit"
  161. v-model="row.corpName"
  162. :cropIndex="index"
  163. @getcorpId="getcorpId"
  164. ></customer-dialog>
  165. <span v-else>{{ row.corpName }}</span>
  166. </template>
  167. <template slot="code" slot-scope="{row,index}">
  168. <el-button
  169. type="text"
  170. size="mini"
  171. style="padding:4px 10px;float:left"
  172. @click="commodityChoice(row)"
  173. :disabled="detailData.seeDisabled || !row.$cellEdit">选择</el-button>
  174. <span>{{ row.code }}</span>
  175. </template>
  176. <template slot="purchaseAmount" slot-scope="{ row }">
  177. <el-select
  178. v-if="row.$cellEdit"
  179. v-model="row.purchaseAmount"
  180. @focus="getPurchasePrice(row)"
  181. allow-create
  182. filterable
  183. v-input-limit="2"
  184. >
  185. <el-option
  186. v-for="(item, index) in purchasePriceOption"
  187. :key="index"
  188. :label="item.purchasePrice"
  189. :value="item.purchasePrice"></el-option>
  190. </el-select>
  191. <span v-else>{{ row.purchaseAmount }}</span>
  192. </template>
  193. <template slot="price" slot-scope="{ row }">
  194. <el-select
  195. v-if="row.$cellEdit"
  196. v-model="row.price"
  197. @focus="getMarketPrice(row)"
  198. @input="priceChange(row)"
  199. allow-create
  200. filterable
  201. v-input-limit="2"
  202. >
  203. <el-option
  204. v-for="(item, index) in salesPriceOtion"
  205. :key="index"
  206. :label="item.salesPrice"
  207. :value="item.salesPrice"></el-option>
  208. </el-select>
  209. <span v-else>{{ row.price }}</span>
  210. </template>
  211. <template slot="orderQuantity" slot-scope="{ row }">
  212. <el-input
  213. v-if="row.$cellEdit"
  214. v-model="row.orderQuantity"
  215. oninput='this.value=this.value.replace(/[^\-?\d.]/g,"").replace(/^(\-)*(\d+)\.(\d\d).*$/, "$1$2.$3")'
  216. size="small"
  217. @input="quantityChange(row)"
  218. ></el-input>
  219. <span v-else>{{ row.orderQuantity }}</span>
  220. </template>
  221. <template slot="cname" slot-scope="{ row }">
  222. <goods-select v-if="row.$cellEdit" v-model="row.cname" @getRow="getGoodsRow($event, row)"
  223. :configuration="goodsConfiguration" @receiveList="receiveGoodList" @returnRow="getRow($event, row)"/>
  224. <span v-else>
  225. <span v-for="item in goodsConfiguration.dicData" v-if="item.cname == row.cname">{{ item.cname }}</span>
  226. </span>
  227. </template>
  228. <template slot-scope="{row,index}" slot="menu">
  229. <el-button
  230. type="text"
  231. size="small"
  232. @click="rowCell(row,index)"
  233. :disabled="detailData.seeDisabled"
  234. >{{ row.$cellEdit ? '保 存' : '修 改' }}
  235. </el-button>
  236. <el-button
  237. size="small"
  238. icon="el-icon-delete"
  239. type="text"
  240. @click="rowDel(row, index)"
  241. :disabled="detailData.seeDisabled"
  242. v-if="!row.$cellEdit"
  243. >删 除</el-button>
  244. </template>
  245. <template slot="menuLeft" slot-scope="{size}">
  246. <el-button type="primary"
  247. icon="el-icon-plus"
  248. size="small"
  249. @click="commoditySelection"
  250. :disabled="detailData.seeDisabled">录入明细
  251. </el-button>
  252. <el-button type="primary"
  253. icon="el-icon-plus"
  254. size="small"
  255. @click="policy"
  256. :disabled="detailData.seeDisabled">政策
  257. </el-button>
  258. <el-button type="warning"
  259. icon="el-icon-plus"
  260. size="small"
  261. :disabled="selection.length < 1 || detailData.seeDisabled"
  262. @click="getShipmentD">生成发货单
  263. </el-button>
  264. <el-button type="info"
  265. :size="size"
  266. icon="el-icon-printer"
  267. :disabled="detailData.seeDisabled"
  268. @click.stop="openReport()"
  269. >报 表</el-button>
  270. <el-button
  271. type="primary"
  272. size="small"
  273. icon="el-icon-download"
  274. @click="downloadHandle"
  275. >下载模板</el-button>
  276. <el-upload
  277. :action="baseURL"
  278. :headers="headers"
  279. :disabled="detailData.seeDisabled"
  280. :on-progress="uploading"
  281. :show-file-list=false
  282. accept=".xls,.xlsx"
  283. multiple
  284. :on-success="importTemplate"
  285. style="float: right"
  286. >
  287. <el-button
  288. type="primary"
  289. size="small"
  290. icon="el-icon-upload"
  291. >导 入</el-button>
  292. </el-upload>
  293. </template>
  294. </avue-crud>
  295. </basic-container>
  296. <containerTitle title="费用明细"></containerTitle>
  297. <basic-container style="margin-bottom: 10px">
  298. <avue-crud
  299. :option="advantageProject"
  300. v-model="advantageProjectForm"
  301. :data="advantageProjectData"
  302. ref="crudProject"
  303. @row-save="rowSaveProject"
  304. @row-update="rowUpdateProject"
  305. @row-del="rowDelProject"
  306. @saveColumn="saveColumn('fees')"
  307. >
  308. <template slot="code" slot-scope="{row,index}">
  309. <el-button type="text" size="mini" style="padding:4px 10px;float:left" @click="choice(row)" :disabled="detailData.seeDisabled || !row.$cellEdit">选择</el-button>
  310. <span>{{ row.code }}</span>
  311. </template>
  312. <template slot="corpId" slot-scope="{ row }">
  313. <selectComponent v-if="row.$cellEdit" v-model="row.corpId"
  314. :configuration="configuration" @receiveList="receiveList"/>
  315. <span v-else>
  316. <span v-for="item in configuration.dicData" v-if="item.id == row.corpId">{{ item.cname }}</span>
  317. </span>
  318. </template>
  319. <template slot="amount" slot-scope="{ row }">
  320. <el-input v-if="row.$cellEdit" v-model="row.amount"
  321. size="small" v-input-limit="2"
  322. ></el-input>
  323. <span v-else>{{ row.amount }}</span>
  324. </template>
  325. <template slot="settlmentAmount" slot-scope="{ row }">
  326. <el-input v-if="row.$cellEdit" v-model="row.settlmentAmount"
  327. size="small" v-input-limit="2"
  328. ></el-input>
  329. <span v-else>{{ row.settlmentAmount }}</span>
  330. </template>
  331. <template slot-scope="{row,index}" slot="menu">
  332. <el-button
  333. type="text"
  334. size="small"
  335. @click="rowCellTwo(row,index)"
  336. :disabled="detailData.seeDisabled"
  337. >{{ row.$cellEdit ? '保 存' : '修 改 ' }}
  338. </el-button>
  339. <el-button
  340. size="small"
  341. icon="el-icon-delete"
  342. type="text"
  343. @click="rowDelProject(row, index)"
  344. :disabled="detailData.seeDisabled"
  345. v-if="!row.$cellEdit"
  346. >删 除</el-button>
  347. </template>
  348. <template slot="menuLeft" slot-scope="{size}">
  349. <el-button type="primary"
  350. icon="el-icon-plus"
  351. size="small"
  352. @click="costIncrease"
  353. :disabled="detailData.seeDisabled"
  354. >录入明细
  355. </el-button>
  356. </template>
  357. </avue-crud>
  358. </basic-container>
  359. <containerTitle title="附件上传"></containerTitle>
  360. <basic-container style="margin-bottom: 40px">
  361. <avue-crud
  362. :option="bankOfDeposit"
  363. v-model="bankOfDepositForm"
  364. :data="bankOfDepositData"
  365. @row-save="rowSaveBankOfDeposit"
  366. @row-update="rowUpdateBankOfDeposit"
  367. @row-del="rowDelBankOfDeposit"
  368. :upload-after="uploadAfter"
  369. ref="uploadCrud"
  370. >
  371. <template slot="menuLeft">
  372. <el-button
  373. type="primary"
  374. icon="el-icon-plus"
  375. size="small"
  376. @click.stop="$refs.uploadCrud.rowAdd()"
  377. :disabled="detailData.seeDisabled"
  378. >上传</el-button
  379. >
  380. </template>
  381. <template slot="menu" slot-scope="{ row, index }">
  382. <el-button
  383. size="small"
  384. icon="el-icon-edit"
  385. type="text"
  386. @click="$refs.uploadCrud.rowEdit(row, index)"
  387. :disabled="detailData.seeDisabled"
  388. >编 辑</el-button
  389. >
  390. <el-button
  391. size="small"
  392. icon="el-icon-delete"
  393. type="text"
  394. @click="rowDelBankOfDeposit(row, index)"
  395. :disabled="detailData.seeDisabled"
  396. >删 除</el-button
  397. >
  398. </template>
  399. </avue-crud>
  400. </basic-container>
  401. </el-form>
  402. </div>
  403. <el-dialog
  404. title="导入商品"
  405. append-to-body
  406. class="el-dialogDeep"
  407. :visible.sync="dialogVisible"
  408. width="80%"
  409. :close-on-click-modal="false"
  410. :destroy-on-close="true"
  411. :close-on-press-escape="false"
  412. @close="closeGoods">
  413. <el-row :style="{height: rowHeight}">
  414. <el-col :span="5" style="height: 100%;overflow-y: auto">
  415. <div>
  416. <el-scrollbar>
  417. <basic-container>
  418. <avue-tree :option="treeOption" :data="treeDataGoods" @node-click="nodeClick"/>
  419. </basic-container>
  420. </el-scrollbar>
  421. </div>
  422. </el-col>
  423. <el-col :span="19">
  424. <basic-container>
  425. <avue-crud :option="optionTwo"
  426. :table-loading="loading"
  427. :data="data"
  428. ref="crud"
  429. @refresh-change="refreshChange"
  430. @selection-change="selectionChange"
  431. @search-change="goodsSearch"
  432. :page.sync="page"
  433. @on-load="onLoad"></avue-crud>
  434. </basic-container>
  435. </el-col>
  436. </el-row>
  437. <span slot="footer" class="dialog-footer">
  438. <el-button @click="dialogVisible = false">取 消</el-button>
  439. <el-button type="primary" @click="importGoods" v-if="commodityData !== true">导入</el-button>
  440. <el-button type="primary" @click="importChoice" v-if="commodityData === true"
  441. :disabled="tableData.length !== 1">导入</el-button>
  442. </span>
  443. </el-dialog>
  444. <el-dialog
  445. title="导入政策"
  446. append-to-body
  447. class="el-dialogDeep"
  448. :visible.sync="policyDialog"
  449. width="80%"
  450. :close-on-click-modal="false"
  451. :destroy-on-close="true"
  452. :close-on-press-escape="false"
  453. @close="closePolicy">
  454. <el-row :style="{height: rowHeight}">
  455. <el-col :span="5" style="height: 100%;overflow-y: auto">
  456. <div>
  457. <el-scrollbar>
  458. <basic-container>
  459. <avue-tree :option="policyOption" :data="treeDataPolicy" @node-click="policyNodeClick"/>
  460. </basic-container>
  461. </el-scrollbar>
  462. </div>
  463. </el-col>
  464. <el-col :span="19">
  465. <containerTitle title="特价促销"></containerTitle>
  466. <basic-container style="margin-bottom: 10px">
  467. <avue-crud :option="optionPolicy"
  468. :table-loading="loadingPolicy"
  469. :data="dataPolicy"
  470. ref="crud"
  471. @selection-change="selectionChangePolicy"
  472. :page.sync="pagePolicy">
  473. </avue-crud>
  474. </basic-container>
  475. <containerTitle title="买赠促销"></containerTitle>
  476. <basic-container>
  477. <avue-crud
  478. :option="customerBuyFree"
  479. :data="contactsDataBuyFree"
  480. @selection-change="selectionChangePolicyTwo"
  481. ref="crudContactE">
  482. </avue-crud>
  483. </basic-container>
  484. </el-col>
  485. </el-row>
  486. <span slot="footer" class="dialog-footer">
  487. <el-button @click="policyDialog = false">取 消</el-button>
  488. <el-button type="primary" @click="importPolicy">导入</el-button>
  489. </span>
  490. </el-dialog>
  491. <el-dialog
  492. title="导入费用"
  493. append-to-body
  494. class="el-dialogDeep"
  495. :visible.sync="dialogCost"
  496. width="80%"
  497. top="8vh"
  498. :close-on-click-modal="false"
  499. :destroy-on-close="true"
  500. :close-on-press-escape="false"
  501. @close="closeFees">
  502. <el-row :style="{height: rowHeight}">
  503. <el-col :span="5" style="height: 100%;overflow-y: auto">
  504. <div>
  505. <el-scrollbar>
  506. <basic-container>
  507. <avue-tree :option="treeOptionCost" :data="treeData" @node-click="nodeClickCost"/>
  508. </basic-container>
  509. </el-scrollbar>
  510. </div>
  511. </el-col>
  512. <el-col :span="19">
  513. <basic-container>
  514. <avue-crud :option="optionTwoCost"
  515. :table-loading="loadingCost"
  516. :data="dataCost"
  517. ref="crud"
  518. @refresh-change="refreshChangeCost"
  519. @selection-change="selectionChangeCost"
  520. :page.sync="pageCost"
  521. @search-change="feesSearch"
  522. @on-load="onLoadCost">
  523. </avue-crud>
  524. </basic-container>
  525. </el-col>
  526. </el-row>
  527. <span slot="footer" class="dialog-footer">
  528. <el-button @click="dialogCost = false">取 消</el-button>
  529. <el-button type="primary" @click="importCost" v-if="choiceData !== true">导入</el-button>
  530. <el-button type="primary" @click="choiceCost" v-if="choiceData === true"
  531. :disabled="tableDataCost.length !== 1">导入</el-button>
  532. </span>
  533. </el-dialog>
  534. <el-dialog
  535. title="账单"
  536. append-to-body
  537. class="el-dialogDeep"
  538. :visible.sync="applySettlementDialog"
  539. width="60%"
  540. :close-on-click-modal="false"
  541. :destroy-on-close="true"
  542. :close-on-press-escape="false"
  543. v-dialog-drag
  544. >
  545. <apply-payment
  546. :billType="billType"
  547. :billData="billData"
  548. @choceFun="choceFun"
  549. >
  550. </apply-payment>
  551. </el-dialog>
  552. <report-dialog
  553. :switchDialog="switchDialog"
  554. @onClose="onClose()"
  555. ></report-dialog>
  556. </div>
  557. </template>
  558. <script>
  559. import {
  560. typeSave, detail, deleteDetails,
  561. corpstypeTree,
  562. corpsattn,
  563. corpsbank,
  564. corpsfiles,
  565. corpsitem,
  566. getList,
  567. detailList,
  568. generateShipment,
  569. saveSell,
  570. getlistBankBy,
  571. } from "@/api/basicData/configuration"
  572. import {selectGoodsNum} from "@/api/basicData/inventoryAccount"
  573. import customerContact from "./configuration/customerContact.json"
  574. import advantageProject from "./configuration/advantageProject.json"
  575. import bankOfDeposit from "./configuration/bankOfDeposit.json"
  576. import commodity from "./configuration/commodity.json"
  577. import optionTwoCost from "./configuration/mainListCost.json"
  578. import optionPolicy from "./configuration/optionPolicy.json"
  579. import BuyFree from "./configuration/BuyFree.json"
  580. import {
  581. getDeptLazyTree,
  582. getDeptLazyTreeTwo,
  583. customerList,
  584. policyList,
  585. policyColumn
  586. } from "@/api/basicData/basicFeesDesc";
  587. import _ from "lodash";
  588. import option from "./configuration/mainList.json";
  589. import { contrastObj, contrastList } from "@/util/contrastData";
  590. import { getMarketPrice, getPurchasePrice } from "@/api/basicData/fees"
  591. import customerDialog from "@/components/customer-dialog/main";
  592. //账单组件
  593. import ApplyPayment from "../../../components/finance/applyPayment";
  594. import reportDialog from "@/components/report-dialog/main";
  595. import { getToken } from "@/util/auth";
  596. import Cookies from 'js-cookie'
  597. export default {
  598. name: "detailsPage",
  599. props: {
  600. detailData: {
  601. type: Object
  602. }
  603. },
  604. components:{
  605. customerDialog,
  606. ApplyPayment,
  607. reportDialog,
  608. },
  609. data() {
  610. return {
  611. saveLoading: false,
  612. disabled: false,
  613. form: {},
  614. billType:"销售", //账单类型
  615. billData:{}, //账单需要数据
  616. applySettlementDialog:false,//生成账单组件
  617. configuration: {
  618. multipleChoices: false,
  619. multiple: false,
  620. collapseTags: false,
  621. placeholder: '请点击右边按钮选择',
  622. dicData: []
  623. },
  624. goodsConfiguration: {
  625. multipleChoices: false,
  626. multiple: false,
  627. collapseTags: false,
  628. placeholder: '请点击右边按钮选择',
  629. dicData: []
  630. },
  631. plantConfiguration: {
  632. multipleChoices: false,
  633. multiple: false,
  634. collapseTags: false,
  635. placeholder: '请点击右边按钮选择',
  636. dicData: []
  637. },
  638. companyConfiguration: {
  639. multipleChoices: false,
  640. multiple: false,
  641. collapseTags: false,
  642. placeholder: '请点击右边按钮选择',
  643. dicData: []
  644. },
  645. data: [],
  646. policyForm: {},
  647. dataPolicy: [],
  648. contactsDataBuyFree: [],
  649. loadingCost: false,
  650. customerDivide: '',
  651. choiceData: false,
  652. commodityData: false,
  653. dataCost: [],
  654. treeDataPolicy: [],
  655. treeDataGoods: [],
  656. choiceIndex: '',
  657. dialogCost: false,
  658. treeDeptId: '',
  659. treeDeptIdCost: '',
  660. treePolicyId: '',
  661. pageCost: {
  662. pageSize: 10,
  663. currentPage: 1,
  664. total: 0
  665. },
  666. page: {
  667. pageSize: 10,
  668. currentPage: 1,
  669. total: 0
  670. },
  671. pagePolicy: {
  672. pageSize: 10,
  673. currentPage: 1,
  674. total: 0
  675. },
  676. loading: false,
  677. loadingPolicy: false,
  678. contactsForm: {},
  679. optionPolicy: optionPolicy,
  680. optionTwo: commodity,
  681. optionTwoCost: optionTwoCost,
  682. customerBuyFree: BuyFree,
  683. policyOption: {
  684. nodeKey: 'id',
  685. lazy: true,
  686. treeLoad: function (node, resolve) {
  687. const parentId = (node.level === 0) ? 0 : node.data.id;
  688. const newTime = new Date().toLocaleString('chinese',{hour12:false})
  689. policyColumn({newTime: newTime,parentId: parentId}).then(res => {
  690. resolve(res.data.data.map(item => {
  691. return {
  692. ...item,
  693. leaf: !item.hasChildren
  694. }
  695. }))
  696. });
  697. },
  698. addBtn: false,
  699. menu: false,
  700. size: 'small',
  701. props: {
  702. labelText: '标题',
  703. label: 'title',
  704. value: 'value',
  705. children: 'children'
  706. }
  707. },
  708. treeOptionCost: {
  709. nodeKey: 'id',
  710. lazy: true,
  711. treeLoad: function (node, resolve) {
  712. const parentId = (node.level === 0) ? 0 : node.data.id;
  713. getDeptLazyTree(parentId).then(res => {
  714. resolve(res.data.data.map(item => {
  715. return {
  716. ...item,
  717. leaf: !item.hasChildren
  718. }
  719. }))
  720. });
  721. },
  722. addBtn: false,
  723. menu: false,
  724. size: 'small',
  725. props: {
  726. labelText: '标题',
  727. label: 'title',
  728. value: 'value',
  729. children: 'children'
  730. }
  731. },
  732. treeOption: {
  733. nodeKey: 'id',
  734. lazy: true,
  735. treeLoad: function (node, resolve) {
  736. const parentId = (node.level === 0) ? 0 : node.data.id;
  737. getDeptLazyTreeTwo(parentId).then(res => {
  738. resolve(res.data.data.map(item => {
  739. return {
  740. ...item,
  741. leaf: !item.hasChildren
  742. }
  743. }))
  744. });
  745. },
  746. addBtn: false,
  747. menu: false,
  748. size: 'small',
  749. props: {
  750. labelText: '标题',
  751. label: 'title',
  752. value: 'value',
  753. children: 'children'
  754. }
  755. },
  756. dialogVisible: false,
  757. policyDialog: false,
  758. advantageProjectForm: {},
  759. selection: [],
  760. bankOfDepositForm: {},
  761. contactsData: [],
  762. advantageProjectData: [],
  763. bankOfDepositData: [],
  764. tableDataCost: [],
  765. dic: [],
  766. tableData: [],
  767. policyData: [],
  768. policyDataTwo: [],
  769. customerContact: {},
  770. advantageProject: {},
  771. bankOfDeposit: bankOfDeposit,
  772. contactInformation: {
  773. column: [
  774. {
  775. label: '销售金额',
  776. prop: 'orderAmount',
  777. type: 'number',
  778. rules: [
  779. {
  780. required: false,
  781. message: ' ',
  782. trigger: 'blur'
  783. }
  784. ]
  785. }, {
  786. label: '其他费用',
  787. prop: 'otherAmount',
  788. type: 'number',
  789. rules: [
  790. {
  791. required: false,
  792. message: ' ',
  793. trigger: 'blur'
  794. }
  795. ]
  796. }, {
  797. label: '溢付款',
  798. prop: 'overPayment',
  799. rules: [
  800. {
  801. required: false,
  802. message: ' ',
  803. trigger: 'blur'
  804. }
  805. ]
  806. },{
  807. label: '应收账款',
  808. prop: 'debitAmount',
  809. type: 'number',
  810. rules: [
  811. {
  812. required: false,
  813. message: ' ',
  814. trigger: 'blur'
  815. }
  816. ]
  817. }, {
  818. label: '已收款',
  819. prop: 'settlmentAmount',
  820. rules: [
  821. {
  822. required: false,
  823. message: ' ',
  824. trigger: 'blur'
  825. }
  826. ]
  827. }, {
  828. label: '应收未收款',
  829. prop: 'balanceAmount',//无
  830. disabled: true,
  831. rules: [
  832. {
  833. required: false,
  834. message: ' ',
  835. trigger: 'blur'
  836. }
  837. ]
  838. },
  839. // {
  840. // label: '应收预付款',
  841. // prop: 'advancePayment',
  842. // rules: [
  843. // {
  844. // required: false,
  845. // message: ' ',
  846. // trigger: 'blur'
  847. // }
  848. // ]
  849. // },
  850. {
  851. label: '保证金',
  852. prop: 'deposit',
  853. type: 'number',
  854. rules: [
  855. {
  856. required: false,
  857. message: ' ',
  858. trigger: 'blur'
  859. }
  860. ]
  861. }, {
  862. label: '逾期账款',
  863. prop: 'overDueAccounts',
  864. type: 'number',
  865. rules: [
  866. {
  867. required: false,
  868. message: ' ',
  869. trigger: 'blur'
  870. }
  871. ]
  872. }, {
  873. label: '实际发货日期',
  874. prop: 'actualDeliveryDate',
  875. type: 'datetime',
  876. rules: [
  877. {
  878. required: false,
  879. message: ' ',
  880. trigger: 'blur'
  881. }
  882. ]
  883. }, {
  884. label: '合同日期',
  885. prop: 'businesDate',
  886. type: 'date',
  887. rules: [
  888. {
  889. required: false,
  890. message: ' ',
  891. trigger: 'blur'
  892. }
  893. ]
  894. }, {
  895. label: '毛利率',
  896. prop: 'grossProfitRate',
  897. rules: [
  898. {
  899. required: false,
  900. message: ' ',
  901. trigger: 'blur'
  902. }
  903. ]
  904. }, {
  905. label: '毛利额',
  906. prop: 'grossProfit',
  907. type: 'number',
  908. rules: [
  909. {
  910. required: false,
  911. message: ' ',
  912. trigger: 'blur'
  913. }
  914. ]
  915. }, {
  916. label: '历史运费(元/条)',
  917. prop: 'freightAmountHistory',
  918. type: 'number',
  919. rules: [
  920. {
  921. required: false,
  922. message: ' ',
  923. trigger: 'blur'
  924. }
  925. ]
  926. }, {
  927. label: '到货日期',
  928. prop: 'arrivalDate',
  929. type: 'datetime',
  930. rules: [
  931. {
  932. required: false,
  933. message: ' ',
  934. trigger: 'blur'
  935. }
  936. ]
  937. }, {
  938. label: '预收款日期',
  939. type: 'datetime',
  940. prop: 'advanceCollectionDate',
  941. rules: [
  942. {
  943. required: false,
  944. message: ' ',
  945. trigger: 'blur'
  946. }
  947. ]
  948. }, {
  949. label: '积分倍数',
  950. prop: 'pointMutiple',
  951. rules: [
  952. {
  953. required: false,
  954. message: ' ',
  955. trigger: 'blur'
  956. }
  957. ]
  958. }, {
  959. label: '单据状态',
  960. prop: 'orderStatus',
  961. rules: [
  962. {
  963. required: false,
  964. message: ' ',
  965. trigger: 'blur'
  966. }
  967. ]
  968. },{
  969. label: '制单日期',
  970. prop: 'createTime',
  971. type: 'datetime',
  972. disabled:true,
  973. rules: [
  974. {
  975. required: false,
  976. message: ' ',
  977. trigger: 'blur'
  978. }
  979. ]
  980. }, {
  981. label: '制单人',
  982. prop: 'createUserName',
  983. disabled: true,
  984. rules: [
  985. {
  986. required: false,
  987. message: ' ',
  988. trigger: 'blur'
  989. }
  990. ]
  991. },{
  992. label: '特别提醒',
  993. prop: 'specialRemarks',
  994. type: 'textarea',
  995. span: 24,
  996. rules: [
  997. {
  998. required: false,
  999. message: ' ',
  1000. trigger: 'blur'
  1001. }
  1002. ]
  1003. }
  1004. ]
  1005. },
  1006. basicData: {
  1007. column: [
  1008. {
  1009. label: '客户全称',
  1010. prop: 'corpId',
  1011. span: 16,
  1012. rules: [
  1013. {
  1014. required: true,
  1015. message: ' ',
  1016. trigger: 'blur'
  1017. }
  1018. ]
  1019. }, {
  1020. label: '到货地址',
  1021. prop: 'arrivalAddress',
  1022. rules: [
  1023. {
  1024. required: true,
  1025. message: ' ',
  1026. trigger: 'blur'
  1027. }
  1028. ]
  1029. }, {
  1030. label: '生产工厂',
  1031. prop: 'productionPlant',
  1032. span: 16,
  1033. rules: [
  1034. {
  1035. required: true,
  1036. message: ' ',
  1037. trigger: 'blur'
  1038. }
  1039. ]
  1040. },
  1041. {
  1042. label: '发货地址',
  1043. prop: 'shippingAddress',
  1044. rules: [
  1045. {
  1046. required: true,
  1047. message: ' ',
  1048. trigger: 'blur'
  1049. }
  1050. ]
  1051. }, {
  1052. label: '所属公司',
  1053. prop: 'belongToCorpId',
  1054. span: 16,
  1055. rules: [
  1056. {
  1057. required: true,
  1058. message: ' ',
  1059. trigger: 'blur'
  1060. }
  1061. ]
  1062. }, {
  1063. label: '银行帐号',
  1064. prop: 'banks',
  1065. type: 'select',
  1066. rules: [
  1067. {
  1068. required: true,
  1069. message: ' ',
  1070. trigger: 'blur'
  1071. }
  1072. ]
  1073. }, {
  1074. label: '公司户头',
  1075. prop: 'banksAccountName',
  1076. rules: [
  1077. {
  1078. required: false,
  1079. message: ' ',
  1080. trigger: 'blur'
  1081. }
  1082. ]
  1083. }, {
  1084. label: '开户银行',
  1085. prop: 'accountBank',
  1086. rules: [
  1087. {
  1088. required: false,
  1089. message: ' ',
  1090. trigger: 'blur'
  1091. }
  1092. ]
  1093. }, {
  1094. label: '付款方式',
  1095. prop: 'paymentType',
  1096. rules: [
  1097. {
  1098. required: true,
  1099. message: ' ',
  1100. trigger: 'blur'
  1101. }
  1102. ]
  1103. }, {
  1104. label: '包装要求',
  1105. prop: 'packageRemarks',
  1106. rules: [
  1107. {
  1108. required: true,
  1109. message: ' ',
  1110. trigger: 'blur'
  1111. }
  1112. ]
  1113. }, {
  1114. label: '销售订单号',
  1115. prop: 'orgOrderNo',
  1116. disabled: true,
  1117. rules: [
  1118. {
  1119. required: false,
  1120. message: ' ',
  1121. trigger: 'blur'
  1122. }
  1123. ]
  1124. }, {
  1125. label: '主订单号',
  1126. prop: 'morderNo',
  1127. rules: [
  1128. {
  1129. required: false,
  1130. message: ' ',
  1131. trigger: 'blur'
  1132. }
  1133. ]
  1134. }, {
  1135. label: '预估运费',
  1136. prop: 'oceanFreight',
  1137. type: 'number',
  1138. rules: [
  1139. {
  1140. required: true,
  1141. message: ' ',
  1142. trigger: 'blur'
  1143. }
  1144. ]
  1145. }, {
  1146. label: '要求发货日期',
  1147. prop: 'requiredDeliveryDate',
  1148. type: 'date',
  1149. rules: [
  1150. {
  1151. required: true,
  1152. message: ' ',
  1153. trigger: 'blur'
  1154. }
  1155. ]
  1156. }, {
  1157. label: '要求到货日期',
  1158. prop: 'requiredArrivalDate',
  1159. type: 'date',
  1160. rules: [
  1161. {
  1162. required: true,
  1163. message: ' ',
  1164. trigger: 'blur'
  1165. }
  1166. ]
  1167. }, {
  1168. label: "订单备注",
  1169. type: 'textarea',
  1170. span: 24,
  1171. prop: "orderRemark",
  1172. mock: {
  1173. type: 'county'
  1174. }
  1175. }
  1176. ]
  1177. },
  1178. // 银行账号下拉
  1179. bankList: [],
  1180. paymentOption: [],
  1181. statusOption: [],
  1182. // 费用信息排序的最大值
  1183. maxFeeNum: 0,
  1184. maxGoodsNum: 0,
  1185. oldForm: {
  1186. orderStatus: "录入"
  1187. },
  1188. oldGoodsList: [],
  1189. oldFeesList: [],
  1190. oldUploadList: [],
  1191. // 采购价格
  1192. purchasePriceOption: [],
  1193. // 销售价格
  1194. salesPriceOtion: [],
  1195. // 弹窗高度
  1196. rowHeight: '',
  1197. // 查询时loading页面
  1198. pageLoading: false,
  1199. switchDialog: false,
  1200. baseURL: '/api/blade-purchase-sales/orderitems/importPrice',
  1201. headers: { "Blade-Auth": 'Bearer ' + getToken()},
  1202. }
  1203. },
  1204. mounted() {
  1205. this.$nextTick(() => {
  1206. // 监听浏览器高度变化,改变表格高度
  1207. window.onresize = () => {
  1208. this.rowHeight = (window.innerHeight - 130) + 'px'
  1209. }
  1210. })
  1211. },
  1212. //初始化查询
  1213. async created() {
  1214. this.rowHeight = (window.innerHeight - 130) + 'px'
  1215. this.customerContact = customerContact
  1216. // this.customerContact = await this.getColumnData(this.getColumnName(15), customerContact);
  1217. this.advantageProject = await this.getColumnData(this.getColumnName(16), advantageProject);
  1218. this.getWorkDicts("payment_term").then(res => {
  1219. this.paymentOption = res.data.data
  1220. })
  1221. this.getWorkDicts("order_status").then(res => {
  1222. this.statusOption = res.data.data
  1223. })
  1224. this.$set(this.form, 'orderStatus', '录入')
  1225. this.$set(this.form, 'overPayment', 0)
  1226. this.$set(this.form, 'orderAmount', 0)
  1227. if (this.detailData.id) {
  1228. this.queryData(this.detailData.id)
  1229. }
  1230. if (this.detailData.seeDisabled) {
  1231. // this.bankOfDeposit.column.forEach(item => {
  1232. // item.editDisabled = true
  1233. // item.addDisabled = true
  1234. // })
  1235. }
  1236. if (this.detailData.copyId) {
  1237. this.queryData(this.detailData.copyId, true)
  1238. }
  1239. },
  1240. watch: {
  1241. },
  1242. methods: {
  1243. getGoodsRow(event,row) {
  1244. row.priceCategory = event.goodsTypeName
  1245. this.$set(row, 'priceType', '一般')
  1246. row.code = event.code
  1247. row.typeno = event.typeno
  1248. row.itemType = event.typeno
  1249. row.itemId = event.id
  1250. },
  1251. queryData(id, isCopy = false){
  1252. this.pageLoading = true
  1253. detail(id).then(res => {
  1254. this.form = res.data.data;
  1255. this.contactsData = this.form.orderItemsList
  1256. this.advantageProjectData = this.form.orderFeesList
  1257. this.bankOfDepositData = this.form.orderFilesList
  1258. this.configuration.dicData = this.form.corpName
  1259. if (this.form.belongToCorpList) {
  1260. this.companyConfiguration.dicData = this.form.belongToCorpList
  1261. }
  1262. if (this.form.productionPlantList) {
  1263. this.plantConfiguration.dicData = this.form.productionPlantList
  1264. }
  1265. let feesData = []
  1266. this.form.orderFeesList.forEach(item => {
  1267. let a = {
  1268. cname: item.corpName,
  1269. id: item.corpId
  1270. }
  1271. feesData.push(a)
  1272. })
  1273. this.configuration.dicData = this.configuration.dicData.concat(feesData)
  1274. // 去重
  1275. this.removeRepeat()
  1276. let goodsData = []
  1277. this.form.orderItemsList.forEach(item => {
  1278. let a = {
  1279. cname: item.cname,
  1280. }
  1281. goodsData.push(a)
  1282. })
  1283. this.goodsConfiguration.dicData = [].concat(goodsData)
  1284. this.removeGoodsRepeat()
  1285. delete this.form.orderItemsList
  1286. delete this.form.orderFeesList
  1287. delete this.form.orderFilesList
  1288. // delete this.form.corpName
  1289. delete this.form.belongToCorpList
  1290. // 获取最大值
  1291. let num = []
  1292. this.advantageProjectData.forEach(item => {
  1293. num.push(item.sort)
  1294. })
  1295. if (num.length == 0) {
  1296. this.maxFeeNum = 0;
  1297. } else {
  1298. this.maxFeeNum = num.reduce((a, b) => {
  1299. return b > a? b: a;
  1300. })
  1301. }
  1302. let goodsNum = []
  1303. let purchaseAmount = 0
  1304. this.contactsData.forEach(item => {
  1305. goodsNum.push(item.sort)
  1306. purchaseAmount += Number(item.purchaseAmount)
  1307. })
  1308. if (goodsNum.length == 0) {
  1309. this.maxGoodsNum = 0;
  1310. } else {
  1311. this.maxGoodsNum = goodsNum.reduce((a, b) => {
  1312. return b > a? b: a;
  1313. })
  1314. }
  1315. this.oldForm = Object.assign({}, this.form)
  1316. this.oldGoodsList = []
  1317. this.oldFeesList = []
  1318. this.oldUploadList = []
  1319. this.oldGoodsList = this.deepClone(this.contactsData)
  1320. this.oldFeesList = this.deepClone(this.advantageProjectData)
  1321. this.oldUploadList = this.deepClone(this.bankOfDepositData)
  1322. if (isCopy) {
  1323. this.$set(this.form, 'orderStatus', '录入')
  1324. delete this.form.id
  1325. delete this.form.orgOrderNo
  1326. delete this.form.morderNo
  1327. delete this.form.createUserName
  1328. delete this.form.createTime
  1329. this.contactsData.forEach(item => {
  1330. delete item.id
  1331. delete item.pid
  1332. })
  1333. this.advantageProjectData.forEach(item => {
  1334. delete item.id
  1335. delete item.pid
  1336. })
  1337. this.bankOfDepositData.forEach(item => {
  1338. delete item.id
  1339. delete item.pid
  1340. })
  1341. }
  1342. }).finally(() => {
  1343. this.saveLoading = false
  1344. this.pageLoading = false
  1345. });
  1346. },
  1347. // 复制新单
  1348. copyOrder() {
  1349. this.queryData(this.form.id, true)
  1350. },
  1351. getcorpId(row) {
  1352. this.contactsData[row.index].corpId = row.id;
  1353. },
  1354. // 采购金额获取
  1355. getPurchasePrice(row) {
  1356. getPurchasePrice({code: row.code}).then(res => {
  1357. this.purchasePriceOption = res.data.data
  1358. })
  1359. },
  1360. // 销售金额获取
  1361. getMarketPrice(row) {
  1362. getMarketPrice({code: row.code}).then(res => {
  1363. this.salesPriceOtion = res.data.data
  1364. })
  1365. },
  1366. // 生成采购单
  1367. saveSell() {
  1368. // if (!this.form.id) {
  1369. // return this.$message.error("此单据没有提交记录,请先提交");
  1370. // }
  1371. if (contrastObj(this.form, this.oldForm) ||
  1372. contrastList(this.contactsData, this.oldGoodsList) ||
  1373. contrastList(this.advantageProjectData, this.oldFeesList) ||
  1374. contrastList(this.bankOfDepositData, this.oldUploadList)
  1375. ) {
  1376. this.$confirm("数据发生变化未有提交记录, 是否保存?", "提示", {
  1377. confirmButtonText: "确定",
  1378. cancelButtonText: "取消",
  1379. type: "warning"
  1380. }).then(() => {
  1381. this.editCustomer(false)
  1382. }).catch(() => {
  1383. this.$message.info('已取消')
  1384. // this.$confirm("是否生成采购单?", {
  1385. // confirmButtonText: "确定",
  1386. // cancelButtonText: "取消",
  1387. // type: "warning"
  1388. // }).then(() => {
  1389. // saveSell(this.form.id).then(res => {
  1390. // if (res.data.code == 200) {
  1391. // this.$message.success("生成成功");
  1392. // }
  1393. // });
  1394. // });
  1395. })
  1396. } else {
  1397. this.$confirm("是否生成采购单?", {
  1398. confirmButtonText: "确定",
  1399. cancelButtonText: "取消",
  1400. type: "warning"
  1401. }).then(() => {
  1402. saveSell(this.form.id).then(res => {
  1403. if (res.data.code == 200) {
  1404. this.$message.success("生成成功");
  1405. }
  1406. });
  1407. });
  1408. }
  1409. },
  1410. //点击行可编辑
  1411. handleRowClick(row, event, column) {
  1412. },
  1413. //商品编辑
  1414. rowCell(row, index) {
  1415. if (row.$cellEdit) {
  1416. if (Number(row.orderQuantity) < Number(row.actualQuantity)) {
  1417. return this.$message.error('订货数量不能小于发货数量')
  1418. }
  1419. }
  1420. this.$refs.crudContact.rowCell(row, index)
  1421. },
  1422. //费用编辑
  1423. rowCellTwo(row, index) {
  1424. console.log(row)
  1425. this.$refs.crudProject.rowCell(row, index)
  1426. },
  1427. //费用新增触发
  1428. costIncrease() {
  1429. this.dialogCost = !this.dialogCost
  1430. this.choiceData = false
  1431. },
  1432. //商品新增触发
  1433. commoditySelection() {
  1434. this.dialogVisible = !this.dialogVisible
  1435. this.tableData = []
  1436. this.commodityData = false
  1437. },
  1438. //政策价格导入
  1439. policy() {
  1440. this.policyDialog = !this.policyDialog
  1441. },
  1442. // 报表
  1443. openReport() {
  1444. this.switchDialog =! this.switchDialog;
  1445. },
  1446. // 下载模板
  1447. downloadHandle() {
  1448. this.$confirm('是否下载模板文件?', '提示', {
  1449. confirmButtonText: '确定',
  1450. cancelButtonText: '取消',
  1451. type: 'warning'
  1452. }).then(() => {
  1453. window.open(
  1454. `/api/blade-purchase-sales/orderitems/exportPrice?${
  1455. this.website.tokenHeader
  1456. }=${getToken()}`
  1457. );
  1458. }).catch(() => {
  1459. this.$message({
  1460. type: 'info',
  1461. message: '已取消'
  1462. });
  1463. })
  1464. },
  1465. //文件上传时
  1466. uploading(event, file, fileList) {
  1467. this.pageLoading = true;
  1468. // this.openFullScreen(false, '文件正在解析中');
  1469. },
  1470. importTemplate(res, file) {
  1471. console.log(res)
  1472. this.pageLoading = false
  1473. let goodsData = []
  1474. res.data.forEach(item => {
  1475. this.$set(item, 'priceType', '一般')
  1476. this.$set(item, 'actualQuantity', '0')
  1477. this.$set(item, 'purchaseAmount', '0')
  1478. this.$set(item, 'price', '0')
  1479. this.$set(item, 'amount', '0')
  1480. this.$set(item, 'sort', this.maxFeeNum + 1)
  1481. this.maxFeeNum++
  1482. let a = {
  1483. cname: item.cname,
  1484. }
  1485. goodsData.push(a)
  1486. })
  1487. this.goodsConfiguration.dicData = this.goodsConfiguration.dicData.concat(goodsData)
  1488. this.removeGoodsRepeat()
  1489. this.contactsData = this.contactsData.concat(res.data)
  1490. },
  1491. //遮罩层
  1492. openFullScreen(res, text) {
  1493. const loading = this.$loading({
  1494. lock: true,
  1495. text: text,
  1496. spinner: 'el-icon-loading',
  1497. background: 'rgba(0, 0, 0, 0.7)'
  1498. });
  1499. if (res === true) loading.close();
  1500. },
  1501. onClose(val) {
  1502. this.switchDialog = val;
  1503. },
  1504. getShipmentD() {
  1505. if (this.$store.getters.inStatus) {
  1506. this.$alert("发货单存在,请保存发货单再进行操作", "温馨提示", {
  1507. confirmButtonText: "确定",
  1508. type: "warning",
  1509. callback: action => {
  1510. console.log(action);
  1511. }
  1512. });
  1513. } else {
  1514. this.generateShipmentD();
  1515. }
  1516. },
  1517. //生成发货单
  1518. generateShipmentD() {
  1519. let lsit = []
  1520. if (contrastObj(this.form, this.oldForm) ||
  1521. contrastList(this.contactsData, this.oldGoodsList) ||
  1522. contrastList(this.advantageProjectData, this.oldFeesList) ||
  1523. contrastList(this.bankOfDepositData, this.oldUploadList)
  1524. ) {
  1525. this.$confirm("数据发生变化未有提交记录, 是否保存?", "提示", {
  1526. confirmButtonText: "确定",
  1527. cancelButtonText: "取消",
  1528. type: "warning"
  1529. }).then(() => {
  1530. this.editCustomer(false)
  1531. }).catch(() => {
  1532. this.$message({
  1533. type: 'info',
  1534. message: '已取消'
  1535. });
  1536. // this.selection.forEach(item => {
  1537. // lsit.push(item.id)
  1538. // })
  1539. // let data = {
  1540. // id: this.form.id,
  1541. // orderItemIds: lsit
  1542. // }
  1543. // generateShipment(data).then(res => {
  1544. // this.$router.$avueRouter.closeTag("/businessManagement/deliveryNotice/index");
  1545. // this.$router.push({
  1546. // path: "/businessManagement/deliveryNotice/index",
  1547. // query: {form: JSON.stringify(res.data.data)},
  1548. // });
  1549. // })
  1550. })
  1551. } else {
  1552. // lsit.push(this.selection[item].id)
  1553. this.selection.forEach(item => {
  1554. lsit.push(item.id)
  1555. })
  1556. let data = {
  1557. id: this.form.id,
  1558. orderItemIds: lsit
  1559. }
  1560. generateShipment(data).then(res => {
  1561. this.$router.$avueRouter.closeTag("/businessManagement/deliveryNotice/index");
  1562. this.$router.push({
  1563. path: "/businessManagement/deliveryNotice/index",
  1564. query: {form: JSON.stringify(res.data.data)},
  1565. });
  1566. })
  1567. }
  1568. },
  1569. // 生成结算
  1570. applySettlement() {
  1571. if (contrastObj(this.form, this.oldForm) ||
  1572. contrastList(this.contactsData, this.oldGoodsList) ||
  1573. contrastList(this.advantageProjectData, this.oldFeesList) ||
  1574. contrastList(this.bankOfDepositData, this.oldUploadList)
  1575. ) {
  1576. this.$confirm("数据发生变化未有提交记录, 是否提交?", "提示", {
  1577. confirmButtonText: "确定",
  1578. cancelButtonText: "取消",
  1579. type: "warning"
  1580. }).then(() => {
  1581. this.editCustomer(true)
  1582. }).catch(() => {
  1583. })
  1584. } else {
  1585. this.beforeBillData(true)
  1586. this.applySettlementDialog = true;
  1587. }
  1588. },
  1589. //生成账单 拿到主表信息
  1590. beforeBillData(type){
  1591. this.billData = {
  1592. srcOrderno:this.form.orgOrderNo,
  1593. itemType:"销售",
  1594. corpsName:this.form.corpName,
  1595. corpId:this.form.corpId,
  1596. srcParentId: this.form.id,
  1597. }
  1598. if(type){ //申请货款
  1599. this.billData.srcId = -1
  1600. }
  1601. },
  1602. //关闭账单
  1603. choceFun(){
  1604. this.applySettlementDialog = false
  1605. },
  1606. //商品选中触发
  1607. productSelection(selection) {
  1608. this.selection = selection
  1609. },
  1610. //点击费用明细选择触发
  1611. choice(row) {
  1612. this.dialogCost = !this.dialogCost
  1613. this.choiceData = true
  1614. console.log(row)
  1615. this.choiceIndex = row.$index
  1616. },
  1617. // 去重
  1618. removeRepeat() {
  1619. let obj = []
  1620. this.configuration.dicData = this.configuration.dicData.reduce((current,next) => {
  1621. obj[next.id] ? '': obj[next.id] = true && current.push(next)
  1622. return current
  1623. }, [])
  1624. },
  1625. removeGoodsRepeat() {
  1626. let obj = []
  1627. this.goodsConfiguration.dicData = this.goodsConfiguration.dicData.reduce((current,next) => {
  1628. obj[next.cname] ? '': obj[next.cname] = true && current.push(next)
  1629. return current
  1630. }, [])
  1631. },
  1632. //
  1633. receiveList(data){
  1634. this.configuration.dicData = this.configuration.dicData.concat(data)
  1635. this.removeRepeat()
  1636. },
  1637. receiveGoodList(data) {
  1638. console.log(data)
  1639. this.goodsConfiguration.dicData = this.goodsConfiguration.dicData.concat(data)
  1640. this.removeGoodsRepeat()
  1641. },
  1642. getCorpRow(data) {
  1643. this.$set(this.form, 'paymentType', data.paymentType)
  1644. this.$set(this.form, 'packageRemarks', data.remarks)
  1645. this.$set(this.form, 'arrivalAddress', data.storageAddr)
  1646. },
  1647. getPlantRow(data) {
  1648. this.$set(this.form, 'shippingAddress', data.storageAddr)
  1649. },
  1650. getRow(event,row) {
  1651. row.priceCategory = event[0].goodsTypeName
  1652. this.$set(row, 'priceType', '一般')
  1653. row.code = event[0].code
  1654. row.typeno = event[0].typeno
  1655. row.itemType = event[0].typeno
  1656. row.itemId = event[0].id
  1657. },
  1658. //点击商品明细选择触发
  1659. commodityChoice(row) {
  1660. this.dialogVisible = !this.dialogVisible
  1661. this.commodityData = true
  1662. console.log(row)
  1663. this.choiceIndexT = row.$index
  1664. },
  1665. //导入商品触发
  1666. importChoice() {
  1667. // this.contactsData = this.contactsData.concat(this.tableData)
  1668. if (this.tableData.length === 1) {
  1669. this.contactsData[this.choiceIndexT].cname = this.tableData[0].cname
  1670. this.contactsData[this.choiceIndexT].code = this.tableData[0].code
  1671. this.contactsData[this.choiceIndexT].typeno = this.tableData[0].typeno
  1672. this.contactsData[this.choiceIndexT].itemType = this.tableData[0].typeno
  1673. this.contactsData[this.choiceIndexT].itemId = this.tableData[0].id
  1674. this.contactsData[this.choiceIndexT].priceCategory = this.tableData[0].goodsTypeName
  1675. selectGoodsNum({
  1676. goodsId: this.tableData[0].id,
  1677. itemType: this.tableData[0].typeno
  1678. }).then(res => {
  1679. this.contactsData[this.choiceIndexT].storageQuantity = res.data.data
  1680. })
  1681. }
  1682. this.dialogVisible = !this.dialogVisible
  1683. this.commodityData = false
  1684. },
  1685. //费用编辑导入触发
  1686. choiceCost() {
  1687. if (this.tableDataCost.length === 1) {
  1688. this.advantageProjectData[this.choiceIndex].feeName = this.tableDataCost[0].cname
  1689. this.advantageProjectData[this.choiceIndex].itemId = this.tableDataCost[0].id
  1690. this.advantageProjectData[this.choiceIndex].code = this.tableDataCost[0].code
  1691. }
  1692. this.dialogCost = !this.dialogCost
  1693. this.choiceData = false
  1694. },
  1695. //费用导入触发
  1696. importCost() {
  1697. // this.advantageProjectForm = this.advantageProjectForm.concat(this.tableDataCost)
  1698. if (this.tableDataCost.length > 0) {
  1699. for (let item in this.tableDataCost) {
  1700. console.log(this.tableDataCost[item])
  1701. this.tableDataCost[item].itemId = this.tableDataCost[item].id
  1702. this.tableDataCost[item].feeName = this.tableDataCost[item].cname
  1703. this.$set(this.tableDataCost[item], 'amount', 0)
  1704. this.$set(this.tableDataCost[item], 'settlmentAmount', 0)
  1705. this.tableDataCost[item].sort = this.maxFeeNum + 1
  1706. this.maxFeeNum++
  1707. delete this.tableDataCost[item].id
  1708. this.$refs.crudProject.rowCellAdd(this.tableDataCost[item]);
  1709. this.$refs.crudProject.rowCell(this.tableDataCost[item], this.advantageProjectForm.length - 1)
  1710. }
  1711. }
  1712. this.tableDataCost = []
  1713. this.dialogCost = false
  1714. },
  1715. //确认导入触发
  1716. importGoods() {
  1717. // this.contactsData = this.contactsData.concat(this.tableData)
  1718. if (this.tableData.length > 0) {
  1719. for (let item in this.tableData) {
  1720. // this.$set(this.tableData[item], 'storageQuantity', 0)
  1721. selectGoodsNum({
  1722. goodsId: this.tableData[item].id,
  1723. itemType: this.tableData[item].typeno
  1724. }).then(res => {
  1725. this.tableData[item].priceCategory = this.tableData[item].goodsTypeName
  1726. this.tableData[item].storageQuantity = res.data.data
  1727. delete this.tableData[item].goodsTypeName
  1728. this.tableData[item].itemId = this.tableData[item].id
  1729. this.$set(this.tableData[item], 'itemType', this.tableData[item].typeno)
  1730. this.$set(this.tableData[item], 'priceType', '一般')
  1731. this.$set(this.tableData[item], 'orderQuantity', 0)
  1732. this.$set(this.tableData[item], 'actualQuantity', 0)
  1733. this.$set(this.tableData[item], 'purchaseAmount', '0')
  1734. this.tableData[item].price = '0'
  1735. this.tableData[item].amount = 0
  1736. this.tableData[item].sort = this.maxGoodsNum + 1
  1737. delete this.tableData[item].id
  1738. delete this.tableData[item].pid
  1739. delete this.tableData[item].isDeleted
  1740. delete this.tableData[item].status
  1741. delete this.tableData[item].tenantId
  1742. delete this.tableData[item].updateTime
  1743. delete this.tableData[item].updateUser
  1744. delete this.tableData[item].updateUserName
  1745. this.maxGoodsNum++
  1746. this.$refs.crudContact.rowCellAdd(this.tableData[item]);
  1747. this.$refs.crudContact.rowCell(this.tableData[item], this.contactsData.length - 1)
  1748. })
  1749. }
  1750. this.dialogVisible = false
  1751. }
  1752. },
  1753. closeGoods() {
  1754. this.treeDataGoods = [];
  1755. this.treeDeptId = "";
  1756. },
  1757. closeFees() {
  1758. this.treeDeptIdCost = "";
  1759. this.treeData = [];
  1760. },
  1761. closePolicy() {
  1762. this.treePolicyId = '';
  1763. this.dataPolicy = [];
  1764. this.policyForm = {};
  1765. this.contactsDataBuyFree = [];
  1766. this.policyData = []
  1767. this.policyDataTwo = []
  1768. },
  1769. //选中触发
  1770. selectionChange(list) {
  1771. this.tableData = list
  1772. },
  1773. //费用选中触发
  1774. selectionChangeCost(list) {
  1775. this.tableDataCost = list
  1776. },
  1777. //导入页左商品类型查询
  1778. nodeClick(data) {
  1779. this.treeDeptId = data.id;
  1780. this.page.currentPage = 1;
  1781. this.onLoad(this.page);
  1782. },
  1783. //导入页销售政策查询
  1784. policyNodeClick(data) {
  1785. this.treePolicyId = data.id
  1786. // detailList(data.id).then(res => {
  1787. // //特价促销
  1788. // this.dataPolicy = res.data.data.specialItemList
  1789. // //买赠促销
  1790. // this.contactsDataBuyFree = res.data.data.presentItemList
  1791. // })
  1792. this.policyOnLoad()
  1793. },
  1794. //导入页左费用类型查询
  1795. nodeClickCost(data) {
  1796. this.treeDeptIdCost = data.id;
  1797. this.pageCost.currentPage = 1;
  1798. this.onLoadCost(this.pageCost);
  1799. },
  1800. //刷新触发
  1801. refreshChange() {
  1802. this.page.currentPage = 1;
  1803. this.onLoad(this.page);
  1804. },
  1805. //销售政策特价促销选中触发
  1806. selectionChangePolicy(list) {
  1807. this.policyData = list
  1808. // this.policyData.forEach(item => {
  1809. // this.$set(item, 'price', item.specialOffer)
  1810. // })
  1811. if (this.policyData.length > 0) {
  1812. this.customerBuyFree.selection = false
  1813. } else {
  1814. this.customerBuyFree.selection = true
  1815. }
  1816. },
  1817. //销售政策买赠促销选中触发
  1818. selectionChangePolicyTwo(list) {
  1819. this.policyDataTwo = list
  1820. // this.policyDataTwo.forEach(item => {
  1821. // this.$set(item, 'price', item.salesPrice)
  1822. // })
  1823. if (this.policyDataTwo.length > 0) {
  1824. this.optionPolicy.selection = false
  1825. } else {
  1826. this.optionPolicy.selection = true
  1827. }
  1828. },
  1829. //导入商品政策
  1830. importPolicy() {
  1831. let list = this.deepClone(this.policyData.concat(this.policyDataTwo))
  1832. // 买赠额外加一条
  1833. let buyFree = []
  1834. if (this.policyDataTwo.length > 0) {
  1835. buyFree = this.deepClone(this.policyDataTwo)
  1836. }
  1837. for (let item in list) {
  1838. selectGoodsNum({
  1839. goodsId: list[item].itemId,
  1840. itemType: list[item].typeno
  1841. }).then(res => {
  1842. this.$set(list[item], 'storageQuantity', res.data.data)
  1843. if (this.policyDataTwo.length > 0) {
  1844. this.$set(buyFree[item], 'storageQuantity', res.data.data)
  1845. }
  1846. })
  1847. if (this.policyData.length > 0) {
  1848. this.$set(list[item], 'price', list[item].specialOffer)
  1849. } else {
  1850. this.$set(list[item], 'price', list[item].salesPrice)
  1851. this.$set(buyFree[item], 'price', '0')
  1852. this.$set(buyFree[item], 'orderQuantity', list[item].salesVolume)
  1853. this.$set(buyFree[item], 'itemType', list[item].typeno)
  1854. }
  1855. this.$set(list[item], 'itemType', list[item].typeno)
  1856. this.$set(list[item], 'actualQuantity', 0)
  1857. this.$set(list[item], 'orderQuantity', 0)
  1858. this.$set(list[item], 'amount', 0)
  1859. this.$set(list[item], 'priceCategory', list[item].productCategory)
  1860. this.$set(list[item], 'priceType', this.policyForm.cname)
  1861. this.$set(list[item], 'cname', list[item].productCategory)
  1862. this.$set(list[item], 'sort', this.maxGoodsNum + 1)
  1863. this.$set(list[item], 'purchaseAmount', list[item].purchasePrice)
  1864. if (this.policyDataTwo.length > 0) {
  1865. this.$set(buyFree[item], 'actualQuantity', 0)
  1866. this.$set(buyFree[item], 'amount', 0)
  1867. this.$set(buyFree[item], 'priceCategory', list[item].productCategory)
  1868. this.$set(buyFree[item], 'priceType', this.policyForm.cname)
  1869. this.$set(buyFree[item], 'cname', list[item].productCategory)
  1870. this.$set(buyFree[item], 'sort', this.maxGoodsNum + 2)
  1871. this.$set(buyFree[item], 'purchaseAmount', list[item].purchasePrice)
  1872. this.maxGoodsNum++
  1873. }
  1874. delete list[item].id
  1875. delete list[item].pid
  1876. delete list[item].isDeleted
  1877. delete list[item].status
  1878. delete list[item].tenantId
  1879. delete list[item].updateTime
  1880. delete list[item].updateUser
  1881. delete list[item].updateUserName
  1882. this.maxGoodsNum++
  1883. this.$refs.crudContact.rowCellAdd(list[item]);
  1884. // this.$refs.crudContact.rowCell(list[item], this.contactsData.length - 1)
  1885. if (this.policyDataTwo.length > 0) {
  1886. this.$refs.crudContact.rowCellAdd(buyFree[item]);
  1887. }
  1888. // this.$refs.crudContact.rowCell(buyFree[item], this.contactsData.length - 1)
  1889. }
  1890. this.policyDialog = false
  1891. },
  1892. //费用刷新触发
  1893. refreshChangeCost() {
  1894. this.treeDeptIdCost = '';
  1895. this.pageCost.currentPage = 1;
  1896. this.onLoadCost(this.pageCost);
  1897. },
  1898. //新增商品信息保存触发
  1899. rowSave(row, done, loading) {
  1900. console.log(row)
  1901. console.log(this.contactsData)
  1902. // this.contactsData.push(row)
  1903. done()
  1904. },
  1905. //修改商品信息触发
  1906. rowUpdate(row, index, done, loading) {
  1907. done(row);
  1908. },
  1909. //删除商品信息触发
  1910. rowDel(row, index, donerowDel) {
  1911. this.$confirm("确定将选择数据删除?", {
  1912. confirmButtonText: "确定",
  1913. cancelButtonText: "取消",
  1914. type: "warning"
  1915. }).then(() => {
  1916. //商品判断是否需要调用删除接口
  1917. if (row.id) {
  1918. corpsattn(row.id).then(res => {
  1919. this.$message({
  1920. type: "success",
  1921. message: "操作成功!"
  1922. });
  1923. this.contactsData.splice(index, 1);
  1924. })
  1925. } else {
  1926. this.$message({
  1927. type: "success",
  1928. message: "操作成功!"
  1929. });
  1930. this.contactsData.splice(index, 1);
  1931. }
  1932. })
  1933. },
  1934. //新增费用明细保存触发
  1935. rowSaveProject(row, done, loading) {
  1936. // this.advantageProjectData.push(row)
  1937. done()
  1938. },
  1939. //修改费用明细触发
  1940. rowUpdateProject(row, index, done, loading) {
  1941. done(row);
  1942. },
  1943. policyOnLoad(params = {}) {
  1944. // this.policyLoading = true;
  1945. detailList(this.treePolicyId).then(res => {
  1946. this.policyForm = res.data.data
  1947. //特价促销
  1948. if(res.data.data.specialItemList) {
  1949. this.dataPolicy = res.data.data.specialItemList
  1950. } else {
  1951. this.dataPolicy = []
  1952. }
  1953. //买赠促销
  1954. if (res.data.data.presentItemList) {
  1955. this.contactsDataBuyFree = res.data.data.presentItemList
  1956. } else {
  1957. this.contactsDataBuyFree = []
  1958. }
  1959. })
  1960. },
  1961. //
  1962. goodsSearch(params, done) {
  1963. this.onLoad(this.page, params);
  1964. done()
  1965. },
  1966. //商品列表查询
  1967. onLoad(page, params = {}) {
  1968. console.log(params)
  1969. this.loading = true;
  1970. getList(page.currentPage, page.pageSize, Object.assign(params, this.query), this.treeDeptId).then(res => {
  1971. console.log(res)
  1972. const data = res.data.data;
  1973. this.page.total = data.total;
  1974. this.data = data.records;
  1975. this.loading = false;
  1976. });
  1977. },
  1978. // 费用查询按钮
  1979. feesSearch(params, done) {
  1980. this.onLoadCost(this.pageCost, params)
  1981. done()
  1982. },
  1983. //费用查询
  1984. onLoadCost(page, params = {}) {
  1985. this.loadingCost = true;
  1986. let queryParams = Object.assign({}, params, {
  1987. pageSize: page.pageSize,
  1988. pageNum: page.currentPage,
  1989. parentId: 0,
  1990. feesTypeId: this.treeDeptIdCost
  1991. })
  1992. customerList(queryParams).then(res => {
  1993. console.log(res)
  1994. const data = res.data.data;
  1995. this.pageCost.total = data.total;
  1996. this.dataCost = data.records;
  1997. this.loadingCost = false;
  1998. });
  1999. },
  2000. //删除费用明细触发
  2001. rowDelProject(row, index, donerowDel) {
  2002. this.$confirm("确定将选择数据删除?", {
  2003. confirmButtonText: "确定",
  2004. cancelButtonText: "取消",
  2005. type: "warning"
  2006. }).then(() => {
  2007. //费用判断是否需要调用删除接口
  2008. if (row.id) {
  2009. corpsitem(row.id).then(res => {
  2010. this.$message({
  2011. type: "success",
  2012. message: "操作成功!"
  2013. });
  2014. this.advantageProjectData.splice(index, 1);
  2015. })
  2016. } else {
  2017. this.$message({
  2018. type: "success",
  2019. message: "操作成功!"
  2020. });
  2021. this.advantageProjectData.splice(index, 1);
  2022. }
  2023. })
  2024. },
  2025. //新增附件上传保存触发
  2026. rowSaveBankOfDeposit(row, done, loading) {
  2027. this.bankOfDepositData.push(row)
  2028. done()
  2029. },
  2030. //修改附件上传触发
  2031. rowUpdateBankOfDeposit(row, index, done, loading) {
  2032. done(row);
  2033. },
  2034. //删除附件上传触发
  2035. rowDelBankOfDeposit(row, index, donerowDel) {
  2036. this.$confirm("确定将选择数据删除?", {
  2037. confirmButtonText: "确定",
  2038. cancelButtonText: "取消",
  2039. type: "warning"
  2040. }).then(() => {
  2041. //附件判断是否需要调用删除接口
  2042. if (row.id) {
  2043. corpsbank(row.id).then(res => {
  2044. this.$message({
  2045. type: "success",
  2046. message: "操作成功!"
  2047. });
  2048. this.bankOfDepositData.splice(index, 1);
  2049. })
  2050. } else {
  2051. this.$message({
  2052. type: "success",
  2053. message: "操作成功!"
  2054. });
  2055. this.bankOfDepositData.splice(index, 1);
  2056. }
  2057. })
  2058. },
  2059. uploadAfter(res, done) {
  2060. if (res.originalName) {
  2061. this.bankOfDepositForm.fileName = this.bankOfDepositForm.fileName
  2062. ? this.bankOfDepositForm.fileName
  2063. : res.originalName;
  2064. }
  2065. done();
  2066. },
  2067. //修改提交触发
  2068. editCustomer(isBack = false) {
  2069. this.$refs["form"].validate((valid) => {
  2070. if (valid) {
  2071. for (let item in this.contactsData) {
  2072. if (Number(this.contactsData[item].orderQuantity) < Number(this.contactsData[item].actualQuantity)) {
  2073. return this.$message.error('商品信息第'+ (parseInt(item) + 1) + '行订货数量不能小于发货数量')
  2074. }
  2075. }
  2076. // 计算毛利额
  2077. // this.$set(this.form, 'grossProfit', 0)
  2078. this.$set(this.form, 'orderAmount', 0)
  2079. // 成本价
  2080. let purchaseAmount = 0
  2081. // 计算销售金额
  2082. this.contactsData.forEach(item => {
  2083. if (item.purchaseAmount) {
  2084. purchaseAmount += (Number(item.purchaseAmount) * Number(item.orderQuantity)).toFixed(2)
  2085. }
  2086. // this.form.grossProfit += Number(item.amount)
  2087. this.form.orderAmount = (Number(this.form.orderAmount) + Number(item.amount)).toFixed(2)
  2088. })
  2089. // this.form.grossProfit = (Number(this.form.orderAmount) - Number(purchaseAmount)).toFixed(2)
  2090. // if (this.form.orderAmount && this.form.overPayment) {
  2091. // this.form.debitAmount = Number(this.form.orderAmount) - Number(this.form.overPayment)
  2092. // }
  2093. if (this.form.orderAmount && this.form.settlmentAmount) {
  2094. this.$set(this.form, "balanceAmount", (Number(this.form.orderAmount) - Number(this.form.settlmentAmount)).toFixed(2));
  2095. }
  2096. // 计算毛利率
  2097. // if (this.form.orderAmount) {
  2098. // this.form.grossProfitRate = ((Number(this.form.grossProfit) / Number(this.form.orderAmount)) * 100).toFixed(2)
  2099. // }
  2100. // 计算应收账款
  2101. // this.$set(this.form, 'debitAmount', 0)
  2102. // this.contactsData.forEach(item => {
  2103. // this.form.debitAmount += Number(item.amount)
  2104. // })
  2105. //商品信息
  2106. this.form.orderItemsList = this.contactsData
  2107. this.form.orderFeesList = this.advantageProjectData
  2108. this.form.orderFilesList = this.bankOfDepositData
  2109. if (typeof this.form.corpsTypeId == 'object') {
  2110. this.form.corpsTypeId = this.form.corpsTypeId.join(",")
  2111. }
  2112. this.form.billType = 'XS'
  2113. this.saveLoading = true
  2114. typeSave(this.form).then(res => {
  2115. this.$message({type: "success", message: this.form.id ? "修改成功!" : "新增成功!"});
  2116. if (isBack) {
  2117. //成功关闭此页面回到列表页
  2118. this.$emit("goBack");
  2119. } else {
  2120. this.queryData(res.data.data.id)
  2121. }
  2122. }).finally(() => {
  2123. this.saveLoading = false
  2124. })
  2125. } else {
  2126. return false;
  2127. }
  2128. });
  2129. },
  2130. // 计算应收未收款
  2131. computedCost() {
  2132. // 销售金额
  2133. let orderAmount = 0;
  2134. // 已收款
  2135. let settlmentAmount = 0;
  2136. // 溢付款
  2137. let overPayment = 0
  2138. if (this.form.orderAmount) {
  2139. orderAmount = this.form.orderAmount
  2140. }
  2141. if (this.form.settlmentAmount) {
  2142. settlmentAmount = this.form.settlmentAmount
  2143. }
  2144. if (this.form.overPayment) {
  2145. overPayment = this.form.overPayment
  2146. }
  2147. this.$set(this.form, "balanceAmount", (Number(orderAmount) - Number(overPayment) - Number(settlmentAmount)).toFixed(2));
  2148. },
  2149. quantityChange(row) {
  2150. if (!row.orderQuantity) {
  2151. row.orderQuantity = 0;
  2152. } else {
  2153. // row.amount = _.multiply(row.price, row.orderQuantity).toFixed(2);
  2154. row.amount = (row.price * row.orderQuantity).toFixed(2)
  2155. }
  2156. },
  2157. priceChange(row) {
  2158. console.log(row.price)
  2159. if (!row.price) {
  2160. row.price = 0;
  2161. } else {
  2162. row.amount = (row.price * row.orderQuantity).toFixed(2)
  2163. }
  2164. },
  2165. //返回列表
  2166. backToList() {
  2167. if (contrastObj(this.form, this.oldForm) ||
  2168. contrastList(this.contactsData, this.oldGoodsList) ||
  2169. contrastList(this.advantageProjectData, this.oldFeesList) ||
  2170. contrastList(this.bankOfDepositData, this.oldUploadList)
  2171. ) {
  2172. this.$confirm("数据发生变化未有提交记录, 是否提交?", "提示", {
  2173. confirmButtonText: "确定",
  2174. cancelButtonText: "取消",
  2175. type: "warning"
  2176. }).then(() => {
  2177. this.editCustomer(true)
  2178. }).catch(() => {
  2179. this.$emit("goBack");
  2180. })
  2181. } else {
  2182. this.$emit("goBack");
  2183. }
  2184. },
  2185. // 保存列设置
  2186. async saveColumn(name) {
  2187. /**
  2188. * 已定义全局方法,直接使用,saveColumnData保存列数据方法,参数传值(表格名称,当前表格的option数据)
  2189. * 已定义全局方法,直接使用,getColumnName方法用来获取枚举值,参数根据自己定义的code值获取中文名
  2190. * 一定要执行异步操作,要等接口成功返回,才能执行下一行代码
  2191. */
  2192. if (name == 'goods') {
  2193. const inSave = await this.saveColumnData(
  2194. this.getColumnName(15),
  2195. this.customerContact
  2196. );
  2197. if (inSave) {
  2198. this.$message.success("保存成功");
  2199. //关闭窗口
  2200. this.$refs.crudContact.$refs.dialogColumn.columnBox = false;
  2201. }
  2202. } else if (name === 'fees') {
  2203. const inSave = await this.saveColumnData(
  2204. this.getColumnName(16),
  2205. this.advantageProject
  2206. );
  2207. if (inSave) {
  2208. this.$message.success("保存成功");
  2209. //关闭窗口
  2210. this.$refs.crudProject.$refs.dialogColumn.columnBox = false;
  2211. }
  2212. }
  2213. },
  2214. returnBack(val) {
  2215. getlistBankBy(val).then(res =>{
  2216. this.$set(this.form, 'banks', null)
  2217. this.$set(this.form, 'banksAccountName', null)
  2218. this.$set(this.form, 'accountBank', null)
  2219. this.bankList = res.data
  2220. if (this.bankList.length > 0) {
  2221. this.form.banks = this.bankList[0].accountNo
  2222. this.form.banksAccountName = this.bankList[0].accountName
  2223. this.form.accountBank = this.bankList[0].accountBank
  2224. }
  2225. })
  2226. },
  2227. // 银行账号变化
  2228. banksChange(val) {
  2229. let isTrue = false
  2230. this.bankList.forEach(item => {
  2231. if (val == item.accountNo) {
  2232. this.$set(this.form, 'banksAccountName', item.accountName)
  2233. this.$set(this.form, 'accountBank', item.accountBank)
  2234. isTrue = true
  2235. }
  2236. })
  2237. if (!isTrue) {
  2238. this.$set(this.form, 'banksAccountName', null)
  2239. this.$set(this.form, 'accountBank', null)
  2240. }
  2241. },
  2242. }
  2243. }
  2244. </script>
  2245. <style lang="scss" scoped>
  2246. //.customer-head {
  2247. // position: fixed;
  2248. // top: 105px;
  2249. // width: 100%;
  2250. // margin-left: -10px;
  2251. // height: 62px;
  2252. // background: #ffffff;
  2253. // box-shadow: 0 4px 12px 0px rgba(232, 232, 235, 1);
  2254. // z-index: 999;
  2255. // /* display: flex;
  2256. // justify-content: left; */
  2257. //}
  2258. //
  2259. //.customer-back {
  2260. // cursor: pointer;
  2261. // line-height: 62px;
  2262. // font-size: 16px;
  2263. // color: #323233;
  2264. // font-weight: 400;
  2265. //}
  2266. .back-icon {
  2267. line-height: 64px;
  2268. font-size: 20px;
  2269. margin-right: 8px;
  2270. }
  2271. //.add-customer-btn {
  2272. // position: fixed;
  2273. // right: 36px;
  2274. // top: 115px;
  2275. //}
  2276. ::v-deep .el-form-item {
  2277. margin-bottom: 0;
  2278. }
  2279. .el-dialogDeep {
  2280. ::v-deep .el-dialog {
  2281. margin: 1vh auto 0 !important;
  2282. padding-bottom: 10px !important;
  2283. .el-dialog__body, .el-dialog__footer {
  2284. padding-bottom: 0 !important;
  2285. padding-top: 0 !important;
  2286. }
  2287. }
  2288. }
  2289. .print-div {
  2290. color: #000;
  2291. }
  2292. .print_table {
  2293. table {
  2294. border-right: 1px solid #000;
  2295. border-bottom: 1px solid #000;
  2296. font-size: 12px;
  2297. margin-bottom: 5px;
  2298. }
  2299. table td {
  2300. border-left: 1px solid #000;
  2301. border-top: 1px solid #000;
  2302. vertical-align: middle;
  2303. padding: 2px;
  2304. text-align: center;
  2305. }
  2306. }
  2307. .table {
  2308. border-collapse: collapse;
  2309. border-spacing: 0;
  2310. background-color: transparent;
  2311. display: table;
  2312. width: 99%;
  2313. max-width: 100%;
  2314. margin: 0 auto;
  2315. }
  2316. .table td {
  2317. text-align: left;
  2318. vertical-align: middle;
  2319. font-size: 14px;
  2320. color: #000000;
  2321. padding: 10.5px 0 10.5px 30px;
  2322. //border: 1px solid #000;
  2323. }
  2324. ::v-deep .el-form-item {
  2325. margin-bottom: 0;
  2326. }
  2327. ::v-deep .el-form-item__content{
  2328. line-height: 32px;
  2329. }
  2330. ///deep/ .avue-tree {
  2331. // display: flex;
  2332. // flex-direction: column;
  2333. // overflow-y: hidden;
  2334. // height: 100%;
  2335. //}
  2336. ///deep/ .avue-tree__filter {
  2337. // flex-shrink: 1;
  2338. //}
  2339. ///deep/ .avue-tree__content {
  2340. // height: calc(100% - 32px);
  2341. // overflow-y: auto;
  2342. //}
  2343. </style>