| | |
| | | <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 |
| | |
| | | brandId: '', |
| | | // 类型 0平台商城 1咖豆商城 2咖啡计划商品 |
| | | type: '0', // 平台商品 |
| | | status: '', |
| | | status: 0, |
| | | labels: '' |
| | | }, |
| | | labels: [], |
| | |
| | | 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 |
| | |
| | | }, |
| | | blurEvent (row, curIndex, column) { |
| | | if(this.price <= row.goodsPrice) { |
| | | this.$tip.error('供货价不能低于销售价') |
| | | this.$tip.error('供货价不能大于销售价') |
| | | row.isPriceSelected = !row.isPriceSelected |
| | | row.goodsPrice = row.oldGoodsPrice// 价格还原 |
| | | return |
| | |
| | | <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" |
| | |
| | | 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) { |
| | |
| | | <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" |
| | |
| | | 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 ){ |
| | |
| | | } |
| | | //如果是上架 |
| | | goods.setGoodsSkuList(goodsSkuList); |
| | | boolean s =true; |
| | | if(goods.getSkuPrice() == null || goods.getSkuPrice().compareTo(new BigDecimal(0)) <=0){ |
| | | //默认sku信息 |
| | | 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信息 |
| | | s =false; |
| | | if(idList.size()==1){ |
| | | throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(), goods.getName()+":有未设置供货价的经销商,无法上架"); |
| | | } |
| | | |
| | | } |
| | | goodsMapper.update(null,new UpdateWrapper<Goods>().lambda() |
| | | if(s){ |
| | | idList2.add(param.getId()); |
| | | } |
| | | } |
| | | 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,idList)); |
| | | .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()); |