Browse Source

Merge branch 'develop_yh15' of http://git.chelingzhu.com/jianguan-web/qpls-md-html into develop_yh15

chenrui 2 năm trước cách đây
mục cha
commit
29056c969d

+ 1 - 1
public/version.json

@@ -1,5 +1,5 @@
 {
   "message": "发现有新版本发布,确定更新系统?",
   "vendorJsVersion": "",
-  "version": 1677489479100
+  "version": 1677566210366
 }

+ 1 - 0
src/components/index.less

@@ -334,6 +334,7 @@
         border:1px solid #dadada;
         border-radius: 3px;
         overflow: hidden;
+        margin-bottom: 10px!important;
         .ant-form-item-label{
           padding-left: 11px;
           padding-right: 0!important;

+ 1 - 0
src/views/bulkManagement/bulkWarehousingOrder/edit.vue

@@ -499,6 +499,7 @@ export default {
       this.paramsData = data
       this.queryParam.code = data.code
       this.$refs.table.refresh(true)
+      this.spinning = false
     },
     //  重置产品列表
     resetSearchForm () {

+ 1 - 1
src/views/productManagement/productInfo/edit.vue

@@ -380,10 +380,10 @@ export default {
               _this.$message.success(res.message)
               if (_this.pageType == 'pages') {
                 _this.$router.push({ path: '/productManagement/productInfo/list' })
-                _this.spinning = false
               } else {
                 _this.$emit('saveOk', _this.form)
               }
+              _this.spinning = false
             } else {
               _this.spinning = false
             }

+ 1 - 1
src/views/salesManagement/salesQuery/edit.vue

@@ -6,7 +6,7 @@
         <template slot="subTitle">
           <a id="salesEdit-back-btn" href="javascript:;" @click="handleBack"><a-icon type="left" /> 返回列表</a>
           <a style="margin: 0 15px;color: #666;font-size: 18px;font-weight: 600;">单号:{{ detailData&&detailData.salesBillNo || '--' }}</a>
-          <span style="margin: 0 10px;color: #666;">客户名称:{{ detailData&&detailData.buyerName || '--' }}</span>
+          <span style="margin: 0 10px;color: #666;">客户名称:{{ detailData&&detailData.buyerNameCurrent || '--' }}</span>
           <a-button
             id="salesEdit-edit-btn"
             v-if="detailData&&detailData.salesTragetType != 'DEALER'"

+ 642 - 0
src/views/salesManagement/salesQueryNew/chooseProductModal.vue

@@ -0,0 +1,642 @@
+<template>
+  <a-drawer
+    :zIndex="zIndex"
+    :title="title"
+    placement="right"
+    :visible="visible"
+    :width="width"
+    :get-container="false"
+    :wrap-style="{ position: 'absolute' }"
+    @close="onClose"
+    wrapClassName="chooseProduct-drawer jg-drawer-wrap">
+    <a-spin :spinning="spinning" tip="Loading...">
+    <div class="productInfoList-wrap">
+    <!-- 搜索条件 -->
+    <div ref="searchBox" class="table-page-search-wrapper">
+      <a-form-model
+        ref="ruleForm"
+        class="form-model-con"
+        layout="inline"
+        :rules="rules"
+        :model="queryParam"
+        @keyup.enter.native="$refs.table.refresh(true)" >
+        <a-row type="flex" :gutter="5">
+          <a-col flex="1">
+            <a-form-model-item label="产品编码">
+              <a-input id="productInfoList-code" ref="searchProductCode" v-model.trim="queryParam.productCode" allowClear placeholder="请输入产品编码"/>
+            </a-form-model-item>
+          </a-col>
+          <a-col flex="1">
+            <a-form-model-item label="产品名称">
+              <a-input id="productInfoList-name" v-model.trim="queryParam.productName" allowClear placeholder="请输入产品名称"/>
+            </a-form-model-item>
+          </a-col>
+          <a-col flex="1">
+            <a-form-model-item label="原厂编码">
+              <a-input id="productInfoList-origCode" v-model.trim="queryParam.productOrigCode" allowClear placeholder="请输入原厂编码"/>
+            </a-form-model-item>
+          </a-col>
+          <a-col flex="1">
+            <a-form-model-item label="产品品牌">
+              <ProductBrand id="productInfoList-productBrandSn" v-model="queryParam.brandSn"></ProductBrand>
+            </a-form-model-item>
+          </a-col>
+        </a-row>
+        <a-row type="flex" :gutter="5">
+          <a-col flex="1.5">
+            <a-form-model-item label="产品分类">
+              <ProductType id="productInfoList-productType" :isDealer="true" @change="changeProductType" v-model="productType"></ProductType>
+            </a-form-model-item>
+          </a-col>
+          <a-col flex="1.5">
+              <a-form-model-item label="仓库">
+                <a-select
+                  placeholder="请选择仓库"
+                  id="productInfoList-warehouseSn"
+                  allowClear
+                  v-model="queryParam.warehouseSn"
+                  :showSearch="true"
+                  option-filter-prop="children"
+                  :filter-option="filterOption">
+                  <a-select-option v-for="item in warehouseList" :key="item.warehouseSn" :value="item.warehouseSn">{{ item.name }}</a-select-option>
+                </a-select>
+              </a-form-model-item>
+            </a-col>
+            <a-col flex="2" v-if="$hasPermissions('B_salerVinFindProduct')">
+              <a-form-model-item label="车架号(VIN)" prop="vinCode">
+                <a-input id="productInfoList-vinCode" v-model.trim="queryParam.vinCode" allowClear placeholder="请输入车架号(VIN)">
+                  <a-icon @click="uploadFun" :type="vinLoading?'loading':'camera'" slot="addonAfter" :style="{ fontSize: '18px', verticalAlign: 'bottom' }" />
+                </a-input>
+                <input type="file" id="filed" accept="image/jpeg,image/png" hidden="" @change="filePreview">
+              </a-form-model-item>
+            </a-col>
+            <a-col flex="200px">
+              <a-form-item label="是否有库存">
+                <a-select @change="handleHasQty" allowClear :value="queryParam.existStockFlag" placeholder="请选择是否">
+                  <a-select-option value="1">
+                    是
+                  </a-select-option>
+                  <a-select-option value="0">
+                    否
+                  </a-select-option>
+                </a-select>
+              </a-form-item>
+            </a-col>
+          <a-col flex="auto">
+            <a-button type="primary" @click="searchForm()" :disabled="disabled" id="productInfoList-refresh">查询</a-button>
+            <a-button style="margin-left: 5px" @click="resetSearchForm" id="productInfoList-reset">重置</a-button>
+          </a-col>
+        </a-row>
+      </a-form-model>
+
+      <div v-if="hasVaild&&showTable" class="vinInfo-box">
+        <div>
+          <div class="vinInfo-error" v-if="vinInfoData&&!vinInfoData.vinInfo">
+            <a-icon type="exclamation-circle" theme="filled" :style="{ color: '#E70012', fontSize: '15px', verticalAlign: 'sub', marginRight: '3px' }" />抱歉!暂未找到匹配VIN码的车型!
+          </div>
+          <div v-if="vinInfoData&&vinInfoData.vinInfo" @click="openCarInfoModal=true">
+            <div style="display: flex;justify-content: space-between;align-items: center;" @click="openCarInfoModal=true">
+              <div>
+                <img :src="vinInfoData.vinInfo && vinInfoData.vinInfo.icon?(vinInfoData.vinInfo.icon+'?x-oss-process=image/resize,h_30,m_lfit'):defImg" width="30" height="30" class="imageUrl" style="border-radius: 50%;vertical-align: middle;margin-right: 3px;" />
+                <span style="vertical-align: middle;">{{ vinInfoData.vinInfo.text }}</span>
+              </div>
+              <div style="color: #f90;cursor: pointer;">
+                <span>查看更多</span> >
+              </div>
+            </div>
+          </div>
+        </div>
+        <div>
+          <a-dropdown v-model="showCell">
+            <a class="ant-dropdown-link" @click="e => e.preventDefault()">
+              <a-icon type="setting" /> 显示
+            </a>
+            <a-menu slot="overlay">
+              <a-menu-item>
+                <a-checkbox v-model="cost" v-if="$hasPermissions('M_ShowAllCost')" id="salesQuery-cost">成本价</a-checkbox>
+              </a-menu-item>
+              <a-menu-item>
+                <a-checkbox v-model="cityPrice" id="salesQuery-cityPrice">市级价</a-checkbox>
+              </a-menu-item>
+              <a-menu-item>
+                <a-checkbox v-model="tyuePrice" v-if="$store.state.user.isShowSpecialPrice==1" id="salesQuery-tyuePrice">特约价</a-checkbox>
+              </a-menu-item>
+              <a-menu-item>
+                <a-checkbox v-model="zdPrice" id="salesQuery-zdPrice">终端价</a-checkbox>
+              </a-menu-item>
+            </a-menu>
+          </a-dropdown>
+        </div>
+      </div>
+    </div>
+     
+    <!-- 列表 -->
+    <s-table
+      v-if="hasVaild&&showTable"
+      class="sTable"
+      ref="table"
+      size="small"
+      :rowKey="(record) => record.no"
+      rowKeyName="no"
+      :columns="columns"
+      :data="loadData"
+      @dblclick="handleClickRow"
+      :pageSize="30"
+      :scroll="{ y: tableHeight, x: tableWidth||1800 }"
+      bordered>
+      <div slot="costTitle">
+        <a-tooltip placement="top">
+          <template slot="title">
+            产品所在仓库仓位的最近一次入库成本,不包含盘盈入库和仓库调拨入库。
+          </template>
+          <span style="margin-right: 5px;">参考成本价</span> <a-icon type="question-circle" />
+        </a-tooltip>
+      </div>
+      <!-- 售价 -->
+      <template slot="salePrice" slot-scope="text, record">
+        <div style="display: flex;align-items: center;" @dblclick.stop>
+          <a-input-number
+            size="small"
+            v-model="record.price"
+            :precision="2"
+            :min="0"
+            :max="999999"
+            style="width: 100%;"
+            placeholder="请输入" />
+          <span style="color: red;margin: 0 2px;font-size: 14px;" v-if="record.origSalePriceFlag == 1">原</span>
+          <span v-else>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span>
+        </div>
+      </template>
+      <!-- 销售数量 -->
+      <template slot="nums" slot-scope="text, record">
+        <div @dblclick.stop>
+          <a-input-number
+            size="small"
+            v-model="record.salesNums"
+            :precision="0"
+            :min="0"
+            :max="999999"
+            style="width: 100%;"
+            placeholder="请输入" />
+        </div>
+      </template>
+      <!-- 操作 -->
+      <template slot="action" slot-scope="text, record">
+        <a-button
+          size="small"
+          type="link"
+          class="button-primary"
+          @click="handleAdd(record)"
+          id="productInfoList-edit-btn">添加</a-button>
+        <a-button
+          size="small"
+          type="link"
+          class="button-primary"
+          @click="handleDetail(record)"
+          id="productInfoList-detail-btn"
+          style="margin-left: 5px;">销售记录</a-button>
+      </template>
+    </s-table>
+    <div v-else>
+      <a-empty
+        :image="simpleImage"
+        :image-style="{
+          height: '60px',
+        }"
+      >
+        <span style="color:red" slot="description">请输入查询条件</span>
+      </a-empty>
+    </div>
+    <!-- 销售记录 -->
+    <product-salesRecord-modal ref="salseRecord" :openModal="openModal" @close="closeModal" />
+    <!-- 查看车辆信息 -->
+    <car-info-modal ref="carInfoModal" :openModal="openCarInfoModal" :infoData="vinInfoData&&vinInfoData.vinInfo" @close="openCarInfoModal=false" />
+  </div>
+    </a-spin>
+  </a-drawer>
+</template>
+
+<script>
+import { Empty } from 'ant-design-vue'
+import { commonMixin } from '@/utils/mixin'
+import { querySumByProductLocation } from '@/api/stock'
+import { warehouseAllList } from '@/api/warehouse'
+import productSalesRecordModal from './productSalesRecordModal.vue'
+import carInfoModal from './carInfoModal.vue'
+import ProductType from '../../common/productType.js'
+import ProductBrand from '../../common/productBrand.js'
+import { STable, VSelect, Upload } from '@/components'
+import { supperCodeByVin, vinCodeParse } from '@/api/sales'
+import defImg from '@/assets/def_img@2x.png'
+export default {
+  mixins: [commonMixin],
+  components: { STable, VSelect, Upload, productSalesRecordModal, carInfoModal, ProductType, ProductBrand },
+  props: {
+    showModal: {
+      type: Boolean,
+      default: false
+    },
+    width: {
+      type: [String, Number],
+      default: '80%'
+    },
+    zIndex: {
+      type: Number,
+      default: 100
+    },
+    newLoading: {
+      type: Boolean
+    }
+  },
+  watch: {
+    showModal (newValue, oldValue) {
+      this.visible = newValue
+      if (newValue) {
+        this.$refs.searchProductCode.focus()
+        this.setTableH()
+      }
+    },
+    '$store.state.app.winHeight' (newValue, oldValue) { //  窗口变更时,需同时更改表格高度
+      this.setTableH()
+    }
+  },
+  data () {
+    return {
+      showCell:false,
+      spinning: false,
+      showTable: false,
+      visible: this.showModal,
+      title: '添加产品',
+      tableHeight: 0,
+      tableWidth: 1800,
+      simpleImage: Empty.PRESENTED_IMAGE_SIMPLE,
+      advanced: false, // 高级搜索 展开/关闭
+      vinLoading: false,
+      productType: [],
+      defImg,
+      queryParam: { //  查询条件
+        customerSn: '',
+        salesBillSn: '',
+        salePriceType: '',
+        productCode: '', //  产品编码
+        productName: '', //  产品名称
+        productOrigCode: '', //  原厂编码
+        vinCode: '',
+        productCodeList: undefined, //  车架号
+        brandSn: undefined, //  产品品牌
+        productTypeSn1: '', //  产品一级分类
+        productTypeSn2: '', //  产品二级分类
+        productTypeSn3: '', //  产品三级分类
+        warehouseSn: undefined, //  仓库、
+        enableFlag: '1',
+        existStockFlag: undefined
+      },
+      priceType: '',
+      buyerSn: '',
+      rules: {
+        vinCode: [ { len: 17, message: '请输入正确的车架号(VIN)', trigger: 'change' } ]
+      },
+      disabled: false, //  查询、重置按钮是否可操作
+      warehouseList: [], // 仓库列表
+      vinInfoData: null,
+      // 加载数据方法 必须为 Promise 对象
+      loadData: parameter => {
+        const _this = this
+        _this.queryParam.salePriceType = _this.priceType
+        _this.queryParam.customerSn = _this.buyerSn
+        // 排序
+        if (parameter.sortField == 'productCode') {
+          parameter.sortField = 'code'
+          parameter.sortAlias = 'product '
+        }
+        if (parameter.sortField == 'brandName') {
+          parameter.sortField = 'firstChar'
+          parameter.sortAlias = 'brand'
+        }
+        if (parameter.sortField == 'warehouseName') {
+          parameter.sortField = 'warehouseSn'
+          parameter.sortAlias = 'sd'
+        }
+        const params = Object.assign(parameter, _this.queryParam)
+        if (_this.queryParam.vinCode && _this.queryParam.vinCode.length == 17 && !this.onlyList) { //  输入vin,查出vin码信息后请求列表数据
+          _this.disabled = true
+          return supperCodeByVin({ vin: _this.queryParam.vinCode }).then(res => {
+            if (res.status == 200) {
+              _this.vinInfoData = res.data
+              params.productCodeList = res.data.partCodeList || []
+              return _this.getList(params)
+            } else {
+              _this.vinInfoData = null
+              _this.$refs.table.localLoading = false
+              _this.$refs.table.clearTable()
+            }
+          })
+        } else if (_this.queryParam.vinCode && _this.queryParam.vinCode.length < 17 && !this.onlyList) { // 输入vin,但vin码不符合标准,不查vin码信息,不请求列表数据
+          _this.$refs.table.localLoading = false
+          _this.$refs.table.clearTable()
+        } else if (this.onlyList) {
+          _this.disabled = true
+          if (_this.queryParam.vinCode && _this.vinInfoData) {
+            return _this.getList(Object.assign(params, { productCodeList: _this.vinInfoData.partCodeList }))
+          } else {
+            return _this.getList(params)
+          }
+        } else { //  未输入vin码信息,只查列表数据
+          _this.disabled = true
+          return _this.getList(params)
+        }
+      },
+      openModal: false, //  查看客户详情  弹框
+      cost: false, // 成本价
+      cityPrice: false, // 城市价
+      tyuePrice: false, // 特约价
+      zdPrice: false, // 终端价
+      openCarInfoModal: false,
+      onlyList: false
+    }
+  },
+  computed: {
+    hasVaild () {
+      return this.queryParam.productCode || this.queryParam.productName || this.queryParam.brandSn || this.queryParam.productTypeSn1 || this.queryParam.warehouseSn || this.queryParam.existStockFlag || this.queryParam.vinCode
+    },
+    columns () {
+      const _this = this
+      const arr = [
+        { title: '产品编码', dataIndex: 'productCode', width: '150px', align: 'center', sorter: true, customRender: function (text) { return text || '--' }, fixed: 'left' },
+        { title: '产品名称', dataIndex: 'productName', align: 'center', customRender: function (text) { return text || '--' }, ellipsis: true },
+        { title: '原厂编码', dataIndex: 'productOrigCode', width: '150px', align: 'center', customRender: function (text) { return text || '--' } },
+        { title: '库存数量', dataIndex: 'currentQty', width: '100px', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
+      ]
+      if (this.cost) {
+        this.tableWidth += 100
+        arr.push({ slots: { title: 'costTitle' }, dataIndex: 'putCost', width: '100px', align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } })
+      }else{
+        this.tableWidth -= 100
+      }
+      if (this.cityPrice) {
+        this.tableWidth += 80
+        arr.push({ title: '市级价', dataIndex: 'dealerProduct.cityPrice', width: '80px', align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } })
+      }else{
+        this.tableWidth -= 80
+      }
+      if (this.tyuePrice) {
+        this.tableWidth += 80
+        arr.push({ title: '特约价', dataIndex: 'dealerProduct.specialPrice', width: '80px', align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } })
+      }else{
+        this.tableWidth -= 80
+      }
+      if (this.zdPrice) {
+        this.tableWidth += 80
+        arr.push({ title: '终端价', dataIndex: 'dealerProduct.terminalPrice', width: '80px', align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } })
+      }else{
+        this.tableWidth -= 80
+      }
+
+      return arr.concat([
+        { title: '品牌', dataIndex: 'brandName', width: '120px', align: 'center', sorter: true, customRender: function (text) { return text || '--' } },
+        { title: '仓库', dataIndex: 'warehouseName', width: '120px', align: 'center', customRender: function (text) { return text || '--' } },
+        { title: '仓位', dataIndex: 'warehouseLocationName', width: '120px', align: 'center', customRender: function (text) { return text || '--' } },
+        { title: '单位', dataIndex: 'unit', width: '60px', align: 'center', customRender: function (text) { return text || '--' } },
+        { title: '售价', dataIndex: 'salePrice', scopedSlots: { customRender: 'salePrice' }, width: '120px', align: 'center', fixed: 'right' },
+        { title: '销售数量', dataIndex: 'salesNums', scopedSlots: { customRender: 'nums' }, width: '100px', align: 'center', fixed: 'right' },
+        { title: '操作', dataIndex: 'action', scopedSlots: { customRender: 'action' }, width: '120px', align: 'center', fixed: 'right' }
+      ])
+    }
+  },
+  created () {
+    // 仓库
+    if (this.warehouseList.length == 0) {
+      this.getWarehouse()
+    }
+  },
+  methods: {
+    // 查询
+    searchForm () {
+      if (this.hasVaild) {
+        this.showTable = true
+        if (this.$refs.table) {
+          this.$refs.table.refresh(true)
+        }
+      } else {
+        this.showTable = false
+        this.$message.info('请输入查询条件')
+      }
+    },
+    getList (params) {
+      const _this = this
+      return querySumByProductLocation(params).then(res => {
+        let data
+        this.onlyList = false
+        if (res.status == 200) {
+          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 = data.list[i].productSn + '_' + (no + i + 1)
+            data.list[i].salesNums = 1
+            data.list[i].currentQty = data.list[i].currentQty || 0
+            data.list[i].price = data.list[i].origSalePriceFlag == 0 ? data.list[i].lastSalePrice : data.list[i].origSalePriceFlag == 1 ? data.list[i].salePrice : data.list[i].selfSaleprice
+            data.list[i].productOrigCode = data.list[i].productOrigCode ? data.list[i].productOrigCode.trim() : ''
+          }
+          if (!params.vinCode) {
+            _this.vinInfoData = null
+          }
+        } else {
+          data = {
+            list: [],
+            pageNo: 1,
+            pageSize: 10
+          }
+        }
+        _this.disabled = false
+        console.log(data)
+        return data
+      })
+    },
+    // vin  change
+    vinCodeChange (e) {
+      if (e.target.value.length == 17) {
+        supperCodeByVin({ vin: e.target.value }).then(res => {
+          if (res.status == 200) {
+            this.queryParam.productCodeList = res.data
+          } else {
+            this.queryParam.productCodeList = undefined
+          }
+        })
+      } else {
+        this.queryParam.productCodeList = undefined
+      }
+    },
+    // 双击列表
+    handleClickRow (record) {
+      this.$emit('add', record)
+    },
+    //  重置
+    resetSearchForm (flag) {
+      this.queryParam.productCode = ''
+      this.queryParam.productName = ''
+      this.queryParam.productOrigCode = ''
+      this.queryParam.brandSn = undefined
+      this.queryParam.productTypeSn1 = ''
+      this.queryParam.productTypeSn2 = ''
+      this.queryParam.productTypeSn3 = ''
+      this.queryParam.warehouseSn = undefined
+      this.queryParam.productCodeList = undefined
+      this.queryParam.existStockFlag = undefined
+      this.queryParam.vinCode = ''
+      this.productType = []
+      this.$refs.ruleForm.resetFields()
+      this.vinInfoData = null
+      this.showTable = false
+
+      if(!flag){
+        this.$refs.table.refresh(true)
+      }
+    },
+    pageInit (buyerSn, priceType, salesBillSn) {
+      this.priceType = priceType || ''
+      this.buyerSn = buyerSn || ''
+      this.queryParam.salesBillSn = salesBillSn || ''
+    },
+    // 刷新当前页面
+    resetCurForm () {
+      this.$refs.table.refresh()
+    },
+    // 清空数据
+    clearTable () {
+      this.vinInfoData = null
+      this.$refs.ruleForm.resetFields()
+      this.$refs.table.clearTable()
+    },
+    filterOption (input, option) {
+      return (
+        option.componentOptions.children[0].text.toLowerCase().indexOf(input.toLowerCase()) >= 0
+      )
+    },
+    // 选择配件
+    handleAdd (row) {
+      const _this = this
+      console.log(row.price, row.lastSalePrice, row.salePrice, row.lastSalePrice < row.salePrice)
+      if (row.lastSalePrice && (row.price < row.salePrice)) {
+        _this.$confirm({
+          title: '提示',
+          content: '售价低于定价,是否仍继续添加?',
+          centered: true,
+          closable: true,
+          onOk () {
+            _this.$emit('add', row)
+          }
+        })
+      } else {
+        _this.$emit('add', row)
+      }
+    },
+    // 销售记录
+    handleDetail (row) {
+      this.openModal = true
+      this.$refs.salseRecord.getDetail(this.buyerSn, row.productSn, row)
+    },
+    //  关闭弹框
+    closeModal () {
+      this.openModal = false
+    },
+    uploadFun () {
+      document.getElementById('filed').click()
+    },
+    filePreview (e) {
+      const _this = this
+      var files = e.target.files[0]
+      const formData = new FormData()
+      formData.append('savePathType', 'local')
+      formData.append('file', files)
+      this.vinLoading = true
+      vinCodeParse(formData).then(res => {
+        if (res.type == 'application/json') {
+          var reader = new FileReader()
+          reader.addEventListener('loadend', function () {
+            const obj = JSON.parse(reader.result)
+            if (obj.status == 200) {
+              _this.queryParam.vinCode = obj.data || ''
+              // 移除表单项的校验结果
+              _this.$refs.ruleForm.clearValidate('vinCode')
+            } else {
+              _this.$notification.error({
+                message: '提示',
+                description: obj.message
+              })
+            }
+            _this.vinLoading = false
+            document.getElementById('filed').value = ''
+          })
+          reader.readAsText(res)
+        } else {
+          _this.vinLoading = false
+        }
+      })
+    },
+    // 仓库
+    getWarehouse () {
+      warehouseAllList({}).then(res => {
+        if (res.status == 200) {
+          this.warehouseList = res.data
+        } else {
+          this.warehouseList = []
+        }
+      })
+    },
+    //  产品分类  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] : ''
+    },
+    // 查看是否有库存、
+    handleHasQty (val) {
+      this.queryParam.existStockFlag = val
+    },
+    onClose () {
+      this.resetSearchForm(true)
+      this.$emit('close')
+    },
+    setTableH () {
+      this.$nextTick(() => {
+        const searchBoxH = this.$refs.searchBox.offsetHeight
+        this.tableHeight = window.innerHeight - searchBoxH - 245
+      })
+    }
+  }
+}
+</script>
+
+<style lang="less">
+.chooseProduct-drawer {
+  .ant-drawer-header{
+    padding: 13px 20px;
+  }
+  .ant-drawer-body {
+    padding: 15px 20px;
+    height: calc(100% - 50px);
+    display: flex;
+    flex-direction: column;
+    overflow: auto;
+    > div {
+      height: 100%;
+    }
+    .noStock{
+      text-decoration: line-through;
+      color: red;
+    }
+    .ant-input-number-sm input{
+      text-align: center;
+    }
+    .vinInfo-box{
+      display: flex;
+      justify-content: space-between;
+      align-items: center;
+      .vinInfo-error{
+        color: red;
+      }
+    }
+  }
+}
+</style>

