detailsPage.vue 52 KB

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