755b6f8f-2dc0-4726-a05f-8eac91ca17通过输入面积信息,调整下拉选项数据
export async function calculateArea() {
const area = await sdk.getValue('num_5');
const areaValue = area.value;
console.log(areaValue);
let textValue, uuidValue;
const conditions = [
{ min: 0, max: 100, text: '100以下', uuid: 'fd8cbbc8-d0c2-da8a-72ac-e448a693defc' },
{ min: 100, max: 130, text: '100-130', uuid: '7c609441-42ea-dc9f-2819-c488c03f4355' },
{ min: 131, max: 150, text: '131-150', uuid: 'eb44fdab-a900-5a46-bde7-ed62781986a7' },
{ min: 151, max: 199, text: '151-199', uuid: '7885e382-2fec-836b-a1e5-21b193a74d36' },
{ min: 200, max: 250, text: '200-250', uuid: '6c7dc56e-7220-1b5c-95aa-9f28924eeb64' },
{ min: 250, max: 1000, text: '250以上', uuid: '362b2c84-c29a-d49a-b2ae-0c70ee99332b' },
//
];
for (const condition of conditions) {
if (areaValue >= condition.min && areaValue <= condition.max) {
console.log(`面积在${condition.min}-${condition.max}之间`);
textValue = condition.text;
uuidValue = condition.uuid;
break;
}
}
if (!textValue) {
textValue = '231以上';
}
await sdk.setValue('text_33', { text: textValue, value: uuidValue });
}
获取客户阶段信息
export async function getinfo() {
const test = await sdk.getValue("text_18");
console.log(test);
const testvalue = test.value
console.log(testvalue);
const testvaluetext = test.value.text;
console.log(testvaluetext);
console.log("asdf");
const text2 = await sdk.getValue("text_4");
// const bbb = text2.value
console.log(text2);
}
获取客户状态信息
export async function getstatinfo(){
const info = await sdk.getValue("text_4")
console.log("客户状态",info)
}
判断首日和交定修改阶段推进
//联合判断
export async function changeStage() {
const firstVisitDateResponse = await sdk.getValue("date_5");
const depositDateResponse = await sdk.getValue("date_1");
const firstVisitDate = firstVisitDateResponse.value;
const depositDate = depositDateResponse.value;
console.log("First Visit Date: ", firstVisitDate);
console.log("Deposit Date: ", depositDate);
let stageObject = null;
// 检查 firstVisitDate 是否有值
if (firstVisitDate !== undefined && firstVisitDate !== "") {
// 如果 firstVisitDate 有值,但 depositDate 没有值
if (!depositDate || depositDate === undefined || depositDate === "" || depositDate === null) {
console.log("Setting stage to 到店客户");
stageObject = {
allowSkipStage: 0,
color: "#646566",
enable: 1,
fieldMap: [],
isOther: 0,
stageId: 2656214,
stageProcessId: 516616,
stageRatio: 0,
stageType: 0,
text: "到店客户",
value: "2"
};
}
// 如果 firstVisitDate 和 depositDate 都有值
else {
console.log("Setting stage to 定金客户");
stageObject = {
allowSkipStage: 1,
color: "#646566",
enable: 1,
isOther: 0,
stageId: 2656216,
stageProcessId: 516616,
stageRatio: 0,
stageType: 0,
text: "定金客户",
value: "4"
};
}
} else {
console.log("firstVisitDate is not set, no stage change triggered.");
}
if (stageObject !== null) {
const result = await sdk.setValue("text_18", stageObject);
console.log("Setting stage result:", result);
}
}
通过日期判断修改客户阶段
//首次到店日期触发阶段更换
export async function hdpz() {
const data_hd = {
color: "#FFC849",
text: "回单客户",
value: "10"
};
try {
const hdpz = await sdk.setValue("text_4", data_hd);
console.log("成功设置值:", hdpz);
} catch (error) {
console.error("设置值失败:", error);
}
}
//交定日期触发阶段更换
export async function djpz() {
const data_dj = {
color: "#FF8C2E",
text: "定金客户",
value: "5"
};
try {
const djpz = await sdk.setValue("text_4", data_dj);
console.log("成功设置值:", djpz);
} catch (error) {
console.error("设置值失败:", error);
}
}