lilei 2 jaren geleden
bovenliggende
commit
9519e37e70

+ 1 - 1
public/version.json

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

+ 285 - 0
src/views/purchasingManagement/purchaseOrderNew/chooseProductModal.vue

@@ -0,0 +1,285 @@
+<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">
+    <a-spin :spinning="spinning" tip="Loading...">
+      <div class="chooseProduct-drawer-box">
+        <!-- 搜索条件 -->
+        <div class="table-page-search-wrapper">
+          <a-form layout="inline" @keyup.enter.native="$refs.table.refresh(true)">
+            <a-row :gutter="15">
+              <a-col :md="5" :sm="24">
+                <a-form-model-item label="产品编码">
+                  <a-input id="purchaseOrderEdit-code" ref="searchProductCode" v-model.trim="queryParam.code" allowClear placeholder="请输入产品编码"/>
+                </a-form-model-item>
+              </a-col>
+              <a-col :md="5" :sm="24">
+                <a-form-model-item label="产品名称">
+                  <a-input id="purchaseOrderEdit-name" v-model.trim="queryParam.name" allowClear placeholder="请输入产品名称"/>
+                </a-form-model-item>
+              </a-col>
+              <!-- <a-col :md="4" :sm="24">
+              <a-form-model-item label="原厂编码">
+                <a-input id="purchaseOrderEdit-origCode" v-model.trim="queryParam.origCode" allowClear placeholder="请输入原厂编码"/>
+              </a-form-model-item>
+            </a-col> -->
+              <a-col :md="5" :sm="24">
+                <a-form-item label="产品分类">
+                  <ProductType id="purchaseOrderEdit-productType" :isDealer="true" :tenantId="$route.params.dealerSn" @change="changeProductType" v-model="productType"></ProductType>
+                </a-form-item>
+              </a-col>
+              <a-col :md="5" :sm="24">
+                <a-form-item label="产品品牌">
+                  <ProductBrand id="purchaseOrderEdit-productBrand" :tenantId="$route.params.dealerSn" v-model="queryParam.productBrandSn"></ProductBrand>
+                </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="purchaseOrderEdit-refresh">查询</a-button>
+                <a-button style="margin-left: 5px" @click="resetSearchForm" :disabled="disabled" id="purchaseOrderEdit-reset">重置</a-button>
+              </a-col>
+            </a-row>
+          </a-form>
+        </div>
+        <!-- 列表 -->
+        <s-table
+          class="sTable"
+          ref="table"
+          size="small"
+          :rowKey="(record) => record.id"
+          :columns="columns"
+          :data="loadData"
+          :defaultLoadData="false"
+          :scroll="{ x: tableWidth , y:tableHeight }"
+          @dblclick="handleAdd"
+          :pageSize="20"
+          bordered>
+          <!-- 产品图片 -->
+          <template slot="imageUrl" slot-scope="text, record">
+            <img
+              :src="record.productMainPic && record.productMainPic.imageUrl?(record.productMainPic.imageUrl+'?x-oss-process=image/resize,h_30,m_lfit'):defImg"
+              width="30"
+              height="30"
+              style="cursor: pointer;"
+              @click="handlePicDetail(record)" />
+          </template>
+          <!-- 包装数 -->
+          <template slot="baozh" slot-scope="text, record">
+            {{ record.packQty||'--' }}/{{ record.packQtyUnit||'--' }}
+          </template>
+          <!-- 产品编码 -->
+          <template slot="code" slot-scope="text, record">
+            <a-tooltip placement="top" v-if="record.stockState=='NOT_ENOUGH'">
+              <template slot="title">
+                该产品暂时缺货!
+              </template>
+              <span class="noStock">{{ record.code || '--' }}</span>
+            </a-tooltip>
+            <span v-else>{{ record.code || '--' }}</span>
+          </template>
+          <!-- 采购数量 -->
+          <template slot="storageQuantity" slot-scope="text, record">
+            <a-input-number
+              size="small"
+              v-model="record.qty"
+              :precision="0"
+              :min="0"
+              :max="999999"
+              style="width: 100%;"
+              placeholder="请输入数量" />
+          </template>
+          <!-- 操作 -->
+          <template slot="action" slot-scope="text, record">
+            <a-button
+              size="small"
+              type="link"
+              class="button-primary"
+              :loading="addLoading"
+              @click="handleAdd(record)"
+              v-if="record.purchasePrice>0"
+              id="purchaseOrderEdit-add-btn">添加</a-button>
+            <span v-else>--</span>
+          </template>
+        </s-table>
+      </div>
+    </a-spin>
+  </a-drawer>
+</template>
+
+<script>
+import { commonMixin } from '@/utils/mixin'
+import { STable, VSelect } from '@/components'
+import ProductType from '../../common/productType.js'
+import ProductBrand from '../../common/productBrand.js'
+import defImg from '@/assets/def_img@2x.png'
+import { productListPurchase } from '@/api/product'
+export default {
+  mixins: [commonMixin],
+  components: {
+    STable, VSelect, ProductType, ProductBrand
+  },
+  props: {
+    showModal: {
+      type: Boolean,
+      default: false
+    },
+    width: {
+      type: [String, Number],
+      default: '70%'
+    },
+    zIndex: {
+      type: Number,
+      default: 1050
+    },
+    isDealerUp: {
+      type: Boolean
+    },
+    purchaseBillSn: {
+      type: String
+    }
+  },
+  watch: {
+    showModal (newValue, oldValue) {
+      this.visible = newValue
+      if (newValue) {
+        this.resetSearchForm()
+        this.$refs.searchProductCode.focus()
+        this.setTableH()
+      }
+    }
+  },
+  data () {
+    return {
+      visible: this.showModal,
+      title: '添加产品',
+      tableHeight: 0,
+      // 选择产品
+      addLoading: false,
+      spinning: false,
+      productType: [],
+      queryParam: {
+        productBrandSn: undefined,
+        code: '', //  产品编码
+        name: '', //  产品名称
+        origCode: '', //  原厂编码
+        productTypeSn1: '', //  产品一级分类
+        productTypeSn2: '', //  产品二级分类
+        productTypeSn3: '' //  产品三级分类
+      },
+      advanced: false, //  高级搜索 展开/关闭
+      disabled: false, //  查询、重置按钮是否可操作
+      // 加载数据方法 必须为 Promise 对象
+      loadData: parameter => {
+        this.disabled = true
+        return productListPurchase(Object.assign(parameter, this.queryParam, { purchaseBillSn: this.purchaseBillSn })).then(res => {
+          const 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].qty = 1
+          }
+          this.disabled = false
+          return data
+        })
+      },
+      defImg
+    }
+  },
+  computed: {
+    tableWidth () {
+      let w = 1100
+      if (this.isDealerUp) {
+        w = 1200
+      }
+      if (this.$hasPermissions('M_ShowAllCost')) {
+        w = this.isDealerUp ? 1200 : 1100
+      }
+      return w
+    },
+    columns () {
+      const _this = this
+      const arr = [
+        { title: '产品编码', scopedSlots: { customRender: 'code' }, width: '150px', align: 'center', fixed: 'left' },
+        { title: '产品名称', dataIndex: 'name', width: '250px', align: 'center', customRender: function (text) { return text || '--' }, ellipsis: true },
+        // { title: '原厂编码', dataIndex: 'origCode', width: '14%', align: 'center', customRender: function (text) { return text && text != ' ' ? text : '--' } },
+        { title: '产品图片', scopedSlots: { customRender: 'imageUrl' }, width: '80px', align: 'center' },
+        { title: '单位', dataIndex: 'unit', width: '60px', align: 'center', customRender: function (text) { return text || '--' } },
+        { title: '包装数', scopedSlots: { customRender: 'baozh' }, width: '60px', align: 'center' },
+        { title: '终端会员价', dataIndex: 'terminalPrice', width: '100px', align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text, 2) : '--') } },
+        { title: '车主零售价', dataIndex: 'carOwnersPrice', width: '100px', align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text, 2) : '--') } },
+        { title: '采购数量', dataIndex: 'qty', scopedSlots: { customRender: 'storageQuantity' }, width: '100px', align: 'center', fixed: 'right' },
+        { title: '操作', scopedSlots: { customRender: 'action' }, width: '100px', align: 'center', fixed: 'right' }
+      ]
+      // 产品来源
+      if (this.isDealerUp) {
+        arr.splice(2, 0, { title: '产品来源', dataIndex: 'sysFlagDictValue', width: '100px', align: 'center', customRender: function (text) { return text || '--' } })
+      }
+      if (this.$hasPermissions('M_ShowAllCost')) {
+        arr.splice(this.isDealerUp ? 3 : 2, 0, { title: '成本价', dataIndex: 'purchasePrice', width: '100px', align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text, 2) : '--') } })
+      }
+
+      return arr
+    }
+  },
+  methods: {
+    // 查看产品
+    handlePicDetail (row) {
+      this.$router.push({ name: 'viewProduct', params: { sn: row.productSn } })
+    },
+    //  产品分类  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] : ''
+    },
+    // 重置产品库
+    resetSearchForm () {
+      this.queryParam = {
+        productBrandSn: undefined,
+        code: '', //  产品编码
+        name: '', //  产品名称
+        origCode: '', //  原厂编码
+        productTypeSn1: '', //  产品一级分类
+        productTypeSn2: '', //  产品二级分类
+        productTypeSn3: '' //  产品三级分类
+      }
+      this.productType = []
+      this.$refs.table.refresh(true)
+    },
+    onClose () {
+      this.$emit('close')
+    },
+    handleAdd (record) {
+      this.spinning = true
+      this.$emit('add', record, 0)
+    },
+    setTableH () {
+      this.tableHeight = window.innerHeight - 330
+    }
+  }
+}
+</script>
+
+<style lang="less">
+.chooseProduct-drawer {
+  .ant-drawer-header{
+    padding: 13px 20px;
+  }
+  .ant-drawer-body {
+    padding: 15px 20px;
+    height: calc(100% - 55px);
+    display: flex;
+    flex-direction: column;
+    overflow: auto;
+    > div {
+      height: 100%;
+    }
+  }
+}
+</style>

