lilei преди 3 години
родител
ревизия
96e0656a28
променени са 2 файла, в които са добавени 51 реда и са изтрити 34 реда
  1. 39 25
      src/views/salesManagement/salesQuery/detail.vue
  2. 12 9
      src/views/salesManagement/salesQuery/edit.vue

+ 39 - 25
src/views/salesManagement/salesQuery/detail.vue

@@ -127,24 +127,6 @@ export default {
       showCost: false,
       printOrgCode: false, // 打印原创编码
       showOutInModal: false,
-      // 表头
-      columns: [
-        { title: '序号', dataIndex: 'no', width: '4%', align: 'center' },
-        { title: '产品编码', dataIndex: 'productCode', width: '11%', align: 'center', customRender: function (text) { return text || '--' } },
-        { title: '产品名称', dataIndex: 'productName', width: '11%', align: 'center', customRender: function (text) { return text || '--' } },
-        { title: '原厂编码', dataIndex: 'productOrigCode', width: '9%', align: 'center', customRender: function (text) { return text && text != ' ' ? text : '--' } },
-        { title: '售价', dataIndex: 'price', width: '5%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
-        { title: '折后售价', dataIndex: 'discountedPrice', width: '6%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
-        { title: '销售数量', dataIndex: 'qty', width: '6%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
-        { title: '单位', dataIndex: 'productOrigUnit', width: '4%', align: 'center', customRender: function (text) { return text || '--' } },
-        { title: '售价小计', dataIndex: 'totalAmount', width: '6%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
-        { title: '折后小计', dataIndex: 'discountedAmount', width: '6%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
-        { title: '折扣金额', dataIndex: 'discountAmount', width: '6%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
-        { title: '仓库', dataIndex: 'warehouseName', width: '7%', align: 'center', customRender: function (text) { return text || '--' } },
-        { title: '仓位', dataIndex: 'warehouseLocationName', width: '7%', align: 'center', customRender: function (text) { return text || '--' } },
-        { title: '是否急件', dataIndex: 'oosFlagDictValue', width: '6%', align: 'center', customRender: function (text) { return text || '--' } },
-        { title: '操作', scopedSlots: { customRender: 'action' }, width: '7%', align: 'center' }
-      ],
       // 加载数据方法 必须为 Promise 对象
       loadData: parameter => {
         this.disabled = true
@@ -178,6 +160,45 @@ export default {
       detailData: null //  详情数据
     }
   },
+  computed: {
+    // 是否自建单据
+    isOwerEdit () {
+      return this.detailData && this.detailData.salesBillSource == 'SALES'
+    },
+    columns () {
+      const arr = [
+        { title: '序号', dataIndex: 'no', width: '4%', align: 'center' },
+        { title: '产品编码', dataIndex: 'productCode', width: '11%', align: 'center', customRender: function (text) { return text || '--' } },
+        { title: '产品名称', dataIndex: 'productName', width: '11%', align: 'center', customRender: function (text) { return text || '--' } },
+        { title: '原厂编码', dataIndex: 'productOrigCode', width: '9%', align: 'center', customRender: function (text) { return text && text != ' ' ? text : '--' } },
+        { title: '售价', dataIndex: 'price', width: '5%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
+        { title: '折后售价', dataIndex: 'discountedPrice', width: '6%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
+        { title: '销售数量', dataIndex: 'qty', width: '6%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
+        { title: '单位', dataIndex: 'productOrigUnit', width: '4%', align: 'center', customRender: function (text) { return text || '--' } },
+        { title: '售价小计', dataIndex: 'totalAmount', width: '6%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
+        { title: '折后小计', dataIndex: 'discountedAmount', width: '6%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
+        { title: '折扣金额', dataIndex: 'discountAmount', width: '6%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
+        // { title: '仓库', dataIndex: 'warehouseName', width: '7%', align: 'center', customRender: function (text) { return text || '--' } },
+        // { title: '仓位', dataIndex: 'warehouseLocationName', width: '7%', align: 'center', customRender: function (text) { return text || '--' } },
+        { title: '是否急件', dataIndex: 'oosFlagDictValue', width: '6%', align: 'center', customRender: function (text) { return text || '--' } },
+        { title: '操作', scopedSlots: { customRender: 'action' }, width: '7%', align: 'center' }
+      ]
+      // 实际总成本
+      if (this.showCost) {
+        arr.splice(4, 0, { slots: { title: 'costTitle' }, dataIndex: 'cost', width: '6%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } })
+      } else {
+        arr.splice(4, 1)
+      }
+      // 下级创建,不显示仓库仓位
+      if (!this.isOwerEdit) {
+        arr.splice(this.showCost ? 12 : 11, 0, { title: '库存数量', dataIndex: 'currentStockQty', width: '6%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } })
+      } else {
+        arr.splice(this.showCost ? 12 : 11, 0, { title: '仓库', dataIndex: 'warehouseName', width: '7%', align: 'center', customRender: function (text) { return text || '--' } })
+        arr.splice(this.showCost ? 13 : 12, 0, { title: '仓位', dataIndex: 'warehouseLocationName', width: '7%', align: 'center', customRender: function (text) { return text || '--' } })
+      }
+      return arr
+    }
+  },
   methods: {
     // 打印预览/快捷打印
     handlePrint (type, printerType) {
@@ -230,13 +251,6 @@ export default {
     }
   },
   watch: {
-    showCost (newValue, oldValue) {
-      if (newValue) {
-        this.columns.splice(4, 0, { slots: { title: 'costTitle' }, dataIndex: 'cost', width: '8%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } })
-      } else {
-        this.columns.splice(4, 1)
-      }
-    },
     printOrgCode (newValue, oldValue) {
       localStorage.setItem('printOrgCode-' + this.$store.state.user.info.orgId, newValue)
     }

+ 12 - 9
src/views/salesManagement/salesQuery/edit.vue

@@ -138,6 +138,9 @@
             <a-badge count="急" v-if="record.oosFlag == 1">
               <div style="padding-right: 15px;">{{ text }}</div>
             </a-badge>
+            <a-badge count="缺" v-else-if="record.currentStockQty < record.qty">
+              <div style="padding-right: 15px;">{{ text }}</div>
+            </a-badge>
             <span v-else>{{ text }}</span>
           </template>
           <!-- 售价 -->
@@ -257,9 +260,9 @@ export default {
     }
   },
   computed: {
-    // 是否上级改单
-    isSuperEdit () {
-      return this.detailData && this.detailData.salesBillSource == 'PURCHASE' && (this.detailData.billStatus == 'SUPERIOR_CHANGE' || this.detailData.billStatus == 'WAIT_AUDIT')
+    // 是否自建单据
+    isOwerEdit () {
+      return this.detailData && this.detailData.salesBillSource == 'SALES'
     },
     columns () {
       const arr = [
@@ -278,8 +281,8 @@ export default {
         { title: '操作', scopedSlots: { customRender: 'action' }, width: '7%', align: 'center' }
       ]
       // 下级创建,不显示仓库仓位
-      if (this.isSuperEdit) {
-        arr.splice(5, 0, { title: '库存数量', dataIndex: 'warehouseEntity.name', width: '8%', align: 'center', customRender: function (text) { return text || '--' } })
+      if (!this.isOwerEdit) {
+        arr.splice(5, 0, { title: '库存数量', dataIndex: 'currentStockQty', width: '8%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } })
       } else {
         arr.splice(5, 0, { title: '仓库', dataIndex: 'warehouseEntity.name', width: '8%', align: 'center', sorter: true, customRender: function (text) { return text || '--' } })
         arr.splice(6, 0, { title: '仓位', dataIndex: 'warehouseLocationEntity.name', width: '8%', align: 'center', customRender: function (text) { return text || '--' } })
@@ -383,8 +386,8 @@ export default {
     qtyBlur (val, record) {
       this.dataSource = record || []
       if (val && val != record.qtyBackups) {
-        // 非下级创建的单据,修改数量时校验库存
-        if (!this.isSuperEdit) {
+        // 建的单据,修改数量时校验库存
+        if (this.isOwerEdit) {
           this.validStock(val, record)
         } else {
           this.changeQty(record)
@@ -559,8 +562,8 @@ export default {
           }
         }
       }
-      // 库存不足时
-      if (row.currentQty < row.salesNums && !this.isSuperEdit) {
+      // 自建的单据显示库存不足时
+      if (row.currentQty < row.salesNums && this.isOwerEdit) {
         _this.$confirm({
           title: '提示',
           content: '库存不足,确认添加为急件吗?',