✨ 下单界面
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
<!-- 订单确认的优惠劵选择弹窗 -->
|
||||
<template>
|
||||
<su-popup
|
||||
:show="show"
|
||||
@@ -16,20 +17,21 @@
|
||||
:enable-back-to-top="true"
|
||||
>
|
||||
<view class="subtitle ss-m-l-20">可使用优惠券</view>
|
||||
<view v-for="(item, index) in state.couponInfo.can_use" :key="index">
|
||||
<view v-for="(item, index) in state.couponInfo" :key="index">
|
||||
<s-coupon-list :data="item" type="user" :disabled="false">
|
||||
<template #default>
|
||||
<label class="ss-flex ss-col-center" @tap="radioChange(item.id)">
|
||||
<radio
|
||||
color="var(--ui-BG-Main)"
|
||||
style="transform: scale(0.8)"
|
||||
:checked="state.couponId == item.id"
|
||||
:checked="state.couponId === item.id"
|
||||
@tap.stop="radioChange(item.id)"
|
||||
/>
|
||||
</label>
|
||||
</template>
|
||||
</s-coupon-list>
|
||||
</view>
|
||||
<!-- TODO 芋艿:未来接口需要支持下
|
||||
<view class="subtitle ss-m-t-40 ss-m-l-20">不可使用优惠券</view>
|
||||
<view v-for="item in state.couponInfo.cannot_use" :key="item.id">
|
||||
<s-coupon-list :data="item" type="user" :disabled="true">
|
||||
@@ -41,6 +43,7 @@
|
||||
</template>
|
||||
</s-coupon-list>
|
||||
</view>
|
||||
-->
|
||||
</scroll-view>
|
||||
</view>
|
||||
<view class="modal-footer ss-flex">
|
||||
@@ -50,8 +53,9 @@
|
||||
</template>
|
||||
<script setup>
|
||||
import { computed, reactive } from 'vue';
|
||||
|
||||
const props = defineProps({
|
||||
modelValue: {
|
||||
modelValue: { // 优惠劵列表
|
||||
type: Object,
|
||||
default() {},
|
||||
},
|
||||
@@ -60,21 +64,27 @@
|
||||
default: false,
|
||||
},
|
||||
});
|
||||
|
||||
const emits = defineEmits(['confirm', 'close']);
|
||||
|
||||
const state = reactive({
|
||||
couponInfo: computed(() => props.modelValue),
|
||||
couponId: 0,
|
||||
couponInfo: computed(() => props.modelValue), // 优惠劵列表
|
||||
couponId: 0, // 选中的优惠劵编号
|
||||
});
|
||||
|
||||
// 选中优惠劵
|
||||
function radioChange(couponId) {
|
||||
if (state.couponId == couponId) {
|
||||
if (state.couponId === couponId) {
|
||||
state.couponId = 0;
|
||||
} else {
|
||||
state.couponId = couponId;
|
||||
}
|
||||
}
|
||||
|
||||
// 确认优惠劵
|
||||
const onConfirm = () => {
|
||||
emits('confirm', state.couponId);
|
||||
};
|
||||
}
|
||||
</script>
|
||||
<style lang="scss" scoped>
|
||||
:deep() {
|
||||
|
||||
@@ -26,7 +26,7 @@
|
||||
:style="[{ color: priceColor }]"
|
||||
v-if="price && Number(price) > 0"
|
||||
>
|
||||
¥{{ price }}
|
||||
¥{{ fen2yuan(price) }}
|
||||
</view>
|
||||
<view v-if="score && Number(price) > 0">+</view>
|
||||
<view class="price-text ss-flex ss-col-center" v-if="score">
|
||||
@@ -54,6 +54,7 @@
|
||||
<script setup>
|
||||
import sheep from '@/sheep';
|
||||
import { computed } from 'vue';
|
||||
import { fen2yuan } from '../../hooks/useGoods';
|
||||
/**
|
||||
* 订单卡片
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user