|
|
|
@ -178,6 +178,17 @@ |
|
|
|
|
<input placeholder="请输入加价利润率" @input="validateAmount" v-model="rate" class="input" type="text" /> |
|
|
|
|
</div> |
|
|
|
|
</a-modal> |
|
|
|
|
<a-modal |
|
|
|
|
v-model:visible="batchPrice" |
|
|
|
|
width="450px" |
|
|
|
|
title="批量加价" |
|
|
|
|
@ok="handleBatchPrice(selectedRowKeys, batchRate)" |
|
|
|
|
> |
|
|
|
|
<div class="fen" style="margin-top:-10px"> |
|
|
|
|
<span style="margin-right: 5px">加价利润率:</span> |
|
|
|
|
<input placeholder="请输入加价利润率" @input="validateBatchAmount" v-model="batchRate" class="input" type="text" /> |
|
|
|
|
</div> |
|
|
|
|
</a-modal> |
|
|
|
|
<a-modal |
|
|
|
|
v-model:visible="saleVisible" |
|
|
|
|
width="250px" |
|
|
|
@ -252,6 +263,12 @@ |
|
|
|
|
@click="priceVisible = true" |
|
|
|
|
>分类加价</a-button |
|
|
|
|
> |
|
|
|
|
<a-button |
|
|
|
|
v-if="selectedRowKeys.length" |
|
|
|
|
style="background-color: #67C23A; color: #fff; border: none; border-radius: 2px" |
|
|
|
|
@click="batchPrice = true" |
|
|
|
|
>批量加价</a-button |
|
|
|
|
> |
|
|
|
|
<a-button |
|
|
|
|
style="background-color: #501212; color: #fff; border: none; border-radius: 2px" |
|
|
|
|
@click="handleExport(selectedRowKeys)" |
|
|
|
@ -516,6 +533,7 @@ export default { |
|
|
|
|
saleVisible: false, |
|
|
|
|
priceVisible: false, |
|
|
|
|
jingPinVisible: false, |
|
|
|
|
batchPrice:false, |
|
|
|
|
specsType: [ |
|
|
|
|
{ name: '全部', val: '' }, |
|
|
|
|
{ name: '单规格', val: 10 }, |
|
|
|
@ -550,6 +568,7 @@ export default { |
|
|
|
|
categoryIds: [], |
|
|
|
|
categoryPriceIds: [], |
|
|
|
|
rate: '', |
|
|
|
|
batchRate:'', |
|
|
|
|
pickerOptions: { |
|
|
|
|
disabledDate(time) { |
|
|
|
|
return time.getTime() > Date.now() |
|
|
|
@ -736,11 +755,11 @@ export default { |
|
|
|
|
this.$message.error('金额不能小于0') |
|
|
|
|
this.rate = '' |
|
|
|
|
} else if (row.startsWith('0')) { |
|
|
|
|
this.money = '' |
|
|
|
|
this.rate = '' |
|
|
|
|
// 金额小数部分不能超过2位 |
|
|
|
|
} else if (!/^\d+(\.\d{1,2})?$/.test(row)) { |
|
|
|
|
this.$message.error('请输入数字!') |
|
|
|
|
this.money = '' |
|
|
|
|
this.rate = '' |
|
|
|
|
} else if (row.split('.')[1] && row.split('.')[1].length > 2) { |
|
|
|
|
this.$message.error('金额小数部分不能超过2位,请修改') |
|
|
|
|
this.rate = '' |
|
|
|
@ -921,6 +940,39 @@ export default { |
|
|
|
|
this.isLoading = false |
|
|
|
|
}) |
|
|
|
|
}, |
|
|
|
|
validateBatchAmount() { |
|
|
|
|
const row = this.batchRate |
|
|
|
|
// 金额不能小于0 |
|
|
|
|
if (row < 0) { |
|
|
|
|
this.$message.error('金额不能小于0') |
|
|
|
|
this.batchRate = '' |
|
|
|
|
} else if (row.startsWith('0')) { |
|
|
|
|
this.batchRate = '' |
|
|
|
|
// 金额小数部分不能超过2位 |
|
|
|
|
} else if (!/^\d+(\.\d{1,2})?$/.test(row)) { |
|
|
|
|
this.$message.error('请输入数字!') |
|
|
|
|
this.batchRate = '' |
|
|
|
|
} else if (row.split('.')[1] && row.split('.')[1].length > 2) { |
|
|
|
|
this.$message.error('金额小数部分不能超过2位,请修改') |
|
|
|
|
this.batchRate = '' |
|
|
|
|
} |
|
|
|
|
}, |
|
|
|
|
handleBatchPrice(goodsIds, rate) { |
|
|
|
|
if (!rate) { |
|
|
|
|
this.$message.warn('请输入加价利润率', 1.5) |
|
|
|
|
return |
|
|
|
|
} |
|
|
|
|
this.isLoading = true |
|
|
|
|
GoodsApi.batchAddPrice({ goodsIds, rate }) |
|
|
|
|
.then((result) => { |
|
|
|
|
this.batchPrice = false |
|
|
|
|
this.$message.success(result.message, 1.5) |
|
|
|
|
this.handleRefresh() |
|
|
|
|
}) |
|
|
|
|
.finally((result) => { |
|
|
|
|
this.isLoading = false |
|
|
|
|
}) |
|
|
|
|
}, |
|
|
|
|
// 停售 |
|
|
|
|
handleUpdateSales(goodsIds, is_sale) { |
|
|
|
|
this.isLoading = true |
|
|
|
|