|
|
|
@ -95,11 +95,24 @@ function openOptionalPackageDialog(goods_type, goods_info) { |
|
|
|
|
|
|
|
|
|
// 调整卖品数量 |
|
|
|
|
function numChange(goods_id, goods_num) { |
|
|
|
|
let find_in_select = false |
|
|
|
|
selectGoods.value.forEach((goods) => { |
|
|
|
|
if (goods.id === goods_id) { |
|
|
|
|
find_in_select = true |
|
|
|
|
goods['buy_num'] = goods_num |
|
|
|
|
} |
|
|
|
|
}) |
|
|
|
|
if (find_in_select === false) { |
|
|
|
|
goodsList.forEach((item) => { |
|
|
|
|
if (item['id'] === goods_id) { |
|
|
|
|
selectGoods.value.push(item) |
|
|
|
|
console.log('可选套餐', item) |
|
|
|
|
if (item['show_type'] === '可选套餐') { |
|
|
|
|
openOptionalPackageDialog(item['show_type'], item) |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
}) |
|
|
|
|
} |
|
|
|
|
handle_set_user_data() |
|
|
|
|
} |
|
|
|
|
|
|
|
|
@ -119,18 +132,31 @@ const getOptionalPackageDetail = (select) => { |
|
|
|
|
handle_set_user_data() |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// 子组件给父组件传参的回调函数 |
|
|
|
|
const removeOptionalPackage = (select) => { |
|
|
|
|
console.log('getOptionalPackageDetail', select) |
|
|
|
|
goodsDialogVisible.value = false |
|
|
|
|
|
|
|
|
|
const g_index = selectGoods.value.indexOf(select) |
|
|
|
|
console.log('g_index', g_index) |
|
|
|
|
selectGoods.value.splice(g_index,1) |
|
|
|
|
console.log('select', select) |
|
|
|
|
console.log('removeOptionalPackage', selectGoods.value) |
|
|
|
|
handle_set_user_data() |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// 获取卖品折扣子组件的函数 |
|
|
|
|
const getDiscountDetail = (discount) => { |
|
|
|
|
console.log('getDiscountDetail', discount) |
|
|
|
|
discountDialogVisible.value = false |
|
|
|
|
discount.forEach((item) => { |
|
|
|
|
selectGoods.value.forEach((select) => { |
|
|
|
|
if (select.id === discount.id) { |
|
|
|
|
select.discount1 = item.discount1 |
|
|
|
|
select.discount2 = item.discount2 |
|
|
|
|
} |
|
|
|
|
}) |
|
|
|
|
}) |
|
|
|
|
selectGoods.value.forEach((select) => { |
|
|
|
|
if (select.id === discount.id) { |
|
|
|
|
select.discount1 = item.discount1 |
|
|
|
|
select.discount2 = item.discount2 |
|
|
|
|
} |
|
|
|
|
}) |
|
|
|
|
}) |
|
|
|
|
console.log('getDiscountDetail-selectGoods.value', selectGoods.value) |
|
|
|
|
handle_set_user_data() |
|
|
|
|
} |
|
|
|
@ -210,7 +236,8 @@ watch(() => selectGoods.value, () => { |
|
|
|
|
</el-checkbox-group> |
|
|
|
|
</el-form-item> |
|
|
|
|
</el-form> |
|
|
|
|
<PackageSelector v-if="goodsDialogVisible" @get_detail="getOptionalPackageDetail" :is_show="goodsDialogVisible" |
|
|
|
|
<PackageSelector v-if="goodsDialogVisible" @get_detail="getOptionalPackageDetail" |
|
|
|
|
@remove_package="removeOptionalPackage" :is_show="goodsDialogVisible" |
|
|
|
|
:package="optionalPackageInfo"></PackageSelector> |
|
|
|
|
<GoodsDiscount v-if="discountDialogVisible" @get_discount="getDiscountDetail" :is_show="discountDialogVisible" |
|
|
|
|
:goods_array="selectGoods"></GoodsDiscount> |
|
|
|
|