Browse Source

销售单调试

lilei 4 years ago
parent
commit
945307e80f

+ 18 - 4
src/views/salesManagement/salesQuery/detail.vue

@@ -62,9 +62,23 @@
         class="button-info"
         size="large"
         style="width: 150px;"
-        v-if="detailData&&detailData.billStatus !== 'CANCEL' && detailData.billStatus !== 'FINISH' && detailData.billStatus != 'WAIT_OUT_WAREHOUSE'"
-        @click="handleEdit()"
-        id="salesDetail-edit-btn">编辑</a-button>
+        id="salesDetail-edit-btn"
+        v-if="detailData&&detailData.salesBillSource != 'PURCHASE' && (detailData.billStatus == 'WAIT_SUBMIT' || detailData.billStatus == 'WAIT_AUDIT' || detailData.billStatus == 'AUDIT_REJECT')"
+        @click="handleEdit(record)"
+      >
+        编辑
+      </a-button>
+      <a-button
+        size="large"
+        style="width: 150px;"
+        type="primary"
+        class="button-info"
+        id="salesDetail-edit-btn"
+        v-if="detailData&&detailData.salesBillSource == 'PURCHASE' && (detailData.billStatus == 'WAIT_AUDIT'||detailData.billStatus == 'HQ_CHANGE')"
+        @click="handleEdit(record)"
+      >
+        改单
+      </a-button>
     </a-card>
   </div>
 </template>
@@ -137,7 +151,7 @@ export default {
     // 编辑
     handleEdit () {
       const row = this.detailData
-      this.$router.push({ name: 'salesEdit', params: { id: row.id, sn: row.salesBillSn } })
+      this.$router.push({ name: 'salesEdit', params: { sn: row.salesBillSn } })
     },
     //  详情
     getDetail () {

+ 16 - 45
src/views/salesManagement/salesQuery/edit.vue

@@ -20,7 +20,7 @@
         </div>
       </div>
       <!-- 查询配件列表 -->
-      <queryPart ref="partQuery" :buyerSn="detailData&&detailData.buyerSn" :priceType="$route.params.priceType" :newLoading="isInster" @add="insterProduct"></queryPart>
+      <queryPart ref="partQuery" :buyerSn="detailData&&detailData.buyerSn" :newLoading="isInster" @add="insterProduct"></queryPart>
     </a-card>
     <a-card :bordered="false" class="salesEdit-cont">
       <div slot="title">
@@ -70,7 +70,7 @@
         :rowKey="(record) => record.id"
         :columns="columns"
         :data="loadData"
-        :scroll="{ y: 300 }"
+        :scroll="{ x:1000, y: 300 }"
         bordered>
         <!-- 产品名称 -->
         <template slot="productName" slot-scope="text, record">
@@ -151,9 +151,9 @@ export default {
       // 表头
       columns: [
         { title: '序号', dataIndex: 'no', width: 80, align: 'center' },
-        { title: '产品编码', dataIndex: 'productEntity.code', scopedSlots: { customRender: 'productCode' }, width: 140, align: 'center', sorter: true },
+        { title: '产品编码', dataIndex: 'productEntity.code', scopedSlots: { customRender: 'productCode' }, width: 200, align: 'center', sorter: true },
         { title: '产品名称', dataIndex: 'productEntity.name', scopedSlots: { customRender: 'productName' }, align: 'center', customRender: function (text) { return text || '--' } },
-        { title: '售价', dataIndex: 'price', width: 150, align: 'center' },
+        { title: '售价', dataIndex: 'price', width: 150, align: 'center', customRender: function (text) { return '¥' + (text || 0) } },
         { title: '销售数量', scopedSlots: { customRender: 'salesNums' }, width: 150, align: 'center' },
         { title: '单位', dataIndex: 'productEntity.unit', width: 100, align: 'center', customRender: function (text) { return text || '--' } },
         { title: '售价小计', dataIndex: 'totalAmount', width: 100, align: 'center', customRender: function (text) { return '¥' + (text || 0) } },
@@ -194,8 +194,8 @@ export default {
           this.resetSearchForm(true)
           if (res.status == 200) {
             this.$refs.partQuery.resetCurForm()
+            this.$message.success(res.message)
           }
-          this.$message.info(res.message)
         })
       }
     },
@@ -260,59 +260,30 @@ export default {
       })
     },
     // 添加产品