+ 255 - 409
src/views/purchasingManagement/purchaseOrderNew/edit.vue

@@ -1,266 +1,174 @@
 <template>
   <div v-if="showPage" class="purchaseOrderEdit-wrap">
-    <a-spin :spinning="spinning" tip="Loading...">
-      <a-page-header :ghost="false" :backIcon="false" class="purchaseOrderEdit-cont">
-        <!-- 自定义的二级文字标题 -->
-        <template slot="subTitle">
-          <a id="purchaseOrderEdit-back-btn" href="javascript:;" @click="handleBack"><a-icon type="left" /> 返回列表</a>
-          <p class="billno">单号:{{ detail&&detail.purchaseBillNo }}</p>
-          <a-button type="primary" ghost @click="isShowBisiceInfo=!isShowBisiceInfo" style="margin-left:30px;vertical-align:middle;">
-            基础信息
-            <a-icon :type="isShowBisiceInfo ? 'up' : 'down'"/>
-          </a-button>
-        </template>
-        <!-- 操作区,位于 title 行的行尾 -->
-        <template slot="extra" v-if="$hasPermissions('B_purchasePrint')">
-          <Print :disabled="localDataSource.length==0" @handlePrint="handlePrint"></Print>
-        </template>
-      </a-page-header>
+    <a-page-header :ghost="false" :backIcon="false" class="purchaseOrderEdit-cont">
+      <!-- 自定义的二级文字标题 -->
+      <template slot="subTitle">
+        <a id="purchaseOrderEdit-back-btn" href="javascript:;" @click="handleBack"><a-icon type="left" /> 返回列表</a>
+        <p class="billno">单号:{{ detail&&detail.purchaseBillNo }}</p>
+        <a-button type="primary" ghost @click="isShowBisiceInfo=!isShowBisiceInfo" style="margin-left:30px;vertical-align:middle;">
+          基础信息
+          <a-icon :type="isShowBisiceInfo ? 'up' : 'down'"/>
+        </a-button>
+      </template>
+      <!-- 操作区,位于 title 行的行尾 -->
+      <template slot="extra" v-if="$hasPermissions('B_purchasePrint')">
+        <Print :disabled="localDataSource.length==0" @handlePrint="handlePrint"></Print>
+      </template>
+    </a-page-header>
+    <!-- 产品列表 -->
+    <div ref="tableSearch" class="choosedList-cont">
       <!-- 基础信息 -->
