Forráskód Böngészése

Merge branch 'deploy' of http://git.chelingzhu.com/jianguan-web/qpls-md-html into deploy

销售单对接,bug修复
lilei 4 éve
szülő
commit
2db648c3ae

+ 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'
+  })
+}

+ 2 - 2
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: {
@@ -681,7 +681,7 @@ export const asyncRouterMap = [
                 }
               },
               {
-                path: 'add',
+                path: 'add/:id/:sn',
                 name: 'storeTransferOutAdd',
                 component: () => import(/* webpackChunkName: "shop" */ '@/views/allocationManagement/storeTransferOut/edit.vue'),
                 meta: {

+ 10 - 4
src/views/allocationManagement/storeTransferOut/edit.vue

@@ -304,7 +304,7 @@ export default {
       const params = {
         id: isEdit ? row.id : undefined,
         storeCallOutSn: this.$route.params.sn,
-        outCost: row.putCost,
+        outCost: isEdit ? row.outCost : row.putCost,
         outQty: isEdit ? row.outQty : 1, //  添加时调出数量默认为1
         productSn: row.productSn,
         productCode: row.productCode,
@@ -316,6 +316,13 @@ export default {
         warehouseSn: row.warehouseSn,
         warehouseLocationSn: row.warehouseLocationSn
       }
+      if (isEdit) { // 编辑
+        // 清空数量时,值应保持未清空前的值,因数量不可为空
+        if (!row.outQty) {
+          row.outQty = row.outQtyBackups
+          return
+        }
+      }
       storeCallOutDetailSave(params).then(res => {
         if (res.status == 200) {
           this.$message.success(res.message)
@@ -355,9 +362,7 @@ export default {
       this.openModal = true
     },
     //  基本信息  保存
-    handleOk () {
-
-    },
+    handleOk () {},
     //  提交
     handleSubmit () {
       const _this = this
@@ -418,6 +423,7 @@ export default {
           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].outQtyBackups = data.list[i].outQty
             // 成本小计  由于数据库内小数位数为4位,页面则需显示2位。因此会做小数运算精度处理
             data.list[i].costSubtotal = getOperationalPrecision(data.list[i].outCost, data.list[i].outQty)
           }

+ 2 - 2
src/views/allocationManagement/storeTransferOut/list.vue

@@ -194,8 +194,8 @@ export default {
       this.$refs.table.refresh(true)
     },
     //  基本信息  保存
-    handleOk () {
-      this.$router.push({ path: `/allocationManagement/storeTransferOut/add` })
+    handleOk (data) {
+      this.$router.push({ path: `/allocationManagement/storeTransferOut/add/${data.id}/${data.storeCallOutSn}` })
     },
     //  删除
     handleDel (row) {

+ 25 - 28
src/views/allocationManagement/warehouseAllocation/detail.vue

@@ -1,9 +1,9 @@
 <template>
   <div class="warehouseAllocationDetail-wrap">
-    <a-page-header :ghost="false" @back="handleBack" class="warehouseAllocationDetail-back">
+    <a-page-header :ghost="false" :backIcon="false" class="warehouseAllocationDetail-back" >
       <!-- 自定义的二级文字标题 -->
       <template slot="subTitle">
-        <a id="warehouseAllocationDetail-back-btn" href="javascript:;" @click="handleBack">返回列表</a>
+        <a id="warehouseAllocationDetail-back-btn" href="javascript:;" @click="handleBack"><a-icon type="left" /> 返回列表</a>
         <a-button
           v-if="warehouse&&warehouse.stateDictValue!='已完结'"
           type="primary"
@@ -46,7 +46,7 @@
       <s-table
         class="sTable"
         ref="table"
-        size="default"
+        size="small"
         :rowKey="(record) => record.id"
         :columns="columns"
         :data="loadData"
@@ -128,37 +128,34 @@ export default {
     },
     //  新增/编辑
     handleEdit () {
-		  this.$router.push({ path: `/allocationManagement/warehouseAllocation/edit/${this.warehouse.id}/${this.warehouse.allocationWarehouseSn}` })
+      this.$router.push({ path: `/allocationManagement/warehouseAllocation/edit/${this.warehouse.id}/${this.warehouse.allocationWarehouseSn}` })
     },
     // 查询基础信息
     getHouse () {
-		  allocWarehouseFind({
-		    id: this.id
-		  }).then(res => {
-		    if (res.status == 200) {
-		      this.warehouse = res.data
-		      this.queryParam.outWarehouseSn = res.data.outWarehouseSn
-		      // this.getWarehouseLoc(this.warehouse.putWarehouseSn, 'put')
-		      // this.getWarehouseLoc(this.warehouse.outWarehouseSn, 'out')
-		    } else {
-		      this.warehouse = null
-		    }
-		  })
+      allocWarehouseFind({ id: this.id }).then(res => {
+        if (res.status == 200) {
+          this.warehouse = res.data
+          this.queryParam.outWarehouseSn = res.data.outWarehouseSn
+          // this.getWarehouseLoc(this.warehouse.putWarehouseSn, 'put')
+          // this.getWarehouseLoc(this.warehouse.outWarehouseSn, 'out')
+        } else {
+          this.warehouse = null
+        }
+      })
     },
     // 已选产品总计查询
     getProduceTotal () {
-	  allocWarehouseDetailTotal(this.queryParam).then(res => {
-	    console.log(res, '-----总计----')
-	    if (res.status == 200) {
-	      this.productTotalCost = res.data.productTotalCost || 0
-	      this.productTotalQty = res.data.productTotalQty || 0
-	      this.productTotalCategory = res.data.productTotalCategory || 0
-	    } else {
-	      this.productTotalCost = 0
-	      this.productTotalQty = 0
-	      this.productTotalCategory = 0
-	    }
-	  })
+      allocWarehouseDetailTotal(this.queryParam).then(res => {
+        if (res.status == 200) {
+          this.productTotalCost = res.data.productTotalCost || 0
+          this.productTotalQty = res.data.productTotalQty || 0
+          this.productTotalCategory = res.data.productTotalCategory || 0
+        } else {
+          this.productTotalCost = 0
+          this.productTotalQty = 0
+          this.productTotalCategory = 0
+        }
+      })
     },
     //  导出
     handleExport () {

+ 87 - 299
src/views/allocationManagement/warehouseAllocation/edit.vue

@@ -1,9 +1,9 @@
 <template>
   <div class="warehouseAllocationEdit-wrap">
-    <a-page-header :ghost="false" @back="handleBack" class="warehouseAllocationEdit-back">
+    <a-page-header :ghost="false" :backIcon="false" class="warehouseAllocationEdit-back" >
       <!-- 自定义的二级文字标题 -->
       <template slot="subTitle">
-        <a id="warehouseAllocationEdit-back-btn" href="javascript:;" @click="handleBack">返回列表</a>
+        <a id="warehouseAllocationEdit-back-btn" href="javascript:;" @click="handleBack"><a-icon type="left" /> 返回列表</a>
       </template>
       <!-- 操作区,位于 title 行的行尾 -->
       <template slot="extra">
@@ -17,14 +17,7 @@
         <a-collapse-panel key="1">
           <template slot="header">
             基础信息
-            <!-- <a-button
-              type="primary"
-              shape="circle"
-              size="small"
-              icon="edit"
-              class="edit-circle-btn"
-              id="warehouseAllocationEdit-circle-btn"
-              @click.stop="handleEditInfo" /> -->
+            <!-- <a-button type="primary" shape="circle" size="small" icon="edit" class="edit-circle-btn" id="warehouseAllocationEdit-circle-btn" @click.stop="handleEditInfo" /> -->
           </template>
           <a-descriptions :column="3">
             <a-descriptions-item label="调出仓库">{{ warehouse?warehouse.outWarehouseName:'' }}
@@ -89,12 +82,12 @@
                     </a-form-item>
                   </a-col>
                   <a-col :md="6" :sm="24">
-                    <a-form-item label="产品类" prop="typeName">
+                    <a-form-item label="产品类" prop="typeName">
                       <a-cascader
                         :field-names="{ label: 'productTypeName', value: 'productTypeSn', children: 'children'}"
                         :options="typeData"
                         id="warehouseAllocationEdit-typeName"
-                        placeholder="请选择产品类"
+                        placeholder="请选择产品类"
                         allowClear
                         v-model="typeName" />
                     </a-form-item>
@@ -139,19 +132,19 @@
           <a-table
             class="sTable"
             ref="table"
-            size="default"
+            size="small"
             :rowKey="(record) => record.id"
             :columns="columns"
             :loading="loading"
             :dataSource="loadData"
             :pagination="pagination"
             @change="getProductList"
-            :scroll="{ x: 1560, y: 300 }"
+            :scroll="{ x: 1740, y: 300 }"
             bordered>
-            <!-- 类 -->
-            <template slot="type" slot-scope="text, record">
-              <span>{{ record.dealerProduct.productTypeName2||'--' }}</span>
-              <span v-if="record.dealerProduct.productTypeName3">-{{ record.dealerProduct.productTypeName3||'' }}</span>
+            <!-- 产品分类 -->
+            <template slot="productType" slot-scope="text, record">
+              <span v-if="record.productTypeName2 || record.productTypeName3">{{ record.productTypeName2 }} {{ record.productTypeName3 ? '>' : '' }} {{ record.productTypeName3 }}</span>
+              <span v-else>--</span>
             </template>
             <!-- 调入仓位 -->
             <template slot="storageQuantity" slot-scope="text, record">
@@ -182,7 +175,7 @@
                 :loading="record.addLoading"
                 size="small"
                 type="primary"
-                class="button-info"
+                class="button-primary"
                 @click="handleAdd(record)"
                 id="warehouseAllocationEdit-add-btn">添加</a-button>
             </template>
@@ -258,16 +251,16 @@
           <s-table
             class="sTable"
             ref="chooseTable"
-            size="default"
+            size="small"
             :rowKey="(record) => record.id"
             :columns="chooseColumns"
             :data="chooseLoadData"
-            :scroll="{ x: 1460, y: 300 }"
+            :scroll="{ x: 1600, y: 300 }"
             bordered>
-            <!-- 类 -->
-            <template slot="type" slot-scope="text, record">
-              <span>{{ record.productTypeName2||'--' }}</span><span
-                v-if="record.productTypeName3">-{{ record.productTypeName3||'' }}</span>
+            <!-- 产品分类 -->
+            <template slot="productType" slot-scope="text, record">
+              <span v-if="record.productTypeName2 || record.productTypeName3">{{ record.productTypeName2 }} {{ record.productTypeName3 ? '>' : '' }} {{ record.productTypeName3 }}</span>
+              <span v-else>--</span>
             </template>
             <!-- 调入仓位 -->
             <template slot="storageQuantity" slot-scope="text, record">
@@ -278,10 +271,7 @@
                 allowClear
                 v-model="record.putWarehouseLocationSn"
                 style="width: 100%;">
-                <a-select-option
-                  v-for="item in warehousePutLocData"
-                  :key="item.warehouseLocationSn"
-                  :value="item.warehouseLocationSn">{{ item.name }}</a-select-option>
+                <a-select-option v-for="item in warehousePutLocData" :key="item.warehouseLocationSn" :value="item.warehouseLocationSn">{{ item.name }}</a-select-option>
               </a-select>
             </template>
             <!-- 调出数量 -->
@@ -326,39 +316,18 @@
 </template>
 
 <script>
-import {
-  STable,
-  VSelect
-} from '@/components'
+import { STable, VSelect } from '@/components'
 import basicInfoModal from './basicInfoModal.vue'
-import {
-  dealerProductBrandQuery
-} from '@/api/dealerProductBrand.js'
-import {
-  dealerProductTypeList
-} from '@/api/dealerProductType.js'
-import {
-  warehouseLocAllList
-} from '@/api/warehouse.js'
-import {
-  productQuery,
-  allocWarehouseFind,
-  allocWarehouseDetailTotal,
-  allocWarehouseDetailQuery,
-  allocWarehouseDetailSave,
-  allocWarehouseDetailDelete,
-  allocWarehouseSubmit
-} from '@/api/allocWarehouse.js'
+import { dealerProductBrandQuery } from '@/api/dealerProductBrand.js'
+import { dealerProductTypeList } from '@/api/dealerProductType.js'
+import { warehouseLocAllList } from '@/api/warehouse.js'
+import { productQuery, allocWarehouseFind, allocWarehouseDetailTotal, allocWarehouseDetailQuery, allocWarehouseDetailSave, allocWarehouseDetailDelete, allocWarehouseSubmit } from '@/api/allocWarehouse.js'
 export default {
-  components: {
-    STable,
-    VSelect,
-    basicInfoModal
-  },
+  components: { STable, VSelect, basicInfoModal },
   data () {
     return {
       id: this.$route.params.id, // 单据id
-	  typeName: [], // 类别
+      typeName: [], // 分类
       queryParam: {
         outWarehouseSn: '', // 调出仓库sn
         productCode: '', // 产品编码
@@ -377,13 +346,13 @@ export default {
       productTotalCategory: 0, // 总款项
       warehouse: null, // 基础信息
       brandData: [], //  产品品牌  下拉数据
-      typeData: [], //  产品类  下拉数据
+      typeData: [], //  产品类  下拉数据
       warehousePutLocData: [], //  调入仓库仓位  下拉数据
       warehouseOutLocData: [], //  调出仓库仓位  下拉数据
       disabled: false, //  查询、重置按钮是否可操作
       advanced: false, // 高级搜索 展开/关闭
       delLoading: false, // 整单删除loading
-	  submitLoading: false, // 提交按钮loading
+      submitLoading: false, // 提交按钮loading
       // 加载数据方法 必须为 Promise 对象
       loadData: [],
       pageNo: 1,
@@ -396,204 +365,33 @@ export default {
       },
       loading: false, // 表格加载圈
       // 表头
-      columns: [{
-        title: '序号',
-        dataIndex: 'no',
-        width: 80,
-        align: 'center'
-      },
-      {
-        title: '产品编码',
-        dataIndex: 'productCode',
-        width: 140,
-        align: 'center',
-        customRender: function (text) {
-          return text || '--'
-        }
-      },
-      {
-        title: '产品名称',
-        dataIndex: 'productName',
-        width: 200,
-        align: 'center',
-        ellipsis: true
-      },
-      {
-        title: '原厂编码',
-        dataIndex: 'productOrigCode',
-        width: 140,
-        align: 'center',
-        customRender: function (text) {
-          return text || '--'
-        }
-      },
-      {
-        title: '品牌',
-        dataIndex: 'brandName',
-        width: 160,
-        align: 'center',
-        customRender: function (text) {
-          return text || '--'
-        }
-      },
-      {
-        title: '类别',
-        width: 160,
-        align: 'center',
-        scopedSlots: {
-          customRender: 'type'
-        }
-      },
-      {
-        title: '调出仓位',
-        dataIndex: 'warehouseLocationName',
-        width: 140,
-        align: 'center',
-        customRender: function (text) {
-          return text || '--'
-        }
-      },
-      {
-        title: '调入仓位',
-        scopedSlots: {
-          customRender: 'storageQuantity'
-        },
-        width: 140,
-        align: 'center'
-      },
-      {
-        title: '库存数量',
-        dataIndex: 'currentQty',
-        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: 'transferOutQuantity'
-        },
-        width: 140,
-        align: 'center'
-      },
-      {
-        title: '操作',
-        scopedSlots: {
-          customRender: 'action'
-        },
-        width: 100,
-        align: 'center',
-        fixed: 'right'
-      }
+      columns: [
+        { title: '序号', dataIndex: 'no', width: 80, align: 'center' },
+        { title: '产品编码', dataIndex: 'productCode', width: 200, align: 'center' },
+        { title: '产品名称', dataIndex: 'productName', align: 'center', ellipsis: true },
+        { title: '原厂编码', dataIndex: 'productOrigCode', width: 200, align: 'center', customRender: function (text) { return text || '--' } },
+        { title: '品牌', dataIndex: 'brandName', width: 140, align: 'center', customRender: function (text) { return text || '--' } },
+        { title: '分类', scopedSlots: { customRender: 'productType' }, width: 200, align: 'center' },
+        { title: '调出仓位', dataIndex: 'warehouseLocationName', width: 140, align: 'center', customRender: function (text) { return text || '--' } },
+        { title: '调入仓位', scopedSlots: { customRender: 'storageQuantity' }, width: 140, align: 'center' },
+        { title: '库存数量', dataIndex: 'currentQty', 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: 'transferOutQuantity' }, width: 140, align: 'center' },
+        { title: '操作', scopedSlots: { customRender: 'action' }, width: 100, align: 'center', fixed: 'right' }
       ],
-
       // 表头
-      chooseColumns: [{
-        title: '序号',
-        dataIndex: 'no',
-        width: 80,
-        align: 'center'
-      },
-      {
-        title: '产品编码',
-        dataIndex: 'productCode',
-        width: 140,
-        align: 'center',
-        sorter: true,
-        customRender: function (text) {
-          return text || '--'
-        }
-      },
-      {
-        title: '产品名称',
-        dataIndex: 'productName',
-        width: 200,
-        align: 'center',
-        customRender: function (text) {
-          return text || '--'
-        }
-      },
-      {
-        title: '原厂编码',
-        dataIndex: 'productOrigCode',
-        width: 140,
-        align: 'center',
-        customRender: function (text) {
-          return text || '--'
-        }
-      },
-      {
-        title: '品牌',
-        dataIndex: 'brandName',
-        width: 160,
-        align: 'center',
-        customRender: function (text) {
-          return text || '--'
-        }
-      },
-      {
-        title: '类别',
-        width: 160,
-        align: 'center',
-        scopedSlots: {
-          customRender: 'type'
-        }
-      },
-      {
-        title: '调出仓位',
-        dataIndex: 'outWarehouseLocationName',
-        width: 140,
-        align: 'center',
-        customRender: function (text) {
-          return text || '--'
-        }
-      },
-      {
-        title: '调入仓位',
-        dataIndex: 'putWarehouseLocationSn',
-        width: 140,
-        align: 'center',
-        scopedSlots: {
-          customRender: 'storageQuantity'
-        }
-      },
-      {
-        title: '单位',
-        dataIndex: 'productUnit',
-        width: 100,
-        align: 'center',
-        customRender: function (text) {
-          return text || '--'
-        }
-      },
-      {
-        title: '调出数量',
-        scopedSlots: {
-          customRender: 'transferOutQuantity'
-        },
-        width: 140,
-        align: 'center'
-      },
-      {
-        title: '操作',
-        scopedSlots: {
-          customRender: 'action'
-        },
-        width: 100,
-        align: 'center',
-        fixed: 'right'
-      }
+      chooseColumns: [
+        { title: '序号', dataIndex: 'no', width: 80, align: 'center' },
+        { title: '产品编码', dataIndex: 'productCode', width: 200, align: 'center' },
+        { title: '产品名称', dataIndex: 'productName', align: 'center', ellipsis: true },
+        { title: '原厂编码', dataIndex: 'productOrigCode', width: 200, align: 'center', customRender: function (text) { return text || '--' } },
+        { title: '品牌', dataIndex: 'brandName', width: 140, align: 'center', customRender: function (text) { return text || '--' } },
+        { title: '分类', scopedSlots: { customRender: 'productType' }, width: 200, align: 'center' },
+        { title: '调出仓位', dataIndex: 'outWarehouseLocationName', width: 140, align: 'center', customRender: function (text) { return text || '--' } },
+        { title: '调入仓位', dataIndex: 'putWarehouseLocationSn', width: 140, align: 'center', scopedSlots: { customRender: 'storageQuantity' } },
+        { title: '单位', dataIndex: 'productUnit', width: 100, align: 'center', customRender: function (text) { return text || '--' } },
+        { title: '调出数量', scopedSlots: { customRender: 'transferOutQuantity' }, width: 140, align: 'center' },
+        { title: '操作', scopedSlots: { customRender: 'action' }, width: 100, align: 'center', fixed: 'right' }
       ],
       // 加载数据方法 必须为 Promise 对象
       chooseLoadData: parameter => {
@@ -613,25 +411,25 @@ export default {
     }
   },
   methods: {
-	  pageInit () {
-		 this.queryParam.productCode = '' // 产品编码
-		 this.queryParam.productName = '' // 产品名称
-		 this.queryParam.productOrigCode = '' // 原厂编码
-		 this.queryParam.brandSn = undefined // 品牌
-		 this.typeName = [] // 类别
-		 this.queryParam.outWarehouseLocationName = undefined // 调出仓位
-		 this.chooseParam.productCode = ''
-		 this.chooseParam.productName = ''
-		 this.pageNo = 1
-		 this.pageSize = 10
-	  },
+    pageInit () {
+      this.queryParam.productCode = '' // 产品编码
+      this.queryParam.productName = '' // 产品名称
+      this.queryParam.productOrigCode = '' // 原厂编码
+      this.queryParam.brandSn = undefined // 品牌
+      this.typeName = [] // 分类
+      this.queryParam.outWarehouseLocationName = undefined // 调出仓位
+      this.chooseParam.productCode = ''
+      this.chooseParam.productName = ''
+      this.pageNo = 1
+      this.pageSize = 10
+    },
     //  重置
     resetSearchForm () {
       this.queryParam.productCode = '' // 产品编码
       this.queryParam.productName = '' // 产品名称
       this.queryParam.productOrigCode = '' // 原厂编码
       this.queryParam.brandSn = undefined // 品牌
-      this.typeName = [] // 类
+      this.typeName = [] // 
       this.queryParam.outWarehouseLocationName = undefined // 调出仓位
       this.getProductList()
     },
@@ -652,7 +450,6 @@ export default {
     getProductType () {
       dealerProductTypeList({}).then(res => {
         this.typeData = res.data || []
-        console.log(res, this.typeData, '--------获取产品分类')
       })
     },
     // 获取仓库仓位
@@ -665,7 +462,6 @@ export default {
         } else {
           this.warehouseOutLocData = res.data || []
         }
-        // return res.data || []
       })
     },
     // 查询基础信息
@@ -692,39 +488,33 @@ export default {
       this.pageNo = pagination && pagination.current ? pagination.current : this.pageNo
       this.pageSize = pagination && pagination.pageSize ? pagination.pageSize : this.pageSize
       this.pagination.current = this.pageNo
-	  const params = Object.assign({
-        pageNo: this.pageNo,
-        pageSize: this.pageSize
-      }, this.queryParam)
-	  if (this.typeName.length) {
-	  		  params.productTypeSn1 = this.typeName[0]
-	  		  params.productTypeSn2 = this.typeName[1] || ''
-	  		  params.productTypeSn3 = this.typeName[2] || ''
-	  }
-	  console.log(this.typeName, 'queryParam')
+      const params = Object.assign({ pageNo: this.pageNo, pageSize: this.pageSize }, this.queryParam)
+      if (this.typeName.length) {
+        params.productTypeSn1 = this.typeName[0]
+        params.productTypeSn2 = this.typeName[1] || ''
+        params.productTypeSn3 = this.typeName[2] || ''
+      }
       productQuery(params).then(res => {
-		  if (res.status == 200) {
-			 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].addLoading = false
-			 }
-			 this.pagination.total = Number(data.count)
-			 this.loadData = data.list
-		  } else {
-			  this.pagination.total = 0
-			  this.loadData = []
-		  }
+        if (res.status == 200) {
+          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].addLoading = false
+          }
+          this.pagination.total = Number(data.count)
+          this.loadData = data.list
+        } else {
+          this.pagination.total = 0
+          this.loadData = []
+        }
         this.loading = false
         this.disabled = false
-        console.log(this.loadData, '-----产品查询')
       })
     },
     // 已选产品总计查询
     getProduceTotal () {
       allocWarehouseDetailTotal(this.chooseParam).then(res => {
-        console.log(res, '-----总计----')
         if (res.status == 200) {
           this.productTotalCost = res.data.productTotalCost || 0
           this.productTotalQty = res.data.productTotalQty || 0
@@ -738,7 +528,6 @@ export default {
     },
     //  添加
     handleAdd (row) {
-      console.log(row, '-------row')
       if (!row.putWarehouseLocationSn) {
         return this.$message.error('请选择调入仓位!')
       }
@@ -749,7 +538,7 @@ export default {
       const params = Object.assign(row, {
         allocationWarehouseSn: this.chooseParam.allocationWarehouseSn
       })
-	  params.allocationCost = params.putCost
+      params.allocationCost = params.putCost
       allocWarehouseDetailSave(params).then(res => {
         if (res.status == 200) {
           this.$message.success(res.message)
@@ -778,7 +567,6 @@ export default {
             }
           }
           allocWarehouseDetailDelete(params).then(res => {
-            console.log(res, 'res1111')
             if (res.status == 200) {
               _this.$message.success(res.message)
               _this.$refs.chooseTable.refresh()
@@ -825,7 +613,7 @@ export default {
   beforeRouteEnter (to, from, next) {
     next(vm => {
       vm.openModal = false
-	  vm.pageInit()
+      vm.pageInit()
       vm.getProductBrand()
       vm.getProductType()
       vm.getHouse()

+ 105 - 144
src/views/allocationManagement/warehouseAllocation/list.vue

@@ -8,9 +8,9 @@
             <a-form-item label="创建时间">
               <a-range-picker
                 style="width:100%"
-                id="warehouseAllocationList-creatDate"
+                id="warehouseAllocationList-createDate"
                 :disabledDate="disabledDate"
-                v-model="creatDate"
+                v-model="createDate"
                 :format="dateFormat"
                 :placeholder="['开始时间', '结束时间']"
               />
@@ -58,21 +58,47 @@
     <!-- 操作按钮 -->
     <div class="table-operator"><a-button id="warehouseAllocationList-add" type="primary" class="button-error" @click="openModal = true">新增</a-button></div>
     <!-- 列表 -->
-    <s-table class="sTable" ref="table" size="default" :rowKey="record => record.id" :columns="columns" :data="loadData" :scroll="{ x: 1435 }" bordered>
+    <s-table
+      class="sTable"
+      ref="table"
+      size="default"
+      :rowKey="record => record.id"
+      :columns="columns"
+      :data="loadData"
+      :scroll="{ x: 1435 }"
+      bordered>
       <!-- 状态 -->
       <template slot="state" slot-scope="text, record">
         {{ text }}
       </template>
       <!-- 操作 -->
       <template slot="action" slot-scope="text, record">
-        <a-button v-if="record.stateDictValue == '待审核'" size="small" type="primary" class="button-warning" @click="handleExamine(record)" id="warehouseAllocationList-examine-btn">
+        <a-button
+          v-if="record.stateDictValue == '待审核'"
+          size="small"
+          type="primary"
+          class="button-warning"
+          @click="handleExamine(record)"
+          id="warehouseAllocationList-examine-btn">
           审核
         </a-button>
-        <a-button v-if="record.stateDictValue != '已完结'" size="small" type="primary" class="button-info" @click="handleEdit(record)" id="warehouseAllocationList-edit-btn">
+        <a-button
+          v-if="record.stateDictValue != '已完结'"
+          size="small"
+          type="primary"
+          class="button-info"
+          @click="handleEdit(record)"
+          id="warehouseAllocationList-edit-btn">
           编辑
         </a-button>
         <a-button size="small" type="primary" class="button-success" @click="handleDetail(record)" id="warehouseAllocationList-detail-btn">详情</a-button>
-        <a-button v-if="record.stateDictValue != '已完结'" size="small" type="primary" class="button-error" @click="handleDel(record)" id="warehouseAllocationList-del-btn">
+        <a-button
+          v-if="record.stateDictValue != '已完结'"
+          size="small"
+          type="primary"
+          class="button-error"
+          @click="handleDel(record)"
+          id="warehouseAllocationList-del-btn">
           删除
         </a-button>
       </template>
@@ -83,20 +109,19 @@
 </template>
 
 <script>
-import { allocWarehouseList, allocWarehouseAudit, allocWarehouseDelete } from '@/api/allocWarehouse';
-import { warehouseAllList } from '@/api/warehouse.js';
-import { STable, VSelect } from '@/components';
-import basicInfoModal from './basicInfoModal.vue';
-import moment from 'moment';
+import { allocWarehouseList, allocWarehouseAudit, allocWarehouseDelete } from '@/api/allocWarehouse'
+import { warehouseAllList } from '@/api/warehouse.js'
+import { STable, VSelect } from '@/components'
+import basicInfoModal from './basicInfoModal.vue'
+import moment from 'moment'
 export default {
   components: { STable, VSelect, basicInfoModal },
-  data() {
+  data () {
     return {
       advanced: false, // 高级搜索 展开/关闭
-      creatDate: undefined, //  创建时间
+      createDate: undefined, //  创建时间
       warehouseList: [], // 仓库列表
-      queryParam: {
-        //  查询条件
+      queryParam: { //  查询条件
         outWarehouseSn: undefined, //  调出仓库
         putWarehouseSn: undefined, //  调入仓库
         state: undefined //  审核状态
@@ -106,184 +131,120 @@ export default {
       columns: [
         { title: '序号', dataIndex: 'no', width: 80, align: 'center' },
         { title: '创建时间', dataIndex: 'createDate', width: 160, align: 'center' },
-        {
-          title: '单号',
-          dataIndex: 'allocationWarehouseNo',
-          align: 'center',
-          ellipsis: true,
-          customRender: function(text) {
-            return text || '--';
-          }
-        },
-        {
-          title: '调出仓库',
-          dataIndex: 'outWarehouseName',
-          width: 140,
-          align: 'center',
-          customRender: function(text) {
-            return text || '--';
-          },
-          ellipsis: true
-        },
-        {
-          title: '调入仓库',
-          dataIndex: 'putWarehouseName',
-          width: 140,
-          align: 'center',
-          customRender: function(text) {
-            return text || '--';
-          },
-          ellipsis: true
-        },
-        {
-          title: '总款数',
-          dataIndex: 'productTotalCategory',
-          width: 100,
-          align: 'center',
-          customRender: function(text) {
-            return text || text == 0 ? text : '--';
-          }
-        },
-        {
-          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: 'auditTime',
-          width: 160,
-          align: 'center',
-          customRender: function(text) {
-            return text || '--';
-          }
-        },
-        { title: '状态', dataIndex: 'stateDictValue', scopedSlots: { customRender: 'state' }, width: 100, align: 'center' },
-        { title: '操作', scopedSlots: { customRender: 'action' }, width: 300, align: 'center', fixed: 'right' }
+        { title: '单号', scopedSlots: { customRender: 'allocationWarehouseNo' }, align: 'center' },
+        { title: '调出仓库', dataIndex: 'outWarehouseName', width: 140, align: 'center', customRender: function (text) { return text || '--' }, ellipsis: true },
+        { title: '调入仓库', dataIndex: 'putWarehouseName', width: 140, align: 'center', customRender: function (text) { return text || '--' }, ellipsis: true },
+        { title: '总款数', dataIndex: 'productTotalCategory', width: 100, align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
+        { 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: 'auditTime', width: 160, align: 'center', customRender: function (text) { return text || '--' } },
+        { title: '状态', dataIndex: 'stateDictValue', width: 100, align: 'center' },
+        { title: '操作', scopedSlots: { customRender: 'action' }, width: 200, align: 'center', fixed: 'right' }
       ],
       // 加载数据方法 必须为 Promise 对象
       loadData: parameter => {
-        this.disabled = true;
+        this.disabled = true
         // 创建时间
-        if (this.creatDate && this.creatDate.length > 0) {
-          this.queryParam.beginDate = moment(this.creatDate[0]).format(this.dateFormat);
-          this.queryParam.endDate = moment(this.creatDate[1]).format(this.dateFormat);
+        if (this.createDate && this.createDate.length > 0) {
+          this.queryParam.beginDate = moment(this.createDate[0]).format(this.dateFormat)
+          this.queryParam.endDate = moment(this.createDate[1]).format(this.dateFormat)
         } else {
-          this.queryParam.beginDate = undefined;
-          this.queryParam.endDate = undefined;
+          this.queryParam.beginDate = undefined
+          this.queryParam.endDate = undefined
         }
         return allocWarehouseList(Object.assign(parameter, this.queryParam)).then(res => {
-          const data = res.data;
-          const no = (data.pageNo - 1) * data.pageSize;
+          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].no = no + i + 1
           }
-          this.disabled = false;
-          return data;
-        });
+          this.disabled = false
+          return data
+        })
       },
       openModal: false, //  新增编辑  弹框
       itemId: '' //  当前品牌id
-    };
+    }
   },
   methods: {
     // 不可选日期
-    disabledDate(date, dateStrings) {
-      return date && date.valueOf() > Date.now();
+    disabledDate (date, dateStrings) {
+      return date && date.valueOf() > Date.now()
     },
     // 获取仓库列表
-    getWarehouseList() {
+    getWarehouseList () {
       warehouseAllList({}).then(res => {
-        console.log(res, '-----仓库----');
+        console.log(res, '-----仓库----')
         if (res.status == 200) {
-          this.warehouseList = res.data || [];
+          this.warehouseList = res.data || []
         } else {
-          this.warehouseList = [];
+          this.warehouseList = []
         }
-      });
+      })
     },
     //  重置
-    resetSearchForm() {
-      this.queryParam.outWarehouseSn = undefined;
-      this.queryParam.putWarehouseSn = undefined;
-      this.queryParam.state = undefined;
-      this.creatDate = undefined;
-      this.$refs.table.refresh(true);
+    resetSearchForm () {
+      this.queryParam.outWarehouseSn = undefined
+      this.queryParam.putWarehouseSn = undefined
+      this.queryParam.state = undefined
+      this.creatDate = undefined
+      this.$refs.table.refresh(true)
     },
     //  基本信息  保存
-    handleOk(data) {
-      this.$router.push({ path: `/allocationManagement/warehouseAllocation/add` });
+    handleOk (data) {
+      this.$router.push({ path: `/allocationManagement/warehouseAllocation/add` })
     },
     //  删除
-    handleDel(row) {
-      const _this = this;
+    handleDel (row) {
+      const _this = this
       this.$confirm({
         title: '提示',
         content: '删除后不可恢复,确定要进行删除吗?',
         centered: true,
-        onOk() {
-          allocWarehouseDelete({
-            id: row.id
-          }).then(res => {
-            console.log(res, 'res1111');
+        onOk () {
+          allocWarehouseDelete({ id: row.id }).then(res => {
             if (res.status == 200) {
-              _this.$message.success(res.message);
-              _this.$refs.table.refresh();
+              _this.$message.success(res.message)
+              _this.$refs.table.refresh()
             }
-          });
+          })
         }
-      });
+      })
     },
     //  审核
-    handleExamine(row) {
-      const _this = this;
+    handleExamine (row) {
+      const _this = this
       this.$confirm({
         title: '提示',
         content: '确认要审核通过吗?',
         centered: true,
-        onOk() {
-          allocWarehouseAudit({
-            id: row.id
-          }).then(res => {
-            console.log(res, 'res1111');
+        onOk () {
+          allocWarehouseAudit({ id: row.id }).then(res => {
             if (res.status == 200) {
-              _this.$message.success(res.message);
-              _this.$refs.table.refresh();
+              _this.$message.success(res.message)
+              _this.$refs.table.refresh()
             }
-          });
+          })
         }
-      });
+      })
     },
     //  详情
-    handleDetail(row) {
-      this.$router.push({ path: `/allocationManagement/warehouseAllocation/detail/${row.id}/${row.allocationWarehouseSn}` });
+    handleDetail (row) {
+      this.$router.push({ path: `/allocationManagement/warehouseAllocation/detail/${row.id}/${row.allocationWarehouseSn}` })
     },
     //  新增/编辑
-    handleEdit(row) {
-      this.$router.push({ path: `/allocationManagement/warehouseAllocation/edit/${row.id}/${row.allocationWarehouseSn}` });
+    handleEdit (row) {
+      this.$router.push({ path: `/allocationManagement/warehouseAllocation/edit/${row.id}/${row.allocationWarehouseSn}` })
     }
   },
-  beforeRouteEnter(to, from, next) {
+  beforeRouteEnter (to, from, next) {
     next(vm => {
-      vm.queryParam.outWarehouseSn = undefined;
-      vm.queryParam.putWarehouseSn = undefined;
-      vm.queryParam.state = undefined;
-      vm.creatDate = undefined;
-      vm.getWarehouseList();
-    });
+      vm.queryParam.outWarehouseSn = undefined
+      vm.queryParam.putWarehouseSn = undefined
+      vm.queryParam.state = undefined
+      vm.createDate = undefined
+      vm.getWarehouseList()
+    })
   }
-};
+}
 </script>

+ 18 - 4
src/views/bulkManagement/bulkWarehousingOrder/edit.vue

@@ -363,19 +363,19 @@ export default {
     },
     //  添加/编辑
     handleAdd (row, isEdit) {
-      if (!row.putCost) {
+      if (!isEdit && !row.putCost) {
         this.$message.warning('请输入成本价')
         return
       }
-      if (!row.putQty) {
+      if (!isEdit && !row.putQty) {
         this.$message.warning('请输入数量')
         return
       }
-      if (!row.warehouseSn) {
+      if (!isEdit && !row.warehouseSn) {
         this.$message.warning('请选择仓库')
         return
       }
-      if (!row.warehouseLocationSn) {
+      if (!isEdit && !row.warehouseLocationSn) {
         this.$message.warning('请选择仓位')
         return
       }
@@ -394,8 +394,20 @@ export default {
         warehouseLocationSn: row.warehouseLocationSn,
         warehouseSn: row.warehouseSn
       }
+      if (isEdit) { // 编辑
+        // 清空成本价或数量时,值应保持未清空前的值,因成本价和数量都不可为空
+        if (!row.putCost) {
+          row.putCost = row.putCostBackups
+          return
+        }
+        if (!row.putQty) {
+          row.putQty = row.putQtyBackups
+          return
+        }
+      }
       sparePartsPurDetailSave(params).then(res => {
         if (res.status == 200) {
+          this.$message.success(res.message)
           this.getChooseDealerProductList()
         }
       })
@@ -611,6 +623,8 @@ export default {
           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].putCostBackups = data.list[i].putCost
+            data.list[i].putQtyBackups = data.list[i].putQty
             // 成本小计  由于数据库内小数位数为4位,页面则需显示2位。因此会做小数运算精度处理
             data.list[i].costSubtotal = getOperationalPrecision(data.list[i].putCost, data.list[i].putQty)
           }

+ 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()
             }
           })

+ 1 - 14
src/views/power/role/menuModal.vue

@@ -16,7 +16,7 @@
         <a-button type="primary" @click="handleSubmit()" id="menuModal-handleSubmit">
           保存
         </a-button>
-        <a-button :style="{ marginLeft: '8px' }" @click="handleCancel()" id="menuModal-handleCancel">
+        <a-button :style="{ marginLeft: '8px' }" @click="cancel" id="menuModal-handleCancel">
           取消
         </a-button>
       </a-form-item>
@@ -98,19 +98,6 @@ export default {
         }
       })
     },
-    // 取消
-    handleCancel () {
-      const _this = this
-      this.$confirm({
-        title: '提示',
-        content: '确定取消吗?',
-        centered: true,
-        onOk () {
-          _this.clear()
-          _this.cancel()
-        }
-      })
-    },
     clear () {
       this.form.resetFields()
       this.roleName = ''

+ 2 - 2
src/views/power/user/userList.vue

@@ -5,12 +5,12 @@
         <a-row :gutter="15">
           <a-col :md="6" :sm="24">
             <a-form-item label="用户名称">
-              <a-input allowClear v-model="queryParam.name" placeholder="请输入用户名称"/>
+              <a-input allowClear v-model.trim="queryParam.name" placeholder="请输入用户名称"/>
             </a-form-item>
           </a-col>
           <a-col :md="6" :sm="24">
             <a-form-item label="手机号码">
-              <a-input allowClear v-model="queryParam.phone" placeholder="请输入手机号码"/>
+              <a-input allowClear v-model.trim="queryParam.phone" placeholder="请输入手机号码"/>
             </a-form-item>
           </a-col>
           <a-col :md="6" :sm="24">

+ 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 {

+ 60 - 80
src/views/purchasingManagement/purchaseReturn/edit.vue

@@ -22,21 +22,21 @@
         <a-collapse-panel key="1" header="选择产品">
           <!-- 筛选条件 -->
           <div class="table-page-search-wrapper">
-            <a-form layout="inline" @keyup.enter.native="$refs.table.refresh(true)">
+            <a-form layout="inline" @keyup.enter.native="getPurchaseBillDetailList(1)">
               <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(1)
     },
     //  添加/编辑
     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' })
@@ -310,7 +290,6 @@ export default {
     getPurchaseBillDetailList (pageNo) {
       this.pageNo = this.pageNo || pageNo
       this.disabled = true
-      this.queryParam = {}
       const params = Object.assign({ pageNo: this.pageNo, pageSize: this.pageSize }, this.queryParam)
       purchaseReturnPurchaseBillDetailList(params).then(res => {
         if (res.status == 200) {
@@ -344,13 +323,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
@@ -358,9 +336,9 @@ export default {
           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].qtyLeft = data.list[i].purchaseBillQtyLeft + data.list[i].qty
           }
           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) {
@@ -380,10 +362,8 @@ export default {
   },
   beforeRouteEnter (to, from, next) {
     next(vm => {
-      vm.getPurchaseBillDetailList()
+      vm.getPurchaseBillDetailList(1)
       vm.getChooseProductList(1)
-      // vm.getProductBrand()
-      // vm.getProductType()
     })
   }
 }

+ 25 - 28
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">
@@ -27,7 +27,7 @@
                 v-model="queryParam.state"
                 ref="state"
                 id="purchaseReturnList-state"
-                code="STORE_CALL_OUT_STATE"
+                code="PURCHASE_RETURN_STATUS"
                 placeholder="请选择业务状态"
                 allowClear
               ></v-select>
@@ -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: '退货数量', 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: '采退单号', scopedSlots: { customRender: 'purchaseReturnNo' }, align: 'center' },
+        { title: '退货数量', dataIndex: 'totalQty', width: 100, align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
+        { title: '退款金额', dataIndex: 'totalAmount', 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', customRender: function (text) { return text || '--' } },
+        { title: '财务状态', dataIndex: 'settleStateDictValue', width: 100, align: 'center', customRender: function (text) { return text || '--' } },
         { 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}` })
+              }
+            })
           }
         })
       }