detailsPage.vue 76 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792
  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="goBack(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;" type="primary" size="small"
  11. 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="info" size="small"
  17. :disabled="form.status != '已发货' || form.returnsNumber == form.goodsTotalNum || editButton"
  18. @click="getReturns">
  19. 销售退货
  20. </el-button>
  21. <el-dropdown style="padding: 0 6px;line-height: 0">
  22. <el-button v-show="form.id " type="danger"
  23. :disabled="!form.id || !(form.status == '待确认'||form.status == '录入'||form.status == '退款请核')" size="small">
  24. 售 后<i class="el-icon-arrow-down el-icon--right"></i>
  25. </el-button>
  26. <el-dropdown-menu slot="dropdown">
  27. <el-dropdown-item @click.native="applySettlement('申请')" :disabled="!(form.status == '待确认'||form.status == '录入')">申请退款
  28. </el-dropdown-item>
  29. <el-dropdown-item @click.native="revocationRequest('撤销')" :disabled="form.status != '退款请核'">撤销请核
  30. </el-dropdown-item>
  31. </el-dropdown-menu>
  32. </el-dropdown>
  33. <!-- <el-button v-if="form.status != '已发货'" class="el-button--small-yh" style="margin-left: 6px;"
  34. type="success" size="small" :disabled="!form.id || editButton || form.businessSource == '外部销售'"
  35. @click="confirm(1)">确认到货
  36. </el-button>
  37. <el-button v-if="form.status == '已发货'" class="el-button--small-yh" style="margin-left: 6px;"
  38. type="danger" size="small" :disabled="!form.id || editButton || form.businessSource == '外部销售'"
  39. @click="confirm(2)">撤销到货
  40. </el-button> -->
  41. </div>
  42. </div>
  43. <div style="margin-top: 50px">
  44. <trade-card title="基础信息">
  45. <avue-form :option="optionForm" v-model="form" ref="form">
  46. <tempalte slot="customerName" slot-scope="{ row }">
  47. <dic-select v-model="form.customerName" placeholder="客户" key="id" label="cname" res="records"
  48. url="/blade-sales-part/corpsDesc/list?current=1&size=10&corpType=KH" :filterable="true"
  49. :remote="true" dataName="cname" @selectChange="dicChange('customerName', $event)"
  50. :disabled="editButton || form.status == '已发货'|| form.status == '已取消' || form.businessSource == '外部销售' || form.goodsTotalShipNum > 0"></dic-select>
  51. </tempalte>
  52. <template slot-scope="{row,index}" slot="contacts">
  53. <el-select v-model="form.contacts" placeholder="请选择" size="small" style="width:60%" clearable
  54. filterable allow-create default-first-option @change="contactsChange($event)"
  55. :disabled="editButton || form.status == '已发货'|| form.status == '已取消' || form.businessSource == '外部销售' || form.goodsTotalShipNum > 0">
  56. <el-option v-for="item in contactsOption" :key="item.id" :label="item.contacts"
  57. :value="item.contacts" />
  58. </el-select>
  59. </template>
  60. </avue-form>
  61. </trade-card>
  62. <trade-card title="明细信息">
  63. <el-tabs v-model="activeName" type="card">
  64. <el-tab-pane label="销售明细" name="sale_detail">
  65. <avue-crud :option="optionContacts" ref="formContacts" :data="form.orderItemsList" :key="key"
  66. @selection-change="selectionChange"
  67. @resetColumn="resetColumnTwo('formContacts', 'optionContacts', 'optionContactsBack', 434)"
  68. @saveColumn="saveColumnTwo('formContacts', 'optionContacts', 'optionContactsBack', 434)">
  69. <template slot-scope="{scope,row}" slot="menuLeft">
  70. <el-button type="primary" icon="el-icon-plus" size="small"
  71. :disabled="editButton || form.status == '已发货'|| form.status == '已取消' || form.businessSource == '外部销售'"
  72. @click="rowAdd(row, 1)">添加商品</el-button>
  73. <el-button type="success" size="small"
  74. :disabled="!form.id || editButton || form.status == '已发货'|| form.status == '已取消' || form.businessSource == '外部销售'"
  75. icon="el-icon-bottom" @click="excelDialogfun('名称')">按名称导入
  76. </el-button>
  77. <el-button type="success" size="small"
  78. :disabled="!form.id || editButton || form.status == '已发货'|| form.status == '已取消' || form.businessSource == '外部销售'"
  79. icon="el-icon-bottom" @click="excelDialogfun('code')">按Code导入
  80. </el-button>
  81. <el-button type="primary" plain size="small" @click="quickCopy">快捷复制</el-button>
  82. <el-popover placement="top" width="400" trigger="click" @show="inventoryShow2()">
  83. <avue-crud :data="inventoryList" :option="inventoryOption">
  84. </avue-crud>
  85. <el-button slot="reference" type="primary" plain size="small"
  86. :disabled="selectionMultilist.length != 1">查看库存</el-button>
  87. </el-popover>
  88. <el-button type="primary" plain size="small"
  89. :disabled="selectionMultilist.length == 0 || editButton || form.status == '已发货'|| form.status == '已取消'"
  90. @click="allClick('派发销售单')">派发销售单</el-button>
  91. <el-button type="danger" plain size="small" @click="allClick('撤销派发')"
  92. :disabled="selectionMultilist.length == 0 || editButton || form.goodsTotalShipNum == 0">撤销派发</el-button>
  93. <el-button type="primary" icon="el-icon-printer" size="small"
  94. @click="handlePrint">打印</el-button>
  95. <el-button type="danger" plain size="small" @click="batchDelete"
  96. :disabled="editButton || form.status == '已发货'|| form.status == '已取消' || form.businessSource == '外部销售'">一键删除</el-button>
  97. </template>
  98. <template slot="goodsId" slot-scope="{ row }">
  99. {{ row.goodsName }}
  100. </template>
  101. <template slot="goodsNum" slot-scope="{ row }">
  102. <el-input-number v-if="row.$cellEdit" size="small" v-model="row.goodsNum"
  103. :precision="numberDecimal" :controls="false" @change="goodsNumblurfun(row)"
  104. style="width: 100%"></el-input-number>
  105. <span v-else>{{ row.goodsNum }}</span>
  106. </template>
  107. <template slot="price" slot-scope="{ row }">
  108. <el-input v-if="row.$cellEdit" size="small" v-model="row.price"
  109. style="width: 100%"></el-input>
  110. <span v-else>{{ row.price }}</span>
  111. </template>
  112. <template slot="dot" slot-scope="{ row }">
  113. <el-select v-if="row.$cellEdit" v-model="row.dot" filterable default-first-option
  114. @focus="picihaolistfun(row.goodsId)" @change="dotchangefun($event, row)"
  115. size="small">
  116. <el-option v-for="(item, index) in picihaolist" :key="index" :label="item.dot"
  117. :value="item.dot"></el-option>
  118. </el-select>
  119. <span v-else>{{ row.dot }}</span>
  120. </template>
  121. <template slot="subTotalMoney" slot-scope="{ row }">{{ row.goodsNum * row.price
  122. }}</template>
  123. <template slot="remarks" slot-scope="{ row }">
  124. <el-input v-if="row.$cellEdit" size="small" v-model="row.remarks"
  125. style="width: 100%"></el-input>
  126. <span v-else>{{ row.remarks }}</span>
  127. </template>
  128. <template slot-scope="{type,size,row,index,disabled}" slot="menu">
  129. <el-button v-if="!row.$cellEdit" :size="size"
  130. :disabled="editButton || row.sendNum > 0 || form.businessSource == '外部销售'|| form.status == '已取消'"
  131. :type="type" icon="el-icon-edit" @click="rowCell(row, index)">编辑
  132. </el-button>
  133. <el-button v-else :size="size" :disabled="editButton || row.sendNum > 0" :type="type"
  134. icon="el-icon-plus" @click="rowSave(row, index)">保存
  135. </el-button>
  136. <el-button icon="el-icon-delete" :size="size"
  137. :disabled="editButton || row.sendNum > 0 || form.businessSource == '外部销售'|| form.status == '已取消'"
  138. :type="type" @click="rowDelBox(row, index, 'orderItemsList')">删除
  139. </el-button>
  140. </template>
  141. </avue-crud>
  142. <el-dialog title="导入明细" append-to-body :visible.sync="excelBox" v-if="excelBox" width="555px"
  143. :close-on-click-modal="false" v-dialog-drag>
  144. <avue-form :option="excelOption" v-model="excelForm" table-loading="excelLoading"
  145. :upload-before="uploadBefore" :upload-after="uploadAfter">
  146. <template slot="excelTemplate">
  147. <el-button type="primary" @click="derivation">
  148. 点击下载<i class="el-icon-download el-icon--right"></i>
  149. </el-button>
  150. </template>
  151. </avue-form>
  152. <p style="text-align: center;color: #DC0505">
  153. 温馨提示 第一次导入时请先下载模板
  154. </p>
  155. </el-dialog>
  156. </el-tab-pane>
  157. <el-tab-pane label="支付明细" name="payment_details">
  158. <avue-crud :option="optionPaymentDetails" v-model="formContacts" ref="payment_details"
  159. :data="dataList" @row-save="rowSave" @row-update="rowUpdate"
  160. @resetColumn="resetColumnTwo('payment_details', 'optionPaymentDetails', 'optionPaymentDetailsBack', 269.2)"
  161. @saveColumn="saveColumnTwo('payment_details', 'optionPaymentDetails', 'optionPaymentDetailsBack', 269.2)">
  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.shareSalesItemsList" @row-save="rowSave" @row-update="rowUpdate"
  167. @resetColumn="resetColumnTwo('outbound_records', 'optionOutboundRecords', 'optionOutboundRecordsBack', 435)"
  168. @saveColumn="saveColumnTwo('outbound_records', 'optionOutboundRecords', 'optionOutboundRecordsBack', 435)">
  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. </div>
  185. <el-dialog title="选择商品" append-to-body class="el-dialogDeep" :visible.sync="dialogVisible" width="80%"
  186. :close-on-click-modal="false" :destroy-on-close="true" :close-on-press-escape="false" @close="closeGoods">
  187. <el-row>
  188. <el-col :span="5">
  189. <div>
  190. <el-scrollbar>
  191. <basic-container>
  192. <avue-tree style="height: 60vh;overflow-y: auto" :option="treeOption"
  193. :data="treeDataGoods" @node-click="nodeClick" />
  194. </basic-container>
  195. </el-scrollbar>
  196. </div>
  197. </el-col>
  198. <el-col :span="19">
  199. <basic-container>
  200. <avue-crud :option="optionTwo" :table-loading="loading" :data="goodsListShow" ref="crud"
  201. :search.sync="SelectSearch" @refresh-change="refreshChange" @search-change="goodsSearch"
  202. :page.sync="page" @on-load="onLoad" @resetColumn="resetCrud" @saveColumn="saveCrud">
  203. <template slot="menuLeft">
  204. <el-tabs v-model="activeNameTabs" @tab-click="tabHandle">
  205. <el-tab-pane label="查询结果" name="searchList" />
  206. <el-tab-pane label="已选定数据" name="importStaging" />
  207. </el-tabs>
  208. </template>
  209. <template slot="goodsNum" slot-scope="{row}">
  210. <el-input-number v-model="row.goodsNum" size="small" :controls="false"
  211. :precision="numberDecimal" @input="amountChange($event, row)" style="width: 100%" />
  212. </template>
  213. <template slot="dot" slot-scope="{row}">
  214. <!--使用allow-create属性即可通过在输入框中输入文字来创建新的条目。注意此时filterable必须为真。-->
  215. <!--本例还使用了default-first-option属性, 在该属性打开的情况下,按下回车就可以选中当前选项列表中的第一个选项,-->
  216. <!--无需使用鼠标或键盘方向键进行定位。-->
  217. <!--allow-create filterable default-first-option-->
  218. <el-select v-model="row.dot" filterable default-first-option size="small"
  219. @focus="picihaolistfun(row.id)" @change="dotchangefun($event, row)">
  220. <el-option v-for="(item, index) in picihaolist" :key="index" :label="item.dot"
  221. :value="item.dot"></el-option>
  222. </el-select>
  223. <!--<span v-else>{{ row.dot }}</span>-->
  224. </template>
  225. <template slot="price" slot-scope="{row}">
  226. <el-input-number v-model="row.price" size="small" :controls="false"
  227. style="width: 100%" />
  228. </template>
  229. <template slot-scope="scope" slot="menu">
  230. <el-button type="text" icon="el-icon-edit" size="small"
  231. @click.stop="importStagList(scope.row, scope.index)"
  232. v-if="activeNameTabs == 'searchList'"
  233. :disabled="goodsListSave.findIndex(item => item.id == scope.row.id) !== -1">选择
  234. </el-button>
  235. <el-button type="text" icon="el-icon-delete" size="small"
  236. @click.stop="removeStagList(scope.row, scope.index)" v-else>移除
  237. </el-button>
  238. </template>
  239. <template slot="inventory" slot-scope="scope">
  240. <span style="color: #489fef">
  241. {{ Number(scope.row.inventory) }}
  242. </span>
  243. </template>
  244. </avue-crud>
  245. </basic-container>
  246. </el-col>
  247. </el-row>
  248. <span slot="footer" class="dialog-footer">
  249. <el-button @click="dialogVisible = false" :loading="saveLoading">取 消</el-button>
  250. <el-button type="primary" @click="importGoods" :loading="saveLoading">导入</el-button>
  251. <!--<el-button type="primary" @click="importChoice" v-if="commodityData === true" :loading="saveLoading"-->
  252. <!-- :disabled="tableData.length !== 1">导入</el-button>-->
  253. </span>
  254. </el-dialog>
  255. <el-dialog title="派发销售单" append-to-body class="el-dialogDeep" :visible.sync="distributeVisible" width="60%"
  256. :close-on-click-modal="false" :destroy-on-close="true" :close-on-press-escape="false"
  257. @close="distributeGoods">
  258. <div>
  259. <div style="display: flex;align-items: center;">
  260. <span>
  261. 共享公司:
  262. </span>
  263. <dic-select v-model="sharedCompany" placeholder="共享公司" key="id" label="deptName"
  264. url="/blade-system/dept/deptListAll" :filterable="true"
  265. @selectChange="dicChange('sharedCompany', $event)"></dic-select>
  266. </div>
  267. <avue-crud :data="selectionMultilist" :option="distributeOption">
  268. <template slot="outGoodsTotalShipNum" slot-scope="{row}">
  269. <el-input-number v-model="row.outGoodsTotalShipNum" size="small" :controls="false"
  270. style="width: 100%" @change="outGoodsChange(row)" />
  271. </template>
  272. <template slot-scope="{type,size,row,index}" slot="menu">
  273. <el-popover placement="top" width="400" trigger="click" @show="inventoryShow(row)">
  274. <avue-crud :data="inventoryList" :option="inventoryOption">
  275. </avue-crud>
  276. <el-button slot="reference" size="small" type="text">查看库存</el-button>
  277. </el-popover>
  278. </template>
  279. </avue-crud>
  280. </div>
  281. <span slot="footer" class="dialog-footer">
  282. <el-button @click="distributeVisible = false" :loading="saveLoading" size="small">取 消</el-button>
  283. <el-button type="primary" @click="inDistribute" :loading="saveLoading" size="small">确认派发</el-button>
  284. </span>
  285. </el-dialog>
  286. </div>
  287. </template>
  288. <script>
  289. import { getDetails as getCustom } from "@/api/tirePartsMall/basicData/customerInformation"
  290. import { getDetails as getDetailsGods } from '@/api/tirePartsMall/basicData/commodityInformation'
  291. import {
  292. getDetails,
  293. submit,
  294. delOrderItem,
  295. checkOrder,
  296. confirmRefund,
  297. revokeCheckOrder,
  298. goodsListXs,
  299. goodsPageXs,
  300. distributeShareSales,
  301. revokeDistributeShareSales,
  302. confirmShipment,
  303. revokeShipment,
  304. listAllByGoodsId
  305. } from "@/api/tirePartsMall/basicData/shareSales";
  306. import { dotList, goodsDetail } from "@/api/tirePartsMall/purchasingManagement/warehouseEntryOrder";
  307. import reportDialog from "@/components/report-dialog/main";
  308. import { dateFormat } from "@/util/date";
  309. import checkSchedule from "@/components/checkL/checkSchedule";
  310. import check from "@/components/checkL/check";
  311. import dicSelect from "@/components/dicSelect/main";
  312. import commodityxsho from '../../configuration/commodityxsho.json'
  313. import TicketDistribution from "../../../oceanShipping/maritimeExport/components/ticketDistribution.vue";
  314. import M from "minimatch";
  315. import da from "element-ui/src/locale/lang/da";
  316. import { number } from "echarts";
  317. import { getCorpTypes } from "@/api/tirePartsMall/basicData/commodityInformation";
  318. import { getWorkDicts } from "../../../../api/system/dictbiz";
  319. import losbfeestemplate from "@/views/iosBasicData/losbfeestemplate/index.vue";
  320. import SearchQuery from "@/components/iosbasic-data/searchquery.vue";
  321. import {
  322. getList as KHgetList
  323. } from "@/api/tirePartsMall/basicData/customerInformation";
  324. import { getToken } from "@/util/auth";
  325. import { isProcurement } from "@/api/basicData/configuration";
  326. export default {
  327. name: "detailsPage",
  328. data() {
  329. return {
  330. sharedCompany: null,
  331. distributeVisible: false,
  332. numberDecimal: 0,
  333. inventoryList: [],
  334. inventoryOption: {
  335. header: false,
  336. menu: false,
  337. align: 'center',
  338. column: [
  339. {
  340. label: '来源公司',
  341. prop: 'srcSalesCompanyName',
  342. overHidden: true,
  343. },
  344. {
  345. label: '商品名称',
  346. prop: 'goodsName',
  347. overHidden: true,
  348. },
  349. {
  350. label: '库存数量',
  351. prop: 'inventory',
  352. overHidden: true,
  353. }
  354. ]
  355. },
  356. distributeOption: {
  357. header: false,
  358. border: true,
  359. stripe: true,
  360. editBtn: false,
  361. delBtn: false,
  362. menuWidth: '80',
  363. align: 'center',
  364. column: [
  365. {
  366. label: '商品名称',
  367. prop: 'goodsName',
  368. width: 360,
  369. overHidden: true,
  370. },
  371. {
  372. label: '商品数量',
  373. prop: 'goodsNum',
  374. overHidden: true,
  375. },
  376. {
  377. label: '已派发数量',
  378. prop: 'sendNum',
  379. overHidden: true,
  380. },
  381. {
  382. label: '派发数量',
  383. prop: 'outGoodsTotalShipNum',
  384. overHidden: true,
  385. }
  386. ]
  387. },
  388. excelBox: false,
  389. reportName: '', // 打印传的名字
  390. SelectSearch: {}, // 添加商品检索
  391. // 编辑还是保存
  392. mingxibaocun: true,
  393. // 批次号请求到的数据
  394. picihaolist: [],
  395. // 添加商品弹窗
  396. dialogVisible: false,
  397. // 弹窗高度
  398. // rowHeight: '',
  399. // 左侧选择搜索
  400. treeDataGoods: [],
  401. treeDeptId: '',
  402. page: {
  403. pageSize: 10,
  404. currentPage: 1,
  405. total: 0,
  406. pageSizes: [10, 50, 100, 300, 500]
  407. },
  408. pageList: {
  409. pageSize: 10,
  410. currentPage: 1,
  411. total: 0
  412. },
  413. // 左侧选择
  414. treeOption: {
  415. addBtn: false,
  416. menu: false,
  417. size: "small",
  418. props: {
  419. labelText: "标题",
  420. label: "title",
  421. value: "id",
  422. }
  423. },
  424. templateUrl: '', // 模板url
  425. // 表格需要的配置
  426. optionTwo: {
  427. align: "center",
  428. height: "400",
  429. searchShow: true,
  430. searchShowBtn: false,
  431. menu: true,
  432. menuWidth: 80,
  433. searchSpan: 8,
  434. searchMenuSpan: 8,
  435. searchMenuPosition: "right",
  436. viewBtn: false,
  437. editBtn: false,
  438. delBtn: false,
  439. border: true,
  440. index: true,
  441. dialogClickModal: false,
  442. searchIcon: true,
  443. searchIndex: 2,
  444. column: [
  445. {
  446. label: "商品名称",
  447. prop: "goodsName",
  448. search: true,
  449. width: 100,
  450. overHidden: true
  451. },
  452. {
  453. label: "商品编号",
  454. prop: "goodsCode",
  455. search: true,
  456. width: 100,
  457. overHidden: true
  458. },
  459. {
  460. label: "数量",
  461. prop: "goodsNum",
  462. width: 100,
  463. overHidden: true
  464. },
  465. {
  466. label: "单价",
  467. prop: "price",
  468. width: 100,
  469. overHidden: true
  470. },
  471. {
  472. label: "库存",
  473. prop: "inventory",
  474. width: 100,
  475. overHidden: true
  476. },
  477. {
  478. label: "规格型号",
  479. prop: "specificationAndModel",
  480. width: 100,
  481. overHidden: true
  482. },
  483. {
  484. label: "公司",
  485. prop: "salesCompanyName",
  486. width: 100,
  487. overHidden: true
  488. },
  489. {
  490. label: "品牌",
  491. prop: "brandName",
  492. width: 100,
  493. overHidden: true
  494. },
  495. {
  496. label: "花纹",
  497. prop: "brandItem",
  498. width: 100,
  499. overHidden: true
  500. },
  501. {
  502. label: "是否静音棉",
  503. prop: "originalFactory",
  504. width: 100,
  505. type: 'select',
  506. dicData: [{
  507. label: '否',
  508. value: "0"
  509. }, {
  510. label: '是',
  511. value: "1"
  512. }],
  513. overHidden: true
  514. },
  515. {
  516. label: "是否防爆",
  517. prop: "explosionProof",
  518. width: 100,
  519. type: 'select',
  520. dicData: [{
  521. label: '否',
  522. value: 0
  523. }, {
  524. label: '是',
  525. value: 1
  526. }],
  527. overHidden: true
  528. },
  529. {
  530. label: "是否自修补",
  531. prop: "selfRecovery",
  532. width: 100,
  533. type: 'select',
  534. dicData: [{
  535. label: '否',
  536. value: "0"
  537. }, {
  538. label: '是',
  539. value: "1"
  540. }],
  541. overHidden: true
  542. }
  543. ]
  544. },
  545. loading: false,
  546. // 商品列表数据合计
  547. goodsListShow: [],
  548. // 商品列表暂存
  549. goodsListSave: [],
  550. saveLoading: false,
  551. commodityData: false,
  552. surplusRouteQuantityOption: [],
  553. tableData: [],
  554. // tabs切换
  555. activeNameTabs: 'searchList',
  556. data: [],
  557. courierCompaniesList: [],
  558. inventory: 0,
  559. isStatus: 1,
  560. goodsIdoptions: [],
  561. dataList: [],
  562. dicUrlWithCustomId: '',
  563. editButton: false, // 大编辑大隐藏显示
  564. isEditButton: false, // 大编辑是否禁用
  565. goods: [],
  566. isDisabled: false, // 表格删除的是否禁用
  567. isDisabledTask: false, // 撤销任务和生成任务的是否禁用
  568. contactsOption: [],
  569. isContacts: false, // 表单的联系人是否禁用
  570. checkData: {},
  571. buttonColor: 'success', // 初始颜色为success 生成任务和撤销任务颜色状态
  572. checkDialog: false, // 审核弹窗的开启关闭
  573. batchNo: '',
  574. switchDialog: false, // 打印弹窗的开启和关闭
  575. activeName: "sale_detail",
  576. disabled: false, // 表格按钮的禁用
  577. key: 0,
  578. form: {
  579. orderItemsList: [],
  580. paymentRecordsList: [],
  581. outboundRecordsList: [],
  582. freight: 5,
  583. },
  584. excelOption: {
  585. submitBtn: false,
  586. emptyBtn: false,
  587. column: [
  588. {
  589. label: "模板下载",
  590. prop: "excelTemplate",
  591. formslot: true,
  592. span: 24
  593. },
  594. {
  595. label: "导入明细",
  596. prop: "excelFile",
  597. type: "upload",
  598. drag: true,
  599. loadText: "上传中,请稍等",
  600. accept: '.xls,.xlsx',
  601. span: 24,
  602. propsHttp: {
  603. res: "data"
  604. },
  605. tip: "请上传 .xls,.xlsx 标准格式文件",
  606. action: "/api/blade-sales-part/ship/import-item"
  607. }
  608. ]
  609. },
  610. optionForm: {
  611. menuBtn: false,
  612. span: 8,
  613. disabled: false,
  614. column: [{
  615. label: '客户',
  616. prop: "customerName",
  617. disabled: false,
  618. formslot: true,
  619. rules: [{
  620. required: true,
  621. message: " ",
  622. trigger: "blur"
  623. }]
  624. },
  625. // {
  626. // label: '业务员',
  627. // // disabled: false,
  628. // prop: "salerId",
  629. // type: "select",
  630. // props: {
  631. // label: "name",
  632. // value: "id"
  633. // },
  634. // dicUrl: "/api/blade-user/salerList",
  635. // filterable: true,
  636. // }, {
  637. // label: '仓库',
  638. // prop: "storageId",
  639. // type: 'select',
  640. // disabled: true,
  641. // placeholder: '仓库为空即为异地销售',
  642. // props: {
  643. // label: 'cname',
  644. // value: 'id'
  645. // },
  646. // dicUrl: '/api/blade-sales-part/storageDesc/listAll',
  647. // },
  648. {
  649. label: '联系人',
  650. type: "select",
  651. prop: "contacts",
  652. disabled: false,
  653. allowCreate: true,
  654. filterable: true,
  655. dicData: [],
  656. props: {
  657. label: 'address',
  658. value: 'id'
  659. },
  660. dicUrl: '/api/blade-sales-part/corpsAddr/corpIdByAddr?pid={{key}}'
  661. }, {
  662. label: '电话',
  663. disabled: false,
  664. prop: "phone",
  665. }, {
  666. label: '收货地址',
  667. prop: "recAddress",
  668. type: 'select',
  669. allowCreate: true,
  670. filterable: true,
  671. disabled: false,
  672. props: {
  673. label: 'address',
  674. value: 'address'
  675. },
  676. dicUrl: '/api/blade-sales-part/corpsAddr/corpIdByAddr?pid={{key}}'
  677. }, {
  678. label: '业务日期',
  679. prop: "businesDate",
  680. searchProp: "businesDateList",
  681. disabled: false,
  682. type: "datetime",
  683. value: dateFormat(new Date(), 'yyyy-MM-dd'),
  684. format: "yyyy-MM-dd",
  685. valueFormat: "yyyy-MM-dd",
  686. rules: [
  687. {
  688. required: true,
  689. message: "",
  690. trigger: "blur"
  691. }
  692. ]
  693. }, {
  694. label: '收款方式',
  695. prop: "receivableType",
  696. type: "select",
  697. disabled: false,
  698. dicUrl: "/api/blade-system/dict-biz/dictionary?code=receivableType",
  699. props: {
  700. label: "dictValue",
  701. value: "dictValue"
  702. },
  703. value: '网络支付'
  704. },
  705. {
  706. label: '业务来源',
  707. prop: "businessSource",
  708. disabled: true
  709. }, {
  710. label: '配送方式',
  711. type: 'select',
  712. prop: "shipType",
  713. disabled: false,
  714. dicUrl: "/api/blade-system/dict-biz/dictionary?code=deliveryMethod",
  715. props: {
  716. label: "dictValue",
  717. value: "dictValue"
  718. },
  719. value: '物流',
  720. }, {
  721. label: '货运公司',
  722. type: 'select',
  723. prop: "logisticsCorpName",
  724. allowCreate: true,
  725. filterable: true,
  726. disabled: false,
  727. dicUrl: "/api/blade-system/dict-biz/dictionary?code=tyre_express_company",
  728. props: {
  729. label: "dictValue",
  730. value: "dictValue"
  731. }
  732. },
  733. {
  734. label: '货运单号',
  735. disabled: false,
  736. prop: "expressNo"
  737. },
  738. {
  739. label: '成本',
  740. prop: "cost",
  741. display: false,
  742. disabled: true
  743. }, {
  744. label: '毛利',
  745. prop: "grossProfit",
  746. display: false,
  747. disabled: true
  748. }, {
  749. label: '销售金额',
  750. prop: "salesAmount",
  751. disabled: true
  752. }, {
  753. label: '运费',
  754. prop: "freight",
  755. disabled: true
  756. }, {
  757. label: '总金额',
  758. prop: "totalMoney",
  759. disabled: true
  760. }, {
  761. label: '已收金额',
  762. prop: "paymentAmountTl",
  763. disabled: true
  764. }, {
  765. label: '单据编号',
  766. prop: "ordNo",
  767. disabled: true
  768. }, {
  769. label: '来源单号',
  770. prop: "srcOrdNo",
  771. disabled: true
  772. }, {
  773. label: '退货数量',
  774. prop: "returnsNumber",
  775. disabled: true
  776. }, {
  777. label: '退货金额',
  778. prop: "returnsAmount",
  779. disabled: true
  780. }, {
  781. label: '备注',
  782. prop: "remarks",
  783. type: 'textarea',
  784. disabled: false,
  785. span: 16,
  786. minRows: 1
  787. }]
  788. },
  789. formContacts: {},
  790. optionContacts: {},
  791. optionContactsBack: {
  792. disabled: false,
  793. goodsId: '',
  794. border: true,
  795. align: 'center',
  796. index: true,
  797. addBtnText: "添加商品",
  798. updateBtnText: '保存',
  799. refreshBtn: false,
  800. dialogDrag: true,
  801. addBtn: false,
  802. // 航编辑开启
  803. cellBtn: false,
  804. span: 8,
  805. height: 500,
  806. addRowBtn: false,
  807. editBtn: false,
  808. delBtn: false,
  809. menuWidth: 150,
  810. dialogTop: 25,
  811. dialogWidth: "80%",
  812. summaryText:this.$t("land118n.total"),
  813. showSummary: true,
  814. selection: true,
  815. sumColumnList: [{
  816. name: "goodsNum",
  817. type: "sum"
  818. }, {
  819. name: "sendNum",
  820. type: "sum"
  821. }, {
  822. name: "profit",
  823. type: "sum"
  824. }, {
  825. name: "subTotalMoney",
  826. type: "sum"
  827. }, {
  828. name: "thisAmount",
  829. type: "sum"
  830. }, {
  831. name: "costprie",
  832. type: "sum"
  833. }, {
  834. name: "grossProfit",
  835. type: "sum"
  836. }, {
  837. name: "returnsNumber",
  838. type: "sum"
  839. }, {
  840. name: "returnsAmount",
  841. type: "sum"
  842. }],
  843. column: [{
  844. label: '商品名称',
  845. prop: 'goodsId',
  846. width: 250,
  847. disabled: false,
  848. remote: true,
  849. overHidden: true,
  850. hide: true,
  851. type: 'select',
  852. dicData: [],
  853. props: {
  854. label: 'goodsName',
  855. value: 'goodsId'
  856. },
  857. dicUrl: `/api/blade-sales-part/goodsDesc/goodsListXs?cname={{key}}&customId=&enableOrNot=1&stock=${this.goodsId}`
  858. }, {
  859. label: '商品名称',
  860. prop: 'goodsName',
  861. width: 250,
  862. disabled: false,
  863. remote: true,
  864. overHidden: true,
  865. }, {
  866. label: '库存',
  867. prop: 'inventory',
  868. width: 250,
  869. disabled: false,
  870. remote: true,
  871. overHidden: true,
  872. }, {
  873. label: '数量',
  874. prop: 'goodsNum',
  875. overHidden: true,
  876. disabled: false,
  877. cell: true,
  878. width: 100,
  879. rules: [{
  880. required: true,
  881. message: " ",
  882. trigger: "blur"
  883. }, {
  884. validator: (rule, value, callback) => {
  885. console.log(this.formContacts.inventory);
  886. if (value < 0) {
  887. callback(new Error("数量不能小于0"));
  888. } else if (Number(value) > Number(this.formContacts.inventory)) {
  889. callback(new Error("数量不能大于库存"));
  890. } else {
  891. callback();
  892. }
  893. },
  894. trigger: "blur"
  895. }]
  896. },
  897. {
  898. label: '价格',
  899. prop: 'price',
  900. overHidden: true,
  901. width: 100,
  902. disabled: false,
  903. cell: true,
  904. rules: [{
  905. required: true,
  906. message: " ",
  907. trigger: "blur"
  908. }, {
  909. validator: (rule, value, callback) => {
  910. if (value < 0) {
  911. callback(new Error("价格不能小于0"));
  912. } else {
  913. callback();
  914. }
  915. },
  916. trigger: "blur"
  917. }]
  918. },
  919. {
  920. label: '库存',
  921. prop: 'inventory',
  922. overHidden: true,
  923. hide: true,
  924. width: 100
  925. },
  926. {
  927. label: '商品编码',
  928. prop: 'goodsNo',
  929. overHidden: true,
  930. disabled: false,
  931. width: 100
  932. },
  933. {
  934. label: '品牌',
  935. prop: 'brandName',
  936. disabled: false,
  937. width: 100,
  938. overHidden: true,
  939. },
  940. {
  941. label: '规格型号',
  942. prop: 'propertyName',
  943. overHidden: true,
  944. disabled: false,
  945. width: 100
  946. }, {
  947. label: '花纹',
  948. prop: 'pattern',
  949. overHidden: true,
  950. disabled: false,
  951. width: 100
  952. }, {
  953. label: '商品描述',
  954. prop: 'goodsDescription',
  955. disabled: false,
  956. overHidden: true,
  957. width: 100
  958. },
  959. {
  960. label: '已派发数量',
  961. prop: 'sendNum',
  962. overHidden: true,
  963. width: 100,
  964. disabled: true,
  965. editDisplay: false,
  966. addDisplay: false
  967. },
  968. // {
  969. // label: '利润',
  970. // prop: 'profit',
  971. // overHidden: true,
  972. // width: 100
  973. // },
  974. {
  975. label: '小计',
  976. prop: 'subTotalMoney',
  977. overHidden: true,
  978. width: 100,
  979. disabled: true,
  980. editDisplay: false,
  981. addDisplay: false
  982. },
  983. // {
  984. // label: '返利',
  985. // prop: 'thisAmount',
  986. // overHidden: true,
  987. // width: 100
  988. // },
  989. {
  990. label: '成本',
  991. prop: 'costprie',
  992. overHidden: true,
  993. width: 100,
  994. disabled: true,
  995. editDisplay: false,
  996. addDisplay: false
  997. },
  998. {
  999. label: '毛利',
  1000. prop: 'grossProfit',
  1001. overHidden: true,
  1002. width: 100,
  1003. disabled: true,
  1004. editDisplay: false,
  1005. addDisplay: false
  1006. },
  1007. {
  1008. label: '退货数量',
  1009. prop: "returnsNumber",
  1010. overHidden: true,
  1011. width: 100,
  1012. disabled: true,
  1013. },
  1014. {
  1015. label: '退货金额',
  1016. prop: "returnsAmount",
  1017. overHidden: true,
  1018. width: 100,
  1019. disabled: true,
  1020. },
  1021. {
  1022. label: '备注',
  1023. prop: "remarks",
  1024. overHidden: true,
  1025. width: 100,
  1026. disabled: false,
  1027. }
  1028. ]
  1029. },
  1030. selectionMultilist: [], // 多选数据
  1031. optionPaymentDetails: {},
  1032. optionPaymentDetailsBack: {
  1033. align: 'center',
  1034. index: true,
  1035. addBtnText: "录入明细",
  1036. menu: false,
  1037. refreshBtn: false,
  1038. dialogDrag: true,
  1039. addBtn: false,
  1040. span: 8,
  1041. height: 600,
  1042. addRowBtn: false,
  1043. editBtn: false,
  1044. delBtn: false,
  1045. menuWidth: 140,
  1046. dialogTop: 25,
  1047. dialogWidth: "80%",
  1048. column: [{
  1049. label: '支付编号',
  1050. prop: 'serialNumber',
  1051. overHidden: true,
  1052. }, {
  1053. label: '金额',
  1054. prop: 'amount',
  1055. overHidden: true,
  1056. }, {
  1057. label: '类型',
  1058. prop: 'type',
  1059. overHidden: true,
  1060. }, {
  1061. label: '支付时间',
  1062. prop: 'createTime',
  1063. overHidden: true,
  1064. }]
  1065. },
  1066. optionOutboundRecords: {},
  1067. optionOutboundRecordsBack: {
  1068. align: 'center',
  1069. index: true,
  1070. menu: false,
  1071. addBtnText: "录入明细",
  1072. refreshBtn: false,
  1073. dialogDrag: true,
  1074. addBtn: false,
  1075. span: 8,
  1076. height: 600,
  1077. addRowBtn: false,
  1078. editBtn: false,
  1079. delBtn: false,
  1080. // menuWidth: 140,
  1081. dialogTop: 25,
  1082. dialogWidth: "80%",
  1083. column: [{
  1084. label: '商品名称',
  1085. prop: 'goodsName',
  1086. overHidden: true,
  1087. },
  1088. // {
  1089. // label: '来源单号',
  1090. // prop: 'ordNo'
  1091. // },
  1092. {
  1093. label: '商品数量',
  1094. prop: 'goodsNum',
  1095. overHidden: true,
  1096. }, {
  1097. label: '单价',
  1098. prop: 'price',
  1099. overHidden: true,
  1100. }, {
  1101. label: '小计',
  1102. prop: 'subTotalMoney',
  1103. overHidden: true,
  1104. }, {
  1105. label: '共享公司',
  1106. prop: 'sharedCompanyName',
  1107. overHidden: true,
  1108. }, {
  1109. label: '状态',
  1110. prop: 'sharedStatus',
  1111. overHidden: true,
  1112. }]
  1113. }
  1114. }
  1115. },
  1116. components: { SearchQuery, reportDialog, check, checkSchedule, dicSelect },
  1117. props: {
  1118. detailData: Object
  1119. },
  1120. async created() {
  1121. this.optionContacts = await this.getColumnData(this.getColumnName(434), this.optionContactsBack);
  1122. this.optionPaymentDetails = await this.getColumnData(this.getColumnName(269.2), this.optionPaymentDetailsBack);
  1123. this.optionOutboundRecords = await this.getColumnData(this.getColumnName(435), this.optionOutboundRecordsBack);
  1124. this.key++
  1125. if (this.detailData.id) {
  1126. this.editButton = true
  1127. this.optionForm.disabled = true
  1128. this.getDetail(this.detailData.id, true)
  1129. }
  1130. },
  1131. methods: {
  1132. // 快捷复制
  1133. quickCopy() {
  1134. let temp = document.createElement("textarea")
  1135. let txt = `${this.form.customerName} ${this.form.businesDate}`
  1136. for (let item of this.form.orderItemsList) {
  1137. txt += `\n${item.goodsName} ${item.goodsNum}`
  1138. }
  1139. document.body.appendChild(temp)
  1140. temp.value = txt
  1141. temp.select()
  1142. document.execCommand("copy")
  1143. document.body.removeChild(temp)
  1144. },
  1145. confirmEditing() {
  1146. this.editButton = false
  1147. if (this.form.status != '已发货') {
  1148. if (this.form.businessSource == '外部销售') {
  1149. this.optionForm.disabled = false
  1150. this.optionForm.column.forEach(item => {
  1151. if (item.prop == 'shipType' || item.prop == 'logisticsCorpName' || item.prop == 'expressNo' || item.prop == 'remarks') {
  1152. item.disabled = false
  1153. } else {
  1154. item.disabled = true
  1155. }
  1156. })
  1157. }
  1158. if (this.form.businessSource == '内部销售' && this.form.goodsTotalShipNum == 0) {
  1159. this.optionForm.disabled = false
  1160. }
  1161. }
  1162. },
  1163. outGoodsChange(row) {
  1164. if (Number(row.outGoodsTotalShipNum) > Number(Number(row.goodsNum) - Number(row.sendNum))) {
  1165. this.$set(row, 'outGoodsTotalShipNum', null)
  1166. return this.$message.error("派发数量不能超过" + (Number(row.goodsNum) - Number(row.sendNum)));
  1167. }
  1168. },
  1169. dicChange(name, row) {
  1170. if (name == 'customerName') {
  1171. if (row) {
  1172. this.$set(this.form, 'customerId', row.id)
  1173. getCustom({ id: row.id }).then(res => {
  1174. if (res.data.data) {
  1175. this.dicUrlWithCustomId = res.data.data.id ? res.data.data.id : ''
  1176. this.form.storageId = res.data.data.deliveryWarehouseId
  1177. this.form.storageName = res.data.data.deliveryWarehouseName
  1178. this.form.contacts = res.data.data.corpsAttnList[0].cname
  1179. this.form.phone = res.data.data.corpsAttnList[0].tel
  1180. this.contactsOption = res.data.data.corpsAddrList
  1181. this.form.recAddress = res.data.data.corpsAddrList[0].belongtoarea + res.data.data.corpsAddrList[0].detailedAddress
  1182. this.form.salerId = res.data.data.salesmanId
  1183. this.form.salerName = res.data.data.salesmanName
  1184. }
  1185. })
  1186. } else {
  1187. this.form.customerId = ''
  1188. this.form.customerName = ''
  1189. this.dicUrlWithCustomId = ''
  1190. this.form.storageId = ''
  1191. this.form.contacts = ''
  1192. this.form.phone = ''
  1193. this.contactsOption = ''
  1194. this.form.recAddress = ''
  1195. this.form.salerId = ''
  1196. this.form.salerName = ''
  1197. this.form.storageName = ''
  1198. }
  1199. }
  1200. if (name == 'sharedCompany') {
  1201. if (row) {
  1202. this.form.sharedCompanyId = row.id
  1203. this.form.sharedCompanyName = row.deptName
  1204. } else {
  1205. this.form.sharedCompanyId = null
  1206. this.form.sharedCompanyName = null
  1207. }
  1208. }
  1209. },
  1210. confirm(type) {
  1211. if (type == 1) {
  1212. for (let item of this.form.orderItemsList) {
  1213. if (item.sendNum != item.goodsNum) {
  1214. return this.$message.error("第" + Number(item.$index + 1) + "行明细未发货,请先发货");
  1215. }
  1216. }
  1217. this.$confirm('是否确认发货?', '提示', {
  1218. confirmButtonText: '确定',
  1219. cancelButtonText: '取消',
  1220. type: 'warning'
  1221. }).then(() => {
  1222. const loading = this.$loading({
  1223. lock: true,
  1224. text: '加载中',
  1225. spinner: 'el-icon-loading',
  1226. background: 'rgba(255,255,255,0.7)'
  1227. });
  1228. confirmShipment(this.form).then(res => {
  1229. this.$message.success("操作成功");
  1230. this.getDetail(this.form.id)
  1231. }).finally(() => {
  1232. loading.close();
  1233. });
  1234. })
  1235. }
  1236. if (type == 2) {
  1237. this.$confirm('是否撤销发货?', '提示', {
  1238. confirmButtonText: '确定',
  1239. cancelButtonText: '取消',
  1240. type: 'warning'
  1241. }).then(() => {
  1242. const loading = this.$loading({
  1243. lock: true,
  1244. text: '加载中',
  1245. spinner: 'el-icon-loading',
  1246. background: 'rgba(255,255,255,0.7)'
  1247. });
  1248. revokeShipment(this.form).then(res => {
  1249. this.$message.success("操作成功");
  1250. this.getDetail(this.form.id)
  1251. }).finally(() => {
  1252. loading.close();
  1253. });
  1254. })
  1255. }
  1256. },
  1257. allClick(name) {
  1258. if (name == '派发销售单') {
  1259. for (let item of this.selectionMultilist) {
  1260. if (!item.id) {
  1261. return this.$message.error("请保存数据");
  1262. }
  1263. if (item.sendNum == item.goodsNum) {
  1264. return this.$message.error("明细存在已派发完的数据,请重新选择");
  1265. }
  1266. }
  1267. this.sharedCompany = null
  1268. this.selectionMultilist.forEach(e => {
  1269. e.outGoodsTotalShipNum = 0
  1270. })
  1271. this.distributeVisible = true
  1272. }
  1273. if (name == '撤销派发') {
  1274. let ids = []
  1275. for (let item of this.selectionMultilist) {
  1276. if (item.sendNum == 0) {
  1277. return this.$message.error("请正确选择明细");
  1278. }
  1279. ids.push(item.id)
  1280. }
  1281. this.$confirm('是否撤销派发?', '提示', {
  1282. confirmButtonText: '确定',
  1283. cancelButtonText: '取消',
  1284. type: 'warning'
  1285. }).then(() => {
  1286. const loading = this.$loading({
  1287. lock: true,
  1288. text: '加载中',
  1289. spinner: 'el-icon-loading',
  1290. background: 'rgba(255,255,255,0.7)'
  1291. });
  1292. revokeDistributeShareSales({ itemIds: ids.join(',') }).then(res => {
  1293. this.$message.success("操作成功");
  1294. this.getDetail(this.form.id, '撤销派发')
  1295. }).finally(() => {
  1296. loading.close();
  1297. });
  1298. })
  1299. }
  1300. },
  1301. // 数量失焦触发
  1302. goodsNumblurfun(row) {
  1303. if (Number(row.goodsNum) > Number(row.inventory)) {
  1304. this.$set(row, 'goodsNum', null)
  1305. return this.$message.warning("不能大于库存数量");
  1306. }
  1307. },
  1308. inventoryShow(row) {
  1309. this.inventoryList = []
  1310. const loading = this.$loading({
  1311. lock: true,
  1312. text: '加载中',
  1313. spinner: 'el-icon-loading',
  1314. background: 'rgba(255,255,255,0.7)'
  1315. });
  1316. listAllByGoodsId({ goodsCode: row.goodsNo }).then(res => {
  1317. this.inventoryList = res.data.data
  1318. }).finally(() => {
  1319. loading.close();
  1320. });
  1321. },
  1322. inventoryShow2() {
  1323. this.inventoryList = []
  1324. const loading = this.$loading({
  1325. lock: true,
  1326. text: '加载中',
  1327. spinner: 'el-icon-loading',
  1328. background: 'rgba(255,255,255,0.7)'
  1329. });
  1330. listAllByGoodsId({ goodsCode: this.selectionMultilist[0].goodsNo }).then(res => {
  1331. this.inventoryList = res.data.data
  1332. }).finally(() => {
  1333. loading.close();
  1334. });
  1335. },
  1336. inDistribute() {
  1337. if (!this.sharedCompany) {
  1338. return this.$message.error("请选择共享公司");
  1339. }
  1340. for (let item of this.selectionMultilist) {
  1341. if (item.outGoodsTotalShipNum == 0) {
  1342. return this.$message.error("请输入派件数量");
  1343. }
  1344. }
  1345. let obj = {}
  1346. obj = {
  1347. ...this.form,
  1348. orderItemsList: this.selectionMultilist
  1349. }
  1350. const loading = this.$loading({
  1351. lock: true,
  1352. text: '加载中',
  1353. spinner: 'el-icon-loading',
  1354. background: 'rgba(255,255,255,0.7)'
  1355. });
  1356. distributeShareSales(obj).then(res => {
  1357. this.$message.success("操作成功")
  1358. this.distributeVisible = false
  1359. this.getDetail(this.form.id)
  1360. }).finally(() => {
  1361. loading.close();
  1362. });
  1363. },
  1364. uploadAfter(res, done, loading, column) {
  1365. if (Array.isArray(res)) {
  1366. if (res instanceof Array) {
  1367. this.form.orderItemsList = this.form.orderItemsList.concat(res)
  1368. res.forEach(item => {
  1369. dotList({
  1370. storageId: this.form.storageId,
  1371. goodsId: res.goodsId,
  1372. whether: 1
  1373. }).then(e => {
  1374. this.findObject(this.optionContactsBack.column, "dot").dicData = e.data.data
  1375. })
  1376. })
  1377. }
  1378. } else {
  1379. this.$message.error(res)
  1380. }
  1381. this.excelBox = false;
  1382. loading = false;
  1383. done(res);
  1384. },
  1385. derivation() {
  1386. window.open(
  1387. `${this.templateUrl}?${this.website.tokenHeader
  1388. }=${getToken()}&stockId=${this.form.storageId}`
  1389. );
  1390. },
  1391. uploadBefore(file, done, loading) {
  1392. done();
  1393. loading = true;
  1394. },
  1395. // 销售明细 导入按钮
  1396. excelDialogfun(name) {
  1397. if (!this.form.customerId) {
  1398. this.$message.error('请选择客户')
  1399. return
  1400. }
  1401. if (name == '名称') {
  1402. this.findObject(this.excelOption.column, "excelFile").action = '/api/blade-sales-part/order/import-item-name'
  1403. this.templateUrl = '/api/blade-sales-part/order/export-item-name'
  1404. } else if (name == 'code') {
  1405. this.findObject(this.excelOption.column, "excelFile").action = '/api/blade-sales-part/order/import-item-code'
  1406. this.templateUrl = '/api/blade-sales-part/order/export-item-code'
  1407. }
  1408. this.excelBox = true
  1409. },
  1410. //生成退货单
  1411. getReturns() {
  1412. this.$confirm("您确定要退货吗?", {
  1413. confirmButtonText: "确定",
  1414. cancelButtonText: "取消",
  1415. type: "warning"
  1416. }).then(() => {
  1417. this.$router.push({
  1418. path: "/tirePartsMall/salesService/returns/index",
  1419. query: {
  1420. bsType: 'TKXS',
  1421. id: this.form.id,
  1422. }
  1423. });
  1424. })
  1425. },
  1426. // 获取左侧筛选
  1427. getAllWorkDicts() {
  1428. getCorpTypes({ whetherIntegral: '0' }).then(res => {
  1429. this.treeDataGoods = res.data.data;
  1430. });
  1431. },
  1432. //导入页左商品类型查询
  1433. nodeClick(data) {
  1434. this.treeDeptId = data.id;
  1435. this.page.currentPage = 1;
  1436. this.onLoad(this.page, { ...this.SelectSearch, goodsTypeId: this.treeDeptId });
  1437. },
  1438. closeGoods() {
  1439. this.treeDataGoods = [];
  1440. this.treeDeptId = "";
  1441. this.activeNameTabs = "searchList";
  1442. },
  1443. //刷新触发
  1444. refreshChange() {
  1445. this.page.currentPage = 1;
  1446. this.onLoad(this.page);
  1447. },
  1448. // 点击搜索触发
  1449. goodsSearch(params, done) {
  1450. this.page.currentPage = 1;
  1451. params = {
  1452. ...params,
  1453. }
  1454. this.onLoad(this.page, params);
  1455. done()
  1456. },
  1457. rowCell(row) {
  1458. this.$set(row, "$cellEdit", true);
  1459. },
  1460. rowSave(row) {
  1461. this.$set(row, "$cellEdit", false);
  1462. },
  1463. // 标签页切换
  1464. tabHandle(data) {
  1465. if (data.name == 'searchList') {
  1466. this.goodsListShow = this.data;
  1467. this.page.total = this.pageList.total
  1468. } else if (data.name == 'importStaging') {
  1469. this.goodsListShow = this.goodsListSave;
  1470. this.page.total = 0
  1471. }
  1472. },
  1473. // 商品信息价格计算
  1474. amountChange(value, row) {
  1475. if (value > row.inventory) {
  1476. this.$set(row, 'goodsNum', null)
  1477. return this.$message.error("数量不能超过库存数量");
  1478. }
  1479. },
  1480. importStagList(row, index, type) {
  1481. this.goodsListSave.push(row);
  1482. },
  1483. removeStagList(row, index, type) {
  1484. this.goodsListSave.splice(row.$index, 1)
  1485. },
  1486. //确认导入触发
  1487. importGoods() {
  1488. if (this.goodsListSave.length == 0) {
  1489. return this.$message.error("请选择");
  1490. }
  1491. this.goodsListSave.forEach(item => {
  1492. item.goodsNo = item.goodsCode
  1493. item.propertyName = item.specificationAndModel
  1494. item.pattern = item.brandItem
  1495. item.costpriePrice = item.shareCost
  1496. item.rebatePrice = item.costpriePrice
  1497. item.subTotalMoney = Number(item.goodsNum * item.price) ? Number(item.goodsNum * item.price).toFixed(2) : 0,
  1498. delete item.id
  1499. this.form.orderItemsList.push(item)
  1500. })
  1501. this.dialogVisible = false
  1502. },
  1503. //申请退款
  1504. applySettlement(type) {
  1505. this.$confirm("您确定申请退款吗?", {
  1506. confirmButtonText: "确定",
  1507. cancelButtonText: "取消",
  1508. type: "warning"
  1509. }).then(() => {
  1510. this.$refs["form"].validate((valid, done) => {
  1511. done()
  1512. if (valid) {
  1513. const data = {
  1514. id: this.form.id,
  1515. url: '/tirePartsMall/basicData/sharedSales/index',
  1516. pageStatus: "",
  1517. pageLabel: "共享销售",
  1518. }
  1519. const loading = this.$loading({
  1520. lock: true,
  1521. text: '加载中',
  1522. spinner: 'el-icon-loading',
  1523. background: 'rgba(255,255,255,0.7)'
  1524. });
  1525. checkOrder({ ...data }).then((res) => {
  1526. this.getDetail(res.data.data.id)
  1527. this.$message.success('申请退款成功');
  1528. }).finally(() => {
  1529. loading.close();
  1530. });
  1531. }
  1532. })
  1533. })
  1534. },
  1535. //撤销请核
  1536. revocationRequest() {
  1537. this.$confirm("您确定撤回此次申请吗?", {
  1538. confirmButtonText: "确定",
  1539. cancelButtonText: "取消",
  1540. type: "warning"
  1541. }).then(() => {
  1542. const loading = this.$loading({
  1543. lock: true,
  1544. text: '加载中',
  1545. spinner: 'el-icon-loading',
  1546. background: 'rgba(255,255,255,0.7)'
  1547. });
  1548. revokeCheckOrder({ ...this.form }).then(res => {
  1549. this.getDetail(res.data.data.id)
  1550. this.$message.success('撤回成功')
  1551. loading.close();
  1552. })
  1553. })
  1554. },
  1555. //导入商品弹窗列表查询
  1556. onLoad(page, params = {}) {
  1557. this.loading = true;
  1558. goodsPageXs({
  1559. current: page.currentPage,
  1560. size: page.pageSize,
  1561. ...Object.assign(params, this.SelectSearch)
  1562. }).then(res => {
  1563. res.data.data.records.forEach(e => {
  1564. e.price = e.priceOne
  1565. e.goodsNum = 0
  1566. })
  1567. this.goodsListShow = res.data.data.records
  1568. this.page.total = res.data.data.total;
  1569. this.data = res.data.data.records
  1570. this.pageList.total = res.data.data.total;
  1571. this.loading = false;
  1572. })
  1573. },
  1574. //修改提交触发
  1575. editCustomer() {
  1576. this.$refs["form"].validate((valid, done) => {
  1577. done();
  1578. let picihao = false
  1579. if (valid) {
  1580. const loading = this.$loading({
  1581. lock: true,
  1582. text: '加载中',
  1583. spinner: 'el-icon-loading',
  1584. background: 'rgba(255,255,255,0.7)'
  1585. });
  1586. submit({
  1587. bsType: "GX",
  1588. ...this.form
  1589. }).then(res => {
  1590. this.getDetail(res.data.data.id)
  1591. this.$message.success("保存成功");
  1592. }).finally(() => {
  1593. loading.close();
  1594. });
  1595. } else {
  1596. return false;
  1597. }
  1598. });
  1599. },
  1600. getDetail(id, type) {
  1601. const loading = this.$loading({
  1602. lock: true,
  1603. text: '加载中',
  1604. spinner: 'el-icon-loading',
  1605. background: 'rgba(255,255,255,0.7)'
  1606. })
  1607. getDetails({ id: id }).then(res => {
  1608. this.form = res.data.data
  1609. if (res.data.data.status == '已发货') {
  1610. this.optionForm.disabled = true
  1611. }
  1612. if (res.data.data.goodsTotalShipNum > 0) {
  1613. this.optionForm.disabled = true
  1614. }
  1615. if (type == '撤销派发') {
  1616. if (res.data.data.goodsTotalShipNum == 0) {
  1617. this.optionForm.disabled = false
  1618. }
  1619. }
  1620. }).finally(() => {
  1621. loading.close();
  1622. })
  1623. },
  1624. rowDelBox(row, index, type) {
  1625. this.$confirm("确定将选择数据删除?", {
  1626. confirmButtonText: "确定",
  1627. cancelButtonText: "取消",
  1628. type: "warning"
  1629. }).then(() => {
  1630. if (row.id) {
  1631. delOrderItem({ ids: row.id }).then(res => {
  1632. this.form.orderItemsList.splice(index, 1);
  1633. this.$message.success("操作成功!");
  1634. });
  1635. } else {
  1636. this.form[type].splice(index, 1);
  1637. this.$message.success("操作成功!");
  1638. }
  1639. }
  1640. );
  1641. },
  1642. // 明细信息多选
  1643. selectionChange(list) {
  1644. this.selectionMultilist = list
  1645. },
  1646. // 一键删除
  1647. batchDelete() {
  1648. if (this.selectionMultilist.length == 0) {
  1649. return this.$message.warning('请选择要删除的数据')
  1650. }
  1651. for (let item of this.selectionMultilist) {
  1652. if (item.sendNum != 0) {
  1653. return this.$message.error("已派发,不能删除");
  1654. }
  1655. }
  1656. this.$confirm("确定将选择数据删除?", {
  1657. confirmButtonText: "确定",
  1658. cancelButtonText: "取消",
  1659. type: "warning"
  1660. }).then(() => {
  1661. let multiList = this.selectionMultilist
  1662. let arr = this.form.orderItemsList
  1663. // 获取有id 的数据
  1664. const itemsWithId = multiList.filter(item => item.hasOwnProperty('id'));
  1665. let arrIds = itemsWithId.map(item => item.id) // 获取id 数据
  1666. // 把选中的删除掉
  1667. multiList.forEach((item) => {
  1668. for (let index in arr) {
  1669. if (JSON.stringify(item) == JSON.stringify(arr[index])) {
  1670. arr.splice(Number(index), 1)
  1671. }
  1672. }
  1673. })
  1674. // 有id 的处理
  1675. if (itemsWithId.length != 0) {
  1676. delOrderItem({ ids: arrIds.join(',') }).then(res => {
  1677. this.$message.success("操作成功!");
  1678. });
  1679. }
  1680. })
  1681. },
  1682. // 新增商品
  1683. rowAdd(row, type) {
  1684. if (!this.form.customerId) {
  1685. this.$message.error('请选择客户')
  1686. return
  1687. }
  1688. this.findObject(this.optionContactsBack.column, 'goodsId').dicUrl = `/api/blade-sales-part/goodsDesc/goodsListXs?cname={{key}}&customId=${this.dicUrlWithCustomId}&enableOrNot=1&stock=${this.form.storageId}`
  1689. this.optionContactsBack.column.forEach(its => {
  1690. if (its.prop == 'goodsId' || its.prop == 'goodsNum' || its.prop == 'price' || its.prop == 'dot' || its.prop == 'remarks') {
  1691. its.disabled = false
  1692. } else {
  1693. its.disabled = true
  1694. }
  1695. })
  1696. this.getAllWorkDicts()
  1697. this.goodsListSave = []
  1698. setTimeout(res => {
  1699. this.refreshChange()
  1700. this.dialogVisible = true
  1701. }, 300)
  1702. // this.$refs.formContacts.rowAdd()
  1703. },
  1704. //打印
  1705. handlePrint() {
  1706. this.switchDialog = !this.switchDialog;
  1707. },
  1708. onClose(val) {
  1709. this.switchDialog = val;
  1710. },
  1711. //自定义列保存
  1712. async saveColumnTwo(ref, option, optionBack, code) {
  1713. /**
  1714. * 已定义全局方法,直接使用,saveColumnData保存列数据方法,参数传值(表格名称,当前表格的option数据)
  1715. * 已定义全局方法,直接使用,getColumnName方法用来获取枚举值,参数根据自己定义的code值获取中文名
  1716. * 一定要执行异步操作,要等接口成功返回,才能执行下一行代码
  1717. */
  1718. const inSave = await this.saveColumnData(this.getColumnName(code), this[option]);
  1719. isProcurement({ "param": "whether.model" }).then(res => {
  1720. if (res.data.data == 1) {
  1721. this.findObject(this.optionContacts.column, "pattern").label = '规格型号1'
  1722. this.findObject(this.optionContacts.column, "rebatePrice").hide = true
  1723. this.findObject(this.optionContacts.column, "rebateCostprie").hide = true
  1724. this.findObject(this.optionContacts.column, "rebateProfit").hide = true
  1725. this.findObject(this.optionContacts.column, "rebatePrice").showColumn = true
  1726. this.findObject(this.optionContacts.column, "rebateCostprie").showColumn = true
  1727. this.findObject(this.optionContacts.column, "rebateProfit").showColumn = true
  1728. }
  1729. })
  1730. if (inSave) {
  1731. this.$message.success("保存成功");
  1732. //关闭窗口
  1733. this.$refs[ref].$refs.dialogColumn.columnBox = false;
  1734. }
  1735. },
  1736. //自定义列重置
  1737. async resetColumnTwo(ref, option, optionBack, code) {
  1738. this[option] = this[optionBack];
  1739. isProcurement({ "param": "whether.model" }).then(res => {
  1740. if (res.data.data == 1) {
  1741. this.findObject(this.optionContacts.column, "pattern").label = '规格型号1'
  1742. this.findObject(this.optionContacts.column, "rebatePrice").hide = true
  1743. this.findObject(this.optionContacts.column, "rebateCostprie").hide = true
  1744. this.findObject(this.optionContacts.column, "rebateProfit").hide = true
  1745. this.findObject(this.optionContacts.column, "rebatePrice").showColumn = true
  1746. this.findObject(this.optionContacts.column, "rebateCostprie").showColumn = true
  1747. this.findObject(this.optionContacts.column, "rebateProfit").showColumn = true
  1748. }
  1749. })
  1750. const inSave = await this.delColumnData(this.getColumnName(code), this[optionBack]);
  1751. if (inSave) {
  1752. this.$message.success("重置成功");
  1753. this.$refs[ref].$refs.dialogColumn.columnBox = false;
  1754. }
  1755. },
  1756. goBack(type) {
  1757. this.$emit("goBack", type);
  1758. },
  1759. // 弹框的重置
  1760. resetCrud() {
  1761. this.$message.success("重置成功");
  1762. },
  1763. // 弹窗的保存
  1764. saveCrud() {
  1765. this.$message.success("保存成功");
  1766. }
  1767. }
  1768. }
  1769. </script>
  1770. <style lang="scss" scoped>
  1771. ::v-deep .el-form-item {
  1772. margin-bottom: 8px !important;
  1773. }
  1774. </style>