detailsPage.vue 96 KB

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