detailsPage.vue 95 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155
  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="goodsNum" slot-scope="{ row }">
  73. <el-input v-if="row.goodsNumtype" size="small" v-model="row.goodsNum" style="width: 100%"></el-input>
  74. <span v-else>{{ row.goodsNum }}</span>
  75. </template>
  76. <template slot="price" slot-scope="{ row }">
  77. <el-input v-if="row.pricetype" size="small" v-model="row.price" style="width: 100%"></el-input>
  78. <span v-else>{{ row.price }}</span>
  79. </template>
  80. <template slot="dot" slot-scope="{ row }">
  81. <el-select v-if="row.dotedittype && row.whether=='1'" v-model="row.dot" allow-create filterable default-first-option >
  82. <el-option v-for="(item, index) in picihaolist" :key="index" :label="item.dot"
  83. :value="item.id"></el-option>
  84. </el-select>
  85. <span v-else>{{ row.dot }}</span>
  86. </template>
  87. <template slot="remarks" slot-scope="{ row }">
  88. <el-input v-if="row.pricetype" size="small" v-model="row.remarks" style="width: 100%"></el-input>
  89. <span v-else>{{ row.remarks }}</span>
  90. </template>
  91. <!-- <template slot-scope="{scope,row}" slot="goodsNum">
  92. <el-input size="small" v-model="formContacts.goodsNum" style="width: 100%">
  93. <template slot="inventory">{{ inventory }}吨</template>
  94. </el-input>
  95. </template> -->
  96. <!-- <template slot="goodsId" slot-scope="{ row, index }">
  97. <span style="display:flex">
  98. <el-select v-model="row.goodsId" placeholder="请选择" size="small" filterable
  99. style="width:60%" >
  100. <el-option v-for="item in goodsIdoptions" :key="item.id" :label="item.cname"
  101. :value="item.id">
  102. </el-option>
  103. </el-select>
  104. <el-button icon="el-icon-search" size="small" @click="rePick(row, index)"></el-button>
  105. </span>
  106. </template> -->
  107. <template slot-scope="{type,size,row,index,disabled}" slot="menu">
  108. <el-button v-if="mingxibaocun" :size="size" :disabled="disabled || isAdd" :type="type"
  109. :icon="row.$cellEdit ? 'el-icon-plus' : 'el-icon-edit'" @click="hangeditBtn(row, index)">编辑
  110. </el-button>
  111. <el-button v-else :size="size" :disabled="disabled || isAdd" :type="type"
  112. :icon="row.$cellEdit ? 'el-icon-plus' : 'el-icon-edit'" @click="hangbaocun(row, index)">保存
  113. </el-button>
  114. <el-button icon="el-icon-delete" :size="size" :disabled="disabled || isDisabled"
  115. :type="type" @click="rowDelBox(row, index, 'orderItemsList')">删除
  116. </el-button>
  117. </template>
  118. </avue-crud>
  119. </el-tab-pane>
  120. <el-tab-pane label="支付明细" name="payment_details">
  121. <avue-crud :option="optionPaymentDetails" v-model="formContacts" ref="payment_details"
  122. :data="dataList" @row-save="rowSave" @row-update="rowUpdate"
  123. @resetColumn="resetColumnTwo('payment_details', 'optionPaymentDetails', 'optionPaymentDetailsBack', 269.2)"
  124. @saveColumn="saveColumnTwo('payment_details', 'optionPaymentDetails', 'optionPaymentDetailsBack', 269.2)">
  125. <!-- <template slot-scope="{type,size,row,index,disabled}" slot="menu">
  126. <el-button :size="size" :disabled="disabled" :type="type"
  127. :icon="row.$cellEdit ? 'el-icon-plus' : 'el-icon-edit'"
  128. @click="$refs.formContacts.rowCell(row, index)">{{ row.$cellEdit ? '确认' : '修改' }}
  129. </el-button>
  130. <el-button icon="el-icon-delete" :size="size" :disabled="disabled" :type="type"
  131. @click="rowDelBox(row, index, 'paymentRecordsList')">删除
  132. </el-button>
  133. </template> -->
  134. </avue-crud>
  135. </el-tab-pane>
  136. <el-tab-pane label="出库记录" name="outbound_records">
  137. <avue-crud :option="optionOutboundRecords" v-model="formContacts" ref="outbound_records"
  138. :data="form.outboundRecordsList" @row-save="rowSave" @row-update="rowUpdate"
  139. @resetColumn="resetColumnTwo('outbound_records', 'optionOutboundRecords', 'optionOutboundRecordsBack', 269.3)"
  140. @saveColumn="saveColumnTwo('outbound_records', 'optionOutboundRecords', 'optionOutboundRecordsBack', 269.3)">
  141. <!-- <template slot-scope="{type,size,row,index,disabled}" slot="menu">
  142. <el-button :size="size" :disabled="disabled" :type="type"
  143. :icon="row.$cellEdit ? 'el-icon-plus' : 'el-icon-edit'"
  144. @click="$refs.formContacts.rowCell(row, index)">{{ row.$cellEdit ? '确认' : '修改' }}
  145. </el-button>
  146. <el-button icon="el-icon-delete" :size="size" :disabled="disabled" :type="type"
  147. @click="rowDelBox(row, index)">删除
  148. </el-button>
  149. </template> -->
  150. </avue-crud>
  151. </el-tab-pane>
  152. </el-tabs>
  153. </trade-card>
  154. <report-dialog :switchDialog="switchDialog" reportName="轮胎商城-销售订单" :reportId="form.id"
  155. @onClose="onClose()"></report-dialog>
  156. <el-dialog append-to-body title="审批" class="el-dialogDeep" :visible.sync="checkDialog" width="50%"
  157. :close-on-click-modal="false" :destroy-on-close="true" :close-on-press-escape="false" v-dialog-drag>
  158. <check :checkData="checkData" :checkDetail="true" :idList="[]" @operationType="operationType"
  159. @choceCheckFun="choceCheckFun">
  160. </check>
  161. </el-dialog>
  162. <el-dialog append-to-body title="审批进度" class="el-dialogDeep" :visible.sync="checkScheduleDialog" width="40%"
  163. :close-on-click-modal="false" :destroy-on-close="true" :close-on-press-escape="false" v-dialog-drag>
  164. <check-schedule :checkId="checkId" :batchNo="batchNo" @choceScheduleFun="choceScheduleFun"></check-schedule>
  165. </el-dialog>
  166. </div>
  167. <el-dialog title="选择轮胎" append-to-body class="el-dialogDeep" :visible.sync="dialogVisible" width="80%"
  168. :close-on-click-modal="false" :destroy-on-close="true" :close-on-press-escape="false" @close="closeGoods">
  169. <el-row :style="{ height: rowHeight }">
  170. <el-col :span="5" style="height: 100%;overflow-y: auto">
  171. <div>
  172. <el-scrollbar>
  173. <basic-container>
  174. <avue-tree :option="treeOption" :data="treeDataGoods" @node-click="nodeClick" />
  175. </basic-container>
  176. </el-scrollbar>
  177. </div>
  178. </el-col>
  179. <el-col :span="19">
  180. <basic-container>
  181. <avue-crud :option="optionTwo" :table-loading="loading" :data="goodsListShow" ref="crud"
  182. @refresh-change="refreshChange" @selection-change="selectionChange" @search-change="goodsSearch"
  183. :page.sync="page" @on-load="onLoad"
  184. @resetColumn="resetCrud" @saveColumn="saveCrud">
  185. <template slot="menuLeft">
  186. <el-tabs v-model="activeNameTabs" @tab-click="tabHandle">
  187. <el-tab-pane label="查询结果" name="searchList" />
  188. <el-tab-pane label="已选定数据" name="importStaging" />
  189. </el-tabs>
  190. </template>
  191. <template slot="goodsNum" slot-scope="{row}">
  192. <el-input-number v-model="row.goodsNum" size="small" :controls="false" :precision="0"
  193. @input="amountChange(row)" style="width: 100%" />
  194. </template>
  195. <template slot="dot" slot-scope="{row}">
  196. <el-select v-model="row.dot" allow-create filterable default-first-option @focus="picihaolistfun(row.goodsId)">
  197. <el-option v-for="(item, index) in picihaolist" :key="index" :label="item.dot"
  198. :value="item.dot"></el-option>
  199. </el-select>
  200. <!--<span v-else>{{ row.dot }}</span>-->
  201. </template>
  202. <template slot-scope="scope" slot="menu">
  203. <el-button type="text" icon="el-icon-edit" size="small"
  204. @click.stop="importStagList(scope.row, scope.index)" v-if="activeNameTabs == 'searchList'"
  205. :disabled="goodsListSave.findIndex(item => item.id == scope.row.id) !== -1">选择
  206. </el-button>
  207. <el-button type="text" icon="el-icon-delete" size="small"
  208. @click.stop="removeStagList(scope.row, scope.index)" v-else>移除
  209. </el-button>
  210. </template>
  211. </avue-crud>
  212. </basic-container>
  213. </el-col>
  214. </el-row>
  215. <span slot="footer" class="dialog-footer">
  216. <el-button @click="dialogVisible = false" :loading="saveLoading">取 消</el-button>
  217. <el-button type="primary" @click="importGoods" v-if="commodityData !== true" :loading="saveLoading">导入</el-button>
  218. <!--<el-button type="primary" @click="importChoice" v-if="commodityData === true" :loading="saveLoading"-->
  219. <!-- :disabled="tableData.length !== 1">导入</el-button>-->
  220. </span>
  221. </el-dialog>
  222. </div>
  223. </template>
  224. <script>
  225. import { getDetails as getCustom } from "@/api/tirePartsMall/basicData/customerInformation"
  226. import { getDetails, submit, generateShipTask, tradingBox, delOrderItem, checkOrder, confirmRefund, revokeCheckOrder, revokeGenerateShipTask, goodsListXs } from "@/api/tirePartsMall/salesManagement/saleOrder";
  227. import { dotList, goodsDetail } from "@/api/tirePartsMall/purchasingManagement/warehouseEntryOrder";
  228. import reportDialog from "@/components/report-dialog/main";
  229. import { dateFormat } from "@/util/date";
  230. import checkSchedule from "@/components/check/checkSchedule";
  231. import check from "@/components/check/check";
  232. import {getList, listAll} from "@/api/tirePartsMall/basicData/listingManagement"
  233. import commodityxsho from '../../configuration/commodityxsho.json'
  234. import TicketDistribution from "../../../oceanShipping/maritimeExport/components/ticketDistribution.vue";
  235. import M from "minimatch";
  236. import da from "element-ui/src/locale/lang/da";
  237. import { number } from "echarts";
  238. export default {
  239. name: "detailsPage",
  240. data() {
  241. return {
  242. // 编辑还是保存
  243. mingxibaocun:true,
  244. // 批次号请求到的数据
  245. picihaolist:[],
  246. // 添加轮胎弹窗
  247. dialogVisible:false,
  248. // 弹窗高度
  249. rowHeight: '',
  250. // 左侧选择搜索
  251. treeDataGoods: [],
  252. treeDeptId: '',
  253. page: {
  254. pageSize: 10,
  255. currentPage: 1,
  256. total: 0,
  257. pageSizes: [10, 50, 100, 300, 500]
  258. },
  259. pageList: {
  260. pageSize: 10,
  261. currentPage: 1,
  262. total: 0
  263. },
  264. // 左侧选择
  265. treeOption:{
  266. addBtn: false,
  267. menu: false,
  268. size: "small",
  269. props: {
  270. labelText: "标题",
  271. label: "cname",
  272. value: "id",
  273. }
  274. },
  275. // 表格需要的配置
  276. optionTwo: commodityxsho,
  277. loading: false,
  278. // 商品列表数据合计
  279. goodsListShow: [],
  280. // 商品列表暂存
  281. goodsListSave: [],
  282. saveLoading: false,
  283. commodityData: false,
  284. surplusRouteQuantityOption: [],
  285. tableData: [],
  286. // tabs切换
  287. activeNameTabs:'searchList',
  288. data:[],
  289. inventory: 0,
  290. isStatus: 1,
  291. goodsIdoptions: [],
  292. dataList: [],
  293. dicUrlWithCustomId: '',
  294. sharedCompanyId: 0,
  295. isAddBtn: true,
  296. isSaveBtn: false,
  297. viewDisabled: false,
  298. isAdd: false,
  299. editButton: true,
  300. isEditButton: false,
  301. goods: [],
  302. isDisabled: false,
  303. isDisabledTask: false,
  304. contactsOption: [],
  305. isContacts: false,
  306. checkData: {},
  307. buttonText: '生成任务',
  308. buttonColor: 'success', // 初始颜色为success
  309. checkScheduleDialog: false,
  310. isApplySettlement: true,
  311. isConfirmRefundBtn: true,
  312. isExamineBtn: true,
  313. isRevocationRequest: true,
  314. checkDialog: false,
  315. checkId: '',
  316. batchNo: '',
  317. switchDialog: false,
  318. activeName: "sale_detail",
  319. disabled: false,
  320. key: 0,
  321. form: {
  322. orderItemsList: [],
  323. paymentRecordsList: [],
  324. outboundRecordsList: []
  325. },
  326. optionForm: {
  327. menuBtn: false,
  328. span: 8,
  329. disabled: false,
  330. column: [{
  331. label: '客户',
  332. prop: "customerId",
  333. disabled: false,
  334. remote: true,
  335. type: 'select',
  336. props: {
  337. label: 'cname',
  338. value: 'id'
  339. },
  340. cascader: ['recAddress'],
  341. click: () => {
  342. this.$refs.form.dicInit()
  343. },
  344. change: (data) => {
  345. if (!this.onLoad.id) {
  346. // this.$set(this.optionContactsBack, "addBtn", true)
  347. // this['optionContacts'] = this['optionContactsBack'];
  348. // this.delColumnData(this.getColumnName('269.1'), this['optionContactsBack']);
  349. }
  350. if (this.$refs.form.DIC.customerId || !this.onLoad.id) {
  351. getCustom({ id: data.value }).then(res => {
  352. if (res.data.data) {
  353. this.dicUrlWithCustomId = res.data.data.id ? res.data.data.id : ''
  354. // this.form.storageId ? this.form.storageId : res.data.data.deliveryWarehouseId
  355. // this.form.storageId = res.data.data.deliveryWarehouseId
  356. this.form.storageId = this.form.storageId ? this.form.storageId : res.data.data.deliveryWarehouseId
  357. this.form.contacts = res.data.data.corpsAttnList[0].cname
  358. this.form.phone = res.data.data.corpsAttnList[0].tel
  359. this.contactsOption = res.data.data.corpsAddrList
  360. this.form.recAddress = res.data.data.corpsAddrList[0].belongtoarea + res.data.data.corpsAddrList[0].detailedAddress
  361. this.form.salerId = res.data.data.salesmanId?res.data.data.salesmanId:''
  362. }
  363. })
  364. }
  365. // if (this.$refs.form.DIC.customerId || data.value) {
  366. // for (let item of this.$refs.form.DIC.customerId) {
  367. // if (item.id == data.value) {
  368. // console.log(data);
  369. // console.log(this.$refs.form);
  370. // console.log(item);
  371. // // 后端返回数据暂无联系人、地址等数据,无法下拉默认
  372. // this.form.phone = item.tel
  373. // }
  374. // }
  375. // }
  376. },
  377. dicUrl: '/api/blade-sales-part/corpsDesc/listAll?cname={{key}}&corpType=KH&enableOrNot=1',
  378. rules: [{
  379. required: true,
  380. message: " ",
  381. trigger: "blur"
  382. }]
  383. }, {
  384. label: '业务员',
  385. disabled:false,
  386. prop: "salerId",
  387. type: "select",
  388. props: {
  389. label: "name",
  390. value: "id"
  391. },
  392. dicUrl: "/api/blade-user/client/getUserByRole",
  393. filterable: true,
  394. rules: [{
  395. required: true,
  396. message: " ",
  397. trigger: "blur"
  398. }]
  399. }, {
  400. label: '仓库',
  401. prop: "storageId",
  402. type: 'select',
  403. disabled: false,
  404. placeholder: '仓库为空即为异地销售',
  405. props: {
  406. label: 'cname',
  407. value: 'id'
  408. },
  409. dicUrl: '/api/blade-sales-part/storageDesc/listAll',
  410. // rules: [{
  411. // required: true,
  412. // message: " ",
  413. // trigger: "blur"
  414. // }]
  415. },
  416. {
  417. label: '联系人',
  418. type: "select",
  419. prop: "contacts",
  420. disabled: false,
  421. props: {
  422. label: 'address',
  423. value: 'id'
  424. },
  425. dicUrl: '/api/blade-sales-part/corpsAddr/corpIdByAddr?pid={{key}}'
  426. }, {
  427. label: '电话',
  428. disabled: false,
  429. prop: "phone",
  430. }, {
  431. label: '收货地址',
  432. prop: "recAddress",
  433. type: 'select',
  434. filterable: true,
  435. disabled: false,
  436. props: {
  437. label: 'address',
  438. value: 'address'
  439. },
  440. dicUrl: '/api/blade-sales-part/corpsAddr/corpIdByAddr?pid={{key}}'
  441. }, {
  442. label: '业务日期',
  443. prop: "businesDate",
  444. searchProp: "businesDateList",
  445. disabled: false,
  446. type: "datetime",
  447. value: dateFormat(new Date(), 'yyyy-MM-dd'),
  448. format: "yyyy-MM-dd",
  449. valueFormat: "yyyy-MM-dd",
  450. rules: [
  451. {
  452. required: true,
  453. message: "",
  454. trigger: "blur"
  455. }
  456. ]
  457. }, {
  458. label: '收款方式',
  459. prop: "receivableType",
  460. type: "select",
  461. disabled: false,
  462. dicUrl: "/api/blade-system/dict-biz/dictionary?code=receivableType",
  463. props: {
  464. label: "dictValue",
  465. value: "dictValue"
  466. },
  467. value: '网络支付'
  468. },
  469. {
  470. label: '业务来源',
  471. prop: "businessSource",
  472. disabled: true
  473. }, {
  474. label: '配送方式',
  475. type: 'select',
  476. prop: "shipType",
  477. disabled: false,
  478. dicUrl: "/api/blade-system/dict-biz/dictionary?code=deliveryMethod",
  479. props: {
  480. label: "dictValue",
  481. value: "dictValue"
  482. },
  483. value: '物流'
  484. }, {
  485. label: '物流公司',
  486. disabled: false,
  487. prop: "logisticsCorpName"
  488. }, {
  489. label: '成本',
  490. prop: "cost",
  491. display: true,
  492. disabled: true
  493. }, {
  494. label: '毛利',
  495. prop: "grossProfit",
  496. disabled: true
  497. }, {
  498. label: '销售金额',
  499. prop: "salesAmount",
  500. disabled: true
  501. }, {
  502. label: '运费',
  503. prop: "freight",
  504. disabled: true
  505. }, {
  506. label: '总金额',
  507. prop: "totalMoney",
  508. disabled: true
  509. }, {
  510. label: '结算金额',
  511. prop: "paymentAmountTl",
  512. disabled: true
  513. },{
  514. label: '单据编号',
  515. prop: "ordNo",
  516. disabled: true
  517. }, {
  518. label: '来源单号',
  519. prop: "srcOrdNo",
  520. disabled: true
  521. },{
  522. label: '备注',
  523. prop: "remarks",
  524. type: 'textarea',
  525. disabled: false,
  526. span: 16,
  527. minRows: 1
  528. }]
  529. },
  530. formContacts: {},
  531. optionContacts: {},
  532. optionContactsBack: {
  533. disabled: false,
  534. goodsId:'',
  535. border: true,
  536. align: 'center',
  537. index: true,
  538. showSummary: true,
  539. addBtnText: "添加轮胎",
  540. updateBtnText: '保存',
  541. refreshBtn: false,
  542. dialogDrag: true,
  543. addBtn: false,
  544. // 航编辑开启
  545. cellBtn:true,
  546. span: 8,
  547. height: 500,
  548. addRowBtn: false,
  549. editBtn: false,
  550. delBtn: false,
  551. menuWidth: 140,
  552. dialogTop: 25,
  553. dialogWidth: "80%",
  554. summaryText: "合计",
  555. showSummary: true,
  556. sumColumnList: [{
  557. name: "goodsNum",
  558. type: "sum"
  559. }, {
  560. name: "sendNum",
  561. type: "sum"
  562. }, {
  563. name: "profit",
  564. type: "sum"
  565. }, {
  566. name: "subTotalMoney",
  567. type: "sum"
  568. }, {
  569. name: "thisAmount",
  570. type: "sum"
  571. }, {
  572. name: "costprie",
  573. type: "sum"
  574. }, {
  575. name: "grossProfit",
  576. type: "sum"
  577. }],
  578. column: [{
  579. label: '轮胎名称',
  580. prop: 'goodsId',
  581. width: 200,
  582. disabled: false,
  583. remote: true,
  584. overHidden: true,
  585. type: 'select',
  586. dicData: [],
  587. props: {
  588. label: 'cname',
  589. value: 'id'
  590. },
  591. // dicUrl: '/api/blade-sales-part/goodsDesc/goodsListAll?cname={{key}}'
  592. dicUrl: `/api/blade-sales-part/goodsDesc/goodsListXs?cname={{key}}&customId=&enableOrNot=1&stock=${this.goodsId}`
  593. // dicUrl: "/api/blade-sales-part/goodsDesc/goodsListXs?cname={{key}}"
  594. }, {
  595. label: '数量',
  596. prop: 'goodsNum',
  597. overHidden: true,
  598. disabled: false,
  599. cell:true,
  600. width: 100,
  601. rules: [{
  602. required: true,
  603. message: " ",
  604. trigger: "blur"
  605. }, {
  606. validator: (rule, value, callback) => {
  607. console.log(this.formContacts.inventory);
  608. if (value < 0) {
  609. callback(new Error("数量不能小于0"));
  610. } else if (Number(value) > Number(this.formContacts.inventory)) {
  611. callback(new Error("数量不能大于库存"));
  612. } else {
  613. callback();
  614. }
  615. },
  616. trigger: "blur"
  617. }]
  618. },
  619. {
  620. label: '价格',
  621. prop: 'price',
  622. overHidden: true,
  623. width: 100,
  624. disabled: false,
  625. cell:true,
  626. rules: [{
  627. required: true,
  628. message: " ",
  629. trigger: "blur"
  630. }, {
  631. validator: (rule, value, callback) => {
  632. if (value < 0) {
  633. callback(new Error("价格不能小于0"));
  634. } else {
  635. callback();
  636. }
  637. },
  638. trigger: "blur"
  639. }]
  640. },
  641. {
  642. label: '库存',
  643. prop: 'inventory',
  644. overHidden: true,
  645. hide: true,
  646. width: 100
  647. }, {
  648. label: '批次号',
  649. prop: 'dot',
  650. cell:true,
  651. type: "select",
  652. width:120,
  653. disabled: true,
  654. allowCreate: true,
  655. filterable: true,
  656. dicData: [],
  657. props: {
  658. label: "dot",
  659. value: "dot"
  660. },
  661. dicUrl: "/api/blade-sales-part/stockDesc/dotList",
  662. overHidden: true,
  663. }, {
  664. label: '轮胎编码',
  665. prop: 'goodsNo',
  666. overHidden: true,
  667. disabled: false,
  668. width: 100
  669. },
  670. {
  671. label: '品牌',
  672. prop: 'brandId',
  673. disabled: false,
  674. width: 100,
  675. overHidden: true,
  676. type: 'select',
  677. props: {
  678. label: 'cname',
  679. value: 'id'
  680. },
  681. dicUrl: '/api/blade-sales-part/brandDesc/listAll'
  682. },
  683. {
  684. label: '规格型号',
  685. prop: 'propertyName',
  686. overHidden: true,
  687. disabled: false,
  688. width: 100
  689. }, {
  690. label: '花纹',
  691. prop: 'pattern',
  692. overHidden: true,
  693. disabled: false,
  694. width: 100
  695. }, {
  696. label: '轮胎描述',
  697. prop: 'goodsDescription',
  698. disabled: false,
  699. overHidden: true,
  700. width: 100
  701. },
  702. {
  703. label: '单位',
  704. prop: 'units',
  705. type: "select",
  706. disabled: false,
  707. props: {
  708. label: "dictValue",
  709. value: "dictValue"
  710. },
  711. dicUrl: "/api/blade-system/dict-biz/dictionary?code=unit",
  712. overHidden: true,
  713. width: 100
  714. },
  715. {
  716. label: '发货数量',
  717. prop: 'sendNum',
  718. disabled: false,
  719. overHidden: true,
  720. width: 100,
  721. disabled: true,
  722. editDisplay: false,
  723. addDisplay: false
  724. },
  725. // {
  726. // label: '利润',
  727. // prop: 'profit',
  728. // overHidden: true,
  729. // width: 100
  730. // },
  731. {
  732. label: '小计',
  733. prop: 'subTotalMoney',
  734. overHidden: true,
  735. width: 100,
  736. disabled: true,
  737. editDisplay: false,
  738. addDisplay: false
  739. },
  740. // {
  741. // label: '返利',
  742. // prop: 'thisAmount',
  743. // overHidden: true,
  744. // width: 100
  745. // },
  746. {
  747. label: '成本',
  748. prop: 'costprie',
  749. overHidden: true,
  750. width: 100,
  751. disabled: true,
  752. editDisplay: false,
  753. addDisplay: false
  754. },
  755. {
  756. label: '毛利',
  757. prop: 'grossProfit',
  758. overHidden: true,
  759. width: 100,
  760. disabled: true,
  761. editDisplay: false,
  762. addDisplay: false
  763. },
  764. {
  765. label: '备注',
  766. prop: "remarks",
  767. overHidden: true,
  768. width: 100,
  769. disabled: false,
  770. }
  771. ]
  772. },
  773. optionPaymentDetails: {},
  774. optionPaymentDetailsBack: {
  775. align: 'center',
  776. index: true,
  777. addBtnText: "录入明细",
  778. menu: false,
  779. refreshBtn: false,
  780. dialogDrag: true,
  781. addBtn: false,
  782. span: 8,
  783. height: 600,
  784. addRowBtn: false,
  785. editBtn: false,
  786. delBtn: false,
  787. menuWidth: 140,
  788. dialogTop: 25,
  789. dialogWidth: "80%",
  790. column: [{
  791. label: '支付编号',
  792. prop: 'serialNumber'
  793. }, {
  794. label: '金额',
  795. prop: 'amount'
  796. }, {
  797. label: '类型',
  798. prop: 'type'
  799. }, {
  800. label: '支付时间',
  801. prop: 'createTime'
  802. }]
  803. },
  804. optionOutboundRecords: {},
  805. optionOutboundRecordsBack: {
  806. align: 'center',
  807. index: true,
  808. menu: false,
  809. addBtnText: "录入明细",
  810. refreshBtn: false,
  811. dialogDrag: true,
  812. addBtn: false,
  813. span: 8,
  814. height: 600,
  815. addRowBtn: false,
  816. editBtn: false,
  817. delBtn: false,
  818. // menuWidth: 140,
  819. dialogTop: 25,
  820. dialogWidth: "80%",
  821. column: [{
  822. label: '出库单号',
  823. prop: 'billno'
  824. }, {
  825. label: '来源单号',
  826. prop: 'ordNo'
  827. }, {
  828. label: '数量',
  829. prop: 'goodsTotalNum'
  830. }, {
  831. label: '状态',
  832. prop: 'statusName'
  833. }, {
  834. label: '业务时间',
  835. prop: 'createTime'
  836. }]
  837. }
  838. }
  839. },
  840. components: { reportDialog, check, checkSchedule },
  841. props: {
  842. onLoad: Object,
  843. detailData: Object
  844. },
  845. async created() {
  846. // console.log(this.$route);
  847. // if(this.$route.query.check.actId){
  848. // this.isExamineBtn = false
  849. // }
  850. this.findObject(this.optionContactsBack.column, "goodsId").change = ({ value, column }) => {
  851. if (this.formContacts.goodsId !== value) {
  852. goodsDetail({ id: value, customId: this.dicUrlWithCustomId, stock: this.form.storageId ? this.form.storageId : '' }).then(res => {
  853. this.goods = res.data.data
  854. this.formContacts.goodsNo = res.data.data.code
  855. this.formContacts.brandId = res.data.data.brandId
  856. this.formContacts.inventory = res.data.data.inventory
  857. // this.formContacts.brandId = res.data.data.brandName
  858. // this.formContacts.brandName = res.data.data.brandId
  859. this.formContacts.propertyName = res.data.data.specificationAndModel
  860. this.formContacts.pattern = res.data.data.brandItem
  861. this.formContacts.goodsDescription = res.data.data.goodsDescription
  862. this.formContacts.units = res.data.data.unit
  863. this.formContacts.price = res.data.data.price
  864. //
  865. this.formContacts.sharedCompanyId = res.data.data.sharedCompanyId
  866. console.log(res.data.data.sharedCompanyId);
  867. console.log(res.data.data.sharedCompanyName);
  868. this.form.sharedCompanyId = res.data.data.sharedCompanyId
  869. this.form.sharedCompanyName = res.data.data.sharedCompanyName
  870. this.sharedCompanyId = res.data.data.sharedCompanyId
  871. console.log(res.data.data.sharedCompanyId);
  872. console.log(this.form.orderItemsList);
  873. for (let i = 0; i < this.form.orderItemsList.length; i++) {
  874. console.log(Number(this.form.orderItemsList[i].sharedCompanyId));
  875. if (Number(this.form.orderItemsList[i].sharedCompanyId) != Number(res.data.data.sharedCompanyId)) {
  876. this.isStatus = 0
  877. }
  878. }
  879. if (res.data.data.whether == 0) {
  880. this.findObject(this.optionContactsBack.column, "dot").disabled = true
  881. } else {
  882. this.findObject(this.optionContactsBack.column, "dot").disabled = false
  883. dotList({
  884. storageId: this.form.storageId,
  885. goodsId: this.formContacts.goodsId
  886. }).then(res => {
  887. this.findObject(this.optionContactsBack.column, "dot").dicData = res.data.data
  888. })
  889. }
  890. // this.formContacts.goodsId = res.data.data.cname
  891. // this.formContacts.goodsName = res.data.data.id
  892. })
  893. }
  894. }
  895. this.optionContacts = await this.getColumnData(this.getColumnName(269.1), this.optionContactsBack);
  896. this.findObject(this.optionContacts.column, "goodsId").change = ({ value, column }) => {
  897. if (this.formContacts.goodsId !== value) {
  898. goodsDetail({ id: value, customId: this.dicUrlWithCustomId, stock: this.form.storageId ? this.form.storageId : '' }).then(res => {
  899. this.goods = res.data.data
  900. this.formContacts.goodsNo = res.data.data.code
  901. this.formContacts.brandId = res.data.data.brandId
  902. this.formContacts.inventory = res.data.data.inventory
  903. // this.formContacts.brandId = res.data.data.brandName
  904. // this.formContacts.brandName = res.data.data.brandId
  905. this.formContacts.propertyName = res.data.data.specificationAndModel
  906. this.formContacts.pattern = res.data.data.brandItem
  907. this.formContacts.goodsDescription = res.data.data.goodsDescription
  908. this.formContacts.units = res.data.data.unit
  909. this.sharedCompanyId = res.data.data.sharedCompanyId
  910. this.formContacts.sharedCompanyId = res.data.data.sharedCompanyId
  911. //
  912. this.form.sharedCompanyId = res.data.data.sharedCompanyId
  913. this.form.sharedCompanyName = res.data.data.sharedCompanyName
  914. for (let i = 0; i < this.form.orderItemsList.length; i++) {
  915. if (this.form.orderItemsList[i].sharedCompanyId != res.data.data.sharedCompanyId) {
  916. this.isStatus = 0
  917. }
  918. }
  919. if (res.data.data.whether == 0) {
  920. this.findObject(this.optionContacts.column, "dot").disabled = true
  921. } else {
  922. this.findObject(this.optionContacts.column, "dot").disabled = false
  923. dotList({
  924. storageId: this.form.storageId,
  925. goodsId: this.formContacts.goodsId
  926. }).then(res => {
  927. this.findObject(this.optionContacts.column, "dot").dicData = res.data.data
  928. })
  929. }
  930. // this.formContacts.goodsId = res.data.data.cname
  931. // this.formContacts.goodsName = res.data.data.id
  932. })
  933. }
  934. }
  935. this.optionPaymentDetails = await this.getColumnData(this.getColumnName(269.2), this.optionPaymentDetailsBack);
  936. this.optionOutboundRecords = await this.getColumnData(this.getColumnName(269.3), this.optionOutboundRecordsBack);
  937. this.key++
  938. if (this.onLoad.id && this.detailData.id) {
  939. this.$set(this.optionForm, 'disabled', true)
  940. this.$set(this.optionContactsBack, 'disabled', true)
  941. this.isContacts = true
  942. this.isDisabled = true
  943. //添加删除按钮禁用
  944. this.isAdd = true
  945. this.refresh(this.onLoad.id, true)
  946. } else if (this.onLoad.id) {
  947. console.log(2);
  948. this.refresh(this.onLoad.id, true)
  949. }
  950. if (!this.form.id) {
  951. console.log(3);
  952. this.optionContactsBack.column.forEach(its => {
  953. if (its.prop == 'goodsId' || its.prop == 'goodsNum' || its.prop == 'price' || its.prop == 'dot' || its.prop == 'remarks') {
  954. its.disabled = false
  955. } else {
  956. its.disabled = true
  957. }
  958. })
  959. this.isSaveBtn = true;
  960. this.isDisabledTask = true;
  961. this.viewDisabled = true;
  962. // this.$set(this.optionContactsBack, "addBtn", false)
  963. this['optionContacts'] = this['optionContactsBack'];
  964. this.delColumnData(this.getColumnName('269.1'), this['optionContactsBack']);
  965. }
  966. if (!this.detailData.id) {
  967. this.editButton = false
  968. this.isAddBtn = false
  969. this.isDisabledTask = false;
  970. this.isSaveBtn = false
  971. this.viewDisabled = false;
  972. this.form.businessSource = '内部销售'
  973. }
  974. console.log('this.detailData.check', this.detailData.check);
  975. if (this.detailData.check) {
  976. this.isExamineBtn = false
  977. // this.batchNo = this.detailData.check.batchNo
  978. }
  979. if (this.detailData.id) {
  980. this.getDetailsfun()
  981. }
  982. },
  983. watch: {
  984. dicUrlWithCustomId() {
  985. console.log(this.form);
  986. // this.findObject(this.optionContactsBack.column, "goodsId").dicUrl = `/api/blade-sales-part/goodsDesc/goodsListXs?cname={{key}}&customId=${this.dicUrlWithCustomId}&enableOrNot=0`
  987. goodsListXs(this.dicUrlWithCustomId, this.form.storageId ? this.form.storageId : '').then(res => {
  988. this.findObject(this.optionContactsBack.column, "goodsId").dicData = res.data.data
  989. })
  990. },
  991. 'form.storageId'(newStorageId, oldStorageId) {
  992. goodsListXs(this.dicUrlWithCustomId, this.form.storageId ? this.form.storageId : '').then(res => {
  993. console.log(res.data.data, '2');
  994. this.findObject(this.optionContactsBack.column, "goodsId").dicData = res.data.data
  995. })
  996. },
  997. 'form.orderItemsList.length'(newformContacts, oldformContacts) {
  998. console.log(this.formContacts);
  999. console.log(this.form.orderItemsList);
  1000. // for (let i = 0; i < this.form.orderItemsList.length - 1; i++) {
  1001. // const currentItem = this.form.orderItemsList[i];
  1002. // const nextItem = this.form.orderItemsList[i + 1];
  1003. // if (currentItem.sharedCompanyId !== nextItem.sharedCompanyId) {
  1004. // console.log('不能添加');
  1005. // }
  1006. // }
  1007. if (this.form.orderItemsList.length) {
  1008. this.findObject(this.optionForm.column, 'storageId').disabled = true
  1009. } else {
  1010. this.findObject(this.optionForm.column, 'storageId').disabled = false
  1011. }
  1012. },
  1013. 'form.sharedCompanyId'(newSharedCompanyId, oldSharedCompanyId) {
  1014. console.log(newSharedCompanyId, oldSharedCompanyId);
  1015. if (newSharedCompanyId != oldSharedCompanyId) {
  1016. console.log('不能添加');
  1017. }
  1018. console.log(this.sharedCompanyId);
  1019. },
  1020. $route(to, from) {
  1021. if (this.onLoad.id && this.detailData.id) {
  1022. this.$set(this.optionForm, 'disabled', true)
  1023. this.$set(this.optionContactsBack, 'disabled', true)
  1024. this.isContacts = true
  1025. this.isDisabled = true
  1026. this.isAdd = true
  1027. this.refresh(this.onLoad.id, true)
  1028. } else if (this.onLoad.id) {
  1029. console.log(2);
  1030. this.refresh(this.onLoad.id, true)
  1031. }
  1032. // if (!this.form.id) {
  1033. // console.log(3);
  1034. // // this.$set(this.optionContactsBack, "addBtn", false)
  1035. // this['optionContacts'] = this['optionContactsBack'];
  1036. // this.delColumnData(this.getColumnName('269.1'), this['optionContactsBack']);
  1037. // }
  1038. // if (!this.detailData.id) {
  1039. // this.form.businessSource = '内部销售'
  1040. // }
  1041. if (this.detailData.status == 1) {
  1042. this.isExamineBtn = false;
  1043. }
  1044. // if (to.name == '销售订单') {
  1045. // console.log('销售订单');
  1046. // this.isExamineBtn = false;
  1047. // }
  1048. }
  1049. },
  1050. methods: {
  1051. // 获取明细信息
  1052. getDetailsfun(){
  1053. getDetails({
  1054. id:this.detailData.id
  1055. }).then(res=>{
  1056. console.log(res.data,1131)
  1057. this.form = res.data.data
  1058. this.form.orderItemsList = res.data.data.orderItemsList
  1059. })
  1060. },
  1061. // 获取左侧筛选
  1062. getAllWorkDicts(){
  1063. listAll().then(res => {
  1064. console.log(res.data,1050)
  1065. this.treeDataGoods = res.data.data;
  1066. });
  1067. },
  1068. //导入页左商品类型查询
  1069. nodeClick(data) {
  1070. this.treeDeptId = data.id;
  1071. this.page.currentPage = 1;
  1072. this.onLoad(this.page, {brandId:this.treeDeptId});
  1073. },
  1074. closeGoods() {
  1075. this.treeDataGoods = [];
  1076. this.treeDeptId = "";
  1077. this.activeNameTabs = "searchList";
  1078. },
  1079. //刷新触发
  1080. refreshChange() {
  1081. this.treeDeptId = ''
  1082. this.page.currentPage = 1;
  1083. this.onLoad(this.page);
  1084. },
  1085. //选中触发
  1086. selectionChange(list) {
  1087. this.tableData = list
  1088. },
  1089. // 点击搜索触发
  1090. goodsSearch(params, done) {
  1091. console.log(params,done,1079)
  1092. this.treeDeptId = ''
  1093. params = {
  1094. ...params,
  1095. artsVision: this.form.belongToCorpId
  1096. }
  1097. console.log(params,1085)
  1098. // params.specificationAndModel = params.cname
  1099. // delete params.cname
  1100. this.onLoad(this.page, params);
  1101. done()
  1102. },
  1103. // 标签页切换
  1104. tabHandle(data) {
  1105. if (data.name == 'searchList') {
  1106. this.goodsListShow = this.data;
  1107. this.page.total = this.pageList.total
  1108. } else if (data.name == 'importStaging') {
  1109. this.goodsListShow = this.goodsListSave;
  1110. this.page.total = 0
  1111. }
  1112. },
  1113. // 商品信息价格计算
  1114. amountChange(row) {
  1115. // 价格
  1116. if (!row.price) {
  1117. row.price = 0;
  1118. }
  1119. },
  1120. importStagList(row, index, type) {
  1121. this.goodsListSave.push(row);
  1122. },
  1123. removeStagList(row, index, type) {
  1124. this.goodsListSave.splice(row.$index, 1)
  1125. },
  1126. //确认导入触发
  1127. async importGoods() {
  1128. this.surplusRouteQuantityOption.push({ storageQuantity: '0' });
  1129. console.log(this.goodsListSave,'导入按钮')
  1130. console.log(this.surplusRouteQuantityOption,'导入按钮2')
  1131. console.log(this.tableData,'导入按钮3')
  1132. if (this.goodsListSave.length > 0) {
  1133. this.goodsListSaveHandle()
  1134. } else {
  1135. if (this.tableData.length > 0) {
  1136. this.tableDataHandle()
  1137. }
  1138. }
  1139. },
  1140. // 导入按钮事件
  1141. tableDataHandle(){
  1142. // 循环获取库存数量
  1143. for(let item of this.tableData) {
  1144. console.log(item,'循环导入')
  1145. let page = {}
  1146. if (this.form.storageId) {
  1147. page.storageId = this.form.storageId
  1148. }
  1149. page.goodsId = item.goodsId
  1150. let obj = {}
  1151. goodsDetail({ id: page.goodsId, customId: this.dicUrlWithCustomId, stock: page.storageId ? page.storageId : '' }).then(res=>{
  1152. console.log(res.data.data,1141)
  1153. // 单位
  1154. obj.units = res.data.data.unit
  1155. // 判断批次号是否可以编辑
  1156. obj.whether = res.data.data.whether,
  1157. dotList(page).then(res=>{
  1158. console.log(res.data,'获取到的数据')
  1159. if(res.data.data.length>0){
  1160. obj.price = res.data.data[0].inventoryCostPrice,
  1161. obj.inventory = res.data.data[0].balanceQuantity,
  1162. obj.pattern = res.data.data[0].brandItem,
  1163. obj.goodsDescription = res.data.data[0].productDescription,
  1164. obj.dot = res.data.data[0].dot,
  1165. // 轮胎编码
  1166. obj.goodsNo = res.data.data[0].code
  1167. // 规格型号
  1168. obj.propertyName = res.data.data[0].typeno,
  1169. // 小计
  1170. obj.subTotalMoney = item.goodsNum * res.data.data[0].inventoryCostPrice
  1171. }
  1172. this.form.orderItemsList.push({
  1173. ...obj,
  1174. goodsId:item.goodsId,
  1175. goodsName:item.cname,
  1176. goodsNum:item.goodsNum,
  1177. brandName:item.brandName,
  1178. brandId:item.brandId,
  1179. // sendNum:res.data.data[0],
  1180. // 备注
  1181. remarks:item.remarks,
  1182. // 批次号的状态
  1183. dotedittype:false,
  1184. // 价格数量
  1185. goodsNumtype:false,
  1186. // 价格
  1187. pricetype:false
  1188. })
  1189. })
  1190. })
  1191. }
  1192. this.dialogVisible = false
  1193. },
  1194. // 导入
  1195. goodsListSaveHandle(){
  1196. this.tableDataHandle()
  1197. },
  1198. //导入轮胎弹窗列表查询
  1199. onLoad(page, params = { artsVision: this.form.belongToCorpId }) {
  1200. this.loading = true;
  1201. getList({
  1202. ...params,
  1203. current: page.currentPage,
  1204. size: page.pageSize,
  1205. billType:page.billType,
  1206. upAndDownShelves:1,
  1207. }).then(res=>{
  1208. console.log(res,1213)
  1209. const data = res.data.data;
  1210. this.page.total = data.total;
  1211. this.pageList.total = data.total
  1212. this.data = data.records;
  1213. this.goodsListShow = data.records;
  1214. this.loading = false;
  1215. })
  1216. // getList(page.currentPage, page.pageSize, Object.assign(params, this.query), this.treeDeptId, null).then(res => {
  1217. // const data = res.data.data;
  1218. // this.page.total = data.total;
  1219. // this.pageList.total = data.total
  1220. // this.data = data.records;
  1221. // this.goodsListShow = data.records;
  1222. // this.loading = false;
  1223. // });
  1224. },
  1225. // 采购明细行编辑
  1226. hangeditBtn(row,index){
  1227. console.log(row)
  1228. this.picihaolistfun(row.goodsId)
  1229. row.dotedittype = true
  1230. // 价格数量
  1231. row.goodsNumtype = true
  1232. row.pricetype = true
  1233. // 编辑和保存状态切换
  1234. this.mingxibaocun = false
  1235. },
  1236. // 保存按钮
  1237. hangbaocun(row) {
  1238. row.dotedittype = false
  1239. row.goodsNumtype = false
  1240. row.pricetype = false
  1241. this.mingxibaocun = true
  1242. },
  1243. // 批次号获取数据
  1244. picihaolistfun(goodsId){
  1245. dotList({
  1246. storageId:this.form.storageId,
  1247. goodsId: goodsId
  1248. }).then(res=>{
  1249. this.picihaolist = res.data.data
  1250. console.log(res.data.data,1282)
  1251. })
  1252. },
  1253. editBtn(row, index) {
  1254. this.confirmEditing()
  1255. this.$refs.formContacts.rowEdit(row, index);
  1256. dotList({
  1257. storageId: this.form.storageId,
  1258. goodsId: this.formContacts.goodsId
  1259. }).then(res => {
  1260. this.findObject(this.optionContactsBack.column, "dot").dicData = res.data.data
  1261. })
  1262. goodsListXs(this.dicUrlWithCustomId, this.form.storageId ? this.form.storageId : '').then(res => {
  1263. this.findObject(this.optionContactsBack.column, "goodsId").dicData = res.data.data
  1264. })
  1265. },
  1266. //表头编辑
  1267. confirmEditing() {
  1268. goodsListXs(this.dicUrlWithCustomId, this.form.storageId ? this.form.storageId : '').then(res => {
  1269. this.findObject(this.optionContactsBack.column, "goodsId").dicData = res.data.data
  1270. })
  1271. if (this.form.status == '已发货') {
  1272. this.viewDisabled = false
  1273. return
  1274. }
  1275. if (this.form.status == '退款中') {
  1276. this.viewDisabled = false
  1277. this.isRevocationRequest = true
  1278. return
  1279. }
  1280. this.isAddBtn = false
  1281. if (this.form.status == '已取消' || this.form.status == '已退款' || this.form.status == '已发货') {
  1282. return
  1283. // this.$message.error('当前状态不允许编辑')
  1284. // this.optionForm.column.forEach(item=>{
  1285. // if(item.prop= 'contacts'){
  1286. // item.disabled = true
  1287. // }
  1288. // })
  1289. }
  1290. if (this.form.status == '退款请核') {
  1291. this.viewDisabled = false
  1292. this.isAddBtn = true
  1293. return
  1294. }
  1295. if (this.form.status == '已取消' || this.form.status == '退款请核') {
  1296. this.isAddBtn = true
  1297. // this.$message.error('当前状态不允许编辑')
  1298. // this.optionForm.column.forEach(item=>{
  1299. // if(item.prop= 'contacts'){
  1300. // item.disabled = true
  1301. // }
  1302. // })
  1303. }
  1304. if (this.form.status == '待发货') {
  1305. this.isAddBtn = true
  1306. }
  1307. this.optionContactsBack.column.forEach(its => {
  1308. if (its.prop == 'goodsId' || its.prop == 'goodsNum' || its.prop == 'price' || its.prop == 'dot' || its.prop == 'remarks') {
  1309. its.disabled = false
  1310. } else {
  1311. its.disabled = true
  1312. }
  1313. })
  1314. this.$set(this.optionForm, 'disabled', false)
  1315. this.$set(this.optionContactsBack, 'disabled', false)
  1316. this.isDisabled = false
  1317. this.isAdd = false
  1318. if (this.form.businessSource == "外部销售") {
  1319. this.optionForm.column.forEach(its => {
  1320. if (its.prop == 'contacts' || its.prop == 'phone' || its.prop == 'recAddress') {
  1321. this.$set(its, 'disabled', true)
  1322. }
  1323. })
  1324. if (this.form.status == '待发货') {
  1325. this.isSaveBtn = false;
  1326. this.isDisabledTask = false;
  1327. this.viewDisabled = false;
  1328. }
  1329. if (this.form.status == '待确认') {
  1330. const loadings = this.$loading({
  1331. lock: true,
  1332. text: '加载中',
  1333. spinner: 'el-icon-loading',
  1334. background: 'rgba(255,255,255,0.7)'
  1335. });
  1336. console.log('外部销售待确认');
  1337. this.isSaveBtn = false;
  1338. this.isDisabledTask = false;
  1339. this.viewDisabled = false;
  1340. this.optionForm.column.forEach(its => {
  1341. if (its.prop == 'customerId') {
  1342. this.$set(its, 'disabled', true)
  1343. }
  1344. if (its.prop == 'storageId') {
  1345. this.$set(its, 'disabled', false)
  1346. }
  1347. })
  1348. //外部销售都能申请退款
  1349. this.isApplySettlement = false
  1350. //不能录入不能删除
  1351. this.isDisabled = true
  1352. this.isAdd = false
  1353. this.isAddBtn = true
  1354. this.$set(this.form, 'shipType', '物流')
  1355. this.$set(this.form, 'receivableType', '网络支付')
  1356. this.optionContactsBack.column.forEach(item => {
  1357. this.$set(item, 'disabled', true)
  1358. if (item.label == '批次号' || item.label == '备注') {
  1359. item.disabled = false
  1360. }
  1361. })
  1362. loadings.close()
  1363. } else {
  1364. const loadin = this.$loading({
  1365. lock: true,
  1366. text: '加载中',
  1367. spinner: 'el-icon-loading',
  1368. background: 'rgba(255,255,255,0.7)'
  1369. });
  1370. this.isAddBtn = true
  1371. this.isDisabled = true
  1372. this.isSaveBtn = false;
  1373. this.isDisabledTask = false;
  1374. this.viewDisabled = false;
  1375. this.optionForm.column.forEach(its => {
  1376. if (its.prop != 'remarks') {
  1377. its.disabled = true
  1378. } else {
  1379. its.disabled = false
  1380. }
  1381. })
  1382. this.optionContactsBack.column.forEach(its => {
  1383. if (its.prop != 'remarks') {
  1384. its.disabled = true
  1385. } else {
  1386. its.disabled = false
  1387. }
  1388. })
  1389. loadin.close()
  1390. }
  1391. } else {
  1392. const loading = this.$loading({
  1393. lock: true,
  1394. text: '加载中',
  1395. spinner: 'el-icon-loading',
  1396. background: 'rgba(255,255,255,0.7)'
  1397. });
  1398. if (this.form.status == '待发货' || this.form.status == '已发货' || this.form.status == '已取消') {
  1399. const loading = this.$loading({
  1400. lock: true,
  1401. text: '加载中',
  1402. spinner: 'el-icon-loading',
  1403. background: 'rgba(255,255,255,0.7)'
  1404. });
  1405. this.optionForm.column.forEach(its => {
  1406. if (its.prop != 'remarks') {
  1407. its.disabled = true
  1408. } else {
  1409. its.disabled = false
  1410. }
  1411. })
  1412. this.optionContactsBack.column.forEach(its => {
  1413. if (its.prop != 'remarks') {
  1414. its.disabled = true
  1415. } else {
  1416. its.disabled = false
  1417. }
  1418. })
  1419. loading.close()
  1420. } else if (this.form.status == '录入') {
  1421. this.isSaveBtn = false;
  1422. this.isDisabledTask = false;
  1423. this.viewDisabled = false;
  1424. // this.$set(this.optionForm, 'disabled', false)
  1425. // this.$set(this.optionContactsBack, 'disabled', false)
  1426. this.$set(this.optionForm, 'disabled', false)
  1427. this.$set(this.optionContactsBack, 'disabled', false)
  1428. this.isContacts = true
  1429. //删除按钮
  1430. this.isDisabled = false
  1431. // this.optionForm.column.forEach(item => {
  1432. // item.disabled = false
  1433. // })
  1434. loading.close()
  1435. } else if (this.form.status == '待确认') {
  1436. this.isSaveBtn = false;
  1437. this.isDisabledTask = false;
  1438. this.viewDisabled = false;
  1439. // this.isDisabled = true
  1440. console.log('待确认');
  1441. this.optionForm.column.forEach(item => {
  1442. if (item.label === '成本' || item.label === '毛利' || item.label === '销售金额' || item.label === '运费' || item.label === '总金额' || item.label === '结算金额' || item.label === '单据编号' || item.label === '来源编号') {
  1443. this.$set(item, 'disabled', true)
  1444. } else {
  1445. this.$set(item, 'disabled', false)
  1446. }
  1447. })
  1448. this.isContacts = false
  1449. this.optionContactsBack.column.forEach(its => {
  1450. if (its.prop == 'remarks' || its.prop == 'dot') {
  1451. this.$set(its, 'disabled', false)
  1452. } else {
  1453. this.$set(its, 'disabled', true)
  1454. }
  1455. })
  1456. loading.close()
  1457. }
  1458. if (this.form.status == '待发货') {
  1459. this.isSaveBtn = false;
  1460. this.isDisabledTask = false;
  1461. this.viewDisabled = false;
  1462. this.isDisabled = true
  1463. }
  1464. // this.$set(this.form, 'shipType', '物流')
  1465. // this.$set(this.form, 'receivableType', '现金')
  1466. // this.optionContactsBack.column.forEach(item => {
  1467. // this.$set(item, 'disabled', false)
  1468. // })
  1469. // this.optionContactsBack.column.forEach(item => {
  1470. // if (item.label === '规格型号' || item.label === '花纹' || item.label === '品牌' || item.label === '物料编码' || item.label === '单位' || item.label === '轮胎描述') {
  1471. // item.disabled = true;
  1472. // }
  1473. // })
  1474. // this['optionContacts'] = this['optionContactsBack'];
  1475. // this.delColumnData(this.getColumnName(269.1), this['optionContactsBack']);
  1476. // this.form.outboundRecordsList.forEach(item=>{
  1477. // if(item.statusName == '待出库'){
  1478. // this.isDisabledTask = true
  1479. // }
  1480. // })
  1481. loading.close()
  1482. }
  1483. // this.$set(this.form.orderItemsList,'goodsNum',66)
  1484. },
  1485. generateOutbound() {
  1486. if (!this.form.id) {
  1487. this.$message.error('请先保存')
  1488. } else {
  1489. if (this.buttonText === '生成任务') {
  1490. //生成任务逻辑
  1491. if (this.form.orderItemsList.length <= 0) {
  1492. this.$message.error('请录入明细');
  1493. } else {
  1494. const loading = this.$loading({
  1495. lock: true,
  1496. text: '加载中',
  1497. spinner: 'el-icon-loading',
  1498. background: 'rgba(255,255,255,0.7)'
  1499. });
  1500. this.$set(this.optionForm, 'disabled', true)
  1501. this.$set(this.optionContactsBack, 'disabled', true)
  1502. this.$refs["form"].validate((valid, done) => {
  1503. done();
  1504. console.log(valid);
  1505. if (valid) {
  1506. submit({
  1507. bsType: "XS",
  1508. ...this.form
  1509. }).then(res => {
  1510. console.log(1);
  1511. this.refresh(res.data.data.id)
  1512. this.isDisabledTask = false
  1513. generateShipTask(this.form).then(res => {
  1514. console.log(res.data);
  1515. // 将按钮文本更改为"撤销任务"
  1516. this.buttonText = '撤销任务';
  1517. // 将按钮颜色更改为对应的颜色
  1518. this.buttonColor = 'warning'; // 比如改为warning
  1519. this.refreshs(res.data.data.id, true)
  1520. this.isContacts = true
  1521. this.$message.success("生成出库任务成功");
  1522. this.isApplySettlement = false
  1523. this.isAdd = true
  1524. this.isDisabled = true
  1525. this.isAddBtn = true
  1526. }).finally(() => {
  1527. loading.close();
  1528. });
  1529. }).catch(() => {
  1530. loading.close();
  1531. });
  1532. done();
  1533. } else {
  1534. this.$message.error('请选择仓库')
  1535. }
  1536. })
  1537. }
  1538. } else {
  1539. this.$refs["form"].validate((valid, done) => {
  1540. console.log(valid);
  1541. if (valid) {
  1542. const loading = this.$loading({
  1543. lock: true,
  1544. text: '加载中',
  1545. spinner: 'el-icon-loading',
  1546. background: 'rgba(255,255,255,0.7)'
  1547. });
  1548. // this.form.orderItemsList.forEach((items) => {
  1549. // let brandName = items.brandId
  1550. // items.brandId = items.brandName
  1551. // items.brandName = brandName
  1552. // let goodsName = items.goodsId
  1553. // items.goodsId = items.goodsName
  1554. // items.goodsName = goodsName
  1555. // })
  1556. revokeGenerateShipTask(this.form).then(res => {
  1557. // 将按钮文本更改为"生成任务"
  1558. this.buttonText = '生成任务';
  1559. // 将按钮颜色还原为success
  1560. this.buttonColor = 'success';
  1561. this.$message.success("撤销出库成功");
  1562. this.refresh(res.data.data.id)
  1563. this.isApplySettlement = false
  1564. this.$set(this.optionForm, 'disabled', true)
  1565. this.$set(this.optionContactsBack, 'disabled', true)
  1566. this.isContacts = true
  1567. this.isDisabled = true
  1568. //添加删除按钮禁用
  1569. this.isAdd = true
  1570. if (this.form.businessSource == "外部销售") {
  1571. }
  1572. loading.close();
  1573. }).catch((err) => {
  1574. console.log(err);
  1575. if (err instanceof TooManyResultsException) {
  1576. // 不显示错误消息
  1577. return;
  1578. }
  1579. // 显示其他错误消息
  1580. this.$message.error('发生错误,请稍后重试');
  1581. }).finally(() => {
  1582. loading.close();
  1583. });
  1584. done();
  1585. }
  1586. })
  1587. }
  1588. }
  1589. },
  1590. //联系人change
  1591. contactsChange(e) {
  1592. console.log(e);
  1593. console.log(this.contactsOption);
  1594. // 假设this.contactsOption是你的数组对象
  1595. let matchedContact = this.contactsOption.find(item => item.contacts == e);
  1596. // 判断是否找到匹配的对象
  1597. this.$set(this.form, 'phone', matchedContact.tel)
  1598. this.$set(this.form, 'recAddress', matchedContact.belongtoarea + matchedContact.detailedAddress)
  1599. },
  1600. //修改提交触发
  1601. editCustomer() {
  1602. this.$refs["form"].validate((valid, done) => {
  1603. done();
  1604. if (valid) {
  1605. const loading = this.$loading({
  1606. lock: true,
  1607. text: '加载中',
  1608. spinner: 'el-icon-loading',
  1609. background: 'rgba(255,255,255,0.7)'
  1610. });
  1611. // this.form.orderItemsList.forEach(its => {
  1612. // console.log(its.goodsId);
  1613. // console.log(its.goodsName);
  1614. // its.brandId = its.brandName
  1615. // let goodsName = its.goodsId
  1616. // its.goodsId = its.goodsName
  1617. // its.goodsName = goodsName
  1618. // })
  1619. submit({
  1620. bsType: "XS",
  1621. ...this.form
  1622. }).then(res => {
  1623. this.$message.success("保存成功");
  1624. this.refresh(res.data.data.id)
  1625. this.isDisabledTask = false
  1626. this.editButton = true
  1627. loading.close();
  1628. }).finally(() => {
  1629. loading.close();
  1630. });
  1631. } else {
  1632. return false;
  1633. }
  1634. });
  1635. },
  1636. //保存
  1637. save() {
  1638. this.$refs["form"].validate((valid, done) => {
  1639. done();
  1640. if (valid) {
  1641. const loading = this.$loading({
  1642. lock: true,
  1643. text: '加载中',
  1644. spinner: 'el-icon-loading',
  1645. background: 'rgba(255,255,255,0.7)'
  1646. });
  1647. submit({
  1648. bsType: "XS",
  1649. ...this.form
  1650. }).then(res => {
  1651. console.log(1);
  1652. this.refresh(res.data.data.id)
  1653. this.isDisabledTask = false
  1654. loading.close();
  1655. }).finally(() => {
  1656. loading.close();
  1657. });
  1658. } else {
  1659. return false;
  1660. }
  1661. });
  1662. },
  1663. //关闭弹窗表单
  1664. beforeClose(done, type) {
  1665. console.log(type);
  1666. // if(row == "add"){
  1667. // this.form.sharedCompanyId = this.form.sharedCompanyId?this.form.sharedCompanyId:''
  1668. // this.form.sharedCompanyName = this.form.sharedCompanyName?this.form.sharedCompanyName:''
  1669. // }
  1670. console.log('this.form.sharedCompanyId', this.form.sharedCompanyId);
  1671. console.log('this.form.sharedCompanyName', this.form.sharedCompanyName);
  1672. done()
  1673. },
  1674. refresh(id, type) {
  1675. const loading = this.$loading({
  1676. lock: true,
  1677. text: '加载中',
  1678. spinner: 'el-icon-loading',
  1679. background: 'rgba(255,255,255,0.7)'
  1680. })
  1681. getDetails({ id: id }).then(res => {
  1682. this.form = res.data.data
  1683. let ordForm = { srcBillNo: this.form.ordNo }
  1684. let _this = this
  1685. this.dataList = res.data.data.paymentRecordsList ? res.data.data.paymentRecordsList : [];
  1686. this.$nextTick(() => {
  1687. this.$refs.formContacts.doLayout()
  1688. })
  1689. // getList(1, 50, ordForm).then((res) => {
  1690. // this.dataList = res.data.data.records ? res.data.data.records : [];
  1691. // this.$nextTick(() => {
  1692. // this.$refs.formContacts.doLayout()
  1693. // })
  1694. // })
  1695. if (this.form.status !== '录入' && this.form.status !== '退款中' && this.form.status !== '已取消' && this.form.status !== '退款请核' && this.form.status !== '已退款' && this.form.status !== '待确认' && this.form.status !== '待发货') {
  1696. console.log(1);
  1697. this.isApplySettlement = false;
  1698. }
  1699. if (
  1700. this.form.status === '已退款' ||
  1701. this.form.status === '已收货' ||
  1702. this.form.status === '已发货' ||
  1703. this.form.status === '已取消'
  1704. ) {
  1705. // 禁用编辑按钮
  1706. console.log('按钮全部禁用');
  1707. this.isEditButton = true;
  1708. this.isSaveBtn = true;
  1709. this.isDisabledTask = true;
  1710. this.viewDisabled = true;
  1711. }
  1712. if (this.form.status === '已发货') {
  1713. this.isDisabledTask = true;
  1714. this.viewDisabled = true;
  1715. this.isEditButton = false;
  1716. }
  1717. // else {
  1718. // this.isSaveBtn = true;
  1719. // this.isDisabledTask = true;
  1720. // this.viewDisabled = true;
  1721. // }
  1722. if (this.form.status == '退款中') {
  1723. this.isConfirmRefundBtn = false;
  1724. }
  1725. if (this.form.status == '已取消') {
  1726. this.isConfirmRefundBtn = true;
  1727. }
  1728. if (this.form.generateTask == '已生成') {
  1729. this.buttonText = '撤销任务';
  1730. // this.isDisabledTask = false;
  1731. this.buttonColor = 'warning'
  1732. }
  1733. if (this.form.status == '退款请核' || this.form.status == '退款中') {
  1734. this.isRevocationRequest = false;
  1735. }
  1736. if (this.form.status == '待发货') {
  1737. this.isApplySettlement = false
  1738. this.isDisabled = true
  1739. }
  1740. //成本、毛利对销售角色隐藏
  1741. this.optionForm.column.forEach(its => {
  1742. if (JSON.parse(localStorage.getItem('saber-userInfo')).content.role_name.split(',').includes('销售')) {
  1743. if (its.prop == 'cost' || its.prop == 'grossProfit') {
  1744. this.$set(its, 'display', false)
  1745. }
  1746. }
  1747. })
  1748. this.form.orderItemsList.forEach((items) => {
  1749. if (!items.subTotalMoney) {
  1750. items.subTotalMoney = items.goodsNum * items.price
  1751. items.grossProfit = items.subTotalMoney - items.costprie
  1752. }
  1753. // let brandName = items.brandId
  1754. // items.brandId = items.brandName
  1755. // items.brandName = brandName
  1756. // let goodsName = items.goodsId
  1757. // items.goodsId = items.goodsName
  1758. // items.goodsName = goodsName
  1759. })
  1760. loading.close();
  1761. // if (this.form.businessSource == "外部销售") {
  1762. // console.log('外部销售');
  1763. // this.optionForm.column.forEach(its => {
  1764. // if (its.prop == 'customerId') {
  1765. // this.$set(its, 'disabled', true)
  1766. // }
  1767. // })
  1768. // //不能录入不能删除
  1769. // this.$set(this.optionContactsBack, "addBtn", false)
  1770. // this.isDisabled = true
  1771. // this.$set(this.form, 'shipType', '物流')
  1772. // this.$set(this.form, 'receivableType', '网络支付')
  1773. // this.optionContactsBack.column.forEach(item => {
  1774. // this.$set(item, 'disabled', true)
  1775. // if (item.label == '批次号' || item.label == '备注') {
  1776. // item.disabled = false
  1777. // }
  1778. // })
  1779. // this['optionContacts'] = this['optionContactsBack'];
  1780. // this.delColumnData(this.getColumnName(269.1), this['optionContactsBack']);
  1781. // this.optionContactsBack.column.forEach(item => {
  1782. // if (item.prop == 'dot') {
  1783. // this.$set(item, disabled, false)
  1784. // } else {
  1785. // this.$set(item, disabled, true)
  1786. // }
  1787. // })
  1788. // } else {
  1789. // this.$set(this.form, 'shipType', '物流')
  1790. // this.$set(this.form, 'receivableType', '现金')
  1791. // this.optionContactsBack.column.forEach(item => {
  1792. // this.$set(item, 'disabled', false)
  1793. // })
  1794. // this.optionContactsBack.column.forEach(item => {
  1795. // if (item.label === '规格型号' || item.label === '花纹' || item.label === '品牌' || item.label === '物料编码' || item.label === '单位' || item.label === '商品描述') {
  1796. // item.disabled = true;
  1797. // }
  1798. // })
  1799. // console.log(324324);
  1800. // this['optionContacts'] = this['optionContactsBack'];
  1801. // this.delColumnData(this.getColumnName(269.1), this['optionContactsBack']);
  1802. // }
  1803. // // this.$set(this.form.orderItemsList,'goodsNum',66)
  1804. }).catch(() => {
  1805. loading.close();
  1806. })
  1807. },
  1808. refreshs(id, type) {
  1809. getDetails({ id: id }).then(res => {
  1810. this.form = res.data.data
  1811. let ordForm = { srcBillNo: this.form.ordNo }
  1812. let _this = this
  1813. this.dataList = res.data.data.paymentRecordsList ? res.data.data.paymentRecordsList : [];
  1814. if (this.form.status !== '录入' && this.form.status !== '退款中' && this.form.status !== '已取消' && this.form.status !== '退款请核' && this.form.status !== '已退款' && this.form.status !== '待确认' && this.form.status !== '待发货') {
  1815. console.log(1);
  1816. this.isApplySettlement = false;
  1817. }
  1818. if (
  1819. this.form.status === '已退款' ||
  1820. this.form.status === '已收货' ||
  1821. this.form.status === '已发货' ||
  1822. this.form.status === '已取消'
  1823. ) {
  1824. // 禁用编辑按钮
  1825. console.log('按钮全部禁用');
  1826. this.isEditButton = true;
  1827. this.isSaveBtn = true;
  1828. this.isDisabledTask = true;
  1829. this.viewDisabled = true;
  1830. }
  1831. if (this.form.status === '已发货') {
  1832. this.isDisabledTask = true;
  1833. this.viewDisabled = true;
  1834. this.isEditButton = false;
  1835. }
  1836. if (this.form.status == '退款中') {
  1837. this.isConfirmRefundBtn = false;
  1838. }
  1839. if (this.form.status == '已取消') {
  1840. this.isConfirmRefundBtn = true;
  1841. }
  1842. if (this.form.generateTask == '已生成') {
  1843. this.buttonText = '撤销任务';
  1844. // this.isDisabledTask = false;
  1845. this.buttonColor = 'warning'
  1846. }
  1847. if (this.form.status == '退款请核' || this.form.status == '退款中') {
  1848. this.isRevocationRequest = false;
  1849. }
  1850. if (this.form.status == '待发货') {
  1851. this.isApplySettlement = false
  1852. }
  1853. //成本、毛利对销售角色隐藏
  1854. this.optionForm.column.forEach(its => {
  1855. if (JSON.parse(localStorage.getItem('saber-userInfo')).content.role_name.split(',').includes('销售')) {
  1856. if (its.prop == 'cost' || its.prop == 'grossProfit') {
  1857. this.$set(its, 'display', false)
  1858. }
  1859. }
  1860. })
  1861. this.form.orderItemsList.forEach((items) => {
  1862. if (!items.subTotalMoney) {
  1863. items.subTotalMoney = items.goodsNum * items.price
  1864. items.grossProfit = items.subTotalMoney - items.costprie
  1865. }
  1866. })
  1867. }).catch(() => {
  1868. })
  1869. },
  1870. //请核关闭
  1871. choceScheduleFun() {
  1872. this.checkScheduleDialog = false
  1873. },
  1874. //关闭审核
  1875. choceCheckFun() {
  1876. this.isExamineBtn = !this.isExamineBtn
  1877. this.checkDialog = false;
  1878. },
  1879. //申请退款
  1880. applySettlement(type) {
  1881. this.$confirm("您确定申请退款吗?", {
  1882. confirmButtonText: "确定",
  1883. cancelButtonText: "取消",
  1884. type: "warning"
  1885. }).then(() => {
  1886. this.$refs["form"].validate((valid, done) => {
  1887. done()
  1888. if (valid) {
  1889. const data = {
  1890. id: this.form.id,
  1891. url: '/tirePartsMall/salesManagement/saleOrder/index',
  1892. pageStatus: "this.$store.getters.ltxsStatus",
  1893. pageLabel: "销售订单",
  1894. }
  1895. const loading = this.$loading({
  1896. lock: true,
  1897. text: '加载中',
  1898. spinner: 'el-icon-loading',
  1899. background: 'rgba(255,255,255,0.7)'
  1900. });
  1901. checkOrder({ ...data }).then((res) => {
  1902. this.refresh(res.data.data.id)
  1903. this.$message.success('申请退款成功');
  1904. this.isApplySettlement = !this.isApplySettlement
  1905. loading.close();
  1906. console.log(res);
  1907. }).catch(() => { loading.close(); })
  1908. }
  1909. })
  1910. })
  1911. },
  1912. //确认退款
  1913. confirmRefundBtn() {
  1914. this.$confirm("您确定退款吗?", {
  1915. confirmButtonText: "确定",
  1916. cancelButtonText: "取消",
  1917. type: "warning"
  1918. }).then(() => {
  1919. const loading = this.$loading({
  1920. lock: true,
  1921. text: '加载中',
  1922. spinner: 'el-icon-loading',
  1923. background: 'rgba(255,255,255,0.7)'
  1924. });
  1925. // this.form.orderItemsList.forEach((items) => {
  1926. // let brandName = items.brandId
  1927. // items.brandId = items.brandName
  1928. // items.brandName = brandName
  1929. // let goodsName = items.goodsId
  1930. // items.goodsId = items.goodsName
  1931. // items.goodsName = goodsName
  1932. // })
  1933. confirmRefund({ ...this.form }).then((res) => {
  1934. loading.close()
  1935. this.$message.success('确定退款成功');
  1936. }).catch(() => { loading.close(); })
  1937. })
  1938. },
  1939. //审批
  1940. examineBtn() {
  1941. this.checkData = this.$route.query.check
  1942. this.checkDialog = true;
  1943. },
  1944. //撤销请核
  1945. revocationRequest() {
  1946. this.$confirm("您确定撤回此次申请吗?", {
  1947. confirmButtonText: "确定",
  1948. cancelButtonText: "取消",
  1949. type: "warning"
  1950. }).then(() => {
  1951. const loading = this.$loading({
  1952. lock: true,
  1953. text: '加载中',
  1954. spinner: 'el-icon-loading',
  1955. background: 'rgba(255,255,255,0.7)'
  1956. });
  1957. // this.form.orderItemsList.forEach((items) => {
  1958. // if (!items.subTotalMoney) {
  1959. // items.subTotalMoney = items.goodsNum * items.price
  1960. // items.grossProfit = items.subTotalMoney - items.costprie
  1961. // }
  1962. // let brandName = items.brandId
  1963. // items.brandId = items.brandName
  1964. // items.brandName = brandName
  1965. // let goodsName = items.goodsId
  1966. // items.goodsId = items.goodsName
  1967. // items.goodsName = goodsName
  1968. // })
  1969. revokeCheckOrder({ ...this.form }).then(res => {
  1970. this.isRevocationRequest = !this.isRevocationRequest
  1971. this.refresh(res.data.data.id)
  1972. this.$message.success('撤回成功')
  1973. loading.close();
  1974. })
  1975. })
  1976. },
  1977. rowDelBox(row, index, type) {
  1978. this.$confirm("确定将选择数据删除?", {
  1979. confirmButtonText: "确定",
  1980. cancelButtonText: "取消",
  1981. type: "warning"
  1982. }).then(() => {
  1983. if (row.id) {
  1984. delOrderItem({ ids: row.id }).then(res => {
  1985. this.form.orderItemsList.splice(index, 1);
  1986. this.$message.success("操作成功!");
  1987. });
  1988. } else {
  1989. this.form[type].splice(index, 1);
  1990. this.$message.success("操作成功!");
  1991. }
  1992. }
  1993. );
  1994. },
  1995. rowSave(form, done, loading) {
  1996. if (this.isStatus) {
  1997. done(form)
  1998. } else {
  1999. this.$message.error('请选择相同公司的轮胎')
  2000. }
  2001. console.log(form);
  2002. // this.form.sharedCompanyId = res.data.data.sharedCompanyId
  2003. // this.form.sharedCompanyName = res.data.data.sharedCompanyName
  2004. },
  2005. rowUpdate(form, index, done, loading) {
  2006. done(form)
  2007. },
  2008. // 新增轮胎
  2009. rowAdd(row) {
  2010. if (!this.form.customerId) {
  2011. this.$message.error('请选择客户')
  2012. return
  2013. }
  2014. this.findObject(this.optionContactsBack.column,'goodsId').dicUrl=`/api/blade-sales-part/goodsDesc/goodsListXs?cname={{key}}&customId=${this.dicUrlWithCustomId}&enableOrNot=1&stock=${this.form.storageId}`
  2015. this.optionContactsBack.column.forEach(its => {
  2016. if (its.prop == 'goodsId' || its.prop == 'goodsNum' || its.prop == 'price' || its.prop == 'dot' || its.prop == 'remarks') {
  2017. its.disabled = false
  2018. } else {
  2019. its.disabled = true
  2020. }
  2021. })
  2022. console.log('新增了', row);
  2023. console.log(this.form.storageId,2038)
  2024. if (this.form.storageId) {
  2025. this.page.billType = 0
  2026. }else {
  2027. this.page.billType = 1
  2028. }
  2029. this.getAllWorkDicts()
  2030. this.refreshChange()
  2031. this.dialogVisible = true
  2032. // this.$refs.formContacts.rowAdd()
  2033. },
  2034. //打印
  2035. handlePrint() {
  2036. this.switchDialog = !this.switchDialog;
  2037. },
  2038. onClose(val) {
  2039. this.switchDialog = val;
  2040. },
  2041. //自定义列保存
  2042. async saveColumnTwo(ref, option, optionBack, code) {
  2043. /**
  2044. * 已定义全局方法,直接使用,saveColumnData保存列数据方法,参数传值(表格名称,当前表格的option数据)
  2045. * 已定义全局方法,直接使用,getColumnName方法用来获取枚举值,参数根据自己定义的code值获取中文名
  2046. * 一定要执行异步操作,要等接口成功返回,才能执行下一行代码
  2047. */
  2048. const inSave = await this.saveColumnData(this.getColumnName(code), this[option]);
  2049. if (inSave) {
  2050. this.$message.success("保存成功");
  2051. //关闭窗口
  2052. this.$refs[ref].$refs.dialogColumn.columnBox = false;
  2053. }
  2054. },
  2055. //自定义列重置
  2056. async resetColumnTwo(ref, option, optionBack, code) {
  2057. this[option] = this[optionBack];
  2058. const inSave = await this.delColumnData(this.getColumnName(code), this[optionBack]);
  2059. if (inSave) {
  2060. this.$message.success("重置成功");
  2061. this.$refs[ref].$refs.dialogColumn.columnBox = false;
  2062. }
  2063. },
  2064. backToList(type) {
  2065. this.$emit("backToList", type);
  2066. },
  2067. // 弹框的重置
  2068. resetCrud(){
  2069. this.$message.success("重置成功");
  2070. },
  2071. // 弹窗的保存
  2072. saveCrud(){
  2073. this.$message.success("保存成功");
  2074. }
  2075. }
  2076. }
  2077. </script>
  2078. <style lang="scss" scoped>
  2079. ::v-deep .el-form-item {
  2080. margin-bottom: 8px !important;
  2081. }
  2082. </style>