Browse Source

bug修复

chenrui 4 years ago
parent
commit
b0d746931f

+ 10 - 2
src/api/productType.js

@@ -1,10 +1,18 @@
 import { axios } from '@/utils/request'
 
-//  箭冠 产品分类 列表
-export const productTypeQuery = (params) => {
+//  箭冠 产品分类 列表   一层分类查询   无分页
+export const productTypeQueryList = (params) => {
   return axios({
     url: '/productType/queryList',
     data: params,
     method: 'post'
   })
 }
+//  箭冠 产品分类 列表  多层分类查询   无分页
+export const productTypeQuery = (params) => {
+  return axios({
+    url: '/productType/query',
+    data: params,
+    method: 'post'
+  })
+}

+ 32 - 2
src/api/purchaseReturn.js

@@ -11,6 +11,29 @@ export const purchaseReturnList = (params) => {
     method: 'post'
   })
 }
+//  采购退货  新增
+export const purchaseReturnSave = (params) => {
+  return axios({
+    url: '/purchaseReturn/save',
+    data: params,
+    method: 'post'
+  })
+}
+//  采购退货 删除
+export const purchaseReturnDel = (params) => {
+  return axios({
+    url: `/purchaseReturn/delete//${params.id}`,
+    method: 'get'
+  })
+}
+//  采购退货  提交
+export const purchaseReturnSubmit = (params) => {
+  return axios({
+    url: '/purchaseReturn/submit',
+    data: params,
+    method: 'post'
+  })
+}
 //  采购退货 详情 选择产品 列表  分页
 export const purchaseReturnPurchaseBillDetailList = (params) => {
   const url = `/purchaseReturn/detail/queryPurchaseBillDetailPage/${params.pageNo}/${params.pageSize}`
@@ -33,11 +56,18 @@ export const purchaseReturnDetailList = (params) => {
     method: 'post'
   })
 }
