Commit a9a5da2a authored by qinhaitao's avatar qinhaitao

fix: 🐛 bug

parent 458f3136
...@@ -111,13 +111,14 @@ ...@@ -111,13 +111,14 @@
class="probability-prize-content-formItem" class="probability-prize-content-formItem"
label="奖品描述" label="奖品描述"
validateState="{{prizeDescTips.status}}" validateState="{{prizeDescTips.status}}"
help="{{prizeDescTips.content}}" help="{{prizeDescTips.content}}">
required>
<input <input
class="probability-prize-content-input edit-probability-input" class="probability-prize-content-input edit-probability-input"
type="desc" type="desc"
onChange="onChangePrizeValue" onChange="onChangePrizeValue"
data-name="desc" data-name="desc"
maxLength="{{30}}"
hasLimitHint="{{true}}"
value="{{prizeInitData.desc}}" value="{{prizeInitData.desc}}"
name="奖品描述" name="奖品描述"
defaultValue="{{prizeInitData.desc}}" defaultValue="{{prizeInitData.desc}}"
......
...@@ -16,7 +16,7 @@ const STOCK_NO_LIMIT = 2; ...@@ -16,7 +16,7 @@ const STOCK_NO_LIMIT = 2;
const INIT_DATA = { const INIT_DATA = {
ename: "", ename: "",
stock: "", stock: "",
type: 1, type: EQUITY_TYPE,
image: "", image: "",
desc: "", desc: "",
useUrl: "", useUrl: "",
...@@ -221,7 +221,7 @@ Component({ ...@@ -221,7 +221,7 @@ Component({
onPrizeTypeChange(e) { onPrizeTypeChange(e) {
let value = e.detail.value; let value = e.detail.value;
const { type, rank } = this.data.prizeInitData; const { type, rank, isBackUp } = this.data.prizeInitData;
let initData = { let initData = {
ename: "", ename: "",
stock: "", stock: "",
...@@ -265,7 +265,7 @@ Component({ ...@@ -265,7 +265,7 @@ Component({
}); });
} else { } else {
this.setData({ this.setData({
prizeInitData: INIT_DATA, prizeInitData: { ...INIT_DATA, type: typeChecked.length ? +typeChecked[0]: EQUITY_TYPE } ,
}); });
} }
}, },
...@@ -436,11 +436,11 @@ Component({ ...@@ -436,11 +436,11 @@ Component({
// } // }
// } // }
if (type == EQUITY_TYPE || type == OBJECT_TYPE) { if (type == EQUITY_TYPE || type == OBJECT_TYPE) {
if (!desc) { // if (!desc) {
this.showItemTips("prizeDescTips", "error", "请填写奖品描述"); // this.showItemTips("prizeDescTips", "error", "请填写奖品描述");
} else { // } else {
this.showItemTips("prizeDescTips", "success", ""); // this.showItemTips("prizeDescTips", "success", "");
} // }
if (!name) { if (!name) {
this.showItemTips("nameTips", "error", "请输入奖品名称"); this.showItemTips("nameTips", "error", "请输入奖品名称");
} else { } else {
...@@ -451,7 +451,7 @@ Component({ ...@@ -451,7 +451,7 @@ Component({
} }
} }
// 库存奖品的库存值判断 // 库存奖品的库存值判断
let usePass = switchStock == 1 ? +stock > (useStock || 0) : true; let usePass = switchStock == 1 ? +stock >= (useStock || 0) : true;
let stockPass = switchStock == 1 ? validateRangeNumber(stock, [0, 99999]) : true; let stockPass = switchStock == 1 ? validateRangeNumber(stock, [0, 99999]) : true;
if (!stockPass || !usePass) { if (!stockPass || !usePass) {
this.showItemTips( this.showItemTips(
...@@ -468,7 +468,7 @@ Component({ ...@@ -468,7 +468,7 @@ Component({
); );
} }
if (type == CREDITS_TYPE && !validateRangeNumber(credits, [0, 999])) { if (type == CREDITS_TYPE && (!validateRangeNumber(credits, [0, 999]) || !credits)) {
this.showItemTips( this.showItemTips(
"creditsValueTips", "creditsValueTips",
"error", "error",
......
...@@ -22,7 +22,7 @@ ...@@ -22,7 +22,7 @@
<table-column title="奖品数量(件)" dataIndex="stock"> <table-column title="奖品数量(件)" dataIndex="stock">
<view slot-scope="x">{{x.value || '-'}}</view> <view slot-scope="x">{{x.value || '-'}}</view>
</table-column> </table-column>
<table-column title="中奖概率(%)" dataIndex="probability"> <table-column a:if="{{type==='probability'}}" title="中奖概率(%)" dataIndex="probability">
<view slot-scope="x">{{x.value}}</view> <view slot-scope="x">{{x.value}}</view>
</table-column> </table-column>
<table-column title="操作"> <table-column title="操作">
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment