Browse Source

促销管理

chenrui 2 years ago
parent
commit
3133ea5d10

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

@@ -3193,6 +3193,44 @@ export const asyncRouterMap = [
           }
         ]
       },
+      // 促销管理
+      {
+        path: '/promotionManagement',
+        redirect: '/promotionManagement/promotionInfo',
+        component: PageView,
+        meta: {
+          title: '促销管理',
+          icon: 'contacts'
+          // permission: 'M_promotionInfoList'
+        },
+        children: [
+          {
+            path: '/promotionManagement/promotionInfo',
+            redirect: '/promotionManagement/promotionInfo/list',
+            name: 'promotionInfo',
+            component: BlankLayout,
+            meta: {
+              title: '促销查看',
+              icon: 'contacts'
+              // permission: 'M_promotionInfoList'
+            },
+            hideChildrenInMenu: true,
+            children: [
+              {
+                path: 'list',
+                name: 'promotionInfoList',
+                component: () => import(/* webpackChunkName: "productManagement" */ '@/views/promotionManagement/promotionInfo/list.vue'),
+                meta: {
+                  title: '促销列表',
+                  icon: 'contacts',
+                  hidden: true
+                  // permission: 'M_promotionInfoList'
+                }
+              }
+            ]
+          }
+        ]
+      },
       // 中心店/配送店管理
       {
         path: '/storeManagement',

+ 247 - 0
src/views/promotionManagement/promotionInfo/list.vue

@@ -0,0 +1,247 @@
+<template>
+  <a-card size="small" :bordered="false" class="jg-page-wrap promotionInfoList-wrap">
+    <a-spin :spinning="spinning" tip="Loading...">
+      <!-- 搜索条件 -->
+      <div ref="tableSearch" 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="发布时间">
+                <rangeDate ref="rangeDate" :value="time" @change="dateChange" />
+              </a-form-item>
+            </a-col>
+            <a-col :md="6" :sm="24">
+              <a-form-item label="促销名称">
+                <a-input id="promotionInfoList-urgentBillNo" v-model.trim="queryParam.urgentBillNo" allowClear placeholder="请输入急件单号"/>
+              </a-form-item>
+            </a-col>
+            <a-col :md="4" :sm="24">
+              <a-form-item label="显示状态">
+                <v-select
+                  v-model="queryParam.status"
+                  ref="status"
+                  id="chainTransferInList-status"
+                  code="URGENT_STATUS"
+                  placeholder="请选择显示状态"
+                  allowClear></v-select>
+              </a-form-item>
+            </a-col>
+            <a-col :md="4" :sm="24">
+              <a-form-item label="促销状态">
+                <v-select
+                  v-model="queryParam.sourceType"
+                  ref="sourceType"
+                  id="promotionInfoList-sourceType"
+                  code="SALES_SOURCE"
+                  placeholder="请选择促销状态"
+                  allowClear></v-select>
+              </a-form-item>
+            </a-col>
+            <a-col :md="4" :sm="24">
+              <a-button type="primary" @click="$refs.table.refresh(true)" :disabled="disabled" id="promotionInfoList-refresh">查询</a-button>
+              <a-button style="margin-left: 8px" @click="resetSearchForm" :disabled="disabled" id="promotionInfoList-reset">重置</a-button>
+            </a-col>
+          </a-row>
+        </a-form>
+      </div>
+      <!-- 列表 -->
+      <s-table
+        class="sTable fixPagination"
+        ref="table"
+        :style="{ height: tableHeight+84.5+'px' }"
+        size="small"
+        :rowKey="(record) => record.id"
+        :columns="columns"
+        :data="loadData"
+        :scroll="{ y: tableHeight }"
+        :defaultLoadData="false"
+        bordered>
+        <!-- 参与客户 -->
+        <template slot="joinCustomers" slot-scope="text, record">
+          <span @click="openCustomerModal = true">共<span style="color:red;">17</span>个客户</span>
+        </template>
+        <!-- 状态 -->
+        <template slot="status" slot-scope="text, record">
+          <stateIcon :title="record.statusDictValue" :state="record.status=='WAIT'?'2':'1'"></stateIcon>
+        </template>
+        <!-- 操作 -->
+        <template slot="action" slot-scope="text, record">
+          <a-button
+            size="small"
+            type="link"
+            v-if="record.status == 'WAIT' && $hasPermissions('B_urgentWriteDown')"
+            @click="handleWriteDown(record)"
+            class="button-primary"
+            id="urgentItemsOffsetDetail-btn-submit">冲减</a-button>
+          <span v-else>--</span>
+        </template>
+      </s-table>
+    </a-spin>
+    <lookUp-customers-modal ref="lookUpCustomers" :openModal="openCustomerModal" @close="openCustomerModal = false"/>
+    <promotion-desc-modal :openModal="openDescModal" @close="openDescModal = false"/>
+    <promotion-show-modal :openModal="openShowModal" @close="openShowModal = false"/>
+  </a-card>
+</template>
+
+<script>
+import { commonMixin } from '@/utils/mixin'
+import { urgentList, urgentWriteDown } from '@/api/urgent'
+import { STable, VSelect } from '@/components'
+import rangeDate from '@/views/common/rangeDate.vue'
+import stateIcon from '@/views/common/stateIcon'
+import custList from '@/views/common/custList.vue'
+import getDate from '@/libs/getDate.js'
+import lookUpCustomersModal from './lookUpCustomersModal'
+import promotionDescModal from './promotionDescModal'
+import promotionShowModal from './promotionShowModal'
+
+export default {
+  name: 'UrgentOffsetList',
+  components: { STable, VSelect, rangeDate, custList, stateIcon, lookUpCustomersModal, promotionDescModal, promotionShowModal },
+  mixins: [commonMixin],
+  data () {
+    return {
+      spinning: false,
+      tableHeight: 0,
+      openCustomerModal: false, // 参与客户弹窗
+      openDescModal: false, // 促销描述弹窗
+      openShowModal: true, // 促销展示弹窗
+      time: [
+        getDate.getCurrMonthDays().starttime,
+        getDate.getCurrMonthDays().endtime
+      ],
+      queryParam: { //  查询条件
+        beginDate: getDate.getCurrMonthDays().starttime,
+        endDate: getDate.getCurrMonthDays().endtime,
+        buyerNameCurrent: undefined, //  客户名称
+        bizBillNo: '', //  关联单号
+        urgentBillNo: '', //  急件单号
+        status: undefined, //  状态
+        sourceType: undefined // 单据来源
+      },
+      disabled: false, //  查询、重置按钮是否可操作
+      columns: [
+        { title: '序号', dataIndex: 'no', width: '4%', align: 'center' },
+        { title: '发布时间', dataIndex: 'createDate', width: '14%', align: 'center', customRender: function (text) { return text || '--' } },
+        { title: '促销名称', dataIndex: 'buyerNameCurrent', width: '24%', align: 'center', customRender: function (text) { return text || '--' }, ellipsis: true },
+        { title: '促销时间', dataIndex: 'offSetTime', width: '14%', align: 'center', customRender: function (text) { return text || '--' } },
+        { title: '参与客户', scopedSlots: { customRender: 'joinCustomers' }, width: '15%', align: 'center' },
+        { title: '促销描述', dataIndex: 'bizBillNo', width: '15%', align: 'center', customRender: function (text) { return text || '--' } },
+        { title: '促销展示', scopedSlots: { customRender: 'status' }, width: '15%', align: 'center' },
+        { title: '显示状态', dataIndex: 'bizBillNo', width: '10%', align: 'center', customRender: function (text) { return text || '--' } },
+        { title: '状态', dataIndex: 'bizBillNo', width: '10%', align: 'center', customRender: function (text) { return text || '--' } }
+      ],
+      // 加载数据方法 必须为 Promise 对象
+      loadData: parameter => {
+        this.disabled = true
+        this.spinning = true
+        return urgentList(Object.assign(parameter, this.queryParam)).then(res => {
+          let data
+          if (res.status == 200) {
+            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.disabled = false
+          }
+          this.spinning = false
+          return data
+        })
+      }
+    }
+  },
+  methods: {
+    //  时间  change
+    dateChange (date) {
+      this.queryParam.beginDate = date[0]
+      this.queryParam.endDate = date[1]
+    },
+    // 冲减
+    handleWriteDown (row) {
+      const _this = this
+      this.$confirm({
+        title: '提示',
+        content: '确定要进行冲减吗?',
+        centered: true,
+        onOk () {
+          _this.disabled = true
+          _this.spinning = true
+          urgentWriteDown({ urgentBillSn: row.urgentBillSn }).then(res => {
+            if (res.status == 200) {
+              _this.$message.success(res.message)
+              _this.$refs.table.refresh()
+            }
+            _this.disabled = false
+            _this.spinning = false
+          })
+        }
+      })
+    },
+    //  重置
+    resetSearchForm () {
+      this.$refs.rangeDate.resetDate(this.time)
+      this.queryParam.beginDate = getDate.getCurrMonthDays().starttime
+      this.queryParam.endDate = getDate.getCurrMonthDays().endtime
+      this.queryParam.buyerNameCurrent = undefined
+      this.queryParam.bizBillNo = ''
+      this.queryParam.urgentBillNo = ''
+      this.queryParam.status = undefined
+      this.queryParam.sourceType = undefined
+      this.$refs.custList.resetForm()
+      this.$refs.table.refresh(true)
+    },
+    //  详情
+    handleDetail (row) {
+      this.$router.push({ path: `/salesManagement/urgentItemsOffset/detail/${row.urgentBillSn}` })
+    },
+    pageInit () {
+      const _this = this
+      this.$nextTick(() => { // 页面渲染完成后的回调
+        _this.setTableH()
+      })
+    },
+    setTableH () {
+      const tableSearchH = this.$refs.tableSearch.offsetHeight
+      this.tableHeight = window.innerHeight - tableSearchH - 195
+    }
+  },
+  mounted () {
+    if (!this.$store.state.app.isNewTab) { // 页签刷新时调用
+      this.pageInit()
+      this.resetSearchForm()
+    }
+  },
+  watch: {
+    '$store.state.app.winHeight' (newValue, oldValue) { //  窗口变更时,需同时更改表格高度
+      this.setTableH()
+    }
+  },
+  activated () {
+    // 如果是新页签打开,则重置当前页面
+    if (this.$store.state.app.isNewTab) {
+      this.pageInit()
+      this.resetSearchForm()
+    }
+    // 只刷新列表
+    if (this.$store.state.app.updateList) {
+      this.pageInit()
+      this.$refs.table.refresh()
+    }
+  },
+  beforeRouteEnter (to, from, next) {
+    next(vm => {})
+  }
+}
+</script>
+
+<style lang="less">
+  .promotionInfoList-wrap{
+    .red{
+      color: #ed1c24;
+    }
+    .green{
+      color: #19be6b;
+    }
+  }
+</style>

+ 282 - 0
src/views/promotionManagement/promotionInfo/lookUpCustomersModal.vue

@@ -0,0 +1,282 @@
+<template>
+  <a-modal
+    centered
+    class="lookUpCustomers-modal"
+    :footer="null"
+    :maskClosable="false"
+    title="参与客户"
+    v-model="isShow"
+    @cancel="isShow = false"
+    width="50%">
+    <a-spin :spinning="spinning" tip="Loading...">
+      <a-card size="small" :bordered="false">
+        <!-- 筛选条件 -->
+        <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="客户名称">
+                  <custList ref="custList" @change="custChange" placeholder="输入客户名称搜索"></custList>
+                </a-form-item>
+              </a-col>
+              <a-col :md="6" :sm="24">
+                <a-form-item label="联系人">
+                  <custList ref="custList" @change="custChange" placeholder="输入联系人名称搜索"></custList>
+                </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="inventoryCheckMakeInventoryList-refresh">查询</a-button>
+                <a-button style="margin-left: 5px" @click="resetSearchForm" :disabled="disabled" id="inventoryCheckMakeInventoryList-reset">重置</a-button>
+              </a-col>
+            </a-row>
+          </a-form>
+        </div>
+        <!-- 列表 -->
+        <s-table
+          class="sTable"
+          ref="table"
+          size="small"
+          :rowKey="(record) => record.id"
+          :columns="columns"
+          :data="loadData"
+          :defaultLoadData="false"
+          :scroll="{ y: 450 }"
+          :rowClassName="(record, index) => record.checkProfitLossQty < 0 ? 'redBg-row':''"
+          bordered>
+        </s-table>
+      </a-card>
+      <div class="btn-cont">
+        <a-button type="primary" id="lookUpCustomers-modal-back" @click="isShow = false">关闭</a-button>
+      </div>
+    </a-spin>
+  </a-modal>
+</template>
+
+<script>
+import { commonMixin } from '@/utils/mixin'
+import { hdPrint } from '@/libs/JGPrint.js'
+import { STable } from '@/components'
+// import printModal from './printModal.vue'
+// import exportModal from './exportModal.vue'
+import ProductType from '@/views/common/productType.js'
+import custList from '@/views/common/custList.vue'
+import { checkWarehouseDetailList, checkWarehouseDetail, checkWarehouseDetailCount, checkWarehouseDetailExport, checkWarehouseDetailPrint, checkWarehouseWarehouse } from '@/api/checkWarehouse'
+export default {
+  name: 'LookUpCustomersModal',
+  components: { STable, ProductType, custList },
+  mixins: [commonMixin],
+  props: {
+    openModal: { //  弹框显示状态
+      type: Boolean,
+      default: false
+    },
+    itemSn: {
+      type: String || Number,
+      default: ''
+    }
+  },
+  data () {
+    return {
+      spinning: false,
+      isShow: this.openModal, //  是否打开弹框
+      disabled: false,
+      advanced: false,
+      exportShow: false,
+      queryParam: {
+        productName: '',
+        productCode: '',
+        productTypeSn1: undefined,
+        productTypeSn2: undefined,
+        productTypeSn3: undefined,
+        warehouseSn: undefined
+      },
+      // 加载数据方法 必须为 Promise 对象
+      loadData: parameter => {
+        this.disabled = true
+        this.spinning = true
+        const params = Object.assign(parameter, this.queryParam, { checkWarehouseSn: this.itemSn })
+        if (this.isPrice) {
+          params.profitLossFlag = 1
+        }
+        return checkWarehouseDetailList(params).then(res => {
+          let data
+          if (res.status == 200) {
+            data = res.data
+            this.getDetailCount(params)
+            const no = (data.pageNo - 1) * data.pageSize
+            for (var i = 0; i < data.list.length; i++) {
+              data.list[i].no = no + i + 1
+            }
+            this.localDataSource = data.list || []
+            this.disabled = false
+          }
+          this.spinning = false
+          return data
+        })
+      },
+      basicInfoData: null, //  基本信息
+      productTotal: null,
+      productType: [],
+      warehouseList: [], //  仓库  下拉数据
+      localDataSource: [],
+      isPrice: false, //  仅显示盈亏
+      openPrintModal: false,
+      nowType: null,
+      printerType: 'NEEDLE', //  打印机类型
+      columns: [
+        { title: '序号', dataIndex: 'no', width: '4%', align: 'center' },
+        { title: '客户名称', dataIndex: 'productName', width: '30%', align: 'left', customRender: function (text) { return text || '--' }, ellipsis: true },
+        { title: '联系人', dataIndex: 'productUnit', width: '15%', align: 'center', customRender: function (text) { return text || '--' } },
+        { title: '联系电话', dataIndex: 'productUnit', width: '15%', align: 'center', customRender: function (text) { return text || '--' } }
+      ]
+    }
+  },
+  methods: {
+    // 详情
+    getDetail () {
+      checkWarehouseDetail({ sn: this.itemSn }).then(res => {
+        if (res.status == 200) {
+          this.basicInfoData = res.data || null
+        } else {
+          this.basicInfoData = null
+        }
+      })
+    },
+    // 合计
+    getDetailCount (params) {
+      checkWarehouseDetailCount(params).then(res => {
+        if (res.status == 200) {
+          this.productTotal = res.data
+          if (res.data && res.data.checkLossQty) {
+            this.productTotal.checkLossQty = Math.abs(this.productTotal.checkLossQty || 0)
+          }
+        } else {
+          this.productTotal = null
+        }
+      })
+    },
+    //  重置
+    resetSearchForm () {
+      this.queryParam.productName = ''
+      this.queryParam.productCode = ''
+      this.queryParam.warehouseSn = undefined
+      this.queryParam.productTypeSn1 = undefined
+      this.queryParam.productTypeSn2 = undefined
+      this.queryParam.productTypeSn3 = undefined
+      this.productType = []
+      this.$refs.table.refresh(true)
+    },
+    //  产品分类  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] : ''
+    },
+    // 仓库下拉数据
+    getWarehouseList () {
+      checkWarehouseWarehouse({}).then(res => {
+        if (res.status == 200) {
+          this.warehouseList = res.data
+        } else {
+          this.warehouseList = []
+        }
+      })
+    },
+    handleExport () {
+      this.exportShow = true
+    },
+    // 打印导出
+    handlePrint (type, data) {
+      if (type == 'export') {
+        this.exportShow = false
+        this.nowType = type
+        this.handleOk(data)
+      } else {
+        this.nowType = type
+        this.openPrintModal = true
+      }
+    },
+    handleOk (objs) {
+      const _this = this
+      let params, type
+      let url = checkWarehouseDetailPrint //  打印
+      if (this.nowType == 'export') { //  导出
+        url = checkWarehouseDetailExport
+        params = { checkWarehouseSn: this.itemSn, ...objs }
+        type = 'export'
+      } else { //  打印
+        params = JSON.parse(JSON.stringify(objs))
+        params.printType = this.printerType
+        type = params.type
+        delete params.type
+      }
+      _this.spinning = true
+      // 打印或导出
+      hdPrint(this.printerType, type, url, params, '库存盘点', function () {
+        _this.spinning = false
+      })
+    }
+  },
+  watch: {
+    //  父页面传过来的弹框状态
+    openModal (newValue, oldValue) {
+      this.isShow = newValue
+    },
+    //  重定义的弹框状态
+    isShow (newValue, oldValue) {
+      if (!newValue) {
+        this.$emit('close')
+        this.printerType = 'NEEDLE'
+        this.$refs.table.clearTable()
+        this.basicInfoData = null
+      } else {
+        const _this = this
+        setTimeout(() => (
+          _this.resetSearchForm()
+        ), 300)
+      }
+    },
+    itemSn (newValue, oldValue) {
+      if (this.isShow && newValue) {
+        this.isPrice = false
+        this.getDetail()
+        this.getWarehouseList()
+      }
+    },
+    isPrice (newValue, oldValue) {
+      this.$refs.table.refresh(true)
+    }
+  }
+}
+</script>
+<style lang="less" scoped>
+  .lookUpCustomers-modal{
+    .ant-modal-body{
+      padding: 0 24px 24px;
+    }
+    .redBg-row{
+      background-color: #f5cdc8;
+    }
+    .btn-cont {
+      text-align: center;
+      margin: 5px 0 10px;
+    }
+    .table-page-search-wrapper{
+      margin-bottom:6px;
+      /deep/.ant-select-selection{
+        border:0 !important;
+        box-shadow: none !important;
+      }
+      .ant-form.ant-form-inline .ant-form-item{
+        border:1px solid #dadada;
+        border-radius: 3px;
+        overflow: hidden;
+        margin-bottom: 10px!important;
+        /deep/.ant-form-item-label{
+          padding-left: 11px !important;
+          padding-right: 0!important;
+        }
+      }
+    }
+  }
+</style>