-//  采购退货 详情 选择产品 列表  分页
-export const purchaseReturnSave = (params) => {
+//  采购退货 详情 添加产品
+export const purchaseReturnDetailSave = (params) => {
   return axios({
     url: '/purchaseReturn/detail/save',
     data: params,
     method: 'post'
   })
 }
+//  采购退货 详情 删除
+export const purchaseReturnDetailDel = (params) => {
+  return axios({
+    url: `/purchaseReturn/detail/delete//${params.id}`,
+    method: 'get'
+  })
+}

+ 1 - 1
src/config/router.config.js

@@ -436,7 +436,7 @@ export const asyncRouterMap = [
                 }
               },
               {
-                path: 'add',
+                path: 'add/:id/:sn',
                 name: 'purchaseReturnAdd',
                 component: () => import(/* webpackChunkName: "shop" */ '@/views/purchasingManagement/purchaseReturn/edit.vue'),
                 meta: {

+ 1 - 5
src/views/customerManagement/customerInfo/list.vue

@@ -217,10 +217,6 @@ export default {
     },
     //  重置
     resetSearchForm () {
-      this.clearData()
-      this.$refs.table.refresh(true)
-    },
-    clearData () {
       this.queryParam.customerName = undefined
       this.queryParam.contactName = ''
       this.queryParam.provinceSn = undefined
@@ -230,6 +226,7 @@ export default {
       this.queryParam.customerTypeSn = undefined
       this.creatTime = []
       this.lastSaleTime = []
+      this.$refs.table.refresh(true)
     },
     //  新增/编辑
     handleEdit (row) {
@@ -250,7 +247,6 @@ export default {
           custDel({ id: row.id }).then(res => {
             if (res.status == 200) {
               _this.$message.success(res.message)
-              _this.clearData()
               _this.$refs.table.refresh()
             }
           })

+ 2 - 2
src/views/productManagement/productInfoJg/list.vue

@@ -202,7 +202,7 @@ export default {
     },
     //  产品品牌  列表
     getProductBrand () {
-      productBrandQuery({ 'sysFlag': '1' }).then(res => {
+      productBrandQuery({}).then(res => {
         if (res.status == 200) {
           this.productBrandList = res.data
         } else {
@@ -212,7 +212,7 @@ export default {
     },
     //  产品分类  列表
     getProductType () {
-      productTypeQuery({ 'sysFlag': '1' }).then(res => {
+      productTypeQuery({}).then(res => {
         if (res.status == 200) {
           this.productTypeList = res.data
         } else {

+ 57 - 77
src/views/purchasingManagement/purchaseReturn/edit.vue

@@ -25,18 +25,18 @@
             <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="采购单号" prop="productCode">
-                    <a-input id="purchaseReturnEdit-productCode" v-model="queryParam.productCode" placeholder="请输入采购单号" allowClear />
+                  <a-form-item label="采购单号" prop="purchaseBillNo">
+                    <a-input id="purchaseReturnEdit-purchaseBillNo" v-model.trim="queryParam.purchaseBillNo" placeholder="请输入采购单号" allowClear />
                   </a-form-item>
                 </a-col>
                 <a-col :md="6" :sm="24">
                   <a-form-item label="产品编码" prop="productCode">
-                    <a-input id="purchaseReturnEdit-productCode" v-model="queryParam.productCode" placeholder="请输入产品编码" allowClear />
+                    <a-input id="purchaseReturnEdit-productCode" v-model.trim="queryParam.productCode" placeholder="请输入产品编码" allowClear />
                   </a-form-item>
                 </a-col>
                 <a-col :md="6" :sm="24">
                   <a-form-item label="产品名称" prop="productName">
-                    <a-input id="purchaseReturnEdit-productName" v-model="queryParam.productName" placeholder="请输入产品名称" allowClear />
+                    <a-input id="purchaseReturnEdit-productName" v-model.trim="queryParam.productName" placeholder="请输入产品名称" allowClear />
                   </a-form-item>
                 </a-col>
                 <a-col :md="6" :sm="24" style="margin-bottom: 24px;">
@@ -58,13 +58,13 @@
             :pagination="paginationProps"
             bordered>
             <!-- 数量 -->
-            <template slot="putQty" slot-scope="text, record">
+            <template slot="returnQty" slot-scope="text, record">
               <a-input-number
-                id="purchaseReturnEdit-putQty"
-                v-model="record.putQty"
+                id="purchaseReturnEdit-returnQty"
+                v-model="record.returnQty"
                 :precision="0"
                 :min="1"
-                :max="999999"
+                :max="record.qtyLeft"
                 placeholder="请输入"
                 style="width: 100%;" />
             </template>
@@ -99,19 +99,19 @@
             :rowKey="(record) => record.id"
             :columns="chooseColumns"
             :dataSource="chooseLoadData"
-            :scroll="{ x: 1185, y: 300 }"
+            :scroll="{ x: 1320, y: 300 }"
             :pagination="choosePaginationProps"
             bordered>
             <!-- 退货数量 -->
-            <template slot="outQty" slot-scope="text, record">
+            <template slot="qty" slot-scope="text, record">
               <a-input-number
-                id="purchaseReturnEdit-outQty"
-                v-model="record.outQty"
+                id="purchaseReturnEdit-qty"
+                v-model="record.qty"
                 :precision="0"
                 :min="1"
-                :max="999999"
+                :max="record.qtyLeft"
                 placeholder="请输入"
-                @blur="e => outQtyChange(e.target.value, record)"
+                @blur="e => qtyChange(e.target.value, record)"
                 style="width: 100%;" />
             </template>
             <!-- 退货原因 -->
@@ -121,7 +121,7 @@
                 v-model="record.remarks"
                 :maxLength="30"
                 placeholder="退货原因(最多30个字符)"
-                @change="e => outQtyChange(e.target.value, record)"
+                @change="e => remarksChange(e.target.value, record)"
                 style="width: 100%;" />
             </template>
             <!-- 操作 -->
@@ -142,39 +142,27 @@
 
 <script>
 import { STable, VSelect } from '@/components'
-import { purchaseReturnPurchaseBillDetailList, purchaseReturnDetailList, purchaseReturnSave } from '@/api/purchaseReturn'
+import { purchaseReturnPurchaseBillDetailList, purchaseReturnDetailList, purchaseReturnDetailSave, purchaseReturnDetailDel, purchaseReturnSubmit } from '@/api/purchaseReturn'
 export default {
   components: { STable, VSelect },
   data () {
     return {
       queryParam: {
-        productCode: '',
-        productName: '',
-        warehouseSn: undefined,
-        brandSn: undefined,
-        productTypeSn1: undefined,
-        productTypeSn2: undefined,
-        productTypeSn3: undefined
-      },
-      chooseQueryParam: {
+        purchaseBillNo: '',
         productCode: '',
         productName: ''
       },
       disabled: false, //  查询、重置按钮是否可操作
-      chooseDisabled: false, //  查询、重置按钮是否可操作
       advanced: false, // 高级搜索 展开/关闭
-      productBrandList: [], //  产品品牌  下拉数据
-      productTypeList: [], //  产品分类  下拉数据
-      productType: [],
-      warehouseList: [], //  仓库  下拉数据
       // 表头
       columns: [
         { title: '序号', dataIndex: 'no', width: 80, align: 'center' },
         { title: '采购单号', dataIndex: 'purchaseBillNo', width: 200, align: 'center' },
         { title: '产品编码', dataIndex: 'productEntity.code', width: 200, align: 'center' },
-        { title: '产品名称', dataIndex: 'productEntity.name', align: 'center', ellipsis: true },
+        { title: '产品名称', dataIndex: 'productEntity.name', width: 200, align: 'center', ellipsis: true },
         { title: '采购总数', dataIndex: 'qty', width: 100, align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
-        { title: '退货数量', scopedSlots: { customRender: 'putQty' }, width: 200, align: 'center' },
+        { title: '可退数量', dataIndex: 'qtyLeft', width: 100, align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
+        { title: '退货数量', scopedSlots: { customRender: 'returnQty' }, width: 100, align: 'center' },
         { title: '采购价', dataIndex: 'price', width: 100, align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
         { title: '单位', dataIndex: 'productEntity.unit', width: 100, align: 'center', customRender: function (text) { return text || '--' } },
         { title: '操作', scopedSlots: { customRender: 'action' }, width: 100, align: 'center', fixed: 'right' }
@@ -193,13 +181,13 @@ export default {
       chooseColumns: [
         { title: '序号', dataIndex: 'no', width: 80, align: 'center' },
         { title: '采购单号', dataIndex: 'purchaseBillNo', width: 200, align: 'center' },
-        { title: '产品编码', dataIndex: 'productCode', width: 140, align: 'center', customRender: function (text) { return text || '--' } },
-        { title: '产品名称', dataIndex: 'productName', align: 'center', ellipsis: true },
-        { title: '采购总数', dataIndex: 'currentQty', width: 100, align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
-        { title: '退货数量', scopedSlots: { customRender: 'putQty' }, width: 100, align: 'center' },
-        { title: '采购价', dataIndex: 'putCost', width: 100, align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
-        { title: '单位', dataIndex: 'unit', width: 100, align: 'center', customRender: function (text) { return text || '--' } },
-        { title: '退货原因', scopedSlots: { customRender: 'remarks' }, width: 100, align: 'center' },
+        { title: '产品编码', dataIndex: 'dealerProductEntity.code', width: 140, align: 'center', customRender: function (text) { return text || '--' } },
+        { title: '产品名称', dataIndex: 'dealerProductEntity.name', align: 'center', ellipsis: true },
+        { title: '采购总数', dataIndex: 'purchaseBillQty', width: 100, align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
+        { title: '退货数量', scopedSlots: { customRender: 'qty' }, width: 100, align: 'center' },
+        { title: '采购价', dataIndex: 'cost', width: 100, align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
+        { title: '单位', dataIndex: 'dealerProductEntity.unit', width: 100, align: 'center', customRender: function (text) { return text || '--' } },
+        { title: '退货原因', scopedSlots: { customRender: 'remarks' }, width: 200, align: 'center' },
         { title: '操作', scopedSlots: { customRender: 'action' }, width: 100, align: 'center', fixed: 'right' }
       ],
       chooseLoadData: [],
@@ -211,46 +199,40 @@ export default {
         current: 1,
         onShowSizeChange: (current, pageSize) => this.changeChoosePageSize(current, pageSize),
         onChange: (current) => this.changeChoosePage(current)
-      },
-      productTotal: null //  合计
+      }
     }
   },
   methods: {
     //  重置
     resetSearchForm () {
+      this.queryParam.purchaseBillNo = ''
       this.queryParam.productCode = ''
       this.queryParam.productName = ''
-      this.queryParam.warehouseSn = undefined
-      this.queryParam.brandSn = undefined
-      this.queryParam.productTypeSn1 = undefined
-      this.queryParam.productTypeSn2 = undefined
-      this.queryParam.productTypeSn3 = undefined
-      this.$refs.table.refresh(true)
-    },
-    // 已选产品  重置
-    chooseResetSearchForm () {
-      this.chooseQueryParam.productCode = ''
-      this.chooseQueryParam.productName = ''
-      this.getChooseProductList(1)
+      this.getPurchaseBillDetailList()
     },
     //  添加/编辑
     handleAdd (row, isEdit) {
+      // 添加时退货数量字段名为returnQty,编辑时退货数量字段名为qty
+      if (!isEdit && !row.returnQty) {
+        this.$message.warning('请输入退货数量')
+        return
+      }
+      if (isEdit && !row.qty) {
+        this.$message.warning('请输入退货数量')
+        return
+      }
       const params = {
         id: isEdit ? row.id : undefined,
-        storeCallOutSn: this.$route.params.sn,
-        outCost: row.putCost,
-        outQty: isEdit ? row.outQty : 1, //  添加时调出数量默认为1
+        purchaseReturnSn: this.$route.params.sn,
+        purchaseBillSn: row.purchaseBillSn,
+        purchaseBillNo: row.purchaseBillNo,
+        purchaseBillDetailSn: row.purchaseBillDetailSn,
+        qty: isEdit ? row.qty : row.returnQty, //  退货数量
         productSn: row.productSn,
-        productCode: row.productCode,
-        productOrigCode: row.productOrigCode || undefined,
-        productTypeSn1: row.productTypeSn1,
-        productTypeSn2: row.productTypeSn2,
-        productTypeSn3: row.productTypeSn3,
-        brandSn: row.brandSn,
-        warehouseSn: row.warehouseSn,
-        warehouseLocationSn: row.warehouseLocationSn
+        cost: row.price,
+        remarks: row.remarks
       }
-      purchaseReturnSave(params).then(res => {
+      purchaseReturnDetailSave(params).then(res => {
         if (res.status == 200) {
           this.$message.success(res.message)
           this.getChooseProductList()
@@ -279,7 +261,7 @@ export default {
         content: '删除后不可恢复,确定要进行删除吗?',
         centered: true,
         onOk () {
-          storeCallOutDetailDel({ id: row.id }).then(res => {
+          purchaseReturnDetailDel({ id: row.id }).then(res => {
             if (res.status == 200) {
               _this.$message.success(res.message)
               _this.getChooseProductList()
@@ -291,7 +273,7 @@ export default {
     //  提交
     handleSubmit () {
       const _this = this
-      storeCallOutSubmit({ id: this.$route.params.id }).then(res => {
+      purchaseReturnSubmit({ id: this.$route.params.id }).then(res => {
         if (res.status == 200) {
           this.$message.success(res.message)
           setTimeout(() => {
@@ -300,8 +282,6 @@ export default {
         }
       })
     },
-    //  导入明细
-    handleImport () {},
     //  返回列表
     handleBack () {
       this.$router.push({ path: '/purchasingManagement/purchaseReturn/list' })
@@ -344,13 +324,12 @@ export default {
     // 已选产品列表数据
     getChooseProductList (pageNo) {
       this.choosePageNo = this.choosePageNo || pageNo
-      this.chooseDisabled = true
       const params = {
         pageNo: this.choosePageNo,
         pageSize: this.choosePageSize,
-        purchaseBillNo: this.$route.params.sn
+        purchaseReturnSn: this.$route.params.sn
       }
-      purchaseReturnDetailList(Object.assign(params, this.chooseQueryParam)).then(res => {
+      purchaseReturnDetailList(params).then(res => {
         if (res.status == 200) {
           const data = res.data
           this.choosePaginationProps.total = Number(res.data.count) || 0
@@ -360,7 +339,6 @@ export default {
             data.list[i].no = no + i + 1
           }
           this.chooseLoadData = data.list
-          this.chooseDisabled = false
         } else {
           this.choosePaginationProps.total = 0
           this.choosePaginationProps.current = 1
@@ -368,8 +346,12 @@ export default {
         }
       })
     },
-    // 已选产品 调出数量  change
-    outQtyChange (val, record) {
+    // 已选产品 退货数量  change
+    qtyChange (val, record) {
+      this.handleAdd(record, 'edit')
+    },
+    // 已选产品 退货数量  change
+    remarksChange (val, record) {
       this.handleAdd(record, 'edit')
     },
     filterOption (input, option) {
@@ -382,8 +364,6 @@ export default {
     next(vm => {
       vm.getPurchaseBillDetailList()
       vm.getChooseProductList(1)
-      // vm.getProductBrand()
-      // vm.getProductType()
     })
   }
 }

+ 23 - 26
src/views/purchasingManagement/purchaseReturn/list.vue

@@ -18,7 +18,7 @@
           </a-col>
           <a-col :md="6" :sm="24">
             <a-form-item label="退货单号">
-              <a-input id="purchaseReturnList-putPersonName" v-model.trim="queryParam.putPersonName" allowClear placeholder="请输入退货单号"/>
+              <a-input id="purchaseReturnList-purchaseReturnNo" v-model.trim="queryParam.purchaseReturnNo" allowClear placeholder="请输入退货单号"/>
             </a-form-item>
           </a-col>
           <a-col :md="6" :sm="24">
@@ -42,7 +42,7 @@
     </div>
     <!-- 操作按钮 -->
     <div class="table-operator">
-      <a-button id="purchaseReturnList-add" type="primary" @click="handleEdit()">新增</a-button>
+      <a-button id="purchaseReturnList-add" type="primary" class="button-error" @click="handleEdit()">新增</a-button>
     </div>
     <!-- 列表 -->
     <s-table
@@ -54,23 +54,21 @@
       :data="loadData"
       :scroll="{ x: 1170 }"
       bordered>
-      <!-- 店内调出单号 -->
-      <template slot="storeCallOutNo" slot-scope="text, record">
-        <span style="color: #ed1c24;cursor: pointer;" @click="handleDetail(record)">{{ record.storeCallOutNo }}</span>
+      <!-- 采退单号 -->
+      <template slot="purchaseReturnNo" slot-scope="text, record">
+        <span style="color: #ed1c24;cursor: pointer;" @click="handleDetail(record)">{{ record.purchaseReturnNo }}</span>
       </template>
       <!-- 操作 -->
       <template slot="action" slot-scope="text, record">
         <a-button
           size="small"
           type="primary"
-          v-if="record.state == 'WAIT_SUBMIT' || record.state == 'WAIT_AUDIT'"
           class="button-info"
           @click="handleEdit(record)"
           id="purchaseReturnList-edit-btn">编辑</a-button>
         <a-button
           size="small"
           type="primary"
-          v-if="record.state == 'WAIT_SUBMIT' || record.state == 'WAIT_AUDIT'"
           class="button-error"
           @click="handleDel(record)"
           id="purchaseReturnList-del-btn">删除</a-button>
@@ -82,30 +80,27 @@
 <script>
 import moment from 'moment'
 import { STable, VSelect } from '@/components'
-import { purchaseReturnList } from '@/api/purchaseReturn'
-import { storeCallOutTypeAllList } from '@/api/storeCallOutType'
+import { purchaseReturnList, purchaseReturnSave, purchaseReturnDel } from '@/api/purchaseReturn'
 export default {
   components: { STable, VSelect },
   data () {
     return {
       createDate: [], //  创建时间
       queryParam: { //  查询条件
-        putPersonName: undefined, //  调往对象
-        callOutType: undefined, //  调拨类型
-        state: undefined, //  业务状态
-        settleState: undefined //  财务状态
+        purchaseReturnNo: '', //  退货单号
+        state: undefined //  业务状态
       },
       disabled: false, //  查询、重置按钮是否可操作
       dateFormat: 'YYYY-MM-DD',
       columns: [
         { title: '序号', dataIndex: 'no', width: 80, align: 'center' },
         { title: '创建时间', dataIndex: 'createDate', width: 160, align: 'center' },
-        { title: '采购单号', scopedSlots: { customRender: 'storeCallOutNo' }, align: 'center' },
+        { title: '采退单号', scopedSlots: { customRender: 'purchaseReturnNo' }, align: 'center' },
         { title: '退货数量', dataIndex: 'productTotalQty', width: 100, align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
-        { title: '退金额', dataIndex: 'productTotalCost', width: 100, align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
+        { title: '退金额', dataIndex: 'productTotalCost', width: 100, align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
         { title: '审核时间', dataIndex: 'auditTime', width: 160, align: 'center', customRender: function (text) { return text || '--' } },
-        { title: '业务状态', dataIndex: 'stateDictValue', width: 110, align: 'center' },
-        { title: '财务状态', dataIndex: 'settleStateDictValue', width: 110, align: 'center' },
+        { title: '业务状态', dataIndex: 'stateDictValue', width: 100, align: 'center' },
+        { title: '财务状态', dataIndex: 'settleStateDictValue', width: 100, align: 'center' },
         { title: '操作', scopedSlots: { customRender: 'action' }, width: 150, align: 'center', fixed: 'right' }
       ],
       // 加载数据方法 必须为 Promise 对象
@@ -128,9 +123,7 @@ export default {
           this.disabled = false
           return data
         })
-      },
-      storeCallOutTypeList: [], //  调拨类型
-      itemId: '' //  当前id
+      }
     }
   },
   methods: {
@@ -140,8 +133,7 @@ export default {
     },
     //  重置
     resetSearchForm () {
-      this.queryParam.putPersonName = undefined
-      this.queryParam.callOutType = undefined
+      this.queryParam.purchaseReturnNo = ''
       this.queryParam.state = undefined
       this.createDate = undefined
       this.$refs.table.refresh(true)
@@ -154,7 +146,7 @@ export default {
         content: '删除后不可恢复,确定要进行删除吗?',
         centered: true,
         onOk () {
-          storeCallOutDel({ id: row.id }).then(res => {
+          purchaseReturnDel({ id: row.id }).then(res => {
             if (res.status == 200) {
               _this.$message.success(res.message)
               _this.$refs.table.refresh()
@@ -165,20 +157,25 @@ export default {
     },
     //  详情
     handleDetail (row) {
-      this.$router.push({ path: `/purchasingManagement/purchaseReturn/detail/${row.id}/${row.purchaseBillNo}` })
+      this.$router.push({ path: `/purchasingManagement/purchaseReturn/detail/${row.id}/${row.purchaseReturnSn}` })
     },
     //  新增/编辑
     handleEdit (row) {
       const _this = this
       if (row) { //  编辑
-        _this.$router.push({ path: `/purchasingManagement/purchaseReturn/edit/${row.id}/${row.purchaseBillNo}` })
+        _this.$router.push({ path: `/purchasingManagement/purchaseReturn/edit/${row.id}/${row.purchaseReturnSn}` })
       } else { //  新增
         this.$confirm({
           title: '提示',
           content: '退货供应商:箭冠营销总部',
           centered: true,
           onOk () {
-            _this.$router.push({ path: '/purchasingManagement/purchaseReturn/add' })
+            purchaseReturnSave({}).then(res => {
+              if (res.status == 200) {
+                const data = res.data
+                _this.$router.push({ path: `/purchasingManagement/purchaseReturn/add/${data.id}/${data.purchaseReturnSn}` })
+              }
+            })
           }
         })
       }