lilei 2 vuotta sitten
vanhempi
commit
58702c1d16

+ 38 - 0
src/api/supplier.js

@@ -11,6 +11,27 @@ export const supplierList = (params) => {
     method: 'post'
   })
 }
+// 供应商成本变更记录
+export const supplierProductCostLogList = (params) => {
+  const url = `/supplierProductCostLog/queryPage/${params.pageNo}/${params.pageSize}`
+  delete params.pageNo
+  delete params.pageSize
+  return axios({
+    url: url,
+    data: params,
+    method: 'post'
+  })
+}
+// 成本变更导出明细
+export const supplierProductCostLogExport = params => {
+  return axios.request({
+    url: `/supplierProductCostLog/export`,
+    method: 'post',
+    data: params,
+    responseType: 'blob'
+  })
+}
+
 //  供应商 列表  无分页
 export const supplierAllList = (params) => {
   return axios({
@@ -95,6 +116,23 @@ export const supplierProductDownload = params => {
     responseType: 'blob'
   })
 }
+// 设置成本导出明细
+export const supplierProductExportDetail = params => {
+  return axios.request({
+    url: `/supplierProduct/export`,
+    method: 'post',
+    data: params,
+    responseType: 'blob'
+  })
+}
+// 审核成本价
+export const supplierProductUpdateAuditState = params => {
+  return axios.request({
+    url: `/supplierProduct/updateAuditState`,
+    method: 'post',
+    data: params
+  })
+}
 // 供应商关联产品  解析导入的文件
 export const supplierProductParseProducts = params => {
   return axios({

+ 32 - 22
src/views/supplierManagement/costSetRecord/list.vue

@@ -7,32 +7,32 @@
           <a-row :gutter="15">
             <a-col :md="6" :sm="24">
               <a-form-item label="产品名称">
-                <a-input id="costSetRecordList-productName" v-model.trim="queryParam.product.name" allowClear placeholder="请输入产品名称"/>
+                <a-input id="costSetList-productName" v-model.trim="queryParam.product.name" allowClear placeholder="请输入产品名称"/>
               </a-form-item>
             </a-col>
             <a-col :md="6" :sm="24">
               <a-form-item label="产品编码/原厂编码">
-                <a-input id="costSetRecordList-productCode" v-model.trim="queryParam.product.queryWord" allowClear placeholder="请输入产品编码"/>
+                <a-input id="costSetList-productCode" v-model.trim="queryParam.product.queryWord" allowClear placeholder="请输入产品编码"/>
               </a-form-item>
             </a-col>
             <a-col :md="6" :sm="24">
-              <a-form-item label="产品品牌">
-                <ProductBrand id="associatedProduct-productBrandSn" v-model="queryParam.product.productBrandSn"></ProductBrand>
+              <a-form-item label="品牌">
+                <ProductBrand id="costSetRecord-productBrandSn" v-model="queryParam.product.productBrandSn"></ProductBrand>
               </a-form-item>
             </a-col>
             <a-col :md="6" :sm="24">
               <a-form-item label="产品分类">
-                <ProductType id="associatedProduct-productType" v-model="productType" @change="changeProductType"></ProductType>
+                <ProductType id="costSetRecord-productType" v-model="productType" @change="changeProductType"></ProductType>
               </a-form-item>
             </a-col>
             <a-col :md="6" :sm="24">
               <a-form-item label="供应商名称">
-                <a-input id="costSetRecordList-productName" v-model.trim="queryParam.supplierName" allowClear placeholder="请输入供应商名称"/>
+                <a-input id="costSetList-productName" v-model.trim="queryParam.supplierName" allowClear placeholder="请输入供应商名称"/>
               </a-form-item>
             </a-col>
             <a-col :md="6" :sm="24" style="margin-bottom: 10px;">
-              <a-button type="primary" @click="$refs.table.refresh(true)" :disabled="disabled" id="costSetRecordList-refresh">查询</a-button>
-              <a-button style="margin-left: 5px" @click="resetSearchForm" :disabled="disabled" id="costSetRecordList-reset">重置</a-button>
+              <a-button type="primary" @click="$refs.table.refresh(true)" :disabled="disabled" id="costSetList-refresh">查询</a-button>
+              <a-button style="margin-left: 5px" @click="resetSearchForm" :disabled="disabled" id="costSetList-reset">重置</a-button>
               <a-button
                 style="margin-left: 10px"
                 type="primary"
@@ -40,8 +40,7 @@
                 @click="handleExport"
                 :disabled="disabled"
                 :loading="exportLoading"
-                v-if="$hasPermissions('B_salerReturnDetailTable_export')"
-                id="salesReturnDetailList-export">导出</a-button>
+                id="costSetDetailList-export">导出</a-button>
             </a-col>
           </a-row>
         </a-form>
@@ -71,11 +70,12 @@
 <script>
 import { commonMixin } from '@/utils/mixin'
 import { STable, VSelect } from '@/components'
+import { hdExportExcel } from '@/libs/exportExcel'
 import ProductType from '@/views/common/productType.js'
 import ProductBrand from '@/views/common/productBrand.js'
-import { supplierProductList } from '@/api/supplier'
+import { supplierProductCostLogList,supplierProductCostLogExport } from '@/api/supplier'
 export default {
-  name: 'AssociatedProductDetailsList',
+  name: 'costSetRecordList',
   mixins: [commonMixin],
   components: { STable, VSelect, ProductBrand, ProductType },
   data () {
@@ -96,16 +96,15 @@ export default {
       },
       columns: [
         { title: '序号', dataIndex: 'no', width: '4%', align: 'center' },
-        { title: '变更时间', dataIndex: 'product.name', width: '20%', align: 'center', customRender: function (text) { return text || '--' } },
-        { title: '产品名称', dataIndex: 'product.name', width: '20%', align: 'center', customRender: function (text) { return text || '--' } },
-        { title: '产品编码', dataIndex: 'product.code', width: '8%', align: 'center', customRender: function (text) { return text || '--' } },
-        // { title: '成本价(¥)', dataIndex: 'cost', width: '6%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
-        { title: '原厂编码', dataIndex: 'product.origCode', width: '8%', align: 'center', customRender: function (text) { return text || '--' } },
+        { title: '变更时间', dataIndex: 'auditTime', width: '10%', align: 'center', customRender: function (text) { return text || '--' } },
+        { title: '产品名称', dataIndex: 'product.name', width: '15%', align: 'center', customRender: function (text) { return text || '--' } },
+        { title: '产品编码', dataIndex: 'product.code', width: '10%', align: 'center', customRender: function (text) { return text || '--' } },
+        { title: '原厂编码', dataIndex: 'product.origCode', width: '10%', align: 'center', customRender: function (text) { return text || '--' } },
         { title: '产品品牌', dataIndex: 'product.productBrandName', width: '10%', align: 'center', customRender: function (text) { return text || '--' } },
-        { title: '产品分类', scopedSlots: { customRender: 'productType' }, width: '18%', align: 'center' },
-        { title: '供应商名称', dataIndex: 'supplierName', width: '20%', align: 'center', customRender: function (text) { return text || '--' } },
-        { title: '变更前', dataIndex: 'supplierName', width: '20%', align: 'center', customRender: function (text) { return text || '--' } },
-        { title: '变更后', dataIndex: 'supplierName', width: '20%', align: 'center', customRender: function (text) { return text || '--' } }
+        { title: '产品分类', scopedSlots: { customRender: 'productType' }, width: '12%', align: 'center' },
+        { title: '供应商名称', dataIndex: 'supplierName', width: '15%', align: 'center', customRender: function (text) { return text || '--' } },
+        { title: '变更前', dataIndex: 'oldCost', width: '7%', align: 'center', customRender: function (text) { return text || '--' } },
+        { title: '变更后', dataIndex: 'newCost', width: '7%', align: 'center', customRender: function (text) { return text || '--' } }
 
       ],
       disabled: false, //  查询、重置按钮是否可操作
@@ -114,7 +113,7 @@ export default {
       loadData: parameter => {
         this.disabled = true
         this.spinning = true
-        return supplierProductList(Object.assign(parameter, this.queryParam)).then(res => {
+        return supplierProductCostLogList(Object.assign(parameter, this.queryParam)).then(res => {
           let data
           if (res.status == 200) {
             data = res.data
@@ -131,6 +130,17 @@ export default {
     }
   },
   methods: {
+    // 导出明细
+    handleExport () {
+      const _this = this
+      const params = _this.queryParam
+      _this.exportLoading = true
+      _this.spinning = true
+      hdExportExcel(supplierProductCostLogExport, params, '成本变更记录', function () {
+        _this.exportLoading = false
+        _this.spinning = false
+      })
+    },
     //  重置
     resetSearchForm () {
       this.queryParam.supplierName = ''

+ 64 - 32
src/views/supplierManagement/costSetting/list.vue

@@ -17,12 +17,12 @@
             </a-col>
             <a-col :md="6" :sm="24">
               <a-form-item label="品牌">
-                <ProductBrand id="associatedProduct-productBrandSn" v-model="queryParam.product.productBrandSn"></ProductBrand>
+                <ProductBrand id="costSeting-productBrandSn" v-model="queryParam.product.productBrandSn"></ProductBrand>
               </a-form-item>
             </a-col>
             <a-col :md="6" :sm="24">
               <a-form-item label="产品分类">
-                <ProductType id="associatedProduct-productType" v-model="productType" @change="changeProductType"></ProductType>
+                <ProductType id="costSeting-productType" v-model="productType" @change="changeProductType"></ProductType>
               </a-form-item>
             </a-col>
             <a-col :md="6" :sm="24">
@@ -33,10 +33,10 @@
             <a-col :md="6" :sm="24">
               <a-form-item label="审核状态">
                 <v-select
-                  v-model="queryParam.state"
-                  ref="state"
-                  id="costSetList-state"
-                  code="FINANCIAL_RECEIVE_STATUS"
+                  v-model="queryParam.auditState"
+                  ref="auditState"
+                  id="costSetList-auditState"
+                  code="SUPPLIER_PRODUCT_STATE"
                   placeholder="请选择审核状态"
                   allowClear></v-select>
               </a-form-item>
@@ -68,8 +68,9 @@
         ref="table"
         :style="{ height: tableHeight+84.5+'px' }"
         size="small"
-        :rowKey="(record) => record.id"
-        :row-selection="{ columnWidth: 40, getCheckboxProps: record => ({ props: { disabled: !record.id } }) }"
+        :rowKey="(record) => record.supplierProductSn"
+        rowKeyName="supplierProductSn"
+        :row-selection="{ columnWidth: 40, getCheckboxProps: record => ({ props: { disabled: record.auditState!=='WAIT' } }) }"
         @rowSelection="rowSelectionFun"
         :columns="columns"
         :data="loadData"
@@ -83,18 +84,22 @@
         </template>
         <!-- 操作 -->
         <template slot="action" slot-scope="text, record">
-          <a-button
-            size="small"
-            type="link"
-            class="button-warning"
-            @click="handleAudit(record)"
-          >审核</a-button>
-          <a-button
-            size="small"
-            type="link"
-            class="button-warning"
-            @click="handleCostSet(record)"
-          >设置成本</a-button>
+          <div>
+            <a-button
+              size="small"
+              type="link"
+              class="button-warning"
+              v-if="record.auditState=='WAIT'"
+              @click="handleAudit([record.supplierProductSn])"
+            >审核</a-button>
+            <a-button
+              size="small"
+              type="link"
+              class="button-warning"
+              v-else
+              @click="handleCostSet(record)"
+            >设置成本</a-button>
+          </div>
         </template>
       </s-table>
     </a-spin>
@@ -109,13 +114,14 @@
 <script>
 import { commonMixin } from '@/utils/mixin'
 import { STable, VSelect } from '@/components'
+import { hdExportExcel } from '@/libs/exportExcel'
 import ProductType from '@/views/common/productType.js'
 import ProductBrand from '@/views/common/productBrand.js'
 import addProductModal from './addProductModal.vue'
 import SettingCost from './settingCost.vue'
-import { supplierProductList } from '@/api/supplier'
+import { supplierProductList, supplierProductExportDetail, supplierProductUpdateAuditState } from '@/api/supplier'
 export default {
-  name: 'AssociatedProductDetailsList',
+  name: 'costSettingList',
   mixins: [commonMixin],
   components: { STable, VSelect, ProductBrand, ProductType, addProductModal, SettingCost },
   data () {
@@ -132,8 +138,9 @@ export default {
           productBrandSn: undefined, //  产品品牌
           productTypeSn1: '', //  产品一级分类
           productTypeSn2: '', //  产品二级分类
-          productTypeSn3: '' //  产品三级分类
-        }
+          productTypeSn3: '' ,//  产品三级分类
+        },
+        auditState: undefined
       },
       disabled: false, //  查询、重置按钮是否可操作
       productType: [],
@@ -170,12 +177,13 @@ export default {
         { title: '产品品牌', dataIndex: 'product.productBrandName', width: '10%', align: 'center', customRender: function (text) { return text || '--' } },
         { title: '产品分类', scopedSlots: { customRender: 'productType' }, width: '12%', align: 'center' },
         { title: '供应商名称', dataIndex: 'supplierName', width: '12%', align: 'center', customRender: function (text) { return text || '--' } },
-        { title: '审核时间', dataIndex: 'creatDate', width: '10%', align: 'center', customRender: function (text) { return text || '--' } },
-        { title: '审核状态', dataIndex: 'state', width: '8%', align: 'center', customRender: function (text) { return text || '--' } },
+        { title: '审核时间', dataIndex: 'auditTime', width: '10%', align: 'center', customRender: function (text) { return text || '--' } },
+        { title: '审核状态', dataIndex: 'auditStateDictValue', width: '8%', align: 'center', customRender: function (text) { return text || '--' } },
         { title: '操作', scopedSlots: { customRender: 'action' }, width: '8%', align: 'center' }
       ]
       if (this.$hasPermissions('B_isShowCost')) { //  成本价权限
-        arr.splice(7, 0, { title: '成本价(¥)', dataIndex: 'cost', width: '8%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } })
+        arr.splice(7, 0, { title: '当前成本价', dataIndex: 'cost', width: '7%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } })
+        arr.splice(8, 0, { title: '变更成本价', dataIndex: 'modifyCost', width: '7%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } })
       }
       return arr
     }
@@ -194,6 +202,7 @@ export default {
       this.queryParam.product.productTypeSn1 = ''
       this.queryParam.product.productTypeSn2 = ''
       this.queryParam.product.productTypeSn3 = ''
+      this.queryParam.auditState = undefined
       this.productType = []
       this.$refs.table.refresh(true)
     },
@@ -205,7 +214,14 @@ export default {
     },
     // 导出明细
     handleExport () {
-
+      const _this = this
+      const params = _this.queryParam
+      _this.exportLoading = true
+      _this.spinning = true
+      hdExportExcel(supplierProductExportDetail, params, '成本设置明细', function () {
+        _this.exportLoading = false
+        _this.spinning = false
+      })
     },
     // 新增成功
     handleProductsOk () {
@@ -218,13 +234,15 @@ export default {
     },
     // 批量审核
     handleBatchAudit () {
-      if (!this.rowSelectionInfo || (this.rowSelectionInfo && this.rowSelectionInfo.selectedRowKeys.length < 1)) {
+      const row = this.rowSelectionInfo && this.rowSelectionInfo.selectedRowKeys
+      if (!this.rowSelectionInfo || (row.length < 1)) {
         this.$message.warning('请在列表中进行勾选!')
         return false
       }
+      this.handleAudit(row)
     },
     // 单个审核
-    handleAudit (row) {
+    handleAudit (sn) {
       const _this = this
       this.$confirm({
         title: '提示',
@@ -234,16 +252,30 @@ export default {
         okText: '通过',
         cancelText: '不通过',
         onOk () {
-          // _this.auditOrder(row.allocateReturnSn, 'FINISH')
+          _this.auditOrder(sn, 'PASS')
         },
         onCancel (e) {
           if (!e.triggerCancel) {
-            // _this.auditOrder(row.allocateReturnSn, 'FINANCIAL_REJECT')
+            _this.auditOrder(sn, 'REJECT')
           }
           _this.$destroyAll()
         }
       })
     },
+    auditOrder(sn,val){
+      this.spinning = true
+      supplierProductUpdateAuditState({
+        auditState: val,
+        supplierProductSnList: sn
+      }).then(res => {
+        if(res.status == 200){
+          this.$refs.table.refresh(true)
+          this.$refs.table.clearSelected()
+          this.$message.info(res.message)
+        }
+        this.spinning = false
+      })
+    },
     // 成本设置
     handleCostSet (row) {
       this.openSetModal = true

+ 11 - 7
src/views/supplierManagement/costSetting/settingCost.vue

@@ -29,15 +29,15 @@
           <a-form-model-item style="margin-bottom:10px;" label="原成本价">
             {{ cost||'--' }}
           </a-form-model-item>
-          <a-form-model-item label="变更成本价" prop="cost">
+          <a-form-model-item label="变更成本价" prop="modifyCost">
             <a-input-number
               id="setting-cost"
-              v-model="form.cost"
+              v-model="form.modifyCost"
               :precision="2"
               :min="0"
               :max="999999"
               placeholder="请输入"
-              ref="cost"
+              ref="modifyCost"
               @keyup.enter.native="onSubmit"
               style="width: 100%;" />
           </a-form-model-item>
@@ -83,10 +83,10 @@ export default {
       form: {
         supplierSn: '',
         supplierProductSn: '',
-        cost: ''
+        modifyCost: ''
       },
       rules: {
-        cost: [
+        modifyCost: [
           { required: true, message: '请输入成本价', trigger: 'change' }
         ]
       }
@@ -106,6 +106,10 @@ export default {
       this.$refs.ruleForm.validate(valid => {
         if (valid) {
           const params = JSON.parse(JSON.stringify(_this.form))
+          if(params.modifyCost==0){
+            this.$message.warning('成本价不能是0!')
+            return false
+          }
           _this.spinning = true
           settingCost(params).then(res => {
             if (res.status == 200) {
@@ -137,8 +141,8 @@ export default {
         // 默认首项获取焦点
         const _this = this
         setTimeout(() => {
-          if (_this.$refs['cost']) {
-            _this.$refs['cost'].focus()
+          if (_this.$refs['modifyCost']) {
+            _this.$refs['modifyCost'].focus()
           }
         }, 300)
       }

+ 2 - 2
vue.config.js

@@ -107,9 +107,9 @@ const vueConfig = {
     // If you want to turn on the proxy, please remove the mockjs /src/main.jsL11
     proxy: {
       '/api': {
-        // target: 'http://192.168.0.183:8602/ocs-admin',
+        target: 'http://192.168.0.216:8602/ocs-admin',
         // target: 'https://t.ocs.360arrow.com/ocs-admin', //  练习
-        target: 'http://p.ocs.360arrow.com/ocs-admin', //  预发布
+        // target: 'http://p.ocs.360sarrow.com/ocs-admin', //  预发布
         ws: false,
         changeOrigin: true,
         pathRewrite: {