Files
cmgd-mini-app/unpackage/dist/dev/mp-weixin/pages/index/orderAdd.js
2026-01-27 19:40:07 +08:00

498 lines
21 KiB
JavaScript

"use strict";
const common_vendor = require("../../common/vendor.js");
const api_index = require("../../api/index.js");
if (!Array) {
const _easycom_nut_radio2 = common_vendor.resolveComponent("nut-radio");
const _easycom_nut_radio_group2 = common_vendor.resolveComponent("nut-radio-group");
const _easycom_nut_form_item2 = common_vendor.resolveComponent("nut-form-item");
const _easycom_nut_form2 = common_vendor.resolveComponent("nut-form");
const _easycom_nut_button2 = common_vendor.resolveComponent("nut-button");
const _easycom_nut_input2 = common_vendor.resolveComponent("nut-input");
const _easycom_nut_textarea2 = common_vendor.resolveComponent("nut-textarea");
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_radio2 + _easycom_nut_radio_group2 + _easycom_nut_form_item2 + _easycom_nut_form2 + _easycom_nut_button2 + _easycom_nut_input2 + _easycom_nut_textarea2 + _easycom_nut_cascader2 + _easycom_nut_picker2 + _easycom_nut_popup2)();
}
const _easycom_nut_radio = () => "../../uni_modules/nutui-uni/components/radio/radio.js";
const _easycom_nut_radio_group = () => "../../uni_modules/nutui-uni/components/radiogroup/radiogroup.js";
const _easycom_nut_form_item = () => "../../uni_modules/nutui-uni/components/formitem/formitem.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_input = () => "../../uni_modules/nutui-uni/components/input/input.js";
const _easycom_nut_textarea = () => "../../uni_modules/nutui-uni/components/textarea/textarea.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_radio + _easycom_nut_radio_group + _easycom_nut_form_item + _easycom_nut_form + _easycom_nut_button + _easycom_nut_input + _easycom_nut_textarea + _easycom_nut_cascader + _easycom_nut_picker + _easycom_nut_popup)();
}
const _sfc_main = {
__name: "orderAdd",
setup(__props) {
common_vendor.onLoad((options) => {
common_vendor.index.__f__("log", "at pages/index/orderAdd.vue:253", "onLoad - options", options);
form.room_id = options.roomId;
common_vendor.index.__f__("log", "at pages/index/orderAdd.vue:255", "onLoad - form", form);
});
const selectGoods = common_vendor.ref([]);
const selectCombos = common_vendor.ref([]);
common_vendor.onMounted(() => {
api_index.fetchGoods().then((res) => {
selectGoods.value = res;
});
api_index.fetchCombos().then((res) => {
selectCombos.value = res;
});
});
const visiblePaymentStatusPopup = common_vendor.ref(false);
const popupPaymentTypeVal = common_vendor.ref("");
const paymentStatuses = [
{
value: 1,
label: "已付"
},
{
value: 2,
label: "未付"
},
{
value: 3,
label: "赠送"
}
];
const openPayStatusPopup = (type, index = -1) => {
popupPaymentTypeVal.value = type;
if (type === "combos") {
combosPayIndex.value = index;
} else if (type === "goods") {
goodsPayIndex.value = index;
} else
;
visiblePaymentStatusPopup.value = true;
common_vendor.index.__f__("log", "at pages/index/orderAdd.vue:303", type);
};
const onConfirmPaymentStatus = (selectedValue) => {
let label = selectedValue.selectedOptions[0].label;
let value = selectedValue.selectedOptions[0].value;
if (popupPaymentTypeVal.value == "fee") {
form.fee_pay_status_txt = label;
form.fee_pay_status = value;
}
if (popupPaymentTypeVal.value == "over") {
form.over_pay_status_txt = label;
form.over_pay_status = value;
}
if (popupPaymentTypeVal.value == "combos" && combosPayIndex.value >= 0) {
common_vendor.index.__f__("log", "at pages/index/orderAdd.vue:325", "处理套餐支付状态", combosPayIndex.value);
orderCombos.value[combosPayIndex.value].combo_pay_status_txt = label;
orderCombos.value[combosPayIndex.value].combo_pay_status = value;
}
if (popupPaymentTypeVal.value == "goods" && goodsPayIndex.value >= 0) {
common_vendor.index.__f__("log", "at pages/index/orderAdd.vue:331", "处理商品支付状态", goodsPayIndex.value);
orderGoods.value[goodsPayIndex.value].goods_pay_status_txt = label;
orderGoods.value[goodsPayIndex.value].goods_pay_status = value;
}
common_vendor.index.__f__("log", "at pages/index/orderAdd.vue:335", form);
visiblePaymentStatusPopup.value = false;
popupPaymentTypeVal.value = "";
goodsPayIndex.value = -1;
combosPayIndex.value = -1;
};
const orderCombos = common_vendor.ref([]);
const combosPayIndex = common_vendor.ref(-1);
const combosIndex = common_vendor.ref(-1);
const visibleCombosCascader = common_vendor.ref(false);
const addCombos = () => {
common_vendor.index.__f__("log", "at pages/index/orderAdd.vue:350", orderCombos.value);
orderCombos.value.push({
combo_type_name: null,
combo_type_id: null,
combo_id: null,
combo_name: null,
combo_price: null,
combo_pay_status: 0,
combo_pay_status_txt: "请选择",
cascader_val: []
});
};
const removeCombos = (index) => {
orderCombos.value.splice(index, 1);
};
const cascaderCombosValue = common_vendor.computed(() => {
var _a;
let cascader_val = [];
if (combosIndex.value >= 0) {
return ((_a = orderCombos.value[combosIndex.value]) == null ? void 0 : _a.cascader_val) ?? [];
} else {
return cascader_val;
}
});
const onCombosPathChange = (args) => {
common_vendor.index.__f__("log", "at pages/index/orderAdd.vue:378", "onCombosPathChange", args);
common_vendor.index.__f__("log", "at pages/index/orderAdd.vue:379", "combosIndex", combosIndex.value);
common_vendor.index.__f__("log", "at pages/index/orderAdd.vue:380", "orderCombos.value[combosIndex.value]", orderCombos.value[combosIndex.value]);
orderCombos.value[combosIndex.value].combo_type_name = null;
orderCombos.value[combosIndex.value].combo_type_id = null;
orderCombos.value[combosIndex.value].combo_id = null;
orderCombos.value[combosIndex.value].combo_name = null;
orderCombos.value[combosIndex.value].combo_price = null;
if (args.length >= 1 && args[0] !== null) {
orderCombos.value[combosIndex.value].combo_type_name = args[0].text;
orderCombos.value[combosIndex.value].combo_type_id = args[0].value;
}
if (args.length >= 2 && args[1] !== null) {
orderCombos.value[combosIndex.value].combo_name = args[1].text;
orderCombos.value[combosIndex.value].combo_id = args[1].value;
orderCombos.value[combosIndex.value].combo_price = args[1].combo_price;
}
common_vendor.index.__f__("log", "at pages/index/orderAdd.vue:395", "orderCombos.value[combosIndex.value]", orderCombos.value[combosIndex.value]);
};
const onOpenCombosCascader = () => {
common_vendor.index.__f__("log", "at pages/index/orderAdd.vue:402", "onOpenCombosCascader");
common_vendor.index.__f__("log", "at pages/index/orderAdd.vue:403", "combosIndex.value", combosIndex.value);
};
const onCloseCombosCascader = () => {
common_vendor.index.__f__("log", "at pages/index/orderAdd.vue:407", "onCloseCombosCascader");
common_vendor.index.__f__("log", "at pages/index/orderAdd.vue:408", "combosIndex.value", combosIndex.value);
if (orderCombos.value[combosIndex.value].combo_type_id && orderCombos.value[combosIndex.value].combo_id) {
orderCombos.value[combosIndex.value].cascader_val = [
orderCombos.value[combosIndex.value].combo_type_id,
orderCombos.value[combosIndex.value].combo_id
];
}
combosIndex.value = -1;
common_vendor.index.__f__("log", "at pages/index/orderAdd.vue:416", "combosIndex.value", combosIndex.value);
};
const onCombosChange = (...args) => {
common_vendor.index.__f__("log", "at pages/index/orderAdd.vue:420", "onCombosChange", args);
};
const orderGoods = common_vendor.ref([]);
const goodsPayIndex = common_vendor.ref(-1);
const goodsIndex = common_vendor.ref(-1);
const visibleGoodsCascader = common_vendor.ref(false);
const addGoods = () => {
common_vendor.index.__f__("log", "at pages/index/orderAdd.vue:434", 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 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/orderAdd.vue:460", "onGoodsChange", args);
};
const onGoodsPathChange = (args) => {
common_vendor.index.__f__("log", "at pages/index/orderAdd.vue:464", "onGoodsPathChange", args);
common_vendor.index.__f__("log", "at pages/index/orderAdd.vue:465", "goodsIndex", goodsIndex.value);
common_vendor.index.__f__("log", "at pages/index/orderAdd.vue:466", "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/orderAdd.vue:482", "orderGoods.value[goodsIndex.value]", orderGoods.value[goodsIndex.value]);
};
const onCloseGoodsCascader = () => {
common_vendor.index.__f__("log", "at pages/index/orderAdd.vue:485", "onCloseGoodsCascader");
common_vendor.index.__f__("log", "at pages/index/orderAdd.vue:486", "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 = -1;
common_vendor.index.__f__("log", "at pages/index/orderAdd.vue:494", "goodsIndex.value", goodsIndex.value);
};
const onOpenGoodsCascader = () => {
common_vendor.index.__f__("log", "at pages/index/orderAdd.vue:497", "onOpenGoodsCascader");
common_vendor.index.__f__("log", "at pages/index/orderAdd.vue:498", "goodsIndex.value", goodsIndex.value);
};
const form = common_vendor.reactive({
order_type: 1,
// 开台订单
room_id: 0,
// 房间ID
fee_type: "1",
// 默认是团购
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,
// 优惠金额
remarks: null
});
const submitForm = () => {
let data = {
order_goods: orderGoods.value,
order_combos: orderCombos.value,
order: form
};
common_vendor.index.__f__("log", "at pages/index/orderAdd.vue:533", "提交的订单数据:", data);
};
return (_ctx, _cache) => {
return common_vendor.e({
a: common_vendor.p({
label: "1"
}),
b: common_vendor.p({
label: "2"
}),
c: common_vendor.o(($event) => form.fee_type = $event),
d: common_vendor.p({
direction: "horizontal",
modelValue: form.fee_type
}),
e: common_vendor.p({
label: "结算方式"
}),
f: form.fee_type == 1
}, form.fee_type == 1 ? {
g: common_vendor.f(orderCombos.value, (item, index, i0) => {
return common_vendor.e({
a: item.combo_type_name && item.combo_name
}, item.combo_type_name && item.combo_name ? {
b: common_vendor.t(item.combo_type_name),
c: common_vendor.t(item.combo_name)
} : {}, {
d: common_vendor.o(($event) => {
visibleCombosCascader.value = true;
combosIndex.value = index;
}, index),
e: "528154d3-6-" + i0 + ",528154d3-5",
f: common_vendor.t(item.combo_price),
g: "528154d3-7-" + i0 + ",528154d3-5",
h: common_vendor.t(item.combo_pay_status_txt),
i: common_vendor.o(($event) => openPayStatusPopup("combos", index), index),
j: "528154d3-8-" + i0 + ",528154d3-5",
k: common_vendor.o(($event) => removeCombos(index), index),
l: "528154d3-10-" + i0 + "," + ("528154d3-9-" + i0),
m: "528154d3-9-" + i0 + ",528154d3-5",
n: index
});
}),
h: common_vendor.p({
["label-position"]: "top"
}),
i: common_vendor.p({
["label-position"]: "top"
}),
j: common_vendor.p({
["label-position"]: "top"
}),
k: common_vendor.p({
type: "danger",
size: "mini"
}),
l: common_vendor.p({
["label-position"]: "top"
}),
m: common_vendor.o(addCombos),
n: common_vendor.p({
type: "primary",
plain: true,
size: "small"
})
} : {
o: common_vendor.o(($event) => form.fee_amount = $event),
p: common_vendor.p({
placeholder: "请输入金额",
type: "number",
modelValue: form.fee_amount
}),
q: common_vendor.p({
["label-position"]: "top"
}),
r: common_vendor.t(form.fee_pay_status_txt),
s: common_vendor.o(($event) => openPayStatusPopup("fee")),
t: common_vendor.p({
["label-position"]: "top"
})
}, {
v: form.fee_type == 1
}, form.fee_type == 1 ? {} : {}, {
w: form.fee_type == 1
}, form.fee_type == 1 ? {
x: common_vendor.o(($event) => form.over_often = $event),
y: common_vendor.p({
placeholder: "请输入小时",
type: "number",
modelValue: form.over_often
}),
z: common_vendor.p({
["label-position"]: "top"
}),
A: common_vendor.o(($event) => form.over_amount = $event),
B: common_vendor.p({
placeholder: "请输入金额",
type: "number",
modelValue: form.over_amount
}),
C: common_vendor.p({
["label-position"]: "top"
}),
D: common_vendor.t(form.over_pay_status_txt),
E: common_vendor.o(($event) => openPayStatusPopup("over")),
F: common_vendor.p({
["label-position"]: "top"
})
} : {}, {
G: 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: "528154d3-23-" + i0 + ",528154d3-22",
f: common_vendor.t(item.goods_price),
g: "528154d3-24-" + i0 + ",528154d3-22",
h: common_vendor.t(item.goods_pay_status_txt),
i: common_vendor.o(($event) => openPayStatusPopup("goods", index), index),
j: "528154d3-25-" + i0 + ",528154d3-22",
k: common_vendor.o(($event) => removeGoods(index), index),
l: "528154d3-27-" + i0 + "," + ("528154d3-26-" + i0),
m: "528154d3-26-" + i0 + ",528154d3-22",
n: index
});
}),
H: common_vendor.p({
["label-position"]: "top"
}),
I: common_vendor.p({
["label-position"]: "top"
}),
J: common_vendor.p({
["label-position"]: "top"
}),
K: common_vendor.p({
type: "danger",
size: "mini"
}),
L: common_vendor.p({
["label-position"]: "top"
}),
M: common_vendor.o(addGoods),
N: common_vendor.p({
type: "primary",
plain: true,
size: "small"
}),
O: common_vendor.o(($event) => form.discount_amount = $event),
P: common_vendor.p({
placeholder: "请输入金额",
type: "number",
modelValue: form.discount_amount
}),
Q: common_vendor.o(($event) => form.remarks = $event),
R: common_vendor.p({
rows: 3,
placeholder: "请输入备注",
modelValue: form.remarks
}),
S: common_vendor.p({
label: "备注"
}),
T: common_vendor.o(submitForm),
U: common_vendor.p({
type: "primary",
block: true
}),
V: common_vendor.o(onGoodsChange),
W: common_vendor.o(onGoodsPathChange),
X: common_vendor.o(onOpenGoodsCascader),
Y: common_vendor.o(onCloseGoodsCascader),
Z: common_vendor.o(($event) => visibleGoodsCascader.value = $event),
aa: common_vendor.o(($event) => cascaderGoodsValue.value = $event),
ab: 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
}),
ac: common_vendor.o(onCombosChange),
ad: common_vendor.o(onCombosPathChange),
ae: common_vendor.o(onOpenCombosCascader),
af: common_vendor.o(onCloseCombosCascader),
ag: common_vendor.o(($event) => visibleCombosCascader.value = $event),
ah: common_vendor.o(($event) => cascaderCombosValue.value = $event),
ai: common_vendor.p({
title: "套餐选择",
["text-key"]: "label",
["value-key"]: "value",
["children-key"]: "children",
options: selectCombos.value,
["title-ellipsis"]: false,
visible: visibleCombosCascader.value,
modelValue: cascaderCombosValue.value
}),
aj: common_vendor.o(onConfirmPaymentStatus),
ak: common_vendor.o(($event) => visiblePaymentStatusPopup.value = false),
al: common_vendor.p({
columns: paymentStatuses,
["field-names"]: {
text: "label",
value: "value"
},
title: "选择支付状态"
}),
am: common_vendor.o(($event) => visiblePaymentStatusPopup.value = $event),
an: common_vendor.p({
position: "bottom",
["safe-area-inset-bottom"]: true,
visible: visiblePaymentStatusPopup.value
})
});
};
}
};
const MiniProgramPage = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["__scopeId", "data-v-528154d3"]]);
wx.createPage(MiniProgramPage);
//# sourceMappingURL=../../../.sourcemap/mp-weixin/pages/index/orderAdd.js.map