+ 269 - 217
src/views/salesManagement/salesQueryNew/edit.vue

@@ -1,6 +1,5 @@
 <template>
   <div v-if="showPage" class="jg-page-wrap salesEdit-wrap">
-    <a-spin :spinning="spinning" tip="Loading...">
       <a-page-header :ghost="false" :backIcon="false" class="header-bar">
         <!-- 自定义的二级文字标题 -->
         <template slot="subTitle">
@@ -29,6 +28,15 @@
             <a-divider type="vertical" v-if="detailData&&detailData.totalCategory" />
             <a-button v-if="detailData&&detailData.totalCategory" id="salesNewOrderEdit-add-btn" type="link" @click="openChooseProduct=true"><a-icon type="plus" />添加产品</a-button>
             <a-divider type="vertical" />
+            <a-dropdown v-model="showCell" v-if="$hasPermissions('M_ShowAllCost')">
+              <a-button type="link" class="button-default"> <a-icon type="setting" />  显示</a-button>
+              <a-menu slot="overlay">
+                <a-menu-item>
+                  <a-checkbox v-model="isCosts" id="salesQuery-edit-cost">成本价</a-checkbox>
+                </a-menu-item>
+              </a-menu>
+            </a-dropdown>
+            <a-divider type="vertical" v-if="$hasPermissions('M_ShowAllCost')"/>
             <a-dropdown>
               <a-menu slot="overlay" @click="handleActions">
                 <a-menu-item key="4">
