修复了在details.vue中的会员价格设置,添加了新的按钮和表单,并移除了不必要的代码。

This commit is contained in:
mkm 2024-09-01 22:23:01 +08:00
parent dd722e0ef4
commit 4eb15ae0ab
1 changed files with 85 additions and 55 deletions

View File

@ -45,6 +45,54 @@
<!-- <div style="white-space: pre;">{{ cMark(formData.manufacturer_information) }}</div> -->
</el-descriptions-item>
</el-descriptions>
<el-button type="primary" @click="dialogShop = true" class="mt-2">
添加会员价格
</el-button>
<div>
<div>
<el-table :data="vipPriceList" v-loading="pager.loading">
<el-table-column label="类型" show-overflow-tooltip />
<el-table-column
label="供货价"
prop="purchase"
show-overflow-tooltip
/>
<el-table-column label="商户价" prop="cost" show-overflow-tooltip />
<el-table-column
label="零售价"
prop="price"
show-overflow-tooltip
/>
<el-table-column label="操作" width="120" fixed="right">
<template #default="{ row }">
<el-button
v-perms="['store_product.store_product/vip_price_edit']"
type="primary"
link
@click="handleEdit(row)"
>
编辑
</el-button>
<el-button
v-perms="[
'warehouse_product.warehouse_product/vip_price_delete'
]"
type="danger"
link
@click="handleDeletes(row.id)"
>
删除
</el-button>
</template>
</el-table-column>
</el-table>
</div>
<div class="flex mt-4 justify-end" v-if="pager.lists.length < pager.count">
<pagination v-model="pager" @change="getLists" />
</div>
</div>
</el-tab-pane>
<el-tab-pane label="适用门店" name="second">
<el-table :data="pager.lists" border>
@ -133,22 +181,43 @@
</el-tab-pane>
</el-tabs>
</el-drawer>
<el-dialog v-model="showStore" title="选择门店" width="70%">
<store-pop @onBindStore="onBindStore"></store-pop>
</el-dialog>
<el-dialog v-model="dialogFormVisible" title="编辑价格" width="500">
<el-dialog v-model="dialogShop" title="设置会员价格" width="500">
<el-form :model="formPrice">
<el-form-item label="价格">
<el-form-item label="类型">
<el-input
v-model="formPrice.vip_type"
placeholder="请输入会员类型"
autocomplete="off"
/>
</el-form-item>
<el-form-item label="供货价">
<el-input
v-model="formPrice.purchase"
type="number"
placeholder="请输入供货价"
autocomplete="off"
/>
</el-form-item>
<el-form-item label="商户价">
<el-input
v-model="formPrice.cost"
type="number"
placeholder="请输入商户价"
autocomplete="off"
/>
</el-form-item>
<el-form-item label="零售价">
<el-input
v-model="formPrice.price"
placeholder="请输入价格"
type="number"
placeholder="请输入价"
autocomplete="off"
/>
</el-form-item>
</el-form>
<template #footer>
<div class="dialog-footer">
<el-button @click="dialogFormVisible = false">取消</el-button>
<el-button @click="dialogShop = false">取消</el-button>
<el-button type="primary" @click="onUpdatePrice"> 确认 </el-button>
</div>
</template>
@ -177,8 +246,9 @@ defineProps({
}
})
const emit = defineEmits(['success', 'close'])
const popupRef = shallowRef<InstanceType<typeof Popup>>()
const mode = ref('add')
const dialogShop = ref(false)
const vipPriceList = ref([])
const isOpen = ref(false)
const activeName = ref('first')
const handleClick = (tab: any) => {
@ -203,7 +273,12 @@ const formData = reactive({
rose: '0',
manufacturer_information: ''
})
const handleEdit = () => {
console.log(12)
}
const handleDeletes = () => {
console.log(12)
}
//
const setFormData = async (data: Record<any, any>) => {
queryParams.product_id = data.id
@ -216,24 +291,6 @@ const setFormData = async (data: Record<any, any>) => {
}
}
const cMark = (str: any) => {
if (str) {
return str.replace(/(\d{5,})/g, (match: string) => {
let replacement
//
if (match.length >= 11) {
// 11
replacement = match.slice(0, -8) + '****' + match.slice(-4)
} else {
// 511
replacement = match.slice(0, -4) + '****'
}
return replacement
})
}
return '-'
}
const getDetail = async (row: Record<string, any>) => {
queryParams.product_id = row.id
const data = await apiStoreProductDetail({
@ -249,11 +306,6 @@ const open = () => {
removeList.clear()
}
//
const handleClose = () => {
emit('close')
}
//
const queryParams = reactive({
product_id: ''
@ -297,28 +349,6 @@ const stockList = ref(new Map())
const handleChange = (row: any) => {
stockList.value.set(row.id, row.new_stock)
}
const submitStock = () => {
feedback
.confirm('确定修改库存吗?')
.then(async () => {
const data = Array.from(stockList.value.entries()).map(([key, value]) => {
return {
id: key,
stock: value
}
})
apiStoreBranchProductEdit({
data
}).then((res) => {
isEidtStock.value = false
stockList.value.clear()
getLists()
})
})
.catch(() => {
// on cancel
})
}
//
const dialogFormVisible = ref(false)