commerce_detail.vue 33 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892
  1. <template>
  2. <div class="detail-container">
  3. <div v-show="!isShowCheckOrder">
  4. <el-page-header content="详情" @back="goBack" />
  5. <div id="printData">
  6. <div class="main-title">
  7. <div class="title">
  8. 工程订单 <span style="margin-left: 20px">经销商名称:{{ detailData.customerName }}</span>
  9. </div>
  10. </div>
  11. <div class="diy-table-1">
  12. <el-row>
  13. <el-col :span="8" class="item">
  14. <div class="label">工程订单号</div>
  15. <div class="value">{{ detailData.enginOrderNo }}</div>
  16. </el-col>
  17. <el-col :span="8" class="item">
  18. <div class="label">订单日期</div>
  19. <div class="value">{{ detailData.orderDate }}</div>
  20. </el-col>
  21. <el-col :span="8" class="item">
  22. <div class="label">单据状态</div>
  23. <div class="value">
  24. {{ detailData.examineStatus | statusFilter }}
  25. </div>
  26. </el-col>
  27. <el-col :span="8" class="item">
  28. <div class="label">经销商编码</div>
  29. <div class="value">{{ detailData.customerNumber }}</div>
  30. </el-col>
  31. <el-col :span="8" class="item">
  32. <div class="label">经销商名称</div>
  33. <div class="value">{{ detailData.customerName }}</div>
  34. </el-col>
  35. <el-col :span="8" class="item">
  36. <div class="label">机型类别</div>
  37. <div class="value">{{ detailData.refMachineType }}</div>
  38. </el-col>
  39. <el-col :span="8" class="item">
  40. <div class="label">工程登录编号</div>
  41. <div class="value">{{ detailData.refEnginRecordNo }}</div>
  42. </el-col>
  43. <el-col :span="8" class="item">
  44. <div class="label">项目名称</div>
  45. <div class="value">{{ detailData.refProjectName }}</div>
  46. </el-col>
  47. <el-col :span="8" class="item">
  48. <div class="label">行业类别</div>
  49. <div class="value">{{ detailData.refTradeCategory }}</div>
  50. </el-col>
  51. <el-col :span="8" class="item">
  52. <div class="label">工程编号</div>
  53. <div class="value">{{ detailData.refProjectNo }}</div>
  54. </el-col>
  55. <el-col :span="8" class="item">
  56. <div class="label">跨区厂编号</div>
  57. <div class="value">{{ detailData.refFactoryNo }}</div>
  58. </el-col>
  59. <el-col :span="8" class="item">
  60. <div class="label">使用单位</div>
  61. <div class="value">{{ detailData.refUseUnit }}</div>
  62. </el-col>
  63. <!-- <el-col :span="8" class="item">-->
  64. <!-- <div class="label">销售类型</div>-->
  65. <!-- <div class="value">{{detailData.saleTypeName}}</div>-->
  66. <!-- </el-col>-->
  67. <el-col :span="8" class="item">
  68. <div class="label">联系人</div>
  69. <div class="value">{{ detailData.refLinkman }}</div>
  70. </el-col>
  71. <el-col :span="8" class="item">
  72. <div class="label">固定电话</div>
  73. <div class="value">{{ detailData.refTel }}</div>
  74. </el-col>
  75. <el-col :span="8" class="item">
  76. <div class="label">移动电话</div>
  77. <div class="value">{{ detailData.refPhone }}</div>
  78. </el-col>
  79. <el-col v-if="!isDealer" :span="8" class="item">
  80. <div class="label">权限分类</div>
  81. <div class="value">{{ detailData.refPowerCategory }}</div>
  82. </el-col>
  83. <el-col :span="8" class="item">
  84. <div class="label">工程登录类型</div>
  85. <div class="value">{{ detailData.refPromiseStatus }}</div>
  86. </el-col>
  87. <el-col :span="24" class="item">
  88. <div class="label">安装地址</div>
  89. <div class="value">{{ detailData.refInstallAddress }}</div>
  90. </el-col>
  91. <el-col :span="8" class="item">
  92. <div class="label">不扣押金</div>
  93. <div class="value">
  94. {{ detailData.takeDeposit ? '是' : '否' }}
  95. </div>
  96. </el-col>
  97. <el-col :span="8" class="item">
  98. <div class="label">文件编号</div>
  99. <div class="value">{{ detailData.fileNo }}</div>
  100. </el-col>
  101. <el-col :span="8" class="item">
  102. <div class="label">业务员</div>
  103. <div class="value">{{ detailData.serviceName }}</div>
  104. </el-col>
  105. <el-col :span="24" class="item">
  106. <div class="label">格力回复</div>
  107. <div class="value">{{ detailData.geLiNote }}</div>
  108. </el-col>
  109. <el-col v-if="!isDealer" :span="24" class="item">
  110. <div class="label">格力内部备注</div>
  111. <div class="value">{{ detailData.geLiInerNote }}</div>
  112. </el-col>
  113. <el-col :span="24" class="item">
  114. <div class="label">备注</div>
  115. <div class="value">{{ detailData.remark }}</div>
  116. </el-col>
  117. <el-col :span="6" class="item">
  118. <div class="label">制单人</div>
  119. <div class="value">{{ detailData.createName }}</div>
  120. </el-col>
  121. <el-col :span="6" class="item">
  122. <div class="label">制单日期</div>
  123. <div class="value">{{ detailData.createTime }}</div>
  124. </el-col>
  125. <el-col :span="6" class="item">
  126. <div class="label">审核人</div>
  127. <div class="value">{{ detailData.confirmName }}</div>
  128. </el-col>
  129. <el-col :span="6" class="item">
  130. <div class="label">审核日期</div>
  131. <div class="value">{{ detailData.confirmTime }}</div>
  132. </el-col>
  133. <el-col :span="6" class="item">
  134. <div class="label">最后更新人</div>
  135. <div class="value">{{ detailData.updateName }}</div>
  136. </el-col>
  137. <el-col :span="6" class="item">
  138. <div class="label">最后更新日期</div>
  139. <div class="value">{{ detailData.updateTime }}</div>
  140. </el-col>
  141. <el-col :span="6" class="item">
  142. <div class="label">关闭人</div>
  143. <div class="value">{{ detailData.closeName }}</div>
  144. </el-col>
  145. <el-col :span="6" class="item">
  146. <div class="label">关闭日期</div>
  147. <div class="value">{{ detailData.closeTime }}</div>
  148. </el-col>
  149. <el-col :span="24" class="item">
  150. <div class="label">审批说明</div>
  151. <div class="value">{{ detailData.examineNote }}</div>
  152. </el-col>
  153. <el-col :span="24" class="item">
  154. <div class="label">计划单</div>
  155. <div class="value">
  156. <el-radio-group v-model="detailData.isPlanOrder" disabled>
  157. <el-radio label="true">计划单</el-radio>
  158. <el-radio label="false">非计划单</el-radio>
  159. </el-radio-group>
  160. </div>
  161. </el-col>
  162. </el-row>
  163. </div>
  164. <div class="main-title">
  165. <div class="title">货品信息</div>
  166. </div>
  167. <div class="table" style="margin-top: 20px">
  168. <el-table
  169. :data="detailData.items"
  170. element-loading-text="Loading"
  171. border
  172. fit
  173. highlight-current-row
  174. stripe
  175. max-height="400"
  176. show-summary
  177. :summary-method="$getSummaries"
  178. >
  179. <el-table-column align="center" label="序号" type="index" width="50" />
  180. <el-table-column align="left" label="销售类型" prop="saleTypeName" min-width="100" show-overflow-tooltip />
  181. <el-table-column
  182. align="left"
  183. label="物料编码"
  184. prop="materialNumber"
  185. min-width="120"
  186. show-overflow-tooltip
  187. />
  188. <el-table-column
  189. align="left"
  190. label="产品编码"
  191. prop="materialOldNumber"
  192. min-width="120"
  193. show-overflow-tooltip
  194. />
  195. <el-table-column align="left" label="产品名称" prop="materialName" min-width="160" show-overflow-tooltip />
  196. <el-table-column align="left" label="规格型号" prop="specification" min-width="350" show-overflow-tooltip />
  197. <el-table-column align="left" label="单位" prop="unit" min-width="100" show-overflow-tooltip />
  198. <el-table-column align="right" label="单价" prop="price" min-width="100" show-overflow-tooltip>
  199. <template slot-scope="scope">
  200. {{ scope.row.price | numToFixed }}
  201. </template>
  202. </el-table-column>
  203. <el-table-column align="right" label="工程登录数量" prop="enginNum" min-width="100" show-overflow-tooltip />
  204. <el-table-column align="right" label="数量" prop="qty" min-width="100" show-overflow-tooltip />
  205. <el-table-column align="right" label="订单金额" prop="totalAmount" min-width="100" show-overflow-tooltip>
  206. <template slot-scope="scope">
  207. {{ scope.row.totalAmount | numToFixed }}
  208. </template>
  209. </el-table-column>
  210. <el-table-column
  211. align="left"
  212. label="返利类型"
  213. prop="customerWalletName2"
  214. min-width="100"
  215. show-overflow-tooltip
  216. />
  217. <el-table-column
  218. align="right"
  219. label="实付返利金额"
  220. prop="payRebateAmount"
  221. min-width="100"
  222. show-overflow-tooltip
  223. >
  224. <template slot-scope="scope">
  225. {{ scope.row.payRebateAmount | numToFixed }}
  226. </template>
  227. </el-table-column>
  228. <el-table-column align="right" label="返利比例" min-width="100" prop="rebateRate" show-overflow-tooltip />
  229. <el-table-column align="right" label="格力折扣" prop="discAmount" min-width="100" show-overflow-tooltip>
  230. <template slot-scope="scope">
  231. {{ scope.row.discAmount | numToFixed }}
  232. </template>
  233. </el-table-column>
  234. <el-table-column
  235. align="left"
  236. label="现金钱包"
  237. prop="customerWalletName"
  238. min-width="100"
  239. show-overflow-tooltip
  240. />
  241. <el-table-column align="right" label="实付金额" prop="payAmount" min-width="100" show-overflow-tooltip>
  242. <template slot-scope="scope">
  243. {{ scope.row.payAmount | numToFixed }}
  244. </template>
  245. </el-table-column>
  246. <el-table-column
  247. align="left"
  248. label="是否直调"
  249. prop="isDirectTransfer"
  250. min-width="100"
  251. show-overflow-tooltip
  252. >
  253. <template slot-scope="scope">
  254. {{ scope.row.isDirectTransfer ? '是' : '否' }}
  255. </template>
  256. </el-table-column>
  257. <el-table-column
  258. align="right"
  259. label="直调数量"
  260. prop="directTransferQty"
  261. min-width="100"
  262. show-overflow-tooltip
  263. />
  264. <el-table-column align="right" label="原订单数量" prop="oldQty" min-width="100" show-overflow-tooltip />
  265. <el-table-column align="left" label="备注" prop="remark" min-width="160" show-overflow-tooltip />
  266. <el-table-column align="left" label="税率" prop="tax" min-width="100" show-overflow-tooltip />
  267. <el-table-column align="left" label="仓库" prop="correspondName" min-width="100" show-overflow-tooltip />
  268. <el-table-column align="left" label="业务员" prop="serviceName" min-width="100" show-overflow-tooltip />
  269. </el-table>
  270. </div>
  271. <div v-if="detailData.examineStatus == 'OK'" class="table" style="margin-top: 20px">
  272. <el-table
  273. :data="detailData.refundNoteList"
  274. element-loading-text="Loading"
  275. border
  276. fit
  277. highlight-current-row
  278. stripe
  279. max-height="400"
  280. show-summary
  281. :summary-method="$getSummaries"
  282. >
  283. <el-table-column align="center" label="序号" type="index" width="50" />
  284. <el-table-column align="left" label="创建人" prop="createBy" show-overflow-tooltip />
  285. <el-table-column align="left" label="创建时间" prop="createTime" show-overflow-tooltip />
  286. <el-table-column align="left" label="退订说明" prop="refundNote" show-overflow-tooltip />
  287. </el-table>
  288. </div>
  289. </div>
  290. <div class="page-footer">
  291. <div class="footer">
  292. <el-button type="success" @click="toCheckOrder">联查单据</el-button>
  293. <el-button
  294. v-if="detailData.examineStatus === 'SAVE' || detailData.examineStatus === 'WAIT'"
  295. type="danger"
  296. @click="closeData"
  297. >关闭订单</el-button>
  298. <!-- <el-button type="primary" @click="openDirectDialog" v-if="!isDealer">提前开票</el-button> -->
  299. <template v-if="detailData.isPlanOrder === 'true'">
  300. <el-button
  301. v-if="!isDealer"
  302. type="primary"
  303. :disabled="detailData.directTransferStatus"
  304. @click="overData"
  305. >直调完结</el-button>
  306. <el-button
  307. v-if="!isDealer"
  308. type="primary"
  309. :disabled="detailData.directTransferStatus"
  310. @click="openDeliverDialog"
  311. >直调发货</el-button>
  312. </template>
  313. <el-button @click="goBack">返回列表</el-button>
  314. </div>
  315. </div>
  316. </div>
  317. <el-dialog title="直调发货" append-to-body :visible.sync="isShowDeliverDialog" width="80%">
  318. <el-form
  319. ref="deliverForm"
  320. :model="deliverForm"
  321. :rules="deliverFormRules"
  322. label-width="120px"
  323. size="small"
  324. label-position="left"
  325. >
  326. <el-row :gutter="20">
  327. <!-- <el-col :xs="8" :sm="8" :lg="8" style="height: 51px">-->
  328. <!-- <el-form-item label="发货日期" prop="date">-->
  329. <!-- <el-date-picker-->
  330. <!-- v-model="deliverForm.date"-->
  331. <!-- type="date"-->
  332. <!-- value-format="yyyy-MM-dd"-->
  333. <!-- style="width: 100%"-->
  334. <!-- placeholder="选择日期"-->
  335. <!-- />-->
  336. <!-- </el-form-item>-->
  337. <!-- </el-col>-->
  338. <el-col :xs="8" :sm="8" :lg="8">
  339. <el-form-item label="选择仓位" prop="position">
  340. <el-select v-model="deliverForm.position" placeholder="请选择仓位" style="width: 100%" filterable>
  341. <el-option v-for="item in positionList" :key="item.id" :label="item.name" :value="item.id" />
  342. </el-select>
  343. </el-form-item>
  344. </el-col>
  345. <el-col :xs="8" :sm="8" :lg="8">
  346. <el-form-item label="发货申请备注" prop="remark">
  347. <el-input v-model="deliverForm.remark" placeholder="请输入发货申请备注" clearable />
  348. </el-form-item>
  349. </el-col>
  350. </el-row>
  351. </el-form>
  352. <div class="table" style="margin-top: 20px">
  353. <el-table
  354. :data="deliverGoodsList"
  355. element-loading-text="Loading"
  356. border
  357. fit
  358. highlight-current-row
  359. stripe
  360. max-height="400"
  361. >
  362. <el-table-column align="center" label="序号" type="index" width="50" />
  363. <el-table-column align="center" label="销售类型" prop="saleTypeName" min-width="100" show-overflow-tooltip />
  364. <el-table-column
  365. align="center"
  366. label="物料编码"
  367. prop="materialNumber"
  368. min-width="160"
  369. show-overflow-tooltip
  370. />
  371. <el-table-column align="center" label="产品名称" prop="materialName" min-width="160" show-overflow-tooltip />
  372. <el-table-column align="center" label="规格型号" prop="specification" min-width="160" show-overflow-tooltip />
  373. <el-table-column align="center" label="单位" prop="unit" min-width="100" show-overflow-tooltip />
  374. <el-table-column align="right" label="订单数量" prop="qty" min-width="100" show-overflow-tooltip />
  375. <el-table-column align="right" label="发货数量" prop="hasSendQty" min-width="100" show-overflow-tooltip />
  376. <el-table-column
  377. align="right"
  378. label="直调数量"
  379. prop="directTransferQty"
  380. min-width="100"
  381. show-overflow-tooltip
  382. >
  383. <template slot-scope="scope">
  384. <el-input
  385. v-model="scope.row.realDirectTransferQty"
  386. :disabled="!scope.row.isDirectTransfer"
  387. size="small"
  388. type="number"
  389. @mousewheel.native.prevent
  390. />
  391. </template>
  392. </el-table-column>
  393. <el-table-column align="right" label="单价" prop="price" min-width="100" show-overflow-tooltip>
  394. <template slot-scope="scope">
  395. {{ scope.row.price | numToFixed }}
  396. </template>
  397. </el-table-column>
  398. <el-table-column align="right" label="金额" prop="totalAmount" min-width="100" show-overflow-tooltip>
  399. <template slot-scope="scope">
  400. {{ scope.row.totalAmount | numToFixed }}
  401. </template>
  402. </el-table-column>
  403. <el-table-column align="right" label="返利" prop="payRebateAmount" min-width="100" show-overflow-tooltip>
  404. <template slot-scope="scope">
  405. {{ scope.row.payRebateAmount | numToFixed }}
  406. </template>
  407. </el-table-column>
  408. <el-table-column align="center" label="备注" prop="remark" min-width="160" show-overflow-tooltip />
  409. </el-table>
  410. </div>
  411. <span slot="footer" class="dialog-footer">
  412. <el-button @click="closeDeliverDialog">取 消</el-button>
  413. <el-button type="primary" @click="submitDeliverForm">确 定</el-button>
  414. </span>
  415. </el-dialog>
  416. <el-dialog title="直接调拨单(提前开票)" append-to-body :visible.sync="isShowDirectDialog" width="80%">
  417. <el-form
  418. ref="directForm"
  419. :model="directForm"
  420. :rules="directFormRules"
  421. label-width="80px"
  422. size="small"
  423. label-position="left"
  424. >
  425. <el-row :gutter="20">
  426. <el-col :xs="12" :sm="6" :lg="6">
  427. <el-form-item label="调出仓库" prop="warehouse1">
  428. <el-select
  429. v-model="directForm.warehouse1"
  430. placeholder="请选择调出仓库"
  431. style="width: 100%"
  432. filterable
  433. @change="changeWarehouse1"
  434. >
  435. <el-option v-for="item in warehouseList1" :key="item.id" :label="item.name" :value="item.id" />
  436. </el-select>
  437. </el-form-item>
  438. </el-col>
  439. <el-col :xs="12" :sm="6" :lg="6">
  440. <el-form-item label="调出仓位" prop="position1">
  441. <el-select
  442. v-model="directForm.position1"
  443. placeholder="请调出仓位"
  444. style="width: 100%"
  445. filterable
  446. @change="changePosition1"
  447. >
  448. <el-option v-for="item in positionList1" :key="item.id" :label="item.name" :value="item.id" />
  449. </el-select>
  450. </el-form-item>
  451. </el-col>
  452. <el-col :xs="12" :sm="6" :lg="6">
  453. <el-form-item label="调入仓库" prop="warehouse2">
  454. <el-select
  455. v-model="directForm.warehouse2"
  456. placeholder="请选择调入仓库"
  457. style="width: 100%"
  458. filterable
  459. @change="changeWarehouse2"
  460. >
  461. <el-option v-for="item in warehouseList2" :key="item.id" :label="item.name" :value="item.id" />
  462. </el-select>
  463. </el-form-item>
  464. </el-col>
  465. <el-col :xs="12" :sm="6" :lg="6">
  466. <el-form-item label="调入仓位" prop="position2">
  467. <el-select
  468. v-model="directForm.position2"
  469. placeholder="请调入仓位"
  470. style="width: 100%"
  471. filterable
  472. @change="changePosition2"
  473. >
  474. <el-option v-for="item in positionList2" :key="item.id" :label="item.name" :value="item.id" />
  475. </el-select>
  476. </el-form-item>
  477. </el-col>
  478. </el-row>
  479. </el-form>
  480. <div class="table" style="margin-top: 20px">
  481. <el-table
  482. :data="directGoodsList"
  483. element-loading-text="Loading"
  484. border
  485. fit
  486. highlight-current-row
  487. stripe
  488. max-height="400"
  489. >
  490. <el-table-column align="center" label="序号" type="index" width="50" />
  491. <el-table-column align="center" label="销售类型" prop="saleTypeName" min-width="100" show-overflow-tooltip />
  492. <el-table-column
  493. align="center"
  494. label="产品编码"
  495. prop="materialNumber"
  496. min-width="160"
  497. show-overflow-tooltip
  498. />
  499. <el-table-column
  500. align="center"
  501. label="物料代码"
  502. prop="materialOldNumber"
  503. min-width="160"
  504. show-overflow-tooltip
  505. />
  506. <el-table-column align="center" label="产品名称" prop="materialName" min-width="160" show-overflow-tooltip />
  507. <el-table-column align="center" label="规格型号" prop="specification" min-width="160" show-overflow-tooltip />
  508. <el-table-column align="center" label="单位" prop="unit" min-width="100" show-overflow-tooltip />
  509. <el-table-column align="center" label="数量" prop="qty" min-width="100" show-overflow-tooltip />
  510. <el-table-column align="center" label="调出仓库" prop="warehouse1" min-width="100" show-overflow-tooltip />
  511. <el-table-column align="center" label="调出仓位" prop="position1" min-width="100" show-overflow-tooltip />
  512. <el-table-column align="center" label="调入仓库" prop="warehouse2" min-width="100" show-overflow-tooltip />
  513. <el-table-column align="center" label="调入仓位" prop="position2" min-width="100" show-overflow-tooltip />
  514. <el-table-column align="center" label="调出库存状态" prop="status1" min-width="110" show-overflow-tooltip />
  515. <el-table-column align="center" label="调入库存状态" prop="status2" min-width="110" show-overflow-tooltip />
  516. <el-table-column align="center" label="调出货主" min-width="100" show-overflow-tooltip>
  517. <template slot-scope="">弘格</template>
  518. </el-table-column>
  519. <el-table-column align="center" label="调入货主" min-width="100" show-overflow-tooltip>
  520. <template slot-="scope">弘格</template>
  521. </el-table-column>
  522. <el-table-column align="center" label="备注" prop="remark" min-width="160" show-overflow-tooltip />
  523. </el-table>
  524. </div>
  525. <span slot="footer" class="dialog-footer">
  526. <el-button @click="closeDirectDialog">取 消</el-button>
  527. <el-button type="primary" @click="submitDirectForm">确 定</el-button>
  528. </span>
  529. </el-dialog>
  530. <CheckOrder v-if="isShowCheckOrder" :check-order-id="checkOrderId" @backDetail="backDetail" />
  531. </div>
  532. </template>
  533. <script>
  534. import {
  535. getOrderDetail,
  536. closeCom,
  537. overOrder,
  538. getWarehouseList,
  539. deliverOrder,
  540. directOrder,
  541. getPositionList
  542. } from '@/api/supply/engin'
  543. import CheckOrder from '@/components/Common/check-order'
  544. export default {
  545. name: 'CommerceDetail',
  546. componentName: 'CommerceDetail',
  547. components: {
  548. CheckOrder
  549. },
  550. filters: {
  551. statusFilter(val) {
  552. const statusList = [
  553. { label: '已保存', value: 'SAVE' },
  554. { label: '待审核', value: 'WAIT' },
  555. { label: '审核通过', value: 'OK' },
  556. // { label: '审核驳回', value: 'FAIL' },,
  557. { label: '已关闭', value: 'CLOSE' }
  558. ]
  559. const obj = statusList.find(o => o.value == val)
  560. return obj ? obj.label : ''
  561. }
  562. },
  563. props: ['listItem'],
  564. data() {
  565. return {
  566. detailData: {},
  567. isShowDeliverDialog: false,
  568. deliverForm: {
  569. date: '',
  570. position: '',
  571. remark: ''
  572. },
  573. deliverFormRules: {
  574. // date: [
  575. // { required: true, message: "请选择发货日期", trigger: "change" },
  576. // ],
  577. position: [{ required: true, message: '请选择仓位', trigger: 'change' }]
  578. },
  579. positionList: [],
  580. deliverGoodsList: [],
  581. isShowDirectDialog: false,
  582. directForm: {
  583. warehouse1: '',
  584. position1: '',
  585. warehouse2: '',
  586. position2: ''
  587. },
  588. directFormRules: {
  589. warehouse1: [{ required: true, message: '请选择调出仓库', trigger: 'change' }],
  590. position1: [{ required: true, message: '请选择调出仓位', trigger: 'change' }],
  591. warehouse2: [{ required: true, message: '请选择调入仓库', trigger: 'change' }],
  592. position2: [{ required: true, message: '请选择调入仓位', trigger: 'change' }]
  593. },
  594. warehouseList1: [],
  595. warehouseList2: [],
  596. positionList1: [],
  597. positionList2: [],
  598. directGoodsList: [],
  599. checkOrderId: {},
  600. isShowCheckOrder: false
  601. }
  602. },
  603. computed: {
  604. isExamine() {
  605. return this.detailData.examineStatus === 'OK' || this.detailData.examineStatus === 'FAIL'
  606. },
  607. isDealer() {
  608. return JSON.parse(localStorage.getItem('supply_user')).isCustomer
  609. }
  610. },
  611. created() {
  612. this.getDetail()
  613. },
  614. methods: {
  615. // 返回列表
  616. goBack() {
  617. this.$emit('backListFormDetail')
  618. },
  619. // 获取仓库列表
  620. getWarehouseList() {
  621. getWarehouseList({
  622. pageNum: 1,
  623. pageSize: -1
  624. }).then(res => {
  625. this.warehouseList1 = res.data.records
  626. this.warehouseList2 = res.data.records
  627. })
  628. },
  629. // 获取虚拟仓位列表
  630. getPositionList() {
  631. getPositionList({
  632. pageNum: 1,
  633. pageSize: -1,
  634. type: 2
  635. }).then(res => {
  636. this.positionList = res.data.records
  637. })
  638. },
  639. // 获取详情
  640. getDetail() {
  641. getOrderDetail({ id: this.listItem.parentId }).then(res => {
  642. if (res.data.items) {
  643. res.data.items.forEach(item => {
  644. item.number = (item.qty * 100 - item.retiredQty * 100) / 100
  645. item.sums1 = ['number', 'directTransferQty', 'qty', 'enginNum', 'oldQty']
  646. item.sums2 = ['totalAmount', 'payAmount', 'price', 'payRebateAmount', 'discAmount']
  647. item.correspondName = res.data.correspondName
  648. })
  649. }
  650. res.data.isPlanOrder = String(res.data.isPlanOrder)
  651. this.detailData = res.data
  652. console.log(this.detailData.isPlanOrder)
  653. })
  654. },
  655. // 关闭订单
  656. closeData() {
  657. this.$confirm('此操作将关闭订单, 是否继续?', '提示', {
  658. confirmButtonText: '确定',
  659. cancelButtonText: '取消',
  660. type: 'warning'
  661. })
  662. .then(() => {
  663. closeCom({
  664. id: this.listItem.parentId,
  665. refEnginRecordNo: this.detailData.refEnginRecordNo || ''
  666. }).then(res => {
  667. this.$successMsg()
  668. this.getDetail()
  669. })
  670. })
  671. .catch(() => {})
  672. },
  673. // 直调完结
  674. overData() {
  675. this.$confirm('此操作将直调完结订单, 是否继续?', '提示', {
  676. confirmButtonText: '确定',
  677. cancelButtonText: '取消',
  678. type: 'warning'
  679. })
  680. .then(() => {
  681. overOrder({
  682. id: this.listItem.parentId,
  683. refEnginRecordNo: this.detailData.refEnginRecordNo || ''
  684. }).then(res => {
  685. this.$successMsg()
  686. this.getDetail()
  687. })
  688. })
  689. .catch(() => {})
  690. },
  691. // 更改仓库
  692. changeWarehouse() {
  693. this.deliverForm.position = ''
  694. const obj = this.warehouseList.find(o => o.id == this.deliverForm.warehouse)
  695. this.positionList = obj.kingDeeStocks
  696. },
  697. // 打开 直调发货
  698. openDeliverDialog() {
  699. this.isShowDeliverDialog = true
  700. this.deliverGoodsList = this.detailData.items
  701. this.deliverGoodsList.forEach(item => {
  702. item.warehouse1 = ''
  703. item.warehouse2 = ''
  704. item.position1 = ''
  705. item.position2 = ''
  706. item.status1 = ''
  707. item.status2 = ''
  708. this.$set(item, 'realDirectTransferQty', item.refundableQty)
  709. })
  710. this.getPositionList()
  711. },
  712. // 关闭 直调发货
  713. closeDeliverDialog() {
  714. this.isShowDeliverDialog = false
  715. },
  716. // 提交 直调发货
  717. submitDeliverForm() {
  718. console.log(this.deliverGoodsList)
  719. this.$refs.deliverForm.validate(valid => {
  720. if (valid) {
  721. for (let i = 0; i < this.deliverGoodsList.length; i++) {
  722. if (!this.deliverGoodsList[i].directTransferQty && this.deliverGoodsList[i].directTransferQty !== 0) {
  723. this.$errorMsg('请输入直调数量')
  724. return
  725. }
  726. }
  727. // const arr = this.deliverGoodsList.filter(k => {
  728. // return k.directTransferQty !== 0 || k.directTransferQty !== null
  729. // })
  730. const params = {
  731. enginOrderId: this.detailData.enginOrderId,
  732. enginOrderType: 'TRADE', // TRADE=商用 HOME=家用
  733. deliverDate: '',
  734. correspondId: this.deliverForm.position,
  735. remark: this.deliverForm.remark,
  736. items: this.deliverGoodsList,
  737. refEnginRecordNo: this.detailData.refEnginRecordNo || ''
  738. }
  739. deliverOrder(params).then(res => {
  740. this.$successMsg()
  741. this.isShowDeliverDialog = false
  742. this.getDetail()
  743. })
  744. }
  745. })
  746. },
  747. // 更改调出仓库
  748. changeWarehouse1() {
  749. this.directForm.position1 = ''
  750. const obj = this.warehouseList1.find(o => o.id == this.directForm.warehouse1)
  751. this.positionList1 = obj.kingDeeStocks
  752. this.directGoodsList.forEach(item => {
  753. item.warehouse1 = obj.name
  754. })
  755. },
  756. // 更改调入仓库
  757. changeWarehouse2() {
  758. this.directForm.position2 = ''
  759. const obj = this.warehouseList2.find(o => o.id == this.directForm.warehouse2)
  760. this.positionList2 = obj.kingDeeStocks
  761. this.directGoodsList.forEach(item => {
  762. item.warehouse2 = obj.name
  763. })
  764. },
  765. // 更改调出仓位
  766. changePosition1() {
  767. const obj = this.positionList1.find(o => o.id == this.directForm.position1)
  768. this.directGoodsList.forEach(item => {
  769. item.position1 = obj.name
  770. item.status1 = obj.defStockStatusName
  771. })
  772. },
  773. // 更改调入仓位
  774. changePosition2() {
  775. const obj = this.positionList2.find(o => o.id == this.directForm.position2)
  776. this.directGoodsList.forEach(item => {
  777. item.position2 = obj.name
  778. item.status2 = obj.defStockStatusName
  779. })
  780. },
  781. // 打开 提前开票
  782. openDirectDialog() {
  783. this.isShowDirectDialog = true
  784. this.directGoodsList = this.detailData.items
  785. this.getWarehouseList()
  786. },
  787. // 关闭 提前开票
  788. closeDirectDialog() {
  789. this.isShowDirectDialog = false
  790. },
  791. // 提交 提前开票
  792. submitDirectForm() {
  793. this.$refs.directForm.validate(valid => {
  794. if (valid) {
  795. const warehouseItem1 = this.warehouseList1.find(o => o.id == this.directForm.warehouse1)
  796. const positionItem1 = this.positionList1.find(o => o.id == this.directForm.position1)
  797. const warehouseItem2 = this.warehouseList2.find(o => o.id == this.directForm.warehouse2)
  798. const positionItem2 = this.positionList2.find(o => o.id == this.directForm.position2)
  799. const params = {
  800. orderNo: this.detailData.enginOrderId,
  801. orderType: 'TRADE', // TRADE=商用 HOME=家用 RETAIL=零售单 RETAIL_POLICY 销售政策单
  802. correspondId: this.directForm.warehouse1,
  803. correspondName: warehouseItem1.name,
  804. stockId: this.directForm.position1,
  805. stockName: positionItem1.name,
  806. inCorrespondId: this.directForm.warehouse2,
  807. inCorrespondName: warehouseItem2.name,
  808. inStockId: this.directForm.position2,
  809. inStockName: positionItem2.name,
  810. refEnginRecordNo: this.detailData.refEnginRecordNo || ''
  811. }
  812. directOrder(params).then(res => {
  813. this.$successMsg()
  814. this.isShowDirectDialog = false
  815. this.getDetail()
  816. })
  817. }
  818. })
  819. },
  820. // 联查单据
  821. toCheckOrder() {
  822. this.checkOrderId = this.detailData.enginOrderId
  823. this.isShowCheckOrder = true
  824. },
  825. backDetail() {
  826. this.isShowCheckOrder = false
  827. }
  828. }
  829. }
  830. </script>
  831. <style scoped lang="scss">
  832. .detail-container {
  833. width: 100%;
  834. height: 100%;
  835. }
  836. .main-title {
  837. display: flex;
  838. justify-content: space-between;
  839. align-items: center;
  840. margin-top: 20px;
  841. height: 60px;
  842. border-bottom: 1px solid #dcdfe6;
  843. margin-bottom: 20px;
  844. .title {
  845. font-size: 16px;
  846. font-weight: 600;
  847. padding-left: 10px;
  848. }
  849. }
  850. </style>