detailsPage.vue 42 KB

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