detailsPage.vue 146 KB

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