doum
13 小时以前 f93f02d8cc15732652c751f69e7319858ca6f0a4
经销商管理
已修改5个文件
79 ■■■■ 文件已修改
admin/src/components/business/OperaGoodsShopWindow.vue 17 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
admin/src/components/business/OperaShopGoodsWindow.vue 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
admin/src/views/business/platformGoods.vue 17 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
admin/src/views/business/shop.vue 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
server/dmmall_service/src/main/java/com/doumee/service/business/impl/GoodsServiceImpl.java 41 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
admin/src/components/business/OperaGoodsShopWindow.vue
@@ -109,7 +109,10 @@
              <el-input v-if="scope.row.isPriceSelected" v-model="scope.row.shopPrice"
                        @focus="focusEvent(scope.row,scope.$index,scope.column)"
                        @blur="blurEvent(scope.row,scope.$index,scope.column)" v-focus></el-input>
              <p style="cursor: pointer" class="blue" title="点击编辑" @click="cellClick(scope.row, scope.column)" v-else>{{scope.row.shopPrice || '未设置' }}</p>
              <p :style="'cursor: pointer;'+((scope.row.skuPrice||0) <= (scope.row.shopPrice||0)?'color: red':'')+';'" class="blue" title="点击编辑" @click="cellClick(scope.row, scope.column)" v-else>
                {{scope.row.shopPrice || '未设置' }}
                <i v-if="(scope.row.skuPrice||0) <= (scope.row.shopPrice||0)" class="el-icon-warning" style="color: red"></i>
              </p>
            </template>
          </el-table-column>
<!--          <el-table-column
@@ -163,7 +166,7 @@
        brandId: '',
        // 类型 0平台商城 1咖豆商城 2咖啡计划商品
        type: '0', // 平台商品
        status: '',
        status: 0,
        labels: ''
      },
      labels: [],