@@ -49,174 +57,208 @@
           </div>
         </template>
       </a-page-header>
-      <a-card size="small" :bordered="false" class="salesEdit-cont">
-        <!-- 查询配件列表 -->
-        <queryPart
-          ref="partQuery"
-          :newLoading="isInster"
-          @add="insterProduct"
-          @isCost="isCost"></queryPart>
-      </a-card>
-      <a-card size="small" :bordered="false" class="salesEdit-cont">
-        <!-- 总计 -->
-        <a-alert v-if="detailData" style="margin-bottom: 10px;" type="info">
-          <div slot="message" class="total-bar">
-            <div>
-              总售价:<strong>{{ detailData&&(detailData.totalAmount || detailData.totalAmount==0) ? toThousands(detailData.totalAmount) : '--' }}</strong>;
-              总款数:<strong>{{ detailData&&(detailData.totalCategory || detailData.totalCategory==0) ? detailData.totalCategory : '--' }}</strong>;
-              总数量:<strong>{{ detailData&&(detailData.totalQty || detailData.totalQty==0) ? detailData.totalQty : '--' }}</strong>;
-              赠品总数量:<strong>{{ detailData&&(detailData.giftQty || detailData.giftQty==0) ? detailData.giftQty : '--' }}</strong>;
-              <span v-if="isCosts">
-                总成本价:<strong>{{ detailData&&(detailData.totalCost || detailData.totalCost==0) ? toThousands(detailData.totalCost) : '--' }}</strong>;
-                毛利:<strong>{{ detailData&&(detailData.grossProfit || detailData.grossProfit==0) ? toThousands(detailData.grossProfit) : '--' }}</strong>;
-              </span>
+       <!-- 已选产品 -->
+      <div class="choosedList-cont">
+        <div class="choosed-table" v-if="detailData&&detailData.totalCategory">
+          <!-- 搜索条件 -->
+          <div class="table-page-search-wrapper" style="margin-bottom:0;" v-if="showSearch">
+            <a-row :gutter="0">
+              <a-col :lg="24" :xl="14">
+                <a-form-model :model="productForm" ref="ruleForm" layout="inline" @keyup.enter.native="$refs.table.refresh(true)" >
+                  <a-row :gutter="10">
+                    <a-col :md="6" :sm="24">
+                      <a-form-model-item label="产品编码">
+                        <a-input v-model.trim="productForm.productCode" allowClear placeholder="输入产品编码" />
+                      </a-form-model-item>
+                    </a-col>
+                    <a-col :md="6" :sm="24">
+                      <a-form-model-item label="产品名称">
+                        <a-input v-model.trim="productForm.productName" allowClear placeholder="输入产品名称" />
+                      </a-form-model-item>
+                    </a-col>
+                    <a-col :md="6" :sm="24">
+                      <a-form-item label="是否有急件">
+                        <a-select allowClear v-model="productForm.oosFlag" placeholder="请选择是否">
+                          <a-select-option value="1">
+                            是
+                          </a-select-option>
+                          <a-select-option value="0">
+                            否
+                          </a-select-option>
+                        </a-select>
+                      </a-form-item>
+                    </a-col>
+                    <a-col :md="6" :sm="24">
+                      <a-button type="primary" @click="$refs.table.refresh(true)" :disabled="disabled" id="salesEdit-refresh">查询</a-button>
+                      <a-button style="margin-left: 5px" @click="resetForm" id="salesEdit-reset">重置</a-button>
+                    </a-col>
+                  </a-row>
+                </a-form-model>
+              </a-col>
+              <a-col :lg="24" :xl="10">
+                <div style="display:flex;align-items:center;padding: 6px 0;justify-content: flex-end;width:100%;">
+                  <div>
+                  折扣金额:
+                  <a-input-number
+                    id="discount"
+                    size="small"
+                    v-model.trim="detailData.discountAmount"
+                    :min="0"
+                    :precision="2"
+                    :max="999999"/>
+                  <a-button size="small" type="primary" class="button-primary" @click="salesDiscount">打折</a-button>
+                </div>
+                <div style="padding:0 10px;">
+                  折扣:<strong>{{ detailData&&(detailData.discountRate || detailData.discountRate==0) ? detailData.discountRate+'%' : '--' }}</strong>;
+                  折后总售价:<strong>{{ detailData&&(detailData.discountedAmount || detailData.discountedAmount==0) ? toThousands(detailData.discountedAmount) : '--' }}</strong>;
+                </div>
+                </div>
+              </a-col>
+            </a-row>
+          </div>
+          <!-- 已选配件列表 -->
+          <s-table
+            class="sTable"
+            ref="table"
+            size="small"
+            :rowKey="(record) => record.id"
+            :columns="columns"
+            :data="loadData"
+            :scroll="{ y: tableHeight }"
+            :defaultLoadData="false"
+            :pageSize="30"
+            bordered>
+            <div slot="costTitle">
+              <a-tooltip placement="top">
+                <template slot="title">
+                  系统中不同批次的产品,成本价可能不同,此值是按照实际出库批次的成本计算得到。
+                </template>
+                <span style="margin-right: 5px;">实际总成本</span> <a-icon type="question-circle" />
+              </a-tooltip>
             </div>
