chenrui 4 лет назад
Родитель
Сommit
75ac53c189

+ 18 - 0
src/api/product.js

@@ -22,3 +22,21 @@ export const productList = (params) => {
     method: 'post'
   })
 }
+//  产品  价格变更记录  列表  分页
+export const productPriceChangeList = (params) => {
+  const url = `/product/priceChange/queryPage/${params.pageNo}/${params.pageSize}`
+  delete params.pageNo
+  delete params.pageSize
+  return axios({
+    url: url,
+    data: params,
+    method: 'post'
+  })
+}
+//  查找当前经销商信息
+export const getCurrentDealer = (params) => {
+  return axios({
+    url: `/dealer/findCurrentDealer`,
+    method: 'get'
+  })
+}

+ 25 - 0
src/config/router.config.js

@@ -1082,6 +1082,31 @@ export const asyncRouterMap = [
                 }
               }
             ]
+          },
+          {
+            path: '/productManagement/priceChangeRecord',
+            redirect: '/productManagement/priceChangeRecord/list',
+            name: 'priceChangeRecord',
+            component: RouteView,
+            meta: {
+              title: '价格变更记录',
+              icon: 'sketch'
+              // permission: 'M_goodsManage_list'
+            },
+            hideChildrenInMenu: true,
+            children: [
+              {
+                path: 'list',
+                name: 'priceChangeRecordList',
+                component: () => import(/* webpackChunkName: "shop" */ '@/views/productManagement/priceChangeRecord/list.vue'),
+                meta: {
+                  title: '价格变更记录列表',
+                  icon: 'sketch',
+                  hidden: true
+                  // permission: 'M_goodsManage_list'
+                }
+              }
+            ]
           }
         ]
       },

+ 2 - 2
src/libs/getDate.js

@@ -77,13 +77,13 @@ export default {
     return obj
   },
   // 获取近三个月的开始结束时间
-  getLastThreeMonthDays () {
+  getThreeMonthDays () {
     const obj = {
       starttime: '',
       endtime: ''
     }
     obj.starttime = moment(moment().month(moment().month() - 2).startOf('month').valueOf()).format('YYYY-MM-DD')
-    obj.endtime = moment(moment().valueOf()).format('YYYY-MM-DD')
+    obj.endtime = moment(moment().month(moment().month() - 2).endOf('month').valueOf()).format('YYYY-MM-DD')
     return obj
   }
 }

+ 1 - 0
src/views/allocationManagement/warehouseAllocation/edit.vue

@@ -535,6 +535,7 @@ export default {
     },
     // 已选产品 仓位  change
     chooseWarehouseLocChange (record) {
+      console.log('调入仓位--------------')
       this.handleAdd(record, 'edit')
     },
     //  产品分类  change

+ 387 - 0
src/views/productManagement/priceChangeRecord/list.vue

