detailsPage.vue 75 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692
  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" :disabled="isEditButton" style="margin-left: 6px;"
  11. type="primary" size="small" 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. :disabled="isSaveBtn" @click="editCustomer">保 存
  15. </el-button>
  16. <el-button class="el-button--small-yh" style="margin-left: 6px;" :type="buttonColor" size="small"
  17. :disabled="isDisabledTask" @click="generateOutbound">
  18. {{ buttonText }}
  19. </el-button>
  20. <el-dropdown style="padding: 0 6px;line-height: 0">
  21. <el-button type="danger" :loading="buttonLoading" :disabled="!form.id || viewDisabled" size="small">
  22. 售 后<i class="el-icon-arrow-down el-icon--right"></i>
  23. </el-button>
  24. <el-dropdown-menu slot="dropdown">
  25. <el-dropdown-item @click.native="applySettlement('申请')" :disabled="isApplySettlement">申请退款
  26. </el-dropdown-item>
  27. <el-dropdown-item @click.native="confirmRefundBtn('确认')" :disabled="isConfirmRefundBtn">确认退款
  28. </el-dropdown-item>
  29. <el-dropdown-item @click.native="revocationRequest('撤销')" :disabled="isRevocationRequest">撤销请核
  30. </el-dropdown-item>
  31. </el-dropdown-menu>
  32. </el-dropdown>
  33. <el-dropdown style="line-height: 0">
  34. <el-button type="warning" :loading="buttonLoading" :disabled="!form.id || viewDisabled" size="small">
  35. 审 批<i class="el-icon-arrow-down el-icon--right"></i>
  36. </el-button>
  37. <el-dropdown-menu slot="dropdown">
  38. <el-dropdown-item @click.native="examineBtn('审批')" :disabled="isExamineBtn && !detailData.check">审批
  39. </el-dropdown-item>
  40. <el-dropdown-item @click.native="checkScheduleDialog = true, checkId = form.id">请核进度
  41. </el-dropdown-item>
  42. </el-dropdown-menu>
  43. </el-dropdown>
  44. </div>
  45. </div>
  46. <div style="margin-top: 50px">
  47. <trade-card title="基础信息">
  48. <avue-form :option="optionForm" v-model="form" ref="form">
  49. <template slot-scope="{row,index}" slot="contacts">
  50. <el-select v-model="form.contacts" placeholder="请选择" size="small" style="width:60%" filterable
  51. @change="contactsChange($event)" :disabled=isContacts>
  52. <el-option v-for="item in contactsOption" :key="item.id" :label="item.contacts"
  53. :value="item.contacts" />
  54. </el-select>
  55. </template>
  56. </avue-form>
  57. </trade-card>
  58. <trade-card title="明细信息">
  59. <el-tabs v-model="activeName" type="card">
  60. <el-tab-pane label="销售明细" name="sale_detail">
  61. <avue-crud :option="optionContacts" v-model="formContacts" ref="formContacts"
  62. :data="form.orderItemsList" :key="key" @row-save="rowSave" @row-update="rowUpdate"
  63. @row-close="rowClose" :before-close="beforeClose"
  64. @resetColumn="resetColumnTwo('formContacts', 'optionContacts', 'optionContactsBack', 269.1)"
  65. @saveColumn="saveColumnTwo('formContacts', 'optionContacts', 'optionContactsBack', 269.1)">
  66. <template slot-scope="{scope,row}" slot="menuLeft">
  67. <el-button type="primary" icon="el-icon-plus" size="small" :disabled="isAddBtn"
  68. @click="rowAdd(row)">添加轮胎</el-button>
  69. <el-button type="primary" icon="el-icon-printer" size="small"
  70. @click="handlePrint">打印</el-button>
  71. </template>
  72. <!-- <template slot-scope="{scope,row}" slot="goodsNum">
  73. <el-input size="small" v-model="formContacts.goodsNum" style="width: 100%">
  74. <template slot="inventory">{{ inventory }}吨</template>
  75. </el-input>
  76. </template> -->
  77. <!-- <template slot="goodsId" slot-scope="{ row, index }">
  78. <span style="display:flex">
  79. <el-select v-model="row.goodsId" placeholder="请选择" size="small" filterable
  80. style="width:60%" >
  81. <el-option v-for="item in goodsIdoptions" :key="item.id" :label="item.cname"
  82. :value="item.id">
  83. </el-option>
  84. </el-select>
  85. <el-button icon="el-icon-search" size="small" @click="rePick(row, index)"></el-button>
  86. </span>
  87. </template> -->
  88. <template slot-scope="{type,size,row,index,disabled}" slot="menu">
  89. <el-button :size="size" :disabled="disabled || isAdd" :type="type"
  90. :icon="row.$cellEdit ? 'el-icon-plus' : 'el-icon-edit'" @click="editBtn(row, index)">编辑
  91. </el-button>
  92. <el-button icon="el-icon-delete" :size="size" :disabled="disabled || isDisabled"
  93. :type="type" @click="rowDelBox(row, index, 'orderItemsList')">删除
  94. </el-button>
  95. </template>
  96. </avue-crud>
  97. </el-tab-pane>
  98. <el-tab-pane label="支付明细" name="payment_details">
  99. <avue-crud :option="optionPaymentDetails" v-model="formContacts" ref="payment_details"
  100. :data="dataList" @row-save="rowSave" @row-update="rowUpdate"
  101. @resetColumn="resetColumnTwo('payment_details', 'optionPaymentDetails', 'optionPaymentDetailsBack', 269.2)"
  102. @saveColumn="saveColumnTwo('payment_details', 'optionPaymentDetails', 'optionPaymentDetailsBack', 269.2)">
  103. <!-- <template slot-scope="{type,size,row,index,disabled}" slot="menu">
  104. <el-button :size="size" :disabled="disabled" :type="type"
  105. :icon="row.$cellEdit ? 'el-icon-plus' : 'el-icon-edit'"
  106. @click="$refs.formContacts.rowCell(row, index)">{{ row.$cellEdit ? '确认' : '修改' }}
  107. </el-button>
  108. <el-button icon="el-icon-delete" :size="size" :disabled="disabled" :type="type"
  109. @click="rowDelBox(row, index, 'paymentRecordsList')">删除
  110. </el-button>
  111. </template> -->
  112. </avue-crud>
  113. </el-tab-pane>
  114. <el-tab-pane label="出库记录" name="outbound_records">
  115. <avue-crud :option="optionOutboundRecords" v-model="formContacts" ref="outbound_records"
  116. :data="form.outboundRecordsList" @row-save="rowSave" @row-update="rowUpdate"
  117. @resetColumn="resetColumnTwo('outbound_records', 'optionOutboundRecords', 'optionOutboundRecordsBack', 269.3)"
  118. @saveColumn="saveColumnTwo('outbound_records', 'optionOutboundRecords', 'optionOutboundRecordsBack', 269.3)">
  119. <!-- <template slot-scope="{type,size,row,index,disabled}" slot="menu">
  120. <el-button :size="size" :disabled="disabled" :type="type"
  121. :icon="row.$cellEdit ? 'el-icon-plus' : 'el-icon-edit'"
  122. @click="$refs.formContacts.rowCell(row, index)">{{ row.$cellEdit ? '确认' : '修改' }}
  123. </el-button>
  124. <el-button icon="el-icon-delete" :size="size" :disabled="disabled" :type="type"
  125. @click="rowDelBox(row, index)">删除
  126. </el-button>
  127. </template> -->
  128. </avue-crud>
  129. </el-tab-pane>
  130. </el-tabs>
  131. </trade-card>
  132. <report-dialog :switchDialog="switchDialog" reportName="轮胎商城-销售订单" :reportId="form.id"
  133. @onClose="onClose()"></report-dialog>
  134. <el-dialog append-to-body title="审批" class="el-dialogDeep" :visible.sync="checkDialog" width="50%"
  135. :close-on-click-modal="false" :destroy-on-close="true" :close-on-press-escape="false" v-dialog-drag>
  136. <check :checkData="checkData" :checkDetail="true" :idList="[]" @operationType="operationType"
  137. @choceCheckFun="choceCheckFun">
  138. </check>
  139. </el-dialog>
  140. <el-dialog append-to-body title="审批进度" class="el-dialogDeep" :visible.sync="checkScheduleDialog" width="40%"
  141. :close-on-click-modal="false" :destroy-on-close="true" :close-on-press-escape="false" v-dialog-drag>
  142. <check-schedule :checkId="checkId" :batchNo="batchNo" @choceScheduleFun="choceScheduleFun"></check-schedule>
  143. </el-dialog>
  144. </div>
  145. </div>
  146. </template>
  147. <script>
  148. import { getDetails as getCustom } from "@/api/tirePartsMall/basicData/customerInformation"
  149. import { getDetails, submit, generateShipTask, tradingBox, delOrderItem, checkOrder, confirmRefund, revokeCheckOrder, revokeGenerateShipTask, goodsListXs } from "@/api/tirePartsMall/salesManagement/saleOrder";
  150. import { dotList, goodsDetail } from "@/api/tirePartsMall/purchasingManagement/warehouseEntryOrder";
  151. import reportDialog from "@/components/report-dialog/main";
  152. import checkSchedule from "@/components/check/checkSchedule";
  153. import check from "@/components/check/check";
  154. import { getList } from "@/api/paymentManagement/paymentRecord"
  155. import TicketDistribution from "../../../oceanShipping/maritimeExport/components/ticketDistribution.vue";
  156. import M from "minimatch";
  157. import da from "element-ui/src/locale/lang/da";
  158. import { number } from "echarts";
  159. export default {
  160. name: "detailsPage",
  161. data() {
  162. return {
  163. inventory: 0,
  164. isStatus: 1,
  165. goodsIdoptions: [],
  166. dataList: [],
  167. dicUrlWithCustomId: '',
  168. sharedCompanyId: 0,
  169. isAddBtn: true,
  170. isSaveBtn: false,
  171. viewDisabled: false,
  172. isAdd: false,
  173. editButton: true,
  174. isEditButton: false,
  175. goods: [],
  176. isDisabled: false,
  177. isDisabledTask: false,
  178. contactsOption: [],
  179. isContacts: false,
  180. checkData: {},
  181. buttonText: '生成任务',
  182. buttonColor: 'success', // 初始颜色为success
  183. checkScheduleDialog: false,
  184. isApplySettlement: true,
  185. isConfirmRefundBtn: true,
  186. isExamineBtn: true,
  187. isRevocationRequest: true,
  188. checkDialog: false,
  189. checkId: '',
  190. batchNo: '',
  191. switchDialog: false,
  192. activeName: "sale_detail",
  193. disabled: false,
  194. key: 0,
  195. form: {
  196. orderItemsList: [],
  197. paymentRecordsList: [],
  198. outboundRecordsList: []
  199. },
  200. optionForm: {
  201. menuBtn: false,
  202. span: 8,
  203. disabled: false,
  204. column: [{
  205. label: '客户',
  206. prop: "customerId",
  207. disabled: false,
  208. remote: true,
  209. type: 'select',
  210. props: {
  211. label: 'cname',
  212. value: 'id'
  213. },
  214. cascader: ['recAddress'],
  215. change: (data) => {
  216. if (!this.onLoad.id) {
  217. // this.$set(this.optionContactsBack, "addBtn", true)
  218. // this['optionContacts'] = this['optionContactsBack'];
  219. // this.delColumnData(this.getColumnName('269.1'), this['optionContactsBack']);
  220. }
  221. if (this.$refs.form.DIC.customerId || !this.onLoad.id) {
  222. getCustom({ id: data.value }).then(res => {
  223. this.dicUrlWithCustomId = res.data.data.id ? res.data.data.id : ''
  224. // this.form.storageId ? this.form.storageId : res.data.data.deliveryWarehouseId
  225. // this.form.storageId = res.data.data.deliveryWarehouseId
  226. this.form.storageId = this.form.storageId ? this.form.storageId : res.data.data.deliveryWarehouseId
  227. this.form.contacts = res.data.data.corpsAttnList[0].cname
  228. this.form.phone = res.data.data.corpsAttnList[0].tel
  229. this.contactsOption = res.data.data.corpsAddrList
  230. this.form.recAddress = res.data.data.corpsAddrList[0].belongtoarea + res.data.data.corpsAddrList[0].detailedAddress
  231. })
  232. }
  233. // if (this.$refs.form.DIC.customerId || data.value) {
  234. // for (let item of this.$refs.form.DIC.customerId) {
  235. // if (item.id == data.value) {
  236. // console.log(data);
  237. // console.log(this.$refs.form);
  238. // console.log(item);
  239. // // 后端返回数据暂无联系人、地址等数据,无法下拉默认
  240. // this.form.phone = item.tel
  241. // }
  242. // }
  243. // }
  244. },
  245. dicUrl: '/api/blade-sales-part/corpsDesc/listAll?cname={{key}}&corpType=KH&enableOrNot=0',
  246. rules: [{
  247. required: true,
  248. message: " ",
  249. trigger: "blur"
  250. }]
  251. }, {
  252. label: '仓库',
  253. prop: "storageId",
  254. type: 'select',
  255. disabled: false,
  256. placeholder: '仓库为空即为异地销售',
  257. props: {
  258. label: 'cname',
  259. value: 'id'
  260. },
  261. dicUrl: '/api/blade-sales-part/storageDesc/listAll',
  262. // rules: [{
  263. // required: true,
  264. // message: " ",
  265. // trigger: "blur"
  266. // }]
  267. }, {
  268. label: '单据编号',
  269. prop: "ordNo",
  270. disabled: true
  271. }, {
  272. label: '来源单号',
  273. prop: "srcOrdNo",
  274. disabled: true
  275. }, {
  276. label: '业务来源',
  277. prop: "businessSource",
  278. disabled: true
  279. }, {
  280. label: '应收类别',
  281. prop: "receivableType",
  282. type: "select",
  283. disabled: false,
  284. dicUrl: "/api/blade-system/dict-biz/dictionary?code=receivableType",
  285. props: {
  286. label: "dictValue",
  287. value: "dictValue"
  288. },
  289. value: '网络支付'
  290. }, {
  291. label: '联系人',
  292. type: "select",
  293. prop: "contacts",
  294. disabled: false,
  295. props: {
  296. label: 'address',
  297. value: 'id'
  298. },
  299. dicUrl: '/api/blade-sales-part/corpsAddr/corpIdByAddr?pid={{key}}'
  300. }, {
  301. label: '电话',
  302. disabled: false,
  303. prop: "phone",
  304. }, {
  305. label: '收货地址',
  306. prop: "recAddress",
  307. type: 'select',
  308. disabled: false,
  309. props: {
  310. label: 'address',
  311. value: 'address'
  312. },
  313. dicUrl: '/api/blade-sales-part/corpsAddr/corpIdByAddr?pid={{key}}'
  314. }, {
  315. label: '配送方式',
  316. type: 'select',
  317. prop: "shipType",
  318. disabled: false,
  319. dicUrl: "/api/blade-system/dict-biz/dictionary?code=deliveryMethod",
  320. props: {
  321. label: "dictValue",
  322. value: "dictValue"
  323. },
  324. value: '物流'
  325. }, {
  326. label: '物流公司',
  327. disabled: false,
  328. prop: "logisticsCorpName"
  329. }, {
  330. label: '成本',
  331. prop: "cost",
  332. display: true,
  333. disabled: true
  334. }, {
  335. label: '毛利',
  336. prop: "grossProfit",
  337. disabled: true
  338. }, {
  339. label: '销售金额',
  340. prop: "salesAmount",
  341. disabled: true
  342. }, {
  343. label: '运费',
  344. prop: "freight",
  345. disabled: true
  346. }, {
  347. label: '总金额',
  348. prop: "totalMoney",
  349. disabled: true
  350. }, {
  351. label: '备注',
  352. prop: "remarks",
  353. type: 'textarea',
  354. disabled: false,
  355. span: 16,
  356. minRows: 1
  357. }]
  358. },
  359. formContacts: {},
  360. optionContacts: {},
  361. optionContactsBack: {
  362. disabled: false,
  363. border: true,
  364. align: 'center',
  365. index: true,
  366. showSummary: true,
  367. sumColumnList: [
  368. {
  369. name: 'goodsNum',
  370. type: 'sum',
  371. },
  372. {
  373. name: 'sendNum',
  374. type: 'sum',
  375. },
  376. {
  377. name: 'subTotalMoney',
  378. type: 'sum',
  379. },
  380. {
  381. name: 'costprie',
  382. type: 'sum',
  383. },
  384. {
  385. name: 'grossProfit',
  386. type: 'sum',
  387. }
  388. ],
  389. addBtnText: "添加轮胎",
  390. updateBtnText:'保存',
  391. refreshBtn: false,
  392. dialogDrag: true,
  393. addBtn: false,
  394. span: 8,
  395. height: 500,
  396. addRowBtn: false,
  397. editBtn: false,
  398. delBtn: false,
  399. menuWidth: 140,
  400. dialogTop: 25,
  401. dialogWidth: "80%",
  402. // summaryText: "合计",
  403. // showSummary: true,
  404. // sumColumnList:[{
  405. // name: "goodsNum",
  406. // type: "sum",
  407. // decimals: 2
  408. // },{
  409. // name: "sendNum",
  410. // type: "sum",
  411. // decimals: 2
  412. // },{
  413. // name: "profit",
  414. // type: "sum",
  415. // decimals: 2
  416. // },{
  417. // name: "subTotalMoney",
  418. // type: "sum",
  419. // decimals: 2
  420. // },{
  421. // name: "thisAmount",
  422. // type: "sum",
  423. // decimals: 2
  424. // },{
  425. // name: "costprie",
  426. // type: "sum",
  427. // decimals: 2
  428. // },{
  429. // name: "grossProfit",
  430. // type: "sum",
  431. // decimals: 2
  432. // }],
  433. column: [{
  434. label: '轮胎名称',
  435. prop: 'goodsId',
  436. width: 200,
  437. disabled: false,
  438. remote: true,
  439. overHidden: true,
  440. type: 'select',
  441. dicData: [],
  442. props: {
  443. label: 'cname',
  444. value: 'id'
  445. },
  446. // dicUrl: '/api/blade-sales-part/goodsDesc/goodsListAll?cname={{key}}'
  447. dicUrl: "/api/blade-sales-part/goodsDesc/goodsListXs?cname={{key}}&customId=1658279303722418177&enableOrNot=0"
  448. // dicUrl: "/api/blade-sales-part/goodsDesc/goodsListXs?cname={{key}}"
  449. }, {
  450. label: '数量',
  451. prop: 'goodsNum',
  452. overHidden: true,
  453. disabled: false,
  454. width: 100,
  455. rules: [{
  456. required: true,
  457. message: " ",
  458. trigger: "blur"
  459. }, {
  460. validator: (rule, value, callback) => {
  461. console.log(this.formContacts.inventory);
  462. if (value < 0) {
  463. callback(new Error("数量不能小于0"));
  464. } else if (Number(value) > Number(this.formContacts.inventory)) {
  465. callback(new Error("数量不能大于库存"));
  466. } else {
  467. callback();
  468. }
  469. },
  470. trigger: "blur"
  471. }]
  472. },
  473. {
  474. label: '价格',
  475. prop: 'price',
  476. overHidden: true,
  477. width: 100,
  478. disabled: false,
  479. rules: [{
  480. required: true,
  481. message: " ",
  482. trigger: "blur"
  483. }, {
  484. validator: (rule, value, callback) => {
  485. if (value < 0) {
  486. callback(new Error("价格不能小于0"));
  487. } else {
  488. callback();
  489. }
  490. },
  491. trigger: "blur"
  492. }]
  493. },
  494. {
  495. label: '库存',
  496. prop: 'inventory',
  497. overHidden: true,
  498. hide: true,
  499. width: 100
  500. }, {
  501. label: '批次号',
  502. prop: 'dot',
  503. type: "select",
  504. disabled: true,
  505. allowCreate: true,
  506. filterable: true,
  507. dicData: [],
  508. props: {
  509. label: "dot",
  510. value: "dot"
  511. },
  512. dicUrl: "/api/blade-sales-part/stockDesc/dotList",
  513. overHidden: true,
  514. }, {
  515. label: '轮胎编码',
  516. prop: 'goodsNo',
  517. overHidden: true,
  518. disabled: false,
  519. width: 100
  520. },
  521. {
  522. label: '品牌',
  523. prop: 'brandId',
  524. disabled: false,
  525. width: 100,
  526. overHidden: true,
  527. type: 'select',
  528. props: {
  529. label: 'cname',
  530. value: 'id'
  531. },
  532. dicUrl: '/api/blade-sales-part/brandDesc/listAll'
  533. },
  534. {
  535. label: '规格型号',
  536. prop: 'propertyName',
  537. overHidden: true,
  538. disabled: false,
  539. width: 100
  540. }, {
  541. label: '花纹',
  542. prop: 'pattern',
  543. overHidden: true,
  544. disabled: false,
  545. width: 100
  546. }, {
  547. label: '轮胎描述',
  548. prop: 'goodsDescription',
  549. disabled: false,
  550. overHidden: true,
  551. width: 100
  552. },
  553. {
  554. label: '单位',
  555. prop: 'units',
  556. type: "select",
  557. disabled: false,
  558. props: {
  559. label: "dictValue",
  560. value: "dictValue"
  561. },
  562. dicUrl: "/api/blade-system/dict-biz/dictionary?code=unit",
  563. overHidden: true,
  564. width: 100
  565. },
  566. {
  567. label: '发货数量',
  568. prop: 'sendNum',
  569. disabled: false,
  570. overHidden: true,
  571. width: 100,
  572. disabled: true,
  573. editDisplay: false,
  574. addDisplay: false
  575. },
  576. // {
  577. // label: '利润',
  578. // prop: 'profit',
  579. // overHidden: true,
  580. // width: 100
  581. // },
  582. {
  583. label: '小计',
  584. prop: 'subTotalMoney',
  585. overHidden: true,
  586. width: 100,
  587. disabled: true,
  588. editDisplay: false,
  589. addDisplay: false
  590. },
  591. // {
  592. // label: '返利',
  593. // prop: 'thisAmount',
  594. // overHidden: true,
  595. // width: 100
  596. // },
  597. {
  598. label: '成本',
  599. prop: 'costprie',
  600. overHidden: true,
  601. width: 100,
  602. disabled: true,
  603. editDisplay: false,
  604. addDisplay: false
  605. },
  606. {
  607. label: '毛利',
  608. prop: 'grossProfit',
  609. overHidden: true,
  610. width: 100,
  611. disabled: true,
  612. editDisplay: false,
  613. addDisplay: false
  614. },
  615. {
  616. label: '备注',
  617. prop: "remarks",
  618. overHidden: true,
  619. width: 100,
  620. disabled: false,
  621. }
  622. ]
  623. },
  624. optionPaymentDetails: {},
  625. optionPaymentDetailsBack: {
  626. align: 'center',
  627. index: true,
  628. addBtnText: "录入明细",
  629. menu: false,
  630. refreshBtn: false,
  631. dialogDrag: true,
  632. addBtn: false,
  633. span: 8,
  634. height: 600,
  635. addRowBtn: false,
  636. editBtn: false,
  637. delBtn: false,
  638. menuWidth: 140,
  639. dialogTop: 25,
  640. dialogWidth: "80%",
  641. column: [{
  642. label: '支付编号',
  643. prop: 'serialNumber'
  644. }, {
  645. label: '金额',
  646. prop: 'amount'
  647. }, {
  648. label: '类型',
  649. prop: 'type'
  650. }, {
  651. label: '支付时间',
  652. prop: 'createTime'
  653. }]
  654. },
  655. optionOutboundRecords: {},
  656. optionOutboundRecordsBack: {
  657. align: 'center',
  658. index: true,
  659. menu: false,
  660. addBtnText: "录入明细",
  661. refreshBtn: false,
  662. dialogDrag: true,
  663. addBtn: false,
  664. span: 8,
  665. height: 600,
  666. addRowBtn: false,
  667. editBtn: false,
  668. delBtn: false,
  669. // menuWidth: 140,
  670. dialogTop: 25,
  671. dialogWidth: "80%",
  672. column: [{
  673. label: '出库单号',
  674. prop: 'billno'
  675. }, {
  676. label: '来源单号',
  677. prop: 'ordNo'
  678. }, {
  679. label: '数量',
  680. prop: 'goodsTotalNum'
  681. }, {
  682. label: '状态',
  683. prop: 'statusName'
  684. }, {
  685. label: '业务时间',
  686. prop: 'createTime'
  687. }]
  688. }
  689. }
  690. },
  691. components: { reportDialog, check, checkSchedule },
  692. props: {
  693. onLoad: Object,
  694. detailData: Object
  695. },
  696. async created() {
  697. // console.log(this.$route);
  698. // if(this.$route.query.check.actId){
  699. // this.isExamineBtn = false
  700. // }
  701. this.findObject(this.optionContactsBack.column, "goodsId").change = ({ value, column }) => {
  702. if (this.formContacts.goodsId !== value) {
  703. goodsDetail({ id: value, customId: this.dicUrlWithCustomId, stock: this.form.storageId ? this.form.storageId : '' }).then(res => {
  704. this.goods = res.data.data
  705. this.formContacts.goodsNo = res.data.data.code
  706. this.formContacts.brandId = res.data.data.brandId
  707. this.formContacts.inventory = res.data.data.inventory
  708. // this.formContacts.brandId = res.data.data.brandName
  709. // this.formContacts.brandName = res.data.data.brandId
  710. this.formContacts.propertyName = res.data.data.specificationAndModel
  711. this.formContacts.pattern = res.data.data.brandItem
  712. this.formContacts.goodsDescription = res.data.data.goodsDescription
  713. this.formContacts.units = res.data.data.unit
  714. this.formContacts.price = res.data.data.price
  715. //
  716. this.formContacts.sharedCompanyId = res.data.data.sharedCompanyId
  717. console.log(res.data.data.sharedCompanyId);
  718. console.log(res.data.data.sharedCompanyName);
  719. this.form.sharedCompanyId = res.data.data.sharedCompanyId
  720. this.form.sharedCompanyName = res.data.data.sharedCompanyName
  721. this.sharedCompanyId = res.data.data.sharedCompanyId
  722. console.log(res.data.data.sharedCompanyId);
  723. console.log(this.form.orderItemsList);
  724. for (let i = 0; i < this.form.orderItemsList.length; i++) {
  725. console.log(Number(this.form.orderItemsList[i].sharedCompanyId));
  726. if (Number(this.form.orderItemsList[i].sharedCompanyId) != Number(res.data.data.sharedCompanyId)) {
  727. this.isStatus = 0
  728. }
  729. }
  730. if (res.data.data.whether == 0) {
  731. this.findObject(this.optionContactsBack.column, "dot").disabled = true
  732. } else {
  733. this.findObject(this.optionContactsBack.column, "dot").disabled = false
  734. dotList({
  735. storageId: this.form.storageId,
  736. goodsId: this.formContacts.goodsId
  737. }).then(res => {
  738. this.findObject(this.optionContactsBack.column, "dot").dicData = res.data.data
  739. })
  740. }
  741. // this.formContacts.goodsId = res.data.data.cname
  742. // this.formContacts.goodsName = res.data.data.id
  743. })
  744. }
  745. }
  746. this.optionContacts = await this.getColumnData(this.getColumnName(269.1), this.optionContactsBack);
  747. this.findObject(this.optionContacts.column, "goodsId").change = ({ value, column }) => {
  748. if (this.formContacts.goodsId !== value) {
  749. goodsDetail({ id: value, customId: this.dicUrlWithCustomId, stock: this.form.storageId ? this.form.storageId : '' }).then(res => {
  750. this.goods = res.data.data
  751. this.formContacts.goodsNo = res.data.data.code
  752. this.formContacts.brandId = res.data.data.brandId
  753. this.formContacts.inventory = res.data.data.inventory
  754. // this.formContacts.brandId = res.data.data.brandName
  755. // this.formContacts.brandName = res.data.data.brandId
  756. this.formContacts.propertyName = res.data.data.specificationAndModel
  757. this.formContacts.pattern = res.data.data.brandItem
  758. this.formContacts.goodsDescription = res.data.data.goodsDescription
  759. this.formContacts.units = res.data.data.unit
  760. this.sharedCompanyId = res.data.data.sharedCompanyId
  761. this.formContacts.sharedCompanyId = res.data.data.sharedCompanyId
  762. //
  763. this.form.sharedCompanyId = res.data.data.sharedCompanyId
  764. this.form.sharedCompanyName = res.data.data.sharedCompanyName
  765. for (let i = 0; i < this.form.orderItemsList.length; i++) {
  766. if (this.form.orderItemsList[i].sharedCompanyId != res.data.data.sharedCompanyId) {
  767. this.isStatus = 0
  768. }
  769. }
  770. if (res.data.data.whether == 0) {
  771. this.findObject(this.optionContacts.column, "dot").disabled = true
  772. } else {
  773. this.findObject(this.optionContacts.column, "dot").disabled = false
  774. dotList({
  775. storageId: this.form.storageId,
  776. goodsId: this.formContacts.goodsId
  777. }).then(res => {
  778. this.findObject(this.optionContacts.column, "dot").dicData = res.data.data
  779. })
  780. }
  781. // this.formContacts.goodsId = res.data.data.cname
  782. // this.formContacts.goodsName = res.data.data.id
  783. })
  784. }
  785. }
  786. this.optionPaymentDetails = await this.getColumnData(this.getColumnName(269.2), this.optionPaymentDetailsBack);
  787. this.optionOutboundRecords = await this.getColumnData(this.getColumnName(269.3), this.optionOutboundRecordsBack);
  788. this.key++
  789. if (this.onLoad.id && this.detailData.id) {
  790. this.$set(this.optionForm, 'disabled', true)
  791. this.$set(this.optionContactsBack, 'disabled', true)
  792. this.isContacts = true
  793. this.isDisabled = true
  794. //添加删除按钮禁用
  795. this.isAdd = true
  796. this.refresh(this.onLoad.id, true)
  797. } else if (this.onLoad.id) {
  798. console.log(2);
  799. this.refresh(this.onLoad.id, true)
  800. }
  801. if (!this.form.id) {
  802. console.log(3);
  803. this.optionContactsBack.column.forEach(its => {
  804. if (its.prop == 'goodsId' || its.prop == 'goodsNum' || its.prop == 'price' || its.prop == 'dot' || its.prop == 'remarks') {
  805. its.disabled = false
  806. } else {
  807. its.disabled = true
  808. }
  809. })
  810. this.isSaveBtn = true;
  811. this.isDisabledTask = true;
  812. this.viewDisabled = true;
  813. // this.$set(this.optionContactsBack, "addBtn", false)
  814. this['optionContacts'] = this['optionContactsBack'];
  815. this.delColumnData(this.getColumnName('269.1'), this['optionContactsBack']);
  816. }
  817. if (!this.detailData.id) {
  818. this.editButton = false
  819. this.isAddBtn = false
  820. this.isDisabledTask = false;
  821. this.isSaveBtn = false
  822. this.viewDisabled = false;
  823. this.form.businessSource = '内部销售'
  824. }
  825. console.log('this.detailData.check',this.detailData.check);
  826. if (this.detailData.check) {
  827. this.isExamineBtn = false
  828. // this.batchNo = this.detailData.check.batchNo
  829. }
  830. },
  831. watch: {
  832. dicUrlWithCustomId() {
  833. console.log(this.form);
  834. // this.findObject(this.optionContactsBack.column, "goodsId").dicUrl = `/api/blade-sales-part/goodsDesc/goodsListXs?cname={{key}}&customId=${this.dicUrlWithCustomId}&enableOrNot=0`
  835. goodsListXs(this.dicUrlWithCustomId, this.form.storageId ? this.form.storageId : '').then(res => {
  836. this.findObject(this.optionContactsBack.column, "goodsId").dicData = res.data.data
  837. })
  838. },
  839. 'form.storageId'(newStorageId, oldStorageId) {
  840. goodsListXs(this.dicUrlWithCustomId, this.form.storageId ? this.form.storageId : '').then(res => {
  841. this.findObject(this.optionContactsBack.column, "goodsId").dicData = res.data.data
  842. })
  843. },
  844. 'form.orderItemsList.length'(newformContacts, oldformContacts) {
  845. console.log(this.formContacts);
  846. console.log(this.form.orderItemsList);
  847. // for (let i = 0; i < this.form.orderItemsList.length - 1; i++) {
  848. // const currentItem = this.form.orderItemsList[i];
  849. // const nextItem = this.form.orderItemsList[i + 1];
  850. // if (currentItem.sharedCompanyId !== nextItem.sharedCompanyId) {
  851. // console.log('不能添加');
  852. // }
  853. // }
  854. if (this.form.orderItemsList.length) {
  855. this.findObject(this.optionForm.column, 'storageId').disabled = true
  856. } else {
  857. this.findObject(this.optionForm.column, 'storageId').disabled = false
  858. }
  859. },
  860. 'form.sharedCompanyId'(newSharedCompanyId, oldSharedCompanyId) {
  861. console.log(newSharedCompanyId, oldSharedCompanyId);
  862. if (newSharedCompanyId != oldSharedCompanyId) {
  863. console.log('不能添加');
  864. }
  865. console.log(this.sharedCompanyId);
  866. },
  867. $route(to, from) {
  868. if (this.onLoad.id && this.detailData.id) {
  869. this.$set(this.optionForm, 'disabled', true)
  870. this.$set(this.optionContactsBack, 'disabled', true)
  871. this.isContacts = true
  872. this.isDisabled = true
  873. this.isAdd = true
  874. this.refresh(this.onLoad.id, true)
  875. } else if (this.onLoad.id) {
  876. console.log(2);
  877. this.refresh(this.onLoad.id, true)
  878. }
  879. // if (!this.form.id) {
  880. // console.log(3);
  881. // // this.$set(this.optionContactsBack, "addBtn", false)
  882. // this['optionContacts'] = this['optionContactsBack'];
  883. // this.delColumnData(this.getColumnName('269.1'), this['optionContactsBack']);
  884. // }
  885. // if (!this.detailData.id) {
  886. // this.form.businessSource = '内部销售'
  887. // }
  888. if (this.detailData.status == 1) {
  889. this.isExamineBtn = false;
  890. }
  891. // if (to.name == '销售订单') {
  892. // console.log('销售订单');
  893. // this.isExamineBtn = false;
  894. // }
  895. }
  896. },
  897. methods: {
  898. editBtn(row, index) {
  899. console.log(123);
  900. this.confirmEditing()
  901. this.$refs.formContacts.rowEdit(row, index);
  902. dotList({
  903. storageId: this.form.storageId,
  904. goodsId: this.formContacts.goodsId
  905. }).then(res => {
  906. this.findObject(this.optionContactsBack.column, "dot").dicData = res.data.data
  907. })
  908. goodsListXs(this.dicUrlWithCustomId, this.form.storageId ? this.form.storageId : '').then(res => {
  909. this.findObject(this.optionContactsBack.column, "goodsId").dicData = res.data.data
  910. })
  911. },
  912. //表头编辑
  913. confirmEditing() {
  914. goodsListXs(this.dicUrlWithCustomId, this.form.storageId ? this.form.storageId : '').then(res => {
  915. this.findObject(this.optionContactsBack.column, "goodsId").dicData = res.data.data
  916. })
  917. if(this.form.status == '已发货'){
  918. this.viewDisabled =false
  919. return
  920. }
  921. if(this.form.status == '退款中'){
  922. this.viewDisabled =false
  923. this.isRevocationRequest = true
  924. return
  925. }
  926. this.isAddBtn = false
  927. if (this.form.status == '已取消' || this.form.status == '已退款' || this.form.status == '已发货') {
  928. return
  929. // this.$message.error('当前状态不允许编辑')
  930. // this.optionForm.column.forEach(item=>{
  931. // if(item.prop= 'contacts'){
  932. // item.disabled = true
  933. // }
  934. // })
  935. }
  936. if(this.form.status == '退款请核'){
  937. this.viewDisabled = false
  938. this.isAddBtn = true
  939. return
  940. }
  941. if (this.form.status == '已取消' || this.form.status == '退款请核') {
  942. this.isAddBtn = true
  943. // this.$message.error('当前状态不允许编辑')
  944. // this.optionForm.column.forEach(item=>{
  945. // if(item.prop= 'contacts'){
  946. // item.disabled = true
  947. // }
  948. // })
  949. }
  950. if (this.form.status == '待发货') {
  951. this.isAddBtn = true
  952. }
  953. this.optionContactsBack.column.forEach(its => {
  954. if (its.prop == 'goodsId' || its.prop == 'goodsNum' || its.prop == 'price' || its.prop == 'dot' || its.prop == 'remarks') {
  955. its.disabled = false
  956. } else {
  957. its.disabled = true
  958. }
  959. })
  960. this.$set(this.optionForm, 'disabled', false)
  961. this.$set(this.optionContactsBack, 'disabled', false)
  962. this.isDisabled = false
  963. this.isAdd = false
  964. if (this.form.businessSource == "外部销售") {
  965. this.optionForm.column.forEach(its => {
  966. if (its.prop == 'contacts' || its.prop == 'phone'||its.prop == 'recAddress') {
  967. this.$set(its, 'disabled', true)
  968. }
  969. })
  970. if (this.form.status == '待发货') {
  971. this.isSaveBtn = false;
  972. this.isDisabledTask = false;
  973. this.viewDisabled = false;
  974. }
  975. if (this.form.status == '待确认') {
  976. const loadings = this.$loading({
  977. lock: true,
  978. text: '加载中',
  979. spinner: 'el-icon-loading',
  980. background: 'rgba(255,255,255,0.7)'
  981. });
  982. console.log('外部销售待确认');
  983. this.isSaveBtn = false;
  984. this.isDisabledTask = false;
  985. this.viewDisabled = false;
  986. this.optionForm.column.forEach(its => {
  987. if (its.prop == 'customerId') {
  988. this.$set(its, 'disabled', true)
  989. }
  990. if (its.prop == 'storageId') {
  991. this.$set(its, 'disabled', false)
  992. }
  993. })
  994. //外部销售都能申请退款
  995. this.isApplySettlement = false
  996. //不能录入不能删除
  997. this.isDisabled = true
  998. this.isAdd = false
  999. this.isAddBtn= true
  1000. this.$set(this.form, 'shipType', '物流')
  1001. this.$set(this.form, 'receivableType', '网络支付')
  1002. this.optionContactsBack.column.forEach(item => {
  1003. this.$set(item, 'disabled', true)
  1004. if (item.label == '批次号' || item.label == '备注') {
  1005. item.disabled = false
  1006. }
  1007. })
  1008. loadings.close()
  1009. } else {
  1010. const loadin = this.$loading({
  1011. lock: true,
  1012. text: '加载中',
  1013. spinner: 'el-icon-loading',
  1014. background: 'rgba(255,255,255,0.7)'
  1015. });
  1016. this.isAddBtn = true
  1017. this.isDisabled = true
  1018. this.isSaveBtn = false;
  1019. this.isDisabledTask = false;
  1020. this.viewDisabled = false;
  1021. this.optionForm.column.forEach(its => {
  1022. if (its.prop != 'remarks') {
  1023. its.disabled = true
  1024. } else {
  1025. its.disabled = false
  1026. }
  1027. })
  1028. this.optionContactsBack.column.forEach(its => {
  1029. if (its.prop != 'remarks') {
  1030. its.disabled = true
  1031. } else {
  1032. its.disabled = false
  1033. }
  1034. })
  1035. loadin.close()
  1036. }
  1037. } else {
  1038. const loading = this.$loading({
  1039. lock: true,
  1040. text: '加载中',
  1041. spinner: 'el-icon-loading',
  1042. background: 'rgba(255,255,255,0.7)'
  1043. });
  1044. if (this.form.status == '待发货' || this.form.status == '已发货' || this.form.status == '已取消') {
  1045. const loading = this.$loading({
  1046. lock: true,
  1047. text: '加载中',
  1048. spinner: 'el-icon-loading',
  1049. background: 'rgba(255,255,255,0.7)'
  1050. });
  1051. this.optionForm.column.forEach(its => {
  1052. if (its.prop != 'remarks') {
  1053. its.disabled = true
  1054. } else {
  1055. its.disabled = false
  1056. }
  1057. })
  1058. this.optionContactsBack.column.forEach(its => {
  1059. if (its.prop != 'remarks') {
  1060. its.disabled = true
  1061. } else {
  1062. its.disabled = false
  1063. }
  1064. })
  1065. loading.close()
  1066. } else if (this.form.status == '录入') {
  1067. this.isSaveBtn = false;
  1068. this.isDisabledTask = false;
  1069. this.viewDisabled = false;
  1070. // this.$set(this.optionForm, 'disabled', false)
  1071. // this.$set(this.optionContactsBack, 'disabled', false)
  1072. this.$set(this.optionForm, 'disabled', false)
  1073. this.$set(this.optionContactsBack, 'disabled', false)
  1074. this.isContacts = true
  1075. //删除按钮
  1076. this.isDisabled = false
  1077. // this.optionForm.column.forEach(item => {
  1078. // item.disabled = false
  1079. // })
  1080. loading.close()
  1081. } else if (this.form.status == '待确认') {
  1082. this.isSaveBtn = false;
  1083. this.isDisabledTask = false;
  1084. this.viewDisabled = false;
  1085. // this.isDisabled = true
  1086. console.log('待确认');
  1087. this.optionForm.column.forEach(item => {
  1088. if (item.label === '仓库' || item.label === '备注' || item.label === '配送方式' || item.label === '物流公司') {
  1089. this.$set(item, 'disabled', false)
  1090. } else {
  1091. this.$set(item, 'disabled', true)
  1092. }
  1093. })
  1094. this.optionContactsBack.column.forEach(its => {
  1095. if (its.prop == 'remarks' || its.prop == 'dot') {
  1096. this.$set(its, 'disabled', false)
  1097. } else {
  1098. this.$set(its, 'disabled', true)
  1099. }
  1100. })
  1101. loading.close()
  1102. }
  1103. if (this.form.status == '待发货') {
  1104. this.isSaveBtn = false;
  1105. this.isDisabledTask = false;
  1106. this.viewDisabled = false;
  1107. }
  1108. // this.$set(this.form, 'shipType', '物流')
  1109. // this.$set(this.form, 'receivableType', '现金')
  1110. // this.optionContactsBack.column.forEach(item => {
  1111. // this.$set(item, 'disabled', false)
  1112. // })
  1113. // this.optionContactsBack.column.forEach(item => {
  1114. // if (item.label === '规格型号' || item.label === '花纹' || item.label === '品牌' || item.label === '物料编码' || item.label === '单位' || item.label === '轮胎描述') {
  1115. // item.disabled = true;
  1116. // }
  1117. // })
  1118. // this['optionContacts'] = this['optionContactsBack'];
  1119. // this.delColumnData(this.getColumnName(269.1), this['optionContactsBack']);
  1120. this.form.outboundRecordsList.forEach(item=>{
  1121. if(item.statusName == '待出库'){
  1122. this.isDisabledTask = true
  1123. }
  1124. })
  1125. loading.close()
  1126. }
  1127. // this.$set(this.form.orderItemsList,'goodsNum',66)
  1128. },
  1129. generateOutbound() {
  1130. if (!this.form.id) {
  1131. this.$message.error('请先保存')
  1132. } else {
  1133. if (this.buttonText === '生成任务') {
  1134. //生成任务逻辑
  1135. if (this.form.orderItemsList.length <= 0) {
  1136. this.$message.error('请录入明细');
  1137. } else {
  1138. this.$set(this.optionForm, 'disabled', true)
  1139. this.$set(this.optionContactsBack, 'disabled', true)
  1140. this.$refs["form"].validate((valid, done) => {
  1141. if (valid) {
  1142. // this.form.orderItemsList.forEach((items) => {
  1143. // let brandName = items.brandId
  1144. // items.brandId = items.brandName
  1145. // items.brandName = brandName
  1146. // let goodsName = items.goodsId
  1147. // items.goodsId = items.goodsName
  1148. // items.goodsName = goodsName
  1149. // })
  1150. this.$refs["form"].validate((valid, done) => {
  1151. done();
  1152. if (valid) {
  1153. const loading = this.$loading({
  1154. lock: true,
  1155. text: '加载中',
  1156. spinner: 'el-icon-loading',
  1157. background: 'rgba(255,255,255,0.7)'
  1158. });
  1159. submit({
  1160. bsType: "XS",
  1161. ...this.form
  1162. }).then(res => {
  1163. console.log(1);
  1164. this.refresh(res.data.data.id)
  1165. this.isDisabledTask = false
  1166. generateShipTask(this.form).then(res => {
  1167. console.log(res.data);
  1168. // 将按钮文本更改为"撤销任务"
  1169. this.buttonText = '撤销任务';
  1170. // 将按钮颜色更改为对应的颜色
  1171. this.buttonColor = 'warning'; // 比如改为warning
  1172. this.refresh(res.data.data.id, true)
  1173. this.isContacts = true
  1174. this.$message.success("生成出库任务成功");
  1175. this.isApplySettlement = false
  1176. }).finally(() => {
  1177. loading.close();
  1178. });
  1179. }).finally(() => {
  1180. loading.close();
  1181. });
  1182. } else {
  1183. return false;
  1184. }
  1185. });
  1186. done();
  1187. } else {
  1188. this.$message.error('请选择仓库')
  1189. }
  1190. })
  1191. }
  1192. } else {
  1193. this.$refs["form"].validate((valid, done) => {
  1194. console.log(valid);
  1195. if (valid) {
  1196. const loading = this.$loading({
  1197. lock: true,
  1198. text: '加载中',
  1199. spinner: 'el-icon-loading',
  1200. background: 'rgba(255,255,255,0.7)'
  1201. });
  1202. // this.form.orderItemsList.forEach((items) => {
  1203. // let brandName = items.brandId
  1204. // items.brandId = items.brandName
  1205. // items.brandName = brandName
  1206. // let goodsName = items.goodsId
  1207. // items.goodsId = items.goodsName
  1208. // items.goodsName = goodsName
  1209. // })
  1210. revokeGenerateShipTask(this.form).then(res => {
  1211. // 将按钮文本更改为"生成任务"
  1212. this.buttonText = '生成任务';
  1213. // 将按钮颜色还原为success
  1214. this.buttonColor = 'success';
  1215. this.$message.success("撤销出库成功");
  1216. this.refresh(res.data.data.id)
  1217. this.isApplySettlement = false
  1218. loading.close();
  1219. }).catch((err) => {
  1220. console.log(err);
  1221. if (err instanceof TooManyResultsException) {
  1222. // 不显示错误消息
  1223. return;
  1224. }
  1225. // 显示其他错误消息
  1226. this.$message.error('发生错误,请稍后重试');
  1227. }).finally(() => {
  1228. loading.close();
  1229. });
  1230. done();
  1231. }
  1232. })
  1233. }
  1234. }
  1235. },
  1236. //联系人change
  1237. contactsChange(e) {
  1238. console.log(e);
  1239. console.log(this.contactsOption);
  1240. // 假设this.contactsOption是你的数组对象
  1241. let matchedContact = this.contactsOption.find(item => item.contacts == e);
  1242. // 判断是否找到匹配的对象
  1243. this.$set(this.form, 'phone', matchedContact.tel)
  1244. this.$set(this.form, 'recAddress', matchedContact.belongtoarea + matchedContact.detailedAddress)
  1245. },
  1246. //修改提交触发
  1247. editCustomer() {
  1248. this.$refs["form"].validate((valid, done) => {
  1249. done();
  1250. if (valid) {
  1251. const loading = this.$loading({
  1252. lock: true,
  1253. text: '加载中',
  1254. spinner: 'el-icon-loading',
  1255. background: 'rgba(255,255,255,0.7)'
  1256. });
  1257. // this.form.orderItemsList.forEach(its => {
  1258. // console.log(its.goodsId);
  1259. // console.log(its.goodsName);
  1260. // its.brandId = its.brandName
  1261. // let goodsName = its.goodsId
  1262. // its.goodsId = its.goodsName
  1263. // its.goodsName = goodsName
  1264. // })
  1265. submit({
  1266. bsType: "XS",
  1267. ...this.form
  1268. }).then(res => {
  1269. this.$message.success("保存成功");
  1270. this.refresh(res.data.data.id)
  1271. this.isDisabledTask = false
  1272. this.editButton = true
  1273. loading.close();
  1274. }).finally(() => {
  1275. loading.close();
  1276. });
  1277. } else {
  1278. return false;
  1279. }
  1280. });
  1281. },
  1282. //保存
  1283. save() {
  1284. this.$refs["form"].validate((valid, done) => {
  1285. done();
  1286. if (valid) {
  1287. const loading = this.$loading({
  1288. lock: true,
  1289. text: '加载中',
  1290. spinner: 'el-icon-loading',
  1291. background: 'rgba(255,255,255,0.7)'
  1292. });
  1293. submit({
  1294. bsType: "XS",
  1295. ...this.form
  1296. }).then(res => {
  1297. console.log(1);
  1298. this.refresh(res.data.data.id)
  1299. this.isDisabledTask = false
  1300. loading.close();
  1301. }).finally(() => {
  1302. loading.close();
  1303. });
  1304. } else {
  1305. return false;
  1306. }
  1307. });
  1308. },
  1309. //关闭弹窗表单
  1310. beforeClose(done, type) {
  1311. console.log(type);
  1312. // if(row == "add"){
  1313. // this.form.sharedCompanyId = this.form.sharedCompanyId?this.form.sharedCompanyId:''
  1314. // this.form.sharedCompanyName = this.form.sharedCompanyName?this.form.sharedCompanyName:''
  1315. // }
  1316. console.log('this.form.sharedCompanyId', this.form.sharedCompanyId);
  1317. console.log('this.form.sharedCompanyName', this.form.sharedCompanyName);
  1318. done()
  1319. },
  1320. refresh(id, type) {
  1321. const loading = this.$loading({
  1322. lock: true,
  1323. text: '加载中',
  1324. spinner: 'el-icon-loading',
  1325. background: 'rgba(255,255,255,0.7)'
  1326. })
  1327. getDetails({ id: id }).then(res => {
  1328. this.form = res.data.data
  1329. let ordForm = { srcBillNo: this.form.ordNo }
  1330. let _this = this
  1331. getList(1, 50, ordForm).then((res) => {
  1332. this.dataList = res.data.data.records ? res.data.data.records : [];
  1333. })
  1334. if (this.form.status !== '录入' && this.form.status !== '退款中' && this.form.status !== '已取消' && this.form.status !== '退款请核' && this.form.status !== '已退款' && this.form.status !== '待确认' && this.form.status !== '待发货') {
  1335. console.log(1);
  1336. this.isApplySettlement = false;
  1337. }
  1338. if (
  1339. this.form.status === '已退款' ||
  1340. this.form.status === '已收货' ||
  1341. this.form.status === '已发货' ||
  1342. this.form.status === '已取消'
  1343. ) {
  1344. // 禁用编辑按钮
  1345. console.log('按钮全部禁用');
  1346. this.isEditButton = true;
  1347. this.isSaveBtn = true;
  1348. this.isDisabledTask = true;
  1349. this.viewDisabled = true;
  1350. }
  1351. if(this.form.status === '已发货' ){
  1352. this.isDisabledTask = true;
  1353. this.viewDisabled = true;
  1354. this.isEditButton = false;
  1355. }
  1356. // else {
  1357. // this.isSaveBtn = true;
  1358. // this.isDisabledTask = true;
  1359. // this.viewDisabled = true;
  1360. // }
  1361. if (this.form.status == '退款中') {
  1362. this.isConfirmRefundBtn = false;
  1363. }
  1364. if (this.form.status == '已取消') {
  1365. this.isConfirmRefundBtn = true;
  1366. }
  1367. if (this.form.generateTask == '已生成') {
  1368. this.buttonText = '撤销任务';
  1369. // this.isDisabledTask = false;
  1370. this.buttonColor = 'warning'
  1371. }
  1372. if (this.form.status == '退款请核' || this.form.status == '退款中') {
  1373. this.isRevocationRequest = false;
  1374. }
  1375. if(this.form.status == '待发货'){
  1376. this.isApplySettlement = false
  1377. }
  1378. //成本、毛利对销售角色隐藏
  1379. this.optionForm.column.forEach(its => {
  1380. if (JSON.parse(localStorage.getItem('saber-userInfo')).content.role_name.split(',').includes('销售')) {
  1381. if (its.prop == 'cost' || its.prop == 'grossProfit') {
  1382. this.$set(its, 'display', false)
  1383. }
  1384. }
  1385. })
  1386. this.form.orderItemsList.forEach((items) => {
  1387. if (!items.subTotalMoney) {
  1388. items.subTotalMoney = items.goodsNum * items.price
  1389. items.grossProfit = items.subTotalMoney - items.costprie
  1390. }
  1391. // let brandName = items.brandId
  1392. // items.brandId = items.brandName
  1393. // items.brandName = brandName
  1394. // let goodsName = items.goodsId
  1395. // items.goodsId = items.goodsName
  1396. // items.goodsName = goodsName
  1397. })
  1398. loading.close();
  1399. // if (this.form.businessSource == "外部销售") {
  1400. // console.log('外部销售');
  1401. // this.optionForm.column.forEach(its => {
  1402. // if (its.prop == 'customerId') {
  1403. // this.$set(its, 'disabled', true)
  1404. // }
  1405. // })
  1406. // //不能录入不能删除
  1407. // this.$set(this.optionContactsBack, "addBtn", false)
  1408. // this.isDisabled = true
  1409. // this.$set(this.form, 'shipType', '物流')
  1410. // this.$set(this.form, 'receivableType', '网络支付')
  1411. // this.optionContactsBack.column.forEach(item => {
  1412. // this.$set(item, 'disabled', true)
  1413. // if (item.label == '批次号' || item.label == '备注') {
  1414. // item.disabled = false
  1415. // }
  1416. // })
  1417. // this['optionContacts'] = this['optionContactsBack'];
  1418. // this.delColumnData(this.getColumnName(269.1), this['optionContactsBack']);
  1419. // this.optionContactsBack.column.forEach(item => {
  1420. // if (item.prop == 'dot') {
  1421. // this.$set(item, disabled, false)
  1422. // } else {
  1423. // this.$set(item, disabled, true)
  1424. // }
  1425. // })
  1426. // } else {
  1427. // this.$set(this.form, 'shipType', '物流')
  1428. // this.$set(this.form, 'receivableType', '现金')
  1429. // this.optionContactsBack.column.forEach(item => {
  1430. // this.$set(item, 'disabled', false)
  1431. // })
  1432. // this.optionContactsBack.column.forEach(item => {
  1433. // if (item.label === '规格型号' || item.label === '花纹' || item.label === '品牌' || item.label === '物料编码' || item.label === '单位' || item.label === '商品描述') {
  1434. // item.disabled = true;
  1435. // }
  1436. // })
  1437. // console.log(324324);
  1438. // this['optionContacts'] = this['optionContactsBack'];
  1439. // this.delColumnData(this.getColumnName(269.1), this['optionContactsBack']);
  1440. // }
  1441. // // this.$set(this.form.orderItemsList,'goodsNum',66)
  1442. }).catch(() => {
  1443. loading.close();
  1444. })
  1445. },
  1446. //请核关闭
  1447. choceScheduleFun() {
  1448. this.checkScheduleDialog = false
  1449. },
  1450. //关闭审核
  1451. choceCheckFun() {
  1452. this.isExamineBtn = !this.isExamineBtn
  1453. this.checkDialog = false;
  1454. },
  1455. //申请退款
  1456. applySettlement(type) {
  1457. this.$confirm("您确定申请退款吗?", {
  1458. confirmButtonText: "确定",
  1459. cancelButtonText: "取消",
  1460. type: "warning"
  1461. }).then(() => {
  1462. this.$refs["form"].validate((valid, done) => {
  1463. done()
  1464. if (valid) {
  1465. const data = {
  1466. id: this.form.id,
  1467. url: '/tirePartsMall/salesManagement/saleOrder/index',
  1468. pageStatus: "this.$store.getters.ltxsStatus",
  1469. pageLabel: "销售订单",
  1470. }
  1471. const loading = this.$loading({
  1472. lock: true,
  1473. text: '加载中',
  1474. spinner: 'el-icon-loading',
  1475. background: 'rgba(255,255,255,0.7)'
  1476. });
  1477. checkOrder({ ...data }).then((res) => {
  1478. this.refresh(res.data.data.id)
  1479. this.$message.success('申请退款成功');
  1480. this.isApplySettlement = !this.isApplySettlement
  1481. loading.close();
  1482. console.log(res);
  1483. }).catch(() => { loading.close(); })
  1484. }
  1485. })
  1486. })
  1487. },
  1488. //确认退款
  1489. confirmRefundBtn() {
  1490. this.$confirm("您确定退款吗?", {
  1491. confirmButtonText: "确定",
  1492. cancelButtonText: "取消",
  1493. type: "warning"
  1494. }).then(() => {
  1495. const loading = this.$loading({
  1496. lock: true,
  1497. text: '加载中',
  1498. spinner: 'el-icon-loading',
  1499. background: 'rgba(255,255,255,0.7)'
  1500. });
  1501. // this.form.orderItemsList.forEach((items) => {
  1502. // let brandName = items.brandId
  1503. // items.brandId = items.brandName
  1504. // items.brandName = brandName
  1505. // let goodsName = items.goodsId
  1506. // items.goodsId = items.goodsName
  1507. // items.goodsName = goodsName
  1508. // })
  1509. confirmRefund({ ...this.form }).then((res) => {
  1510. loading.close()
  1511. this.$message.success('确定退款成功');
  1512. }).catch(() => { loading.close(); })
  1513. })
  1514. },
  1515. //审批
  1516. examineBtn() {
  1517. this.checkData = this.$route.query.check
  1518. this.checkDialog = true;
  1519. },
  1520. //撤销请核
  1521. revocationRequest() {
  1522. this.$confirm("您确定撤回此次申请吗?", {
  1523. confirmButtonText: "确定",
  1524. cancelButtonText: "取消",
  1525. type: "warning"
  1526. }).then(() => {
  1527. const loading = this.$loading({
  1528. lock: true,
  1529. text: '加载中',
  1530. spinner: 'el-icon-loading',
  1531. background: 'rgba(255,255,255,0.7)'
  1532. });
  1533. // this.form.orderItemsList.forEach((items) => {
  1534. // if (!items.subTotalMoney) {
  1535. // items.subTotalMoney = items.goodsNum * items.price
  1536. // items.grossProfit = items.subTotalMoney - items.costprie
  1537. // }
  1538. // let brandName = items.brandId
  1539. // items.brandId = items.brandName
  1540. // items.brandName = brandName
  1541. // let goodsName = items.goodsId
  1542. // items.goodsId = items.goodsName
  1543. // items.goodsName = goodsName
  1544. // })
  1545. revokeCheckOrder({ ...this.form }).then(res => {
  1546. this.isRevocationRequest = !this.isRevocationRequest
  1547. this.refresh(res.data.data.id)
  1548. this.$message.success('撤回成功')
  1549. loading.close();
  1550. })
  1551. })
  1552. },
  1553. rowDelBox(row, index, type) {
  1554. this.$confirm("确定将选择数据删除?", {
  1555. confirmButtonText: "确定",
  1556. cancelButtonText: "取消",
  1557. type: "warning"
  1558. }).then(() => {
  1559. if (row.id) {
  1560. delOrderItem({ ids: row.id }).then(res => {
  1561. this.form.orderItemsList.splice(index, 1);
  1562. this.$message.success("操作成功!");
  1563. });
  1564. } else {
  1565. this.form[type].splice(index, 1);
  1566. this.$message.success("操作成功!");
  1567. }
  1568. }
  1569. );
  1570. },
  1571. rowSave(form, done, loading) {
  1572. if (this.isStatus) {
  1573. done(form)
  1574. } else {
  1575. this.$message.error('请选择相同公司的轮胎')
  1576. }
  1577. console.log(form);
  1578. // this.form.sharedCompanyId = res.data.data.sharedCompanyId
  1579. // this.form.sharedCompanyName = res.data.data.sharedCompanyName
  1580. },
  1581. rowUpdate(form, index, done, loading) {
  1582. done(form)
  1583. },
  1584. // 新增轮胎
  1585. rowAdd(row) {
  1586. if (!this.form.customerId) {
  1587. this.$message.error('请选择客户')
  1588. return
  1589. }
  1590. this.optionContactsBack.column.forEach(its => {
  1591. if (its.prop == 'goodsId' || its.prop == 'goodsNum' || its.prop == 'price' || its.prop == 'dot' || its.prop == 'remarks') {
  1592. its.disabled = false
  1593. } else {
  1594. its.disabled = true
  1595. }
  1596. })
  1597. console.log('新增了', row);
  1598. this.$refs.formContacts.rowAdd()
  1599. },
  1600. //打印
  1601. handlePrint() {
  1602. this.switchDialog = !this.switchDialog;
  1603. },
  1604. onClose(val) {
  1605. this.switchDialog = val;
  1606. },
  1607. //自定义列保存
  1608. async saveColumnTwo(ref, option, optionBack, code) {
  1609. /**
  1610. * 已定义全局方法,直接使用,saveColumnData保存列数据方法,参数传值(表格名称,当前表格的option数据)
  1611. * 已定义全局方法,直接使用,getColumnName方法用来获取枚举值,参数根据自己定义的code值获取中文名
  1612. * 一定要执行异步操作,要等接口成功返回,才能执行下一行代码
  1613. */
  1614. const inSave = await this.saveColumnData(this.getColumnName(code), this[option]);
  1615. if (inSave) {
  1616. this.$message.success("保存成功");
  1617. //关闭窗口
  1618. this.$refs[ref].$refs.dialogColumn.columnBox = false;
  1619. }
  1620. },
  1621. //自定义列重置
  1622. async resetColumnTwo(ref, option, optionBack, code) {
  1623. this[option] = this[optionBack];
  1624. const inSave = await this.delColumnData(this.getColumnName(code), this[optionBack]);
  1625. if (inSave) {
  1626. this.$message.success("重置成功");
  1627. this.$refs[ref].$refs.dialogColumn.columnBox = false;
  1628. }
  1629. },
  1630. backToList(type) {
  1631. this.$emit("backToList", type);
  1632. }
  1633. }
  1634. }
  1635. </script>
  1636. <style lang="scss" scoped>
  1637. ::v-deep .el-form-item {
  1638. margin-bottom: 8px !important;
  1639. }
  1640. </style>