-      <div v-if="isShowBisiceInfo" class="purchaseOrderEdit-cont">
-        <a-collapse :activeKey="['1']">
-          <a-collapse-panel key="1" :show-arrow="false" :disabled="true">
-            <template slot="header">
-              基础信息
-            </template>
-            <a-row :gutter="16" type="flex" sjustify="center">
-              <a-col class="gutter-row" :span="12">
-                供应商:{{ detail&&detail.purchaseTargetName || '--' }}
-              </a-col>
-              <a-col class="gutter-row" :span="12">
-                支付方式:{{ detail&&detail.settleStyleSnDictValue || '--' }}
-              </a-col>
-              <a-col class="gutter-row" :span="12">
-                收货人:{{ detail&&detail.consigneeName || '--' }}({{ detail&&detail.consigneeTel || '--' }})
-              </a-col>
-              <a-col class="gutter-row" :span="12">
-                <span>收货地址:</span>
-                <div style="display: inline-block;width:90%;vertical-align: top;" v-if="detail&&(detail.shippingAddressProvinceName || detail.shippingAddressCityName || detail.shippingAddressCountyName || detail.shippingAddress)">
-                  {{ detail&&detail.shippingAddressProvinceName || '' }}
-                  {{ detail&&detail.shippingAddressCityName || '' }}
-                  {{ detail&&detail.shippingAddressCountyName || '' }}
-                  {{ detail&&detail.shippingAddress || '' }}
-                  <a-button type="link" @click="openAddrModal=true">更换地址 >></a-button>
-                </div>
-                <div v-else><a-button type="link" @click="openAddrModal=true">选择地址 >></a-button></div>
-              </a-col>
-            </a-row>
-          </a-collapse-panel>
-        </a-collapse>
+      <div style="padding:10px;" v-if="isShowBisiceInfo">
+        <a-descriptions title="基础信息" size="small">
+          <a-descriptions-item label="供应商:">
+            {{ detail&&detail.purchaseTargetName || '--' }}
+          </a-descriptions-item>
+          <a-descriptions-item label="支付方式:">
+            {{ detail&&detail.settleStyleSnDictValue || '--' }}
+          </a-descriptions-item>
+          <a-descriptions-item label="收货人:">
+            {{ detail&&detail.consigneeName || '--' }}({{ detail&&detail.consigneeTel || '--' }})
+          </a-descriptions-item>
+          <a-descriptions-item label="收货地址:" span="3">
+            <div v-if="detail&&(detail.shippingAddressProvinceName || detail.shippingAddressCityName || detail.shippingAddressCountyName || detail.shippingAddress)">
+              {{ detail&&detail.shippingAddressProvinceName || '' }}
+              {{ detail&&detail.shippingAddressCityName || '' }}
+              {{ detail&&detail.shippingAddressCountyName || '' }}
+              {{ detail&&detail.shippingAddress || '' }}
+              <a-button type="link" @click="openAddrModal=true">更换地址 >></a-button>
+            </div>
+            <div v-else><a-button type="link" @click="openAddrModal=true">选择地址 >></a-button></div>
+          </a-descriptions-item>
+        </a-descriptions>
       </div>
-      <!-- 选择产品 -->
-      <div class="purchaseOrderEdit-cont">
-        <a-collapse :activeKey="['1']">
-          <a-collapse-panel key="1">
-            <template slot="header">
-              <div style="display: flex;">
-                选择产品<span class="sub-title">①输入查询条件--->②查找到需要采购的产品--->③录入采购数量--->④点击“添加”</span>
-                <p class="tag-txt">注意:仅限采购【箭冠】产品。自建产品的采购入库请使用“散件入库”功能</p>
-              </div>
-            </template>
-            <!-- 选择产品 -->
-            <div>
-              <!-- 搜索条件 -->
-              <div class="table-page-search-wrapper">
-                <a-form layout="inline" @keyup.enter.native="$refs.table.refresh(true)">
+      <!-- 添加产品 -->
+      <chooseProductModal
+        ref="chooseProduct"
+        :isDealerUp="isDealerUp"
+        :purchaseBillSn="$route.params.sn"
+        :showModal="openChooseProduct"
+        @close="openChooseProduct=false"
+        @add="handleAdd"
+      ></chooseProductModal>
+      <!-- 已选产品 -->
+      <div>
+        <div class="chooseBox-title">
+          <div class="sub-title" style="display: flex;">
+            已选产品
+            <p class="tag-txt">注意:仅限采购【箭冠】产品。自建产品的采购入库请使用“散件入库”功能</p>
+          </div>
+          <div class="actions-button">
+            <a-button id="purchaseOrderEdit-add-btn" type="primary" ghost @click="openChooseProduct=true">添加产品</a-button>
+            <a-button id="purchaseOrderEdit-import-btn" type="primary" ghost @click="openGuideModal=true">产品导入</a-button>
+            <a-button id="purchaseOrderEdit-outStock-btn" type="primary" ghost @click="handleOutStock">上次缺货</a-button>
+            <a-button id="purchaseOrderEdit-cart-btn" type="primary" ghost>购物车</a-button>
+          </div>
+        </div>
+        <div class="choosed-table" v-if="detail&&detail.totalCategory">
+          <!-- 搜索条件 -->
+          <div class="table-page-search-wrapper">
+            <a-row :gutter="15">
+              <a-col :span="24">
+                <a-form-model :model="productForm" layout="inline" @keyup.enter.native="$refs.purchaseTable.refresh(true)" >
                   <a-row :gutter="15">
