invoiceDialog.vue 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384
  1. <template>
  2. <ele-modal
  3. custom-class="ele-dialog-form long-dialog-form"
  4. :centered="true"
  5. :visible.sync="addRepairNotesDialog"
  6. title="发货单"
  7. :close-on-click-modal="false"
  8. width="85%"
  9. append-to-body
  10. @close="handleClose"
  11. >
  12. <div class="main_container">
  13. <headerTitle title="发货单" style="margin-top: 8px"></headerTitle>
  14. <ele-pro-table
  15. ref="tableRef2"
  16. :columns="columns"
  17. :datasource="datasource"
  18. tool-class="ele-toolbar-form"
  19. :initLoad="false"
  20. height="300px"
  21. @cell-click="rowClick"
  22. ></ele-pro-table>
  23. <headerTitle title="物品明细" style="margin-top: 8px"></headerTitle>
  24. <ele-pro-table
  25. ref="tableRef3"
  26. :columns="columnsPro"
  27. :datasource="packingList"
  28. :need-page="false"
  29. tool-class="ele-toolbar-form"
  30. :selection.sync="selection"
  31. height="400px"
  32. ></ele-pro-table>
  33. <!-- <ele-pro-table
  34. v-else
  35. ref="tableRef3"
  36. :columns="listColumn"
  37. :datasource="packingList"
  38. :need-page="false"
  39. tool-class="ele-toolbar-form"
  40. :selection.sync="selection"
  41. height="400px"
  42. >
  43. <template v-slot:industryArtFiles="scope">
  44. <el-form-item style="margin-bottom: 20px">
  45. <fileMain v-model="scope.row.industryArtFiles" type="view"></fileMain>
  46. </el-form-item>
  47. </template>
  48. </ele-pro-table>-->
  49. </div>
  50. <div slot="footer" class="footer">
  51. <el-button type="primary" @click="submitAdd">确认</el-button>
  52. <el-button @click="handleClose">取消</el-button>
  53. </div>
  54. </ele-modal>
  55. </template>
  56. <script>
  57. import { parameterGetByCode } from '@/api/main';
  58. import {
  59. getSendTableList,
  60. getSendSaleOrderrecordDetailSplit
  61. } from '@/api/saleManage/saleordersendrecord';
  62. import { reviewStatusEnum } from '@/enum/dict';
  63. import { lbjtList } from '@/enum/dict.js';
  64. import { getInfoBySourceBizNoAll } from '@/api/wms';
  65. const dayjs = require('dayjs');
  66. export default {
  67. props: {
  68. contractBookType: {
  69. //合同类型 1销售 2采购
  70. type: [String, Number],
  71. default: 1
  72. }
  73. },
  74. components: {},
  75. data() {
  76. return {
  77. addRepairNotesDialog: false,
  78. rowClickData: {},
  79. selection: [],
  80. packingList: [],
  81. columns: [
  82. {
  83. columnKey: 'index',
  84. label: '序号',
  85. type: 'index',
  86. width: 55,
  87. align: 'center',
  88. showOverflowTooltip: true
  89. },
  90. {
  91. prop: 'docNo',
  92. label: '发货单编码',
  93. sortable: true,
  94. align: 'center',
  95. slot: 'docNo',
  96. showOverflowTooltip: true,
  97. minWidth: 120
  98. },
  99. {
  100. prop: 'orderNo',
  101. label: '销售订单编码',
  102. sortable: true,
  103. align: 'center',
  104. slot: 'orderNo',
  105. showOverflowTooltip: true,
  106. minWidth: 120
  107. },
  108. {
  109. prop: 'contactName',
  110. label: '客户名称',
  111. align: 'center',
  112. showOverflowTooltip: true,
  113. minWidth: 120
  114. },
  115. {
  116. prop: 'replied',
  117. label: '是否回执',
  118. align: 'center',
  119. showOverflowTooltip: true,
  120. minWidth: 120,
  121. formatter: (_row, _column, cellValue) => {
  122. return _row.replied == 1 ? '是' : '否';
  123. }
  124. },
  125. {
  126. prop: 'reviewStatus',
  127. label: '状态',
  128. align: 'center',
  129. showOverflowTooltip: true,
  130. minWidth: 120,
  131. formatter: (_row, _column, cellValue) => {
  132. return reviewStatusEnum[_row.reviewStatus].label;
  133. }
  134. },
  135. {
  136. prop: 'createTime',
  137. label: '创建时间',
  138. align: 'center',
  139. showOverflowTooltip: true,
  140. minWidth: 120
  141. }
  142. ],
  143. columnsPro: [
  144. {
  145. width: 45,
  146. type: 'selection',
  147. columnKey: 'selection',
  148. align: 'center'
  149. },
  150. {
  151. columnKey: 'index',
  152. label: '序号',
  153. type: 'index',
  154. width: 55,
  155. align: 'center',
  156. showOverflowTooltip: true
  157. },
  158. {
  159. prop: 'productCategoryName',
  160. label: '类型',
  161. align: 'center',
  162. showOverflowTooltip: true
  163. },
  164. {
  165. prop: 'categoryCode',
  166. label: '编码',
  167. align: 'center',
  168. showOverflowTooltip: true
  169. },
  170. {
  171. prop: 'categoryName',
  172. label: '名称',
  173. align: 'center',
  174. showOverflowTooltip: true
  175. },
  176. {
  177. prop: 'productBrand',
  178. label: '牌号',
  179. align: 'center',
  180. showOverflowTooltip: true
  181. },
  182. {
  183. prop: 'categoryModel',
  184. label: '型号',
  185. align: 'center',
  186. showOverflowTooltip: true
  187. },
  188. {
  189. prop: 'packingSpecification',
  190. label: '规格',
  191. align: 'center',
  192. showOverflowTooltip: true
  193. },
  194. {
  195. prop: 'batchNo',
  196. label: '批次号',
  197. align: 'center',
  198. showOverflowTooltip: true
  199. },
  200. {
  201. prop: 'measureQuantity',
  202. label: '计量数量',
  203. align: 'center',
  204. showOverflowTooltip: true
  205. },
  206. {
  207. prop: 'singlePrice',
  208. label: '单价(元)',
  209. align: 'center',
  210. showOverflowTooltip: true
  211. },
  212. {
  213. prop: 'barcodes',
  214. label: '发货条码/车架号',
  215. align: 'center',
  216. showOverflowTooltip: true
  217. }
  218. // {
  219. // prop: 'materielDesignation',
  220. // label: '物料代号',
  221. // align: 'center',
  222. // showOverflowTooltip: true
  223. // },
  224. // {
  225. // prop: 'engrave',
  226. // label: '刻码',
  227. // align: 'center',
  228. // showOverflowTooltip: true
  229. // }
  230. ],
  231. contactId: '',
  232. goodsShow: false
  233. };
  234. },
  235. created() {},
  236. methods: {
  237. // 初始化数据(父组件调用)
  238. open(data, obj) {
  239. this.contactId = data;
  240. this.addRepairNotesDialog = true;
  241. // this.contractId = data.contractId;
  242. // this.rowClickData.id = data.orderId;
  243. // this.rowClickData.docNo = data.orderCode;
  244. // 数据回显 ***
  245. this.rowClickData.id = obj.orderId;
  246. this.rowClickData.docNo = obj.orderCode;
  247. this.packingList = JSON.parse(JSON.stringify(obj.tableList));
  248. this.$nextTick(() => {
  249. this.packingList.forEach((row) => {
  250. this.$refs.tableRef3.toggleRowSelection(row);
  251. });
  252. this.reload();
  253. });
  254. console.log(this.selection, 'this.selection 开始');
  255. },
  256. datasource({ page, limit, where, order }) {
  257. return getSendTableList({
  258. pageNum: page,
  259. size: limit,
  260. ...where
  261. });
  262. },
  263. reload(where) {
  264. where = {
  265. ...where,
  266. // contractId: this.contractId,
  267. contactId: this.contactId,
  268. reviewStatus: 2
  269. };
  270. this.$refs.tableRef2.reload({ page: 1, where });
  271. },
  272. async rowClick(row) {
  273. this.rowClickData = row;
  274. let params = {
  275. code: 'after_sales_product_list_source'
  276. };
  277. const res = await parameterGetByCode(params);
  278. if (res.value == '1') {
  279. this.getInfo(row);
  280. } else {
  281. this._getInfo(row.docNo);
  282. }
  283. },
  284. handleClose() {
  285. this.addRepairNotesDialog = false;
  286. },
  287. submitAdd() {
  288. console.log(this.selection, 'this.selection 确定');
  289. if (!this.selection.length) {
  290. return this.$message.warning('请至少选择一条数据');
  291. }
  292. this.$emit('changeParent', {
  293. orderCode: this.rowClickData.docNo,
  294. orderId: this.rowClickData.id,
  295. tableList: this.selection
  296. });
  297. this.handleClose();
  298. },
  299. async getInfo(row) {
  300. const res = await getSendSaleOrderrecordDetailSplit(row.id);
  301. let list = res.productList.map((el) => {
  302. el.categoryCode = el.productCode;
  303. el.categoryName = el.productName;
  304. el.categoryModel = el.modelType;
  305. el.measureQuantity = el.totalCount;
  306. el.barcodes = el.carCode;
  307. el.packingSpecification = el.specification;
  308. el.shipmentDate = row.createTime || null;
  309. (el.guaranteePeriodDeadline = this.getTime(row.createTime)[0]),
  310. (el.warrantyStatus = this.getTime(row.createTime)[1]);
  311. return el;
  312. });
  313. this.packingList = list;
  314. },
  315. async _getInfo(sourceBizNo) {
  316. const dataArray = await getInfoBySourceBizNoAll(sourceBizNo);
  317. let res = {};
  318. if (dataArray && dataArray.length > 0) {
  319. res = JSON.parse(JSON.stringify(dataArray[0]));
  320. res['outInDetailList'] = [];
  321. dataArray.forEach((item) => {
  322. item.outInDetailList.forEach((val) => {
  323. res['outInDetailList'].push(val);
  324. });
  325. });
  326. }
  327. this.init(res);
  328. },
  329. init(res) {
  330. this.infoData = res;
  331. this.productList = res?.outInDetailList?.map(
  332. (productItem, productIndex) => {
  333. return {
  334. ...productItem,
  335. outInDetailRecordRequestList:
  336. productItem.outInDetailRecordRequestList.map((packingItem) => {
  337. return {
  338. ...packingItem,
  339. categoryName: productItem.categoryName,
  340. categoryCode: productItem.categoryCode,
  341. categoryModel: productItem.categoryModel,
  342. produceTime: packingItem.produceTime || null,
  343. shipmentDate: res.createTime || null,
  344. guaranteePeriodDeadline: this.getTime(res.createTime)[0],
  345. warrantyStatus: this.getTime(res.createTime)[1]
  346. };
  347. })
  348. };
  349. }
  350. );
  351. // 获取包装维度数据
  352. const arr = [];
  353. for (const key in this.productList) {
  354. for (const k in this.productList[key].outInDetailRecordRequestList) {
  355. arr.push({
  356. ...this.productList[key].outInDetailRecordRequestList[k]
  357. });
  358. }
  359. }
  360. this.packingList = arr;
  361. },
  362. getTime(createTime) {
  363. let date = new Date(createTime);
  364. date.setMonth(date.getMonth() + 13); // 月份加13月
  365. let time = dayjs(date).format('YYYY-MM-DD HH:mm:ss');
  366. let warrantyStatus =
  367. new Date(time).getTime() > new Date().getTime() ? 0 : 1;
  368. return [time, warrantyStatus];
  369. }
  370. }
  371. };
  372. </script>
  373. <style lang="scss" scoped></style>