doum
2 天以前 d8689abdb2378bdd1c97317ca881173eca26283c
经销商管理
已添加2个文件
已修改14个文件
1029 ■■■■ 文件已修改
admin/src/api/business/goods.js 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
admin/src/assets/style/style.scss 5 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
admin/src/components/business/OperaCouponGoodsWindow.vue 264 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
admin/src/components/business/OperaCouponWindow.vue 267 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
admin/src/views/business/coupon.vue 59 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
admin/src/views/business/integralRuleSet.vue 265 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
server/dmmall_admin/src/main/java/com/doumee/api/business/GoodsController.java 6 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
server/dmmall_service/src/main/java/com/doumee/core/utils/Constants.java 9 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
server/dmmall_service/src/main/java/com/doumee/dao/business/model/Coupon.java 13 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
server/dmmall_service/src/main/java/com/doumee/dao/business/model/Goods.java 3 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
server/dmmall_service/src/main/java/com/doumee/dao/business/model/Goodsorder.java 2 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
server/dmmall_service/src/main/java/com/doumee/dao/system/SystemDictDataMapper.java 3 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
server/dmmall_service/src/main/java/com/doumee/dao/system/dto/PlatformConfigDTO.java 10 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
server/dmmall_service/src/main/java/com/doumee/service/business/impl/CouponServiceImpl.java 30 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
server/dmmall_service/src/main/java/com/doumee/service/business/impl/GoodsServiceImpl.java 9 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
server/dmmall_service/src/main/java/com/doumee/service/system/impl/SystemDictDataServiceImpl.java 79 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
admin/src/api/business/goods.js
@@ -6,6 +6,11 @@
    trim: true
  })
}
export function allList (data) {
  return request.post('/business/goods/list', data, {
    trim: true
  })
}
export function detail (id) {
  return request.get(`/business/goods/${id}`)
}
admin/src/assets/style/style.scss
@@ -54,11 +54,14 @@
.red{
  color: red;
}
.grey{
  color: grey;
}
.green{
  color: green;
}
.blue{
  color: blue;
  color: #216EEE;
}.orange{
   color: orange;
 }
admin/src/components/business/OperaCouponGoodsWindow.vue
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,264 @@
<template>
  <GlobalWindow
    :title="title"
    width="80%"
    :visible.sync="visible"
    @confirm="confirm"
  >
    <TableLayout :permissions="['business:goods:query']">
      <!-- æœç´¢è¡¨å• -->
      <el-form ref="searchForm" slot="search-form" :model="searchForm" label-width="100px" style="display: block;" >
        <el-form-item label="" prop="name" label-width="5px" style="display: inline-block;margin-right: 30px;">
          <el-input v-model="searchForm.name" style="width: 150px;" placeholder="商品名称" clearable @keypress.enter.native="search"></el-input>
        </el-form-item>
        <el-form-item label="" prop="categoryId" label-width="5px" style="display: inline-block;margin-right: 30px;" >
          <el-select v-model="searchForm.categoryId" placeholder="所属分类"    clearable style="width: 150px;"  >
            <el-option  v-for="item in labels"  :key="item.id" :value="item.id"  :label="item.name" ></el-option>
          </el-select>
        </el-form-item>
        <el-form-item label="" prop="brandId" label-width="5px" style="display: inline-block">
          <el-select  v-model="searchForm.brandId"  placeholder="所属品牌"  style="width: 150px;"   >
            <el-option  v-for="item in brands"   :key="item.id"   :value="item.id"  :label="item.name"    clearable ></el-option>
          </el-select>
        </el-form-item>
        <section>
          <el-button type="primary" @click="search">搜索</el-button>
          <el-button @click="reset">重置</el-button>
        </section>
      </el-form>
      <!-- è¡¨æ ¼å’Œåˆ†é¡µ -->
      <template v-slot:table-wrap>
        <div :style="'display: flex;height:'+tabelHeight+'px;'">
          <div style="flex: 6;">
            <ul class="toolbar">
              <li><el-button type="primary"  icon="el-icon-plus"  @click="addAll()" :disabled="!(tableData.selectedRows &&  tableData.selectedRows.length)">批量添加</el-button></li>
            </ul>
          <el-table
              ref="singleTable"
              :height="tabelHeight-80"
              v-loading="isWorking.search"
              :data="tableData.list"
              stripe
              border
              @selection-change="handleSelectionChange"
          >
            <el-table-column type="selection"  :selectable="checkSelectable" width="55"></el-table-column>
            <el-table-column prop="imgurl" label="列表图" min-width="70px">
              <template slot-scope="{row}">
                <el-image style="width: 50px;height: 50px;" v-if="row.imgurl && row.imgurl!=''" :src="row.resourcePath+row.imgurl" :preview-src-list="[row.resourcePath+row.imgurl]"></el-image>
              </template>
            </el-table-column>
            <el-table-column prop="id" label="商品ID"   ></el-table-column>
            <el-table-column prop="name" label="商品名称"   show-overflow-tooltip></el-table-column>
            <el-table-column prop="categoryName" label="所属分类"  ></el-table-column>
            <el-table-column prop="brandName" label="所属品牌"  ></el-table-column>
            <el-table-column prop="price" label="展示价格"  ></el-table-column>
            <el-table-column prop="skuPrice" label="零售价(元)" ></el-table-column>
            <el-table-column  label="操作"   align="center" min-width="80px"   fixed="right"  >
              <template slot-scope="{ row }">
                <el-button style="color: red"  v-if="row.tabStatus === 2" type="text" icon="el-icon-delete" @click="delItem(row)">移除</el-button>
                <el-button v-else type="text" icon="el-icon-plus" @click="add(row)">添加</el-button>
              </template>
            </el-table-column>
          </el-table>
          <pagination
              @size-change="handleSizeChange"
              @current-change="handlePageChange"
              :pagination="tableData.pagination"
          >
          </pagination>
          </div>
          <div  style="flex: 2;margin-left: 20px;border: 1px solid #f2f2f2;padding: 10px;font-size: 12px;">
              <div style="display: flex;">
                <div style="flex: 6"> <span>已选择<i class="blue" style="margin: 0 10px">{{selectGoods.length||0}}</i>件商品</span></div>
                <div style="flex: 1;text-align: right"> <el-button size="mini" type="danger" class="blue" @click="cleanAll">清空</el-button></div>
              </div>
              <div :style="`display: flex;flex-direction: column;max-height: ${tabelHeight-80}px;overflow: auto`">
                <div  v-for="(item,index) in selectGoods" style="display: flex;margin: 10px 0;" :key="'selGoods'+item.id">
                  <div style="flex: 6">{{item.name}}<br><span class="red">ï¿¥{{item.skuPrice || 0}}</span></div>
                  <div style="flex: 1;text-align: right;">
                    <el-button class="blue" style="border: none;color: red" icon="el-icon-delete" @click="del(item,index)"></el-button>
                  </div>
                </div>
              </div>
          </div>
        </div>
      </template>
    </TableLayout>
  </GlobalWindow>
