detailsPage.vue 68 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015
  1. <template>
  2. <div class="borderless" v-loading="pageLoading">
  3. <div class="customer-head">
  4. <div class="customer-back">
  5. <el-button type="danger" style="border: none;background: none;color: red" icon="el-icon-arrow-left"
  6. @click="backToList">返回列表
  7. </el-button>
  8. </div>
  9. <div class="add-customer-btn" v-if="showBut">
  10. <el-button type="primary" size="small" v-if="detailData.status == 1" class="el-button--small-yh "
  11. @click.stop="openEdit">编辑
  12. </el-button>
  13. <el-button type="info" @click="saveSell" size="small">生成销售单</el-button>
  14. <el-button type="success" :disabled="!form.id" size="small" @click="copyDoc">
  15. 复制单据
  16. </el-button>
  17. <el-button type="primary" :disabled="disabled" @click="editCustomer" :loading="subLoading"
  18. v-if="detailData.status != 1" size="small">保存数据
  19. </el-button>
  20. </div>
  21. </div>
  22. <div class="customer-main">
  23. <trade-card title="基础信息">
  24. <avue-form ref="form" class="trading-form" v-model="form" :option="option">
  25. <template slot="portOfLoad">
  26. <port-info v-model="form.portOfLoad" :disabled="detailData.status == 1" />
  27. </template>
  28. <template slot="portOfDestination">
  29. <port-info v-model="form.portOfDestination" :disabled="detailData.status == 1" />
  30. </template>
  31. <template slot="corpId">
  32. <crop-select v-model="form.corpId" @getCorpData="getCorpData" corpType="KH"
  33. :disabled="detailData.status == 1"></crop-select>
  34. </template>
  35. <template slot="corpAttn">
  36. <el-select size="small" v-model="form.corpAttn" placeholder="请选择" @change="corpAttnChange" clearable
  37. :disabled="detailData.status == 1">
  38. <el-option v-for="item in corpsattns" :key="item.id" :label="item.cname" :value="item.cname">
  39. </el-option>
  40. </el-select>
  41. </template>
  42. <template slot="belongToCorpId">
  43. <crop-select v-model="form.belongToCorpId" corpType="GS" :disabled="detailData.status == 1"></crop-select>
  44. </template>
  45. <template slot="priceTerms">
  46. <el-select size="small" v-model="form.priceTerms" placeholder="请选择" @change="priceTermsChange" clearable
  47. :disabled="detailData.status == 1">
  48. <el-option v-for="item in priceTermsList" :key="item.id" :label="item.dictValue" :value="item.dictValue">
  49. </el-option>
  50. </el-select>
  51. </template>
  52. <template slot="paymentType">
  53. <el-select size="small" v-model="form.paymentType" placeholder="请选择" @change="paymentTypeChange" clearable
  54. :disabled="detailData.status == 1">
  55. <el-option v-for="item in paymentTermList" :key="item.id" :label="item.dictValue" :value="item.dictValue">
  56. </el-option>
  57. </el-select>
  58. </template>
  59. <template slot="businesDate">
  60. <el-date-picker v-model="form.businesDate" type="date" format="yyyy-MM-dd"
  61. value-format="yyyy-MM-dd 00:00:00" :disabled="detailData.status == 1" @change="businesDateChange">
  62. </el-date-picker>
  63. </template>
  64. <template slot="currency">
  65. <el-select size="small" v-model="form.currency" placeholder="请选择" @change="currencyChange"
  66. :disabled="detailData.status == 1" clearable>
  67. <el-option v-for="item in currencyList" :key="item.id" :label="item" :value="item">
  68. </el-option>
  69. </el-select>
  70. </template>
  71. <template slot="exchangeRate">
  72. <el-input size="small" v-model="form.exchangeRate"
  73. oninput="value=value.replace(/[^0-9.]/g,'').replace(/^(\-)*(\d+)\.(\d\d).*$/,'$1$2.$3')"
  74. placeholder="请输入 汇率" :disabled="detailData.status == 1" @change="exchangeRateChange" />
  75. </template>
  76. <template slot="boxPile">
  77. <el-select size="small" v-model="form.boxPile" placeholder="请选择" clearable filterable
  78. :disabled="detailData.status == 1">
  79. <el-option v-for="item in allBoxs" :key="item.id" :label="item.name" :value="item.name">
  80. </el-option>
  81. </el-select>
  82. </template>
  83. <template slot="boxNumber">
  84. <el-input size="small" v-model="form.boxNumber"
  85. oninput="value=value.replace(/[^0-9.]/g,'').replace(/^(\-)*(\d+)\.(\d\d).*$/,'$1$2.$3')"
  86. placeholder="请输入 箱量" :disabled="detailData.status == 1" />
  87. </template>
  88. <template slot="minOrder">
  89. <el-input size="small" v-model="form.minOrder"
  90. oninput="value=value.replace(/[^0-9.]/g,'').replace(/^(\-)*(\d+)\.(\d\d).*$/,'$1$2.$3')"
  91. placeholder="请输入 起订量" :disabled="detailData.status == 1" />
  92. </template>
  93. <template slot="predictOceanFreight">
  94. <el-input size="small" v-model="form.predictOceanFreight"
  95. oninput="value=value.replace(/[^0-9.]/g,'').replace(/^(\-)*(\d+)\.(\d\d).*$/,'$1$2.$3')"
  96. placeholder="请输入 预计海运费" :disabled="detailData.status == 1" />
  97. </template>
  98. <template slot="referenceOceanFreight">
  99. <el-input size="small" v-model="form.referenceOceanFreight"
  100. oninput="value=value.replace(/[^0-9.]/g,'').replace(/^(\-)*(\d+)\.(\d\d).*$/,'$1$2.$3')"
  101. placeholder="请输入 参考海运费" :disabled="detailData.status == 1" />
  102. </template>
  103. <template slot="oceanFreight">
  104. <el-input size="small" v-model="form.oceanFreight"
  105. oninput="value=value.replace(/[^0-9.]/g,'').replace(/^(\-)*(\d+)\.(\d\d).*$/,'$1$2.$3')"
  106. placeholder="请输入 实际海运费" :disabled="detailData.status == 1" />
  107. </template>
  108. </avue-form>
  109. </trade-card>
  110. <trade-card title="商品信息">
  111. <avue-crud ref="crud" :data="data" :option="tableOption" @row-del="rowDel" :summary-method="summaryMethod"
  112. @saveColumn="saveColumn" @resetColumn="resetColumn" :cell-style="cellStyle" @row-dblclick="handleRowDBLClick">
  113. <template slot="headerSerial">
  114. <el-button type="primary" icon="el-icon-plus" size="mini" @click.stop="addRow"
  115. :disabled="detailData.status == 1" circle></el-button>
  116. </template>
  117. <template slot="menuLeft">
  118. <el-row>
  119. <el-button type="primary" icon="el-icon-plus" size="small" @click.stop="newDetails"
  120. :disabled="detailData.status == 1">批量录入</el-button>
  121. <el-button type="primary" icon="el-icon-plus" size="small" @click.stop="addLibrary"
  122. :disabled="detailData.status == 1">出口价格库</el-button>
  123. <el-button type="info" icon="el-icon-printer" size="small" @click.stop="openReport()">报表打印</el-button>
  124. <el-button type="info" size="small" @click.stop="savePurchase" :disabled="detailData.status == 1">采购询价
  125. </el-button>
  126. <el-button type="info" size="small" @click.stop="saveShipping" :disabled="detailData.status == 1">船务询价
  127. </el-button>
  128. <el-button v-if="goodsEditShow" size="small" type="primary" @click="handleSave">保存明细</el-button>
  129. <el-button v-if="goodsEditShow" size="small" @click="handleClose">关闭明细</el-button>
  130. </el-row>
  131. <el-row>
  132. <avue-form v-if="goodsEditShow" class="trading-form" v-model="goodsEditForm" :option="goodsEditOption">
  133. <template slot="ename">
  134. <el-input type="textarea" size="small" v-model="goodsEditForm.ename" placeholder="请输入"
  135. @change="formEditChange(goodsEditForm)" />
  136. </template>
  137. <template slot="itemProp">
  138. <el-input type="textarea" size="small" v-model="goodsEditForm.itemProp" placeholder="请输入"
  139. @change="formEditChange(goodsEditForm)" />
  140. </template>
  141. <template slot="itemDescription">
  142. <el-input type="textarea" size="small" v-model="goodsEditForm.itemDescription" placeholder="请输入"
  143. @change="formEditChange(goodsEditForm)" />
  144. </template>
  145. <template slot="partsDescribe">
  146. <el-input type="textarea" size="small" v-model="goodsEditForm.partsDescribe" placeholder="请输入"
  147. @change="formEditChange(goodsEditForm)" />
  148. </template>
  149. </avue-form>
  150. </el-row>
  151. </template>
  152. <template slot="menu" slot-scope="{ row, index }">
  153. <div style="display:flex;justify-content: center;">
  154. <el-button size="small" icon="el-icon-edit" type="text" @click="rowCell(row, index)"
  155. :disabled="disabled || detailData.status == 1">{{ row.$cellEdit ? "保存" : "修改" }}</el-button>
  156. <el-button size="small" icon="el-icon-delete" type="text" @click="rowDel(row, index)"
  157. :disabled="detailData.status == 1">删除</el-button>
  158. <div v-if="!goodsEditShow"
  159. style="display:flex;flex-direction: column;justify-content: center;margin-left: 10px;">
  160. <el-tooltip effect="dark" content="向上移动" placement="top">
  161. <i v-if="index != 0" :disabled="detailData.status == 1" class="el-icon-arrow-up"
  162. @click="moveUp(row, index)" style="color:#409EFF;"></i>
  163. </el-tooltip>
  164. <el-tooltip effect="dark" content="向下移动" placement="bottom"> <i v-if="index != (data.length - 1)"
  165. :disabled="detailData.status == 1" class="el-icon-arrow-down" @click="moveDown(row, index)"
  166. style="color:#409EFF;"></i></el-tooltip>
  167. </div>
  168. </div>
  169. </template>
  170. <template slot="itemType" slot-scope="{ row }">
  171. <el-select v-if="row.$cellEdit" v-model="row.itemType" filterable allow-create default-first-option
  172. placeholder="请输入" size="small" @focus="itemTypeFocus(row)">
  173. <el-option v-for="(item, index) in itemtypeList" :key="index" :label="item.value" :value="item.value">
  174. </el-option>
  175. </el-select>
  176. <span v-else>{{ row.itemType }}</span>
  177. </template>
  178. <template slot="ename" slot-scope="{ row, index }">
  179. <el-input v-if="row.$cellEdit" v-model="row.ename" size="small" placeholder="请点击右边按钮"
  180. @change="editChange(row)"></el-input>
  181. <span v-else>{{ row.ename }}</span>
  182. </template>
  183. <template slot="itemProp" slot-scope="{ row, index }">
  184. <span v-if="row.$cellEdit" style="display:flex">
  185. <el-input v-model="row.itemProp" size="small" placeholder="请点击右边按钮" @change="editChange(row)"></el-input>
  186. <el-button icon="el-icon-edit" size="mini" @click="openProperty(row, index)"></el-button>
  187. </span>
  188. <span v-else>{{ row.itemProp }}</span>
  189. </template>
  190. <template slot="itemDescription" slot-scope="{ row, index }">
  191. <span v-if="row.$cellEdit" style="display:flex">
  192. <el-input v-model="row.itemDescription" size="small" placeholder="请输入" @change="editChange(row)">
  193. </el-input>
  194. </span>
  195. <span v-else>{{ row.itemDescription }}</span>
  196. </template>
  197. <template slot="cname" slot-scope="{ row, index }">
  198. <span v-if="row.$cellEdit" style="display:flex">
  199. <el-select v-model="row.itemId" placeholder="请选择" size="small" style="width:60%"
  200. @change="cnameChange(row, index)">
  201. <el-option v-for="item in goodsoptions" :key="item.id" :label="item.cname" :value="item.id">
  202. </el-option>
  203. </el-select>
  204. <el-button icon="el-icon-search" size="small" @click="rePick(row, index)"></el-button>
  205. </span>
  206. <span v-else> {{ row.cname }}</span>
  207. </template>
  208. <template slot="partsDescribe" slot-scope="{ row, index }">
  209. <span v-if="row.$cellEdit" style="display:flex">
  210. <el-input v-model="row.partsDescribe" size="small" placeholder="请点击右边按钮" @change="editChange(row)">
  211. </el-input>
  212. <el-button icon="el-icon-edit" size="mini" @click="partrePick(row, index)"></el-button>
  213. </span>
  214. <span v-else>{{ row.partsDescribe }}</span>
  215. </template>
  216. <template slot="priorityReferrer" slot-scope="{ row }">
  217. <el-checkbox :disabled="!row.$cellEdit" v-model="row.priorityReferrer" :true-label="1" :false-label="0" />
  218. </template>
  219. <template slot="corpId" slot-scope="{ row }">
  220. <span>{{ row.corpName }}</span>
  221. </template>
  222. <template slot="purchaseCost" slot-scope="{ row }">
  223. <el-input v-if="row.$cellEdit" v-model="row.purchaseCost" size="small" placeholder="请输入"
  224. oninput="value=value.replace(/[^0-9.]/g,'').replace(/^(\-)*(\d+)\.(\d\d).*$/,'$1$2.$3')"></el-input>
  225. <span v-else>{{ row.purchaseCost | micrometerFormat }}</span>
  226. </template>
  227. <template slot="purchaseAmount" slot-scope="{ row }">
  228. <el-input v-if="row.$cellEdit" v-model="row.purchaseAmount" size="small" placeholder="请输入"
  229. @change="purchaseAmountChange(row)"
  230. oninput="value=value.replace(/[^0-9.]/g,'').replace(/^(\-)*(\d+)\.(\d\d).*$/,'$1$2.$3')"></el-input>
  231. <span v-else>{{ row.purchaseAmount | micrometerFormat }}</span>
  232. </template>
  233. <template slot="price" slot-scope="{ row }">
  234. <el-input v-if="row.$cellEdit" v-model="row.price" size="small"
  235. oninput="value=value.replace(/[^0-9.]/g,'').replace(/^(\-)*(\d+)\.(\d\d).*$/,'$1$2.$3')"
  236. @change="priceChange(row)"></el-input>
  237. <span v-else>{{ row.price | micrometerFormat }}</span>
  238. </template>
  239. <template slot="amount" slot-scope="{ row }">
  240. <span>{{ row.amount | micrometerFormat }}</span>
  241. </template>
  242. <template slot="orderQuantity" slot-scope="{ row }">
  243. <el-input v-if="row.$cellEdit" v-model="row.orderQuantity" size="small"
  244. oninput='this.value=this.value.replace(/[^(\d)]/g,"")' @change="priceChange(row)"></el-input>
  245. <span v-else>{{ row.orderQuantity | IntegerFormat }}</span>
  246. </template>
  247. <template slot="discount" slot-scope="{ row }">
  248. <el-input v-if="row.$cellEdit" v-model="row.discount" size="small"
  249. oninput="value=value.replace(/[^0-9.]/g,'').replace(/^(\-)*(\d+)\.(\d\d).*$/,'$1$2.$3')"
  250. @change="discountChange(row)"></el-input>
  251. <span v-else>{{ row.discount | isDiscount }}</span>
  252. </template>
  253. <template slot="insurance" slot-scope="{ row }">
  254. <el-input v-if="row.$cellEdit" v-model="row.insurance" size="small"
  255. oninput="value=value.replace(/[^0-9.]/g,'').replace(/^(\-)*(\d+)\.(\d\d).*$/,'$1$2.$3')"
  256. @change="priceChange(row)"></el-input>
  257. <span v-else>{{ row.insurance | micrometerFormat }}</span>
  258. </template>
  259. <template slot="freight" slot-scope="{ row }">
  260. <el-input v-if="row.$cellEdit" v-model="row.freight" size="small"
  261. oninput="value=value.replace(/[^0-9.]/g,'').replace(/^(\-)*(\d+)\.(\d\d).*$/,'$1$2.$3')"
  262. @change="priceChange(row)"></el-input>
  263. <span v-else>{{ row.freight | micrometerFormat }}</span>
  264. </template>
  265. <template slot="taxRate" slot-scope="{ row }">
  266. <el-input v-if="row.$cellEdit" v-model="row.taxRate" size="small"
  267. oninput="value=value.replace(/[^0-9.]/g,'').replace(/^(\-)*(\d+)\.(\d\d).*$/,'$1$2.$3')"
  268. @change="taxRateChange(row)"></el-input>
  269. <span v-else>{{ row.taxRate | isPercentage }}</span>
  270. </template>
  271. <template slot="itemMargin" slot-scope="{ row }">
  272. <span>{{ row.itemMargin | isPercentage }}</span>
  273. </template>
  274. </avue-crud>
  275. </trade-card>
  276. <fee-info ref="feeInfo" :orderFeesList="orderFeesList" :disabled="detailData.status == 1"
  277. feeUrl="/blade-purchase-sales/orderfees/update" optionType="CK" itemType="报价" @beforeFinance="beforeFinance"
  278. :inCropId="true" />
  279. <containerTitle title="合同附件">
  280. </containerTitle>
  281. <c-upload typeUpload="CK" :data="orderFilesList" :disabled="detailData.status == 1" :enumerationValue="76"
  282. deleteUrl="/blade-purchase-sales/orderfiles/update" />
  283. </div>
  284. <el-dialog title="导入商品" append-to-body class="el-dialogDeep" :visible.sync="dialogVisible" width="80%"
  285. :close-on-click-modal="false" :destroy-on-close="true" :close-on-press-escape="false" @close="closeGoods"
  286. top="5vh" v-dialog-drag>
  287. <span>
  288. <el-row>
  289. <el-col :span="4">
  290. <div>
  291. <el-scrollbar>
  292. <basic-container>
  293. <avue-tree :option="treeOption" @node-click="nodeClick" :style="treeStyle" />
  294. </basic-container>
  295. </el-scrollbar>
  296. </div>
  297. </el-col>
  298. <el-col :span="20">
  299. <avue-crud :option="goodsOption" :table-loading="loading" :data="goodsList" ref="goodsCrud"
  300. :search.sync="search" @search-change="searchChange" @refresh-change="refreshChange"
  301. @selection-change="selectionChange" @row-click="rowClick" :page.sync="page" @on-load="onLoad"
  302. @saveColumn="saveGoodsColumn" @resetColumn="resetGoodsColumn" :cell-style="cellStyle"></avue-crud>
  303. </el-col>
  304. </el-row>
  305. </span>
  306. <span slot="footer" class="dialog-footer">
  307. <el-button @click="dialogVisible = false">取 消</el-button>
  308. <el-button type="primary" @click="importGoods" :disabled="selectionList.length == 0">导入</el-button>
  309. </span>
  310. </el-dialog>
  311. <report-dialog :switchDialog="switchDialog" :reportId="form.id" reportName="报价单明细(E)" @onClose="onClose()">
  312. </report-dialog>
  313. <part-dialog ref="part" :partList="partList" @importPart="importPart" @partClosed="partClosed" />
  314. <property-dialog ref="property" @importProperty="importProperty" />
  315. <price-library ref="library" @importLibray="importLibray" />
  316. </div>
  317. </template>
  318. <script>
  319. import tableOption from "./config/customerContact.json";
  320. import goodsOption from "./config/commodity.json";
  321. import feeInfo from "@/components/fee-info/main";
  322. import customerDialog from "@/components/customer-dialog/main";
  323. import partDialog from "@/components/part-dialog/main";
  324. import propertyDialog from "@/components/property-dialog/main";
  325. import {
  326. detail,
  327. submit,
  328. delItem,
  329. getDeptLazyTree,
  330. getGoods,
  331. savePurchase,
  332. saveShipping,
  333. getPorts,
  334. getSpecification,
  335. saveSell,
  336. getPricedetail,
  337. getParities,
  338. getCode
  339. } from "@/api/basicData/customerInquiry";
  340. import { getAllBoxs } from "@/api/basicData/portinformation";
  341. import { getCorpsattn } from "@/api/basicData/customerInformation";
  342. import reportDialog from "@/components/report-dialog/main";
  343. import priceLibrary from "@/components/price-Library/main";
  344. import detailsSelect from "@/components/details-select/main";
  345. import {
  346. isDiscount,
  347. isPercentage,
  348. micrometerFormat,
  349. IntegerFormat
  350. } from "@/util/validate";
  351. import { contrastObj, contrastList } from "@/util/contrastData";
  352. import { dateFormat } from "@/util/date";
  353. import {
  354. productCal,
  355. sellingCal,
  356. amountCal,
  357. transformCal,
  358. grossProfitCal,
  359. STGPCal,
  360. numCal,
  361. costsCal,
  362. costCal
  363. } from "@/util/calculate";
  364. import _ from "lodash";
  365. export default {
  366. name: "detailsPageEdit",
  367. data() {
  368. return {
  369. goodsEditForm: {},
  370. show: true,
  371. oldExchange: null,
  372. treeStyle: "height:" + (window.innerHeight - 315) + "px",
  373. itemtypeList: [],
  374. switchDialog: false,
  375. form: {
  376. orderStatus: "录入",
  377. businesDate: dateFormat(new Date(), "yyyy-MM-dd") + " 00:00:00",
  378. currency: "USD"
  379. },
  380. disabled: false,
  381. dialogVisible: false,
  382. tableOption: {},
  383. option: {
  384. menuBtn: false,
  385. labelWidth: 100,
  386. column: [
  387. {
  388. label: "客户名称",
  389. prop: "corpId",
  390. rules: [
  391. {
  392. required: true,
  393. message: "",
  394. trigger: "blur"
  395. }
  396. ],
  397. span: 10,
  398. slot: true,
  399. },
  400. {
  401. label: "公司主体",
  402. prop: "belongToCorpId",
  403. span: 6,
  404. offset: 2,
  405. },
  406. {
  407. label: "系统号",
  408. prop: "sysNo",
  409. span: 6,
  410. disabled: true
  411. },
  412. {
  413. label: "详情信息",
  414. prop: "clientMessage",
  415. type: "textarea",
  416. minRows: 2,
  417. span: 10
  418. },
  419. {
  420. label: "报价日期",
  421. prop: "businesDate",
  422. span: 6,
  423. offset: 2,
  424. rules: [
  425. {
  426. required: true,
  427. message: "",
  428. trigger: "blur"
  429. }
  430. ]
  431. },
  432. {
  433. label: "报价单号",
  434. prop: "orderNo",
  435. span: 6
  436. },
  437. {
  438. label: "联系人",
  439. prop: "corpAttn",
  440. span: 5
  441. },
  442. {
  443. label: "电话",
  444. prop: "corpTel",
  445. span: 5,
  446. },
  447. {
  448. label: "有效日期",
  449. prop: "dateValidity",
  450. span: 6,
  451. type: "date",
  452. format: "yyyy-MM-dd",
  453. valueFormat: "yyyy-MM-dd 00:00:00",
  454. offset: 2,
  455. rules: [
  456. {
  457. required: true,
  458. message: "",
  459. trigger: "blur"
  460. }
  461. ]
  462. },
  463. {
  464. label: "日期说明",
  465. prop: "dateDesc",
  466. type: "textarea",
  467. minRows: 1,
  468. span: 6,
  469. },
  470. {
  471. label: "起运港",
  472. prop: "portOfLoad",
  473. span: 6,
  474. type: "select",
  475. filterable: true,
  476. rules: [
  477. {
  478. required: true,
  479. message: "",
  480. trigger: "blur"
  481. }
  482. ],
  483. dicData: [],
  484. props: {
  485. label: "name",
  486. value: "name"
  487. }
  488. },
  489. {
  490. label: "目的港",
  491. prop: "portOfDestination",
  492. span: 6,
  493. type: "select",
  494. filterable: true,
  495. rules: [
  496. {
  497. required: true,
  498. message: "",
  499. trigger: "blur"
  500. }
  501. ],
  502. dicData: [],
  503. props: {
  504. label: "name",
  505. value: "name"
  506. }
  507. },
  508. {
  509. label: "运输方式",
  510. prop: "transport",
  511. span: 6,
  512. type: "select",
  513. dicUrl: "/api/blade-system/dict-biz/dictionary?code=mode_transport",
  514. props: {
  515. label: "dictValue",
  516. value: "dictValue"
  517. }
  518. },
  519. {
  520. label: "订单状态",
  521. prop: "orderStatus",
  522. span: 6,
  523. type: "select",
  524. dicUrl: "/api/blade-system/dict-biz/dictionary?code=order_status",
  525. props: {
  526. label: "dictValue",
  527. value: "dictValue"
  528. }
  529. },
  530. {
  531. label: "价格条款",
  532. prop: "priceTerms",
  533. span: 6
  534. // type: "select",
  535. // dicData:[],
  536. // props: {
  537. // label: "dictValue",
  538. // value: "dictValue"
  539. // }
  540. },
  541. {
  542. label: "条款说明",
  543. prop: "priceTermsDescription",
  544. type: "textarea",
  545. minRows: 1,
  546. span: 12,
  547. },
  548. {
  549. label: "币别",
  550. prop: "currency",
  551. span: 6,
  552. rules: [
  553. {
  554. required: true,
  555. message: "",
  556. trigger: "blur"
  557. }
  558. ]
  559. },
  560. {
  561. label: "收款方式",
  562. prop: "paymentType",
  563. span: 6
  564. // type: "select",
  565. // dicUrl: "/api/blade-system/dict-biz/dictionary?code=payment_term",
  566. // props: {
  567. // label: "dictValue",
  568. // value: "dictValue"
  569. // }
  570. },
  571. {
  572. label: "收款说明",
  573. prop: "paymentTypeDescription",
  574. type: "textarea",
  575. minRows: 1,
  576. span: 12,
  577. },
  578. {
  579. label: "汇率",
  580. prop: "exchangeRate",
  581. span: 6,
  582. rules: [
  583. {
  584. required: true,
  585. message: "",
  586. trigger: "blur"
  587. }
  588. ]
  589. },
  590. {
  591. label: "产品毛利",
  592. prop: "grossProfit",
  593. span: 6,
  594. disabled: true
  595. },
  596. {
  597. label: "产品利率",
  598. prop: "grossProfitRate",
  599. span: 6,
  600. append: "%",
  601. disabled: true
  602. },
  603. {
  604. label: "单票毛利",
  605. prop: "singleTicketMargin",
  606. span: 6,
  607. row: true,
  608. disabled: true
  609. },
  610. {
  611. label: "箱型",
  612. prop: "boxPile",
  613. span: 6
  614. },
  615. {
  616. label: "箱量",
  617. prop: "boxNumber",
  618. span: 6
  619. },
  620. {
  621. label: "起订量",
  622. prop: "minOrder",
  623. row: true,
  624. span: 6
  625. },
  626. {
  627. label: "预计海运费",
  628. prop: "predictOceanFreight",
  629. span: 6
  630. },
  631. {
  632. label: "参考海运费",
  633. prop: "referenceOceanFreight",
  634. span: 6
  635. },
  636. {
  637. label: "实际海运费",
  638. prop: "oceanFreight",
  639. span: 6
  640. },
  641. {
  642. label: "备注",
  643. prop: "orderRemark",
  644. type: "textarea",
  645. minRows: 2,
  646. span: 8
  647. },
  648. {
  649. label: "采购备注",
  650. prop: "purchaseRemark",
  651. type: "textarea",
  652. minRows: 2,
  653. span: 8
  654. },
  655. {
  656. label: "船务备注",
  657. prop: "shippingRemark",
  658. type: "textarea",
  659. minRows: 2,
  660. span: 8
  661. }
  662. ]
  663. },
  664. goodsEditShow: false,
  665. goodsEditOption: {
  666. emptyBtn: false,
  667. submitBtn: false,
  668. labelWidth: 100,
  669. column: [
  670. {
  671. label: "英文名称",
  672. prop: "ename",
  673. type: "textarea",
  674. minRows: 2,
  675. span: 12,
  676. },
  677. {
  678. label: "产品属性",
  679. prop: "itemProp",
  680. type: "textarea",
  681. minRows: 2,
  682. span: 12,
  683. },
  684. {
  685. label: "产品描述",
  686. prop: "itemDescription",
  687. type: "textarea",
  688. minRows: 2,
  689. span: 12,
  690. },
  691. {
  692. label: "配件信息",
  693. prop: "partsDescribe",
  694. type: "textarea",
  695. minRows: 2,
  696. span: 12,
  697. },
  698. {
  699. label: "商品信息",
  700. prop: "productRemark",
  701. type: "textarea",
  702. minRows: 2,
  703. span: 24,
  704. }
  705. ]
  706. },
  707. treeOption: {
  708. nodeKey: "id",
  709. lazy: true,
  710. treeLoad: function (node, resolve) {
  711. const parentId = node.level === 0 ? 0 : node.data.id;
  712. getDeptLazyTree(parentId).then(res => {
  713. resolve(
  714. res.data.data.map(item => {
  715. return {
  716. ...item,
  717. leaf: !item.hasChildren
  718. };
  719. })
  720. );
  721. });
  722. },
  723. addBtn: false,
  724. menu: false,
  725. size: "small",
  726. props: {
  727. label: "title",
  728. value: "value",
  729. children: "children"
  730. }
  731. },
  732. page: {
  733. pageSize: 10,
  734. currentPage: 1,
  735. total: 0
  736. },
  737. goodsOption: {},
  738. data: [],
  739. goodsList: [],
  740. selectionList: [],
  741. treeDeptId: null,
  742. orderFeesList: [],
  743. orderFilesList: [],
  744. oldform: {
  745. orderStatus: "录入",
  746. businesDate: dateFormat(new Date(), "yyyy-MM-dd") + " 00:00:00",
  747. currency: "USD"
  748. },
  749. olddata: [],
  750. oldorderFeesList: [],
  751. oldorderFilesList: [],
  752. reData: null,
  753. loading: false,
  754. subLoading: false,
  755. pageLoading: false,
  756. showBut: true,
  757. partList: [],
  758. goodsoptions: [],
  759. priceTermsList: [],
  760. paymentTermList: [],
  761. currencyList: [],
  762. corpsattns: [],
  763. allBoxs: [],
  764. search: {}
  765. };
  766. },
  767. props: {
  768. detailData: {
  769. type: Object
  770. }
  771. },
  772. components: {
  773. reportDialog,
  774. feeInfo,
  775. customerDialog,
  776. partDialog,
  777. priceLibrary,
  778. propertyDialog,
  779. detailsSelect
  780. },
  781. async created() {
  782. if (this.detailData.id) {
  783. this.getDetail(this.detailData.id);
  784. }
  785. this.tableOption = await this.getColumnData(
  786. this.getColumnName(1),
  787. tableOption
  788. );
  789. // console.log(JSON.stringify('(<el-button type="primary" icon="el-icon-circle-plus" circle size="small" onClick={() => this.$refs.crudBox.rowCellAdd()}></el-button>)'))
  790. this.goodsOption = await this.getColumnData(
  791. this.getColumnName(26),
  792. goodsOption
  793. );
  794. if (this.detailData.status == 1) {
  795. this.option.disabled = true;
  796. }
  797. if (localStorage.getItem("roleName") == "贸易") {
  798. this.findObject(this.tableOption.column, "purchaseCost").hide = true;
  799. this.findObject(
  800. this.tableOption.column,
  801. "purchaseCost"
  802. ).showColumn = false;
  803. this.findObject(this.tableOption.column, "partsCost").hide = true;
  804. this.findObject(this.tableOption.column, "partsCost").showColumn = false;
  805. }
  806. this.getWorkDicts("product_properties").then(res => {
  807. this.findObject(this.tableOption.column, "itemProp").dicData =
  808. res.data.data;
  809. });
  810. this.getWorkDicts("unit").then(res => {
  811. this.findObject(this.tableOption.column, "unit").dicData = res.data.data;
  812. });
  813. this.getWorkDicts("pricing_terms").then(res => {
  814. this.priceTermsList = res.data.data;
  815. });
  816. this.getWorkDicts("payment_term").then(res => {
  817. this.paymentTermList = res.data.data;
  818. });
  819. getCode().then(res => {
  820. this.currencyList = res.data.data;
  821. });
  822. if (!this.detailData.id) {
  823. this.getParities();
  824. }
  825. getPorts().then(res => {
  826. this.findObject(this.option.column, "portOfLoad").dicData = res.data;
  827. this.findObject(this.option.column, "portOfDestination").dicData =
  828. res.data;
  829. });
  830. getAllBoxs().then(res => {
  831. this.allBoxs = res.data.data;
  832. });
  833. getGoods(1, 10).then(res => {
  834. if (res.data.data.total > 0) {
  835. this.goodsoptions = res.data.data.records;
  836. if (Math.ceil(res.data.data.total / 10) > 1) {
  837. for (let i = 2; i <= Math.ceil(res.data.data.total / 10); i++) {
  838. getGoods(i, 10).then(e => {
  839. this.goodsoptions = this.goodsoptions.concat(e.data.data.records);
  840. });
  841. }
  842. }
  843. }
  844. });
  845. },
  846. filters: {
  847. isDiscount(val) {
  848. return isDiscount(val);
  849. },
  850. isPercentage(val) {
  851. return isPercentage(val);
  852. },
  853. micrometerFormat(val) {
  854. return micrometerFormat(val);
  855. },
  856. IntegerFormat(num) {
  857. return IntegerFormat(num);
  858. }
  859. },
  860. methods: {
  861. cellStyle() {
  862. return "padding:0;height:40px;";
  863. },
  864. copyDoc() {
  865. this.$emit("copyOrder", this.form.id);
  866. },
  867. getParities(status) {
  868. getParities({
  869. currency: this.form.currency,
  870. businesDate: this.form.businesDate
  871. })
  872. .then(res => {
  873. const data = res.data.data;
  874. this.form.exchangeRate = data.receivableParities;
  875. this.oldform.exchangeRate = data.receivableParities;
  876. this.oldExchange = this.deepClone(data.receivableParities);
  877. })
  878. .finally(() => {
  879. if (this.data.length > 0 && status == "currency") {
  880. this.data.forEach(e => {
  881. e.freight = transformCal(
  882. e.freight,
  883. this.oldExchange,
  884. this.form.exchangeRate
  885. );
  886. e.insurance = transformCal(
  887. e.insurance,
  888. this.oldExchange,
  889. this.form.exchangeRate
  890. );
  891. e.price = sellingCal(e.productPrice, this.form.exchangeRate);
  892. e.amount = amountCal(
  893. e.price,
  894. e.orderQuantity,
  895. e.freight,
  896. e.insurance,
  897. e.discount
  898. );
  899. e.itemMargin = grossProfitCal(
  900. e.purchaseAmount,
  901. e.partsPrice,
  902. e.price,
  903. this.form.exchangeRate
  904. );
  905. e.exchangeRate = this.form.exchangeRate;
  906. });
  907. }
  908. });
  909. },
  910. refreshChange() {
  911. this.onLoad(this.page);
  912. },
  913. businesDateChange() {
  914. if (this.form.currency && this.form.businesDate) {
  915. this.getParities();
  916. }
  917. },
  918. getCorpData(row) {
  919. this.form.corpAttn = null;
  920. this.form.corpTel = null;
  921. this.form.coefficient = row.coefficient;
  922. this.form.clientMessage = (row.cname ? row.cname : '') + '\r\n' + (row.addr ? row.addr : '')
  923. if (this.data.length > 0) {
  924. this.data.forEach(e => {
  925. e.productPrice = productCal(
  926. e.purchaseAmount,
  927. e.partsPrice,
  928. this.form.coefficient
  929. );
  930. e.price = sellingCal(e.productPrice, this.form.exchangeRate);
  931. e.amount = amountCal(
  932. e.price,
  933. e.orderQuantity,
  934. e.freight,
  935. e.insurance,
  936. e.discount
  937. );
  938. e.itemMargin = grossProfitCal(
  939. e.purchaseAmount,
  940. e.partsPrice,
  941. e.price,
  942. this.form.exchangeRate
  943. );
  944. });
  945. }
  946. },
  947. addRow() {
  948. this.data.push({ $cellEdit: true });
  949. },
  950. corpAttnChange() {
  951. this.corpsattns.forEach(e => {
  952. if (this.form.corpId == e.pid) {
  953. this.form.corpTel = e.tel;
  954. }
  955. });
  956. },
  957. rowCorpData(row) {
  958. this.data[row.index].corpName = row.code;
  959. },
  960. priceTermsChange(row) {
  961. if (row == "FOB" || row == "EXW") {
  962. this.form.priceTermsDescription = this.form.portOfLoad;
  963. } else {
  964. this.form.priceTermsDescription = this.form.portOfDestination;
  965. }
  966. },
  967. paymentTypeChange(row) {
  968. this.paymentTermList.forEach(e => {
  969. if (row == e.dictValue) {
  970. this.form.paymentTypeDescription = e.remark;
  971. }
  972. });
  973. },
  974. addLibrary() {
  975. if (!this.form.corpId) {
  976. return this.$message.error("请选择客户名称");
  977. }
  978. if (!this.form.currency) {
  979. return this.$message.error("请选择币别");
  980. }
  981. this.$refs.library.init(false);
  982. },
  983. handleRowDBLClick(row) {
  984. if (row.$cellEdit) {
  985. return this.$message.error("请保存此行内容再操作");
  986. }
  987. if (this.detailData.status != 1 && !row.$cellEdit) {
  988. this.goodsEditShow = true
  989. this.goodsEditForm = row
  990. }
  991. },
  992. handleSave() {
  993. this.$set(this.data, this.goodsEditForm.$index, this.goodsEditForm)
  994. this.goodsEditShow = false
  995. this.goodsEditForm = this.$options.data().goodsEditForm
  996. },
  997. handleClose() {
  998. this.goodsEditShow = false
  999. this.goodsEditForm = this.$options.data().goodsEditForm
  1000. },
  1001. cnameChange(row) {
  1002. this.goodsoptions.forEach(e => {
  1003. if (e.id == row.itemId) {
  1004. row.cname = e.cname;
  1005. row.code = e.code;
  1006. row.corpId = e.corpId;
  1007. row.corpName = e.corpCode;
  1008. row.priceCategory = e.goodsTypeName;
  1009. row.itemUrl = e.url;
  1010. row.itemDescription = e.cnameDescription;
  1011. row.unit = e.unit;
  1012. row.purchaseAmount = 0;
  1013. row.productPrice = productCal(
  1014. 0,
  1015. row.partsPrice,
  1016. this.form.coefficient
  1017. );
  1018. row.price = sellingCal(
  1019. productCal(0, row.partsPrice, this.form.coefficient),
  1020. this.form.exchangeRate
  1021. );
  1022. row.amount = amountCal(
  1023. sellingCal(
  1024. productCal(0, row.partsPrice, this.form.coefficient),
  1025. this.form.exchangeRate
  1026. ),
  1027. row.orderQuantity,
  1028. row.freight,
  1029. row.insurance,
  1030. row.discount
  1031. );
  1032. row.itemMargin = grossProfitCal(
  1033. 0,
  1034. row.partsPrice,
  1035. sellingCal(
  1036. productCal(0, row.partsPrice, this.form.coefficient),
  1037. this.form.exchangeRate
  1038. ),
  1039. this.form.exchangeRate
  1040. );
  1041. }
  1042. });
  1043. getPricedetail({ itemId: row.itemId, corpId: row.corpId }).then(res => {
  1044. if (res.data.data) {
  1045. this.goodsoptions.forEach(e => {
  1046. if (e.id == row.itemId) {
  1047. row.purchaseAmount = res.data.data.purchaseAmount;
  1048. row.productPrice = productCal(
  1049. res.data.data.purchaseAmount,
  1050. row.partsPrice,
  1051. this.form.coefficient
  1052. );
  1053. row.price = sellingCal(
  1054. productCal(
  1055. res.data.data.purchaseAmount,
  1056. row.partsPrice,
  1057. this.form.coefficient
  1058. ),
  1059. this.form.exchangeRate
  1060. );
  1061. row.amount = amountCal(
  1062. sellingCal(
  1063. productCal(
  1064. res.data.data.purchaseAmount,
  1065. row.partsPrice,
  1066. this.form.coefficient
  1067. ),
  1068. this.form.exchangeRate
  1069. ),
  1070. row.orderQuantity,
  1071. row.freight,
  1072. row.insurance,
  1073. row.discount
  1074. );
  1075. row.itemMargin = grossProfitCal(
  1076. res.data.data.purchaseAmount,
  1077. row.partsPrice,
  1078. sellingCal(
  1079. productCal(
  1080. res.data.data.purchaseAmount,
  1081. row.partsPrice,
  1082. this.form.coefficient
  1083. ),
  1084. this.form.exchangeRate
  1085. ),
  1086. this.form.exchangeRate
  1087. );
  1088. }
  1089. });
  1090. }
  1091. });
  1092. },
  1093. saveSell() {
  1094. if (!this.form.id) {
  1095. return this.$message.error("此单据没有提交记录,请先提交");
  1096. }
  1097. this.$confirm("是否生成销售单?", {
  1098. confirmButtonText: "确定",
  1099. cancelButtonText: "取消",
  1100. type: "warning"
  1101. }).then(() => {
  1102. saveSell(this.form.id).then(res => {
  1103. if (res.data.code == 200) {
  1104. this.$message.success("生成成功");
  1105. this.getDetail(this.form.id);
  1106. }
  1107. });
  1108. });
  1109. },
  1110. rePick(row, index) {
  1111. this.reData = {
  1112. ...row,
  1113. index: index
  1114. };
  1115. this.newDetails();
  1116. },
  1117. partrePick(row, index) {
  1118. this.partList = row.partsList;
  1119. this.$refs.part.init(index);
  1120. },
  1121. importPart(rows, sum, index) {
  1122. this.data[index].partsList = rows;
  1123. this.data[index].partsPrice = sum;
  1124. // 销售价=(配件采购价格+产品价格)/汇率 *(1+客户FOB系数/100)
  1125. this.data[index].productPrice = productCal(
  1126. this.data[index].purchaseAmount,
  1127. this.data[index].partsPrice,
  1128. this.form.coefficient
  1129. );
  1130. this.data[index].price = sellingCal(
  1131. this.data[index].productPrice,
  1132. this.form.exchangeRate
  1133. );
  1134. this.data[index].amount = amountCal(
  1135. this.data[index].price,
  1136. this.data[index].orderQuantity,
  1137. this.data[index].freight,
  1138. this.data[index].insurance,
  1139. this.data[index].discount
  1140. );
  1141. this.data[index].itemMargin = grossProfitCal(
  1142. this.data[index].purchaseAmount,
  1143. this.data[index].partsPrice,
  1144. this.data[index].price,
  1145. this.form.exchangeRate
  1146. );
  1147. const names = [];
  1148. const namePrices = [];
  1149. let costsSum = 0;
  1150. rows.map(e => {
  1151. if (e.ename) {
  1152. names.push(e.ename);
  1153. }
  1154. namePrices.push((e.goodName ? e.goodName : "") + ":" + e.amout);
  1155. costsSum = costsCal(costsSum, e.partsCost, e.goodNumber);
  1156. });
  1157. this.data[index].partsDescribe = names.join(",");
  1158. this.data[index].partsPriceDescribe = namePrices.join(";");
  1159. this.data[index].partsCost = costsSum;
  1160. this.data[index].productRemark = this.getproductRemark(this.data[index])
  1161. this.priceChange(this.data[index]);
  1162. },
  1163. importProperty(row, index) {
  1164. const arr = [];
  1165. for (let key in row) {
  1166. if (row[key]) {
  1167. arr.push(row[key]);
  1168. }
  1169. }
  1170. this.data[index].itemProp = arr.join(",");
  1171. this.data[index].remarksOne = row.remarksOne;
  1172. this.data[index].customTwo = row.customTwo;
  1173. this.data[index].customThree = row.customThree;
  1174. this.data[index].customFour = row.customFour;
  1175. this.data[index].customFive = row.customFive;
  1176. this.data[index].productRemark = this.getproductRemark(this.data[index])
  1177. },
  1178. partClosed() {
  1179. this.partList = [];
  1180. },
  1181. rowCell(row, index) {
  1182. if (this.goodsEditShow) {
  1183. return this.$message.error('请关闭表格上面的编辑')
  1184. }
  1185. if (row.$cellEdit == true) {
  1186. this.$set(row, "$cellEdit", false);
  1187. } else {
  1188. this.$set(row, "$cellEdit", true);
  1189. }
  1190. },
  1191. itemTypeFocus(row) {
  1192. this.itemtypeList = [];
  1193. getSpecification({ goodId: row.itemId }).then(res => {
  1194. const data = res.data.data;
  1195. this.itemtypeList = data.map(item => ({ value: item }));
  1196. });
  1197. },
  1198. purchaseAmountChange(row) {
  1199. row.productPrice = productCal(
  1200. row.purchaseAmount,
  1201. row.partsPrice,
  1202. this.form.coefficient
  1203. );
  1204. row.price = sellingCal(row.productPrice, this.form.exchangeRate);
  1205. row.amount = amountCal(
  1206. row.price,
  1207. row.orderQuantity,
  1208. row.freight,
  1209. row.insurance,
  1210. row.discount
  1211. );
  1212. row.itemMargin = grossProfitCal(
  1213. row.purchaseAmount,
  1214. row.partsPrice,
  1215. row.price,
  1216. this.form.exchangeRate
  1217. );
  1218. },
  1219. priceChange(row) {
  1220. row.amount = amountCal(
  1221. row.price,
  1222. row.orderQuantity,
  1223. row.freight,
  1224. row.insurance,
  1225. row.discount
  1226. );
  1227. row.itemMargin = grossProfitCal(
  1228. row.purchaseAmount,
  1229. row.partsPrice,
  1230. row.price,
  1231. this.form.exchangeRate
  1232. );
  1233. },
  1234. currencyChange() {
  1235. if (this.form.currency && this.form.businesDate) {
  1236. this.getParities("currency");
  1237. }
  1238. },
  1239. exchangeRateChange(row) {
  1240. if (this.data.length > 0) {
  1241. this.data.forEach(e => {
  1242. e.freight = transformCal(e.freight, this.oldExchange, row);
  1243. e.insurance = transformCal(e.insurance, this.oldExchange, row);
  1244. e.price = sellingCal(e.productPrice, row);
  1245. e.amount = amountCal(
  1246. e.price,
  1247. e.orderQuantity,
  1248. e.freight,
  1249. e.insurance,
  1250. e.discount
  1251. );
  1252. e.itemMargin = grossProfitCal(
  1253. e.purchaseAmount,
  1254. e.partsPrice,
  1255. e.price,
  1256. this.form.exchangeRate
  1257. );
  1258. e.exchangeRate = this.form.exchangeRate;
  1259. });
  1260. }
  1261. this.oldExchange = this.deepClone(row);
  1262. },
  1263. discountChange(row) {
  1264. if (row.discount >= 10) {
  1265. row.discount = null;
  1266. this.$message.error("请正确输入折扣");
  1267. }
  1268. this.priceChange(row);
  1269. },
  1270. taxRateChange(row) {
  1271. if (row.taxRate > 100) {
  1272. row.taxRate = 0;
  1273. this.$message.error("请正确输入税率");
  1274. }
  1275. },
  1276. saveShipping() {
  1277. if (!this.form.id) {
  1278. return this.$message.error("此单据没有提交记录,请先提交");
  1279. }
  1280. this.$confirm("是否生成船务询价单?", {
  1281. confirmButtonText: "确定",
  1282. cancelButtonText: "取消",
  1283. type: "warning"
  1284. }).then(() => {
  1285. saveShipping(this.form.id).then(res => {
  1286. if (res.data.code == 200) {
  1287. this.$message.success("生成成功");
  1288. }
  1289. });
  1290. });
  1291. },
  1292. savePurchase() {
  1293. if (!this.form.id) {
  1294. return this.$message.error("此单据没有提交记录,请先提交");
  1295. }
  1296. this.$confirm("是否生成采购询价单?", {
  1297. confirmButtonText: "确定",
  1298. cancelButtonText: "取消",
  1299. type: "warning"
  1300. }).then(() => {
  1301. savePurchase(this.form.id).then(res => {
  1302. if (res.data.code == 200) {
  1303. this.$message.success("生成成功");
  1304. }
  1305. });
  1306. });
  1307. },
  1308. rowSave(row) {
  1309. this.$set(row, "$cellEdit", false);
  1310. },
  1311. rowDel(row) {
  1312. this.$confirm("确定删除数据?", {
  1313. confirmButtonText: "确定",
  1314. cancelButtonText: "取消",
  1315. type: "warning"
  1316. }).then(() => {
  1317. if (row.id) {
  1318. delItem(row.id).then(res => {
  1319. this.$message({
  1320. type: "success",
  1321. message: "删除成功!"
  1322. });
  1323. this.data.splice(row.$index, 1);
  1324. });
  1325. } else {
  1326. this.$message({
  1327. type: "success",
  1328. message: "删除成功!"
  1329. });
  1330. this.data.splice(row.$index, 1);
  1331. }
  1332. });
  1333. },
  1334. importGoods() {
  1335. if (this.reData) {
  1336. if (this.selectionList.length != 1) {
  1337. return this.$message.error("重新选择的时候只能选择一条数据");
  1338. } else {
  1339. this.selectionList.forEach(e => {
  1340. this.data.forEach((item, index) => {
  1341. if (index == this.reData.index) {
  1342. item.itemId = e.id;
  1343. item.code = e.code;
  1344. item.cname = e.cname;
  1345. item.ename = e.ename;
  1346. item.corpId = e.corpId;
  1347. item.corpName = e.corpCode;
  1348. item.priceCategory = e.goodsTypeName;
  1349. item.itemUrl = e.url;
  1350. item.itemProp = this.reData.itemProp;
  1351. item.remarksOne = this.reData.remarksOne;
  1352. item.customTwo = this.reData.customTwo;
  1353. item.customThree = this.reData.customThree;
  1354. item.customFour = this.reData.customFour;
  1355. item.customFive = this.reData.customFive;
  1356. item.partsList = this.reData.partsList;
  1357. item.partsPrice = this.reData.partsPrice;
  1358. item.itemDescription = e.cnameDescription;
  1359. item.itemType = this.reData.itemType;
  1360. item.tradeTerms = this.reData.tradeTerms;
  1361. item.partsDescribe = this.reData.partsDescribe;
  1362. item.purchaseCost = 0;
  1363. item.purchaseAmount = 0;
  1364. item.productPrice = productCal(
  1365. 0,
  1366. this.reData.partsPrice,
  1367. this.form.coefficient
  1368. );
  1369. item.price = sellingCal(
  1370. productCal(0, this.reData.partsPrice, this.form.coefficient),
  1371. this.form.exchangeRate
  1372. );
  1373. item.orderQuantity = this.reData.orderQuantity;
  1374. item.insurance = this.reData.insurance;
  1375. item.freight = this.reData.freight;
  1376. item.discount = this.reData.discount;
  1377. item.amount = amountCal(
  1378. sellingCal(
  1379. productCal(
  1380. 0,
  1381. this.reData.partsPrice,
  1382. this.form.coefficient
  1383. ),
  1384. this.form.exchangeRate
  1385. ),
  1386. this.reData.orderQuantity,
  1387. this.reData.freight,
  1388. this.reData.insurance,
  1389. this.reData.discount
  1390. );
  1391. item.taxRate = this.reData.taxRate;
  1392. item.itemMargin = grossProfitCal(
  1393. 0,
  1394. this.reData.partsPrice,
  1395. sellingCal(
  1396. productCal(
  1397. 0,
  1398. this.reData.partsPrice,
  1399. this.form.coefficient
  1400. ),
  1401. this.form.exchangeRate
  1402. ),
  1403. this.form.exchangeRate
  1404. );
  1405. item.unit = e.unit;
  1406. item.remarks = this.reData.remarks;
  1407. item.exchangeRate = this.reData.exchangeRate;
  1408. item.productRemark = e.ename + "\n" + (this.reData.itemProp ? this.reData.itemProp : '') + " " + (this.reData.itemDescription ? this.reData.itemDescription : '') + " " + (this.reData.partsDescribe ? (", " + this.reData.partsDescribe) : ''),
  1409. item.$cellEdit = true;
  1410. }
  1411. });
  1412. });
  1413. }
  1414. } else {
  1415. this.selectionList.forEach(e => {
  1416. this.data.push({
  1417. itemId: e.id,
  1418. code: e.code,
  1419. cname: e.cname,
  1420. ename: e.ename,
  1421. corpId: e.corpId,
  1422. corpName: e.corpCode,
  1423. priceCategory: e.goodsTypeName,
  1424. itemUrl: e.url,
  1425. itemProp: null,
  1426. remarksOne: null,
  1427. customTwo: null,
  1428. customThree: null,
  1429. customFour: null,
  1430. customFive: null,
  1431. itemDescription: e.cnameDescription,
  1432. partsList: [],
  1433. partsPrice: 0,
  1434. itemType: null,
  1435. tradeTerms: null,
  1436. purchaseCost: 0,
  1437. purchaseAmount: 0,
  1438. price: 0,
  1439. orderQuantity: 0,
  1440. insurance: 0,
  1441. freight: 0,
  1442. discount: null,
  1443. amount: 0,
  1444. taxRate: 0,
  1445. unit: e.unit,
  1446. itemMargin: 0,
  1447. remarks: null,
  1448. exchangeRate: this.form.exchangeRate,
  1449. partsDescribe: null,
  1450. productRemark: e.ename,
  1451. $cellEdit: true
  1452. });
  1453. });
  1454. }
  1455. this.dialogVisible = false;
  1456. },
  1457. closeGoods() {
  1458. this.selectionList = [];
  1459. this.treeDeptId = "";
  1460. this.reData = null;
  1461. },
  1462. selectionChange(list) {
  1463. this.selectionList = list;
  1464. },
  1465. rowClick(row) {
  1466. this.$refs.goodsCrud.toggleSelection([this.goodsList[row.$index]]);
  1467. },
  1468. nodeClick(data) {
  1469. this.treeDeptId = data.id;
  1470. this.page.currentPage = 1;
  1471. this.onLoad(this.page);
  1472. },
  1473. searchChange(params, done) {
  1474. this.search = this.deepClone(params);
  1475. this.onLoad(this.page, params);
  1476. done();
  1477. },
  1478. //费用查询
  1479. onLoad(page, params = {}) {
  1480. let obj = this.deepClone(Object.assign(params, this.search));
  1481. this.loading = true;
  1482. getGoods(page.currentPage, page.pageSize, this.treeDeptId, obj)
  1483. .then(res => {
  1484. const data = res.data.data;
  1485. this.page.total = data.total;
  1486. this.goodsList = data.records;
  1487. if (this.page.total) {
  1488. this.goodsOption.height = window.innerHeight - 350;
  1489. }
  1490. })
  1491. .finally(() => {
  1492. this.loading = false;
  1493. });
  1494. },
  1495. importLibray(rows) {
  1496. rows.forEach(e => {
  1497. console.log(e);
  1498. this.data.push({
  1499. itemId: e.itemId,
  1500. code: e.code,
  1501. cname: e.cname,
  1502. ename: e.ename,
  1503. priceCategory: e.goodsTypeName,
  1504. purchaseCost: costCal(e.price, e.taxRate),
  1505. purchaseAmount: e.purchaseAmount,
  1506. itemProp: null,
  1507. remarksOne: null,
  1508. customTwo: null,
  1509. customThree: null,
  1510. customFour: null,
  1511. customFive: null,
  1512. corpId: e.corpId,
  1513. corpName: e.corpCode,
  1514. itemDescription: e.cnameDescription,
  1515. partsList: [],
  1516. partsPrice: 0,
  1517. itemType: e.specs,
  1518. tradeTerms: null,
  1519. productPrice: productCal(e.purchaseAmount, 0, this.form.coefficient),
  1520. price: sellingCal(
  1521. productCal(e.purchaseAmount, 0, this.form.coefficient),
  1522. this.form.exchangeRate
  1523. ),
  1524. orderQuantity: 1,
  1525. insurance: 0,
  1526. freight: 0,
  1527. discount: null,
  1528. amount: sellingCal(
  1529. productCal(e.purchaseAmount, 0, this.form.coefficient),
  1530. this.form.exchangeRate
  1531. ),
  1532. taxRate: 0,
  1533. unit: e.unit,
  1534. itemMargin: grossProfitCal(
  1535. e.purchaseAmount,
  1536. 0,
  1537. sellingCal(
  1538. productCal(e.purchaseAmount, 0, this.form.coefficient),
  1539. this.form.exchangeRate
  1540. ),
  1541. this.form.exchangeRate
  1542. ),
  1543. partsDescribe: null,
  1544. remarks: null,
  1545. exchangeRate: this.form.exchangeRate,
  1546. productRemark: e.ename,
  1547. $cellEdit: true
  1548. });
  1549. });
  1550. },
  1551. //商品明细导入
  1552. newDetails() {
  1553. if (!this.form.corpId) {
  1554. return this.$message.error("请选择客户名称");
  1555. }
  1556. this.dialogVisible = !this.dialogVisible;
  1557. },
  1558. rowAdd() {
  1559. if (!this.form.corpId) {
  1560. return this.$message.error("请选择客户名称");
  1561. }
  1562. this.data.push({ $cellEdit: true });
  1563. },
  1564. getDetail(id) {
  1565. this.loading = true;
  1566. this.showBut = false;
  1567. this.pageLoading = true;
  1568. detail(id)
  1569. .then(res => {
  1570. if (this.detailData.status == "copy") {
  1571. delete res.data.data.id;
  1572. delete res.data.data.sysNo;
  1573. delete res.data.data.orderNo;
  1574. delete res.data.data.orgOrderNo;
  1575. delete res.data.data.createTime;
  1576. delete res.data.data.createUser;
  1577. delete res.data.data.createUserName;
  1578. delete res.data.data.updateTime;
  1579. delete res.data.data.updateUser;
  1580. delete res.data.data.updateUserName;
  1581. delete res.data.data.morderNo;
  1582. delete res.data.data.status;
  1583. delete res.data.data.ifEnquiry;
  1584. delete res.data.data.ifShipping;
  1585. res.data.data.orderStatus = "录入";
  1586. res.data.data.orderItemsList.forEach(e => {
  1587. delete e.id;
  1588. delete e.pid;
  1589. delete e.createTime;
  1590. delete e.createUser;
  1591. delete e.updateTime;
  1592. delete e.updateUser;
  1593. delete e.orgOrderNo;
  1594. delete e.srcId;
  1595. delete e.status;
  1596. delete e.isDeleted;
  1597. });
  1598. res.data.data.orderFeesList.forEach(e => {
  1599. delete e.id;
  1600. delete e.pid;
  1601. delete e.createTime;
  1602. delete e.createUser;
  1603. delete e.updateTime;
  1604. delete e.updateUser;
  1605. delete e.status;
  1606. delete e.isDeleted;
  1607. });
  1608. res.data.data.orderFilesList.forEach(e => {
  1609. delete e.id;
  1610. delete e.pid;
  1611. delete e.createTime;
  1612. delete e.createUser;
  1613. delete e.updateTime;
  1614. delete e.updateUser;
  1615. delete e.status;
  1616. delete e.isDeleted;
  1617. });
  1618. }
  1619. this.form = res.data.data;
  1620. this.data = res.data.data.orderItemsList;
  1621. this.orderFeesList = res.data.data.orderFeesList;
  1622. this.orderFilesList = res.data.data.orderFilesList;
  1623. this.oldform = res.data.data;
  1624. this.olddata = this.deepClone(res.data.data.orderItemsList);
  1625. this.oldorderFeesList = this.deepClone(res.data.data.orderFeesList);
  1626. this.oldorderFilesList = this.deepClone(res.data.data.orderFilesList);
  1627. this.oldExchange = this.deepClone(this.form.exchangeRate);
  1628. })
  1629. .finally(() => {
  1630. this.loading = false;
  1631. this.showBut = true;
  1632. this.pageLoading = false;
  1633. });
  1634. },
  1635. getproductRemark(row) {
  1636. const ename = row.ename ? row.ename : "";
  1637. const itemDescription = row.itemDescription
  1638. ? row.itemDescription
  1639. : "";
  1640. const itemProp = row.itemProp ? row.itemProp : "";
  1641. const partsDescribe = row.partsDescribe ? (', ' + row.partsDescribe) : "";
  1642. const productRemark =
  1643. ename +
  1644. "\n" +
  1645. itemProp +
  1646. " " +
  1647. itemDescription +
  1648. " " +
  1649. partsDescribe;
  1650. return productRemark
  1651. },
  1652. formEditChange(row) {
  1653. row.productRemark = this.getproductRemark(row)
  1654. },
  1655. editChange(row) {
  1656. row.productRemark = this.getproductRemark(row)
  1657. },
  1658. //修改提交触发
  1659. editCustomer(status) {
  1660. this.$refs["form"].validate((valid, done) => {
  1661. done();
  1662. if (valid) {
  1663. let orderFeesList = this.$refs.feeInfo.submitData();
  1664. let amountSum = 0;
  1665. let reSum = 0;
  1666. let costSum = 0;
  1667. let paySum = 0;
  1668. if (this.data.length > 0) {
  1669. for (let i = 0; i < this.data.length; i++) {
  1670. if (this.data[i].corpId == null) {
  1671. return this.$message.error(`请输入第${i + 1}行的供应商`);
  1672. }
  1673. amountSum = _.add(
  1674. amountSum,
  1675. _.multiply(
  1676. numCal(this.data[i].amount),
  1677. numCal(this.data[i].exchangeRate)
  1678. )
  1679. );
  1680. costSum = _.add(
  1681. costSum,
  1682. _.multiply(
  1683. _.add(
  1684. numCal(this.data[i].purchaseAmount),
  1685. numCal(this.data[i].partsPrice)
  1686. ),
  1687. numCal(this.data[i].orderQuantity)
  1688. )
  1689. );
  1690. }
  1691. }
  1692. for (let i = 0; i < orderFeesList.length; i++) {
  1693. // if (orderFeesList[i].corpId == null) {
  1694. // return this.$message.error(`请输入第${i + 1}行的结算中心`);
  1695. // }
  1696. if (orderFeesList[i].price == 0) {
  1697. return this.$message.error(`请正确输入第${i + 1}行的销售价`);
  1698. }
  1699. if (orderFeesList[i].orderQuantity == 0) {
  1700. return this.$message.error(`请正确输入第${i + 1}行的数量`);
  1701. }
  1702. if (!orderFeesList[i].currency) {
  1703. return this.$message.error(`请正确选择第${i + 1}行的币别`);
  1704. }
  1705. if (!orderFeesList[i].exchangeRate) {
  1706. return this.$message.error(`请正确输入第${i + 1}行的汇率`);
  1707. }
  1708. if (orderFeesList[i].feesType == 1) {
  1709. reSum = _.add(
  1710. reSum,
  1711. _.multiply(
  1712. numCal(orderFeesList[i].amount),
  1713. numCal(orderFeesList[i].exchangeRate)
  1714. )
  1715. );
  1716. }
  1717. if (orderFeesList[i].feesType == 2) {
  1718. paySum = _.add(
  1719. paySum,
  1720. _.multiply(
  1721. numCal(orderFeesList[i].amount),
  1722. numCal(orderFeesList[i].exchangeRate)
  1723. )
  1724. );
  1725. }
  1726. }
  1727. this.form.singleTicketMargin = STGPCal(
  1728. amountSum,
  1729. reSum,
  1730. costSum,
  1731. paySum
  1732. );
  1733. this.subLoading = true;
  1734. submit({
  1735. ...this.form,
  1736. orderItemsList: this.data,
  1737. orderFeesList: orderFeesList,
  1738. orderFilesList: this.orderFilesList
  1739. })
  1740. .then(res => {
  1741. if (res.data.code == 200) {
  1742. this.$message.success("保存成功");
  1743. this.form = res.data.data;
  1744. this.data = res.data.data.orderItemsList;
  1745. this.orderFeesList = res.data.data.orderFeesList;
  1746. this.orderFilesList = res.data.data.orderFilesList;
  1747. this.oldform = res.data.data;
  1748. this.olddata = this.deepClone(res.data.data.orderItemsList);
  1749. this.oldorderFeesList = this.deepClone(
  1750. res.data.data.orderFeesList
  1751. );
  1752. this.oldorderFilesList = this.deepClone(
  1753. res.data.data.orderFilesList
  1754. );
  1755. this.oldExchange = this.deepClone(this.form.exchangeRate);
  1756. if (status == "goBack") {
  1757. if (this.form.id) {
  1758. this.unLock({
  1759. moduleName: "bj",
  1760. tableName: "business_order",
  1761. billId: this.form.id,
  1762. billNo: this.form.orgOrderNo
  1763. });
  1764. }
  1765. this.$emit("goBack");
  1766. this.leaveDetailsKey(this.$route.name);
  1767. }
  1768. }
  1769. })
  1770. .finally(() => {
  1771. this.subLoading = false;
  1772. });
  1773. } else {
  1774. return false;
  1775. }
  1776. });
  1777. },
  1778. detailsDate(obj) {
  1779. this.form = obj;
  1780. this.form.clientMessage =
  1781. (this.form.client ? this.form.client + ";" : "") +
  1782. (this.form.clientAttn ? this.form.clientAttn + ";" : "") +
  1783. (this.form.clientAddress ? this.form.clientAddress + ";" : "");
  1784. },
  1785. //返回列表
  1786. backToList() {
  1787. let orderFeesList = this.$refs.feeInfo.submitData();
  1788. if (
  1789. contrastObj(this.form, this.oldform) ||
  1790. contrastList(this.data, this.olddata) ||
  1791. contrastList(orderFeesList, this.oldorderFeesList) ||
  1792. contrastList(this.orderFilesList, this.oldorderFilesList)
  1793. ) {
  1794. this.$confirm("数据发生变化未有提交记录, 是否提交?", "提示", {
  1795. confirmButtonText: "确定",
  1796. cancelButtonText: "取消",
  1797. type: "warning"
  1798. })
  1799. .then(() => {
  1800. this.editCustomer("goBack");
  1801. })
  1802. .catch(() => {
  1803. if (this.form.id) {
  1804. this.unLock({
  1805. moduleName: "bj",
  1806. tableName: "business_order",
  1807. billId: this.form.id,
  1808. billNo: this.form.orgOrderNo
  1809. });
  1810. }
  1811. this.$emit("goBack");
  1812. this.leaveDetailsKey(this.$route.name);
  1813. });
  1814. } else {
  1815. if (this.form.id) {
  1816. this.unLock({
  1817. moduleName: "bj",
  1818. tableName: "business_order",
  1819. billId: this.form.id,
  1820. billNo: this.form.orgOrderNo
  1821. });
  1822. }
  1823. this.$emit("goBack");
  1824. this.leaveDetailsKey(this.$route.name);
  1825. }
  1826. },
  1827. openReport() {
  1828. this.switchDialog = !this.switchDialog;
  1829. },
  1830. openProperty(row, index) {
  1831. this.$refs.property.init(row, index);
  1832. },
  1833. onClose(val) {
  1834. this.switchDialog = val;
  1835. },
  1836. summaryMethod({ columns, data }) {
  1837. const sums = [];
  1838. if (columns.length > 0) {
  1839. columns.forEach((item, index) => {
  1840. sums[0] = "合计";
  1841. if (
  1842. item.property == "orderQuantity" ||
  1843. item.property == "amount" ||
  1844. item.property == "insurance" ||
  1845. item.property == "freight"
  1846. ) {
  1847. let qtySum = 0;
  1848. let amountSum = 0;
  1849. let insuranceSum = 0;
  1850. let freightSum = 0;
  1851. data.forEach(e => {
  1852. qtySum = _.add(qtySum, Number(e.orderQuantity));
  1853. amountSum = _.add(amountSum, Number(e.amount));
  1854. insuranceSum = _.add(insuranceSum, Number(e.insurance));
  1855. freightSum = _.add(freightSum, Number(e.freight));
  1856. });
  1857. //数量总计
  1858. if (item.property == "orderQuantity") {
  1859. sums[index] = qtySum ? qtySum.toFixed(2) : "0.00";
  1860. }
  1861. //金额总计
  1862. if (item.property == "amount") {
  1863. sums[index] = micrometerFormat(amountSum);
  1864. }
  1865. //保险总计
  1866. if (item.property == "insurance") {
  1867. sums[index] = micrometerFormat(insuranceSum);
  1868. }
  1869. //运费总计
  1870. if (item.property == "freight") {
  1871. sums[index] = micrometerFormat(freightSum);
  1872. }
  1873. }
  1874. });
  1875. }
  1876. return sums;
  1877. },
  1878. //费用明细回调
  1879. beforeFinance(feesData, callback) {
  1880. this.advantageProjectData = feesData;
  1881. let params = {};
  1882. //暂时默认通过 之后优化
  1883. params.valid = true;
  1884. params.parentId = this.form.id;
  1885. params.srcOrderno = this.form.orderNo;
  1886. callback(params);
  1887. },
  1888. openEdit() {
  1889. const data = {
  1890. moduleName: "bj",
  1891. tableName: "business_order",
  1892. billId: this.form.id,
  1893. no: localStorage.getItem("browserID"),
  1894. billNo: this.form.orgOrderNo
  1895. };
  1896. this.inDetailsKey(this.$route.name, {
  1897. moduleName: "bj",
  1898. tableName: "business_order",
  1899. billId: this.form.id,
  1900. billNo: this.form.orgOrderNo
  1901. });
  1902. this.checkLock(data).then(res => {
  1903. if (res.data.code == 200) {
  1904. this.onLock(data).then(res => {
  1905. if (res.data.code == 200) {
  1906. this.detailData.status = 2;
  1907. this.option = this.$options.data().option;
  1908. this.$refs.crud.refreshTable();
  1909. }
  1910. });
  1911. }
  1912. });
  1913. },
  1914. async saveColumn() {
  1915. const inSave = await this.saveColumnData(
  1916. this.getColumnName(1),
  1917. this.tableOption
  1918. );
  1919. if (inSave) {
  1920. this.$nextTick(() => {
  1921. this.$refs.crud.doLayout();
  1922. });
  1923. this.$message.success("保存成功");
  1924. //关闭窗口
  1925. this.$refs.crud.$refs.dialogColumn.columnBox = false;
  1926. }
  1927. },
  1928. async resetColumn() {
  1929. this.tableOption = tableOption;
  1930. const inSave = await this.delColumnData(
  1931. this.getColumnName(1),
  1932. tableOption
  1933. );
  1934. if (inSave) {
  1935. this.$nextTick(() => {
  1936. this.$refs.crud.doLayout();
  1937. });
  1938. this.$message.success("重置成功");
  1939. //关闭窗口
  1940. setTimeout(() => {
  1941. this.$refs.crud.$refs.dialogColumn.columnBox = false;
  1942. }, 1000);
  1943. }
  1944. },
  1945. moveUp(row, index) {
  1946. this.data[index] = this.data.splice(index - 1, 1, row)[0]
  1947. },
  1948. moveDown(row, index) {
  1949. this.data[index] = this.data.splice(index + 1, 1, row)[0]
  1950. },
  1951. async saveGoodsColumn() {
  1952. const inSave = await this.saveColumnData(
  1953. this.getColumnName(26),
  1954. this.goodsOption
  1955. );
  1956. if (inSave) {
  1957. this.$nextTick(() => {
  1958. this.$refs.goodsCrud.doLayout();
  1959. });
  1960. this.$message.success("保存成功");
  1961. //关闭窗口
  1962. this.$refs.goodsCrud.$refs.dialogColumn.columnBox = false;
  1963. }
  1964. },
  1965. async resetGoodsColumn() {
  1966. this.goodsOption = goodsOption;
  1967. const inSave = await this.delColumnData(
  1968. this.getColumnName(26),
  1969. goodsOption
  1970. );
  1971. if (inSave) {
  1972. this.$nextTick(() => {
  1973. this.$refs.goodsCrud.doLayout();
  1974. });
  1975. this.$message.success("重置成功");
  1976. //关闭窗口
  1977. setTimeout(() => {
  1978. this.$refs.goodsCrud.$refs.dialogColumn.columnBox = false;
  1979. }, 1000);
  1980. }
  1981. }
  1982. },
  1983. watch: {
  1984. "form.corpId": function (id) {
  1985. if (id) {
  1986. this.corpsattns = [];
  1987. getCorpsattn({ pid: id }).then(res => {
  1988. this.corpsattns = res.data.data.records;
  1989. });
  1990. }
  1991. }
  1992. }
  1993. };
  1994. </script>
  1995. <style lang="scss" scoped>
  1996. .trading-form ::v-deep .el-form-item {
  1997. margin-bottom: 8px !important;
  1998. }
  1999. ::v-deep .el-form-item__error {
  2000. display: none !important;
  2001. }
  2002. ::v-deep .select-component {
  2003. display: flex !important;
  2004. }
  2005. </style>