Browse Source

优惠券列表

chenrui 11 months ago
parent
commit
dd374519ee

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

@@ -3336,6 +3336,31 @@ export const asyncRouterMap = [
                 }
               }
             ]
+          },
+          {
+            path: '/promotionManagement/couponDetails',
+            redirect: '/promotionManagement/couponDetails/list',
+            name: 'couponDetails',
+            component: BlankLayout,
+            meta: {
+              title: '优惠券详情',
+              icon: 'contacts'
+              // permission: 'M_couponDetailsList'
+            },
+            hideChildrenInMenu: true,
+            children: [
+              {
+                path: 'list',
+                name: 'couponDetailsList',
+                component: () => import(/* webpackChunkName: "productManagement" */ '@/views/promotionManagement/couponDetails/list.vue'),
+                meta: {
+                  title: '优惠券详情',
+                  icon: 'contacts',
+                  hidden: true
+                  // permission: 'M_couponDetailsList'
+                }
+              }
+            ]
           }
         ]
       },

+ 218 - 0
src/views/promotionManagement/couponDetails/list.vue

@@ -0,0 +1,218 @@
+<template>
+  <a-card size="small" :bordered="false" class="jg-page-wrap couponDetails-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="券名称/券副标题">
+                <a-input id="couponDetails-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="couponDetails-customerName" v-model.trim="queryParam.customerName" allowClear placeholder="请输入客户名称"/>
+              </a-form-item>
+            </a-col>
+            <a-col :md="6" :sm="24">
+              <a-form-item label="券状态">
+                <v-select
+                  v-model="queryParam.state"
+                  ref="sourceType"
+                  id="couponDetails-state"
+                  code="PROMO_STATE"
+                  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="couponDetails-refresh">查询</a-button>
+              <a-button style="margin-left: 8px" @click="resetSearchForm" :disabled="disabled" id="couponDetails-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="action" slot-scope="text, record">
+          <a-button
+            size="small"
+            type="link"
+            class="button-success"
+            @click="handleWriteoff(record)"
+            id="productOnlineInfoList-detail-btn">核销</a-button>
+        </template>
+      </s-table>
+    </a-spin>
+    <!-- 核销 -->
+    <writeOffModal :openModal="openModal" @close="openModal = false"/>
+  </a-card>
+</template>
+
+<script>
+import { commonMixin } from '@/utils/mixin'
+import { promoTerminalList } from '@/api/promoTerminal'
+import { STable, VSelect } from '@/components'
+import writeOffModal from './writeOffModal.vue'
+
+export default {
+  name: 'UrgentOffsetList',
+  components: { STable, VSelect, writeOffModal },
+  mixins: [commonMixin],
+  data () {
+    return {
+      spinning: false,
+      tableHeight: 0,
+      openModal: false, // 核销弹窗
+      openShowModal: false, // 促销展示弹窗
+      time: [],
+      queryParam: { //  查询条件
+        beginDate: undefined,
+        endDate: undefined,
+        name: '', //  促销名称
+        showFlag: undefined, // 显示状态
+        state: undefined// 促销状态
+      },
+      descInfo: '', // 促销描述
+      disabled: false, //  查询、重置按钮是否可操作
+      columns: [
+        { title: '序号', dataIndex: 'no', width: '4%', align: 'center' },
+        { title: '销售单号', dataIndex: 'createDate', width: '14%', align: 'center', customRender: function (text) { return text || '--' } },
+        { title: '客户名称', dataIndex: 'name1', width: '24%', align: 'center', customRender: function (text) { return text || '--' }, ellipsis: true },
+        { title: '券名称', dataIndex: 'name2', width: '24%', align: 'center', customRender: function (text) { return text || '--' }, ellipsis: true },
+        { title: '券副标题', dataIndex: 'name3', width: '24%', align: 'center', customRender: function (text) { return text || '--' } },
+        { title: '终端价', dataIndex: 'terminalPrice', width: '6%', align: 'right', customRender: function (text) { return text || text == 0 ? this.toThousands(text, 2) : '--' } },
+        { title: '促销名称', dataIndex: 'name', width: '24%', align: 'center', customRender: function (text) { return text || '--' }, ellipsis: true },
+        { title: '有效期', dataIndex: 'stateDictValue1', width: '10%', align: 'center', customRender: function (text) { return text || '--' } },
+        { title: '券状态', dataIndex: 'stateDictValue', width: '10%', align: 'center', customRender: function (text) { return text || '--' } },
+        { title: '操作', scopedSlots: { customRender: 'action' }, width: '8%', align: 'center' }
+      ],
+      // 加载数据方法 必须为 Promise 对象
+      loadData: parameter => {
+        this.disabled = true
+        this.spinning = true
+        return promoTerminalList(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
+              data.list[i].images = data.list[i].images ? data.list[i].images.split(',') : []
+            }
+            this.disabled = false
+          }
+          this.spinning = false
+          return data
+        })
+      }
+    }
+  },
+  methods: {
+    // 核销
+    handleWriteoff () {
+      this.openModal = true
+    },
+    //  时间  change
+    dateChange (date) {
+      this.queryParam.beginDate = date[0]
+      this.queryParam.endDate = date[1]
+    },
+    // 查看促销描述
+    handleDescModal (row) {
+      this.descInfo = row.description
+      const _this = this
+      this.$nextTick(() => {
+        _this.openDescModal = true
+      })
+    },
+    // 促销展示
+    handleSaleShow (row) {
+      const _this = this
+      _this.openShowModal = true
+      this.$nextTick(() => {
+        _this.$refs.promotionShow.getDetail({ id: row.promoActiveSn, showType: row.contentType })
+      })
+    },
+    //  重置
+    resetSearchForm () {
+      this.$refs.rangeDate.resetDate(this.time)
+      this.queryParam.beginDate = undefined
+      this.queryParam.endDate = undefined
+      this.queryParam.name = ''
+      this.queryParam.showFlag = undefined
+      this.queryParam.state = undefined
+      this.$refs.table.refresh(true)
+    },
+    pageInit () {
+      const _this = this
+      this.$nextTick(() => { // 页面渲染完成后的回调
+        _this.setTableH()
+      })
+    },
+    setTableH () {
+      const tableSearchH = this.$refs.tableSearch.offsetHeight
+      this.tableHeight = window.innerHeight - tableSearchH - 203
+    }
+  },
+  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">
+  .couponDetails-wrap{
+    .red{
+      color: #ed1c24;
+    }
+    .green{
+      color: #19be6b;
+    }
+    .font1{
+     color:#39f;
+    }
+    .desc{
+      width: 100%;
+      overflow: hidden;
+      text-overflow: ellipsis;
+      display: -webkit-box;
+      -webkit-line-clamp: 3;
+      -webkit-box-orient: vertical;
+    }
+  }
+</style>

