瀏覽代碼

bug 修复

lilei 4 年之前
父節點
當前提交
2a0126f9f1

+ 0 - 2
src/views/customerManagement/customerInfo/edit.vue

@@ -155,7 +155,6 @@ export default {
         satelliteFlag: 0, //  是否卫星仓客户
         customerTypeSn: undefined, //  客户类型
         priceType: '', //  价格类型
-        payType: '', //  支付方式
         settleStyleSn: undefined //  收款方式
       },
       rules: {
@@ -165,7 +164,6 @@ export default {
         citySn: [{ required: true, message: '请选择市', trigger: 'change' }],
         countySn: [{ required: true, message: '请选择区/县', trigger: 'change' }],
         priceType: [{ required: true, message: '请选择价格类型', trigger: 'change' }],
-        payType: [{ required: true, message: '请选择支付方式', trigger: 'change' }],
         settleStyleSn: [{ required: true, message: '请选择收款方式', trigger: 'change' }]
       },
       addrProvinceList: [], //  省下拉

+ 6 - 3
src/views/salesManagement/salesQuery/chooseCustomModal.vue

@@ -327,8 +327,7 @@ export default {
       this.isEdit = true
       if (data.shippingAddressProvinceSn) { this.getArea('city', data.shippingAddressProvinceSn) }
       if (data.shippingAddressCitySn) { this.getArea('district', data.shippingAddressCitySn) }
-      // this.form = Object.assign(this.form, data)
-      this.form = data
+      this.form = Object.assign(this.form, data)
     },
     //  获取详情
     getDetail () {
@@ -389,6 +388,8 @@ export default {
         })
       } else {
         // 新建
+        params.id = null
+        params.satelliteFlag = 0 //  是否卫星仓客户
         custSave(params).then(res => {
           if (res.status != 200) {
             this.$message.error(res.message)
@@ -405,7 +406,9 @@ export default {
           // 保存客户信息
           _this.handleSaveCust()
           // 保存销售单
-          _this.salesSaveFun()
+          if (_this.form.buyerSn) {
+            _this.salesSaveFun()
+          }
         } else {
           console.log('error submit!!')
           return false

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

@@ -15,7 +15,7 @@
     </a-page-header>
     <a-card size="small" :bordered="false" class="salesEdit-cont">
       <!-- 查询配件列表 -->
-      <queryPart @add="insterProduct"></queryPart>
+      <queryPart :buyerSn="detailData&&detailData.buyerSn" @add="insterProduct"></queryPart>
     </a-card>
     <a-card size="small" :bordered="false" class="salesEdit-cont">
       <!-- 总计 -->
@@ -77,7 +77,7 @@
         </template>
         <!-- 操作 -->
         <template slot="action" slot-scope="text, record">
-          <a-button size="small" type="link" @click="handleDel(record)" id="productInfoList-Del">删除</a-button>
+          <a-button size="small" type="primary" class="button-error" @click="handleDel(record)" id="productInfoList-Del">删除</a-button>
         </template>
       </s-table>
     </a-card>
@@ -127,8 +127,8 @@ export default {
         { title: '售价', scopedSlots: { customRender: 'price' }, width: 150, align: 'center' },
         { title: '销售数量', scopedSlots: { customRender: 'salesNums' }, width: 150, align: 'center' },
         { title: '单位', dataIndex: 'dealerProductEntity.unit', width: 100, align: 'center', customRender: function (text) { return text || '--' } },
-        { title: '售价小计', dataIndex: 'totalAmount', width: 100, align: 'center', customRender: function (text) { return ('¥' + text) || '--' } },
-        { title: '折后小计', dataIndex: 'discountedAmount', width: 100, align: 'center', customRender: function (text) { return ('¥' + text) || '--' } },
+        { title: '售价小计', dataIndex: 'totalAmount', width: 100, align: 'center', customRender: function (text) { return (text ? ('¥' + text) : '--') } },
+        { title: '折后小计', dataIndex: 'discountedAmount', width: 100, align: 'center', customRender: function (text) { return (text ? ('¥' + text) : '--') } },
         { title: '操作', scopedSlots: { customRender: 'action' }, width: 170, align: 'center', fixed: 'right' }
       ],
       // 加载数据方法 必须为 Promise 对象
@@ -185,7 +185,9 @@ export default {
     // 编辑客户信息
     handleEdit () {
       this.openModal = true
-      this.$refs.custModal.editCust(this.detailData)
+      setTimeout(() => {
+        this.$refs.custModal.editCust(this.detailData)
+      }, 500)
     },
     //  重置
     resetSearchForm (flag) {

+ 22 - 6
src/views/salesManagement/salesQuery/list.vue

@@ -104,7 +104,12 @@
     </div>
     <!-- alert -->
     <a-alert type="info" showIcon style="margin-bottom:15px">
-      <div slot="message">总售价:<strong>13.00</strong>元;总单数:<strong>13.00</strong>;总款数:<strong>13.00</strong>;总数量:<strong>13.00</strong>;</div>
+      <div slot="message">
+        总售价:<strong>{{ totalData.totalAmount }}</strong>元;
+        总单数:<strong>{{ totalData.totalRecord }}</strong>;
+        总款数:<strong>{{ totalData.totalCategory }}</strong>;
+        总数量:<strong>{{ totalData.totalQty }}</strong>;
+      </div>
     </a-alert>
     <!-- 列表 -->
     <s-table
@@ -118,11 +123,11 @@
       bordered>
       <!-- 业务/审核状态 -->
       <template slot="billStatus" slot-scope="text, record">
-        <a-tag :color="record.state=='FINISH'?'green':'red'" >{{ record.state=='FINISH'? '待备货审核': '待单据审核' }}</a-tag>
+        <a-tag :color="record.state=='FINISH'?'green':'red'" >{{ record.billStatus }}</a-tag>
       </template>
       <!-- 财务状态 -->
       <template slot="financialStatus" slot-scope="text, record">
-        <a-tag :color="record.state==1?'green':'red'" >{{ record.state==1? '待提交': '待单据审核' }}</a-tag>
+        <a-tag :color="record.state==1?'green':'red'" >{{ record.financialStatus }}</a-tag>
       </template>
       <!-- 操作 -->
       <template slot="action" slot-scope="text, record">
@@ -143,7 +148,7 @@ import moment from 'moment'
 import { STable, VSelect } from '@/components'
 import chooseCustomModal from './chooseCustomModal.vue'
 import { custAllList } from '@/api/customer'
-import { salesList, salesDel, salesWriteAudit, salesWriteStockOut } from '@/api/sales'
+import { salesList, salesDel, salesWriteAudit, salesWriteStockOut, salesCount } from '@/api/sales'
 export default {
   name: 'TableList',
   components: { STable, VSelect, chooseCustomModal },
@@ -165,6 +170,12 @@ export default {
         billStatus: undefined, //  业务状态
         financialStatus: undefined //  财务状态
       },
+      totalData: {
+        totalAmount: 0,
+        totalCategory: 0,
+        totalQty: 0,
+        totalRecord: 0
+      },
       // 表头
       columns: [
         { title: '序号', dataIndex: 'no', width: 80, align: 'center' },
@@ -178,7 +189,7 @@ export default {
         { title: '收款方式', dataIndex: 'settleStyle', width: 100, align: 'center', customRender: function (text) { return text || '--' } },
         { title: '审核时间', dataIndex: 'auditTime', width: 160, align: 'center', customRender: function (text) { return text || '--' } },
         { title: '急件', dataIndex: 'urgentFlag', width: 100, align: 'center', customRender: function (text) { return text || '--' } },
-        { title: '业务状态', scopedSlots: { customRender: 'auditStatus' }, width: 110, align: 'center' },
+        { title: '业务状态', scopedSlots: { customRender: 'billStatus' }, width: 110, align: 'center' },
         { title: '财务状态', scopedSlots: { customRender: 'financialStatus' }, width: 110, align: 'center' },
         { title: '操作', scopedSlots: { customRender: 'action' }, width: 300, align: 'center', fixed: 'right' }
       ],
@@ -193,6 +204,11 @@ export default {
           this.queryParam.beginDate = undefined
           this.queryParam.endDate = undefined
         }
+        // 查询总计
+        salesCount(Object.assign(parameter, this.queryParam)).then(res => {
+          console.log(res)
+          this.totalData = Object.assign(this.totalData, res.data || {})
+        })
         return salesList(Object.assign(parameter, this.queryParam)).then(res => {
           const data = res.data
           const no = (data.pageNo - 1) * data.pageSize
@@ -309,7 +325,7 @@ export default {
       this.queryParam.purchaseBillNo = ''
       this.queryParam.payType = undefined
       this.queryParam.settleStyle = undefined
-      this.queryParam.auditStatus = undefined
+      this.queryParam.billStatus = undefined
       this.queryParam.financialStatus = undefined
       this.time = []
       this.$refs.table.refresh(true)

+ 63 - 59
src/views/salesManagement/salesQuery/productSalesRecordModal.vue

@@ -9,30 +9,34 @@
     @cancle="isShow=false"
     width="80%">
     <div>
-      <a-tabs type="card" default-active-key="1" @change="callback">
+      <a-tabs type="card" v-model="curTab" @change="callback">
         <a-tab-pane key="1" tab="当前客户">
         </a-tab-pane>
         <a-tab-pane key="2" tab="全部客户">
         </a-tab-pane>
       </a-tabs>
       <!-- 表格 -->
-      <s-table
+      <a-table
         class="sTable"
         ref="table"
         size="default"
-        :rowKey="(record) => record.id"
+        :data-source="list"
+        :pagination="pagination"
+        :loading="loading"
+        :row-key="(record) => record.id"
         :columns="columns"
-        :data="loadData"
+        @change="handleTableChange"
         bordered>
-      </s-table>
+      </a-table>
     </div>
   </a-modal>
 </template>
 
 <script>
+import { salesRecordlList } from '@/api/salesDetail.js'
 import { STable } from '@/components'
 export default {
-  name: 'salesRecordModal',
+  name: 'SalesRecordModal',
   components: { STable },
   props: {
     openModal: { //  弹框显示状态
@@ -52,11 +56,17 @@ export default {
   data () {
     return {
       isShow: this.openModal, //  是否打开弹框
+      buyerSn: null,
+      queryParam: {
+        productSn: null,
+        pageNo: 1,
+        pageSize: 10
+      },
       // 表头
       columns: [
         {
           title: '销售时间',
-          dataIndex: 'salesTime',
+          dataIndex: 'putTime',
           align: 'center',
           width: 250
         },
@@ -68,65 +78,63 @@ export default {
         },
         {
           title: '销售数量',
-          dataIndex: 'salesNums',
+          dataIndex: 'qty',
           align: 'center',
           width: 150
         },
         {
           title: '客户名称',
-          dataIndex: 'productBrand',
+          dataIndex: 'buyerName',
           align: 'center'
-        },
+        }
       ],
-      // 加载数据方法 必须为 Promise 对象
-      loadData: parameter => {
-        this.disabled = true
-        // return customerBundleDelayList( Object.assign(parameter, this.queryParam) ).then(res => {
-        //   const data = res.data
-        //   return data
-        // })
-        const _this = this
-        return new Promise(function(resolve, reject){
-          const data = {
-            pageNo: 1,
-            pageSize: 10,
-            list: [
-              { 
-                id: '1', 
-                salesTime: '2020-12-23 15:23:15', 
-                price: 56, 
-                salesNums: 12, 
-                productBrand: '箭冠品牌', 
-              },
-              {
-                id: '23', 
-                salesTime: '2020-12-23 15:23:15', 
-                price: 56, 
-                salesNums: 12, 
-                productBrand: '箭冠品牌', 
-              },
-              {
-                id: '44', 
-                salesTime: '2020-12-23 15:23:15', 
-                price: 56, 
-                salesNums: 12, 
-                productBrand: '箭冠品牌', 
-              }
-            ],
-            count: 100
-          }
-          resolve(data)
-        })
-      },
+      list: [],
+      pagination: {},
+      loading: false,
+      curTab: '1'
     }
   },
   methods: {
+    handleTableChange (pagination, filters, sorter) {
+      console.log(pagination)
+      const pager = { ...this.pagination }
+      pager.current = pagination.current
+      this.pagination = pager
+      this.loading = true
+      this.queryParam = Object.assign(this.queryParam, {
+        results: pagination.pageSize,
+        page: pagination.current,
+        sortField: sorter.field,
+        sortOrder: sorter.order,
+        ...filters
+      })
+
+      salesRecordlList(this.queryParam).then(res => {
+        this.list = res.data.list || []
+        this.loading = false
+      })
+    },
     //  获取详情
-    getDetail(){
-      
+    getDetail (productSn, buyerSn) {
+      this.buyerSn = buyerSn
+      if (this.curTab == 1) {
+        this.queryParam.buyerSn = buyerSn
+      } else {
+        delete this.queryParam.buyerSn
+      }
+      this.queryParam.productSn = productSn
+      this.queryParam.pageNo = 1
+      this.queryParam.pageSize = 10
+      this.loading = true
+      salesRecordlList(this.queryParam).then(res => {
+        this.list = res.data.list || []
+        this.loading = false
+      })
     },
-    callback(key){
-      console.log(key);
+    callback (key) {
+      console.log(key)
+      this.curTab = key
+      this.getDetail(this.queryParam.productSn, this.buyerSn)
     }
   },
   watch: {
@@ -138,11 +146,7 @@ export default {
     isShow (newValue, oldValue) {
       if (!newValue) {
         this.$emit('close')
-      }
-    },
-    itemId (newValue, oldValue) {
-      if (this.isShow && newValue) {
-        this.getDetail()
+        this.curTab = '1'
       }
     }
   }

+ 20 - 11
src/views/salesManagement/salesQuery/queryPart.vue

@@ -124,13 +124,18 @@
       </template>
       <!-- 操作 -->
       <template slot="action" slot-scope="text, record">
-        <a-button size="small" type="link" @click="handleAdd(record)" id="productInfoList-edit-btn">添加</a-button>
-        <a-divider type="vertical" style="margin: 0;" />
-        <a-button size="small" type="link" @click="handleDetail(record)" id="productInfoList-detail-btn" style="margin-left: 15px;">销售记录</a-button>
+        <a-button size="small" type="primary" class="button-info" @click="handleAdd(record)" id="productInfoList-edit-btn">添加</a-button>
+        <a-button
+          size="small"
+          type="primary"
+          class="button-success"
+          @click="handleDetail(record)"
+          id="productInfoList-detail-btn"
+          style="margin-left: 15px;">销售记录</a-button>
       </template>
     </s-table>
     <!-- 销售记录 -->
-    <product-salesRecord-modal :openModal="openModal" :itemId="itemId" @close="closeModal" />
+    <product-salesRecord-modal ref="salseRecord" :openModal="openModal" @close="closeModal" />
   </div>
 </template>
 
@@ -144,6 +149,12 @@ import { STable, VSelect } from '@/components'
 export default {
   name: 'QueryPart',
   components: { STable, VSelect, productSalesRecordModal },
+  props: {
+    buyerSn: {
+      type: [Number, String],
+      default: ''
+    }
+  },
   data () {
     return {
       advanced: false, // 高级搜索 展开/关闭
@@ -169,12 +180,12 @@ export default {
         { title: '产品名称', dataIndex: 'productName', align: 'center' },
         { title: '原厂编码', dataIndex: 'productOrigCode', width: 140, align: 'center' },
         { title: '品牌', dataIndex: 'brandName', width: 100, align: 'center', sorter: true },
-        { title: '仓库', dataIndex: 'warehouseSn', width: 100, align: 'center', sorter: true },
-        { title: '仓位', dataIndex: 'warehouseLocationSn', width: 100, align: 'center' },
+        { title: '仓库', dataIndex: 'warehouseName', width: 100, align: 'center', sorter: true },
+        { title: '仓位', dataIndex: 'warehouseLocationName', width: 100, align: 'center' },
         { title: '售价', scopedSlots: { customRender: 'price' }, width: 150, align: 'center' },
         { title: '销售数量', scopedSlots: { customRender: 'nums' }, width: 150, align: 'center' },
         { title: '单位', dataIndex: 'unit', width: 100, align: 'center', customRender: function (text) { return text || '--' } },
-        { title: '操作', scopedSlots: { customRender: 'action' }, width: 170, align: 'center', fixed: 'right' }
+        { title: '操作', scopedSlots: { customRender: 'action' }, width: 200, align: 'center', fixed: 'right' }
       ],
       // 加载数据方法 必须为 Promise 对象
       loadData: parameter => {
@@ -202,8 +213,7 @@ export default {
           return data
         })
       },
-      openModal: false, //  查看客户详情  弹框
-      itemId: '' //  当前产品id
+      openModal: false //  查看客户详情  弹框
     }
   },
   methods: {
@@ -242,12 +252,11 @@ export default {
     },
     // 销售记录
     handleDetail (row) {
-      this.itemId = row.id
       this.openModal = true
+      this.$refs.salseRecord.getDetail(this.buyerSn, row.productSn)
     },
     //  关闭弹框
     closeModal () {
-      this.itemId = ''
       this.openModal = false
     },
     // 仓库