detailsPage.vue 133 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848284928502851285228532854285528562857285828592860286128622863286428652866286728682869287028712872287328742875287628772878287928802881288228832884288528862887
  1. <template>
  2. <div>
  3. <div class="customer-head">
  4. <div class="customer-back">
  5. <el-button type="danger" style="border: none;background: none;color: red" icon="el-icon-arrow-left"
  6. @click="backToList(0)">返回列表
  7. </el-button>
  8. </div>
  9. <div class="add-customer-btn">
  10. <el-button class="el-button&#45;&#45;small-yh" :disabled="isEditButton" style="margin-left: 6px;"
  11. type="primary" size="small" v-if="editButton" @click="confirmEditing">编 辑
  12. </el-button>
  13. <el-button class="el-button--small-yh" v-else style="margin-left: 6px;" type="primary" size="small"
  14. :disabled="isSaveBtn" @click="editCustomer">保 存
  15. </el-button>
  16. <el-button class="el-button--small-yh" style="margin-left: 6px;" :type="buttonColor" size="small"
  17. :disabled="isDisabledTask" @click="generateOutbound" v-if="form.taskWhetherAdopt != '审核提交'">
  18. {{ buttonText }}
  19. </el-button>
  20. <el-button class="el-button--small-yh" style="margin-left: 6px;" :type="buttonColor" size="small"
  21. v-if="form.taskWhetherAdopt == '审核提交'" @click="revokeTask">
  22. 撤销出库任务审批
  23. </el-button>
  24. <el-button class="el-button--small-yh" style="margin-left: 6px;" type="info" size="small"
  25. :disabled="form.status != '已发货' || form.returnsNumber == form.goodsTotalNum || editButton"
  26. @click="getReturns">
  27. 销售退货
  28. </el-button>
  29. <el-dropdown style="padding: 0 6px;line-height: 0">
  30. <el-button v-show="!(!form.id || viewDisabled)" type="danger" :loading="buttonLoading"
  31. :disabled="!form.id || viewDisabled" size="small">
  32. 售 后<i class="el-icon-arrow-down el-icon--right"></i>
  33. </el-button>
  34. <el-dropdown-menu slot="dropdown">
  35. <el-dropdown-item @click.native="applySettlement('申请')" :disabled="isApplySettlement">申请退款
  36. </el-dropdown-item>
  37. <!-- <el-dropdown-item @click.native="confirmRefundBtn('确认')" :disabled="isConfirmRefundBtn">确认退款
  38. </el-dropdown-item>-->
  39. <el-dropdown-item @click.native="revocationRequest('撤销')" :disabled="isRevocationRequest">撤销请核
  40. </el-dropdown-item>
  41. </el-dropdown-menu>
  42. </el-dropdown>
  43. <el-dropdown style="line-height: 0">
  44. <el-button type="warning" :loading="buttonLoading" :disabled="!form.id || viewDisabled"
  45. size="small">
  46. 审 批<i class="el-icon-arrow-down el-icon--right"></i>
  47. </el-button>
  48. <el-dropdown-menu slot="dropdown">
  49. <el-dropdown-item @click.native="examineBtn('审批')"
  50. :disabled="isExamineBtn && !detailData.check||form.checkStatus=='审核完成'">审批
  51. </el-dropdown-item>
  52. <el-dropdown-item @click.native="checkScheduleDialog = true, checkId = form.id">审核进度
  53. </el-dropdown-item>
  54. </el-dropdown-menu>
  55. </el-dropdown>
  56. </div>
  57. </div>
  58. <div style="margin-top: 50px">
  59. <trade-card title="基础信息">
  60. <avue-form :option="optionForm" v-model="form" ref="form">
  61. <tempalte slot="customerName" slot-scope="{ row }">
  62. <search-query :datalist="customerData" :selectValue="form.customerName" :clearable="true"
  63. :buttonIf="false" :filterable="true" :remote="true"
  64. :disabled="findObject(optionForm.column, 'customerName').disabled || form.businessSource == '外部销售' || isDisabledTask"
  65. placeholder="请选择客户" :forParameter="{ key: 'id', label: 'cname', value: 'cname' }"
  66. @corpFocus="KHgetListfun" @remoteMethod="KHgetListfun" @corpChange="KHcorpChange"
  67. @corpClear="KHClear">
  68. </search-query>
  69. </tempalte>
  70. <template slot-scope="{row,index}" slot="contacts">
  71. <el-select v-model="form.contacts" placeholder="请选择" size="small" style="width:60%" clearable
  72. filterable allow-create default-first-option @change="contactsChange($event)"
  73. :disabled=isContacts>
  74. <el-option v-for="item in contactsOption" :key="item.id" :label="item.contacts"
  75. :value="item.contacts" />
  76. </el-select>
  77. </template>
  78. </avue-form>
  79. </trade-card>
  80. <trade-card title="明细信息">
  81. <el-tabs v-model="activeName" type="card">
  82. <el-tab-pane label="销售明细" name="sale_detail">
  83. <avue-crud :option="optionContacts" v-model="formContacts" ref="formContacts"
  84. :data="form.orderItemsList" :key="key" @row-save="rowSave" @row-update="rowUpdate"
  85. @row-close="rowClose" :before-close="beforeClose" @selection-change="selectionContacts"
  86. @resetColumn="resetColumnTwo('formContacts', 'optionContacts', 'optionContactsBack', 269.1)"
  87. @saveColumn="saveColumnTwo('formContacts', 'optionContacts', 'optionContactsBack', 269.1)">
  88. <template slot-scope="{scope,row}" slot="menuLeft">
  89. <el-button type="primary" icon="el-icon-plus" size="small" :disabled="isAddBtn"
  90. @click="rowAdd(row)">添加商品</el-button>
  91. <el-button type="success" size="small" :disabled="isAddBtn" icon="el-icon-bottom"
  92. @click="excelDialogfun('名称')">按名称导入
  93. </el-button>
  94. <el-button type="success" size="small" :disabled="isAddBtn" icon="el-icon-bottom"
  95. @click="excelDialogfun('code')">按Code导入
  96. </el-button>
  97. <el-button type="primary" icon="el-icon-printer" size="small"
  98. @click="handlePrint">打印</el-button>
  99. <el-button type="danger" plain size="small" @click="batchDelete"
  100. :disabled="form.generateTask == '已生成' || form.businessSource == '外部销售'">一键删除</el-button>
  101. <el-button type="primary" plain size="small" @click="quickCopy">快捷复制</el-button>
  102. </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: 'rebatePrice',
  967. overHidden: true,
  968. width: 100,
  969. disabled: true,
  970. editDisplay: false,
  971. addDisplay: false
  972. },
  973. {
  974. label: '返利后成本价',
  975. prop: 'rebateCostprie',
  976. overHidden: true,
  977. width: 100,
  978. disabled: true,
  979. editDisplay: false,
  980. addDisplay: false
  981. },
  982. {
  983. label: '返利后利润',
  984. prop: 'rebateProfit',
  985. overHidden: true,
  986. width: 100,
  987. disabled: true,
  988. editDisplay: false,
  989. addDisplay: false
  990. },
  991. {
  992. label: '退货数量',
  993. prop: "returnsNumber",
  994. overHidden: true,
  995. width: 100,
  996. disabled: true,
  997. },
  998. {
  999. label: '退货金额',
  1000. prop: "returnsAmount",
  1001. overHidden: true,
  1002. width: 100,
  1003. disabled: true,
  1004. },
  1005. {
  1006. label: '备注',
  1007. prop: "remarks",
  1008. overHidden: true,
  1009. width: 100,
  1010. disabled: false,
  1011. }
  1012. ]
  1013. },
  1014. selectionMultilist: [], // 多选数据
  1015. optionPaymentDetails: {},
  1016. optionPaymentDetailsBack: {
  1017. align: 'center',
  1018. index: true,
  1019. addBtnText: "录入明细",
  1020. menu: false,
  1021. refreshBtn: false,
  1022. dialogDrag: true,
  1023. addBtn: false,
  1024. span: 8,
  1025. height: 600,
  1026. addRowBtn: false,
  1027. editBtn: false,
  1028. delBtn: false,
  1029. menuWidth: 140,
  1030. dialogTop: 25,
  1031. dialogWidth: "80%",
  1032. column: [{
  1033. label: '支付编号',
  1034. prop: 'serialNumber'
  1035. }, {
  1036. label: '金额',
  1037. prop: 'amount'
  1038. }, {
  1039. label: '类型',
  1040. prop: 'type'
  1041. }, {
  1042. label: '支付时间',
  1043. prop: 'createTime'
  1044. }]
  1045. },
  1046. optionOutboundRecords: {},
  1047. optionOutboundRecordsBack: {
  1048. align: 'center',
  1049. index: true,
  1050. menu: false,
  1051. addBtnText: "录入明细",
  1052. refreshBtn: false,
  1053. dialogDrag: true,
  1054. addBtn: false,
  1055. span: 8,
  1056. height: 600,
  1057. addRowBtn: false,
  1058. editBtn: false,
  1059. delBtn: false,
  1060. // menuWidth: 140,
  1061. dialogTop: 25,
  1062. dialogWidth: "80%",
  1063. column: [{
  1064. label: '出库单号',
  1065. prop: 'billno'
  1066. },
  1067. // {
  1068. // label: '来源单号',
  1069. // prop: 'ordNo'
  1070. // },
  1071. {
  1072. label: '数量',
  1073. prop: 'goodsTotalNum'
  1074. }, {
  1075. label: '实际数量',
  1076. prop: 'sendTotalNum'
  1077. }, {
  1078. label: '业务类型',
  1079. prop: 'bizTypeName'
  1080. }, {
  1081. label: '状态',
  1082. prop: 'statusName'
  1083. }, {
  1084. label: '业务时间',
  1085. prop: 'createTime'
  1086. }]
  1087. }
  1088. }
  1089. },
  1090. components: { SearchQuery, reportDialog, check, checkSchedule },
  1091. props: {
  1092. onLoad: Object,
  1093. detailData: Object
  1094. },
  1095. async created() {
  1096. console.log(this.detailData.id)
  1097. console.log(JSON.parse(localStorage.getItem('saber-tenantId')).content, 959)
  1098. if (JSON.parse(localStorage.getItem('saber-tenantId')).content == '069164') {
  1099. this.reportName = '轮胎商城-玉玲珑销售单'
  1100. } else {
  1101. this.reportName = '轮胎商城-销售订单'
  1102. }
  1103. // console.log(this.$route);
  1104. // if(this.$route.query.check.actId){
  1105. // this.isExamineBtn = false
  1106. // }
  1107. getWorkDicts("tyre_express_company").then(res => {
  1108. this.courierCompaniesList = res.data.data;
  1109. })
  1110. this.findObject(this.optionContactsBack.column, "goodsId").change = ({ value, column }) => {
  1111. if (this.formContacts.goodsId !== value) {
  1112. goodsDetail({ id: value, customId: this.dicUrlWithCustomId, stock: this.form.storageId ? this.form.storageId : '' }).then(res => {
  1113. this.goods = res.data.data
  1114. this.formContacts.goodsNo = res.data.data.code
  1115. this.formContacts.brandId = res.data.data.brandId
  1116. this.formContacts.inventory = res.data.data.inventory
  1117. // this.formContacts.brandId = res.data.data.brandName
  1118. // this.formContacts.brandName = res.data.data.brandId
  1119. this.formContacts.propertyName = res.data.data.specificationAndModel
  1120. this.formContacts.pattern = res.data.data.brandItem
  1121. this.formContacts.goodsDescription = res.data.data.goodsDescription
  1122. this.formContacts.units = res.data.data.unit
  1123. this.formContacts.price = res.data.data.price
  1124. //
  1125. this.formContacts.sharedCompanyId = res.data.data.sharedCompanyId
  1126. console.log(res.data.data.sharedCompanyId);
  1127. console.log(res.data.data.sharedCompanyName);
  1128. this.form.sharedCompanyId = res.data.data.sharedCompanyId
  1129. this.form.sharedCompanyName = res.data.data.sharedCompanyName
  1130. this.sharedCompanyId = res.data.data.sharedCompanyId
  1131. console.log(res.data.data.sharedCompanyId);
  1132. console.log(this.form.orderItemsList);
  1133. for (let i = 0; i < this.form.orderItemsList.length; i++) {
  1134. console.log(Number(this.form.orderItemsList[i].sharedCompanyId));
  1135. if (Number(this.form.orderItemsList[i].sharedCompanyId) != Number(res.data.data.sharedCompanyId)) {
  1136. this.isStatus = 0
  1137. }
  1138. }
  1139. if (res.data.data.whether == 0) {
  1140. this.findObject(this.optionContactsBack.column, "dot").disabled = true
  1141. } else {
  1142. this.findObject(this.optionContactsBack.column, "dot").disabled = false
  1143. dotList({
  1144. storageId: this.form.storageId,
  1145. goodsId: this.formContacts.goodsId
  1146. }).then(res => {
  1147. this.findObject(this.optionContactsBack.column, "dot").dicData = res.data.data
  1148. })
  1149. }
  1150. // this.formContacts.goodsId = res.data.data.cname
  1151. // this.formContacts.goodsName = res.data.data.id
  1152. })
  1153. }
  1154. }
  1155. this.optionContacts = await this.getColumnData(this.getColumnName(269.1), this.optionContactsBack);
  1156. this.findObject(this.optionContacts.column, "goodsId").change = ({ value, column }) => {
  1157. if (this.formContacts.goodsId !== value) {
  1158. goodsDetail({ id: value, customId: this.dicUrlWithCustomId, stock: this.form.storageId ? this.form.storageId : '' }).then(res => {
  1159. this.goods = res.data.data
  1160. this.formContacts.goodsNo = res.data.data.code
  1161. this.formContacts.brandId = res.data.data.brandId
  1162. this.formContacts.inventory = res.data.data.inventory
  1163. // this.formContacts.brandId = res.data.data.brandName
  1164. // this.formContacts.brandName = res.data.data.brandId
  1165. this.formContacts.propertyName = res.data.data.specificationAndModel
  1166. this.formContacts.pattern = res.data.data.brandItem
  1167. this.formContacts.goodsDescription = res.data.data.goodsDescription
  1168. this.formContacts.dotListunits = res.data.data.unit
  1169. this.sharedCompanyId = res.data.data.sharedCompanyId
  1170. this.formContacts.sharedCompanyId = res.data.data.sharedCompanyId
  1171. //
  1172. this.form.sharedCompanyId = res.data.data.sharedCompanyId
  1173. this.form.sharedCompanyName = res.data.data.sharedCompanyName
  1174. for (let i = 0; i < this.form.orderItemsList.length; i++) {
  1175. if (this.form.orderItemsList[i].sharedCompanyId != res.data.data.sharedCompanyId) {
  1176. this.isStatus = 0
  1177. }
  1178. }
  1179. if (res.data.data.whether == 0) {
  1180. this.findObject(this.optionContacts.column, "dot").disabled = true
  1181. } else {
  1182. this.findObject(this.optionContacts.column, "dot").disabled = false
  1183. dotList({
  1184. storageId: this.form.storageId,
  1185. goodsId: this.formContacts.goodsId
  1186. }).then(res => {
  1187. this.findObject(this.optionContacts.column, "dot").dicData = res.data.data
  1188. })
  1189. }
  1190. // this.formContacts.goodsId = res.data.data.cname
  1191. // this.formContacts.goodsName = res.data.data.id
  1192. })
  1193. }
  1194. }
  1195. this.optionPaymentDetails = await this.getColumnData(this.getColumnName(269.2), this.optionPaymentDetailsBack);
  1196. this.optionOutboundRecords = await this.getColumnData(this.getColumnName(269.3), this.optionOutboundRecordsBack);
  1197. this.key++
  1198. if (this.onLoad.id && this.detailData.id) {
  1199. this.$set(this.optionForm, 'disabled', true)
  1200. this.$set(this.optionContactsBack, 'disabled', true)
  1201. this.isContacts = true
  1202. this.isDisabled = true
  1203. //添加删除按钮禁用
  1204. this.isAdd = true
  1205. this.refresh(this.onLoad.id, true)
  1206. } else if (this.onLoad.id) {
  1207. console.log(2);
  1208. this.refresh(this.onLoad.id, true)
  1209. }
  1210. if (!this.form.id) {
  1211. console.log(3);
  1212. this.optionContactsBack.column.forEach(its => {
  1213. if (its.prop == 'goodsId' || its.prop == 'goodsNum' || its.prop == 'price' || its.prop == 'dot' || its.prop == 'remarks') {
  1214. its.disabled = false
  1215. } else {
  1216. its.disabled = true
  1217. }
  1218. })
  1219. this.isSaveBtn = true;
  1220. this.isDisabledTask = true;
  1221. this.viewDisabled = true;
  1222. // this.$set(this.optionContactsBack, "addBtn", false)
  1223. this['optionContacts'] = this['optionContactsBack'];
  1224. this.delColumnData(this.getColumnName('269.1'), this['optionContactsBack']);
  1225. }
  1226. if (!this.detailData.id) {
  1227. this.editButton = false
  1228. this.isAddBtn = false
  1229. this.isDisabledTask = false;
  1230. this.isSaveBtn = false
  1231. this.viewDisabled = false;
  1232. this.form.businessSource = '内部销售'
  1233. }
  1234. console.log('this.detailData.check', this.detailData.check);
  1235. if (this.detailData.check) {
  1236. this.isExamineBtn = false
  1237. // this.batchNo = this.detailData.check.batchNo
  1238. }
  1239. //成本、毛利对业务员隐藏
  1240. this.optionForm.column.forEach(its => {
  1241. if (JSON.parse(localStorage.getItem('saber-userInfo')).content.role_name.split(',').includes('业务员')) {
  1242. if (its.prop == 'cost' || its.prop == 'grossProfit') {
  1243. this.$set(its, 'display', false)
  1244. }
  1245. } else {
  1246. if (its.prop == 'cost' || its.prop == 'grossProfit') {
  1247. this.$set(its, 'display', true)
  1248. }
  1249. }
  1250. })
  1251. // 明细信息成本、毛利对业务员隐藏
  1252. this.optionContacts.column.forEach(its => {
  1253. if (JSON.parse(localStorage.getItem('saber-userInfo')).content.role_name.split(',').includes('业务员')) {
  1254. if (its.prop == 'costprie' || its.prop == 'grossProfit') {
  1255. this.$set(its, 'hide', true)
  1256. }
  1257. } else {
  1258. if (its.prop == 'costprie' || its.prop == 'grossProfit') {
  1259. this.$set(its, 'hide', false)
  1260. }
  1261. }
  1262. })
  1263. if (this.detailData.id) {
  1264. this.getDetailsfun()
  1265. }
  1266. },
  1267. watch: {
  1268. dicUrlWithCustomId() {
  1269. console.log(this.form);
  1270. // this.findObject(this.optionContactsBack.column, "goodsId").dicUrl = `/api/blade-sales-part/goodsDesc/goodsListXs?cname={{key}}&customId=${this.dicUrlWithCustomId}&enableOrNot=0`
  1271. goodsListXs(this.dicUrlWithCustomId, this.form.storageId ? this.form.storageId : '').then(res => {
  1272. this.findObject(this.optionContactsBack.column, "goodsId").dicData = res.data.data
  1273. })
  1274. },
  1275. 'form.storageId'(newStorageId, oldStorageId) {
  1276. goodsListXs(this.dicUrlWithCustomId, this.form.storageId ? this.form.storageId : '').then(res => {
  1277. console.log(res.data.data, '2');
  1278. this.findObject(this.optionContactsBack.column, "goodsId").dicData = res.data.data
  1279. })
  1280. },
  1281. 'form.orderItemsList.length'(newformContacts, oldformContacts) {
  1282. console.log(this.formContacts);
  1283. console.log(this.form.orderItemsList);
  1284. // for (let i = 0; i < this.form.orderItemsList.length - 1; i++) {
  1285. // const currentItem = this.form.orderItemsList[i];
  1286. // const nextItem = this.form.orderItemsList[i + 1];
  1287. // if (currentItem.sharedCompanyId !== nextItem.sharedCompanyId) {
  1288. // console.log('不能添加');
  1289. // }
  1290. // }
  1291. if (this.form.orderItemsList.length) {
  1292. this.findObject(this.optionForm.column, 'storageId').disabled = true
  1293. } else {
  1294. this.findObject(this.optionForm.column, 'storageId').disabled = false
  1295. }
  1296. },
  1297. 'form.sharedCompanyId'(newSharedCompanyId, oldSharedCompanyId) {
  1298. console.log(newSharedCompanyId, oldSharedCompanyId);
  1299. if (newSharedCompanyId != oldSharedCompanyId) {
  1300. console.log('不能添加');
  1301. }
  1302. console.log(this.sharedCompanyId);
  1303. },
  1304. $route(to, from) {
  1305. if (this.onLoad.id && this.detailData.id) {
  1306. this.$set(this.optionForm, 'disabled', true)
  1307. this.$set(this.optionContactsBack, 'disabled', true)
  1308. this.isContacts = true
  1309. this.isDisabled = true
  1310. this.isAdd = true
  1311. this.refresh(this.onLoad.id, true)
  1312. } else if (this.onLoad.id) {
  1313. this.refresh(this.onLoad.id, true)
  1314. }
  1315. // if (!this.form.id) {
  1316. // console.log(3);
  1317. // // this.$set(this.optionContactsBack, "addBtn", false)
  1318. // this['optionContacts'] = this['optionContactsBack'];
  1319. // this.delColumnData(this.getColumnName('269.1'), this['optionContactsBack']);
  1320. // }
  1321. // if (!this.detailData.id) {
  1322. // this.form.businessSource = '内部销售'
  1323. // }
  1324. if (this.detailData.status == 1) {
  1325. this.isExamineBtn = false;
  1326. }
  1327. // if (to.name == '销售订单') {
  1328. // console.log('销售订单');
  1329. // this.isExamineBtn = false;
  1330. // }
  1331. }
  1332. },
  1333. methods: {
  1334. uploadAfter(res, done, loading, column) {
  1335. if (Array.isArray(res)) {
  1336. if (res instanceof Array) {
  1337. this.form.orderItemsList = this.form.orderItemsList.concat(res)
  1338. res.forEach(item => {
  1339. dotList({
  1340. storageId: this.form.storageId,
  1341. goodsId: res.goodsId
  1342. }).then(e => {
  1343. this.findObject(this.optionContactsBack.column, "dot").dicData = e.data.data
  1344. })
  1345. })
  1346. }
  1347. } else {
  1348. this.$message.error(res)
  1349. }
  1350. this.excelBox = false;
  1351. loading = false;
  1352. done(res);
  1353. },
  1354. derivation() {
  1355. window.open(
  1356. `${this.templateUrl}?${this.website.tokenHeader
  1357. }=${getToken()}&stockId=${this.form.storageId}`
  1358. );
  1359. },
  1360. uploadBefore(file, done, loading) {
  1361. done();
  1362. loading = true;
  1363. },
  1364. // 销售明细 导入按钮
  1365. excelDialogfun(name) {
  1366. if (!this.form.customerId) {
  1367. this.$message.error('请选择客户')
  1368. return
  1369. }
  1370. if (name == '名称') {
  1371. this.findObject(this.excelOption.column, "excelFile").action = '/api/blade-sales-part/order/import-item-name'
  1372. this.templateUrl = '/api/blade-sales-part/order/export-item-name'
  1373. } else if (name == 'code') {
  1374. this.findObject(this.excelOption.column, "excelFile").action = '/api/blade-sales-part/order/import-item-code'
  1375. this.templateUrl = '/api/blade-sales-part/order/export-item-code'
  1376. }
  1377. this.excelBox = true
  1378. },
  1379. //生成退货单
  1380. getReturns() {
  1381. this.$confirm("您确定要退货吗?", {
  1382. confirmButtonText: "确定",
  1383. cancelButtonText: "取消",
  1384. type: "warning"
  1385. }).then(() => {
  1386. this.$router.push({
  1387. path: "/tirePartsMall/salesService/returns/index",
  1388. query: {
  1389. bsType: 'TKXS',
  1390. id: this.form.id,
  1391. }
  1392. });
  1393. })
  1394. },
  1395. // 客户监听
  1396. KHcorpChange(value) {
  1397. for (let item of this.customerData) {
  1398. if (item.cname == value) {
  1399. this.$set(this.form, 'customerId', item.id)
  1400. this.$set(this.form, 'customerName', item.cname)
  1401. if (this.$refs.form.DIC.customerId || !this.onLoad.id) {
  1402. getCustom({ id: item.id }).then(res => {
  1403. if (res.data.data) {
  1404. this.dicUrlWithCustomId = res.data.data.id ? res.data.data.id : ''
  1405. this.form.storageId = this.form.storageId ? this.form.storageId : res.data.data.deliveryWarehouseId
  1406. this.form.contacts = res.data.data.corpsAttnList[0].cname
  1407. this.form.phone = res.data.data.corpsAttnList[0].tel
  1408. this.contactsOption = res.data.data.corpsAddrList
  1409. this.form.recAddress = res.data.data.corpsAddrList[0].belongtoarea + res.data.data.corpsAddrList[0].detailedAddress
  1410. this.form.salerId = res.data.data.salesmanId ? res.data.data.salesmanId : ''
  1411. }
  1412. })
  1413. }
  1414. }
  1415. }
  1416. },
  1417. KHClear() {
  1418. this.form.customerId = ''
  1419. this.form.customerName = ''
  1420. this.dicUrlWithCustomId = ''
  1421. this.form.storageId = ''
  1422. this.form.contacts = ''
  1423. this.form.phone = ''
  1424. this.contactsOption = ''
  1425. this.form.recAddress = ''
  1426. this.form.salerId = ''
  1427. this.KHgetListfun()
  1428. },
  1429. // 获取客户数据
  1430. KHgetListfun(cname) {
  1431. KHgetList({
  1432. current: 1,
  1433. size: 10,
  1434. corpType: 'KH',
  1435. cname: cname ? cname : null,
  1436. }).then(res => {
  1437. this.customerData = res.data.data.records
  1438. })
  1439. },
  1440. // 获取详细明细信息
  1441. getDetailsfun() {
  1442. getDetails({
  1443. id: this.detailData.id
  1444. }).then(res => {
  1445. this.form = res.data.data
  1446. this.form.orderItemsList = res.data.data.orderItemsList
  1447. console.log(this.isEditButton, 'bianj')
  1448. console.log(this.isDisabledTask, 'chexiao')
  1449. console.log(this.buttonColor, '123')
  1450. // if (this.form.status == '待发货') {
  1451. //
  1452. // }
  1453. })
  1454. },
  1455. // 获取左侧筛选
  1456. getAllWorkDicts() {
  1457. getCorpTypes().then(res => {
  1458. this.treeDataGoods = res.data.data;
  1459. });
  1460. },
  1461. //导入页左商品类型查询
  1462. nodeClick(data) {
  1463. this.treeDeptId = data.id;
  1464. this.page.currentPage = 1;
  1465. this.onLoadfun(this.page, { ...this.SelectSearch, goodsTypeId: this.treeDeptId });
  1466. },
  1467. closeGoods() {
  1468. this.treeDataGoods = [];
  1469. this.treeDeptId = "";
  1470. this.activeNameTabs = "searchList";
  1471. },
  1472. //刷新触发
  1473. refreshChange() {
  1474. this.page.currentPage = 1;
  1475. this.onLoadfun(this.page);
  1476. },
  1477. //选中触发
  1478. selectionChange(list) {
  1479. this.tableData = list
  1480. },
  1481. // 点击搜索触发
  1482. goodsSearch(params, done) {
  1483. this.page.currentPage = 1;
  1484. params = {
  1485. ...params,
  1486. artsVision: this.form.belongToCorpId,
  1487. }
  1488. // params.specificationAndModel = params.cname
  1489. // delete params.cname
  1490. this.onLoadfun(this.page, params);
  1491. done()
  1492. },
  1493. // 标签页切换
  1494. tabHandle(data) {
  1495. if (data.name == 'searchList') {
  1496. this.goodsListShow = this.data;
  1497. this.page.total = this.pageList.total
  1498. } else if (data.name == 'importStaging') {
  1499. this.goodsListShow = this.goodsListSave;
  1500. this.page.total = 0
  1501. }
  1502. },
  1503. // 商品信息价格计算
  1504. amountChange(value, row) {
  1505. if (value > 0) {
  1506. this.$refs.crud.toggleRowSelection(row, true);
  1507. } else {
  1508. this.$refs.crud.toggleRowSelection(row, false);
  1509. }
  1510. // 价格
  1511. // if (!row.price) {
  1512. // row.price = 0;
  1513. // }
  1514. },
  1515. importStagList(row, index, type) {
  1516. this.goodsListSave.push(row);
  1517. },
  1518. removeStagList(row, index, type) {
  1519. this.goodsListSave.splice(row.$index, 1)
  1520. },
  1521. //确认导入触发
  1522. async importGoods() {
  1523. this.surplusRouteQuantityOption.push({ storageQuantity: '0' });
  1524. if (this.goodsListSave.length > 0) {
  1525. this.goodsListSaveHandle()
  1526. } else {
  1527. if (this.tableData.length > 0) {
  1528. this.tableDataHandle()
  1529. }
  1530. }
  1531. },
  1532. // 导入按钮事件
  1533. tableDataHandle() {
  1534. // 循环获取库存数量
  1535. for (let item of this.tableData) {
  1536. let page = {}
  1537. if (this.form.storageId) {
  1538. page.storageId = this.form.storageId
  1539. }
  1540. page.goodsId = item.goodsId
  1541. let obj = {
  1542. goodsId: item.id,
  1543. price: item.price,
  1544. goodsName: item.cname,
  1545. goodsNum: item.goodsNum,
  1546. brandName: item.brandName,
  1547. brandId: item.brandId,
  1548. goodsNo: item.code,
  1549. propertyName: item.specificationAndModel,
  1550. inventory: item.inventory,
  1551. pattern: item.brandItem,
  1552. goodsDescription: item.goodsDescription,
  1553. dot: item.dot,
  1554. // poNo: item.poNo,
  1555. whether: item.whether,
  1556. units: item.unit,
  1557. // 小计
  1558. subTotalMoney: Number(item.goodsNum * item.price)?Number(item.goodsNum * item.price).toFixed(2):0,
  1559. // 备注
  1560. remarks: item.remarks,
  1561. // 批次号的状态
  1562. dotedittype: false,
  1563. // 价格数量
  1564. goodsNumtype: false,
  1565. // 价格
  1566. pricetype: false,
  1567. }
  1568. for (let ite of item.goodsFilesList) {
  1569. if (ite.version == '0') {
  1570. obj.url = ite.url
  1571. }
  1572. }
  1573. this.form.orderItemsList.push(obj)
  1574. }
  1575. this.dialogVisible = false
  1576. },
  1577. // 导入
  1578. goodsListSaveHandle() {
  1579. this.tableData = this.goodsListSave
  1580. this.tableDataHandle()
  1581. },
  1582. // 获取添加商品弹窗里的数据
  1583. goodsPageXsfun() {
  1584. goodsPageXs({
  1585. customId: this.form.customerId,
  1586. stock: this.form.storageId,
  1587. enableOrNot: 1
  1588. }).then(res => {
  1589. const data = res.data.data;
  1590. this.goodsListShow = data.records;
  1591. })
  1592. },
  1593. //导入商品弹窗列表查询
  1594. onLoadfun(page, params = { artsVision: this.form.belongToCorpId }) {
  1595. console.log(params)
  1596. this.loading = true;
  1597. goodsPageXs({
  1598. current: page.currentPage,
  1599. size: page.pageSize,
  1600. customId: this.form.customerId,
  1601. stock: this.form.storageId,
  1602. enableOrNot: 1,
  1603. goodsTypeId: this.treeDeptId,
  1604. ...Object.assign(params, this.SelectSearch),
  1605. }).then(res => {
  1606. const data = res.data.data;
  1607. this.page.total = data.total;
  1608. this.pageList.total = data.total
  1609. this.data = data.records;
  1610. this.goodsListShow = data.records;
  1611. for (let item of this.goodsListShow) {
  1612. item.goodsNum = item.goodsNum ? item.goodsNum : 0
  1613. }
  1614. // // 获取单价数据
  1615. // for(let item of this.goodsListShow) {
  1616. // let page = {}
  1617. // if (this.form.storageId) {
  1618. // page.storageId = this.form.storageId
  1619. // }
  1620. // page.goodsId = item.goodsId
  1621. // dotList(page).then(res=>{
  1622. // // console.log(res.data.data[0].inventoryCostPrice)
  1623. // item.price = res.data.data[0].inventoryCostPrice
  1624. // // console.log(item)
  1625. // })
  1626. // }
  1627. this.loading = false;
  1628. })
  1629. },
  1630. // 采购明细行编辑
  1631. hangeditBtn(row, index) {
  1632. // 获取是否管理批次号
  1633. getDetailsGods({ id: row.goodsId }).then(res => {
  1634. row.whether = res.data.data.whether
  1635. this.picihaolistfun(row.id)
  1636. row.dotedittype = true
  1637. // 价格数量
  1638. row.goodsNumtype = true
  1639. row.pricetype = true
  1640. // 编辑和保存状态切换
  1641. this.mingxibaocun = false
  1642. this.goodsPageXsfun()
  1643. })
  1644. },
  1645. // 保存按钮
  1646. hangbaocun(row) {
  1647. row.dotedittype = false
  1648. row.goodsNumtype = false
  1649. row.pricetype = false
  1650. this.mingxibaocun = true
  1651. },
  1652. // 批次号获取数据
  1653. picihaolistfun(goodsId) {
  1654. dotList({
  1655. storageId: this.form.storageId,
  1656. goodsId: goodsId
  1657. }).then(res => {
  1658. this.picihaolist = res.data.data
  1659. })
  1660. },
  1661. // 批次号切换库存
  1662. dotchangefun(value, row) {
  1663. for (let item of this.picihaolist) {
  1664. if (item.dot == value) {
  1665. this.$set(row, 'inventory', item.balanceQuantity)
  1666. this.$set(row, 'rebatePrice', item.rebatePrice)
  1667. }
  1668. }
  1669. },
  1670. // 数量失焦触发
  1671. goodsNumblurfun(row) {
  1672. if (Number(row.goodsNum) > Number(row.inventory)) {
  1673. this.$message.warning("不能大于库存数量");
  1674. return
  1675. }
  1676. },
  1677. editBtn(row, index) {
  1678. this.confirmEditing()
  1679. this.$refs.formContacts.rowEdit(row, index);
  1680. dotList({
  1681. storageId: this.form.storageId,
  1682. goodsId: this.formContacts.goodsId
  1683. }).then(res => {
  1684. this.findObject(this.optionContactsBack.column, "dot").dicData = res.data.data
  1685. })
  1686. goodsListXs(this.dicUrlWithCustomId, this.form.storageId ? this.form.storageId : '').then(res => {
  1687. this.findObject(this.optionContactsBack.column, "goodsId").dicData = res.data.data
  1688. })
  1689. },
  1690. //表头编辑
  1691. confirmEditing() {
  1692. this.editButton = false
  1693. goodsListXs(this.dicUrlWithCustomId, this.form.storageId ? this.form.storageId : '').then(res => {
  1694. this.findObject(this.optionContactsBack.column, "goodsId").dicData = res.data.data
  1695. })
  1696. if (this.form.status == '已发货') {
  1697. this.viewDisabled = false
  1698. return
  1699. }
  1700. /* if (this.form.status == '退款中') {
  1701. this.viewDisabled = false
  1702. this.isRevocationRequest = true
  1703. return
  1704. }*/
  1705. this.isAddBtn = false
  1706. if (this.form.status == '已取消' || this.form.status == '已退款' || this.form.status == '已发货') {
  1707. return
  1708. // this.$message.error('当前状态不允许编辑')
  1709. // this.optionForm.column.forEach(item=>{
  1710. // if(item.prop= 'contacts'){
  1711. // item.disabled = true
  1712. // }
  1713. // })
  1714. }
  1715. if (this.form.status == '退款请核') {
  1716. this.viewDisabled = false
  1717. this.isAddBtn = true
  1718. return
  1719. }
  1720. if (this.form.status == '已取消' || this.form.status == '退款请核') {
  1721. this.isAddBtn = true
  1722. // this.$message.error('当前状态不允许编辑')
  1723. // this.optionForm.column.forEach(item=>{
  1724. // if(item.prop= 'contacts'){
  1725. // item.disabled = true
  1726. // }
  1727. // })
  1728. }
  1729. if (this.form.status == '待发货') {
  1730. this.isAddBtn = true
  1731. }
  1732. this.optionContactsBack.column.forEach(its => {
  1733. if (its.prop == 'goodsId' || its.prop == 'goodsNum' || its.prop == 'price' || its.prop == 'dot' || its.prop == 'remarks') {
  1734. its.disabled = false
  1735. } else {
  1736. its.disabled = true
  1737. }
  1738. })
  1739. this.$set(this.optionForm, 'disabled', false)
  1740. this.$set(this.optionContactsBack, 'disabled', false)
  1741. if (this.form.generateTask == '已生成') {
  1742. this.optionForm.disabled = true
  1743. }
  1744. this.isDisabled = false
  1745. this.isAdd = false
  1746. if (this.form.businessSource == "外部销售") {
  1747. this.optionForm.column.forEach(its => {
  1748. if (its.prop == 'contacts' || its.prop == 'phone' || its.prop == 'recAddress') {
  1749. this.$set(its, 'disabled', true)
  1750. }
  1751. })
  1752. if (this.form.status == '待发货') {
  1753. this.isSaveBtn = false;
  1754. this.isDisabledTask = false;
  1755. this.viewDisabled = false;
  1756. }
  1757. if (this.form.status == '待确认') {
  1758. const loadings = this.$loading({
  1759. lock: true,
  1760. text: '加载中',
  1761. spinner: 'el-icon-loading',
  1762. background: 'rgba(255,255,255,0.7)'
  1763. });
  1764. console.log('外部销售待确认');
  1765. this.isSaveBtn = false;
  1766. this.isDisabledTask = false;
  1767. this.viewDisabled = false;
  1768. this.optionForm.column.forEach(its => {
  1769. if (its.prop == 'customerName') {
  1770. this.$set(its, 'disabled', true)
  1771. }
  1772. if (its.prop == 'storageId') {
  1773. this.$set(its, 'disabled', false)
  1774. }
  1775. })
  1776. //外部销售都能申请退款
  1777. this.isApplySettlement = false
  1778. //不能录入不能删除
  1779. this.isDisabled = true
  1780. this.isAdd = false
  1781. this.isAddBtn = true
  1782. this.$set(this.form, 'shipType', '物流')
  1783. this.$set(this.form, 'receivableType', '网络支付')
  1784. this.optionContactsBack.column.forEach(item => {
  1785. this.$set(item, 'disabled', true)
  1786. if (item.label == '批次号' || item.label == '备注') {
  1787. item.disabled = false
  1788. }
  1789. })
  1790. loadings.close()
  1791. } else {
  1792. const loadin = this.$loading({
  1793. lock: true,
  1794. text: '加载中',
  1795. spinner: 'el-icon-loading',
  1796. background: 'rgba(255,255,255,0.7)'
  1797. });
  1798. this.isAddBtn = true
  1799. this.isDisabled = true
  1800. this.isSaveBtn = false;
  1801. this.isDisabledTask = false;
  1802. this.viewDisabled = false;
  1803. this.optionForm.column.forEach(its => {
  1804. if (its.prop != 'remarks') {
  1805. its.disabled = true
  1806. } else {
  1807. its.disabled = false
  1808. }
  1809. })
  1810. this.optionContactsBack.column.forEach(its => {
  1811. if (its.prop != 'remarks') {
  1812. its.disabled = true
  1813. } else {
  1814. its.disabled = false
  1815. }
  1816. })
  1817. loadin.close()
  1818. }
  1819. } else {
  1820. const loading = this.$loading({
  1821. lock: true,
  1822. text: '加载中',
  1823. spinner: 'el-icon-loading',
  1824. background: 'rgba(255,255,255,0.7)'
  1825. });
  1826. if (this.form.status == '待发货' || this.form.status == '已发货' || this.form.status == '已取消') {
  1827. const loading = this.$loading({
  1828. lock: true,
  1829. text: '加载中',
  1830. spinner: 'el-icon-loading',
  1831. background: 'rgba(255,255,255,0.7)'
  1832. });
  1833. this.optionForm.column.forEach(its => {
  1834. if (its.prop != 'remarks') {
  1835. its.disabled = true
  1836. } else {
  1837. its.disabled = false
  1838. }
  1839. })
  1840. this.optionContactsBack.column.forEach(its => {
  1841. if (its.prop != 'remarks') {
  1842. its.disabled = true
  1843. } else {
  1844. its.disabled = false
  1845. }
  1846. })
  1847. loading.close()
  1848. } else if (this.form.status == '录入') {
  1849. this.isSaveBtn = false;
  1850. this.isDisabledTask = false;
  1851. this.viewDisabled = false;
  1852. // this.$set(this.optionForm, 'disabled', false)
  1853. // this.$set(this.optionContactsBack, 'disabled', false)
  1854. this.$set(this.optionForm, 'disabled', false)
  1855. this.$set(this.optionContactsBack, 'disabled', false)
  1856. this.isContacts = true
  1857. //删除按钮
  1858. this.isDisabled = false
  1859. // this.optionForm.column.forEach(item => {
  1860. // item.disabled = false
  1861. // })
  1862. loading.close()
  1863. } else if (this.form.status == '待确认') {
  1864. this.isSaveBtn = false;
  1865. this.isDisabledTask = false;
  1866. this.viewDisabled = false;
  1867. // this.isDisabled = true
  1868. console.log('待确认');
  1869. this.optionForm.column.forEach(item => {
  1870. if (item.label === '成本' || item.label === '毛利' || item.label === '销售金额' || item.label === '运费' || item.label === '总金额' || item.label === '已收金额' || item.label === '单据编号' || item.label === '来源编号') {
  1871. this.$set(item, 'disabled', true)
  1872. } else {
  1873. this.$set(item, 'disabled', false)
  1874. }
  1875. })
  1876. this.isContacts = false
  1877. this.optionContactsBack.column.forEach(its => {
  1878. if (its.prop == 'remarks' || its.prop == 'dot') {
  1879. this.$set(its, 'disabled', false)
  1880. } else {
  1881. this.$set(its, 'disabled', true)
  1882. }
  1883. })
  1884. loading.close()
  1885. }
  1886. if (this.form.status == '待发货') {
  1887. this.isSaveBtn = false;
  1888. this.isDisabledTask = false;
  1889. this.viewDisabled = false;
  1890. this.isDisabled = true
  1891. this.isAdd = true
  1892. }
  1893. // this.$set(this.form, 'shipType', '物流')
  1894. // this.$set(this.form, 'receivableType', '现金')
  1895. // this.optionContactsBack.column.forEach(item => {
  1896. // this.$set(item, 'disabled', false)
  1897. // })
  1898. // this.optionContactsBack.column.forEach(item => {
  1899. // if (item.label === '规格型号' || item.label === '花纹' || item.label === '品牌' || item.label === '物料编码' || item.label === '单位' || item.label === '轮胎描述') {
  1900. // item.disabled = true;
  1901. // }
  1902. // })
  1903. // this['optionContacts'] = this['optionContactsBack'];
  1904. // this.delColumnData(this.getColumnName(269.1), this['optionContactsBack']);
  1905. // this.form.outboundRecordsList.forEach(item=>{
  1906. // if(item.statusName == '待出库'){
  1907. // this.isDisabledTask = true
  1908. // }
  1909. // })
  1910. loading.close()
  1911. }
  1912. // this.$set(this.form.orderItemsList,'goodsNum',66)
  1913. },
  1914. generateOutbound() {
  1915. if (!this.form.id) {
  1916. this.$message.error('请先保存')
  1917. } else {
  1918. if (this.buttonText === '生成任务') {
  1919. //生成任务逻辑
  1920. if (this.form.orderItemsList.length <= 0) {
  1921. this.$message.error('请录入明细');
  1922. } else {
  1923. this.$refs["form"].validate((valid, done) => {
  1924. done();
  1925. if (valid) {
  1926. const loading = this.$loading({
  1927. lock: true,
  1928. text: '加载中',
  1929. spinner: 'el-icon-loading',
  1930. background: 'rgba(255,255,255,0.7)'
  1931. });
  1932. getParamservice(1, 10, { paramKey: 'whether.financing' }).then(res => {
  1933. if (res.data.data.records.length) {
  1934. res.data.data.records.forEach(e => {
  1935. if (e.paramValue == 1) {
  1936. if(!this.form.storageId) return this.$message.error('请选择仓库')
  1937. whetherExistenceFinancing({
  1938. bsType: "XS",
  1939. ...this.form
  1940. }).then(res => {
  1941. if (res.data.data == true) {
  1942. submit({
  1943. bsType: "XS",
  1944. ...this.form
  1945. }).then(res => {
  1946. // this.refresh(res.data.data.id)
  1947. this.isDisabledTask = false
  1948. const loading = this.$loading({
  1949. lock: true,
  1950. text: '加载中',
  1951. spinner: 'el-icon-loading',
  1952. background: 'rgba(255,255,255,0.7)'
  1953. });
  1954. generateShipTask(this.form).then(res => {
  1955. this.$set(this.optionForm, 'disabled', true)
  1956. this.$set(this.optionContactsBack, 'disabled', true)
  1957. this.$message.success("生成出库任务成功");
  1958. // 将按钮文本更改为"撤销任务"
  1959. this.buttonText = '撤销任务';
  1960. // 将按钮颜色更改为对应的颜色
  1961. this.buttonColor = 'warning'; // 比如改为warning
  1962. this.refresh(res.data.data.id)
  1963. this.refreshs(res.data.data.id, true)
  1964. this.isContacts = true
  1965. this.isApplySettlement = false
  1966. this.isAdd = true
  1967. this.isDisabled = true
  1968. this.isAddBtn = true
  1969. this.isDisabledTask = true
  1970. this.editButton = true // 把编辑按钮显示出来
  1971. }).finally(() => {
  1972. loading.close();
  1973. })
  1974. }).catch(() => {
  1975. loading.close();
  1976. })
  1977. } else {
  1978. this.$confirm(res.data.data, '提示', {
  1979. confirmButtonText: '确定',
  1980. cancelButtonText: '取消',
  1981. type: 'warning'
  1982. }).then(() => {
  1983. checkOrderRW({
  1984. bsType: "XS",
  1985. ...this.form,
  1986. url: '/tirePartsMall/salesManagement/saleOrder/index',
  1987. pageStatus: "this.$store.getters.ltxsStatus",
  1988. pageLabel: "销售订单(L)",
  1989. }).then(res => {
  1990. this.$set(this.optionForm, 'disabled', true)
  1991. this.$set(this.optionContactsBack, 'disabled', true)
  1992. this.$message.success("提交成功");
  1993. // 将按钮文本更改为"撤销任务"
  1994. this.buttonText = '撤销任务';
  1995. // 将按钮颜色更改为对应的颜色
  1996. this.buttonColor = 'warning'; // 比如改为warning
  1997. this.refresh(res.data.data.id)
  1998. this.refreshs(res.data.data.id, true)
  1999. this.isContacts = true
  2000. this.isApplySettlement = false
  2001. this.isAdd = true
  2002. this.isDisabled = true
  2003. this.isAddBtn = true
  2004. this.isDisabledTask = true
  2005. this.editButton = true
  2006. }).finally(() => {
  2007. loading.close();
  2008. })
  2009. }).catch(() => {
  2010. loading.close();
  2011. })
  2012. }
  2013. }).catch(() => {
  2014. loading.close();
  2015. })
  2016. } else {
  2017. submit({
  2018. bsType: "XS",
  2019. ...this.form
  2020. }).then(res => {
  2021. // this.refresh(res.data.data.id)
  2022. this.isDisabledTask = false
  2023. const loading = this.$loading({
  2024. lock: true,
  2025. text: '加载中',
  2026. spinner: 'el-icon-loading',
  2027. background: 'rgba(255,255,255,0.7)'
  2028. });
  2029. generateShipTask(this.form).then(res => {
  2030. this.$set(this.optionForm, 'disabled', true)
  2031. this.$set(this.optionContactsBack, 'disabled', true)
  2032. this.$message.success("生成出库任务成功");
  2033. // 将按钮文本更改为"撤销任务"
  2034. this.buttonText = '撤销任务';
  2035. // 将按钮颜色更改为对应的颜色
  2036. this.buttonColor = 'warning'; // 比如改为warning
  2037. this.refresh(res.data.data.id)
  2038. this.refreshs(res.data.data.id, true)
  2039. this.isContacts = true
  2040. this.isApplySettlement = false
  2041. this.isAdd = true
  2042. this.isDisabled = true
  2043. this.isAddBtn = true
  2044. this.isDisabledTask = true
  2045. this.editButton = true // 把编辑按钮显示出来
  2046. }).finally(() => {
  2047. loading.close();
  2048. })
  2049. }).catch(() => {
  2050. loading.close();
  2051. })
  2052. }
  2053. })
  2054. }
  2055. if (res.data.data.records.length == 0) {
  2056. const loading = this.$loading({
  2057. lock: true,
  2058. text: '加载中',
  2059. spinner: 'el-icon-loading',
  2060. background: 'rgba(255,255,255,0.7)'
  2061. });
  2062. submit({
  2063. bsType: "XS",
  2064. ...this.form
  2065. }).then(res => {
  2066. // this.refresh(res.data.data.id)
  2067. this.isDisabledTask = false
  2068. generateShipTask(this.form).then(res => {
  2069. this.$set(this.optionForm, 'disabled', true)
  2070. this.$set(this.optionContactsBack, 'disabled', true)
  2071. this.$message.success("生成出库任务成功");
  2072. // 将按钮文本更改为"撤销任务"
  2073. this.buttonText = '撤销任务';
  2074. // 将按钮颜色更改为对应的颜色
  2075. this.buttonColor = 'warning'; // 比如改为warning
  2076. this.refresh(res.data.data.id)
  2077. this.refreshs(res.data.data.id, true)
  2078. this.isContacts = true
  2079. this.isApplySettlement = false
  2080. this.isAdd = true
  2081. this.isDisabled = true
  2082. this.isAddBtn = true
  2083. this.isDisabledTask = true
  2084. this.editButton = true // 把编辑按钮显示出来
  2085. }).finally(() => {
  2086. loading.close();
  2087. })
  2088. }).catch(() => {
  2089. loading.close();
  2090. })
  2091. }
  2092. })
  2093. done();
  2094. } else {
  2095. this.$message.error('请选择仓库')
  2096. this.$set(this.optionForm, 'disabled', false)
  2097. this.$set(this.optionContactsBack, 'disabled', false)
  2098. }
  2099. })
  2100. }
  2101. } else {
  2102. this.$refs["form"].validate((valid, done) => {
  2103. if (valid) {
  2104. const loading = this.$loading({
  2105. lock: true,
  2106. text: '加载中',
  2107. spinner: 'el-icon-loading',
  2108. background: 'rgba(255,255,255,0.7)'
  2109. });
  2110. // this.form.orderItemsList.forEach((items) => {
  2111. // let brandName = items.brandId
  2112. // items.brandId = items.brandName
  2113. // items.brandName = brandName
  2114. // let goodsName = items.goodsId
  2115. // items.goodsId = items.goodsName
  2116. // items.goodsName = goodsName
  2117. // })
  2118. revokeGenerateShipTask(this.form).then(res => {
  2119. // 将按钮文本更改为"生成任务"
  2120. this.buttonText = '生成任务';
  2121. // 将按钮颜色还原为success
  2122. this.buttonColor = 'success';
  2123. this.$message.success("撤销出库成功");
  2124. this.refresh(res.data.data.id)
  2125. this.isApplySettlement = false
  2126. this.isContacts = true
  2127. this.isDisabled = true
  2128. this.isDisabledTask = false
  2129. this.$set(this.optionForm, 'disabled', false) // form 表单的禁用放开
  2130. this.$set(this.optionContactsBack, 'disabled', false) // table 表格的禁用放开
  2131. this.editButton = true // 把编辑按钮显示出来
  2132. //添加删除按钮禁用
  2133. this.isAdd = true
  2134. if (this.form.businessSource == "外部销售") {
  2135. }
  2136. loading.close();
  2137. }).catch((err) => {
  2138. if (err instanceof TooManyResultsException) {
  2139. // 不显示错误消息
  2140. return;
  2141. }
  2142. // 显示其他错误消息
  2143. this.$message.error('发生错误,请稍后重试');
  2144. }).finally(() => {
  2145. loading.close();
  2146. });
  2147. done();
  2148. }
  2149. })
  2150. }
  2151. }
  2152. },
  2153. revokeTask() {
  2154. this.$confirm('是否撤销出库任务审批?', '提示', {
  2155. confirmButtonText: '确定',
  2156. cancelButtonText: '取消',
  2157. type: 'warning'
  2158. }).then(() => {
  2159. revokeCheckOrderRW(this.form).then(res => {
  2160. this.buttonText = '生成任务';
  2161. // 将按钮颜色还原为success
  2162. this.buttonColor = 'success';
  2163. this.$message.success("撤销出库成功");
  2164. this.refresh(res.data.data.id)
  2165. this.isApplySettlement = false
  2166. this.isContacts = true
  2167. this.isDisabled = true
  2168. this.isDisabledTask = false
  2169. this.$set(this.optionForm, 'disabled', false) // form 表单的禁用放开
  2170. this.$set(this.optionContactsBack, 'disabled', false) // table 表格的禁用放开
  2171. // this.editButton = true // 把编辑按钮显示出来
  2172. //添加删除按钮禁用
  2173. this.isAdd = true
  2174. })
  2175. })
  2176. },
  2177. //联系人change
  2178. contactsChange(e) {
  2179. // 假设this.contactsOption是你的数组对象
  2180. let matchedContact = this.contactsOption.find(item => item.contacts == e);
  2181. // 判断是否找到匹配的对象
  2182. this.$set(this.form, 'phone', matchedContact.tel)
  2183. this.$set(this.form, 'recAddress', matchedContact.belongtoarea + matchedContact.detailedAddress)
  2184. },
  2185. //修改提交触发
  2186. editCustomer() {
  2187. this.$refs["form"].validate((valid, done) => {
  2188. done();
  2189. let picihao = false
  2190. if (valid) {
  2191. if (this.form.orderItemsList.length == 0) {
  2192. this.$message.warning("请添加商品");
  2193. return
  2194. }
  2195. for (let i in this.form.orderItemsList) {
  2196. this.form.orderItemsList[i].subTotalMoney = this.form.orderItemsList[i].goodsNum * this.form.orderItemsList[i].price
  2197. if (this.form.orderItemsList[i].pid) {
  2198. } else {
  2199. if (this.form.orderItemsList[i].whether == '1') {
  2200. if (this.form.orderItemsList[i].dot) { } else {
  2201. this.$message.warning(`销售明细序号${Number(i) + 1}的批次号不能为空`);
  2202. picihao = true
  2203. break;
  2204. }
  2205. } else {
  2206. }
  2207. }
  2208. if (this.form.orderItemsList[i].goodsNum <= 0) {
  2209. this.$message.warning(`销售明细序号${Number(i) + 1}的数量不能为零`);
  2210. picihao = true
  2211. }
  2212. }
  2213. this.mingxibaocun = true
  2214. if (picihao) {
  2215. return
  2216. }
  2217. const loading = this.$loading({
  2218. lock: true,
  2219. text: '加载中',
  2220. spinner: 'el-icon-loading',
  2221. background: 'rgba(255,255,255,0.7)'
  2222. });
  2223. // this.form.orderItemsList.forEach(its => {
  2224. // console.log(its.goodsId);
  2225. // console.log(its.goodsName);
  2226. // its.brandId = its.brandName
  2227. // let goodsName = its.goodsId
  2228. // its.goodsId = its.goodsName
  2229. // its.goodsName = goodsName
  2230. // })
  2231. for (let courierCompanies of this.courierCompaniesList) {
  2232. if (courierCompanies.dictValue === this.form.logisticsCorpName) {
  2233. this.form.logisticsCorpId = courierCompanies.dictKey
  2234. break
  2235. }
  2236. }
  2237. this.form.salerName = this.form.$salerId ? this.form.$salerId : ''
  2238. this.form.storageName = this.form.$storageId ? this.form.$storageId : ''
  2239. submit({
  2240. bsType: "XS",
  2241. ...this.form
  2242. }).then(res => {
  2243. this.$message.success("保存成功");
  2244. this.refresh(res.data.data.id)
  2245. this.isDisabledTask = false
  2246. // this.editButton = true
  2247. this.$set(this.optionContactsBack, 'disabled', true)
  2248. loading.close();
  2249. }).finally(() => {
  2250. loading.close();
  2251. });
  2252. } else {
  2253. return false;
  2254. }
  2255. });
  2256. },
  2257. //保存
  2258. save() {
  2259. this.$refs["form"].validate((valid, done) => {
  2260. done();
  2261. if (valid) {
  2262. const loading = this.$loading({
  2263. lock: true,
  2264. text: '加载中',
  2265. spinner: 'el-icon-loading',
  2266. background: 'rgba(255,255,255,0.7)'
  2267. });
  2268. submit({
  2269. bsType: "XS",
  2270. ...this.form
  2271. }).then(res => {
  2272. console.log(1);
  2273. this.refresh(res.data.data.id)
  2274. this.isDisabledTask = false
  2275. loading.close();
  2276. }).finally(() => {
  2277. loading.close();
  2278. });
  2279. } else {
  2280. return false;
  2281. }
  2282. });
  2283. },
  2284. //关闭弹窗表单
  2285. beforeClose(done, type) {
  2286. console.log(type);
  2287. // if(row == "add"){
  2288. // this.form.sharedCompanyId = this.form.sharedCompanyId?this.form.sharedCompanyId:''
  2289. // this.form.sharedCompanyName = this.form.sharedCompanyName?this.form.sharedCompanyName:''
  2290. // }
  2291. console.log('this.form.sharedCompanyId', this.form.sharedCompanyId);
  2292. console.log('this.form.sharedCompanyName', this.form.sharedCompanyName);
  2293. done()
  2294. },
  2295. refresh(id, type) {
  2296. const loading = this.$loading({
  2297. lock: true,
  2298. text: '加载中',
  2299. spinner: 'el-icon-loading',
  2300. background: 'rgba(255,255,255,0.7)'
  2301. })
  2302. getDetails({ id: id }).then(res => {
  2303. this.form = res.data.data
  2304. let ordForm = { srcBillNo: this.form.ordNo }
  2305. let _this = this
  2306. this.dataList = res.data.data.paymentRecordsList ? res.data.data.paymentRecordsList : [];
  2307. this.$nextTick(() => {
  2308. this.$refs.formContacts.doLayout()
  2309. })
  2310. // getList(1, 50, ordForm).then((res) => {
  2311. // this.dataList = res.data.data.records ? res.data.data.records : [];
  2312. // this.$nextTick(() => {
  2313. // this.$refs.formContacts.doLayout()
  2314. // })
  2315. // })
  2316. // if (this.form.status !== '录入' && this.form.status !== '退款中' && this.form.status !== '已取消' && this.form.status !== '退款请核' && this.form.status !== '已退款' && this.form.status !== '待确认' && this.form.status !== '待发货') {
  2317. if (this.form.status !== '录入' && this.form.status !== '已取消' && this.form.status !== '退款请核' && this.form.status !== '已退款' && this.form.status !== '待确认' && this.form.status !== '待发货') {
  2318. console.log(1);
  2319. this.isApplySettlement = false;
  2320. }
  2321. if (
  2322. this.form.status === '已退款' ||
  2323. this.form.status === '已收货' ||
  2324. this.form.status === '已发货' ||
  2325. this.form.status === '已取消'
  2326. ) {
  2327. // 禁用编辑按钮
  2328. console.log('按钮全部禁用');
  2329. this.isEditButton = true;
  2330. this.isSaveBtn = true;
  2331. this.isDisabledTask = true;
  2332. this.viewDisabled = true;
  2333. }
  2334. if (this.form.status === '已发货') {
  2335. this.isDisabledTask = true;
  2336. this.viewDisabled = true;
  2337. this.isEditButton = false;
  2338. }
  2339. // else {
  2340. // this.isSaveBtn = true;
  2341. // this.isDisabledTask = true;
  2342. // this.viewDisabled = true;
  2343. // }
  2344. /*if (this.form.status == '退款中') {
  2345. this.isConfirmRefundBtn = false;
  2346. }*/
  2347. if (this.form.status == '已取消') {
  2348. this.isConfirmRefundBtn = true;
  2349. }
  2350. if (this.form.generateTask == '已生成') {
  2351. this.buttonText = '撤销任务';
  2352. // this.isDisabledTask = false;
  2353. this.buttonColor = 'warning'
  2354. this.optionForm.disabled = true
  2355. this.$set(this.optionForm, 'disabled', true)
  2356. }
  2357. if (this.form.status == '退款请核') {
  2358. this.isRevocationRequest = false;
  2359. }
  2360. if (this.form.status == '待发货') {
  2361. this.isApplySettlement = false
  2362. this.isDisabled = true
  2363. }
  2364. //成本、毛利对业务员隐藏
  2365. this.optionForm.column.forEach(its => {
  2366. if (JSON.parse(localStorage.getItem('saber-userInfo')).content.role_name.split(',').includes('业务员')) {
  2367. if (its.prop == 'cost' || its.prop == 'grossProfit') {
  2368. this.$set(its, 'display', false)
  2369. }
  2370. } else {
  2371. if (its.prop == 'cost' || its.prop == 'grossProfit') {
  2372. this.$set(its, 'display', true)
  2373. }
  2374. }
  2375. })
  2376. // 明细信息成本、毛利对业务员隐藏
  2377. this.optionContacts.column.forEach(its => {
  2378. if (JSON.parse(localStorage.getItem('saber-userInfo')).content.role_name.split(',').includes('业务员')) {
  2379. if (its.prop == 'costprie' || its.prop == 'grossProfit') {
  2380. this.$set(its, 'hide', true)
  2381. }
  2382. } else {
  2383. if (its.prop == 'costprie' || its.prop == 'grossProfit') {
  2384. this.$set(its, 'hide', false)
  2385. }
  2386. }
  2387. })
  2388. this.form.orderItemsList.forEach((items) => {
  2389. if (!items.subTotalMoney) {
  2390. items.subTotalMoney = items.goodsNum * items.price
  2391. items.grossProfit = items.subTotalMoney - items.costprie
  2392. }
  2393. // let brandName = items.brandId
  2394. // items.brandId = items.brandName
  2395. // items.brandName = brandName
  2396. // let goodsName = items.goodsId
  2397. // items.goodsId = items.goodsName
  2398. // items.goodsName = goodsName
  2399. })
  2400. loading.close();
  2401. // if (this.form.businessSource == "外部销售") {
  2402. // console.log('外部销售');
  2403. // this.optionForm.column.forEach(its => {
  2404. // if (its.prop == 'customerId') {
  2405. // this.$set(its, 'disabled', true)
  2406. // }
  2407. // })
  2408. // //不能录入不能删除
  2409. // this.$set(this.optionContactsBack, "addBtn", false)
  2410. // this.isDisabled = true
  2411. // this.$set(this.form, 'shipType', '物流')
  2412. // this.$set(this.form, 'receivableType', '网络支付')
  2413. // this.optionContactsBack.column.forEach(item => {
  2414. // this.$set(item, 'disabled', true)
  2415. // if (item.label == '批次号' || item.label == '备注') {
  2416. // item.disabled = false
  2417. // }
  2418. // })
  2419. // this['optionContacts'] = this['optionContactsBack'];
  2420. // this.delColumnData(this.getColumnName(269.1), this['optionContactsBack']);
  2421. // this.optionContactsBack.column.forEach(item => {
  2422. // if (item.prop == 'dot') {
  2423. // this.$set(item, disabled, false)
  2424. // } else {
  2425. // this.$set(item, disabled, true)
  2426. // }
  2427. // })
  2428. // } else {
  2429. // this.$set(this.form, 'shipType', '物流')
  2430. // this.$set(this.form, 'receivableType', '现金')
  2431. // this.optionContactsBack.column.forEach(item => {
  2432. // this.$set(item, 'disabled', false)
  2433. // })
  2434. // this.optionContactsBack.column.forEach(item => {
  2435. // if (item.label === '规格型号' || item.label === '花纹' || item.label === '品牌' || item.label === '物料编码' || item.label === '单位' || item.label === '商品描述') {
  2436. // item.disabled = true;
  2437. // }
  2438. // })
  2439. // console.log(324324);
  2440. // this['optionContacts'] = this['optionContactsBack'];
  2441. // this.delColumnData(this.getColumnName(269.1), this['optionContactsBack']);
  2442. // }
  2443. // // this.$set(this.form.orderItemsList,'goodsNum',66)
  2444. }).catch(() => {
  2445. loading.close();
  2446. })
  2447. },
  2448. refreshs(id, type) {
  2449. const loading = this.$loading({
  2450. lock: true,
  2451. text: '加载中',
  2452. spinner: 'el-icon-loading',
  2453. background: 'rgba(255,255,255,0.7)'
  2454. });
  2455. getDetails({ id: id }).then(res => {
  2456. this.form = res.data.data
  2457. let ordForm = { srcBillNo: this.form.ordNo }
  2458. let _this = this
  2459. this.dataList = res.data.data.paymentRecordsList ? res.data.data.paymentRecordsList : [];
  2460. // if (this.form.status !== '录入' && this.form.status !== '退款中' && this.form.status !== '已取消' && this.form.status !== '退款请核' && this.form.status !== '已退款' && this.form.status !== '待确认' && this.form.status !== '待发货') {
  2461. if (this.form.status !== '录入' && this.form.status !== '已取消' && this.form.status !== '退款请核' && this.form.status !== '已退款' && this.form.status !== '待确认' && this.form.status !== '待发货') {
  2462. console.log(1);
  2463. this.isApplySettlement = false;
  2464. }
  2465. if (
  2466. this.form.status === '已退款' ||
  2467. this.form.status === '已收货' ||
  2468. this.form.status === '已发货' ||
  2469. this.form.status === '已取消'
  2470. ) {
  2471. // 禁用编辑按钮
  2472. console.log('按钮全部禁用');
  2473. this.isEditButton = true;
  2474. this.isSaveBtn = true;
  2475. this.isDisabledTask = true;
  2476. this.viewDisabled = true;
  2477. }
  2478. if (this.form.status === '已发货') {
  2479. this.isDisabledTask = true;
  2480. this.viewDisabled = true;
  2481. this.isEditButton = false;
  2482. }
  2483. /* if (this.form.status == '退款中') {
  2484. this.isConfirmRefundBtn = false;
  2485. }*/
  2486. if (this.form.status == '已取消') {
  2487. this.isConfirmRefundBtn = true;
  2488. }
  2489. if (this.form.generateTask == '已生成') {
  2490. this.buttonText = '撤销任务';
  2491. // this.isDisabledTask = false;
  2492. this.buttonColor = 'warning'
  2493. this.optionForm.disabled = true
  2494. this.$set(this.optionForm, 'disabled', true)
  2495. }
  2496. if (this.form.status == '退款请核') {
  2497. this.isRevocationRequest = false;
  2498. }
  2499. if (this.form.status == '待发货') {
  2500. this.isApplySettlement = false
  2501. }
  2502. //成本、毛利对业务员隐藏
  2503. this.optionForm.column.forEach(its => {
  2504. if (JSON.parse(localStorage.getItem('saber-userInfo')).content.role_name.split(',').includes('业务员')) {
  2505. if (its.prop == 'cost' || its.prop == 'grossProfit') {
  2506. this.$set(its, 'display', false)
  2507. }
  2508. } else {
  2509. if (its.prop == 'cost' || its.prop == 'grossProfit') {
  2510. this.$set(its, 'display', true)
  2511. }
  2512. }
  2513. })
  2514. // 明细信息成本、毛利对业务员隐藏
  2515. this.optionContacts.column.forEach(its => {
  2516. if (JSON.parse(localStorage.getItem('saber-userInfo')).content.role_name.split(',').includes('业务员')) {
  2517. if (its.prop == 'costprie' || its.prop == 'grossProfit') {
  2518. this.$set(its, 'hide', true)
  2519. }
  2520. } else {
  2521. if (its.prop == 'costprie' || its.prop == 'grossProfit') {
  2522. this.$set(its, 'hide', false)
  2523. }
  2524. }
  2525. })
  2526. this.form.orderItemsList.forEach((items) => {
  2527. if (!items.subTotalMoney) {
  2528. items.subTotalMoney = items.goodsNum * items.price
  2529. items.grossProfit = items.subTotalMoney - items.costprie
  2530. }
  2531. })
  2532. }).finally(() => {
  2533. loading.close();
  2534. });
  2535. },
  2536. //请核关闭
  2537. choceScheduleFun() {
  2538. this.checkScheduleDialog = false
  2539. },
  2540. //关闭审核
  2541. choceCheckFun() {
  2542. this.isExamineBtn = !this.isExamineBtn
  2543. this.checkDialog = false;
  2544. },
  2545. //申请退款
  2546. applySettlement(type) {
  2547. this.$confirm("您确定申请退款吗?", {
  2548. confirmButtonText: "确定",
  2549. cancelButtonText: "取消",
  2550. type: "warning"
  2551. }).then(() => {
  2552. this.$refs["form"].validate((valid, done) => {
  2553. done()
  2554. if (valid) {
  2555. const data = {
  2556. id: this.form.id,
  2557. url: '/tirePartsMall/salesManagement/saleOrder/index',
  2558. pageStatus: "this.$store.getters.ltxsStatus",
  2559. pageLabel: "销售订单",
  2560. }
  2561. const loading = this.$loading({
  2562. lock: true,
  2563. text: '加载中',
  2564. spinner: 'el-icon-loading',
  2565. background: 'rgba(255,255,255,0.7)'
  2566. });
  2567. checkOrder({ ...data }).then((res) => {
  2568. this.refresh(res.data.data.id)
  2569. this.$message.success('申请退款成功');
  2570. this.isApplySettlement = !this.isApplySettlement
  2571. loading.close();
  2572. console.log(res);
  2573. }).catch(() => { loading.close(); })
  2574. }
  2575. })
  2576. })
  2577. },
  2578. //确认退款
  2579. confirmRefundBtn() {
  2580. this.$confirm("您确定退款吗?", {
  2581. confirmButtonText: "确定",
  2582. cancelButtonText: "取消",
  2583. type: "warning"
  2584. }).then(() => {
  2585. const loading = this.$loading({
  2586. lock: true,
  2587. text: '加载中',
  2588. spinner: 'el-icon-loading',
  2589. background: 'rgba(255,255,255,0.7)'
  2590. });
  2591. // this.form.orderItemsList.forEach((items) => {
  2592. // let brandName = items.brandId
  2593. // items.brandId = items.brandName
  2594. // items.brandName = brandName
  2595. // let goodsName = items.goodsId
  2596. // items.goodsId = items.goodsName
  2597. // items.goodsName = goodsName
  2598. // })
  2599. confirmRefund({ ...this.form }).then((res) => {
  2600. loading.close()
  2601. this.$message.success('确定退款成功');
  2602. }).catch(() => { loading.close(); })
  2603. })
  2604. },
  2605. //审批
  2606. examineBtn() {
  2607. this.checkData = this.$route.query.check
  2608. this.checkDialog = true;
  2609. },
  2610. //撤销请核
  2611. revocationRequest() {
  2612. this.$confirm("您确定撤回此次申请吗?", {
  2613. confirmButtonText: "确定",
  2614. cancelButtonText: "取消",
  2615. type: "warning"
  2616. }).then(() => {
  2617. const loading = this.$loading({
  2618. lock: true,
  2619. text: '加载中',
  2620. spinner: 'el-icon-loading',
  2621. background: 'rgba(255,255,255,0.7)'
  2622. });
  2623. // this.form.orderItemsList.forEach((items) => {
  2624. // if (!items.subTotalMoney) {
  2625. // items.subTotalMoney = items.goodsNum * items.price
  2626. // items.grossProfit = items.subTotalMoney - items.costprie
  2627. // }
  2628. // let brandName = items.brandId
  2629. // items.brandId = items.brandName
  2630. // items.brandName = brandName
  2631. // let goodsName = items.goodsId
  2632. // items.goodsId = items.goodsName
  2633. // items.goodsName = goodsName
  2634. // })
  2635. revokeCheckOrder({ ...this.form }).then(res => {
  2636. this.isRevocationRequest = !this.isRevocationRequest
  2637. this.refresh(res.data.data.id)
  2638. this.$message.success('撤回成功')
  2639. loading.close();
  2640. })
  2641. })
  2642. },
  2643. rowDelBox(row, index, type) {
  2644. this.$confirm("确定将选择数据删除?", {
  2645. confirmButtonText: "确定",
  2646. cancelButtonText: "取消",
  2647. type: "warning"
  2648. }).then(() => {
  2649. if (row.id) {
  2650. delOrderItem({ ids: row.id }).then(res => {
  2651. this.form.orderItemsList.splice(index, 1);
  2652. this.$message.success("操作成功!");
  2653. });
  2654. } else {
  2655. this.form[type].splice(index, 1);
  2656. this.$message.success("操作成功!");
  2657. }
  2658. }
  2659. );
  2660. },
  2661. // 明细信息多选
  2662. selectionContacts(list) {
  2663. this.selectionMultilist = list
  2664. },
  2665. // 快捷复制
  2666. quickCopy() {
  2667. let temp = document.createElement("textarea")
  2668. let txt = `${this.form.customerName} ${this.form.businesDate}`
  2669. for (let item of this.form.orderItemsList) {
  2670. txt += `\n${item.goodsName} ${item.goodsNum}`
  2671. }
  2672. document.body.appendChild(temp)
  2673. temp.value = txt
  2674. temp.select()
  2675. document.execCommand("copy")
  2676. document.body.removeChild(temp)
  2677. },
  2678. // 一键删除
  2679. batchDelete() {
  2680. if (this.selectionMultilist.length == 0) {
  2681. return this.$message.warning('请选择要删除的数据')
  2682. }
  2683. this.$confirm("确定将选择数据删除?", {
  2684. confirmButtonText: "确定",
  2685. cancelButtonText: "取消",
  2686. type: "warning"
  2687. }).then(() => {
  2688. let multiList = this.selectionMultilist
  2689. let arr = this.form.orderItemsList
  2690. // 获取有id 的数据
  2691. const itemsWithId = multiList.filter(item => item.hasOwnProperty('id'));
  2692. let arrIds = itemsWithId.map(item => item.id) // 获取id 数据
  2693. // 把选中的删除掉
  2694. multiList.forEach((item) => {
  2695. for (let index in arr) {
  2696. if (JSON.stringify(item) == JSON.stringify(arr[index])) {
  2697. arr.splice(Number(index), 1)
  2698. }
  2699. }
  2700. })
  2701. // 有id 的处理
  2702. if (itemsWithId.length != 0) {
  2703. delOrderItem({ ids: arrIds.join(',') }).then(res => {
  2704. this.$message.success("操作成功!");
  2705. });
  2706. }
  2707. })
  2708. },
  2709. rowSave(form, done, loading) {
  2710. if (this.isStatus) {
  2711. done(form)
  2712. } else {
  2713. this.$message.error('请选择相同公司的商品')
  2714. }
  2715. console.log(form);
  2716. // this.form.sharedCompanyId = res.data.data.sharedCompanyId
  2717. // this.form.sharedCompanyName = res.data.data.sharedCompanyName
  2718. },
  2719. rowUpdate(form, index, done, loading) {
  2720. done(form)
  2721. },
  2722. // 新增商品
  2723. rowAdd(row) {
  2724. if (!this.form.customerId) {
  2725. this.$message.error('请选择客户')
  2726. return
  2727. }
  2728. this.findObject(this.optionContactsBack.column, 'goodsId').dicUrl = `/api/blade-sales-part/goodsDesc/goodsListXs?cname={{key}}&customId=${this.dicUrlWithCustomId}&enableOrNot=1&stock=${this.form.storageId}`
  2729. this.optionContactsBack.column.forEach(its => {
  2730. if (its.prop == 'goodsId' || its.prop == 'goodsNum' || its.prop == 'price' || its.prop == 'dot' || its.prop == 'remarks') {
  2731. its.disabled = false
  2732. } else {
  2733. its.disabled = true
  2734. }
  2735. })
  2736. console.log('新增了', row);
  2737. // console.log(this.form.storageId,2038)
  2738. // if (this.form.storageId) {
  2739. // this.page.billType = 0
  2740. // }else {
  2741. // this.page.billType = 1
  2742. // }
  2743. this.getAllWorkDicts()
  2744. this.refreshChange()
  2745. this.goodsListSave = []
  2746. setTimeout(res => {
  2747. this.dialogVisible = true
  2748. }, 300)
  2749. // this.$refs.formContacts.rowAdd()
  2750. },
  2751. //打印
  2752. handlePrint() {
  2753. this.switchDialog = !this.switchDialog;
  2754. },
  2755. onClose(val) {
  2756. this.switchDialog = val;
  2757. },
  2758. //自定义列保存
  2759. async saveColumnTwo(ref, option, optionBack, code) {
  2760. /**
  2761. * 已定义全局方法,直接使用,saveColumnData保存列数据方法,参数传值(表格名称,当前表格的option数据)
  2762. * 已定义全局方法,直接使用,getColumnName方法用来获取枚举值,参数根据自己定义的code值获取中文名
  2763. * 一定要执行异步操作,要等接口成功返回,才能执行下一行代码
  2764. */
  2765. const inSave = await this.saveColumnData(this.getColumnName(code), this[option]);
  2766. if (inSave) {
  2767. this.$message.success("保存成功");
  2768. //关闭窗口
  2769. this.$refs[ref].$refs.dialogColumn.columnBox = false;
  2770. }
  2771. },
  2772. //自定义列重置
  2773. async resetColumnTwo(ref, option, optionBack, code) {
  2774. this[option] = this[optionBack];
  2775. const inSave = await this.delColumnData(this.getColumnName(code), this[optionBack]);
  2776. if (inSave) {
  2777. this.$message.success("重置成功");
  2778. this.$refs[ref].$refs.dialogColumn.columnBox = false;
  2779. }
  2780. },
  2781. backToList(type) {
  2782. this.$emit("backToList", type);
  2783. },
  2784. // 弹框的重置
  2785. resetCrud() {
  2786. this.$message.success("重置成功");
  2787. },
  2788. // 弹窗的保存
  2789. saveCrud() {
  2790. this.$message.success("保存成功");
  2791. }
  2792. }
  2793. }
  2794. </script>
  2795. <style lang="scss" scoped>
  2796. ::v-deep .el-form-item {
  2797. margin-bottom: 8px !important;
  2798. }
  2799. </style>