-                    <a-col :md="4" :sm="24">
+                    <a-col :md="8" :sm="24">
                       <a-form-model-item label="产品编码">
-                        <a-input id="purchaseOrderEdit-code" ref="searchProductCode" v-model.trim="queryParam.code" allowClear placeholder="请输入产品编码"/>
+                        <a-input v-model.trim="productForm.productCode" allowClear placeholder="输入产品编码" />
                       </a-form-model-item>
                     </a-col>
-                    <a-col :md="4" :sm="24">
+                    <a-col :md="8" :sm="24">
                       <a-form-model-item label="产品名称">
-                        <a-input id="purchaseOrderEdit-name" v-model.trim="queryParam.name" allowClear placeholder="请输入产品名称"/>
+                        <a-input v-model.trim="productForm.productName" allowClear placeholder="输入产品名称" />
                       </a-form-model-item>
                     </a-col>
-                    <a-col :md="4" :sm="24">
-                      <a-form-model-item label="原厂编码">
-                        <a-input id="purchaseOrderEdit-origCode" v-model.trim="queryParam.origCode" allowClear placeholder="请输入原厂编码"/>
+                    <a-col :md="8" :sm="24">
+                      <a-form-model-item style="margin-bottom: 10px;">
+                        <a-button type="primary" @click="$refs.purchaseTable.refresh(true)" :disabled="purchaseDisabled" id="purchaseOrderEdit-refresh">查询</a-button>
+                        <a-button style="margin-left: 5px" @click="resetPurchaseForm" id="purchaseOrderEdit-reset">重置</a-button>
                       </a-form-model-item>
                     </a-col>
-                    <a-col :md="4" :sm="24">
-                      <a-form-item label="产品分类">
-                        <ProductType id="purchaseOrderEdit-productType" :isDealer="true" :tenantId="$route.params.dealerSn" @change="changeProductType" v-model="productType"></ProductType>
-                      </a-form-item>
-                    </a-col>
-                    <template v-if="advanced">
-                      <a-col :md="4" :sm="24">
-                        <a-form-item label="产品品牌">
-                          <ProductBrand id="purchaseOrderEdit-productBrand" :tenantId="$route.params.dealerSn" v-model="queryParam.productBrandSn"></ProductBrand>
-                        </a-form-item>
-                      </a-col>
-                    </template>
-                    <a-col :md="4" :sm="24" style="margin-bottom: 10px;">
-                      <a-button type="primary" @click="$refs.table.refresh(true)" :disabled="disabled" id="purchaseOrderEdit-refresh">查询</a-button>
-                      <a-button style="margin-left: 5px" @click="resetSearchForm" :disabled="disabled" id="purchaseOrderEdit-reset">重置</a-button>
-                      <a @click="advanced=!advanced" style="margin:0 30px 0 10px">
-                        {{ advanced ? '收起' : '展开' }}
-                        <a-icon :type="advanced ? 'up' : 'down'"/>
-                      </a>
-                    </a-col>
                   </a-row>
-                </a-form>
-              </div>
-              <!-- 列表 -->
-              <s-table
-                class="sTable"
-                ref="table"
+                </a-form-model>
+              </a-col>
+            </a-row>
+          </div>
+          <!-- 列表 -->
+          <s-table
+            class="sTable"
+            ref="purchaseTable"
+            size="small"
+            :rowKey="(record) => record.id"
+            :columns="chooseColumns"
+            :data="chooseLoadData"
+            :defaultLoadData="false"
+            :showPagination="false"
+            :scroll="{ y:tableHeight }"
+            bordered>
+            <!-- 采购数量 -->
+            <template slot="storageQuantity" slot-scope="text, record">
+              <a-input-number
                 size="small"