</template>
<script>
import GlobalWindow from '@/components/common/GlobalWindow'
import BaseTable from '@/components/base/BaseTable'
import TableLayout from '@/layouts/TableLayout'
import Pagination from '@/components/common/Pagination'
import { findAll as labelList } from '@/api/business/labels'
export default {
  name: 'OperaCouponGoodsWindow',
  extends: BaseTable,
  components: { GlobalWindow, TableLayout, Pagination },
  data () {
    return {
      activeName: 'first',
      title: '',
      visible: false,
      tabelHeight: null,
      // æœç´¢
      searchForm: {
        name: '',
        categoryId: '',
        brandId: '',
        type: '0', // å¹³å°å•†å“
        status: '',
        isrec: '',
        labels: ''
      },
      labels: [],
      serials: [],
      brands: [],
      selectGoods: []
    }
  },
  mounted() {
    window.addEventListener('resize', this.handleResize);
  },
  beforeDestroy() {
    window.removeEventListener('resize', this.handleResize);
  },
  created () {
    this.config({
      module: '商品信息表',
      api: '/business/goods',
      'field.id': 'id',
      'field.main': 'id'
    })
    labelList({
      type: 0 // å•†å“åˆ†ç±»
    }).then(res => {
      this.labels = res
    })
    labelList({
      type: 1 // å•†å“å“ç‰Œ
    })
      .then(res => {
        this.brands = res
      })
    this.handleResize()
  },
  methods: {
    handleResize(){
      this.tabelHeight = window.innerHeight - 300
    },
    checkSelectable (row) {
      return row.tabStatus !== 2
    },
    addAll () {
      if (this.tableData.selectedRows && this.tableData.selectedRows.length) {
        this.tableData.selectedRows.forEach(item => {
          this.add(item)
        })
        this.$nextTick(() => {
          if (this.$refs.singleTable) {
            this.$refs.singleTable.clearSelection()
          }
        })
      }
    },
    cleanAll () {
      this.selectGoods = []
      this.tableData.list.forEach(item => {
        item.tabStatus = 1
      })
      this.$nextTick(() => {
        if (this.$refs.singleTable) {
          this.$refs.singleTable.clearSelection()
        }
      })
    },
    add (row) {
      var add = true
      row.tabStatus = 2
      console.log(this.tableData.list)
      this.selectGoods.forEach(item => {
        if (item.id === row.id) {
          add = false
        }
      })
      if (add) {
        this.selectGoods.push(row)
      }
    },
    del (row, index) {
      this.selectGoods.splice(index, 1)
      this.tableData.list.forEach(item => {
        if (item.id === row.id) {
          item.tabStatus = 1
        }
      })
    },
    delItem (delItem) {
      this.selectGoods.forEach((item, index) => {
        if (item.id === delItem.id) {
          this.del(item, index)
        }
      })
    },
    confirm () {
      this.$emit('success', this.selectGoods)
      this.visible = false
    },
    open (title, goods) {
      this.title = title
      this.visible = true
      this.cleanAll()
      if (goods && goods.length) {
        goods.forEach(item => {
          this.selectGoods.push(item)
        })
      }
      this.search()
    },
    handlePageChange (pageIndex) {
      this.__checkApi()
      this.tableData.pagination.pageIndex = pageIndex || this.tableData.pagination.pageIndex
      this.isWorking.search = true
      this.api.fetchList({
        page: this.tableData.pagination.pageIndex,
        capacity: this.tableData.pagination.pageSize,
        model: this.searchForm,
        sorts: this.tableData.sorts
      })
        .then(data => {
          this.tableData.list = data.records || []
          this.tableData.pagination.total = data.total
          this.tableData.list.forEach(item => {
            item.tabStatus = 1
            this.selectGoods.forEach(row => {
              if (item.id === row.id) {
                item.tabStatus = 2
              }
            })
          })
        })
        .catch(e => {
          this.$tip.apiFailed(e)
        })
        .finally(() => {
          this.isWorking.search = false
        })
    },
    goPriceSet (row) {
    },
    handleClick (val) {
    }
  }
}
</script>
<style scoped>
.table-pagination{
  position: fixed !important;
  bottom: 50px;
}
</style>
admin/src/components/business/OperaCouponWindow.vue
@@ -1,116 +1,121 @@
<template>
  <GlobalAlertWindow
    :title="title"
    :visible.sync="visible"
    :confirm-working="isWorking"
    @confirm="confirm"
  <GlobalWindow
      :title="title"
      width="80%"
      :visible.sync="visible"
      :confirm-working="isWorking"
      @confirm="confirm"
  >
    <el-form :model="form" ref="form" :rules="rules" label-width="120px" label-suffix=":" inline>
      <p class="tip-header" >基本属性</p>
      <el-form-item label="优惠券名称" prop="name">
        <el-input v-model="form.name" placeholder="请输入优惠券名称" :maxlength="12" v-trim/>
      </el-form-item>
      <el-form-item label="优惠券说明" prop="info">
        <el-input v-model="form.info" placeholder="请输入优惠券说明" :maxlength="30" v-trim/>
      <el-form-item label="类型" prop="couponType">
          <el-radio-group v-model="form.couponType">
            <el-radio :label="0" >满减券</el-radio>
            <el-radio :label="1">折扣券</el-radio>
          </el-radio-group>
      </el-form-item>
      <el-form-item label="优惠规则" prop="couponRule">
      <el-form-item label="优惠规则" prop="couponRule" >
        <div class="coupon-rule">
          <div class="discrep">订单满</div>
          <el-input
            v-model="form.limitPrice"
            placeholder="请输入"
            @input="inputAction(form, 'limitPrice')"
          <el-input v-model="form.limitPrice"   placeholder="请输入"     @input="inputAction(form, 'limitPrice')"
          >
            <template slot="append">元</template>
          </el-input>
          <div class="discrep">减</div>
          <el-input
            v-model="form.price"
            placeholder="请输入"
            @input="inputAction(form, 'price')"
          >
            <template slot="append">元</template>
          <div class="discrep" >{{form.couponType === 1?',享':',减'}}</div>
          <el-input  v-model="form.price"     placeholder="请输入"    @input="inputAction(form, 'price')"  >
            <template slot="append" >{{form.couponType ===1?'折':'元'}}</template>
          </el-input>
        </div>
      </el-form-item>
      <el-form-item label="发放总量" prop="num">
        <div class="num-style">
          <el-input-number step-strictly v-model="form.num" :controls="false" :min="1" :max="99999" placeholder="请输入发放总量(1~99999)" v-trim></el-input-number>
        </div>
      <el-form-item label="优惠券说明" prop="info">
        <el-input type="textarea" v-model="form.info" placeholder="请输入优惠券说明"  v-trim/>
      </el-form-item>
      <el-form-item v-if="form.type==1" label="兑换条件" prop="integral">
        <el-input-number step-strictly v-model="form.integral" :controls="false" :min="1" :max="99999" placeholder="请输入" v-trim/> å’–豆兑换一张优惠券
      <p class="tip-header" >使用限制</p>
      <el-form-item label="有效期" prop="useType">
        <el-radio-group v-model="form.useType">
          <el-radio :label="0">固定时段</el-radio>
          <el-radio :label="1">固定时长</el-radio>
        </el-radio-group>
      </el-form-item>
      <el-form-item label="可领取时间" prop="getDate">
      <el-form-item label="使用时段" prop="getDate" v-if="form.useType===0">
        <div class="date-style">
          <el-date-picker
            v-model="getDate"
            type="datetimerange"
            value-format="yyyy-MM-dd HH:mm:ss"
            format="yyyy-MM-dd HH:mm:ss"
            range-separator="至"
            start-placeholder="开始时间"
            end-placeholder="结束时间"
            @change="selectDate"
              v-model="getDate"
              type="datetimerange"
              value-format="yyyy-MM-dd HH:mm:ss"
              format="yyyy-MM-dd HH:mm:ss"
              range-separator="至"
              start-placeholder="开始时间"
              end-placeholder="结束时间"
              @change="selectDate"
          ></el-date-picker>
        </div>
      </el-form-item>
      <el-form-item label="可用时间" prop="validDays">
        <!-- <el-input v-model="form.validDays" placeholder="请输入领取后有效天数" v-trim/> -->
      <el-form-item label="固定时长" prop="validDays" v-if="form.useType===1">
        <div class="coupon-rule">
          <div class="discrep">领劵后</div>
          <el-input
            v-model="form.validDays"
            placeholder="请输入"
            @input="inputAction(form, 'validDays')"
              v-model="form.validDays"
              placeholder="请输入"
              @input="inputAction(form, 'validDays')"
          >
            <template slot="append">天</template>
          </el-input>
          <div class="discrep">内有效,领取后立即生效</div>
          <div class="discrep">有效</div>
        </div>
      </el-form-item>
      <el-form-item v-if="form.type==0" label="关联店铺" prop="shopId">
        <el-select
          v-model="form.shopId"
          placeholder="请输入店铺名称,再选择"
          filterable
          remote
          reserve-keyword
          :remote-method="remoteMethod"
          :loading="searchLoading"
        >
          <el-option
            v-for="item in shops"
            :key="item.id"
            :label="item.name"
            :value="item.id">
          </el-option>
      <el-form-item label="适用对象" prop="applyType">
        <el-radio-group v-model="form.applyType">
          <el-radio :label="0">全场通用</el-radio>
          <el-radio :label="1">按品类</el-radio>
          <el-radio :label="2">指定商品</el-radio>
        </el-radio-group>
      </el-form-item>
      <el-form-item v-if="form.applyType===1" label="选择品类" prop="applyCateIdList" >
        <el-select v-model="form.applyCateIdList"  placeholder="请选择,支持多选" filterable multiple clearable >
          <el-option  v-for="item in categorys" :key="'optCate'+item.id"  :label="item.name"  :value="item.id">  </el-option>
        </el-select>
      </el-form-item>
      <el-form-item v-if="form.applyType===2" label="选择商品" prop="applyIdList" style="display: flex">
          <span style="font-size: 12px;color: #216EEE"   @click="selectGoods">已指定【 {{applyDataList.length}} ã€‘件商品</span>
        <el-button style="margin-left:30px;display: inline-block;width: 80px;" type="primary"  @click="selectGoods">去选择 </el-button>
      </el-form-item>
      <p class="tip-header" >发放规则</p>
      <el-form-item label="发放总量" prop="num">
        <div class="num-style">
          <el-input-number  v-model="form.num" :controls="false" :min="1" :max="99999" placeholder="请输入发放总量(1~99999)" v-trim></el-input-number>
        </div>
      </el-form-item>
    </el-form>
  </GlobalAlertWindow>
    <OperaCouponGoodsWindow ref="OperaCouponGoodsWindow" @success="doSelect"/>
  </GlobalWindow>
