detailsPage.vue 106 KB

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