detailsPage.vue 114 KB

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