parent
e8e0b0860f
commit
a74490afd8
9 changed files with 517 additions and 26 deletions
@ -0,0 +1,31 @@ |
||||
<script setup> |
||||
|
||||
</script> |
||||
|
||||
<template> |
||||
<el-row type="flex" justify="start" align="middle" style="margin-left: 20px"> |
||||
<el-col :span="1" style="font-size: 14px; font-weight: bold; color: #919399;" class="col-right">售卖类型</el-col> |
||||
<el-col :span="5" class="col-left"> |
||||
<el-radio-group v-model="selectSaleType"> |
||||
<el-radio label="ticket">单影票</el-radio> |
||||
<el-radio label="goods">单卖品</el-radio> |
||||
<el-radio label="all">影票加卖品</el-radio> |
||||
</el-radio-group> |
||||
</el-col> |
||||
</el-row> |
||||
<el-row type="flex" justify="start" align="middle" style="margin-left: 20px"> |
||||
<el-col :span="1" style="font-size: 14px; font-weight: bold; color: #919399;" class="col-right">支付方式</el-col> |
||||
<el-col :span="5" class="col-left"> |
||||
<el-radio-group v-model="selectPayType"> |
||||
<el-radio label="cash">普通支付</el-radio> |
||||
<el-radio label="ecard">联名卡</el-radio> |
||||
<el-radio label="yushouquan">扫码券</el-radio> |
||||
<el-radio label="equan">会员卡赠券</el-radio> |
||||
</el-radio-group> |
||||
</el-col> |
||||
</el-row> |
||||
</template> |
||||
|
||||
<style scoped> |
||||
|
||||
</style> |
@ -0,0 +1,186 @@ |
||||
<script setup> |
||||
import {ref, watch, onBeforeMount} from 'vue' |
||||
import {get_ec_api_get_quan} from "@/apis/ec_api.js"; |
||||
|
||||
// 定义props接收父组件参数 |
||||
const props = defineProps(['cid']) |
||||
// 定义emits用于回传参数 |
||||
const emits = defineEmits(['getQuan', 'getSaleType']) |
||||
|
||||
// 用于标记券类型 |
||||
const quan_type = ref('yushouquan') |
||||
|
||||
// 券属性 |
||||
const quanArray = ref([]) |
||||
const selectQuan = ref([]) |
||||
|
||||
// 卡券属性 |
||||
const cardNum = ref('') |
||||
const cardQuanArray = ref([]) |
||||
const selectCardQuan = ref() |
||||
const selectCardQuanArray = ref([]) |
||||
const useCardQuanNum = ref(1) |
||||
const useCardQuanNumMax = ref(1) |
||||
const allSelectCardQuan = ref([]) |
||||
|
||||
// 售卖类型 |
||||
const selectSaleType = ref('ticket') |
||||
|
||||
// 通过接口获取券信息 |
||||
async function get_quan() { |
||||
console.log('get_quan') |
||||
await get_ec_api_get_quan(props.cid, cardNum.value).then( |
||||
res => { |
||||
quanArray.value = res.quan |
||||
cardQuanArray.value = res.card_quan |
||||
cardQuanArray.value.forEach(item => { |
||||
item['label'] = item['cinema_quan_name'] + ' 可用数量' + item['quan_remain_nums'] |
||||
}) |
||||
console.log('quanArray.value', quanArray.value) |
||||
console.log('cardQuanArray.value', cardQuanArray.value) |
||||
} |
||||
).catch( |
||||
err => { |
||||
console.log(err) |
||||
} |
||||
) |
||||
} |
||||
|
||||
// 点击会员卡券的查询时请求接口获取券信息 |
||||
function get_card_quan() { |
||||
if (cardNum.value === '') { |
||||
alert('请输入卡号后查询!') |
||||
return |
||||
} |
||||
get_quan() |
||||
} |
||||
|
||||
// 追加卡券到已选数据中 |
||||
function add_card_quan() { |
||||
cardQuanArray.value.forEach(item => { |
||||
if (item['card_quan_order_id'] === selectCardQuan.value) { |
||||
if (selectCardQuanArray.value.indexOf(selectCardQuan.value) < 0) { |
||||
allSelectCardQuan.value.push( |
||||
{ |
||||
'card_num': cardNum.value, |
||||
'card_coupon_order_id': selectCardQuan.value, |
||||
'num': useCardQuanNum.value |
||||
} |
||||
) |
||||
selectCardQuanArray.value.push(selectCardQuan.value) |
||||
}else{ |
||||
alert('此卡券已添加请选择其他卡券!') |
||||
} |
||||
} |
||||
}) |
||||
console.log('allSelectCardQuan.value', allSelectCardQuan.value) |
||||
console.log('checkQuan-') |
||||
emits('getQuan', selectQuan.value, allSelectCardQuan.value, quan_type.value) |
||||
} |
||||
|
||||
function clear_card_quan() { |
||||
allSelectCardQuan.value = [] |
||||
selectCardQuanArray.value = [] |
||||
emits('getQuan', selectQuan.value, allSelectCardQuan.value, quan_type.value) |
||||
} |
||||
|
||||
onBeforeMount(() => { |
||||
get_quan() |
||||
}) |
||||
|
||||
// 监视选择的券,如果变化则回调父组件 |
||||
watch(() => selectQuan.value, () => { |
||||
console.log('selectQuan', selectQuan.value) |
||||
console.log('selectSaleType.value', selectSaleType.value) |
||||
emits('getQuan', selectQuan.value, allSelectCardQuan.value, quan_type.value) |
||||
}) |
||||
|
||||
// 监视选择的卡券 |
||||
watch(() => selectCardQuan.value, () => { |
||||
cardQuanArray.value.forEach(item => { |
||||
if (item['card_quan_order_id'] === selectCardQuan.value) { |
||||
useCardQuanNumMax.value = item['quan_remain_nums'] |
||||
} |
||||
}) |
||||
}) |
||||
|
||||
watch( ()=>selectSaleType.value, () => { |
||||
emits('getSaleType', selectSaleType.value) |
||||
}) |
||||
|
||||
// 测试用方法 |
||||
function test() { |
||||
console.log('selectCardQuan', selectCardQuan.value) |
||||
} |
||||
</script> |
||||
|
||||
<template> |
||||
<div> |
||||
<el-row type="flex" justify="start" align="middle" style="margin-left: 20px"> |
||||
<el-col :span="1" style="font-size: 14px; font-weight: bold; color: #919399;" class="col-right">售卖类型</el-col> |
||||
<el-col :span="5" class="col-left"> |
||||
<el-radio-group v-model="selectSaleType"> |
||||
<el-radio label="ticket">单影票</el-radio> |
||||
<el-radio label="goods">单卖品</el-radio> |
||||
<el-radio label="all">影票加卖品</el-radio> |
||||
</el-radio-group> |
||||
</el-col> |
||||
</el-row> |
||||
<el-row type="flex" justify="start" align="middle" style="margin: 20px 0 0 20px"> |
||||
<el-col :span="1" style="font-size: 14px; font-weight: bold; color: #919399;" class="col-right">券类型</el-col> |
||||
<el-col :span="5" class="col-left"> |
||||
<el-radio-group v-model="quan_type" @change="test"> |
||||
<el-radio label="yushouquan">扫码券</el-radio> |
||||
<el-radio label="equan">会员卡赠券</el-radio> |
||||
</el-radio-group> |
||||
</el-col> |
||||
</el-row> |
||||
<el-row v-if="quan_type==='yushouquan'" style="margin: 20px 0 30px 100px"> |
||||
<el-select-v2 |
||||
v-model="selectQuan" |
||||
filterable |
||||
:options="quanArray" |
||||
placeholder="选择券,可多选" |
||||
multiple |
||||
clearable="clearable" |
||||
collapse-tags |
||||
collapse-tags-tooltip |
||||
:max-collapse-tags="2" |
||||
style="width: 460px" |
||||
/> |
||||
</el-row> |
||||
<el-row v-if="quan_type==='equan'" style="margin: 20px 0 30px 100px"> |
||||
<el-input style="width: 240px; margin-right: 20px" v-model="cardNum"></el-input> |
||||
<el-button style="margin-right: 20px" @click="get_card_quan">查找</el-button> |
||||
<el-select v-model="selectCardQuan" placeholder="选择卡内赠券" |
||||
clearable="clearable" style="margin-right: 20px"> |
||||
<el-option v-for="item in cardQuanArray" :key="item['card_quan_order_id']" :label="item['label']" |
||||
:value="item['card_quan_order_id']"> |
||||
{{ item['label'] }} |
||||
</el-option> |
||||
|
||||
</el-select> |
||||
<el-input-number v-model="useCardQuanNum" :min="1" :max="useCardQuanNumMax" |
||||
style="margin-right: 20px"></el-input-number> |
||||
<el-button @click="add_card_quan">追加</el-button> |
||||
<el-button @click="clear_card_quan">重选</el-button> |
||||
</el-row> |
||||
</div> |
||||
</template> |
||||
|
||||
<style scoped> |
||||
.col-right { |
||||
display: flex; |
||||
justify-content: end; |
||||
align-items: center; |
||||
height: 100%; |
||||
} |
||||
|
||||
.col-left { |
||||
display: flex; |
||||
justify-content: start; |
||||
align-items: center; |
||||
height: 100%; |
||||
margin-left: 20px; |
||||
} |
||||
</style> |
@ -0,0 +1,47 @@ |
||||
<script setup> |
||||
const props = defineProps(['is_show', 'goods_array']) |
||||
const emits = defineEmits(['get_discount']) |
||||
|
||||
function finish() { |
||||
const discount_goods = [] |
||||
props.goods_array.forEach((goods) => { |
||||
if (goods.discount1 !== 0 || goods.discount2 !== 0) { |
||||
discount_goods.push(goods) |
||||
} |
||||
}) |
||||
emits('get_discount', discount_goods) |
||||
} |
||||
</script> |
||||
|
||||
<template> |
||||
<el-dialog v-model="props.is_show" :width="900"> |
||||
<div style="text-align: left; margin-left: 20px"> |
||||
<span style="font-weight: bold;">输入卖品折扣</span>   |
||||
<span style="font-size: 12px">如果不设置则表示没有三方折扣,最多允许设置两组折扣</span> |
||||
</div> |
||||
<div> |
||||
<el-row v-for="goods in props.goods_array" :key="goods.id" style="margin: 10px 0 0 80px"> |
||||
<el-col :span="9" style="text-align: left"><span>{{ goods.id }}</span>  <span>{{ goods.name }}</span>  <span>{{ |
||||
goods.final_price |
||||
}}</span></el-col> |
||||
<el-col :span="12">输入卖品三方折扣   |
||||
<el-input-number :min="0" :max="parseFloat(goods.final_price)" :precision="2" size="small" :step="0.01" |
||||
v-model="goods.discount1"></el-input-number> |
||||
  |
