detailsPage.vue 68 KB

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