|
|
@@ -44,9 +44,9 @@
|
|
|
</el-radio-group>
|
|
|
</el-form-item>
|
|
|
<!-- 自定义开始售卖时间(当选择"设置售卖时间"时显示) -->
|
|
|
- <el-form-item label="" prop="saleTimeStr" v-if="storeInfoModel.startTimeType == 1">
|
|
|
+ <el-form-item label="" prop="startTimeValue" v-if="storeInfoModel.startTimeType == 1">
|
|
|
<el-date-picker
|
|
|
- v-model="storeInfoModel.saleTimeStr"
|
|
|
+ v-model="storeInfoModel.startTimeValue"
|
|
|
format="YYYY/MM/DD"
|
|
|
value-format="YYYY-MM-DD"
|
|
|
placeholder="请选择开始售卖时间"
|
|
|
@@ -453,7 +453,7 @@ import { ref, reactive, onMounted, watch, nextTick, computed } from "vue";
|
|
|
import { ElMessage, ElMessageBox } from "element-plus";
|
|
|
import { Plus, Delete, ArrowDown, ArrowUp, Picture } from "@element-plus/icons-vue";
|
|
|
import {
|
|
|
- saveStoreInfo,
|
|
|
+ saveDraft,
|
|
|
editStoreInfo,
|
|
|
getDetail,
|
|
|
getStoreDetail,
|
|
|
@@ -488,7 +488,7 @@ const rules = reactive({
|
|
|
imageList: [{ required: true, message: "请上传图片" }],
|
|
|
groupName: [{ required: true, message: "请填写团购名称" }],
|
|
|
startTimeType: [{ required: true, message: "请选择开始售卖时间" }],
|
|
|
- saleTimeStr: [
|
|
|
+ startTimeValue: [
|
|
|
{ required: true, message: "请选择开始售卖时间" },
|
|
|
{
|
|
|
validator: (rule: any, value: any, callback: any) => {
|
|
|
@@ -534,8 +534,8 @@ const rules = reactive({
|
|
|
return;
|
|
|
}
|
|
|
// 如果开始时间已设置,验证结束时间必须晚于开始时间
|
|
|
- if (storeInfoModel.value.startTimeType === 1 && storeInfoModel.value.saleTimeStr) {
|
|
|
- const startDate = new Date(storeInfoModel.value.saleTimeStr);
|
|
|
+ if (storeInfoModel.value.startTimeType === 1 && storeInfoModel.value.startTimeValue) {
|
|
|
+ const startDate = new Date(storeInfoModel.value.startTimeValue);
|
|
|
if (selectedDate <= startDate) {
|
|
|
callback(new Error("结束售卖时间必须晚于开始售卖时间"));
|
|
|
return;
|
|
|
@@ -811,7 +811,7 @@ const storeInfoModel = ref<any>({
|
|
|
// 开始售卖时间设置方式:0-审核通过后立即开始,1-设置售卖时间
|
|
|
startTimeType: 0,
|
|
|
// 开始售卖时间(当storeStatus为1时必填)
|
|
|
- saleTimeStr: "",
|
|
|
+ startTimeValue: "",
|
|
|
// 结束售卖时间
|
|
|
endTime: "",
|
|
|
// 库存数量
|
|
|
@@ -910,7 +910,6 @@ const lifeGroupBuyThalis = ref([
|
|
|
detailId: "", // 菜品ID
|
|
|
dishName: "", // 菜品名称
|
|
|
dishPrice: "", // 菜品价格
|
|
|
- dishImage: "", // 菜品图片
|
|
|
qty: "", // 数量
|
|
|
dishesUnit: ""
|
|
|
}
|
|
|
@@ -963,7 +962,7 @@ watch(
|
|
|
* 当开始时间改变时,重新验证结束时间
|
|
|
*/
|
|
|
watch(
|
|
|
- () => storeInfoModel.value.saleTimeStr,
|
|
|
+ () => storeInfoModel.value.startTimeValue,
|
|
|
() => {
|
|
|
if (storeInfoModel.value.endTime) {
|
|
|
nextTick(() => {
|
|
|
@@ -980,9 +979,9 @@ watch(
|
|
|
watch(
|
|
|
() => storeInfoModel.value.endTime,
|
|
|
() => {
|
|
|
- if (storeInfoModel.value.startTimeType === 1 && storeInfoModel.value.saleTimeStr) {
|
|
|
+ if (storeInfoModel.value.startTimeType === 1 && storeInfoModel.value.startTimeValue) {
|
|
|
nextTick(() => {
|
|
|
- ruleFormRef.value?.validateField("saleTimeStr");
|
|
|
+ ruleFormRef.value?.validateField("startTimeValue");
|
|
|
});
|
|
|
}
|
|
|
}
|
|
|
@@ -1090,7 +1089,6 @@ onMounted(async () => {
|
|
|
detailId: "",
|
|
|
dishName: "",
|
|
|
dishPrice: "",
|
|
|
- dishImage: "",
|
|
|
qty: "",
|
|
|
dishesUnit: ""
|
|
|
}
|
|
|
@@ -1266,7 +1264,6 @@ const addGroup = () => {
|
|
|
detailId: "",
|
|
|
dishName: "",
|
|
|
dishPrice: "",
|
|
|
- dishImage: "",
|
|
|
qty: "",
|
|
|
dishesUnit: ""
|
|
|
}
|
|
|
@@ -1307,7 +1304,6 @@ const addGroup = () => {
|
|
|
detailId: "",
|
|
|
dishName: "",
|
|
|
dishPrice: "",
|
|
|
- dishImage: "",
|
|
|
qty: "",
|
|
|
dishesUnit: ""
|
|
|
}
|
|
|
@@ -1437,7 +1433,6 @@ const addDish = (groupIndex: number) => {
|
|
|
detailId: "",
|
|
|
dishName: "",
|
|
|
dishPrice: "",
|
|
|
- dishImage: "",
|
|
|
qty: "",
|
|
|
dishesUnit: ""
|
|
|
});
|
|
|
@@ -1469,7 +1464,6 @@ const addDish = (groupIndex: number) => {
|
|
|
detailId: "",
|
|
|
dishName: "",
|
|
|
dishPrice: "",
|
|
|
- dishImage: "",
|
|
|
qty: "",
|
|
|
dishesUnit: ""
|
|
|
});
|
|
|
@@ -1504,7 +1498,6 @@ const addDish = (groupIndex: number) => {
|
|
|
detailId: "",
|
|
|
dishName: "",
|
|
|
dishPrice: "",
|
|
|
- dishImage: "",
|
|
|
qty: "",
|
|
|
dishesUnit: ""
|
|
|
});
|
|
|
@@ -1572,7 +1565,6 @@ const confirmDishSelection = () => {
|
|
|
dish.detailId = selectedDish.id;
|
|
|
dish.dishName = selectedDish.dishName;
|
|
|
dish.dishPrice = selectedDish.dishPrice;
|
|
|
- dish.dishImage = selectedDish.imgUrl;
|
|
|
dish.dishesUnit = selectedDish.dishesUnit;
|
|
|
dishDialogVisible.value = false;
|
|
|
// 重新验证对应的字段,如果验证通过,错误提示会消失
|
|
|
@@ -1722,13 +1714,8 @@ const packageFormRules = computed(() => {
|
|
|
* 提交数据(新增/编辑)
|
|
|
* 验证表单,通过后调用相应的API接口
|
|
|
*/
|
|
|
-const handleSubmit = (type?) => {
|
|
|
+const handleSubmit = async (type?) => {
|
|
|
let params: any = { ...storeInfoModel.value };
|
|
|
- if (params.effectiveDateType == 0) {
|
|
|
- // params.couponCompDate = `用户购买${params.expirationDate}天内有效`;
|
|
|
- } else {
|
|
|
- params.expirationDateList = params.expirationDateList.join(",");
|
|
|
- }
|
|
|
if (params.disableDateType == 1) {
|
|
|
params.disableDateValue = params.unavailableWeekdays.join(",") + ";" + params.unavailableHolidays.join(",");
|
|
|
// params.disableDateValue = [params.unavailableWeekdays, params.unavailableHolidays];
|
|
|
@@ -1746,12 +1733,23 @@ const handleSubmit = (type?) => {
|
|
|
// dishPrice: dish.dishPrice
|
|
|
// }))
|
|
|
// );
|
|
|
- const paramsObj = {
|
|
|
+ const paramsObj: any = {
|
|
|
lifeGroupBuyMain: params,
|
|
|
lifeGroupBuyThalis: lifeGroupBuyThalis.value
|
|
|
};
|
|
|
- console.log(paramsObj);
|
|
|
if (type) {
|
|
|
+ if (!storeInfoModel.value.groupName) {
|
|
|
+ ElMessage.error("请填写团购名称");
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ paramsObj.lifeGroupBuyMain.status = "0";
|
|
|
+ paramsObj.lifeGroupBuyMain.groupType = 1;
|
|
|
+ paramsObj.lifeGroupBuyMain.storeId = id.value;
|
|
|
+ console.log(paramsObj);
|
|
|
+ let res: any = await saveDraft(paramsObj);
|
|
|
+ if (res && res.code == 200) {
|
|
|
+ }
|
|
|
+ // goBack();
|
|
|
return;
|
|
|
}
|
|
|
// 验证表单
|
|
|
@@ -1807,8 +1805,8 @@ const disabledEndDate = (time: Date) => {
|
|
|
return true;
|
|
|
}
|
|
|
// 如果开始售卖时间已设置,不能早于或等于开始时间
|
|
|
- if (storeInfoModel.value.startTimeType === 1 && storeInfoModel.value.saleTimeStr) {
|
|
|
- const startDate = new Date(storeInfoModel.value.saleTimeStr);
|
|
|
+ if (storeInfoModel.value.startTimeType === 1 && storeInfoModel.value.startTimeValue) {
|
|
|
+ const startDate = new Date(storeInfoModel.value.startTimeValue);
|
|
|
startDate.setHours(0, 0, 0, 0);
|
|
|
return time.getTime() <= startDate.getTime();
|
|
|
}
|