detailsPage.vue 41 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976
  1. <template>
  2. <div>
  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(0)">返回列表
  7. </el-button>
  8. </div>
  9. <div class="add-customer-btn">
  10. <el-button class="el-button&#45;&#45;small-yh" style="margin-left: 6px;" type="primary" size="small"
  11. v-if="!editButton" @click="confirmEditing">编 辑
  12. </el-button>
  13. <el-button class="el-button--small-yh" style="margin-left: 6px;" type="primary" size="small"
  14. @click="editCustomer">保 存
  15. </el-button>
  16. <el-button class="el-button--small-yh" style="margin-left: 6px;" type="success" size="small"
  17. v-if="form.generateTask !== '已生成'" @click="generateOutbound">生成任务
  18. </el-button>
  19. <el-dropdown style="padding: 0 6px;line-height: 0">
  20. <el-button type="danger" :loading="buttonLoading" :disabled="!form.id || viewDisabled" size="small">
  21. 售 后<i class="el-icon-arrow-down el-icon--right"></i>
  22. </el-button>
  23. <el-dropdown-menu slot="dropdown">
  24. <el-dropdown-item @click.native="applySettlement('申请')" :disabled="isApplySettlement">申请退款
  25. </el-dropdown-item>
  26. <el-dropdown-item @click.native="confirmRefundBtn('确认')" :disabled="isConfirmRefundBtn">确认退款
  27. </el-dropdown-item>
  28. </el-dropdown-menu>
  29. </el-dropdown>
  30. <el-dropdown style="line-height: 0">
  31. <el-button type="warning" :loading="buttonLoading" :disabled="!form.id || viewDisabled" size="small">
  32. 审 批<i class="el-icon-arrow-down el-icon--right"></i>
  33. </el-button>
  34. <el-dropdown-menu slot="dropdown">
  35. <el-dropdown-item @click.native="examineBtn('审批')" :disabled="isExamineBtn">审批
  36. </el-dropdown-item>
  37. <el-dropdown-item @click.native="checkScheduleDialog = true, checkId = form.id">请核进度
  38. </el-dropdown-item>
  39. <el-dropdown-item @click.native="revocationRequest('撤销')" :disabled="isRevocationRequest">撤销请核
  40. </el-dropdown-item>
  41. </el-dropdown-menu>
  42. </el-dropdown>
  43. </div>
  44. </div>
  45. <div style="margin-top: 50px">
  46. <trade-card title="基础信息">
  47. <avue-form :option="optionForm" v-model="form" ref="form">
  48. <template slot-scope="{row,index}" slot="contacts">
  49. <el-select v-model="form.contacts" placeholder="请选择" size="small" style="width:60%" filterable
  50. @change="contactsChange($event)">
  51. <el-option v-for="item in contactsOption" :key="item.id" :label="item.contacts"
  52. :value="item.contacts" />
  53. </el-select>
  54. </template></avue-form>
  55. </trade-card>
  56. <trade-card title="明细信息">
  57. <el-tabs v-model="activeName" type="card">
  58. <el-tab-pane label="销售明细" name="sale_detail">
  59. <avue-crud :option="optionContacts" v-model="formContacts" ref="formContacts"
  60. :data="form.orderItemsList" :key="key" @row-save="rowSave" @row-update="rowUpdate"
  61. @resetColumn="resetColumnTwo('formContacts', 'optionContacts', 'optionContactsBack', 269.1)"
  62. @saveColumn="saveColumnTwo('formContacts', 'optionContacts', 'optionContactsBack', 269.1)">
  63. <template slot-scope="scope" slot="menuLeft">
  64. <el-button type="primary" icon="el-icon-printer" size="small"
  65. @click="handlePrint">打印</el-button>
  66. </template>
  67. <template slot-scope="{type,size,row,index,disabled}" slot="menu">
  68. <el-button :size="size" :disabled="disabled" :type="type"
  69. :icon="row.$cellEdit ? 'el-icon-plus' : 'el-icon-edit'"
  70. @click="$refs.formContacts.rowEdit(row, index)">编辑
  71. </el-button>
  72. <el-button icon="el-icon-delete" :size="size" :disabled="disabled || isDisabled"
  73. :type="type" @click="rowDelBox(row, index, 'orderItemsList')">删除
  74. </el-button>
  75. </template>
  76. </avue-crud>
  77. </el-tab-pane>
  78. <el-tab-pane label="支付明细" name="payment_details">
  79. <avue-crud :option="optionPaymentDetails" v-model="formContacts" ref="payment_details"
  80. :data="form.paymentRecordsList" @row-save="rowSave" @row-update="rowUpdate"
  81. @resetColumn="resetColumnTwo('payment_details', 'optionPaymentDetails', 'optionPaymentDetailsBack', 269.2)"
  82. @saveColumn="saveColumnTwo('payment_details', 'optionPaymentDetails', 'optionPaymentDetailsBack', 269.2)">
  83. <template slot-scope="{type,size,row,index,disabled}" slot="menu">
  84. <el-button :size="size" :disabled="disabled" :type="type"
  85. :icon="row.$cellEdit ? 'el-icon-plus' : 'el-icon-edit'"
  86. @click="$refs.formContacts.rowCell(row, index)">{{ row.$cellEdit ? '确认' : '修改' }}
  87. </el-button>
  88. <el-button icon="el-icon-delete" :size="size" :disabled="disabled" :type="type"
  89. @click="rowDelBox(row, index, 'paymentRecordsList')">删除
  90. </el-button>
  91. </template>
  92. </avue-crud>
  93. </el-tab-pane>
  94. <el-tab-pane label="出库记录" name="outbound_records">
  95. <avue-crud :option="optionOutboundRecords" v-model="formContacts" ref="outbound_records"
  96. :data="form.outboundRecordsList" @row-save="rowSave" @row-update="rowUpdate"
  97. @resetColumn="resetColumnTwo('outbound_records', 'optionOutboundRecords', 'optionOutboundRecordsBack', 269.3)"
  98. @saveColumn="saveColumnTwo('outbound_records', 'optionOutboundRecords', 'optionOutboundRecordsBack', 269.3)">
  99. <template slot-scope="{type,size,row,index,disabled}" slot="menu">
  100. <el-button :size="size" :disabled="disabled" :type="type"
  101. :icon="row.$cellEdit ? 'el-icon-plus' : 'el-icon-edit'"
  102. @click="$refs.formContacts.rowCell(row, index)">{{ row.$cellEdit ? '确认' : '修改' }}
  103. </el-button>
  104. <el-button icon="el-icon-delete" :size="size" :disabled="disabled" :type="type"
  105. @click="rowDelBox(row, index)">删除
  106. </el-button>
  107. </template>
  108. </avue-crud>
  109. </el-tab-pane>
  110. </el-tabs>
  111. </trade-card>
  112. <report-dialog :switchDialog="switchDialog" @onClose="onClose()"></report-dialog>
  113. <el-dialog append-to-body title="审批" class="el-dialogDeep" :visible.sync="checkDialog" width="50%"
  114. :close-on-click-modal="false" :destroy-on-close="true" :close-on-press-escape="false" v-dialog-drag>
  115. <check :checkData="checkData" :checkDetail="true" :idList="[]" @operationType="operationType"
  116. @choceCheckFun="choceCheckFun">
  117. </check>
  118. </el-dialog>
  119. <el-dialog append-to-body title="审批进度" class="el-dialogDeep" :visible.sync="checkScheduleDialog" width="40%"
  120. :close-on-click-modal="false" :destroy-on-close="true" :close-on-press-escape="false" v-dialog-drag>
  121. <check-schedule :checkId="checkId" :batchNo="batchNo" @choceScheduleFun="choceScheduleFun"></check-schedule>
  122. </el-dialog>
  123. </div>
  124. </div>
  125. </template>
  126. <script>
  127. import { getDetails as getCustom } from "@/api/tirePartsMall/basicData/customerInformation"
  128. import { getDetails, submit, generateShipTask, tradingBox, delOrderItem, checkOrder, confirmRefund, revokeCheckOrder } from "@/api/tirePartsMall/salesManagement/saleOrder";
  129. import { dotList, goodsDetail } from "@/api/tirePartsMall/purchasingManagement/warehouseEntryOrder";
  130. import reportDialog from "@/components/report-dialog/main";
  131. import checkSchedule from "@/components/check/checkSchedule";
  132. import check from "@/components/check/check";
  133. export default {
  134. name: "detailsPage",
  135. data() {
  136. return {
  137. isDisabled: false,
  138. contactsOption: [],
  139. checkData: {},
  140. checkScheduleDialog: false,
  141. isApplySettlement: true,
  142. isConfirmRefundBtn: true,
  143. isExamineBtn: true,
  144. isRevocationRequest: true,
  145. checkDialog: false,
  146. checkId: '',
  147. batchNo: '',
  148. switchDialog: false,
  149. activeName: "sale_detail",
  150. disabled: false,
  151. key: 0,
  152. form: {
  153. orderItemsList: [],
  154. paymentRecordsList: [],
  155. outboundRecordsList: []
  156. },
  157. optionForm: {
  158. menuBtn: false,
  159. span: 8,
  160. column: [{
  161. label: '客户',
  162. prop: "customerId",
  163. disabled: false,
  164. type: 'select',
  165. props: {
  166. label: 'cname',
  167. value: 'id'
  168. },
  169. cascader: ['recAddress'],
  170. change: (data) => {
  171. console.log(data.value);
  172. if (data.value) {
  173. getCustom({ id: data.value }).then(res => {
  174. console.log(res.data.data);
  175. this.form.storageId = res.data.data.deliveryWarehouseId
  176. this.form.contacts = res.data.data.corpsAttnList[0].cname
  177. this.form.phone = res.data.data.corpsAttnList[0].tel
  178. this.contactsOption = res.data.data.corpsAddrList
  179. this.form.recAddress = res.data.data.corpsAddrList[0].id
  180. this.form.businessSource = '内部销售'
  181. })
  182. }
  183. // if (this.$refs.form.DIC.customerId || data.value) {
  184. // for (let item of this.$refs.form.DIC.customerId) {
  185. // if (item.id == data.value) {
  186. // console.log(data);
  187. // console.log(this.$refs.form);
  188. // console.log(item);
  189. // // 后端返回数据暂无联系人、地址等数据,无法下拉默认
  190. // this.form.phone = item.tel
  191. // }
  192. // }
  193. // }
  194. },
  195. dicUrl: '/api/blade-sales-part/corpsDesc/listAll?corpType=KH',
  196. rules: [{
  197. required: true,
  198. message: " ",
  199. trigger: "blur"
  200. }]
  201. }, {
  202. label: '仓库',
  203. prop: "storageId",
  204. type: 'select',
  205. props: {
  206. label: 'cname',
  207. value: 'id'
  208. },
  209. dicUrl: '/api/blade-sales-part/storageDesc/listAll',
  210. rules: [{
  211. required: true,
  212. message: " ",
  213. trigger: "blur"
  214. }]
  215. }, {
  216. label: '单据编号',
  217. prop: "ordNo",
  218. disabled: true
  219. }, {
  220. label: '来源单号',
  221. prop: "srcOrdNo",
  222. disabled: true
  223. }, {
  224. label: '业务来源',
  225. prop: "businessSource",
  226. disabled: true
  227. }, {
  228. label: '应收类别',
  229. prop: "receivableType",
  230. type: "select",
  231. dicUrl: "/api/blade-system/dict-biz/dictionary?code=receivableType",
  232. props: {
  233. label: "dictValue",
  234. value: "dictValue"
  235. },
  236. value: '网络支付'
  237. }, {
  238. label: '联系人',
  239. type: "select",
  240. prop: "contacts",
  241. props: {
  242. label: 'address',
  243. value: 'id'
  244. },
  245. dicUrl: '/api/blade-sales-part/corpsAddr/corpIdByAddr?pid={{key}}'
  246. }, {
  247. label: '电话',
  248. prop: "phone",
  249. }, {
  250. label: '收货地址',
  251. prop: "recAddress",
  252. type: 'select',
  253. disabled: true,
  254. props: {
  255. label: 'address',
  256. value: 'id'
  257. },
  258. dicUrl: '/api/blade-sales-part/corpsAddr/corpIdByAddr?pid={{key}}'
  259. }, {
  260. label: '配送方式',
  261. type: 'select',
  262. prop: "shipType",
  263. dicUrl: "/api/blade-system/dict-biz/dictionary?code=deliveryMethod",
  264. props: {
  265. label: "dictValue",
  266. value: "dictValue"
  267. },
  268. value: '物流'
  269. }, {
  270. label: '物流公司',
  271. prop: "logisticsCorpName"
  272. }, {
  273. label: '成本',
  274. prop: "cost",
  275. disabled: true
  276. }, {
  277. label: '毛利',
  278. prop: "grossProfit",
  279. disabled: true
  280. }, {
  281. label: '销售金额',
  282. prop: "salesAmount",
  283. disabled: true
  284. }, {
  285. label: '运费',
  286. prop: "freight",
  287. disabled: true
  288. }, {
  289. label: '总金额',
  290. prop: "totalMoney",
  291. disabled: true
  292. }, {
  293. label: '备注',
  294. prop: "remarks",
  295. type: 'textarea',
  296. span: 16,
  297. minRows: 1
  298. }]
  299. },
  300. formContacts: {},
  301. optionContacts: {},
  302. optionContactsBack: {
  303. disabled: false,
  304. border: true,
  305. align: 'center',
  306. index: true,
  307. showSummary: true,
  308. sumColumnList: [
  309. {
  310. name: 'goodsNum',
  311. type: 'sum',
  312. },
  313. {
  314. name: 'sendNum',
  315. type: 'sum',
  316. },
  317. {
  318. name: 'subTotalMoney',
  319. type: 'sum',
  320. },
  321. {
  322. name: 'costprie',
  323. type: 'sum',
  324. },
  325. {
  326. name: 'grossProfit',
  327. type: 'sum',
  328. }
  329. ],
  330. addBtnText: "录入明细",
  331. refreshBtn: false,
  332. dialogDrag: true,
  333. addBtn: true,
  334. span: 8,
  335. height: 500,
  336. addRowBtn: false,
  337. editBtn: false,
  338. delBtn: false,
  339. menuWidth: 140,
  340. dialogTop: 25,
  341. dialogWidth: "80%",
  342. // summaryText: "合计",
  343. // showSummary: true,
  344. // sumColumnList:[{
  345. // name: "goodsNum",
  346. // type: "sum",
  347. // decimals: 2
  348. // },{
  349. // name: "sendNum",
  350. // type: "sum",
  351. // decimals: 2
  352. // },{
  353. // name: "profit",
  354. // type: "sum",
  355. // decimals: 2
  356. // },{
  357. // name: "subTotalMoney",
  358. // type: "sum",
  359. // decimals: 2
  360. // },{
  361. // name: "thisAmount",
  362. // type: "sum",
  363. // decimals: 2
  364. // },{
  365. // name: "costprie",
  366. // type: "sum",
  367. // decimals: 2
  368. // },{
  369. // name: "grossProfit",
  370. // type: "sum",
  371. // decimals: 2
  372. // }],
  373. column: [{
  374. label: '商品名称',
  375. prop: 'goodsId',
  376. width: 200,
  377. disabled: false,
  378. remote: true,
  379. overHidden: true,
  380. type: 'select',
  381. props: {
  382. label: 'cname',
  383. value: 'id'
  384. },
  385. dicUrl: '/api/blade-sales-part/goodsDesc/goodsListAll?cname={{key}}'
  386. }, {
  387. label: '物料编码',
  388. prop: 'goodsNo',
  389. overHidden: true,
  390. disabled: false,
  391. width: 100
  392. }, {
  393. label: '品牌',
  394. prop: 'brandId',
  395. disabled: false,
  396. width: 100,
  397. overHidden: true,
  398. type: 'select',
  399. props: {
  400. label: 'cname',
  401. value: 'id'
  402. },
  403. dicUrl: '/api/blade-sales-part/brandDesc/listAll'
  404. }, {
  405. label: '规格型号',
  406. prop: 'propertyName',
  407. overHidden: true,
  408. disabled: false,
  409. width: 100
  410. }, {
  411. label: '花纹',
  412. prop: 'pattern',
  413. overHidden: true,
  414. disabled: false,
  415. width: 100
  416. }, {
  417. label: '商品描述',
  418. prop: 'goodsDescription',
  419. disabled: false,
  420. overHidden: true,
  421. width: 100
  422. },
  423. {
  424. label: '单位',
  425. prop: 'units',
  426. type: "select",
  427. disabled: false,
  428. props: {
  429. label: "dictValue",
  430. value: "dictValue"
  431. },
  432. dicUrl: "/api/blade-system/dict-biz/dictionary?code=unit",
  433. overHidden: true,
  434. width: 100
  435. }, {
  436. label: '批次号',
  437. prop: 'dot',
  438. type: "select",
  439. disabled: true,
  440. allowCreate: true,
  441. filterable: true,
  442. dicData: [],
  443. props: {
  444. label: "dot",
  445. value: "dot"
  446. },
  447. dicUrl: "/api/blade-sales-part/stockDesc/dotList",
  448. overHidden: true,
  449. },
  450. {
  451. label: '数量',
  452. prop: 'goodsNum',
  453. overHidden: true,
  454. disabled: false,
  455. width: 100,
  456. rules: [{
  457. required: true,
  458. message: " ",
  459. trigger: "blur"
  460. }]
  461. },
  462. {
  463. label: '价格',
  464. prop: 'price',
  465. overHidden: true,
  466. width: 100,
  467. disabled: false,
  468. rules: [{
  469. required: true,
  470. message: " ",
  471. trigger: "blur"
  472. }]
  473. },
  474. {
  475. label: '发货数量',
  476. prop: 'sendNum',
  477. disabled: false,
  478. overHidden: true,
  479. width: 100,
  480. disabled: true,
  481. editDisplay: false,
  482. addDisplay: false
  483. },
  484. // {
  485. // label: '利润',
  486. // prop: 'profit',
  487. // overHidden: true,
  488. // width: 100
  489. // },
  490. {
  491. label: '小计',
  492. prop: 'subTotalMoney',
  493. overHidden: true,
  494. width: 100,
  495. disabled: true,
  496. editDisplay: false,
  497. addDisplay: false
  498. },
  499. // {
  500. // label: '返利',
  501. // prop: 'thisAmount',
  502. // overHidden: true,
  503. // width: 100
  504. // },
  505. {
  506. label: '成本',
  507. prop: 'costprie',
  508. overHidden: true,
  509. width: 100,
  510. disabled: true,
  511. editDisplay: false,
  512. addDisplay: false
  513. },
  514. {
  515. label: '毛利',
  516. prop: 'grossProfit',
  517. overHidden: true,
  518. width: 100,
  519. disabled: true,
  520. editDisplay: false,
  521. addDisplay: false
  522. },
  523. {
  524. label: '备注',
  525. prop: "remarks",
  526. overHidden: true,
  527. width: 100,
  528. disabled: false,
  529. }
  530. ]
  531. },
  532. optionPaymentDetails: {},
  533. optionPaymentDetailsBack: {
  534. align: 'center',
  535. index: true,
  536. addBtnText: "录入明细",
  537. refreshBtn: false,
  538. dialogDrag: true,
  539. addBtn: false,
  540. span: 8,
  541. height: 600,
  542. addRowBtn: false,
  543. editBtn: false,
  544. delBtn: false,
  545. menuWidth: 140,
  546. dialogTop: 25,
  547. dialogWidth: "80%",
  548. column: [{
  549. label: '支付编号',
  550. prop: 'paymentNumber'
  551. }, {
  552. label: '金额',
  553. prop: 'amount'
  554. }, {
  555. label: '类型',
  556. prop: 'paymentType'
  557. }, {
  558. label: '支付时间',
  559. prop: 'paymentTime'
  560. }]
  561. },
  562. optionOutboundRecords: {},
  563. optionOutboundRecordsBack: {
  564. align: 'center',
  565. index: true,
  566. addBtnText: "录入明细",
  567. refreshBtn: false,
  568. dialogDrag: true,
  569. addBtn: false,
  570. span: 8,
  571. height: 600,
  572. addRowBtn: false,
  573. editBtn: false,
  574. delBtn: false,
  575. menuWidth: 140,
  576. dialogTop: 25,
  577. dialogWidth: "80%",
  578. column: [{
  579. label: '出库单号',
  580. prop: 'billno'
  581. }, {
  582. label: '来源单号',
  583. prop: 'ordNo'
  584. }, {
  585. label: '数量',
  586. prop: 'goodsTotalNum'
  587. }, {
  588. label: '状态',
  589. prop: 'statusName'
  590. }, {
  591. label: '业务时间',
  592. prop: 'createTime'
  593. }]
  594. }
  595. }
  596. },
  597. components: { reportDialog, check, checkSchedule },
  598. props: {
  599. onLoad: Object,
  600. detailData: Object
  601. },
  602. async created() {
  603. this.findObject(this.optionContactsBack.column, "goodsId").change = ({ value, column }) => {
  604. if (this.formContacts.goodsId !== value) {
  605. goodsDetail({ id: value }).then(res => {
  606. this.formContacts.goodsNo = res.data.data.code
  607. this.formContacts.brandId = res.data.data.brandId
  608. this.formContacts.propertyName = res.data.data.specificationAndModel
  609. this.formContacts.pattern = res.data.data.brandItem
  610. this.formContacts.goodsDescription = res.data.data.goodsDescription
  611. this.formContacts.units = res.data.data.unit
  612. if (res.data.data.whether == 0) {
  613. this.findObject(this.optionContactsBack.column, "dot").disabled = true
  614. } else {
  615. this.findObject(this.optionContactsBack.column, "dot").disabled = false
  616. dotList({
  617. storageId: this.form.storageId,
  618. goodsId: this.formContacts.goodsId
  619. }).then(res => {
  620. this.findObject(this.optionContactsBack.column, "dot").dicData = res.data.data
  621. })
  622. }
  623. })
  624. }
  625. }
  626. this.optionContacts = await this.getColumnData(this.getColumnName(269.1), this.optionContactsBack);
  627. console.log('this.optionContacts.column', this.optionContacts.column);
  628. this.findObject(this.optionContacts.column, "goodsId").change = ({ value, column }) => {
  629. console.log('走i在');
  630. if (this.formContacts.goodsId !== value) {
  631. goodsDetail({ id: value }).then(res => {
  632. this.formContacts.goodsNo = res.data.data.code
  633. this.formContacts.brandId = res.data.data.brandId
  634. this.formContacts.propertyName = res.data.data.specificationAndModel
  635. this.formContacts.pattern = res.data.data.brandItem
  636. this.formContacts.goodsDescription = res.data.data.goodsDescription
  637. this.formContacts.units = res.data.data.unit
  638. if (res.data.data.whether == 0) {
  639. this.findObject(this.optionContacts.column, "dot").disabled = true
  640. } else {
  641. this.findObject(this.optionContacts.column, "dot").disabled = false
  642. dotList({
  643. storageId: this.form.storageId,
  644. goodsId: this.formContacts.goodsId
  645. }).then(res => {
  646. this.findObject(this.optionContacts.column, "dot").dicData = res.data.data
  647. })
  648. }
  649. })
  650. }
  651. }
  652. this.optionPaymentDetails = await this.getColumnData(this.getColumnName(269.2), this.optionPaymentDetailsBack);
  653. this.optionOutboundRecords = await this.getColumnData(this.getColumnName(269.3), this.optionOutboundRecordsBack);
  654. this.key++
  655. if (this.onLoad.id && this.detailData.id) {
  656. console.log(1);
  657. this.refresh(this.onLoad.id, true)
  658. } else if (this.onLoad.id) {
  659. this.refresh(this.onLoad.id, true)
  660. }
  661. if(!this.form.id){
  662. this.$set(this.optionContacts, "addBtn", true)
  663. }
  664. },
  665. methods: {
  666. generateOutbound() {
  667. if (this.form.orderItemsList.length <= 0) {
  668. this.$message.error('请录入明细');
  669. } else {
  670. this.$refs["form"].validate((valid, done) => {
  671. done();
  672. if (valid) {
  673. const loading = this.$loading({
  674. lock: true,
  675. text: '加载中',
  676. spinner: 'el-icon-loading',
  677. background: 'rgba(255,255,255,0.7)'
  678. });
  679. generateShipTask(this.form).then(res => {
  680. this.$message.success("生成出库任务成功");
  681. loading.close();
  682. }).finally(() => {
  683. loading.close();
  684. });
  685. }
  686. })
  687. }
  688. },
  689. //联系人change
  690. contactsChange(e) {
  691. console.log(e);
  692. console.log(this.contactsOption);
  693. // 假设this.contactsOption是你的数组对象
  694. let matchedContact = this.contactsOption.find(item => item.contacts == e);
  695. // 判断是否找到匹配的对象
  696. this.$set(this.form, 'phone', matchedContact.tel)
  697. this.$set(this.form, 'recAddress', matchedContact.belongtoarea + matchedContact.detailedAddress)
  698. },
  699. //修改提交触发
  700. editCustomer() {
  701. this.$refs["form"].validate((valid, done) => {
  702. done();
  703. if (valid) {
  704. const loading = this.$loading({
  705. lock: true,
  706. text: '加载中',
  707. spinner: 'el-icon-loading',
  708. background: 'rgba(255,255,255,0.7)'
  709. });
  710. submit({
  711. bsType: "XS",
  712. ...this.form
  713. }).then(res => {
  714. this.$message.success("保存成功");
  715. this.refresh(res.data.data.id)
  716. loading.close();
  717. }).finally(() => {
  718. loading.close();
  719. });
  720. } else {
  721. return false;
  722. }
  723. });
  724. },
  725. refresh(id, type) {
  726. const loading = this.$loading({
  727. lock: true,
  728. text: '加载中',
  729. spinner: 'el-icon-loading',
  730. background: 'rgba(255,255,255,0.7)'
  731. })
  732. getDetails({ id: id }).then(res => {
  733. console.log('res', res);
  734. this.form = res.data.data
  735. if (this.form.status !== '录入' && this.form.status !== '退款中' && this.form.status !== '已取消' && this.form.status !== '退款请核') {
  736. console.log(1);
  737. this.isApplySettlement = false;
  738. }
  739. if (this.form.status == '退款中' ) {
  740. console.log(2);
  741. this.isConfirmRefundBtn = false;
  742. }
  743. if (this.form.status == '退款请核') {
  744. console.log(3);
  745. this.isExamineBtn = false;
  746. }
  747. console.log(this.form.status == '退款请核' || this.form.status == '退款中');
  748. if (this.form.status == '退款请核' || this.form.status == '退款中') {
  749. console.log(4);
  750. this.isRevocationRequest = false;
  751. }
  752. this.form.orderItemsList.forEach((items) => {
  753. if (!items.subTotalMoney) {
  754. items.subTotalMoney = items.goodsNum * items.price
  755. items.grossProfit = items.subTotalMoney - items.costprie
  756. }
  757. })
  758. loading.close();
  759. if (this.form.businessSource == "外部销售") {
  760. console.log('外部销售');
  761. this.optionForm.column.forEach(its => {
  762. if (its.prop == 'customerId') {
  763. this.$set(its, 'disabled', true)
  764. }
  765. })
  766. //不能录入不能删除
  767. this.$set(this.optionContactsBack, "addBtn", false)
  768. this.isDisabled = true
  769. this.$set(this.form, 'shipType', '物流')
  770. this.$set(this.form, 'receivableType', '网络支付')
  771. this.optionContactsBack.column.forEach(item => {
  772. this.$set(item, 'disabled', true)
  773. if (item.label == '批次号' || item.label == '备注') {
  774. item.disabled = false
  775. }
  776. })
  777. this['optionContacts'] = this['optionContactsBack'];
  778. this.delColumnData(this.getColumnName(269.1), this['optionContactsBack']);
  779. this.optionContactsBack.column.forEach(item => {
  780. if (item.prop == 'dot') {
  781. this.$set(item, disabled, false)
  782. } else {
  783. this.$set(item, disabled, true)
  784. }
  785. })
  786. } else {
  787. this.$set(this.form, 'shipType', '物流')
  788. this.$set(this.form, 'receivableType', '现金')
  789. this.optionContactsBack.column.forEach(item => {
  790. this.$set(item, 'disabled', false)
  791. })
  792. this.optionContactsBack.column.forEach(item => {
  793. if (item.label === '规格型号' || item.label === '花纹' || item.label === '品牌' || item.label === '物料编码' || item.label === '单位' || item.label === '商品描述') {
  794. item.disabled = true;
  795. }
  796. })
  797. console.log(324324);
  798. this['optionContacts'] = this['optionContactsBack'];
  799. this.delColumnData(this.getColumnName(269.1), this['optionContactsBack']);
  800. }
  801. // this.$set(this.form.orderItemsList,'goodsNum',66)
  802. }).catch(() => {
  803. loading.close();
  804. })
  805. },
  806. //请核关闭
  807. choceScheduleFun() {
  808. this.checkScheduleDialog = false
  809. },
  810. //关闭审核
  811. choceCheckFun() {
  812. this.checkDialog = false;
  813. },
  814. //申请退款
  815. applySettlement(type) {
  816. this.$confirm("您确定申请退款吗?", {
  817. confirmButtonText: "确定",
  818. cancelButtonText: "取消",
  819. type: "warning"
  820. }).then(() => {
  821. this.$refs["form"].validate((valid, done) => {
  822. done()
  823. if (valid) {
  824. console.log(this.form);
  825. console.log(this.$store.getters.domSaleStatus);
  826. const data = {
  827. id: this.form.id,
  828. url: '/tirePartsMall/salesManagement/saleOrder/index',
  829. pageStatus: "this.$store.getters.domSaleStatus",
  830. pageLabel: "销售订单",
  831. }
  832. const loading = this.$loading({
  833. lock: true,
  834. text: '加载中',
  835. spinner: 'el-icon-loading',
  836. background: 'rgba(255,255,255,0.7)'
  837. });
  838. checkOrder({ ...data }).then((res) => {
  839. loading.close();
  840. this.$message.success('申请退款成功');
  841. console.log(res);
  842. }).catch(() => { loading.close(); })
  843. }
  844. })
  845. })
  846. },
  847. //确认退款
  848. confirmRefundBtn() {
  849. this.$confirm("您确定退款吗?", {
  850. confirmButtonText: "确定",
  851. cancelButtonText: "取消",
  852. type: "warning"
  853. }).then(() => {
  854. const loading = this.$loading({
  855. lock: true,
  856. text: '加载中',
  857. spinner: 'el-icon-loading',
  858. background: 'rgba(255,255,255,0.7)'
  859. });
  860. confirmRefund({ ...this.form }).then((res) => {
  861. loading.close()
  862. this.$message.success('确定退款成功');
  863. }).catch(() => { loading.close(); })
  864. })
  865. },
  866. //审批
  867. examineBtn() {
  868. console.log(this.$route.query.check);
  869. this.checkData = this.$route.query.check
  870. this.checkDialog = true;
  871. },
  872. //撤销请核
  873. revocationRequest() {
  874. this.$confirm("您确定撤回此次申请吗?", {
  875. confirmButtonText: "确定",
  876. cancelButtonText: "取消",
  877. type: "warning"
  878. }).then(() => {
  879. const loading = this.$loading({
  880. lock: true,
  881. text: '加载中',
  882. spinner: 'el-icon-loading',
  883. background: 'rgba(255,255,255,0.7)'
  884. });
  885. revokeCheckOrder({ ...this.form }).then(res => {
  886. loading.close();
  887. this.$message.success('撤回成功')
  888. this.refresh(this.form.id)
  889. })
  890. })
  891. },
  892. rowDelBox(row, index, type) {
  893. this.$confirm("确定将选择数据删除?", {
  894. confirmButtonText: "确定",
  895. cancelButtonText: "取消",
  896. type: "warning"
  897. }).then(() => {
  898. if (row.id) {
  899. console.log(index);
  900. console.log(this.form.orderItemsList);
  901. delOrderItem({ ids: row.id }).then(res => {
  902. this.form.orderItemsList.splice(index, 1);
  903. this.$message.success("操作成功!");
  904. });
  905. } else {
  906. this.form[type].splice(index, 1);
  907. this.$message.success("操作成功!");
  908. }
  909. }
  910. );
  911. },
  912. rowSave(form, done, loading) {
  913. done(form)
  914. },
  915. rowUpdate(form, index, done, loading) {
  916. done(form)
  917. },
  918. //打印
  919. handlePrint() {
  920. this.switchDialog = !this.switchDialog;
  921. },
  922. onClose(val) {
  923. this.switchDialog = val;
  924. },
  925. //自定义列保存
  926. async saveColumnTwo(ref, option, optionBack, code) {
  927. /**
  928. * 已定义全局方法,直接使用,saveColumnData保存列数据方法,参数传值(表格名称,当前表格的option数据)
  929. * 已定义全局方法,直接使用,getColumnName方法用来获取枚举值,参数根据自己定义的code值获取中文名
  930. * 一定要执行异步操作,要等接口成功返回,才能执行下一行代码
  931. */
  932. const inSave = await this.saveColumnData(this.getColumnName(code), this[option]);
  933. if (inSave) {
  934. this.$message.success("保存成功");
  935. //关闭窗口
  936. this.$refs[ref].$refs.dialogColumn.columnBox = false;
  937. }
  938. },
  939. //自定义列重置
  940. async resetColumnTwo(ref, option, optionBack, code) {
  941. this[option] = this[optionBack];
  942. const inSave = await this.delColumnData(this.getColumnName(code), this[optionBack]);
  943. if (inSave) {
  944. this.$message.success("重置成功");
  945. this.$refs[ref].$refs.dialogColumn.columnBox = false;
  946. }
  947. },
  948. backToList(type) {
  949. this.$emit("backToList", type);
  950. }
  951. }
  952. }
  953. </script>
  954. <style lang="scss" scoped>
  955. ::v-deep .el-form-item {
  956. margin-bottom: 8px !important;
  957. }
  958. </style>