detailsPage.vue 52 KB

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