瀏覽代碼

编辑销售单 成本价 市级价

chenrui 3 年之前
父節點
當前提交
84ef64cc14

+ 19 - 7
src/views/salesManagement/salesQuery/edit.vue

@@ -26,7 +26,13 @@
       </a-page-header>
       <a-card size="small" :bordered="false" class="salesEdit-cont">
         <!-- 查询配件列表 -->
-        <queryPart ref="partQuery" :buyerSn="(detailData&&detailData.buyerSn&&detailData.salesBillSource&&detailData.salesBillSource=='PURCHASE')?'':detailData.buyerSn" :priceType="$route.params.priceType" :newLoading="isInster" @add="insterProduct"></queryPart>
+        <queryPart
+          ref="partQuery"
+          :buyerSn="(detailData&&detailData.buyerSn&&detailData.salesBillSource&&detailData.salesBillSource=='PURCHASE')?'':detailData.buyerSn"
+          :priceType="$route.params.priceType"
+          :newLoading="isInster"
+          @add="insterProduct"
+          @isCost="isCost"></queryPart>
       </a-card>
       <a-card size="small" :bordered="false" class="salesEdit-cont">
         <!-- 总计 -->
@@ -37,6 +43,10 @@
               总款数:<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) ? detailData.totalCost : '--' }}</strong>;
+                毛利:<strong>{{ detailData&&(detailData.grossProfit || detailData.grossProfit==0) ? detailData.grossProfit : '--' }}</strong>;
+              </span>
             </div>
             <div>
               <div>
@@ -199,9 +209,9 @@ export default {
       // 表头
       columns: [
         { title: '序号', dataIndex: 'no', width: 80, align: 'center' },
-        { title: '产品编码', dataIndex: 'dealerProductEntity.code', scopedSlots: { customRender: 'productCode' }, width: 150, align: 'center', sorter: true },
-        { title: '产品名称', dataIndex: 'dealerProductEntity.name', align: 'center', customRender: function (text) { return text || '--' } },
-        { title: '原厂编码', dataIndex: 'dealerProductEntity.origCode', width: 120, align: 'center', customRender: function (text) { return text || '--' } },
+        { title: '产品编码', dataIndex: 'dealerProductEntity.code', scopedSlots: { customRender: 'productCode' }, align: 'center', sorter: true },
+        { title: '产品名称', dataIndex: 'dealerProductEntity.name', align: 'center', customRender: function (text) { return text || '--' }, ellipsis: true },
+        { title: '原厂编码', dataIndex: 'dealerProductEntity.origCode', align: 'center', customRender: function (text) { return text || '--' } },
         { title: '品牌', dataIndex: 'dealerProductEntity.productBrandName', width: 100, align: 'center', sorter: true, customRender: function (text) { return text || '--' } },
         { title: '仓库', dataIndex: 'warehouseEntity.name', width: 100, align: 'center', sorter: true, customRender: function (text) { return text || '--' } },
         { title: '仓位', dataIndex: 'warehouseLocationEntity.name', width: 100, align: 'center', customRender: function (text) { return text || '--' } },
@@ -229,7 +239,8 @@ export default {
           return data
         })
       },
-      printerType: 'NEEDLE' //  打印机类型
+      printerType: 'NEEDLE', //  打印机类型
+      isCosts: false
     }
   },
   methods: {
@@ -303,6 +314,9 @@ export default {
         record.price = record.priceBackups
       }
     },