-            <div>
-              <div>
-                折扣金额:
+            <!-- 产品名称 -->
+            <template slot="productName" slot-scope="text, record">
+              <a-tag color="blue" v-if="record.shelfPlaceCode">{{ record.shelfPlaceCode }}</a-tag>
+              <span>{{ text }}</span>
+            </template>
+            <!-- 产品编码 -->
+            <template slot="productCode" slot-scope="text, record">
+              <div v-if="detailData">
+                <div v-if="isOwerEdit">
+                  <a-badge count="急" v-if="record.oosFlag == 1">
+                    <div style="padding-right: 15px;">{{ text }}</div>
+                  </a-badge>
+                  <span v-else>{{ text }}</span>
+                </div>
+                <div v-else>
+                  <a-badge count="急" v-if="isAudit&&record.oosFlag == 1">
+                    <div style="padding-right: 15px;">{{ text }}</div>
+                  </a-badge>
+                  <a-badge count="缺" v-else-if="!isAudit&&(!record.currentStockQty || record.currentStockQty < record.qty)">
+                    <div style="padding-right: 15px;">{{ text }}</div>
+                  </a-badge>
+                  <span v-else>{{ text }}</span>
+                </div>
+              </div>
+            </template>
+            <!-- 售价 -->
+            <template slot="price" slot-scope="text, record">
+              <div style="display:flex;align-items: center;" :class="record.cost > record.price?'redBg-row':''">
                 <a-input-number
-                  id="discount"
-                  size="small"
-                  v-model.trim="detailData.discountAmount"
-                  :min="0"
-                  :precision="2"
-                  :max="999999"/>
-                <a-button size="small" type="primary" class="button-primary" @click="salesDiscount">打折</a-button>
+                size="small"
+                v-model="record.price"
+                :precision="2"
+                :min="0"
+                :max="999999"
+                placeholder="请输入"
+                @blur="e => priceBlur(e.target.value, record)"
+                style="flex-grow: 1;margin-right: 3px;"
+                />
+              <div v-if="record.cost > record.price">
+                <a-tooltip placement="top">
+                  <template slot="title">
+                    售价低于成本价
+                  </template>
+                  <a-icon type="question-circle" />
+                </a-tooltip>
               </div>
-              <div>
-                折扣:<strong>{{ detailData&&(detailData.discountRate || detailData.discountRate==0) ? detailData.discountRate+'%' : '--' }}</strong>;
-                折后总售价:<strong>{{ detailData&&(detailData.discountedAmount || detailData.discountedAmount==0) ? toThousands(detailData.discountedAmount) : '--' }}</strong>;
               </div>
-            </div>
+            </template>
+            <!-- 销售数量 -->
+            <template slot="salesNums" slot-scope="text, record">
+              <a-input-number
+                id="salesEdit-salesNums"
+                size="small"
+                v-model="record.qty"
+                :precision="0"
+                :min="1"
+                :max="999999"
+                placeholder="请输入"
+                @blur="e => qtyBlur(e.target.value, record)"
+                style="width: 100%;" />
+            </template>
+            <!-- 操作 -->
+            <template slot="action" slot-scope="text, record">
+              <a-button size="small" v-if="record.oosFlag == 0" type="link" class="button-primary" @click="handleViewDetail(record)">出库明细</a-button>
+              <a-button
+                size="small"
+                type="link"
+                :loading="delLoading"
+                class="button-error"
+                @click="handleDel(record)"
+                id="productInfoList-Del">删除</a-button>
+            </template>
+          </s-table>
+        </div>
+        <div class="choosed-table" v-else>
+          <div v-if="!spinning&&dataSource.length==0">
+            <a-empty
+              :image="simpleImage"
+              :image-style="{
+                height: '60px',
+              }"
+            >
+              <span slot="description"> 暂无产品 </span>
+              <a-button type="primary" class="button-error" @click="openChooseProduct=true"><a-icon type="plus" />立即添加产品</a-button>
+            </a-empty>
+          </div>
+          <div style="text-align: center;padding: 30px 50px;" v-if="spinning">
+            <a-spin :spinning="spinning" tip="Loading..."></a-spin>
           </div>
-        </a-alert>
-        <!-- 搜索条件 -->
-        <div class="table-page-search-wrapper" v-if="showSearch">
-          <a-row :gutter="15">
-            <a-col :md="24" :lg="12">
-              <a-form-model :model="productForm" ref="ruleForm" layout="inline" @keyup.enter.native="$refs.table.refresh(true)" >
-                <a-row :gutter="15">
-                  <a-col :md="8" :sm="24">
-                    <a-form-model-item label="产品编码">
-                      <a-input v-model.trim="productForm.productCode" allowClear placeholder="输入产品编码" />
-                    </a-form-model-item>
-                  </a-col>
-                  <a-col :md="8" :sm="24">
-                    <a-form-model-item label="产品名称">
-                      <a-input v-model.trim="productForm.productName" allowClear placeholder="输入产品名称" />
-                    </a-form-model-item>
-                  </a-col>
-                  <a-col :md="8" :sm="24">
-                    <a-form-model-item 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="resetForm" id="salesEdit-reset">重置</a-button>
-                    </a-form-model-item>
-                  </a-col>
-                </a-row>
-              </a-form-model>
-            </a-col>
-            <a-col :md="24" :lg="12">
-              <div style="float:right;overflow: hidden;margin-bottom:10px;">
-                <a-checkbox :value="0" :checked="tbForm.indexOf('AUDIT')>=0" @change="(e)=>{tbFormChange(e,0)}" id="salesQuery-tbsh">同步审核</a-checkbox>
-                <a-checkbox :value="1" :checked="tbForm.indexOf('STOCK_OUT')>=0" @change="(e)=>{tbFormChange(e,1)}" id="salesQuery-tbck">同步出库</a-checkbox>
-                <a-checkbox :value="2" :checked="tbForm.indexOf('SETTLE')>=0" @change="(e)=>{tbFormChange(e,2)}" id="salesQuery-tbsk">同步收款</a-checkbox>
-                <a-button
-                  style="padding: 0 25px;"
-                  type="primary"
-                  :disabled="spinning"
-                  class="button-primary"
-                  @click="enableFundAccount && tbForm.length == 3 ? handleSettleAcountPay(null,0) : handleSubmit({})"
-                  id="productInfoList-handleSubmit">提交</a-button>
-              </div>
-            </a-col>
-          </a-row>
         </div>
-        <!-- 已选配件列表 -->
-        <s-table
-          class="sTable"
-          ref="table"
-          size="small"
-          :rowKey="(record) => record.id"
-          :columns="columns"
-          :data="loadData"
-          :defaultLoadData="false"
-          :pageSize="5"
-          :rowClassName="(record, index) => record.cost > record.price ? 'redBg-row':''"
-          bordered>
-          <div slot="costTitle">
-            <a-tooltip placement="top">
-              <template slot="title">
-                系统中不同批次的产品,成本价可能不同,此值是按照实际出库批次的成本计算得到。
-              </template>
-              <span style="margin-right: 5px;">实际总成本</span> <a-icon type="question-circle" />
-            </a-tooltip>
+      
+      <!-- 底部栏 -->
+      <div class="footer-bar" v-if="detailData&&detailData.totalCategory">
+        <!-- 总计 -->
+        <div v-if="detailData" class="total-bar">
+          <div>
+            总售价:<strong>{{ detailData&&(detailData.totalAmount || detailData.totalAmount==0) ? toThousands(detailData.totalAmount) : '--' }}</strong>;
+            总款数:<strong>{{ detailData&&(detailData.totalCategory || detailData.totalCategory==0) ? detailData.totalCategory : '--' }}</strong>;
+            总数量:<strong>{{ detailData&&(detailData.totalQty || detailData.totalQty==0) ? detailData.totalQty : '--' }}</strong>;
+            赠品总数量:<strong>{{ detailData&&(detailData.giftQty || detailData.giftQty==0) ? detailData.giftQty : '--' }}</strong>;
+            <span v-if="isCosts">
+              总成本价:<strong>{{ detailData&&(detailData.totalCost || detailData.totalCost==0) ? toThousands(detailData.totalCost) : '--' }}</strong>;
+              毛利:<strong>{{ detailData&&(detailData.grossProfit || detailData.grossProfit==0) ? toThousands(detailData.grossProfit) : '--' }}</strong>;
+            </span>
           </div>
