|
|
@@ -0,0 +1,207 @@
|
|
|
+<!-- @desc:优惠卷 @auth:常皓宁 @time:2024-7-24 9:28 -->
|
|
|
+<template>
|
|
|
+ <div class="main-div" ref="mainDiv">
|
|
|
+ <loading :loading="loading" v-if="!modalVisible"></loading>
|
|
|
+ <BaseIndexButtonGroup ref="BaseIndexButtonGroup" id="BaseIndexButtonGroup">
|
|
|
+ <template #left>
|
|
|
+ <BaseIndexButton ref="search" name="search"></BaseIndexButton>
|
|
|
+ <BaseIndexButton ref="clear" name="clear"></BaseIndexButton>
|
|
|
+ <BaseIndexButton ref="edit" name="edit"></BaseIndexButton>
|
|
|
+ <!-- 启用 -->
|
|
|
+ <BaseIndexButton ref="enable" name="enable"></BaseIndexButton>
|
|
|
+ <!-- 停用 -->
|
|
|
+ <BaseIndexButton ref="disable" name="disable"></BaseIndexButton>
|
|
|
+ </template>
|
|
|
+ <template #right>
|
|
|
+ <BaseIndexButton ref="add" name="add"></BaseIndexButton>
|
|
|
+ </template>
|
|
|
+ </BaseIndexButtonGroup>
|
|
|
+ <!-- 查询条件区域 -->
|
|
|
+ <div id="search-cond-div" ref="search-cond-div" class="search-cond-class">
|
|
|
+ <SearchCond ref="searchCond" v-model="searchCond"
|
|
|
+ @collapse-change="collapseChange" :setFlag="false"
|
|
|
+ :searchContent="searchContent"
|
|
|
+ ></SearchCond>
|
|
|
+ </div>
|
|
|
+
|
|
|
+ <!-- 表格部分 -->
|
|
|
+ <div slot="top" style="margin-left: 5px;">
|
|
|
+ <DkTable ref="table-select" name="table" :data="tableData" primaryKey="couponId"
|
|
|
+ @pageChange="pageSizeChange"
|
|
|
+ :page-total="pageInfo.total"
|
|
|
+ :page-size="pageInfo.pageSize"
|
|
|
+ :page-size-opts="pageSizeOpts"
|
|
|
+ :current-page="pageInfo.currentPage"
|
|
|
+ :choose-flag="false"
|
|
|
+ :height="this.tableHeight" showFooter>
|
|
|
+ <DkTableColumn field="couponName"></DkTableColumn>
|
|
|
+ <DkTableColumn field="couponDesc"></DkTableColumn>
|
|
|
+ <DkTableColumn field="discount"/>
|
|
|
+ <DkTableColumn field="useValidDays"/>
|
|
|
+ <DkTableColumn field="userNum"></DkTableColumn>
|
|
|
+ <DkTableColumn field="gradeName"/>
|
|
|
+ <DkTableColumn field="flgValid" type="switch" ></DkTableColumn>
|
|
|
+ </DkTable>
|
|
|
+ </div>
|
|
|
+
|
|
|
+ <!--新建编辑总单-->
|
|
|
+ <DkModal
|
|
|
+ :loading="loading"
|
|
|
+ v-model="editAddModal"
|
|
|
+ ref="modal_editAdd"
|
|
|
+ @on-visible-change="handleVisibleModal"
|
|
|
+ @modalOk="save"
|
|
|
+ :saveFlag="true"
|
|
|
+ :title="modalTitle"
|
|
|
+ >
|
|
|
+ <DkForm ref="formInline" v-model="formData" :col-count="1" :labelMaxWords="6">
|
|
|
+ <!--系统版本-->
|
|
|
+ <DkFormItem prop="gradeCode">
|
|
|
+ <SelectPop v-model="formData.gradeCode" ref="gradeCode"
|
|
|
+ :options="gradeList"
|
|
|
+ :multiple="false"
|
|
|
+ labelKey="gradeName" valueKey="gradeCode">
|
|
|
+ </SelectPop>
|
|
|
+ </DkFormItem>
|
|
|
+ <!--优惠券名称-->
|
|
|
+ <DkFormItem prop="couponName" :required="true">
|
|
|
+ <InputPop v-model="formData.couponName"/>
|
|
|
+ </DkFormItem>
|
|
|
+ <!--优惠券描述-->
|
|
|
+ <DkFormItem prop="couponDesc">
|
|
|
+ <InputPop v-model="formData.couponDesc" :textareaFlag="true"/>
|
|
|
+ </DkFormItem>
|
|
|
+ <!--折扣-->
|
|
|
+ <DkFormItem prop="discount" :required="true" data-type="number">
|
|
|
+ <InputNumberPop v-model="formData.discount" :digits="2"/>
|
|
|
+ </DkFormItem>
|
|
|
+ <!--使用有效期-->
|
|
|
+ <DkFormItem prop="useValidDays" :required="true" data-type="number">
|
|
|
+ <InputNumberPop v-model="formData.useValidDays" :unit="'天'"/>
|
|
|
+ </DkFormItem>
|
|
|
+ <!--所需人数-->
|
|
|
+ <DkFormItem prop="userNum" :required="true" data-type="number">
|
|
|
+ <InputNumberPop v-model="formData.userNum"/>
|
|
|
+ </DkFormItem>
|
|
|
+ </DkForm>
|
|
|
+ </DkModal>
|
|
|
+ </div>
|
|
|
+</template>
|
|
|
+
|
|
|
+<script>
|
|
|
+import {indexMixin} from '@/mixins'
|
|
|
+
|
|
|
+export default {
|
|
|
+ name: "coupon",
|
|
|
+ mixins: [indexMixin],
|
|
|
+ data() {
|
|
|
+ let self = this
|
|
|
+ return {
|
|
|
+ tableData:[],
|
|
|
+ gradeList:[],
|
|
|
+ formData: {
|
|
|
+ couponName:null,
|
|
|
+ couponDesc:null,
|
|
|
+ discount:null,
|
|
|
+ useValidDays:null,
|
|
|
+ userNum:null,
|
|
|
+ gradeCode:null,
|
|
|
+ },
|
|
|
+ searchContent: [
|
|
|
+ {
|
|
|
+ itemCode: 'couponName',
|
|
|
+ },
|
|
|
+ self.$config.flgValidSearch // 有效标识
|
|
|
+ ],
|
|
|
+ }
|
|
|
+ },
|
|
|
+ methods:{
|
|
|
+ /**
|
|
|
+ * @desc : 查询数据
|
|
|
+ * @author : 常皓宁
|
|
|
+ * @date : 2024/7/24 9.28
|
|
|
+ */
|
|
|
+ getData(params) {
|
|
|
+ this.tableData = [];
|
|
|
+ return this.excute(this.$service.couponService, this.$service.couponService.selectByCond, params)
|
|
|
+ },
|
|
|
+
|
|
|
+ /**
|
|
|
+ * @desc : 提交事件
|
|
|
+ * @author : 常皓宁
|
|
|
+ * @date : 2024/7/24 9.28
|
|
|
+ */
|
|
|
+ saveData() {
|
|
|
+ let params = {...this.formData}
|
|
|
+ console.log('this.params', this.params)
|
|
|
+ if (this.modalParams.button === this.$config.formMode.add) {
|
|
|
+ delete this.params.tacticId // 解决提示主键重复的问题,删除主键代码
|
|
|
+ return this.excute(this.$service.couponService, this.$service.couponService.insert, params)
|
|
|
+ } else {
|
|
|
+ return this.excute(this.$service.couponService, this.$service.couponService.update, params)
|
|
|
+ }
|
|
|
+ },
|
|
|
+
|
|
|
+ /**
|
|
|
+ * @desc : 清空窗体
|
|
|
+ * @author : 常皓宁
|
|
|
+ * @date : 2024/7/24 9.28
|
|
|
+ */
|
|
|
+ clear() {
|
|
|
+ this.formData = {
|
|
|
+ couponName:null,
|
|
|
+ couponDesc:null,
|
|
|
+ discount:null,
|
|
|
+ useValidDays:null,
|
|
|
+ userNum:null,
|
|
|
+ gradeCode:null,
|
|
|
+ }
|
|
|
+ },
|
|
|
+
|
|
|
+ /**
|
|
|
+ * @desc : 通过id查询
|
|
|
+ * @author : 常皓宁
|
|
|
+ * @date : 2024/7/24 9.28
|
|
|
+ */
|
|
|
+ detail(id) {
|
|
|
+ return this.excuteNoParam(this.$service.couponService, this.$service.couponService.selectById, [id], false).then(res => {
|
|
|
+ this.formData = res.data
|
|
|
+ })
|
|
|
+ },
|
|
|
+
|
|
|
+ /**
|
|
|
+ * @desc : 获取版本代码
|
|
|
+ * @author : 常皓宁
|
|
|
+ * @date : 2024/7/24 9.28
|
|
|
+ */
|
|
|
+ getGrade(){
|
|
|
+ // 查询数据
|
|
|
+ let params = {
|
|
|
+ }
|
|
|
+ this.excute(this.$service.commonService, this.$service.commonService.getGrade, params).then(res => {
|
|
|
+ if (res.code === this.$config.SUCCESS_CODE) {
|
|
|
+ this.gradeList = res.data
|
|
|
+ }
|
|
|
+ })
|
|
|
+ },
|
|
|
+
|
|
|
+ /**
|
|
|
+ * @desc : 加载数据
|
|
|
+ * @author : 常皓宁
|
|
|
+ * @date : 2024/7/24 10:09
|
|
|
+ */
|
|
|
+ initData() {
|
|
|
+ this.getGrade()
|
|
|
+ },
|
|
|
+ },
|
|
|
+ created() {
|
|
|
+ this.primaryKey = 'couponId' // 设置主键Id
|
|
|
+ this.routeObjName = 'coupon'// 设置路由名称
|
|
|
+ this.comHandleEnableFlag = true; // 开启启用停用功能
|
|
|
+ }
|
|
|
+}
|
|
|
+</script>
|
|
|
+
|
|
|
+<style scoped>
|
|
|
+
|
|
|
+</style>
|