소스 검색

促销活动

chenrui 10 달 전
부모
커밋
c63a463acf

+ 22 - 0
src/api/promoActive.js

@@ -0,0 +1,22 @@
+import { axios } from '@/utils/request'
+
+//  促销活动 列表  有分页
+export const promoActiveList = (params) => {
+  const url = `/promoActive/ueryPage/${params.pageNo}/${params.pageSize}`
+  delete params.pageNo
+  delete params.pageSize
+  return axios({
+    url: url,
+    data: params,
+    method: 'post'
+  })
+}
+
+// 促销活动
+export const ticketCheckTicket = (params) => {
+  return axios({
+    url: '/ticket/checkTicket',
+    data: params,
+    method: 'post'
+  })
+}

+ 22 - 0
src/api/ticket.js

@@ -0,0 +1,22 @@
+import { axios } from '@/utils/request'
+
+//  优惠券详情 列表  有分页
+export const ticketQueryPage = (params) => {
+  const url = `/ticket/queryPage/${params.pageNo}/${params.pageSize}`
+  delete params.pageNo
+  delete params.pageSize
+  return axios({
+    url: url,
+    data: params,
+    method: 'post'
+  })
+}
+
+// 优惠券详情 核销
+export const ticketCheckTicket = (params) => {
+  return axios({
+    url: '/ticket/checkTicket',
+    data: params,
+    method: 'post'
+  })
+}

+ 6 - 6
src/config/router.config.js

