detailsPage.vue 92 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118
  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" 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 || form.status !== '待确认' && form.status !== '待收货'" @click="generateOutbound">
  18. {{ buttonText }}
  19. </el-button>
  20. <el-dropdown style="padding: 0 6px;line-height: 0">
  21. <el-button v-show="!(!form.id || viewDisabled)" type="danger" :loading="buttonLoading" :disabled="!form.id || viewDisabled" size="small">
  22. 请 核<i class="el-icon-arrow-down el-icon--right"></i>
  23. </el-button>
  24. <el-dropdown-menu slot="dropdown">
  25. <el-dropdown-item @click.native="applySettlement('申请')"
  26. :disabled="isApplySettlement || form.status !== '录入'">请核数据
  27. </el-dropdown-item>
  28. <!-- <el-dropdown-item @click.native="confirmRefundBtn('确认')" :disabled="isConfirmRefundBtn">确认退款
  29. </el-dropdown-item> -->
  30. <el-dropdown-item @click.native="revocationRequest('撤销')" :disabled="isRevocationRequest">撤销请核
  31. </el-dropdown-item>
  32. </el-dropdown-menu>
  33. </el-dropdown>
  34. <el-dropdown style="line-height: 0">
  35. <el-button type="warning" :loading="buttonLoading" :disabled="!form.id || viewDisabled" size="small">
  36. 审 批<i class="el-icon-arrow-down el-icon--right"></i>
  37. </el-button>
  38. <el-dropdown-menu slot="dropdown">
  39. <el-dropdown-item @click.native="examineBtn('审批')" :disabled="isExamineBtn && !detailData.check">审批
  40. </el-dropdown-item>
  41. <el-dropdown-item @click.native="checkScheduleDialog = true, checkId = form.id">审核进度
  42. </el-dropdown-item>
  43. </el-dropdown-menu>
  44. </el-dropdown>
  45. <el-button class="el-button&#45;&#45;small-yh" style="margin-left: 6px;" v-if="form.id"
  46. type="success" size="small"
  47. :disabled="form.shortcutWarehousingStatus == '1'"
  48. @click="oneClickStorage" >一键采购入库
  49. </el-button>
  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. <template slot-scope="{row,index}" slot="contacts">
  56. <!-- 联系人 -->
  57. <el-select v-model="form.contacts" placeholder="请选择" size="small" style="width:60%"
  58. clearable filterable allow-create default-first-option
  59. @change="contactsChange($event)" :disabled=isContacts>
  60. <el-option v-for="item in contactsOption" :key="item.cname" :label="item.cname"
  61. :value="item.contacts" />
  62. </el-select>
  63. </template>
  64. <template slot-scope="{row,index}" slot="recAddress">
  65. <!-- 地址 -->
  66. <el-select v-model="form.recAddress" placeholder="请选择" size="small" style="width:60%"
  67. clearable filterable allow-create default-first-option
  68. :disabled=isContacts>
  69. <el-option v-for="item in recAddressOption" :key="item.id"
  70. :label="item.belongtoarea + item.detailedAddress"
  71. :value="item.belongtoarea + item.detailedAddress" />
  72. </el-select>
  73. </template>
  74. </avue-form>
  75. </trade-card>
  76. <trade-card title="明细信息">
  77. <el-tabs v-model="activeName" type="card">
  78. <el-tab-pane label="采购明细" name="sale_detail">
  79. <avue-crud :option="optionContacts" v-model="formContacts" ref="formContacts"
  80. :data="form.orderItemsList" :key="key" @row-save="rowSave" @row-update="rowUpdate"
  81. @row-close="rowClose" :before-close="beforeClose"
  82. @resetColumn="resetColumnTwo('formContacts', 'optionContacts', 'optionContactsBack', 269.1)"
  83. @saveColumn="saveColumnTwo('formContacts', 'optionContacts', 'optionContactsBack', 269.1)">
  84. <template slot-scope="{scope,row}" slot="menuLeft">
  85. <el-button type="primary" icon="el-icon-plus" size="small" :disabled="isAddBtn"
  86. @click="rowAdd(row)">添加轮胎</el-button>
  87. <el-button type="success" size="small" :disabled="isAddBtn" icon="el-icon-bottom" @click="excelBox = true">导入
  88. </el-button>
  89. <el-button type="primary" icon="el-icon-printer" size="small"
  90. @click="handlePrint">打印</el-button>
  91. </template>
  92. <template slot="goodsId" slot-scope="{ row }">
  93. <!--<el-select v-if="row.$cellEdit" v-model="row.goodsId" allow-create filterable default-first-option >-->
  94. <!-- <el-option v-for="(item, index) in goodsIdoptions" :key="index" :label="item.cname"-->
  95. <!-- :value="item.id"></el-option>-->
  96. <!--</el-select>-->
  97. <span>{{ row.goodsName }}</span>
  98. </template>
  99. <template slot="goodsNum" slot-scope="{ row }">
  100. <el-input v-if="!mingxibaocun" size="small" v-model="row.goodsNum" style="width: 100%"></el-input>
  101. <span v-else>{{ row.goodsNum }}</span>
  102. </template>
  103. <template slot="price" slot-scope="{ row }">
  104. <el-input v-if="!mingxibaocun" size="small" v-model="row.price" style="width: 100%"></el-input>
  105. <span v-else>{{ row.price }}</span>
  106. </template>
  107. <template slot="dot" slot-scope="{ row }">
  108. <el-select v-if="!mingxibaocun && row.whether=='1'" v-model="row.dot" allow-create filterable default-first-option @focus="picihaolistfun(row.goodsId)">
  109. <el-option v-for="(item, index) in picihaolist" :key="index" :label="item.dot"
  110. :value="item.dot"></el-option>
  111. </el-select>
  112. <span v-else>{{ row.dot }}</span>
  113. </template>
  114. <template slot="subTotalMoney" slot-scope="{ row }">{{row.goodsNum * row.price}}</template>
  115. <template slot="remarks" slot-scope="{ row }">
  116. <el-input v-if="!mingxibaocun" size="small" v-model="row.remarks" style="width: 100%"></el-input>
  117. <span v-else>{{ row.remarks }}</span>
  118. </template>
  119. <!-- <template slot-scope="{scope,row}" slot="goodsNum">
  120. <el-input size="small" v-model="formContacts.goodsNum" style="width: 100%">
  121. <template slot="inventory">{{ inventory }}吨</template>
  122. </el-input>
  123. </template> -->
  124. <!-- <template slot="goodsId" slot-scope="{ row, index }">
  125. <span style="display:flex">
  126. <el-select v-model="row.goodsId" placeholder="请选择" size="small" filterable
  127. style="width:60%" >
  128. <el-option v-for="item in goodsIdoptions" :key="item.id" :label="item.cname"
  129. :value="item.id">
  130. </el-option>
  131. </el-select>
  132. <el-button icon="el-icon-search" size="small" @click="rePick(row, index)"></el-button>
  133. </span>
  134. </template> -->
  135. <template slot-scope="{type,size,row,index,disabled}" slot="menu">
  136. <el-button v-if="mingxibaocun" :size="size" :disabled="disabled || isAdd" :type="type"
  137. :icon="row.$cellEdit ? 'el-icon-plus' : 'el-icon-edit'" @click="hangeditBtn(row, index)">编辑
  138. </el-button>
  139. <el-button v-else :size="size" :disabled="disabled || isAdd" :type="type"
  140. :icon="row.$cellEdit ? 'el-icon-plus' : 'el-icon-edit'" @click="hangbaocun(row, index)">保存
  141. </el-button>
  142. <el-button icon="el-icon-delete" :size="size" :disabled="disabled || isDisabled"
  143. :type="type" @click="rowDelBox(row, index, 'orderItemsList')">删除
  144. </el-button>
  145. </template>
  146. </avue-crud>
  147. </el-tab-pane>
  148. <el-tab-pane label="付款明细" name="payment_details">
  149. <avue-crud :option="optionPaymentDetails" v-model="formContacts" ref="payment_details"
  150. :data="dataList" @row-save="rowSave" @row-update="rowUpdate"
  151. @resetColumn="resetColumnTwo('payment_details', 'optionPaymentDetails', 'optionPaymentDetailsBack', 269.2)"
  152. @saveColumn="saveColumnTwo('payment_details', 'optionPaymentDetails', 'optionPaymentDetailsBack', 269.2)">
  153. <!-- <template slot-scope="{type,size,row,index,disabled}" slot="menu">
  154. <el-button :size="size" :disabled="disabled" :type="type"
  155. :icon="row.$cellEdit ? 'el-icon-plus' : 'el-icon-edit'"
  156. @click="$refs.formContacts.rowCell(row, index)">{{ row.$cellEdit ? '确认' : '修改' }}
  157. </el-button>
  158. <el-button icon="el-icon-delete" :size="size" :disabled="disabled" :type="type"
  159. @click="rowDelBox(row, index, 'paymentRecordsList')">删除
  160. </el-button>
  161. </template> -->
  162. </avue-crud>
  163. </el-tab-pane>
  164. <el-tab-pane label="入库记录" name="outbound_records">
  165. <avue-crud :option="optionOutboundRecords" v-model="formContacts" ref="outbound_records"
  166. :data="form.outboundRecordsList" @row-save="rowSave" @row-update="rowUpdate"
  167. @resetColumn="resetColumnTwo('outbound_records', 'optionOutboundRecords', 'optionOutboundRecordsBack', 269.3)"
  168. @saveColumn="saveColumnTwo('outbound_records', 'optionOutboundRecords', 'optionOutboundRecordsBack', 269.3)">
  169. <!-- <template slot-scope="{type,size,row,index,disabled}" slot="menu">
  170. <el-button :size="size" :disabled="disabled" :type="type"
  171. :icon="row.$cellEdit ? 'el-icon-plus' : 'el-icon-edit'"
  172. @click="$refs.formContacts.rowCell(row, index)">{{ row.$cellEdit ? '确认' : '修改' }}
  173. </el-button>
  174. <el-button icon="el-icon-delete" :size="size" :disabled="disabled" :type="type"
  175. @click="rowDelBox(row, index)">删除
  176. </el-button>
  177. </template> -->
  178. </avue-crud>
  179. </el-tab-pane>
  180. </el-tabs>
  181. </trade-card>
  182. <report-dialog :switchDialog="switchDialog" reportName="轮胎商城-采购订单" :reportId="form.id"
  183. @onClose="onClose()"></report-dialog>
  184. <el-dialog append-to-body title="审批" class="el-dialogDeep" :visible.sync="checkDialog" width="50%"
  185. :close-on-click-modal="false" :destroy-on-close="true" :close-on-press-escape="false" v-dialog-drag>
  186. <check :checkData="checkData" :checkDetail="true" :idList="[]" @operationType="operationType"
  187. @choceCheckFun="choceCheckFun">
  188. </check>
  189. </el-dialog>
  190. <el-dialog append-to-body title="审批进度" class="el-dialogDeep" :visible.sync="checkScheduleDialog" width="40%"
  191. :close-on-click-modal="false" :destroy-on-close="true" :close-on-press-escape="false" v-dialog-drag>
  192. <check-schedule :checkId="checkId" :batchNo="batchNo" @choceScheduleFun="choceScheduleFun"></check-schedule>
  193. </el-dialog>
  194. <el-dialog title="导入明细" append-to-body :visible.sync="excelBox" v-if="excelBox" width="555px"
  195. :close-on-click-modal="false" v-dialog-drag>
  196. <avue-form :option="excelOption" v-model="excelForm" table-loading="excelLoading" :upload-before="uploadBefore"
  197. :upload-after="uploadAfter">
  198. <template slot="excelTemplate">
  199. <el-button type="primary" @click="derivation">
  200. 点击下载<i class="el-icon-download el-icon--right"></i>
  201. </el-button>
  202. </template>
  203. </avue-form>
  204. <p style="text-align: center;color: #DC0505">
  205. 温馨提示 第一次导入时请先下载模板
  206. </p>
  207. </el-dialog>
  208. </div>
  209. <el-dialog title="选择轮胎" append-to-body class="el-dialogDeep" :visible.sync="dialogVisible" width="80%"
  210. :close-on-click-modal="false" :destroy-on-close="true" :close-on-press-escape="false" @close="closeGoods">
  211. <el-row :style="{ height: rowHeight }">
  212. <el-col :span="5" style="height: 100%;overflow-y: auto">
  213. <div>
  214. <el-scrollbar>
  215. <basic-container>
  216. <avue-tree :option="treeOption" :data="treeDataGoods" @node-click="nodeClick" />
  217. </basic-container>
  218. </el-scrollbar>
  219. </div>
  220. </el-col>
  221. <el-col :span="19">
  222. <basic-container>
  223. <avue-crud :option="optionTwo" :table-loading="loading" :data="goodsListShow" ref="crud"
  224. @refresh-change="refreshChange" @selection-change="selectionChange" @search-change="goodsSearch"
  225. :page.sync="page" @on-load="onLoadfun"
  226. @resetColumn="resetCrud" @saveColumn="saveCrud" >
  227. <template slot="menuLeft">
  228. <el-tabs v-model="activeNameTabs" @tab-click="tabHandle">
  229. <el-tab-pane label="查询结果" name="searchList" />
  230. <el-tab-pane label="已选定数据" name="importStaging" />
  231. </el-tabs>
  232. </template>
  233. <template slot="goodsNum" slot-scope="{row}">
  234. <el-input-number v-model="row.goodsNum" size="small" :controls="false" :precision="0"
  235. @input="amountChange($event,row)" style="width: 100%" />
  236. </template>
  237. <template slot="dot" slot-scope="{row}">
  238. <el-select v-if="row.whether=='1'" v-model="row.dot" allow-create filterable default-first-option @focus="picihaolistfun(row.id)">
  239. <el-option v-for="(item, index) in picihaolist" :key="index" :label="item.dot"
  240. :value="item.dot"></el-option>
  241. </el-select>
  242. <span v-else>{{ row.dot }}</span>
  243. </template>
  244. <template slot="price" slot-scope="{row}">
  245. <el-input-number v-model="row.price" size="small" :controls="false"
  246. style="width: 100%" />
  247. <!--<span v-else>{{ row.price }}</span>-->
  248. </template>
  249. <template slot-scope="scope" slot="menu">
  250. <el-button type="text" icon="el-icon-edit" size="small"
  251. @click.stop="importStagList(scope.row, scope.index)" v-if="activeNameTabs == 'searchList'"
  252. :disabled="goodsListSave.findIndex(item => item.id == scope.row.id) !== -1">选择
  253. </el-button>
  254. <el-button type="text" icon="el-icon-delete" size="small"
  255. @click.stop="removeStagList(scope.row, scope.index)" v-else>移除
  256. </el-button>
  257. </template>
  258. </avue-crud>
  259. </basic-container>
  260. </el-col>
  261. </el-row>
  262. <span slot="footer" class="dialog-footer">
  263. <el-button @click="dialogVisible = false" :loading="saveLoading">取 消</el-button>
  264. <el-button type="primary" @click="importGoods" v-if="commodityData !== true" :loading="saveLoading">导入</el-button>
  265. <!--<el-button type="primary" @click="importChoice" v-if="commodityData === true" :loading="saveLoading"-->
  266. <!-- :disabled="tableData.length !== 1">导入</el-button>-->
  267. </span>
  268. </el-dialog>
  269. </div>
  270. </template>
  271. <script>
  272. import { getDetails as getCustom } from "@/api/tirePartsMall/basicData/customerInformation"
  273. import { dateFormat } from "@/util/date";
  274. import { getToken } from "@/util/auth";
  275. import {
  276. getDetails,
  277. submit,
  278. generateShipTask,
  279. tradingBox,
  280. delOrderItem,
  281. checkOrder,
  282. confirmRefund,
  283. goodsListXs,
  284. inboundTask,
  285. checkOrderCG,
  286. revokeCheckOrderCG,
  287. revokeInboundTask,
  288. goodsListAll,
  289. shortcutWarehousing
  290. } from "@/api/tirePartsMall/salesManagement/saleOrder";
  291. import { dotList, goodsDetail } from "@/api/tirePartsMall/purchasingManagement/warehouseEntryOrder";
  292. import reportDialog from "@/components/report-dialog/main";
  293. import checkSchedule from "@/components/checkL/checkSchedule";
  294. import check from "@/components/checkL/check";
  295. import {getCorpType, getList} from "@/api/tirePartsMall/basicData/commodityInformation"
  296. import TicketDistribution from "../../../oceanShipping/maritimeExport/components/ticketDistribution.vue";
  297. import M from "minimatch";
  298. import da from "element-ui/src/locale/lang/da";
  299. import { number } from "echarts";
  300. import {getDeptLazyTreeTwo} from "@/api/basicData/basicFeesDesc";
  301. import commodity from "../../configuration/commodity.json";
  302. export default {
  303. name: "detailsPage",
  304. data() {
  305. return {
  306. // 编辑还是保存
  307. mingxibaocun:true,
  308. // 批次号请求到的数据
  309. picihaolist:[],
  310. // 添加轮胎弹窗
  311. dialogVisible:false,
  312. // 弹窗高度
  313. rowHeight: '',
  314. // 左侧选择搜索
  315. treeDataGoods: [],
  316. treeDeptId: '',
  317. page: {
  318. pageSize: 10,
  319. currentPage: 1,
  320. total: 0,
  321. pageSizes: [10, 50, 100, 300, 500]
  322. },
  323. pageList: {
  324. pageSize: 10,
  325. currentPage: 1,
  326. total: 0
  327. },
  328. // 左侧选择
  329. treeOption:{
  330. addBtn: false,
  331. menu: false,
  332. size: "small",
  333. props: {
  334. labelText: "标题",
  335. label: "title",
  336. value: "value",
  337. }
  338. },
  339. // 表格需要的配置
  340. optionTwo: commodity,
  341. loading: false,
  342. // 商品列表数据合计
  343. goodsListShow: [],
  344. // 商品列表暂存
  345. goodsListSave: [],
  346. saveLoading: false,
  347. commodityData: false,
  348. surplusRouteQuantityOption: [],
  349. tableData: [],
  350. // tabs切换
  351. activeNameTabs:'searchList',
  352. data:[],
  353. inventory: 0,
  354. isStatus: 1,
  355. excelBox:false,
  356. // 轮胎名称
  357. goodsIdoptions: [],
  358. dataList: [],
  359. dicUrlWithCustomId: '',
  360. sharedCompanyId: 0,
  361. isAddBtn: true,
  362. viewDisabled: false, // 请核和大审批按钮是否禁用
  363. isApplySettlement: false, // 请核数据按钮是否禁用
  364. isRevocationRequest: true, // 撤销审核
  365. isExamineBtn: true, // 审批
  366. isAdd: false,
  367. editButton: true, // 编辑按钮和保存按钮的显示隐藏
  368. isSaveBtn: false, // 保存的禁用
  369. isDisabledTask: false, // 生成,撤销任务按钮是否禁用
  370. buttonText: '生成任务',
  371. buttonColor: 'success', // 初始颜色为success
  372. isContacts: false, // 基础信息插槽禁用
  373. goods: [],
  374. isDisabled: false,
  375. //地址
  376. recAddressOption: [],
  377. contactsOption: [],
  378. checkData: {},
  379. checkScheduleDialog: false,
  380. isConfirmRefundBtn: true,
  381. checkDialog: false,
  382. checkId: '',
  383. batchNo: '',
  384. switchDialog: false,
  385. activeName: "sale_detail",
  386. disabled: false,
  387. key: 0,
  388. excelOption: {
  389. submitBtn: false,
  390. emptyBtn: false,
  391. column: [
  392. {
  393. label: "模板下载",
  394. prop: "excelTemplate",
  395. formslot: true,
  396. span: 24
  397. },
  398. {
  399. label: "导入明细",
  400. prop: "excelFile",
  401. type: "upload",
  402. drag: true,
  403. loadText: "上传中,请稍等",
  404. accept: '.xls,.xlsx',
  405. span: 24,
  406. propsHttp: {
  407. res: "data"
  408. },
  409. tip: "请上传 .xls,.xlsx 标准格式文件",
  410. action: "/api/blade-sales-part/ship/import-item"
  411. }
  412. ]
  413. },
  414. form: {
  415. orderItemsList: [],
  416. paymentRecordsList: [],
  417. outboundRecordsList: []
  418. },
  419. optionForm: {
  420. menuBtn: false,
  421. span: 8,
  422. disabled: false,
  423. column: [{
  424. label: '供应商',
  425. prop: "customerId",
  426. disabled: false,
  427. remote: true,
  428. type: 'select',
  429. props: {
  430. label: 'cname',
  431. value: 'id'
  432. },
  433. cascader: ['recAddress'],
  434. click: () => {
  435. this.$refs.form.dicInit()
  436. },
  437. change: (data) => {
  438. if (!this.onLoad.id) {
  439. // this.$set(this.optionContactsBack, "addBtn", true)
  440. // this['optionContacts'] = this['optionContactsBack'];
  441. // this.delColumnData(this.getColumnName('269.1'), this['optionContactsBack']);
  442. }
  443. if (this.$refs.form.DIC.customerId || !this.onLoad.id) {
  444. getCustom({ id: data.value }).then(res => {
  445. this.dicUrlWithCustomId = res.data.data.id ? res.data.data.id : ''
  446. // this.form.storageId ? this.form.storageId : res.data.data.deliveryWarehouseId
  447. // this.form.storageId = res.data.data.deliveryWarehouseId
  448. this.form.storageId = this.form.storageId ? this.form.storageId : res.data.data.deliveryWarehouseId
  449. this.form.contacts = res.data.data.corpsAttnList[0].cname
  450. this.form.phone = res.data.data.corpsAttnList[0].tel
  451. //联系人
  452. this.contactsOption = res.data.data.corpsAttnList
  453. //地址
  454. this.recAddressOption = res.data.data.corpsAddrList
  455. console.log('contactsOption', this.contactsOption);
  456. this.form.recAddress = res.data.data.corpsAddrList[0].belongtoarea + res.data.data.corpsAddrList[0].detailedAddress
  457. })
  458. }
  459. // if (this.$refs.form.DIC.customerId || data.value) {
  460. // for (let item of this.$refs.form.DIC.customerId) {
  461. // if (item.id == data.value) {
  462. // console.log(data);
  463. // console.log(this.$refs.form);
  464. // console.log(item);
  465. // // 后端返回数据暂无联系人、地址等数据,无法下拉默认
  466. // this.form.phone = item.tel
  467. // }
  468. // }
  469. // }
  470. },
  471. dicUrl: '/api/blade-sales-part/corpsDesc/listAll?cname={{key}}&corpType=GYS&enableOrNot=1',
  472. rules: [{
  473. required: true,
  474. message: " ",
  475. trigger: "blur"
  476. }]
  477. }, {
  478. label: '仓库',
  479. prop: "storageId",
  480. type: 'select',
  481. disabled: false,
  482. // placeholder: '仓库为空即为异地销售',
  483. props: {
  484. label: 'cname',
  485. value: 'id'
  486. },
  487. dicUrl: '/api/blade-sales-part/storageDesc/listAll',
  488. rules: [{
  489. required: true,
  490. message: " ",
  491. trigger: "blur"
  492. }]
  493. },
  494. // {
  495. // label: '来源单号',
  496. // prop: "srcOrdNo",
  497. // disabled: true
  498. // }, {
  499. // label: '业务来源',
  500. // prop: "businessSource",
  501. // disabled: true
  502. // },
  503. {
  504. label: '业务日期',
  505. prop: "businesDate",
  506. searchProp:"businesDateList",
  507. disabled: false,
  508. type: "datetime",
  509. value: dateFormat(new Date(), 'yyyy-MM-dd'),
  510. format: "yyyy-MM-dd",
  511. valueFormat: "yyyy-MM-dd",
  512. rules: [
  513. {
  514. required: true,
  515. message: "",
  516. trigger: "blur"
  517. }
  518. ]
  519. },
  520. {
  521. label: '联系人',
  522. type: "select",
  523. prop: "contacts",
  524. disabled: false,
  525. allowCreate:true,
  526. filterable:true,
  527. props: {
  528. label: 'address',
  529. value: 'id'
  530. },
  531. dicUrl: '/api/blade-sales-part/corpsAddr/corpIdByAddr?pid={{key}}'
  532. }, {
  533. label: '电话',
  534. disabled: false,
  535. prop: "phone",
  536. }, {
  537. label: '地址',
  538. prop: "recAddress",
  539. type: 'select',
  540. allowCreate:true,
  541. filterable: true,
  542. disabled: false,
  543. props: {
  544. label: 'address',
  545. value: 'address'
  546. },
  547. dicUrl: '/api/blade-sales-part/corpsAddr/corpIdByAddr?pid={{key}}'
  548. },
  549. // {
  550. // label: '配送方式',
  551. // type: 'select',
  552. // prop: "shipType",
  553. // disabled: false,
  554. // dicUrl: "/api/blade-system/dict-biz/dictionary?code=deliveryMethod",
  555. // props: {
  556. // label: "dictValue",
  557. // value: "dictValue"
  558. // },
  559. // value: '物流'
  560. // }, {
  561. // label: '物流公司',
  562. // disabled: false,
  563. // prop: "logisticsCorpName"
  564. // },
  565. // {
  566. // label: '成本',
  567. // prop: "cost",
  568. // display: true,
  569. // disabled: true
  570. // }, {
  571. // label: '毛利',
  572. // prop: "grossProfit",
  573. // disabled: true
  574. // },
  575. // {
  576. // label: '采购金额',
  577. // prop: "salesAmount",
  578. // disabled: true
  579. // },
  580. // {
  581. // label: '运费',
  582. // prop: "freight",
  583. // disabled: true
  584. // },
  585. {
  586. label: '应付类别',
  587. prop: "receivableType",
  588. type: "select",
  589. disabled: false,
  590. dicUrl: "/api/blade-system/dict-biz/dictionary?code=receivableType",
  591. props: {
  592. label: "dictValue",
  593. value: "dictValue"
  594. },
  595. value: '网络支付'
  596. },
  597. {
  598. label: '总金额',
  599. prop: "totalMoney",
  600. disabled: true
  601. },
  602. {
  603. label: '已付金额',
  604. prop: "paymentAmountTl",
  605. disabled: true
  606. },
  607. {
  608. label: '单据编号',
  609. prop: "ordNo",
  610. disabled: true
  611. },
  612. {
  613. label: '备注',
  614. prop: "remarks",
  615. type: 'textarea',
  616. disabled: false,
  617. span: 16,
  618. minRows: 1
  619. }]
  620. },
  621. formContacts: {},
  622. optionContacts: {},
  623. optionContactsBack: {
  624. disabled: false,
  625. border: true,
  626. align: 'center',
  627. index: true,
  628. showSummary: true,
  629. addBtnText: "添加轮胎",
  630. updateBtnText: '保存',
  631. refreshBtn: false,
  632. dialogDrag: true,
  633. addBtn: false,
  634. span: 8,
  635. height: 500,
  636. // 添加
  637. addRowBtn: false,
  638. // 保存按钮
  639. editBtn: false,
  640. // 航编辑开启
  641. cellBtn:true,
  642. rowKey:'ids',
  643. delBtn: false,
  644. menuWidth: 140,
  645. dialogTop: 25,
  646. dialogWidth: "80%",
  647. summaryText: "合计",
  648. showSummary: true,
  649. sumColumnList: [{
  650. name: "goodsNum",
  651. type: "sum"
  652. }, {
  653. name: "price",
  654. type: "sum",
  655. decimals: 2
  656. }, {
  657. name: "sendNum",
  658. type: "sum",
  659. decimals: 2
  660. }, {
  661. name: "subTotalMoney",
  662. type: "sum",
  663. decimals: 2
  664. }],
  665. column: [{
  666. label: '轮胎名称',
  667. prop: 'goodsId',
  668. width: 200,
  669. disabled: false,
  670. remote: true,
  671. hide:true,
  672. overHidden: true,
  673. type: 'select',
  674. // dicData: [],
  675. props: {
  676. label: 'cname',
  677. value: 'id'
  678. },
  679. // dicUrl: '/api/blade-sales-part/goodsDesc/goodsListAll?cname={{key}}'
  680. dicUrl: "/api/blade-sales-part/goodsDesc/goodsListAll?cname={{key}}&enableOrNot=1"
  681. // dicUrl: "/api/blade-sales-part/goodsDesc/goodsListXs?cname={{key}}"
  682. },{
  683. label: '轮胎名称',
  684. prop: 'goodsName',
  685. width: 200,
  686. disabled: false,
  687. remote: true,
  688. overHidden: true,
  689. }, {
  690. label: '数量',
  691. prop: 'goodsNum',
  692. overHidden: true,
  693. disabled: false,
  694. cell:true,
  695. width: 100,
  696. rules: [{
  697. required: true,
  698. message: " ",
  699. trigger: "blur"
  700. }, {
  701. validator: (rule, value, callback) => {
  702. console.log(this.formContacts.inventory);
  703. if (value < 0) {
  704. callback(new Error("数量不能小于0"));
  705. } else {
  706. callback();
  707. }
  708. },
  709. trigger: "blur"
  710. }]
  711. },
  712. {
  713. label: '价格',
  714. prop: 'price',
  715. overHidden: true,
  716. width: 100,
  717. disabled: false,
  718. cell:true,
  719. rules: [{
  720. required: true,
  721. message: " ",
  722. trigger: "blur"
  723. }, {
  724. validator: (rule, value, callback) => {
  725. if (value < 0) {
  726. callback(new Error("价格不能小于0"));
  727. } else {
  728. callback();
  729. }
  730. },
  731. trigger: "blur"
  732. }]
  733. },
  734. {
  735. label: '库存',
  736. prop: 'inventory',
  737. overHidden: true,
  738. hide: true,
  739. width: 100
  740. }, {
  741. label: '批次号',
  742. prop: 'dot',
  743. cell:true,
  744. width:120,
  745. type: "select",
  746. disabled: true,
  747. allowCreate: true,
  748. filterable: true,
  749. dicData: [],
  750. props: {
  751. label: "dot",
  752. value: "dot"
  753. },
  754. dicUrl: "/api/blade-sales-part/stockDesc/dotList",
  755. overHidden: true,
  756. },{
  757. label: '小计',
  758. prop: 'subTotalMoney',
  759. overHidden: true,
  760. width: 100,
  761. disabled: true,
  762. editDisplay: false,
  763. addDisplay: false
  764. }, {
  765. label: '轮胎编码',
  766. prop: 'goodsNo',
  767. overHidden: true,
  768. disabled: false,
  769. width: 100
  770. },
  771. {
  772. label: '品牌',
  773. prop: 'brandName',
  774. disabled: false,
  775. width: 100,
  776. overHidden: true,
  777. },
  778. {
  779. label: '规格型号',
  780. prop: 'propertyName',
  781. overHidden: true,
  782. disabled: false,
  783. width: 100
  784. }, {
  785. label: '花纹',
  786. prop: 'pattern',
  787. overHidden: true,
  788. disabled: false,
  789. width: 100
  790. }, {
  791. label: '轮胎描述',
  792. prop: 'goodsDescription',
  793. disabled: false,
  794. overHidden: true,
  795. width: 100
  796. },
  797. {
  798. label: '单位',
  799. prop: 'units',
  800. type: "select",
  801. disabled: false,
  802. props: {
  803. label: "dictValue",
  804. value: "dictValue"
  805. },
  806. dicUrl: "/api/blade-system/dict-biz/dictionary?code=unit",
  807. overHidden: true,
  808. width: 100
  809. },
  810. {
  811. label: '收货数量',
  812. prop: 'sendNum',
  813. disabled: false,
  814. overHidden: true,
  815. width: 100,
  816. disabled: true,
  817. editDisplay: false,
  818. addDisplay: false
  819. },
  820. // {
  821. // label: '利润',
  822. // prop: 'profit',
  823. // overHidden: true,
  824. // width: 100
  825. // },
  826. // {
  827. // label: '返利',
  828. // prop: 'thisAmount',
  829. // overHidden: true,
  830. // width: 100
  831. // },
  832. // {
  833. // label: '成本',
  834. // prop: 'costprie',
  835. // overHidden: true,
  836. // width: 100,
  837. // disabled: true,
  838. // editDisplay: false,
  839. // addDisplay: false
  840. // },
  841. // {
  842. // label: '毛利',
  843. // prop: 'grossProfit',
  844. // overHidden: true,
  845. // width: 100,
  846. // disabled: true,
  847. // editDisplay: false,
  848. // addDisplay: false
  849. // },
  850. {
  851. label: '备注',
  852. prop: "remarks",
  853. overHidden: true,
  854. width: 100,
  855. disabled: false,
  856. }
  857. ]
  858. },
  859. optionPaymentDetails: {},
  860. optionPaymentDetailsBack: {
  861. align: 'center',
  862. index: true,
  863. addBtnText: "录入明细",
  864. menu: false,
  865. refreshBtn: false,
  866. dialogDrag: true,
  867. addBtn: false,
  868. span: 8,
  869. height: 600,
  870. addRowBtn: false,
  871. editBtn: false,
  872. delBtn: false,
  873. menuWidth: 140,
  874. dialogTop: 25,
  875. dialogWidth: "80%",
  876. column: [{
  877. label: '支付编号',
  878. prop: 'serialNumber'
  879. }, {
  880. label: '金额',
  881. prop: 'amount'
  882. }, {
  883. label: '类型',
  884. prop: 'type'
  885. }, {
  886. label: '支付时间',
  887. prop: 'createTime'
  888. }]
  889. },
  890. optionOutboundRecords: {},
  891. optionOutboundRecordsBack: {
  892. align: 'center',
  893. index: true,
  894. menu: false,
  895. addBtnText: "录入明细",
  896. refreshBtn: false,
  897. dialogDrag: true,
  898. addBtn: false,
  899. span: 8,
  900. height: 600,
  901. addRowBtn: false,
  902. editBtn: false,
  903. delBtn: false,
  904. // menuWidth: 140,
  905. dialogTop: 25,
  906. dialogWidth: "80%",
  907. column: [{
  908. label: '入库单号',
  909. prop: 'billno'
  910. },
  911. // {
  912. // label: '来源单号',
  913. // prop: 'ordNo'
  914. // },
  915. {
  916. label: '数量',
  917. prop: 'goodsTotalNum'
  918. }, {
  919. label: '实际数量',
  920. prop: 'sendTotalNum'
  921. }, {
  922. label: '业务类型',
  923. prop: 'bizTypeName'
  924. }, {
  925. label: '状态',
  926. prop: 'statusName'
  927. }, {
  928. label: '业务时间',
  929. prop: 'createTime'
  930. }]
  931. }
  932. }
  933. },
  934. components: { reportDialog, check, checkSchedule },
  935. props: {
  936. onLoad: Object,
  937. detailData: Object
  938. },
  939. async created() {
  940. this.findObject(this.optionContactsBack.column, "goodsId").click = ({ value, column }) => {
  941. this.$refs.formContacts.dicInit()
  942. }
  943. this.findObject(this.optionContactsBack.column, "goodsId").change = ({ value, column }) => {
  944. if (this.formContacts.goodsId !== value) {
  945. goodsDetail({ id: value, customId: this.dicUrlWithCustomId, stock: this.form.storageId ? this.form.storageId : '' }).then(res => {
  946. this.goods = res.data.data
  947. this.formContacts.goodsNo = res.data.data.code
  948. this.formContacts.brandId = res.data.data.brandId
  949. this.formContacts.inventory = res.data.data.inventory
  950. // this.formContacts.brandId = res.data.data.brandName
  951. // this.formContacts.brandName = res.data.data.brandId
  952. this.formContacts.propertyName = res.data.data.specificationAndModel
  953. this.formContacts.pattern = res.data.data.brandItem
  954. this.formContacts.goodsDescription = res.data.data.goodsDescription
  955. this.formContacts.units = res.data.data.unit
  956. this.formContacts.price = res.data.data.price
  957. //
  958. this.formContacts.sharedCompanyId = res.data.data.sharedCompanyId
  959. console.log(res.data.data.sharedCompanyId);
  960. console.log(res.data.data.sharedCompanyName);
  961. this.form.sharedCompanyId = res.data.data.sharedCompanyId
  962. this.form.sharedCompanyName = res.data.data.sharedCompanyName
  963. this.sharedCompanyId = res.data.data.sharedCompanyId
  964. console.log(res.data.data.sharedCompanyId);
  965. console.log(this.form.orderItemsList);
  966. for (let i = 0; i < this.form.orderItemsList.length; i++) {
  967. console.log(Number(this.form.orderItemsList[i].sharedCompanyId));
  968. if (Number(this.form.orderItemsList[i].sharedCompanyId) != Number(res.data.data.sharedCompanyId)) {
  969. this.isStatus = 0
  970. }
  971. }
  972. if (res.data.data.whether == 0) {
  973. this.findObject(this.optionContactsBack.column, "dot").disabled = true
  974. } else {
  975. this.findObject(this.optionContactsBack.column, "dot").disabled = false
  976. dotList({
  977. storageId: this.form.storageId,
  978. goodsId: this.formContacts.goodsId
  979. }).then(res => {
  980. this.findObject(this.optionContactsBack.column, "dot").dicData = res.data.data
  981. })
  982. }
  983. // this.formContacts.goodsId = res.data.data.cname
  984. // this.formContacts.goodsName = res.data.data.id
  985. })
  986. }
  987. }
  988. this.optionContacts = await this.getColumnData(this.getColumnName(269.1), this.optionContactsBack);
  989. this.findObject(this.optionContacts.column, "goodsId").change = ({ value, column }) => {
  990. if (this.formContacts.goodsId !== value) {
  991. goodsDetail({ id: value, customId: this.dicUrlWithCustomId, stock: this.form.storageId ? this.form.storageId : '' }).then(res => {
  992. this.goods = res.data.data
  993. this.formContacts.goodsNo = res.data.data.code
  994. this.formContacts.brandId = res.data.data.brandId
  995. this.formContacts.inventory = res.data.data.inventory
  996. // this.formContacts.brandId = res.data.data.brandName
  997. // this.formContacts.brandName = res.data.data.brandId
  998. this.formContacts.propertyName = res.data.data.specificationAndModel
  999. this.formContacts.pattern = res.data.data.brandItem
  1000. this.formContacts.goodsDescription = res.data.data.goodsDescription
  1001. this.formContacts.units = res.data.data.unit
  1002. this.sharedCompanyId = res.data.data.sharedCompanyId
  1003. this.formContacts.sharedCompanyId = res.data.data.sharedCompanyId
  1004. //
  1005. this.form.sharedCompanyId = res.data.data.sharedCompanyId
  1006. this.form.sharedCompanyName = res.data.data.sharedCompanyName
  1007. for (let i = 0; i < this.form.orderItemsList.length; i++) {
  1008. if (this.form.orderItemsList[i].sharedCompanyId != res.data.data.sharedCompanyId) {
  1009. this.isStatus = 0
  1010. }
  1011. }
  1012. if (res.data.data.whether == 0) {
  1013. this.findObject(this.optionContacts.column, "dot").disabled = true
  1014. } else {
  1015. this.findObject(this.optionContacts.column, "dot").disabled = false
  1016. dotList({
  1017. storageId: this.form.storageId,
  1018. goodsId: this.formContacts.goodsId
  1019. }).then(res => {
  1020. this.findObject(this.optionContacts.column, "dot").dicData = res.data.data
  1021. })
  1022. }
  1023. // this.formContacts.goodsId = res.data.data.cname
  1024. // this.formContacts.goodsName = res.data.data.id
  1025. })
  1026. }
  1027. }
  1028. this.optionPaymentDetails = await this.getColumnData(this.getColumnName(269.2), this.optionPaymentDetailsBack);
  1029. this.optionOutboundRecords = await this.getColumnData(this.getColumnName(269.3), this.optionOutboundRecordsBack);
  1030. this.key++
  1031. if (this.onLoad.id && this.detailData.id) {
  1032. this.$set(this.optionForm, 'disabled', true)
  1033. this.$set(this.optionContactsBack, 'disabled', true)
  1034. this.isContacts = true
  1035. this.isDisabled = true
  1036. //添加删除按钮禁用
  1037. this.isAdd = true
  1038. this.refresh(this.onLoad.id, true)
  1039. } else if (this.onLoad.id) {
  1040. this.refresh(this.onLoad.id, true)
  1041. }
  1042. if (!this.form.id) {
  1043. this.editButton = false // 第一次录入显示保存按钮
  1044. this.optionContactsBack.column.forEach(its => {
  1045. if (its.prop == 'goodsId' || its.prop == 'goodsNum' || its.prop == 'price' || its.prop == 'dot' || its.prop == 'remarks') {
  1046. its.disabled = false
  1047. } else {
  1048. its.disabled = true
  1049. }
  1050. })
  1051. this.isDisabledTask = true;
  1052. // this.$set(this.optionContactsBack, "addBtn", false)
  1053. this['optionContacts'] = this['optionContactsBack'];
  1054. this.delColumnData(this.getColumnName('269.1'), this['optionContactsBack']);
  1055. }
  1056. if (!this.detailData.id) {
  1057. this.isAddBtn = false
  1058. this.isDisabledTask = false;
  1059. this.form.businessSource = '内部销售'
  1060. }
  1061. if (this.detailData.check) {
  1062. console.log('this.detailData.check', this.detailData.check);
  1063. this.isExamineBtn = false
  1064. // this.batchNo = this.detailData.check.batchNo
  1065. }
  1066. if (this.detailData.id) {
  1067. this.getDetailsfun()
  1068. }
  1069. },
  1070. watch: {
  1071. 'form.sharedCompanyId'(newSharedCompanyId, oldSharedCompanyId) {
  1072. console.log(newSharedCompanyId, oldSharedCompanyId);
  1073. if (newSharedCompanyId != oldSharedCompanyId) {
  1074. console.log('不能添加');
  1075. }
  1076. console.log(this.sharedCompanyId);
  1077. },
  1078. $route(to, from) {
  1079. if (this.onLoad.id && this.detailData.id) {
  1080. this.$set(this.optionForm, 'disabled', true)
  1081. this.$set(this.optionContactsBack, 'disabled', true)
  1082. this.isContacts = true
  1083. this.isDisabled = true
  1084. this.isAdd = true
  1085. this.refresh(this.onLoad.id, true)
  1086. } else if (this.onLoad.id) {
  1087. console.log(2);
  1088. this.refresh(this.onLoad.id, true)
  1089. }
  1090. // if (!this.form.id) {
  1091. // console.log(3);
  1092. // // this.$set(this.optionContactsBack, "addBtn", false)
  1093. // this['optionContacts'] = this['optionContactsBack'];
  1094. // this.delColumnData(this.getColumnName('269.1'), this['optionContactsBack']);
  1095. // }
  1096. // if (!this.detailData.id) {
  1097. // this.form.businessSource = '内部销售'
  1098. // }
  1099. if (this.detailData.status == 1) {
  1100. this.isExamineBtn = false;
  1101. }
  1102. // if (to.name == '销售订单') {
  1103. // console.log('销售订单');
  1104. // this.isExamineBtn = false;
  1105. // }
  1106. }
  1107. },
  1108. mounted() {
  1109. this.$nextTick(() => {
  1110. // 监听浏览器高度变化,改变表格高度
  1111. window.onresize = () => {
  1112. this.rowHeight = (window.innerHeight - 130) + 'px'
  1113. }
  1114. })
  1115. },
  1116. methods: {
  1117. // 一键入库
  1118. oneClickStorage(){
  1119. this.$confirm("是否要一件入库?", "提示", {
  1120. confirmButtonText: "确定",
  1121. cancelButtonText: "取消",
  1122. type: "warning"
  1123. }).then(()=>{
  1124. const loading = this.$loading({
  1125. lock: true,
  1126. text: '加载中',
  1127. spinner: 'el-icon-loading',
  1128. background: 'rgba(255,255,255,0.7)'
  1129. });
  1130. shortcutWarehousing(this.form).then(res=>{
  1131. this.$message.success("保存成功");
  1132. this.refresh(res.data.data.id)
  1133. loading.close();
  1134. }).catch(()=>{
  1135. loading.close();
  1136. })
  1137. })
  1138. },
  1139. // 获取明细信息
  1140. getDetailsfun(){
  1141. getDetails({
  1142. id:this.detailData.id
  1143. }).then(res=>{
  1144. this.form = res.data.data
  1145. this.form.orderItemsList = res.data.data.orderItemsList
  1146. this.editButton = true //显示编辑按钮
  1147. })
  1148. },
  1149. // 获取左侧筛选
  1150. getAllWorkDicts(){
  1151. getCorpType({ corpType: 'SP' }).then(res => {
  1152. this.treeDataGoods = res.data.data;
  1153. });
  1154. },
  1155. //导入页左商品类型查询
  1156. nodeClick(data) {
  1157. this.treeDeptId = data.id;
  1158. this.page.currentPage = 1;
  1159. this.onLoadfun(this.page, {goodsTypeId:this.treeDeptId});
  1160. },
  1161. closeGoods() {
  1162. this.treeDataGoods = [];
  1163. this.treeDeptId = "";
  1164. this.activeNameTabs = "searchList";
  1165. },
  1166. //刷新触发
  1167. refreshChange() {
  1168. this.treeDeptId = ''
  1169. this.page.currentPage = 1;
  1170. this.onLoadfun(this.page);
  1171. },
  1172. // 这个方法是解决 this.onLoad is not a function 的问题
  1173. onaloadfun(page, params = { artsVision: this.form.belongToCorpId }) {
  1174. this.loading = true;
  1175. getList({
  1176. ...params,
  1177. current: page.currentPage,
  1178. size: page.pageSize
  1179. }).then(res=>{
  1180. console.log(res,1213)
  1181. const data = res.data.data;
  1182. this.page.total = data.total;
  1183. this.pageList.total = data.total
  1184. this.data = data.records;
  1185. this.goodsListShow = data.records;
  1186. this.loading = false;
  1187. })
  1188. // getList(page.currentPage, page.pageSize, Object.assign(params, this.query), this.treeDeptId, null).then(res => {
  1189. // const data = res.data.data;
  1190. // this.page.total = data.total;
  1191. // this.pageList.total = data.total
  1192. // this.data = data.records;
  1193. // this.goodsListShow = data.records;
  1194. // this.loading = false;
  1195. // });
  1196. },
  1197. //选中触发
  1198. selectionChange(list) {
  1199. this.tableData = list
  1200. },
  1201. // 点击搜索触发
  1202. goodsSearch(params, done) {
  1203. this.treeDeptId = ''
  1204. params = {
  1205. ...params,
  1206. artsVision: this.form.belongToCorpId
  1207. }
  1208. this.onLoadfun(this.page, params);
  1209. done()
  1210. },
  1211. // 标签页切换
  1212. tabHandle(data) {
  1213. if (data.name == 'searchList') {
  1214. this.goodsListShow = this.data;
  1215. this.page.total = this.pageList.total
  1216. } else if (data.name == 'importStaging') {
  1217. this.goodsListShow = this.goodsListSave;
  1218. this.page.total = 0
  1219. }
  1220. },
  1221. // 商品信息价格计算
  1222. amountChange(value,row) {
  1223. if (value > 0) {
  1224. this.$refs.crud.toggleRowSelection(row,true);
  1225. }else {
  1226. this.$refs.crud.toggleRowSelection(row,false);
  1227. }
  1228. // 价格
  1229. // if (!row.price) {
  1230. // row.price = 0;
  1231. // }
  1232. },
  1233. importStagList(row, index, type) {
  1234. this.goodsListSave.push(row);
  1235. },
  1236. removeStagList(row, index, type) {
  1237. this.goodsListSave.splice(row.$index, 1)
  1238. },
  1239. //确认导入触发
  1240. async importGoods() {
  1241. this.surplusRouteQuantityOption.push({ storageQuantity: '0' });
  1242. console.log(this.goodsListSave,'导入按钮')
  1243. console.log(this.surplusRouteQuantityOption,'导入按钮2')
  1244. console.log(this.tableData,'导入按钮3')
  1245. if (this.goodsListSave.length > 0) {
  1246. this.goodsListSaveHandle()
  1247. } else {
  1248. if (this.tableData.length > 0) {
  1249. this.tableDataHandle()
  1250. }
  1251. }
  1252. },
  1253. // 导入按钮事件
  1254. tableDataHandle(){
  1255. // 循环获取库存数量
  1256. for(let item of this.tableData) {
  1257. console.log(item,'循环导入')
  1258. let page = {}
  1259. if (this.form.storageId) {
  1260. page.storageId = this.form.storageId
  1261. }
  1262. page.goodsId = item.id
  1263. dotList(page).then(res=>{
  1264. console.log(res.data,'获取到的数据')
  1265. let obj = {}
  1266. if(res.data.data.length>0){
  1267. obj.inventory = res.data.data[0].balanceQuantity
  1268. if (item.dot) {
  1269. obj.dot = item.dot
  1270. }else {
  1271. obj.dot = ''
  1272. }
  1273. }
  1274. this.form.orderItemsList.push({
  1275. ...obj,
  1276. price:item.price,
  1277. goodsId:item.id,
  1278. goodsName:item.cname,
  1279. dot:item.dot,
  1280. brandName:item.brandName,
  1281. brandId:item.brandId,
  1282. goodsNo:item.code,
  1283. // propertyName:item.typeno,
  1284. // 规格型号
  1285. propertyName:item.specificationAndModel,
  1286. // 花纹
  1287. pattern:item.brandItem,
  1288. // 轮胎描述
  1289. goodsDescription:item.goodsDescription,
  1290. goodsNum:item.goodsNum,
  1291. units:item.unit,
  1292. // sendNum:res.data.data[0],
  1293. // 小计
  1294. subTotalMoney:item.goodsNum * item.price,
  1295. // 备注
  1296. remarks:item.remarks,
  1297. // 判断批次号是否可以编辑
  1298. whether:item.whether,
  1299. // 批次号的状态
  1300. dotedittype:false,
  1301. // 价格数量
  1302. goodsNumtype:false,
  1303. // 价格
  1304. pricetype:false,
  1305. // 是否是编辑状态
  1306. mingxibaocun:true
  1307. })
  1308. })
  1309. }
  1310. this.dialogVisible = false
  1311. },
  1312. // 导入
  1313. goodsListSaveHandle(){
  1314. this.tableData = this.goodsListSave
  1315. this.tableDataHandle()
  1316. },
  1317. //导入轮胎弹窗列表查询
  1318. onLoadfun(page, params = { artsVision: this.form.belongToCorpId }) {
  1319. this.loading = true;
  1320. getList({
  1321. ...params,
  1322. current: page.currentPage,
  1323. size: page.pageSize
  1324. }).then(res=>{
  1325. const data = res.data.data;
  1326. this.page.total = data.total;
  1327. this.pageList.total = data.total
  1328. this.data = data.records;
  1329. this.goodsListShow = data.records;
  1330. // 获取单价数据
  1331. for(let item of this.goodsListShow) {
  1332. let page = {}
  1333. item.goodsNum = item.goodsNum?item.goodsNum:0
  1334. if (this.form.storageId) {
  1335. page.storageId = this.form.storageId
  1336. }
  1337. page.goodsId = item.id
  1338. if (this.form.storageId) {
  1339. dotList(page).then(res=>{
  1340. item.price = res.data.data[0].inventoryCostPrice?res.data.data[0].inventoryCostPrice:0
  1341. })
  1342. }
  1343. }
  1344. this.loading = false;
  1345. })
  1346. },
  1347. // 采购明细行编辑
  1348. hangeditBtn(row,index){
  1349. this.picihaolistfun(row.id)
  1350. row.dotedittype = true
  1351. // 价格数量
  1352. row.goodsNumtype = true
  1353. row.pricetype = true
  1354. // 编辑和保存状态切换
  1355. this.mingxibaocun = false
  1356. },
  1357. // 保存按钮
  1358. hangbaocun(row) {
  1359. row.dotedittype = false
  1360. row.goodsNumtype = false
  1361. row.pricetype = false
  1362. this.mingxibaocun = true
  1363. },
  1364. // 批次号获取数据
  1365. picihaolistfun(goodsId){
  1366. dotList({
  1367. storageId:this.form.storageId,
  1368. goodsId: goodsId
  1369. }).then(res=>{
  1370. this.picihaolist = res.data.data
  1371. })
  1372. },
  1373. // 编辑
  1374. editBtn(row, index) {
  1375. this.confirmEditing()
  1376. this.$refs.formContacts.dicInit()
  1377. dotList({
  1378. storageId: this.form.storageId,
  1379. goodsId: this.formContacts.goodsId
  1380. }).then(res => {
  1381. this.findObject(this.optionContactsBack.column, "dot").dicData = res.data.data
  1382. })
  1383. },
  1384. //表头编辑
  1385. confirmEditing() {
  1386. this.editButton = false // 让保存按钮出来
  1387. this.viewDisabled = true // 请核审批禁用
  1388. goodsListXs(this.dicUrlWithCustomId, this.form.storageId ? this.form.storageId : '').then(res => {
  1389. this.findObject(this.optionContactsBack.column, "goodsId").dicData = res.data.data
  1390. })
  1391. if (this.form.status == '已收货') {
  1392. this.viewDisabled = false
  1393. return
  1394. }
  1395. if (this.form.status == '审核中') {
  1396. this.$set(this.optionForm, 'disabled', false)
  1397. this.findObject(this.optionForm.column, "customerId").disabled = true
  1398. this.findObject(this.optionForm.column, "storageId").disabled = true
  1399. this.findObject(this.optionForm.column, "businesDate").disabled = true
  1400. this.findObject(this.optionForm.column, "phone").disabled = true
  1401. this.findObject(this.optionForm.column, "receivableType").disabled = true
  1402. this.isRevocationRequest = false // 撤销请核按钮放开
  1403. this.viewDisabled = false // 请核审批大按钮可点击
  1404. return
  1405. }
  1406. this.isAddBtn = false
  1407. if (this.form.status == '已收货') {
  1408. return
  1409. }
  1410. if (this.form.status == '已取消' || this.form.status == '退款请核') {
  1411. this.isAddBtn = true
  1412. }
  1413. if (this.form.status == '待发货') {
  1414. this.isAddBtn = true
  1415. this.isDisabledTask = false
  1416. }
  1417. this.optionContactsBack.column.forEach(its => {
  1418. if (its.prop == 'goodsId' || its.prop == 'goodsNum' || its.prop == 'price' || its.prop == 'dot' || its.prop == 'remarks') {
  1419. its.disabled = false
  1420. } else {
  1421. its.disabled = true
  1422. }
  1423. })
  1424. // this.$set(this.optionForm, 'disabled', false)
  1425. // this.$set(this.optionContactsBack, 'disabled', false)
  1426. this.isDisabled = false
  1427. this.isAdd = false
  1428. const loading = this.$loading({
  1429. lock: true,
  1430. text: '加载中',
  1431. spinner: 'el-icon-loading',
  1432. background: 'rgba(255,255,255,0.7)'
  1433. });
  1434. if (this.form.status == '待收货' || this.form.status == '已收货') {
  1435. const loading = this.$loading({
  1436. lock: true,
  1437. text: '加载中',
  1438. spinner: 'el-icon-loading',
  1439. background: 'rgba(255,255,255,0.7)'
  1440. });
  1441. this.optionForm.column.forEach(its => {
  1442. if (its.prop != 'remarks') {
  1443. its.disabled = true
  1444. } else {
  1445. its.disabled = false
  1446. }
  1447. })
  1448. this.optionContactsBack.column.forEach(its => {
  1449. if (its.prop != 'remarks') {
  1450. its.disabled = true
  1451. } else {
  1452. its.disabled = false
  1453. }
  1454. })
  1455. loading.close()
  1456. } else if (this.form.status == '录入') {
  1457. this.isDisabledTask = false;
  1458. this.viewDisabled = false;
  1459. this.$set(this.optionForm, 'disabled', false)
  1460. this.$set(this.optionContactsBack, 'disabled', false)
  1461. this.isContacts = false
  1462. //删除按钮
  1463. this.isDisabled = false
  1464. loading.close()
  1465. } else if (this.form.status == '待确认') {
  1466. this.isDisabledTask = false;
  1467. this.isAddBtn = false;
  1468. this.isAdd = false;
  1469. this.isDisabled = false
  1470. this.viewDisabled = false;
  1471. // this.isDisabled = true
  1472. loading.close()
  1473. }
  1474. if (this.form.status == '待收货') {
  1475. this.isDisabledTask = false;
  1476. this.viewDisabled = false;
  1477. }
  1478. this.form.outboundRecordsList.forEach(item => {
  1479. if (item.statusName == '待出库') {
  1480. this.isDisabledTask = true
  1481. }
  1482. })
  1483. if (this.form.checkStatus == '审核完成') {
  1484. this.$set(this.optionForm, 'disabled', false)
  1485. this.$set(this.optionContactsBack, 'disabled', true)
  1486. this.findObject(this.optionForm.column, "customerId").disabled = true
  1487. this.findObject(this.optionForm.column, "storageId").disabled = true
  1488. this.findObject(this.optionForm.column, "businesDate").disabled = true
  1489. this.findObject(this.optionForm.column, "phone").disabled = true
  1490. this.findObject(this.optionForm.column, "receivableType").disabled = true
  1491. this.isContacts = true
  1492. this.isDisabled = true
  1493. //添加删除按钮禁用
  1494. this.isAdd = true
  1495. this.isAddBtn = true
  1496. }
  1497. loading.close()
  1498. },
  1499. generateOutbound() {
  1500. if (!this.form.id) {
  1501. this.$message.error('请先保存')
  1502. } else {
  1503. if (this.buttonText === '生成任务') {
  1504. //生成任务逻辑
  1505. if (this.form.orderItemsList.length <= 0) {
  1506. this.$message.error('请录入明细');
  1507. } else {
  1508. this.$set(this.optionForm, 'disabled', true)
  1509. this.$set(this.optionContactsBack, 'disabled', true)
  1510. this.$refs["form"].validate((valid, done) => {
  1511. if (valid) {
  1512. this.$refs["form"].validate((valid, done) => {
  1513. done();
  1514. if (valid) {
  1515. const loading = this.$loading({
  1516. lock: true,
  1517. text: '加载中',
  1518. spinner: 'el-icon-loading',
  1519. background: 'rgba(255,255,255,0.7)'
  1520. });
  1521. inboundTask({
  1522. bsType: "CG",
  1523. ...this.form
  1524. }).then(res => {
  1525. this.refresh(res.data.data.id)
  1526. // this.isDisabledTask = false
  1527. this.editButton = true
  1528. this.isDisabledTask = true
  1529. // 将按钮文本更改为"撤销任务"
  1530. this.buttonText = '撤销任务';
  1531. // 将按钮颜色更改为对应的颜色
  1532. this.buttonColor = 'warning'; // 比如改为warning
  1533. this.refresh(res.data.data.id, true)
  1534. this.isContacts = true
  1535. this.isAdd = true
  1536. this.isDisabled = true
  1537. // this.findObject(this.optionForm,'disabled') = true
  1538. // this.findObject(this.optionContactsBack,'disabled') = true
  1539. this.$message.success("生成入库任务成功");
  1540. this.isApplySettlement = false
  1541. loading.close();
  1542. // generateShipTask(this.form).then(res => {
  1543. // console.log(res.data);
  1544. // // 将按钮文本更改为"撤销任务"
  1545. // this.buttonText = '撤销任务';
  1546. // // 将按钮颜色更改为对应的颜色
  1547. // this.buttonColor = 'warning'; // 比如改为warning
  1548. // this.refresh(res.data.data.id, true)
  1549. // this.isContacts = true
  1550. // this.isAdd = true
  1551. // this.isDisabled = true
  1552. // // this.findObject(this.optionForm,'disabled') = true
  1553. // // this.findObject(this.optionContactsBack,'disabled') = true
  1554. // this.$message.success("生成入库任务成功");
  1555. // this.isApplySettlement = false
  1556. // loading.close();
  1557. //
  1558. // }).finally(() => {
  1559. // loading.close();
  1560. // });
  1561. }).finally(() => {
  1562. loading.close();
  1563. });
  1564. } else {
  1565. return false;
  1566. }
  1567. });
  1568. done();
  1569. } else {
  1570. this.$message.error('请选择仓库')
  1571. }
  1572. })
  1573. }
  1574. } else {
  1575. this.$refs["form"].validate((valid, done) => {
  1576. console.log(valid);
  1577. if (valid) {
  1578. const loading = this.$loading({
  1579. lock: true,
  1580. text: '加载中',
  1581. spinner: 'el-icon-loading',
  1582. background: 'rgba(255,255,255,0.7)'
  1583. });
  1584. revokeInboundTask(this.form).then(res => {
  1585. this.isDisabledTask = true
  1586. this.editButton = true
  1587. // 将按钮文本更改为"生成任务"
  1588. this.buttonText = '生成任务';
  1589. // 将按钮颜色还原为success
  1590. this.buttonColor = 'success';
  1591. this.$message.success("撤销入库成功");
  1592. this.refresh(res.data.data.id)
  1593. this.isApplySettlement = false
  1594. loading.close();
  1595. }).catch((err) => {
  1596. console.log(err);
  1597. if (err instanceof TooManyResultsException) {
  1598. // 不显示错误消息
  1599. return;
  1600. }
  1601. // 显示其他错误消息
  1602. this.$message.error('发生错误,请稍后重试');
  1603. }).finally(() => {
  1604. loading.close();
  1605. });
  1606. done();
  1607. }
  1608. })
  1609. }
  1610. }
  1611. },
  1612. //联系人change
  1613. contactsChange(e) {
  1614. console.log(e);
  1615. console.log(this.contactsOption);
  1616. // 假设this.contactsOption是你的数组对象
  1617. let matchedContact = this.contactsOption.find(item => item.contacts == e);
  1618. // 判断是否找到匹配的对象
  1619. this.$set(this.form, 'phone', matchedContact.tel)
  1620. // this.$set(this.form, 'recAddress', matchedContact.belongtoarea + matchedContact.detailedAddress)
  1621. },
  1622. //修改提交触发
  1623. editCustomer() {
  1624. this.$refs["form"].validate((valid, done) => {
  1625. done();
  1626. let picihao = false
  1627. if (valid) {
  1628. for(let i in this.form.orderItemsList) {
  1629. console.log(this.form.orderItemsList[i],1800)
  1630. this.form.orderItemsList[i].subTotalMoney = this.form.orderItemsList[i].goodsNum * this.form.orderItemsList[i].price
  1631. if (this.form.orderItemsList[i].pid) {
  1632. }else {
  1633. if(this.form.orderItemsList[i].whether == '1'){
  1634. if(this.form.orderItemsList[i].dot){}else {
  1635. this.$message.warning(`采购明细序号${Number(i)+1}的批次号不能为空`);
  1636. picihao = true
  1637. break;
  1638. }
  1639. }else {
  1640. }
  1641. }
  1642. if (this.form.orderItemsList[i].goodsNum <= 0) {
  1643. this.$message.warning(`采购明细序号${Number(i)+1}的数量不能为零`);
  1644. picihao = true
  1645. }
  1646. }
  1647. this.mingxibaocun = true
  1648. if (picihao) {
  1649. return
  1650. }
  1651. const loading = this.$loading({
  1652. lock: true,
  1653. text: '加载中',
  1654. spinner: 'el-icon-loading',
  1655. background: 'rgba(255,255,255,0.7)'
  1656. });
  1657. submit({
  1658. bsType: "CG",
  1659. ...this.form
  1660. }).then(res => {
  1661. this.$message.success("保存成功");
  1662. this.refresh(res.data.data.id)
  1663. this.isDisabledTask = false
  1664. this.editButton = true // 让编辑按钮出来
  1665. // this.isDisabledTask = false;
  1666. // this.viewDisabled = false;
  1667. this.isAddBtn = true // 表格的添加轮胎禁用
  1668. this.$set(this.optionForm, 'disabled', true)
  1669. this.$set(this.optionContactsBack, 'disabled', true)
  1670. this.isContacts = true // 基础信息联系人 和地址插槽禁用
  1671. // 表格的删除按钮禁用
  1672. this.isDisabled = true
  1673. this.isAdd = true // 表格的编辑和保存按钮禁用
  1674. loading.close();
  1675. }).finally(() => {
  1676. loading.close();
  1677. });
  1678. } else {
  1679. return false;
  1680. }
  1681. });
  1682. },
  1683. //保存
  1684. save() {
  1685. this.$refs["form"].validate((valid, done) => {
  1686. done();
  1687. if (valid) {
  1688. const loading = this.$loading({
  1689. lock: true,
  1690. text: '加载中',
  1691. spinner: 'el-icon-loading',
  1692. background: 'rgba(255,255,255,0.7)'
  1693. });
  1694. inboundTask({
  1695. bsType: "CG",
  1696. ...this.form
  1697. }).then(res => {
  1698. console.log(1);
  1699. this.refresh(res.data.data.id)
  1700. this.isDisabledTask = false
  1701. loading.close();
  1702. }).finally(() => {
  1703. loading.close();
  1704. });
  1705. } else {
  1706. return false;
  1707. }
  1708. });
  1709. },
  1710. inBtn(){
  1711. },
  1712. //关闭弹窗表单
  1713. beforeClose(done, type) {
  1714. console.log(type);
  1715. // if(row == "add"){
  1716. // this.form.sharedCompanyId = this.form.sharedCompanyId?this.form.sharedCompanyId:''
  1717. // this.form.sharedCompanyName = this.form.sharedCompanyName?this.form.sharedCompanyName:''
  1718. // }
  1719. console.log('this.form.sharedCompanyId', this.form.sharedCompanyId);
  1720. console.log('this.form.sharedCompanyName', this.form.sharedCompanyName);
  1721. done()
  1722. },
  1723. refresh(id, type) {
  1724. const loading = this.$loading({
  1725. lock: true,
  1726. text: '加载中',
  1727. spinner: 'el-icon-loading',
  1728. background: 'rgba(255,255,255,0.7)'
  1729. })
  1730. goodsListAll().then(res=>{
  1731. console.log();
  1732. })
  1733. getDetails({ id: id }).then(res => {
  1734. this.form = res.data.data
  1735. let ordForm = { srcBillNo: this.form.ordNo }
  1736. let _this = this
  1737. this.dataList = res.data.data.paymentRecordsList ? res.data.data.paymentRecordsList : [];
  1738. this.$nextTick(() => {
  1739. this.$refs.formContacts.doLayout()
  1740. })
  1741. // if (this.form.status !== '录入' &&
  1742. // this.form.status !== '退款中' &&
  1743. // this.form.status !== '已取消' &&
  1744. // this.form.status !== '退款请核' &&
  1745. // this.form.status !== '已退款' &&
  1746. // this.form.status !== '待确认' &&
  1747. // this.form.status !== '待收货') {
  1748. // this.isApplySettlement = false;
  1749. // }
  1750. if (this.form.status == '审核中') {
  1751. this.isApplySettlement = false;
  1752. this.isRevocationRequest = false // 撤销请核能点击
  1753. }
  1754. // if (this.form.status == '待确认') {
  1755. // this.isApplySettlement = true;
  1756. // }
  1757. // if (this.form.status === '已退款' || this.form.status === '已收货' || this.form.status === '已取消') {
  1758. // // 禁用编辑按钮
  1759. // console.log('按钮全部禁用');
  1760. // this.isDisabledTask = true;
  1761. // this.viewDisabled = true;
  1762. // }
  1763. // if (this.form.status === '已收货') {
  1764. // this.isDisabledTask = true;
  1765. // this.viewDisabled = true;
  1766. // }
  1767. //
  1768. // if (this.form.status == '退款中') {
  1769. // this.isConfirmRefundBtn = false;
  1770. // }
  1771. // if (this.form.status == '已取消') {
  1772. // this.isConfirmRefundBtn = true;
  1773. // }
  1774. //
  1775. if (this.form.generateTask == '已生成') {
  1776. this.buttonText = '撤销任务';
  1777. // this.isDisabledTask = false;
  1778. this.buttonColor = 'warning'
  1779. }
  1780. // if (this.form.status == '退款请核' || this.form.status == '退款中') {
  1781. // this.isRevocationRequest = false;
  1782. // }
  1783. //成本、毛利对销售角色隐藏
  1784. this.optionForm.column.forEach(its => {
  1785. if (JSON.parse(localStorage.getItem('saber-userInfo')).content.role_name.split(',').includes('销售')) {
  1786. if (its.prop == 'cost' || its.prop == 'grossProfit') {
  1787. this.$set(its, 'display', false)
  1788. }
  1789. }
  1790. })
  1791. this.form.orderItemsList.forEach((items) => {
  1792. if (!items.subTotalMoney) {
  1793. items.subTotalMoney = items.goodsNum * items.price
  1794. items.grossProfit = items.subTotalMoney - items.costprie
  1795. }
  1796. })
  1797. if (res.data.data.checkStatus == '审核完成') {
  1798. console.log('审核完成');
  1799. this.$set(this.optionForm, 'disabled', true)
  1800. this.$set(this.optionContactsBack, 'disabled', true)
  1801. this.isContacts = true
  1802. this.isDisabled = true
  1803. //添加删除按钮禁用
  1804. this.isAdd = true
  1805. }
  1806. loading.close();
  1807. }).catch(() => {
  1808. loading.close();
  1809. })
  1810. },
  1811. operationType() {
  1812. },
  1813. //请核关闭
  1814. choceScheduleFun() {
  1815. this.checkScheduleDialog = false
  1816. },
  1817. //关闭审核
  1818. choceCheckFun() {
  1819. this.refresh(this.onLoad.id)
  1820. // this.isDisabledTask = false
  1821. this.isExamineBtn = !this.isExamineBtn
  1822. this.checkDialog = false;
  1823. },
  1824. //请核数据qing
  1825. applySettlement(type) {
  1826. this.$confirm("您确定请核吗?", {
  1827. confirmButtonText: "确定",
  1828. cancelButtonText: "取消",
  1829. type: "warning"
  1830. }).then(() => {
  1831. this.$refs["form"].validate((valid, done) => {
  1832. done()
  1833. if (valid) {
  1834. const data = {
  1835. id: this.form.id,
  1836. url: '/tirePartsMall/salesManagement/purchaseOrder/index',
  1837. pageStatus: "this.$store.getters.purchaseStatus",
  1838. pageLabel: "采购订单",
  1839. }
  1840. const loading = this.$loading({
  1841. lock: true,
  1842. text: '加载中',
  1843. spinner: 'el-icon-loading',
  1844. background: 'rgba(255,255,255,0.7)'
  1845. });
  1846. checkOrderCG({ ...data }).then((res) => {
  1847. this.refresh(res.data.data.id)
  1848. this.$message.success('请核成功');
  1849. this.isApplySettlement = !this.isApplySettlement
  1850. loading.close();
  1851. console.log(res);
  1852. }).catch(() => { loading.close(); })
  1853. }
  1854. })
  1855. })
  1856. },
  1857. //确认退款
  1858. confirmRefundBtn() {
  1859. this.$confirm("您确定退款吗?", {
  1860. confirmButtonText: "确定",
  1861. cancelButtonText: "取消",
  1862. type: "warning"
  1863. }).then(() => {
  1864. const loading = this.$loading({
  1865. lock: true,
  1866. text: '加载中',
  1867. spinner: 'el-icon-loading',
  1868. background: 'rgba(255,255,255,0.7)'
  1869. });
  1870. // this.form.orderItemsList.forEach((items) => {
  1871. // let brandName = items.brandId
  1872. // items.brandId = items.brandName
  1873. // items.brandName = brandName
  1874. // let goodsName = items.goodsId
  1875. // items.goodsId = items.goodsName
  1876. // items.goodsName = goodsName
  1877. // })
  1878. confirmRefund({ ...this.form }).then((res) => {
  1879. loading.close()
  1880. this.$message.success('确定退款成功');
  1881. }).catch(() => { loading.close(); })
  1882. })
  1883. },
  1884. //审批
  1885. examineBtn() {
  1886. this.checkData = this.$route.query.check
  1887. this.checkDialog = true;
  1888. },
  1889. //撤销请核
  1890. revocationRequest() {
  1891. this.$confirm("您确定撤回此次申请吗?", {
  1892. confirmButtonText: "确定",
  1893. cancelButtonText: "取消",
  1894. type: "warning"
  1895. }).then(() => {
  1896. const loading = this.$loading({
  1897. lock: true,
  1898. text: '加载中',
  1899. spinner: 'el-icon-loading',
  1900. background: 'rgba(255,255,255,0.7)'
  1901. });
  1902. // this.form.orderItemsList.forEach((items) => {
  1903. // if (!items.subTotalMoney) {
  1904. // items.subTotalMoney = items.goodsNum * items.price
  1905. // items.grossProfit = items.subTotalMoney - items.costprie
  1906. // }
  1907. // let brandName = items.brandId
  1908. // items.brandId = items.brandName
  1909. // items.brandName = brandName
  1910. // let goodsName = items.goodsId
  1911. // items.goodsId = items.goodsName
  1912. // items.goodsName = goodsName
  1913. // })
  1914. revokeCheckOrderCG({ ...this.form }).then(res => {
  1915. this.isRevocationRequest = !this.isRevocationRequest
  1916. this.refresh(res.data.data.id)
  1917. this.$message.success('撤回成功')
  1918. loading.close();
  1919. })
  1920. })
  1921. },
  1922. rowDelBox(row, index, type) {
  1923. this.$confirm("确定将选择数据删除?", {
  1924. confirmButtonText: "确定",
  1925. cancelButtonText: "取消",
  1926. type: "warning"
  1927. }).then(() => {
  1928. if (row.id) {
  1929. delOrderItem({ ids: row.id }).then(res => {
  1930. this.form.orderItemsList.splice(index, 1);
  1931. this.$message.success("操作成功!");
  1932. });
  1933. } else {
  1934. this.form[type].splice(index, 1);
  1935. this.$message.success("操作成功!");
  1936. }
  1937. }
  1938. );
  1939. },
  1940. rowSave(form, done, loading) {
  1941. form.subTotalMoney = form.goodsNum * form.price
  1942. form.goodsName = form.$goodsId
  1943. if (this.isStatus) {
  1944. console.log(form);
  1945. done(form)
  1946. } else {
  1947. this.$message.error('请选择相同商户的轮胎')
  1948. }
  1949. console.log(form);
  1950. // this.form.sharedCompanyId = res.data.data.sharedCompanyId
  1951. // this.form.sharedCompanyName = res.data.data.sharedCompanyName
  1952. },
  1953. rowUpdate(form, index, done, loading) {
  1954. this.$set(form,'goodsName',form.$goodsId)
  1955. console.log(form);
  1956. done(form)
  1957. },
  1958. // 新增轮胎
  1959. rowAdd(row) {
  1960. if (!this.form.customerId) {
  1961. this.$message.error('请选择供应商')
  1962. return
  1963. }
  1964. this.optionContactsBack.column.forEach(its => {
  1965. if (its.prop == 'goodsId' || its.prop == 'goodsNum' || its.prop == 'price' || its.prop == 'dot' || its.prop == 'remarks') {
  1966. its.disabled = false
  1967. } else {
  1968. its.disabled = true
  1969. }
  1970. })
  1971. console.log('新增了', row);
  1972. this.getAllWorkDicts()
  1973. this.refreshChange()
  1974. this.goodsListSave = []
  1975. this.dialogVisible = true
  1976. // this.$refs.formContacts.rowAdd()
  1977. },
  1978. uploadAfter(res, done, loading, column) {
  1979. if (res instanceof Array) {
  1980. this.form.orderItemsList = this.form.orderItemsList.concat(res)
  1981. }
  1982. this.excelBox = false;
  1983. loading = false;
  1984. done(res);
  1985. },
  1986. derivation() {
  1987. window.open(
  1988. `/api/blade-sales-part/ship/export-item?${this.website.tokenHeader
  1989. }=${getToken()}`
  1990. );
  1991. },
  1992. uploadBefore(file, done, loading) {
  1993. done();
  1994. loading = true;
  1995. },
  1996. //打印
  1997. handlePrint() {
  1998. this.switchDialog = !this.switchDialog;
  1999. },
  2000. onClose(val) {
  2001. this.switchDialog = val;
  2002. },
  2003. //自定义列保存
  2004. async saveColumnTwo(ref, option, optionBack, code) {
  2005. /**
  2006. * 已定义全局方法,直接使用,saveColumnData保存列数据方法,参数传值(表格名称,当前表格的option数据)
  2007. * 已定义全局方法,直接使用,getColumnName方法用来获取枚举值,参数根据自己定义的code值获取中文名
  2008. * 一定要执行异步操作,要等接口成功返回,才能执行下一行代码
  2009. */
  2010. const inSave = await this.saveColumnData(this.getColumnName(code), this[option]);
  2011. if (inSave) {
  2012. this.$message.success("保存成功");
  2013. //关闭窗口
  2014. this.$refs[ref].$refs.dialogColumn.columnBox = false;
  2015. }
  2016. },
  2017. //自定义列重置
  2018. async resetColumnTwo(ref, option, optionBack, code) {
  2019. this[option] = this[optionBack];
  2020. const inSave = await this.delColumnData(this.getColumnName(code), this[optionBack]);
  2021. if (inSave) {
  2022. this.$message.success("重置成功");
  2023. this.$refs[ref].$refs.dialogColumn.columnBox = false;
  2024. }
  2025. },
  2026. backToList(type) {
  2027. this.$emit("backToList", type);
  2028. },
  2029. // 弹框的重置
  2030. resetCrud(){
  2031. this.$message.success("重置成功");
  2032. },
  2033. // 弹窗的保存
  2034. saveCrud(){
  2035. this.$message.success("保存成功");
  2036. }
  2037. }
  2038. }
  2039. </script>
  2040. <style lang="scss" scoped>
  2041. ::v-deep .el-form-item {
  2042. margin-bottom: 8px !important;
  2043. }
  2044. </style>