pickup_form.vue 41 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269
  1. <template>
  2. <div class="detail-container">
  3. <el-page-header :content="listItem ? (flag ? '详情' : '编辑') : '新增'" @back="goBack" />
  4. <el-divider />
  5. <div>
  6. <el-form
  7. ref="mainForm"
  8. :model="mainForm"
  9. :rules="mainFormRules"
  10. label-width="80px"
  11. size="small"
  12. label-position="left"
  13. >
  14. <el-row :gutter="20">
  15. <el-col :xs="24" :sm="12" :lg="8">
  16. <el-form-item label="选择仓库" prop="warehouse">
  17. <el-select
  18. v-model="mainForm.warehouse"
  19. placeholder="请选择仓库"
  20. style="width: 100%"
  21. :disabled="!!listItem"
  22. >
  23. <el-option
  24. v-for="(item, index) in warehouseList"
  25. :key="index"
  26. :label="item.name"
  27. :value="item.id"
  28. />
  29. </el-select>
  30. </el-form-item>
  31. </el-col>
  32. <el-col :xs="24" :sm="12" :lg="8">
  33. <el-button size="small" type="primary" :disabled="!!listItem" @click="getDeliverList">确定</el-button>
  34. </el-col>
  35. </el-row>
  36. <el-row :gutter="20">
  37. <el-col :xs="24" :sm="12" :lg="8" style="height: 51px">
  38. <el-form-item label="预约日期" prop="date">
  39. <el-date-picker
  40. v-model="mainForm.date"
  41. :disabled="flag"
  42. type="date"
  43. value-format="yyyy-MM-dd"
  44. style="width: 100%"
  45. :picker-options="setDisabled"
  46. placeholder="选择日期"
  47. />
  48. </el-form-item>
  49. </el-col>
  50. <el-col :xs="24" :sm="12" :lg="12" style="height: 51px">
  51. <el-form-item label="预约时段" prop="timeSlot">
  52. <el-radio-group v-model="mainForm.timeSlot" :disabled="flag">
  53. <el-radio :label="1">上午</el-radio>
  54. <el-radio :label="2">下午</el-radio>
  55. </el-radio-group>
  56. </el-form-item>
  57. </el-col>
  58. </el-row>
  59. <el-row :gutter="20">
  60. <el-col :xs="24" :sm="12" :lg="8">
  61. <el-form-item label="提货方式" prop="pickupWay">
  62. <el-radio-group v-model="mainForm.pickupWay" :disabled="flag">
  63. <el-radio
  64. v-for="(item, index) in pickupWayList"
  65. :key="index"
  66. :label="item.dictCode"
  67. :disabled="item.disabled"
  68. >{{ item.dictValue }}
  69. </el-radio>
  70. </el-radio-group>
  71. </el-form-item>
  72. </el-col>
  73. <el-col :xs="24" :sm="12" :lg="8">
  74. <el-form-item v-if="mainForm.pickupWay == '1'" label="提货人" prop="pickupMan">
  75. <el-select v-model="mainForm.pickupMan" placeholder="全部" :disabled="flag" style="width: 100%">
  76. <el-option
  77. v-for="(item, index) in pickupManList"
  78. :key="index"
  79. :label="item.takerName"
  80. :value="item.id"
  81. />
  82. </el-select>
  83. </el-form-item>
  84. </el-col>
  85. <el-col v-if="mainForm.pickupWay == '1'" :xs="24" :sm="12" :lg="8">
  86. <el-form-item label="提货车辆" prop="pickupCar">
  87. <el-select v-model="mainForm.pickupCar" placeholder="全部" style="width: 100%" :disabled="flag">
  88. <el-option
  89. v-for="(item, index) in pickupCarList"
  90. :key="index"
  91. :label="item.carBrand"
  92. :value="item.id"
  93. />
  94. </el-select>
  95. </el-form-item>
  96. </el-col>
  97. <template v-if="mainForm.pickupWay == '2'">
  98. <el-col :xs="24" :sm="12" :lg="8">
  99. <el-form-item label="物流公司" prop="company">
  100. <el-select
  101. v-model="mainForm.logisticsId"
  102. placeholder="全部"
  103. style="width: 100%"
  104. :disabled="flag"
  105. @change="getLogisticsId"
  106. >
  107. <el-option
  108. v-for="(item, index) in companyList"
  109. :key="index"
  110. :label="item.logisticsCompany"
  111. :value="item.id"
  112. />
  113. </el-select>
  114. </el-form-item>
  115. </el-col>
  116. <el-col class="pd-lr" :span="16">
  117. <el-col :xs="24" :sm="12" :lg="12">
  118. <el-form-item label="是否上楼" prop="isUp">
  119. <el-radio-group v-model="mainForm.isUp" :disabled="flag">
  120. <el-radio label="YES"> 是 </el-radio>
  121. <el-radio label="NO"> 否 </el-radio>
  122. </el-radio-group>
  123. </el-form-item>
  124. </el-col>
  125. <el-col :xs="24" :sm="12" :lg="12">
  126. <el-form-item label="是否卸货" prop="isDischarge">
  127. <el-radio-group v-model="mainForm.isDischarge" :disabled="flag">
  128. <el-radio label="YES"> 是 </el-radio>
  129. <el-radio label="NO"> 否 </el-radio>
  130. </el-radio-group>
  131. </el-form-item>
  132. </el-col>
  133. </el-col>
  134. </template>
  135. <el-col :xs="24" :sm="12" :lg="8">
  136. <el-form-item label="备注" prop="remark">
  137. <el-input v-model="mainForm.remark" placeholder="请输入备注" :disabled="flag" />
  138. </el-form-item>
  139. </el-col>
  140. </el-row>
  141. <!-- <el-row :gutter="20">-->
  142. <!-- <template v-if="logisticsNumber === '001'">-->
  143. <!-- <el-col :xs="24" :sm="8" :lg="8">-->
  144. <!-- <el-form-item label="收货客户" :prop="logisticsNumber === '001' ? 'receivingName' : ''">-->
  145. <!-- <el-input v-model="mainForm.receivingName" :disabled="flag" placeholder="请输入收货客户"></el-input>-->
  146. <!-- </el-form-item>-->
  147. <!-- </el-col>-->
  148. <!-- <el-col :xs="24" :sm="8" :lg="8">-->
  149. <!-- <el-form-item label="电话" :prop="logisticsNumber === '001' ? 'phone' : ''">-->
  150. <!-- <el-input v-model="mainForm.phone" :disabled="flag" placeholder="请输入电话"></el-input>-->
  151. <!-- </el-form-item>-->
  152. <!-- </el-col>-->
  153. <!-- <el-col :xs="24" :sm="8" :lg="8">-->
  154. <!-- <el-form-item label="收货地址" :prop="logisticsNumber === '001' ? 'address' : ''">-->
  155. <!-- <el-input v-model="mainForm.address" :disabled="flag" placeholder="请输入收货地址"></el-input>-->
  156. <!-- </el-form-item>-->
  157. <!-- </el-col>-->
  158. <!-- </template>-->
  159. <!-- <el-col :xs="24" :sm="24" :lg="24">-->
  160. <!-- <el-form-item label="备注内容" prop="remark">-->
  161. <!-- <el-input v-model="mainForm.remark" :disabled="flag" placeholder="请输入备注内容"></el-input>-->
  162. <!-- </el-form-item>-->
  163. <!-- </el-col>-->
  164. <!-- </el-row>-->
  165. </el-form>
  166. </div>
  167. <div class="mymain-container">
  168. <div class="table">
  169. <el-table
  170. ref="table"
  171. v-loading="listLoading"
  172. :data="deliverList"
  173. element-loading-text="Loading"
  174. border
  175. fit
  176. highlight-current-row
  177. stripe
  178. @select="handleSelect"
  179. @select-all="handleSelectAll"
  180. >
  181. <el-table-column align="center" type="selection" width="55" />
  182. <template v-if="logisticsNumber === '001' && mainForm.pickupWay == 2">
  183. <el-table-column align="left" label="仓库" prop="invoiceId" min-width="160" show-overflow-tooltip>
  184. <template v-slot="{ row }">
  185. <el-select
  186. v-model="row.warehouseFlag"
  187. value-key=""
  188. placeholder=""
  189. :disabled="flag"
  190. filterable
  191. size="mini"
  192. @change="storeChange($event, row)"
  193. >
  194. <el-option v-for="item in storeList" :key="item.value" :label="item.label" :value="item.value" />
  195. </el-select>
  196. </template>
  197. </el-table-column>
  198. <el-table-column align="left" label="收货客户" prop="orderTime" min-width="100" show-overflow-tooltip>
  199. <template slot-scope="scope">
  200. <el-input
  201. v-if="!(scope.row.orderType === 'TRADE' || scope.row.orderType === 'HOME')"
  202. v-model="scope.row.receivingName"
  203. :disabled="flag || scope.row.warehouseFlag == 0 || scope.row.warehouseFlag == null"
  204. size="mini"
  205. @input="handleInput($event, scope.row.invoiceId, 1)"
  206. />
  207. <template v-else>
  208. <template v-if="listItem">
  209. <el-input
  210. v-model="scope.row.receivingName"
  211. :disabled="flag || scope.row.warehouseFlag == 0 || scope.row.warehouseFlag == null"
  212. size="mini"
  213. />
  214. </template>
  215. <template v-else>
  216. <el-input
  217. v-model="scope.row.refLinkman"
  218. :disabled="flag || scope.row.warehouseFlag == 0 || scope.row.warehouseFlag == null"
  219. size="mini"
  220. />
  221. </template>
  222. </template>
  223. </template>
  224. </el-table-column>
  225. <el-table-column align="left" label="电话" prop="orderTime" min-width="150" show-overflow-tooltip>
  226. <template slot-scope="scope">
  227. <el-input
  228. v-if="!(scope.row.orderType === 'TRADE' || scope.row.orderType === 'HOME')"
  229. v-model="scope.row.phone"
  230. :disabled="flag || scope.row.warehouseFlag == 0 || scope.row.warehouseFlag == null"
  231. size="mini"
  232. @input="handleInput($event, scope.row.invoiceId, 2)"
  233. />
  234. <template v-else>
  235. <template v-if="listItem">
  236. <el-input
  237. v-model="scope.row.phone"
  238. :disabled="flag || scope.row.warehouseFlag == 0 || scope.row.warehouseFlag == null"
  239. size="mini"
  240. />
  241. </template>
  242. <template v-else>
  243. <el-input
  244. v-model="scope.row.refPhone"
  245. :disabled="flag || scope.row.warehouseFlag == 0 || scope.row.warehouseFlag == null"
  246. size="mini"
  247. />
  248. </template>
  249. </template>
  250. </template>
  251. </el-table-column>
  252. <el-table-column align="left" label="收货地址" prop="orderTime" min-width="200" show-overflow-tooltip>
  253. <template slot-scope="scope">
  254. <el-input
  255. v-if="!(scope.row.orderType === 'TRADE' || scope.row.orderType === 'HOME')"
  256. v-model="scope.row.address"
  257. :disabled="flag || scope.row.warehouseFlag == 0 || scope.row.warehouseFlag == null"
  258. size="mini"
  259. @input="handleInput($event, scope.row.invoiceId, 3)"
  260. />
  261. <template v-else>
  262. <template v-if="listItem">
  263. <el-input
  264. v-model="scope.row.address"
  265. :disabled="flag || scope.row.warehouseFlag == 0 || scope.row.warehouseFlag == null"
  266. size="mini"
  267. />
  268. </template>
  269. <template v-else>
  270. <el-input
  271. v-model="scope.row.refInstallAddress"
  272. :disabled="flag || scope.row.warehouseFlag == 0 || scope.row.warehouseFlag == null"
  273. size="mini"
  274. />
  275. </template>
  276. </template>
  277. </template>
  278. </el-table-column>
  279. </template>
  280. <el-table-column
  281. align="left"
  282. label="发货申请单"
  283. prop="invoiceId"
  284. min-width="160"
  285. show-overflow-tooltip
  286. />
  287. <el-table-column align="left" label="单据日期" prop="orderTime" min-width="120" show-overflow-tooltip>
  288. <template slot-scope="scope">
  289. {{ scope.row.orderTime | dateToDayFilter }}
  290. </template>
  291. </el-table-column>
  292. <el-table-column align="left" label="销售订单号" min-width="160" show-overflow-tooltip>
  293. <template v-if="scope.row" slot-scope="scope">
  294. <CopyButton
  295. :copy-text="
  296. scope.row.orderType === 'TRADE' ||
  297. scope.row.orderType === 'HOME' ||
  298. scope.row.orderType === 'REQUISITION_TRADE' ||
  299. scope.row.orderType === 'REQUISITION_HOME'
  300. ? scope.row.enginOrderNo
  301. : scope.row.mainOrderId
  302. "
  303. />
  304. <span>{{
  305. (scope.row.orderType === 'TRADE' ||
  306. scope.row.orderType === 'HOME' ||
  307. scope.row.orderType === 'REQUISITION_TRADE' ||
  308. scope.row.orderType === 'REQUISITION_HOME')
  309. ? scope.row.enginOrderNo
  310. : scope.row.mainOrderId
  311. }}</span>
  312. </template>
  313. </el-table-column>
  314. <!-- <el-table-column align="left" label="工程编号" prop="enginOrderNo" min-width="140" show-overflow-tooltip></el-table-column> -->
  315. <el-table-column
  316. align="left"
  317. label="销售类型"
  318. prop="saleTypeName"
  319. min-width="160"
  320. show-overflow-tooltip
  321. />
  322. <el-table-column
  323. align="left"
  324. label="物料编码"
  325. prop="materialCode"
  326. min-width="160"
  327. show-overflow-tooltip
  328. />
  329. <el-table-column
  330. align="left"
  331. label="产品名称"
  332. prop="materialName"
  333. min-width="160"
  334. show-overflow-tooltip
  335. />
  336. <el-table-column
  337. align="left"
  338. label="规格型号"
  339. prop="specification"
  340. min-width="160"
  341. show-overflow-tooltip
  342. />
  343. <el-table-column
  344. align="left"
  345. label="单位"
  346. prop="unit"
  347. min-width="100"
  348. show-overflow-tooltip
  349. />
  350. <el-table-column
  351. align="right"
  352. label="数量"
  353. prop="refundableQty"
  354. min-width="100"
  355. show-overflow-tooltip
  356. />
  357. <el-table-column v-if="flag && mainForm.pickupWay == '2'" fixed="right" label="操作" width="250">
  358. <template slot-scope="scope">
  359. <el-button type="text" size="small" @click="handLogistics(scope.row)">物流信息</el-button>
  360. <el-button type="text" size="small" @click="getListCostBillV2(scope.row)">物流费用</el-button>
  361. <el-button type="text" size="small" @click="getListCodeV2(scope.row)">出库条码</el-button>
  362. </template>
  363. </el-table-column>
  364. </el-table>
  365. </div>
  366. </div>
  367. <div class="page-footer">
  368. <div class="footer" :class="classObj">
  369. <el-button
  370. v-if="!flag"
  371. type="primary"
  372. :loading="formLoading"
  373. @click="clickSubmitForm"
  374. >{{ formLoading ? '提交中 ...' : '提 交' }}
  375. </el-button>
  376. <el-popconfirm v-if="!listItem" title="确定重置吗?" style="margin-left: 10px" @onConfirm="resetForm">
  377. <el-button slot="reference">重 置</el-button>
  378. </el-popconfirm>
  379. </div>
  380. </div>
  381. <el-dialog
  382. title="物流信息"
  383. append-to-body
  384. :visible.sync="visible"
  385. width="60%"
  386. :close-on-click-modal="false"
  387. @close="onClose"
  388. >
  389. <el-timeline v-if="logisticsDetail.length" class="logistics" :reverse="false">
  390. <el-timeline-item
  391. v-for="(item, index) in logisticsDetail"
  392. :key="index"
  393. placement="top"
  394. type="success"
  395. :timestamp="item.time"
  396. >
  397. <el-row :gutter="20">
  398. <el-col class="logistics-title"> {{ item.status }} </el-col>
  399. <el-col>
  400. <div class="flex">
  401. <div>{{ item.context }}</div>
  402. <!-- <div>{{ item.createTime }}</div> -->
  403. </div>
  404. </el-col>
  405. </el-row>
  406. </el-timeline-item>
  407. </el-timeline>
  408. <div v-else class="tip">暂无物流信息</div>
  409. </el-dialog>
  410. <el-dialog
  411. title="物流费用"
  412. append-to-body
  413. :visible.sync="logisticsVisible"
  414. width="60%"
  415. :close-on-click-modal="false"
  416. @close="onClose"
  417. >
  418. <zj-table
  419. :table-attributes="defaultTableAttributes"
  420. :is-drop="true"
  421. :columns="formLogistics"
  422. :table-data="logisticsData"
  423. />
  424. </el-dialog>
  425. <el-dialog
  426. title="出库条码"
  427. append-to-body
  428. :visible.sync="outboundVisible"
  429. width="60%"
  430. :close-on-click-modal="false"
  431. @close="onClose"
  432. >
  433. <zj-table
  434. :table-attributes="defaultTableAttributes"
  435. :is-drop="true"
  436. :columns="formOutbound"
  437. :table-data="outboundData"
  438. />
  439. </el-dialog>
  440. </div>
  441. </template>
  442. <script>
  443. import {
  444. getWarehouseList,
  445. getDeliverList,
  446. getPickupManList,
  447. getPickupCarList,
  448. getCompanyList,
  449. addPickupBook,
  450. editPickupBook,
  451. getDetail,
  452. checkStock,
  453. getListOrderTrack
  454. } from '@/api/supply/pickup'
  455. import { getListCostBillV2 } from '@/api/logisticsBill'
  456. import { getListCodeV2 } from '@/api/barcode'
  457. import { getDictList } from '@/api/common'
  458. import { mapGetters } from 'vuex'
  459. export default {
  460. name: 'PickupForm',
  461. componentName: 'PickupForm',
  462. props: ['listItem', 'flag'],
  463. data() {
  464. return {
  465. deliverList: null, // 列表数据
  466. listLoading: false, // 列表加载loading
  467. mainForm: {
  468. // 筛选表单数据
  469. warehouse: '',
  470. date: '',
  471. timeSlot: '',
  472. pickupWay: '',
  473. pickupMan: '',
  474. pickupCar: '',
  475. company: '',
  476. remark: '',
  477. logisticsId: '',
  478. receivingName: '',
  479. phone: '',
  480. address: '',
  481. isUp: 'NO',
  482. isDischarge: 'NO'
  483. },
  484. mainFormRules: {
  485. date: [{ required: true, message: '请选择预约日期', trigger: 'change' }],
  486. timeSlot: [{ required: true, message: '请选择预约时段', trigger: 'change' }],
  487. pickupWay: [{ required: true, message: '请选择提货方式', trigger: 'change' }],
  488. pickupMan: [{ required: true, message: '请选择提货人', trigger: 'change' }],
  489. company: [{ required: true, message: '请选择物流公司', trigger: 'change' }]
  490. // receivingName: [{ required: true, message: '请填写收货客户', trigger: 'change' }],
  491. // phone: [{ required: true, message: '请填写电话', trigger: 'change' }]
  492. // address: [{ required: true, message: '请填写收货地址', trigger: 'change' }]
  493. },
  494. formLoading: false,
  495. tableSelection: [],
  496. warehouseList: [],
  497. pickupWayList: [],
  498. pickupManList: [],
  499. pickupCarList: [],
  500. companyList: [],
  501. defaultTableAttributes: {
  502. border: true,
  503. headerCellClassName: 'headerRowColor',
  504. size: 'mini',
  505. 'summary-method': this.$getSummaries,
  506. 'show-summary': true
  507. },
  508. logisticsNumber: '',
  509. storeList: [
  510. {
  511. label: '前置仓',
  512. value: 0
  513. },
  514. {
  515. label: '工程机',
  516. value: 1
  517. },
  518. {
  519. label: '商家仓',
  520. value: 2
  521. }
  522. ],
  523. setDisabled: {
  524. disabledDate: time => {
  525. return time.getTime() < new Date() - 24 * 3600 * 1000
  526. }
  527. },
  528. visible: false,
  529. logisticsVisible: false,
  530. outboundVisible: false,
  531. orderId: '',
  532. logisticsDetail: [],
  533. frontPickType: null,
  534. isFront: null,
  535. isPick: null,
  536. isPickUpGoods: false,
  537. logisticsData: [],
  538. outboundData: []
  539. }
  540. },
  541. computed: {
  542. sidebar() {
  543. return this.$store.state.app.sidebar
  544. },
  545. classObj() {
  546. return {
  547. hideSidebar: !this.sidebar.opened,
  548. openSidebar: this.sidebar.opened
  549. }
  550. },
  551. ...mapGetters(['userInfo']),
  552. formLogistics() {
  553. return [
  554. {
  555. columnAttributes: {
  556. label: '序号',
  557. prop: 'materialName',
  558. type: 'index'
  559. }
  560. },
  561. {
  562. columnAttributes: {
  563. label: '结算状态',
  564. prop: 'materialName'
  565. }
  566. },
  567. {
  568. columnAttributes: {
  569. label: '调拨单号',
  570. prop: 'materialName'
  571. }
  572. },
  573. {
  574. columnAttributes: {
  575. label: '嘉贤单据号',
  576. prop: 'materialName'
  577. }
  578. },
  579. {
  580. columnAttributes: {
  581. label: '存货编码',
  582. prop: 'materialName'
  583. }
  584. },
  585. {
  586. columnAttributes: {
  587. label: '物料代码',
  588. prop: 'materialName'
  589. }
  590. },
  591. {
  592. columnAttributes: {
  593. label: '产品名称',
  594. prop: 'materialName'
  595. }
  596. },
  597. {
  598. columnAttributes: {
  599. label: '规格型号',
  600. prop: 'materialName'
  601. }
  602. },
  603. {
  604. columnAttributes: {
  605. label: '单价',
  606. prop: 'materialName'
  607. }
  608. },
  609. {
  610. columnAttributes: {
  611. label: '数量',
  612. prop: 'materialName'
  613. }
  614. },
  615. {
  616. columnAttributes: {
  617. label: '物流费用',
  618. prop: 'materialName'
  619. }
  620. },
  621. {
  622. columnAttributes: {
  623. label: '仓储费用',
  624. prop: 'materialName'
  625. }
  626. },
  627. {
  628. columnAttributes: {
  629. label: '合计费用',
  630. prop: 'materialName'
  631. }
  632. },
  633. {
  634. columnAttributes: {
  635. label: '对账人',
  636. prop: 'materialName'
  637. }
  638. },
  639. {
  640. columnAttributes: {
  641. label: '对账日期',
  642. prop: 'materialName'
  643. }
  644. },
  645. {
  646. columnAttributes: {
  647. label: '结算人',
  648. prop: 'materialName'
  649. }
  650. },
  651. {
  652. columnAttributes: {
  653. label: '结算日期',
  654. prop: 'materialName'
  655. }
  656. }
  657. ]
  658. },
  659. formOutbound() {
  660. return [
  661. {
  662. columnAttributes: {
  663. label: '序号',
  664. prop: 'materialName',
  665. type: 'index'
  666. }
  667. },
  668. {
  669. columnAttributes: {
  670. label: '条码状态',
  671. prop: 'materialName'
  672. }
  673. },
  674. {
  675. columnAttributes: {
  676. label: '签收状态',
  677. prop: 'materialName'
  678. }
  679. },
  680. {
  681. columnAttributes: {
  682. label: '上墙状态',
  683. prop: 'materialName'
  684. }
  685. },
  686. {
  687. columnAttributes: {
  688. label: '物料代码',
  689. prop: 'materialName'
  690. }
  691. },
  692. {
  693. columnAttributes: {
  694. label: '产品名称',
  695. prop: 'materialName'
  696. }
  697. },
  698. {
  699. columnAttributes: {
  700. label: '规格型号',
  701. prop: 'materialName'
  702. }
  703. },
  704. {
  705. columnAttributes: {
  706. label: '内外机',
  707. prop: 'materialName'
  708. }
  709. },
  710. {
  711. columnAttributes: {
  712. label: '物料条码',
  713. prop: 'materialName'
  714. }
  715. },
  716. {
  717. columnAttributes: {
  718. label: '出库条形码',
  719. prop: 'materialName'
  720. }
  721. },
  722. {
  723. columnAttributes: {
  724. label: '签收日期',
  725. prop: 'materialName'
  726. }
  727. },
  728. {
  729. columnAttributes: {
  730. label: '上增日期',
  731. prop: 'materialName'
  732. }
  733. }
  734. ]
  735. }
  736. },
  737. created() {
  738. this.getWarehouseList()
  739. this.getPickupWayList()
  740. this.getPickupManList()
  741. this.getPickupCarList()
  742. this.getCompanyList()
  743. if (this.listItem) {
  744. this.getDetail()
  745. }
  746. },
  747. methods: {
  748. // 查询按钮权限
  749. checkBtnRole(value) {
  750. // let btnRole = this.$route.meta.roles;
  751. // if(!btnRole) {return true}
  752. // let index = btnRole.indexOf(value);
  753. // return index >= 0;
  754. return true
  755. },
  756. // 返回列表
  757. goBack() {
  758. this.$emit('backListFormDetail')
  759. },
  760. storeChange(e, row) {
  761. console.log(e, row)
  762. this.deliverList.forEach(item => {
  763. if (item.invoiceId === row.invoiceId) {
  764. this.$set(item, 'warehouseFlag', e)
  765. if (e == 0) {
  766. if (!(item.orderType === 'TRADE' || item.orderType === 'HOME')) {
  767. if (item.receivingName && item.phone && item.address) {
  768. item.copyReceivingName = item.receivingName
  769. item.copyPhone = item.phone
  770. item.copyAddress = item.address
  771. item.receivingName = ''
  772. item.phone = ''
  773. item.address = ''
  774. }
  775. } else {
  776. if (item.refLinkman && item.refPhone && item.refInstallAddress) {
  777. item.copyRefLinkman = item.refLinkman
  778. item.copyRefPhone = item.refPhone
  779. item.copyRefInstallAddress = item.refInstallAddress
  780. item.refLinkman = ''
  781. item.refPhone = ''
  782. item.refInstallAddress = ''
  783. }
  784. }
  785. }
  786. if (e == 1) {
  787. item.refLinkman = item.copyRefLinkman || item.copyReceivingName || item.refLinkman
  788. item.refPhone = item.copyRefPhone || item.copyPhone || item.refPhone
  789. item.refInstallAddress = item.copyRefInstallAddress || item.copyAddress || item.refInstallAddress
  790. }
  791. if (e == 2) {
  792. item.receivingName = item.copyReceivingName
  793. item.phone = item.copyPhone
  794. item.address = item.copyAddress
  795. }
  796. }
  797. })
  798. },
  799. handleInput(e, id, type) {
  800. console.log(e)
  801. this.deliverList.forEach(k => {
  802. if (k.invoiceId === id) {
  803. switch (type) {
  804. case 1:
  805. k.receivingName = e
  806. break
  807. case 2:
  808. k.phone = e
  809. break
  810. default:
  811. k.address = e
  812. }
  813. }
  814. })
  815. },
  816. // 获取详情
  817. getDetail() {
  818. getDetail({ id: this.listItem.id }).then(res => {
  819. const data = res.data
  820. this.mainForm.warehouse = data.correspondId
  821. this.mainForm.date = data.pickTime.slice(0, 10)
  822. this.mainForm.timeSlot = Number(data.pickStatus)
  823. this.mainForm.pickupWay = String(data.pickType)
  824. this.mainForm.pickupMan = data.takerId
  825. this.mainForm.pickupCar = data.takerCarId
  826. this.mainForm.company = data.pickLogistics
  827. this.mainForm.remark = data.remark
  828. this.mainForm.logisticsId = data.logisticsId
  829. this.mainForm.isUp = data.isUp
  830. this.mainForm.isDischarge = data.isDischarge
  831. if (this.mainForm.pickupWay == 2) {
  832. const item = this.companyList.find(k => k.id === data.logisticsId)
  833. this.logisticsNumber = item.logisticsNumber
  834. }
  835. data.invoicePickBeans.forEach(k => {
  836. if (k.warehouseFlag == 0) {
  837. if (!(k.orderType === 'TRADE' || k.orderType === 'HOME')) {
  838. if (k.receivingName && k.phone && k.address) {
  839. k.copyReceivingName = k.receivingName
  840. k.copyPhone = k.phone
  841. k.copyAddress = k.address
  842. k.receivingName = ''
  843. k.phone = ''
  844. k.address = ''
  845. }
  846. } else {
  847. if (k.refLinkman && k.refPhone && k.refInstallAddress) {
  848. k.copyRefLinkman = k.refLinkman
  849. k.copyRefPhone = k.refPhone
  850. k.copyRefInstallAddress = k.refInstallAddress
  851. k.refLinkman = ''
  852. k.refPhone = ''
  853. k.refInstallAddress = ''
  854. }
  855. }
  856. }
  857. })
  858. this.deliverList = data.invoicePickBeans
  859. })
  860. },
  861. // 获取仓库列表
  862. getWarehouseList() {
  863. getWarehouseList({
  864. pageNum: 1,
  865. pageSize: -1
  866. }).then(res => {
  867. this.warehouseList = res.data.records
  868. })
  869. },
  870. // 获取提货方式列表
  871. getPickupWayList() {
  872. getDictList({ sysDictEnum: 'PICK' }).then(res => {
  873. console.log(this.userInfo)
  874. this.frontPickType = this.userInfo.frontPickType
  875. this.isFront = this.userInfo.isFront
  876. this.isPick = this.userInfo.isPick
  877. res.data.forEach(k => {
  878. if (this.frontPickType) {
  879. if (!this.isFront && k.dictCode == 2) {
  880. k.disabled = true
  881. }
  882. if (!this.isPick && k.dictCode == 1) {
  883. k.disabled = true
  884. }
  885. }
  886. })
  887. this.pickupWayList = res.data
  888. // if (this.isFront === true) {
  889. // this.mainForm.pickupWay = '2'
  890. // this.mainForm.logisticsId = '1574563841707114498'
  891. // getCompanyList({
  892. // pageNum: 1,
  893. // pageSize: -1
  894. // }).then(res => {
  895. // this.companyList = res.data.records
  896. // const item = this.companyList.find(k => k.id === this.mainForm.logisticsId)
  897. // this.mainForm.company = item.logisticsCompany
  898. // this.logisticsNumber = item.logisticsNumber
  899. // if (this.logisticsNumber === '001' && this.deliverList && this.deliverList.length) {
  900. // if (!this.listItem) {
  901. // this.deliverList.forEach(k => {
  902. // this.$set(k, 'receivingName', '')
  903. // this.$set(k, 'phone', '')
  904. // this.$set(k, 'address', '')
  905. // })
  906. // }
  907. // }
  908. // })
  909. // } else if (this.isFront === false) {
  910. // this.mainForm.pickupWay = '1'
  911. // }
  912. })
  913. },
  914. // 获取提货人列表
  915. getPickupManList() {
  916. getPickupManList({
  917. pageNum: 1,
  918. pageSize: -1
  919. }).then(res => {
  920. this.pickupManList = res.data.records
  921. })
  922. },
  923. // 获取提货车辆列表
  924. getPickupCarList() {
  925. getPickupCarList({
  926. pageNum: 1,
  927. pageSize: -1
  928. }).then(res => {
  929. this.pickupCarList = res.data.records
  930. })
  931. },
  932. // 获取物流公司列表
  933. getCompanyList() {
  934. getCompanyList({
  935. pageNum: 1,
  936. pageSize: -1
  937. }).then(res => {
  938. this.companyList = res.data.records
  939. console.log(this.companyList)
  940. })
  941. },
  942. getLogisticsId(e) {
  943. console.log(this.companyList)
  944. const item = this.companyList.find(k => k.id === e)
  945. this.mainForm.company = item.logisticsCompany
  946. this.logisticsNumber = item.logisticsNumber
  947. if (this.logisticsNumber === '001' && this.deliverList && this.deliverList.length) {
  948. this.deliverList.forEach(k => {
  949. this.$set(k, 'receivingName', '')
  950. this.$set(k, 'phone', '')
  951. this.$set(k, 'address', '')
  952. })
  953. } else {
  954. if (this.deliverList && !this.deliverList.length) return
  955. this.deliverList.forEach(k => {
  956. delete k.receivingName
  957. delete k.phone
  958. delete k.address
  959. })
  960. }
  961. this.deliverList.forEach(k => {
  962. if (!k.warehouseFlag) {
  963. this.$set(k, 'warehouseFlag', null)
  964. if (this.mainForm.pickupWay == 2 && this.logisticsNumber === '001') {
  965. // 注释默认不选择仓库
  966. // if (k.refLinkman || k.refPhone || k.refInstallAddress) {
  967. // this.$set(k, 'warehouseFlag', 1)
  968. // } else {
  969. // this.$set(k, 'warehouseFlag', 0)
  970. // }
  971. }
  972. }
  973. })
  974. },
  975. // 查询列表
  976. getDeliverList() {
  977. if (!this.mainForm.warehouse) {
  978. return this.$errorMsg('请选择仓库')
  979. }
  980. this.listLoading = true
  981. getDeliverList({ correspondId: this.mainForm.warehouse }).then(res => {
  982. this.deliverList = res.data
  983. this.deliverList.forEach(k => {
  984. this.$set(k, 'warehouseFlag', null)
  985. // 注释默认不选择仓库
  986. // if (this.mainForm.pickupWay == 2 && this.logisticsNumber === '001') {
  987. // if (k.refLinkman || k.refPhone || k.refInstallAddress) {
  988. // this.$set(k, 'warehouseFlag', 1)
  989. // } else {
  990. // this.$set(k, 'warehouseFlag', 0)
  991. // }
  992. // }
  993. })
  994. this.listLoading = false
  995. })
  996. },
  997. handleSelect(selection, row) {
  998. this.$refs.table.toggleRowSelection(row)
  999. this.deliverList.forEach(item => {
  1000. if (item.invoiceId === row.invoiceId) {
  1001. this.$refs.table.toggleRowSelection(item)
  1002. }
  1003. })
  1004. this.tableSelection = this.$refs.table.selection
  1005. // this.tableSelection = this.$refs.table.selection;
  1006. },
  1007. handleSelectAll(selection) {
  1008. this.tableSelection = this.$refs.table.selection
  1009. },
  1010. clickSubmitForm() {
  1011. this.$refs.mainForm.validate(valid => {
  1012. if (valid) {
  1013. if (this.tableSelection.length < 1) {
  1014. return this.$errorMsg('请选择发货申请单')
  1015. }
  1016. if (this.mainForm.pickupWay == 2 && this.logisticsNumber === '001') {
  1017. for (let i = 0; i < this.tableSelection.length; i++) {
  1018. if (this.tableSelection[i].warehouseFlag == null) {
  1019. this.$errorMsg('仓库必选')
  1020. return
  1021. }
  1022. }
  1023. }
  1024. for (let i = 0; i < this.tableSelection.length; i++) {
  1025. if (this.tableSelection[i].warehouseFlag == 2) {
  1026. const el = this.tableSelection[i]
  1027. if (!(el.orderType === 'TRADE' || el.orderType === 'HOME')) {
  1028. if (!(el.receivingName && el.phone && el.address)) {
  1029. return this.$errorMsg('商家仓必须填写收货地址、电话、收货地址')
  1030. }
  1031. } else {
  1032. if (this.listItem) {
  1033. if (!(el.receivingName && el.phone && el.address)) {
  1034. return this.$errorMsg('商家仓必须填写收货地址、电话、收货地址')
  1035. }
  1036. } else {
  1037. if (!(el.refLinkman && el.refPhone && el.refInstallAddress)) {
  1038. return this.$errorMsg('商家仓必须填写收货地址、电话、收货地址')
  1039. }
  1040. }
  1041. }
  1042. }
  1043. }
  1044. const orderList = []
  1045. this.tableSelection.forEach(item => {
  1046. orderList.push(item.invoiceOrderId)
  1047. })
  1048. const params = {
  1049. correspondId: this.mainForm.warehouse,
  1050. pickTime: this.mainForm.date + ' 00:00:00',
  1051. invoiceOrderIds: orderList.join(',')
  1052. }
  1053. checkStock(params).then(res => {
  1054. if (res.data) {
  1055. this.$confirm(res.data, '提示', {
  1056. confirmButtonText: '确定',
  1057. cancelButtonText: '取消',
  1058. type: 'warning'
  1059. })
  1060. .then(() => {
  1061. this.submitForm()
  1062. })
  1063. .catch(() => {})
  1064. } else {
  1065. this.submitForm()
  1066. }
  1067. })
  1068. }
  1069. })
  1070. },
  1071. submitForm() {
  1072. this.formLoading = true
  1073. let takerName
  1074. if (this.mainForm.pickupWay == '1') {
  1075. takerName = this.pickupManList.find(o => o.id == this.mainForm.pickupMan).takerName
  1076. }
  1077. // let correspondName = this.warehouseList.find(o => o.id == this.mainForm.warehouse).name;
  1078. const orderList = []
  1079. this.tableSelection.forEach(item => {
  1080. if (!(item.orderType === 'TRADE' || item.orderType === 'HOME')) {
  1081. } else {
  1082. if (this.listItem) {
  1083. } else {
  1084. if (item.refLinkman && item.refPhone && item.refInstallAddress) {
  1085. item.receivingName = item.refLinkman
  1086. item.phone = item.refPhone
  1087. item.address = item.refInstallAddress
  1088. }
  1089. }
  1090. }
  1091. orderList.push({
  1092. warehouseFlag: item.warehouseFlag,
  1093. address: item.address,
  1094. id: this.listItem ? item.id : '',
  1095. invoiceOrderId: item.invoiceOrderId,
  1096. materialCode: item.materialCode,
  1097. materialId: item.materialId,
  1098. materialName: item.materialName,
  1099. materialOldNumber: item.materialOldNumber,
  1100. phone: item.phone,
  1101. pickActualTime: item.pickActualTime,
  1102. pickId: item.pickId,
  1103. printNum: item.printNum,
  1104. printTime: item.printTime,
  1105. receivingName: item.receivingName,
  1106. status: item.status
  1107. })
  1108. })
  1109. const params = {
  1110. correspondId: this.mainForm.warehouse,
  1111. // correspondName,
  1112. pickTime: this.mainForm.date + ' 00:00:00',
  1113. pickStatus: Number(this.mainForm.timeSlot),
  1114. pickType: Number(this.mainForm.pickupWay),
  1115. takerId: this.mainForm.pickupMan,
  1116. takerName: takerName || '',
  1117. remark: this.mainForm.remark,
  1118. invoiceOrderIds: orderList
  1119. }
  1120. if (this.mainForm.pickupWay == '1') {
  1121. params.takerCarId = this.mainForm.pickupCar
  1122. }
  1123. if (this.mainForm.pickupWay == '2') {
  1124. params.pickLogistics = this.mainForm.company
  1125. params.logisticsId = this.mainForm.logisticsId
  1126. params.isUp = this.mainForm.isUp
  1127. params.isDischarge = this.mainForm.isDischarge
  1128. // params.receivingName = this.mainForm.receivingName
  1129. // params.phone = this.mainForm.phone
  1130. // params.address = this.mainForm.address
  1131. }
  1132. if (this.listItem) {
  1133. params.id = this.listItem.id
  1134. editPickupBook(params)
  1135. .then(res => {
  1136. this.$successMsg('提交成功')
  1137. this.goBack()
  1138. })
  1139. .finally(res => {
  1140. this.formLoading = false
  1141. })
  1142. } else {
  1143. addPickupBook(params)
  1144. .then(res => {
  1145. this.$successMsg('提交成功')
  1146. this.goBack()
  1147. })
  1148. .finally(res => {
  1149. this.formLoading = false
  1150. })
  1151. }
  1152. },
  1153. getListCostBillV2(row) {
  1154. this.logisticsVisible = true
  1155. getListCostBillV2({
  1156. pageNum: 1,
  1157. pageSize: -1,
  1158. params: [
  1159. {
  1160. param: 'order_code',
  1161. compare: '=',
  1162. value: row.invoiceId
  1163. }
  1164. ]
  1165. }).then(res => {
  1166. res.data.records.forEach(item => {
  1167. item.sums1 = ['orderHasSendQty', 'subsidyCoefficient', 'unloadUpstairsCoefficient', 'coefficient']
  1168. item.sums2 = ['cost', 'unitPrice', 'totalCost', 'allowanceCost']
  1169. })
  1170. this.logisticsData = res.data.records
  1171. })
  1172. },
  1173. getListCodeV2(row) {
  1174. this.outboundVisible = true
  1175. getListCodeV2({
  1176. pageNum: 1,
  1177. pageSize: -1,
  1178. params: [
  1179. {
  1180. param: 'order_number',
  1181. compare: '=',
  1182. value: row.invoiceId
  1183. }
  1184. ]
  1185. }).then(res => {
  1186. this.outboundData = res.data.records
  1187. })
  1188. },
  1189. resetForm() {
  1190. this.$refs.mainForm.resetFields()
  1191. // if (this.isFront === true) {
  1192. // this.mainForm.pickupWay = '2'
  1193. // }
  1194. // if (this.isFront === false) {
  1195. // this.mainForm.pickupWay = '1'
  1196. // }
  1197. this.deliverList = []
  1198. },
  1199. handLogistics(row) {
  1200. getListOrderTrack({ orderId: row.invoiceId }).then(res => {
  1201. this.logisticsDetail = res.data
  1202. })
  1203. this.orderId = row.id
  1204. this.visible = true
  1205. },
  1206. onClose() {
  1207. this.logisticsDetail = []
  1208. this.outboundData = []
  1209. this.logisticsData = []
  1210. this.orderId = ''
  1211. this.visible = false
  1212. this.logisticsVisible = false
  1213. this.outboundVisible = false
  1214. }
  1215. }
  1216. }
  1217. </script>
  1218. <style lang="scss" scoped>
  1219. .flex {
  1220. display: flex;
  1221. div {
  1222. flex: 1;
  1223. }
  1224. }
  1225. ::v-deep .el-timeline-item__tail {
  1226. border-left: 2px solid #67c23a;
  1227. }
  1228. ::v-deep .el-form-item__content {
  1229. line-height: 33px;
  1230. }
  1231. .logistics-title {
  1232. padding: 10px;
  1233. }
  1234. .tip {
  1235. height: 200px;
  1236. text-align: center;
  1237. line-height: 200px;
  1238. }
  1239. .pd-lr {
  1240. padding-left: 0 !important;
  1241. padding-right: 0 !important;
  1242. }
  1243. </style>