@@ -0,0 +1,387 @@
+<template>
+  <a-card size="small" :bordered="false" class="productChangeRecordList-wrap">
+    <!-- 搜索条件 -->
+    <div class="table-page-search-wrapper">
+      <a-form layout="inline" @keyup.enter.native="$refs.table.refresh(true)">
+        <a-row :gutter="15">
+          <a-col :md="6" :sm="24">
+            <a-form-item label="变更时间">
+              <a-range-picker
+                style="width:100%"
+                id="productChangeRecordList-time"
+                :disabledDate="disabledDate"
+                v-model="time"
+                :format="dateFormat"
+                :placeholder="['开始时间', '结束时间']" />
+            </a-form-item>
+          </a-col>
+          <a-col :md="6" :sm="24">
+            <a-form-item label="产品名称">
+              <a-input id="productChangeRecordList-name" v-model.trim="queryParam.name" allowClear placeholder="请输入产品名称"/>
+            </a-form-item>
+          </a-col>
+          <a-col :md="6" :sm="24">
+            <a-form-item label="产品编码">
+              <a-input id="productChangeRecordList-code" v-model.trim="queryParam.code" allowClear placeholder="请输入产品编码"/>
+            </a-form-item>
+          </a-col>
+          <template v-if="advanced">
+            <a-col :md="6" :sm="24">
+              <a-form-item label="品牌">
+                <a-select
+                  placeholder="请选择"
+                  id="productChangeRecordList-brandSn"
+                  allowClear
+                  v-model="queryParam.brandSn"
+                  :showSearch="true"
+                  option-filter-prop="children"
+                  :filter-option="filterOption">
+                  <a-select-option v-for="item in productBrandList" :key="item.productBrandSn" :value="item.productBrandSn">{{ item.productBrandName }}</a-select-option>
+                </a-select>
+              </a-form-item>
+            </a-col>
+            <a-col :md="6" :sm="24">
+              <a-form-item label="产品分类">
+                <a-cascader
+                  @change="changeProductType"
+                  expand-trigger="hover"
+                  change-on-select
+                  :options="productTypeList"
+                  :fieldNames="{ label: 'productTypeName', value: 'id', children: 'children' }"
+                  id="productInfoList-productType"
+                  placeholder="请选择产品分类"
+                  allowClear
+                  v-model="productType" />
+              </a-form-item>
+            </a-col>
+          </template>
+          <a-col :md="6" :sm="24">
+            <a-button style="margin-bottom: 18px;" type="primary" @click="$refs.table.refresh(true)" :disabled="disabled" id="productChangeRecordList-refresh">查询</a-button>
+            <a-button style="margin: 0 0 18px 8px" @click="resetSearchForm" :disabled="disabled" id="productChangeRecordList-reset">重置</a-button>
+            <a-button style="margin: 0 0 18px 8px" type="danger" @click="handleExport" :loading="exportLoading" id="productChangeRecordList-export">导出</a-button>
+            <a @click="advanced=!advanced" style="margin-left: 8px">
+              {{ advanced ? '收起' : '展开' }}
+              <a-icon :type="advanced ? 'up' : 'down'"/>
+            </a>
+          </a-col>
+        </a-row>
+      </a-form>
+    </div>
+    <!-- 总计 -->
+    <a-alert type="info" showIcon style="margin-bottom:15px">
+      <div slot="message">合计:<strong>{{ total }}</strong></div>
+    </a-alert>
+    <!-- 列表 -->
+    <s-table
+      class="sTable"
+      ref="table"
+      size="default"
+      :rowKey="(record) => record.id"
+      :columns="columns"
+      :data="loadData"
+      :scroll="{ x: 2340, y: tableHeight }"
+      bordered>
+      <!-- 产品分类 -->
+      <template slot="productType" slot-scope="text, record">
+        <span v-if="record.productEntity.productTypeName2 || record.productEntity.productTypeName3">{{ record.productEntity.productTypeName2 }} {{ record.productEntity.productTypeName3 ? '>' : '' }} {{ record.productEntity.productTypeName3 }}</span>
+        <span v-else>--</span>
+      </template>
+      <!-- 省级价变更后 -->
+      <template slot="afterProvincePrice" slot-scope="text, record">
+        <span v-if="record.afterProvincePrice || record.afterProvincePrice==0" :class="record.beforeProvincePrice != record.afterProvincePrice ? 'red' : ''">{{ record.afterProvincePrice }}</span>
+        <span v-else>--</span>
+      </template>
+      <!-- 市级价变更后 -->
+      <template slot="afterCityPrice" slot-scope="text, record">
+        <span v-if="record.afterCityPrice || record.afterCityPrice==0" :class="record.beforeCityPrice != record.afterCityPrice ? 'red' : ''">{{ record.afterCityPrice }}</span>
+        <span v-else>--</span>
+      </template>
+      <!-- 特约价变更后 -->
+      <template slot="afterSpecialPrice" slot-scope="text, record">
+        <span v-if="record.afterSpecialPrice || record.afterSpecialPrice==0" :class="record.beforeSpecialPrice != record.afterSpecialPrice ? 'red' : ''">{{ record.afterSpecialPrice }}</span>
+        <span v-else>--</span>
+      </template>
+      <!-- 终端价变更后 -->
+      <template slot="afterTerminalPrice" slot-scope="text, record">
+        <span v-if="record.afterTerminalPrice || record.afterTerminalPrice==0" :class="record.beforeTerminalPrice != record.afterTerminalPrice ? 'red' : ''">{{ record.afterTerminalPrice }}</span>
+        <span v-else>--</span>
+      </template>
+      <!-- 车主价变更后 -->
+      <template slot="afterCarOwnersPrice" slot-scope="text, record">
+        <span v-if="record.afterCarOwnersPrice || record.afterCarOwnersPrice==0" :class="record.beforeCarOwnersPrice != record.afterCarOwnersPrice ? 'red' : ''">{{ record.afterCarOwnersPrice }}</span>
+        <span v-else>--</span>
+      </template>
+    </s-table>
+  </a-card>
+</template>
+
+<script>
+import moment from 'moment'
+import { STable, VSelect } from '@/components'
+import getDate from '@/libs/getDate.js'
+import { productBrandQuery } from '@/api/productBrand'
+import { productTypeQuery } from '@/api/productType'
+import { productPriceChangeList, getCurrentDealer } from '@/api/product'
+export default {
+  components: { STable, VSelect },
+  data () {
+    return {
+      advanced: false, // 高级搜索 展开/关闭
+      tableHeight: 0,
+      queryParam: { //  查询条件
+        name: '', //  产品名称
+        code: '', //  产品编码
+        brandSn: undefined, //  品牌
+        productTypeSn1: '', //  产品一级分类
+        productTypeSn2: '', //  产品二级分类
+        productTypeSn3: '' //  产品三级分类
+      },
+      productType: [],
+      disabled: false, //  查询、重置按钮是否可操作
+      dateFormat: 'YYYY-MM-DD',
+      time: [
+        moment(getDate.getThreeMonthDays().starttime, 'YYYY-MM-DD'),
+        moment(getDate.getCurrMonthDays().endtime, 'YYYY-MM-DD')
+      ], //  变更时间
+      exportLoading: false, // 导出loading
+      // 加载数据方法 必须为 Promise 对象
+      loadData: parameter => {
+        this.disabled = true
+        if (this.tableHeight == 0) {
+          this.tableHeight = window.innerHeight - 430
+        }
+        // 变更时间
+        if (this.time && this.time.length > 0) {
+          this.queryParam.beginDate = moment(this.time[0]).format(this.dateFormat)
+          this.queryParam.endDate = moment(this.time[1]).format(this.dateFormat)
+        } else {
+          this.queryParam.beginDate = undefined
+          this.queryParam.endDate = undefined
+        }
+        return productPriceChangeList(Object.assign(parameter, this.queryParam)).then(res => {
+          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
+          }
+          this.total = data.count || 0
+          this.disabled = false
+          return data
+        })
+      },
+      columns: [],
+      total: 0,
+      productBrandList: [], //  品牌下拉数据
+      productTypeList: [] //  分类下拉数据
+    }
+  },
+  methods: {
+    // 不可选日期
+    disabledDate (date, dateStrings) {
+      return date && date.valueOf() > Date.now()
+    },
+    // 设置表头
+    getColumns () {
+      this.columns = [
+        { title: '序号', dataIndex: 'no', width: 80, align: 'center', fixed: 'left' },
+        { title: '变更时间', dataIndex: 'updateDate', width: 160, align: 'center', customRender: function (text) { return text || '--' } },
+        { title: '产品名称', dataIndex: 'productEntity.name', align: 'center', ellipsis: true, customRender: function (text) { return text || '--' } },
+        { title: '产品编码', dataIndex: 'productEntity.code', align: 'center' },
+        { title: '品牌', dataIndex: 'productEntity.productBrandName', align: 'center', customRender: function (text) { return text || '--' } },
+        { title: '产品分类', scopedSlots: { customRender: 'productType' }, align: 'center' },
+        { title: '单位', dataIndex: 'productEntity.unit', width: 100, align: 'center', customRender: function (text) { return text || '--' } }
+      ]
+      const cArr = [
+        {
+          title: '终端价',
+          dataIndex: 'hterminaldsdPrice',
+          width: 200,
+          align: 'center',
+          children: [
+            { title: '变更前', dataIndex: 'beforeTerminalPrice', width: 100, align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
+            { title: '变更后', scopedSlots: { customRender: 'afterTerminalPrice' }, width: 100, align: 'center' }
+          ]
+        },
+        {
+          title: '车主价',
+          dataIndex: 'sterminaldsdPrice',
+          width: 200,
+          align: 'center',
+          children: [
+            { title: '变更前', dataIndex: 'beforeCarOwnersPrice', width: 100, align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
+            { title: '变更后', scopedSlots: { customRender: 'afterCarOwnersPrice' }, width: 100, align: 'center' }
+          ]
+        },
+        { title: '变更原因', dataIndex: 'changeReason', width: 160, align: 'center', customRender: function (text) { return text || '--' }, ellipsis: true }
+      ]
+      getCurrentDealer().then(res => {
+        if (res.status == 200) {
+          if (res.data.dealerLevel && res.data.dealerLevel == 'PROVINCE') { //  省级
+            this.columns.push({
+              title: '省级价',
+              dataIndex: 'sdtermindfaldsdPrice',
+              width: 200,
+              align: 'center',
+              children: [
+                { title: '变更前', dataIndex: 'beforeProvincePrice', width: 100, align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
+                { title: '变更后', scopedSlots: { customRender: 'afterProvincePrice' }, width: 100, align: 'center' }
+              ]
+            },
+            {
+              title: '市级价',
+              dataIndex: 'sdterminaldsdPrice',
+              width: 200,
+              align: 'center',
+              children: [
+                { title: '变更前', dataIndex: 'beforeCityPrice', width: 100, align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
+                { title: '变更后', scopedSlots: { customRender: 'afterCityPrice' }, width: 100, align: 'center' }
+              ]
+            })
+          } else if (res.data.dealerLevel && res.data.dealerLevel == 'CITY') { //  市级
+            this.columns.push({
+              title: '市级价',
+              dataIndex: 'sdterminaldsdPrice',
+              width: 200,
+              align: 'center',
+              children: [
+                { title: '变更前', dataIndex: 'beforeCityPrice', width: 100, align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
+                { title: '变更后', scopedSlots: { customRender: 'afterCityPrice' }, width: 100, align: 'center' }
+              ]
+            })
+          }
+          if (res.data.isShowSpecialPrice && res.data.isShowSpecialPrice == '0') { //  是否展示特约价
+            this.columns.push({
+              title: '特约价',
+              dataIndex: 'gterminaldsdPrice',
+              width: 200,
+              align: 'center',
+              children: [
+                { title: '变更前', dataIndex: 'beforeSpecialPrice', width: 100, align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
+                { title: '变更后', scopedSlots: { customRender: 'afterSpecialPrice' }, width: 100, align: 'center' }
+              ]
+            })
+          }
+          this.columns = [...this.columns, ...cArr]
+        }
+      })
+    },
+    //  重置
+    resetSearchForm () {
+      this.queryParam.code = ''
+      this.queryParam.name = ''
+      this.queryParam.brandSn = undefined
+      this.queryParam.productTypeSn1 = ''
+      this.queryParam.productTypeSn2 = ''
+      this.queryParam.productTypeSn3 = ''
+      this.time = [
+        moment(getDate.getThreeMonthDays().starttime, 'YYYY-MM-DD'),
+        moment(getDate.getCurrMonthDays().endtime, 'YYYY-MM-DD')
+      ]
+      this.$refs.table.refresh(true)
+    },
+    // 审核
+    handleAudit (row) {
+      this.itemId = row.id
+      this.openAuditModal = true
+    },
+    filterOption (input, option) {
+      return (
+        option.componentOptions.children[0].text.toLowerCase().indexOf(input.toLowerCase()) >= 0
+      )
+    },
+    //  编辑
+    handleEdit (row) {
+      this.itemId = row.id
+      this.openModal = true
+    },
+    //  关闭弹框
+    closeModal () {
+      this.itemId = ''
+      this.openModal = false
+    },
+    //  关闭审核弹框
+    closeAuditModal () {
+      this.itemId = ''
+      this.openAuditModal = false
+    },
+    //  产品分类  change
+    changeProductType (val, opt) {
+      this.queryParam.productTypeSn1 = val[0] ? val[0] : ''
+      this.queryParam.productTypeSn2 = val[1] ? val[1] : ''
+      this.queryParam.productTypeSn3 = val[2] ? val[2] : ''
+    },
+    //  导出
+    handleExport () {
+      const params = this.queryParam
+      if (this.time && this.time.length) {
+        params.beginDate = moment(this.time[0]).format('YYYY-MM-DD')
+        params.endDate = moment(this.time[1]).format('YYYY-MM-DD')
+      } else {
+        params.beginDate = ''
+        params.endDate = ''
+      }
+      if (!params.beginDate && !params.endDate) {
+        this.$message.error('请先选择变更时间后查询并导出!')
+        return
+      }
+      // 判断两个时间段是否相差m个月  第二个参数指相差单位,第三个参数指是否返回浮点形式(小数)
+      if (moment(params.endDate).diff(moment(params.beginDate), 'months', true) > 12) {
+        this.$message.error('仅支持导出最多12个月的数据,请先修改变更时间再进行导出!')
+        return
+      }
+      this.exportLoading = true
+      // customerBundleExportDelay(params).then(res => {
+      //   this.exportLoading = false
+      //   this.download(res)
+      // })
+    },
+    download (data) {
+      if (!data) { return }
+      const url = window.URL.createObjectURL(new Blob([data]))
+      const link = document.createElement('a')
+      link.style.display = 'none'
+      link.href = url
+      const a = moment().format('YYYYMMDDHHmmss')
+      const fname = '价格变更记录' + a
+      link.setAttribute('download', fname + '.xlsx')
+      document.body.appendChild(link)
+      link.click()
+    },
+    //  产品品牌  列表
+    getProductBrand () {
+      productBrandQuery({}).then(res => {
+        if (res.status == 200) {
+          this.productBrandList = res.data
+        } else {
+          this.productBrandList = []
+        }
+      })
+    },
+    //  产品分类  列表
+    getProductType () {
+      productTypeQuery({}).then(res => {
+        if (res.status == 200) {
+          this.productTypeList = res.data
+        } else {
+          this.productTypeList = []
+        }
+      })
+    }
+  },
+  beforeRouteEnter (to, from, next) {
+    next(vm => {
+      vm.getColumns()
+      vm.getProductBrand()
+      vm.getProductType()
+    })
+  }
+}
+</script>
+
+<style lang="less" scoped>
+  .productChangeRecordList-wrap{
+    .red{
+      color: #ed1c24;
+    }
+  }
+</style>