+ 67 - 0
src/views/promotionManagement/promotionInfo/promotionDescModal.vue

@@ -0,0 +1,67 @@
+<template>
+  <a-modal
+    centered
+    class="promotionDesc-modal"
+    :footer="null"
+    :maskClosable="false"
+    :title="modalTit"
+    v-model="isShow"
+    @cancel="isShow=false"
+    :width="500">
+    <div class="promotionDesc-con">
+      <p>购买满 10000 元正价产品,送 1000 元代金券可用于购买促销品</p>
+      <p>购买满 20000 元正价产品,返 3000 元代金券可用于购买促销品</p>
+      <p>正价消费满 1000 元 减 500 元</p>
+    </div>
+    <div class="btn-cont">
+      <a-button type="primary" id="promotionDesc-modal-back" @click="isShow = false">关闭</a-button>
+    </div>
+  </a-modal>
+</template>
+
+<script>
+import { commonMixin } from '@/utils/mixin'
+export default {
+  name: 'PromotionDescModal',
+  mixins: [commonMixin],
+  props: {
+    openModal: { //  弹框显示状态
+      type: Boolean,
+      default: false
+    }
+  },
+  data () {
+    return {
+      modalTit: '促销描述',
+      isShow: this.openModal //  是否打开弹框
+    }
+  },
+  methods: {
+
+  },
+  watch: {
+    //  父页面传过来的弹框状态
+    openModal (newValue, oldValue) {
+      this.isShow = newValue
+    },
+    //  重定义的弹框状态
+    isShow (newValue, oldValue) {
+      if (!newValue) {
+        this.$emit('close')
+      }
+    }
+  }
+}
+</script>
+
+<style lang="less">
+  .promotionDesc-modal{
+    .promotionDesc-con{
+       text-align: center;
+    }
+    .btn-cont {
+      text-align: center;
+      margin: 50px 0 0px;
+    }
+  }
+</style>

