goodsInfo.vue 78 KB

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