处理开台

This commit is contained in:
2026-01-11 01:49:45 +08:00
parent 9e957d5dea
commit a14a51d575
26 changed files with 2495 additions and 297 deletions

View File

@@ -9,10 +9,59 @@ import { request } from "./request";
// 获取店铺配置 // 获取商品
export function fetchGoods () { export function fetchGoods () {
return request({ return request({
url:'/index/goods', url:'/index/goods',
}) })
} }
// 获取套餐
export function fetchCombos(data : {}) {
return request({
url: '/index/combos',
data: data,
method: 'POST'
});
}
// 获取房间
export function fetchRooms(data : {}) {
return request({
url: '/index/rooms',
data: data,
method: 'POST'
});
}
// 预约
export function fetchBooking(data : {}) {
return request({
url: '/index/booking',
data: data,
method: 'POST'
});
}
// 取消预约
export function fetchUnBooking(data : {}) {
return request({
url: '/index/unbooking',
data: data,
method: 'POST'
});
}
// 开台/商品订单
export function fetchAddOrder(data : {}) {
return request({
url: '/index/addOrder',
data: data,
method: 'POST'
});
}
// 房间订单详情
export function fetchRoomOrder(roomId : Number) {
return request({
url: '/index/roomOrder',
data: { roomId: roomId },
})
}

View File

@@ -1,4 +0,0 @@
// export enum ShoppingCartType {
// PHONE = 1,
// PARTS = 2,
// }

View File

@@ -14,7 +14,7 @@
// "pagePath": "pages/cart/index", // "pagePath": "pages/cart/index",
// "iconPath": "static/tabbar/cart.png", // "iconPath": "static/tabbar/cart.png",
// "selectedIconPath": "static/tabbar/cart-active.png", // "selectedIconPath": "static/tabbar/cart-active.png",
// "text": "购物车" // "text": "待办"
// }, // },
// { // {
// "pagePath": "pages/cart/parts/index", // "pagePath": "pages/cart/parts/index",
@@ -36,14 +36,21 @@
{ {
"path": "pages/index/index", "path": "pages/index/index",
"style": { "style": {
"navigationBarTitleText": "订单管理", "navigationBarTitleText": "茶麻古道",
"enablePullDownRefresh": false "enablePullDownRefresh": false
} }
}, },
{ {
"path": "pages/index/orderAdd", "path": "pages/index/orderAdd",
"style": { "style": {
"navigationBarTitleText": "新增订单", "navigationBarTitleText": "开台",
"enablePullDownRefresh": false
}
},
{
"path": "pages/index/orderEdit",
"style": {
"navigationBarTitleText": "账单",
"enablePullDownRefresh": false "enablePullDownRefresh": false
} }
}, },

View File

@@ -2,26 +2,67 @@
<view class="page-content"> <view class="page-content">
<view style="z-index: 10000;position: sticky;" :style="'top:0px'"> <view style="z-index: 10000;position: sticky;" :style="'top:0px'">
<view class="top-bar"> <view class="top-bar">
<nut-button type="primary" block @click="navigateTo('/pages/index/orderAdd')"> <nut-button type="primary" block @click="navigateTo('/pages/index/orderAdd')">
新增商品订单 新增商品订单
</nut-button> </nut-button>
</view> </view>
</view> </view>
<nut-grid :column-num="2" square> <!-- 使用flex布局 -->
<nut-grid-item v-for="(room, index) in rooms" :key="index"> <view class="room-grid">
<view class="grid-item-content"> <view v-for="(room, index) in rooms" :key="index" class="room-grid-item" :style="getRoomStyle(room.status)">
<view class="room-name">{{room.name}}</view> <view class="room-grid-card">
<view class="room-footer"> <view class="grid-item-content">
<view class="room-id">尾号: 111111</view> <view class="room-name">{{room.room_name}}</view>
<view class="remark">备注: 这是一段北湖这是一段北湖这是一段北...</view> <view class="room-info">
</view> <view class="room-id" v-if="room.tel">尾号: {{room.tel}}</view>
<view class="buttons"> <view class="remark" v-if="room.remarks">备注: {{room.remarks}}</view>
<nut-button type="primary">预约</nut-button> </view>
<nut-button type="success">开台</nut-button> <view class="room-buttons">
<view v-if="room.status === 1">
<nut-button size="small" type="primary" shape="square"
@click="onBooking(room)">预约</nut-button>
</view>
<view v-else-if="room.status === 2">
<nut-button size="small" type="warning" plain shape="square"
@click="onUnBooking(room)">取消预约</nut-button>
</view>
<view v-if="room.status === 3">
<nut-button size="small" type="info" plain shape="square"
@click="navigateTo(`/pages/index/orderEdit?roomId=${room.id}`)">详情</nut-button>
</view>
<view v-else>
<nut-button size="small" type="success" plain shape="square"
@click="navigateTo(`/pages/index/orderAdd?roomId=${room.id}`)">开台</nut-button>
</view>
</view>
</view> </view>
</view> </view>
</nut-grid-item> </view>
</nut-grid> </view>
<!-- 弹出 -->
<nut-popup :custom-style="{ height: '60%' }" v-model:visible="visiblePopup" position="bottom"
safe-area-inset-bottom :close-on-click-overlay="true" @close="onClosePopup">
<view>
<view class="title">{{tempRoom?.room_name}} </view>
<nut-form>
<nut-form-item label="尾号">
<nut-input v-model="form.tel" placeholder="请输入尾号"></nut-input>
</nut-form-item>
<nut-form-item label="备注">
<nut-textarea v-model="form.remarks" :rows="3" :adjust-keyboard-to="bottom"
placeholder="请输入备注"></nut-textarea>
</nut-form-item>
</nut-form>
<view style=" padding: 0rpx 80rpx;">
<nut-button type="primary" block @click="onSubmit">
预约
</nut-button>
</view>
</view>
</nut-popup>
</view> </view>
</template> </template>
@@ -37,43 +78,111 @@
onLoad, onLoad,
onShow, onShow,
} from '@dcloudio/uni-app' } from '@dcloudio/uni-app'
import {
import { fetchRooms,
navigateTo, fetchBooking,
fetchUnBooking
} from '@/api/index';
import {
navigateTo,
} from '@/utils/helper' } from '@/utils/helper'
const form = reactive({
room_id: 0,
tel: '',
remarks: ''
})
// 房间列表 // 房间列表
const rooms = [{ const rooms = ref([]);
name: '房间名称 1' const getRoomStyle = (status) => {
}, let backgroundColor = '';
{ let borderColor = '';
name: '房间名称 2' switch (status) {
}, case 1: // 空闲/可用
{ backgroundColor = '#d9d9d9';
name: '房间名称 3' break;
}, case 2: // 已预约
{ backgroundColor = '#ffa39e';
name: '房间名称 4' break;
}, case 3: // 已占用
{ backgroundColor = '#b7eb8f';
name: '房间名称 5' break;
}, // case 4: // 打扫中
{ // backgroundColor = '#f0f5ff';
name: '房间名称 6' // borderColor = '#adc6ff';
}, // break;
{ default: // 默认
name: '房间名称 7' backgroundColor = '#d9d9d9';
},
{
name: '房间名称 8'
},
{
name: '房间名称 9'
} }
]; return {
'background-color': backgroundColor,
};
}
const visiblePopup = ref(false)
const tempRoom = reactive({})
const onBooking = (room) => {
console.log("----", room);
Object.assign(tempRoom, room)
form.room_id = room.id
visiblePopup.value = true
}
const onClosePopup = () => {
Object.assign(tempRoom, {})
Object.assign(form, {
room_id: 0,
tel: '',
remarks: ''
})
visiblePopup.value = false
console.log("关闭");
};
const getRooms = () => {
console.log("房间");
fetchRooms().then(res => {
console.log(res);
rooms.value = res;
})
}
// 预约
const onSubmit = () => {
fetchBooking(form).then(res => {
console.log(res);
uni.showToast({
icon: 'none',
title: '预约成功'
})
onClosePopup()
getRooms()
})
}
// 取消预约
const onUnBooking = (room) => {
fetchUnBooking({
id: room.id
}).then(res => {
console.log(res);
uni.showToast({
icon: 'none',
title: '取消预约成功'
})
getRooms()
})
}
const init = () => {
console.log('init');
getRooms()
}
onShow(() => {
console.log("onshow---");
getRooms()
});
onMounted(() => {
init();
})
</script> </script>
<style scoped lang="scss"> <style scoped lang="scss">
@@ -83,6 +192,9 @@
} }
.top-bar { .top-bar {
background: #fff; background: #fff;
align-items: center; align-items: center;
@@ -91,6 +203,25 @@
} }
/* Grid布局 - 每行两列 */
.room-grid {
display: grid;
grid-template-columns: repeat(2, 1fr);
/* 两列等宽 */
gap: 20rpx;
/* 间距 */
padding: 20rpx;
background: #f5f5f5;
}
.room-grid-item {
border-radius: 16rpx;
// overflow: hidden;
// background: white;
// box-shadow: 0 4rpx 12rpx rgba(0, 0, 0, 0.08);
// position: relative;
}
.grid-item-content { .grid-item-content {
display: flex; display: flex;
flex-direction: column; flex-direction: column;
@@ -98,33 +229,64 @@
justify-content: space-between; justify-content: space-between;
height: 100%; height: 100%;
text-align: center; text-align: center;
}
.room-name { .room-name {
font-size: 32rpx; font-size: 32rpx;
// margin-bottom: 20rpx; padding: 20rpx 0;
} text-align: center;
}
.room-footer { .room-info {
margin: 20rpx 0; text-align: left;
color: #666; padding: 20rpx 10rpx;
.room-id { color: #666;
font-size: 26rpx; width: 100%;
margin-bottom: 10rpx; min-height: 160rpx;
} box-sizing: border-box;
.remark { .room-id {
font-size: 24rpx; font-size: 24rpx;
padding: 10rpx; }
text-align: center;
.remark {
font-size: 24rpx;
display: -webkit-box;
/* 使元素成为伸缩容器 */
-webkit-box-orient: vertical;
/* 设置伸缩方向为纵向 */
overflow: hidden;
/* 隐藏超出的内容 */
-webkit-line-clamp: 2;
/* 限制显示2行 */
line-height: 36rpx;
word-wrap: break-word;
/* 强制长单词或长数字换行 */
word-break: break-word;
/* 强制长单词或长数字换行 */
white-space: normal;
/* 确保文本正常换行 */
/* 设置行高 */
}
}
.room-buttons {
padding: 20rpx 10rpx;
display: flex;
gap: 20rpx;
justify-content: space-around;
width: 100%;
box-sizing: border-box;
} }
} }
.buttons {
display: flex; .title {
gap: 16rpx; padding: 0 20rpx;
margin-top: 20rpx;
margin-bottom: 20rpx;
font-size: 28rpx;
font-weight: 400;
text-align: center;
} }
</style> </style>

View File

