Jelajahi Sumber

Merge branch 'develop_cuxiao' of http://git.chelingzhu.com/jianguan-web/jg-ocs-html into develop_cuxiao

chenrui 1 tahun lalu
induk
melakukan
cfb832c962

+ 1 - 1
public/version.json

@@ -1,4 +1,4 @@
 {
-    "version": "2.2.41",
+    "version": "2.2.42",
     "message": "发现有新版本发布,确定更新系统?"
 }

+ 7 - 57
src/views/salesManagement/salesQueryNew/comps/chooseProduct.vue

@@ -12,14 +12,7 @@
       <div class="products-con">
         <div>
           <!-- 查询配件列表 -->
-          <queryPart
-            ref="partQuery"
-            :showRemark="true"
-            :showReceiveQty="true"
-            :isShowPrice="isShowPrice"
-            :returnReasonList="returnReasonList"
-            :newLoading="isInster"
-            @add="saveProduct"></queryPart>
+          <queryPart ref="partQuery" :newLoading="isInster" @add="insterProduct"></queryPart>
         </div>
       </div>
     </a-spin>
@@ -27,7 +20,7 @@
 </template>
 
 <script>
-import queryPart from '@/views/salesReturnManagement/salesReturn/queryPart.vue'
+import queryPart from './queryPart.vue'
 export default {
   name: 'ChooseProductsModal',
   components: { queryPart },
@@ -46,53 +39,21 @@ export default {
       type: String,
       default: ''
     },
-    isShowPrice: { //  弹框显示状态
+    isInster: { //  弹框显示状态
       type: Boolean,
-      default: true
-    },
-    goodFlag: {
-      type: String,
-      default: ''
+      default: false
     }
   },
   data () {
     return {
       spinning: false,
       isShow: this.openModal, //  是否打开弹框
-      returnReasonList: [],
-      isInster: false //  表格加载中
     }
   },
   methods: {
-    // 添加或修改产品
-    saveProduct (row) {
-      // 防止多次添加产品
-      if (this.isInster) {
-        return
-      }
-      if (!row.receiveQty) {
-        this.$message.info('请输入仓库实收数量')
-        return
-      }
-      if (!row.returnReasonCode) {
-        this.$message.info('请选择退货原因')
-        return
-      }
-      const rows = this.returnReasonlist.find(item => item.code == row.returnReasonCode)
-      const params = {
-        'price': row.productPrice,
-        'returnReasonCode': row.returnReasonCode,
-        'returnReason': rows ? rows.dispName : '',
-        'returnReasonRemarks': row.returnReasonRemarks,
-        'productSn': row.productSn,
-        'initialQty': row.qty,
-        'receiveQty': row.receiveQty
-      }
-      this.isInster = true
-      this.$emit('addProduct', params)
-    },
-    resetLoading () {
-      this.isInster = false
+    // 添加产品
+    insterProduct (row, promotionFlag) {
+      this.$emit('addProduct', row, promotionFlag)
     }
   },
   watch: {
@@ -105,17 +66,6 @@ export default {
       if (!newValue) {
         this.$emit('close')
       } else {
-        if (this.goodFlag == 'DEFECTIVE_PRODUCT_RETURN') {
-          this.returnReasonlist = this.$store.state.app.defectiveReturnReason
-        }
-        // 良品
-        if (this.goodFlag == 'GOOD_PRODUCT_RETURN') {
-          this.returnReasonlist = this.$store.state.app.goodReturnReason
-        }
-        // 全部
-        if (!this.goodFlag) {
-          this.returnReasonlist = [...this.$store.state.app.goodReturnReason, ...this.$store.state.app.defectiveReturnReason]
-        }
         this.$nextTick(() => {
           this.$refs.partQuery.pageInit(this.buyerSn || '')
         })

+ 102 - 45
src/views/salesManagement/salesQueryNew/comps/productList.vue

@@ -1,12 +1,36 @@
 <template>
   <div>
+    <div class="table-page-search-wrapper" v-show="showDescBox">
+      <div>
+        <a-descriptions :column="4">
+          <a-descriptions-item label="促销类型">
+            买产品送产品
+          </a-descriptions-item>
+          <a-descriptions-item label="促销门槛" span="3">
+            购买1000元门槛产品,可使用200元配额,采购正价产品
+          </a-descriptions-item>
+          <a-descriptions-item label="促销规则">
+            购买满10个正价产品,送10个促销产品
+          </a-descriptions-item>
+          <a-descriptions-item label="显示正价产品款数">
+            40
+          </a-descriptions-item>
+          <a-descriptions-item label="订单起订金额">
+            20000
+          </a-descriptions-item>
+          <a-descriptions-item label="活动经费上线">
+            8000
+          </a-descriptions-item>
+        </a-descriptions>
+      </div>
+    </div>
     <!-- 筛选条件 -->
     <div class="table-page-search-wrapper" v-show="showSearchBox">
       <a-form layout="inline" @keyup.enter.native="$refs.table.refresh(true)">
         <a-row :gutter="15">
           <a-col :md="4" :sm="24">
             <a-form-item label="出库仓库" prop="warehouseSn">
-              <chooseWarehouse ref="warehouse" v-model="queryParam.warehouseSn"></chooseWarehouse>
+              <chooseWarehouse ref="warehouse" v-model="queryParam.warehouseSn" @load="warehouseLoad"></chooseWarehouse>
             </a-form-item>
           </a-col>
           <a-col :md="4" :sm="24">
@@ -33,40 +57,59 @@
             <a-button type="primary" @click="$refs.table.refresh(true)" :disabled="disabled" id="salesEdit-refresh">查询</a-button>
             <a-button style="margin-left: 5px" @click="resetSearchForm" :disabled="disabled" id="salesEdit-reset">重置</a-button>
           </a-col>
-          <a-col :md="12" :sm="24" style="text-align:left;">
-            <a-dropdown>
-              <a-menu slot="overlay" @click="handleMenuClick">
-                <a-menu-item key="0">
-                  仓库设置
-                </a-menu-item>
-                <a-menu-item key="1">
-                  删除已选项
-                </a-menu-item>
-                <a-menu-item key="2">
-                  全部删除
-                </a-menu-item>
-              </a-menu>
-              <a-button
-                style="margin:0 15px 0 0;"
-                type="info"
-              > 批量操作 <a-icon type="down" /> </a-button>
-            </a-dropdown>
-            <span>已选{{ selectTotal }}项</span>
-          </a-col>
-          <a-col :md="12" :sm="24" style="text-align:right;">
-            <a-space>
-              <a-button
-                type="default"
-                @click="openGuideModal=true">导入产品</a-button>
-              <a-button
-                type="primary"
-                class="button-info"
-                @click="openCpModal=true">添加产品</a-button>
-            </a-space>
-          </a-col>
         </a-row>
       </a-form>
     </div>
+    <div>
+      <a-row :gutter="15">
+        <a-col :md="12" :sm="24" style="text-align:left;">
+          <span style="margin-right:5px;">已选{{ selectTotal }}项</span>
+          <a-dropdown>
+            <a-menu slot="overlay" @click="handleMenuClick">
+              <a-menu-item key="0">
+                仓库设置
+              </a-menu-item>
+              <a-menu-item key="1">
+                删除已选项
+              </a-menu-item>
+              <a-menu-item key="2">
+                全部删除
+              </a-menu-item>
+            </a-menu>
+            <a-button
+              type="link"
+              class="button-info"
+            > 批量操作 <a-icon type="down" /> </a-button>
+          </a-dropdown>
+        </a-col>
+        <a-col :md="12" :sm="24" style="text-align:right;">
+          <a-button
+            type="link"
+            class="button-info"
+            @click="openGuideModal=true"><a-icon type="login" /> 导入活动产品</a-button>
+          <a-button
+            type="link"
+            class="button-info"
+            @click="openQxModal=true"><a-icon type="plus" /> 添加促销产品</a-button>
+          <a-button
+            type="link"
+            class="button-info"
+            @click="openCpModal=true"><a-icon type="plus" /> 添加活动产品</a-button>
+        </a-col>
+      </a-row>
+    </div>
+    <!-- 总计 -->
+    <a-alert type="info" style="margin-bottom: 5px;" banner :showIcon="false">
+      <div slot="message" class="total-bar">
+        <div>
+          已满足1000元门槛金额,已选择180元正价产品配额,<strong>再满2件产品,可享受满赠优惠/已满足促销要求,可享受优惠</strong>
+        </div>
+        <div>
+          <span v-if="$hasPermissions('B_salesEdit_salesPrice')">总金额:<strong>{{ detailData&&(detailData.totalCommonAmount || detailData.totalCommonAmount==0) ? toThousands(detailData.totalCommonAmount) : '--' }}</strong>;</span>
+          <span v-if="$hasPermissions('B_salesEdit_salesPrice')">优惠金额:<strong>{{ detailData&&(detailData.totalCommonAmount || detailData.totalCommonAmount==0) ? toThousands(detailData.totalCommonAmount) : '--' }}</strong>;</span>
+        </div>
+      </div>
+    </a-alert>
     <!-- 已选配件列表 -->
     <s-table
       class="sTable"
@@ -77,7 +120,6 @@
       :data="loadData"
       :row-selection="{ columnWidth: 40 }"
       @rowSelection="rowSelectionFun"
-      :defaultLoadData="false"
       :scroll="{ y: 300 }"
       bordered>
       <!-- 产品编码 -->
@@ -122,7 +164,16 @@
       </template>
       <!-- 出库仓库 -->
       <template slot="warehouseBox" slot-scope="text, record">
-        <chooseWarehouse style="width:100%;" :allowClear="false" ref="warehouseBox" v-model="record.warehouseSn" @change="handleWarehouseBox(record)"></chooseWarehouse>
+        <a-select
+          style="width:100%;" 
+          placeholder="请选择仓库"
+          v-model="record.warehouseSn"
+          :showSearch="true"
+          @change="handleWarehouseBox(record)"
+          mode="default"
+          :filter-option="filterOption">
+          <a-select-option v-for="item in warehouseDataList" :key="item.warehouseSn" :value="item.warehouseSn">{{ item.name }}</a-select-option>
+        </a-select>
       </template>
       <!-- 操作 -->
       <template slot="action" slot-scope="text, record">
@@ -135,16 +186,7 @@
         >删除</a-button>
       </template>
     </s-table>
-    <!-- 总计 -->
-    <a-alert type="info" style="margin-top: 10px;">
-      <div slot="message" class="total-bar">
-        <div>
-          <span v-if="$hasPermissions('B_salesEdit_salesPrice')">总售价:<strong>{{ detailData&&(detailData.totalCommonAmount || detailData.totalCommonAmount==0) ? toThousands(detailData.totalCommonAmount) : '--' }}</strong>;</span>
-          总款数:<strong>{{ detailData&&(detailData.totalCommonCategory || detailData.totalCommonCategory==0) ? detailData.totalCommonCategory : '--' }}</strong>;
-          总数量:<strong>{{ detailData&&(detailData.totalCommonQty || detailData.totalCommonQty==0) ? detailData.totalCommonQty : '--' }}</strong>;
-        </div>
-      </div>
-    </a-alert>
+  
       <!-- 添加产品 -->
       <chooseProduct
         ref="chooseProduct"
@@ -225,6 +267,7 @@
           })
         },
         showSearchBox: false,
+        showDescBox: false,
         openCpModal: false,
         openWarehouseModal: false, // 打开仓库设置
         openGuideModal: false, //  导入产品引导
@@ -242,6 +285,7 @@
         },
         productType: [],
         rowSelectionInfo: null,
+        warehouseDataList: []
       }
     },
     computed: {
@@ -274,9 +318,20 @@
       }
     },
     methods: {
+      filterOption (input, option) {
+        return (
+          option.componentOptions.children[0].text.toLowerCase().indexOf(input.toLowerCase()) >= 0
+        )
+      },
+      warehouseLoad(sn,list){
+        this.warehouseDataList = list
+      },
       showSearch(){
         this.showSearchBox = !this.showSearchBox
       },
+      showDesc(){
+        this.showDescBox = !this.showDescBox
+      },
       // 表格选中项
       rowSelectionFun (obj) {
         this.rowSelectionInfo = obj || null
@@ -531,5 +586,7 @@
   }
 </script>
 
-<style>
+<style lang="less">
+  .total-bar{
+  }
 </style>

+ 551 - 0
src/views/salesManagement/salesQueryNew/comps/productNormalList.vue

@@ -0,0 +1,551 @@
+<template>
+  <div>
+    <!-- 筛选条件 -->
+    <div class="table-page-search-wrapper">
+      <a-form layout="inline" @keyup.enter.native="$refs.table.refresh(true)">
+        <a-row :gutter="15">
+          <a-col :md="4" :sm="24">
+            <a-form-item label="出库仓库" prop="warehouseSn">
+              <chooseWarehouse ref="warehouse" v-model="queryParam.warehouseSn" @load="warehouseLoad"></chooseWarehouse>
+            </a-form-item>
+          </a-col>
+          <a-col :md="4" :sm="24">
+            <a-form-item label="产品编码" prop="productCode">
+              <a-input id="salesEdit-productCode" v-model.trim="queryParam.productCode" placeholder="请输入产品编码" allowClear />
+            </a-form-item>
+          </a-col>
+          <a-col :md="4" :sm="24">
+            <a-form-item label="产品名称" prop="productName">
+              <a-input id="salesEdit-productName" v-model.trim="queryParam.productName" placeholder="请输入产品名称" allowClear />
+            </a-form-item>
+          </a-col>
+          <a-col :md="4" :sm="24">
+            <a-form-item label="品牌">
+              <ProductBrand id="salesEdit-productBrandSn" v-model="queryParam.productBrandSn"></ProductBrand>
+            </a-form-item>
+          </a-col>
+          <a-col :md="4" :sm="24">
+            <a-form-item label="产品分类">
+              <productTypeAll placeholder="请选择产品分类" @change="changeProductType" v-model="productType" id="salesEdit-productType"></productTypeAll>
+            </a-form-item>
+          </a-col>
+          <a-col :md="4" :sm="24" style="margin-bottom: 10px;">
+            <a-button type="primary" @click="$refs.table.refresh(true)" :disabled="disabled" id="salesEdit-refresh">查询</a-button>
+            <a-button style="margin-left: 5px" @click="resetSearchForm" :disabled="disabled" id="salesEdit-reset">重置</a-button>
+          </a-col>
+        </a-row>
+      </a-form>
+    </div>
+    <div>
+      <a-row :gutter="15">
+        <a-col :md="12" :sm="24" style="text-align:left;">
+          <span style="margin-right:5px;">已选{{ selectTotal }}项</span>
+          <a-dropdown>
+            <a-menu slot="overlay" @click="handleMenuClick">
+              <a-menu-item key="0">
+                仓库设置
+              </a-menu-item>
+              <a-menu-item key="1">
+                删除已选项
+              </a-menu-item>
+              <a-menu-item key="2">
+                全部删除
+              </a-menu-item>
+            </a-menu>
+            <a-button
+              type="link"
+              class="button-info"
+            > 批量操作 <a-icon type="down" /> </a-button>
+          </a-dropdown>
+        </a-col>
+        <a-col :md="12" :sm="24" style="text-align:right;">
+          <a-button
+            type="link"
+            class="button-info"
+            @click="openGuideModal=true"><a-icon type="login" /> 导入产品</a-button>
+          <a-button
+            type="link"
+            class="button-info"
+            @click="openCpModal=true"><a-icon type="plus" /> 添加产品</a-button>
+        </a-col>
+      </a-row>
+    </div>
+    <!-- 总计 -->
+    <a-alert type="info" style="margin-bottom: 5px;" banner :showIcon="false">
+      <div slot="message" class="total-bar">
+        <div>
+          <span v-if="$hasPermissions('B_salesEdit_salesPrice')">总售价:<strong>{{ detailData&&(detailData.totalCommonAmount || detailData.totalCommonAmount==0) ? toThousands(detailData.totalCommonAmount) : '--' }}</strong>;</span>
+          总款数:<strong>{{ detailData&&(detailData.totalCommonCategory || detailData.totalCommonCategory==0) ? detailData.totalCommonCategory : '--' }}</strong>;
+          总数量:<strong>{{ detailData&&(detailData.totalCommonQty || detailData.totalCommonQty==0) ? detailData.totalCommonQty : '--' }}</strong>;
+        </div>
+      </div>
+    </a-alert>
+    <!-- 已选配件列表 -->
+    <s-table
+      class="sTable"
+      ref="table"
+      size="small"
+      :rowKey="(record) => record.id"
+      :columns="columns"
+      :data="loadData"
+      :row-selection="{ columnWidth: 40 }"
+      @rowSelection="rowSelectionFun"
+      :scroll="{ y: 300 }"
+      bordered>
+      <!-- 产品编码 -->
+      <template slot="productCode" slot-scope="text, record">
+        <a-badge count="缺" v-if="Number(record.stockQty||0) < Number(record.unpushedQty||0)">
+          <div style="padding-right: 15px;">{{ text }}</div>
+        </a-badge>
+        <span v-if="!(Number(record.stockQty||0) < Number(record.unpushedQty||0))">{{ text }}</span>
+      </template>
+      <!-- 产品名称 -->
+      <template slot="productName" slot-scope="text, record">
+        <div class="ellipsisCon">
+          <a-tooltip placement="rightBottom">
+            <template slot="title">
+              <span>{{ text }}</span>
+            </template>
+            <span class="ellipsisText">{{ text }}</span>
+          </a-tooltip>
+          <a-badge :number-style="{ backgroundColor: '#52c41a' }" count="活动" v-if="record.promotableFlag == 1"></a-badge>
+        </div>
+      </template>
+      <!-- 销售数量 -->
+      <template slot="salesNums" slot-scope="text, record">
+        <a-input-number
+          id="salesEdit-qty"
+          size="small"
+          v-model="record.qty"
+          :precision="0"
+          :min="1"
+          :max="999999"
+          placeholder="请输入"
+          @blur="e => onCellBlur(e.target.value, record)"
+          style="width: 100%;" />
+      </template>
+      <!-- 当前库存 -->
+      <template slot="stockQty" slot-scope="text, record">
+        <div v-if="record.stockQty || record.stockQty==0">
+          <p style="margin: 0;" v-if="Number(record.stockQty) < Number(record.unpushedQty)">{{ record.stockQty }}(<span class="redStyle">缺{{ Number(record.unpushedQty||0) - Number(record.stockQty||0) }}</span>)</p>
+          <p style="margin: 0;" v-else>{{ record.stockQty }}</p>
+        </div>
+        <span v-else>--</span>
+      </template>
+      <!-- 出库仓库 -->
+      <template slot="warehouseBox" slot-scope="text, record">
+        <a-select
+          style="width:100%;" 
+          placeholder="请选择仓库"
+          v-model="record.warehouseSn"
+          :showSearch="true"
+          @change="handleWarehouseBox(record)"
+          mode="default"
+          :filter-option="filterOption">
+          <a-select-option v-for="item in warehouseDataList" :key="item.warehouseSn" :value="item.warehouseSn">{{ item.name }}</a-select-option>
+        </a-select>
+      </template>
+      <!-- 操作 -->
+      <template slot="action" slot-scope="text, record">
+        <a-button
+          size="small"
+          type="link"
+          :loading="delLoading"
+          class="button-error"
+          @click="handleDel(record)"
+        >删除</a-button>
+      </template>
+    </s-table>
+  
+      <!-- 添加产品 -->
+      <chooseProduct
+        ref="chooseProduct"
+        :openModal="openCpModal"
+        :isInster="isInster"
+        :buyerSn="detailData&&detailData.buyerSn||''"
+        @close="openCpModal=false"
+        @addProduct="insterProduct"></chooseProduct>
+      <!-- 导入产品 -->
+      <importGuideModal :openModal="openGuideModal" :params="{salesBillSn: salesBillSn}" @close="closeGuideModel" @ok="hanldeOk" />
+      <!-- 仓库设置 -->
+      <setWarehouse :show="openWarehouseModal" @ok="chooseWarehouseOk" @cancel="openWarehouseModal=false"></setWarehouse>
+  </div>
+</template>
+
+<script>
+  import { commonMixin } from '@/utils/mixin'
+  import { STable, VSelect } from '@/components'
+  import ImportGuideModal from './importGuideModal.vue'
+  import setWarehouse from './setWarehouse.vue'
+  import chooseProduct from './chooseProduct.vue'
+  import chooseWarehouse from '@/views/common/chooseWarehouse'
+  import ProductBrand from '@/views/common/productBrand.js'
+  import productTypeAll from '@/views/common/productTypeAll.js'
+  import { salesModify, salesDetailBySn, salesWriteSubmit, getPromoacActiveList, deleteAll, submitCheck, updateWarehouse } from '@/api/sales'
+  import { salesDetailStockList, salesDetailInsert, salesDetailUpdateQty, salesDetailDel, salesDetailBatchDel, salesDetailDelAll, addPromoGoods, salesBatchInsert } from '@/api/salesDetail'
+  export default {
+    name: 'ProductList',
+    mixins: [commonMixin],
+    components: { 
+      STable,
+      VSelect,
+      ImportGuideModal,
+      chooseWarehouse,
+      setWarehouse,
+      ProductBrand,
+      productTypeAll,
+      chooseProduct
+    },
+    props: {
+      openModal: { //  弹框显示状态
+        type: Boolean,
+        default: false
+      },
+      newLoading: Boolean,
+      detailData: {
+        type: Object,
+        default: function(){return null}
+      },
+      warehouseSn: {
+        type: String,
+        default: ''
+      },
+      salesBillSn: {
+        type: String,
+        default: ''
+      }
+    },
+    data () {
+      return {
+        spinning: false,
+        // 加载数据方法 必须为 Promise 对象
+        loadData: parameter => {
+          this.disabled = true
+          this.queryParam.salesBillSn = this.salesBillSn || ''
+          return salesDetailStockList(Object.assign(parameter, this.queryParam)).then(res => {
+            let data
+            if (res.status == 200) {
+              data = res.data
+              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].qtyBackups = data.list[i].qty
+              }
+              this.disabled = false
+              this.dataSource = data.list
+            }
+            return data
+          })
+        },
+        openCpModal: false,
+        openWarehouseModal: false, // 打开仓库设置
+        openGuideModal: false, //  导入产品引导
+        delLoading: false,
+        chooseDisabled: false,
+        disabled: false, //  查询、重置按钮是否可操作
+        queryParam: {
+          warehouseSn: undefined,
+          productCode: '',
+          productName: '',
+          productBrandSn: undefined,
+          productTypeSn1: '', //  产品一级分类
+          productTypeSn2: '', //  产品二级分类
+          productTypeSn3: '' //  产品三级分类
+        },
+        productType: [],
+        rowSelectionInfo: null,
+        warehouseDataList: []
+      }
+    },
+    computed: {
+      selectTotal () {
+        return this.rowSelectionInfo && this.rowSelectionInfo.selectedRowKeys.length || 0
+      },
+      columns () {
+        const arr = [
+          { title: '序号', dataIndex: 'no', width: '4%', align: 'center' },
+          { title: '产品编码', dataIndex: 'productEntity.code', scopedSlots: { customRender: 'productCode' }, width: '13%', align: 'center', sorter: true },
+          { title: '产品名称', dataIndex: 'productEntity.name', scopedSlots: { customRender: 'productName' }, width: '20%', align: 'left' },
+          // { title: '售价', dataIndex: 'price', width: '8%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
+          { title: '销售数量', scopedSlots: { customRender: 'salesNums' }, width: '8%', align: 'center' },
+          { title: '库存', dataIndex: 'stockQty', scopedSlots: { customRender: 'stockQty' }, width: '8%', align: 'center' },
+          { title: '出库仓库', scopedSlots: { customRender: 'warehouseBox' }, width: '15%', align: 'center' },
+          { title: '单位', dataIndex: 'productEntity.unit', width: '6%', align: 'center', customRender: function (text) { return text || '--' } },
+          // { title: '售价小计', dataIndex: 'totalAmount', width: '8%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
+          { title: '操作', scopedSlots: { customRender: 'action' }, width: '10%', align: 'center' }
+        ]
+        if (this.$hasPermissions('B_salesEdit_salesPrice')) { // 售价权限
+          arr.splice(3, 0, { title: '售价', dataIndex: 'price', width: '8%', align: 'right', customRender: text => ((text || text == 0) ? this.toThousands(text) : '--') })
+          arr.splice(7, 0, { title: '售价小计', dataIndex: 'totalAmount', width: '8%', align: 'right', customRender: text => ((text || text == 0) ? this.toThousands(text) : '--') })
+        }
+        return arr
+      }
+    },
+    methods: {
+      filterOption (input, option) {
+        return (
+          option.componentOptions.children[0].text.toLowerCase().indexOf(input.toLowerCase()) >= 0
+        )
+      },
+      warehouseLoad(sn,list){
+        this.warehouseDataList = list
+      },
+      // 表格选中项
+      rowSelectionFun (obj) {
+        this.rowSelectionInfo = obj || null
+      },
+      handleBatchDelAll () {
+        const _this = this
+        if (_this.dataSource.length == 0) {
+          _this.$message.warning('暂无可删除的已选产品!')
+          return
+        }
+        this.$confirm({
+          title: '提示',
+          content: '确认要删除全部已选产品吗?',
+          centered: true,
+          onOk () {
+            _this.spinning = true
+            deleteAll({ salesBillSn: _this.salesBillSn }).then(res => {
+              if (res.status == 200) {
+                _this.resetSearchForm(true)
+                _this.$refs.promotable.resetCurForm()
+                _this.$message.success(res.message)
+              }
+              _this.spinning = false
+            })
+          }
+        })
+      },
+      // 批量删除已选产品
+      handleBatchDel () {
+        const _this = this
+        if (!_this.rowSelectionInfo || (_this.rowSelectionInfo && _this.rowSelectionInfo.selectedRowKeys.length < 1)) {
+          _this.$message.warning('请先选择要删除的产品后再进行批量操作!')
+          return
+        }
+        const obj = []
+        _this.rowSelectionInfo && _this.rowSelectionInfo.selectedRows.map(item => {
+          obj.push(item.salesBillDetailSn)
+        })
+        this.$confirm({
+          title: '提示',
+          content: '已选产品' + obj.length + '项,确认要批量删除吗?',
+          centered: true,
+          onOk () {
+            _this.spinning = true
+            salesDetailBatchDel({
+              salesBillSn: _this.salesBillSn,
+              salesBillDetailSnList: obj
+            }).then(res => {
+              if (res.status == 200) {
+                _this.resetSearchForm(true)
+                _this.$refs.promotable.resetCurForm()
+                _this.$message.success(res.message)
+              }
+              _this.spinning = false
+            })
+          }
+        })
+      },
+      // 设置单个出库仓库
+      handleWarehouseBox (row) {
+        const snArr = [row.salesBillDetailSn]
+        const ajax_data = {
+          warehouseSn: row.warehouseSn,
+          salesBillDetailSnList: snArr,
+          salesBillSn: this.salesBillSn
+        }
+        this.setWarehouseInfo(ajax_data)
+      },
+      chooseWarehouseOk (sn) {
+        const _this = this
+        const snArr = []
+        _this.rowSelectionInfo.selectedRows.forEach(item => {
+          snArr.push(item.salesBillDetailSn)
+        })
+        const ajax_data = {
+          warehouseSn: sn,
+          salesBillDetailSnList: snArr,
+          salesBillSn: _this.salesBillSn
+        }
+        _this.setWarehouseInfo(ajax_data)
+      },
+      setWarehouseInfo (data) {
+        const _this = this
+        _this.spinning = true
+        updateWarehouse(data).then(res => {
+          if (res.status == 200) {
+            _this.openWarehouseModal = false
+            _this.resetSearchForm(true)
+            _this.$refs.promotable.resetCurForm()
+            _this.$message.success(res.message)
+          }
+          _this.$refs.table.refresh(true)
+          _this.spinning = false
+        })
+      },
+      //  产品分类  change
+      changeProductType (val, opt) {
+        this.queryParam.productTypeSn1 = val[0] ? val[0] : ''
+        this.queryParam.productTypeSn2 = val[1] ? val[1] : ''
+        this.queryParam.productTypeSn3 = val[2] ? val[2] : ''
+      },
+      handleMenuClick (e) {
+        const _this = this
+        if (e.key == 0) { // 仓库设置
+          if (!_this.rowSelectionInfo || (_this.rowSelectionInfo && _this.rowSelectionInfo.selectedRowKeys.length < 1)) {
+            _this.$message.warning('请先选择要设置的产品!')
+          } else {
+            _this.openWarehouseModal = true
+          }
+        } else if (e.key == 1) { // 删除已选项
+          this.handleBatchDel()
+        } else {
+          this.handleBatchDelAll()
+        }
+      },
+      // 已选产品  blur
+      onCellBlur (val, record) {
+        const _this = this
+        //  光标移出,值发生改变再调用编辑接口
+        if (val && val != record.qtyBackups) {
+          _this.spinning = true
+          salesDetailUpdateQty({
+            salesBillDetailSn: record.salesBillDetailSn,
+            qty: record.qty,
+            salesBillSn: _this.salesBillSn
+          }).then(res => {
+            _this.resetSearchForm(true)
+            _this.$refs.promotable.resetCurForm()
+            if (res.status == 200) {
+              _this.$message.success(res.message)
+            }
+            _this.spinning = false
+          })
+        } else {
+          record.qty = record.qtyBackups
+        }
+      },
+      //  重置
+      resetSearchForm (flag) {
+        this.queryParam.productCode = ''
+        this.queryParam.productName = ''
+        this.queryParam.warehouseSn = undefined
+        this.queryParam.productBrandSn = undefined
+        this.queryParam.productTypeSn1 = ''
+        this.queryParam.productTypeSn2 = ''
+        this.queryParam.productTypeSn3 = ''
+        this.productType = []
+        this.$refs.table.refresh(!!flag)
+      },
+      // 整单删除
+      delSalerDetailAll () {
+        const _this = this
+        this.$confirm({
+          title: '提示',
+          content: '确认要整单删除吗?',
+          centered: true,
+          closable: true,
+          onOk () {
+            _this.delLoading = true
+            _this.spinning = true
+            salesDetailDelAll({ salesBillSn: _this.salesBillSn }).then(res => {
+              if (res.status == 200) {
+                _this.resetSearchForm()
+                _this.$refs.promotable.resetCurForm()
+                _this.$message.success(res.message)
+              }
+              _this.delLoading = false
+              _this.spinning = false
+            })
+          }
+        })
+      },
+      // 删除产品
+      handleDel (row) {
+        const _this = this
+        this.$confirm({
+          title: '提示',
+          content: '确认要删除吗?',
+          centered: true,
+          closable: true,
+          onOk () {
+            _this.delLoading = true
+            _this.spinning = true
+            salesDetailDel({ salesBillDetailSn: row.salesBillDetailSn, salesBillSn: _this.salesBillSn }).then(res => {
+              if (res.status == 200) {
+                _this.resetSearchForm(true)
+                _this.$refs.promotable.resetCurForm()
+                _this.$message.success(res.message)
+              }
+              _this.delLoading = false
+              _this.spinning = false
+            })
+          }
+        })
+      },
+      // 添加产品
+      insterProduct (row, promotionFlag) {
+        console.log(row, promotionFlag)
+        // 防止多次添加产品
+        if (this.isInster) { return }
+        this.saveNewProduct(row, promotionFlag)
+      },
+      // 保存添加的产品到销售列表
+      saveNewProduct (row, promotionFlag) {
+        this.$message.loading('正在添加产品...', 1)
+        this.isInster = true
+        this.spinning = true
+        salesDetailInsert({
+          packQty: row.productPackQty,
+          productSn: row.productSn,
+          showCost: row.lastStockCost,
+          price: row.productPrice,
+          origPrice: row.productPrice,
+          promotionGiftsAmount: 0,
+          usePromotionGiftsAmount: 0,
+          qty: row.salesNums,
+          salesBillSn: this.detailData.salesBillSn,
+          salesBillNo: this.detailData.salesBillNo,
+          purchaseBillSn: this.detailData.purchaseBillSn,
+          purchaseBillNo: this.detailData.purchaseBillNo,
+          stockSn: row.stockSn,
+          promotableFlag: row.isJoinActivityProduct || 0, // 可促销标记 有活动的传1,没活动的传0
+          promotionFlag: promotionFlag, // 促销标记 正品传0,促销品传1
+          warehouseSn: row.warehouseSn
+        }).then(res => {
+          if (res.status == 200) {
+            this.resetSearchForm()
+            this.$message.success('产品添加成功', 2.5)
+            this.spinning = false
+          } else {
+            this.spinning = false
+          }
+          this.isInster = false
+        }).catch(err => {
+          this.isInster = false
+        })
+      },
+      closeGuideModel () {
+        this.openGuideModal = false
+      },
+      // 导入产品
+      hanldeOk (obj) {
+        salesBatchInsert(obj).then(res => {
+          if (res.status == 200) {
+            this.$refs.table.refresh(true)
+            this.getOrderDetail(false)
+          }
+        })
+      },
+    }
+  }
+</script>
+
+<style lang="less">
+  .total-bar{
+    display:flex;
+    justify-content: space-between;
+  }
+</style>

