lilei 4 years ago
parent
commit
d76c031d62

+ 59 - 0
src/api/dispatch.js

@@ -0,0 +1,59 @@
+import { axios } from '@/utils/request'
+
+// 发货列表分页
+export const dispatchlList = (params) => {
+  const url = `/dispatch/queryPage/${params.pageNo}/${params.pageSize}`
+  delete params.pageNo
+  delete params.pageSize
+  return axios({
+    url: url,
+    data: params,
+    method: 'post'
+  })
+}
+
+// 发货单明细列表分页
+export const dispatchDetaillList = (params) => {
+  const url = `/dispatch/detail/queryPage/${params.pageNo}/${params.pageSize}`
+  delete params.pageNo
+  delete params.pageSize
+  return axios({
+    url: url,
+    data: params,
+    method: 'post'
+  })
+}
+
+// 根据发货单SN查询发货单对象
+export const dispatchFindBySn = (params) => {
+  return axios({
+    url: `/dispatch/findBySn/${params.dispatchBillSn}`,
+    method: 'get'
+  })
+}
+
+// 发货单统计查询
+export const dispatchQueryCount = (params) => {
+  return axios({
+    url: '/dispatch/queryCount',
+    data: params,
+    method: 'post'
+  })
+}
+
+// 出库
+export const dispatchStockOut = (params) => {
+  return axios({
+    url: `/dispatch/stockOut/${params.dispatchBillSn}`,
+    method: 'get'
+  })
+}
+
+// 备货审核
+export const dispatchStockUpAduit = (params) => {
+  return axios({
+    url: '/dispatch/stockUpAduit',
+    data: params,
+    method: 'post'
+  })
+}

+ 9 - 143
src/views/salesManagement/pushOrderManagement/list.vue

@@ -76,69 +76,11 @@
       bordered>
       <!-- 销售单号 -->
       <template slot="salesBillNo" slot-scope="text, record">
-        <span style="color: #ed1c24;cursor: pointer;" @click="handleDetail(record)">{{ record.salesBillNo }}</span>
+        <span style="color: #ed1c24;cursor: pointer;" @click="handleDetail(record,0)">{{ record.salesBillNo }}</span>
       </template>
       <!-- 下推单号 -->
       <template slot="dispatchBillNo" slot-scope="text, record">
-        <span style="color: #ed1c24;cursor: pointer;" @click="handleDetail(record)">{{ record.dispatchBillNo }}</span>
-      </template>
-      <!-- 财务状态 -->
-      <template slot="financialStatus" slot-scope="text, record">
-        <a-badge :color="text=='FINISH'?'#87d068':'gold'" :text="record.financialStatusDictValue" />
-      </template>
-      <!-- 操作 -->
-      <template slot="action" slot-scope="text, record">
-        <a-button
-          size="small"
-          type="link"
-          class="button-warning"
-          v-if="record.billStatus == 'WAIT_AUDIT'"
-          @click="handleEexamine(record)"
-        >审核</a-button>
-        <a-button
-          size="small"
-          type="link"
-          v-if="record.billStatus == 'WAIT_OUT_WAREHOUSE'"
-          class="button-primary"
-          @click="handleSend(record)"
-        >出库</a-button>
-        <a-button
-          size="small"
-          type="link"
-          class="button-info"
-          v-if="record.salesBillSource == 'SALES' && record.billStatus !== 'CANCEL' && record.billStatus !== 'FINISH' && record.billStatus != 'WAIT_OUT_WAREHOUSE'"
-          @click="handleEdit(record)"
-        >
-          编辑
-        </a-button>
-        <a-button
-          size="small"
-          type="link"
-          class="button-error"
-          v-if="record.salesBillSource == 'SALES' && record.billStatus !== 'FINISH' && record.financialStatus !== 'FINISH'"
-          @click="handleDel(record)"
-        >
-          删除
-        </a-button>
-        <a-button
-          size="small"
-          type="link"
-          class="button-info"
-          v-if="record.salesBillSource == 'PURCHASE' && record.billStatus !== 'CANCEL' && record.billStatus !== 'FINISH' && record.billStatus != 'WAIT_OUT_WAREHOUSE'&& record.billStatus != 'AUDIT_REJECT'"
-          @click="handleEdit(record)"
-        >
-          改单
-        </a-button>
-        <a-button
-          size="small"
-          type="link"
-          class="button-error"
-          v-if="record.salesBillSource == 'PURCHASE' && record.billStatus !== 'FINISH' && record.financialStatus !== 'FINISH'&& record.billStatus != 'AUDIT_REJECT'&& record.billStatus != 'WAIT_OUT_WAREHOUSE'"
-          @click="handleDel(record)"
-        >
-          取消
-        </a-button>
-        <span v-if="record.billStatus == 'FINISH'||(record.salesBillSource == 'PURCHASE'&&record.billStatus == 'AUDIT_REJECT')">--</span>
+        <span style="color: #ed1c24;cursor: pointer;" @click="handleDetail(record,1)">{{ record.dispatchBillNo }}</span>
       </template>
     </s-table>
   </a-card>
