detailsPage.vue 67 KB

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