detailsPage.vue 94 KB

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