@@ -148,7 +90,7 @@
 import moment from 'moment'
 import { STable, VSelect } from '@/components'
 import custList from '@/views/common/custList.js'
-import { salesList, salesDel, salesWriteAudit, salesWriteStockOut, salesCount } from '@/api/sales'
+import { dispatchlList, dispatchQueryCount } from '@/api/dispatch'
 export default {
   name: 'TableList',
   components: { STable, VSelect, custList },
@@ -168,17 +110,15 @@ export default {
       },
       totalData: {
         totalAmount: 0,
-        totalCategory: 0,
         totalQty: 0,
         totalRecord: 0
       },
       // 表头
       columns: [
         { title: '序号', dataIndex: 'no', width: 80, align: 'center' },
-        { title: '区域', dataIndex: 'shippingAddrCountyName', width: 120, align: 'center' },
-        { title: '省份', dataIndex: 'shippingAddrProvinceName', width: 120, align: 'center' },
+        // { title: '区域', dataIndex: 'shippingAddrCountyName', width: 120, align: 'center' },
+        // { title: '省份', dataIndex: 'shippingAddrProvinceName', width: 120, align: 'center' },
         { title: '创建时间', dataIndex: 'createDate', width: 160, align: 'center' },
-        { title: '单据来源', dataIndex: 'salesBillSource', width: 120, align: 'center' },
         { title: '下推单号', scopedSlots: { customRender: 'dispatchBillNo' }, width: 210, align: 'center' },
         { title: '关联销售单号', scopedSlots: { customRender: 'salesBillNo' }, width: 210, align: 'center' },
         { title: '客户名称', dataIndex: 'buyerName', align: 'center', customRender: function (text) { return text || '--' }, ellipsis: true },
@@ -204,11 +144,11 @@ export default {
           this.queryParam.endDate = undefined
         }
         // 查询总计
-        salesCount(Object.assign(parameter, this.queryParam)).then(res => {
+        dispatchQueryCount(Object.assign(parameter, this.queryParam)).then(res => {
           console.log(res)
           this.totalData = Object.assign(this.totalData, res.data || {})
         })
-        return salesList(Object.assign(parameter, this.queryParam)).then(res => {
+        return dispatchlList(Object.assign(parameter, this.queryParam)).then(res => {
           const data = res.data
           const no = (data.pageNo - 1) * data.pageSize
           for (var i = 0; i < data.list.length; i++) {
@@ -225,83 +165,9 @@ export default {
     disabledDate (date, dateStrings) {
       return date && date.valueOf() > Date.now()
     },
-    //  审核
-    handleEexamine (row) {
-      const _this = this
-      this.$confirm({
-        title: '提示',
-        content: '请点击下方按钮确认操作?',
-        centered: true,
-        closable: true,
-        okText: '审核通过',
-        cancelText: '审核不通过',
-        onOk () {
-          _this.auditOrder(row.id, 'WAIT_OUT_WAREHOUSE')
-        },
-        onCancel (e) {
-          if (!e.triggerCancel) {
-            _this.auditOrder(row.id, 'AUDIT_REJECT')
-          }
-          _this.$destroyAll()
-        }
-      })
-    },
-    auditOrder (id, billStatus) {
-      salesWriteAudit({
-        id,
-        billStatus
-      }).then(res => {
-        if (res.status == 200) {
-          this.$message.success(res.message)
-          this.$refs.table.refresh()
-        }
-      })
-    },
-    //  出库
-    handleSend (row) {
-      const _this = this
-      this.$confirm({
-        title: '提示',
-        content: '确认要出库吗?',
-        centered: true,
-        closable: true,
-        onOk () {
-          salesWriteStockOut({
-            salesBillSn: row.salesBillSn
-          }).then(res => {
-            if (res.status == 200) {
-              _this.$message.success(res.message)
-              _this.$refs.table.refresh()
-            }
-          })
-        }
-      })
-    },
     // 详情
-    handleDetail (row) {
-      this.$router.push({ name: 'salesDetail', params: { sn: row.salesBillSn } })
-    },
-    // 编辑
-    handleEdit (row) {
-      this.$router.push({ name: 'salesEdit', params: { id: row.id, sn: row.salesBillSn, priceType: row.priceType } })
-    },
-    // 删除
-    handleDel (row) {
-      const _this = this
-      this.$confirm({
-        title: '提示',
-        content: '确认要删除吗?',
-        centered: true,
-        closable: true,
-        onOk () {
-          salesDel({ id: row.id }).then(res => {
-            if (res.status == 200) {
-              _this.$message.success(res.message)
-              _this.$refs.table.refresh()
-            }
-          })
-        }
-      })
+    handleDetail (row, type) {
+      this.$router.push({ name: type == 0 ? 'salesDetail' : 'pushOrderDetail', params: { sn: row.salesBillSn } })
     },
     // 重置
     resetSearchForm () {

+ 8 - 19
src/views/salesManagement/waitDispatch/edit.vue

@@ -254,42 +254,31 @@ export default {
       })
     },
     // 添加产品
-    insterProduct (row, promotionFlag) {
-      console.log(row)
+    insterProduct (list) {
+      console.log(list)
       // 防止多次添加产品
       if (this.isInster) { return }
       const _this = this
-      _this.saveNewProduct(row, promotionFlag)
+      _this.saveNewProduct(list)
     },
-    // 保存添加的产品到销售列表
-    saveNewProduct (row, promotionFlag) {
+    // 保存添加的产品到下推列表
+    saveNewProduct (list) {
       this.$message.loading('正在添加产品...', 1)
       this.isInster = true
       insertBatchOfWaitDispatch({
-        packQty: row.productPackQty,
-        productSn: row.productSn,
-        showCos: row.lastStockCost,
-        price: row.productPrice,
-        qty: row.salesNums,
-        salesBillSn: this.detailData.salesBillSn,
-        salesBillNo: this.detailData.salesBillNo,
-        purchaseBillSn: this.detailData.purchaseBillSn,
-        purchaseBillNo: this.detailData.purchaseBillNo,
-        stockSn: row.stockSn,
-        promotableFlag: 0, // 可促销标记 有活动的传1,没活动的传0
-        promotionFlag: promotionFlag // 促销标记 正品传0,促销品传1
+        list: list
       }).then(res => {
         if (res.status == 200) {
           this.resetSearchForm()
           this.$refs.partQuery.resetCurForm()
-          this.$message.success('产品添加成功', 2.5)
+          this.$message.success('添加成功', 2.5)
         }
         this.isInster = false
       })
     },
     // 批量取消产品
     cancelProduct (row) {
-
+      // 防止多次添加产品
     },
     // 一键下推
     oneDispatch () {

+ 28 - 12
src/views/salesManagement/waitDispatch/queryPart.vue

@@ -52,9 +52,9 @@
     </div>
     <!-- 按钮 -->
     <div class="table-operator">
-      <a-button type="primary" class="button-error" @click="handlePlAdd">批量添加</a-button>
-      <a-button type="primary" class="button-info" @click="handlePlCancel">批量取消</a-button>
-      <a-button type="primary" class="button-warning" @click="handleOneDispatch">有货一键下推</a-button>
+      <a-button type="primary" :disabled="newLoading" class="button-error" @click="handlePlAdd">批量添加</a-button>
+      <a-button type="primary" :disabled="newLoading" class="button-info" @click="handlePlCancel">批量取消</a-button>
+      <a-button type="primary" :disabled="newLoading" class="button-warning" @click="handleOneDispatch">有货一键下推</a-button>
     </div>
     <!-- alert -->
     <a-alert type="info" style="margin-bottom: 15px;" v-if="detailData">
@@ -69,7 +69,13 @@
       class="sTable"
       ref="table"
       size="small"
-      :row-selection="{ selectedRowKeys: selectedRowKeys, onChange: onSelectChange }"
+      :row-selection="{
+        selectedRowKeys: selectedRowKeys,
+        onChange: onSelectChange,
+        getCheckboxProps:record =>({props: {
+          disabled: record.surplusQty<=0,
+        }})
+      }"
       :rowKey="(record) => record.id"
       :columns="columns"
       :showPagination="false"
@@ -104,7 +110,9 @@
           class="button-info"
           :loading="newLoading"
           @click="handleAdd(record)"
+          v-if="record.surplusQty>0"
           id="productInfoList-edit-btn">添加</a-button>
+        <span v-else>--</span>
       </template>
     </s-table>
   </div>
@@ -151,11 +159,11 @@ export default {
         { title: '成本价', dataIndex: 'showCost', width: 100, align: 'center', customRender: function (text) { return '¥' + (text || 0) } },
         { title: '销售价', dataIndex: 'price', width: 150, align: 'center', customRender: function (text) { return '¥' + (text || 0) } },
         { title: '单位', dataIndex: 'productEntity.unit', width: 100, align: 'center', customRender: function (text) { return text || '--' } },
-        { title: '可用库存', dataIndex: 'stockQty', width: 150, align: 'center' },
-        { title: '销售数量', dataIndex: 'qty', width: 150, align: 'center' },
-        { title: '已取消', dataIndex: 'cancelQty', width: 150, align: 'center' },
-        { title: '已下推', dataIndex: 'pushedQty', width: 150, align: 'center' },
-        { title: '剩余待下推', dataIndex: 'surplusQty', width: 150, align: 'center' },
+        { title: '可用库存', dataIndex: 'stockQty', width: 150, align: 'center', customRender: function (text) { return text || '--' } },
+        { title: '销售数量', dataIndex: 'qty', width: 150, align: 'center', customRender: function (text) { return text || '--' } },
+        { title: '已取消', dataIndex: 'cancelQty', width: 150, align: 'center', customRender: function (text) { return text || '--' } },
+        { title: '已下推', dataIndex: 'pushedQty', width: 150, align: 'center', customRender: function (text) { return text || '--' } },
+        { title: '剩余待下推', dataIndex: 'surplusQty', width: 150, align: 'center', customRender: function (text) { return text || '--' } },
         { title: '取消数量', dataIndex: 'cancelNums', scopedSlots: { customRender: 'nums' }, width: 150, align: 'center' },
         { title: '操作', dataIndex: 'action', scopedSlots: { customRender: 'action' }, width: 150, align: 'center', fixed: 'right' }
       ],
@@ -222,7 +230,7 @@ export default {
     },
     // 添加
     handleAdd (row) {
-      this.$emit('add', row)
+      this.$emit('addProduct', [row.salesBillDetailSn])
     },
     // 批量添加
     handlePlAdd () {
@@ -233,10 +241,18 @@ export default {
       }
       const obj = []
       _this.selectedRows.map(item => {
-        obj.push(item.productSn)
+        obj.push(item.salesBillDetailSn)
       })
 
-      this.$emit('addProduct', obj)
+      this.$confirm({
+        title: '提示',
+        content: '确认要批量添加到待下推列表吗?',
+        centered: true,
+        closable: true,
+        onOk () {
+          _this.$emit('addProduct', obj)
+        }
+      })
     },
     // 批量取消
     handlePlCancel () {