对接支付优惠
This commit is contained in:
@@ -88,6 +88,9 @@
|
||||
v-if="goodsStore.orderList.length">
|
||||
历史下单
|
||||
</div>
|
||||
<CartItem
|
||||
:item="{ product_name: '客座费', number: goodsStore.tableInfo.num, lowPrice: store.shopInfo.tableFee, memberPrice: store.shopInfo.tableFee }"
|
||||
v-if="!store.shopInfo.isTableFee && goodsStore.tableInfo.name && (goodsStore.cartList.length || goodsStore.orderList.length)" />
|
||||
<div class="order_list_item" v-for="(arr, index) in goodsStore.orderList" :key="index">
|
||||
<div class="order_num">{{ `第${arr.orderNum}次下单` }}</div>
|
||||
<CartItem type="order" :border="false" :item="item" :index="index" :i="i" :key="item.id"
|
||||
@@ -105,7 +108,7 @@
|
||||
<div class="num_wrap_top">
|
||||
<div class="left" @click="allSelectedHandle" v-if="store.shopInfo.eatModel.includes('take-out')">
|
||||
<div class="selected">
|
||||
<div class="selected_round" v-if="!allSelected"></div>
|
||||
<div class="selected_round" v-if="!goodsStore.allSelected"></div>
|
||||
<el-icon class="icon" v-else>
|
||||
<CircleCheckFilled />
|
||||
</el-icon>
|
||||
@@ -168,19 +171,12 @@
|
||||
<!-- 检查版本升级 -->
|
||||
<updateDialog />
|
||||
<!-- 选择会员 -->
|
||||
<SelectVipUser ref="SelectVipUserRef" />
|
||||
<SelectVipUser ref="SelectVipUserRef" @success="selectUser" />
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
name: "home",
|
||||
};
|
||||
</script>
|
||||
<script setup>
|
||||
import { onMounted, ref } from "vue";
|
||||
import { useUser } from "@/store/user.js";
|
||||
import { ref } from "vue";
|
||||
import { useGlobal } from '@/store/global.js'
|
||||
|
||||
import SelectVipUser from "@/components/selectVipUser.vue";
|
||||
import updateDialog from '@/components/updateDialog.vue'
|
||||
import remarkModal from "@/components/remarkModal.vue";
|
||||
@@ -191,23 +187,18 @@ import fastCashier from "@/views/home/components/fastCashier.vue";
|
||||
import pendingCartModal from "@/views/home/components/pendingCartModal.vue";
|
||||
import tableMerging from '@/views/home/components/tableMerging.vue'
|
||||
import CartItem from './components/cartItem.vue'
|
||||
import useStorage from '@/utils/useStorage'
|
||||
import { formatDecimal, formatPhoneNumber } from '@/utils/index.js'
|
||||
import { useGoods } from '@/store/goods.js'
|
||||
|
||||
import { queryShopInfo, staffPermission } from '@/api/user.js'
|
||||
import { staffPermission } from '@/api/user.js'
|
||||
import { createOrder } from '@/api/order.js'
|
||||
|
||||
// 商品列表
|
||||
import goods from "@/views/home/components/goods.vue";
|
||||
import member from "@/views/member/index.vue";
|
||||
import { ElMessage } from "element-plus";
|
||||
import { useUser } from '@/store/user.js'
|
||||
|
||||
const SelectVipUserRef = ref(null)
|
||||
|
||||
|
||||
const goodsStore = useGoods()
|
||||
|
||||
const global = useGlobal()
|
||||
|
||||
|
||||
@@ -220,9 +211,6 @@ const pendingCartModalRef = ref(null);
|
||||
const settleAccountRef = ref(null);
|
||||
const fastCashierRef = ref(null);
|
||||
const tableMergingRef = ref(null)
|
||||
|
||||
const allSelected = ref(false);
|
||||
|
||||
const remark = ref("");
|
||||
const cartListActive = ref(0);
|
||||
const cartListActiveItem = ref({})
|
||||
@@ -234,6 +222,14 @@ const orderInfo = ref({});
|
||||
const createOrderLoading = ref(false);
|
||||
|
||||
|
||||
function selectUser(row) {
|
||||
goodsStore.vipUserInfo = { ...row }
|
||||
if (store.shopInfo.isMemberPrice && row.isVip) {
|
||||
goodsStore.showVipPrice = true
|
||||
goodsStore.calcCartInfo()
|
||||
}
|
||||
}
|
||||
|
||||
// 挂单量
|
||||
const pendingCartNum = ref(0);
|
||||
|
||||
@@ -255,19 +251,18 @@ async function createOrderHandle(t = 0) {
|
||||
orderId: goodsStore.orderListInfo.id || '', // 订单id
|
||||
shopId: store.shopInfo.id, // 店铺id
|
||||
seatNum: goodsStore.tableInfo.num || 0, // 用餐人数
|
||||
seatAmount: goodsStore.cartInfo.tableFee, // 餐位费
|
||||
packFee: goodsStore.cartInfo.packFee, // 打包费
|
||||
originAmount: formatDecimal(+goodsStore.cartInfo.totalAmount, 2, true), // 订单原金额(包含打包费+餐位费) 不含折扣价格
|
||||
tableCode: goodsStore.cartList[0].table_code, // 台桌号
|
||||
dineMode: allSelected.value ? store.shopInfo.eatModel.split(',')[1] : store.shopInfo.eatModel.split(',')[0], // 用餐方式
|
||||
dineMode: goodsStore.allSelected ? store.shopInfo.eatModel.split(',')[1] : store.shopInfo.eatModel.split(',')[0], // 用餐方式
|
||||
remark: remark.value, // 备注
|
||||
placeNum: (goodsStore.orderListInfo.placeNum || 0) + 1, // 下单次数
|
||||
waitCall: 0,//是否叫号
|
||||
userId: '', // 会员用户id
|
||||
vipPrice: 0, // 会员价
|
||||
waitCall: 0, // 是否叫号
|
||||
userId: goodsStore.vipUserInfo.userId, // 会员用户id
|
||||
}
|
||||
|
||||
createOrderLoading.value = true;
|
||||
goodsStore.calcCartInfo()
|
||||
const res = await createOrder(data)
|
||||
// 设置订单信息
|
||||
goodsStore.orderListInfo = res
|
||||
@@ -279,7 +274,6 @@ async function createOrderHandle(t = 0) {
|
||||
// 清除购物车,更新历史订单
|
||||
goodsStore.updateOrderList()
|
||||
} else {
|
||||
goodsStore.calcCartInfo()
|
||||
settleAccountRef.value.show(t)
|
||||
}
|
||||
} catch (error) {
|
||||
@@ -321,7 +315,11 @@ function giftPackHandle(key, item) {
|
||||
|
||||
// 打包全选
|
||||
const allSelectedHandle = async () => {
|
||||
allSelected.value = !allSelected.value;
|
||||
if (goodsStore.allSelected) {
|
||||
goodsStore.allSelected = 0
|
||||
} else {
|
||||
goodsStore.allSelected = 1
|
||||
}
|
||||
};
|
||||
|
||||
// 购物车选中
|
||||
|
||||
Reference in New Issue
Block a user