-          <!-- 产品名称 -->
-          <template slot="productName" slot-scope="text, record">
-            <a-tag color="blue" v-if="record.shelfPlaceCode">{{ record.shelfPlaceCode }}</a-tag>
-            <span>{{ text }}</span>
-          </template>
-          <!-- 产品编码 -->
-          <template slot="productCode" slot-scope="text, record">
-            <div v-if="detailData">
-              <div v-if="isOwerEdit">
-                <a-badge count="急" v-if="record.oosFlag == 1">
-                  <div style="padding-right: 15px;">{{ text }}</div>
-                </a-badge>
-                <span v-else>{{ text }}</span>
-              </div>
-              <div v-else>
-                <a-badge count="急" v-if="isAudit&&record.oosFlag == 1">
-                  <div style="padding-right: 15px;">{{ text }}</div>
-                </a-badge>
-                <a-badge count="缺" v-else-if="!isAudit&&(!record.currentStockQty || record.currentStockQty < record.qty)">
-                  <div style="padding-right: 15px;">{{ text }}</div>
-                </a-badge>
-                <span v-else>{{ text }}</span>
-              </div>
-            </div>
-          </template>
-          <!-- 售价 -->
-          <template slot="price" slot-scope="text, record">
-            <a-input-number
-              id="salesEdit-price"
-              size="small"
-              v-model="record.price"
-              :precision="2"
-              :min="0"
-              :max="999999"
-              placeholder="请输入"
-              @blur="e => priceBlur(e.target.value, record)"
-              style="width: 100%;" />
-          </template>
-          <!-- 销售数量 -->
-          <template slot="salesNums" slot-scope="text, record">
-            <a-input-number
-              id="salesEdit-salesNums"
-              size="small"
-              v-model="record.qty"
-              :precision="0"
-              :min="1"
-              :max="999999"
-              placeholder="请输入"
-              @blur="e => qtyBlur(e.target.value, record)"
-              style="width: 100%;" />
-          </template>
-          <!-- 操作 -->
-          <template slot="action" slot-scope="text, record">
-            <a-button size="small" v-if="record.oosFlag == 0" type="link" class="button-primary" @click="handleViewDetail(record)">出库明细</a-button>
-            <a-button
-              size="small"
-              type="link"
-              :loading="delLoading"
-              class="button-error"
-              @click="handleDel(record)"
-              id="productInfoList-Del">删除</a-button>
-          </template>
-        </s-table>
-      </a-card>
-    </a-spin>
-    <!-- <div class="affix-cont"></div> -->
+          <div>
+            
+          </div>
+      </div>
+        <div>
+          <a-checkbox :value="0" :checked="tbForm.indexOf('AUDIT')>=0" @change="(e)=>{tbFormChange(e,0)}" id="salesQuery-tbsh">同步审核</a-checkbox>
+          <a-checkbox :value="1" :checked="tbForm.indexOf('STOCK_OUT')>=0" @change="(e)=>{tbFormChange(e,1)}" id="salesQuery-tbck">同步出库</a-checkbox>
+          <a-checkbox :value="2" :checked="tbForm.indexOf('SETTLE')>=0" @change="(e)=>{tbFormChange(e,2)}" id="salesQuery-tbsk">同步收款</a-checkbox>
+          <a-button
+            style="padding: 0 25px;"
+            type="primary"
+            :disabled="spinning"
+            class="button-primary"
+            @click="enableFundAccount && tbForm.length == 3 ? handleSettleAcountPay(null,0) : handleSubmit({})"
+            id="productInfoList-handleSubmit">提交</a-button>
+        </div>
+      </div>
+    </div>
     <!-- 选择客户弹框 -->
     <choose-custom-modal ref="custModal" :show="openModal" @updateData="updateData" @cancel="openModal=false" />
     <!-- 导入产品 -->
@@ -225,6 +267,13 @@
     <settleModal ref="settleModal" @ok="settleAcountPay" :openModal="openSettleModal" @close="openSettleModal=false"></settleModal>
     <!-- 出库明细 -->
     <outInDetialModal ref="outInDetialModal" outBizType="SALES" :openModal="showOutInModal" @close="showOutInModal=false"></outInDetialModal>
+    <!-- 添加产品 -->
+    <chooseProductModal
+      ref="partQuery"
+      :showModal="openChooseProduct"
+      @close="openChooseProduct=false"
+      @add="insterProduct"
+    ></chooseProductModal>
     <!-- 选择货架产品 -->
     <chooseShelfProduct
       v-if="showShelfModal"
@@ -239,8 +288,9 @@
 <script>
 import { commonMixin } from '@/utils/mixin'
 import { mapActions } from 'vuex'
+import { Empty } from 'ant-design-vue'
 import { STable, VSelect } from '@/components'
-import queryPart from './queryPart.vue'
+import chooseProductModal from './chooseProductModal.vue'
 import chooseCustomModal from './chooseCustomModal.vue'
 import importGuideModal from './importGuideModal.vue'
 import settleModal from '@/views/financialManagement/settleModal/settleModal.vue'
