detailsPage.vue 51 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377
  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 v-if="!auditDisabled" class="upper_right_button">
  9. <el-button type="primary" size="small" v-if="viewDisabled" class="el-button--small-yh "
  10. :loading="buttonLoading" @click.stop="openEdit()">编辑
  11. </el-button>
  12. <el-dropdown style="padding: 0 6px;line-height: 0">
  13. <el-button type="primary" size="small" :loading="buttonLoading" :disabled="!form.id">
  14. 审批处理<i class="el-icon-arrow-down el-icon--right"></i>
  15. </el-button>
  16. <el-dropdown-menu slot="dropdown">
  17. <el-dropdown-item :loading="buttonLoading" :disabled="viewDisabled" @click.native="auditCheck">提交审批</el-dropdown-item>
  18. <el-dropdown-item :disabled="form.status == 0" @click.native="checkScheduleDialog = true">审批进度</el-dropdown-item>
  19. <el-dropdown-item :disabled="form.status == 0 || form.status == 4 || !form.id" @click.native="repealCancel">撤销审批</el-dropdown-item>
  20. </el-dropdown-menu>
  21. </el-dropdown>
  22. <el-dropdown style="padding: 0 6px;line-height: 0" v-if="false">
  23. <el-button type="warning" :loading="buttonLoading" :disabled="!form.id || viewDisabled" size="small">
  24. 账单处理<i class="el-icon-arrow-down el-icon--right"></i>
  25. </el-button>
  26. <el-dropdown-menu slot="dropdown">
  27. <el-dropdown-item @click.native="applyPayment('申请')">申请货款
  28. </el-dropdown-item>
  29. <el-dropdown-item @click.native="applyPayment('收费')">申请退款
  30. </el-dropdown-item>
  31. <el-dropdown-item @click.native="openApplicationDialog">查看账单
  32. </el-dropdown-item>
  33. </el-dropdown-menu>
  34. </el-dropdown>
  35. <el-dropdown style="padding: 0 6px;line-height: 0">
  36. <el-button type="success" :loading="buttonLoading" :disabled="!form.id || viewDisabled" size="small">
  37. 业务处理<i class="el-icon-arrow-down el-icon--right"></i>
  38. </el-button>
  39. <el-dropdown-menu slot="dropdown">
  40. <el-dropdown-item @click.native="createData()">创建单据
  41. </el-dropdown-item>
  42. <el-dropdown-item @click.native="copyData()">复制单据
  43. </el-dropdown-item>
  44. </el-dropdown-menu>
  45. </el-dropdown>
  46. <el-button class="el-button--small-yh " type="primary" size="small" :disabled="disabled || viewDisabled"
  47. @click="editCustomer" :loading="buttonLoading">保存数据
  48. </el-button>
  49. </div>
  50. <div v-if="auditDisabled" class="upper_right_button">
  51. <el-button type="primary" size="small" class="el-button--small-yh" :loading="buttonLoading"
  52. @click.stop="checkScheduleDialog = true, checkId = detailData.check.srcBillId">
  53. 审批流程
  54. </el-button>
  55. <el-button type="primary" size="small" class="el-button--small-yh" :loading="buttonLoading"
  56. :disabled="buttonDisabled" @click.stop="checkDialog = true">
  57. 审批
  58. </el-button>
  59. </div>
  60. </div>
  61. </div>
  62. <div class="customer-main">
  63. <el-form :model="form" ref="form" label-width="130px">
  64. <trade-card title="基础信息">
  65. <el-row>
  66. <el-col v-for="(item, index) in basicData.column" :span="item.span ? item.span : 8" :key="index">
  67. <el-form-item :label="item.label" :prop="item.prop" :rules="item.rules">
  68. <el-date-picker v-if="item.type === 'date'" style="width: 100%;" v-model="form[item.prop]"
  69. :disabled="item.disabled ? true : false || viewDisabled" size="small" type="date" @change="dateChange"
  70. placeholder="选择日期" value-format="yyyy-MM-dd HH:mm:ss" />
  71. <el-select v-else-if="item.type === 'select'" style="width: 100%" v-model="form[item.prop]" size="small"
  72. placeholder="请选择" clearable filterable>
  73. <el-option v-for="(data, index) in item.dicData" :key="index" :label="data.label" :value="data.value">
  74. </el-option>
  75. </el-select>
  76. <el-input type="age" v-else-if="item.prop === 'orderAmount'" v-model="form[item.prop]"
  77. :disabled="item.disabled ? true : false || takeDisabled || viewDisabled" size="small"
  78. autocomplete="off" @input="RMBChange" placeholder="请输入"></el-input>
  79. <crop-select v-else-if="item.prop === 'corpId'" v-model="form[item.prop]" corpType="GYS"
  80. :disabled="item.disabled ? true : false || takeDisabled || viewDisabled" style="width: 100%">
  81. </crop-select>
  82. <crop-select v-else-if="item.prop === 'belongToCorpId'" v-model="form[item.prop]"
  83. :disabled="item.disabled ? true : false || takeDisabled || viewDisabled" corpType="GS"></crop-select>
  84. <el-select v-else-if="item.prop === 'orderType'" style="width: 100%" v-model="form[item.prop]"
  85. :disabled="item.disabled ? true : false || takeDisabled || viewDisabled" size="small"
  86. placeholder="请选择" clearable filterable>
  87. <el-option v-for="(item, index) in contractTypeDic" :key="index" :label="item.dictValue"
  88. :value="item.dictValue"></el-option>
  89. </el-select>
  90. <el-select v-else-if="item.prop === 'currency'" style="width: 100%"
  91. :disabled="item.disabled ? true : false || takeDisabled || viewDisabled" v-model="form[item.prop]"
  92. size="small" placeholder="请选择" @change="currencyChange" clearable filterable>
  93. <el-option v-for="(item, index) in currencyDic" :key="index" :label="item.dictValue"
  94. :value="item.dictValue"></el-option>
  95. </el-select>
  96. <el-select v-else-if="item.prop === 'paymentType'" style="width: 100%"
  97. :disabled="item.disabled ? true : false || viewDisabled" v-model="form[item.prop]" size="small"
  98. placeholder="请选择" clearable filterable>
  99. <el-option v-for="(item, index) in paymentTypeDic" :key="index" :label="item.dictValue"
  100. :value="item.dictValue"></el-option>
  101. </el-select>
  102. <div v-else-if="item.prop === 'advancePayment'">
  103. <el-input type="age" v-model="form[item.prop]" style="width: 70%"
  104. :disabled="item.disabled ? true : false || takeDisabled || viewDisabled" size="small"
  105. autocomplete="off" placeholder="请输入"></el-input>
  106. <el-select v-model="form['prepayCurrency']" size="small" style="width: 30%" :value="'USD'"
  107. :disabled="item.disabled ? true : false || takeDisabled || viewDisabled" value="USD"
  108. placeholder="请选择" clearable filterable>
  109. <el-option v-for="(item, index) in currencyDic" :key="index" :label="item.dictValue"
  110. :value="item.dictValue"></el-option>
  111. </el-select>
  112. </div>
  113. <user-com v-else-if="item.prop === 'salesName'"
  114. :disabled="item.disabled ? true : false || takeDisabled || viewDisabled" v-model="form[item.prop]"
  115. style="width: 100%"></user-com>
  116. <el-input type="age" v-else-if="item.prop === 'exchangeRate'" v-model="form[item.prop]"
  117. :disabled="item.disabled ? true : false || takeDisabled || viewDisabled" size="small"
  118. autocomplete="off" @change="RMBChange" placeholder="请输入">
  119. </el-input>
  120. <el-input type="textarea" v-else-if="(item.prop === 'orderRemark')" v-model="form[item.prop]"
  121. :disabled="viewDisabled" size="small" autocomplete="off" placeholder="请输入"></el-input>
  122. <el-input type="age" v-else v-model="form[item.prop]"
  123. :disabled="item.disabled ? true : false || takeDisabled || viewDisabled" size="small"
  124. autocomplete="off" placeholder="请输入"></el-input>
  125. </el-form-item>
  126. </el-col>
  127. </el-row>
  128. </trade-card>
  129. <!-- 采购明细-->
  130. <trade-card title="采购明细">
  131. <avue-crud :option="customerContact" v-model="contactsForm" :data="contactsData" ref="crudContact"
  132. :cell-style="cellStyle" @row-save="rowSave" @selection-change="selectionContact" @row-click="handleRowClick"
  133. @row-update="rowUpdate" @row-del="rowDel" @saveColumn="saveColumn" @resetColumn="resetColumn">
  134. <template slot="priceCategory" slot-scope="{ row, index}">
  135. <span v-if="row.$cellEdit" class="required_fields">*</span>
  136. <goods-select style="width:90% !important;" v-if="row.$cellEdit" v-model="row.priceCategoryNames"
  137. @valueName="(value) => valueName(value, row)" :configuration="itemConfiguration">
  138. </goods-select>
  139. <span v-else>{{ row.priceCategoryNames }}</span>
  140. </template>
  141. <template slot="itemType" slot-scope="{ row, index }">
  142. <span v-if="row.$cellEdit" class="required_fields">*</span>
  143. <el-select v-if="row.$cellEdit" v-model="row.itemType" size="small" style="width:90% !important;"
  144. filterable allow-create default-first-option clearable>
  145. <el-option v-for="(item, index) in itemTypeList" :key="index" :label="item" :value="item">
  146. </el-option>
  147. </el-select>
  148. <span v-else>{{ row.itemType }}</span>
  149. </template>
  150. <template slot="orderQuantity" slot-scope="{ row }">
  151. <span v-if="row.$cellEdit" class="required_fields">*</span>
  152. <el-input style="width:90% !important;" v-if="row.$cellEdit" v-model="row.orderQuantity" placeholder="请输入"
  153. size="small"
  154. oninput='this.value=this.value.replace(/[^(\d.)]/g,"").replace(/^(\d+)\.(\d\d\d\d\d\d).*$/, "$1.$2")'>
  155. </el-input>
  156. <span v-else>{{ row.orderQuantity | roundNumbers }}</span>
  157. </template>
  158. <template slot="price" slot-scope="{ row }">
  159. <el-input v-if="row.$cellEdit" v-model="row.price" placeholder="请输入" size="small"
  160. oninput='this.value=this.value.replace(/[^(\d.)]/g,"").replace(/^(\d+)\.(\d\d\d\d\d\d).*$/, "$1.$2")'>
  161. </el-input>
  162. <!-- @input="priceChange(row)"-->
  163. <span v-else>{{ row.price }}</span>
  164. </template>
  165. <template slot="invoiceWeight" slot-scope="{ row }">
  166. <span v-if="row.$cellEdit" class="required_fields">*</span>
  167. <el-input style="width:90% !important;" v-if="row.$cellEdit" v-model="row.invoiceWeight" placeholder="请输入"
  168. size="small"
  169. oninput='this.value=this.value.replace(/[^(\d.)]/g,"").replace(/^(\d+)\.(\d\d\d\d\d\d).*$/, "$1.$2")'
  170. @change="totalChange(row.invoiceWeight)"></el-input>
  171. <span v-else>{{ row.invoiceWeight }}</span>
  172. </template>
  173. <template slot="billWeight" slot-scope="{ row }">
  174. <el-input style="width:90% !important;" v-if="row.$cellEdit" v-model="row.billWeight" placeholder="请输入"
  175. size="small"
  176. oninput='this.value=this.value.replace(/[^(\d.)]/g,"").replace(/^(\d+)\.(\d\d\d\d\d\d).*$/, "$1.$2")'
  177. @change="totalChange(row.billWeight)"></el-input>
  178. <!-- @input="billWeightChange(row)"-->
  179. <span v-else>{{ row.billWeight }}</span>
  180. </template>
  181. <template slot="grossWeight" slot-scope="{ row }">
  182. <el-input v-if="row.$cellEdit" v-model="row.grossWeight" style="width: 90%" placeholder="请输入" size="small"
  183. oninput='this.value=this.value.replace(/[^(\d.)]/g,"").replace(/^(\d+)\.(\d\d\d\d\d\d).*$/, "$1.$2")'>
  184. </el-input>
  185. <span v-else>{{ row.grossWeight }}</span>
  186. </template>
  187. <template slot="amount" slot-scope="{ row }">
  188. <el-input v-if="row.$cellEdit" v-model="row.amount" placeholder="请输入" size="small"
  189. oninput='this.value=this.value.replace(/[^(\d.)]/g,"").replace(/^(\d+)\.(\d\d\d\d\d\d).*$/, "$1.$2")'>
  190. </el-input>
  191. <span v-else>{{ row.amount }}</span>
  192. </template>
  193. <template slot="taxRate" slot-scope="{ row }">
  194. <el-input v-if="row.$cellEdit" v-model="row.taxRate" size="small"
  195. oninput='this.value=this.value.replace(/[^(\d.)]/g,"").replace(/^(\d+)\.(\d\d\d\d\d\d).*$/, "$1.$2")'
  196. autocomplete="off">
  197. <i slot="suffix" style="margin-top:3px;margin-right: 10px;display:inline-block">%</i>
  198. </el-input>
  199. <span v-else>{{ row.taxRate | isPercentage }}</span>
  200. </template>
  201. <template slot="actualQuantity" slot-scope="{ row }">
  202. <span>{{ row.actualQuantity | roundNumbers }}</span>
  203. </template>
  204. <template slot-scope="{row,index}" slot="menu">
  205. <el-button type="text" size="small" icon="el-icon-edit"
  206. :disabled="row.actualQuantity != 0 || viewDisabled" @click="rowCell(row, index)">{{ row.$cellEdit ?
  207. '修改完成' : '修改'
  208. }}
  209. </el-button>
  210. <el-button type="text" icon="el-icon-delete" size="small"
  211. :disabled="row.actualQuantity != 0 || viewDisabled" @click="rowDel(row, index)">删除
  212. </el-button>
  213. </template>
  214. <template slot="menuLeft" slot-scope="{size}">
  215. <el-button type="primary" icon="el-icon-plus" size="small" :disabled="viewDisabled"
  216. :loading="buttonLoading" @click="commoditySelection">录入明细
  217. </el-button>
  218. <el-button type="warning" size="small" :loading="buttonLoading"
  219. :disabled="selectContact.length == 0 || viewDisabled" @click="beforePage()">生成收货单
  220. </el-button>
  221. <el-button type="warning" size="small" :loading="buttonLoading" :disabled="viewDisabled"
  222. @click="download">下载模板
  223. </el-button>
  224. <el-upload :action="baseURL" :headers="headers" :disabled="viewDisabled" :on-progress="uploading"
  225. :show-file-list=false accept=".xls,.xlsx" multiple :on-success="importTemplate" :on-error="uploadError"
  226. style="float: right">
  227. <el-button type="primary" size="small" icon="el-icon-upload" :disabled="viewDisabled">导 入</el-button>
  228. </el-upload>
  229. </template>
  230. </avue-crud>
  231. </trade-card>
  232. <fee-info ref="feeInfo" :orderFeesList="orderFeesList" :disabled="viewDisabled" :itemType="'采购'"
  233. activeName="second" :optionType="'JK'" @beforeFinance="beforeFinance" @afterFinance="afterFinance"
  234. @getBillNo="getBillNo" feeUrl="/blade-purchase-sales/entranceOrder/removeOrderFees" :corpId="form.corpId" :billNoList="billNoList" />
  235. <upload-file ref="uploadFile" title="合同附件" :disabled="viewDisabled" :orderFilesList="orderFilesList"
  236. delUrl="" />
  237. </el-form>
  238. </div>
  239. <el-dialog title="付款记录" append-to-body class="el-dialogDeep" :visible.sync="applicationDialog" width="60%"
  240. :close-on-click-modal="false" :destroy-on-close="true" :close-on-press-escape="false" v-dialog-drag>
  241. <bill-application :billId="form.id" @choceApplication="choceApplication">
  242. </bill-application>
  243. </el-dialog>
  244. <el-dialog append-to-body title="账单" class="el-dialogDeep" :visible.sync="applyPaymentDialog" width="70%"
  245. :close-on-click-modal="false" :destroy-on-close="true" :close-on-press-escape="false" v-dialog-drag>
  246. <apply-payment :billType="billType" :billData="billData" @choceFun="choceFun">
  247. </apply-payment>
  248. </el-dialog>
  249. <el-dialog append-to-body title="账单" class="el-dialogDeep" :visible.sync="financialAccountDialog" width="70%"
  250. :close-on-click-modal="false" :destroy-on-close="true" :close-on-press-escape="false" v-dialog-drag>
  251. <financial-account :billId="form.id" :billType="billType" :billData="billData" :checkData="checkData"
  252. :belongCompany="form.belongToCorpId" @choceFun="choceFun">
  253. </financial-account>
  254. </el-dialog>
  255. <el-dialog append-to-body title="审批进度" class="el-dialogDeep" :visible.sync="checkScheduleDialog" width="40%"
  256. :close-on-click-modal="false" :destroy-on-close="true" :close-on-press-escape="false" v-dialog-drag>
  257. <check-schedule :checkId="form.id" :batchNo="batchNo" @choceScheduleFun="choceScheduleFun">
  258. </check-schedule>
  259. </el-dialog>
  260. <el-dialog append-to-body title="审批" class="el-dialogDeep" :visible.sync="checkDialog" width="50%"
  261. :close-on-click-modal="false" :destroy-on-close="true" :close-on-press-escape="false" v-dialog-drag>
  262. <check :checkData="detailData.check" :checkDetail="false" :idList="[]" @choceCheckFun="choceCheckFun">
  263. </check>
  264. </el-dialog>
  265. </div>
  266. </template>
  267. <script>
  268. import customerContact from "./config/customerContact.json"
  269. import { detailListData, submitData } from "@/api/importTrade/purchase";
  270. import feeInfo from "@/components/fee-info/main";
  271. import uploadFile from "@/components/upload-file/main";
  272. import _ from "lodash";
  273. import { isPercentage, roundNumbers } from "@/util/validate";
  274. import billApplication from "@/components/bill/billApplication";
  275. //商品详情接口
  276. import {corpsattn} from "@/api/basicData/configuration"
  277. import { contrastObj, contrastList, contrastList2 } from "@/util/contrastData";
  278. import ApplyPayment from "../../../components/finance/applyPayment";
  279. import financialAccount from "../../../components/finance/financialAccount";
  280. import { pleaseCheck,repealPurchase } from "@/api/basicData/configuration"
  281. import checkSchedule from "../../../components/check/checkSchedule";
  282. import check from "@/components/check/check";
  283. import { getToken } from "@/util/auth";
  284. export default {
  285. name: "detailsPage",
  286. props: {
  287. detailData: {
  288. type: Object
  289. }
  290. },
  291. filters: {
  292. isPercentage(val) {
  293. return isPercentage(val);
  294. },
  295. roundNumbers(val) {
  296. return roundNumbers(val);
  297. }
  298. },
  299. components: {
  300. ApplyPayment,
  301. financialAccount,
  302. feeInfo,
  303. uploadFile,
  304. billApplication,
  305. checkSchedule,
  306. check
  307. },
  308. data() {
  309. return {
  310. baseURL: '/api/trade-purchase/purchase-order/importPrice', // 商品明细上传路径
  311. headers: { "Blade-Auth": 'Bearer ' + getToken() },
  312. form: {},
  313. disabled: false,
  314. customerContact: customerContact,
  315. contactsForm: {},
  316. contactsData: [],
  317. itemTypeList: [],
  318. billNoList: [],
  319. buttonLoading: false,
  320. buttonDisabled: false,
  321. applyPaymentDialog: false,
  322. applicationDialog: false,
  323. financialAccountDialog: false,
  324. checkScheduleDialog: false,//审批窗口
  325. auditDisabled: false,
  326. checkDialog: false,//审批窗口
  327. commodityData: false,
  328. takeDisabled: false, //收货状态
  329. viewDisabled: false,//查看状态
  330. approverDisabled: false,//审批
  331. tableData: [],
  332. batchNo: '',
  333. billType: "",
  334. billData: {},
  335. salesNameDic: [],//业务员列表
  336. contractTypeDic: [],
  337. currencyDic: [],
  338. selectContact: [],//选中采购明细
  339. selectKind: -1,//选择采购明细的货品
  340. paymentTypeDic: [],
  341. orderFeesList: [],
  342. orderFilesList: [],
  343. itemConfiguration: {
  344. multipleChoices: false,
  345. multiple: false,
  346. disabled: false,
  347. searchShow: true,
  348. collapseTags: false,
  349. placeholder: '请点击右边按钮选择',
  350. dicData: []
  351. },
  352. checkData: {
  353. url: "/financialManagement/paymentRequest/index",
  354. pageStatus: "this.$store.getters.pqStatus",
  355. pageLabel: "付费申请",
  356. checkType: 'ffsq'
  357. },
  358. //对比新旧数据信息
  359. oldContactsData: [],
  360. oldForm: {},
  361. oldFeesList: [],
  362. oldFilesList: [],
  363. // 基础信息
  364. basicData: {
  365. column: [
  366. {
  367. label: '系统编号',
  368. prop: 'sysNo',
  369. disabled: true,
  370. rules: [
  371. {
  372. required: false,
  373. message: ' ',
  374. trigger: 'blur'
  375. }
  376. ]
  377. }, {
  378. label: '供应商',
  379. prop: 'corpId',
  380. span: 16,
  381. dicData: [],
  382. rules: [
  383. {
  384. required: true,
  385. message: ' ',
  386. trigger: 'blur'
  387. }
  388. ]
  389. }, {
  390. label: '合同号',
  391. prop: 'orderNo',
  392. rules: [
  393. {
  394. required: true,
  395. message: ' ',
  396. trigger: 'blur'
  397. }
  398. ]
  399. },
  400. {
  401. label: '所属公司',
  402. prop: 'belongToCorpId',
  403. span: 16,
  404. dicData: [],
  405. rules: [
  406. {
  407. required: true,
  408. message: ' ',
  409. trigger: 'blur'
  410. }
  411. ]
  412. },
  413. {
  414. label: '合同日期',
  415. prop: 'businesDate',
  416. type: 'date',
  417. rules: [
  418. {
  419. required: false,
  420. message: ' ',
  421. trigger: 'blur'
  422. }
  423. ]
  424. },
  425. {
  426. label: '合同金额',
  427. prop: 'orderAmount',
  428. rules: [
  429. {
  430. pattern: /(^[1-9]([0-9]+)?(\.[0-9]{1,2})?$)|(^(0){1}$)|(^[0-9]\.[0-9]([0-9])?$)/,
  431. message: ' ',
  432. trigger: 'blur'
  433. }
  434. ]
  435. },
  436. {
  437. label: '合同重量(吨)',
  438. prop: 'contractWeight',
  439. rules: [
  440. {
  441. required: false,
  442. message: ' ',
  443. trigger: 'blur'
  444. }
  445. ]
  446. },
  447. {
  448. label: '合同类型',
  449. prop: 'orderType',
  450. // type:'select',
  451. dicData: [],
  452. rules: [
  453. {
  454. required: false,
  455. message: ' ',
  456. trigger: 'blur'
  457. }
  458. ]
  459. },
  460. {
  461. label: '要求发货日期',
  462. prop: 'requiredDeliveryDate',
  463. type: 'date',
  464. rules: [
  465. {
  466. required: true,
  467. message: ' ',
  468. trigger: 'blur'
  469. }
  470. ]
  471. }, {
  472. label: '要求到货日期',
  473. prop: 'requiredArrivalDate',
  474. type: 'date',
  475. rules: [
  476. {
  477. required: true,
  478. message: ' ',
  479. trigger: 'blur'
  480. }
  481. ]
  482. },
  483. {
  484. label: '单价',
  485. prop: 'salesPrice',
  486. rules: [
  487. {
  488. pattern: /(^[1-9]([0-9]+)?(\.[0-9]{1,2})?$)|(^(0){1}$)|(^[0-9]\.[0-9]([0-9])?$)/,
  489. message: ' ',
  490. trigger: 'blur'
  491. }
  492. ]
  493. }, {
  494. label: '币别',
  495. prop: 'currency'
  496. }, {
  497. label: '汇率',
  498. prop: 'exchangeRate',
  499. },
  500. {
  501. label: '人民币金额',
  502. prop: 'rmbAmount',
  503. rules: [
  504. {
  505. pattern: /(^[1-9]([0-9]+)?(\.[0-9]{1,2})?$)|(^(0){1}$)|(^[0-9]\.[0-9]([0-9])?$)/,
  506. message: ' ',
  507. trigger: 'blur'
  508. }
  509. ]
  510. },
  511. {
  512. label: '预付(保证)金额',
  513. prop: 'advancePayment',
  514. rules: [
  515. {
  516. pattern: /(^[1-9]([0-9]+)?(\.[0-9]{1,2})?$)|(^(0){1}$)|(^[0-9]\.[0-9]([0-9])?$)/,
  517. message: ' ',
  518. trigger: 'blur'
  519. }
  520. ]
  521. },
  522. {
  523. label: '付款方式',
  524. prop: 'paymentType',
  525. },
  526. {
  527. label: '付款/开证日期',
  528. prop: 'accountsCollectionDate',
  529. type: 'date',
  530. rules: [
  531. {
  532. required: false,
  533. message: ' ',
  534. trigger: 'blur'
  535. }
  536. ]
  537. },
  538. {
  539. label: '信用证到期日',
  540. prop: 'creditDate',
  541. type: 'date',
  542. rules: [
  543. {
  544. required: false,
  545. message: ' ',
  546. trigger: 'blur'
  547. }
  548. ]
  549. },
  550. {
  551. label: '最迟付款日期',
  552. prop: 'latestDate',
  553. type: 'date',
  554. rules: [
  555. {
  556. required: false,
  557. message: ' ',
  558. trigger: 'blur'
  559. }
  560. ]
  561. },
  562. {
  563. label: '已付人民币金额',
  564. prop: 'settlmentAmount',
  565. disabled: true,
  566. },
  567. {
  568. label: '已付外币金额',
  569. prop: 'foreignSettlmentAmount',
  570. disabled: true,
  571. },
  572. {
  573. label: '到港日期',
  574. prop: 'dateOfArrival',
  575. type: 'date',
  576. rules: [
  577. {
  578. required: false,
  579. message: ' ',
  580. trigger: 'blur'
  581. }
  582. ]
  583. },
  584. {
  585. label: '已退人民币金额',
  586. prop: 'refundSettlmentAmount',
  587. disabled: true,
  588. },
  589. {
  590. label: '已退外币金额',
  591. prop: 'refundForeignSettlmentAmount',
  592. disabled: true,
  593. },
  594. {
  595. label: '业务员',
  596. prop: 'salesName',
  597. dicData: [],
  598. rules: [
  599. {
  600. required: false,
  601. message: ' ',
  602. trigger: 'blur'
  603. }
  604. ]
  605. },
  606. {
  607. label: '发票重量',
  608. prop: 'invoiceWeight',
  609. disabled: true,
  610. rules: [
  611. {
  612. required: false,
  613. message: ' ',
  614. trigger: 'blur'
  615. }
  616. ]
  617. },
  618. {
  619. label: '码单重量',
  620. prop: 'billWeight',
  621. disabled: true,
  622. rules: [
  623. {
  624. required: false,
  625. message: ' ',
  626. trigger: 'blur'
  627. }
  628. ]
  629. },
  630. {
  631. label: "备注",
  632. span: 24,
  633. prop: "orderRemark",
  634. mock: {
  635. type: 'county'
  636. }
  637. }
  638. ],
  639. },
  640. }
  641. },
  642. async created() {
  643. // this.customerContact = await this.getColumnData(this.getColumnName(37), customerContact);
  644. //币别
  645. this.getWorkDicts("currency").then(res => {
  646. this.currencyDic = res.data.data
  647. if (!this.detailData.id) {
  648. this.$set(this.form, "currency", "USD")
  649. this.currencyChange("USD")
  650. }
  651. })
  652. this.getWorkDicts("contractType").then(res => {
  653. this.contractTypeDic = res.data.data
  654. })
  655. this.getWorkDicts("payment_term").then(res => {
  656. this.paymentTypeDic = res.data.data
  657. })
  658. this.getWorkDicts("boxModel").then(res => {
  659. this.findObject(this.customerContact.column, "cntrType").dicData =
  660. res.data.data;
  661. })
  662. if (this.detailData.view) {
  663. this.viewDisabled = true
  664. }
  665. if (this.detailData.id) {
  666. this.buttonLoading = true;
  667. let id = this.detailData.id.replace(/\"/g, "")
  668. detailListData(id).then(res => {
  669. this.afterEcho(res.data.data)
  670. }).finally(() => {
  671. this.buttonLoading = false;
  672. })
  673. }
  674. if (this.detailData.check) {
  675. //待审批状态才可选择通过或者驳回
  676. if (this.detailData.check.auditStatus === "S") {
  677. this.buttonDisabled = false
  678. }
  679. this.viewDisabled = true //查看审批不能编辑
  680. this.auditDisabled = true
  681. this.buttonLoading = true;
  682. this.batchNo = this.detailData.check.batchNo
  683. let id = this.detailData.check.srcBillId.replace(/\"/g, "")
  684. detailListData(id).then(res => {
  685. this.afterEcho(res.data.data)
  686. }).finally(() => {
  687. this.buttonLoading = false;
  688. })
  689. }
  690. },
  691. methods: {
  692. //选择货品物种
  693. valueName(value, row) {
  694. this.itemTypeList = value.list
  695. this.$set(row, "priceCategory", value.id)
  696. this.$set(row, "itemId", value.id) //将id 赋值给itemId 提单号查询合同号时使用
  697. },
  698. //到货日期不能小于发货日期
  699. dateChange() {
  700. if (this.form.requiredArrivalDate && this.form.requiredDeliveryDate && this.form.requiredArrivalDate < this.form.requiredDeliveryDate) {
  701. this.$message.error("到货日期不能小于发货日期")
  702. this.$set(this.form, "requiredArrivalDate", '')
  703. }
  704. },
  705. //单价
  706. priceChange(row) {
  707. if (row.price && row.billWeight) {
  708. row.amount = _.multiply(row.billWeight, row.price).toFixed(2);
  709. }
  710. },
  711. //码单重量
  712. billWeightChange(row) {
  713. if (row.billWeight && row.price) {
  714. row.amount = _.multiply(row.billWeight, row.price).toFixed(2);
  715. }
  716. },
  717. //带出汇率
  718. currencyChange(value) {
  719. this.currencyDic.forEach(item => {
  720. if (item.dictValue === value) {
  721. this.$set(this.form, "exchangeRate", item.remark)
  722. }
  723. })
  724. if (this.form.orderAmount && this.form.orderAmount) {
  725. this.$set(this.form, "rmbAmount", _.multiply(this.form.orderAmount, this.form.exchangeRate).toFixed(2))
  726. }
  727. },
  728. //计算人民币金额
  729. RMBChange(value) {
  730. if (this.form.orderAmount && this.form.orderAmount) {
  731. this.$set(this.form, "rmbAmount", _.multiply(this.form.orderAmount, this.form.exchangeRate).toFixed(2))
  732. }
  733. },
  734. //合计
  735. totalChange() {
  736. let invoiceList = this.contactsData.map(item => {
  737. if (item.invoiceWeight) {
  738. return parseFloat(item.invoiceWeight);
  739. } else return 0
  740. });
  741. let billList = this.contactsData.map(item => {
  742. if (item.billWeight) {
  743. return parseFloat(item.billWeight);
  744. } else return 0
  745. });
  746. this.$set(this.form, "invoiceWeight", invoiceList.reduce((n, m) => n + m)) //数组内和
  747. this.$set(this.form, "billWeight", billList.reduce((n, m) => n + m))
  748. },
  749. //获取明细列表提单号list
  750. getBillNo() {
  751. this.contactsData.forEach(item => {
  752. this.billNoList.push(item.billNo)
  753. })
  754. this.billNoList = Array.from(new Set(this.billNoList))
  755. },
  756. //费用明细回调
  757. beforeFinance(feesData, callback) {
  758. let params = {}
  759. if (contrastObj(this.form, this.oldForm) || contrastList(this.contactsData, this.oldContactsData)
  760. || contrastList2(feesData, this.oldFeesList) || contrastList(this.orderFilesList, this.oldFilesList)
  761. ) {
  762. this.$confirm("数据发生变化,请先提交保存?", {
  763. confirmButtonText: "保存",
  764. cancelButtonText: "取消",
  765. type: "warning"
  766. }).then(() => {
  767. this.editCustomer();
  768. }).finally(() => {
  769. params.valid = false
  770. callback(params)
  771. })
  772. } else {
  773. params.valid = true
  774. params.parentId = this.form.id
  775. params.srcOrderno = this.form.orderNo
  776. callback(params)
  777. }
  778. },
  779. //生成账单之后需要更新明细列表的属性
  780. afterFinance() {
  781. detailListData(this.form.id).then(res => {
  782. this.afterEcho(res.data.data)
  783. })
  784. },
  785. //修改提交触发
  786. editCustomer(status) {
  787. this.$refs["form"].validate((valid) => {
  788. if (valid) {
  789. let orderFeesList = this.$refs.feeInfo.submitData();
  790. for (let i = 0; i < orderFeesList.length; i++) {
  791. if (orderFeesList[i].corpId === (null || "")) {
  792. return this.$message.error(`请输入费用明细第${i + 1}行的结算中心`);
  793. }
  794. if (orderFeesList[i].itemId === (null || "")) {
  795. return this.$message.error(`请输入费用明细第${i + 1}行的费用名称`);
  796. }
  797. }
  798. const orderFilesList = this.$refs.uploadFile.submitData();
  799. for (let j = 0; j < this.contactsData.length; j++) {
  800. if (this.contactsData[j].billNo === (null || "")) {
  801. return this.$message.error(`请输入采购明细第${j + 1}行的提单号`);
  802. }
  803. if (this.contactsData[j].priceCategory === (null || "")) {
  804. return this.$message.error(`请输入采购明细第${j + 1}行的货物品种`);
  805. }
  806. if (this.contactsData[j].itemType === (null || "")) {
  807. return this.$message.error(`请输入采购明细第${j + 1}行的规格型号`);
  808. }
  809. if (this.contactsData[j].orderQuantity === (null || "")) {
  810. return this.$message.error(`请输入采购明细第${j + 1}行的件数`);
  811. }
  812. if (this.contactsData[j].cntrNum === (null || 0)) {
  813. return this.$message.error(`采购明细第${j + 1}行的箱量不能为空`);
  814. }
  815. if (this.contactsData[j].invoiceWeight === (null || "")) {
  816. return this.$message.error(`请输入采购明细第${j + 1}行的发票重量`);
  817. }
  818. }
  819. if (this.contactsData.length !== 0) {
  820. let invoiceList = this.contactsData.map(item => {
  821. if (item.amount) {
  822. return parseFloat(item.amount);
  823. } else return 0
  824. });
  825. this.form.invoiceAmount = invoiceList.reduce((n, m) => n + m)
  826. }
  827. this.form.billNo = Array.from(new Set(this.contactsData.map(item => { return item.billNo }))).join(",")
  828. let submitDto = {
  829. ...this.form,
  830. tradeType: "JK",
  831. billType: "CG",
  832. itemsVOList: this.contactsData,
  833. orderFeesList: orderFeesList,
  834. orderFilesList: orderFilesList
  835. };
  836. this.buttonLoading = true;
  837. submitData(submitDto).then(res => {
  838. if (res.data.success) {
  839. this.form.id = res.data.data
  840. this.$message.success("操作成功!")
  841. detailListData(this.form.id).then(res => {
  842. this.afterEcho(res.data.data)
  843. })
  844. }
  845. }).finally(() => {
  846. this.buttonLoading = false
  847. })
  848. if (status === true) {
  849. this.$emit("goBack");
  850. }
  851. } else {
  852. return false;
  853. }
  854. });
  855. },
  856. //回调
  857. afterEcho(form) {
  858. this.form = form;
  859. this.oldForm = Object.assign({}, form);
  860. if (form.itemsVOList) {
  861. this.contactsData = form.itemsVOList
  862. this.oldContactsData = this.deepClone(form.itemsVOList)
  863. //明细列表内是否有 已经收货的 如果有 则禁用一些输入框
  864. this.takeDisabled = this.contactsData.map(item => { if (item.actualQuantity != 0 || item.actualWeight != 0) return true }).some(item => { return item == true })
  865. this.basicData.column.forEach(item => {
  866. if (item.prop == "businesDate" || item.prop == "requiredDeliveryDate" || item.prop == "requiredArrivalDate" || item.prop == "latestDate") {
  867. item.disabled = this.takeDisabled
  868. }
  869. })
  870. this.getBillNo()
  871. }
  872. if (form.orderFeesList) {
  873. this.orderFeesList = form.orderFeesList
  874. this.oldFeesList = this.deepClone(form.orderFeesList)
  875. }
  876. if (form.orderFilesList) {
  877. this.orderFilesList = form.orderFilesList
  878. this.oldFilesList = this.deepClone(form.orderFilesList)
  879. }
  880. if (this.detailData.status === 'copy') {
  881. this.copyData()
  882. }
  883. },
  884. selectionContact(row) {
  885. this.selectContact = row;
  886. },
  887. //进入收货单
  888. beforePage() {
  889. if (this.verificationData()) {
  890. if (this.$store.getters.takeStatus) {
  891. this.$alert("收货单页面已存在,请关闭收货单再进行操作", "温馨提示", {
  892. confirmButtonText: "确定",
  893. type: 'warning',
  894. callback: action => {
  895. }
  896. });
  897. } else {
  898. const params = {//你问我西厂算什么东西 东厂管的了的我要管 管不了的我也要管 先斩后奏 皇权特许 这 就是西厂
  899. id: this.form.id,
  900. orderItemIds: this.selectContact.map(i => { return i.$index })
  901. }
  902. //关闭一下存在的列表页
  903. this.$router.$avueRouter.closeTag('/importTrade/receipt/index');
  904. this.$router.push({
  905. path: "/importTrade/receipt/index",
  906. query: {
  907. params: params
  908. },
  909. });
  910. }
  911. }
  912. },
  913. beforeBillData(bool, type) {
  914. this.billType = type
  915. //采购明细提单号 list
  916. this.billData = {
  917. srcOrderno: this.form.orderNo,
  918. itemType: "采购", //区分采购还是销售
  919. optionType: 'JK', //区分贸易类型
  920. billNoList: Array.from(new Set(this.contactsData.map(item => { return item.billNo }))),
  921. amount: this.form.orderAmount,
  922. belongToCorpId: this.form.belongToCorpId,
  923. price: this.form.salesPrice,
  924. corpsName: this.form.corpsName,
  925. corpId: this.form.corpId,
  926. accDate: this.form.businesDate,
  927. currency: this.form.currency,
  928. exchangeRate: this.form.exchangeRate,
  929. srcParentId: this.form.id,
  930. }
  931. if (bool) { //申请货款
  932. this.billData.srcId = -1
  933. }
  934. },
  935. // 付款
  936. applyPayment(type) {
  937. if (this.verificationData()) {
  938. this.beforeBillData(true, type);
  939. this.financialAccountDialog = true;
  940. }
  941. },
  942. //请核
  943. auditCheck() {
  944. if (this.verificationData()) {
  945. let orderFeesList = this.$refs.feeInfo.submitData();
  946. let receivableList = []; //应收
  947. let copeWithList = []; //应付
  948. orderFeesList.forEach(item => {
  949. if (item.isCheck == "0" && item.feesType == "1") {
  950. receivableList.push(item)
  951. }
  952. if (item.isCheck == "0" && item.feesType == "2") {
  953. copeWithList.push(item)
  954. }
  955. })
  956. // if(receivableList.length!=0 || copeWithList.length!=0 ){
  957. // this.$confirm("有未提交的费用,系统将自动提交,确定要提交吗??", {
  958. // confirmButtonText: "确定",
  959. // cancelButtonText: "取消",
  960. // type: "warning"
  961. // }).then(()=>{
  962. // for(let i=0;i<receivableList.length;i++){
  963. // if(receivableList[i].corpId != this.selectionList[0].corpId){
  964. // return this.$message.error('批量操作结算单位必须一致')
  965. // }
  966. // }
  967. // for(let i=0;i<copeWithList.length;i++){
  968. // if(copeWithList[i].corpId != this.selectionList[0].corpId){
  969. // return this.$message.error('批量操作结算单位必须一致')
  970. // }
  971. // }
  972. //
  973. // this.selectionList.map(item =>{
  974. // // item.url = this.billUrl
  975. // item.srcOrderno = params.srcOrderno
  976. // item.srcParentId = params.parentId
  977. // item.corpsName = item.corpName
  978. // item.srcFeesId = item.id
  979. // item.costType = item.itemId
  980. // item.itemType = this.itemType
  981. // item.optionType = this.optionType
  982. // item.srcType = this.srcType //费用明细申请
  983. // item.tradeType = this.optionType
  984. // })
  985. // let data = {
  986. // billType: type,
  987. // itemsList : this.selectionList,
  988. // }
  989. // if(type === '申请'){
  990. // this.$confirm("您确定申请付费吗?", "提示", {
  991. // confirmButtonText: "确定",
  992. // cancelButtonText: "取消",
  993. // type: "warning",
  994. // }).then(()=>{
  995. // this.buttonLoading = true
  996. //
  997. // data.checkType = 'ffsq'
  998. // data.url = '/financialManagement/paymentRequest/index'
  999. // data.pageStatus = 'this.$store.getters.pqStatus'
  1000. // data.pageLabel = '付费申请'
  1001. //
  1002. // applyLoan(data).then(res=>{
  1003. // if(res.data.success){
  1004. // this.$message.success("操作成功!")
  1005. // this.$emit("afterFinance")
  1006. // }
  1007. // }).finally(()=>{
  1008. // this.buttonLoading = false
  1009. // })
  1010. // })
  1011. // }else{
  1012. // this.$confirm("您确定生成账单吗?", "提示", {
  1013. // confirmButtonText: "确定",
  1014. // cancelButtonText: "取消",
  1015. // type: "warning",
  1016. // }).then(()=>{
  1017. // this.buttonLoading = true
  1018. // paymentApply(data).then(res=>{
  1019. // if(res.data.success){
  1020. // this.$message.success("操作成功!")
  1021. // this.$emit("afterFinance")
  1022. // }
  1023. // }).finally(()=>{
  1024. // this.buttonLoading = false
  1025. // })
  1026. // })
  1027. // }
  1028. // })
  1029. // }else{
  1030. this.$confirm("确定审核此订单?", {
  1031. confirmButtonText: "确定",
  1032. cancelButtonText: "取消",
  1033. type: "warning"
  1034. }).then(() => {
  1035. this.buttonLoading = true
  1036. const data = {
  1037. id: this.form.id,
  1038. checkType: 'cgqh',
  1039. url: '/purchase/contract/index',
  1040. pageStatus: "this.$store.getters.entranceCgStatus",
  1041. pageLabel: "采购订单",
  1042. checkFlag: 1,
  1043. }
  1044. pleaseCheck(data).then(res => {
  1045. if (res.data.success) {
  1046. this.$message.success("操作成功!")
  1047. this.viewDisabled = true
  1048. this.approverDisabled = true
  1049. }
  1050. })
  1051. }).finally(() => {
  1052. this.buttonLoading = false
  1053. })
  1054. // }
  1055. }
  1056. },
  1057. repealCancel(){
  1058. this.$confirm("您确定撤回此次申请吗?", {
  1059. confirmButtonText: "确定",
  1060. cancelButtonText: "取消",
  1061. type: "warning"
  1062. }).then(() => {
  1063. this.buttonLoading = true
  1064. const data = {
  1065. id : this.form.id,
  1066. checkType: 'cgqh',
  1067. pageLabel:"采购订单",
  1068. checkFlag: 2,
  1069. }
  1070. repealPurchase(data).then(res=>{
  1071. this.viewDisabled = true
  1072. this.approverDisabled = true
  1073. this.buttonLoading = false
  1074. }).finally(() => {
  1075. this.buttonLoading = false
  1076. })
  1077. })
  1078. },
  1079. //新增商品明细保存触发
  1080. rowSave(row, done, loading) {
  1081. // this.contactsData.push(row)
  1082. done()
  1083. },
  1084. //修改商品信息触发
  1085. rowUpdate(row, index, done, loading) {
  1086. done(row);
  1087. },
  1088. //删除商品信息触发
  1089. rowDel(row, index, donerowDel) {
  1090. this.$confirm("确定将选择数据删除?", {
  1091. confirmButtonText: "确定",
  1092. cancelButtonText: "取消",
  1093. type: "warning"
  1094. }).then(() => {
  1095. //商品判断是否需要调用删除接口
  1096. if (row.id) {
  1097. corpsattn(row.id).then(res => {
  1098. this.$message({
  1099. type: "success",
  1100. message: "操作成功!"
  1101. });
  1102. this.contactsData.splice(index, 1);
  1103. })
  1104. } else {
  1105. this.$message({
  1106. type: "success",
  1107. message: "操作成功!"
  1108. });
  1109. this.contactsData.splice(index, 1);
  1110. }
  1111. }).finally(() => {
  1112. this.totalChange()
  1113. })
  1114. },
  1115. //关闭账单
  1116. choceFun() {
  1117. this.financialAccountDialog = false
  1118. },
  1119. //打开申请记录
  1120. openApplicationDialog() {
  1121. this.applicationDialog = true
  1122. },
  1123. //关闭申记录
  1124. choceApplication() {
  1125. this.applicationDialog = false
  1126. },
  1127. //商品编辑
  1128. rowCell(row, index) {
  1129. this.$refs.crudContact.rowCell(row, index)
  1130. },
  1131. //录入明细
  1132. commoditySelection() {
  1133. const params = {
  1134. price: this.form.salesPrice,
  1135. cntrNum: 1,
  1136. }
  1137. this.$refs.crudContact.rowCellAdd(params);
  1138. },
  1139. //点击行可编辑
  1140. handleRowClick(row, event, column) {
  1141. },
  1142. //关闭审核
  1143. choceCheckFun() {
  1144. this.checkDialog = false;
  1145. },
  1146. choceScheduleFun() {
  1147. this.checkScheduleDialog = false
  1148. },
  1149. verificationData() {
  1150. this.orderFeesList = this.$refs.feeInfo.submitData();
  1151. if (contrastObj(this.form, this.oldForm) || contrastList(this.contactsData, this.oldContactsData)
  1152. || contrastList(this.orderFeesList, this.oldFeesList) || contrastList(this.orderFilesList, this.oldFilesList)
  1153. ) {
  1154. this.$confirm("数据发生变化,请先提交保存!", "提示", {
  1155. confirmButtonText: "保存",
  1156. cancelButtonText: "取消",
  1157. type: "warning",
  1158. }).then(() => {
  1159. this.editCustomer()
  1160. }).catch(() => {
  1161. return false
  1162. })
  1163. } else {
  1164. return true
  1165. }
  1166. },
  1167. createData() {
  1168. if (this.verificationData()) {
  1169. this.$confirm("确定创建新的单据吗?", "提示", {
  1170. confirmButtonText: "保存",
  1171. cancelButtonText: "取消",
  1172. type: "warning",
  1173. }).then(() => {
  1174. this.form = {}
  1175. this.oldForm = {}
  1176. this.contactsData = []
  1177. this.oldContactsData = []
  1178. this.orderFeesList = []
  1179. this.oldFeesList = []
  1180. this.orderFilesList = []
  1181. this.oldFilesList = []
  1182. })
  1183. }
  1184. },
  1185. download() {
  1186. window.open(`/api/trade-purchase/purchase-order/exportPrice?${this.website.tokenHeader
  1187. }=${getToken()}`);
  1188. },
  1189. copyData() {
  1190. if (this.verificationData()) {
  1191. this.takeDisabled = false
  1192. this.basicData.column.forEach(item => {
  1193. if (item.prop == "businesDate" || item.prop == "requiredDeliveryDate" || item.prop == "requiredArrivalDate" || item.prop == "latestDate" || item.prop == "") {
  1194. item.disabled = this.takeDisabled
  1195. }
  1196. })
  1197. delete this.form.id //删除id
  1198. this.$set(this.form, "sysNo", "")//系统编号
  1199. this.$set(this.form, "orderNo", "")//合同号
  1200. this.$set(this.form, "settlmentAmount", "")//已付人民币
  1201. this.$set(this.form, "foreignSettlmentAmount", "")//已付外币
  1202. this.$set(this.form, "refundSettlmentAmount", "")//已退人民币
  1203. this.$set(this.form, "refundForeignSettlmentAmount", "")//已退外币
  1204. this.contactsData.forEach(item => {
  1205. delete item.id //删除id
  1206. item.actualQuantity = "" //已收件数
  1207. item.actualWeight = "" //已收发票
  1208. })
  1209. this.orderFeesList.forEach(item => {
  1210. delete item.id //删除id
  1211. })
  1212. this.oldForm = {}
  1213. this.oldContactsData = []
  1214. this.oldFeesList = []
  1215. this.oldFilesList = []
  1216. this.$message.success("复制成功!")
  1217. }
  1218. },
  1219. async openEdit() {
  1220. if (this.approverDisabled || this.form.status != 0) { //是否审批
  1221. this.$message.warning("此订单已提交审批,不可编辑!")
  1222. return
  1223. }
  1224. //标签页保存key
  1225. this.inDetailsKey(this.$route.name, this.detailData.lockData);
  1226. //单据是否锁定
  1227. if (!await this.checkLocks(this.detailData.lockData)) {
  1228. this.onLock(this.detailData.lockData); //上锁
  1229. this.viewDisabled = false
  1230. } else {
  1231. this.$message.warning('此单据已被锁定,请稍后再进行操作!')
  1232. }
  1233. },
  1234. backToList() {
  1235. //编辑按钮存在 直接返回
  1236. if (this.viewDisabled || !this.detailData.lockData) {
  1237. this.$emit("goBack");
  1238. return
  1239. }
  1240. this.orderFeesList = this.$refs.feeInfo.submitData();
  1241. if (contrastObj(this.form, this.oldForm) || contrastList(this.contactsData, this.oldContactsData)
  1242. || contrastList(this.orderFeesList, this.oldFeesList) || contrastList(this.orderFilesList, this.oldFilesList)
  1243. ) {
  1244. this.$confirm("数据发生变化,请先提交保存!", "提示", {
  1245. confirmButtonText: "保存",
  1246. cancelButtonText: "取消",
  1247. type: "warning",
  1248. }).then(() => {
  1249. this.editCustomer(true)
  1250. }).catch(() => {
  1251. this.$emit("goBack");
  1252. }).finally(() => {
  1253. if (this.form.id) {
  1254. this.unLock(this.detailData.lockData);
  1255. this.leaveDetailsKey(this.$route.name);
  1256. }
  1257. })
  1258. } else {
  1259. this.$emit("goBack");
  1260. if (this.form.id) {
  1261. this.unLock(this.detailData.lockData);
  1262. this.leaveDetailsKey(this.$route.name);
  1263. }
  1264. }
  1265. },
  1266. //文件上传时
  1267. uploading(event, file, fileList) {
  1268. this.openFullScreen(false, '文件正在解析中');
  1269. },
  1270. // 商品明细上传成功钩子
  1271. importTemplate(res, file) {
  1272. this.openFullScreen(true)
  1273. res.data.forEach(item => {
  1274. const params = {
  1275. ...item,
  1276. itemType:item.specificationAndModel,
  1277. cntrNo:item.containerNo,
  1278. orderQuantity:item.number,
  1279. cntrType:item.cntrType?String(item.cntrType):null,
  1280. }
  1281. this.$refs.crudContact.rowCellAdd(params)
  1282. })
  1283. },
  1284. uploadError(err, file, fileList){
  1285. let myError = err.toString();
  1286. myError= myError.replace("Error: ","")
  1287. myError= JSON.parse(myError);
  1288. this.$message.error(myError.msg)
  1289. this.openFullScreen(true)
  1290. },
  1291. openFullScreen(res, text) {
  1292. const loading = this.$loading({
  1293. lock: true,
  1294. text: text,
  1295. spinner: 'el-icon-loading',
  1296. background: 'rgba(0, 0, 0, 0.7)'
  1297. });
  1298. if (res === true) loading.close();
  1299. },
  1300. //列保存触发
  1301. async saveColumn() {
  1302. const inSave = await this.saveColumnData(
  1303. this.getColumnName(37),
  1304. this.customerContact
  1305. );
  1306. if (inSave) {
  1307. this.$message.success("保存成功");
  1308. //关闭窗口
  1309. this.$refs.crudContact.$refs.dialogColumn.columnBox = false;
  1310. }
  1311. },
  1312. async resetColumn() {
  1313. const inSave = await this.delColumnData(
  1314. this.getColumnName(36),
  1315. customerContact
  1316. );
  1317. if (inSave) {
  1318. this.$message.success("重置成功");
  1319. this.customerContact = customerContact;
  1320. //关闭窗口
  1321. this.$refs.crudContact.$refs.dialogColumn.columnBox = false;
  1322. }
  1323. },
  1324. cellStyle() {
  1325. return "padding:0;height:40px;";
  1326. },
  1327. },
  1328. }
  1329. </script>
  1330. <style scoped lang="scss">
  1331. .upper_right_button {
  1332. display: flex;
  1333. position: fixed;
  1334. right: 12px;
  1335. top: 47px;
  1336. align-items: flex-start;
  1337. }
  1338. .required_fields {
  1339. color: #F56C6C;
  1340. display: inline-block;
  1341. width: 7%
  1342. }
  1343. ::v-deep .el-form-item {
  1344. margin-bottom: 0;
  1345. }
  1346. //el-icon-plus avue-upload__icon
  1347. .avue-upload /deep/ .avue-upload__icon {
  1348. line-height: 178px !important;
  1349. }
  1350. ::v-deep .el-form-item__content {
  1351. line-height: 32px;
  1352. }
  1353. </style>