inventoryTable.vue 83 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692
  1. <template>
  2. <el-form ref="form" :model="form" :rules="rules">
  3. <ele-pro-table
  4. ref="table"
  5. :needPage="false"
  6. :columns="columns"
  7. :datasource="form.datasource"
  8. class="time-form"
  9. height="300"
  10. full-height="calc(100vh - 76px)"
  11. @columns-change="handleColumnChange"
  12. :cache-key="cacheKeyUrl"
  13. :selection.sync="selection"
  14. >
  15. <!-- :show-summary="showSummary"
  16. :summary-method="getSummaries" -->
  17. <!-- 表头工具栏 -->
  18. <template v-slot:toolbar>
  19. <div class="headbox">
  20. <div>
  21. <el-button
  22. size="small"
  23. type="primary"
  24. icon="el-icon-plus"
  25. class="ele-btn-icon"
  26. @click="handParent('', -1)"
  27. >
  28. 新增
  29. </el-button>
  30. <el-button
  31. size="small"
  32. type="primary"
  33. icon="el-icon-plus"
  34. class="ele-btn-icon"
  35. v-if="isGoods"
  36. @click="handGoods(-1)"
  37. >
  38. 选择商品
  39. </el-button>
  40. <el-button
  41. size="small"
  42. type="primary"
  43. icon="el-icon-plus"
  44. class="ele-btn-icon"
  45. v-if="isTemporary"
  46. @click="handlAdd"
  47. >
  48. 新增临时产品
  49. </el-button>
  50. <el-button
  51. size="small"
  52. type="primary"
  53. class="ele-btn-icon"
  54. @click="save"
  55. v-if="isDrawer"
  56. >
  57. 保存
  58. </el-button>
  59. <setAllValue
  60. :disabled="!selection.length"
  61. title="客户期望交期"
  62. @success="setAllValueChange"
  63. valueKey="customerExpectDeliveryDeadline"
  64. />
  65. <setAllValue
  66. :disabled="!selection.length"
  67. title="生产交付交期"
  68. valueKey="produceDeliveryDeadline"
  69. @success="setAllValueChange"
  70. />
  71. </div>
  72. <div class="pricebox">
  73. <span class="amount" v-if="showSummary">数量合计:{{ allQuantity }}</span>
  74. <span class="amount">总计:{{ allPrice }}元</span>
  75. <el-form-item
  76. style="width: 300px"
  77. v-if="isDiscountTotalPrice"
  78. label="优惠后总金额:"
  79. prop="discountTotalPrice"
  80. :rules="{
  81. required: true,
  82. message: '请输入优惠后总金额',
  83. trigger: 'change'
  84. }"
  85. >
  86. <el-input
  87. type="number"
  88. :min="0"
  89. :max="allPrice"
  90. :disabled="!allPrice"
  91. v-model="form.discountTotalPrice"
  92. style="width: 180px"
  93. placeholder="请输入"
  94. @input="discountInputByOrder(form.discountTotalPrice)"
  95. >
  96. <template slot="append">元</template>
  97. </el-input>
  98. </el-form-item>
  99. </div>
  100. </div>
  101. </template>
  102. <template v-slot:productName="{ row, $index }">
  103. <el-form-item
  104. :prop="'datasource.' + $index + '.productName'"
  105. :rules="{
  106. required: true,
  107. message: '请输入',
  108. trigger: 'change'
  109. }"
  110. >
  111. <el-input
  112. :disabled="!!row.productId && row.productId != 0"
  113. v-model="row.productName"
  114. placeholder="请输入"
  115. style="width: 60%; margin-right: 10px"
  116. ></el-input>
  117. <el-button
  118. size="small"
  119. type="primary"
  120. @click.native="handParent(row, $index)"
  121. >选择
  122. </el-button>
  123. </el-form-item>
  124. </template>
  125. <template v-slot:entrustedEnterpriseId="scope">
  126. <el-form-item prop="entrustedEnterpriseId">
  127. <el-select
  128. v-model="scope.row.entrustedEnterpriseId"
  129. clearable
  130. filterable
  131. >
  132. <el-option
  133. v-for="i in scope.row.entrustedEnterpriseIdList"
  134. :key="i.id"
  135. :value="i.id"
  136. :label="i.name"
  137. ></el-option>
  138. </el-select>
  139. </el-form-item>
  140. </template>
  141. <template v-slot:headerCustomerMark="{ column }">
  142. <span class="is-required">{{ column.label }}</span>
  143. </template>
  144. <template v-slot:customerMark="{ row, $index }">
  145. <el-form-item
  146. :prop="'datasource.' + $index + '.customerMark'"
  147. :rules="{
  148. required: isCustomerMark ? true : false,
  149. message: '请输入客户代号',
  150. trigger: 'change'
  151. }"
  152. >
  153. <el-input
  154. v-model="row.customerMark"
  155. :disabled="quoteType === 2"
  156. placeholder="请输入"
  157. ></el-input>
  158. </el-form-item>
  159. </template>
  160. <template v-slot:headerProductName="{ column }">
  161. <span class="is-required">{{ column.label }}</span>
  162. </template>
  163. <template v-slot:productCode="scope">
  164. <el-form-item :prop="'datasource.' + scope.$index + '.productCode'">
  165. <el-input
  166. v-model="scope.row.productCode"
  167. :disabled="
  168. quoteType != 2 ||
  169. (!!scope.row.productId && scope.row.productId != 0)
  170. "
  171. ></el-input>
  172. </el-form-item>
  173. </template>
  174. <template v-slot:productCategoryName="scope">
  175. <el-form-item
  176. :prop="'datasource.' + scope.$index + '.productCategoryName'"
  177. >
  178. <el-input v-model="scope.row.productCategoryName" disabled></el-input>
  179. </el-form-item>
  180. </template>
  181. <template v-slot:headerTotalCount="{ column }">
  182. <span :class="{ 'is-required': isTotalCount }">{{ column.label }}</span>
  183. </template>
  184. <template v-slot:headerTaxRate="{ column }">
  185. <span class="is-required">{{ column.label }}</span>
  186. </template>
  187. <template v-slot:totalPrice="scope">
  188. <el-form-item :prop="'datasource.' + scope.$index + '.totalPrice'">
  189. {{ formatPrice(Number(scope.row.totalPrice) || 0) }}元
  190. </el-form-item>
  191. </template>
  192. <template v-slot:productBrand="scope">
  193. <el-form-item :prop="'datasource.' + scope.$index + '.productBrand'">
  194. <el-input
  195. v-model="scope.row.productBrand"
  196. :disabled="!!scope.row.productId && scope.row.productId != 0"
  197. ></el-input>
  198. </el-form-item>
  199. </template>
  200. <template v-slot:modelType="scope">
  201. <el-form-item :prop="'datasource.' + scope.$index + '.modelType'">
  202. <el-input
  203. v-model="scope.row.modelType"
  204. :disabled="!!scope.row.productId && scope.row.productId != 0"
  205. ></el-input>
  206. </el-form-item>
  207. </template>
  208. <template v-slot:specification="scope">
  209. <el-form-item :prop="'datasource.' + scope.$index + '.specification'">
  210. <el-input
  211. v-model="scope.row.specification"
  212. :disabled="!!scope.row.productId && scope.row.productId != 0"
  213. ></el-input>
  214. </el-form-item>
  215. </template>
  216. <template v-slot:guaranteePeriod="scope">
  217. <div class="period">
  218. <div class="borderleftnone">
  219. <el-form-item
  220. :prop="'datasource.' + scope.$index + '.guaranteePeriod'"
  221. :rules="{
  222. pattern: numberReg,
  223. message: '请输入有效期',
  224. trigger: 'blur'
  225. }"
  226. >
  227. <el-input
  228. v-model="scope.row.guaranteePeriod"
  229. @change="
  230. setDeliveryDays(scope.row, scope.$index, 'guaranteePeriod')
  231. "
  232. placeholder="请输入"
  233. ></el-input>
  234. </el-form-item>
  235. </div>
  236. <div class="borderrightnone">
  237. <DictSelection
  238. dictName="质保期单位"
  239. clearable
  240. v-model="scope.row.guaranteePeriodUnitCode"
  241. @change="
  242. setDeliveryDays(scope.row, scope.$index, 'guaranteePeriod')
  243. "
  244. :isOne="scope.$index === 0"
  245. >
  246. </DictSelection>
  247. </div>
  248. </div>
  249. </template>
  250. <!-- <template v-slot:measuringUnit="scope">
  251. <el-form-item :prop="'datasource.' + scope.$index + '.measuringUnit'">
  252. <el-input
  253. v-model="scope.row.measuringUnit"
  254. :disabled="!!scope.row.productCode"
  255. placeholder="请输入"
  256. ></el-input>
  257. </el-form-item>
  258. </template> -->
  259. <template v-slot:remark="scope">
  260. <el-form-item :prop="'datasource.' + scope.$index + '.remark'">
  261. <el-input
  262. v-model="scope.row.remark"
  263. type="textarea"
  264. placeholder="请输入"
  265. ></el-input>
  266. </el-form-item>
  267. </template>
  268. <template v-slot:singlePrice="scope">
  269. <el-form-item
  270. :prop="'datasource.' + scope.$index + '.singlePrice'"
  271. :rules="{
  272. required: quoteType !== 2 && isSinglePrice ? true : false,
  273. message: '请输入单价',
  274. trigger: 'change'
  275. }"
  276. >
  277. <el-input
  278. v-model="scope.row.singlePrice"
  279. placeholder="请输入"
  280. :disabled="quoteType === 2"
  281. @input="handleCountChange(scope.row, scope.$index)"
  282. type="number"
  283. >
  284. <template slot="append">元</template>
  285. </el-input>
  286. </el-form-item>
  287. </template>
  288. <template v-slot:taxRate="scope">
  289. <el-form-item
  290. :prop="'datasource.' + scope.$index + '.taxRate'"
  291. :rules="{
  292. required: isTaxRate == 1 ? true : false,
  293. message: '请输入税率',
  294. trigger: 'change'
  295. }"
  296. >
  297. <el-input
  298. v-model="scope.row.taxRate"
  299. placeholder="请输入"
  300. type="number"
  301. :disabled="quoteType === 2"
  302. @input="getNotaxSinglePrice"
  303. >
  304. <template slot="append">%</template>
  305. </el-input>
  306. </el-form-item>
  307. </template>
  308. <template v-slot:headerSinglePrice="{ column }">
  309. <span :class="isSinglePrice ? 'is-required' : ''">{{
  310. column.label
  311. }}</span>
  312. </template>
  313. <template v-slot:headerCustomerExpectDeliveryDeadline="{ column }">
  314. <span :class="isDate == 1 ? 'is-required' : ''">{{
  315. column.label
  316. }}</span>
  317. </template>
  318. <template v-slot:technicalAnswerName="{ row, $index }">
  319. <el-form-item :prop="'datasource.' + $index + '.technicalAnswerName'">
  320. <el-input
  321. v-model="row.technicalAnswerName"
  322. placeholder="请输入"
  323. @click.native="handHead(row, $index)"
  324. ></el-input>
  325. </el-form-item>
  326. </template>
  327. <template v-slot:technicalParams="scope">
  328. <el-form-item :prop="'datasource.' + scope.$index + '.technicalParams'">
  329. <el-input
  330. type="textarea"
  331. v-model="scope.row.technicalParams"
  332. placeholder="请输入"
  333. ></el-input>
  334. </el-form-item>
  335. </template>
  336. <template v-slot:technicalDrawings="scope">
  337. <el-form-item
  338. :prop="'datasource.' + scope.$index + '.technicalDrawings'"
  339. >
  340. <fileMain v-model="scope.row.technicalDrawings"></fileMain>
  341. </el-form-item>
  342. </template>
  343. <template v-slot:customerReqFiles="scope">
  344. <el-form-item
  345. :prop="'datasource.' + scope.$index + '.customerReqFiles'"
  346. >
  347. <fileMain v-model="scope.row.customerReqFiles"></fileMain>
  348. </el-form-item>
  349. </template>
  350. <template v-slot:industryArtFiles="scope">
  351. <el-form-item
  352. :prop="'datasource.' + scope.$index + '.industryArtFiles'"
  353. :rules="{
  354. required: false,
  355. message: '请输入',
  356. trigger: 'change'
  357. }"
  358. >
  359. <fileMain v-model="scope.row.industryArtFiles"></fileMain>
  360. </el-form-item>
  361. </template>
  362. <template v-slot:otherFiles="scope">
  363. <el-form-item :prop="'datasource.' + scope.$index + '. otherFiles'">
  364. <fileMain v-model="scope.row.otherFiles"></fileMain>
  365. </el-form-item>
  366. </template>
  367. <template v-slot:headerProduceDeliveryDeadline="{ column }">
  368. <span
  369. :class="isProduceDeliveryDeadline && isDate == 1 ? 'is-required' : ''"
  370. >{{ column.label }}</span
  371. >
  372. </template>
  373. <template v-slot:produceDeliveryDeadline="scope">
  374. <el-form-item
  375. :prop="'datasource.' + scope.$index + '.produceDeliveryDeadline'"
  376. :rules="{
  377. required: isProduceDeliveryDeadline && isDate == 1 ? true : false,
  378. message: '选择生产交付交期',
  379. trigger: 'change'
  380. }"
  381. >
  382. <el-date-picker
  383. style="width: 140px"
  384. value-format="yyyy-MM-dd"
  385. v-model="scope.row.produceDeliveryDeadline"
  386. @change="
  387. setDeliveryDays(scope.row, scope.$index, 'guaranteePeriod')
  388. "
  389. type="date"
  390. placeholder="选择日期"
  391. >
  392. </el-date-picker>
  393. </el-form-item>
  394. </template>
  395. <template v-slot:customerExpectDeliveryDeadline="scope">
  396. <el-form-item
  397. v-if="scope.row.arrivalWay == 1 || !scope.row.arrivalWay"
  398. :rules="{
  399. required: isDate == 1 && quoteType != 2 ? true : false,
  400. message:
  401. contractBookType == 1 ? '请选择客户期望交期' : '请选择交付日期',
  402. trigger: 'change'
  403. }"
  404. :prop="
  405. 'datasource.' + scope.$index + '.customerExpectDeliveryDeadline'
  406. "
  407. >
  408. <el-date-picker
  409. style="width: 140px"
  410. v-model="scope.row.customerExpectDeliveryDeadline"
  411. value-format="yyyy-MM-dd"
  412. @change="
  413. setDeliveryDays(scope.row, scope.$index, 'guaranteePeriod')
  414. "
  415. type="date"
  416. placeholder="选择日期"
  417. >
  418. </el-date-picker>
  419. </el-form-item>
  420. <el-form-item v-if="scope.row.arrivalWay == 2">
  421. <el-link
  422. type="primary"
  423. :underline="false"
  424. @click.native="handleMethod(scope.row, scope.$index)"
  425. >
  426. 设置分批时间
  427. </el-link>
  428. </el-form-item>
  429. </template>
  430. <template v-slot:provenance="scope">
  431. <el-form-item :prop="'datasource.' + scope.$index + '.provenance'">
  432. <DictSelection
  433. dictName="产地"
  434. clearable
  435. v-model="scope.row.provenance"
  436. :disabled="quoteType === 2"
  437. collapse-tags
  438. multiple
  439. :isOne="scope.$index === 0"
  440. >
  441. </DictSelection>
  442. </el-form-item>
  443. </template>
  444. <template v-slot:guaranteePeriodDeadline="scope">
  445. <el-form-item
  446. :prop="'datasource.' + scope.$index + '.guaranteePeriodDeadline'"
  447. >
  448. <el-date-picker
  449. style="width: 140px"
  450. v-model="scope.row.guaranteePeriodDeadline"
  451. type="date"
  452. value-format="yyyy-MM-dd"
  453. placeholder="选择日期"
  454. >
  455. </el-date-picker>
  456. </el-form-item>
  457. </template>
  458. <template v-slot:singleWeight="scope">
  459. <el-form-item :prop="'datasource.' + scope.$index + '.singleWeight'">
  460. <el-input
  461. v-model="scope.row.singleWeight"
  462. @input="handleCountChange(scope.row, scope.$index)"
  463. placeholder="请输入"
  464. >
  465. <template slot="append">
  466. <span v-if="!!scope.row.productId && scope.row.productId != 0">
  467. {{ scope.row.weightUnit }}
  468. </span>
  469. <el-input
  470. v-else
  471. v-model="scope.row.weightUnit"
  472. placeholder="单位"
  473. style="width: 80px; padding: 0"
  474. ></el-input>
  475. </template>
  476. </el-input>
  477. </el-form-item>
  478. </template>
  479. <template v-slot:totalWeight="scope">
  480. <el-form-item
  481. style="margin-bottom: 20px"
  482. :rules="{
  483. required: false,
  484. pattern: numberReg,
  485. trigger: 'change'
  486. }"
  487. :prop="'datasource.' + scope.$index + '.totalWeight'"
  488. >
  489. <el-input
  490. v-model="scope.row.totalWeight"
  491. @input="handleCountChange(scope.row, scope.$index, 'totalWeight')"
  492. placeholder="请输入"
  493. >
  494. <template slot="append">
  495. {{ scope.row.weightUnit }}
  496. </template>
  497. </el-input>
  498. </el-form-item>
  499. </template>
  500. <template v-slot:increaseTotalWeight="scope">
  501. <el-form-item
  502. :prop="'datasource.' + scope.$index + '.increaseTotalWeight'"
  503. >
  504. <el-input
  505. v-model="scope.row.increaseTotalWeight"
  506. @input="setIncreaseTotalWeight(scope.row, scope.$index)"
  507. placeholder="请输入"
  508. >
  509. <template slot="append">
  510. <span v-if="!!scope.row.productId && scope.row.productId != 0">
  511. {{ scope.row.weightUnit }}
  512. </span>
  513. <el-input
  514. v-else
  515. v-model="scope.row.weightUnit"
  516. placeholder="单位"
  517. style="width: 80px; padding: 0"
  518. ></el-input>
  519. </template>
  520. </el-input>
  521. </el-form-item>
  522. </template>
  523. <template v-slot:technologyRouteName="scope">
  524. <el-form-item
  525. :prop="'datasource.' + scope.$index + '.technologyRouteName'"
  526. :rules="{
  527. required: false,
  528. message: '请选择',
  529. trigger: 'change'
  530. }"
  531. >
  532. <el-input
  533. v-model="scope.row.technologyRouteName"
  534. placeholder="请选择"
  535. @click.native="openVersion(scope.$index)"
  536. ></el-input>
  537. </el-form-item>
  538. </template>
  539. <template v-slot:pricingWay="scope">
  540. <el-form-item :prop="'datasource.' + scope.$index + '.pricingWay'">
  541. <el-select
  542. v-model="scope.row.pricingWay"
  543. placeholder="请选择"
  544. :rules="{
  545. required: true,
  546. message: '请选择计价方式',
  547. trigger: 'change'
  548. }"
  549. @change="changeCount(scope.row, scope.$index)"
  550. >
  551. <el-option
  552. v-for="item in pricingWayList"
  553. :key="item.id"
  554. :label="item.name"
  555. :value="item.id"
  556. >
  557. </el-option>
  558. </el-select>
  559. </el-form-item>
  560. </template>
  561. <template v-slot:headerPricingWay="{ column }">
  562. <span class="is-required">{{ column.label }}</span>
  563. </template>
  564. <template v-slot:taskName="scope">
  565. <el-form-item :prop="'datasource.' + scope.$index + '.taskName'">
  566. <el-input
  567. v-model="scope.row.taskName"
  568. placeholder="请选择"
  569. style="width: 60%; margin-right: 10px"
  570. disabled
  571. ></el-input>
  572. <el-button
  573. size="small"
  574. type="primary"
  575. @click.native="handleTaskinstance(scope.row, scope.$index)"
  576. >选择
  577. </el-button>
  578. </el-form-item>
  579. </template>
  580. <template v-slot:arrivalWay="scope">
  581. <el-form-item :prop="'datasource.' + scope.$index + '.arrivalWay'">
  582. <el-select
  583. v-model="scope.row.arrivalWay"
  584. clearable
  585. style="width: 100%"
  586. >
  587. <el-option
  588. v-for="item in arrivalWayList"
  589. :key="item.value"
  590. :label="item.label"
  591. :value="item.value"
  592. >
  593. </el-option>
  594. </el-select>
  595. </el-form-item>
  596. </template>
  597. <template v-slot:batchNo="scope">
  598. <el-form-item
  599. :prop="'datasource.' + scope.$index + '.batchNo'"
  600. :rules="[
  601. {
  602. required: isBatchNo == 1 ? true : false,
  603. message: '请输入批号',
  604. trigger: 'blur'
  605. }
  606. ]"
  607. >
  608. <el-input
  609. v-model="scope.row.batchNo"
  610. placeholder="请输入"
  611. :disabled="quoteType === 2"
  612. v-no-chinese
  613. >
  614. </el-input>
  615. </el-form-item>
  616. </template>
  617. <template v-slot:headerBatchNo="{ column }">
  618. <span class="is-required">{{ column.label }}</span>
  619. </template>
  620. <template v-slot:orderNo="{ row, $index }">
  621. <el-form-item :prop="'datasource.' + $index + '.orderNo'">
  622. <el-select v-model="row.orderNo" style="width: 100%">
  623. <el-option
  624. :label="item.orderNo"
  625. :value="item.orderNo"
  626. @click.native="orderNoChange(row, item)"
  627. v-for="(item, index) in orderOption"
  628. :key="index"
  629. ></el-option>
  630. </el-select>
  631. </el-form-item>
  632. </template>
  633. <template v-slot:goodsLevel="{ row, $index }">
  634. <el-form-item :prop="'datasource.' + $index + '.goodsLevel'">
  635. <el-select
  636. v-model="row.goodsLevel"
  637. style="width: 100%"
  638. :disabled="quoteType === 2"
  639. >
  640. <el-option
  641. :label="item.label"
  642. :value="item.value"
  643. v-for="(item, index) in levelList"
  644. :key="index"
  645. ></el-option>
  646. </el-select>
  647. </el-form-item>
  648. </template>
  649. <template v-slot:goodsPriceType="{ row, $index }">
  650. <el-form-item :prop="'datasource.' + $index + '.goodsPriceType'">
  651. <DictSelection
  652. dictName="商品价格类型"
  653. clearable
  654. :disabled="quoteType === 2"
  655. v-model="row.goodsPriceType"
  656. @change="goodsPriceTypeChange(row, $index)"
  657. :isOne="$index === 0"
  658. >
  659. </DictSelection>
  660. </el-form-item>
  661. </template>
  662. <template v-slot:saleCount="scope">
  663. <el-form-item
  664. :prop="'datasource.' + scope.$index + '.' + countObj.countKey"
  665. :rules="{
  666. required: quoteType !== 2 && isTotalCount ? true : false,
  667. message: '请输入数量',
  668. trigger: 'change'
  669. }"
  670. >
  671. <el-input
  672. v-model="scope.row[countObj.countKey]"
  673. style="width: calc(100% - 36px)"
  674. placeholder="请输入"
  675. type="number"
  676. :min="0"
  677. @input="handleCountChange(scope.row, scope.$index)"
  678. >
  679. <template slot="append">
  680. <el-select
  681. v-model="scope.row[countObj.unitIdKey]"
  682. style="width: 100px"
  683. v-if="!!scope.row.productId && scope.row.productId != 0"
  684. @change="handleCountChange(scope.row, scope.$index)"
  685. >
  686. <el-option
  687. :label="item.conversionUnit"
  688. :value="item.id"
  689. v-for="(item, index) in scope.row.packageDispositionList"
  690. :key="index"
  691. ></el-option>
  692. </el-select>
  693. <el-input
  694. v-else
  695. v-model="scope.row.measuringUnit"
  696. placeholder="单位"
  697. style="width: 100px; padding: 0"
  698. ></el-input>
  699. </template>
  700. </el-input>
  701. </el-form-item>
  702. </template>
  703. <template v-slot:quoteWay="scope">
  704. <el-form-item
  705. :prop="'datasource.' + scope.$index + '.quoteWay'"
  706. :rules="{
  707. required: true,
  708. message: '请选择报价方式',
  709. trigger: 'change'
  710. }">
  711. <el-select
  712. v-model="scope.row.quoteWay"
  713. clearable
  714. filterable
  715. >
  716. <el-option
  717. v-for="i in quoteTypeOp"
  718. :key="i.value"
  719. :value="i.value"
  720. :label="i.label"
  721. ></el-option>
  722. </el-select>
  723. </el-form-item>
  724. </template>
  725. <template v-slot:headerQuoteWay="{ column }">
  726. <span class="is-required">{{ column.label }}</span>
  727. </template>
  728. <template v-slot:discountRatio="scope">
  729. <el-form-item
  730. :prop="'datasource.' + scope.$index + '.discountRatio'"
  731. :rules="{
  732. required: isDiscount == 1 ? true : false,
  733. message: '请输入折让比例',
  734. trigger: 'change'
  735. }"
  736. >
  737. <el-input
  738. v-model="scope.row.discountRatio"
  739. placeholder="请输入"
  740. type="number"
  741. :min="0"
  742. :max="100"
  743. :disabled="quoteType === 2"
  744. @input="getDiscountRatioPrice(scope.row)"
  745. >
  746. <template slot="append">%</template>
  747. </el-input>
  748. </el-form-item>
  749. </template>
  750. <template v-slot:headerDiscountRatio="{ column }">
  751. <span :class="isDiscount ? 'is-required' : ''">{{
  752. column.label
  753. }}</span>
  754. </template>
  755. <!-- <template v-slot:saleUnit="scope">
  756. <el-form-item
  757. :prop="'datasource.' + scope.$index + '.' + countObj.unitIdKey"
  758. >
  759. <el-select
  760. v-model="scope.row[countObj.unitIdKey]"
  761. style="width: 100%"
  762. @change="changeCount(scope.row, scope.$index)"
  763. >
  764. <el-option
  765. :label="item.conversionUnit"
  766. :value="item.id"
  767. @click.native="packingChange(item, scope.$index)"
  768. v-for="(item, index) in scope.row.packageDispositionList"
  769. :key="index"
  770. ></el-option>
  771. </el-select>
  772. </el-form-item>
  773. </template> -->
  774. <template v-slot:modelKey="scope">
  775. <el-form-item :prop="'datasource.' + scope.$index + '.' + 'modelKey'">
  776. <DictSelection
  777. dictName="物品机型"
  778. clearable
  779. :disabled="quoteType === 2"
  780. v-model="scope.row.modelKey"
  781. :isOne="scope.$index === 0"
  782. filterable
  783. allow-create
  784. default-first-option
  785. multiple
  786. >
  787. </DictSelection>
  788. </el-form-item>
  789. </template>
  790. <template v-slot:colorKey="scope">
  791. <el-form-item :prop="'datasource.' + scope.$index + '.' + 'colorKey'">
  792. <DictSelection
  793. dictName="物品颜色"
  794. clearable
  795. v-model="scope.row.colorKey"
  796. :isOne="scope.$index === 0"
  797. filterable
  798. allow-create
  799. default-first-option
  800. multiple
  801. >
  802. </DictSelection>
  803. </el-form-item>
  804. </template>
  805. <!-- 生产加工类型特有列的模板 -->
  806. <template v-slot:thickNess="{ row, $index }">
  807. <el-form-item :prop="'datasource.' + $index + '.thickNess'">
  808. <el-input v-model="row.thickNess" placeholder="请输入">
  809. <template slot="append">mm</template></el-input
  810. >
  811. </el-form-item>
  812. </template>
  813. <template v-slot:squareNumber="{ row, $index }">
  814. <el-form-item :prop="'datasource.' + $index + '.squareNumber'">
  815. <el-input v-model="row.squareNumber" placeholder="请输入">
  816. <template slot="append">m²</template></el-input
  817. >
  818. </el-form-item>
  819. </template>
  820. <template v-slot:processingFeeBeforeTax="{ row, $index }">
  821. <el-form-item
  822. :prop="'datasource.' + $index + '.processingFeeBeforeTax'"
  823. >
  824. <el-input
  825. v-model="row.processingFeeBeforeTax"
  826. type="number"
  827. placeholder="请输入"
  828. @input="calculateIncludingTaxPrice(row, $index)"
  829. >
  830. <template slot="append">元</template>
  831. </el-input>
  832. </el-form-item>
  833. </template>
  834. <template v-slot:packagingFeeNotTaxed="{ row, $index }">
  835. <el-form-item :prop="'datasource.' + $index + '.packagingFeeNotTaxed'">
  836. <el-input
  837. v-model="row.packagingFeeNotTaxed"
  838. type="number"
  839. placeholder="请输入"
  840. @input="calculateIncludingTaxPrice(row, $index)"
  841. >
  842. <template slot="append">元</template>
  843. </el-input>
  844. </el-form-item>
  845. </template>
  846. <template v-slot:transportationFeeWithoutTax="{ row, $index }">
  847. <el-form-item
  848. :prop="'datasource.' + $index + '.transportationFeeWithoutTax'"
  849. >
  850. <el-input
  851. v-model="row.transportationFeeWithoutTax"
  852. type="number"
  853. placeholder="请输入"
  854. @input="calculateIncludingTaxPrice(row, $index)"
  855. >
  856. <template slot="append">元</template>
  857. </el-input>
  858. </el-form-item>
  859. </template>
  860. <!-- 新增未税小记列模板 -->
  861. <template v-slot:quotationSubtotalBeforeTax="{ row, $index }">
  862. <el-form-item
  863. :prop="'datasource.' + $index + '.quotationSubtotalBeforeTax'"
  864. >
  865. {{ (Number(row.quotationSubtotalBeforeTax) || 0).toFixed(2) }}元
  866. </el-form-item>
  867. </template>
  868. <template v-slot:extraTax="{ row, $index }">
  869. <el-form-item :prop="'datasource.' + $index + '.extraTax'">
  870. <el-input
  871. v-model="row.extraTax"
  872. type="number"
  873. placeholder="请输入"
  874. @input="calculateIncludingTaxPrice(row, $index)"
  875. >
  876. <template slot="append">%</template>
  877. </el-input>
  878. </el-form-item>
  879. </template>
  880. <!-- 含税单价改为含税小计 -->
  881. <template v-slot:quotationSubtotalTax="{ row, $index }">
  882. <el-form-item :prop="'datasource.' + $index + '.quotationSubtotalTax'">
  883. {{ (Number(row.quotationSubtotalTax) || 0).toFixed(2) }}元
  884. <!-- <el-input
  885. v-model="row.quotationSubtotalTax"
  886. type="number"
  887. placeholder="请输入"
  888. >
  889. <template slot="append">元</template>
  890. </el-input> -->
  891. </el-form-item>
  892. </template>
  893. <template v-slot:productionRequirements="{ row, $index }">
  894. <el-form-item
  895. :prop="'datasource.' + $index + '.productionRequirements'"
  896. >
  897. <el-input
  898. v-model="row.productionRequirements"
  899. placeholder="请输入"
  900. type="textarea"
  901. >
  902. </el-input>
  903. </el-form-item>
  904. </template>
  905. <template v-slot:cuttingLength="{ row, $index }">
  906. <el-form-item
  907. :prop="'datasource.' + $index + '.cuttingLength'"
  908. >
  909. <el-input
  910. v-model="row.cuttingLength"
  911. placeholder="请输入"
  912. >
  913. </el-input>
  914. </el-form-item>
  915. </template>
  916. <!-- 操作列 -->
  917. <template v-slot:action="scope">
  918. <el-popconfirm
  919. class="ele-action"
  920. title="确定要删除吗?"
  921. @confirm="remove(scope.$index)"
  922. >
  923. <template v-slot:reference>
  924. <el-link type="danger" :underline="false" icon="el-icon-delete">
  925. 删除
  926. </el-link>
  927. </template>
  928. </el-popconfirm>
  929. </template>
  930. </ele-pro-table>
  931. <product-list
  932. ref="productListRef"
  933. classType="1"
  934. :is-get-inventory-total="true"
  935. @changeParent="changeParent"
  936. :isSupplier="isSupplier"
  937. :isSalesRecord="isSalesRecord"
  938. ></product-list>
  939. <head-list ref="headRef" @changeParent="changeAnswer"></head-list>
  940. <ProductionVersion
  941. ref="versionRefs"
  942. @changeProduct="changeProduct"
  943. ></ProductionVersion>
  944. <taskinstance-dialog
  945. ref="taskinstanceDialogRef"
  946. v-if="taskinstanceDialogFlag"
  947. @saveTaskInstance="saveTaskInstance"
  948. :visible.sync="taskinstanceDialogFlag"
  949. ></taskinstance-dialog>
  950. <timeDialog
  951. @chooseTime="chooseTime"
  952. ref="timeDialogRef"
  953. :isBatch="true"
  954. ></timeDialog>
  955. <selectStockLedgerDialog
  956. ref="selectStockLedgerDialogRef"
  957. @changeParent="replaceTable"
  958. :isSupplier="isSupplier"
  959. ></selectStockLedgerDialog>
  960. <commodityPriceListDialog
  961. ref="commodityPriceListDialogRef"
  962. @changeParent="changeParent"
  963. ></commodityPriceListDialog>
  964. </el-form>
  965. </template>
  966. <script>
  967. import { numberReg } from 'ele-admin';
  968. import productList from '@/BIZComponents/product-list.vue';
  969. import dictMixins from '@/mixins/dictMixins';
  970. import fileUpload from '@/components/upload/fileUpload';
  971. import headList from '@/BIZComponents/user-select/user-select.vue';
  972. import ProductionVersion from '@/components/ProductionVersion2/index.vue';
  973. import { getInventoryTotalAPI } from '@/api/wms';
  974. import { pricingWayList, lbjtList } from '@/enum/dict.js';
  975. import { changeCount, getAllPrice, getAllDiscountPrice, formatPrice, getAllQuantity } from '@/BIZComponents/setProduct.js';
  976. import { contactQueryByCategoryIdsAPI } from '@/api/saleManage/contact';
  977. import taskinstanceDialog from '@/BIZComponents/procedure/taskinstanceDialog.vue';
  978. import timeDialog from '@/components/timeDialog/index.vue';
  979. import { copyObj } from '@/utils/util';
  980. import selectStockLedgerDialog from '@/BIZComponents/selectStockLedger/selectStockLedgerDialog.vue'; //库存台账
  981. import setAllValue from '@/BIZComponents/setAllValue.vue'; //批量修改
  982. import tabMixins from '@/mixins/tableColumnsMixin';
  983. import commodityPriceListDialog from '@/views/commodityManagement/commodityPriceList/components/commodityPriceListDialog.vue';
  984. const dayjs = require('dayjs');
  985. import { levelList, quoteTypeOp } from '@/enum/dict.js';
  986. import {
  987. getGoodsPriceByCondition,
  988. getGoodsByCategoryId
  989. } from '@/api/goodsManage/index';
  990. import { parameterGetByCode } from '@/api/main/index.js';
  991. import { getSummaries } from '@/utils/util.js';
  992. export default {
  993. mixins: [dictMixins, tabMixins],
  994. components: {
  995. fileUpload,
  996. productList,
  997. headList,
  998. ProductionVersion,
  999. taskinstanceDialog,
  1000. timeDialog,
  1001. selectStockLedgerDialog,
  1002. commodityPriceListDialog,
  1003. setAllValue
  1004. },
  1005. props: {
  1006. pageName: {
  1007. default: '',
  1008. type: String
  1009. },
  1010. isDiscountTotalPrice: {
  1011. default: false,
  1012. type: Boolean
  1013. },
  1014. quoteType: {
  1015. type: Number,
  1016. default: 1
  1017. },
  1018. isGuaranteePeriod: {
  1019. default: true,
  1020. type: Boolean
  1021. },
  1022. customerMark: {
  1023. default: '',
  1024. type: String
  1025. },
  1026. isContractId: {
  1027. type: Boolean,
  1028. default: false
  1029. },
  1030. isSinglePrice: {
  1031. //单价必填
  1032. type: Boolean,
  1033. default: true
  1034. },
  1035. isTotalCount: {
  1036. //数量必填
  1037. type: Boolean,
  1038. default: true
  1039. },
  1040. isCustomerMark: {
  1041. //客户代号必填
  1042. type: Boolean,
  1043. default: false
  1044. },
  1045. isDiscount: {
  1046. //折让
  1047. type: Boolean,
  1048. default: true
  1049. },
  1050. isProduceDeliveryDeadline: {
  1051. //生产交付交期必填
  1052. type: Boolean,
  1053. default: false
  1054. },
  1055. isDrawer: {
  1056. type: Boolean,
  1057. default: false
  1058. },
  1059. isChangeCount: {
  1060. //默认计算
  1061. type: Boolean,
  1062. default: true
  1063. },
  1064. // 是否合同
  1065. isContractBook: {
  1066. type: Boolean,
  1067. default: false
  1068. },
  1069. contractBookType: {
  1070. //合同类型 1销售 2采购
  1071. type: [String, Number],
  1072. default: 1
  1073. },
  1074. isTemporary: {
  1075. //临时
  1076. type: Boolean,
  1077. default: false
  1078. },
  1079. isSupplier: {
  1080. //供应商
  1081. type: Boolean,
  1082. default: false
  1083. },
  1084. isSalesRecord: {
  1085. default: ''
  1086. },
  1087. isArrivalWay: {
  1088. //分批到货时间
  1089. type: Boolean,
  1090. default: false
  1091. },
  1092. //订单类型
  1093. needProduce: {
  1094. type: [String, Number],
  1095. default: 1
  1096. },
  1097. cacheKeyUrl: '',
  1098. //是否显示订单编码
  1099. isOrderNo: {
  1100. type: Boolean,
  1101. default: false
  1102. },
  1103. isBatchNo: {
  1104. type: Boolean, //批次号是否必填
  1105. default: false
  1106. },
  1107. orderOption: {
  1108. default: () => {
  1109. return [];
  1110. }
  1111. },
  1112. //是否商品
  1113. isGoods: {
  1114. type: Boolean,
  1115. default: false
  1116. },
  1117. // 是否税率必填
  1118. isTaxRate: {
  1119. type: [Number, String],
  1120. default: 0
  1121. },
  1122. defTaxRate: {
  1123. type: Number,
  1124. default: undefined
  1125. },
  1126. //是否显示增重重量
  1127. isIncreaseTotalWeight: {
  1128. type: Boolean,
  1129. default: false
  1130. },
  1131. countObj: {
  1132. type: Object,
  1133. default: () => {
  1134. return {
  1135. countKey: 'saleCount',
  1136. unitKey: 'saleUnit',
  1137. unitIdKey: 'saleUnitId'
  1138. };
  1139. }
  1140. },
  1141. showSummary: {
  1142. type: Boolean,
  1143. default: false
  1144. }
  1145. },
  1146. data() {
  1147. const defaultForm = {
  1148. key: null,
  1149. endTime: '',
  1150. isFirst: 0,
  1151. name: '',
  1152. startTime: '',
  1153. workHour: '',
  1154. guaranteePeriodUnitCode: '',
  1155. technicalDrawings: [],
  1156. arrivalWay: 1,
  1157. // 生产加工类型特有字段
  1158. thickNess: '',
  1159. squareNumber: '',
  1160. processingFeeBeforeTax: '',
  1161. packagingFeeNotTaxed: '',
  1162. transportationFeeWithoutTax: '',
  1163. extraTax: '',
  1164. quotationSubtotalTax: '',
  1165. // 新增未税小记字段
  1166. quotationSubtotalBeforeTax: '',
  1167. quoteWay: 1,
  1168. discountRatio: 100
  1169. };
  1170. return {
  1171. levelList,
  1172. taskinstanceDialogFlag: false,
  1173. allPrice: 0,
  1174. allQuantity: 0,
  1175. numberReg,
  1176. defaultForm,
  1177. form: {
  1178. datasource: [],
  1179. discountTotalPrice: 0
  1180. },
  1181. isDate: 1,
  1182. pricingWayList,
  1183. curIndex: '',
  1184. rules: {},
  1185. dictList: {},
  1186. arrivalWayList: [
  1187. { label: '一次性到货', value: 1 },
  1188. { label: '分批到货', value: 2 }
  1189. ],
  1190. columnsVersion: 1,
  1191. selection: [],
  1192. quoteTypeOp
  1193. };
  1194. },
  1195. computed: {
  1196. canHandl() {
  1197. return this.form.datasource.length;
  1198. },
  1199. columns() {
  1200. let columnsVersion = this.columnsVersion;
  1201. // 基础列定义
  1202. let baseColumns = [
  1203. {
  1204. label: '选择',
  1205. width: 45,
  1206. type: 'selection',
  1207. columnKey: 'selection',
  1208. align: 'center',
  1209. fixed: 'left'
  1210. },
  1211. {
  1212. width: 65,
  1213. type: 'index',
  1214. columnKey: 'index',
  1215. align: 'center',
  1216. fixed: 'left'
  1217. },
  1218. {
  1219. minWidth: 200,
  1220. prop: 'orderNo',
  1221. slot: 'orderNo',
  1222. label: '订单编码',
  1223. isNone: !this.isOrderNo,
  1224. showOverflowTooltip: true,
  1225. align: 'center'
  1226. },
  1227. {
  1228. width: 280,
  1229. prop: 'productName',
  1230. label: '名称',
  1231. slot: 'productName',
  1232. headerSlot: 'headerProductName',
  1233. align: 'center',
  1234. },
  1235. {
  1236. width: 120,
  1237. prop: 'productCode',
  1238. label: '编码',
  1239. slot: 'productCode',
  1240. align: 'center'
  1241. },
  1242. {
  1243. width: 120,
  1244. prop: 'specification',
  1245. label: '规格',
  1246. slot: 'specification',
  1247. align: 'center'
  1248. },
  1249. {
  1250. minWidth: 240,
  1251. prop: 'taskName',
  1252. label: '工序',
  1253. slot: 'taskName',
  1254. align: 'center'
  1255. },
  1256. {
  1257. minWidth: 120,
  1258. prop: 'entrustedEnterpriseId',
  1259. label: '受托企业',
  1260. slot: 'entrustedEnterpriseId',
  1261. isNone: !this.isCustomerMark,
  1262. align: 'center'
  1263. },
  1264. {
  1265. width: 140,
  1266. prop: 'pricingWay',
  1267. label: '计价方式',
  1268. headerSlot: 'headerPricingWay',
  1269. slot: 'pricingWay',
  1270. isNone: this.quoteType === 2,
  1271. fixed: 'left',
  1272. align: 'center'
  1273. },
  1274. {
  1275. width: 250,
  1276. prop: 'saleCount',
  1277. label: '数量',
  1278. slot: 'saleCount',
  1279. headerSlot: this.isTotalCount ? 'headerTotalCount' : '',
  1280. align: 'center'
  1281. },
  1282. {
  1283. width: 250,
  1284. prop: 'quoteWay',
  1285. label: '报价方式',
  1286. slot: 'quoteWay',
  1287. headerSlot: 'headerQuoteWay',
  1288. align: 'center'
  1289. },
  1290. ];
  1291. // 当quoteType为2时添加生产加工相关列
  1292. if (this.quoteType === 2) {
  1293. baseColumns.push(
  1294. {
  1295. width: 150,
  1296. prop: 'thickNess',
  1297. label: '厚度',
  1298. slot: 'thickNess',
  1299. align: 'center'
  1300. },
  1301. {
  1302. width: 150,
  1303. prop: 'squareNumber',
  1304. label: '平方数',
  1305. slot: 'squareNumber',
  1306. align: 'center'
  1307. },
  1308. {
  1309. width: 150,
  1310. prop: 'processingFeeBeforeTax',
  1311. label: '加工费(未税)',
  1312. slot: 'processingFeeBeforeTax',
  1313. align: 'center'
  1314. },
  1315. {
  1316. width: 150,
  1317. prop: 'packagingFeeNotTaxed',
  1318. label: '包装费(未税)',
  1319. slot: 'packagingFeeNotTaxed',
  1320. align: 'center'
  1321. },
  1322. {
  1323. width: 150,
  1324. prop: 'transportationFeeWithoutTax',
  1325. label: '运输费(未税)',
  1326. slot: 'transportationFeeWithoutTax',
  1327. align: 'center'
  1328. },
  1329. {
  1330. width: 150,
  1331. prop: 'quotationSubtotalBeforeTax',
  1332. label: '未税小计',
  1333. slot: 'additionalTaxRate_untaxed',
  1334. align: 'center'
  1335. },
  1336. {
  1337. width: 150,
  1338. prop: 'extraTax',
  1339. label: '税率(%)',
  1340. slot: 'extraTax',
  1341. align: 'center'
  1342. },
  1343. {
  1344. width: 150,
  1345. prop: 'quotationSubtotalTax',
  1346. label: '含税小计',
  1347. slot: 'quotationSubtotalTax',
  1348. align: 'center'
  1349. }
  1350. );
  1351. }
  1352. // 其他列
  1353. const otherColumns = [
  1354. {
  1355. width: 160,
  1356. prop: 'customerExpectDeliveryDeadline',
  1357. label: this.contractBookType == 1 ? '客户期望交期' : '交付日期',
  1358. slot: 'customerExpectDeliveryDeadline',
  1359. headerSlot:
  1360. this.isDate == 1 && this.quoteType != 2
  1361. ? 'headerCustomerExpectDeliveryDeadline'
  1362. : '',
  1363. align: 'center'
  1364. },
  1365. {
  1366. width: 180,
  1367. prop: 'singleWeight',
  1368. label: '单重',
  1369. slot: 'singleWeight',
  1370. headerSlot: 'headerSingleWeight',
  1371. align: 'center'
  1372. },
  1373. {
  1374. minWidth: 120,
  1375. prop: 'goodsLevel',
  1376. label: '物品级别',
  1377. slot: 'goodsLevel',
  1378. align: 'center',
  1379. isNone: this.quoteType === 2
  1380. },
  1381. {
  1382. width: 200,
  1383. prop: 'totalCount',
  1384. label: '计量数量',
  1385. headerSlot: 'headerTotalCount',
  1386. align: 'center',
  1387. formatter: (_row, _column, cellValue) => {
  1388. if (_row.totalCount) {
  1389. return _row.totalCount + ' ' + (_row.measuringUnit || '');
  1390. }
  1391. },
  1392. isNone: this.quoteType === 2
  1393. },
  1394. {
  1395. width: 200,
  1396. prop: 'customerMark',
  1397. label: this.contractBookType == 1 ? '客户代号' : '供应商代号',
  1398. slot: 'customerMark',
  1399. headerSlot: this.isCustomerMark ? 'headerCustomerMark' : '',
  1400. align: 'center',
  1401. isNone: this.quoteType === 2
  1402. },
  1403. {
  1404. minWidth: 160,
  1405. prop: 'productionCodes',
  1406. label: '生产编号',
  1407. align: 'center',
  1408. isNone: this.quoteType === 2
  1409. },
  1410. {
  1411. minWidth: 280,
  1412. prop: 'productionRequirements',
  1413. label: '生产要求',
  1414. align: 'center',
  1415. slot: 'productionRequirements',
  1416. isNone: !this.isProductionRequirements && this.quoteType === 2
  1417. },
  1418. {
  1419. minWidth: 280,
  1420. prop: 'cuttingLength',
  1421. label: '裁线米段',
  1422. align: 'center',
  1423. slot: 'cuttingLength',
  1424. isNone: this.quoteType === 2
  1425. },
  1426. {
  1427. width: 200,
  1428. prop: 'productCategoryName',
  1429. label: '类型',
  1430. slot: 'productCategoryName',
  1431. align: 'center',
  1432. isNone: this.quoteType === 2
  1433. },
  1434. {
  1435. width: 120,
  1436. prop: 'packingSpecification',
  1437. align: 'center',
  1438. label: '包装规格',
  1439. showOverflowTooltip: true,
  1440. isNone: this.quoteType === 2
  1441. },
  1442. {
  1443. width: 160,
  1444. prop: 'goodsPriceType',
  1445. label: '价格类型',
  1446. slot: 'goodsPriceType',
  1447. align: 'center',
  1448. isNone: this.quoteType === 2
  1449. },
  1450. {
  1451. width: 200,
  1452. prop: 'singlePrice',
  1453. label: '单价',
  1454. slot: 'singlePrice',
  1455. headerSlot: this.isSinglePrice ? 'headerSinglePrice' : '',
  1456. align: 'center',
  1457. isNone: this.quoteType === 2
  1458. },
  1459. {
  1460. width: 160,
  1461. prop: 'taxRate',
  1462. label: '税率',
  1463. slot: 'taxRate',
  1464. align: 'center',
  1465. headerSlot: this.isTaxRate == 1 ? 'headerTaxRate' : '',
  1466. isNone: this.quoteType === 2
  1467. },
  1468. {
  1469. width: 180,
  1470. prop: 'notaxSinglePrice',
  1471. label: '不含税单价',
  1472. slot: 'notaxSinglePrice',
  1473. align: 'center',
  1474. isNone: this.quoteType === 2
  1475. },
  1476. {
  1477. width: 160,
  1478. prop: 'discountRatio',
  1479. label: '折让比例',
  1480. align: 'center',
  1481. isNone: !this.isDiscount,
  1482. slot: 'discountRatio',
  1483. headerSlot: 'headerDiscountRatio'
  1484. },
  1485. {
  1486. width: 160,
  1487. prop: 'discountSinglePrice',
  1488. label: '折让单价',
  1489. align: 'center',
  1490. isNone: !this.isDiscount,
  1491. formatter: (_row, _column, cellValue) => {
  1492. return _row.discountSinglePrice
  1493. ? formatPrice(Number(_row.discountSinglePrice))
  1494. : '';
  1495. }
  1496. },
  1497. {
  1498. width: 120,
  1499. prop: 'totalPrice',
  1500. label: '合计',
  1501. slot: 'totalPrice',
  1502. align: 'center'
  1503. },
  1504. {
  1505. width: 160,
  1506. prop: 'discountTotalPrice',
  1507. label: '折让合计',
  1508. align: 'center',
  1509. isNone: !this.isDiscount,
  1510. formatter: (_row, _column, cellValue) => {
  1511. return _row.discountTotalPrice
  1512. ? formatPrice(Number(_row.discountTotalPrice))
  1513. : '';
  1514. }
  1515. },
  1516. {
  1517. width: 110,
  1518. prop: 'batchNo',
  1519. label: '批次号',
  1520. slot: 'batchNo',
  1521. headerSlot: this.isBatchNo ? 'headerBatchNo' : '',
  1522. align: 'center',
  1523. isNone: this.quoteType === 2
  1524. },
  1525. {
  1526. width: 120,
  1527. prop: 'warehouseName',
  1528. label: '仓库名称',
  1529. slot: 'warehouseName',
  1530. align: 'center',
  1531. isNone: this.quoteType === 2
  1532. },
  1533. {
  1534. width: 120,
  1535. prop: 'availableCountBase',
  1536. label: '库存数量',
  1537. slot: 'availableCountBase',
  1538. align: 'center',
  1539. isNone: this.quoteType === 2
  1540. },
  1541. {
  1542. prop: 'provenance',
  1543. label: '产地',
  1544. slot: 'provenance',
  1545. align: 'center',
  1546. showOverflowTooltip: true,
  1547. minWidth: 200,
  1548. isNone: this.quoteType === 2
  1549. },
  1550. {
  1551. width: 180,
  1552. prop: 'totalWeight',
  1553. label: '总重',
  1554. slot: 'totalWeight',
  1555. formatter: (_row, _column, cellValue) => {
  1556. if (_row.totalWeight) {
  1557. return _row.totalWeight + ' ' + (_row.weightUnit || '');
  1558. }
  1559. },
  1560. align: 'center'
  1561. },
  1562. {
  1563. width: 180,
  1564. prop: 'increaseTotalWeight',
  1565. label: '增重重量',
  1566. slot: 'increaseTotalWeight',
  1567. isNone: this.quoteType === 2 || !this.isIncreaseTotalWeight,
  1568. align: 'center'
  1569. },
  1570. {
  1571. width: 160,
  1572. prop: 'productBrand',
  1573. label: '牌号',
  1574. slot: 'productBrand',
  1575. align: 'center',
  1576. isNone: this.quoteType === 2
  1577. },
  1578. {
  1579. width: 120,
  1580. prop: 'modelType',
  1581. label: '型号',
  1582. slot: 'modelType',
  1583. align: 'center',
  1584. isNone: this.quoteType === 2
  1585. },
  1586. {
  1587. width: 160,
  1588. prop: 'modelKey',
  1589. label: '机型',
  1590. slot: 'modelKey',
  1591. align: 'center',
  1592. isNone: this.quoteType === 2
  1593. },
  1594. {
  1595. width: 160,
  1596. prop: 'colorKey',
  1597. label: '颜色',
  1598. slot: 'colorKey',
  1599. align: 'center',
  1600. isNone: this.quoteType === 2
  1601. },
  1602. {
  1603. width: 120,
  1604. prop: 'produceType',
  1605. align: 'center',
  1606. label: '属性类型',
  1607. isNone: this.quoteType === 2,
  1608. showOverflowTooltip: true,
  1609. formatter: (row, column) => {
  1610. if (row.produceType) {
  1611. return row.produceType
  1612. .map((item) => {
  1613. return lbjtList[item];
  1614. })
  1615. .toString();
  1616. }
  1617. }
  1618. },
  1619. {
  1620. width: 160,
  1621. prop: 'arrivalWay',
  1622. label: '到货方式',
  1623. slot: 'arrivalWay',
  1624. align: 'center',
  1625. isNone: !this.isArrivalWay || this.quoteType === 2
  1626. },
  1627. {
  1628. width: 160,
  1629. prop: 'produceDeliveryDeadline',
  1630. label: '生产交付交期',
  1631. slot: 'produceDeliveryDeadline',
  1632. headerSlot:
  1633. this.isDate == 1 && this.isProduceDeliveryDeadline
  1634. ? 'headerProduceDeliveryDeadline'
  1635. : '',
  1636. isNone: this.contractBookType != 1,
  1637. align: 'center'
  1638. },
  1639. {
  1640. width: 200,
  1641. prop: 'guaranteePeriod',
  1642. label: '有效期',
  1643. slot: 'guaranteePeriod',
  1644. align: 'center',
  1645. isNone: this.quoteType === 2
  1646. },
  1647. {
  1648. width: 200,
  1649. prop: 'guaranteePeriodDeadline',
  1650. label: '有效期截止日期',
  1651. slot: 'guaranteePeriodDeadline',
  1652. isNone: !this.isGuaranteePeriod || this.quoteType === 2,
  1653. align: 'center'
  1654. },
  1655. {
  1656. width: 120,
  1657. prop: 'imgCode',
  1658. align: 'center',
  1659. label: '图号/件号',
  1660. showOverflowTooltip: true,
  1661. isNone: this.quoteType === 2
  1662. },
  1663. {
  1664. width: 220,
  1665. prop: 'customerReqFiles',
  1666. label: '客户需求',
  1667. slot: 'customerReqFiles',
  1668. align: 'center',
  1669. isNone: this.quoteType === 2
  1670. },
  1671. {
  1672. width: 130,
  1673. prop: 'technicalAnswerName',
  1674. label: '技术答疑人',
  1675. slot: 'technicalAnswerName',
  1676. align: 'center',
  1677. isNone: this.quoteType === 2
  1678. },
  1679. {
  1680. width: 220,
  1681. prop: 'technicalParams',
  1682. label: '技术参数',
  1683. slot: 'technicalParams',
  1684. align: 'center',
  1685. isNone: this.quoteType === 2
  1686. },
  1687. {
  1688. width: 240,
  1689. prop: 'technicalDrawings',
  1690. label: '技术图纸',
  1691. slot: 'technicalDrawings',
  1692. align: 'center'
  1693. },
  1694. {
  1695. width: 120,
  1696. prop: 'drawingVersion',
  1697. label: '图纸版本',
  1698. align: 'center',
  1699. isNone: this.quoteType === 2
  1700. },
  1701. {
  1702. width: 240,
  1703. prop: 'technologyRouteName',
  1704. label: '工艺路线',
  1705. slot: 'technologyRouteName',
  1706. align: 'center',
  1707. isNone: this.quoteType === 2
  1708. },
  1709. {
  1710. width: 240,
  1711. prop: 'industryArtFiles',
  1712. label: '工艺附件',
  1713. slot: 'industryArtFiles',
  1714. align: 'center',
  1715. isNone: this.quoteType === 2
  1716. },
  1717. {
  1718. width: 240,
  1719. prop: 'otherFiles',
  1720. label: '其他附件',
  1721. slot: 'otherFiles',
  1722. align: 'center',
  1723. isNone: this.quoteType === 2
  1724. },
  1725. {
  1726. width: 220,
  1727. prop: 'remark',
  1728. label: '备注',
  1729. slot: 'remark',
  1730. align: 'center'
  1731. },
  1732. {
  1733. columnKey: 'action',
  1734. label: '操作',
  1735. width: 120,
  1736. align: 'center',
  1737. resizable: false,
  1738. slot: 'action',
  1739. fixed: 'right',
  1740. showOverflowTooltip: true
  1741. }
  1742. ];
  1743. // 合并所有列
  1744. return [...baseColumns, ...otherColumns].filter((item) => !item.isNone);
  1745. }
  1746. },
  1747. created() {
  1748. parameterGetByCode({
  1749. code: 'eom_inventoryTable_customerExpectDeliveryDeadline'
  1750. }).then((res) => {
  1751. if (res.value) {
  1752. this.isDate = res.value;
  1753. }
  1754. });
  1755. },
  1756. methods: {
  1757. formatPrice,
  1758. getSummaries(param) {
  1759. return getSummaries(
  1760. param,
  1761. ['saleCount'],
  1762. ' '
  1763. );
  1764. },
  1765. handleCountChange(row, index,weightType) {
  1766. // 数量变化时,若为生产加工类型,触发含税小计计算
  1767. if (this.quoteType === 2) {
  1768. this.calculateIncludingTaxPrice(row, index);
  1769. } else {
  1770. this.changeCount(row, index,weightType);
  1771. }
  1772. },
  1773. packingChange(item, index) {
  1774. this.$set(
  1775. this.form.datasource[index],
  1776. this.countObj.unitKey,
  1777. item.conversionUnit
  1778. );
  1779. this.handleCountChange(this.form.datasource[index], index);
  1780. },
  1781. openVersion(index) {
  1782. this.$refs.versionRefs.open(index);
  1783. },
  1784. //设置分批到货时间
  1785. handleMethod(row, index) {
  1786. this.$refs.timeDialogRef.open(row, index);
  1787. },
  1788. chooseTime({ arrivalBatch, index }) {
  1789. this.$set(
  1790. this.form.datasource[index],
  1791. 'arrivalBatch',
  1792. copyObj(arrivalBatch)
  1793. );
  1794. },
  1795. //工艺路线
  1796. changeProduct(data, index) {
  1797. this.$set(
  1798. this.form.datasource[index],
  1799. 'technologyRouteName',
  1800. data.name
  1801. );
  1802. this.$set(this.form.datasource[index], 'technologyRouteId', data.id);
  1803. },
  1804. handleTaskinstance(row, index) {
  1805. this.taskinstanceDialogFlag = true;
  1806. this.$nextTick(() => {
  1807. this.$refs.taskinstanceDialogRef.open(row, index);
  1808. });
  1809. },
  1810. saveTaskInstance(row = {}) {
  1811. this.$set(this.form.datasource[row.index], 'taskId', row.id);
  1812. this.$set(this.form.datasource[row.index], 'taskName', row.name);
  1813. this.$set(
  1814. this.form.datasource[row.index],
  1815. 'routingId',
  1816. row.produceRoutingId
  1817. );
  1818. },
  1819. async getSupplierObj(productList, queryName) {
  1820. try {
  1821. let categoryIds = productList
  1822. .filter((item) => item.productId)
  1823. .map((item) => item.productId);
  1824. if (categoryIds.length > 0) {
  1825. return await contactQueryByCategoryIdsAPI({
  1826. categoryIds
  1827. });
  1828. } else {
  1829. return Promise.resolve({});
  1830. }
  1831. } catch (e) {
  1832. return Promise.resolve({});
  1833. }
  1834. },
  1835. setDeliveryDays(row, index, type, isAll) {
  1836. if (isAll) {
  1837. this.form.datasource.forEach((item, i) => {
  1838. let guaranteePeriodUnitName = this.guaranteePeriodUnit(
  1839. item.guaranteePeriodUnitCode
  1840. );
  1841. this.$set(
  1842. this.form.datasource[i],
  1843. 'guaranteePeriodDeadline',
  1844. guaranteePeriodUnitName != 'second'
  1845. ? this.setDay(
  1846. item.guaranteePeriod,
  1847. guaranteePeriodUnitName,
  1848. item
  1849. )
  1850. : ''
  1851. );
  1852. });
  1853. return;
  1854. }
  1855. if (type == 'guaranteePeriod') {
  1856. let guaranteePeriodUnitName = this.guaranteePeriodUnit(
  1857. row.guaranteePeriodUnitCode
  1858. );
  1859. this.$set(
  1860. this.form.datasource[index],
  1861. 'guaranteePeriodDeadline',
  1862. guaranteePeriodUnitName != 'second'
  1863. ? this.setDay(row.guaranteePeriod, guaranteePeriodUnitName, row)
  1864. : ''
  1865. );
  1866. }
  1867. },
  1868. guaranteePeriodUnit(code) {
  1869. return code == 3
  1870. ? 'day'
  1871. : code == 4
  1872. ? 'month'
  1873. : code == 5
  1874. ? 'year'
  1875. : 'second';
  1876. },
  1877. setDay(addDay, dateType = 'day', item) {
  1878. let tiem =
  1879. this.contractBookType == 1
  1880. ? item.produceDeliveryDeadline
  1881. : item.customerExpectDeliveryDeadline;
  1882. return dayjs(tiem || new Date())
  1883. .add(addDay, dateType)
  1884. .format('YYYY-MM-DD');
  1885. },
  1886. // 返回列表数据
  1887. getTableValue() {
  1888. let comitDatasource = copyObj(this.form.datasource);
  1889. if (comitDatasource.length === 0) return [];
  1890. comitDatasource.forEach((v) => {
  1891. if (v.guaranteePeriodUnitCode) {
  1892. v.guaranteePeriodUnitName = this.getDictValue(
  1893. '保质期单位',
  1894. v.guaranteePeriodUnitCode
  1895. );
  1896. }
  1897. if (v.modelKey) {
  1898. v.modelKey = v.modelKey.toString();
  1899. }
  1900. if (v.colorKey) {
  1901. v.colorKey = v.colorKey.toString();
  1902. }
  1903. v.technicalDrawings = v.technicalDrawings ? v.technicalDrawings : [];
  1904. v.customerReqFiles = v.customerReqFiles || [];
  1905. v.industryArtFiles = v.industryArtFiles || [];
  1906. v.otherFiles = v.otherFiles || [];
  1907. });
  1908. return comitDatasource;
  1909. },
  1910. getPrice() {
  1911. return [this.allPrice, this.form.discountTotalPrice];
  1912. },
  1913. //改变数量
  1914. changeCount(row, index, weightType) {
  1915. if (!row) {
  1916. this.form.datasource = this.form.datasource.map((item, i) => {
  1917. return changeCount(item, this.countObj, false);
  1918. });
  1919. this.form.datasource.forEach((item, i) => {
  1920. this.setIncreaseTotalWeight(item, i);
  1921. });
  1922. } else {
  1923. const updatedRow = changeCount(row, this.countObj, false, weightType);
  1924. this.$set(this.form.datasource, index, updatedRow);
  1925. this.setIncreaseTotalWeight(row, index);
  1926. }
  1927. this.$nextTick(() => {
  1928. // 生产加工类型不需要计算不含税单价,但需要计算含税小计
  1929. this.getNotaxSinglePrice();
  1930. this.changeAll();
  1931. });
  1932. },
  1933. setIncreaseTotalWeight(row, index) {
  1934. if (row.pricingWay == 3) {
  1935. this.$set(
  1936. this.form.datasource[index],
  1937. 'totalPrice',
  1938. formatPrice((row.increaseTotalWeight || 0) * row.singlePrice)
  1939. );
  1940. this.changeAll();
  1941. }
  1942. },
  1943. // 计算含税小计(原含税单价逻辑)
  1944. calculateIncludingTaxPrice(row, index) {
  1945. if (!row) return;
  1946. // 计算未税小记
  1947. const quotationSubtotalBeforeTax =
  1948. (Number(row.processingFeeBeforeTax) || 0) +
  1949. (Number(row.packagingFeeNotTaxed) || 0) +
  1950. (Number(row.transportationFeeWithoutTax) || 0);
  1951. // 使用 $nextTick 确保响应式更新完成
  1952. // this.$nextTick(() => {
  1953. this.$set(
  1954. this.form.datasource[index],
  1955. 'quotationSubtotalBeforeTax',
  1956. quotationSubtotalBeforeTax.toFixed(2)
  1957. );
  1958. // 计算含税小计
  1959. const taxRate = (Number(row.extraTax) || 0) / 100;
  1960. const quotationSubtotalTax = quotationSubtotalBeforeTax * (1 + taxRate);
  1961. this.$set(
  1962. this.form.datasource[index],
  1963. 'quotationSubtotalTax',
  1964. quotationSubtotalTax.toFixed(2)
  1965. );
  1966. const quantity = Number(row[this.countObj.countKey]) || 1;
  1967. const totalPrice = quotationSubtotalTax * quantity;
  1968. this.$set(
  1969. this.form.datasource[index],
  1970. 'totalPrice',
  1971. formatPrice(totalPrice)
  1972. );
  1973. if (
  1974. row[this.countObj.unitKey] == row.weightUnit &&
  1975. row.pricingWay == 1
  1976. ) {
  1977. this.$set(this.form.datasource[index], 'totalWeight', quantity);
  1978. } else {
  1979. if (quantity && row.singleWeight) {
  1980. this.$set(
  1981. this.form.datasource[index],
  1982. 'totalWeight',
  1983. (quantity * row.singleWeight).toFixed(2)
  1984. );
  1985. }
  1986. }
  1987. this.changeAll();
  1988. // });
  1989. },
  1990. changeAll() {
  1991. this.allPrice = getAllPrice(this.form.datasource) || 0;
  1992. this.allQuantity = getAllQuantity(this.form.datasource, this.countObj) || 0;
  1993. this.form.discountTotalPrice = getAllDiscountPrice(this.form.datasource) || 0;
  1994. if (this.isDiscountTotalPrice) {
  1995. this.form.discountTotalPrice = this.form.discountTotalPrice;
  1996. this.$emit('setDiscountTotalPrice', this.form.discountTotalPrice);
  1997. }
  1998. this.$emit('setCountAmount', this.allPrice, this.form.discountTotalPrice);
  1999. },
  2000. setCustomerMark(customerMark) {
  2001. this.form.datasource.forEach((item) => {
  2002. item['customerMark'] = customerMark;
  2003. this.$forceUpdate();
  2004. });
  2005. },
  2006. // 计算折让单价,折让总价
  2007. getDiscountRatioPrice(row) {
  2008. this.form.datasource.forEach((item, index) => {
  2009. if (item.singlePrice && item.discountRatio) {
  2010. this.$set(
  2011. this.form.datasource[index],
  2012. 'discountSinglePrice',
  2013. formatPrice(item.singlePrice * (item.discountRatio / 100))
  2014. );
  2015. this.$set(
  2016. this.form.datasource[index],
  2017. 'discountTotalPrice',
  2018. formatPrice(
  2019. item.totalPrice * (item.discountRatio / 100)
  2020. )
  2021. );
  2022. } else {
  2023. this.$set(this.form.datasource[index], 'discountSinglePrice', 0);
  2024. this.$set(this.form.datasource[index], 'discountTotalPrice', 0);
  2025. }
  2026. this.$set(
  2027. this.form,
  2028. 'discountTotalPrice',
  2029. this.form.datasource.reduce(
  2030. (acc, cur) => acc + Number(cur.discountTotalPrice || 0),
  2031. 0
  2032. )
  2033. );
  2034. this.changeAll();
  2035. });
  2036. },
  2037. //计算不含税单价
  2038. getNotaxSinglePrice() {
  2039. this.form.datasource.forEach((item, index) => {
  2040. if (item.singlePrice && item.taxRate) {
  2041. this.$set(
  2042. this.form.datasource[index],
  2043. 'notaxSinglePrice',
  2044. formatPrice(item.singlePrice / (1 + item.taxRate / 100))
  2045. );
  2046. } else {
  2047. this.$set(this.form.datasource[index], 'notaxSinglePrice', '');
  2048. }
  2049. });
  2050. },
  2051. //设置优惠后总金额修改产品单价
  2052. discountInputByOrder(val) {
  2053. this.form.discountTotalPrice = val;
  2054. this.form.datasource.forEach((item, index) => {
  2055. this.$set(
  2056. this.form.datasource[index],
  2057. 'discountSinglePrice',
  2058. this.getDiscountSinglePrice(item)
  2059. );
  2060. this.$set(
  2061. this.form.datasource[index],
  2062. 'discountTotalPrice',
  2063. this.getDiscountTotalPrice(item)
  2064. );
  2065. this.$set(
  2066. this.form.datasource[index],
  2067. 'discountRatio',
  2068. this.getDiscountRatio(item)
  2069. );
  2070. });
  2071. this.$emit('setDiscountTotalPrice', val);
  2072. this.$forceUpdate();
  2073. this.$refs.table.reRenderTable();
  2074. },
  2075. setAllValueChange({ key, value }) {
  2076. let indexS = this.selection.map((item) => item.key - 1);
  2077. indexS.forEach((i) => {
  2078. this.$set(this.form.datasource[i], key, value);
  2079. this.setDeliveryDays(this.form.datasource[i], i, 'guaranteePeriod');
  2080. });
  2081. },
  2082. //获取折让单价
  2083. getDiscountSinglePrice(row) {
  2084. let num =
  2085. (Number(this.form.discountTotalPrice) / Number(this.allPrice)) *
  2086. Number(row.singlePrice);
  2087. return isNaN(num) ? '' : formatPrice(num);
  2088. },
  2089. //获取折让比例
  2090. getDiscountRatio(row) {
  2091. let num = 100;
  2092. // if(Number(row.discountRatio)) {
  2093. // num =
  2094. // ((Number(this.form.discountTotalPrice) / Number(this.allPrice)) * Number(row.discountRatio)).toFixed(2);
  2095. // console.log('折让比例', row.discountRatio, num, (Number(this.form.discountTotalPrice) / Number(this.allPrice)))
  2096. // } else {
  2097. num = ((Number(this.form.discountTotalPrice) / Number(this.allPrice)) * 100).toFixed(2);
  2098. // }
  2099. return isNaN(num) ? '' : num;
  2100. },
  2101. //获取折让合计
  2102. getDiscountTotalPrice(row) {
  2103. let num = 0;
  2104. num =
  2105. Number(row.discountSinglePrice) * Number(row[this.countObj.countKey]);
  2106. return isNaN(num) ? '' : formatPrice(num);
  2107. },
  2108. orderNoChange(row, item) {
  2109. row['orderId'] = item.orderId;
  2110. },
  2111. //修改回显
  2112. async putTableValue(data) {
  2113. let productList =
  2114. (data &&
  2115. (data.quoteProductList || data.productList || data.detailList)) ||
  2116. [];
  2117. if (productList) {
  2118. let supplierObj = await this.getSupplierObj(productList, 'productId');
  2119. productList.forEach((item, index) => {
  2120. item['key'] = index + 1;
  2121. if (item.modelKey) {
  2122. item.modelKey = item.modelKey.split(',');
  2123. }
  2124. if (item.colorKey) {
  2125. item.colorKey = item.colorKey.split(',');
  2126. }
  2127. item.guaranteePeriodUnitCode = item.guaranteePeriodUnitCode
  2128. ? item.guaranteePeriodUnitCode + ''
  2129. : '';
  2130. let guaranteePeriodUnitName = this.guaranteePeriodUnit(
  2131. item.guaranteePeriodUnitCode
  2132. );
  2133. if (item.guaranteePeriod && item.guaranteePeriodUnitCode) {
  2134. item['guaranteePeriodDeadline'] =
  2135. item['guaranteePeriodDeadline'] ||
  2136. guaranteePeriodUnitName != 'second'
  2137. ? this.setDay(
  2138. item.guaranteePeriod,
  2139. guaranteePeriodUnitName,
  2140. item
  2141. )
  2142. : '';
  2143. }
  2144. item.entrustedEnterpriseIdList = supplierObj[item.productId];
  2145. // if (supplierObj[item.productId]?.length === 1) {
  2146. // item.entrustedEnterpriseId = supplierObj[item.productId][0].id;
  2147. // }
  2148. // item.entrustedEnterpriseId = item.entrustedEnterpriseId || undefined;
  2149. this.$set(
  2150. item,
  2151. 'entrustedEnterpriseId',
  2152. item.entrustedEnterpriseId || ''
  2153. );
  2154. item['customerMark'] = item.customerMark || this.customerMark;
  2155. item['arrivalWay'] = item.arrivalWay || 1;
  2156. item.discountRatio = Number(item.discountRatio) || 100;
  2157. item.taxRate = item.taxRate ? item.taxRate : this.isContractBook ? this.defTaxRate : this.isTaxRate == 1 ? this.defTaxRate : undefined;
  2158. item.quoteWay = item.quoteWay || 1;
  2159. });
  2160. this.form.datasource = productList;
  2161. let codeList = this.form.datasource
  2162. .filter((item) => item.productCode)
  2163. .map((item) => item.batchNo ? [item.productCode, item.batchNo].join(',') : item.productCode);
  2164. //获取仓库库存
  2165. let inventoryTotalList = await getInventoryTotalAPI(codeList);
  2166. this.form.datasource
  2167. .filter((item) => item.productCode)
  2168. .forEach((item, index) => {
  2169. let find =
  2170. inventoryTotalList.find(
  2171. (key) => (key.code + ',' + key.batchNo == item.productCode+','+item.batchNo)
  2172. ) || {};
  2173. this.form.datasource;
  2174. this.$set(
  2175. this.form.datasource[index],
  2176. 'availableCountBase',
  2177. find.availableCountBase
  2178. );
  2179. });
  2180. if (this.isChangeCount) {
  2181. this.changeCount();
  2182. } else {
  2183. this.allPrice = data.totalAmount || data?.contractVO?.totalPrice;
  2184. this.allQuantity = getAllQuantity(this.form.datasource, this.countObj);
  2185. }
  2186. if (this.isDiscountTotalPrice) {
  2187. this.form.discountTotalPrice =
  2188. data.payAmount || data?.contractVO?.discountTotalPrice;
  2189. }
  2190. this.$refs.table.reload();
  2191. }
  2192. },
  2193. //选择产品
  2194. handParent(row, index) {
  2195. let item = {
  2196. id: row?.productCode
  2197. };
  2198. if (row?.goodsId) {
  2199. this.handGoods(index);
  2200. return;
  2201. }
  2202. if (this.needProduce == 1 || this.needProduce == 2) {
  2203. this.$refs.productListRef.open(item, index);
  2204. } else {
  2205. this.$refs.selectStockLedgerDialogRef.open(item, index);
  2206. }
  2207. },
  2208. handGoods(index) {
  2209. this.$refs.commodityPriceListDialogRef.open(index);
  2210. },
  2211. //选择技术人回调
  2212. changeAnswer(obj, idx) {
  2213. this.$set(this.form.datasource[idx], 'technicalAnswerId', obj.id);
  2214. this.$set(this.form.datasource[idx], 'technicalAnswerName', obj.name);
  2215. },
  2216. handHead(row, index) {
  2217. let item = {
  2218. id: row.technicalAnswerId
  2219. };
  2220. this.$refs.headRef.open(item, index);
  2221. },
  2222. //选择产品回调
  2223. changeParent(obj, idx) {
  2224. obj.forEach((item, index) => {
  2225. let i = idx == -1 ? index : idx;
  2226. let row = JSON.parse(JSON.stringify(this.defaultForm));
  2227. row.key = this.form.datasource.length + 1;
  2228. let parasm = idx == -1 ? row : this.form.datasource[i];
  2229. this.$set(parasm, 'productId', item.id);
  2230. this.$set(parasm, 'categoryName', item.name);
  2231. this.$set(parasm, 'productCategoryId', item.categoryLevelId);
  2232. this.$set(parasm, 'productBrand', item.brandNum);
  2233. this.$set(parasm, 'productCategoryName', item.categoryLevelPath);
  2234. this.$set(parasm, 'productCode', item.code);
  2235. this.$set(parasm, 'productName', item.name);
  2236. this.$set(parasm, 'modelType', item.modelType);
  2237. this.$set(parasm, 'availableCountBase', item.availableCountBase);
  2238. this.$set(parasm, 'measuringUnit', item.measuringUnit);
  2239. this.$set(parasm, 'specification', item.specification);
  2240. this.$set(parasm, 'weightUnit', item.weightUnit);
  2241. this.$set(parasm, 'singleWeight', item.netWeight);
  2242. this.$set(parasm, 'pricingWay', 1);
  2243. this.$set(parasm, 'goodsLevel', item.goodsLevel);
  2244. this.$set(parasm, 'guaranteePeriod', item.warrantyPeriod);
  2245. this.$set(
  2246. parasm,
  2247. 'customerExpectDeliveryDeadline',
  2248. dayjs(new Date()).format('YYYY-MM-DD')
  2249. );
  2250. if (item.modelKey) {
  2251. this.$set(parasm, 'modelKey', item.modelKey.split(','));
  2252. }
  2253. if (item.colorKey) {
  2254. this.$set(parasm, 'colorKey', item.colorKey.split(','));
  2255. }
  2256. if (this.defTaxRate) {
  2257. this.$set(parasm, 'taxRate', parasm.taxRate ? parasm.taxRate : this.isContractBook ? this.defTaxRate : this.isTaxRate == 1 ? this.defTaxRate : undefined);
  2258. }
  2259. this.$set(
  2260. parasm,
  2261. 'guaranteePeriodUnitCode',
  2262. item.warrantyPeriodUnit ? item.warrantyPeriodUnit + '' : ''
  2263. );
  2264. if (item.warrantyPeriod && item.warrantyPeriodUnit) {
  2265. this.$set(
  2266. parasm,
  2267. 'guaranteePeriodDeadline',
  2268. this.setDay(
  2269. item.warrantyPeriod,
  2270. this.guaranteePeriodUnit(item.warrantyPeriodUnit),
  2271. {}
  2272. )
  2273. );
  2274. }
  2275. this.$set(
  2276. parasm,
  2277. 'packageDispositionList',
  2278. item.packageDispositionList
  2279. );
  2280. if (item.packageDispositionList?.length) {
  2281. this.$set(
  2282. parasm,
  2283. this.countObj.unitIdKey,
  2284. item.packageDispositionList[0].id
  2285. );
  2286. this.$set(
  2287. parasm,
  2288. this.countObj.unitKey,
  2289. item.packageDispositionList[0].conversionUnit
  2290. );
  2291. }
  2292. this.$set(parasm, 'arrivalWay', item.arrivalWay || 1);
  2293. this.$set(parasm, 'imgCode', item.imgCode);
  2294. this.$set(parasm, 'produceType', item.componentAttribute);
  2295. if (this.isOrderNo) {
  2296. this.$set(parasm, 'orderNo', this.orderOption[0]?.orderNo);
  2297. this.$set(parasm, 'orderId', this.orderOption[0]?.orderId);
  2298. }
  2299. if (this.isGoods && item.goodsId) {
  2300. this.$set(parasm, 'goodsId', item.goodsId);
  2301. this.$set(parasm, 'goodsPriceId', item.goodsPriceId);
  2302. this.$set(parasm, 'goodsPriceType', item.goodsPriceType);
  2303. this.$set(parasm, 'singlePrice', item.singlePrice);
  2304. this.$set(parasm, 'notaxSinglePrice', item.notaxSinglePrice);
  2305. this.$set(parasm, 'taxRate', item.taxRate);
  2306. this.$set(parasm, 'discountSinglePrice', item.singlePrice);
  2307. this.$set(parasm, 'totalCount', '');
  2308. this.$set(parasm, 'discountRatio', item.discountRatio);
  2309. this.$set(parasm, 'quoteWay', item.quoteWay || 1);
  2310. } else {
  2311. this.$set(parasm, 'singlePrice', parasm.singlePrice || 0);
  2312. this.$set(parasm, 'discountRatio', parasm.discountRatio || 100);
  2313. this.$set(parasm, 'quoteWay', parasm.quoteWay || 1);
  2314. }
  2315. // 初始化生产加工特有字段及未税小记
  2316. // 当quoteType为2时,数量默认设置为1
  2317. if (this.quoteType === 2) {
  2318. this.processSetValue(parasm);
  2319. }
  2320. if (this.isSupplier) {
  2321. this.$set(
  2322. parasm,
  2323. 'entrustedEnterpriseIdList',
  2324. item.entrustedEnterpriseIdList
  2325. );
  2326. this.$set(
  2327. parasm,
  2328. 'entrustedEnterpriseId',
  2329. item.entrustedEnterpriseId
  2330. );
  2331. }
  2332. this.$set(parasm, 'approvalNumber', item.extField?.approvalNumber);
  2333. this.$set(
  2334. parasm,
  2335. 'packingSpecification',
  2336. item.extField.packingSpecification
  2337. );
  2338. this.$set(parasm, 'customerMark', this.customerMark);
  2339. if (item.purchaseOrigins?.length > 0) {
  2340. item.purchaseOrigins = item.purchaseOrigins.map((val) => val + '');
  2341. }
  2342. this.$set(parasm, 'provenance', item.purchaseOrigins || []);
  2343. if (idx == -1) {
  2344. this.form.datasource.push(row);
  2345. }
  2346. });
  2347. this.changeCount();
  2348. },
  2349. replaceTable(obj, idx) {
  2350. obj.forEach(async (item, index) => {
  2351. let i = idx == -1 ? index : idx;
  2352. let row = JSON.parse(JSON.stringify(this.defaultForm));
  2353. row.key = this.form.datasource.length + 1;
  2354. let parasm = idx == -1 ? row : this.form.datasource[i];
  2355. this.$set(parasm, 'customerMark', this.customerMark);
  2356. this.$set(parasm, 'productId', item.productId);
  2357. this.$set(parasm, 'categoryName', item.productName);
  2358. this.$set(parasm, 'productCategoryId', item.categoryLevelId);
  2359. this.$set(parasm, 'productBrand', item.productBrand);
  2360. this.$set(parasm, 'productCategoryName', item.categoryLevelPath);
  2361. this.$set(parasm, 'productCode', item.productCode);
  2362. this.$set(parasm, 'productName', item.productName);
  2363. this.$set(parasm, 'modelType', item.categoryModel);
  2364. this.$set(parasm, 'warehouseId', item.warehouseId);
  2365. this.$set(parasm, 'warehouseName', item.warehouseName);
  2366. this.$set(parasm, 'availableCountBase', item.measureQuantity);
  2367. this.$set(parasm, 'measuringUnit', item.measuringUnit);
  2368. this.$set(parasm, 'specification', item.specification);
  2369. this.$set(parasm, 'weightUnit', item.weightUnit);
  2370. this.$set(parasm, 'singleWeight', item.weight);
  2371. this.$set(parasm, 'pricingWay', 1);
  2372. this.$set(parasm, 'arrivalWay', item.arrivalWay || 1);
  2373. this.$set(parasm, 'batchNo', item.batchNo);
  2374. this.$set(parasm, 'imgCode', '');
  2375. this.$set(parasm, 'produceType', item.componentAttribute);
  2376. let goodsData = await getGoodsByCategoryId(item.productId);
  2377. goodsData = goodsData.filter((item) => item.approvalStatus == 2);
  2378. if (goodsData?.length) {
  2379. let goodsPriceList = goodsData[0]?.goodsPriceList[0];
  2380. this.$set(parasm, 'goodsId', goodsData[0].id);
  2381. this.$set(parasm, 'goodsPriceId', goodsPriceList.id);
  2382. this.$set(parasm, 'goodsPriceType', goodsPriceList.priceType);
  2383. this.$set(parasm, 'singlePrice', goodsPriceList.unitPrice || 0);
  2384. this.$set(
  2385. parasm,
  2386. 'notaxSinglePrice',
  2387. goodsPriceList.excludeTaxPrice
  2388. );
  2389. this.$set(parasm, 'taxRate', goodsPriceList.taxRate);
  2390. this.$set(parasm, 'discountSinglePrice', goodsPriceList.unitPrice);
  2391. this.$set(parasm, 'totalCount', '');
  2392. } else {
  2393. this.$set(parasm, 'singlePrice', 0);
  2394. }
  2395. if (item.modelKey) {
  2396. this.$set(parasm, 'modelKey', item.modelKey.split(','));
  2397. }
  2398. if (item.colorKey) {
  2399. this.$set(parasm, 'colorKey', item.colorKey.split(','));
  2400. }
  2401. if (this.isSupplier) {
  2402. this.$set(
  2403. parasm,
  2404. 'entrustedEnterpriseIdList',
  2405. item.entrustedEnterpriseIdList
  2406. );
  2407. this.$set(
  2408. parasm,
  2409. 'entrustedEnterpriseId',
  2410. item.entrustedEnterpriseId
  2411. );
  2412. }
  2413. this.$set(parasm, 'approvalNumber', item.extField?.approvalNumber);
  2414. this.$set(
  2415. parasm,
  2416. 'packingSpecification',
  2417. item.extField.packingSpecification
  2418. );
  2419. this.$set(
  2420. parasm,
  2421. 'packageDispositionList',
  2422. item.packageDispositionList
  2423. );
  2424. if (item.packageDispositionList?.length) {
  2425. this.$set(
  2426. parasm,
  2427. this.countObj.unitIdKey,
  2428. item.packageDispositionList[0].id
  2429. );
  2430. this.$set(
  2431. parasm,
  2432. this.countObj.unitKey,
  2433. item.packageDispositionList[0].conversionUnit
  2434. );
  2435. }
  2436. this.$set(parasm, 'customerMark', this.customerMark);
  2437. if (item.purchaseOrigins?.length > 0) {
  2438. item.purchaseOrigins = item.purchaseOrigins.map((val) => val + '');
  2439. }
  2440. this.$set(parasm, 'provenance', item.purchaseOrigins || []);
  2441. // 初始化生产加工特有字段及未税小记
  2442. // 当quoteType为2时,数量默认设置为1
  2443. if (this.quoteType === 2) {
  2444. this.processSetValue(parasm);
  2445. }
  2446. if (idx == -1) {
  2447. this.form.datasource.push(row);
  2448. }
  2449. });
  2450. },
  2451. remove(index) {
  2452. this.form.datasource.splice(index, 1);
  2453. this.setSort();
  2454. this.changeAll();
  2455. },
  2456. // 重新排序
  2457. setSort() {
  2458. this.form.datasource.forEach((n, index) => {
  2459. n.key = index + 1;
  2460. });
  2461. },
  2462. // 添加临时产品
  2463. handlAdd() {
  2464. let item = JSON.parse(JSON.stringify(this.defaultForm));
  2465. item.key = this.form.datasource.length + 1;
  2466. item.customerMark = this.customerMark;
  2467. item.customerExpectDeliveryDeadline = dayjs(new Date()).format(
  2468. 'YYYY-MM-DD'
  2469. );
  2470. // 初始化生产加工特有字段及未税小记
  2471. // 当quoteType为2时,数量默认设置为1
  2472. if (this.quoteType === 2) {
  2473. this.processSetValue(item);
  2474. }
  2475. this.form.datasource.push(item);
  2476. },
  2477. processSetValue(parasm) {
  2478. this.$set(parasm, this.countObj.countKey, 1);
  2479. this.$set(parasm, 'thickNess', '');
  2480. this.$set(parasm, 'squareNumber', '');
  2481. this.$set(parasm, 'processingFeeBeforeTax', '');
  2482. this.$set(parasm, 'packagingFeeNotTaxed', '');
  2483. this.$set(parasm, 'transportationFeeWithoutTax', '');
  2484. this.$set(parasm, 'extraTax', 13);
  2485. this.$set(parasm, 'quotationSubtotalBeforeTax', '0.00');
  2486. this.$set(parasm, 'quotationSubtotalTax', '');
  2487. },
  2488. validateForm(callback) {
  2489. this.$refs.form.validate((valid, obj) => {
  2490. if (obj) {
  2491. let messages = Object.keys(obj).map((key) => obj[key][0]);
  2492. if (messages.length > 0) {
  2493. this.$message.warning(messages[0].message);
  2494. }
  2495. }
  2496. callback(valid);
  2497. });
  2498. },
  2499. goodsPriceTypeChange(row, index) {
  2500. if (row.goodsId) {
  2501. getGoodsPriceByCondition({
  2502. id: row.goodsId,
  2503. priceType: row.goodsPriceType
  2504. }).then((res) => {
  2505. if (res.id) {
  2506. this.$set(this.form.datasource[index], 'goodsPriceId', res.id);
  2507. this.$set(
  2508. this.form.datasource[index],
  2509. 'goodsPriceType',
  2510. res.priceType
  2511. );
  2512. this.$set(
  2513. this.form.datasource[index],
  2514. 'singlePrice',
  2515. res.unitPrice
  2516. );
  2517. this.$set(
  2518. this.form.datasource[index],
  2519. 'notaxSinglePrice',
  2520. res.excludeTaxPrice
  2521. );
  2522. this.$set(this.form.datasource[index], 'taxRate', res.taxRate);
  2523. this.$set(
  2524. this.form.datasource[index],
  2525. 'discountSinglePrice',
  2526. res.unitPrice
  2527. );
  2528. }
  2529. this.changeCount(row, index);
  2530. });
  2531. }
  2532. },
  2533. save() {
  2534. this.$emit('save');
  2535. }
  2536. }
  2537. };
  2538. </script>
  2539. <style lang="scss" scoped>
  2540. .headbox {
  2541. display: flex;
  2542. justify-content: space-between;
  2543. align-items: center;
  2544. .amount {
  2545. font-size: 14px;
  2546. font-weight: bold;
  2547. padding-right: 30px;
  2548. }
  2549. }
  2550. .time-form .el-form-item {
  2551. margin-bottom: 0 !important;
  2552. }
  2553. ::v-deep .period {
  2554. display: flex;
  2555. .borderleftnone {
  2556. .el-input--medium .el-input__inner {
  2557. border-top-right-radius: 0;
  2558. border-bottom-right-radius: 0;
  2559. }
  2560. }
  2561. .borderrightnone {
  2562. .el-input--medium .el-input__inner {
  2563. border-top-left-radius: 0;
  2564. border-bottom-left-radius: 0;
  2565. }
  2566. }
  2567. }
  2568. ::v-deep .time-form tbody > tr:hover > td {
  2569. background-color: transparent !important;
  2570. }
  2571. ::v-deep .time-form .el-table tr {
  2572. background-color: #ffffff;
  2573. }
  2574. .pricebox {
  2575. display: flex;
  2576. justify-content: flex-start;
  2577. align-items: center;
  2578. font-weight: bold;
  2579. }
  2580. :deep(.el-input-group__append) {
  2581. padding: 0;
  2582. }
  2583. </style>