index.js 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131
  1. // 盘点-任务状态
  2. // 任务状态 1.未开始,2.进行中,3.已完成,4.已取消
  3. export const taskStatusList = [
  4. {
  5. value: "",
  6. name: "全部任务",
  7. name2: "",
  8. className: "",
  9. },
  10. {
  11. value: 1,
  12. name: "待盘点",
  13. name2: "未开始",
  14. className: "tips-red",
  15. },
  16. {
  17. value: 2,
  18. name: "盘点中",
  19. name2: "进行中",
  20. className: "tips-green",
  21. },
  22. {
  23. value: 3,
  24. name: "已盘点",
  25. name2: "已完成",
  26. className: "tips-hui",
  27. },
  28. {
  29. value: 4,
  30. name: "已取消",
  31. name2: "已取消",
  32. className: "tips-yellow",
  33. },
  34. ];
  35. export function getTaskStatusInfoByVal(val) {
  36. const target = taskStatusList.find((item) => item.value === val);
  37. return target || {};
  38. }
  39. export const taskTypeList = [
  40. {
  41. value: 1,
  42. name: "全盘",
  43. },
  44. {
  45. value: 2,
  46. name: "抽盘",
  47. },
  48. ];
  49. export function getTaskTypeInfoByVal(val) {
  50. const target = taskTypeList.find((item) => item.value === val);
  51. return target || {};
  52. }
  53. // 盘点状态 商品盘点类型:1.未盘,2.盘盈,3.盘亏 4.无差异 其余为全部
  54. export const goodsInventoryStatus = [
  55. {
  56. name: "未盘",
  57. value: 1,
  58. },
  59. {
  60. name: "盘盈",
  61. value: 2,
  62. },
  63. {
  64. name: "盘亏",
  65. value: 3,
  66. },
  67. {
  68. name: "无差异",
  69. value: 4,
  70. },
  71. ];
  72. export function getGoodsInventoryStatusInfoByVal(val) {
  73. const target = goodsInventoryStatus.find((item) => item.value === val);
  74. return target || {};
  75. }
  76. /**
  77. * @des 前端计算系统库存、已盘库存数量 获取盘点状态信息
  78. * @parms inventory 系统库存
  79. * @parms newInventory 系统库存
  80. */
  81. export function getGoodsInventoryStatusInfo(inventory, newInventory) {
  82. const goodsInventoryStatus = [
  83. {
  84. label: "去盘点",
  85. value: "1",
  86. },
  87. {
  88. label: "盘盈",
  89. value: "2",
  90. },
  91. {
  92. label: "盘亏",
  93. value: "3",
  94. },
  95. {
  96. label: "无差异",
  97. value: "4",
  98. },
  99. ];
  100. let val;
  101. const a = inventory || 0; // 系统库存
  102. const b = newInventory || 0; // 已盘库存
  103. const diffVal = Number(a) - Number(b);
  104. if (b === 0) {
  105. val = "1";
  106. } else if (diffVal === 0 && a !== 0) {
  107. val = "4";
  108. } else if (diffVal > 0) {
  109. val = "3";
  110. } else {
  111. val = "2";
  112. }
  113. const target = goodsInventoryStatus.find((item) => item.value === val);
  114. if (target) {
  115. return {
  116. ...target,
  117. inventory: a,
  118. newInventory: b,
  119. };
  120. }
  121. return {
  122. inventory: a,
  123. newInventory: b,
  124. };
  125. }