+ 2 - 2
src/views/salesManagement/salesQueryNew/queryPart.vue → src/views/salesManagement/salesQueryNew/comps/queryPart.vue

@@ -60,7 +60,7 @@
       :columns="columns"
       :data="loadData"
       :customRow="handleClickRow"
-      :scroll="{ y: 149 }"
+      :scroll="{ y: 500 }"
       :defaultLoadData="false"
       bordered>
       <!-- 销售数量 -->
@@ -186,6 +186,7 @@ export default {
     loadWarehouse (sn) {
       this.defaultWarehouseSn = sn
       this.queryParam.warehouseSn = sn
+      this.resetSearchForm()
     },
     // 双击列表
     handleClickRow (record) {
@@ -226,7 +227,6 @@ export default {
     },
     pageInit (buyerSn, warehouseSn) {
       this.buyerSn = buyerSn
-      this.resetSearchForm()
     },
     // 刷新当前页面
     resetCurForm () {

+ 99 - 77
src/views/salesManagement/salesQueryNew/edit.vue

@@ -8,60 +8,78 @@
           <span style="margin: 0 15px;color: #666;">客户名称:{{ detailData&&detailData.buyerName }}</span>
         </template>
       </a-page-header>
-       
-      <a-card size="small" :bordered="false" class="salesEdit-cont">
-        <div slot="title">
-          <a-row :gutter="15" type="flex">
-            <a-col :span="2">
-              <div class="p-title">
-                促销产品
-              </div>
-            </a-col>
-            <a-col :span="16">
-               
-            </a-col>
-          </a-row>
-        </div>
-        
-        <a-collapse v-model="activeKey">
-          <a-collapse-panel v-for="item in activeList" :key="item.activeId" forceRender>
-            <div slot="header" style="font-size:14px;display: inline-block;">
-              <strong>{{item.activeName}}</strong>({{item.activeDesc}})
-            </div>
-            <a-icon slot="extra" style="margin-right:10px;" type="search" @click="(event) => {showSearch(event, item.activeId)}" />
+      <!-- 正常产品 -->
+      <a-card size="small" :bordered="false" class="salesEdit-cont" v-if="salesBillSn">
+        <productNormalList ref="productNormalList" :detailData="detailData" :warehouseSn="warehouseSn" :salesBillSn="salesBillSn"></productNormalList>
+      </a-card>
+      <!-- 活动产品 -->
+      <a-collapse v-model="activeKey" style="background: #f8f8f8;border-color: #f8f8f8;">
+        <a-collapse-panel 
+        v-for="item in activeList" 
+        :key="item.activeId" 
+        forceRender 
+        style="background: #fff;border-radius: 5px;margin-bottom: 10px;border: 0;overflow: hidden;">
+          <div slot="header" style="display: inline-block;padding:6px;width:80%;">
             <div>
-              <a-descriptions>
-                  <a-descriptions-item label="UserName">
-                    Zhou Maomao
-                  </a-descriptions-item>
-                  <a-descriptions-item label="Telephone">
-                    1810000000
-                  </a-descriptions-item>
-                  <a-descriptions-item label="Live">
-                    Hangzhou, Zhejiang
-                  </a-descriptions-item>
-                  <a-descriptions-item label="Remark">
-                    empty
-                  </a-descriptions-item>
-                  <a-descriptions-item label="Address">
-                    No. 18, Wantang Road, Xihu District, Hangzhou, Zhejiang, China
-                  </a-descriptions-item>
-                </a-descriptions>
+              <strong style="margin-right:10px;font-size:16px;">{{item.activeName}}</strong> ({{item.activeDesc}})
+              <span style="margin-left:10px;color:#00aaff;"  @click="(event) => {showDesc(event, item.activeId)}">
+                <a-icon title="查看活动详情" type="eye"/> 查看详情
+              </span>
             </div>
-            <productList :ref="'productList-'+item.activeId" :detailData="detailData" :warehouseSn="warehouseSn" :salesBillSn="salesBillSn"></productList>
-          </a-collapse-panel>
-        </a-collapse>
-      </a-card>
+          </div>
+          <span slot="extra" style="margin-right:10px;color:#00aaff;" @click="(event) => {showSearch(event, item.activeId)}" >
+            <a-icon style="margin-top:13px;" type="search"/> 筛选
+          </span>
+          <productList :ref="'productList-'+item.activeId" :detailData="detailData" :warehouseSn="warehouseSn" :salesBillSn="salesBillSn"></productList>
+        </a-collapse-panel>
+      </a-collapse>
     </a-spin>
     <div class="affix-cont">
-      <a-button
-        size="large"
-        style="padding: 0 60px;"
-        :disabled="spinning"
-        type="primary"
-        class="button-primary"
-        @click="handleSubmit()"
-        id="productInfoList-handleSubmit">提交</a-button>
+      <div class="footer-price">
+        <div>产品总款数:<strong>12</strong>;总数量:<strong>111</strong>;总售价:<strong>17898.88</strong></div>
+        <div>
+          <div class="totalPrice">合计:¥<span>121.60</span></div>
+          <div>
+            <span style="margin-right:10px;">优惠金额:¥<strong>121.60</strong></span>
+            <a-popover title="优惠明细">
+              <a-button shape="round" size="small">优惠明细</a-button>
+              <div slot="content">
+                <div class="yhdetail" style="min-width:300px;">
+                  <div class="yhdetail-h" style="font-weight: bold;font-size:14px;">520以爱之名保护你</div>
+                  <div style="padding-left:10px;">
+                    <div>卖产品送产品:¥<strong>220</strong></div>
+                    <div class="yhdetail-d" style="color:#999;">满10送2</div>
+                  </div>
+                </div>
+                <div class="yhdetail">
+                  <div class="yhdetail-h" style="font-weight: bold;font-size:14px;">滤清器夏季大派送</div>
+                  <div style="padding-left:10px;">
+                    <div>卖产品送产品:¥<strong>220</strong></div>
+                    <div class="yhdetail-d" style="color:#999;">满10送2</div>
+                  </div>
+                </div>
+                <div class="yhdetail">
+                  <div class="yhdetail-h" style="font-weight: bold;font-size:14px;">520以爱之名保护你</div>
+                  <div style="padding-left:10px;">
+                    <div>卖产品送产品:¥<strong>220</strong></div>
+                    <div class="yhdetail-d" style="color:#999;">满10送2</div>
+                  </div>
+                </div>
+              </div>
+            </a-popover>
+          </div>
+        </div>
+      </div>
+      <div>
+        <a-button
+          size="large"
+          style="padding: 0 60px;"
+          :disabled="spinning"
+          type="primary"
+          class="button-primary"
+          @click="handleSubmit()"
+          id="productInfoList-handleSubmit">提交</a-button>
+      </div>
     </div>
     <!-- 价格更新弹窗 -->
     <setPriceModal :show="priceUpdateModal" :totalRealAmount="updataData.totalRealAmount" :totalAmount="updataData.totalAmount" @ok="updatePrice" @cancel="priceUpdateModal=false"></setPriceModal>
@@ -71,6 +89,7 @@
 <script>
 import { commonMixin } from '@/utils/mixin'
 import productList from './comps/productList.vue'
+import productNormalList from './comps/productNormalList.vue'
 import setPriceModal from './setPriceModal.vue'
 import { salesDetailBySn, salesWriteSubmit, submitCheck, updateBatch } from '@/api/sales'
 export default {
@@ -78,7 +97,8 @@ export default {
   mixins: [commonMixin],
   components:{
     setPriceModal,
-    productList
+    productList,
+    productNormalList
   },
   data () {
     return {
@@ -107,6 +127,7 @@ export default {
         if (res.status == 200) {
           this.detailData = res.data
         }
+        this.getActive()
       })
     },
     // 选择价格类型  并更新
@@ -170,16 +191,20 @@ export default {
     showSearch(e,id){
       e.stopPropagation()
       const row = this.$refs['productList-'+id][0]
-      console.log(row)
       row&&row.showSearch()
     },
+    showDesc(e,id){
+      e.stopPropagation()
+      const row = this.$refs['productList-'+id][0]
+      row&&row.showDesc()
+    },
     // 获取活动列表
     getActive(){
       this.activeList = [
         {
           activeId: '102312313',
-          activeName: "五一超优惠活动",
-          activeDesc: "满5000300"
+          activeName: "520以爱之名保护你",
+          activeDesc: "满5000300"
         },
         {
           activeId: '02342341',
@@ -203,10 +228,9 @@ export default {
       })
     },
     pageInit () {
-      this.getActive()
-      this.getOrderDetail(true)
       this.salesBillSn = this.$route.params.sn
       this.warehouseSn = this.$route.params.sn ? this.$route.params.wSn : ''
+      this.getOrderDetail(true)
     }
   },
   mounted () {
@@ -233,21 +257,11 @@ export default {
     padding-bottom: 51px;
     box-sizing: border-box;
     >.ant-spin-nested-loading{
-      overflow-y: scroll;
+      overflow-y: auto;
       height: 100%;
     }
     .salesEdit-cont{
-      margin-top: 10px;
-    }
-    .p-title{
-      font-weight: bold;
-      font-size: 14px;
-    }
-    .p-notes{
-      font-size: 14px;
-      span{
-        color: #FF9900;
-      }
+      margin: 10px 0;
     }
     .redStyle{
       font-weight: bold;
@@ -267,17 +281,25 @@ export default {
         -webkit-box-orient: vertical;
       }
     }
-    .total-bar{
+    .affix-cont{
+      padding: 5px 15px;
+      text-align: right;
       display: flex;
-      align-items: center;
       justify-content: space-between;
-      > div{
-        &:last-child{
-          display: flex;
-          align-items: center;
-          justify-content: space-between;
-          > div{
-            padding: 0 10px;
+      align-items: center;
+      .footer-price{
+        flex-grow:1;
+        display: flex;
+        justify-content: flex-end;
+        align-items: center;
+        > div{
+          padding: 0 15px;
+        }
+        .totalPrice{
+          span{
+            font-weight: bold;
+            color: red;
+            font-size: 20px;
           }
         }
       }