Browse Source

销售列表

chenrui 2 years ago
parent
commit
2112349877

+ 30 - 5
src/views/salesManagement/salesQuery/detail.vue

@@ -55,7 +55,6 @@
               <a-descriptions-item label="收款方式">{{ detailData&&detailData.settleStyleSnDictValue || '--' }}</a-descriptions-item>
               <a-descriptions-item label="收货人">{{ detailData&&detailData.salesBillExtEntity&&detailData.salesBillExtEntity.consigneeName || '--' }}</a-descriptions-item>
               <a-descriptions-item label="收货电话">{{ detailData&&detailData.salesBillExtEntity&&detailData.salesBillExtEntity.consigneeTel || '--' }}</a-descriptions-item>
-              <a-descriptions-item label="出库仓库">{{ detailData&&detailData.warehouseName || '--' }}</a-descriptions-item>
               <a-descriptions-item label="审核时间">{{ detailData&&detailData.auditDate || '--' }}</a-descriptions-item>
               <a-descriptions-item label="业务状态">{{ detailData&&detailData.billStatusDictValue || '--' }}</a-descriptions-item>
               <a-descriptions-item label="财务状态">{{ detailData&&detailData.financialStatusDictValue || '--' }}</a-descriptions-item>
@@ -93,6 +92,22 @@
             </div>
           </div>
         </a-alert>
+        <!-- 查询 -->
+        <div class="table-page-search-wrapper">
+          <a-form layout="inline" @keyup.enter.native="$refs.table.refresh(true)">
+            <a-row :gutter="15">
+              <a-col :md="6" :sm="24">
+                <a-form-item label="出库仓库">
+                  <chooseWarehouse ref="warehouse" v-model="queryParam.warehouseSn"></chooseWarehouse>
+                </a-form-item>
+              </a-col>
+              <a-col :md="6" :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-col>
+            </a-row>
+          </a-form>
+        </div>
         <!-- 列表 -->
         <s-table
           class="sTable"
@@ -202,12 +217,13 @@ import printModal from './printModal.vue'
 import auditModal from '@/views/common/auditModal.vue'
 import dsModal from '@/views/salesManagement/waitDispatch/dsModal.vue'
 import stockOutDetail from './stockOutDetailModal.vue'
