|
|
@@ -18,14 +18,20 @@ |
|
|
|
</a-col> |
|
|
|
<a-col span="24"> |
|
|
|
<a-form-item required label="点数值"> |
|
|
|
<a-input-number :min="0" type="number" v-model:value="createForm.point" |
|
|
|
placeholder="请输入点数值" style="width: 100%;" /> |
|
|
|
<a-input-number :min="0" type="number" v-model:value="createForm.point" placeholder="请输入点数值" |
|
|
|
style="width: 100%;" /> |
|
|
|
</a-form-item> |
|
|
|
</a-col> |
|
|
|
<a-col span="24"> |
|
|
|
<a-form-item required label="价格(元)"> |
|
|
|
<a-input-number :min="0" type="number" v-model:value="createForm.price" |
|
|
|
placeholder="请输入价格" style="width: 100%;" /> |
|
|
|
<a-input-number :min="0" type="number" v-model:value="createForm.price" placeholder="请输入价格" |
|
|
|
style="width: 100%;" /> |
|
|
|
</a-form-item> |
|
|
|
</a-col> |
|
|
|
<a-col span="24"> |
|
|
|
<a-form-item required label="会员日期延期天数"> |
|
|
|
<a-input-number :min="0" type="number" v-model:value="createForm.day" placeholder="请输入价格" |
|
|
|
style="width: 100%;" /> |
|
|
|
</a-form-item> |
|
|
|
</a-col> |
|
|
|
</a-row> |
|
|
@@ -35,7 +41,7 @@ |
|
|
|
|
|
|
|
<script setup lang="ts"> |
|
|
|
import { ref, onMounted, computed, defineProps, watch, defineEmits } from 'vue'; |
|
|
|
import { GetActivityaddressCate, PostActivityaddressAdd, PostActivityaddressUpdate } from '@/apis/models'; |
|
|
|
import { PostFeePackageAdd, PostFeePackageUpdate } from '@/apis/models'; |
|
|
|
import { dataForm, otherDataForm, reset } from '@/views/buy/package/add/data.js'; |
|
|
|
import { useCommon } from '@/hooks/useCommon'; |
|
|
|
let { store, openAddModel, hideModal, message } = useCommon(); |
|
|
@@ -48,52 +54,22 @@ |
|
|
|
let addOtherForm = ref(otherDataForm) |
|
|
|
|
|
|
|
|
|
|
|
onMounted(() => { |
|
|
|
}) |
|
|
|
|
|
|
|
|
|
|
|
// 选择企业 |
|
|
|
let cate_list = ref<Object[]>([]) |
|
|
|
const cateSearch = (val : Object) => { |
|
|
|
GetActivityaddressCate(val).then((res : object) => { |
|
|
|
const data = res.data.activity_address_cate.map((item : object) => ({ |
|
|
|
label: item, |
|
|
|
value: item, |
|
|
|
})); |
|
|
|
cate_list.value = data; |
|
|
|
}) |
|
|
|
} |
|
|
|
const getCateValue = (val : Object) => { |
|
|
|
createForm.value.cate = val.key; |
|
|
|
} |
|
|
|
|
|
|
|
// 经纬度 |
|
|
|
const getLoc = (mapData : Object) => { |
|
|
|
console.log(mapData) |
|
|
|
createForm.value.address = mapData.poiaddress; |
|
|
|
createForm.value.lat = mapData.latlng.lat; |
|
|
|
createForm.value.lng = mapData.latlng.lng; |
|
|
|
showMap.value = false; |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
const sumbitForm = () => { |
|
|
|
if(!createForm.value.address) { |
|
|
|
message.error('请选择门店地址'); |
|
|
|
return false; |
|
|
|
} |
|
|
|
if (createForm.value.address && createForm.value.store_name && createForm.value.contact_person && createForm.value.mobile && createForm.value.audit_mobile && createForm.value.communal && createForm.value.cate) { |
|
|
|
if (createForm.value.name && createForm.value.type && createForm.value.price && createForm.value.point && createForm.value.day) { |
|
|
|
if (!createForm.value.id) { |
|
|
|
PostActivityaddressAdd(createForm.value).then(res => { |
|
|
|
message.success('创建活动地址'); |
|
|
|
PostFeePackageAdd(createForm.value).then(res => { |
|
|
|
message.success('创建套餐成功'); |
|
|
|
hideModal(); |
|
|
|
resetForm(); |
|
|
|
emit('successAdd'); |
|
|
|
}).catch(err => { |
|
|
|
}) |
|
|
|
} else { |
|
|
|
PostActivityaddressUpdate(createForm.value).then(res => { |
|
|
|
message.success('修改活动地址成功'); |
|
|
|
PostFeePackageUpdate(createForm.value).then(res => { |
|
|
|
message.success('修改套餐成功'); |
|
|
|
hideModal(); |
|
|
|
resetForm(); |
|
|
|
emit('successAdd'); |
|
|
@@ -124,22 +100,20 @@ |
|
|
|
|
|
|
|
watch(() => props.edit_record, (newVal) => { |
|
|
|
if (newVal) { |
|
|
|
title.value = '编辑活动地址'; |
|
|
|
title.value = '编辑套餐'; |
|
|
|
console.log(newVal) |
|
|
|
createForm.value = { |
|
|
|
id: newVal.id, |
|
|
|
address: newVal.address, |
|
|
|
lat: newVal.lat, |
|
|
|
lng: newVal.lng, |
|
|
|
store_name: newVal.store_name, |
|
|
|
contact_person: newVal.contact_person, |
|
|
|
mobile: newVal.mobile, |
|
|
|
audit_mobile: newVal.audit_mobile, |
|
|
|
communal: newVal.communal, |
|
|
|
cate: newVal.cate, |
|
|
|
name: newVal.name, |
|
|
|
type: newVal.type, |
|
|
|
price: newVal.price, |
|
|
|
point: newVal.point, |
|
|
|
day: newVal.day, |
|
|
|
ad: newVal.ad, |
|
|
|
ad_day: newVal.ad_day, |
|
|
|
} |
|
|
|
} else { |
|
|
|
title.value = '新增活动地址'; |
|
|
|
title.value = '新增套餐'; |
|
|
|
} |
|
|
|
}) |
|
|
|
</script> |