This commit is contained in:
2026-04-28 14:05:52 +08:00
parent f1b6440034
commit ba32423fcf
2 changed files with 16 additions and 2 deletions

View File

@@ -56,6 +56,7 @@
<image-preview :src="scope.row.imageUrl" :width="40" :height="40" /> <image-preview :src="scope.row.imageUrl" :width="40" :height="40" />
</template> </template>
</el-table-column> </el-table-column>
<el-table-column align="center" prop="itemName" label="物品名称"></el-table-column>
<el-table-column align="center" prop="usePrice" label="金额"></el-table-column> <el-table-column align="center" prop="usePrice" label="金额"></el-table-column>
<!-- <el-table-column align="center" prop="usePrice" label="颜色"></el-table-column> --> <!-- <el-table-column align="center" prop="usePrice" label="颜色"></el-table-column> -->
<el-table-column align="center" prop="ornamentsNum" label="数量" width="50"> <el-table-column align="center" prop="ornamentsNum" label="数量" width="50">
@@ -200,7 +201,7 @@
v-for="(item,index) in orList" v-for="(item,index) in orList"
:key="index" :key="index"
@click="addOr(item)" @click="addOr(item)"
>{{ item.itemName }} - {{ item.usePrice }}</div> >{{ item.name }} - {{ item.usePrice }}</div>
</div> </div>
<div v-else> <div v-else>
<div style="margin:0 auto; text-align:center; margin-top:10px;">无此名称饰品名称</div> <div style="margin:0 auto; text-align:center; margin-top:10px;">无此名称饰品名称</div>
@@ -298,9 +299,19 @@ export default {
}, },
handleChange(res) { handleChange(res) {
this.type = 2; this.type = 2;
this.title = "编辑物品";
this.dialogFormVisible = true; this.dialogFormVisible = true;
this.formAdd = res; // 深拷贝,避免直接修改表格行数据
this.formAdd = Object.assign({}, res);
this.formAdd.jackpotId = Number(this.$route.query.id); this.formAdd.jackpotId = Number(this.$route.query.id);
// price 为空时用 usePrice 兜底,防止后端 NPE
if (this.formAdd.price == null || this.formAdd.price === '') {
this.formAdd.price = res.usePrice || 0;
}
// 回显奖池选择框名称
this.orOnselects.itemName = res.itemName
? (res.itemName + ' - ¥' + this.formAdd.price)
: ('¥' + this.formAdd.price);
}, },
// 点击数量修改数量 // 点击数量修改数量
handleChangeOrnum(res) { handleChangeOrnum(res) {
@@ -347,6 +358,8 @@ export default {
addOr(res) { addOr(res) {
this.formAdd.ornamentsId = res.id; this.formAdd.ornamentsId = res.id;
this.formAdd.price = res.usePrice; this.formAdd.price = res.usePrice;
this.formAdd.ornamentName = res.name; // 存入物品名称
this.formAdd.imgUrl = res.imageUrl; // 存入图片URL
this.orOnselect = res; this.orOnselect = res;
this.orOnselects.itemName = res.name + " - ¥" + res.usePrice; this.orOnselects.itemName = res.name + " - ¥" + res.usePrice;
this.$refs.morePop.doClose(); this.$refs.morePop.doClose();

View File

@@ -56,6 +56,7 @@ public class TtRollJackpotOrnamentsServiceImpl extends ServiceImpl<TtRollJackpot
.list(); .list();
BigDecimal total = BigDecimal.ZERO; BigDecimal total = BigDecimal.ZERO;
for (TtRollJackpotOrnaments item : list){ for (TtRollJackpotOrnaments item : list){
if (item.getPrice() == null) continue;
total = total.add(item.getPrice().multiply(new BigDecimal(item.getOrnamentsNum()))); total = total.add(item.getPrice().multiply(new BigDecimal(item.getOrnamentsNum())));
} }
new LambdaUpdateChainWrapper<>(ttRollJackpotMapper) new LambdaUpdateChainWrapper<>(ttRollJackpotMapper)