You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

401 lines
17 KiB

1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
  1. <script>
  2. import {queryQuoteDetailAllCost} from "../../../../../api/quote/quoteDetail";
  3. export default {
  4. name: "quoteDetailCost",
  5. props: {
  6. quoteDetail: {
  7. type: Object,
  8. required: true
  9. },
  10. },
  11. model: {
  12. prop: "quoteDetail",
  13. event: "update",
  14. },
  15. data(){
  16. return {
  17. computeLoading:false,
  18. rules:{
  19. adjustPartCost: [
  20. { required: true, message: "请输入材料标准成本", trigger: ["blur","change"] }
  21. ],
  22. adjustBomUnYield: [
  23. { required: true, message: "请输入材料实际成本", trigger: ["blur","change"] }
  24. ],
  25. adjustMachineCost: [
  26. { required: true, message: "请输入机器成本", trigger: ["blur","change"] }
  27. ],
  28. adjustFabricateCost: [
  29. { required: true, message: "请输入制造费用成本", trigger: ["blur","change"] }
  30. ],
  31. adjustLabourCost: [
  32. { required: true, message: "请输入人工成本", trigger: ["blur","change"] }
  33. ],
  34. adjustToolCost: [
  35. { required: true, message: "请输入工具成本", trigger: ["blur","change"] }
  36. ],
  37. manageCost: [
  38. { required: true, message: "请输入管理成本", trigger: ["blur","change"] }
  39. ],
  40. otherCost: [
  41. { required: true, message: "请输入其他成本", trigger: ["blur","change"] }
  42. ],
  43. profitRate: [
  44. { required: true, message: "请输入利润率", trigger: ["blur","change"] }
  45. ],
  46. taxRate: [
  47. { required: true, message: "请输入税率", trigger: ["blur","change"] }
  48. ],
  49. },
  50. }
  51. },
  52. methods:{
  53. computeTotalCost(){
  54. this.quoteDetail.totalCost =
  55. this.quoteDetail.adjustPartCost +
  56. this.quoteDetail.adjustBomUnYield +
  57. this.quoteDetail.adjustQuoteCost +
  58. this.quoteDetail.adjustMachineCost +
  59. this.quoteDetail.adjustFabricateCost +
  60. this.quoteDetail.adjustLabourCost +
  61. this.quoteDetail.adjustToolCost +
  62. this.quoteDetail.manageCost +
  63. this.quoteDetail.otherCost;
  64. this.computeProfitAmount();
  65. },
  66. computeProfitAmount(){
  67. this.quoteDetail.profitAmount =
  68. this.quoteDetail.totalCost * (this.quoteDetail.profitRate / 100);
  69. this.computeTaxCost();
  70. },
  71. computeTaxCost(){
  72. this.quoteDetail.totalPrice =
  73. this.quoteDetail.totalCost + this.quoteDetail.profitAmount;
  74. this.quoteDetail.unitPrice =
  75. this.quoteDetail.totalPrice / this.quoteDetail.qty;
  76. this.quoteDetail.taxTotalPrice =
  77. this.quoteDetail.totalPrice + this.quoteDetail.totalPrice * (this.quoteDetail.taxRate / 100);
  78. this.quoteDetail.taxUnitPrice =
  79. this.quoteDetail.taxTotalPrice / this.quoteDetail.qty;
  80. },
  81. handleQueryAllCost(){
  82. let params = {
  83. ...this.quoteDetail
  84. }
  85. this.computeLoading = true
  86. queryQuoteDetailAllCost(params).then(({data})=>{
  87. if (data && data.code === 0){
  88. this.quoteDetail.partCost = data.row.unitQuotePrice;
  89. this.quoteDetail.adjustPartCost = data.row.unitQuotePrice;
  90. this.quoteDetail.bomUnYield = data.row.actualQuotePrice;
  91. this.quoteDetail.adjustBomUnYield = data.row.actualQuotePrice;
  92. this.quoteDetail.quoteCost = data.row.quoteCost;
  93. this.quoteDetail.adjustQuoteCost = data.row.quoteCost;
  94. this.quoteDetail.labourCost = data.row.labourCost;
  95. this.quoteDetail.adjustLabourCost = data.row.labourCost;
  96. this.quoteDetail.machineCost = data.row.machineCost;
  97. this.quoteDetail.adjustMachineCost = data.row.machineCost;
  98. this.quoteDetail.fabricateCost = data.row.manufactureCost;
  99. this.quoteDetail.adjustFabricateCost = data.row.manufactureCost;
  100. this.quoteDetail.toolCost = data.row.toolCost;
  101. this.quoteDetail.adjustToolCost = data.row.toolCost;
  102. this.quoteDetail.packCost = data.row.packCost;
  103. this.quoteDetail.shippingCost = data.row.shippingCost;
  104. this.quoteDetail.otherCost = data.row.otherCost;
  105. }else {
  106. this.$message.warning(data.msg);
  107. }
  108. this.computeLoading = false
  109. }).catch((error)=>{
  110. this.$message.error(error);
  111. this.computeLoading = false
  112. })
  113. }
  114. },
  115. watch:{
  116. 'quoteDetail.adjustPartCost'(newValue, oldValue){
  117. if (newValue === undefined || newValue === null){
  118. this.quoteDetail.adjustPartCost = 0;
  119. }
  120. this.computeTotalCost();
  121. },
  122. 'quoteDetail.adjustBomUnYield'(newValue, oldValue){
  123. if (newValue === undefined || newValue === null){
  124. this.quoteDetail.adjustPartCost = 0;
  125. }
  126. this.computeTotalCost();
  127. },
  128. 'quoteDetail.adjustQuoteCost'(newValue, oldValue){
  129. if (newValue === undefined || newValue === null){
  130. this.quoteDetail.adjustQuoteCost = 0;
  131. }
  132. this.computeTotalCost();
  133. },
  134. 'quoteDetail.adjustMachineCost'(newValue, oldValue){
  135. if (newValue === undefined || newValue === null){
  136. this.quoteDetail.adjustMachineCost = 0;
  137. }
  138. this.computeTotalCost();
  139. },
  140. 'quoteDetail.adjustFabricateCost'(newValue, oldValue){
  141. if (newValue === undefined || newValue === null){
  142. this.quoteDetail.adjustFabricateCost = 0;
  143. }
  144. this.computeTotalCost();
  145. },
  146. 'quoteDetail.adjustLabourCost'(newValue, oldValue){
  147. if (newValue === undefined || newValue === null){
  148. this.quoteDetail.adjustLabourCost = 0;
  149. }
  150. this.computeTotalCost();
  151. },
  152. 'quoteDetail.adjustToolCost'(newValue, oldValue){
  153. if (newValue === undefined || newValue === null){
  154. this.quoteDetail.adjustToolCost = 0;
  155. }
  156. this.computeTotalCost();
  157. },
  158. 'quoteDetail.manageCost'(newValue, oldValue){
  159. if (newValue === undefined || newValue === null){
  160. this.quoteDetail.manageCost = 0;
  161. }
  162. this.computeTotalCost();
  163. },
  164. 'quoteDetail.otherCost'(newValue, oldValue){
  165. if (newValue === undefined || newValue === null){
  166. this.quoteDetail.otherCost = 0;
  167. }
  168. this.computeTotalCost();
  169. },
  170. 'quoteDetail.profitRate'(newValue, oldValue){
  171. if (newValue === undefined || newValue === null){
  172. this.quoteDetail.profitRate = 0;
  173. }
  174. this.computeProfitAmount();
  175. },
  176. 'quoteDetail.taxRate'(newValue, oldValue){
  177. if (newValue === undefined || newValue === null){
  178. this.quoteDetail.taxRate = 0;
  179. }
  180. this.computeTaxCost();
  181. },
  182. }
  183. }
  184. </script>
  185. <template>
  186. <div>
  187. <el-button :loading="computeLoading" type="primary" :disabled="quoteDetail.status === '下达'" @click="handleQueryAllCost"> </el-button>
  188. <!--系统自动计算结果-->
  189. <el-form :model="quoteDetail" ref="costForm" :rules="rules" label-position="top" label-width="120px">
  190. <fieldset
  191. style="height:80px;margin-top: 2px;">
  192. <legend>系统自动计算结果(料工费/工具)</legend>
  193. <el-row :gutter="10" type="flex">
  194. <el-col :span="4">
  195. <el-form-item label="材料标准成本:" prop="partCost" :show-message="false">
  196. <el-input-number style="width: 100%; " :controls="false"
  197. v-model="quoteDetail.partCost" :precision="4" disabled/>
  198. </el-form-item>
  199. </el-col>
  200. <el-col :span="4">
  201. <el-form-item label="材料实际成本:" prop="bomUnYield" :show-message="false">
  202. <el-input-number style="width: 100%; " :controls="false"
  203. v-model="quoteDetail.bomUnYield" :precision="4" disabled/>
  204. </el-form-item>
  205. </el-col>
  206. <el-col :span="4">
  207. <el-form-item label="材料报价成本:" prop="bomUnYield" :show-message="false">
  208. <el-input-number style="width: 100%;" :controls="false"
  209. v-model="quoteDetail.quoteCost" :precision="4" disabled/>
  210. </el-form-item>
  211. </el-col>
  212. <el-col :span="4">
  213. <el-form-item label="机器成本:" prop="machineCost" :show-message="false">
  214. <el-input-number style="width: 100%; " :controls="false"
  215. v-model="quoteDetail.machineCost" :precision="4" disabled/>
  216. </el-form-item>
  217. </el-col>
  218. <el-col :span="4">
  219. <el-form-item label="制造费用成本:" prop="fabricateCost" :show-message="false">
  220. <el-input-number style="width: 100%; " :controls="false"
  221. v-model="quoteDetail.fabricateCost" :precision="4" disabled/>
  222. </el-form-item>
  223. </el-col>
  224. <el-col :span="4">
  225. <el-form-item label="人工成本:" prop="labourCost" :show-message="false">
  226. <el-input-number style="width: 100%;" :controls="false"
  227. v-model="quoteDetail.labourCost" :precision="4" disabled/>
  228. </el-form-item>
  229. </el-col>
  230. <el-col :span="4">
  231. <el-form-item label="工具成本:" prop="toolCost" :show-message="false">
  232. <el-input-number style="width: 100%;" :controls="false"
  233. v-model="quoteDetail.toolCost" :precision="4" disabled/>
  234. </el-form-item>
  235. </el-col>
  236. </el-row>
  237. </fieldset>
  238. <fieldset
  239. style="height:80px;margin-top: 5px;">
  240. <legend>调整后成本(料工费/工具)</legend>
  241. <el-row :gutter="10" type="flex">
  242. <el-col :span="4">
  243. <el-form-item label="材料标准成本:" prop="adjustPartCost" :show-message="false">
  244. <el-input-number style="width: 100%;" :controls="false"
  245. v-model="quoteDetail.adjustPartCost" :disabled="quoteDetail.status === '下达'" :step="0" :precision="4" :min="0"/>
  246. </el-form-item>
  247. </el-col>
  248. <el-col :span="4">
  249. <el-form-item label="材料实际成本:" prop="adjustBomUnYield" :show-message="false">
  250. <el-input-number style="width: 100%;" :controls="false"
  251. v-model="quoteDetail.adjustBomUnYield" :disabled="quoteDetail.status === '下达'" :step="0" :precision="4" :min="0"/>
  252. </el-form-item>
  253. </el-col>
  254. <el-col :span="4">
  255. <el-form-item label="材料报价成本:" prop="adjustBomUnYield" :show-message="false">
  256. <el-input-number style="width: 100%;" :controls="false"
  257. v-model="quoteDetail.adjustQuoteCost" :disabled="quoteDetail.status === '下达'" :step="0" :precision="4" :min="0"/>
  258. </el-form-item>
  259. </el-col>
  260. <el-col :span="4">
  261. <el-form-item label="机器成本:" prop="adjustMachineCost" :show-message="false">
  262. <el-input-number style="width: 100%;" :controls="false"
  263. v-model="quoteDetail.adjustMachineCost" :disabled="quoteDetail.status === '下达'" :step="0" :precision="4" :min="0"/>
  264. </el-form-item>
  265. </el-col>
  266. <el-col :span="4">
  267. <el-form-item label="制造费用成本:" prop="adjustFabricateCost" :show-message="false">
  268. <el-input-number style="width: 100%;" :controls="false"
  269. v-model="quoteDetail.adjustFabricateCost" :disabled="quoteDetail.status === '下达'" :step="0" :precision="4" :min="0"/>
  270. </el-form-item>
  271. </el-col>
  272. <el-col :span="4">
  273. <el-form-item label="人工成本:" prop="adjustLabourCost" :show-message="false">
  274. <el-input-number style="width: 100%;" :controls="false"
  275. v-model="quoteDetail.adjustLabourCost" :disabled="quoteDetail.status === '下达'" :step="0" :precision="4" :min="0"/>
  276. </el-form-item>
  277. </el-col>
  278. <el-col :span="4">
  279. <el-form-item label="工具成本:" prop="adjustToolCost" :show-message="false">
  280. <el-input-number style="width: 100%;" :controls="false"
  281. v-model="quoteDetail.adjustToolCost" :disabled="quoteDetail.status === '下达'" :step="0" :precision="4" :min="0"/>
  282. </el-form-item>
  283. </el-col>
  284. </el-row>
  285. </fieldset>
  286. <fieldset
  287. style="height:80px;margin-top: 5px;">
  288. <legend>其他成本</legend>
  289. <el-row :gutter="10" type="flex">
  290. <el-col :span="4">
  291. <el-form-item label="管理成本:" prop="manageCost" :show-message="false">
  292. <el-input-number style="width: 100%;" :controls="false"
  293. v-model="quoteDetail.manageCost" :disabled="quoteDetail.status === '下达'" :step="0" :precision="4" :min="0"/>
  294. </el-form-item>
  295. </el-col>
  296. <el-col :span="4">
  297. <el-form-item label="包装成本:">
  298. <el-input-number style="width: 100%;" :controls="false"
  299. v-model="quoteDetail.packCost" :step="0" :precision="4" :min="0" disabled/>
  300. </el-form-item>
  301. </el-col>
  302. <el-col :span="4">
  303. <el-form-item label="运输成本:">
  304. <el-input-number style="width: 100%; " :controls="false"
  305. v-model="quoteDetail.shippingCost" :step="0" :precision="4" :min="0" disabled/>
  306. </el-form-item>
  307. </el-col>
  308. <el-col :span="4">
  309. <el-form-item label="其他成本:" prop="otherCost" :show-message="false">
  310. <el-input-number style="width: 100%; " :controls="false"
  311. v-model="quoteDetail.otherCost" :disabled="quoteDetail.status === '下达'" :step="0" :precision="4" :min="0"/>
  312. </el-form-item>
  313. </el-col>
  314. <el-col :span="4">
  315. <el-form-item label="总成本:" prop="totalCost" :show-message="false">
  316. <el-input-number style="width: 100%;" :controls="false"
  317. v-model="quoteDetail.totalCost" :step="0" :precision="4" :min="0" disabled/>
  318. </el-form-item>
  319. </el-col>
  320. <el-col :span="4">
  321. </el-col>
  322. <el-col :span="4">
  323. </el-col>
  324. </el-row>
  325. </fieldset>
  326. <fieldset style="height:80px;margin-top: 5px;">
  327. <legend>利润</legend>
  328. <el-row :gutter="10" type="flex">
  329. <el-col :span="4">
  330. <el-form-item label="利润率%:" prop="profitRate" :show-message="false">
  331. <el-input-number style="width: 100%;" :controls="false"
  332. v-model="quoteDetail.profitRate" :disabled="quoteDetail.status === '下达'" :step="0" :min="0"/>
  333. </el-form-item>
  334. </el-col>
  335. <el-col :span="4">
  336. <el-form-item label="利润额:" prop="profitAmount" :show-message="false">
  337. <el-input-number style="width: 100%;" :controls="false"
  338. v-model="quoteDetail.profitAmount" :step="0" :precision="4" :min="0" disabled/>
  339. </el-form-item>
  340. </el-col>
  341. <el-col :span="4">
  342. </el-col>
  343. <el-col :span="4">
  344. </el-col>
  345. <el-col :span="4">
  346. </el-col>
  347. <el-col :span="4">
  348. </el-col>
  349. <el-col :span="4">
  350. </el-col>
  351. </el-row>
  352. </fieldset>
  353. <fieldset style="height:80px;margin-top: 5px;">
  354. <legend>最终价格</legend>
  355. <el-row :gutter="10" type="flex">
  356. <el-col :span="4">
  357. <el-form-item label="未税总额:" prop="totalPrice" :show-message="false">
  358. <el-input-number style="width: 100%;" :controls="false"
  359. v-model="quoteDetail.totalPrice" :step="0" :precision="4" :min="0" disabled/>
  360. </el-form-item>
  361. </el-col>
  362. <el-col :span="4">
  363. <el-form-item label="未税单价:" prop="unitPrice" :show-message="false">
  364. <el-input-number style="width: 100%;" :controls="false"
  365. v-model="quoteDetail.unitPrice" :step="0" :min="0" :precision="6" disabled/>
  366. </el-form-item>
  367. </el-col>
  368. <el-col :span="4">
  369. <el-form-item label="税率%:" prop="taxRate" :show-message="false">
  370. <el-input-number style="width: 100%;" :controls="false"
  371. v-model="quoteDetail.taxRate" :disabled="quoteDetail.status === '下达'" :step="0" :min="0"/>
  372. </el-form-item>
  373. </el-col>
  374. <el-col :span="4">
  375. <el-form-item label="含税总额:" prop="taxTotalPrice" :show-message="false">
  376. <el-input-number style="width: 100%;" :controls="false"
  377. v-model="quoteDetail.taxTotalPrice" :step="0" :precision="4" :min="0" disabled/>
  378. </el-form-item>
  379. </el-col>
  380. <el-col :span="4">
  381. <el-form-item label="含税单价:" prop="taxUnitPrice" :show-message="false">
  382. <el-input-number style="width: 100%;" :controls="false"
  383. v-model="quoteDetail.taxUnitPrice" :step="0" :precision="6" :min="0" disabled/>
  384. </el-form-item>
  385. </el-col>
  386. <el-col :span="4">
  387. </el-col>
  388. <el-col :span="4">
  389. </el-col>
  390. </el-row>
  391. </fieldset>
  392. </el-form>
  393. </div>
  394. </template>
  395. <style scoped>
  396. </style>