Commit 1ca029eb authored by zhaofei's avatar zhaofei

s

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