@@ -0,0 +1,618 @@
<template>
<view class="page-content">
<view style=" padding: 10rpx;">
<view class="title">基础台费 </view>
<nut-form>
<!-- <nut-form-item>
<template v-slot:label>房间</template>
<template v-slot:default>
<view style="color: black;" @click="visibleRoomsPopup = true">
<text>{{form.room_name}}</text>
</view>
</template>
</nut-form-item> -->
<!-- 台费类型套餐支付状态 三者在同一行布局 -->
<view class="inline-form">
<!-- 台费类型选择 -->
<nut-form-item label-position="top">
<template v-slot:label>结算方式</template>
<template v-slot:default>
<view style="color: black;" @click="visibleFeeTypePopup = true">
<text>{{form.fee_type_name}}</text>
</view>
</template>
</nut-form-item>
<!-- 套餐选择 -->
<nut-form-item label-position="top" v-if="form.fee_type === 1 || form.fee_type === 2">
<template v-slot:label>选择团购</template>
<template v-slot:default>
<view style="color: black;" @click="visibleCombosPopup = true">
<text>{{form.fee_combo_name}}</text>
</view>
</template>
</nut-form-item>
<!-- 金额输入框 -->
<nut-form-item label-position="top" v-else>
<template v-slot:label>线下收款</template>
<template v-slot:default>
<nut-input v-model="form.fee_amount" placeholder="请输入金额" type="number" />
</template>
</nut-form-item>
<!-- 支付状态选择 -->
<nut-form-item label-position="top">
<template v-slot:label>支付状态</template>
<template v-slot:default>
<view style="color: black;" @click="openPayStatusPopup('fee')">
<text>{{form.fee_pay_status_txt}}</text>
</view>
</template>
</nut-form-item>
</view>
</nut-form>
<view class="title">超时收费 </view>
<nut-form>
<!-- 台费类型套餐支付状态 三者在同一行布局 -->
<view class="inline-form">
<!-- 台费类型选择 -->
<nut-form-item label-position="top">
<template v-slot:label>时长(小时)</template>
<template v-slot:default>
<nut-input v-model="form.often" placeholder="请输入小时" type="number" />
</template>
</nut-form-item>
<!-- 金额输入框 -->
<nut-form-item label-position="top">
<template v-slot:label>超时金额</template>
<template v-slot:default>
<nut-input v-model="form.over_amount" placeholder="请输入金额" type="number" />
</template>
</nut-form-item>
<!-- 支付状态选择 -->
<nut-form-item label-position="top">
<template v-slot:label>支付状态</template>
<template v-slot:default>
<view style="color: black;" @click="openPayStatusPopup('over')">
<text>{{form.over_pay_status_txt}}</text>
</view>
</template>
</nut-form-item>
</view>
</nut-form>
<view class="title">商品 </view>
<view class="top-bar">
<nut-button type="primary" plain size="small" @click="addGoods">新增商品</nut-button>
</view>
<nut-form>
<!-- 台费类型套餐支付状态 三者在同一行布局 -->
<view class="inline-goods-form" v-for="(item, index) in orderGoods" :key="index">
<view class="form-row">
<!-- 台费类型选择 -->
<nut-form-item label-position="top">
<template v-slot:label>商品</template>
<template v-slot:default>
<view style="color: black;" @click="visibleGoodsCascader = true;goodsIndex = index">
<text v-if="item.goods_type_name && item.goods_name">
{{ item.goods_type_name }} - {{ item.goods_name }}
</text>
<text v-else>请选择商品</text>
</view>
</template>
</nut-form-item>
<!-- 套餐选择 -->
<nut-form-item label-position="top">
<template v-slot:label>售价</template>
<template v-slot:default>
<view style="color: black;">
<text>{{item.goods_price}}</text>
</view>
</template>
</nut-form-item>
</view>
<view class="form-row">
<!-- 支付状态选择 -->
<nut-form-item label-position="top">
<template v-slot:label>支付状态</template>
<template v-slot:default>
<view style="color: black;" @click="openPayStatusPopup('goods',index)">
<text>{{item.goods_pay_status_txt}}</text>
</view>
</template>
</nut-form-item>
<!-- 套餐选择 -->
<nut-form-item label-position="top">
<template v-slot:label>操作</template>
<template v-slot:default>
<view>
<nut-button type="danger" size="mini" @click="removeGoods(index)">删除商品</nut-button>
</view>
</template>
</nut-form-item>
</view>
</view>
</nut-form>
<view class="title">订单优惠 </view>
<nut-form>
<nut-form-item>
<template v-slot:label>优惠金额</template>
<template v-slot:default>
<nut-input v-model="form.discount_amount" placeholder="请输入金额" type="number" />
</template>
</nut-form-item>
</nut-form>
<view style="align-items: center;text-align: center; padding: 20rpx 60rpx;">
<nut-button type="primary" block @click="submitForm">
保存订单
</nut-button>
</view>
</view>
<nut-cascader title="商品选择" v-model:visible="visibleGoodsCascader" v-model="cascaderGoodsValue"
@change="onGoodsChange" @pathChange="onGoodsPathChange" text-key="label" value-key="value"
children-key="children" :options="selectGoods" :title-ellipsis="false" @open="onOpenGoodsCascader"
@close="onCloseGoodsCascader"></nut-cascader>
<!-- v-model="popupPaymentStatusVal" -->
<nut-popup v-model:visible="visiblePaymentStatusPopup" position="bottom" safe-area-inset-bottom>
<nut-picker :columns="paymentStatuses" :field-names="{text:'label',value:'value'}" title="选择支付状态"
@confirm="onConfirmPaymentStatus" @cancel="visiblePaymentStatusPopup = false">
</nut-picker>
</nut-popup>
<nut-popup v-model:visible="visibleCombosPopup" position="bottom" safe-area-inset-bottom>
<nut-picker v-model="popupCombosVal" :columns="combos" :field-names="{text:'label',value:'value'}"
title="选择团购套餐" @confirm="onConfirmCombos" @cancel="visibleCombosPopup = false">
</nut-picker>
</nut-popup>
<!-- v-model="popupFeeTypeVal" -->
<nut-popup v-model:visible="visibleFeeTypePopup" position="bottom" safe-area-inset-bottom>
<nut-picker :columns="feeTypes" :field-names="{text:'label',value:'value'}" title="选择结算方式"
@confirm="onConfirmFeeType" @cancel="visibleFeeTypePopup = false">
</nut-picker>
</nut-popup>
<!-- <nut-popup v-model:visible="visibleRoomsPopup" position="bottom" safe-area-inset-bottom>
<nut-picker v-model="popupRoomsVal" :columns="rooms" :field-names="{text:'label',value:'value'}"
title="选择房间" @confirm="onConfirmRoom" @cancel="visibleRoomsPopup = false">
</nut-picker>
</nut-popup> -->
</view>
</template>
<script setup>
import {
computed,
onMounted,
reactive,
ref,
toValue
} from 'vue';
import {
fetchCombos,
fetchGoods,
} from '@/api/index';
// // 选择房间弹窗
// const visibleRoomsPopup = ref(false);
// // 选中的房间
// const popupRoomsVal = ref([])
// // 房间列表
// const rooms = [{
// value: 1,
// label: '房间 101'
// },
// {
// value: 2,
// label: '房间 102'
// },
// {
// value: 3,
// label: '房间 103'
// }
// ];
// // 选择房间
// const onConfirmRoom = (selectedValue) => {
// console.log(selectedValue);
// form.room_name = selectedValue.selectedOptions[0].label
// form.room_id = selectedValue.selectedOptions[0].value
// console.log(form);
// visibleRoomsPopup.value = false
// }
// 选择房间弹窗
const visibleFeeTypePopup = ref(false);
// 台费结算类型
// const popupFeeTypeVal = ref([])
// 台费类型选择列表
const feeTypes = [{
value: 1,
label: '美团'
},
{
value: 2,
label: '抖音'
},
{
value: 3,
label: '线下'
}
];
// 选择房间
const onConfirmFeeType = (selectedValue) => {
console.log(selectedValue);
form.fee_type_name = selectedValue.selectedOptions[0].label
form.fee_type = selectedValue.selectedOptions[0].value
console.log(form);
if (form.fee_type !== 3) {
getCombos();
}
visibleFeeTypePopup.value = false
}
const getCombos = () => {
console.log("获取套餐");
fetchCombos({
type: form.fee_type
}).then(res => {
console.log(res);
combos.value = res;
})
}
// 选择套餐弹窗
const visibleCombosPopup = ref(false);
// 选中的套餐
const popupCombosVal = ref([])
// 套餐列表
const combos = ref([]);
// 选择套餐
const onConfirmCombos = (selectedValue) => {
console.log(selectedValue);
form.fee_combo_name = selectedValue.selectedOptions[0].label
form.fee_combo_id = selectedValue.selectedOptions[0].value
console.log(form);
visibleCombosPopup.value = false
}
// 支付状态弹窗
const visiblePaymentStatusPopup = ref(false);
// 选中的支付状态
const popupPaymentStatusVal = ref([])
// 支付类型
const popupPaymentTypeVal = ref('')
// 支付状态
const paymentStatuses = [{
value: 1,
label: '已付'
},
{
value: 2,
label: '未付'
},
{
value: 3,
label: '赠送'
}
];
const openPayStatusPopup = (type, index = -1) => {
popupPaymentTypeVal.value = type
goodsPayIndex.value = index // 只有type = goods 生效
visiblePaymentStatusPopup.value = true
console.log(type);
}
const onConfirmPaymentStatus = (selectedValue) => {
if (popupPaymentTypeVal.value == 'fee') {
form.fee_pay_status_txt = selectedValue.selectedOptions[0].label
form.payment_status = selectedValue.selectedOptions[0].value
}
if (popupPaymentTypeVal.value == 'over') {
form.over_pay_status_txt = selectedValue.selectedOptions[0].label
form.over_pay_status = selectedValue.selectedOptions[0].value
}
if (popupPaymentTypeVal.value == 'goods' && goodsPayIndex.value >= 0) {
console.log("处理商品支付状态", goodsPayIndex.value);
orderGoods.value[goodsPayIndex.value].goods_pay_status_txt = selectedValue.selectedOptions[0].label
orderGoods.value[goodsPayIndex.value].goods_pay_status = selectedValue.selectedOptions[0].value
}
console.log(form);
visiblePaymentStatusPopup.value = false
popupPaymentTypeVal.value = ''
goodsPayIndex.value = -1
}
// 订单商品列表
const orderGoods = ref([
// {
// goods_type_name: null,
// goods_type_id: null,
// goods_name: null,
// goods_id: null,
// goods_price: null,
// goods_pay_status: 0,
// goods_pay_status_txt: "请选择",
// cascader_val: []
// },
])
// 当前操作的商品
const goodsPayIndex = ref(0)
// 当前操作的商品
const goodsIndex = ref(0)
// 添加规则
const addGoods = () => {
console.log(orderGoods.value);
orderGoods.value.push({
goods_type_name: null,
goods_type_id: null,
goods_name: null,
goods_id: null,
goods_price: null,
goods_pay_status: 0,
goods_pay_status_txt: "请选择",
cascader_val: []
})
}
// 删除商品
const removeGoods = (index) => {
orderGoods.value.splice(index, 1)
}
// 显示商品选择
const visibleGoodsCascader = ref(false)
// 商品选中
const cascaderGoodsValue = computed(() => {
let cascader_val = [];
if (goodsIndex.value >= 0) {
return orderGoods.value[goodsIndex.value]?.cascader_val ?? []
} else {
return cascader_val;
}
});
const onGoodsChange = (...args) => {
console.log("onGoodsChange", args);
}
// 选择商品
const onGoodsPathChange = (args) => {
console.log("onGoodsPathChange", args);
console.log("goodsIndex", goodsIndex.value);
console.log("orderGoods.value[goodsIndex.value]", orderGoods.value[goodsIndex.value]);
orderGoods.value[goodsIndex.value].goods_type_name = null
orderGoods.value[goodsIndex.value].goods_type_id = null
orderGoods.value[goodsIndex.value].goods_name = null
orderGoods.value[goodsIndex.value].goods_id = null
orderGoods.value[goodsIndex.value].goods_price = null
if (args.length >= 1 && args[0] !== null) {
orderGoods.value[goodsIndex.value].goods_type_name = args[0].text
orderGoods.value[goodsIndex.value].goods_type_id = args[0].value
}
if (args.length >= 2 && args[1] !== null) {
orderGoods.value[goodsIndex.value].goods_name = args[1].text
orderGoods.value[goodsIndex.value].goods_id = args[1].value
orderGoods.value[goodsIndex.value].goods_price = args[1].goods_price
}
console.log("orderGoods.value[goodsIndex.value]", orderGoods.value[goodsIndex.value]);
}
const onCloseGoodsCascader = () => {
console.log("onCloseGoodsCascader");
console.log("goodsIndex.value", goodsIndex.value);
if (orderGoods.value[goodsIndex.value].goods_type_id && orderGoods.value[goodsIndex.value].goods_id) {
orderGoods.value[goodsIndex.value].cascader_val = [
orderGoods.value[goodsIndex.value].goods_type_id,
orderGoods.value[goodsIndex.value].goods_id
]
}
goodsIndex.value = 0
console.log("goodsIndex.value", goodsIndex.value);
}
const onOpenGoodsCascader = () => {
console.log("onOpenGoodsCascader");
console.log("goodsIndex.value", goodsIndex.value);
}
const form = reactive({
// room_id: 0,
// room_name: '选择房间',
fee_type: 0,
fee_type_name: '选择方式',
fee_combo_id: 0, // 套餐费用ID
fee_combo_name: '请选择', // 套餐费用名称
fee_amount: null, // 线下支付费用
fee_pay_status: 0, // 费用支付状态
fee_pay_status_txt: '请选择', // 费用支付状态
over_often: null, // 超时小时
over_amount: null, // 超时金额
over_pay_status: 0, // 超时支付状态
over_pay_status_txt: "请选择", // 超时支付状态
discount_amount: null, // 优惠金额
})
const selectGoods = ref([])
onMounted(() => {
fetchGoods().then(res => {
selectGoods.value = res;
})
})
// 提交表单
const submitForm = () => {
// const formData = {
// room: room.value,
// feeType: feeType.value,
// selectedPackage: selectedPackage.value,
// amount: amount.value,
// paymentStatus: paymentStatus.value
// };
console.log('提交的订单数据:', orderGoods.value);
};
</script>
<style lang="scss" scoped>
.page-content {
min-height: 100vh;
background-color: #f2f3f5;
}
.title {
padding: 0 20rpx;
margin-top: 20rpx;
margin-bottom: 20rpx;
font-size: 28rpx;
// font-weight: 400;
color: #909ca4;
}
.inline-form {
display: flex;
justify-content: space-between;
gap: 10rpx;
/* 在元素之间添加间距 */
}
.top-bar {
background: #fff;
padding: 20rpx;
display: flex;
justify-content: space-between;
border-top: 1px solid #eee;
// position: sticky;
// bottom: 0;
// z-index: 999;
}
/* 每个商品项容器 */
.inline-goods-form {
// box-sizing: border-box;
}
/* 行容器 */
.form-row {
display: flex;
justify-content: space-between;
align-items: flex-start;
gap: 20rpx;
margin-bottom: 20rpx;
}
// .inline-goods-form {
// display: flex;
// justify-content: space-between;
// gap: 10rpx;
// /* 在元素之间添加间距 */
// }
// .inline-goods-form {
// display: flex;
// flex-wrap: nowrap;
// /* 防止换行 */
// align-items: flex-start;
// gap: 10rpx;
// margin-bottom: 20rpx;
// padding: 20rpx;
// background-color: #f8f9fa;
// border-radius: 16rpx;
// box-sizing: border-box;
// overflow: hidden;
// /* 防止溢出 */
// }
// /* 关键为每个表单项设置适当的flex属性 */
// .inline-goods-form .nut-form-item {
// flex: 1; /* 平均分配空间 */
// min-width: 0; /* 重要:允许内容收缩 */
// max-width: 100%; /* 防止溢出 */
// word-break: break-word; /* 文本换行 */
// overflow: hidden; /* 隐藏溢出内容 */
// }
// /* 确保内部元素不会撑开 */
// .inline-goods-form .nut-form-item__body {
// width: 100%;
// overflow: hidden;
// }
// /* 调整按钮大小 */
// .inline-goods-form .nut-button {
// max-width: 100%;
// white-space: nowrap;
// overflow: hidden;
// text-overflow: ellipsis;
// }
// .inline-goods-form {
// display: flex;
// flex-wrap: wrap; /* 确保元素在不足的宽度时换行 */
// justify-content: space-between;
// gap: 10rpx; /* 设置每个表单项之间的间距 */
// width: 100%;
// // box-sizing: border-box;
// }
// .inline-goods-form-item-50 {
// flex: 0 0 50% !important; /* 第一个表单项占 50% */
// }
// .inline-goods-form-item-25 {
// flex: 0 0 25% !important; /* 其他两个表单项各占 25% */
// }
// .inline-item {
// flex: 1;
// display: flex;
// flex-direction: column;
// }
</style>

View File