||||
<el-input-number :min="0" :max="parseFloat(goods.final_price)" :precision="2" size="small" :step="0.01" |
||||
v-model="goods.discount2"></el-input-number> |
||||
</el-col> |
||||
</el-row> |
||||
</div> |
||||
<div v-if="props.goods_array.length === 0" style="font-size: 20px; margin-top: 50px; color: #909399">暂无数据</div> |
||||
<template #footer> |
||||
<div class="dialog-footer"> |
||||
<el-button type="primary" @click="finish">完成</el-button> |
||||
</div> |
||||
</template> |
||||
</el-dialog> |
||||
</template> |
||||
|
||||
<style scoped> |
||||
|
||||
</style> |
@ -0,0 +1,48 @@ |
||||
<script setup> |
||||
const props = defineProps(['is_show', 'ticket_data']) |
||||
const emits = defineEmits(['get_discount']) |
||||
|
||||
function finish() { |
||||
const discount_seats = [] |
||||
props.ticket_data.forEach((seat) => { |
||||
if (seat.ticketDiscount !==0 || seat.serviceDiscount !== 0) { |
||||
discount_seats.push(seat) |
||||
} |
||||
}) |
||||
emits('get_discount', discount_seats) |
||||
} |
||||
|
||||
</script> |
||||
|
||||
<template> |
||||
<el-dialog v-model="props.is_show" :width="1000"> |
||||
<div style="text-align: left; margin-left: 20px"> |
||||
<span style="font-weight: bold;">输入影票折扣</span>   |
||||
<span style="font-size: 12px">如果不输入则表示不使用三方折扣,此处应小于票价和服务费</span> |
||||
</div> |
||||
<div> |
||||
<el-row v-for="seat in props.ticket_data" :key="seat.cineSeatId" style="margin: 10px 0 0 80px"> |
||||
<el-col :span="3" style="text-align: left"> |
||||
<span>{{ seat.rowValue }}-{{ seat.columnValue }}: {{ seat.name }}</span></el-col> |
||||
<el-col :span="8">输入影票折扣   |
||||
<el-input-number :min="0" :precision="2" size="small" :step="0.01" |
||||
v-model="seat.ticketDiscount"></el-input-number> |
||||
</el-col> |
||||
<el-col :span="8">输入服务费折扣   |
||||
<el-input-number :min="0" :precision="2" size="small" :step="0.01" |
||||
v-model="seat.serviceDiscount"></el-input-number> |
||||
</el-col> |
||||
</el-row> |
||||
</div> |
||||
<div v-if="props.ticket_data.length === 0" style="font-size: 20px; margin-top: 50px; color: #909399">暂无数据</div> |
||||
<template #footer> |
||||
<div class="dialog-footer"> |
||||
<el-button type="primary" @click="finish">完成</el-button> |
||||
</div> |
||||
</template> |
||||
</el-dialog> |
||||
</template> |
||||
|
||||
<style scoped> |
||||
|
||||
</style> |
Loading…
Reference in new issue