@@ -254,11 +304,14 @@ import PrintPanel from '@/views/common/printPanel.vue'
 import { hdPrint } from '@/libs/JGPrint'
 export default {
   name: 'SalesEdit',
-  components: { STable, VSelect, queryPart, chooseCustomModal, PrintPanel, importGuideModal, settleModal, outInDetialModal, chooseShelfProduct },
+  components: { STable, VSelect, chooseProductModal, chooseCustomModal, PrintPanel, importGuideModal, settleModal, outInDetialModal, chooseShelfProduct },
   mixins: [commonMixin],
   data () {
     return {
+      simpleImage: Empty.PRESENTED_IMAGE_SIMPLE,
+      tableHeight: 0,
       showOutInModal: false, // 出入库明细
+      showCell: false,
       showPage: false,
       spinning: false,
       showSearch: false,
@@ -278,6 +331,7 @@ export default {
       productForm: {
         productName: '',
         productCode: '',
+        oosFlag: undefined,
         orderBy: 'sales_bill_detail.CREATE_DATE desc'
       },
       tbForm: [], // 同步操作
@@ -286,7 +340,9 @@ export default {
       // 加载数据方法 必须为 Promise 对象
       loadData: parameter => {
         this.disabled = true
+        this.spinning = true
         this.productForm.salesBillSn = this.$route.params.sn
+        
         return salesDetailList(Object.assign(parameter, this.productForm)).then(res => {
           let data
           if (res.status == 200) {
@@ -300,6 +356,7 @@ export default {
             this.disabled = false
             this.dataSource = data.list || []
           }
+          this.spinning = false
           return data
         })
       },
@@ -444,7 +501,7 @@ export default {
         qty: record.qty,
         price: record.price
       }).then(res => {
-        this.resetSearchForm(false)
+        this.getOrderDetail(false,true)
         if (res.status == 200) {
           this.$message.info(res.message)
         }
@@ -479,7 +536,7 @@ export default {
           qty: record.qty,
           price: record.price
         }).then(res => {
-          this.resetSearchForm(false)
+          this.getOrderDetail(false,true)
           if (res.status == 200) {
             this.$message.info(res.message)
             this.spinning = false
@@ -491,20 +548,12 @@ export default {
         record.price = record.priceBackups
       }
     },
-    isCost (val) {
-      this.isCosts = val
-    },
-    //  重置
-    resetSearchForm (flag) {
-      if (flag) { this.$refs.partQuery.onlyList = true }
-      this.$refs.table.refresh(!!flag)
-      this.getOrderDetail(false)
-    },
     // 重置列表
     resetForm () {
       this.productForm = {
         productName: '',
         productCode: '',
+        oosFlag:undefined,
         orderBy: 'sales_bill_detail.CREATE_DATE desc'
       }
       this.$refs.table.refresh()
@@ -522,7 +571,7 @@ export default {
         id: this.detailData.id
       }).then(res => {
         if (res.status == 200) {
-          this.resetSearchForm(true)
+          this.getOrderDetail(true)
           this.spinning = false
         } else {
           this.spinning = false
@@ -562,7 +611,7 @@ export default {
           _this.spinning = true
           salesDetailDelAll({ salesBillSn: _this.detailData.salesBillSn }).then(res => {
             if (res.status == 200) {
-              _this.resetSearchForm(true)
+              _this.getOrderDetail(true)
               _this.productForm = {
                 productName: '',
                 productCode: '',
@@ -582,7 +631,7 @@ export default {
       this.$refs.outInDetialModal.getData(row)
     },
     // 删除产品
-    handleDel (row) {
+    handleDel (row) {row
       const _this = this
       this.$confirm({
         title: '提示',
@@ -594,7 +643,7 @@ export default {
           _this.spinning = true
           salesDetailDel({ id: row.id }).then(res => {
             if (res.status == 200) {
-              _this.resetSearchForm(false)
+              _this.getOrderDetail(false,true)
             }
             _this.$message.info(res.message)
             _this.delLoading = false
@@ -608,25 +657,6 @@ export default {
       // 防止多次添加产品
       if (this.isInster) { return }
       const _this = this
-      // 判断是否已添加此产品
-      // if (this.dataSource && this.dataSource.length > 0) {
-      //   const hasRow = this.dataSource.find(item => item.productSn == row.productSn)
-      //   if (hasRow) {
-      //     this.$message.info('该产品已在当前销售单中存在!')
-      //     this.productForm = {
-      //       productName: '',
-      //       productCode: hasRow.dealerProductEntity && hasRow.dealerProductEntity.code || '',
-      //       orderBy: 'sales_bill_detail.CREATE_DATE desc'
-      //     }
-      //     this.$refs.table.refresh(true)
-      //   } else {
-      //     this.productForm = {
-      //       productName: '',
-      //       productCode: '',
-      //       orderBy: 'sales_bill_detail.CREATE_DATE desc'
-      //     }
-      //   }
-      // }
       // 自建的单据显示库存不足时
       if (row.currentQty < row.salesNums && this.isOwerEdit) {
         _this.$confirm({
@@ -680,9 +710,7 @@ export default {
         stockSn: row.stockSn
       }).then(res => {
         if (res.status == 200) {
-          // this.resetSearchForm(true)  //  不刷新库存
-          this.$refs.table.refresh(true)
-          this.getOrderDetail(false)
+          this.resetForm()
           if (this.showShelfModal) {
             this.$refs.chooseShelfProduct.reload()
           }
@@ -693,6 +721,7 @@ export default {
               productCode: row.productCode || '',
               orderBy: 'sales_bill_detail.CREATE_DATE desc'
             }
+            this.showSearch = true
             this.$refs.table.refresh(true)
           }
         }
@@ -718,8 +747,7 @@ export default {
       this.$message.loading('正在批量添加产品...', 1)
       salesDetailInsertBatch(params).then(res => {
         if (res.status == 200) {
-          this.$refs.table.refresh(true)
-          this.getOrderDetail(false)
+          this.resetForm()
           if (this.showShelfModal) {
             this.$refs.chooseShelfProduct.reload()
           }
@@ -727,7 +755,8 @@ export default {
       })
     },
     //  销售单详情
-    getOrderDetail (flag) {
+    getOrderDetail (flag,resetTable) {
+      this.spinning = true
       salesDetail({ id: this.$route.params.id }).then(res => {
         if (res.status == 200) {
           this.detailData = res.data
@@ -736,14 +765,26 @@ export default {
             const buyerSn = (vm.detailData && vm.detailData.buyerSn && vm.detailData.sourceType && vm.detailData.sourceType == 'PURCHASE') ? '' : vm.detailData.buyerSn
             const priceType = vm.$route.params.priceType
             vm.$refs.partQuery.pageInit(buyerSn, priceType, vm.salesBillSn)
-            // 查询关联的客户
+            if(vm.detailData.totalCategory){
+              vm.$nextTick(()=>{
+                vm.$refs.table.refresh(true)
+              })
+            }
+            // 查询关联的客户货架信息
             if (vm.detailData && vm.detailData.buyerSn) {
               this.getShelfQueryByCustomer()
             }
+          }else{
+            if(resetTable){
+              this.$refs.table.refresh()
+            }else{
+              this.spinning = false
+            }
           }
         }
       })
     },
+    // 查询关联的客户货架信息
     getShelfQueryByCustomer () {
       queryByCustomerSn({ sn: this.detailData.buyerSn }).then(res => {
         if (res.data) {
@@ -798,22 +839,24 @@ export default {
       this.spinning = true
       salesDetailInsertImport(obj).then(res => {
         if (res.status == 200) {
-          this.$refs.table.refresh(true)
-          this.getOrderDetail(false)
+          this.getOrderDetail(true)
         }
         this.spinning = false
       })
     },
+    setTableH () {
+      this.tableHeight = window.innerHeight - (this.showSearch ? 42 : 0) - 280
+    },
     pageInit () {
       const vm = this
       vm.$nextTick(() => {
+        vm.setTableH()
         vm.orderId = vm.$route.params.id
         vm.salesBillSn = vm.$route.params.sn
         // 是否默认打印原厂编码
         vm.printOrgCode = localStorage.getItem('printOrgCode-' + this.$store.state.user.info.orgId) == 'true'
         vm.printAllName = localStorage.getItem('printAllName-' + this.$store.state.user.info.orgId) == 'true'
         vm.getOrderDetail(true)
-        vm.$refs.table.refresh(true)
       })
     }
   },
@@ -823,6 +866,12 @@ export default {
     },
     printAllName (newValue, oldValue) {
       localStorage.setItem('printAllName-' + this.$store.state.user.info.orgId, newValue)
+    },
+    showSearch(newValue, oldValue){
+      this.setTableH()
+    },
+    '$store.state.app.winHeight' (newValue, oldValue) { //  窗口变更时,需同时更改表格高度
+      this.setTableH()
     }
   },
   mounted () {
@@ -857,12 +906,17 @@ export default {
     position: relative;
     height: 100%;
     box-sizing: border-box;
-    >.ant-spin-nested-loading{
-      overflow-y: auto;
-      height: 100%;
-    }
-    .salesEdit-cont{
-      margin-top: 10px;
+    
+    .choosedList-cont{
+      position: relative;
+      background-color: #fff;
+      height: calc(100% - 60px);
+      .redBg-row{
+        color: #f5452e;
+        input{
+          color: #f5452e;
+        }
+      }
     }
     .total-bar{
       display: flex;
@@ -879,8 +933,6 @@ export default {
         }
       }
     }
-    .redBg-row{
-      background-color: #f5cdc8;
-    }
+    
   }
 </style>

+ 37 - 37
src/views/salesManagement/salesQueryNew/list.vue

@@ -15,34 +15,7 @@
                 <custList ref="custList" @change="custChange"></custList>
               </a-form-item>
             </a-col>
-            <a-col :span="6">
-              <a-form-item label="销售单号">
-                <a-input id="salesManagementList-salesBillNo" v-model.trim="queryParam.salesBillNo" allowClear placeholder="请输入销售单号"/>
-              </a-form-item>
-            </a-col>
-            <a-col :span="6">
-              <a-form-item label="审核时间">
-                <rangeDate ref="auditRangeDate" v-model="auditTime" @change="auditDateChange" />
-              </a-form-item>
-            </a-col>
-            <template v-if="advanced">
-              <a-col :span="6">
-                <a-form-item label="出库时间">
-                  <rangeDate ref="outWareRangeDate" v-model="outWareTime" @change="outWareDateChange" />
-                </a-form-item>
-              </a-col>
-              <a-col :span="6">
-                <a-form-item label="单据来源">
-                  <v-select
-                    v-model="queryParam.sourceType"
-                    ref="sourceType"
-                    id="salesManagementList-sourceType"
-                    code="SALES_SOURCE"
-                    placeholder="请选择单据来源"
-                    allowClear></v-select>
-                </a-form-item>
-              </a-col>
-              <a-col :span="6">
+            <a-col :span="6" v-if="advanced">
                 <a-form-item label="收款方式">
                   <v-select
                     code="SETTLE_STYLE"
@@ -53,7 +26,7 @@
                   ></v-select>
                 </a-form-item>
               </a-col>
-              <a-col :span="6">
+              <a-col :span="6" v-if="advanced">
                 <a-form-item label="业务状态">
                   <v-select
                     v-model="queryParam.billStatus"
@@ -64,7 +37,28 @@
                     allowClear></v-select>
                 </a-form-item>
               </a-col>
+            <a-col :span="6">
+              <a-form-item label="审核时间">
+                <rangeDate ref="auditRangeDate" v-model="auditTime" @change="auditDateChange" />
+              </a-form-item>
+            </a-col>
               <a-col :span="6">
+              <a-form-item label="销售单号">
+                <a-input id="salesManagementList-salesBillNo" v-model.trim="queryParam.salesBillNo" allowClear placeholder="请输入销售单号"/>
+              </a-form-item>
+            </a-col>
+            <a-col :span="6" v-if="advanced">
+                <a-form-item label="单据来源">
+                  <v-select
+                    v-model="queryParam.sourceType"
+                    ref="sourceType"
+                    id="salesManagementList-sourceType"
+                    code="SALES_SOURCE"
+                    placeholder="请选择单据来源"
+                    allowClear></v-select>
+                </a-form-item>
+              </a-col>
+              <a-col :span="6" v-if="advanced">
                 <a-form-item label="财务状态">
                   <v-select
                     v-model="queryParam.financialStatus"
@@ -75,17 +69,21 @@
                     allowClear></v-select>
                 </a-form-item>
               </a-col>
-              <a-col :span="6">
-                <a-form-item label="采购单号">
-                  <a-input id="salesManagementList-purchaseBillNo" v-model.trim="queryParam.purchaseBillNo" allowClear placeholder="请输入采购单号"/>
+              <a-col :span="6" v-if="advanced">
+                <a-form-item label="出库时间">
+                  <rangeDate ref="outWareRangeDate" v-model="outWareTime" @change="outWareDateChange" />
                 </a-form-item>
               </a-col>
-              <a-col :span="6">
+              <a-col :span="6" v-if="advanced">
+              <a-form-item label="采购单号">
+                <a-input id="salesManagementList-purchaseBillNo" v-model.trim="queryParam.purchaseBillNo" allowClear placeholder="请输入采购单号"/>
+              </a-form-item>
+            </a-col>
+              <a-col :span="6" v-if="advanced">
                 <a-form-model-item label="铺货出库">
                   <v-select code="FLAG" id="salesManagementList-distributionFlag" v-model="queryParam.distributionFlag" allowClear placeholder="请选择是否铺货出库"></v-select>
                 </a-form-model-item>
               </a-col>
-            </template>
             <a-col :span="24" style="display:flex;align-items: center;">
               <div style="text-align:left;width:50%;">
                 <a-checkbox v-model="isByCustQuery" id="sales-byCustQuery">按客户查询</a-checkbox>
@@ -138,7 +136,7 @@
         <s-table
           class="sTable fixPagination"
           ref="table"
-          :style="{ height: tableHeight+77+'px' }"
+          :style="{ height: tableHeight+84+'px' }"
           size="small"
           :rowKey="(record) => record.id"
           :columns="columns"
@@ -231,7 +229,6 @@
       <auditModal :openModal="visibleAudit" :spinning="spinningAudit" @close="visibleAudit=false" @ok="auditOrder('WAIT_OUT_WAREHOUSE')" @fail="auditOrder('AUDIT_REJECT')" />
     </a-card>
   </div>
-  </div>
 </template>
 
 <script>
@@ -540,7 +537,7 @@ export default {
     },
     setTableH () {
       const tableSearchH = this.$refs.tableSearch.offsetHeight
-      this.tableHeight = window.innerHeight - tableSearchH - 260
+      this.tableHeight = window.innerHeight - tableSearchH - 267
     },
     pageInit () {
       const _this = this
@@ -574,6 +571,9 @@ export default {
         if (a && !b) {
           this.resetSearchForm()
         }
+        if (!a && !b) {
+          this.resetSearchForm()
+        }
       }
       // 仅刷新列表,不重置页面
       if (b || a == b) {

+ 1 - 1
src/views/salesManagement/salesReturn/salesReturnEdit.vue

@@ -5,7 +5,7 @@
         <!-- 自定义的二级文字标题 -->
         <template slot="subTitle">
           <a id="salesReturnEdit-back-btn" href="javascript:;" @click="handleBack"><a-icon type="left" /> 返回列表</a>
-          <span style="margin: 0 15px;color: #666;">客户名称:{{ (ordeDetail&&ordeDetail.buyerName) || '--' }}</span>
+          <span style="margin: 0 15px;color: #666;">客户名称:{{ (ordeDetail&&ordeDetail.buyerNameCurrent) || '--' }}</span>
         </template>
         <!-- 操作区,位于 title 行的行尾 -->
         <template slot="extra" v-if="$hasPermissions('B_salesReturnPrint')">

+ 3 - 3
src/views/salesManagement/salesReturn/salesReturnGrabEdit.vue

@@ -5,7 +5,7 @@
         <!-- 自定义的二级文字标题 -->
         <template slot="subTitle">
           <a id="salesReturnGrabEdit-back-btn" href="javascript:;" @click="handleBack"><a-icon type="left" /> 返回列表</a>
-          <span style="margin: 0 15px;color: #666;">客户名称:{{ (ordeDetail&&ordeDetail.buyerName) || '--' }}</span>
+          <span style="margin: 0 15px;color: #666;">客户名称:{{ (ordeDetail&&ordeDetail.buyerNameCurrent) || '--' }}</span>
         </template>
         <!-- 操作区,位于 title 行的行尾 -->
         <template slot="extra" v-if="$hasPermissions('B_salesReturnPrint')">
@@ -211,14 +211,14 @@ export default {
         { title: '产品名称', dataIndex: 'dealerProductEntity.name', width: '12%', align: 'center', customRender: function (text) { return text || '--' }, ellipsis: true },
         { title: '原厂编码', dataIndex: 'dealerProductEntity.origCode', align: 'center', width: '10%', customRender: function (text) { return text || '--' } },
         { title: '销售单号', dataIndex: 'salesBillNo', align: 'center', width: '8%', customRender: function (text) { return text || '--' } },
-        { title: '售价', dataIndex: 'price', align: 'right', width: '4%', customRender: function (text) { return ((text || text == 0) ?  _this.toThousands(text) : '--') }},
+        { title: '售价', dataIndex: 'price', align: 'right', width: '4%', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } },
         { title: '单位', dataIndex: 'dealerProductEntity.unit', align: 'center', width: '4%', customRender: function (text) { return text || '--' } },
         { title: '销售数量', dataIndex: 'salesQty', align: 'center', width: '5%', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
         { title: '本次退货数量', dataIndex: 'qty', align: 'center', width: '7%', scopedSlots: { customRender: 'qty' } },
         { title: '废品数量', dataIndex: 'celQty', align: 'center', width: '6%', scopedSlots: { customRender: 'celQty' } },
         { title: '仓库仓位', scopedSlots: { customRender: 'warehouse' }, width: '10%', align: 'center' },
         { title: '退货金额小计', align: 'right', scopedSlots: { customRender: 'returnAmount' }, width: '7%' },
-        { title: '折后金额小计', dataIndex: 'discountedAmount', align: 'right', width: '7%', customRender: function (text) { return ((text || text == 0) ?  _this.toThousands(text) : '--') } },
+        { title: '折后金额小计', dataIndex: 'discountedAmount', align: 'right', width: '7%', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } },
         { title: '操作', scopedSlots: { customRender: 'action' }, width: '5%', align: 'center' }
       ],
       chooseLoadData: [],