</template>
<script>
import BaseOpera from '@/components/base/BaseOpera'
import GlobalAlertWindow from '@/components/common/GlobalAlertWindow'
import { fetchList as shopList } from '@/api/business/shop'
import GlobalWindow from '@/components/common/GlobalWindow'
import { findAll as labelList } from '@/api/business/labels'
import { allList as goodsList} from '@/api/business/goods'
import OperaCouponGoodsWindow from '@/components/business/OperaCouponGoodsWindow'
export default {
  name: 'OperaCouponWindow',
  extends: BaseOpera,
  components: { GlobalAlertWindow },
  components: { GlobalWindow,OperaCouponGoodsWindow },
  data () {
    let couponRules = (rule, value, callback) => {
    const couponRules = (rule, value, callback) => {
      if (!this.form.limitPrice) {
        callback(new Error('请输入满额'))
      } else if (!this.form.price) {
        callback(new Error('请输入优惠金额'))
        callback(new Error('请完善优惠规则'))
      } else {
        callback()
      }
    }
    let getDateRules = (rule, value, callback) => {
    const getDateRules = (rule, value, callback) => {
      if (!this.form.startDate) {
        callback(new Error('请选择开始时间'))
      } else if (!this.form.endDate) {
@@ -119,7 +124,7 @@
        callback()
      }
    }
    let numRule = (rule, value, callBack) => {
    const numRule = (rule, value, callBack) => {
      if (value < 0) {
        callBack(new Error())
      } else {
@@ -129,16 +134,24 @@
    return {
      searchLoading: false,
      getDate: [],
      applyDataList:[],
      showGoods:false,
      // è¡¨å•数据
      form: {
        id: null,
        name: '',
        couponType: 0,
        applyType: 0,
        useType: 0,
        shopId: '',
        type: '',
        applyIdList: [],
        applyCateIdList: [],
        type: 0,
        limitPrice: '',
        price: '',
        startDate: '',
        endDate: '',
        applyIds: '',
        validDays: '',
        getMethod: '',
        integral: '',
@@ -147,29 +160,39 @@
        info: ''
      },
      shops: [],
      categorys: [],
      // éªŒè¯è§„则
      rules: {
        name: [
          { required: true, message: '请输入优惠券名称', tigger: 'blur' }
        ],
        couponRule: [
          { required: true, validator: couponRules, tigger: 'blur'}
          { required: true, validator: couponRules, tigger: 'blur' }
        ],
        useType: [
          { required: true, message: '请选择有效期方式' }
        ],
        couponType: [
          { required: true, message: '请选择类型' }
        ],
        applyType: [
          { required: true, message: '请选择适用对象类型' }
        ],
        num: [
          { required: true, validator: numRule, message: '请输入发放总数', tigger: 'blur'}
          { required: true, validator: numRule, message: '请输入发放总数', tigger: 'blur' }
        ],
        integral: [
          { required: true, validator: numRule, message: '请输入兑换条件', tigger: 'blur'}
        ],
        validDays: [
          { required: true, message: '请输入可用时间', tigger: 'blur'}
        ],
        getDate: [
          { required: true, validator: getDateRules, tigger: 'change'}
        ],
        shopId: [
          { required: true, validator: numRule, message: '请选择关联店铺', tigger: 'change'}
        ],
        /*integral: [
          { required: true, validator: numRule, message: '请输入兑换条件', tigger: 'blur' }
        ],*/
        // validDays: [
        //   { required: true, message: '请输入可用时间', tigger: 'blur' }
        // ],
        // getDate: [
        //   { required: true, validator: getDateRules, tigger: 'change' }
        // ],
        // shopId: [
        //   { required: true, validator: numRule, message: '请选择关联店铺', tigger: 'change' }
        // ]
      }
    }
  },
@@ -180,21 +203,62 @@
    })
  },
  methods: {
    selectGoods(){
      this.$refs.OperaCouponGoodsWindow.open('选择商品', this.applyDataList)
    },
    loadLabels(){
      labelList({
        type: 0 // å•†å“åˆ†ç±»
      }).then(res => {
        this.categorys = res || []
      })
    },
    loadSelectGoods(){
      console.log(this.form.applyIdList)
      if(!this.form.applyIdList || !this.form.applyIdList.length){
        return
      }
      goodsList({
        idList: this.form.applyIdList // å•†å“åˆ†ç±»
      }).then(res => {
        this.applyDataList = res || []
      })
    },
    doSelect(rows){
      console.log(rows,this.applyDataList)
      this.applyDataList =[]
      this.form.applyIdList=[]
      if(rows && rows.length){
        rows.forEach(item => {
          this.applyDataList.push(item)
          this.form.applyIdList.push(item.id)
        })
      }
    },
    open (title, target, type) {
      this.showGoods=false
      this.title = title
      this.visible = true
      this.form.type = type
      this.getDate = []
      this.form.startDate = ''
      this.form.endDate = ''
      this.applyDataList=[]
      this.form.applyIdList=[]
      this.form.applyCateIdList=[]
      this.loadLabels()
      this.form.limitPrice=null
      this.form.price=null
      this.form.startDate=null
      this.form.endDate=null
      this.form.num=1
      // æ–°å»º
      if (target == null) {
        this.$nextTick(() => {
          this.$refs.form.resetFields()
          console.log(this.form);
          console.log(this.form)
          this.form[this.configData['field.id']] = null
        })
        return
      }
      // ç¼–辑
@@ -203,29 +267,42 @@
          this.form[key] = target[key]
        }
        this.getDate = [target.startDate, target.endDate]
        if(this.form.applyType === 1){
          this.form.applyCateIdList =[]
          var ta = this.form.applyIds.split(',')
          if(ta && ta.length){
            ta.forEach(tt =>{
              this.form.applyCateIdList.push(parseInt(tt))
            })
          }
        }
        if(this.form.applyType === 2){
          this.form.applyIdList = this.form.applyIds.split(',')
          this.loadSelectGoods()
        }
      })
    },
    selectDate(value) {
    selectDate (value) {
      this.form.startDate = value[0]
      this.form.endDate = value[1]
    },
    inputAction(item, key) {
      if(item[key]<0) {
    inputAction (item, key) {
      if (item[key] < 0) {
        item[key] = ''
      } else {
        item[key] = item[key].replace(/[^\d.]/g, '')
                      .replace(/\.{2,}/g, '.')
                      .replace('.', '$#$')
                      .replace(/\./g, '')
                      .replace('$#$', '.')
                      .replace(/^(\-)*(\d+)\.(\d\d).*$/, '$1$2.$3')
                      .replace(/^\./g, '')
          .replace(/\.{2,}/g, '.')
          .replace('.', '$#$')
          .replace(/\./g, '')
          .replace('$#$', '.')
          .replace(/^(\-)*(\d+)\.(\d\d).*$/, '$1$2.$3')
          .replace(/^\./g, '')
      }
    },
    remoteMethod(query) {
    remoteMethod (query) {
      if (query !== '') {
        this.searchLoading = true
        let action = this.form.type==2 ? activityList : shopList
        const action = this.form.type == 2 ? activityList : shopList
        action({
          capacity: 999,
          model: {
@@ -239,8 +316,8 @@
            this.searchLoading = false
          })
      }
    },
  },
    }
  }
}
</script>
admin/src/views/business/coupon.vue
@@ -2,19 +2,16 @@
  <TableLayout :permissions="['business:coupon:query']">
    <!-- æœç´¢è¡¨å• -->
    <el-form ref="searchForm" slot="search-form" :model="searchForm" label-width="100px" inline>
      <el-form-item label="优惠券名称" prop="name">
      <el-form-item label="名称" prop="name">
        <el-input v-model="searchForm.name" placeholder="请输入优惠券名称" @keypress.enter.native="search"></el-input>
      </el-form-item>
      <!-- 0商家优惠券 1平台优惠券 -->
      <!-- <el-form-item label="优惠券类型" prop="type">
        <el-select
          v-model="searchForm.type"
          placeholder="请选择优惠券类型"
        >
          <el-option key="0" :value="0" label="商家优惠券"></el-option>
          <el-option key="1" :value="1" label="平台优惠券"></el-option>
       <el-form-item label="类型" prop="couponType">
        <el-select  v-model="searchForm.couponType" clearable  placeholder="请选择优惠券类型" >
          <el-option key="0" :value="0" label="满减券"></el-option>
          <el-option key="1" :value="1" label="折扣券"></el-option>
        </el-select>
      </el-form-item> -->
      </el-form-item>
      <section>
        <el-button type="primary" @click="search">搜索</el-button>
        <el-button @click="reset">重置</el-button>
@@ -23,9 +20,8 @@
    <!-- è¡¨æ ¼å’Œåˆ†é¡µ -->
    <template v-slot:table-wrap>
      <ul class="toolbar" v-permissions="['business:coupon:create', 'business:coupon:delete']">
        <li><el-button type="primary" @click="$refs.operaCouponWindow.open('新建平台优惠券', null, 1)" v-permissions="['business:coupon:create']">新建平台优惠券</el-button></li>
        <li><el-button type="primary" @click="$refs.operaCouponWindow.open('新建商家优惠券', null, 0)" v-permissions="['business:coupon:create']">新建商家优惠券</el-button></li>
        <li><el-button @click="deleteByIdInBatch" icon="el-icon-delete" v-permissions="['business:coupon:delete']">删除</el-button></li>
        <li><el-button type="primary" icon="el-icon-plus" @click="$refs.operaCouponWindow.open('新建', null, 1)" v-permissions="['business:coupon:create']">新建</el-button></li>
        <li><el-button type="danger" @click="deleteByIdInBatch" icon="el-icon-delete" v-permissions="['business:coupon:delete']">删除</el-button></li>
      </ul>
      <el-table
        v-loading="isWorking.search"
@@ -35,23 +31,21 @@
        @selection-change="handleSelectionChange"
      >
        <el-table-column type="selection" width="55"></el-table-column>
        <el-table-column prop="name" label="优惠券名称" align="center" min-width="120px">
        <el-table-column prop="name" label="优惠券名称" align="center" min-width="120px"></el-table-column>
        <el-table-column label="类型" align="center" min-width="100px">
          <template slot-scope="{row}">
            <el-button type="text" @click="showDetail(row)">{{ row.name }}</el-button>
            <span v-if="row.couponType ===0"> æ»¡å‡åˆ¸</span>
            <span v-if="row.couponType ===1"> æŠ˜æ‰£åˆ¸</span>
          </template>
        </el-table-column>
        <el-table-column label="优惠规则" align="center" min-width="100px">
        <el-table-column label="优惠规则" align="center" min-width="150px" show-overflow-tooltip>
          <template slot-scope="{row}">
            {{ `满${row.limitPrice}减${row.price}` }}
          </template>
        </el-table-column>
        <el-table-column prop="type" label="优惠券类型" align="center" min-width="100px">
          <template slot-scope="{row}">
            {{ row.type==0?'商家优惠券':'平台优惠券' }}
            <span v-if="row.couponType ===0"> {{ `订单满${row.limitPrice||0}元,减${row.price||0}` }}元</span>
            <span v-if="row.couponType ===1"> {{ `订单满${row.limitPrice||0}元,享${row.price||0}折` }}</span>
          </template>
        </el-table-column>
        <el-table-column prop="num" label="发放总量" align="center" min-width="100px"></el-table-column>
        <el-table-column  label="已领取" align="center" min-width="100px">
        <el-table-column  label="已发送数量" align="center" min-width="100px">
          <template slot-scope="{row}">
            <el-button type="text" @click="showCouponUse(row.id)">{{ row.unused + row.used }}</el-button>
          </template>
@@ -62,12 +56,17 @@
          </template>
        </el-table-column>
        <el-table-column prop="used" label="使用数量" align="center" min-width="100px"></el-table-column>
        <el-table-column prop="validDays" label="领取后有效天数" align="center" min-width="110px"></el-table-column>
        <el-table-column prop="startDate" label="开始时间" align="center" min-width="140px"></el-table-column>
        <el-table-column prop="endDate" label="结束时间" align="center" min-width="140px"></el-table-column>
        <el-table-column label="进行状态" align="center" min-width="100px">
        <el-table-column prop="validDays" label="使用有效期" align="center" min-width="210px">
          <template slot-scope="{row}">
            {{ row.status==0 ? '未开始' : row.status==1 ? '进行中' : '已结束' }}
            <span v-if="row.useType ===0"><li> èµ·ï¼š{{ row.startDate}}</li> <li>止:{{row.endDate }}</li></span>
            <span v-if="row.useType ===1"> {{ `领用后${row.validDays||0}天有效` }}</span>
          </template>
        </el-table-column>
        <el-table-column label="适用类型" align="center" min-width="100px">
          <template slot-scope="{row}">
            <span v-if="row.applyType ===0"> å…¨ç¨‹é€šç”¨</span>
            <span v-if="row.applyType ===1"> æŒ‰å“ç±»</span>
            <span v-if="row.applyType ===2"> æŒ‡å®šå•†å“</span>
          </template>
        </el-table-column>
        <el-table-column prop="status" label="状态" align="center" min-width="100px">
@@ -87,7 +86,7 @@
          label="操作"
          min-width="120"
          fixed="right"
          align="center"
          align="center"
        >
          <template slot-scope="{row}">
            <el-button type="text" @click="$refs.operaCouponWindow.open('编辑优惠券', row)" icon="el-icon-edit" v-permissions="['business:coupon:update']">编辑</el-button>
@@ -126,7 +125,7 @@
      // æœç´¢
      searchForm: {
        name: '',
        type: ''
        couponType: ''
      }
    }
  },
