detailsPage.vue 102 KB

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