detailsPage.vue 98 KB

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