+    isCost (val) {
+      this.isCosts = val
+    },
     // 打印预览/快捷打印
     handlePrint (type) {
       const _this = this
@@ -519,10 +533,8 @@ export default {
     //  销售单详情
     getOrderDetail () {
       salesDetail({ id: this.$route.params.id }).then(res => {
-        console.log('getOrderDetail')
         if (res.status == 200) {
           this.detailData = res.data
-          console.log(this.detailData)
         }
       })
     },

+ 2 - 2
src/views/salesManagement/salesQuery/list.vue

@@ -219,8 +219,8 @@ export default {
         { title: '序号', dataIndex: 'no', width: 80, align: 'center' },
         { title: '创建时间', dataIndex: 'createDate', width: 100, align: 'center', customRender: function (text) { return text || '--' } },
         { title: '来源', dataIndex: 'salesBillSourceDictValue', width: 80, align: 'center', customRender: function (text) { return text || '--' } },
-        { title: '销售单号', scopedSlots: { customRender: 'salesBillNo' }, width: 120, align: 'center' },
-        { title: '采购单号', dataIndex: 'purchaseBillNo', width: 120, align: 'center', customRender: function (text) { return text || '--' } },
+        { title: '销售单号', scopedSlots: { customRender: 'salesBillNo' }, align: 'center' },
+        { title: '采购单号', dataIndex: 'purchaseBillNo', align: 'center', customRender: function (text) { return text || '--' } },
         { title: '客户名称', dataIndex: 'buyerName', align: 'center', customRender: function (text) { return text || '--' } },
         { title: '总款数', dataIndex: 'totalCategory', width: 60, align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
         { title: '总数量', dataIndex: 'totalQty', width: 60, align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },

+ 42 - 93
src/views/salesManagement/salesQuery/queryPart.vue

@@ -9,8 +9,8 @@
         :rules="rules"
         :model="queryParam"
         @keyup.enter.native="$refs.table.refresh(true)" >
-        <a-row :gutter="15">
-          <a-col :md="7" :sm="24">
+        <a-row :gutter="5">
+          <a-col :md="6" :sm="24">
             <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' }" />
@@ -18,7 +18,7 @@
               <input type="file" id="filed" hidden="" @change="filePreview">
             </a-form-model-item>
           </a-col>
-          <a-col :md="6" :sm="24">
+          <a-col :md="5" :sm="24">
             <a-form-model-item label="产品编码">
               <a-input id="productInfoList-code" v-model.trim="queryParam.productCode" allowClear placeholder="请输入产品编码"/>
             </a-form-model-item>
@@ -29,12 +29,12 @@
             </a-form-model-item>
           </a-col>
           <template v-if="advanced">
-            <a-col :md="6" :sm="24">
+            <a-col :md="8" :sm="24">
               <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 :md="7" :sm="24">
+            <a-col :md="6" :sm="24">
               <a-form-model-item label="产品分类">
                 <a-cascader
                   @change="changeProductType"
@@ -48,7 +48,7 @@
                   allowClear />
               </a-form-model-item>
             </a-col>
-            <a-col :md="6" :sm="24">
+            <a-col :md="5" :sm="24">
               <a-form-model-item label="产品品牌">
                 <a-select
                   placeholder="请选择产品品牌"
@@ -77,21 +77,15 @@
               </a-form-model-item>
             </a-col>
           </template>
-          <a-col :md="6" :sm="24" style="margin-bottom: 10px;">
+          <a-col :md="8" :sm="24" style="margin-bottom: 10px;">
             <a-button type="primary" @click="$refs.table.refresh(true)" :disabled="disabled" id="productInfoList-refresh">查询</a-button>
             <a-button style="margin-left: 5px" @click="resetSearchForm" id="productInfoList-reset">重置</a-button>
-            <a @click="advanced=!advanced" style="margin:0 15px 0 8px">
+            <a @click="advanced=!advanced" style="margin:0 5px">
               {{ advanced ? '收起' : '展开' }}
               <a-icon :type="advanced ? 'up' : 'down'"/>
             </a>
-            <a-popover>
-              <template slot="content">双击列表配件可快速选中添加</template>
-              <a-icon type="question-circle" theme="twoTone" />
-            </a-popover>
-            <a-popover>
-              <template slot="content">点击设置列的显示</template>
-              <a-icon style="margin:0 5px;cursor: pointer;" @click="showSetting = true" type="setting" theme="twoTone" />
-            </a-popover>
+            <a-checkbox v-model="cost" id="salesQuery-cost">成本价</a-checkbox>
+            <a-checkbox v-model="cityPrice" id="salesQuery-cityPrice">市级价</a-checkbox>
           </a-col>
         </a-row>
       </a-form-model>
@@ -101,12 +95,12 @@
       class="sTable"
       ref="table"
       size="small"
-      :rowKey="(record) => record.productSn"
+      :rowKey="(record) => record.productSn+record.currentQty"
       :columns="columns"
       :data="loadData"
       :customRow="handleClickRow"
       :defaultLoadData="false"
-      :scroll="{ x: tableWidth, y: 300 }"
+      :scroll="{ x: 1290, y: 300 }"
       bordered>
       <!-- 售价 -->
       <template slot="salePrice" slot-scope="text, record">
@@ -151,23 +145,6 @@
     </s-table>
     <!-- 销售记录 -->
     <product-salesRecord-modal ref="salseRecord" :openModal="openModal" @close="closeModal" />
-    <!-- 设置列 -->
-    <a-modal
-      v-model="showSetting"
-      title="设置要显示的列"
-      centered
-      :footer="null"
-      @ok="() => (showSetting = false)">
-      <a-checkbox-group v-model="settingColVal" @change="onSettingChange">
-        <a-row>
-          <a-col :span="8" v-for="item in settingColList" :key="item.value">
-            <a-checkbox :value="item.value">
-              {{ item.label }}
-            </a-checkbox>
-          </a-col>
-        </a-row>
-      </a-checkbox-group>
-    </a-modal>
   </div>
 </template>
 
@@ -196,20 +173,7 @@ export default {
   data () {
     return {
       advanced: false, // 高级搜索 展开/关闭
-      showSetting: false, // 设置弹框
       vinLoading: false,
-      tableWidth: 0,
-      settingColVal: ['productOrigCode', 'brandName', 'warehouseName', 'warehouseLocationName', 'currentQty', 'unit'],
-      settingColList: [
-        { label: '原厂编码', value: 'productOrigCode' },
-        { label: '品牌', value: 'brandName' },
-        { label: '仓库', value: 'warehouseName' },
-        { label: '仓位', value: 'warehouseLocationName' },
-        { label: '库存数量', value: 'currentQty' },
-        { label: '单位', value: 'unit' },
-        { label: '成本价', value: 'putCost' },
-        { label: '市级价', value: 'dealerProduct.cityPrice' }
-      ],
       productType: [],
       queryParam: { //  查询条件
         customerSn: '',
@@ -232,22 +196,6 @@ export default {
       productBrandList: [], //  下拉数据
       productTypeList: [], //  产品分类  下拉数据
       warehouseList: [], // 仓库列表
-      columnsBak: [
-        { title: '产品编码', dataIndex: 'productCode', width: 150, align: 'center', sorter: true, customRender: function (text) { return text || '--' } },
-        { title: '产品名称', dataIndex: 'productName', align: 'center', customRender: function (text) { return text || '--' } },
-        { title: '原厂编码', dataIndex: 'productOrigCode', width: 120, align: 'center', customRender: function (text) { return text || '--' } },
-        { title: '品牌', dataIndex: 'brandName', width: 100, align: 'center', sorter: true, customRender: function (text) { return text || '--' } },
-        { title: '仓库', dataIndex: 'warehouseName', width: 100, align: 'center', sorter: true, customRender: function (text) { return text || '--' } },
-        { title: '仓位', dataIndex: 'warehouseLocationName', width: 100, align: 'center', customRender: function (text) { return text || '--' } },
-        { title: '库存数量', dataIndex: 'currentQty', width: 80, align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
-        { title: '单位', dataIndex: 'unit', width: 60, align: 'center', customRender: function (text) { return text || '--' } },
-        { title: '成本价', dataIndex: 'putCost', width: 80, align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
-        { title: '市级价', dataIndex: 'dealerProduct.cityPrice', width: 80, align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
-        { title: '售价', dataIndex: 'salePrice', scopedSlots: { customRender: 'salePrice' }, width: 100, align: 'center' },
-        { title: '销售数量', dataIndex: 'salesNums', scopedSlots: { customRender: 'nums' }, width: 100, align: 'center' },
-        { title: '操作', dataIndex: 'action', scopedSlots: { customRender: 'action' }, width: 150, align: 'center', fixed: 'right' }
-      ],
-      columns: [],
       // 加载数据方法 必须为 Promise 对象
       loadData: parameter => {
         this.disabled = true
@@ -288,12 +236,34 @@ export default {
           return data
         })
       },
-      openModal: false //  查看客户详情  弹框
+      openModal: false, //  查看客户详情  弹框
+      cost: false,
+      cityPrice: false
+    }
+  },
+  computed: {
+    columns () {
+      const arr = [
+        { title: '产品编码', dataIndex: 'productCode', align: 'center', sorter: true, customRender: function (text) { return text || '--' } },
+        { title: '产品名称', dataIndex: 'productName', align: 'center', customRender: function (text) { return text || '--' }, ellipsis: true },
+        { title: '原厂编码', dataIndex: 'productOrigCode', align: 'center', customRender: function (text) { return text || '--' } },
+        { title: '品牌', dataIndex: 'brandName', width: 100, align: 'center', sorter: true, customRender: function (text) { return text || '--' } },
+        { title: '库存数量', dataIndex: 'currentQty', width: 80, align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
+        { title: '单位', dataIndex: 'unit', width: 60, align: 'center', customRender: function (text) { return text || '--' } },
+        { title: '售价', dataIndex: 'salePrice', scopedSlots: { customRender: 'salePrice' }, width: 100, align: 'center' },
+        { title: '销售数量', dataIndex: 'salesNums', scopedSlots: { customRender: 'nums' }, width: 100, align: 'center' },
+        { title: '操作', dataIndex: 'action', scopedSlots: { customRender: 'action' }, width: 150, align: 'center', fixed: 'right' }
+      ]
+      if (this.cost) {
+        arr.splice(6, 0, { title: '成本价', dataIndex: 'putCost', width: 80, align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } })
+      }
+      if (this.cityPrice) {
+        arr.splice(this.cost ? 7 : 6, 0, { title: '市级价', dataIndex: 'dealerProduct.cityPrice', width: 80, align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } })
+      }
+      return arr
     }
   },
   created () {
-    this.columns = this.columnsBak
-    this.onSettingChange()
     // 产品品牌
     if (this.productBrandList.length == 0) {
       this.getProductBrand()
@@ -322,32 +292,6 @@ export default {
         this.queryParam.productCodeList = undefined
       }
     },
-    // 设置列
-    onSettingChange (v) {
-      const k = ['productOrigCode', 'brandName', 'warehouseName', 'warehouseLocationName', 'currentQty', 'unit', 'putCost', 'dealerProduct.cityPrice']
-      const a = ['productCode', 'productName']
-      const b = ['salePrice', 'salesNums', 'action']
-      const c = this.settingColVal
-      const q = k.filter(item => c.indexOf(item) >= 0)
-      const o = a.concat(q).concat(b) //  列
-      const r = q.concat(b) //  计算表格宽度
-      const d = []
-      let w = 0
-      for (let i = 0; i < o.length; i++) {
-        const row = this.columnsBak.find(item => item.dataIndex == o[i])
-        if (row) {
-          d.push(row)
-        }
-      }
-      for (let i = 0; i < r.length; i++) {
-        const row = this.columnsBak.find(item => item.dataIndex == r[i])
-        if (row) {
-          w = w + row.width
-        }
-      }
-      this.tableWidth = w + 350
-      this.columns = d
-    },
     // 双击列表
     handleClickRow (record) {
       const _this = this
@@ -468,6 +412,11 @@ export default {
       this.queryParam.productTypeSn2 = val[1] ? val[1] : ''
       this.queryParam.productTypeSn3 = val[2] ? val[2] : ''
     }
+  },
+  watch: {
+    cost (newValue, oldValue) {
+      this.$emit('isCost', newValue)
+    }
   }
 }
 </script>