@@ -3308,8 +3308,8 @@ export const asyncRouterMap = [
         component: PageView,
         meta: {
           title: '促销管理',
-          icon: 'contacts',
-          permission: 'M_promotionInfo'
+          icon: 'contacts'
+          // permission: 'M_promotionInfo'
         },
         children: [
           {
@@ -3319,8 +3319,8 @@ export const asyncRouterMap = [
             component: BlankLayout,
             meta: {
               title: '促销活动',
-              icon: 'contacts',
-              permission: 'M_promotionInfoList'
+              icon: 'contacts'
+              // permission: 'M_promotionInfoList'
             },
             hideChildrenInMenu: true,
             children: [
@@ -3331,8 +3331,8 @@ export const asyncRouterMap = [
                 meta: {
                   title: '促销活动列表',
                   icon: 'contacts',
-                  hidden: true,
-                  permission: 'M_promotionInfoList'
+                  hidden: true
+                  // permission: 'M_promotionInfoList'
                 }
               },
               {

+ 57 - 51
src/views/promotionManagement/couponDetails/list.vue

@@ -7,21 +7,21 @@
           <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-input id="couponDetails-queryWord" v-model.trim="queryParam.queryWord" 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="请输入客户名称"/>
+                <selectCust ref="custList" :isValidateEnabled="true" id="couponDetails-customerSn" @change="custChange" v-model="queryParam.customerSn"></selectCust>
               </a-form-item>
             </a-col>
             <a-col :md="6" :sm="24">
               <a-form-item label="券状态">
                 <v-select
-                  v-model="queryParam.state"
+                  v-model="queryParam.ticketState"
                   ref="sourceType"
-                  id="couponDetails-state"
-                  code="PROMO_STATE"
+                  id="couponDetails-ticketState"
+                  code="TICKET_STATE"
                   placeholder="请选择优惠券使用状态"
                   allowClear></v-select>
               </a-form-item>
@@ -45,30 +45,41 @@
         :scroll="{ y: tableHeight }"
         :defaultLoadData="false"
         bordered>
+        <!-- 有效期 -->
+        <template slot="dateBox" slot-scope="text, record">
+          <span v-if="record.validStartDate&&record.validEndDate">
+            {{ record.validStartDate }}-{{ record.validEndDate }}
+          </span>
+          <span v-else>--</span>
+        </template>
+        <!-- 优惠券状态 ticketState  已使用USED   未使用  UNUSED  已过期 DATED -->
         <template slot="action" slot-scope="text, record">
           <a-button
             size="small"
+            v-if="record.ticketState==='UNUSED'"
             type="link"
             class="button-success"
             @click="handleWriteoff(record)"
-            id="productOnlineInfoList-detail-btn">核销</a-button>
+            :id="'couponDetails-cancel-btn'+record.id">核销</a-button>
+          <span v-else>--</span>
         </template>
       </s-table>
     </a-spin>
     <!-- 核销 -->
-    <writeOffModal :openModal="openModal" @close="openModal = false"/>
+    <writeOffModal :itemObj="writeOffObj" :openModal="openModal" @ok="$refs.table.refresh()" @close="closeModal"/>
   </a-card>
 </template>
 
 <script>
 import { commonMixin } from '@/utils/mixin'
-import { promoTerminalList } from '@/api/promoTerminal'
+import { ticketQueryPage } from '@/api/ticket'
 import { STable, VSelect } from '@/components'
+import selectCust from '@/views/common/selectCust.vue'
 import writeOffModal from './writeOffModal.vue'
 
 export default {
   name: 'UrgentOffsetList',
-  components: { STable, VSelect, writeOffModal },
+  components: { STable, VSelect, writeOffModal, selectCust },
   mixins: [commonMixin],
   data () {
     return {
@@ -78,38 +89,36 @@ export default {
       openShowModal: false, // 促销展示弹窗
       time: [],
       queryParam: { //  查询条件
-        beginDate: undefined,
-        endDate: undefined,
-        name: '', //  促销名称
-        showFlag: undefined, // 显示状态
-        state: undefined// 促销状态
+        queryWord: undefined,
+        customerSn: undefined,
+        ticketState: undefined
       },
+      writeOffObj: null,
       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: '销售单号', dataIndex: 'usedBizNo', width: '12%', align: 'center', customRender: function (text) { return text || '--' } },
+        { title: '客户名称', dataIndex: 'customerName', width: '20%', align: 'center', customRender: function (text) { return text || '--' }, ellipsis: true },
+        { title: '券名称', dataIndex: 'ruleName', width: '20%', align: 'center', customRender: function (text) { return text || '--' }, ellipsis: true },
+        { title: '券副标题', dataIndex: 'ruleTitle', width: '20%', align: 'center', customRender: function (text) { return text || '--' } },
+        { title: '券金额', dataIndex: 'ticketValue', width: '10%', align: 'right', customRender: text => { return text || text == 0 ? this.toThousands(text, 2) : '--' } },
+        { title: '促销名称', dataIndex: 'promoActiveName', width: '20%', align: 'center', customRender: function (text) { return text || '--' }, ellipsis: true },
+        { title: '有效期', scopedSlots: { customRender: 'dateBox' }, width: '20%', align: 'center' },
+        { title: '券状态', dataIndex: 'ticketStateDictValue', 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 => {
+        return ticketQueryPage(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
           }
@@ -121,46 +130,45 @@ export default {
   },
   methods: {
     // 核销
-    handleWriteoff () {
+    handleWriteoff (row) {
+      this.writeOffObj = {
+        customerName: row.customerName,
+        ticketSn: row.ticketSn
+      }
       this.openModal = true
     },
-    //  时间  change
-    dateChange (date) {
-      this.queryParam.beginDate = date[0]
-      this.queryParam.endDate = date[1]
+    // 关闭核销弹窗
+    closeModal () {
+      this.writeOffObj = null
+      this.openModal = false
     },
-    // 查看促销描述
-    handleDescModal (row) {
-      this.descInfo = row.description
+    // 客户名称
+    custChange (obj) {
       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 })
-      })
+      if (obj && obj.key) {
+        const cust = obj.row
+        _this.queryParam.customerSn = cust.customerSn
+      } else {
+        _this.$refs.custList.resetForm()
+      }
     },
     //  重置
     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.queryParam.queryWord = undefined
+      this.queryParam.customerSn = undefined
+      this.queryParam.ticketState = undefined
+      this.$refs.custList.resetForm()
       this.$refs.table.refresh(true)
     },
+    // 初始化
     pageInit () {
       const _this = this
+      _this.resetSearchForm()
       this.$nextTick(() => { // 页面渲染完成后的回调
         _this.setTableH()
       })
     },
+    // 计算表格高度
     setTableH () {
       const tableSearchH = this.$refs.tableSearch.offsetHeight
       this.tableHeight = window.innerHeight - tableSearchH - 203
@@ -169,7 +177,6 @@ export default {
   mounted () {
     if (!this.$store.state.app.isNewTab) { // 页签刷新时调用
       this.pageInit()
-      this.resetSearchForm()
     }
   },
   watch: {
@@ -181,7 +188,6 @@ export default {
     // 如果是新页签打开,则重置当前页面
     if (this.$store.state.app.isNewTab) {
       this.pageInit()
-      this.resetSearchForm()
     }
     // 只刷新列表
     if (this.$store.state.app.updateList) {

+ 34 - 19
src/views/promotionManagement/couponDetails/writeOffModal.vue

@@ -6,6 +6,7 @@
     :maskClosable="false"
     title="核销"
     v-model="isShow"
+    :rules="rules"
     @cancel="isShow=false"
     :width="450">
     <div class="writeOffCon">
@@ -13,27 +14,27 @@
         id="writeOffModal-form"
         ref="ruleForm"
         :model="form"
-        :rules="rules"
+
         :label-col="formItemLayout.labelCol"
         :wrapper-col="formItemLayout.wrapperCol" >
         <a-form-model-item label="客户名称" prop="purchaseTargetSn">
-          西安大兴
+          {{ itemObj&&itemObj.customerName?itemObj.customerName:'--' }}
         </a-form-model-item>
         <a-form-model-item label="核销码" prop="settleStyleSn">
-          <a-input id="writeOffModal-customerName" v-model.trim="form.customerName" allowClear placeholder="请输入该客户的销售单号核销"/>
+          <a-input id="writeOffModal-customerName" v-model.trim="form.usedBizNo" 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>
+      <a-button type="primary" id="writeOff-modal-back" @click="submitSave" >确定</a-button>
     </div>
   </a-modal>
 </template>
 
 <script>
 import { commonMixin } from '@/utils/mixin'
-import { promoTerminalDetail } from '@/api/promoTerminal'
+import { ticketCheckTicket } from '@/api/ticket'
 export default {
   name: 'WriteOffModal',
   mixins: [commonMixin],
@@ -41,37 +42,51 @@ export default {
     openModal: { //  弹框显示状态
       type: Boolean,
       default: false
+    },
+    itemObj: {
+      type: Object,
+      default: () => {
+        return {}
+      }
     }
   },
   data () {
     return {
-      modalTit: '促销展示',
       isShow: this.openModal, //  是否打开弹框
-      mainContent: '', // 主要显示内容
-      showType: undefined,
       formItemLayout: {
         labelCol: { span: 4 },
         wrapperCol: { span: 18 }
       },
       form: {
-        customerName: undefined
+        usedBizNo: undefined
       },
-      rules: []
+      rules: {
+        usedBizNo: [
+          { required: true, message: '请输入核销码', trigger: 'blur' }
+        ]
+      }
     }
   },
   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
+    submitSave () {
+      const _this = this
+      _this.$refs.ruleForm.validate(valid => {
+        if (valid) {
+          this.form.ticketSn = this.itemObj.ticketSn
+          ticketCheckTicket(this.form).then(res => {
+            if (res.status == 200) {
+              _this.$message.success(res.message)
+              _this.$emit('ok')
+            }
           })
+        } else {
+          return false
         }
       })
+    },
+    reSetData () {
+      this.form.usedBizNo = undefined
+      this.$refs.ruleForm.resetFields()
     }
   },
   watch: {

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

@@ -123,7 +123,7 @@
 
 <script>
 import { commonMixin } from '@/utils/mixin'
-import { promoTerminalList } from '@/api/promoTerminal'
+import { promoActiveList } from '@/api/promoActive'
 import { STable, VSelect } from '@/components'
 import rangeDate from '@/views/common/rangeDate.vue'
 import promotionDescModal from './promotionDescModal'
@@ -164,14 +164,14 @@ export default {
       loadData: parameter => {
         this.disabled = true
         this.spinning = true
-        return promoTerminalList(Object.assign(parameter, this.queryParam)).then(res => {
+        return promoActiveList(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(',') : []
+              // data.list[i].images = data.list[i].images ? data.list[i].images.split(',') : []
             }
             this.disabled = false
           }