detailsPage.vue 131 KB

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