-                :rowKey="(record) => record.id"
-                :columns="columns"
-                :data="loadData"
-                :defaultLoadData="false"
-                :scroll="{ y:176 }"
-                :pageSize="10"
-                bordered>
-                <!-- 产品图片 -->
-                <template slot="imageUrl" slot-scope="text, record">
-                  <img
-                    :src="record.productMainPic && record.productMainPic.imageUrl?(record.productMainPic.imageUrl+'?x-oss-process=image/resize,h_30,m_lfit'):defImg"
-                    width="30"
-                    height="30"
-                    style="cursor: pointer;"
-                    @click="handlePicDetail(record)" />
-                </template>
-                <!-- 包装数 -->
-                <template slot="baozh" slot-scope="text, record">
-                  {{ record.packQty||'--' }}/{{ record.packQtyUnit||'--' }}
-                </template>
-                <!-- 产品编码 -->
-                <template slot="code" slot-scope="text, record">
-                  <a-tooltip placement="top" v-if="record.stockState=='NOT_ENOUGH'">
-                    <template slot="title">
-                      该产品暂时缺货!
-                    </template>
-                    <span class="noStock">{{ record.code || '--' }}</span>
-                  </a-tooltip>
-                  <span v-else>{{ record.code || '--' }}</span>
-                </template>
-                <!-- 采购数量 -->
-                <template slot="storageQuantity" slot-scope="text, record">
-                  <a-input-number
-                    size="small"
-                    v-model="record.qty"
-                    :precision="0"
-                    :min="0"
-                    :max="999999"
-                    style="width: 100%;"
-                    placeholder="请输入数量" />
-                </template>
-                <!-- 操作 -->
-                <template slot="action" slot-scope="text, record">
-                  <a-button
-                    size="small"
-                    type="link"
-                    class="button-primary"
-                    :loading="addLoading"
-                    @click="handleAdd(record,0)"
-                    v-if="record.purchasePrice>0"
-                    id="purchaseOrderEdit-add-btn">添加</a-button>
-                  <span v-else>--</span>
-                </template>
-              </s-table>
-            </div>
-          </a-collapse-panel>
-        </a-collapse>
-      </div>
-      <!-- 已选产品 -->
-      <div class="purchaseOrderEdit-cont">
-        <a-collapse :activeKey="['1']">
-          <a-collapse-panel key="1">
-            <template slot="header">已选产品</template>
-            <div>
-              <!-- 总计 -->
-              <a-alert type="info" style="margin-bottom:10px">
-                <div slot="message">产品款数 <strong>{{ detail && (detail.totalCategory || detail.totalCategory==0) ? detail.totalCategory : '--' }}</strong> ,
-                  采购数量合计 <strong>{{ detail && (detail.totalQty || detail.totalQty==0) ? detail.totalQty : '--' }}</strong> ,
-                  <div style="display: inline-block;" v-if="$hasPermissions('M_ShowAllCost')">采购金额合计 <strong>{{ detail && (detail.discountedAmount || detail.discountedAmount==0) ?toThousands(detail.discountedAmount, 2) : '--' }}</strong></div>
-                </div>
-              </a-alert>
-              <!-- 搜索条件 -->
-              <div class="table-page-search-wrapper">
-                <a-row :gutter="15">
-                  <a-col :span="18">
-                    <a-form-model :model="productForm" layout="inline" @keyup.enter.native="$refs.purchaseTable.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.purchaseTable.refresh(true)" :disabled="purchaseDisabled" id="purchaseOrderEdit-refresh">查询</a-button>
-                            <a-button style="margin-left: 5px" @click="resetPurchaseForm" id="purchaseOrderEdit-reset">重置</a-button>
-                          </a-form-model-item>
-                        </a-col>
-                      </a-row>
-                    </a-form-model>
-                  </a-col>
-                  <a-col :span="6">
-                    <div style="float:right;overflow: hidden;">
-                      <a-button type="primary" class="button-primary" id="purchaseOrderEdit-import-btn" @click="handleOutStock">上次缺货</a-button>
-                      <a-button id="purchaseOrderEdit-import-btn" @click="openGuideModal=true">导入产品</a-button>
-                    </div>
-                  </a-col>
-                </a-row>
-              </div>
-              <!-- 列表 -->
-              <s-table
-                class="sTable"
-                ref="purchaseTable"
+                id="purchaseOrderEdit-qty"
+                v-model="record.qty"
+                :precision="0"
+                :min="1"
+                :max="999999"
+                @blur="e => qtyBlur(e.target.value, record)"
+                style="width: 100%;"
+                placeholder="请输入" />
+            </template>
+            <!-- 操作 -->
+            <template slot="action" slot-scope="text, record">
+              <a-button
                 size="small"
-                :rowKey="(record) => record.id"
-                :columns="chooseColumns"
-                :data="chooseLoadData"
-                :defaultLoadData="false"
-                :showPagination="false"
-                bordered>
-                <!-- 采购数量 -->
-                <template slot="storageQuantity" slot-scope="text, record">
-                  <a-input-number
-                    size="small"
-                    id="purchaseOrderEdit-qty"
-                    v-model="record.qty"
-                    :precision="0"
-                    :min="1"
-                    :max="999999"
-                    @blur="e => qtyBlur(e.target.value, record)"
-                    style="width: 100%;"
-                    placeholder="请输入" />
-                </template>
-                <!-- 操作 -->
-                <template slot="action" slot-scope="text, record">
-                  <a-button
-                    size="small"
-                    type="link"
-                    class="button-error"
-                    :loading="delLoading"
-                    @click="handleDel(record)"
-                    id="purchaseOrderEdit-del-btn">删除</a-button>
-                </template>
-              </s-table>
-            </div>
-          </a-collapse-panel>
-        </a-collapse>
+                type="link"
+                class="button-error"
+                :loading="delLoading"
+                @click="handleDel(record)"
+                id="purchaseOrderEdit-del-btn">删除</a-button>
+            </template>
+          </s-table>
+        </div>
+        <div v-else>
+          <div v-if="!spinning">
+            <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-circle" />立即添加产品</a-button>
+            </a-empty>
+          </div>
+          <div style="text-align: center;padding: 30px 50px;" v-else>
+            <a-spin :spinning="spinning" tip="Loading..."></a-spin>
+          </div>
+        </div>
+      </div>
+      <!-- 底部栏 -->
+      <div class="footer-cont">
+        <!-- 总计 -->
+        <div>
+          <span style="color:#666;">
+            共计 {{ detail && (detail.totalCategory || detail.totalCategory==0) ? detail.totalCategory : '--' }} 款
+            {{ detail && (detail.totalQty || detail.totalQty==0) ? detail.totalQty : '--' }} 件产品 ,
+          </span>
+          <div style="display: inline-block;" v-if="$hasPermissions('M_ShowAllCost')">
+            合计: <strong>{{ detail && (detail.discountedAmount || detail.discountedAmount==0) ?toThousands(detail.discountedAmount, 2) : '--' }}</strong>
+          </div>
+        </div>
+        <div>
+          <a-button
+            type="primary"
+            id="purchaseOrderEdit-submit-btn"
+            size="large"
+            class="button-primary"
+            :loading="subLoading"
+            @click="handleSubmit"
+            style="padding: 0 60px;">提交</a-button>
+        </div>
       </div>