+ 127 - 0
src/views/promotionManagement/couponDetails/writeOffModal.vue

@@ -0,0 +1,127 @@
+<template>
+  <a-modal
+    centered
+    class="writeOff-modal"
+    :footer="null"
+    :maskClosable="false"
+    title="核销"
+    v-model="isShow"
+    @cancel="isShow=false"
+    :width="450">
+    <div class="writeOffCon">
+      <a-form-model
+        id="writeOffModal-form"
+        ref="ruleForm"
+        :model="form"
+        :rules="rules"
+        :label-col="formItemLayout.labelCol"
+        :wrapper-col="formItemLayout.wrapperCol" >
+        <a-form-model-item label="客户名称" prop="purchaseTargetSn">
+          西安大兴
+        </a-form-model-item>
+        <a-form-model-item label="核销码" prop="settleStyleSn">
+          <a-input id="writeOffModal-customerName" v-model.trim="form.customerName" allowClear placeholder="请输入该客户的销售单号核销"/>
+        </a-form-model-item>
+      </a-form-model>
+    </div>
+    <div class="btn-cont">
+      <a-button style="margin-right:10px;" id="writeOff-modal-back" @click="isShow = false">取消</a-button>
+      <a-button type="primary" id="writeOff-modal-back" @click="isShow = false" >确定</a-button>
+    </div>
+  </a-modal>
+</template>
+
+<script>
+import { commonMixin } from '@/utils/mixin'
+import { promoTerminalDetail } from '@/api/promoTerminal'
+export default {
+  name: 'WriteOffModal',
+  mixins: [commonMixin],
+  props: {
+    openModal: { //  弹框显示状态
+      type: Boolean,
+      default: false
+    }
+  },
+  data () {
+    return {
+      modalTit: '促销展示',
+      isShow: this.openModal, //  是否打开弹框
+      mainContent: '', // 主要显示内容
+      showType: undefined,
+      formItemLayout: {
+        labelCol: { span: 4 },
+        wrapperCol: { span: 18 }
+      },
+      form: {
+        customerName: undefined
+      },
+      rules: []
+    }
+  },
+  methods: {
+    getDetail (con) {
+      const ajaxData = {
+        id: con.id
+      }
+      promoTerminalDetail(ajaxData).then(res => {
+        if (res.status == 200) {
+          this.$nextTick(() => {
+            this.showType = res.data.contentType
+            this.mainContent = res.data.content
+          })
+        }
+      })
+    }
+  },
+  watch: {
+    //  父页面传过来的弹框状态
+    openModal (newValue, oldValue) {
+      this.isShow = newValue
+    },
+    //  重定义的弹框状态
+    isShow (newValue, oldValue) {
+      if (!newValue) {
+        this.$emit('close')
+      }
+    }
+  }
+}
+</script>
+
+<style lang="less" scoped>
+  .writeOff-modal{
+    /deep/.ant-modal-body{
+       text-algin:center !important;
+    }
+
+    .writeOff-con{
+      width:340px;
+      margin:0 auto;
+      position:relative;
+      text-align: center;
+      img{
+         width:81%;
+         height:auto;
+       }
+       .writeOffCon{
+         position: absolute;
+         left:15%;
+         top:12.5%;
+         width: 70%;
+         max-height:420px;
+         overflow-y: scroll;
+         scrollbar-width:none;
+         -ms-overflow-style: none;
+       }
+       .writeOffCon::-webkit-scrollbar{
+           display:none;
+       }
+    }
+
+    .btn-cont {
+      text-align: center;
+      margin: 30px 0 0px;
+    }
+  }
+</style>

