Commit 1ca029eb authored by zhaofei's avatar zhaofei

s

parent 13f57aa0
.db-layout {
padding: 25px 75px;
padding: 25px 20px;
display: flex;
}
.db-content {
......
......@@ -47,7 +47,7 @@
</form-item>
<form-item
a:if="{{(prizeInitData.type == OBJECT_TYPE || prizeInitData.type == EQUITY_TYPE) && type === 'probability'}}"
a:if="{{(prizeInitData.type == OBJECT_TYPE || prizeInitData.type == EQUITY_TYPE) && type !== 'rank'}}"
style="width:100%"
size="large"
class="probability-prize-content-formItem"
......@@ -60,7 +60,7 @@
</form-item>
<form-item
style="width:100%"
a:if="{{(prizeInitData.type == OBJECT_TYPE || prizeInitData.type == EQUITY_TYPE) && prizeInitData.switchStock==1 && type === 'probability'}}"
a:if="{{(prizeInitData.type == OBJECT_TYPE || prizeInitData.type == EQUITY_TYPE) && prizeInitData.switchStock==1 && type !== 'rank'}}"
size="large"
class="probability-prize-content-formItem"
label="奖品库存"
......@@ -171,11 +171,31 @@
defaultValue="{{prizeInitData.probability}}"
placeholder="当前概率不能超过100"/>%
</form-item>
<form-item
a:if="{{prizeInitData.type == OBJECT_TYPE}}"
style="width:100%" size="large"
class="probability-prize-content-formItem probability-prize-content-formItem-choosePrize"
label="商品查看链接">
<view class="probability-prize-content-formitem-choosePrize-wrap">
<view
class="probability-prize-content-formitem-goequity"
onTap="onOpenDialog"
type="primary">{{prizeInitData.itemId ? '更换商品' : '可选择商品'}}
</view>
</view>
</form-item>
</form>
</view>
<view class="probability-prize-content-btn">
<button class="probability-prize-content-btn_confirm" onTap="updatePrize" type="primary">确定</button>
<button onTap="onCloseDialog">取消</button>
</view>
<items-dialog
a:if="{{goodsVisible}}"
onUpdateBabyChoose="onUpdateBabyChoose"
browseItemIds="{{itemIds}}"
showBaby="{{goodsVisible}}"
onClose="onCloseGoodsDialog" />
</view>
</dialog-wrap>
\ No newline at end of file
......@@ -26,11 +26,15 @@ const INIT_DATA = {
switchStock: STOCK_NO_LIMIT,
useStock: 0,
rank: "",
amount: "",
itemId: "",
};
Component({
mixins: [],
data: {
goodsVisible: false,
itemIds: '',
EQUITY_TYPE,
CREDITS_TYPE,
OBJECT_TYPE,
......@@ -92,6 +96,8 @@ Component({
switchStock: STOCK_NO_LIMIT,
useStock: 0,
rank: "",
amount: "",
itemId: "",
},
},
props: {
......@@ -143,6 +149,7 @@ Component({
startTime,
endTime,
stock,
amount
} = data[0];
if (success) {
//切换不同优惠券内容置空
......@@ -155,6 +162,7 @@ Component({
startTime,
endTime,
stock: stock,
amount
},
});
} else {
......@@ -169,6 +177,7 @@ Component({
stock: "",
useStock: 0,
switchStock: 2,
amount: 0
},
});
}
......@@ -345,6 +354,8 @@ Component({
switchStock,
endTime,
rank,
itemId,
amount,
...rest
} = this.data.prizeInitData;
const { imageTips } = this.data;
......@@ -423,7 +434,7 @@ Component({
}
// 库存奖品的库存值判断
let usePass = switchStock == 1 ? +stock > (useStock || 0) : true;
let stockPass = switchStock == 1 ? validateRangeNumber(credits, [0, 99999]) : true;
let stockPass = switchStock == 1 ? validateRangeNumber(stock, [0, 99999]) : true;
if (!stockPass || !usePass) {
this.showItemTips(
"prizeNumberTips",
......@@ -533,13 +544,15 @@ Component({
rank,
switchStock,
prizeDataType,
itemId,
amount,
...rest,
};
// 自定义新增字段
if (conditionKeys && conditionKeys.length) {
const conditions = {}
conditionKeys.forEach(item => {
conditions[item.key] = conditions[item.value]
conditions[item.key] = item.value
});
prizeData = {
...prizeData,
......@@ -573,5 +586,38 @@ Component({
onCloseDialog() {
this.props.onClose && this.props.onClose();
},
onOpenDialog() {
this.setData({
goodsVisible: true,
itemIds: this.data.prizeInitData.itemId ? this.data.prizeInitData.itemId + '' : null
});
},
onCloseGoodsDialog() {
this.setData({
goodsVisible: false
});
},
// 选择商品查看id
onUpdateBabyChoose(ids) {
if (!ids) {
this.setData({
itemIds: '',
prizeInitData: {
...this.data.prizeInitData,
itemId: '',
},
})
return
}
const chooseId = ids.split(",").map((i) => +i);
this.setData({
itemIds: ids,
prizeInitData: {
...this.data.prizeInitData,
itemId: chooseId[0],
},
})
},
},
});
......@@ -7,6 +7,7 @@
}
},
"usingComponents": {
"dialog-wrap": "../../basic/dialiog-wrap/dialiog-wrap"
"dialog-wrap": "../../basic/dialiog-wrap/dialiog-wrap",
"items-dialog": "/components/dialog/items-dialog/items-dialog"
}
}
\ No newline at end of file
......@@ -42,7 +42,7 @@
conditionKeys="{{conditionKeys}}"
prizeDialogData="{{prizeDialogData}}"
onClose="onCloseDialog"
type="probablity"
type="{{type}}"
imageLimit="{{imageLimit}}"
prizeDataType="{{prizeDataType}}"
onUpdate="onPrizeUpdate"
......
......@@ -12,7 +12,8 @@ Component({
dataName: '',
conditionKeys: [],
imageLimit: [250, 250],
prizeDataType: null
prizeDataType: null,
type:''
},
didMount() { },
didUpdate() { },
......
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