@@ -144,7 +143,7 @@
      this.$refs.operaCouponDetail.open('优惠券详情', row)
    },
    showCouponUse(id) {
      this.$refs.operaCouponUsedDetail.open('优惠券领取详情', id)
    },
    statusChange(row) {
admin/src/views/business/integralRuleSet.vue
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,265 @@
<template>
  <div class="box" style="max-height:calc(100% - 60px);margin-bottom:50px;overflow-y: auto" >
    <el-form :model="form" ref="form">
      <div class="header">
        <span style="font-size: 15px; font-weight: bold">【1】注册奖励</span>
      </div>
      <div class="item-content">
        <el-form-item label="积分奖励" label-width="150px"  prop="regIntegralRewardStatus">
          <el-switch  v-model="form.regIntegralRewardStatus" :active-value="0" :inactive-value="1"    active-color="#13ce66"   inactive-color="#ff4949"  ></el-switch>
        </el-form-item>
        <el-form-item label="新人注册送" label-width="250px" prop="regIntegralReward">
          <el-input  style="width: 200px;margin: 0px 20px" type="number"   v-model="form.regIntegralReward"   placeholder="请输入"   v-trim>
            <template slot="append">积分</template>
          </el-input>
        </el-form-item>
      </div>
      <div class="item-content">
        <el-form-item label="优惠券奖励" label-width="150px"  prop="regCouponRewardStatus">
          <el-switch  v-model="form.regCouponRewardStatus" :active-value="0" :inactive-value="1"    active-color="#13ce66"   inactive-color="#ff4949"  ></el-switch>
        </el-form-item>
        <div  >
          <el-form-item label="新人注册送优惠券" label-width="250px" prop="regCouponRewardList">
          </el-form-item>
          <div  style="margin-left: 150px;border: 1px solid #f2f2f2">
            <el-table style="width: 600px;"  :data="form.regCouponRewardList">
              <el-table-column prop="shopPrice" label="优惠券" min-width="300px" align="center">
                <template slot-scope="{row}" >
                  <el-select v-model="row.couponId" style="width: 200px;margin: 0px 20px" clearable filterable   placeholder="请选择优惠券"  >
                    <el-option v-for="item in couponList"   :label="item.name"  :value="item.id">  </el-option>
                  </el-select>
                </template>
              </el-table-column>
              <el-table-column prop="num" label="数量" min-width="200px" align="center">
                <template slot-scope="{row}" >
                  <el-input  style="width: 100px;margin: 0px 20px" type="number"   v-model="row.num"   placeholder="请输入数量"   v-trim/>
                </template>
              </el-table-column>
              <el-table-column  label="操作" min-width="100px" align="center">
                <template slot-scope="scope" >
                  <el-button style="color: red;border: none;" @click="delCoupon(0,scope.$index)">删除</el-button>
                </template>
              </el-table-column>
            </el-table>
            <el-button s type="primary" icon="el-icon-plus" @click="addCoupon(0)" style="height: 30px;margin: 10px;">添加</el-button>
          </div>
        </div>
      </div>
      <div class="header">
        <span style="font-size: 15px; font-weight: bold">【2】邀请好友奖励</span>
      </div>
      <div class="item-content">
        <el-form-item label="积分奖励" label-width="150px"  prop="shareIntegralRewardStatus">
          <el-switch  v-model="form.shareIntegralRewardStatus" :active-value="0" :inactive-value="1"    active-color="#13ce66"   inactive-color="#ff4949"  ></el-switch>
        </el-form-item>
        <el-form-item label="好友成功注册送邀请人" label-width="250px" prop="shareIntegralReward">
          <el-input  style="width: 200px;margin: 0px 20px" type="number"   v-model="form.shareIntegralReward"   placeholder="请输入"   v-trim>
            <template slot="append">积分</template>
          </el-input>
        </el-form-item>
      </div>
      <div class="item-content">
        <el-form-item label="优惠券奖励" label-width="150px"  prop="shareCouponRewardStatus">
          <el-switch  v-model="form.shareCouponRewardStatus" :active-value="0" :inactive-value="1"    active-color="#13ce66"   inactive-color="#ff4949"  ></el-switch>
        </el-form-item>
        <div  >
          <el-form-item label="好友完成首单送邀请人优惠券" label-width="250px" prop="shareCouponRewardList">
          </el-form-item>
          <div  style="margin-left: 150px;border: 1px solid #f2f2f2">
            <el-table style="width: 600px;"  :data="form.shareCouponRewardList">
              <el-table-column prop="couponId" label="优惠券" min-width="300px" align="center">
                <template slot-scope="{row}" >
                  <el-select v-model="row.couponId" style="width: 200px;margin: 0px 20px"  clearable filterable   placeholder="请选择优惠券"  >
                    <el-option v-for="item in couponList"   :label="item.name"  :value="item.id">  </el-option>
                  </el-select>
                </template>
              </el-table-column>
              <el-table-column prop="num" label="数量" min-width="200px" align="center">
                <template slot-scope="{row}" >
                  <el-input  style="width: 100px;margin: 0px 20px" type="number"   v-model="row.num"   placeholder="请输入数量"   v-trim/>
                </template>
              </el-table-column>
              <el-table-column  label="操作" min-width="100px" align="center">
                <template slot-scope="scope" >
                  <el-button style="color: red;border: none;" @click="delCoupon(1,scope.$index)">删除</el-button>
                </template>
              </el-table-column>
            </el-table>
            <el-button s type="primary" icon="el-icon-plus" @click="addCoupon(1)" style="height: 30px;margin: 10px;">添加</el-button>
          </div>
        </div>
      </div>
      <div class="header">
        <span style="font-size: 15px; font-weight: bold">【3】消费返积分</span>
      </div>
      <div class="item-content">
        <el-form-item label="返用户积分" label-width="150px"  prop="returnMemberIntegralStatus">
          <el-switch  v-model="form.returnMemberIntegralStatus" :active-value="0" :inactive-value="1"    active-color="#13ce66"   inactive-color="#ff4949"  ></el-switch>
        </el-form-item>
        <el-form-item label="订单实付金额每满" label-width="250px" prop="returnMemberIntegral">
          <el-input  style="width: 250px;margin: 0px 20px" type="number"   v-model="form.returnMemberIntegral"   placeholder="请输入"   v-trim>
            <template slot="append">元返用户1积分</template>
          </el-input>
          <p class="tip-warn" style="margin-bottom: 1px;"><i class="el-icon-warning"></i>提醒:实付金额去除运费</p>
        </el-form-item>
      </div>
      <div class="item-content">
        <el-form-item label="返经销商积分" label-width="150px"  prop="returnShopIntegralStatus">
          <el-switch  v-model="form.returnShopIntegralStatus" :active-value="0" :inactive-value="1"    active-color="#13ce66"   inactive-color="#ff4949"  ></el-switch>
        </el-form-item>
        <el-form-item label="订单实付金额每满" label-width="250px" prop="returnShopIntegral">
          <el-input  style="width: 250px;margin: 0px 20px" type="number"   v-model="form.returnShopIntegral"   placeholder="请输入"   v-trim>
            <template slot="append">元返经销商1积分</template>
          </el-input>
          <p class="tip-warn" style="margin-bottom: 1px;"><i class="el-icon-warning"></i>提醒:实付金额去除运费</p>
        </el-form-item>
      </div>
      <div class="header">
        <span style="font-size: 15px; font-weight: bold">【4】合计优惠承担比例</span>
      </div>
      <div class="item-content">
        <el-form-item label="总部承担" label-width="150px" prop="totalRate">
          <el-input  style="width: 200px;margin: 0px 20px" type="number"   v-model="form.totalRate"   placeholder="请输入"   v-trim>
            <template slot="append">%</template>
          </el-input>
          <p class="tip-warn" style="margin-bottom: 1px;"><i class="el-icon-warning"></i>提醒:设置总部和经销商在订单合计优惠金额中(优惠券+积分抵扣)各自承担的比例</p>
        </el-form-item>
      </div>
      <el-form-item style="margin-top: 100px;width: 100%;text-align: center">
        <el-button type="primary" style="width: 300px"  :loading="working" @click="submit">保存配置项</el-button>
      </el-form-item>
    </el-form>
  </div>
</template>
<script>
import { getPlatformConfig, updPlatformConfig } from '@/api/system/dictData'
import {allList} from '@/api/business/coupon'
export default {
  name: '',
  data () {
    return {
      uploadData: {
        folder: ''
      },
      isUploading: false,
      working: false,
      couponList: [],
      form: {
        regIntegralRewardStatus: 0,
        shareIntegralRewardStatus: 0,
        regCouponRewardStatus: 0,
        shareCouponRewardStatus: 0,
        regIntegralReward: 0,
        shareIntegralReward: 0,
        regCouponRewardList: [],
        shareCouponRewardList: [],
        returnMemberIntegralStatus: 0,
        returnShopIntegralStatus: 0,
        returnMemberIntegral: 0,
        returnShopIntegral: 0,
        totalRate: 0
      }
    }
  },
  created () {
    this.getCouponList()
    this.getData()
  },
  methods: {
    getCouponList () {
      allList({})
        .then(res => {
          if (res) {
            this.couponList = res || []
          }
        })
    },
    delCoupon(type,index){
      if(type ===0){
        this.form.regCouponRewardList.splice(index,1)
      }else if(type ===1){
        this.form.shareCouponRewardList.splice(index,1)
      }
    },
    addCoupon(type){
      if(type ===0){
        this.form.regCouponRewardList.push({couponId:null,num:null})
      }else if(type ===1){
        this.form.shareCouponRewardList.push({couponId:null,num:null})
      }
    },
    getData () {
      getPlatformConfig({})
        .then(res => {
          if (res) {
            this.form = {
              regIntegralRewardStatus: res.regIntegralRewardStatus || 0,
              shareIntegralRewardStatus: res.shareIntegralRewardStatus || 0,
              regCouponRewardStatus: res.regCouponRewardStatus || 0,
              shareCouponRewardStatus: res.shareCouponRewardStatus || 0,
              regIntegralReward: res.regIntegralReward || 0,
              shareIntegralReward: res.shareIntegralReward || 0,
              regCouponRewardList: res.regCouponRewardList || [],
              shareCouponRewardList: res.shareCouponRewardList || [],
              returnMemberIntegralStatus: res.returnMemberIntegralStatus || 0,
              returnShopIntegralStatus: res.returnShopIntegralStatus || 0,
              returnMemberIntegral: res.returnMemberIntegral || 0,
              returnShopIntegral: res.returnShopIntegral || 0,
              totalRate: res.totalRate || 0
            }
          }
        })
    },
    submit () {
      console.log(this.form)
      this.$refs.form.validate((valid) => {
        if (!valid) {
          return
        }
        // è°ƒç”¨æ–°å»ºæŽ¥å£
        this.isWorking = true
        updPlatformConfig(this.form).then(res => {
          this.$message.success('保存成功')
          this.getData()
        })
          .catch(e => {
            this.$tip.apiFailed(e)
          })
          .finally(() => {
            this.isWorking = false
          })
      })
    }
  }
}
</script>
<style lang="scss" scoped>
.el-container /deep/  .el-main{
  width: 100%;
  overflow-y: auto  !important ;
  height: calc(100% - 94px);
}
.item-content{
  display: flex;
  width: 100%;
}
.header{
  margin: 20px 0 20px 0;padding:10px;background-color: rgba(140,147,157,0.61);
}
/deep/ .el-main{
  width: 100%;
  //height: 100%;
  overflow-y: auto  !important ;
  height: calc(100% - 94px);
}
.box {
  width: 100%;
  padding: 30px;
  box-sizing: border-box;
  background: #ffffff;
}
</style>
server/dmmall_admin/src/main/java/com/doumee/api/business/GoodsController.java
@@ -98,6 +98,12 @@
    public ApiResponse<PageData<Goods>> findPage (@RequestBody PageWrap<Goods> pageWrap) {
        return ApiResponse.success(goodsService.findPage(pageWrap));
    }
    @ApiOperation("列表查询")
    @PostMapping("/list")
    @RequiresPermissions("business:goods:query")
    public ApiResponse<List<Goods>> findList (@RequestBody  Goods pageWrap) {
        return ApiResponse.success(goodsService.findList(pageWrap));
    }
    @ApiOperation("根据专区分类查询商品")
server/dmmall_service/src/main/java/com/doumee/core/utils/Constants.java
@@ -1,6 +1,7 @@
package com.doumee.core.utils;
import com.doumee.dao.business.model.Areas;
import io.swagger.annotations.ApiModelProperty;
import org.apache.commons.collections4.CollectionUtils;
import java.math.BigDecimal;
@@ -30,8 +31,16 @@
     public static final String ORDERSET_RETURN_SHOP_INTEGRAL_STATUS="ORDERSET_RETURN_SHOP_INTEGRAL_STATUS";
     public static final String ORDERSET_RETURN_MEMBER_INTEGRAL="ORDERSET_RETURN_MEMBER_INTEGRAL";
     public static final String ORDERSET_RETURN_SHOP_INTEGRAL="ORDERSET_RETURN_SHOP_INTEGRAL";
     public static final String INTERALSET_DEDUCTINTEGRALLIMIT="INTERALSET_DEDUCTINTEGRALLIMIT";
     public static final String INTERALSET_MININTEGRALPRICELIMIT="INTERALSET_MININTEGRALPRICELIMIT";
     public static final String INTERALSET_INTEGRALINVALIDTYPE="INTERALSET_INTEGRALINVALIDTYPE";
     public static final String INTERALSET_INTEGRALINVALIDCIRCLE="INTERALSET_INTEGRALINVALIDCIRCLE";
     public static final String INTERALSET_INTEGRALRULEINFO="INTERALSET_INTEGRALRULEINFO";
   public static final String ORDERSET_TOTAL_RATE="ORDERSET_TOTAL_RATE";
    public static final String ORDER_SET ="ORDER_SET" ;
    public static final String INTEGRAL_SET ="INTEGRAL_SET" ;
    /**
     * mq tag
server/dmmall_service/src/main/java/com/doumee/dao/business/model/Coupon.java
@@ -11,6 +11,7 @@
import com.fasterxml.jackson.annotation.JsonFormat;
import java.util.Date;
import java.math.BigDecimal;
import java.util.List;
/**
 * ä¼˜æƒ åˆ¸ä¿¡æ¯è¡¨
@@ -117,7 +118,7 @@
    @ApiModelProperty(value = "适用类型:0=全场;1=品类;2=指定商品")
    private Integer applyType;
    @ApiModelProperty(value = "适用关联对象信息主键")
    @ApiModelProperty(value = "适用关联对象信息主键,多个英文逗号隔开")
    private String applyIds;
    @ApiModelProperty(value = "折扣卷满减上限金额")
@@ -145,8 +146,10 @@
    @ApiModelProperty(value = "未使用数量", example = "1")
    @TableField(exist = false)
    private Integer   unused;
    @ApiModelProperty(value = "适用关联对象信息主键,多个英文逗号隔开")
    @TableField(exist = false)
    private List<Integer> applyIdList;
    @ApiModelProperty(value = "适用关联品类信息主键,多个英文逗号隔开")
    @TableField(exist = false)
    private List<Integer> applyCateIdList;
}
server/dmmall_service/src/main/java/com/doumee/dao/business/model/Goods.java
@@ -193,6 +193,9 @@
    @ApiModelProperty(value = "商品sku信息")
    @TableField(exist = false)
    private List<Sku>  skuList;
    @ApiModelProperty(value = "商品编码集合")
    @TableField(exist = false)
    private List<Integer>  idList;
    @ApiModelProperty(value = "商品sku信息")
    @TableField(exist = false)
    private List<Labels>  brandList;
server/dmmall_service/src/main/java/com/doumee/dao/business/model/Goodsorder.java
@@ -1,3 +1,5 @@
package com.doumee.dao.business.model;
import com.baomidou.mybatisplus.annotation.TableField;
server/dmmall_service/src/main/java/com/doumee/dao/system/SystemDictDataMapper.java
@@ -4,10 +4,11 @@
import com.doumee.dao.system.dto.QuerySystemDictDataDTO;
import com.doumee.dao.system.model.SystemDictData;
import com.doumee.dao.system.vo.SystemDictDataListVO;
import com.github.yulichang.base.MPJBaseMapper;
import java.util.List;
public interface SystemDictDataMapper extends BaseMapper<SystemDictData> {
public interface SystemDictDataMapper extends MPJBaseMapper<SystemDictData> {
    /**
     * æŸ¥è¯¢å­—典数据管理列表
server/dmmall_service/src/main/java/com/doumee/dao/system/dto/PlatformConfigDTO.java
@@ -47,6 +47,16 @@
    private BigDecimal returnShopIntegral;
    @ApiModelProperty(value = "合计优惠承担比例(%)")
    private BigDecimal totalRate;
    @ApiModelProperty(value = "多少积分抵扣1元")
    private Integer deductIntegralLimit;
    @ApiModelProperty(value = "满多少金额可使用积分")
    private BigDecimal minIntegralPriceLimit;
    @ApiModelProperty(value = "积分失效方式 0长期有效 1按积分产生时间失效")
    private Integer integralInvalidType;
    @ApiModelProperty(value = "积分销毁周期")
    private Integer integralInvalidCircle;
    @ApiModelProperty(value = "积分使用规则说明")
    private String integralRuleInfo;
}
server/dmmall_service/src/main/java/com/doumee/service/business/impl/CouponServiceImpl.java
@@ -1,5 +1,6 @@
package com.doumee.service.business.impl;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.toolkit.StringUtils;
import com.doumee.core.constants.ResponseStatus;
import com.doumee.core.exception.BusinessException;
@@ -30,6 +31,7 @@
import java.util.Date;
import java.util.List;
import java.util.Objects;
import java.util.stream.Collectors;
/**
 * ä¼˜æƒ åˆ¸ä¿¡æ¯è¡¨Service实现
@@ -55,24 +57,21 @@
    @Override
    public Integer create(Coupon coupon) {
        LoginUserInfo user = (LoginUserInfo) SecurityUtils.getSubject().getPrincipal();
        coupon.setType(Constants.ONE);
        coupon.setGetMethod(Constants.ZERO);
        isCreateParamValid(coupon);
        /**平台优惠券是兑换优惠券,商家优惠券是领取优惠券*/
        if(Constants.equalsInteger(coupon.getType(),Constants.ZERO)){
            coupon.setGetMethod(Constants.ZERO);
        }else if(Constants.equalsInteger(coupon.getType(),Constants.ONE)){
          coupon.setGetMethod(Constants.ONE);
        }
        coupon.setIsdeleted(Constants.ZERO);
        coupon.setCreator(user.getId());
        coupon.setCreateDate(new Date());
        coupon.setStatus(Constants.ONE);
        coupon.setEditor(user.getId());
        coupon.setEditDate(new Date());
        coupon.setStatus(Constants.ONE);//默认禁用
        couponMapper.insert(coupon);
        return coupon.getId();
    }
    public void isCreateParamValid(Coupon coupon){
        if(StringUtils.isBlank(coupon.getName())
                || coupon.getType()==null
                ||coupon.getLimitPrice()==null
@@ -81,7 +80,7 @@
              /*  ||coupon.getIntegral()==null*/
                ||coupon.getStartDate()==null
                ||coupon.getEndDate()==null
                ||coupon.getValidDays()==null
//                ||coupon.getValidDays()==null
        ){
            throw new BusinessException(ResponseStatus.BAD_REQUEST.getCode(), ResponseStatus.BAD_REQUEST.getMessage());
@@ -98,11 +97,17 @@
                throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(), "关联的店铺不存在!");
            }
        }
        coupon.setApplyIds("");
        if(Constants.equalsInteger(coupon.getApplyType(),Constants.TWO) && coupon.getApplyIdList()!=null){
            coupon.setApplyIds(coupon.getApplyIdList().stream().map(String::valueOf).collect(Collectors.joining(",")));//使用对象编码集合
        }
        if(Constants.equalsInteger(coupon.getApplyType(),Constants.ONE) && coupon.getApplyCateIdList()!=null){
            coupon.setApplyIds(coupon.getApplyCateIdList().stream().map(String::valueOf).collect(Collectors.joining(",")));//使用对象编码集合
        }
    }
    @Override
    public void deleteById(Integer id) {
        Coupon query= couponMapper.selectById(id);
        initCouponStatus(query);
        if(!Constants.equalsInteger(query.getCouponStatus(),Constants.ZERO)){
@@ -134,9 +139,9 @@
        isCreateParamValid(coupon);
        Coupon query= couponMapper.selectById(coupon.getId());
        initCouponStatus(query);
        if(!Constants.equalsInteger(query.getCouponStatus(),Constants.ZERO)){
     /*   if(!Constants.equalsInteger(query.getCouponStatus(),Constants.ZERO)){
            throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(), "活动已开始/已结束状态,不支持编辑操作");
        }
        }*/
        coupon.setEditor(user.getId());
        coupon.setEditDate(new Date());
        couponMapper.updateById(coupon);
@@ -207,6 +212,7 @@
        queryWrapper.select("(select count(id) from member_coupon where ISDELETED=0 and COUPON_ID=t.id and STATUS=1) as used");
        queryWrapper.like(StringUtils.isNotBlank(pageWrap.getModel().getName()),Coupon::getName,pageWrap.getModel().getName());
        queryWrapper.eq(pageWrap.getModel().getCouponType()!=null,Coupon::getCouponType,pageWrap.getModel().getCouponType());
        queryWrapper.eq(Coupon::getIsdeleted,Constants.ZERO);
        queryWrapper.orderByDesc(Coupon::getCreateDate);
        IPage<Coupon> result =  couponJoinMapper.selectJoinPage(page,Coupon.class, queryWrapper);
server/dmmall_service/src/main/java/com/doumee/service/business/impl/GoodsServiceImpl.java
@@ -710,6 +710,9 @@
    @Override
    public List<Goods> findList(Goods goods) {
        QueryWrapper<Goods> wrapper = new QueryWrapper<>(goods);
        wrapper.lambda()
            .in(goods.getIdList() != null && goods.getIdList().size()>0, Goods::getId, goods.getIdList())
            .eq( Goods::getIsdeleted, Constants.ZERO);
        return goodsMapper.selectList(wrapper);
    }
@@ -718,9 +721,7 @@
        IPage<Goods> page = new Page<>(pageWrap.getPage(), pageWrap.getCapacity());
        MPJLambdaWrapper<Goods> queryWrapper = new MPJLambdaWrapper<>();
        Utils.MP.blankToNull(pageWrap.getModel());
        queryWrapper.selectAll(Goods.class);
        queryWrapper.select("t1.name",Goods::getCategoryName);
        queryWrapper.select("t2.name" ,Goods::getBrandName);
        queryWrapper.select("t3.name" ,Goods::getParentName);
@@ -750,8 +751,8 @@
        queryWrapper.eq(pageWrap.getModel().getParentCategoryId() != null, Goods::getParentCategoryId, pageWrap.getModel().getParentCategoryId());
        queryWrapper.eq(pageWrap.getModel().getBrandId() != null, Goods::getBrandId, pageWrap.getModel().getBrandId());
        queryWrapper.eq(pageWrap.getModel().getStatus() != null, Goods::getStatus, pageWrap.getModel().getStatus());
        queryWrapper.orderByDesc(Goods::getCreateDate);
        queryWrapper.in(pageWrap.getModel().getIdList() != null && pageWrap.getModel().getIdList().size()>0, Goods::getId, pageWrap.getModel().getIdList());
        queryWrapper.orderByDesc(Goods::getId);
        IPage<Goods> result = goodsAdminJoinMapper.selectJoinPage(page, Goods.class, queryWrapper);
        initResult(result.getRecords());
        return PageData.from(result);
server/dmmall_service/src/main/java/com/doumee/service/system/impl/SystemDictDataServiceImpl.java
@@ -20,6 +20,7 @@
import com.doumee.service.system.SystemDictDataService;
import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.github.yulichang.wrapper.MPJLambdaWrapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
@@ -142,30 +143,24 @@
        platformConfigDTO.setReturnMemberIntegralStatus(0);
        platformConfigDTO.setReturnShopIntegralStatus(0);
        platformConfigDTO.setMinIntegralPriceLimit(new BigDecimal(0));
        platformConfigDTO.setDeductIntegralLimit(0);
        platformConfigDTO.setIntegralRuleInfo("");
        platformConfigDTO.setIntegralInvalidType(0);
        platformConfigDTO.setIntegralInvalidCircle(0);
        platformConfigDTO.setTotalRate(new BigDecimal(0));
        SystemDict  dict = systemDictMapper.selectOne(new QueryWrapper<SystemDict>().lambda()
 /*       SystemDict  dict = systemDictMapper.selectOne(new QueryWrapper<SystemDict>().lambda()
                .eq(SystemDict::getCode,Constants.ORDER_SET).last("limit 1"));
        if(dict == null){
            throw new BusinessException(ResponseStatus.DATA_EMPTY.getCode(),"数据字典配置数据有误,请联系系统管理员处理!");
        }
        List<SystemDictData> systemDictDataList = systemDictDataMapper.selectList(new QueryWrapper<SystemDictData>()
                .lambda().eq(SystemDictData::getDictId,dict.getId())
                .in(SystemDictData::getLabel
                        , Constants.ORDERSET_REG_INTEGRAL_REWARD_STATUS
                        , Constants.ORDERSET_SHARE_INTEGRAL_REWARD_STATUS
                        , Constants.ORDERSET_REG_COUPON_REWARD_STATUS
                        , Constants.ORDERSET_SHARE_COUPON_REWARD_STATUS
                        , Constants.ORDERSET_REG_INTEGRAL_REWARD
                        , Constants.ORDERSET_SHARE_INTEGRAL_REWARD
                        , Constants.ORDERSET_REG_COUPON_REWARD_LIST
                        , Constants.ORDERSET_SHARE_COUPON_REWARD_LIST
                        , Constants.ORDERSET_RETURN_MEMBER_INTEGRAL_STATUS
                        , Constants.ORDERSET_RETURN_SHOP_INTEGRAL_STATUS
                        , Constants.ORDERSET_RETURN_MEMBER_INTEGRAL
                        , Constants.ORDERSET_RETURN_SHOP_INTEGRAL
                        ,Constants.ORDERSET_TOTAL_RATE )
*/
        List<SystemDictData> systemDictDataList = systemDictDataMapper.selectJoinList(SystemDictData.class,new MPJLambdaWrapper<SystemDictData>()
                .selectAll(SystemDictData.class)
                .leftJoin(SystemDict.class,SystemDict::getId,SystemDictData::getDictId)
                .in(SystemDict::getCode,Constants.ORDER_SET,Constants.INTEGRAL_SET)
        );
        if(com.github.xiaoymin.knife4j.core.util.CollectionUtils.isNotEmpty(systemDictDataList)){
            for (SystemDictData systemDictData:systemDictDataList) {
@@ -195,6 +190,17 @@
                    platformConfigDTO.setReturnShopIntegralStatus(getIntegerValByStr(systemDictData.getCode()));
                }else if(systemDictData.getLabel().equals(Constants.ORDERSET_TOTAL_RATE)) {
                    platformConfigDTO.setTotalRate(getDecimalValByStr(systemDictData.getCode()));
                }
                else if(systemDictData.getLabel().equals(Constants.INTERALSET_INTEGRALINVALIDTYPE)) {
                    platformConfigDTO.setIntegralInvalidType(getIntegerValByStr(systemDictData.getCode()));
                }else if(systemDictData.getLabel().equals(Constants.INTERALSET_INTEGRALINVALIDCIRCLE)) {
                    platformConfigDTO.setIntegralInvalidCircle(getIntegerValByStr(systemDictData.getCode()));
                }else if(systemDictData.getLabel().equals(Constants.INTERALSET_INTEGRALRULEINFO)) {
                    platformConfigDTO.setIntegralRuleInfo(systemDictData.getCode());
                }else if(systemDictData.getLabel().equals(Constants.INTERALSET_DEDUCTINTEGRALLIMIT)) {
                    platformConfigDTO.setDeductIntegralLimit(getIntegerValByStr(systemDictData.getCode()));
                }else if(systemDictData.getLabel().equals(Constants.INTERALSET_MININTEGRALPRICELIMIT)) {
                    platformConfigDTO.setMinIntegralPriceLimit(getDecimalValByStr(systemDictData.getCode()));
                }
            }
        }
@@ -227,28 +233,15 @@
    @Override
    @Transactional(rollbackFor = {Exception.class, BusinessException.class})
    public void updPlatformConfig(PlatformConfigDTO platformConfigDTO) {
        SystemDict dict = systemDictMapper.selectOne(new QueryWrapper<SystemDict>().lambda()
 /*       SystemDict dict = systemDictMapper.selectOne(new QueryWrapper<SystemDict>().lambda()
                .eq(SystemDict::getCode, Constants.ORDER_SET).last("limit 1"));
        if (dict == null) {
            throw new BusinessException(ResponseStatus.DATA_EMPTY.getCode(), "数据字典配置数据有误,请联系系统管理员处理!");
        }
        List<SystemDictData> systemDictDataList = systemDictDataMapper.selectList(new QueryWrapper<SystemDictData>()
                .lambda()
                .eq(SystemDictData::getDictId, dict.getId())
                .in(SystemDictData::getLabel
                        , Constants.ORDERSET_REG_INTEGRAL_REWARD_STATUS
                        , Constants.ORDERSET_SHARE_INTEGRAL_REWARD_STATUS
                        , Constants.ORDERSET_REG_COUPON_REWARD_STATUS
                        , Constants.ORDERSET_SHARE_COUPON_REWARD_STATUS
                        , Constants.ORDERSET_REG_INTEGRAL_REWARD
                        , Constants.ORDERSET_SHARE_INTEGRAL_REWARD
                        , Constants.ORDERSET_REG_COUPON_REWARD_LIST
                        , Constants.ORDERSET_SHARE_COUPON_REWARD_LIST
                        , Constants.ORDERSET_RETURN_MEMBER_INTEGRAL_STATUS
                        , Constants.ORDERSET_RETURN_SHOP_INTEGRAL_STATUS
                        , Constants.ORDERSET_RETURN_MEMBER_INTEGRAL
                        , Constants.ORDERSET_RETURN_SHOP_INTEGRAL
                        , Constants.ORDERSET_TOTAL_RATE)
        }*/
        List<SystemDictData> systemDictDataList = systemDictDataMapper.selectJoinList(SystemDictData.class,new MPJLambdaWrapper<SystemDictData>()
                .selectAll(SystemDictData.class)
                .leftJoin(SystemDict.class,SystemDict::getId,SystemDictData::getDictId)
                .in(SystemDict::getCode,Constants.ORDER_SET,Constants.INTEGRAL_SET)
        );
        if (com.github.xiaoymin.knife4j.core.util.CollectionUtils.isNotEmpty(systemDictDataList)) {
            for (SystemDictData systemDictData : systemDictDataList) {
@@ -279,6 +272,18 @@
                } else if (systemDictData.getLabel().equals(Constants.ORDERSET_TOTAL_RATE)) {
                    systemDictData.setCode(Constants.formatBigdecimal(platformConfigDTO.getTotalRate()).doubleValue() + "");
                }
                else if(systemDictData.getLabel().equals(Constants.INTERALSET_INTEGRALINVALIDTYPE)) {
                    systemDictData.setCode(Constants.formatIntegerNum(platformConfigDTO.getIntegralInvalidType()) + "");
                }else if(systemDictData.getLabel().equals(Constants.INTERALSET_INTEGRALINVALIDCIRCLE)) {
                    systemDictData.setCode(Constants.formatIntegerNum(platformConfigDTO.getIntegralInvalidCircle()) + "");
                }else if(systemDictData.getLabel().equals(Constants.INTERALSET_INTEGRALRULEINFO)) {
                    systemDictData.setCode(platformConfigDTO.getIntegralRuleInfo());
                }else if(systemDictData.getLabel().equals(Constants.INTERALSET_DEDUCTINTEGRALLIMIT)) {
                    systemDictData.setCode(Constants.formatIntegerNum(platformConfigDTO.getDeductIntegralLimit()) + "");
                }else if(systemDictData.getLabel().equals(Constants.INTERALSET_MININTEGRALPRICELIMIT)) {
                    systemDictData.setCode(Constants.formatBigdecimal(platformConfigDTO.getReturnShopIntegral()).doubleValue() + "");
                }
                systemDictDataMapper.update(new UpdateWrapper<SystemDictData>().lambda()
                        .set(SystemDictData::getCode, systemDictData.getCode())
                        .eq(SystemDictData::getId, systemDictData.getId()));