-    </a-spin>
-    <div class="affix-cont">
-      <a-button
-        type="primary"
-        id="purchaseOrderEdit-submit-btn"
-        size="large"
-        class="button-primary"
-        :loading="subLoading"
-        :disabled="spinning"
-        @click="handleSubmit"
-        style="padding: 0 60px;">提交</a-button>
     </div>
     <!-- 导入产品 -->
     <importGuideModal :openModal="openGuideModal" :params="{purchaseBillSn: $route.params.sn}" @close="openGuideModal=false" @ok="hanldeOks" />
@@ -268,26 +176,27 @@
     <outStockModal :openModal="openOutStockModal" :paramsData="paramsData" @close="openOutStockModal=false" @ok="hanldeOkOutStock" />
     <!-- 选择地址 -->
     <choose-address-modal :openModal="openAddrModal" @ok="handleAddrOk" @close="openAddrModal=false" />
+    <!-- 购物车 -->
   </div>
 </template>
 
 <script>
+import { Empty } from 'ant-design-vue'
 import { commonMixin } from '@/utils/mixin'
 import { STable, VSelect } from '@/components'
 import ImportGuideModal from './importGuideModal.vue'
 import outStockModal from './outStockModal.vue'
 import chooseAddressModal from '@/views/common/receivingAddress/chooseAddressModal.vue'
-import ProductType from '../../common/productType.js'
-import ProductBrand from '../../common/productBrand.js'
 import { purchaseDetailBySn, purchaseWriteSubmit, purchaseDetailPrint, purchaseDetailExport, purchaseDetailAddress } from '@/api/purchase'
 import { purchaseDetailList, purchaseDetailSave, purchaseDetailDel, purchaseDetailCount, purchaseDetailCancelList } from '@/api/purchaseDetail'