+ 1 - 1
src/views/promotionManagement/promotionInfo/list.vue

@@ -191,7 +191,7 @@ export default {
     },
     setTableH () {
       const tableSearchH = this.$refs.tableSearch.offsetHeight
-      this.tableHeight = window.innerHeight - tableSearchH - 195
+      this.tableHeight = window.innerHeight - tableSearchH - 203
     }
   },
   mounted () {

+ 1 - 0
src/views/salesManagement/salesQuery/detail.vue

@@ -66,6 +66,7 @@
               折后总售价:<strong>{{ detailData&&(detailData.discountedAmount || detailData.discountedAmount==0) ? toThousands(detailData.discountedAmount) : '--' }}</strong>;
               折扣:<strong>{{ detailData&&(detailData.discountRate || detailData.discountRate==0) ? detailData.discountRate+'%' : '--' }}</strong>;
               折扣金额:<strong>{{ detailData&&(detailData.discountAmount || detailData.discountAmount==0) ? toThousands(detailData.discountAmount) : '--' }}</strong>;
+              已发放券金额:<strong>{{ detailData&&(detailData.discountAmount || detailData.discountAmount==0) ? toThousands(detailData.discountAmount) : '--' }}</strong>;
             </div>
             <div>
               <a-checkbox v-model="showCost" v-if="$hasPermissions('M_ShowAllCost')" id="salesQuery-cost">成本价</a-checkbox>