+import chooseWarehouse from '@/views/common/chooseWarehouse'
 import { salesDetailBySn, salesDetailPrint, salesDetailExcel, salesDetailTypeExcel, salesWriteAudit, salesWriteAuditPush } from '@/api/sales'
 import { salesDetailAllList, salesDetailAllStockList } from '@/api/salesDetail'
 export default {
   name: 'SalesDetail',
   mixins: [commonMixin],
-  components: { STable, VSelect, printModal, auditModal, dsModal, stockOutDetail },
+  components: { STable, VSelect, printModal, auditModal, dsModal, stockOutDetail, chooseWarehouse },
   props: {
     bizSn: { //  有值则为弹框,无值则为页面
       type: [Number, String],
@@ -221,6 +237,9 @@ export default {
       showDsModal: false,
       showStockOut: false,
       authCode: '',
+      queryParam: {
+        warehouseSn: undefined
+      },
       // 加载数据方法 必须为 Promise 对象
       loadData: parameter => {
         this.disabled = true
@@ -293,7 +312,8 @@ export default {
         { title: '序号', dataIndex: 'no', width: '4%', align: 'center' },
         { title: '产品编码', dataIndex: 'productCode', width: '13%', scopedSlots: { customRender: 'productCode' }, align: 'center' },
         { title: '产品名称', dataIndex: 'productName', width: '13%', align: 'center', customRender: function (text) { return text || '--' }, ellipsis: true },
-        { title: '原厂编码', dataIndex: 'productOrigCode', width: '12%', align: 'center', customRender: function (text) { return text || '--' } },
+        { title: '原厂编码', dataIndex: 'productOrigCode', width: '10%', align: 'center', customRender: function (text) { return text || '--' } },
+        { title: '出库仓库', dataIndex: 'warehouseName', width: '12%', align: 'center', customRender: function (text) { return text || '--' }, ellipsis: true },
         // { title: '成本价', dataIndex: 'showCost', width: '6%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
         // { title: '省级价', dataIndex: 'provincePrice', width: '6%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
         // { title: '市级价', dataIndex: 'cityPrice', width: '6%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
@@ -306,10 +326,10 @@ export default {
         { title: '已取消数', dataIndex: 'cancelQty', width: '6%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } }
       ]
       if (this.$hasPermissions(this.authCode + '_costPrice')) { //  成本价权限
-        arr.splice(4, 0, { title: '成本价', dataIndex: 'showCost', width: '6%', align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } })
+        arr.splice(5, 0, { title: '成本价', dataIndex: 'showCost', width: '6%', align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } })
       }
 
-      const ind = this.$hasPermissions(this.authCode + '_costPrice') ? 5 : 4
+      const ind = this.$hasPermissions(this.authCode + '_costPrice') ? 6 : 5
       if (this.$hasPermissions(this.authCode + '_provincePrice')) {
         arr.splice(ind, 0, { title: '省级价', dataIndex: 'provincePrice', width: '6%', align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } })
       }
@@ -341,6 +361,11 @@ export default {
       const row = this.detailData
       this.$router.push({ name: 'salesEdit', params: { sn: row.salesBillSn, wSn: row.warehouseSn } })
     },
+    //  重置
+    resetSearchForm () {
+      this.queryParam.warehouseSn = undefined
+      this.$refs.table.refresh()
+    },
     // 打开缺货明细
     openStockOut () {
       if (this.outStockStr != '') {

+ 44 - 36
src/views/salesManagement/salesQuery/edit.vue

@@ -52,51 +52,52 @@
             <div class="table-page-search-wrapper" style="position: relative;width: 100%;">
               <a-form layout="inline" @keyup.enter.native="$refs.table.refresh(true)">
                 <a-row :gutter="15">
-                  <a-col :md="6" :sm="24">
+                  <a-col :md="5" :sm="24">
                     <a-form-item label="产品编码" prop="productCode">
                       <a-input id="salesEdit-productCode" v-model.trim="queryParam.productCode" placeholder="请输入产品编码" allowClear />
                     </a-form-item>
                   </a-col>
-                  <a-col :md="6" :sm="24">
+                  <a-col :md="5" :sm="24">
                     <a-form-item label="产品名称" prop="productName">
                       <a-input id="salesEdit-productName" v-model.trim="queryParam.productName" placeholder="请输入产品名称" allowClear />
                     </a-form-item>
                   </a-col>
-                  <a-col :md="6" :sm="24" style="margin-bottom: 10px;">
+                  <a-col :md="5" :sm="24">
+                    <a-form-item label="出库仓库" prop="warehouseSn">
+                      <chooseWarehouse ref="warehouse" v-model="queryParam.warehouseSn"></chooseWarehouse>
+                    </a-form-item>
+                  </a-col>
+                  <a-col :md="3" :sm="24" style="margin-bottom: 10px;">
                     <a-button type="primary" @click="$refs.table.refresh(true)" :disabled="disabled" id="salesEdit-refresh">查询</a-button>
                     <a-button style="margin-left: 5px" @click="resetSearchForm" :disabled="disabled" id="salesEdit-reset">重置</a-button>
                   </a-col>
+                  <a-col :md="6" :sm="24" style="text-align: right;">
+                    <span>已选{{ selectTotal }}项</span>
+                    <a-dropdown>
+                      <a-menu slot="overlay" @click="handleMenuClick">
+                        <a-menu-item key="0">
+                          仓库设置
+                        </a-menu-item>
+                        <a-menu-item key="1">
+                          删除已选项
+                        </a-menu-item>
+                        <a-menu-item key="2">
+                          全部删除
+                        </a-menu-item>
+                      </a-menu>
+                      <a-button
+                        style="margin:0 15px;"
+                        type="primary"
+                        ghost
+                        id="salesEdit-plDel-btn"> 仓库设置 <a-icon type="down" /> </a-button>
+                    </a-dropdown>
+                    <a-button
+                      type="default"
+                      id="salesEdit-import-btn"
+                      @click="openGuideModal=true">导入产品</a-button>
+                  </a-col>
                 </a-row>
               </a-form>
-              <div style="position: absolute;right: 0;top: 3px;">
-                <span>已选{{ selectTotal }}项</span>
-                <!-- <a-button
-                  style="margin:0 15px;"
-                  size="small"
-                  type="danger"
-                  class="button-info"
-                  id="salesEdit-plDel-btn"
-                  @click="handleBatchDel">批量删除</a-button> -->
-                <a-dropdown>
-                  <a-menu slot="overlay" @click="handleMenuClick">
-                    <a-menu-item key="1">
-                      删除已选项
-                    </a-menu-item>
-                    <a-menu-item key="2">
-                      全部删除
-                    </a-menu-item>
-                  </a-menu>
-                  <a-button
-                    style="margin:0 15px;"
-                    type="primary"
-                    ghost
-                    id="salesEdit-plDel-btn"> 批量删除 <a-icon type="down" /> </a-button>
-                </a-dropdown>
-                <a-button
-                  type="default"
-                  id="salesEdit-import-btn"
-                  @click="openGuideModal=true">导入产品</a-button>
-              </div>
             </div>
           </a-col>
         </a-row>
@@ -214,6 +215,8 @@
       @close="closeActive"></ChooseActive>
     <!-- 导入产品 -->
     <importGuideModal :openModal="openGuideModal" :params="{salesBillSn: $route.params.sn}" @close="closeGuideModel" @ok="hanldeOk" />
+    <!-- 仓库设置 -->
+    <setWarehouse :show="openWarehouseModal" @ok="chooseCustomOk" @cancel="openWarehouseModal=false"></setWarehouse>
   </div>
 </template>
 
@@ -224,13 +227,14 @@ import queryPart from './queryPart.vue'
 import queryPromotable from './queryPromotable.vue'
 import ChooseActive from './chooseActive.vue'
 import ImportGuideModal from './importGuideModal.vue'
+import setWarehouse from './setWarehouse.vue'
 import chooseWarehouse from '@/views/common/chooseWarehouse'
 import { salesModify, salesDetailBySn, salesWriteSubmit, getPromoacActiveList, deleteAll } from '@/api/sales'
 import { salesDetailStockList, salesDetailInsert, salesDetailUpdateQty, salesDetailDel, salesDetailBatchDel, salesDetailDelAll, addPromoGoods, salesBatchInsert } from '@/api/salesDetail'
 export default {
   name: 'SalesEdit',
   mixins: [commonMixin],
-  components: { STable, VSelect, queryPart, queryPromotable, ChooseActive, ImportGuideModal, chooseWarehouse },
+  components: { STable, VSelect, queryPart, queryPromotable, ChooseActive, ImportGuideModal, chooseWarehouse, setWarehouse },
   data () {
     return {
       spinning: false,
@@ -246,6 +250,7 @@ export default {
         salesBillSn: '',
         promotionFlag: 0
       },
+      openWarehouseModal: false, // 打开仓库设置
       warehouseSn: undefined,
       activeName: '', // 促销活动
       nowData: null,
@@ -284,11 +289,12 @@ export default {
     columns () {
       const arr = [
         { title: '序号', dataIndex: 'no', width: '4%', align: 'center' },
-        { title: '产品编码', dataIndex: 'productEntity.code', scopedSlots: { customRender: 'productCode' }, width: '20%', align: 'center', sorter: true },
-        { title: '产品名称', dataIndex: 'productEntity.name', scopedSlots: { customRender: 'productName' }, width: '25%', align: 'left' },
+        { title: '产品编码', dataIndex: 'productEntity.code', scopedSlots: { customRender: 'productCode' }, width: '13%', align: 'center', sorter: true },
+        { title: '产品名称', dataIndex: 'productEntity.name', scopedSlots: { customRender: 'productName' }, width: '20%', align: 'left' },
         // { title: '售价', dataIndex: 'price', width: '8%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
         { title: '销售数量', scopedSlots: { customRender: 'salesNums' }, width: '8%', align: 'center' },
         { title: '库存', dataIndex: 'stockQty', scopedSlots: { customRender: 'stockQty' }, width: '8%', align: 'center' },
+        { title: '出库仓库', dataIndex: 'warehouseName', width: '15%', align: 'center', customRender: function (text) { return text || '--' } },
         { title: '单位', dataIndex: 'productEntity.unit', width: '6%', align: 'center', customRender: function (text) { return text || '--' } },
         // { title: '售价小计', dataIndex: 'totalAmount', width: '8%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
         { title: '操作', scopedSlots: { customRender: 'action' }, width: '10%', align: 'center' }
@@ -321,7 +327,9 @@ export default {
       })
     },
     handleMenuClick (e) {
-      if (e.key == 1) { // 删除已选项
+      if (e.key == 0) { // 仓库设置
+        this.openWarehouseModal = true
+      } else if (e.key == 1) { // 删除已选项
         this.handleBatchDel()
       } else {
         this.handleBatchDelAll()

+ 13 - 1
src/views/salesManagement/salesQuery/list.vue

@@ -160,6 +160,12 @@
           </div>
           <div v-else>{{ record.salesBillNo }}</div>
         </template>
+        <!-- 出库仓库 -->
+        <template slot="warehouseBox" slot-scope="text, record">
+          <div class="warehouse_box" v-if="record.warehouseName && record.warehouseName.length>0">
+            <span v-for="(item,i) in record.warehouseName" :key="i">{{ item }}</span>
+          </div>
+        </template>
         <!-- 总数量 -->
         <template slot="totalQty" slot-scope="text, record">
           {{ record.totalQty }}
@@ -373,7 +379,7 @@ export default {
         { title: '销售单号', scopedSlots: { customRender: 'salesBillNo' }, width: '7%', align: 'center' },
         { title: '提交时间', dataIndex: 'submitDate', width: '6%', align: 'center', customRender: function (text) { return text || '--' }, sorter: true },
         { title: '客户名称', dataIndex: 'buyerName', width: '8%', align: 'left', customRender: function (text) { return text || '--' }, ellipsis: true },
-        { title: '出库仓库', dataIndex: 'warehouseName', width: '8%', align: 'center', customRender: function (text) { return text || '--' }, ellipsis: true },
+        { title: '出库仓库', scopedSlots: { customRender: 'warehouseBox' }, width: '8%', align: 'center', ellipsis: true },
         { title: '总数量', dataIndex: 'totalQty', scopedSlots: { customRender: 'totalQty' }, width: '4%', align: 'center' },
         // { title: '总售价', dataIndex: 'totalAmount', width: '4%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
         { title: '已下推数量', dataIndex: 'totalPushedQty', width: '4%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
@@ -604,6 +610,12 @@ export default {
           font-size: 13px;
         }
       }
+      .warehouse_box>span::after{
+        content:','
+      }
+      .warehouse_box>span:last-child::after{
+        content:''
+      }
     }
   }
 </style>

+ 6 - 6
src/views/salesManagement/salesQuery/queryPart.vue

@@ -20,6 +20,11 @@
             </a-form-item>
           </a-col>
           <template v-if="advanced">
+            <a-col :md="6" :sm="24">
+              <a-form-item label="出库仓库">
+                <chooseWarehouse ref="warehouse" v-model="queryParam.warehouseSn"></chooseWarehouse>
+              </a-form-item>
+            </a-col>
             <a-col :md="6" :sm="24">
               <a-form-item label="产品品牌">
                 <ProductBrand id="productInfoList-productBrandSn" v-model="queryParam.productBrandSn"></ProductBrand>
@@ -30,11 +35,6 @@
                 <ProductType id="productInfoList-productType" v-model="productType" @change="changeProductType"></ProductType>
               </a-form-item>
             </a-col>
-            <a-col :md="6" :sm="24">
-              <a-form-item label="仓库">
-                <chooseWarehouse ref="warehouse" v-model="queryParam.warehouseSn"></chooseWarehouse>
-              </a-form-item>
-            </a-col>
           </template>
           <a-col :md="6" :sm="24" style="margin-bottom: 10px;">
             <a-button type="primary" @click="$refs.table.refresh(true)" :disabled="disabled" id="productInfoList-refresh">查询</a-button>
@@ -165,7 +165,7 @@ export default {
       const arr = [
         { title: '产品编码', dataIndex: 'productCode', width: '14%', align: 'center', customRender: function (text) { return text || '--' } },
         { title: '产品名称', dataIndex: 'productName', scopedSlots: { customRender: 'productName' }, width: '18%', align: 'left' },
-        { title: '仓库', dataIndex: 'warehouseName', width: '11%', align: 'center', customRender: function (text) { return text || '--' }, ellipsis: true },
+        { title: '出库仓库', dataIndex: 'warehouseName', width: '11%', align: 'center', customRender: function (text) { return text || '--' }, ellipsis: true },
         { title: '原厂编码', dataIndex: 'productOrigCode', width: '11%', align: 'center', customRender: function (text) { return text || '--' }, ellipsis: true },
         { title: '品牌', dataIndex: 'productBrandName', width: '11%', align: 'center', customRender: function (text) { return text || '--' }, ellipsis: true },
         { title: '库存数量', dataIndex: 'currentStockQty', width: '8%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },

+ 183 - 0
src/views/salesManagement/salesQuery/setWarehouse.vue

@@ -0,0 +1,183 @@
+<template>
+  <a-modal
+    v-model="opened"
+    :title="title"
+    centered
+    :maskClosable="false"
+    :confirmLoading="confirmLoading"
+    width="36%"
+    :footer="null"
+    @cancel="cancel"
+  >
+    <a-spin :spinning="spinning" tip="Loading...">
+      <a-form-model
+        id="chooseCustom-form"
+        ref="ruleForm"
+        :model="form"
+        :rules="rules"
+        :label-col="formItemLayout.labelCol"
+        :wrapper-col="formItemLayout.wrapperCol">
+        <a-form-model-item label="出库仓库" prop="warehouseSn">
+          <chooseWarehouse ref="warehouse" v-model="form.warehouseSn"></chooseWarehouse>
+        </a-form-model-item>
+        <a-form-model-item :wrapper-col="{ span: 12, offset: 6 }" style="text-align: center;margin-top:60px;">
+          <a-button @click="cancel" style="margin-right: 15px" id="chooseCustom-btn-back">取消</a-button>
+          <a-button type="primary" :loading="confirmLoading" @click="handleSubmit" id="chooseCustom-btn-submit">确定</a-button>
+        </a-form-model-item>
+      </a-form-model>
+    </a-spin>
+  </a-modal>
+</template>
+
+<script>
+import { commonMixin } from '@/utils/mixin'
+import { VSelect } from '@/components'
+import { dealerRecevieAddrQuery } from '@/api/dealerRecevieAddr'
+import { salesSave } from '@/api/sales'
+import chooseWarehouse from '@/views/common/chooseWarehouse'
+export default {
+  name: 'SalesChooseCustomModal',
+  mixins: [commonMixin],
+  components: { VSelect, chooseWarehouse },
+  props: {
+    show: [Boolean]
+  },
+  data () {
+    return {
+      opened: this.show,
+      spinning: false,
+      title: '更改出库仓库',
+      confirmLoading: false,
+      formItemLayout: {
+        labelCol: { span: 4 },
+        wrapperCol: { span: 18 }
+      },
+      form: {
+        warehouseSn: undefined
+      },
+      rules: {
+        warehouseSn: [ { required: true, message: '请选择出库仓库', trigger: ['change', 'blur'] } ]
+      }
+    }
+  },
+  methods: {
+
+    // 客户 change
+    custChange (val) {
+      if (val && val.key) {
+        this.form.buyerSn = val.key || undefined
+        this.form.buyerName = val.name || ''
+        this.$refs.ruleForm.clearValidate()
+        this.getDefaultAddress()
+        if (val.row) {
+          this.form.warehouseSn = val.row.defaultWarehouseSn
+        }
+      } else {
+        this.form.buyerName = ''
+        this.form.buyerSn = undefined
+        this.form.warehouseSn = undefined
+        this.verifyFun(this.addressId)
+      }
+    },
+    //  选择地址
+    handleChoose () {
+      this.openAddrModal = true
+    },
+    //  保存
+    handleSubmit (e) {
+      e.preventDefault()
+      const _this = this
+      this.$refs.ruleForm.validate(valid => {
+        if (valid) {
+          _this.salesSaveFun()
+        } else {
+          console.log('error submit!!')
+          return false
+        }
+      })
+    },
+    // 新建或编辑销售单
+    salesSaveFun () {
+      const _this = this
+      const form = this.form
+      _this.spinning = true
+      salesSave(form).then(res => {
+        if (res.status == 200) {
+          _this.$message.success(res.message)
+          _this.$emit('ok', res.data)
+          if (_this.form.id) {
+            _this.$emit('updateData')
+          }
+          _this.cancel()
+          _this.spinning = false
+        } else {
+          _this.spinning = false
+        }
+      })
+    },
+    cancel () {
+      this.opened = false
+      this.$emit('cancel')
+      this.$refs.ruleForm.resetFields()
+    },
+    //  地址保存
+    handleOk (data) {
+      this.chooseAddr = (data.consigneeName || '') + '(' + (data.consigneeTel || '-') + ')' + ' ' + (data.address || '')
+      this.addressVal = '更换地址'
+      this.form.shippingAddrProvinceSn = data.provinceSn || ''
+      this.form.shippingAddrProvinceName = data.provinceName || '' // 省
+      this.form.shippingAddrCitySn = data.citySn || ''
+      this.form.shippingAddrCityName = data.cityName || '' // 市
+      this.form.shippingAddrCountySn = data.countySn || ''
+      this.form.shippingAddrCountyName = data.countyName || '' // 区
+      this.form.shippingAddr = data.addr || ''// 详细地址
+      this.form.consigneeTel = data.consigneeTel || '' // 联系电话
+      this.form.consigneeName = data.consigneeName || ''
+      this.addressId = data.id || undefined
+      this.openAddrModal = false
+      // 移除表单项的校验结果
+      this.$refs.ruleForm.clearValidate('consigneeTel')
+    },
+    verifyFun (id) {
+      if (id == this.addressId) {
+        this.chooseAddr = ''
+        this.addressVal = '选择地址'
+        this.form.shippingAddrProvinceSn = ''
+        this.form.shippingAddrProvinceName = ''// 省
+        this.form.shippingAddrCitySn = ''
+        this.form.shippingAddrCityName = '' // 市
+        this.form.shippingAddrCountySn = ''
+        this.form.shippingAddrCountyName = '' // 区
+        this.form.shippingAddr = ''// 详细地址
+        this.form.consigneeTel = '' // 联系电话
+        this.form.consigneeName = ''
+      }
+    },
+    // 获取默认地址
+    getDefaultAddress () {
+      dealerRecevieAddrQuery({ defaultFlag: 1, dealerSn: this.form.buyerSn }).then(res => {
+        if (res.status == 200) {
+          if (res.data.length == 1) {
+            const ret = res.data[0]
+            ret.address = (ret.provinceName ? (ret.provinceName + '-') : '') + (ret.cityName ? (ret.cityName + '-') : '') + (ret.countyName ? (ret.countyName + '-') : '') + ret.addr
+            this.addressId = ret.id || undefined
+            this.handleOk(ret)
+          } else {
+            this.verifyFun(this.addressId)
+          }
+        }
+      })
+    }
+  },
+  watch: {
+    show (newValue, oldValue) {
+      this.opened = newValue
+      if (!newValue) {
+        this.$refs.dealerSubareaScopeList.resetForm()
+        this.$refs.ruleForm.resetFields()
+        this.verifyFun(this.addressId)
+      }
+    }
+  }
+}
+</script>