增加 买单积分赠送比例设置
This commit is contained in:
parent
e3dde5cff3
commit
c4fdd5ae54
@ -22,8 +22,9 @@
|
|||||||
{{ formatDateTime(record.create_time) }}
|
{{ formatDateTime(record.create_time) }}
|
||||||
</template>
|
</template>
|
||||||
<template v-if="column.key === 'action'">
|
<template v-if="column.key === 'action'">
|
||||||
<a-space>
|
<a-space>
|
||||||
<a-button type="link" @click="handleEdit(record)">修改</a-button>
|
<a-button type="link" @click="handleEdit(record)">修改资料</a-button>
|
||||||
|
<a-button type="link" @click="showPointsRateModal(record)">修改积分比例</a-button>
|
||||||
</a-space>
|
</a-space>
|
||||||
</template>
|
</template>
|
||||||
</template>
|
</template>
|
||||||
@ -154,7 +155,7 @@
|
|||||||
v-model:value="formState.longitude"
|
v-model:value="formState.longitude"
|
||||||
:min="-180"
|
:min="-180"
|
||||||
:max="180"
|
:max="180"
|
||||||
style="width: 50%"
|
style="width: calc(100% - 8px); margin-right: 16px"
|
||||||
placeholder="经度"
|
placeholder="经度"
|
||||||
disabled
|
disabled
|
||||||
/>
|
/>
|
||||||
@ -162,7 +163,7 @@
|
|||||||
v-model:value="formState.latitude"
|
v-model:value="formState.latitude"
|
||||||
:min="-90"
|
:min="-90"
|
||||||
:max="90"
|
:max="90"
|
||||||
style="width: 50%"
|
style="width: calc(100% - 8px)"
|
||||||
placeholder="纬度"
|
placeholder="纬度"
|
||||||
disabled
|
disabled
|
||||||
/>
|
/>
|
||||||
@ -298,7 +299,7 @@
|
|||||||
v-model:value="editFormState.longitude"
|
v-model:value="editFormState.longitude"
|
||||||
:min="-180"
|
:min="-180"
|
||||||
:max="180"
|
:max="180"
|
||||||
style="width: 50%"
|
style="width: calc(100% - 8px); margin-right: 16px"
|
||||||
placeholder="经度"
|
placeholder="经度"
|
||||||
disabled
|
disabled
|
||||||
/>
|
/>
|
||||||
@ -306,7 +307,7 @@
|
|||||||
v-model:value="editFormState.latitude"
|
v-model:value="editFormState.latitude"
|
||||||
:min="-90"
|
:min="-90"
|
||||||
:max="90"
|
:max="90"
|
||||||
style="width: 50%"
|
style="width: calc(100% - 8px)"
|
||||||
placeholder="纬度"
|
placeholder="纬度"
|
||||||
disabled
|
disabled
|
||||||
/>
|
/>
|
||||||
@ -314,6 +315,36 @@
|
|||||||
</a-form-item>
|
</a-form-item>
|
||||||
</a-form>
|
</a-form>
|
||||||
</a-modal>
|
</a-modal>
|
||||||
|
|
||||||
|
<!-- 添加积分比例修改模态框 -->
|
||||||
|
<a-modal
|
||||||
|
v-model:visible="pointsRateModalVisible"
|
||||||
|
title="修改积分赠送比例"
|
||||||
|
:maskClosable="false"
|
||||||
|
:keyboard="false"
|
||||||
|
:width="400"
|
||||||
|
@ok="handlePointsRateSubmit"
|
||||||
|
@cancel="pointsRateModalVisible = false"
|
||||||
|
>
|
||||||
|
<div class="points-rate-form">
|
||||||
|
<a-form-item
|
||||||
|
label="积分赠送比例"
|
||||||
|
required
|
||||||
|
extra="消费金额的百分比,例如:输入10表示赠送消费金额的10%"
|
||||||
|
>
|
||||||
|
<a-input-number
|
||||||
|
v-model:value="pointsRateValue"
|
||||||
|
:min="0"
|
||||||
|
:max="100"
|
||||||
|
:precision="1"
|
||||||
|
:step="0.1"
|
||||||
|
style="width: 100%"
|
||||||
|
addonAfter="%"
|
||||||
|
placeholder="请输入0-100之间的数值"
|
||||||
|
/>
|
||||||
|
</a-form-item>
|
||||||
|
</div>
|
||||||
|
</a-modal>
|
||||||
</div>
|
</div>
|
||||||
</page-container>
|
</page-container>
|
||||||
</template>
|
</template>
|
||||||
@ -400,6 +431,16 @@ export default defineComponent({
|
|||||||
key: 'name',
|
key: 'name',
|
||||||
width: 200,
|
width: 200,
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
title: '买单赠送积分比例',
|
||||||
|
dataIndex: 'pay_gift_points_rate',
|
||||||
|
key: 'pay_gift_points_rate',
|
||||||
|
width: 150,
|
||||||
|
align: 'center',
|
||||||
|
customRender: ({ text }) => {
|
||||||
|
return `${text || 0}%`
|
||||||
|
}
|
||||||
|
},
|
||||||
{
|
{
|
||||||
title: '营业时间',
|
title: '营业时间',
|
||||||
dataIndex: 'business_hours',
|
dataIndex: 'business_hours',
|
||||||
@ -436,7 +477,7 @@ export default defineComponent({
|
|||||||
key: 'action',
|
key: 'action',
|
||||||
width: 200,
|
width: 200,
|
||||||
fixed: 'right',
|
fixed: 'right',
|
||||||
align: 'center',
|
align: 'center'
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
|
||||||
@ -457,11 +498,14 @@ export default defineComponent({
|
|||||||
|
|
||||||
const res = await request.get('/api/merchant', { params })
|
const res = await request.get('/api/merchant', { params })
|
||||||
if (res.data) {
|
if (res.data) {
|
||||||
tableData.value = res.data.items || []
|
tableData.value = (res.data.items || []).map(item => ({
|
||||||
|
...item,
|
||||||
|
pay_gift_points_rate: Number(item.pay_gift_points_rate || 0)
|
||||||
|
}))
|
||||||
pagination.value.total = res.data.total || 0
|
pagination.value.total = res.data.total || 0
|
||||||
}
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error('获取商家列表失败:', error)
|
|
||||||
} finally {
|
} finally {
|
||||||
loading.value = false
|
loading.value = false
|
||||||
}
|
}
|
||||||
@ -503,7 +547,7 @@ export default defineComponent({
|
|||||||
title: record.name
|
title: record.name
|
||||||
})
|
})
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error('加载地图失败:', error)
|
|
||||||
message.error('加载地图失败')
|
message.error('加载地图失败')
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -535,7 +579,7 @@ export default defineComponent({
|
|||||||
longitude: null,
|
longitude: null,
|
||||||
latitude: null,
|
latitude: null,
|
||||||
phone: '',
|
phone: '',
|
||||||
brand_image_url: ''
|
brand_image_url: '',
|
||||||
})
|
})
|
||||||
|
|
||||||
const rules = {
|
const rules = {
|
||||||
@ -558,7 +602,7 @@ export default defineComponent({
|
|||||||
categories.value = res.data.items || []
|
categories.value = res.data.items || []
|
||||||
}
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error('获取商家分类失败:', error)
|
|
||||||
message.error('获取商家分类失败')
|
message.error('获取商家分类失败')
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -603,7 +647,7 @@ export default defineComponent({
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error('初始化地图失败:', error)
|
|
||||||
message.error('初始化地图失败')
|
message.error('初始化地图失败')
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -649,7 +693,7 @@ export default defineComponent({
|
|||||||
})
|
})
|
||||||
})
|
})
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error('搜索地址失败:', error)
|
|
||||||
searchLoading.value = false
|
searchLoading.value = false
|
||||||
message.error('搜索地址失败')
|
message.error('搜索地址失败')
|
||||||
}
|
}
|
||||||
@ -692,7 +736,7 @@ export default defineComponent({
|
|||||||
addModalVisible.value = false
|
addModalVisible.value = false
|
||||||
fetchData()
|
fetchData()
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error('添加商家失败:', error)
|
|
||||||
} finally {
|
} finally {
|
||||||
confirmLoading.value = false
|
confirmLoading.value = false
|
||||||
}
|
}
|
||||||
@ -711,7 +755,7 @@ export default defineComponent({
|
|||||||
longitude: null,
|
longitude: null,
|
||||||
latitude: null,
|
latitude: null,
|
||||||
phone: '',
|
phone: '',
|
||||||
brand_image_url: ''
|
brand_image_url: '',
|
||||||
}
|
}
|
||||||
searchAddress.value = ''
|
searchAddress.value = ''
|
||||||
searchOptions.value = []
|
searchOptions.value = []
|
||||||
@ -766,7 +810,7 @@ export default defineComponent({
|
|||||||
longitude: null,
|
longitude: null,
|
||||||
latitude: null,
|
latitude: null,
|
||||||
phone: '',
|
phone: '',
|
||||||
brand_image_url: ''
|
brand_image_url: '',
|
||||||
})
|
})
|
||||||
const editSearchAddress = ref('')
|
const editSearchAddress = ref('')
|
||||||
const editMap = ref(null)
|
const editMap = ref(null)
|
||||||
@ -841,7 +885,7 @@ export default defineComponent({
|
|||||||
editMap.value.setCenter([lng, lat])
|
editMap.value.setCenter([lng, lat])
|
||||||
updateEditMarkerPosition(lng, lat)
|
updateEditMarkerPosition(lng, lat)
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error('初始化地图失败:', error)
|
|
||||||
message.error('初始化地图失败')
|
message.error('初始化地图失败')
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -904,7 +948,7 @@ export default defineComponent({
|
|||||||
throw new Error(res.message || '修改失败')
|
throw new Error(res.message || '修改失败')
|
||||||
}
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error('修改商家失败:', error)
|
|
||||||
message.error(error.message || '修改失败')
|
message.error(error.message || '修改失败')
|
||||||
} finally {
|
} finally {
|
||||||
editLoading.value = false
|
editLoading.value = false
|
||||||
@ -924,7 +968,7 @@ export default defineComponent({
|
|||||||
longitude: null,
|
longitude: null,
|
||||||
latitude: null,
|
latitude: null,
|
||||||
phone: '',
|
phone: '',
|
||||||
brand_image_url: ''
|
brand_image_url: '',
|
||||||
}
|
}
|
||||||
editSearchAddress.value = ''
|
editSearchAddress.value = ''
|
||||||
userOptions.value = []
|
userOptions.value = []
|
||||||
@ -956,7 +1000,7 @@ export default defineComponent({
|
|||||||
userOptions.value = res.data.items || []
|
userOptions.value = res.data.items || []
|
||||||
}
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error('搜索用户失败:', error)
|
|
||||||
message.error('搜索用户失败')
|
message.error('搜索用户失败')
|
||||||
} finally {
|
} finally {
|
||||||
userLoading.value = false
|
userLoading.value = false
|
||||||
@ -1020,7 +1064,7 @@ export default defineComponent({
|
|||||||
message.error('上传失败')
|
message.error('上传失败')
|
||||||
}
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error('上传失败:', error)
|
|
||||||
onError()
|
onError()
|
||||||
message.error('上传失败')
|
message.error('上传失败')
|
||||||
}
|
}
|
||||||
@ -1037,6 +1081,42 @@ export default defineComponent({
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 修改积分比例相关代码
|
||||||
|
const pointsRateModalVisible = ref(false)
|
||||||
|
const currentRecord = ref(null)
|
||||||
|
const pointsRateValue = ref(0)
|
||||||
|
|
||||||
|
const showPointsRateModal = (record) => {
|
||||||
|
currentRecord.value = record
|
||||||
|
pointsRateValue.value = Number(record.pay_gift_points_rate || 0)
|
||||||
|
pointsRateModalVisible.value = true
|
||||||
|
}
|
||||||
|
|
||||||
|
const handlePointsRateSubmit = async () => {
|
||||||
|
try {
|
||||||
|
if (pointsRateValue.value < 0 || pointsRateValue.value > 100) {
|
||||||
|
message.error('积分比例必须在0-100之间')
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
const res = await request.put(`/api/merchant/${currentRecord.value.id}`, {
|
||||||
|
user_id: currentRecord.value.user_id,
|
||||||
|
pay_gift_points_rate: pointsRateValue.value
|
||||||
|
})
|
||||||
|
|
||||||
|
if (res.code === 200) {
|
||||||
|
message.success('修改成功')
|
||||||
|
pointsRateModalVisible.value = false
|
||||||
|
fetchData()
|
||||||
|
} else {
|
||||||
|
throw new Error(res.message || '修改失败')
|
||||||
|
}
|
||||||
|
} catch (error) {
|
||||||
|
|
||||||
|
message.error(error.message || '修改失败')
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
fetchData()
|
fetchData()
|
||||||
})
|
})
|
||||||
@ -1085,7 +1165,11 @@ export default defineComponent({
|
|||||||
brandImageList,
|
brandImageList,
|
||||||
editBrandImageList,
|
editBrandImageList,
|
||||||
handleBrandImageUpload,
|
handleBrandImageUpload,
|
||||||
handleBrandImageRemove
|
handleBrandImageRemove,
|
||||||
|
pointsRateModalVisible,
|
||||||
|
pointsRateValue,
|
||||||
|
showPointsRateModal,
|
||||||
|
handlePointsRateSubmit
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
@ -1263,4 +1347,43 @@ export default defineComponent({
|
|||||||
background: transparent;
|
background: transparent;
|
||||||
box-shadow: none;
|
box-shadow: none;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.points-rate-cell {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
gap: 4px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.percent-sign {
|
||||||
|
color: rgba(0, 0, 0, 0.85);
|
||||||
|
}
|
||||||
|
|
||||||
|
:deep(.ant-input-number) {
|
||||||
|
width: 80px !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
.points-rate-form {
|
||||||
|
padding: 0 24px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.points-rate-form :deep(.ant-form-item) {
|
||||||
|
margin-bottom: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.points-rate-form :deep(.ant-form-item-label) {
|
||||||
|
padding-bottom: 8px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.points-rate-form :deep(.ant-form-item-extra) {
|
||||||
|
margin-top: 8px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.points-rate-form :deep(.ant-input-number-group-wrapper) {
|
||||||
|
width: 100%;
|
||||||
|
}
|
||||||
|
|
||||||
|
.points-rate-form :deep(.ant-input-number) {
|
||||||
|
width: 100% !important;
|
||||||
|
}
|
||||||
</style>
|
</style>
|
||||||
Loading…
Reference in New Issue
Block a user