完成新客立减功能
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
// stores/counter.js
|
||||
import { defineStore } from "pinia";
|
||||
import * as distributionApi from "@/http/api/market/distribution.js";
|
||||
import * as consumeDiscountApi from "@/http/api/market/consumeDiscount.js";
|
||||
|
||||
export const upgradeTypes = [
|
||||
{
|
||||
@@ -51,3 +52,30 @@ export const useDistributionStore = defineStore("distribution", {
|
||||
},
|
||||
unistorage: true, // 开启后对 state 的数据读写都将持久化
|
||||
});
|
||||
|
||||
//新客立减
|
||||
export const useNewUserDiscountStore = defineStore("newUserDiscount", {
|
||||
state: () => {
|
||||
return {
|
||||
//分销配置
|
||||
config: {
|
||||
isEnable: 0,
|
||||
},
|
||||
};
|
||||
},
|
||||
actions: {
|
||||
async getConfig() {
|
||||
const data = await consumeDiscountApi.getConfig();
|
||||
this.config = data;
|
||||
return this.config;
|
||||
},
|
||||
async editConfig(data,isAutoResrefresh = true) {
|
||||
const res = await consumeDiscountApi.editConfig({ ...this.config, ...data });
|
||||
if(isAutoResrefresh){
|
||||
this.getConfig();
|
||||
}
|
||||
return res;
|
||||
},
|
||||
},
|
||||
unistorage: true, // 开启后对 state 的数据读写都将持久化
|
||||
});
|
||||
Reference in New Issue
Block a user