-import { productListPurchase } from '@/api/product'
-import defImg from '@/assets/def_img@2x.png'
+// 选择产品
+import chooseProductModal from './chooseProductModal.vue'
+// 打印
 import Print from '@/views/common/print.vue'
 import { hdPrint } from '@/libs/JGPrint'
 export default {
   name: 'PurchaseEdit',
-  components: { STable, VSelect, ProductType, ProductBrand, ImportGuideModal, outStockModal, Print, chooseAddressModal },
+  components: { STable, VSelect, ImportGuideModal, outStockModal, Print, chooseAddressModal, chooseProductModal },
   mixins: [commonMixin],
   data () {
     return {
@@ -295,38 +204,11 @@ export default {
       showPage: false,
       spinning: false,
       detail: null, // 详细信息
-      subLoading: false,
-      defImg,
-      // 选择产品
-      addLoading: false,
-      productType: [],
-      queryParam: {
-        productBrandSn: undefined,
-        code: '', //  产品编码
-        name: '', //  产品名称
-        origCode: '', //  原厂编码
-        productTypeSn1: '', //  产品一级分类
-        productTypeSn2: '', //  产品二级分类
-        productTypeSn3: '' //  产品三级分类
-      },
-      typeData: [], //    下拉数据
-      advanced: false, //  高级搜索 展开/关闭
-      disabled: false, //  查询、重置按钮是否可操作
-      // 加载数据方法 必须为 Promise 对象
-      loadData: parameter => {
-        this.disabled = true
-        return productListPurchase(Object.assign(parameter, this.queryParam, { purchaseBillSn: this.$route.params.sn })).then(res => {
-          const 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].qty = 1
-          }
-          this.disabled = false
-          return data
-        })
-      },
+      openChooseProduct: false,
+      tableHeight: 0,
+      simpleImage: Empty.PRESENTED_IMAGE_SIMPLE,
       // -------已选产品-------------
+      subLoading: false,
       orderCountData: null,
       delLoading: false,
       productForm: {
@@ -339,9 +221,7 @@ export default {
       chooseLoadData: parameter => {
         this.disabled = true
         // 查询总计
-        // const params = Object.assign(parameter, this.productForm, { purchaseBillSn: this.$route.params.sn })
         const params = Object.assign({ pageNo: 1, pageSize: 5000 }, this.productForm, { purchaseBillSn: this.$route.params.sn })
-        // this.getCountQuery(params)
         return purchaseDetailList(params).then(res => {
           const data = res.data
           const no = (data.pageNo - 1) * data.pageSize
@@ -351,6 +231,7 @@ export default {
           }
           this.localDataSource = data.list
           this.disabled = false
+          this.spinning = false
           return data
         })
       },
@@ -365,42 +246,14 @@ export default {
     isDealerUp () {
       return this.detail && this.detail.purchaseTargetType == 'DEALER_UP'
     },
-    columns () {
-      const _this = this
-      const arr = [
-        { title: '序号', dataIndex: 'no', width: '5%', align: 'center' },
-        { title: '产品编码', scopedSlots: { customRender: 'code' }, width: '15%', align: 'center', sorter: true },
-        { title: '产品名称', dataIndex: 'name', width: '23%', align: 'center', customRender: function (text) { return text || '--' }, ellipsis: true },
-        { title: '原厂编码', dataIndex: 'origCode', width: '14%', align: 'center', customRender: function (text) { return text && text != ' ' ? text : '--' } },
-        { title: '单位', dataIndex: 'unit', width: '5%', align: 'center', customRender: function (text) { return text || '--' } },
-        { title: '包装数', scopedSlots: { customRender: 'baozh' }, width: '5%', align: 'center' },
-        // { title: '成本价', dataIndex: 'purchasePrice', width: '6%', align: 'center', customRender: function (text) { return ((text || text == 0) ? ('¥' + text) : '--') } },
-        { title: '终端会员价', dataIndex: 'terminalPrice', width: '6%', align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text, 2) : '--') } },
-        { title: '车主零售价', dataIndex: 'carOwnersPrice', width: '6%', align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text, 2) : '--') } },
-        { title: '采购数量', dataIndex: 'qty', scopedSlots: { customRender: 'storageQuantity' }, width: '6%', align: 'center' },
-        { title: '产品图片', scopedSlots: { customRender: 'imageUrl' }, width: '6%', align: 'center' },
-        { title: '操作', scopedSlots: { customRender: 'action' }, width: '8%', align: 'center' }
-      ]
-      // 产品来源
-      if (this.isDealerUp) {
-        arr.splice(6, 0, { title: '产品来源', dataIndex: 'sysFlagDictValue', width: '6%', align: 'center', customRender: function (text) { return text || '--' } })
-      }
-      if (this.$hasPermissions('M_ShowAllCost')) {
-        arr.splice(this.isDealerUp ? 7 : 6, 0, { title: '成本价', dataIndex: 'purchasePrice', width: '6%', align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text, 2) : '--') } })
-      }
-
-      return arr
-    },
     chooseColumns () {
       const _this = this
       const arr = [
         { title: '序号', dataIndex: 'no', width: '5%', align: 'center' },
         { title: '产品编码', dataIndex: 'dealerProductEntity.code', width: '20%', align: 'center' },
-        { title: '产品名称', dataIndex: 'dealerProductEntity.name', width: '20%', align: 'center', customRender: function (text) { return text || '--' }, ellipsis: true },
-        // { title: '采购单价', dataIndex: 'discountedPrice', width: '20%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
+        { title: '产品名称', dataIndex: 'dealerProductEntity.name', width: '30%', align: 'center', customRender: function (text) { return text || '--' }, ellipsis: true },
         { title: '采购数量', scopedSlots: { customRender: 'storageQuantity' }, width: '10%', align: 'center' },
         { title: '单位', dataIndex: 'dealerProductEntity.unit', width: '8%', align: 'center', customRender: function (text) { return text || '--' } },
-        // { title: '采购金额', dataIndex: 'discountedAmount', width: '9%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
         { title: '操作', scopedSlots: { customRender: 'action' }, width: '8%', align: 'center' }
       ]
       if (this.$hasPermissions('M_ShowAllCost')) {
@@ -411,17 +264,23 @@ export default {
     }
   },
   methods: {
-    // 获取采购单明细统计
-    getCountQuery (params) {
-      purchaseDetailCount(params).then(res => {
-        this.orderCountData = res.data || null
-      })
-    },
     // 获取采购单基本信息
-    getOrderDetail () {
+    getOrderDetail (noRefashTable, isReset, flag) {
+      this.spinning = true
       purchaseDetailBySn({ sn: this.$route.params.sn }).then(res => {
         if (res.status == 200) {
           this.detail = res.data
+          if (!noRefashTable) {
+            if (isReset) {
+              this.resetPurchaseForm()
+            } else {
+              this.$refs.purchaseTable.refresh(!!flag)
+            }
+          } else {
+            this.spinning = false
+          }
+        } else {
+          this.spinning = false
         }
       })
     },
@@ -435,26 +294,18 @@ export default {
         closable: true,
         onOk () {
           _this.delLoading = true
-          _this.spinning = true
           purchaseDetailDel({ id: row.id }).then(res => {
             if (res.status == 200) {
-              _this.resetPurchaseDetail(true)
+              _this.getOrderDetail(false, false, true)
               _this.$message.success(res.message)
               _this.delLoading = false
-              _this.spinning = false
             } else {
               _this.delLoading = false
-              _this.spinning = false
             }
           })
         }
       })
     },
-    // 重新查询已选产品
-    resetPurchaseDetail (flag) {
-      this.$refs.purchaseTable.refresh(!!flag)
-      this.getOrderDetail()
-    },
     // 修改数量后
     qtyBlur (val, record) {
       //  光标移出,值发生改变再调用编辑接口
@@ -462,41 +313,20 @@ export default {
         this.handleAdd(record, 1)
       }
     },
-    filterOption (input, option) {
-      return (
-        option.componentOptions.children[0].text.toLowerCase().indexOf(input.toLowerCase()) >= 0
-      )
-    },
-    //  产品分类  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] : ''
-    },
-    //  重置产品库
-    resetSearchForm () {
-      this.queryParam = {
-        productBrandSn: undefined,
-        code: '', //  产品编码
-        name: '', //  产品名称
-        origCode: '', //  原厂编码
-        productTypeSn1: '', //  产品一级分类
-        productTypeSn2: '', //  产品二级分类
-        productTypeSn3: '' //  产品三级分类
-      }
-      this.productType = []
-      this.$refs.table.refresh(true)
-    },
+    // 重置已选产品列表
     resetPurchaseForm () {
       this.productForm.productName = ''
       this.productForm.productCode = ''
-      this.$refs.purchaseTable.refresh(true)
+      this.$nextTick(() => {
+        this.$refs.purchaseTable.refresh(true)
+      })
     },
     //  添加或修改
     handleAdd (row, type) {
       let params = {}
       if (type == 0 && !row.qty) {
         this.$message.warning('请输入数量后再添加!')
+        this.$refs.chooseProduct.spinning = false
         return
       }
       // 添加
@@ -515,40 +345,36 @@ export default {
         params = row
       }
       this.addLoading = true
-      this.spinning = true
       purchaseDetailSave(params).then(res => {
         if (res.status == 200) {
-          this.resetPurchaseDetail()
+          this.getOrderDetail(false, true, true)
           this.$message.success(res.message)
-          this.spinning = false
-        } else {
-          this.spinning = false
         }
         this.addLoading = false
+        this.$refs.chooseProduct.spinning = false
       })
     },
     //  提交
     handleSubmit () {
       const _this = this
+      if (_this.detail && !_this.detail.totalCategory) {
+        this.$message.info('请添加产品')
+        return false
+      }
       this.subLoading = true
-      this.spinning = true
       purchaseWriteSubmit({ id: this.detail.id }).then(res => {
         if (res.status == 200) {
           this.$message.success(res.message)
           setTimeout(() => {
             _this.handleBack()
-            _this.spinning = false
           }, 1000)
-        } else {
-          _this.spinning = false
         }
         _this.subLoading = false
       })
     },
     // 导入产品
     hanldeOks () {
-      this.$refs.purchaseTable.refresh(true)
-      this.getOrderDetail()
+      this.getOrderDetail(false, true, true)
     },
     // 上次缺货
     handleOutStock () {
@@ -577,17 +403,13 @@ export default {
       purchaseDetailAddress(params).then(res => {
         if (res.status == 200) {
           this.openAddrModal = false
-          this.getOrderDetail()
+          this.getOrderDetail(true)
         }
       })
     },
-    // 查看产品
-    handlePicDetail (row) {
-      this.$router.push({ name: 'viewProduct', params: { sn: row.productSn } })
-    },
     // 上次缺货 导入成功
     hanldeOkOutStock () {
-      this.$refs.purchaseTable.refresh(true)
+      this.getOrderDetail(false, true, true)
       this.paramsData = null
       this.openOutStockModal = false
     },
@@ -610,12 +432,13 @@ export default {
     handleBack () {
       this.$router.push({ name: 'purchaseOrderNewList' })
     },
+    setTableH () {
+      this.tableHeight = window.innerHeight - 350
+    },
     pageInit () {
       this.$nextTick(() => {
-        this.getOrderDetail()
-        this.resetPurchaseForm()
-        this.resetSearchForm()
-        this.$refs.searchProductCode.focus()
+        this.setTableH()
+        this.getOrderDetail(false, true)
       })
     }
   },
@@ -632,9 +455,6 @@ export default {
       this.pageInit()
     }
   },
