tempPuhs
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
<template>
|
||||
<view class="result-container">
|
||||
<el-button type="primary" @click="handleGetPrice">获取价格</el-button>
|
||||
<el-input type="textarea" style="width: 400px; height: 400px" rows="10" resize="none" readonly></el-input>
|
||||
<el-input v-model="priceReulst" type="textarea" style="width: 400px; height: 400px" rows="10" resize="none" readonly></el-input>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
@@ -15,11 +15,22 @@ const props = defineProps({
|
||||
type: Object,
|
||||
required: true,
|
||||
},
|
||||
numberUnit: {
|
||||
type: String,
|
||||
default: "个",
|
||||
},
|
||||
sizeUnit: {
|
||||
type: String,
|
||||
default: "cm",
|
||||
},
|
||||
});
|
||||
|
||||
const priceReulst = ref("");
|
||||
|
||||
const emits = defineEmits(["verifyCraftData"]);
|
||||
|
||||
const handleGetPrice = () => {
|
||||
priceReulst.value = "";
|
||||
emits("verifyCraftData", (result) => {
|
||||
let { valid, message } = result;
|
||||
if (!valid) {
|
||||
@@ -31,7 +42,29 @@ const handleGetPrice = () => {
|
||||
return;
|
||||
}
|
||||
getProductPrice(props.data).then((res) => {
|
||||
console.log(res);
|
||||
let { code, data, msg } = res;
|
||||
if (code === 200) {
|
||||
let result = "";
|
||||
let resultList = [];
|
||||
resultList.push(props.data.product);
|
||||
resultList.push(props.data.material);
|
||||
resultList.push(`${props.data.length}*${props.data.width}${props.sizeUnit}`);
|
||||
result = resultList.join("-") + "\n";
|
||||
|
||||
if (props.data.crafts && props.data.crafts.length > 0) {
|
||||
result += "工艺:";
|
||||
resultList = [];
|
||||
props.data.crafts.forEach((craft) => {
|
||||
resultList.push(`${craft.text}`);
|
||||
});
|
||||
result += resultList.join(",") + "\n";
|
||||
}
|
||||
data.forEach((item) => {
|
||||
result += `${props.data.number}款 ${item.count}${props.numberUnit},共${item.price}元\n`;
|
||||
});
|
||||
result += "包邮,免费设计呢~(偏远地区需补邮费)";
|
||||
priceReulst.value = result;
|
||||
}
|
||||
});
|
||||
});
|
||||
};
|
||||
|
||||
@@ -217,6 +217,7 @@ const handleDataInfo = () => {
|
||||
if (opt.checked) {
|
||||
item.type = opt.label;
|
||||
item.value = opt.value;
|
||||
let text = opt.value;
|
||||
if (opt.children) {
|
||||
let childItem = {};
|
||||
item.children = [];
|
||||
@@ -229,11 +230,19 @@ const handleDataInfo = () => {
|
||||
});
|
||||
item.children.push(childItem);
|
||||
}
|
||||
if(text == "配刮刮膜" || text == "粘刮刮膜"){
|
||||
text += `(${item.children[0].size})`
|
||||
}
|
||||
if(text == "内部模切"){
|
||||
text += `(${item.children[0].count}个 ${item.children[0].width}*${item.children[0].length}cm)`
|
||||
}
|
||||
item.text = text;
|
||||
}
|
||||
datainfo.push(item);
|
||||
});
|
||||
}
|
||||
});
|
||||
console.log("🚀 ~ handleDataInfo ~ datainfo:", datainfo);
|
||||
|
||||
emits("update:modelValue", datainfo);
|
||||
};
|
||||
@@ -241,7 +250,7 @@ const handleDataInfo = () => {
|
||||
const verifyCraftData = () => {
|
||||
// 验证工艺数据的完整性和正确性
|
||||
|
||||
return { valid: false, message: "工艺数据验证失败" };
|
||||
return { valid: true, message: "工艺数据验证失败" };
|
||||
};
|
||||
handleDataInfo();
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { ref, watch, defineEmits, defineProps } from "vue";
|
||||
import { ref } from "vue";
|
||||
import ProductCraft from "@/components/ProductCraft";
|
||||
|
||||
const defaultCraftData = ref([
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { ref, watch, defineEmits, defineProps } from "vue";
|
||||
import { ref } from "vue";
|
||||
import ProductCraft from "@/components/ProductCraft";
|
||||
|
||||
const defaultCraftData = ref([
|
||||
|
||||
@@ -159,6 +159,7 @@ const componentRef = ref(null);
|
||||
const images = ref([]);
|
||||
const remark = ref("");
|
||||
const data = ref({
|
||||
product: "不干胶",
|
||||
types: "常用种类",
|
||||
material: "",
|
||||
length: null,
|
||||
@@ -180,6 +181,7 @@ watch(
|
||||
|
||||
const handleChange = (val) => {
|
||||
const initData = {
|
||||
product: "不干胶",
|
||||
types: val,
|
||||
material: "",
|
||||
length: null,
|
||||
|
||||
Reference in New Issue
Block a user