@@ -167,7 +167,7 @@
<view style="align-items: center;text-align: center; padding: 20rpx 60rpx;"> <view style="align-items: center;text-align: center; padding: 20rpx 60rpx;">
<nut-button type="primary" block @click="submitForm"> <nut-button type="primary" block @click="submitForm">
保存订单 开台
</nut-button> </nut-button>
</view> </view>
</view> </view>
@@ -218,11 +218,27 @@
toValue toValue
} from 'vue'; } from 'vue';
import { import {
onLoad,
onShow,
onHide
} from '@dcloudio/uni-app';
import {
fetchCombos,
fetchGoods, fetchGoods,
fetchAddOrder,
} from '@/api/index'; } from '@/api/index';
onLoad(options => {
console.log('onLoad');
// 获取房间ID
form.room_id = options.roomId
console.log(form);
console.log(options);
})
// // 选择房间弹窗 // // 选择房间弹窗
// const visibleRoomsPopup = ref(false); // const visibleRoomsPopup = ref(false);
@@ -277,29 +293,31 @@
form.fee_type_name = selectedValue.selectedOptions[0].label form.fee_type_name = selectedValue.selectedOptions[0].label
form.fee_type = selectedValue.selectedOptions[0].value form.fee_type = selectedValue.selectedOptions[0].value
console.log(form); console.log(form);
if (form.fee_type !== 3) {
getCombos();
}
visibleFeeTypePopup.value = false visibleFeeTypePopup.value = false
} }
const getCombos = () => {
console.log("获取套餐");
fetchCombos({
type: form.fee_type
}).then(res => {
console.log(res);
combos.value = res;
})
}
// 选择套餐弹窗 // 选择套餐弹窗
const visibleCombosPopup = ref(false); const visibleCombosPopup = ref(false);
// 选中的套餐 // 选中的套餐
const popupCombosVal = ref([]) const popupCombosVal = ref([])
// 套餐列表 // 套餐列表
const combos = [{ const combos = ref([]);
value: 1,
label: '美团中包套餐'
},
{
value: 2,
label: '美团小包套餐'
},
{
value: 3,
label: '美团小包套餐'
},
];
// 选择套餐 // 选择套餐
const onConfirmCombos = (selectedValue) => { const onConfirmCombos = (selectedValue) => {
console.log(selectedValue); console.log(selectedValue);
@@ -308,8 +326,6 @@
console.log(form); console.log(form);
visibleCombosPopup.value = false visibleCombosPopup.value = false
} }
// 支付状态弹窗 // 支付状态弹窗
const visiblePaymentStatusPopup = ref(false); const visiblePaymentStatusPopup = ref(false);
// 选中的支付状态 // 选中的支付状态
@@ -342,7 +358,7 @@
if (popupPaymentTypeVal.value == 'fee') { if (popupPaymentTypeVal.value == 'fee') {
form.fee_pay_status_txt = selectedValue.selectedOptions[0].label form.fee_pay_status_txt = selectedValue.selectedOptions[0].label
form.payment_status = selectedValue.selectedOptions[0].value form.fee_pay_status = selectedValue.selectedOptions[0].value
} }
if (popupPaymentTypeVal.value == 'over') { if (popupPaymentTypeVal.value == 'over') {
form.over_pay_status_txt = selectedValue.selectedOptions[0].label form.over_pay_status_txt = selectedValue.selectedOptions[0].label
@@ -353,7 +369,6 @@
orderGoods.value[goodsPayIndex.value].goods_pay_status_txt = selectedValue.selectedOptions[0].label orderGoods.value[goodsPayIndex.value].goods_pay_status_txt = selectedValue.selectedOptions[0].label
orderGoods.value[goodsPayIndex.value].goods_pay_status = selectedValue.selectedOptions[0].value orderGoods.value[goodsPayIndex.value].goods_pay_status = selectedValue.selectedOptions[0].value
} }
console.log(form); console.log(form);
visiblePaymentStatusPopup.value = false visiblePaymentStatusPopup.value = false
popupPaymentTypeVal.value = '' popupPaymentTypeVal.value = ''
@@ -363,18 +378,18 @@
// 订单商品列表 // 订单商品列表
const orderGoods = ref([ const orderGoods = ref([
// { // {
// goods_type_name: null, // goods_type_name: null,
// goods_type_id: null, // goods_type_id: null,
// goods_name: null, // goods_name: null,
// goods_id: null, // goods_id: null,
// goods_price: null, // goods_price: null,
// goods_pay_status: 0, // goods_pay_status: 0,
// goods_pay_status_txt: "请选择", // goods_pay_status_txt: "请选择",
// cascader_val: [] // cascader_val: []
// }, // },
]) ])
// 当前操作的商品 // 当前操作的商品
const goodsPayIndex = ref(0) const goodsPayIndex = ref(0)
// 当前操作的商品 // 当前操作的商品
@@ -454,11 +469,10 @@
const form = reactive({ const form = reactive({
// room_id: 0, order_type: 1, // 开台订单
// room_name: '选择房间', room_id: 0,
fee_type: 0, fee_type: 0,
fee_type_name: '选择方式', fee_type_name: '选择',
fee_combo_id: 0, // 套餐费用ID fee_combo_id: 0, // 套餐费用ID
fee_combo_name: '请选择', // 套餐费用名称 fee_combo_name: '请选择', // 套餐费用名称
fee_amount: null, // 线下支付费用 fee_amount: null, // 线下支付费用
@@ -476,6 +490,7 @@
}) })
// 商品列表
const selectGoods = ref([]) const selectGoods = ref([])
onMounted(() => { onMounted(() => {
fetchGoods().then(res => { fetchGoods().then(res => {
@@ -494,7 +509,17 @@
// amount: amount.value, // amount: amount.value,
// paymentStatus: paymentStatus.value // paymentStatus: paymentStatus.value
// }; // };
console.log('提交的订单数据:', orderGoods.value); let data = {
order_goods: orderGoods.value,
order: form
}
console.log('提交的订单数据:', data);
// console.log('提交的订单数据:', form);
fetchAddOrder(data).then(res => {
console.log(res);
// selectGoods.value = res;
})
}; };
</script> </script>
@@ -547,72 +572,4 @@
gap: 20rpx; gap: 20rpx;
margin-bottom: 20rpx; margin-bottom: 20rpx;
} }
// .inline-goods-form {
// display: flex;
// justify-content: space-between;
// gap: 10rpx;
// /* 在元素之间添加间距 */
// }
// .inline-goods-form {
// display: flex;
// flex-wrap: nowrap;
// /* 防止换行 */
// align-items: flex-start;
// gap: 10rpx;
// margin-bottom: 20rpx;
// padding: 20rpx;
// background-color: #f8f9fa;
// border-radius: 16rpx;
// box-sizing: border-box;
// overflow: hidden;
// /* 防止溢出 */
// }
// /* 关键为每个表单项设置适当的flex属性 */
// .inline-goods-form .nut-form-item {
// flex: 1; /* 平均分配空间 */
// min-width: 0; /* 重要:允许内容收缩 */
// max-width: 100%; /* 防止溢出 */
// word-break: break-word; /* 文本换行 */
// overflow: hidden; /* 隐藏溢出内容 */
// }
// /* 确保内部元素不会撑开 */
// .inline-goods-form .nut-form-item__body {
// width: 100%;
// overflow: hidden;
// }
// /* 调整按钮大小 */
// .inline-goods-form .nut-button {
// max-width: 100%;
// white-space: nowrap;
// overflow: hidden;
// text-overflow: ellipsis;
// }
// .inline-goods-form {
// display: flex;
// flex-wrap: wrap; /* 确保元素在不足的宽度时换行 */
// justify-content: space-between;
// gap: 10rpx; /* 设置每个表单项之间的间距 */
// width: 100%;
// // box-sizing: border-box;
// }
// .inline-goods-form-item-50 {
// flex: 0 0 50% !important; /* 第一个表单项占 50% */
// }
// .inline-goods-form-item-25 {
// flex: 0 0 25% !important; /* 其他两个表单项各占 25% */
// }
// .inline-item {
// flex: 1;
// display: flex;
// flex-direction: column;
// }
</style> </style>

626
pages/index/orderEdit.vue Normal file
View File

@@ -0,0 +1,626 @@
<template>
<view class="page-content">
<view style=" padding: 10rpx;">
<view class="title">基础台费 </view>
<nut-form>
<!-- 台费类型套餐支付状态 三者在同一行布局 -->
<view class="inline-form">
<!-- 台费类型选择 -->
<nut-form-item label-position="top">
<template v-slot:label>结算方式</template>
<template v-slot:default>
<view style="color: black;" @click="visibleFeeTypePopup = true">
<text>{{form.fee_type_name}}</text>
</view>
</template>
</nut-form-item>
<!-- 套餐选择 -->
<nut-form-item label-position="top" v-if="form.fee_type === 1 || form.fee_type === 2">
<template v-slot:label>选择团购</template>
<template v-slot:default>
<view style="color: black;" @click="visibleCombosPopup = true">
<text>{{form.fee_combo_name}}</text>
</view>
</template>
</nut-form-item>
<!-- 金额输入框 -->
<nut-form-item label-position="top" v-else>
<template v-slot:label>线下收款</template>
<template v-slot:default>
<nut-input v-model="form.fee_amount" placeholder="请输入金额" type="number" />
</template>
</nut-form-item>
<!-- 支付状态选择 -->
<nut-form-item label-position="top">
<template v-slot:label>支付状态</template>
<template v-slot:default>
<view style="color: black;" @click="openPayStatusPopup('fee')">
<text>{{form.fee_pay_status_txt}}</text>
</view>
</template>
</nut-form-item>
</view>
</nut-form>
<view class="title">超时收费 </view>
<nut-form>
<!-- 台费类型套餐支付状态 三者在同一行布局 -->
<view class="inline-form">
<!-- 台费类型选择 -->
<nut-form-item label-position="top">
<template v-slot:label>时长(小时)</template>
<template v-slot:default>
<nut-input v-model="form.over_often" placeholder="请输入小时" type="number" />
</template>
</nut-form-item>
<!-- 金额输入框 -->
<nut-form-item label-position="top">
<template v-slot:label>超时金额</template>
<template v-slot:default>
<nut-input v-model="form.over_amount" placeholder="请输入金额" type="number" />
</template>
</nut-form-item>
<!-- 支付状态选择 -->
<nut-form-item label-position="top">
<template v-slot:label>支付状态</template>
<template v-slot:default>
<view style="color: black;" @click="openPayStatusPopup('over')">
<text>{{form.over_pay_status_txt}}</text>
</view>
</template>
</nut-form-item>
</view>
</nut-form>
<view class="title">商品 </view>
<view class="top-bar">
<nut-button type="primary" plain size="small" @click="addGoods">新增商品</nut-button>
</view>
<nut-form>
<!-- 台费类型套餐支付状态 三者在同一行布局 -->
<view class="inline-goods-form" v-for="(item, index) in orderGoods" :key="index">
<view class="form-row">
<!-- 台费类型选择 -->
<nut-form-item label-position="top">
<template v-slot:label>商品</template>
<template v-slot:default>
<view style="color: black;" @click="visibleGoodsCascader = true;goodsIndex = index">
<text v-if="item.goods_type_name && item.goods_name">
{{ item.goods_type_name }} - {{ item.goods_name }}
</text>
<text v-else>请选择商品</text>
</view>
</template>
</nut-form-item>
<!-- 套餐选择 -->
<nut-form-item label-position="top">
<template v-slot:label>售价</template>
<template v-slot:default>
<view style="color: black;">
<text>{{item.goods_price}}</text>
</view>
</template>
</nut-form-item>
</view>
<view class="form-row">
<!-- 支付状态选择 -->
<nut-form-item label-position="top">
<template v-slot:label>支付状态</template>
<template v-slot:default>
<view style="color: black;" @click="openPayStatusPopup('goods',index)">
<text>{{item.goods_pay_status_txt}}</text>
</view>
</template>
</nut-form-item>
<!-- 套餐选择 -->
<nut-form-item label-position="top">
<template v-slot:label>操作</template>
<template v-slot:default>
<view>
<nut-button type="danger" size="mini" @click="removeGoods(index)">删除商品</nut-button>
</view>
</template>
</nut-form-item>
</view>
</view>
</nut-form>
<view class="title">订单优惠 </view>
<nut-form>
<nut-form-item>
<template v-slot:label>优惠金额</template>
<template v-slot:default>
<nut-input v-model="form.discount_amount" placeholder="请输入金额" type="number" />
</template>
</nut-form-item>
</nut-form>
<view style="align-items: center;text-align: center; padding: 20rpx 60rpx;">
<nut-button type="primary" block @click="submitForm">
开台
</nut-button>
</view>
</view>
<nut-cascader title="商品选择" v-model:visible="visibleGoodsCascader" v-model="cascaderGoodsValue"
@change="onGoodsChange" @pathChange="onGoodsPathChange" text-key="label" value-key="value"
children-key="children" :options="selectGoods" :title-ellipsis="false" @open="onOpenGoodsCascader"
@close="onCloseGoodsCascader"></nut-cascader>
<!-- v-model="popupPaymentStatusVal" -->
<nut-popup v-model:visible="visiblePaymentStatusPopup" position="bottom" safe-area-inset-bottom>
<nut-picker :columns="paymentStatuses" :field-names="{text:'label',value:'value'}" title="选择支付状态"
@confirm="onConfirmPaymentStatus" @cancel="visiblePaymentStatusPopup = false">
</nut-picker>
</nut-popup>
<nut-popup v-model:visible="visibleCombosPopup" position="bottom" safe-area-inset-bottom>
<nut-picker v-model="popupCombosVal" :columns="combos" :field-names="{text:'label',value:'value'}"
title="选择团购套餐" @confirm="onConfirmCombos" @cancel="visibleCombosPopup = false">
</nut-picker>
</nut-popup>
<!-- v-model="popupFeeTypeVal" -->
<nut-popup v-model:visible="visibleFeeTypePopup" position="bottom" safe-area-inset-bottom>
<nut-picker :columns="feeTypes" :field-names="{text:'label',value:'value'}" title="选择结算方式"
@confirm="onConfirmFeeType" @cancel="visibleFeeTypePopup = false">
</nut-picker>
</nut-popup>
<!-- <nut-popup v-model:visible="visibleRoomsPopup" position="bottom" safe-area-inset-bottom>
<nut-picker v-model="popupRoomsVal" :columns="rooms" :field-names="{text:'label',value:'value'}"
title="选择房间" @confirm="onConfirmRoom" @cancel="visibleRoomsPopup = false">
</nut-picker>
</nut-popup> -->
</view>
</template>
<script setup>
import {
computed,
onMounted,
reactive,
ref,
toValue
} from 'vue';
import {
onLoad,
onShow,
onHide
} from '@dcloudio/uni-app';
import {
fetchCombos,
fetchGoods,
fetchAddOrder,
fetchRoomOrder,
} from '@/api/index';
onLoad(options => {
console.log('onLoad');
// 获取房间ID
form.room_id = options.roomId
getRoomOrder()
console.log(form);
console.log(options);
})
const getRoomOrder = () => {
fetchRoomOrder(form.room_id).then(res => {
console.log(res);
form.room_id = res.room_id
form.order_type = res.order_type
form.fee_type = res.fee_type.value
form.fee_type_name = res.fee_type.text
form.fee_combo_id = res.fee_combo_id
form.fee_combo_name = res.fee_combo_name
form.fee_amount = res.fee_amount
form.fee_pay_status = res.fee_pay_status.value
form.fee_pay_status_txt = res.fee_pay_status.text
form.over_often = res.over_often
form.over_amount = res.over_amount
form.over_pay_status = res.over_pay_status.value
form.over_pay_status_txt = res.over_pay_status.text
// is_show_edit.value = true;
// console.log("====>", res);
// form.goods_id = res.goods_id
// form.goods_name = res.goods_name
// form.goods_no = res.goods_no
// form.goods_price = res.goods_price
// // form.goods_stock = res.goods_stock
// form.content = res.content
// form.details_content = res.details_content
// form.status = res.status.value.toString()
// form.degree_id = res.degree?.degree_id ?? 0
// form.degree_name = res.degree?.degree_name ?? '未选择'
// form.type_id = res.type?.type_id ?? 0
// form.type_name = res.type?.name ?? '未选择'
// form.brand_id = res.brand?.brand_id ?? 0
// form.brand_name = res.brand?.name ?? '未选择'
// form.product_id = res.product?.product_id ?? 0
// form.product_name = res.product?.name ?? '未选择'
// popup_degree_val.value = [res.degree?.degree_id ?? 0]
// cascader_product_val.value = [res.type?.type_id ?? 0, res.brand?.brand_id ?? 0, res.product
// ?.product_id ?? 0
// ]
// form.images = []
// res.image?.forEach(item => {
// form.images.push({
// id: item.image_id,
// file_path: item.file_path,
// })
// })
})
}
// // 选择房间弹窗
// const visibleRoomsPopup = ref(false);
// // 选中的房间
// const popupRoomsVal = ref([])
// // 房间列表
// const rooms = [{
// value: 1,
// label: '房间 101'
// },
// {
// value: 2,
// label: '房间 102'
// },
// {
// value: 3,
// label: '房间 103'
// }
// ];
// // 选择房间
// const onConfirmRoom = (selectedValue) => {
// console.log(selectedValue);
// form.room_name = selectedValue.selectedOptions[0].label
// form.room_id = selectedValue.selectedOptions[0].value
// console.log(form);
// visibleRoomsPopup.value = false
// }
// 选择房间弹窗
const visibleFeeTypePopup = ref(false);
// 台费结算类型
// const popupFeeTypeVal = ref([])
// 台费类型选择列表
const feeTypes = [{
value: 1,
label: '美团'
},
{
value: 2,
label: '抖音'
},
{
value: 3,
label: '线下'
}
];
// 选择房间
const onConfirmFeeType = (selectedValue) => {
console.log(selectedValue);
form.fee_type_name = selectedValue.selectedOptions[0].label
form.fee_type = selectedValue.selectedOptions[0].value
console.log(form);
if (form.fee_type !== 3) {
getCombos();
}
visibleFeeTypePopup.value = false
}
const getCombos = () => {
console.log("获取套餐");
fetchCombos({
type: form.fee_type
}).then(res => {
console.log(res);
combos.value = res;
})
}
// 选择套餐弹窗
const visibleCombosPopup = ref(false);
// 选中的套餐
const popupCombosVal = ref([])
// 套餐列表
const combos = ref([]);
// 选择套餐
const onConfirmCombos = (selectedValue) => {
console.log(selectedValue);
form.fee_combo_name = selectedValue.selectedOptions[0].label
form.fee_combo_id = selectedValue.selectedOptions[0].value
console.log(form);
visibleCombosPopup.value = false
}
// 支付状态弹窗
const visiblePaymentStatusPopup = ref(false);
// 选中的支付状态
const popupPaymentStatusVal = ref([])
// 支付类型
const popupPaymentTypeVal = ref('')
// 支付状态
const paymentStatuses = [{
value: 1,
label: '已付'
},
{
value: 2,
label: '未付'
},
{
value: 3,
label: '赠送'
}
];
const openPayStatusPopup = (type, index = -1) => {
popupPaymentTypeVal.value = type
goodsPayIndex.value = index // 只有type = goods 生效
visiblePaymentStatusPopup.value = true
console.log(type);
}
const onConfirmPaymentStatus = (selectedValue) => {
if (popupPaymentTypeVal.value == 'fee') {
form.fee_pay_status_txt = selectedValue.selectedOptions[0].label
form.fee_pay_status = selectedValue.selectedOptions[0].value
}
if (popupPaymentTypeVal.value == 'over') {
form.over_pay_status_txt = selectedValue.selectedOptions[0].label
form.over_pay_status = selectedValue.selectedOptions[0].value
}
if (popupPaymentTypeVal.value == 'goods' && goodsPayIndex.value >= 0) {
console.log("处理商品支付状态", goodsPayIndex.value);
orderGoods.value[goodsPayIndex.value].goods_pay_status_txt = selectedValue.selectedOptions[0].label
orderGoods.value[goodsPayIndex.value].goods_pay_status = selectedValue.selectedOptions[0].value
}
console.log(form);
visiblePaymentStatusPopup.value = false
popupPaymentTypeVal.value = ''
goodsPayIndex.value = -1
}
// 订单商品列表
const orderGoods = ref([
// {
// goods_type_name: null,
// goods_type_id: null,
// goods_name: null,
// goods_id: null,
// goods_price: null,
// goods_pay_status: 0,
// goods_pay_status_txt: "请选择",
// cascader_val: []
// },
])
// 当前操作的商品
const goodsPayIndex = ref(0)
// 当前操作的商品
const goodsIndex = ref(0)
// 添加规则
const addGoods = () => {
console.log(orderGoods.value);
orderGoods.value.push({
goods_type_name: null,
goods_type_id: null,
goods_name: null,
goods_id: null,
goods_price: null,
goods_pay_status: 0,
goods_pay_status_txt: "请选择",
cascader_val: []
})
}
// 删除商品
const removeGoods = (index) => {
orderGoods.value.splice(index, 1)
}
// 显示商品选择
const visibleGoodsCascader = ref(false)
// 商品选中
const cascaderGoodsValue = computed(() => {
let cascader_val = [];
if (goodsIndex.value >= 0) {
return orderGoods.value[goodsIndex.value]?.cascader_val ?? []
} else {
return cascader_val;
}
});
const onGoodsChange = (...args) => {
console.log("onGoodsChange", args);
}
// 选择商品
const onGoodsPathChange = (args) => {
console.log("onGoodsPathChange", args);
console.log("goodsIndex", goodsIndex.value);
console.log("orderGoods.value[goodsIndex.value]", orderGoods.value[goodsIndex.value]);
orderGoods.value[goodsIndex.value].goods_type_name = null
orderGoods.value[goodsIndex.value].goods_type_id = null
orderGoods.value[goodsIndex.value].goods_name = null
orderGoods.value[goodsIndex.value].goods_id = null
orderGoods.value[goodsIndex.value].goods_price = null
if (args.length >= 1 && args[0] !== null) {
orderGoods.value[goodsIndex.value].goods_type_name = args[0].text
orderGoods.value[goodsIndex.value].goods_type_id = args[0].value
}
if (args.length >= 2 && args[1] !== null) {
orderGoods.value[goodsIndex.value].goods_name = args[1].text
orderGoods.value[goodsIndex.value].goods_id = args[1].value
orderGoods.value[goodsIndex.value].goods_price = args[1].goods_price
}
console.log("orderGoods.value[goodsIndex.value]", orderGoods.value[goodsIndex.value]);
}
const onCloseGoodsCascader = () => {
console.log("onCloseGoodsCascader");
console.log("goodsIndex.value", goodsIndex.value);
if (orderGoods.value[goodsIndex.value].goods_type_id && orderGoods.value[goodsIndex.value].goods_id) {
orderGoods.value[goodsIndex.value].cascader_val = [
orderGoods.value[goodsIndex.value].goods_type_id,
orderGoods.value[goodsIndex.value].goods_id
]
}
goodsIndex.value = 0
console.log("goodsIndex.value", goodsIndex.value);
}
const onOpenGoodsCascader = () => {
console.log("onOpenGoodsCascader");
console.log("goodsIndex.value", goodsIndex.value);
}
const form = reactive({
order_type: 1, // 开台订单
room_id: 0,
fee_type: 0,
fee_type_name: '请选择',
fee_combo_id: 0, // 套餐费用ID
fee_combo_name: '请选择', // 套餐费用名称
fee_amount: null, // 线下支付费用
fee_pay_status: 0, // 费用支付状态
fee_pay_status_txt: '请选择', // 费用支付状态
over_often: null, // 超时小时
over_amount: null, // 超时金额
over_pay_status: 0, // 超时支付状态
over_pay_status_txt: "请选择", // 超时支付状态
discount_amount: null, // 优惠金额
})
// 商品列表
const selectGoods = ref([])
onMounted(() => {
fetchGoods().then(res => {
selectGoods.value = res;
})
})
// 提交表单
const submitForm = () => {
// const formData = {
// room: room.value,
// feeType: feeType.value,
// selectedPackage: selectedPackage.value,
// amount: amount.value,
// paymentStatus: paymentStatus.value
// };
let data = {
order_goods: orderGoods.value,
order: form
}
console.log('提交的订单数据:', data);
// console.log('提交的订单数据:', form);
fetchAddOrder(data).then(res => {
console.log(res);
// selectGoods.value = res;
})
};
</script>
<style lang="scss" scoped>
.page-content {
min-height: 100vh;
background-color: #f2f3f5;
}
.title {
padding: 0 20rpx;
margin-top: 20rpx;
margin-bottom: 20rpx;
font-size: 28rpx;
// font-weight: 400;
color: #909ca4;
}
.inline-form {
display: flex;
justify-content: space-between;
gap: 10rpx;
/* 在元素之间添加间距 */
}
.top-bar {
background: #fff;
padding: 20rpx;
display: flex;
justify-content: space-between;
border-top: 1px solid #eee;
// position: sticky;
// bottom: 0;
// z-index: 999;
}
/* 每个商品项容器 */
.inline-goods-form {
// box-sizing: border-box;
}
/* 行容器 */
.form-row {
display: flex;
justify-content: space-between;
align-items: flex-start;
gap: 20rpx;
margin-bottom: 20rpx;
}
</style>

View File

@@ -1 +1 @@
{"version":3,"file":"index.js","sources":["api/index.ts"],"sourcesContent":["import { request } from \"./request\";\n\n// export function fetchNavList () {\n// \treturn request({\n// \t\turl:'/index/nav_list'\n// \t})\n// }\n\n\n\n\n// 获取店铺配置\nexport function fetchGoods () {\n\treturn request({\n\t\turl:'/index/goods',\n\t})\n}\n\n"],"names":["request"],"mappings":";;AAYO,SAAS,aAAc;AAC7B,SAAOA,oBAAQ;AAAA,IACd,KAAI;AAAA,EAAA,CACJ;AACF;;"} {"version":3,"file":"index.js","sources":["api/index.ts"],"sourcesContent":["import { request } from \"./request\";\n\n// export function fetchNavList () {\n// \treturn request({\n// \t\turl:'/index/nav_list'\n// \t})\n// }\n\n\n\n\n// 获取商品\nexport function fetchGoods () {\n\treturn request({\n\t\turl:'/index/goods',\n\t})\n}\n// 获取套餐\nexport function fetchCombos(data : {}) {\n\treturn request({\n\t\turl: '/index/combos',\n\t\tdata: data,\n\t\tmethod: 'POST'\n\t});\n}\n// 获取房间\nexport function fetchRooms(data : {}) {\n\treturn request({\n\t\turl: '/index/rooms',\n\t\tdata: data,\n\t\tmethod: 'POST'\n\t});\n}\n\n// 预约\nexport function fetchBooking(data : {}) {\n\treturn request({\n\t\turl: '/index/booking',\n\t\tdata: data,\n\t\tmethod: 'POST'\n\t});\n}\n// 取消预约\nexport function fetchUnBooking(data : {}) {\n\treturn request({\n\t\turl: '/index/unbooking',\n\t\tdata: data,\n\t\tmethod: 'POST'\n\t});\n}\n\n// 开台/商品订单\nexport function fetchAddOrder(data : {}) {\n\treturn request({\n\t\turl: '/index/addOrder',\n\t\tdata: data,\n\t\tmethod: 'POST'\n\t});\n}\n\n// 房间订单详情\r\nexport function fetchRoomOrder(roomId : Number) {\r\n\treturn request({\r\n\t\turl: '/index/roomOrder',\r\n\t\tdata: { roomId: roomId },\r\n\t})\r\n}\r\n"],"names":["request"],"mappings":";;AAYO,SAAS,aAAc;AAC7B,SAAOA,oBAAQ;AAAA,IACd,KAAI;AAAA,EAAA,CACJ;AACF;AAEO,SAAS,YAAY,MAAW;AACtC,SAAOA,oBAAQ;AAAA,IACd,KAAK;AAAA,IACL;AAAA,IACA,QAAQ;AAAA,EAAA,CACR;AACF;AAEO,SAAS,WAAW,MAAW;AACrC,SAAOA,oBAAQ;AAAA,IACd,KAAK;AAAA,IACL;AAAA,IACA,QAAQ;AAAA,EAAA,CACR;AACF;AAGO,SAAS,aAAa,MAAW;AACvC,SAAOA,oBAAQ;AAAA,IACd,KAAK;AAAA,IACL;AAAA,IACA,QAAQ;AAAA,EAAA,CACR;AACF;AAEO,SAAS,eAAe,MAAW;AACzC,SAAOA,oBAAQ;AAAA,IACd,KAAK;AAAA,IACL;AAAA,IACA,QAAQ;AAAA,EAAA,CACR;AACF;AAGO,SAAS,cAAc,MAAW;AACxC,SAAOA,oBAAQ;AAAA,IACd,KAAK;AAAA,IACL;AAAA,IACA,QAAQ;AAAA,EAAA,CACR;AACF;AAGO,SAAS,eAAe,QAAiB;AAC/C,SAAOA,oBAAQ;AAAA,IACd,KAAK;AAAA,IACL,MAAM,EAAE,OAAe;AAAA,EAAA,CACvB;AACF;;;;;;;;"}

View File

@@ -1 +1 @@
{"version":3,"file":"app.js","sources":["App.vue","main.js"],"sourcesContent":["<script>\n\t// import {ShoppingCartType} from '@/common/constants';\n\texport default {\n\tonLaunch: function () {\n\t\t\t// const shoppingCartType = uni.getStorageSync('SHOPPING_CART_TYPE');\n\t\t\t// if (!shoppingCartType) {\n\t\t\t// \tuni.setStorageSync('SHOPPING_CART_TYPE', ShoppingCartType.PHONE)\n\t\t\t// }\n\n\t\t\t// uni.hideTabBar()\n\t\t\tconsole.log('App Launch')\n\t\t},\n\t\tonShow: function() {\n\t\t\t// uni.hideTabBar()\n\t\t\tconsole.log('App Show')\n\t\t},\n\t\tonHide: function() {\n\t\t\tconsole.log('App Hide')\n\t\t}\n\t}\n</script>\n\n<style lang=\"scss\">\n\t@import \"@/uni_modules/nutui-uni/styles/index.scss\";\n</style>\n","import App from './App'\n\n// #ifndef VUE3\nimport Vue from 'vue'\nimport './uni.promisify.adaptor'\nVue.config.productionTip = false\nApp.mpType = 'app'\nconst app = new Vue({\n ...App\n})\napp.$mount()\n// #endif\n\n// #ifdef VUE3\nimport { createSSRApp } from 'vue'\nexport function createApp() {\n const app = createSSRApp(App)\n return {\n app\n }\n}\n// #endif"],"names":["uni","createSSRApp","App"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AAEC,MAAK,YAAU;AAAA,EACf,UAAU,WAAY;AAOpBA,kBAAAA,MAAY,MAAA,OAAA,iBAAA,YAAY;AAAA,EACxB;AAAA,EACD,QAAQ,WAAW;AAElBA,kBAAAA,MAAY,MAAA,OAAA,iBAAA,UAAU;AAAA,EACtB;AAAA,EACD,QAAQ,WAAW;AAClBA,kBAAAA,MAAY,MAAA,OAAA,iBAAA,UAAU;AAAA,EACvB;AACD;ACJM,SAAS,YAAY;AAC1B,QAAM,MAAMC,cAAY,aAACC,SAAG;AAC5B,SAAO;AAAA,IACL;AAAA,EACD;AACH;;;"} {"version":3,"file":"app.js","sources":["App.vue","main.js"],"sourcesContent":["<script>\n\t// import {ShoppingCartType} from '@/common/constants';\n\texport default {\n\tonLaunch: function () {\n\t\t\t// const shoppingCartType = uni.getStorageSync('SHOPPING_CART_TYPE');\n\t\t\t// if (!shoppingCartType) {\n\t\t\t// \tuni.setStorageSync('SHOPPING_CART_TYPE', ShoppingCartType.PHONE)\n\t\t\t// }\n\n\t\t\t// uni.hideTabBar()\n\t\t\tconsole.log('App Launch')\n\t\t},\n\t\tonShow: function() {\n\t\t\t// uni.hideTabBar()\n\t\t\tconsole.log('App Show')\n\t\t},\n\t\tonHide: function() {\n\t\t\tconsole.log('App Hide')\n\t\t}\n\t}\n</script>\n\n<style lang=\"scss\">\n\t@import \"@/uni_modules/nutui-uni/styles/index.scss\";\n</style>\n","import App from './App'\n\n// #ifndef VUE3\nimport Vue from 'vue'\nimport './uni.promisify.adaptor'\nVue.config.productionTip = false\nApp.mpType = 'app'\nconst app = new Vue({\n ...App\n})\napp.$mount()\n// #endif\n\n// #ifdef VUE3\nimport { createSSRApp } from 'vue'\nexport function createApp() {\n const app = createSSRApp(App)\n return {\n app\n }\n}\n// #endif"],"names":["uni","createSSRApp","App"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAEC,MAAK,YAAU;AAAA,EACf,UAAU,WAAY;AAOpBA,kBAAAA,MAAY,MAAA,OAAA,iBAAA,YAAY;AAAA,EACxB;AAAA,EACD,QAAQ,WAAW;AAElBA,kBAAAA,MAAY,MAAA,OAAA,iBAAA,UAAU;AAAA,EACtB;AAAA,EACD,QAAQ,WAAW;AAClBA,kBAAAA,MAAY,MAAA,OAAA,iBAAA,UAAU;AAAA,EACvB;AACD;ACJM,SAAS,YAAY;AAC1B,QAAM,MAAMC,cAAY,aAACC,SAAG;AAC5B,SAAO;AAAA,IACL;AAAA,EACD;AACH;;;"}

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@@ -5,5 +5,52 @@ function fetchGoods() {
url: "/index/goods" url: "/index/goods"
}); });
} }
function fetchCombos(data) {
return api_request.request({
url: "/index/combos",
data,
method: "POST"
});
}
function fetchRooms(data) {
return api_request.request({
url: "/index/rooms",
data,
method: "POST"
});
}
function fetchBooking(data) {
return api_request.request({
url: "/index/booking",
data,
method: "POST"
});
}
function fetchUnBooking(data) {
return api_request.request({
url: "/index/unbooking",
data,
method: "POST"
});
}
function fetchAddOrder(data) {
return api_request.request({
url: "/index/addOrder",
data,
method: "POST"
});
}
function fetchRoomOrder(roomId) {
return api_request.request({
url: "/index/roomOrder",
data: { roomId }
});
}
exports.fetchAddOrder = fetchAddOrder;
exports.fetchBooking = fetchBooking;
exports.fetchCombos = fetchCombos;
exports.fetchGoods = fetchGoods; exports.fetchGoods = fetchGoods;
exports.fetchRoomOrder = fetchRoomOrder;
exports.fetchRooms = fetchRooms;
exports.fetchUnBooking = fetchUnBooking;
//# sourceMappingURL=../../.sourcemap/mp-weixin/api/index.js.map //# sourceMappingURL=../../.sourcemap/mp-weixin/api/index.js.map

View File

@@ -4,6 +4,7 @@ const common_vendor = require("./common/vendor.js");
if (!Math) { if (!Math) {
"./pages/index/index.js"; "./pages/index/index.js";
"./pages/index/orderAdd.js"; "./pages/index/orderAdd.js";
"./pages/index/orderEdit.js";
"./pages/mine/index.js"; "./pages/mine/index.js";
"./pages/mall/detail.js"; "./pages/mall/detail.js";
"./pages/mall/houseDetail.js"; "./pages/mall/houseDetail.js";

View File

@@ -2,6 +2,7 @@
"pages": [ "pages": [
"pages/index/index", "pages/index/index",
"pages/index/orderAdd", "pages/index/orderAdd",
"pages/index/orderEdit",
"pages/mine/index", "pages/mine/index",
"pages/mall/detail", "pages/mall/detail",
"pages/mall/houseDetail", "pages/mall/houseDetail",

View File

@@ -1,50 +1,112 @@
"use strict"; "use strict";
const common_vendor = require("../../common/vendor.js"); const common_vendor = require("../../common/vendor.js");
const api_index = require("../../api/index.js");
const utils_helper = require("../../utils/helper.js"); const utils_helper = require("../../utils/helper.js");
if (!Array) { if (!Array) {
const _easycom_nut_button2 = common_vendor.resolveComponent("nut-button"); const _easycom_nut_button2 = common_vendor.resolveComponent("nut-button");
const _easycom_nut_grid_item2 = common_vendor.resolveComponent("nut-grid-item"); const _easycom_nut_input2 = common_vendor.resolveComponent("nut-input");
const _easycom_nut_grid2 = common_vendor.resolveComponent("nut-grid"); const _easycom_nut_form_item2 = common_vendor.resolveComponent("nut-form-item");
(_easycom_nut_button2 + _easycom_nut_grid_item2 + _easycom_nut_grid2)(); const _easycom_nut_textarea2 = common_vendor.resolveComponent("nut-textarea");
const _easycom_nut_form2 = common_vendor.resolveComponent("nut-form");
const _easycom_nut_popup2 = common_vendor.resolveComponent("nut-popup");
(_easycom_nut_button2 + _easycom_nut_input2 + _easycom_nut_form_item2 + _easycom_nut_textarea2 + _easycom_nut_form2 + _easycom_nut_popup2)();
} }
const _easycom_nut_button = () => "../../uni_modules/nutui-uni/components/button/button.js"; const _easycom_nut_button = () => "../../uni_modules/nutui-uni/components/button/button.js";
const _easycom_nut_grid_item = () => "../../uni_modules/nutui-uni/components/griditem/griditem.js"; const _easycom_nut_input = () => "../../uni_modules/nutui-uni/components/input/input.js";
const _easycom_nut_grid = () => "../../uni_modules/nutui-uni/components/grid/grid.js"; const _easycom_nut_form_item = () => "../../uni_modules/nutui-uni/components/formitem/formitem.js";
const _easycom_nut_textarea = () => "../../uni_modules/nutui-uni/components/textarea/textarea.js";
const _easycom_nut_form = () => "../../uni_modules/nutui-uni/components/form/form.js";
const _easycom_nut_popup = () => "../../uni_modules/nutui-uni/components/popup/popup.js";
if (!Math) { if (!Math) {
(_easycom_nut_button + _easycom_nut_grid_item + _easycom_nut_grid)(); (_easycom_nut_button + _easycom_nut_input + _easycom_nut_form_item + _easycom_nut_textarea + _easycom_nut_form + _easycom_nut_popup)();
} }
const _sfc_main = { const _sfc_main = {
__name: "index", __name: "index",
setup(__props) { setup(__props) {
const rooms = [ const form = common_vendor.reactive({
{ room_id: 0,
name: "房间名称 1" tel: "",
}, remarks: ""
{ });
name: "房间名称 2" const rooms = common_vendor.ref([]);
}, const getRoomStyle = (status) => {
{ let backgroundColor = "";
name: "房间名称 3" switch (status) {
}, case 1:
{ backgroundColor = "#d9d9d9";
name: "房间名称 4" break;
}, case 2:
{ backgroundColor = "#ffa39e";
name: "房间名称 5" break;
}, case 3:
{ backgroundColor = "#b7eb8f";
name: "房间名称 6" break;
}, default:
{ backgroundColor = "#d9d9d9";
name: "房间名称 7"
},
{
name: "房间名称 8"
},
{
name: "房间名称 9"
} }
]; return {
"background-color": backgroundColor
};
};
const visiblePopup = common_vendor.ref(false);
const tempRoom = common_vendor.reactive({});
const onBooking = (room) => {
common_vendor.index.__f__("log", "at pages/index/index.vue:123", "----", room);
Object.assign(tempRoom, room);
form.room_id = room.id;
visiblePopup.value = true;
};
const onClosePopup = () => {
Object.assign(tempRoom, {});
Object.assign(form, {
room_id: 0,
tel: "",
remarks: ""
});
visiblePopup.value = false;
common_vendor.index.__f__("log", "at pages/index/index.vue:136", "关闭");
};
const getRooms = () => {
common_vendor.index.__f__("log", "at pages/index/index.vue:140", "房间");
api_index.fetchRooms().then((res) => {
common_vendor.index.__f__("log", "at pages/index/index.vue:142", res);
rooms.value = res;
});
};
const onSubmit = () => {
api_index.fetchBooking(form).then((res) => {
common_vendor.index.__f__("log", "at pages/index/index.vue:150", res);
common_vendor.index.showToast({
icon: "none",
title: "预约成功"
});
onClosePopup();
getRooms();
});
};
const onUnBooking = (room) => {
api_index.fetchUnBooking({
id: room.id
}).then((res) => {
common_vendor.index.__f__("log", "at pages/index/index.vue:164", res);
common_vendor.index.showToast({
icon: "none",
title: "取消预约成功"
});
getRooms();
});
};
const init = () => {
common_vendor.index.__f__("log", "at pages/index/index.vue:174", "init");
getRooms();
};
common_vendor.onShow(() => {
common_vendor.index.__f__("log", "at pages/index/index.vue:179", "onshow---");
getRooms();
});
common_vendor.onMounted(() => {
init();
});
return (_ctx, _cache) => { return (_ctx, _cache) => {
return { return {
a: common_vendor.o(($event) => common_vendor.unref(utils_helper.navigateTo)("/pages/index/orderAdd")), a: common_vendor.o(($event) => common_vendor.unref(utils_helper.navigateTo)("/pages/index/orderAdd")),
@@ -53,24 +115,95 @@ const _sfc_main = {
block: true block: true
}), }),
c: common_vendor.s("top:0px"), c: common_vendor.s("top:0px"),
d: common_vendor.f(rooms, (room, index, i0) => { d: common_vendor.f(rooms.value, (room, index, i0) => {
return { return common_vendor.e({
a: common_vendor.t(room.name), a: common_vendor.t(room.room_name),
b: "1cf27b2a-3-" + i0 + "," + ("1cf27b2a-2-" + i0), b: room.tel
c: "1cf27b2a-4-" + i0 + "," + ("1cf27b2a-2-" + i0), }, room.tel ? {
d: index, c: common_vendor.t(room.tel)
e: "1cf27b2a-2-" + i0 + ",1cf27b2a-1" } : {}, {
}; d: room.remarks
}), }, room.remarks ? {
e: common_vendor.p({ e: common_vendor.t(room.remarks)
type: "primary" } : {}, {
}), f: room.status === 1
f: common_vendor.p({ }, room.status === 1 ? {
type: "success" g: common_vendor.o(($event) => onBooking(room), index),
h: "1cf27b2a-1-" + i0,
i: common_vendor.p({
size: "small",
type: "primary",
shape: "square"
})
} : room.status === 2 ? {
k: common_vendor.o(($event) => onUnBooking(room), index),
l: "1cf27b2a-2-" + i0,
m: common_vendor.p({
size: "small",
type: "warning",
plain: true,
shape: "square"
})
} : {}, {
j: room.status === 2,
n: room.status === 3
}, room.status === 3 ? {
o: common_vendor.o(($event) => common_vendor.unref(utils_helper.navigateTo)(`/pages/index/orderEdit?roomId=${room.id}`), index),
p: "1cf27b2a-3-" + i0,
q: common_vendor.p({
size: "small",
type: "info",
plain: true,
shape: "square"
})
} : {
r: common_vendor.o(($event) => common_vendor.unref(utils_helper.navigateTo)(`/pages/index/orderAdd?roomId=${room.id}`), index),
s: "1cf27b2a-4-" + i0,
t: common_vendor.p({
size: "small",
type: "success",
plain: true,
shape: "square"
})
}, {
v: index,
w: common_vendor.s(getRoomStyle(room.status))
});
}), }),
e: common_vendor.t(tempRoom == null ? void 0 : tempRoom.room_name),
f: common_vendor.o(($event) => form.tel = $event),
g: common_vendor.p({ g: common_vendor.p({
["column-num"]: 2, placeholder: "请输入尾号",
square: true modelValue: form.tel
}),
h: common_vendor.p({
label: "尾号"
}),
i: common_vendor.o(($event) => form.remarks = $event),
j: common_vendor.p({
rows: 3,
["adjust-keyboard-to"]: _ctx.bottom,
placeholder: "请输入备注",
modelValue: form.remarks
}),
k: common_vendor.p({
label: "备注"
}),
l: common_vendor.o(onSubmit),
m: common_vendor.p({
type: "primary",
block: true
}),
n: common_vendor.o(onClosePopup),
o: common_vendor.o(($event) => visiblePopup.value = $event),
p: common_vendor.p({
["custom-style"]: {
height: "60%"
},
position: "bottom",
["safe-area-inset-bottom"]: true,
["close-on-click-overlay"]: true,
visible: visiblePopup.value
}) })
}; };
}; };

View File

@@ -1,9 +1,12 @@
{ {
"navigationBarTitleText": "订单管理", "navigationBarTitleText": "茶麻古道",
"enablePullDownRefresh": false, "enablePullDownRefresh": false,
"usingComponents": { "usingComponents": {
"nut-button": "../../uni_modules/nutui-uni/components/button/button", "nut-button": "../../uni_modules/nutui-uni/components/button/button",
"nut-grid-item": "../../uni_modules/nutui-uni/components/griditem/griditem", "nut-input": "../../uni_modules/nutui-uni/components/input/input",
"nut-grid": "../../uni_modules/nutui-uni/components/grid/grid" "nut-form-item": "../../uni_modules/nutui-uni/components/formitem/formitem",
"nut-textarea": "../../uni_modules/nutui-uni/components/textarea/textarea",
"nut-form": "../../uni_modules/nutui-uni/components/form/form",
"nut-popup": "../../uni_modules/nutui-uni/components/popup/popup"
} }
} }

View File

@@ -1 +1 @@
<view class="page-content data-v-1cf27b2a"><view class="data-v-1cf27b2a" style="{{'z-index:10000;position:sticky' + ';' + c}}"><view class="top-bar data-v-1cf27b2a"><nut-button wx:if="{{b}}" class="data-v-1cf27b2a" u-s="{{['d']}}" bindclick="{{a}}" u-i="1cf27b2a-0" bind:__l="__l" u-p="{{b}}"> 新增商品订单 </nut-button></view></view><nut-grid wx:if="{{g}}" class="data-v-1cf27b2a" u-s="{{['d']}}" u-i="1cf27b2a-1" bind:__l="__l" u-p="{{g}}"><nut-grid-item wx:for="{{d}}" wx:for-item="room" wx:key="d" class="data-v-1cf27b2a" u-s="{{['d']}}" u-i="{{room.e}}" bind:__l="__l"><view class="grid-item-content data-v-1cf27b2a"><view class="room-name data-v-1cf27b2a">{{room.a}}</view><view class="room-footer data-v-1cf27b2a"><view class="room-id data-v-1cf27b2a">尾号: 111111</view><view class="remark data-v-1cf27b2a">备注: 这是一段北湖这是一段北湖这是一段北...</view></view><view class="buttons data-v-1cf27b2a"><nut-button wx:if="{{e}}" class="data-v-1cf27b2a" u-s="{{['d']}}" u-i="{{room.b}}" bind:__l="__l" u-p="{{e}}">预约</nut-button><nut-button wx:if="{{f}}" class="data-v-1cf27b2a" u-s="{{['d']}}" u-i="{{room.c}}" bind:__l="__l" u-p="{{f}}">开台</nut-button></view></view></nut-grid-item></nut-grid></view> <view class="page-content data-v-1cf27b2a"><view class="data-v-1cf27b2a" style="{{'z-index:10000;position:sticky' + ';' + c}}"><view class="top-bar data-v-1cf27b2a"><nut-button wx:if="{{b}}" class="data-v-1cf27b2a" u-s="{{['d']}}" bindclick="{{a}}" u-i="1cf27b2a-0" bind:__l="__l" u-p="{{b}}"> 新增商品订单 </nut-button></view></view><view class="room-grid data-v-1cf27b2a"><view wx:for="{{d}}" wx:for-item="room" wx:key="v" class="room-grid-item data-v-1cf27b2a" style="{{room.w}}"><view class="room-grid-card data-v-1cf27b2a"><view class="grid-item-content data-v-1cf27b2a"><view class="room-name data-v-1cf27b2a">{{room.a}}</view><view class="room-info data-v-1cf27b2a"><view wx:if="{{room.b}}" class="room-id data-v-1cf27b2a">尾号: {{room.c}}</view><view wx:if="{{room.d}}" class="remark data-v-1cf27b2a">备注: {{room.e}}</view></view><view class="room-buttons data-v-1cf27b2a"><view wx:if="{{room.f}}" class="data-v-1cf27b2a"><nut-button wx:if="{{room.i}}" class="data-v-1cf27b2a" u-s="{{['d']}}" bindclick="{{room.g}}" u-i="{{room.h}}" bind:__l="__l" u-p="{{room.i}}">预约</nut-button></view><view wx:elif="{{room.j}}" class="data-v-1cf27b2a"><nut-button wx:if="{{room.m}}" class="data-v-1cf27b2a" u-s="{{['d']}}" bindclick="{{room.k}}" u-i="{{room.l}}" bind:__l="__l" u-p="{{room.m}}">取消预约</nut-button></view><view wx:if="{{room.n}}" class="data-v-1cf27b2a"><nut-button wx:if="{{room.q}}" class="data-v-1cf27b2a" u-s="{{['d']}}" bindclick="{{room.o}}" u-i="{{room.p}}" bind:__l="__l" u-p="{{room.q}}">详情</nut-button></view><view wx:else class="data-v-1cf27b2a"><nut-button wx:if="{{room.t}}" class="data-v-1cf27b2a" u-s="{{['d']}}" bindclick="{{room.r}}" u-i="{{room.s}}" bind:__l="__l" u-p="{{room.t}}">开台</nut-button></view></view></view></view></view></view><nut-popup wx:if="{{p}}" class="data-v-1cf27b2a" u-s="{{['d']}}" bindclose="{{n}}" u-i="1cf27b2a-5" bind:__l="__l" bindupdateVisible="{{o}}" u-p="{{p}}"><view class="data-v-1cf27b2a"><view class="title data-v-1cf27b2a">{{e}}</view><nut-form class="data-v-1cf27b2a" u-s="{{['d']}}" u-i="1cf27b2a-6,1cf27b2a-5" bind:__l="__l"><nut-form-item wx:if="{{h}}" class="data-v-1cf27b2a" u-s="{{['d']}}" u-i="1cf27b2a-7,1cf27b2a-6" bind:__l="__l" u-p="{{h}}"><nut-input wx:if="{{g}}" class="data-v-1cf27b2a" u-i="1cf27b2a-8,1cf27b2a-7" bind:__l="__l" bindupdateModelValue="{{f}}" u-p="{{g}}"></nut-input></nut-form-item><nut-form-item wx:if="{{k}}" class="data-v-1cf27b2a" u-s="{{['d']}}" u-i="1cf27b2a-9,1cf27b2a-6" bind:__l="__l" u-p="{{k}}"><nut-textarea wx:if="{{j}}" class="data-v-1cf27b2a" u-i="1cf27b2a-10,1cf27b2a-9" bind:__l="__l" bindupdateModelValue="{{i}}" u-p="{{j}}"></nut-textarea></nut-form-item></nut-form><view class="data-v-1cf27b2a" style="padding:0rpx 80rpx"><nut-button wx:if="{{m}}" class="data-v-1cf27b2a" u-s="{{['d']}}" bindclick="{{l}}" u-i="1cf27b2a-11,1cf27b2a-5" bind:__l="__l" u-p="{{m}}"> 预约 </nut-button></view></view></nut-popup></view>

View File

@@ -58,6 +58,20 @@
text-align: center; text-align: center;
padding: 20rpx 60rpx; padding: 20rpx 60rpx;
} }
/* Grid布局 - 每行两列 */
.room-grid.data-v-1cf27b2a {
display: grid;
grid-template-columns: repeat(2, 1fr);
/* 两列等宽 */
gap: 20rpx;
/* 间距 */
padding: 20rpx;
background: #f5f5f5;
}
.room-grid-item.data-v-1cf27b2a {
border-radius: 16rpx;
}
.grid-item-content.data-v-1cf27b2a { .grid-item-content.data-v-1cf27b2a {
display: flex; display: flex;
flex-direction: column; flex-direction: column;
@@ -66,23 +80,54 @@
height: 100%; height: 100%;
text-align: center; text-align: center;
} }
.room-name.data-v-1cf27b2a { .grid-item-content .room-name.data-v-1cf27b2a {
font-size: 32rpx; font-size: 32rpx;
} padding: 20rpx 0;
.room-footer.data-v-1cf27b2a {
margin: 20rpx 0;
color: #666;
}
.room-footer .room-id.data-v-1cf27b2a {
font-size: 26rpx;
margin-bottom: 10rpx;
}
.room-footer .remark.data-v-1cf27b2a {
font-size: 24rpx;
padding: 10rpx;
text-align: center; text-align: center;
} }
.buttons.data-v-1cf27b2a { .grid-item-content .room-info.data-v-1cf27b2a {
text-align: left;
padding: 20rpx 10rpx;
color: #666;
width: 100%;
min-height: 160rpx;
box-sizing: border-box;
}
.grid-item-content .room-info .room-id.data-v-1cf27b2a {
font-size: 24rpx;
}
.grid-item-content .room-info .remark.data-v-1cf27b2a {
font-size: 24rpx;
display: -webkit-box;
/* 使元素成为伸缩容器 */
-webkit-box-orient: vertical;
/* 设置伸缩方向为纵向 */
overflow: hidden;
/* 隐藏超出的内容 */
-webkit-line-clamp: 2;
/* 限制显示2行 */
line-height: 36rpx;
word-wrap: break-word;
/* 强制长单词或长数字换行 */
word-break: break-word;
/* 强制长单词或长数字换行 */
white-space: normal;
/* 确保文本正常换行 */
/* 设置行高 */
}
.grid-item-content .room-buttons.data-v-1cf27b2a {
padding: 20rpx 10rpx;
display: flex; display: flex;
gap: 16rpx; gap: 20rpx;
justify-content: space-around;
width: 100%;
box-sizing: border-box;
}
.title.data-v-1cf27b2a {
padding: 0 20rpx;
margin-top: 20rpx;
margin-bottom: 20rpx;
font-size: 28rpx;
font-weight: 400;
text-align: center;
} }

View File

@@ -24,6 +24,12 @@ if (!Math) {
const _sfc_main = { const _sfc_main = {
__name: "orderAdd", __name: "orderAdd",
setup(__props) { setup(__props) {
common_vendor.onLoad((options) => {
common_vendor.index.__f__("log", "at pages/index/orderAdd.vue:233", "onLoad");
form.room_id = options.roomId;
common_vendor.index.__f__("log", "at pages/index/orderAdd.vue:236", form);
common_vendor.index.__f__("log", "at pages/index/orderAdd.vue:237", options);
});
const visibleFeeTypePopup = common_vendor.ref(false); const visibleFeeTypePopup = common_vendor.ref(false);
const feeTypes = [ const feeTypes = [
{ {
@@ -40,33 +46,32 @@ const _sfc_main = {
} }
]; ];
const onConfirmFeeType = (selectedValue) => { const onConfirmFeeType = (selectedValue) => {
common_vendor.index.__f__("log", "at pages/index/orderAdd.vue:276", selectedValue); common_vendor.index.__f__("log", "at pages/index/orderAdd.vue:292", selectedValue);
form.fee_type_name = selectedValue.selectedOptions[0].label; form.fee_type_name = selectedValue.selectedOptions[0].label;
form.fee_type = selectedValue.selectedOptions[0].value; form.fee_type = selectedValue.selectedOptions[0].value;
common_vendor.index.__f__("log", "at pages/index/orderAdd.vue:279", form); common_vendor.index.__f__("log", "at pages/index/orderAdd.vue:295", form);
if (form.fee_type !== 3) {
getCombos();
}
visibleFeeTypePopup.value = false; visibleFeeTypePopup.value = false;
}; };
const getCombos = () => {
common_vendor.index.__f__("log", "at pages/index/orderAdd.vue:304", "获取套餐");
api_index.fetchCombos({
type: form.fee_type
}).then((res) => {
common_vendor.index.__f__("log", "at pages/index/orderAdd.vue:308", res);
combos.value = res;
});
};
const visibleCombosPopup = common_vendor.ref(false); const visibleCombosPopup = common_vendor.ref(false);
const popupCombosVal = common_vendor.ref([]); const popupCombosVal = common_vendor.ref([]);
const combos = [ const combos = common_vendor.ref([]);
{
value: 1,
label: "美团中包套餐"
},
{
value: 2,
label: "美团小包套餐"
},
{
value: 3,
label: "美团小包套餐"
}
];
const onConfirmCombos = (selectedValue) => { const onConfirmCombos = (selectedValue) => {
common_vendor.index.__f__("log", "at pages/index/orderAdd.vue:305", selectedValue); common_vendor.index.__f__("log", "at pages/index/orderAdd.vue:323", selectedValue);
form.fee_combo_name = selectedValue.selectedOptions[0].label; form.fee_combo_name = selectedValue.selectedOptions[0].label;
form.fee_combo_id = selectedValue.selectedOptions[0].value; form.fee_combo_id = selectedValue.selectedOptions[0].value;
common_vendor.index.__f__("log", "at pages/index/orderAdd.vue:308", form); common_vendor.index.__f__("log", "at pages/index/orderAdd.vue:326", form);
visibleCombosPopup.value = false; visibleCombosPopup.value = false;
}; };
const visiblePaymentStatusPopup = common_vendor.ref(false); const visiblePaymentStatusPopup = common_vendor.ref(false);
@@ -90,23 +95,23 @@ const _sfc_main = {
popupPaymentTypeVal.value = type; popupPaymentTypeVal.value = type;
goodsPayIndex.value = index; goodsPayIndex.value = index;
visiblePaymentStatusPopup.value = true; visiblePaymentStatusPopup.value = true;
common_vendor.index.__f__("log", "at pages/index/orderAdd.vue:338", type); common_vendor.index.__f__("log", "at pages/index/orderAdd.vue:354", type);
}; };
const onConfirmPaymentStatus = (selectedValue) => { const onConfirmPaymentStatus = (selectedValue) => {
if (popupPaymentTypeVal.value == "fee") { if (popupPaymentTypeVal.value == "fee") {
form.fee_pay_status_txt = selectedValue.selectedOptions[0].label; form.fee_pay_status_txt = selectedValue.selectedOptions[0].label;
form.payment_status = selectedValue.selectedOptions[0].value; form.fee_pay_status = selectedValue.selectedOptions[0].value;
} }
if (popupPaymentTypeVal.value == "over") { if (popupPaymentTypeVal.value == "over") {
form.over_pay_status_txt = selectedValue.selectedOptions[0].label; form.over_pay_status_txt = selectedValue.selectedOptions[0].label;
form.over_pay_status = selectedValue.selectedOptions[0].value; form.over_pay_status = selectedValue.selectedOptions[0].value;
} }
if (popupPaymentTypeVal.value == "goods" && goodsPayIndex.value >= 0) { if (popupPaymentTypeVal.value == "goods" && goodsPayIndex.value >= 0) {
common_vendor.index.__f__("log", "at pages/index/orderAdd.vue:352", "处理商品支付状态", goodsPayIndex.value); common_vendor.index.__f__("log", "at pages/index/orderAdd.vue:368", "处理商品支付状态", goodsPayIndex.value);
orderGoods.value[goodsPayIndex.value].goods_pay_status_txt = selectedValue.selectedOptions[0].label; orderGoods.value[goodsPayIndex.value].goods_pay_status_txt = selectedValue.selectedOptions[0].label;
orderGoods.value[goodsPayIndex.value].goods_pay_status = selectedValue.selectedOptions[0].value; orderGoods.value[goodsPayIndex.value].goods_pay_status = selectedValue.selectedOptions[0].value;
} }
common_vendor.index.__f__("log", "at pages/index/orderAdd.vue:357", form); common_vendor.index.__f__("log", "at pages/index/orderAdd.vue:372", form);
visiblePaymentStatusPopup.value = false; visiblePaymentStatusPopup.value = false;
popupPaymentTypeVal.value = ""; popupPaymentTypeVal.value = "";
goodsPayIndex.value = -1; goodsPayIndex.value = -1;
@@ -126,7 +131,7 @@ const _sfc_main = {
const goodsPayIndex = common_vendor.ref(0); const goodsPayIndex = common_vendor.ref(0);
const goodsIndex = common_vendor.ref(0); const goodsIndex = common_vendor.ref(0);
const addGoods = () => { const addGoods = () => {
common_vendor.index.__f__("log", "at pages/index/orderAdd.vue:384", orderGoods.value); common_vendor.index.__f__("log", "at pages/index/orderAdd.vue:399", orderGoods.value);
orderGoods.value.push({ orderGoods.value.push({
goods_type_name: null, goods_type_name: null,
goods_type_id: null, goods_type_id: null,
@@ -152,12 +157,12 @@ const _sfc_main = {
} }
}); });
const onGoodsChange = (...args) => { const onGoodsChange = (...args) => {
common_vendor.index.__f__("log", "at pages/index/orderAdd.vue:412", "onGoodsChange", args); common_vendor.index.__f__("log", "at pages/index/orderAdd.vue:427", "onGoodsChange", args);
}; };
const onGoodsPathChange = (args) => { const onGoodsPathChange = (args) => {
common_vendor.index.__f__("log", "at pages/index/orderAdd.vue:416", "onGoodsPathChange", args); common_vendor.index.__f__("log", "at pages/index/orderAdd.vue:431", "onGoodsPathChange", args);
common_vendor.index.__f__("log", "at pages/index/orderAdd.vue:417", "goodsIndex", goodsIndex.value); common_vendor.index.__f__("log", "at pages/index/orderAdd.vue:432", "goodsIndex", goodsIndex.value);
common_vendor.index.__f__("log", "at pages/index/orderAdd.vue:418", "orderGoods.value[goodsIndex.value]", orderGoods.value[goodsIndex.value]); common_vendor.index.__f__("log", "at pages/index/orderAdd.vue:433", "orderGoods.value[goodsIndex.value]", orderGoods.value[goodsIndex.value]);
orderGoods.value[goodsIndex.value].goods_type_name = null; orderGoods.value[goodsIndex.value].goods_type_name = null;
orderGoods.value[goodsIndex.value].goods_type_id = null; orderGoods.value[goodsIndex.value].goods_type_id = null;
orderGoods.value[goodsIndex.value].goods_name = null; orderGoods.value[goodsIndex.value].goods_name = null;
@@ -172,11 +177,11 @@ const _sfc_main = {
orderGoods.value[goodsIndex.value].goods_id = args[1].value; orderGoods.value[goodsIndex.value].goods_id = args[1].value;
orderGoods.value[goodsIndex.value].goods_price = args[1].goods_price; orderGoods.value[goodsIndex.value].goods_price = args[1].goods_price;
} }
common_vendor.index.__f__("log", "at pages/index/orderAdd.vue:434", "orderGoods.value[goodsIndex.value]", orderGoods.value[goodsIndex.value]); common_vendor.index.__f__("log", "at pages/index/orderAdd.vue:449", "orderGoods.value[goodsIndex.value]", orderGoods.value[goodsIndex.value]);
}; };
const onCloseGoodsCascader = () => { const onCloseGoodsCascader = () => {
common_vendor.index.__f__("log", "at pages/index/orderAdd.vue:437", "onCloseGoodsCascader"); common_vendor.index.__f__("log", "at pages/index/orderAdd.vue:452", "onCloseGoodsCascader");
common_vendor.index.__f__("log", "at pages/index/orderAdd.vue:438", "goodsIndex.value", goodsIndex.value); common_vendor.index.__f__("log", "at pages/index/orderAdd.vue:453", "goodsIndex.value", goodsIndex.value);
if (orderGoods.value[goodsIndex.value].goods_type_id && orderGoods.value[goodsIndex.value].goods_id) { if (orderGoods.value[goodsIndex.value].goods_type_id && orderGoods.value[goodsIndex.value].goods_id) {
orderGoods.value[goodsIndex.value].cascader_val = [ orderGoods.value[goodsIndex.value].cascader_val = [
orderGoods.value[goodsIndex.value].goods_type_id, orderGoods.value[goodsIndex.value].goods_type_id,
@@ -184,17 +189,18 @@ const _sfc_main = {
]; ];
} }
goodsIndex.value = 0; goodsIndex.value = 0;
common_vendor.index.__f__("log", "at pages/index/orderAdd.vue:446", "goodsIndex.value", goodsIndex.value); common_vendor.index.__f__("log", "at pages/index/orderAdd.vue:461", "goodsIndex.value", goodsIndex.value);
}; };
const onOpenGoodsCascader = () => { const onOpenGoodsCascader = () => {
common_vendor.index.__f__("log", "at pages/index/orderAdd.vue:449", "onOpenGoodsCascader"); common_vendor.index.__f__("log", "at pages/index/orderAdd.vue:464", "onOpenGoodsCascader");
common_vendor.index.__f__("log", "at pages/index/orderAdd.vue:450", "goodsIndex.value", goodsIndex.value); common_vendor.index.__f__("log", "at pages/index/orderAdd.vue:465", "goodsIndex.value", goodsIndex.value);
}; };
const form = common_vendor.reactive({ const form = common_vendor.reactive({
// room_id: 0, order_type: 1,
// room_name: '选择房间', // 开台订单
room_id: 0,
fee_type: 0, fee_type: 0,
fee_type_name: "选择方式", fee_type_name: "选择",
fee_combo_id: 0, fee_combo_id: 0,
// 套餐费用ID // 套餐费用ID
fee_combo_name: "请选择", fee_combo_name: "请选择",
@@ -223,7 +229,14 @@ const _sfc_main = {
}); });
}); });
const submitForm = () => { const submitForm = () => {
common_vendor.index.__f__("log", "at pages/index/orderAdd.vue:497", "提交的订单数据:", orderGoods.value); let data = {
order_goods: orderGoods.value,
order: form
};
common_vendor.index.__f__("log", "at pages/index/orderAdd.vue:516", "提交的订单数据:", data);
api_index.fetchAddOrder(data).then((res) => {
common_vendor.index.__f__("log", "at pages/index/orderAdd.vue:519", res);
});
}; };
return (_ctx, _cache) => { return (_ctx, _cache) => {
return common_vendor.e({ return common_vendor.e({
@@ -370,7 +383,7 @@ const _sfc_main = {
W: common_vendor.o(($event) => visibleCombosPopup.value = false), W: common_vendor.o(($event) => visibleCombosPopup.value = false),
X: common_vendor.o(($event) => popupCombosVal.value = $event), X: common_vendor.o(($event) => popupCombosVal.value = $event),
Y: common_vendor.p({ Y: common_vendor.p({
columns: combos, columns: combos.value,
["field-names"]: { ["field-names"]: {
text: "label", text: "label",
value: "value" value: "value"

View File

@@ -1,5 +1,5 @@
{ {
"navigationBarTitleText": "新增订单", "navigationBarTitleText": "开台",
"enablePullDownRefresh": false, "enablePullDownRefresh": false,
"usingComponents": { "usingComponents": {
"nut-form-item": "../../uni_modules/nutui-uni/components/formitem/formitem", "nut-form-item": "../../uni_modules/nutui-uni/components/formitem/formitem",

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,441 @@
"use strict";
const common_vendor = require("../../common/vendor.js");
const api_index = require("../../api/index.js");
if (!Array) {
const _easycom_nut_form_item2 = common_vendor.resolveComponent("nut-form-item");
const _easycom_nut_input2 = common_vendor.resolveComponent("nut-input");
const _easycom_nut_form2 = common_vendor.resolveComponent("nut-form");
const _easycom_nut_button2 = common_vendor.resolveComponent("nut-button");
const _easycom_nut_cascader2 = common_vendor.resolveComponent("nut-cascader");
const _easycom_nut_picker2 = common_vendor.resolveComponent("nut-picker");
const _easycom_nut_popup2 = common_vendor.resolveComponent("nut-popup");
(_easycom_nut_form_item2 + _easycom_nut_input2 + _easycom_nut_form2 + _easycom_nut_button2 + _easycom_nut_cascader2 + _easycom_nut_picker2 + _easycom_nut_popup2)();
}
const _easycom_nut_form_item = () => "../../uni_modules/nutui-uni/components/formitem/formitem.js";
const _easycom_nut_input = () => "../../uni_modules/nutui-uni/components/input/input.js";
const _easycom_nut_form = () => "../../uni_modules/nutui-uni/components/form/form.js";
const _easycom_nut_button = () => "../../uni_modules/nutui-uni/components/button/button.js";
const _easycom_nut_cascader = () => "../../uni_modules/nutui-uni/components/cascader/cascader.js";
const _easycom_nut_picker = () => "../../uni_modules/nutui-uni/components/picker/picker.js";
const _easycom_nut_popup = () => "../../uni_modules/nutui-uni/components/popup/popup.js";
if (!Math) {
(_easycom_nut_form_item + _easycom_nut_input + _easycom_nut_form + _easycom_nut_button + _easycom_nut_cascader + _easycom_nut_picker + _easycom_nut_popup)();
}
const _sfc_main = {
__name: "orderEdit",
setup(__props) {
common_vendor.onLoad((options) => {
common_vendor.index.__f__("log", "at pages/index/orderEdit.vue:225", "onLoad");
form.room_id = options.roomId;
getRoomOrder();
common_vendor.index.__f__("log", "at pages/index/orderEdit.vue:232", form);
common_vendor.index.__f__("log", "at pages/index/orderEdit.vue:233", options);
});
const getRoomOrder = () => {
api_index.fetchRoomOrder(form.room_id).then((res) => {
common_vendor.index.__f__("log", "at pages/index/orderEdit.vue:239", res);
form.room_id = res.room_id;
form.order_type = res.order_type;
form.fee_type = res.fee_type.value;
form.fee_type_name = res.fee_type.text;
form.fee_combo_id = res.fee_combo_id;
form.fee_combo_name = res.fee_combo_name;
form.fee_amount = res.fee_amount;
form.fee_pay_status = res.fee_pay_status.value;
form.fee_pay_status_txt = res.fee_pay_status.text;
form.over_often = res.over_often;
form.over_amount = res.over_amount;
form.over_pay_status = res.over_pay_status.value;
form.over_pay_status_txt = res.over_pay_status.text;
});
};
const visibleFeeTypePopup = common_vendor.ref(false);
const feeTypes = [
{
value: 1,
label: "美团"
},
{
value: 2,
label: "抖音"
},
{
value: 3,
label: "线下"
}
];
const onConfirmFeeType = (selectedValue) => {
common_vendor.index.__f__("log", "at pages/index/orderEdit.vue:343", selectedValue);
form.fee_type_name = selectedValue.selectedOptions[0].label;
form.fee_type = selectedValue.selectedOptions[0].value;
common_vendor.index.__f__("log", "at pages/index/orderEdit.vue:346", form);
if (form.fee_type !== 3) {
getCombos();
}
visibleFeeTypePopup.value = false;
};
const getCombos = () => {
common_vendor.index.__f__("log", "at pages/index/orderEdit.vue:355", "获取套餐");
api_index.fetchCombos({
type: form.fee_type
}).then((res) => {
common_vendor.index.__f__("log", "at pages/index/orderEdit.vue:359", res);
combos.value = res;
});
};
const visibleCombosPopup = common_vendor.ref(false);
const popupCombosVal = common_vendor.ref([]);
const combos = common_vendor.ref([]);
const onConfirmCombos = (selectedValue) => {
common_vendor.index.__f__("log", "at pages/index/orderEdit.vue:374", selectedValue);
form.fee_combo_name = selectedValue.selectedOptions[0].label;
form.fee_combo_id = selectedValue.selectedOptions[0].value;
common_vendor.index.__f__("log", "at pages/index/orderEdit.vue:377", form);
visibleCombosPopup.value = false;
};
const visiblePaymentStatusPopup = common_vendor.ref(false);
common_vendor.ref([]);
const popupPaymentTypeVal = common_vendor.ref("");
const paymentStatuses = [
{
value: 1,
label: "已付"
},
{
value: 2,
label: "未付"
},
{
value: 3,
label: "赠送"
}
];
const openPayStatusPopup = (type, index = -1) => {
popupPaymentTypeVal.value = type;
goodsPayIndex.value = index;
visiblePaymentStatusPopup.value = true;
common_vendor.index.__f__("log", "at pages/index/orderEdit.vue:405", type);
};
const onConfirmPaymentStatus = (selectedValue) => {
if (popupPaymentTypeVal.value == "fee") {
form.fee_pay_status_txt = selectedValue.selectedOptions[0].label;
form.fee_pay_status = selectedValue.selectedOptions[0].value;
}
if (popupPaymentTypeVal.value == "over") {
form.over_pay_status_txt = selectedValue.selectedOptions[0].label;
form.over_pay_status = selectedValue.selectedOptions[0].value;
}
if (popupPaymentTypeVal.value == "goods" && goodsPayIndex.value >= 0) {
common_vendor.index.__f__("log", "at pages/index/orderEdit.vue:419", "处理商品支付状态", goodsPayIndex.value);
orderGoods.value[goodsPayIndex.value].goods_pay_status_txt = selectedValue.selectedOptions[0].label;
orderGoods.value[goodsPayIndex.value].goods_pay_status = selectedValue.selectedOptions[0].value;
}
common_vendor.index.__f__("log", "at pages/index/orderEdit.vue:423", form);
visiblePaymentStatusPopup.value = false;
popupPaymentTypeVal.value = "";
goodsPayIndex.value = -1;
};
const orderGoods = common_vendor.ref([
// {
// goods_type_name: null,
// goods_type_id: null,
// goods_name: null,
// goods_id: null,
// goods_price: null,
// goods_pay_status: 0,
// goods_pay_status_txt: "请选择",
// cascader_val: []
// },
]);
const goodsPayIndex = common_vendor.ref(0);
const goodsIndex = common_vendor.ref(0);
const addGoods = () => {
common_vendor.index.__f__("log", "at pages/index/orderEdit.vue:450", orderGoods.value);
orderGoods.value.push({
goods_type_name: null,
goods_type_id: null,
goods_name: null,
goods_id: null,
goods_price: null,
goods_pay_status: 0,
goods_pay_status_txt: "请选择",
cascader_val: []
});
};
const removeGoods = (index) => {
orderGoods.value.splice(index, 1);
};
const visibleGoodsCascader = common_vendor.ref(false);
const cascaderGoodsValue = common_vendor.computed(() => {
var _a;
let cascader_val = [];
if (goodsIndex.value >= 0) {
return ((_a = orderGoods.value[goodsIndex.value]) == null ? void 0 : _a.cascader_val) ?? [];
} else {
return cascader_val;
}
});
const onGoodsChange = (...args) => {
common_vendor.index.__f__("log", "at pages/index/orderEdit.vue:478", "onGoodsChange", args);
};
const onGoodsPathChange = (args) => {
common_vendor.index.__f__("log", "at pages/index/orderEdit.vue:482", "onGoodsPathChange", args);
common_vendor.index.__f__("log", "at pages/index/orderEdit.vue:483", "goodsIndex", goodsIndex.value);
common_vendor.index.__f__("log", "at pages/index/orderEdit.vue:484", "orderGoods.value[goodsIndex.value]", orderGoods.value[goodsIndex.value]);
orderGoods.value[goodsIndex.value].goods_type_name = null;
orderGoods.value[goodsIndex.value].goods_type_id = null;
orderGoods.value[goodsIndex.value].goods_name = null;
orderGoods.value[goodsIndex.value].goods_id = null;
orderGoods.value[goodsIndex.value].goods_price = null;
if (args.length >= 1 && args[0] !== null) {
orderGoods.value[goodsIndex.value].goods_type_name = args[0].text;
orderGoods.value[goodsIndex.value].goods_type_id = args[0].value;
}
if (args.length >= 2 && args[1] !== null) {
orderGoods.value[goodsIndex.value].goods_name = args[1].text;
orderGoods.value[goodsIndex.value].goods_id = args[1].value;
orderGoods.value[goodsIndex.value].goods_price = args[1].goods_price;
}
common_vendor.index.__f__("log", "at pages/index/orderEdit.vue:500", "orderGoods.value[goodsIndex.value]", orderGoods.value[goodsIndex.value]);
};
const onCloseGoodsCascader = () => {
common_vendor.index.__f__("log", "at pages/index/orderEdit.vue:503", "onCloseGoodsCascader");
common_vendor.index.__f__("log", "at pages/index/orderEdit.vue:504", "goodsIndex.value", goodsIndex.value);
if (orderGoods.value[goodsIndex.value].goods_type_id && orderGoods.value[goodsIndex.value].goods_id) {
orderGoods.value[goodsIndex.value].cascader_val = [
orderGoods.value[goodsIndex.value].goods_type_id,
orderGoods.value[goodsIndex.value].goods_id
];
}
goodsIndex.value = 0;
common_vendor.index.__f__("log", "at pages/index/orderEdit.vue:512", "goodsIndex.value", goodsIndex.value);
};
const onOpenGoodsCascader = () => {
common_vendor.index.__f__("log", "at pages/index/orderEdit.vue:515", "onOpenGoodsCascader");
common_vendor.index.__f__("log", "at pages/index/orderEdit.vue:516", "goodsIndex.value", goodsIndex.value);
};
const form = common_vendor.reactive({
order_type: 1,
// 开台订单
room_id: 0,
fee_type: 0,
fee_type_name: "请选择",
fee_combo_id: 0,
// 套餐费用ID
fee_combo_name: "请选择",
// 套餐费用名称
fee_amount: null,
// 线下支付费用
fee_pay_status: 0,
// 费用支付状态
fee_pay_status_txt: "请选择",
// 费用支付状态
over_often: null,
// 超时小时
over_amount: null,
// 超时金额
over_pay_status: 0,
// 超时支付状态
over_pay_status_txt: "请选择",
// 超时支付状态
discount_amount: null
// 优惠金额
});
const selectGoods = common_vendor.ref([]);
common_vendor.onMounted(() => {
api_index.fetchGoods().then((res) => {
selectGoods.value = res;
});
});
const submitForm = () => {
let data = {
order_goods: orderGoods.value,
order: form
};
common_vendor.index.__f__("log", "at pages/index/orderEdit.vue:567", "提交的订单数据:", data);
api_index.fetchAddOrder(data).then((res) => {
common_vendor.index.__f__("log", "at pages/index/orderEdit.vue:570", res);
});
};
return (_ctx, _cache) => {
return common_vendor.e({
a: common_vendor.t(form.fee_type_name),
b: common_vendor.o(($event) => visibleFeeTypePopup.value = true),
c: common_vendor.p({
["label-position"]: "top"
}),
d: form.fee_type === 1 || form.fee_type === 2
}, form.fee_type === 1 || form.fee_type === 2 ? {
e: common_vendor.t(form.fee_combo_name),
f: common_vendor.o(($event) => visibleCombosPopup.value = true),
g: common_vendor.p({
["label-position"]: "top"
})
} : {
h: common_vendor.o(($event) => form.fee_amount = $event),
i: common_vendor.p({
placeholder: "请输入金额",
type: "number",
modelValue: form.fee_amount
}),
j: common_vendor.p({
["label-position"]: "top"
})
}, {
k: common_vendor.t(form.fee_pay_status_txt),
l: common_vendor.o(($event) => openPayStatusPopup("fee")),
m: common_vendor.p({
["label-position"]: "top"
}),
n: common_vendor.o(($event) => form.over_often = $event),
o: common_vendor.p({
placeholder: "请输入小时",
type: "number",
modelValue: form.over_often
}),
p: common_vendor.p({
["label-position"]: "top"
}),
q: common_vendor.o(($event) => form.over_amount = $event),
r: common_vendor.p({
placeholder: "请输入金额",
type: "number",
modelValue: form.over_amount
}),
s: common_vendor.p({
["label-position"]: "top"
}),
t: common_vendor.t(form.over_pay_status_txt),
v: common_vendor.o(($event) => openPayStatusPopup("over")),
w: common_vendor.p({
["label-position"]: "top"
}),
x: common_vendor.o(addGoods),
y: common_vendor.p({
type: "primary",
plain: true,
size: "small"
}),
z: common_vendor.f(orderGoods.value, (item, index, i0) => {
return common_vendor.e({
a: item.goods_type_name && item.goods_name
}, item.goods_type_name && item.goods_name ? {
b: common_vendor.t(item.goods_type_name),
c: common_vendor.t(item.goods_name)
} : {}, {
d: common_vendor.o(($event) => {
visibleGoodsCascader.value = true;
goodsIndex.value = index;
}, index),
e: "7c6285d6-14-" + i0 + ",7c6285d6-13",
f: common_vendor.t(item.goods_price),
g: "7c6285d6-15-" + i0 + ",7c6285d6-13",
h: common_vendor.t(item.goods_pay_status_txt),
i: common_vendor.o(($event) => openPayStatusPopup("goods", index), index),
j: "7c6285d6-16-" + i0 + ",7c6285d6-13",
k: common_vendor.o(($event) => removeGoods(index), index),
l: "7c6285d6-18-" + i0 + "," + ("7c6285d6-17-" + i0),
m: "7c6285d6-17-" + i0 + ",7c6285d6-13",
n: index
});
}),
A: common_vendor.p({
["label-position"]: "top"
}),
B: common_vendor.p({
["label-position"]: "top"
}),
C: common_vendor.p({
["label-position"]: "top"
}),
D: common_vendor.p({
type: "danger",
size: "mini"
}),
E: common_vendor.p({
["label-position"]: "top"
}),
F: common_vendor.o(($event) => form.discount_amount = $event),
G: common_vendor.p({
placeholder: "请输入金额",
type: "number",
modelValue: form.discount_amount
}),
H: common_vendor.o(submitForm),
I: common_vendor.p({
type: "primary",
block: true
}),
J: common_vendor.o(onGoodsChange),
K: common_vendor.o(onGoodsPathChange),
L: common_vendor.o(onOpenGoodsCascader),
M: common_vendor.o(onCloseGoodsCascader),
N: common_vendor.o(($event) => visibleGoodsCascader.value = $event),
O: common_vendor.o(($event) => cascaderGoodsValue.value = $event),
P: common_vendor.p({
title: "商品选择",
["text-key"]: "label",
["value-key"]: "value",
["children-key"]: "children",
options: selectGoods.value,
["title-ellipsis"]: false,
visible: visibleGoodsCascader.value,
modelValue: cascaderGoodsValue.value
}),
Q: common_vendor.o(onConfirmPaymentStatus),
R: common_vendor.o(($event) => visiblePaymentStatusPopup.value = false),
S: common_vendor.p({
columns: paymentStatuses,
["field-names"]: {
text: "label",
value: "value"
},
title: "选择支付状态"
}),
T: common_vendor.o(($event) => visiblePaymentStatusPopup.value = $event),
U: common_vendor.p({
position: "bottom",
["safe-area-inset-bottom"]: true,
visible: visiblePaymentStatusPopup.value
}),
V: common_vendor.o(onConfirmCombos),
W: common_vendor.o(($event) => visibleCombosPopup.value = false),
X: common_vendor.o(($event) => popupCombosVal.value = $event),
Y: common_vendor.p({
columns: combos.value,
["field-names"]: {
text: "label",
value: "value"
},
title: "选择团购套餐",
modelValue: popupCombosVal.value
}),
Z: common_vendor.o(($event) => visibleCombosPopup.value = $event),
aa: common_vendor.p({
position: "bottom",
["safe-area-inset-bottom"]: true,
visible: visibleCombosPopup.value
}),
ab: common_vendor.o(onConfirmFeeType),
ac: common_vendor.o(($event) => visibleFeeTypePopup.value = false),
ad: common_vendor.p({
columns: feeTypes,
["field-names"]: {
text: "label",
value: "value"
},
title: "选择结算方式"
}),
ae: common_vendor.o(($event) => visibleFeeTypePopup.value = $event),
af: common_vendor.p({
position: "bottom",
["safe-area-inset-bottom"]: true,
visible: visibleFeeTypePopup.value
})
});
};
}
};
const MiniProgramPage = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["__scopeId", "data-v-7c6285d6"]]);
wx.createPage(MiniProgramPage);
//# sourceMappingURL=../../../.sourcemap/mp-weixin/pages/index/orderEdit.js.map

View File

@@ -0,0 +1,13 @@
{
"navigationBarTitleText": "账单",
"enablePullDownRefresh": false,
"usingComponents": {
"nut-form-item": "../../uni_modules/nutui-uni/components/formitem/formitem",
"nut-input": "../../uni_modules/nutui-uni/components/input/input",
"nut-form": "../../uni_modules/nutui-uni/components/form/form",
"nut-button": "../../uni_modules/nutui-uni/components/button/button",
"nut-cascader": "../../uni_modules/nutui-uni/components/cascader/cascader",
"nut-picker": "../../uni_modules/nutui-uni/components/picker/picker",
"nut-popup": "../../uni_modules/nutui-uni/components/popup/popup"
}
}

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,84 @@
/**
* 这里是uni-app内置的常用样式变量
*
* uni-app 官方扩展插件及插件市场https://ext.dcloud.net.cn上很多三方插件均使用了这些样式变量
* 如果你是插件开发者建议你使用scss预处理并在插件代码中直接使用这些变量无需 import 这个文件方便用户通过搭积木的方式开发整体风格一致的App
*
*/
/**
* 如果你是App开发者插件使用者你可以通过修改这些变量来定制自己的插件主题实现自定义主题功能
*
* 如果你的项目同样使用了scss预处理你也可以直接在你的 scss 代码中使用如下变量,同时无需 import 这个文件
*/
/* 颜色变量 */
/* 行为相关颜色 */
/* 文字基本颜色 */
/* 背景颜色 */
/* 边框颜色 */
/* 尺寸变量 */
/* 文字尺寸 */
/* 图片尺寸 */
/* Border Radius */
/* 水平间距 */
/* 垂直间距 */
/* 透明度 */
/* 文章场景相关 */
/**
* 这里是uni-app内置的常用样式变量
*
* uni-app 官方扩展插件及插件市场https://ext.dcloud.net.cn上很多三方插件均使用了这些样式变量
* 如果你是插件开发者建议你使用scss预处理并在插件代码中直接使用这些变量无需 import 这个文件方便用户通过搭积木的方式开发整体风格一致的App
*
*/
/**
* 如果你是App开发者插件使用者你可以通过修改这些变量来定制自己的插件主题实现自定义主题功能
*
* 如果你的项目同样使用了scss预处理你也可以直接在你的 scss 代码中使用如下变量,同时无需 import 这个文件
*/
/* 颜色变量 */
/* 行为相关颜色 */
/* 文字基本颜色 */
/* 背景颜色 */
/* 边框颜色 */
/* 尺寸变量 */
/* 文字尺寸 */
/* 图片尺寸 */
/* Border Radius */
/* 水平间距 */
/* 垂直间距 */
/* 透明度 */
/* 文章场景相关 */
.page-content.data-v-7c6285d6 {
min-height: 100vh;
background-color: #f2f3f5;
}
.title.data-v-7c6285d6 {
padding: 0 20rpx;
margin-top: 20rpx;
margin-bottom: 20rpx;
font-size: 28rpx;
color: #909ca4;
}
.inline-form.data-v-7c6285d6 {
display: flex;
justify-content: space-between;
gap: 10rpx;
/* 在元素之间添加间距 */
}
.top-bar.data-v-7c6285d6 {
background: #fff;
padding: 20rpx;
display: flex;
justify-content: space-between;
border-top: 1px solid #eee;
}
/* 每个商品项容器 */
/* 行容器 */
.form-row.data-v-7c6285d6 {
display: flex;
justify-content: space-between;
align-items: flex-start;
gap: 20rpx;
margin-bottom: 20rpx;
}