detailsPage.vue 135 KB

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