@@ -255,8 +258,14 @@
      row.oldShopsPrice = row.shopPrice
    },
    blurEvent (row, curIndex, column) {
      if ( !this.skuPrice || this.skuPrice <= row.shopPrice) {
        this.$tip.error('供货价不能低于销售价')
      if ( !row.skuPrice) {
        this.$tip.error('商品销售价未设置!')
        row.isPriceSelected = !row.isPriceSelected
        row.shopPrice = row.oldShopsPrice// 价格还原
        return
      }
      if (  row.skuPrice <= row.shopPrice) {
        this.$tip.error('供货价不能大于销售价')
        row.isPriceSelected = !row.isPriceSelected
        row.shopPrice = row.oldShopsPrice// 价格还原
        return
admin/src/components/business/OperaShopGoodsWindow.vue
@@ -181,7 +181,7 @@
    },
    blurEvent (row, curIndex, column) {
      if(this.price <= row.goodsPrice) {
        this.$tip.error('供货价不能低于销售价')
        this.$tip.error('供货价不能大于销售价')
        row.isPriceSelected = !row.isPriceSelected
        row.goodsPrice = row.oldGoodsPrice// 价格还原
        return
admin/src/views/business/platformGoods.vue
@@ -62,7 +62,7 @@
        <li><el-button type="primary" icon="el-icon-plus" @click="$refs.operaGoodsWindow.open('新建商品', null, 0)" v-permissions="['business:goods:create']">新建</el-button></li>
        <li><el-button type="primary"  icon="el-icon-edit"  @click="issued(0)">上架</el-button></li>
        <li><el-button type="danger"  icon="el-icon-edit"  @click="issued(1)">下架</el-button></li>
        <li><p class="tip-warn" style="width: 100%;margin-left: 20px;"><i class="el-icon-warning"></i>提示:【供货价设置】只统计启用状态的供销商设置数据</p></li>
        <li><p class="tip-warn" style="width: 100%;margin-left: 20px;"><i class="el-icon-warning"></i>提示:【供货价设置】只统计启用状态的供销商设置数据,(已定价供销商数/全部供销商数)</p></li>
      </ul>
      <el-table
        v-loading="isWorking.search"
@@ -143,7 +143,7 @@
export default {
  name: 'Goods',
  extends: BaseTable,
  components: { TableLayout, Pagination, OperaGoodsWindow, OperaGoodsDetailWindow, OperaPlatformGoodsSkuWindow ,OperaShopGoodsWindow},
  components: { TableLayout, Pagination, OperaGoodsWindow, OperaGoodsDetailWindow, OperaPlatformGoodsSkuWindow, OperaShopGoodsWindow },
  data () {
    return {
      activeName: 'first',
@@ -190,15 +190,15 @@
      })
  },
  methods: {
    priceSuccess(){
    priceSuccess () {
      this.handlePageChange()
    },
    goPriceSet(row){
      if(row.skuPrice == null){
    goPriceSet (row) {
      if (row.skuPrice == null) {
        this.$tip.warning('请先设置商品销售价!')
        return
      }
      this.$refs.OperaShopGoodsWindow.open('设置供货价 - '+row.name, row )
      this.$refs.OperaShopGoodsWindow.open('设置供货价 - ' + row.name, row)
    },
    handleClick (val) {
@@ -215,6 +215,11 @@
      const message = `确认${status === 0 ? '上架' : '下架'}选中的商品么?`
      this.$dialog.messageWaring(message)
        .then(() => {
          var temp = []
          this.tableData.selectedRows.forEach(item => {
            temp.push({ id: item.id, name: item.name, status: status })
          })
          this.statusChangeBiz(temp)
        })
    },
    statusChange (row) {
admin/src/views/business/shop.vue
@@ -32,7 +32,7 @@
      <ul class="toolbar" >
        <li><el-button type="primary" @click="$refs.operaShopWindow.open('新建经销商')" icon="el-icon-plus" v-permissions="['business:shop:create']">新建</el-button></li>
        <!-- <li><el-button @click="deleteByIdInBatch" icon="el-icon-delete" v-permissions="['business:shop:delete']">删除</el-button></li> -->
        <li><p class="tip-warn" style="width: 100%;margin-left: 20px;"><i class="el-icon-warning"></i>提示:【供货价设置】只统计上架状态的商品价格设置数据</p></li>
        <li><p class="tip-warn" style="width: 100%;margin-left: 20px;"><i class="el-icon-warning"></i>提示:【供货价设置】只统计上架状态的商品价格设置数据,(已定价商品数/全部商品数)</p></li>
      </ul>
      <el-table
        v-loading="isWorking.search"
server/dmmall_service/src/main/java/com/doumee/service/business/impl/GoodsServiceImpl.java
@@ -372,6 +372,7 @@
        if(goodsSkuList==null || goodsSkuList.size() == 0){
            throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(), "商品尚未设置零售价,请先设置价格! ");
        }
        List<Integer> idList2 = new ArrayList<>();
        for(Goods param: list){
            Goods goods = getGoodsFromListById(param.getId(),goodsList,goodsSkuList);
            if(goods ==null ){
@@ -379,25 +380,47 @@
            }
            //如果是上架
            goods.setGoodsSkuList(goodsSkuList);
            boolean s =true;
            if(goods.getSkuPrice() == null || goods.getSkuPrice().compareTo(new BigDecimal(0)) <=0){
                //默认sku信息
                throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(), goods.getName()+":商品商品尚未设置零售价,无法上架");
                s =false;
                if(idList.size()==1) {
                 throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(), goods.getName()+":商品商品尚未设置零售价,无法上架");
                }
            }
            if(Constants.formatLongNum(goods.getPricedShopNum()) <= shopNum){
            if(Constants.formatLongNum(goods.getPricedShopNum()) < shopNum){
                //默认sku信息
                throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(), goods.getName()+":有未设置供货价的经销商,无法上架");
                s =false;
                if(idList.size()==1){
                  throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(), goods.getName()+":有未设置供货价的经销商,无法上架");
                }
            }
            if(s){
                idList2.add(param.getId());
            }
        }
        goodsMapper.update(null,new UpdateWrapper<Goods>().lambda()
                .set(Goods::getEditDate,new Date() )
                .set(Goods::getEditor,user.getId())
                .set(Goods::getStatus,Constants.ZERO )
                .in(Goods::getId,idList));
        int successNum = 0;
        if(idList2.size()>0){
            successNum = goodsMapper.update(null,new UpdateWrapper<Goods>().lambda()
                    .set(Goods::getEditDate,new Date() )
                    .set(Goods::getEditor,user.getId())
                    .set(Goods::getStatus,Constants.ZERO )
                    .in(Goods::getId,idList2));
        }
        if(successNum != idList.size()){
            if( idList.size()>1){
                throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(), "成功上架商品数:【"+successNum+"】,上架失败:【"+(idList.size()-successNum)+"】个商品,请确保待上架商品的均销售价和供货价已设置");
            }else {
                throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode()," 上架失败");
            }
        }
    }
    private Goods getGoodsFromListById(Integer id, List<Goods> goodsList, List<GoodsSku> skuList) {
        for(Goods model: goodsList){
            if(Constants.equalsObject(model.getIdList(),id)){
            if(Constants.equalsInteger(model.getId(),id)){
                for(GoodsSku sku :skuList){
                    if(Constants.equalsInteger(sku.getGoodsId(),id)){
                        model.setSkuPrice(sku.getPrice());