+ 71 - 0
src/views/promotionManagement/promotionInfo/promotionShowModal.vue

@@ -0,0 +1,71 @@
+<template>
+  <a-modal
+    centered
+    class="promotionDesc-modal"
+    :footer="null"
+    :maskClosable="false"
+    :title="modalTit"
+    v-model="isShow"
+    @cancel="isShow=false"
+    :width="500">
+    <div class="promotionDesc-con">
+      <img src="https://img0.baidu.com/it/u=107997771,2476879867&fm=253&fmt=auto&app=138&f=JPEG?w=716&h=500" alt="图片走丢了" srcset="">
+    </div>
+    <div class="btn-cont">
+      <a-button id="promotionDesc-modal-back" @click="isShow = false">下载图片</a-button>
+      <a-button style="margin-left:10px;" type="primary" id="promotionDesc-modal-back" @click="isShow = false">关闭</a-button>
+    </div>
+  </a-modal>
+</template>
+
+<script>
+import { commonMixin } from '@/utils/mixin'
+export default {
+  name: 'PromotionDescModal',
+  mixins: [commonMixin],
+  props: {
+    openModal: { //  弹框显示状态
+      type: Boolean,
+      default: false
+    }
+  },
+  data () {
+    return {
+      modalTit: '促销展示',
+      isShow: this.openModal //  是否打开弹框
+    }
+  },
+  methods: {
+
+  },
+  watch: {
+    //  父页面传过来的弹框状态
+    openModal (newValue, oldValue) {
+      this.isShow = newValue
+    },
+    //  重定义的弹框状态
+    isShow (newValue, oldValue) {
+      if (!newValue) {
+        this.$emit('close')
+      }
+    }
+  }
+}
+</script>
+
+<style lang="less">
+  .promotionDesc-modal{
+    .promotionDesc-con{
+      max-height:600px;
+      overflow-y: scroll;
+      img{
+         width:100%;
+         height:auto;
+       }
+    }
+    .btn-cont {
+      text-align: center;
+      margin: 30px 0 0px;
+    }
+  }
+</style>