detailsPage.vue 64 KB

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