优化新增点单智能推荐

This commit is contained in:
gyq
2025-10-23 11:25:20 +08:00
parent dae7ced23c
commit 99881f4d97
20 changed files with 955 additions and 257 deletions

View File

@@ -8,17 +8,20 @@
<el-form-item label="有效期" prop="timeScope">
<div style="width: 350px;">
<el-date-picker v-model="form.timeScope" type="datetimerange" range-separator="至" start-placeholder="开始日期"
end-placeholder="结束日期" value-format="YYYY-MM-DD HH:mm:ss" format="YYYY-MM-DD HH:mm:ss"
style="width: 100%;" />
end-placeholder="结束日期" value-format="YYYY-MM-DD HH:mm:ss" format="YYYY-MM-DD HH:mm:ss" style="width: 100%;"
:disabled="!!form.id" />
</div>
</el-form-item>
<el-form-item label="金额" prop="amount">
<el-input v-model="form.amount" placeholder="请输入" :maxlength="8" show-word-limit style="width: 350px;"
@input="e => form.amount = filterNumberInput(e)"></el-input>
@input="e => form.amount = filterNumberInput(e)" :disabled="!!form.id"></el-input>
</el-form-item>
<el-form-item label="发行数量" prop="total">
<el-input v-model="form.total" placeholder="请输入" :maxlength="4" show-word-limit style="width: 350px;"
@input="e => form.total = filterNumberInput(e, true)"></el-input>
<div class="column">
<el-input v-model="form.total" placeholder="请输入" :maxlength="4" show-word-limit style="width: 350px;"
@input="e => form.total = filterNumberInput(e, true)" :disabled="!!form.id"></el-input>
<div class="tips" style="color: #999;">单次发行上限1000个如需更多请分多次创建</div>
</div>
</el-form-item>
<el-form-item label="库存" prop="stock" v-if="form.id">
<el-input v-model="form.stock" placeholder="请输入" :maxlength="4" show-word-limit style="width: 350px;"

View File

@@ -17,7 +17,7 @@
<el-form-item label="库存">
{{ form.stock }}
</el-form-item>
<el-form-item>
<el-form-item v-if="shopInfo.isHeadShop == 1 || shopInfo.shopType == 'only'">
<el-button type="primary" @click="addRef.show({ ...form })">编辑</el-button>
</el-form-item>
</el-form>
@@ -68,10 +68,9 @@ import { rechargeRedemptionCodeList, rechargeRedemptionDetail, rechargeRedemptio
import { downloadFile } from "@/utils/index";
const emit = defineEmits(['update']);
const addRef = ref(null);
const visible = ref(false);
const shopInfo = ref(JSON.parse(localStorage.getItem("userInfo")));
const form = ref({
id: '',

View File

@@ -1,8 +1,9 @@
<!-- 充值兑换码 -->
<template>
<div class="gyq_container">
<div class="gyq_content">
<header-card name="充值兑换码" intro="兑换码直充余额,可当作礼品赠送" icon="czdhm" showSwitch v-model:isOpen="queryForm.isEnable" />
<div class="gyq_content" v-if="shopInfo.isHeadShop == 1 || isUse">
<header-card name="充值兑换码" intro="兑换码直充余额,可当作礼品赠送" icon="czdhm"
:showSwitch="shopInfo.isHeadShop == 1 || shopInfo.shopType == 'only'" v-model:isOpen="queryForm.isEnable" />
<div class="row mt14">
<el-form inline>
<el-form-item>
@@ -10,7 +11,7 @@
<el-option v-for="item in statusList" :key="item.value" :label="item.label" :value="item.value" />
</el-select>
</el-form-item>
<el-form-item>
<el-form-item v-if="shopInfo.isHeadShop || shopInfo.shopType == 'only'">
<el-button type="primary" @click="addRef.show()">添加</el-button>
<el-button type="primary" plain @click="useShopsRef.show()">适用门店</el-button>
</el-form-item>
@@ -37,7 +38,8 @@
</el-table-column>
<el-table-column label="操作" width="120">
<template #default="scope">
<el-button link type="primary" @click="addRef.show(scope.row)">编辑</el-button>
<el-button link type="primary" @click="addRef.show(scope.row)"
v-if="shopInfo.isHeadShop || shopInfo.shopType == 'only'">编辑</el-button>
<el-button link type="primary" @click="recordRef.show(scope.row)">查看</el-button>
</template>
</el-table-column>
@@ -49,6 +51,9 @@
:total="tableData.total" @size-change="handleSizeChange" @current-change="handleCurrentChange" />
</div>
</div>
<div class="gyq_content" v-else>
门店未参券兑换码活动如需开启参与请联系主店
</div>
<useShops ref="useShopsRef" />
<add ref="addRef" @success="getTableData" />
<record ref="recordRef" @update="getTableData" />
@@ -63,6 +68,7 @@ import record from "./components/record.vue";
import { ref, reactive, onMounted } from "vue";
import { rechargeRedemptionPut, rechargeRedemptionList, rechargeRedemptionEnableStatus } from "@/api/coupon/index.js";
const shopInfo = ref(JSON.parse(localStorage.getItem("userInfo")));
const useShopsRef = ref(null);
const addRef = ref(null);
const recordRef = ref(null);
@@ -138,10 +144,23 @@ async function getTableData() {
}
// 开关状态
const isUse = ref(false)
async function rechargeRedemptionEnableStatusAjax() {
try {
const res = await rechargeRedemptionEnableStatus();
queryForm.value.isEnable = res.isEnable;
if (res.useType == 'all') {
isUse.value = true
} else {
let currentShopId = shopInfo.value.shopId;
res.shopIdList.some((item) => {
if (item == currentShopId) {
isUse.value = true;
return true;
}
});
}
} catch (error) {
console.log(error);
}