-    insterProduct (row) {
+    insterProduct (row, promotionFlag) {
       console.log(row)
       // 防止多次添加产品
       if (this.isInster) { return }
       const _this = this
-      // 判断是否已添加此产品
-      const hasRow = this.dataSource.find(item => item.productSn == row.productSn && item.warehouseSn == row.warehouseSn && item.warehouseLocationSn == row.warehouseLocationSn)
-      if (hasRow) {
-        this.$message.info('该产品已在当前销售单中存在!')
-        return
-      }
-
-      // 库存不足时
-      if (row.currentQty < row.salesNums) {
-        this.$confirm({
-          title: '提示',
-          content: '库存不足,确认添加为急件吗?',
-          centered: true,
-          closable: true,
-          onOk () {
-            _this.saveNewProduct(row)
-          }
-        })
-      } else if (row.putCost > row.salePrice) {
-        // 销售价低于成本价
-        this.$confirm({
-          title: '提示',
-          content: '售价低于成本价,确认要添加吗?',
-          centered: true,
-          closable: true,
-          onOk () {
-            _this.saveNewProduct(row)
-          }
-        })
-      } else {
-        this.saveNewProduct(row)
-      }
+      _this.saveNewProduct(row, promotionFlag)
     },
     // 保存添加的产品到销售列表
-    saveNewProduct (row) {
+    saveNewProduct (row, promotionFlag) {
       this.$message.loading('正在添加产品...', 1)
       this.isInster = true
       salesDetailInsert({
-        buyerSn: this.detailData.buyerSn,
+        packQty: row.productPackQty,
         productSn: row.productSn,
-        cost: row.putCost,
-        price: row.salePrice,
+        showCos: row.lastStockCost,
+        price: row.productPrice,
         qty: row.salesNums,
         salesBillSn: this.detailData.salesBillSn,
         salesBillNo: this.detailData.salesBillNo,
-        warehouseSn: row.warehouseSn,
-        warehouseLocationSn: row.warehouseLocationSn,
-        stockSn: row.stockSn
+        purchaseBillSn: this.detailData.purchaseBillSn,
+        purchaseBillNo: this.detailData.purchaseBillNo,
+        stockSn: row.stockSn,
+        promotableFlag: 0, // 可促销标记 有活动的传1,没活动的传0
+        promotionFlag: promotionFlag // 促销标记 正品传0,促销品传1
       }).then(res => {
         if (res.status == 200) {
           this.resetSearchForm()

+ 10 - 8
src/views/salesManagement/salesQuery/list.vue

@@ -110,8 +110,10 @@
       bordered>
       <!-- 销售单号 -->
       <template slot="salesBillNo" slot-scope="text, record">
-        <span style="color: #00aaff;cursor: pointer;" @click="handleDetail(record)">{{ record.salesBillNo }}</span>
-        <span style="color: #ed1c24;cursor: pointer;" v-if="record.changeTimes>0">({{ record.changeTimes }})</span>
+        <a-badge :count="'改'+record.changeTimes" v-if="record.changeTimes>0">
+          <span style="color: #00aaff;cursor: pointer;" @click="handleDetail(record)">{{ record.salesBillNo }}</span>
+        </a-badge>
+        <span v-else style="color: #00aaff;cursor: pointer;" @click="handleDetail(record)">{{ record.salesBillNo }}</span>
       </template>
       <!-- 总数量 -->
       <template slot="totalQty" slot-scope="text, record">
@@ -175,7 +177,7 @@
         >
           取消
         </a-button>
-        <span v-if="record.billStatus == 'FINISH'||record.salesBillSource == 'CANCEL'">--</span>
+        <span v-if="record.billStatus == 'FINISH'||record.billStatus == 'CANCEL'">--</span>
       </template>
     </s-table>
     <!-- 选择客户弹框 -->
@@ -231,11 +233,11 @@ export default {
         { title: '客户名称', dataIndex: 'buyerName', align: 'center', customRender: function (text) { return text || '--' }, ellipsis: true },
         { title: '总数量', dataIndex: 'totalQty', scopedSlots: { customRender: 'totalQty' }, width: 100, align: 'center' },
         { title: '总售价', dataIndex: 'totalAmount', width: 100, align: 'center', customRender: function (text) { return '¥' + (text || 0) } },
-        { title: '已下推数量', dataIndex: 'pushedQty', width: 120, align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
-        { title: '已发货数量', dataIndex: 'dispatchQty', width: 120, align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
-        { title: '已取消数量', dataIndex: 'cancelQty', width: 120, align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
-        { title: '待下推数量', dataIndex: 'unpushedQty', width: 120, align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
-        { title: '收款方式', dataIndex: 'settleStyleEntity.name', width: 100, align: 'center', customRender: function (text) { return text || '--' } },
+        { title: '已下推数量', dataIndex: 'totalPushedQty', width: 120, align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
+        { title: '已发货数量', dataIndex: 'totalDispatchQty', width: 120, align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
+        { title: '已取消数量', dataIndex: 'totalCancelQty', width: 120, align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
+        { title: '待下推数量', dataIndex: 'totalUnpushedQty', width: 120, align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
+        { title: '收款方式', dataIndex: 'settleStyleSnDictValue', width: 100, align: 'center', customRender: function (text) { return text || '--' } },
         { title: '审核时间', dataIndex: 'auditDate', width: 160, align: 'center', customRender: function (text) { return text || '--' } },
         { title: '最近备货时间', dataIndex: 'lastStockUpDate', width: 160, align: 'center', customRender: function (text) { return text || '--' } },
         { title: '业务状态', dataIndex: 'billStatusDictValue', width: 110, align: 'center' },

+ 20 - 21
src/views/salesManagement/salesQuery/queryPart.vue

@@ -55,7 +55,7 @@
       :columns="columns"
       :data="loadData"
       :customRow="handleClickRow"
-      :scroll="{ x: tableWidth, y: 300 }"
+      :scroll="{ x: 1400, y: 300 }"
       :defaultLoadData="false"
       bordered>
       <!-- 销售数量 -->
@@ -70,6 +70,13 @@
             placeholder="请输入" />
         </div>
       </template>
+      <!-- 产品名称 -->
+      <template slot="productName" slot-scope="text, record">
+        <a-badge count="活动" v-if="record.oosFlag == 1">
+          <div style="padding-right: 15px;">{{ text }}</div>
+        </a-badge>
+        <span v-else>{{ text }}</span>
+      </template>
       <!-- 操作 -->
       <template slot="action" slot-scope="text, record">
         <a-button
@@ -85,8 +92,7 @@
 </template>
 
 <script>
-import { querySumByProductLocation } from '@/api/stock'
-import { warehouseAllList } from '@/api/warehouse'
+import { queryStockProductPage } from '@/api/stock'
 import ProductType from '@/views/common/productType.js'
 import ProductBrand from '@/views/common/productBrand.js'
 import { STable, VSelect } from '@/components'
@@ -98,20 +104,14 @@ export default {
       type: [Number, String],
       default: ''
     },
-    priceType: {
-      type: [Number, String],
-      default: ''
-    },
     newLoading: Boolean
   },
   data () {
     return {
       advanced: false, // 高级搜索 展开/关闭
       showSetting: false, // 设置弹框
-      tableWidth: 0,
       productType: [],
       queryParam: { //  查询条件
-        salePriceType: '',
         productCode: '', //  产品编码
         productName: '', //  产品名称
         productOrigCode: '', //  原厂编码
@@ -124,29 +124,28 @@ export default {
       exportLoading: false, // 导出loading
       columns: [
         { title: '序号', dataIndex: 'no', width: 80, align: 'center' },
-        { title: '产品编码', dataIndex: 'productCode', width: 140, align: 'center', sorter: true, customRender: function (text) { return text || '--' } },
-        { title: '产品名称', dataIndex: 'productName', width: 200, align: 'center', customRender: function (text) { return text || '--' } },
+        { title: '产品名称', dataIndex: 'productName', scopedSlots: { customRender: 'productName' }, width: 200, align: 'center' },
         { title: '原厂编码', dataIndex: 'productOrigCode', width: 140, align: 'center', customRender: function (text) { return text || '--' } },
-        { title: '品牌', dataIndex: 'brandName', width: 100, align: 'center', sorter: true, customRender: function (text) { return text || '--' } },
-        { title: '库存数量', dataIndex: 'currentQty', width: 100, align: 'center', customRender: function (text) { return text || 0 } },
-        { title: '单位', dataIndex: 'unit', width: 100, align: 'center', customRender: function (text) { return text || '--' } },
-        { title: '售价', dataIndex: 'salePrice', scopedSlots: { customRender: 'salePrice' }, width: 150, align: 'center' },
-        { title: '包装数', dataIndex: 'unit', width: 100, align: 'center', customRender: function (text) { return text || '--' } },
+        { title: '品牌', dataIndex: 'productBrandName', width: 100, align: 'center', customRender: function (text) { return text || '--' } },
+        { title: '库存数量', dataIndex: 'currentStockQty', width: 100, align: 'center', customRender: function (text) { return text || 0 } },
+        { title: '单位', dataIndex: 'productUnit', width: 100, align: 'center', customRender: function (text) { return text || '--' } },
+        { title: '售价', dataIndex: 'productPrice', width: 150, align: 'center', customRender: function (text) { return '¥' + (text || 0) } },
+        { title: '包装数', dataIndex: 'productPackQty', width: 100, align: 'center', customRender: function (text) { return text || '--' } },
         { title: '销售数量', dataIndex: 'salesNums', scopedSlots: { customRender: 'nums' }, width: 150, align: 'center' },
         { title: '操作', dataIndex: 'action', scopedSlots: { customRender: 'action' }, width: 200, align: 'center', fixed: 'right' }
       ],
       // 加载数据方法 必须为 Promise 对象
       loadData: parameter => {
         this.disabled = true
-        this.queryParam.salePriceType = this.priceType
-        return querySumByProductLocation(Object.assign(parameter, this.queryParam)).then(res => {
+        this.queryParam.dealerSn = this.buyerSn
+        return queryStockProductPage(Object.assign(parameter, this.queryParam)).then(res => {
           const data = res.data
           data.list = data.list.filter(item => item != null)
           const no = (data.pageNo - 1) * data.pageSize
           for (var i = 0; i < data.list.length; i++) {
             data.list[i].no = no + i + 1
             data.list[i].salesNums = 1
-            data.list[i].currentQty = data.list[i].currentQty || 0
+            data.list[i].currentStockQty = data.list[i].currentStockQty || 0
           }
           this.disabled = false
           return data
@@ -162,7 +161,7 @@ export default {
         on: {
           dblclick: (event) => {
             event.stopPropagation()
-            _this.$emit('add', record)
+            _this.$emit('add', record, 0)
           }
         }
       }
@@ -185,7 +184,7 @@ export default {
     },
     // 选择配件
     handleAdd (row) {
-      this.$emit('add', row)
+      this.$emit('add', row, 0)
     },
     //  产品分类  change
     changeProductType (val, opt) {