detailsPage.vue 92 KB

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