detailsPage.vue 42 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145
  1. <template>
  2. <div class="borderless">
  3. <div class="customer-head">
  4. <div class="customer-back">
  5. <el-button type="danger" style="border: none;background: none;color: red" icon="el-icon-arrow-left"
  6. @click="backToList">返回列表
  7. </el-button>
  8. </div>
  9. <div v-if="!auditDisabled" class="upper_right_button">
  10. <el-button type="primary" size="small" v-if="viewDisabled" class="el-button--small-yh " :loading="buttonLoading"
  11. @click.stop="openEdit()">编辑
  12. </el-button>
  13. <el-dropdown style="padding: 0 6px;line-height: 0">
  14. <el-button type="primary" size="small" :loading="buttonLoading" :disabled="!form.id || viewDisabled">
  15. 审核处理<i class="el-icon-arrow-down el-icon--right"></i>
  16. </el-button>
  17. <el-dropdown-menu slot="dropdown">
  18. <el-dropdown-item :loading="buttonLoading" @click.native="auditCheck">审核数据</el-dropdown-item>
  19. <el-dropdown-item v-if="false">审核进度</el-dropdown-item>
  20. <el-dropdown-item v-if="false">撤销审核</el-dropdown-item>
  21. </el-dropdown-menu>
  22. </el-dropdown>
  23. <el-dropdown style="padding: 0 6px;line-height: 0" v-if="false">
  24. <el-button type="warning" :loading="buttonLoading" :disabled="!form.id || viewDisabled" size="small">
  25. 账单处理<i class="el-icon-arrow-down el-icon--right"></i>
  26. </el-button>
  27. <el-dropdown-menu slot="dropdown">
  28. <el-dropdown-item @click.native="applySettlement('收费')">生成账单
  29. </el-dropdown-item>
  30. <el-dropdown-item @click.native="applySettlement('申请')">申请退款
  31. </el-dropdown-item>
  32. <el-dropdown-item @click.native="openApplicationDialog">查看账单
  33. </el-dropdown-item>
  34. </el-dropdown-menu>
  35. </el-dropdown>
  36. <el-dropdown style="padding: 0 6px;line-height: 0">
  37. <el-button type="success" :loading="buttonLoading" :disabled="!form.id || viewDisabled" size="small">
  38. 业务处理<i class="el-icon-arrow-down el-icon--right"></i>
  39. </el-button>
  40. <el-dropdown-menu slot="dropdown">
  41. <el-dropdown-item @click.native="createData()">创建单据
  42. </el-dropdown-item>
  43. <el-dropdown-item @click.native="copyData()">复制单据
  44. </el-dropdown-item>
  45. </el-dropdown-menu>
  46. </el-dropdown>
  47. <div>
  48. <el-button class="el-button--small-yh" type="primary" size="small" :disabled="disabled || viewDisabled"
  49. :loading="buttonLoading" @click="editCustomer">保存数据
  50. </el-button>
  51. </div>
  52. </div>
  53. <div v-if="auditDisabled" class="upper_right_button">
  54. <el-button type="primary" size="small" class="el-button--small-yh" :loading="buttonLoading"
  55. @click.stop="checkScheduleDialog = true, checkId = detailData.check.srcBillId">
  56. 审批流程
  57. </el-button>
  58. <el-button type="primary" size="small" class="el-button--small-yh" :loading="buttonLoading"
  59. :disabled="buttonDisabled" @click.stop="checkDialog = true">
  60. 审批
  61. </el-button>
  62. </div>
  63. </div>
  64. <div class="customer-main">
  65. <el-form :model="form" ref="form" label-width="130px">
  66. <trade-card title="基础信息">
  67. <el-row>
  68. <el-col v-for="(item, index) in basicData.column" :span="item.span ? item.span : 8" :key="index">
  69. <el-form-item :label="item.label" :prop="item.prop" :rules="item.rules">
  70. <el-date-picker v-if="item.type === 'datetime'" style="width: 100%;" v-model="form[item.prop]"
  71. :disabled="viewDisabled || takeDisabled" size="small" type="date" placeholder="选择日期"
  72. value-format="yyyy-MM-dd HH:mm:ss" />
  73. <el-select v-else-if="item.type === 'select'" style="width: 100%" v-model="form[item.prop]"
  74. :disabled="viewDisabled || takeDisabled" size="small" placeholder="请选择" clearable filterable>
  75. <el-option v-for="(data, index) in item.dicData" :key="index" :label="data.label" :value="data.value">
  76. </el-option>
  77. </el-select>
  78. <el-select v-else-if="item.prop === 'currency'" style="width: 100%" v-model="form[item.prop]"
  79. :disabled="viewDisabled || takeDisabled" size="small" placeholder="请选择" @change="currencyChange"
  80. clearable filterable>
  81. <el-option v-for="(item, index) in currencyDic" :key="index" :label="item.dictValue"
  82. :disabled="viewDisabled || takeDisabled" :value="item.dictValue"></el-option>
  83. </el-select>
  84. <crop-select v-else-if="item.prop === 'corpId'" v-model="form[item.prop]" corpType="KH"
  85. :disabled="viewDisabled || takeDisabled" style="width: 100%"></crop-select>
  86. <crop-select v-else-if="item.prop === 'belongToCorpId'" v-model="form[item.prop]"
  87. :disabled="viewDisabled || takeDisabled" corpType="GS"></crop-select>
  88. <user-com v-else-if="item.prop === 'salesName'" :disabled="viewDisabled || takeDisabled"
  89. v-model="form[item.prop]" style="width: 100%"></user-com>
  90. <el-input type="age" v-else-if="item.type === 'unit'" v-model="form[item.prop]"
  91. @change="downPaymentChange" :disabled="viewDisabled || takeDisabled" size="small" autocomplete="off"
  92. placeholder="请输入">
  93. <template slot="append">%</template>
  94. </el-input>
  95. <el-input type="textarea" v-else-if="(item.prop === 'orderRemark')" v-model="form[item.prop]"
  96. :disabled="viewDisabled" size="small" autocomplete="off" placeholder="请输入"></el-input>
  97. <el-input type="age" v-else v-model="form[item.prop]" size="small"
  98. :disabled="item.disabled ? true : false || viewDisabled" autocomplete="off" placeholder="请输入"></el-input>
  99. </el-form-item>
  100. </el-col>
  101. </el-row>
  102. </trade-card>
  103. <!-- 销售明细-->
  104. <trade-card title="销售明细">
  105. <avue-crud :option="importInventory" v-model="importInventoryForm" :data="importInventoryData"
  106. ref="importInventory" :cell-style="cellStyle" @row-save="rowSaveList" @row-update="rowUpdateList"
  107. @row-del="rowDelList" @selection-change="productSelection" @saveColumn="saveColumn"
  108. @resetColumn="resetColumn">
  109. <template slot-scope="{row}" slot="billNo">
  110. <span v-if="row.$cellEdit" class="required_fields">*</span>
  111. <el-input v-if="row.$cellEdit" v-model="row.billNo" style="width: 90%" placeholder=" " size="small"
  112. @change="bingOut(row)"></el-input>
  113. <span v-else>{{ row.billNo }}</span>
  114. </template>
  115. <template slot-scope="{row}" slot="orgOrderNo">
  116. <span v-if="row.$cellEdit" class="required_fields">*</span>
  117. <el-select v-if="row.$cellEdit" style="width:90% !important;" v-model="row.orgOrderNo" placeholder=" "
  118. size="small" clearable filterable>
  119. <el-option v-for="(item, index) in contractDic" :key="index" :label="item.orderNo" :value="item.orderNo">
  120. </el-option>
  121. </el-select>
  122. <span v-else>{{ row.orgOrderNo }}</span>
  123. </template>
  124. <template slot="price" slot-scope="{ row }">
  125. <el-input v-if="row.$cellEdit" v-model="row.price" placeholder="请输入" size="small"
  126. oninput='this.value=this.value.replace(/[^(\d.)]/g,"").replace(/^(\d+)\.(\d\d\d\d\d\d).*$/, "$1.$2")'>
  127. </el-input>
  128. <!-- @input="priceChange(row)"-->
  129. <span v-else>{{ row.price }}</span>
  130. </template>
  131. <template slot="orderQuantity" slot-scope="{ row }">
  132. <span v-if="row.$cellEdit" class="required_fields">*</span>
  133. <el-input v-if="row.$cellEdit" v-model="row.orderQuantity" style="width: 90%" placeholder="请输入"
  134. size="small"
  135. oninput='this.value=this.value.replace(/[^(\d.)]/g,"").replace(/^(\d+)\.(\d\d\d\d\d\d).*$/, "$1.$2")'>
  136. </el-input>
  137. <span v-else>{{ row.orderQuantity | roundNumbers }}</span>
  138. </template>
  139. <template slot="priceCategory" slot-scope="{row,index}">
  140. <span v-if="row.$cellEdit" class="required_fields">*</span>
  141. <goods-select style="width:90% !important;" v-if="row.$cellEdit" v-model="row.priceCategoryNames"
  142. @valueName="(value) => valueName(value, row)" :configuration="itemConfiguration">
  143. </goods-select>
  144. <span v-else>{{ row.priceCategoryNames }}</span>
  145. </template>
  146. <template slot="invoiceWeight" slot-scope="{ row }">
  147. <span v-if="row.$cellEdit" class="required_fields">*</span>
  148. <el-input v-if="row.$cellEdit" v-model="row.invoiceWeight" style="width: 90%" placeholder="请输入"
  149. size="small"
  150. oninput='this.value=this.value.replace(/[^(\d.)]/g,"").replace(/^(\d+)\.(\d\d\d\d\d\d).*$/, "$1.$2")'
  151. @change="totalChange(row.invoiceWeight)"></el-input>
  152. <span v-else>{{ row.invoiceWeight }}</span>
  153. </template>
  154. <template slot="billWeight" slot-scope="{ row }">
  155. <el-input v-if="row.$cellEdit" v-model="row.billWeight" placeholder="请输入" style="width: 90%" size="small"
  156. oninput='this.value=this.value.replace(/[^(\d.)]/g,"").replace(/^(\d+)\.(\d\d\d\d\d\d).*$/, "$1.$2")'
  157. @change="totalChange(row.billWeight)"></el-input>
  158. <!-- @input="billWeightChange(row)"-->
  159. <span v-else>{{ row.billWeight }}</span>
  160. </template>
  161. <template slot="grossWeight" slot-scope="{ row }">
  162. <el-input v-if="row.$cellEdit" v-model="row.grossWeight" style="width: 90%" placeholder="请输入" size="small"
  163. oninput='this.value=this.value.replace(/[^(\d.)]/g,"").replace(/^(\d+)\.(\d\d\d\d\d\d).*$/, "$1.$2")'>
  164. </el-input>
  165. <span v-else>{{ row.grossWeight }}</span>
  166. </template>
  167. <template slot="amount" slot-scope="{ row }">
  168. <el-input v-if="row.$cellEdit" v-model="row.amount" placeholder="请输入" size="small"
  169. oninput='this.value=this.value.replace(/[^(\d.)]/g,"").replace(/^(\d+)\.(\d\d\d\d\d\d).*$/, "$1.$2")'>
  170. </el-input>
  171. <span v-else>{{ row.amount }}</span>
  172. </template>
  173. <template slot="taxRate" slot-scope="{ row }">
  174. <el-input v-if="row.$cellEdit" v-model="row.taxRate" size="small"
  175. oninput='this.value=this.value.replace(/[^(\d.)]/g,"").replace(/^(\d+)\.(\d\d\d\d\d\d).*$/, "$1.$2")'
  176. autocomplete="off">
  177. <i slot="suffix" style="margin-top:3px;margin-right: 10px;display:inline-block">%</i>
  178. </el-input>
  179. <span v-else>{{ row.taxRate | isPercentage }}</span>
  180. </template>
  181. <template slot="actualQuantity" slot-scope="{ row }">
  182. <span>{{ row.actualQuantity | roundNumbers }}</span>
  183. </template>
  184. <template slot="menuLeft" slot-scope="{ row }">
  185. <el-button type="primary" icon="el-icon-plus" size="small" :disabled="viewDisabled"
  186. :loading="buttonLoading" @click="newDetails">录入明细</el-button>
  187. <el-button type="warning" size="small" :loading="buttonLoading"
  188. :disabled="selection.length < 1 || viewDisabled" @click="generateShipmentD">生成发货单
  189. </el-button>
  190. <!-- <el-button type="info"
  191. size="small"
  192. :disabled="importInventoryData.length < 1"
  193. @click="payeeDialog = true"
  194. >收款记录
  195. </el-button>-->
  196. </template>
  197. <template slot-scope="{row,index}" slot="menu">
  198. <el-button type="text" size="small" icon="el-icon-edit" :disabled="viewDisabled"
  199. @click="rowCell(row, index)">{{ row.$cellEdit ? '修改完成' : '修改' }}
  200. </el-button>
  201. <el-button type="text" size="small" icon="el-icon-delete" :disabled="viewDisabled"
  202. @click="rowDelList(row, index)">删除
  203. </el-button>
  204. </template>
  205. </avue-crud>
  206. </trade-card>
  207. <fee-info ref="feeInfo" @beforeFinance="beforeFinance" @afterFinance="afterFinance" :disabled="viewDisabled"
  208. :orderFeesList="orderFeesList" :itemType="'采购'" :optionType="'JK'" feeUrl="" :corpId="form.corpId" />
  209. <upload-file ref="uploadFile" title="合同附件" :disabled="viewDisabled"
  210. :orderFilesList="orderFilesList || viewDisabled" delUrl="" />
  211. </el-form>
  212. </div>
  213. <el-dialog title="收款记录" append-to-body class="el-dialogDeep" :visible.sync="payeeDialog" width="60%"
  214. :close-on-click-modal="false" :destroy-on-close="true" :close-on-press-escape="false" v-dialog-drag>
  215. <basic-container>
  216. <avue-crud :option="importInventory" :table-loading="payeeLoading" :data="payeeData" ref="applicationCrud"
  217. @refresh-change="payeeRefreshChange" :page.sync="payeePage" @on-load="payeeOnLoad"></avue-crud>
  218. </basic-container>
  219. <span slot="footer" class="dialog-footer">
  220. <el-button @click="payeeDialog = false">关 闭</el-button>
  221. </span>
  222. </el-dialog>
  223. <el-dialog append-to-body class="el-dialogDeep" :visible.sync="applySettlementDialog" width="60%"
  224. :close-on-click-modal="false" :destroy-on-close="true" :close-on-press-escape="false" v-dialog-drag>
  225. <apply-payment :billUrl="billUrl" :billType="billType" :billData="billData" @choceFun="choceFun">
  226. </apply-payment>
  227. </el-dialog>
  228. <el-dialog append-to-body title="账单" class="el-dialogDeep" :visible.sync="financialAccountDialog" width="70%"
  229. :close-on-click-modal="false" :destroy-on-close="true" :close-on-press-escape="false" v-dialog-drag>
  230. <financial-account :billId="form.id" :billType="billType" :billData="billData"
  231. :belongCompany="form.belongToCorpId" @choceFun="choceFun">
  232. </financial-account>
  233. </el-dialog>
  234. <el-dialog title="收款记录" append-to-body class="el-dialogDeep" :visible.sync="applicationDialog" width="60%"
  235. :close-on-click-modal="false" :destroy-on-close="true" :close-on-press-escape="false" v-dialog-drag>
  236. <bill-application :billId="form.id" @choceApplication="choceApplication">
  237. </bill-application>
  238. </el-dialog>
  239. <el-dialog append-to-body title="审批进度" class="el-dialogDeep" :visible.sync="checkScheduleDialog" width="40%"
  240. :close-on-click-modal="false" :destroy-on-close="true" :close-on-press-escape="false" v-dialog-drag>
  241. <check-schedule :checkId="form.id" :batchNo="batchNo" @choceScheduleFun="choceScheduleFun">
  242. </check-schedule>
  243. </el-dialog>
  244. <el-dialog append-to-body title="审批" class="el-dialogDeep" :visible.sync="checkDialog" width="50%"
  245. :close-on-click-modal="false" :destroy-on-close="true" :close-on-press-escape="false" v-dialog-drag>
  246. <check :checkData="detailData.check" :checkDetail="false" :idList="[]" @choceCheckFun="choceCheckFun">
  247. </check>
  248. </el-dialog>
  249. </div>
  250. </template>
  251. <script>
  252. import importInventory from './config/importInventory.json';
  253. import {
  254. detailSaleList,
  255. submitData,
  256. goodsListRemove,
  257. getOrgOrderNo
  258. } from "@/api/importTrade/salesContract"
  259. import feeInfo from "@/components/fee-info/main";
  260. import uploadFile from "@/components/upload-file/main";
  261. import { contrastObj, contrastList } from "@/util/contrastData";
  262. import _ from "lodash";
  263. import { isPercentage, roundNumbers } from "@/util/validate";
  264. //账单组件
  265. import financialAccount from "../../../components/finance/financialAccount";
  266. import ApplyPayment from "../../../components/finance/applyPayment";
  267. import billApplication from "@/components/bill/billApplication";
  268. import checkSchedule from "../../../components/check/checkSchedule";
  269. import check from "@/components/check/check";
  270. import { pleaseCheck } from "@/api/basicData/configuration"
  271. export default {
  272. name: "detailsPage",
  273. props: {
  274. detailData: {
  275. type: Object
  276. }
  277. },
  278. filters: {
  279. isPercentage(val) {
  280. return isPercentage(val);
  281. },
  282. roundNumbers(val) {
  283. return roundNumbers(val);
  284. }
  285. },
  286. components: {
  287. ApplyPayment,
  288. feeInfo,
  289. financialAccount,
  290. uploadFile,
  291. billApplication,
  292. checkSchedule,
  293. check
  294. },
  295. data() {
  296. return {
  297. disabled: false,
  298. buttonLoading: false,
  299. dialogCommodity: false,
  300. applySettlementDialog: false,
  301. financialAccountDialog: false,
  302. applicationDialog: false,
  303. viewDisabled: false,
  304. takeDisabled: false,
  305. buttonDisabled: false,
  306. checkScheduleDialog: false,//审批窗口
  307. auditDisabled: false,//显示审批按钮还是正常按钮
  308. checkDialog: false,//审批窗口
  309. approverDisabled: false,//是否审批过了
  310. batchNo: '',//审批流程
  311. lockData: {},
  312. form: {},
  313. orderFeesList: [],
  314. orderFilesList: [],
  315. currencyDic: [],
  316. contractDic: [],
  317. selectKind: -1,
  318. billUrl: "",
  319. billType: "",
  320. billData: {},
  321. itemConfiguration: {
  322. multipleChoices: false,
  323. multiple: false,
  324. disabled: false,
  325. searchShow: true,
  326. collapseTags: false,
  327. placeholder: '请点击右边按钮选择',
  328. dicData: []
  329. },
  330. // 基础信息
  331. basicData: {
  332. column: [
  333. {
  334. label: '系统号',
  335. prop: 'sysNo',
  336. disabled: true,
  337. rules: [
  338. {
  339. required: false,
  340. message: ' ',
  341. trigger: 'blur'
  342. }
  343. ]
  344. },
  345. {
  346. label: '客户名称',
  347. span: 16,
  348. prop: 'corpId',
  349. rules: [
  350. {
  351. required: true,
  352. message: ' ',
  353. trigger: 'blur'
  354. }
  355. ]
  356. },
  357. {
  358. label: '合同号',
  359. prop: 'orderNo',
  360. rules: [
  361. {
  362. required: true,
  363. message: ' ',
  364. trigger: 'blur'
  365. }
  366. ]
  367. },
  368. {
  369. label: '所属公司',
  370. prop: 'belongToCorpId',
  371. span: 16,
  372. dicData: [],
  373. rules: [
  374. {
  375. required: true,
  376. message: ' ',
  377. trigger: 'blur'
  378. }
  379. ]
  380. },
  381. {
  382. label: '合同日期',
  383. prop: 'businesDate',
  384. type: 'datetime',
  385. data: [],
  386. rules: [
  387. {
  388. required: false,
  389. message: ' ',
  390. trigger: 'blur'
  391. }
  392. ]
  393. },
  394. {
  395. label: '合同金额',
  396. prop: 'orderAmount',
  397. rules: [
  398. {
  399. pattern: /(^[1-9]([0-9]+)?(\.[0-9]{1,2})?$)|(^(0){1}$)|(^[0-9]\.[0-9]([0-9])?$)/,
  400. message: ' ',
  401. trigger: 'blur'
  402. }
  403. ]
  404. },
  405. {
  406. label: '合同重量(吨)',
  407. prop: 'contractWeight',
  408. rules: [
  409. {
  410. required: false,
  411. message: ' ',
  412. trigger: 'blur'
  413. }
  414. ]
  415. },
  416. {
  417. label: '销售单价',
  418. prop: 'salesPrice',
  419. rules: [
  420. {
  421. required: false,
  422. message: ' ',
  423. trigger: 'blur'
  424. }
  425. ]
  426. },
  427. {
  428. label: '币别',
  429. prop: 'currency',
  430. }, {
  431. label: '汇率',
  432. prop: 'exchangeRate',
  433. rules: [
  434. {
  435. required: false,
  436. message: ' ',
  437. trigger: 'blur'
  438. }
  439. ]
  440. },
  441. {
  442. label: '客户首付日期',
  443. prop: 'advanceCollectionDate',
  444. type: 'datetime',
  445. rules: [
  446. {
  447. required: false,
  448. message: ' ',
  449. trigger: 'blur'
  450. }
  451. ]
  452. },
  453. {
  454. label: '首付比例',
  455. type: "unit",
  456. prop: 'downPayment',
  457. rules: [
  458. {
  459. required: false,
  460. message: ' ',
  461. trigger: 'blur'
  462. }
  463. ]
  464. },
  465. {
  466. label: '首付金额',
  467. prop: 'advancePayment',
  468. rules: [
  469. {
  470. pattern: /(^[1-9]([0-9]+)?(\.[0-9]{1,2})?$)|(^(0){1}$)|(^[0-9]\.[0-9]([0-9])?$)/,
  471. message: ' ',
  472. trigger: 'blur'
  473. }
  474. ]
  475. },
  476. {
  477. label: '已收人民币金额',
  478. prop: 'settlmentAmount',
  479. disabled: true,
  480. },
  481. {
  482. label: '已收外币金额',
  483. prop: 'foreignSettlmentAmount',
  484. disabled: true,
  485. },
  486. {
  487. label: '计划交期',
  488. prop: 'plannedDeliveryDate',
  489. type: 'datetime',
  490. },
  491. {
  492. label: '已退人民币金额',
  493. prop: 'refundSettlmentAmount',
  494. disabled: true,
  495. },
  496. {
  497. label: '已退外币金额',
  498. prop: 'refundForeignSettlmentAmount',
  499. disabled: true,
  500. },
  501. {
  502. label: '业务员',
  503. prop: 'salesName',
  504. dicData: [],
  505. },
  506. {
  507. label: '发票重量',
  508. prop: 'invoiceWeight',
  509. disabled: true,
  510. },
  511. {
  512. label: '码单重量',
  513. prop: 'billWeight',
  514. disabled: true,
  515. },
  516. {
  517. label: '开票单位',
  518. prop: 'vbrk',
  519. },
  520. {
  521. label: '包装要求',
  522. prop: 'packageRemarks',
  523. rules: [
  524. {
  525. required: false,
  526. message: ' ',
  527. trigger: 'blur'
  528. }
  529. ]
  530. },
  531. {
  532. label: "备注",
  533. span: 24,
  534. prop: "orderRemark",
  535. mock: {
  536. type: 'county'
  537. }
  538. }
  539. ],
  540. },
  541. //收款记录
  542. payeeDialog: false,
  543. payeeLoading: false,
  544. payeeData: [],
  545. payeePage: {
  546. pageSize: 10,
  547. currentPage: 1,
  548. total: 0
  549. },
  550. // 导入库存配置
  551. importInventory: {},
  552. importInventoryForm: {},
  553. importInventoryData: [],
  554. selection: [],
  555. //新旧数据对比
  556. oldForm: {},
  557. oldInventoryData: [],
  558. oldFeesList: [],
  559. oldFilesList: [],
  560. }
  561. },
  562. async created() {
  563. this.importInventory = await this.getColumnData(this.getColumnName(39), importInventory);
  564. //币别
  565. this.getWorkDicts("currency").then(res => {
  566. this.currencyDic = res.data.data
  567. if (!this.detailData.id) {
  568. this.$set(this.form, "currency", "USD")
  569. this.currencyChange("USD")
  570. }
  571. })
  572. if (this.detailData.view) {
  573. this.viewDisabled = true
  574. }
  575. if (this.detailData.id) {
  576. this.buttonLoading = true;
  577. let id = this.detailData.id.replace(/\"/g, "")
  578. detailSaleList(id).then(res => {
  579. this.afterEcho(res.data.data)
  580. }).finally(() => {
  581. this.buttonLoading = false
  582. })
  583. } else {
  584. //采购日期默认当天
  585. let date = new Date();
  586. let strDate = date.getFullYear() + "-" + (date.getMonth() + 1) + "-" + date.getDate() + " " + date.getHours() + ":" + date.getMinutes() + ":" + date.getSeconds();
  587. this.$set(this.form, "businesDate", strDate)
  588. }
  589. if (this.detailData.check) {
  590. //待审批状态才可选择通过或者驳回
  591. if (this.detailData.check.auditStatus === "S") {
  592. this.buttonDisabled = false
  593. }
  594. this.viewDisabled = true //查看审批不能编辑
  595. this.auditDisabled = true
  596. this.buttonLoading = true;
  597. this.batchNo = this.detailData.check.batchNo
  598. let id = this.detailData.check.srcBillId.replace(/\"/g, "")
  599. detailSaleList(id).then(res => {
  600. this.afterEcho(res.data.data)
  601. }).finally(() => {
  602. this.buttonLoading = false;
  603. })
  604. }
  605. },
  606. methods: {
  607. valueName(value, row) {
  608. this.$set(row, "priceCategory", value.id)
  609. },
  610. //首付比例 带出金额
  611. downPaymentChange() {
  612. if (this.form.orderAmount) {
  613. this.$set(this.form, "advancePayment", _.multiply(this.form.orderAmount, (this.form.downPayment * 0.01)).toFixed(2))
  614. }
  615. },
  616. //合计
  617. totalChange() {
  618. let invoiceList = this.importInventoryData.map(item => {
  619. if (item.invoiceWeight) {
  620. return parseFloat(item.invoiceWeight);
  621. } else return 0
  622. });
  623. let billList = this.importInventoryData.map(item => {
  624. if (item.billWeight) {
  625. return parseFloat(item.billWeight);
  626. } else return 0
  627. });
  628. this.$set(this.form, "invoiceWeight", invoiceList.reduce((n, m) => n + m))
  629. this.$set(this.form, "billWeight", billList.reduce((n, m) => n + m))
  630. },
  631. //带出汇率
  632. currencyChange(value) {
  633. this.currencyDic.forEach(item => {
  634. if (item.dictValue === value) {
  635. this.$set(this.form, "exchangeRate", item.remark)
  636. }
  637. })
  638. },
  639. //单价
  640. priceChange(row) {
  641. if (row.price && row.billWeight) {
  642. row.amount = _.multiply(row.billWeight, row.price).toFixed(2);
  643. }
  644. },
  645. //数量
  646. billWeightChange(row) {
  647. if (row.price && row.billWeight) {
  648. row.amount = _.multiply(row.billWeight, row.price).toFixed(2);
  649. }
  650. },
  651. //提单号带出合同号
  652. bingOut(row) {
  653. getOrgOrderNo(row.billNo).then(res => {
  654. if (res.data.length != 0) {
  655. this.contractDic = res.data;
  656. row.orgOrderNo = res.data[0].orderNo
  657. row.itemId = res.data[0].itemId;
  658. row.priceCategoryNames = res.data[0].itemName[0].cname
  659. row.priceCategory = res.data[0].itemName[0].id
  660. row.cntrNo = res.data[0].cntrNo
  661. } else {
  662. this.$message.warning("无此提单号记录!");
  663. this.contractDic = [];
  664. row.orgOrderNo = ''
  665. row.itemId = ''
  666. row.priceCategoryNames = ''
  667. row.priceCategory = ''
  668. }
  669. }).catch(() => {
  670. row.orgOrderNo = ''
  671. })
  672. },
  673. //打开申请记录
  674. openApplicationDialog() {
  675. this.applicationDialog = true
  676. },
  677. //关闭申记录
  678. choceApplication() {
  679. this.applicationDialog = false
  680. },
  681. //生成账单数据
  682. beforeBillData(bool, type) {
  683. this.billType = type
  684. this.billData = {
  685. srcOrderno: this.form.orderNo,
  686. itemType: "销售",
  687. optionType: 'JK',
  688. billNoList: this.importInventoryData.map(item => { return item.billNo }),
  689. amount: this.form.orderAmount,
  690. belongToCorpId: this.form.belongToCorpId,
  691. corpsName: this.form.corpName,
  692. corpId: this.form.corpId,
  693. price: this.form.salesPrice,
  694. accDate: this.form.businesDate,
  695. currency: this.form.currency,
  696. exchangeRate: this.form.exchangeRate,
  697. srcParentId: this.form.id,
  698. }
  699. if (type) { //申请货款
  700. this.billData.srcId = -1
  701. }
  702. },
  703. //费用明细回调验证
  704. beforeFinance(feesData, callback) {
  705. let params = {}
  706. if (contrastObj(this.form, this.oldForm) || contrastList(this.importInventoryData, this.oldInventoryData)
  707. || contrastList(feesData, this.oldFeesList) || contrastList(this.orderFilesList, this.oldFilesList)
  708. ) {
  709. this.$confirm("数据发生变化,请先提交保存?", {
  710. confirmButtonText: "保存",
  711. cancelButtonText: "取消",
  712. type: "warning"
  713. }).then(() => {
  714. this.editCustomer();
  715. }).finally(() => {
  716. params.valid = false
  717. callback(params)
  718. })
  719. } else {
  720. params.valid = true
  721. params.parentId = this.form.id
  722. params.srcOrderno = this.form.orderNo
  723. callback(params)
  724. }
  725. },
  726. //生成账单之后需要更新明细列表的属性
  727. afterFinance() {
  728. detailSaleList(this.form.id).then(res => {
  729. this.afterEcho(res.data.data)
  730. })
  731. },
  732. //请核
  733. auditCheck() {
  734. if (this.verificationData()) {
  735. this.$confirm("确定审核此订单?", {
  736. confirmButtonText: "确定",
  737. cancelButtonText: "取消",
  738. type: "warning"
  739. }).then(() => {
  740. this.buttonLoading = true
  741. const data = {
  742. id: this.form.id,
  743. checkType: 'xsqh',
  744. url: '/salesManagement/salesContract/index',
  745. pageStatus: "this.$store.getters.entranceXsStatus",
  746. pageLabel: "销售订单",
  747. checkFlag: 2,
  748. }
  749. pleaseCheck(data).then(res => {
  750. if (res.data.success) {
  751. this.$message.success("操作成功!")
  752. this.viewDisabled = true
  753. this.approverDisabled = true
  754. }
  755. })
  756. }).finally(() => {
  757. this.buttonLoading = false
  758. })
  759. }
  760. },
  761. //财务操作
  762. applySettlement(type) {
  763. if (this.verificationData()) {
  764. this.beforeBillData(true, type)
  765. this.financialAccountDialog = true;
  766. }
  767. },
  768. choceFun() {
  769. this.financialAccountDialog = false
  770. },
  771. //刷新
  772. payeeRefreshChange() {
  773. console.log(1)
  774. },
  775. //申请记录
  776. payeeOnLoad() {
  777. console.log(1)
  778. },
  779. //商品选中触发
  780. productSelection(selection) {
  781. this.selection = selection
  782. },
  783. //生成发货单
  784. generateShipmentD() {
  785. if (this.verificationData()) {
  786. if (this.$store.getters.goStatus) {
  787. this.$alert("发货单页面已存在,请关闭发货单再进行操作", "温馨提示", {
  788. confirmButtonText: "确定",
  789. type: 'warning',
  790. callback: action => {
  791. }
  792. });
  793. } else {
  794. const params = {
  795. id: this.form.id,
  796. orderItemIds: this.selection.map(i => { return i.id })
  797. }
  798. this.$router.push({
  799. path: "/importTrade/invoice/index",
  800. query: { form: params },
  801. });
  802. this.$router.$avueRouter.closeTag('/importTrade/invoice/index');
  803. }
  804. }
  805. },
  806. //录入明细
  807. newDetails() {
  808. const params = {
  809. price: this.form.salesPrice,
  810. exRate: this.form.exchangeRate
  811. }
  812. this.$refs.importInventory.rowCellAdd(params);
  813. },
  814. //商品编辑
  815. rowCell(row, index) {
  816. this.$refs.importInventory.rowCell(row, index)
  817. },
  818. //新增明细保存触发
  819. rowSaveList(row, done, loading) {
  820. done()
  821. },
  822. //修改明细触发
  823. rowUpdateList(row, index, done, loading) {
  824. done(row);
  825. },
  826. //关闭审核
  827. choceCheckFun() {
  828. this.checkDialog = false;
  829. },
  830. choceScheduleFun() {
  831. this.checkScheduleDialog = false
  832. },
  833. //删除商品明细触发
  834. rowDelList(row, index, donerowDel) {
  835. this.$confirm("确定将选择数据删除?", {
  836. confirmButtonText: "确定",
  837. cancelButtonText: "取消",
  838. type: "warning"
  839. }).then(() => {
  840. if (row.id) {
  841. goodsListRemove(row.id).then(res => {
  842. this.$message({
  843. type: "success",
  844. message: "操作成功!"
  845. });
  846. this.importInventoryData.splice(index, 1);
  847. })
  848. } else {
  849. this.$message({
  850. type: "success",
  851. message: "操作成功!"
  852. });
  853. this.importInventoryData.splice(index, 1);
  854. }
  855. }).finally(() => {
  856. this.totalChange()
  857. })
  858. },
  859. //修改
  860. editCustomer(status) {
  861. this.$refs["form"].validate((valid) => {
  862. if (valid) {
  863. let orderFeesList = this.$refs.feeInfo.submitData();
  864. for (let i = 0; i < orderFeesList.length; i++) {
  865. if (orderFeesList[i].corpId == null) {
  866. return this.$message.error(`请输入第${i + 1}行的结算中心`);
  867. }
  868. if (orderFeesList[i].price == 0) {
  869. return this.$message.error(`请正确输入第${i + 1}行的价格`);
  870. }
  871. if (orderFeesList[i].orderQuantity == 0) {
  872. return this.$message.error(`请正确输入第${i + 1}行的件数`);
  873. }
  874. }
  875. let orderUpLoadList = this.$refs.uploadFile.submitData();
  876. for (let j = 0; j < this.importInventoryData.length; j++) {
  877. if (this.importInventoryData[j].billNo === (null || "")) {
  878. return this.$message.error(`请输入销售明细第${j + 1}行的提单号`);
  879. }
  880. if (this.importInventoryData[j].orgOrderNo === (null || "")) {
  881. return this.$message.error(`请输入销售明细第${j + 1}行的合同号`);
  882. }
  883. if (this.importInventoryData[j].priceCategory === (null || "")) {
  884. return this.$message.error(`请输入销售明细第${j + 1}行的货品物种`);
  885. }
  886. if (this.importInventoryData[j].orderQuantity === (null || "")) {
  887. return this.$message.error(`请输入销售明细第${j + 1}行的件数`);
  888. }
  889. if (this.importInventoryData[j].invoiceWeight === (null || "")) {
  890. return this.$message.error(`请输入销售明细第${j + 1}行的发票重量`);
  891. }
  892. }
  893. this.buttonLoading = true;
  894. if (this.importInventoryData.length !== 0) {
  895. //提单号
  896. this.form.billNo = Array.from(new Set(this.importInventoryData.map(item => { return item.billNo }))).join(",")
  897. //发票金额合计 存入主表
  898. let invoiceList = this.importInventoryData.map(item => {
  899. if (item.amount) {
  900. return parseFloat(item.amount);
  901. } else return 0
  902. });
  903. this.form.invoiceAmount = invoiceList.reduce((n, m) => n + m)
  904. }
  905. let submitDto = {
  906. ...this.form,
  907. orderItemsList: this.importInventoryData,
  908. orderFeesList: orderFeesList,
  909. orderUpLoadList: orderUpLoadList,
  910. };
  911. submitData(submitDto).then(res => {
  912. if (res.data.success) {
  913. this.$message.success("操作成功!")
  914. detailSaleList(res.data.data.id).then(res => {
  915. this.afterEcho(res.data.data)
  916. }).finally(() => {
  917. this.buttonLoading = false
  918. })
  919. }
  920. })
  921. if (status === true) {
  922. this.$emit("goBack");
  923. }
  924. } else {
  925. return false;
  926. }
  927. });
  928. },
  929. afterEcho(data) {
  930. this.form = data;
  931. this.oldForm = Object.assign({}, data);
  932. this.importInventoryData = data.orderItemsList
  933. //销售明细列表如果存在已发数量或重量不为0 则此订单已发货 禁止编辑主要参数
  934. this.takeDisabled = this.importInventoryData.map(item => { if (item.actualQuantity != 0 || item.actualWeight != 0) return true }).some(item => { return item == true })
  935. this.basicData.column.forEach(item => {
  936. if (item.prop == "advanceCollectionDate" || item.prop == "orderAmount" || item.prop == "salesPrice" || item.prop == "exchangeRate" || item.prop == "advancePayment" || item.prop == "orderNo" || item.prop == "contractWeight") {
  937. item.disabled = this.takeDisabled
  938. }
  939. })
  940. if (data.orderItemsList) {
  941. this.importInventoryData = data.orderItemsList
  942. this.oldInventoryData = this.deepClone(data.orderItemsList)
  943. }
  944. if (data.orderFeesList) {
  945. this.orderFeesList = data.orderFeesList
  946. this.oldFeesList = this.deepClone(data.orderFeesList)
  947. }
  948. if (data.orderFilesList) {
  949. this.orderFilesList = data.orderFilesList
  950. this.oldFilesList = this.deepClone(data.orderFilesList)
  951. }
  952. if (this.detailData.status === 'copy') {
  953. this.copyData()
  954. }
  955. },
  956. //验证数据
  957. verificationData() {
  958. this.orderFeesList = this.$refs.feeInfo.submitData();
  959. if (contrastObj(this.form, this.oldForm) || contrastList(this.importInventoryData, this.oldInventoryData)
  960. || contrastList(this.orderFeesList, this.oldFeesList) || contrastList(this.orderFilesList, this.oldFilesList)
  961. ) {
  962. this.$confirm("数据发生变化,请先提交保存!", "提示", {
  963. confirmButtonText: "保存",
  964. cancelButtonText: "取消",
  965. type: "warning",
  966. }).then(() => {
  967. this.editCustomer()
  968. }).catch(() => {
  969. return false
  970. })
  971. } else {
  972. return true
  973. }
  974. },
  975. createData() {
  976. if (this.verificationData()) {
  977. this.$confirm("确定创建新的单据吗?", "提示", {
  978. confirmButtonText: "保存",
  979. cancelButtonText: "取消",
  980. type: "warning",
  981. }).then(() => {
  982. this.form = {}
  983. this.oldForm = {}
  984. this.importInventoryData = []
  985. this.oldInventoryData = []
  986. this.orderFeesList = []
  987. this.oldFeesList = []
  988. this.orderFilesList = []
  989. this.oldFilesList = []
  990. })
  991. }
  992. },
  993. //复制单据
  994. copyData() {
  995. if (this.verificationData()) {
  996. this.takeDisabled = false
  997. this.basicData.column.forEach(item => {
  998. if (item.prop == "advanceCollectionDate" || item.prop == "orderAmount" || item.prop == "salesPrice" || item.prop == "exchangeRate" || item.prop == "advancePayment" || item.prop == "orderNo" || item.prop == "contractWeight") {
  999. item.disabled = this.takeDisabled
  1000. }
  1001. })
  1002. delete this.form.id //删除id
  1003. this.$set(this.form, "sysNo", "")//系统编号
  1004. this.$set(this.form, "orderNo", "")//合同号
  1005. this.$set(this.form, "settlmentAmount", "")//已付人民币
  1006. this.$set(this.form, "foreignSettlmentAmount", "")//已付外币
  1007. this.$set(this.form, "refundSettlmentAmount", "")//已退人民币
  1008. this.$set(this.form, "refundForeignSettlmentAmount", "")//已退外币
  1009. this.importInventoryData.forEach(item => {
  1010. delete item.id //删除id
  1011. item.actualQuantity = "" //已收件数
  1012. item.actualWeight = "" //已收发票
  1013. })
  1014. this.orderFeesList.forEach(item => {
  1015. delete item.id //删除id
  1016. })
  1017. this.oldForm = {}
  1018. this.oldInventoryData = []
  1019. this.oldFeesList = []
  1020. this.oldFilesList = []
  1021. this.$message.success("复制成功!")
  1022. }
  1023. },
  1024. async openEdit() {
  1025. if (this.approverDisabled || this.form.status != 0) { //是否审批
  1026. this.$message.warning("此订单已提交审批,不可编辑!")
  1027. return
  1028. }
  1029. //标签页保存key
  1030. this.inDetailsKey(this.$route.name, this.detailData.lockData);
  1031. //单据是否锁定
  1032. if (!await this.checkLocks(this.detailData.lockData)) {
  1033. this.onLock(this.detailData.lockData); //上锁
  1034. this.viewDisabled = false
  1035. } else {
  1036. this.$message.warning('此单据已被锁定,请稍后再进行操作!')
  1037. }
  1038. },
  1039. backToList() {
  1040. //如果单据已被锁定 并且编辑按钮存在 则直接返回
  1041. if (this.viewDisabled || !this.detailData.lockData) {
  1042. this.$emit("goBack");
  1043. return
  1044. }
  1045. this.orderFeesList = this.$refs.feeInfo.submitData();
  1046. if (contrastObj(this.form, this.oldForm) || contrastList(this.importInventoryData, this.oldInventoryData)
  1047. || contrastList(this.orderFeesList, this.oldFeesList) || contrastList(this.orderFilesList, this.oldFilesList)
  1048. ) {
  1049. this.$confirm("是否保存当前页面?", "提示", {
  1050. confirmButtonText: "保存",
  1051. cancelButtonText: "取消",
  1052. type: "warning",
  1053. }).then(() => {
  1054. this.editCustomer(true)
  1055. }).catch(() => {
  1056. this.$emit("goBack");
  1057. }).finally(() => {
  1058. if (this.form.id) {
  1059. this.unLock(this.detailData.lockData);
  1060. this.leaveDetailsKey(this.$route.name);
  1061. }
  1062. })
  1063. } else {
  1064. this.$emit("goBack");
  1065. if (this.form.id) {
  1066. this.unLock(this.detailData.lockData);
  1067. this.leaveDetailsKey(this.$route.name);
  1068. }
  1069. }
  1070. },
  1071. //列保存触发
  1072. async saveColumn() {
  1073. const inSave = await this.saveColumnData(
  1074. this.getColumnName(39),
  1075. this.importInventory
  1076. );
  1077. if (inSave) {
  1078. this.$message.success("保存成功");
  1079. //关闭窗口
  1080. this.$refs.importInventory.$refs.dialogColumn.columnBox = false;
  1081. }
  1082. },
  1083. async resetColumn() {
  1084. const inSave = await this.delColumnData(
  1085. this.getColumnName(39),
  1086. importInventory
  1087. );
  1088. if (inSave) {
  1089. this.$message.success("重置成功");
  1090. this.importInventory = importInventory;
  1091. //关闭窗口
  1092. this.$refs.importInventory.$refs.dialogColumn.columnBox = false;
  1093. }
  1094. },
  1095. cellStyle() {
  1096. return "padding:0;height:40px;";
  1097. },
  1098. },
  1099. }
  1100. </script>
  1101. <style scoped lang="scss">
  1102. .required_fields {
  1103. color: #F56C6C;
  1104. display: inline-block;
  1105. width: 7%
  1106. }
  1107. .upper_right_button {
  1108. display: flex;
  1109. position: fixed;
  1110. right: 12px;
  1111. top: 47px;
  1112. }
  1113. ::v-deep .el-form-item {
  1114. margin-bottom: 0;
  1115. }
  1116. ::v-deep .el-form-item__content {
  1117. line-height: 32px;
  1118. }
  1119. </style>