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.

766 lines
30 KiB

2 weeks ago
2 weeks ago
2 weeks ago
2 weeks ago
2 weeks ago
2 weeks ago
2 weeks ago
2 weeks ago
2 weeks ago
3 months ago
2 weeks ago
2 weeks ago
2 weeks ago
2 weeks ago
2 weeks ago
2 weeks ago
2 weeks ago
2 weeks ago
2 weeks ago
2 weeks ago
2 weeks ago
2 weeks ago
2 weeks ago
2 weeks ago
2 weeks ago
2 weeks ago
2 weeks ago
  1. <!-- 询价单报价 -->
  2. <template>
  3. <div class="customer-css">
  4. <!-- 查询条件 -->
  5. <el-form :inline="true" label-position="top" label-width="100px" style="margin-top: 0px;">
  6. <el-row>
  7. <el-col :span="24">
  8. <el-form-item label="询价单号:">
  9. <el-input v-model="searchData.orderNo" style="width: 150px" clearable></el-input>
  10. </el-form-item>
  11. <el-form-item :label="'询价时间'">
  12. <el-date-picker
  13. style="width: 130px"
  14. v-model="searchData.startDate"
  15. type="date"
  16. format="yyyy-MM-dd"
  17. value-format="yyyy-MM-dd"
  18. placeholder="Start">
  19. </el-date-picker>
  20. </el-form-item>
  21. <el-form-item :label="'To'">
  22. <el-date-picker
  23. style="width: 130px"
  24. v-model="searchData.endDate"
  25. type="date"
  26. format="yyyy-MM-dd"
  27. value-format="yyyy-MM-dd"
  28. placeholder="End">
  29. </el-date-picker>
  30. </el-form-item>
  31. <el-form-item label="状态:">
  32. <el-select v-model="searchData.status" placeholder="请选择" clearable style="width: 120px">
  33. <el-option label="全部" value=""></el-option>
  34. <el-option label="待报价" value="待报价"></el-option>
  35. <el-option label="已报价" value="已报价"></el-option>
  36. <el-option label="已接受" value="已接受"></el-option>
  37. <el-option label="未接受" value="未接受"></el-option>
  38. <el-option label="已拒绝" value="已拒绝"></el-option>
  39. </el-select>
  40. </el-form-item>
  41. <el-form-item label=" ">
  42. <el-button class="customer-bun-min" type="primary" @click="getMainData">查询</el-button>
  43. <el-button @click="resetSearch" style="margin-left: 2px">重置</el-button>
  44. </el-form-item>
  45. </el-col>
  46. </el-row>
  47. </el-form>
  48. <!-- 询价列表 -->
  49. <el-table
  50. :height="height"
  51. :data="mainDataList"
  52. border
  53. ref="mainTable"
  54. highlight-current-row
  55. @row-click="changeData"
  56. v-loading="dataListLoading"
  57. style="margin-top: 0px; width: 100%;">
  58. <el-table-column
  59. v-for="(item, index) in columnArray1"
  60. :key="index"
  61. :sortable="item.columnSortable"
  62. :prop="item.columnProp"
  63. :header-align="item.headerAlign"
  64. :show-overflow-tooltip="item.showOverflowTooltip"
  65. :align="item.align"
  66. :fixed="item.fixed"
  67. :min-width="item.columnWidth"
  68. :label="item.columnLabel">
  69. <template slot-scope="scope">
  70. <span v-if="!item.columnHidden">{{ scope.row[item.columnProp] }}</span>
  71. </template>
  72. </el-table-column>
  73. <!-- 操作列 -->
  74. <el-table-column
  75. fixed="right"
  76. header-align="center"
  77. align="center"
  78. width="180"
  79. label="Action">
  80. <template slot-scope="scope">
  81. <el-link
  82. v-if="scope.row.status === '待报价'||scope.row.status === '未接受'"
  83. style="cursor: pointer"
  84. @click="openQuoteDialog(scope.row)">
  85. 报价
  86. </el-link>
  87. <!-- <el-link style="cursor: pointer" @click="openQuoteDialog(scope.row)">报价</el-link> -->
  88. </template>
  89. </el-table-column>
  90. </el-table>
  91. <!-- 分页 -->
  92. <el-pagination
  93. style="margin-top: 0px"
  94. @size-change="sizeChangeHandle"
  95. @current-change="currentChangeHandle"
  96. :current-page="pageIndex"
  97. :page-sizes="[20, 50, 100, 200]"
  98. :page-size="pageSize"
  99. :total="totalPage"
  100. layout="total, sizes, prev, pager, next, jumper">
  101. </el-pagination>
  102. <!-- 标签页 -->
  103. <el-tabs v-model="activeName" style="margin-top: 0px; width: 99%;" @tab-click="tabClick" class="customer-tab" type="border-card">
  104. <el-tab-pane label="报价记录" name="quotationList">
  105. <quotationList ref="quotationList" :height="tabHeight"></quotationList>
  106. </el-tab-pane>
  107. <el-tab-pane label="附件" name="attachments">
  108. <attachments ref="attachments" :height="tabHeight"></attachments>
  109. </el-tab-pane>
  110. </el-tabs>
  111. <!-- 报价信息新增弹出框 -->
  112. <el-dialog
  113. title="报价信息"
  114. :visible.sync="quoteDialogVisible"
  115. width="600px"
  116. top="3vh"
  117. :close-on-click-modal="false"
  118. class="part-dialog">
  119. <div class="dialog-content">
  120. <el-form
  121. :model="quoteForm"
  122. :rules="quoteRules"
  123. ref="quoteForm"
  124. label-position="top"
  125. class="part-form">
  126. <!-- 基础信息 -->
  127. <div class="form-section">
  128. <el-row :gutter="20">
  129. <el-col :span="6">
  130. <el-form-item label="物料编码" prop="partNo">
  131. <el-input v-model="quoteForm.partNo" :disabled="true" placeholder="物料编码"></el-input>
  132. </el-form-item>
  133. </el-col>
  134. <el-col :span="18">
  135. <el-form-item label="物料名称" prop="partDesc">
  136. <el-input v-model="quoteForm.partDesc" :disabled="true" placeholder="物料名称"></el-input>
  137. </el-form-item>
  138. </el-col>
  139. </el-row>
  140. <el-row :gutter="20">
  141. <el-col :span="18">
  142. <el-form-item label="规格型号" prop="spec">
  143. <el-input v-model="quoteForm.spec" :disabled="true" placeholder="规格型号"></el-input>
  144. </el-form-item>
  145. </el-col>
  146. <el-col :span="6">
  147. <el-form-item label="询价数量" prop="qty">
  148. <el-input-number v-model="quoteForm.qty" :disabled="true" :min="0" style="width: 100%"></el-input-number>
  149. </el-form-item>
  150. </el-col>
  151. </el-row>
  152. <el-row :gutter="20">
  153. <el-col :span="18">
  154. <el-form-item label="其他要求" prop="otherCondition">
  155. <el-input v-model="quoteForm.otherCondition" type="text" :disabled="true" :rows="1" placeholder="其他要求"></el-input>
  156. </el-form-item>
  157. </el-col>
  158. <el-col :span="6">
  159. <el-form-item label="计量单位" prop="umid">
  160. <el-input v-model="quoteForm.umid" :disabled="true" placeholder="计量单位"></el-input>
  161. </el-form-item>
  162. </el-col>
  163. </el-row>
  164. </div>
  165. <!-- 费用信息 -->
  166. <div class="form-section">
  167. <el-row :gutter="20">
  168. <el-col :span="6">
  169. <el-form-item label="材料费用" prop="materialCost">
  170. <el-input-number v-model="quoteForm.materialCost" @change="calculatePrice" :precision="2" :min="0" style="width: 100%"></el-input-number>
  171. </el-form-item>
  172. </el-col>
  173. <el-col :span="6">
  174. <el-form-item label="加工费" prop="produceFee">
  175. <el-input-number v-model="quoteForm.produceFee" @change="calculatePrice" :precision="2" :min="0" style="width: 100%"></el-input-number>
  176. </el-form-item>
  177. </el-col>
  178. <el-col :span="6">
  179. <el-form-item label="表面处理费" prop="surfaceFee">
  180. <el-input-number v-model="quoteForm.surfaceFee" @change="calculatePrice" :precision="2" :min="0" style="width: 100%"></el-input-number>
  181. </el-form-item>
  182. </el-col>
  183. <el-col :span="6">
  184. <el-form-item label="利润" prop="profit">
  185. <el-input-number v-model="quoteForm.profit" @change="calculatePrice" :precision="2" :min="0" style="width: 100%"></el-input-number>
  186. </el-form-item>
  187. </el-col>
  188. </el-row>
  189. <!-- 价格信息 -->
  190. <div class="form-section">
  191. <el-row :gutter="20">
  192. <el-col :span="6">
  193. <el-form-item label="未税单价" prop="price">
  194. <el-input-number v-model="quoteForm.price" :disabled="true" :precision="4" :min="0" style="width: 100%" @change="calculateTax"></el-input-number>
  195. </el-form-item>
  196. </el-col>
  197. <el-col :span="6">
  198. <el-form-item label="税率(%)" prop="taxRate">
  199. <el-input-number v-model="quoteForm.taxRate" :disabled="true" :precision="2" :min="0" :max="100" style="width: 100%" @change="calculateTax"></el-input-number>
  200. </el-form-item>
  201. </el-col>
  202. <el-col :span="6">
  203. <el-form-item label="含税单价" prop="tax">
  204. <el-input-number v-model="quoteForm.tax" :disabled="true" :precision="4" :min="0" style="width: 100%"></el-input-number>
  205. </el-form-item>
  206. </el-col>
  207. <el-col :span="6">
  208. <el-form-item label="关税" prop="duty">
  209. <el-input-number v-model="quoteForm.duty" :precision="2" :min="0" style="width: 100%"></el-input-number>
  210. </el-form-item>
  211. </el-col>
  212. </el-row>
  213. </div>
  214. <el-row :gutter="20">
  215. <el-col :span="6">
  216. <el-form-item label="采购周期(天)" prop="purchaseCycle">
  217. <el-input-number v-model="quoteForm.purchaseCycle" :min="0" :precision="0" style="width: 100%"></el-input-number>
  218. </el-form-item>
  219. </el-col>
  220. <el-col :span="6">
  221. <el-form-item label="模具费" prop="mouldFee">
  222. <el-input-number v-model="quoteForm.mouldFee" :precision="2" :min="0" style="width: 100%"></el-input-number>
  223. </el-form-item>
  224. </el-col>
  225. <el-col :span="6">
  226. <el-form-item label="附加费用" prop="additionalCost">
  227. <el-input-number v-model="quoteForm.additionalCost" :precision="2" :min="0" style="width: 100%"></el-input-number>
  228. </el-form-item>
  229. </el-col>
  230. <el-col :span="6">
  231. <el-form-item label="运费" prop="freight">
  232. <el-input-number v-model="quoteForm.freight" :precision="2" :min="0" style="width: 100%"></el-input-number>
  233. </el-form-item>
  234. </el-col>
  235. </el-row>
  236. </div>
  237. <!-- 其他信息 -->
  238. <div class="form-section">
  239. <el-row :gutter="20">
  240. <el-col :span="24">
  241. <el-form-item label="特殊要求" prop="remark2">
  242. <el-input v-model="quoteForm.remark2" type="textarea" :disabled="true" :rows="1" placeholder="请输入特殊要求"></el-input>
  243. </el-form-item>
  244. </el-col>
  245. </el-row>
  246. <el-row :gutter="20">
  247. <el-col :span="24">
  248. <el-form-item label="备注" prop="remark">
  249. <el-input v-model="quoteForm.remark" type="textarea" :rows="1" placeholder="请输入备注"></el-input>
  250. </el-form-item>
  251. </el-col>
  252. </el-row>
  253. </div>
  254. </el-form>
  255. </div>
  256. <div slot="footer" class="dialog-footer" style="margin-top: 20px; text-align: center;">
  257. <el-button type="primary" @click="submitQuote">提交报价</el-button>
  258. <el-button @click="cancelQuote">取消</el-button>
  259. </div>
  260. </el-dialog>
  261. </div>
  262. </template>
  263. <script>
  264. import {
  265. getQuoPurDetailPage
  266. } from '@/api/supplier/purQuotation.js'
  267. import {
  268. createPurReplyHist
  269. } from '@/api/supplier/purReplyHist.js'
  270. import quotationList from './com_inquiry_QuotationList'
  271. import attachments from './com_inquiry_Attachments'
  272. export default {
  273. name: 'InquiryQuery',
  274. components: {
  275. quotationList,
  276. attachments
  277. },
  278. data() {
  279. return {
  280. height: 200,
  281. tabHeight: 300,
  282. dataListLoading: false,
  283. mainDataList: [],
  284. pageIndex: 1,
  285. pageSize: 20,
  286. totalPage: 0,
  287. activeName: 'quotationList',
  288. currentRow: {},
  289. searchData: {
  290. orderNo: '',
  291. partNo: '',
  292. supplierId: '',
  293. supplierName: '',
  294. status: '待报价',
  295. startDate: '',
  296. endDate: '',
  297. site: this.$store.state.user.site,
  298. page: 1,
  299. limit: 20
  300. },
  301. // 表格列配置
  302. columnArray1: [
  303. { columnProp: 'status', columnLabel: '状态', columnWidth: '80', headerAlign: 'center', align: 'center', fixed: false, columnHidden: false, columnSortable: false, showOverflowTooltip: true },
  304. { columnProp: 'orderNo', columnLabel: '询价单号', columnWidth: '120', headerAlign: 'center', align: 'center', fixed: false, columnHidden: false, columnSortable: false, showOverflowTooltip: true },
  305. { columnProp: 'orderDate', columnLabel: '询价日期', columnWidth: '100', headerAlign: 'center', align: 'center', fixed: false, columnHidden: false, columnSortable: false, showOverflowTooltip: true },
  306. { columnProp: 'wantReplyDate', columnLabel: '要求报价日期', columnWidth: '100', headerAlign: 'center', align: 'center', fixed: false, columnHidden: false, columnSortable: false, showOverflowTooltip: true },
  307. { columnProp: 'itemNo', columnLabel: '序号', columnWidth: '60', headerAlign: 'center', align: 'center', fixed: false, columnHidden: false, columnSortable: false, showOverflowTooltip: true },
  308. { columnProp: 'partNo', columnLabel: '物料编码', columnWidth: '120', headerAlign: 'center', align: 'center', fixed: false, columnHidden: false, columnSortable: false, showOverflowTooltip: true },
  309. { columnProp: 'partDesc', columnLabel: '物料名称', columnWidth: '150', headerAlign: 'center', align: 'left', fixed: false, columnHidden: false, columnSortable: false, showOverflowTooltip: true },
  310. { columnProp: 'umid', columnLabel: '计量单位', columnWidth: '80', headerAlign: 'center', align: 'center', fixed: false, columnHidden: false, columnSortable: false, showOverflowTooltip: true },
  311. { columnProp: 'spec', columnLabel: '规格型号', columnWidth: '150', headerAlign: 'center', align: 'left', fixed: false, columnHidden: false, columnSortable: false, showOverflowTooltip: true },
  312. { columnProp: 'qty', columnLabel: '询价数量', columnWidth: '100', headerAlign: 'center', align: 'right', fixed: false, columnHidden: false, columnSortable: false, showOverflowTooltip: true },
  313. { columnProp: 'remark2', columnLabel: '特殊要求', columnWidth: '80', headerAlign: 'center', align: 'center', fixed: false, columnHidden: false, columnSortable: false, showOverflowTooltip: true },
  314. { columnProp: 'buyer', columnLabel: '采购员', columnWidth: '120', headerAlign: 'center', align: 'center', fixed: false, columnHidden: false, columnSortable: false, showOverflowTooltip: true },
  315. { columnProp: 'paymentTerm', columnLabel: '付款方式', columnWidth: '80', headerAlign: 'center', align: 'center', fixed: false, columnHidden: false, columnSortable: false, showOverflowTooltip: true },
  316. { columnProp: 'deliveryTerm', columnLabel: '交易条款', columnWidth: '120', headerAlign: 'center', align: 'center', fixed: false, columnHidden: false, columnSortable: false, showOverflowTooltip: true },
  317. { columnProp: 'otherCondition', columnLabel: '其他要求', columnWidth: '120', headerAlign: 'center', align: 'center', fixed: false, columnHidden: false, columnSortable: false, showOverflowTooltip: true },
  318. { columnProp: 'materialCost', columnLabel: '材料费用', columnWidth: '100', headerAlign: 'center', align: 'right', fixed: false, columnHidden: false, columnSortable: false, showOverflowTooltip: true },
  319. { columnProp: 'produceFee', columnLabel: '加工费', columnWidth: '100', headerAlign: 'center', align: 'right', fixed: false, columnHidden: false, columnSortable: false, showOverflowTooltip: true },
  320. { columnProp: 'surfaceFee', columnLabel: '表面处理费', columnWidth: '100', headerAlign: 'center', align: 'right', fixed: false, columnHidden: false, columnSortable: false, showOverflowTooltip: true },
  321. { columnProp: 'profit', columnLabel: '利润', columnWidth: '100', headerAlign: 'center', align: 'right', fixed: false, columnHidden: false, columnSortable: false, showOverflowTooltip: true },
  322. { columnProp: 'price', columnLabel: '未税单价', columnWidth: '100', headerAlign: 'center', align: 'right', fixed: false, columnHidden: false, columnSortable: false, showOverflowTooltip: true },
  323. { columnProp: 'taxRate', columnLabel: '税率(%)', columnWidth: '80', headerAlign: 'center', align: 'right', fixed: false, columnHidden: false, columnSortable: false, showOverflowTooltip: true },
  324. { columnProp: 'tax', columnLabel: '含税单价', columnWidth: '100', headerAlign: 'center', align: 'right', fixed: false, columnHidden: false, columnSortable: false, showOverflowTooltip: true },
  325. { columnProp: 'duty', columnLabel: '关税', columnWidth: '80', headerAlign: 'center', align: 'right', fixed: false, columnHidden: false, columnSortable: false, showOverflowTooltip: true },
  326. { columnProp: 'purchaseCycle', columnLabel: '采购周期', columnWidth: '90', headerAlign: 'center', align: 'center', fixed: false, columnHidden: false, columnSortable: false, showOverflowTooltip: true },
  327. { columnProp: 'mouldFee', columnLabel: '模具费', columnWidth: '100', headerAlign: 'center', align: 'right', fixed: false, columnHidden: false, columnSortable: false, showOverflowTooltip: true },
  328. { columnProp: 'additionalCost', columnLabel: '附加费用', columnWidth: '100', headerAlign: 'center', align: 'right', fixed: false, columnHidden: false, columnSortable: false, showOverflowTooltip: true },
  329. { columnProp: 'freight', columnLabel: '运费', columnWidth: '100', headerAlign: 'center', align: 'right', fixed: false, columnHidden: false, columnSortable: false, showOverflowTooltip: true },
  330. { columnProp: 'remark', columnLabel: '备注', columnWidth: '150', headerAlign: 'center', align: 'left', fixed: false, columnHidden: false, columnSortable: false, showOverflowTooltip: true },
  331. { columnProp: 'supplierId', columnLabel: '供应商编码', columnWidth: '120', headerAlign: 'center', align: 'center', fixed: false, columnHidden: false, columnSortable: false, showOverflowTooltip: true },
  332. { columnProp: 'supplierName', columnLabel: '供应商名称', columnWidth: '150', headerAlign: 'center', align: 'left', fixed: false, columnHidden: false, columnSortable: false, showOverflowTooltip: true }
  333. ],
  334. // 报价对话框相关
  335. quoteDialogVisible: false,
  336. quoteForm: {
  337. // 基础信息
  338. partNo: '',
  339. partDesc: '',
  340. spec: '',
  341. qty: 0,
  342. umid: '',
  343. otherCondition: '',
  344. // 费用信息
  345. materialCost: 0,
  346. produceFee: 0,
  347. surfaceFee: 0,
  348. profit: 0,
  349. mouldFee: 0,
  350. additionalCost: 0,
  351. freight: 0,
  352. purchaseCycle: 0,
  353. duty: 0,
  354. // 价格信息
  355. price: 0,
  356. taxRate: 13,
  357. tax: 0,
  358. // 其他信息
  359. remark2: '',
  360. remark: '',
  361. // 关联信息
  362. orderNo: '',
  363. itemNo: '',
  364. supplierId: '',
  365. supplierName: '',
  366. site: this.$store.state.user.site,
  367. createdBy: this.$store.state.user.name
  368. },
  369. quoteRules: {
  370. price: [
  371. { required: true, message: '请输入未税单价', trigger: 'blur' },
  372. {
  373. validator: (rule, value, callback) => {
  374. if (value == null || Number(value) <= 0) {
  375. callback(new Error('未税单价必须大于0'))
  376. } else {
  377. callback()
  378. }
  379. },
  380. trigger: 'blur'
  381. }
  382. ],
  383. taxRate: [{ required: true, message: '请输入税率', trigger: 'blur' }]
  384. },
  385. // 上次填写的报价信息(用于残留功能)
  386. lastQuoteData: null
  387. }
  388. },
  389. created() {
  390. this.getMainData()
  391. },
  392. mounted() {
  393. this.$nextTick(() => {
  394. this.height = (window.innerHeight - 280) / 2
  395. this.tabHeight = this.height - 50
  396. })
  397. window.addEventListener('resize', this.handleResize)
  398. },
  399. beforeDestroy() {
  400. window.removeEventListener('resize', this.handleResize)
  401. },
  402. methods: {
  403. handleResize() {
  404. this.height = (window.innerHeight - 280) / 2
  405. this.tabHeight = this.height - 50
  406. this.refreshCurrentTabTable()
  407. },
  408. resetSearch() {
  409. this.searchData = {
  410. orderNo: '',
  411. partNo: '',
  412. supplierId: '',
  413. supplierName: '',
  414. status: '待报价',
  415. startDate: '',
  416. endDate: '',
  417. site: this.$store.state.user.site,
  418. page: 1,
  419. limit: this.pageSize
  420. }
  421. this.getMainData()
  422. },
  423. getMainData() {
  424. this.dataListLoading = true
  425. this.searchData.limit = this.pageSize
  426. this.searchData.page = this.pageIndex
  427. getQuoPurDetailPage(this.searchData).then(({ data }) => {
  428. if (data.code === 0) {
  429. this.mainDataList = data.page.list
  430. this.pageIndex = data.page.currPage
  431. this.pageSize = data.page.pageSize
  432. this.totalPage = data.page.totalCount
  433. if (this.mainDataList.length > 0) {
  434. this.$refs.mainTable.setCurrentRow(this.mainDataList[0])
  435. this.changeData(this.mainDataList[0])
  436. } else {
  437. this.changeData(null)
  438. }
  439. }
  440. this.dataListLoading = false
  441. }).catch(() => {
  442. this.dataListLoading = false
  443. })
  444. },
  445. sizeChangeHandle(val) {
  446. this.pageSize = val
  447. this.pageIndex = 1
  448. this.getMainData()
  449. },
  450. currentChangeHandle(val) {
  451. this.pageIndex = val
  452. this.getMainData()
  453. },
  454. changeData(row) {
  455. this.currentRow = row ? JSON.parse(JSON.stringify(row)) : { site: '', orderNo: '', itemNo: '' }
  456. this.refreshCurrentTabTable()
  457. },
  458. tabClick() {
  459. this.refreshCurrentTabTable()
  460. },
  461. refreshCurrentTabTable() {
  462. if (this.currentRow === '' || this.currentRow === null) {
  463. this.currentRow = {site: '', orderNo: ''}
  464. }
  465. if (this.activeName === 'quotationList') {
  466. this.refreshQuotationList()
  467. }
  468. if (this.activeName === 'attachments') {
  469. this.refreshAttachments()
  470. }
  471. },
  472. refreshQuotationList(){
  473. let inData = {
  474. site: this.currentRow.site,
  475. orderNo: this.currentRow.orderNo,
  476. itemNo: this.currentRow.itemNo,
  477. partNo: this.currentRow.partNo,
  478. type: 'add',
  479. height: this.tabHeight
  480. }
  481. this.$refs.quotationList.init(inData)
  482. },
  483. refreshAttachments () {
  484. let inData = {
  485. orderRef1: this.currentRow.site,
  486. orderRef2: this.currentRow.orderNo,
  487. orderRef3: this.currentRow.partNo,
  488. orderReftype: 'purQuotationDetail',
  489. height: this.tabHeight
  490. }
  491. this.$refs.attachments.init(inData)
  492. },
  493. // 打开报价对话框
  494. openQuoteDialog(row) {
  495. if (!row) {
  496. this.$message.warning('请选择要报价的询价单')
  497. return
  498. }
  499. // 检查是否有上次填写的数据且是当前行的数据
  500. const hasLastData = this.lastQuoteData &&
  501. this.lastQuoteData.orderNo === row.orderNo &&
  502. this.lastQuoteData.itemNo === row.itemNo
  503. // 填充表单数据
  504. this.quoteForm = {
  505. // 基础信息
  506. partNo: row.partNo || '',
  507. partDesc: row.partDesc || '',
  508. spec: row.spec || '',
  509. qty: row.qty || 0,
  510. umid: row.umid || '',
  511. otherCondition: row.otherCondition || '',
  512. status: '已报价',
  513. // 费用信息 - 如果有上次填写的数据则使用,否则使用行数据或默认值
  514. materialCost: hasLastData ? this.lastQuoteData.materialCost : (row.materialCost || 0),
  515. produceFee: hasLastData ? this.lastQuoteData.produceFee : (row.produceFee || 0),
  516. surfaceFee: hasLastData ? this.lastQuoteData.surfaceFee : (row.surfaceFee || 0),
  517. profit: hasLastData ? this.lastQuoteData.profit : (row.profit || 0),
  518. mouldFee: hasLastData ? this.lastQuoteData.mouldFee : (row.mouldFee || 0),
  519. additionalCost: hasLastData ? this.lastQuoteData.additionalCost : (row.additionalCost || 0),
  520. freight: hasLastData ? this.lastQuoteData.freight : (row.freight || 0),
  521. purchaseCycle: hasLastData ? this.lastQuoteData.purchaseCycle : (row.purchaseCycle || 0),
  522. duty: hasLastData ? this.lastQuoteData.duty : (row.duty || 0),
  523. // 价格信息
  524. price: hasLastData ? this.lastQuoteData.price : (row.price || 0),
  525. taxRate: hasLastData ? this.lastQuoteData.taxRate : (row.taxRate || 13),
  526. tax: hasLastData ? this.lastQuoteData.tax : (row.tax || 0),
  527. // 其他信息
  528. remark2: row.remark2 || '',
  529. remark: hasLastData ? this.lastQuoteData.remark : (row.remark || ''),
  530. // 关联信息
  531. orderNo: row.orderNo,
  532. itemNo: row.itemNo,
  533. supplierId: row.supplierId || this.$store.state.user.supplierId,
  534. supplierName: row.supplierName || this.$store.state.user.supplierName,
  535. site: this.$store.state.user.site,
  536. createdBy: this.$store.state.user.name
  537. }
  538. // 计算含税单价
  539. this.calculatePrice()
  540. this.quoteDialogVisible = true
  541. },
  542. calculatePrice(){
  543. //未税单价=材料成本+加工费+表面费用+利润
  544. this.quoteForm.price = this.quoteForm.materialCost + this.quoteForm.produceFee +
  545. this.quoteForm.surfaceFee + this.quoteForm.profit
  546. this.calculateTax()
  547. },
  548. // 计算含税单价
  549. calculateTax() {
  550. //含税单价=未税单价*(1+税率)
  551. if (this.quoteForm.price && this.quoteForm.taxRate) {
  552. this.quoteForm.tax = this.quoteForm.price * (1 + this.quoteForm.taxRate / 100)
  553. }
  554. },
  555. // 提交报价
  556. submitQuote() {
  557. this.calculatePrice()
  558. this.$refs.quoteForm.validate((valid) => {
  559. if (valid) {
  560. if (!this.quoteForm.price || Number(this.quoteForm.price) <= 0) {
  561. this.$message.error('未税单价必须大于0')
  562. return
  563. }
  564. // 计算总成本(可选)
  565. const totalCost = this.quoteForm.materialCost + this.quoteForm.produceFee +
  566. this.quoteForm.surfaceFee + this.quoteForm.profit +
  567. this.quoteForm.mouldFee + this.quoteForm.additionalCost +
  568. this.quoteForm.freight + this.quoteForm.duty
  569. const submitData = {
  570. ...this.quoteForm,
  571. totalCost: totalCost
  572. }
  573. createPurReplyHist(submitData).then(({ data }) => {
  574. if (data && data.code === 0) {
  575. this.$message.success('报价提交成功')
  576. // 提交成功后清除残留数据
  577. this.lastQuoteData = null
  578. this.quoteDialogVisible = false
  579. // 刷新报价记录列表
  580. this.refreshCurrentTabTable()
  581. // 刷新主列表状态
  582. this.getMainData()
  583. } else {
  584. this.$message.error(data.msg || '报价提交失败')
  585. }
  586. }).catch(error => {
  587. this.$message.error('报价提交失败: ' + error.message)
  588. })
  589. } else {
  590. this.$message.warning('请填写必填字段')
  591. }
  592. })
  593. },
  594. // 取消报价(保存当前填写的数据用于下次残留)
  595. cancelQuote() {
  596. // 保存当前填写的数据(只保存可编辑的字段)
  597. this.lastQuoteData = {
  598. orderNo: this.quoteForm.orderNo,
  599. itemNo: this.quoteForm.itemNo,
  600. // 费用信息
  601. materialCost: this.quoteForm.materialCost,
  602. produceFee: this.quoteForm.produceFee,
  603. surfaceFee: this.quoteForm.surfaceFee,
  604. profit: this.quoteForm.profit,
  605. mouldFee: this.quoteForm.mouldFee,
  606. additionalCost: this.quoteForm.additionalCost,
  607. freight: this.quoteForm.freight,
  608. purchaseCycle: this.quoteForm.purchaseCycle,
  609. duty: this.quoteForm.duty,
  610. // 价格信息
  611. price: this.quoteForm.price,
  612. taxRate: this.quoteForm.taxRate,
  613. tax: this.quoteForm.tax,
  614. // 备注
  615. remark: this.quoteForm.remark
  616. }
  617. this.quoteDialogVisible = false
  618. }
  619. }
  620. }
  621. </script>
  622. <style scoped lang="scss">
  623. /deep/ .customer-tab .el-tabs__content {
  624. padding: 5px !important;
  625. }
  626. /* 产品对话框整体样式 */
  627. .part-dialog {
  628. font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  629. }
  630. .part-dialog .el-dialog {
  631. margin-top: 5vh !important;
  632. margin-bottom: 5vh !important;
  633. }
  634. .part-dialog .el-dialog__header {
  635. padding: 20px 25px 15px 25px;
  636. border-bottom: 1px solid #E4E7ED;
  637. }
  638. .part-dialog .el-dialog__body {
  639. padding: 25px 25px 25px 25px;
  640. max-height: 75vh;
  641. overflow-y: auto;
  642. min-height: 400px;
  643. }
  644. .dialog-content {
  645. width: 100%;
  646. }
  647. /* 产品表单样式 */
  648. .part-form {
  649. width: 100%;
  650. }
  651. .part-form .el-form-item {
  652. margin-bottom: 1px;
  653. }
  654. .part-form .el-form-item__label {
  655. font-weight: 500;
  656. color: #303133;
  657. line-height: 32px;
  658. padding-right: 12px;
  659. }
  660. .part-form .el-form-item__content {
  661. line-height: normal;
  662. }
  663. /* 表单分组样式 */
  664. .form-section {
  665. margin-bottom: 5px;
  666. }
  667. .form-section:last-child {
  668. margin-bottom: 5px;
  669. }
  670. /* 输入框样式 */
  671. .part-form .el-input,
  672. .part-form .el-textarea,
  673. .part-form .el-date-editor {
  674. width: 100%;
  675. }
  676. /* 文本域样式优化 */
  677. .part-form .el-textarea__inner {
  678. resize: none;
  679. font-family: inherit;
  680. line-height: 1.5;
  681. }
  682. /* 对话框底部按钮居中 */
  683. .dialog-footer-center {
  684. text-align: center;
  685. padding: 15px 0 5px 0;
  686. border-top: 1px solid #E4E7ED;
  687. margin-top: 15px;
  688. }
  689. .dialog-footer-center .el-button {
  690. margin: 0 10px;
  691. min-width: 90px;
  692. height: 36px;
  693. padding: 0 20px;
  694. font-size: 14px;
  695. }
  696. /* 响应式调整 */
  697. @media (max-width: 1200px) {
  698. .part-dialog {
  699. width: 95% !important;
  700. }
  701. .part-dialog .el-dialog__body {
  702. padding: 20px 20px 15px 20px;
  703. }
  704. }
  705. @media (max-width: 768px) {
  706. .part-form .el-col {
  707. margin-bottom: 20px;
  708. }
  709. .form-section {
  710. margin-bottom: 35px;
  711. }
  712. .part-form .el-form-item__label {
  713. line-height: 28px;
  714. height: 28px;
  715. }
  716. }
  717. </style>