-  deactivated () {
-    // this.showPage = false
-  },
   beforeRouteEnter (to, from, next) {
     next(vm => {})
   }
@@ -645,16 +465,7 @@ export default {
   .purchaseOrderEdit-wrap{
     position: relative;
     height: 100%;
-    padding-bottom: 51px;
     box-sizing: border-box;
-    >.ant-spin-nested-loading{
-      overflow-y: auto;
-      height: 100%;
-    }
-    .noStock{
-      text-decoration: line-through;
-      color: red;
-    }
     .billno{
       margin: 0 0 0 30px;
       font-size: 18px;
@@ -663,33 +474,68 @@ export default {
       vertical-align: middle;
       color: #666;
     }
+    .choosedList-cont{
+      position: relative;
+      background-color: #fff;
+      height: calc(100% - 60px);
+      .chooseBox-title{
+        display:flex;
+        justify-content: space-between;
+        align-items: center;
+        border-top: 1px solid #eee;
+        border-bottom: 1px solid #eee;
+        padding: 8px 0;
+        .actions-button{
+          button{
+            margin-left: 10px;
+            margin-right: 10px;
+          }
+        }
+        .import-btn{
+          margin-left: 15px;
+        }
+        .sub-title{
+          font-size: 14px;
+          color: #333;
+          margin-left: 10px;
+          font-weight:bold;
+        }
+        .tag-txt{
+          font-size: 12px;
+          color: #ed1c24;
+          margin: 0 15px;
+        }
+      }
+      .choosed-table{
+        padding:10px;
+      }
+      .footer-cont{
+        position:absolute;
+        width:100%;
+        bottom:0;
+        display:flex;
+        justify-content: flex-end;
+        align-items: center;
+        padding: 8px;
+        border-top: 1px solid #eee;
+        > div{
+          &:first-child{
+            padding: 0 15px;
+            strong{
+              color: #ff8d00;
+              font-size: 18px;
+            }
+          }
+        }
+      }
+    }
     .purchaseOrderEdit-cont{
-      margin-bottom: 10px;
+      margin-bottom: 8px;
       .sub-title{
         font-size: 12px;
         color: #808695;
         margin-left: 10px;
       }
-      .tag-txt{
-        font-size: 12px;
-        color: #ed1c24;
-        margin: 0 15px;
-      }
-      .edit-circle-btn{
-        margin-left: 15px;
-        i{
-          vertical-align: text-bottom;
-        }
-      }
-      .import-btn{
-        margin-left: 15px;
-      }
     }
-     .gutter-row:nth-child(1),.gutter-row:nth-child(2){
-          margin-bottom:10px;
-        }
-    .ant-collapse .ant-collapse-item-disabled > .ant-collapse-header{
-          color:#333;
-        }
   }
 </style>