|
@@ -332,12 +332,11 @@
|
|
<t-collapse-panel
|
|
<t-collapse-panel
|
|
v-if="[...prePayList.pngs].length"
|
|
v-if="[...prePayList.pngs].length"
|
|
value="0"
|
|
value="0"
|
|
- header="图元"
|
|
|
|
|
|
+ :header="data.goods[0].type"
|
|
>
|
|
>
|
|
<template #headerRightContent>
|
|
<template #headerRightContent>
|
|
<t-space size="small">
|
|
<t-space size="small">
|
|
- <t-checkbox v-model="ss">全部</t-checkbox>
|
|
|
|
- (1000个,5折)
|
|
|
|
|
|
+ <t-checkbox v-model="data.goods[0].checked"></t-checkbox>
|
|
</t-space>
|
|
</t-space>
|
|
</template>
|
|
</template>
|
|
<div v-for="pngPen in prePayList.pngs" class="pay-line">
|
|
<div v-for="pngPen in prePayList.pngs" class="pay-line">
|
|
@@ -352,71 +351,165 @@
|
|
</div>
|
|
</div>
|
|
<div>
|
|
<div>
|
|
<check-icon
|
|
<check-icon
|
|
- v-show="purchasedList.includes(pngPen)"
|
|
|
|
|
|
+ v-show="data.purchasedList.some((item) => item.name === pngPen)"
|
|
style="color: #4480f9ff"
|
|
style="color: #4480f9ff"
|
|
/>
|
|
/>
|
|
</div>
|
|
</div>
|
|
<div>
|
|
<div>
|
|
- {{ purchasedList.includes(pngPen) ? 0 : 50 }}
|
|
|
|
|
|
+ {{
|
|
|
|
+ data.purchasedList.some((item) => item.name === pngPen)
|
|
|
|
+ ? 0
|
|
|
|
+ : data.goods[0].unitPrice
|
|
|
|
+ }}
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<div class="pay-tip">
|
|
<div class="pay-tip">
|
|
- <p>已选择3个图元 小计:¥200</p>
|
|
|
|
|
|
+ <p v-if="data.goods[0].checked">
|
|
|
|
+ 已选择{{ data.goods[0].unPurchased }}个图元 小计:¥{{
|
|
|
|
+ data.goods[0].unPurchased * data.goods[0].unitPrice
|
|
|
|
+ }}
|
|
|
|
+ </p>
|
|
|
|
+ <p v-else>已选择0个图元 小计:¥0</p>
|
|
</div>
|
|
</div>
|
|
</t-collapse-panel>
|
|
</t-collapse-panel>
|
|
<t-collapse-panel
|
|
<t-collapse-panel
|
|
v-if="[...prePayList.iotPens].length"
|
|
v-if="[...prePayList.iotPens].length"
|
|
value="1"
|
|
value="1"
|
|
- header="控件"
|
|
|
|
|
|
+ :header="data.goods[1].type"
|
|
>
|
|
>
|
|
<template #headerRightContent>
|
|
<template #headerRightContent>
|
|
<t-space size="small">
|
|
<t-space size="small">
|
|
- <t-checkbox v-model="ss">全部</t-checkbox>
|
|
|
|
- (1000个,5折)
|
|
|
|
|
|
+ <t-checkbox v-model="data.goods[1].checked"></t-checkbox>
|
|
</t-space>
|
|
</t-space>
|
|
</template>
|
|
</template>
|
|
<div v-for="iotPen in prePayList.iotPens" class="pay-line">
|
|
<div v-for="iotPen in prePayList.iotPens" class="pay-line">
|
|
<div>
|
|
<div>
|
|
<svg class="l-icon" aria-hidden="true">
|
|
<svg class="l-icon" aria-hidden="true">
|
|
- <use :xlink:href="'#' + iotPensMap[iotPen].icon"></use>
|
|
|
|
|
|
+ <use :xlink:href="'#' + iotPensMap[iotPen]?.icon"></use>
|
|
</svg>
|
|
</svg>
|
|
- {{ iotPensMap[iotPen].name }}
|
|
|
|
|
|
+ {{ iotPensMap[iotPen]?.name || iotPen }}
|
|
</div>
|
|
</div>
|
|
<div>
|
|
<div>
|
|
<check-icon
|
|
<check-icon
|
|
- v-show="purchasedList.includes(iotPen)"
|
|
|
|
|
|
+ v-show="data.purchasedList.some((item) => item.name === iotPen)"
|
|
style="color: #4480f9ff"
|
|
style="color: #4480f9ff"
|
|
/>
|
|
/>
|
|
</div>
|
|
</div>
|
|
- <div>{{ purchasedList.includes(iotPen) ? 0 : 70 }}</div>
|
|
|
|
|
|
+ <div>
|
|
|
|
+ {{
|
|
|
|
+ data.purchasedList.some((item) => item.name === iotPen)
|
|
|
|
+ ? 0
|
|
|
|
+ : data.goods[1].unitPrice
|
|
|
|
+ }}
|
|
|
|
+ </div>
|
|
</div>
|
|
</div>
|
|
<div class="pay-tip">
|
|
<div class="pay-tip">
|
|
- <p>已选择3个图元 小计:¥200</p>
|
|
|
|
|
|
+ <p v-if="data.goods[1].checked">
|
|
|
|
+ 已选择{{ data.goods[1].unPurchased }}个图元 小计:¥{{
|
|
|
|
+ data.goods[1].unPurchased * data.goods[1].unitPrice
|
|
|
|
+ }}
|
|
|
|
+ </p>
|
|
|
|
+ <p v-else>已选择0个图元 小计:¥0</p>
|
|
|
|
+ </div>
|
|
|
|
+ </t-collapse-panel>
|
|
|
|
+ <t-collapse-panel
|
|
|
|
+ v-if="[...prePayList.svgPens].length"
|
|
|
|
+ value="2"
|
|
|
|
+ :header="data.goods[2].type"
|
|
|
|
+ >
|
|
|
|
+ <template #headerRightContent>
|
|
|
|
+ <t-space size="small">
|
|
|
|
+ <t-checkbox v-model="data.goods[2].checked"></t-checkbox>
|
|
|
|
+ </t-space>
|
|
|
|
+ </template>
|
|
|
|
+ <template v-if="data.goods[2].count === data.goods[2].total">
|
|
|
|
+ <div>
|
|
|
|
+ 1套({{
|
|
|
|
+ data.goods[2].count
|
|
|
|
+ }}个)。【说明】检查到当前项目为老版本格式,需要购买整套SVG线性图元。
|
|
|
|
+ </div>
|
|
|
|
+ <div>
|
|
|
|
+ <check-icon
|
|
|
|
+ v-show="data.goods[2].unPurchased === 0"
|
|
|
|
+ style="color: #4480f9ff"
|
|
|
|
+ />
|
|
|
|
+ </div>
|
|
|
|
+ </template>
|
|
|
|
+ <template v-else>
|
|
|
|
+ <div v-for="svgPen in prePayList.svgPens" class="pay-line">
|
|
|
|
+ <div>
|
|
|
|
+ <t-image
|
|
|
|
+ class="pay-svg"
|
|
|
|
+ :src="svgPen"
|
|
|
|
+ :lazy="true"
|
|
|
|
+ fit="contain"
|
|
|
|
+ />
|
|
|
|
+ {{
|
|
|
|
+ svgPen.slice(
|
|
|
|
+ svgPen.lastIndexOf('/') + 1,
|
|
|
|
+ svgPen.lastIndexOf('.')
|
|
|
|
+ )
|
|
|
|
+ }}
|
|
|
|
+ </div>
|
|
|
|
+ <div>
|
|
|
|
+ <check-icon
|
|
|
|
+ v-show="
|
|
|
|
+ data.purchasedList.some((item) => item.name === svgPen)
|
|
|
|
+ "
|
|
|
|
+ style="color: #4480f9ff"
|
|
|
|
+ />
|
|
|
|
+ </div>
|
|
|
|
+ <div>
|
|
|
|
+ {{
|
|
|
|
+ data.purchasedList.some((item) => item.name === svgPen)
|
|
|
|
+ ? 0
|
|
|
|
+ : data.goods[2].unitPrice
|
|
|
|
+ }}
|
|
|
|
+ </div>
|
|
|
|
+ </div>
|
|
|
|
+ </template>
|
|
|
|
+ <div class="pay-tip">
|
|
|
|
+ <p v-if="data.goods[2].checked">
|
|
|
|
+ 已选择{{ data.goods[2].unPurchased }}个图元 小计:¥{{
|
|
|
|
+ data.goods[2].unPurchased * data.goods[2].unitPrice
|
|
|
|
+ }}
|
|
|
|
+ </p>
|
|
|
|
+ <p v-else>已选择0个图元 小计:¥0</p>
|
|
</div>
|
|
</div>
|
|
</t-collapse-panel>
|
|
</t-collapse-panel>
|
|
<t-collapse-panel
|
|
<t-collapse-panel
|
|
v-if="[...prePayList.jsPens].length"
|
|
v-if="[...prePayList.jsPens].length"
|
|
value="3"
|
|
value="3"
|
|
- header="js图元"
|
|
|
|
|
|
+ :header="data.goods[3].type"
|
|
>
|
|
>
|
|
<template #headerRightContent>
|
|
<template #headerRightContent>
|
|
<t-space size="small">
|
|
<t-space size="small">
|
|
- <t-checkbox v-model="ss">全部</t-checkbox>
|
|
|
|
- (1000个,5折)
|
|
|
|
|
|
+ <t-checkbox v-model="data.goods[3].checked"></t-checkbox>
|
|
</t-space>
|
|
</t-space>
|
|
</template>
|
|
</template>
|
|
<div v-for="jsPen in prePayList.jsPens" class="pay-line">
|
|
<div v-for="jsPen in prePayList.jsPens" class="pay-line">
|
|
- <div>{{ jsPen }}</div>
|
|
|
|
|
|
+ <div style="margin-left: 16px">{{ jsPen }}</div>
|
|
<div>
|
|
<div>
|
|
<check-icon
|
|
<check-icon
|
|
- v-show="purchasedList.includes(jsPen)"
|
|
|
|
|
|
+ v-show="data.purchasedList.some((item) => item.name === jsPen)"
|
|
style="color: #4480f9ff"
|
|
style="color: #4480f9ff"
|
|
/>
|
|
/>
|
|
</div>
|
|
</div>
|
|
- <div>{{ purchasedList.includes(jsPen) ? 0 : 70 }}</div>
|
|
|
|
|
|
+ <div>
|
|
|
|
+ {{
|
|
|
|
+ data.purchasedList.some((item) => item.name === jsPen)
|
|
|
|
+ ? 0
|
|
|
|
+ : data.goods[3].unitPrice
|
|
|
|
+ }}
|
|
|
|
+ </div>
|
|
</div>
|
|
</div>
|
|
<div class="pay-tip">
|
|
<div class="pay-tip">
|
|
- <p>已选择3个图元 小计:¥200</p>
|
|
|
|
|
|
+ <p v-if="data.goods[3].checked">
|
|
|
|
+ 已选择{{ data.goods[3].unPurchased }}个图元 小计:¥{{
|
|
|
|
+ data.goods[3].unPurchased * data.goods[3].unitPrice
|
|
|
|
+ }}
|
|
|
|
+ </p>
|
|
|
|
+ <p v-else>已选择0个图元 小计:¥0</p>
|
|
</div>
|
|
</div>
|
|
</t-collapse-panel>
|
|
</t-collapse-panel>
|
|
</t-collapse>
|
|
</t-collapse>
|
|
@@ -424,9 +517,9 @@
|
|
<div class="flex pay-footer">
|
|
<div class="flex pay-footer">
|
|
<p>企业图形库购买一次,永久使用</p>
|
|
<p>企业图形库购买一次,永久使用</p>
|
|
<div class="flex pay-price">
|
|
<div class="flex pay-price">
|
|
- 共100个图元,合计
|
|
|
|
|
|
+ 共{{ finalPrice.total }}个图元,合计
|
|
<p>¥</p>
|
|
<p>¥</p>
|
|
- <p>{{ payPrice }}</p>
|
|
|
|
|
|
+ <p>{{ finalPrice.price }}</p>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</t-dialog>
|
|
</t-dialog>
|
|
@@ -452,7 +545,14 @@
|
|
</template>
|
|
</template>
|
|
|
|
|
|
<script lang="ts" setup>
|
|
<script lang="ts" setup>
|
|
-import { reactive, ref, onBeforeMount, onUnmounted, nextTick } from 'vue';
|
|
|
|
|
|
+import {
|
|
|
|
+ reactive,
|
|
|
|
+ ref,
|
|
|
|
+ onBeforeMount,
|
|
|
|
+ onUnmounted,
|
|
|
|
+ nextTick,
|
|
|
|
+ computed,
|
|
|
|
+} from 'vue';
|
|
import { useRouter, useRoute } from 'vue-router';
|
|
import { useRouter, useRoute } from 'vue-router';
|
|
import { useUser } from '@/services/user';
|
|
import { useUser } from '@/services/user';
|
|
import { MessagePlugin } from 'tdesign-vue-next';
|
|
import { MessagePlugin } from 'tdesign-vue-next';
|
|
@@ -501,6 +601,7 @@ import {
|
|
getComponentPurchased,
|
|
getComponentPurchased,
|
|
get2dComponentJs,
|
|
get2dComponentJs,
|
|
getTemPngs,
|
|
getTemPngs,
|
|
|
|
+ getGoods,
|
|
} from '@/services/download';
|
|
} from '@/services/download';
|
|
import { formComponents } from '@/services/defaults';
|
|
import { formComponents } from '@/services/defaults';
|
|
import WechatPay from './WechatPay.vue';
|
|
import WechatPay from './WechatPay.vue';
|
|
@@ -521,6 +622,8 @@ const data = reactive({
|
|
codeUrl: '',
|
|
codeUrl: '',
|
|
id: '', //订单id
|
|
id: '', //订单id
|
|
},
|
|
},
|
|
|
|
+ goods: [], //所有商品类型
|
|
|
|
+ purchasedList: [], //已经购买的列表
|
|
});
|
|
});
|
|
|
|
|
|
onBeforeMount(async () => {
|
|
onBeforeMount(async () => {
|
|
@@ -547,12 +650,13 @@ const prePayList = reactive({
|
|
pngs: new Set<string>(),
|
|
pngs: new Set<string>(),
|
|
jsPens: new Set<string>(),
|
|
jsPens: new Set<string>(),
|
|
iotPens: new Set<string>(),
|
|
iotPens: new Set<string>(),
|
|
|
|
+ svgPens: new Set<string>(),
|
|
});
|
|
});
|
|
let payListNum = 0;
|
|
let payListNum = 0;
|
|
let comparePayListNum = 0;
|
|
let comparePayListNum = 0;
|
|
-let purchasedList = []; //已购买列表
|
|
|
|
|
|
+// let purchasedList = []; //已购买列表
|
|
const iotPensMap = {};
|
|
const iotPensMap = {};
|
|
-const payPrice = ref(0);
|
|
|
|
|
|
+// const payPrice = ref(0);
|
|
|
|
|
|
const getIotPensMap = () => {
|
|
const getIotPensMap = () => {
|
|
formComponents.forEach((item) => {
|
|
formComponents.forEach((item) => {
|
|
@@ -586,7 +690,6 @@ const dealWithMessage = async (e) => {
|
|
saveDownload();
|
|
saveDownload();
|
|
}
|
|
}
|
|
} else if (data.name === 'payList') {
|
|
} else if (data.name === 'payList') {
|
|
- console.log('data.data', data);
|
|
|
|
prePayList.pngs = new Set([...prePayList.pngs, ...data.data.pngs]);
|
|
prePayList.pngs = new Set([...prePayList.pngs, ...data.data.pngs]);
|
|
prePayList.jsPens = new Set([
|
|
prePayList.jsPens = new Set([
|
|
...prePayList.jsPens,
|
|
...prePayList.jsPens,
|
|
@@ -596,14 +699,18 @@ const dealWithMessage = async (e) => {
|
|
...prePayList.iotPens,
|
|
...prePayList.iotPens,
|
|
...data.data.iotPens,
|
|
...data.data.iotPens,
|
|
]);
|
|
]);
|
|
|
|
+ prePayList.svgPens = new Set([
|
|
|
|
+ ...prePayList.svgPens,
|
|
|
|
+ ...data.data.svgPens,
|
|
|
|
+ ]);
|
|
|
|
|
|
comparePayListNum += 1;
|
|
comparePayListNum += 1;
|
|
if (comparePayListNum >= payListNum) {
|
|
if (comparePayListNum >= payListNum) {
|
|
- console.log('进入');
|
|
|
|
if (
|
|
if (
|
|
![...prePayList.pngs].length &&
|
|
![...prePayList.pngs].length &&
|
|
![...prePayList.jsPens].length &&
|
|
![...prePayList.jsPens].length &&
|
|
- ![...prePayList.iotPens].length
|
|
|
|
|
|
+ ![...prePayList.iotPens].length &&
|
|
|
|
+ ![...prePayList.svgPens].length
|
|
) {
|
|
) {
|
|
//直接下载
|
|
//直接下载
|
|
preDownload(meta2d.data());
|
|
preDownload(meta2d.data());
|
|
@@ -947,11 +1054,10 @@ const downloadHtml = async () => {
|
|
//图形库需要购买
|
|
//图形库需要购买
|
|
const meta2dData = meta2d.data();
|
|
const meta2dData = meta2d.data();
|
|
let list = getPayList(meta2dData);
|
|
let list = getPayList(meta2dData);
|
|
- console.log('list', list);
|
|
|
|
prePayList.pngs = new Set(list.pngs);
|
|
prePayList.pngs = new Set(list.pngs);
|
|
prePayList.jsPens = new Set(list.jsPens);
|
|
prePayList.jsPens = new Set(list.jsPens);
|
|
prePayList.iotPens = new Set(list.iotPens);
|
|
prePayList.iotPens = new Set(list.iotPens);
|
|
-
|
|
|
|
|
|
+ prePayList.svgPens = new Set(list.svgPens);
|
|
//向iframe发送消息
|
|
//向iframe发送消息
|
|
payListNum = 0;
|
|
payListNum = 0;
|
|
comparePayListNum = 0;
|
|
comparePayListNum = 0;
|
|
@@ -978,13 +1084,17 @@ const downloadHtml = async () => {
|
|
}),
|
|
}),
|
|
'*'
|
|
'*'
|
|
);
|
|
);
|
|
- console.log('发送消息');
|
|
|
|
payListNum += 1;
|
|
payListNum += 1;
|
|
});
|
|
});
|
|
}
|
|
}
|
|
if (payListNum === 0) {
|
|
if (payListNum === 0) {
|
|
//无嵌入页面
|
|
//无嵌入页面
|
|
- if (!list.pngs.length && !list.jsPens.length && !list.iotPens.length) {
|
|
|
|
|
|
+ if (
|
|
|
|
+ !list.pngs.length &&
|
|
|
|
+ !list.jsPens.length &&
|
|
|
|
+ !list.iotPens.length &&
|
|
|
|
+ !list.svgPens.length
|
|
|
|
+ ) {
|
|
preDownload(meta2dData);
|
|
preDownload(meta2dData);
|
|
} else {
|
|
} else {
|
|
await showPayListDialog();
|
|
await showPayListDialog();
|
|
@@ -993,18 +1103,52 @@ const downloadHtml = async () => {
|
|
};
|
|
};
|
|
|
|
|
|
const showPayListDialog = async () => {
|
|
const showPayListDialog = async () => {
|
|
- console.log('prePayList', prePayList);
|
|
|
|
- let purchased = await getComponentPurchased(prePayList);
|
|
|
|
- console.log(purchased);
|
|
|
|
- if (purchased.price) {
|
|
|
|
- purchasedList = purchased.list;
|
|
|
|
- payPrice.value = purchased.price;
|
|
|
|
- payListDialog.show = true;
|
|
|
|
- } else {
|
|
|
|
- //价格为0,直接下载
|
|
|
|
- preDownload(meta2d.data());
|
|
|
|
|
|
+ data.goods = await getGoods();
|
|
|
|
+ data.purchasedList = await getComponentPurchased(prePayList);
|
|
|
|
+ data.goods.forEach((item, index) => {
|
|
|
|
+ item.checked = true;
|
|
|
|
+ let purchased = data.purchasedList?.filter(
|
|
|
|
+ (_item) => _item.type === item.type
|
|
|
|
+ );
|
|
|
|
+ if (index === 0) {
|
|
|
|
+ item.total = [...prePayList.pngs].length;
|
|
|
|
+ item.unPurchased = item.total - purchased.length;
|
|
|
|
+ } else if (index === 1) {
|
|
|
|
+ item.total = [...prePayList.iotPens].length;
|
|
|
|
+ item.unPurchased = item.total - purchased.length;
|
|
|
|
+ } else if (index === 3) {
|
|
|
|
+ item.total = [...prePayList.jsPens].length;
|
|
|
|
+ item.unPurchased = item.total - purchased.length;
|
|
|
|
+ } else if (index === 2) {
|
|
|
|
+ if (purchased.length === 1 && !purchased[0].name) {
|
|
|
|
+ //说明已经购买全部 //TODO
|
|
|
|
+ item.total = item.count;
|
|
|
|
+ item.unPurchased = 0;
|
|
|
|
+ } else {
|
|
|
|
+ //需要购买全部
|
|
|
|
+ if ([...prePayList.svgPens].includes('*')) {
|
|
|
|
+ item.total = item.count;
|
|
|
|
+ item.unPurchased = item.total;
|
|
|
|
+ } else {
|
|
|
|
+ item.total = [...prePayList.svgPens].length;
|
|
|
|
+ item.unPurchased = item.total - purchased.length;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ });
|
|
|
|
+ let price = 0;
|
|
|
|
+ data.goods.forEach((item, index) => {
|
|
|
|
+ if (item.checked) {
|
|
|
|
+ price += item.unPurchased * item.unitPrice;
|
|
|
|
+ }
|
|
|
|
+ });
|
|
|
|
+ if(price===0){
|
|
|
|
+ skipPay();//如果计算价格为0,直接下载
|
|
|
|
+ }else{
|
|
|
|
+ payListDialog.show = true;
|
|
}
|
|
}
|
|
};
|
|
};
|
|
|
|
+
|
|
const preDownload = (meta2dData: any) => {
|
|
const preDownload = (meta2dData: any) => {
|
|
MessagePlugin.info('正在下载打包中,可能需要几分钟,请耐心等待...');
|
|
MessagePlugin.info('正在下载打包中,可能需要几分钟,请耐心等待...');
|
|
iframeNum = 0;
|
|
iframeNum = 0;
|
|
@@ -1146,27 +1290,64 @@ const saveDownload = async () => {
|
|
const list = [...downloadList];
|
|
const list = [...downloadList];
|
|
//控件
|
|
//控件
|
|
const js = await get2dComponentJs([...prePayList.iotPens]);
|
|
const js = await get2dComponentJs([...prePayList.iotPens]);
|
|
- // let o=window.dc;
|
|
|
|
- // let e=window.mk;
|
|
|
|
- // let uncodeJs = o(e(user.id), js);
|
|
|
|
- // console.log('uncodeJs',uncodeJs);
|
|
|
|
- ///png图形库
|
|
|
|
- const pngs = await getTemPngs([...prePayList.pngs]);
|
|
|
|
list.push({
|
|
list.push({
|
|
data: js,
|
|
data: js,
|
|
- path: '/view/js/2.text',
|
|
|
|
|
|
+ path: '/view/js/2d-components.js',
|
|
});
|
|
});
|
|
|
|
+
|
|
|
|
+ ///png图形库
|
|
|
|
+ const pngs = await getTemPngs([...prePayList.pngs]);
|
|
list.forEach((item) => {
|
|
list.forEach((item) => {
|
|
if (pngs[item.url]) {
|
|
if (pngs[item.url]) {
|
|
item.url = pngs[item.url];
|
|
item.url = pngs[item.url];
|
|
}
|
|
}
|
|
});
|
|
});
|
|
- console.log('down', list);
|
|
|
|
|
|
+ //js线性图元 由对应页面处理
|
|
|
|
|
|
- //iot 2d-component重写
|
|
|
|
- //pngs 替换图片请求地址
|
|
|
|
- //js ?
|
|
|
|
- // return;
|
|
|
|
|
|
+ //SVG线性图元
|
|
|
|
+ if ([...prePayList.svgPens].length) {
|
|
|
|
+ let purchased = data.purchasedList?.filter(
|
|
|
|
+ (_item) => _item.type === 'SVG线性图元'
|
|
|
|
+ );
|
|
|
|
+ if (purchased.length === 1 && !purchased[0].name) {
|
|
|
|
+ //已经购买全部
|
|
|
|
+ list.forEach((item) => {
|
|
|
|
+ if (item.data && item.path.indexOf('/projects/v') !== 1) {
|
|
|
|
+ //清空所有svgpath
|
|
|
|
+ let meta2dData = JSON.parse(item.data);
|
|
|
|
+ for (let key of Object.keys(meta2dData.paths)) {
|
|
|
|
+ let path = meta2dData.paths[key];
|
|
|
|
+ if (
|
|
|
|
+ path.indexOf('-1.18Zm4-1') !== -1 ||
|
|
|
|
+ path.indexOf('-1.19Zm4-1') !== -1 ||
|
|
|
|
+ path.indexOf('2.85ZM') !== -1 ||
|
|
|
|
+ path.indexOf('-1-2.39.3') !== -1
|
|
|
|
+ ) {
|
|
|
|
+ meta2dData.paths[key] = '';
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ item.data = JSON.stringify(meta2dData);
|
|
|
|
+ }
|
|
|
|
+ });
|
|
|
|
+ } else {
|
|
|
|
+ list.forEach((item) => {
|
|
|
|
+ if (item.data && item.path.indexOf('/projects/v') !== 1) {
|
|
|
|
+ //2d 图纸数据
|
|
|
|
+ let meta2dData = JSON.parse(item.data);
|
|
|
|
+ meta2dData.pens.forEach((pen) => {
|
|
|
|
+ if (pen.name === 'svgPath' && pen.svgUrl) {
|
|
|
|
+ if ([...prePayList.svgPens].includes(pen.svgUrl)) {
|
|
|
|
+ pen.pathId = null;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ });
|
|
|
|
+ item.data = JSON.stringify(meta2dData);
|
|
|
|
+ }
|
|
|
|
+ });
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ //开始下载list
|
|
const [{ default: JSZip }, { saveAs }] = await Promise.all([
|
|
const [{ default: JSZip }, { saveAs }] = await Promise.all([
|
|
import('jszip'),
|
|
import('jszip'),
|
|
import('file-saver'),
|
|
import('file-saver'),
|
|
@@ -1731,13 +1912,46 @@ const payListDialog = reactive({
|
|
});
|
|
});
|
|
|
|
|
|
const prePay = async () => {
|
|
const prePay = async () => {
|
|
- //预支付 //TODO: 这个可以发送已经购买的图元吗
|
|
|
|
|
|
+ let list = [];
|
|
|
|
+
|
|
|
|
+ data.goods[0].checked &&
|
|
|
|
+ prePayList.pngs.forEach((item) => {
|
|
|
|
+ list.push({
|
|
|
|
+ type: '图片图元',
|
|
|
|
+ name: item,
|
|
|
|
+ });
|
|
|
|
+ });
|
|
|
|
+ data.goods[3].checked &&
|
|
|
|
+ prePayList.jsPens.forEach((item) => {
|
|
|
|
+ list.push({
|
|
|
|
+ type: 'JS线性图元',
|
|
|
|
+ name: item,
|
|
|
|
+ });
|
|
|
|
+ });
|
|
|
|
+ data.goods[1].checked &&
|
|
|
|
+ prePayList.iotPens.forEach((item) => {
|
|
|
|
+ list.push({
|
|
|
|
+ type: '控件',
|
|
|
|
+ name: item,
|
|
|
|
+ });
|
|
|
|
+ });
|
|
|
|
+ if (data.goods[2].checked) {
|
|
|
|
+ if ([...prePayList.svgPens].includes('*')) {
|
|
|
|
+ _list.push({
|
|
|
|
+ type: 'SVG线性图元',
|
|
|
|
+ });
|
|
|
|
+ } else {
|
|
|
|
+ prePayList.svgPens.forEach((item) => {
|
|
|
|
+ list.push({
|
|
|
|
+ type: 'SVG线性图元',
|
|
|
|
+ name: item,
|
|
|
|
+ });
|
|
|
|
+ });
|
|
|
|
+ }
|
|
|
|
+ }
|
|
const res: any = await axios.post('/api/order/2d/component/submit', {
|
|
const res: any = await axios.post('/api/order/2d/component/submit', {
|
|
- pngs: [...prePayList.pngs],
|
|
|
|
- jsPens: [...prePayList.jsPens],
|
|
|
|
- iotPens: [...prePayList.iotPens],
|
|
|
|
|
|
+ list,
|
|
});
|
|
});
|
|
- console.log('res', res);
|
|
|
|
wechatPayDialog.show = true;
|
|
wechatPayDialog.show = true;
|
|
data.order = res;
|
|
data.order = res;
|
|
};
|
|
};
|
|
@@ -1748,7 +1962,6 @@ const skipPay = () => {
|
|
};
|
|
};
|
|
|
|
|
|
const finishPay = async () => {
|
|
const finishPay = async () => {
|
|
- console.log('进入');
|
|
|
|
let id = data.order.id;
|
|
let id = data.order.id;
|
|
const result: { state: number } = await axios.post('/api/order/pay/state', {
|
|
const result: { state: number } = await axios.post('/api/order/pay/state', {
|
|
id,
|
|
id,
|
|
@@ -1764,6 +1977,21 @@ const finishPay = async () => {
|
|
}
|
|
}
|
|
};
|
|
};
|
|
|
|
|
|
|
|
+const finalPrice = computed(() => {
|
|
|
|
+ let total = 0;
|
|
|
|
+ let price = 0;
|
|
|
|
+ data.goods.forEach((item, index) => {
|
|
|
|
+ if (item.checked) {
|
|
|
|
+ total += item.unPurchased;
|
|
|
|
+ price += item.unPurchased * item.unitPrice;
|
|
|
|
+ }
|
|
|
|
+ });
|
|
|
|
+ return {
|
|
|
|
+ total,
|
|
|
|
+ price,
|
|
|
|
+ };
|
|
|
|
+});
|
|
|
|
+
|
|
const wechatPayDialog = reactive({
|
|
const wechatPayDialog = reactive({
|
|
show: false,
|
|
show: false,
|
|
});
|
|
});
|
|
@@ -1866,6 +2094,11 @@ const onSuccess = (success: boolean) => {
|
|
height: 40px;
|
|
height: 40px;
|
|
margin-top: 7px;
|
|
margin-top: 7px;
|
|
}
|
|
}
|
|
|
|
+ :deep(.pay-svg) {
|
|
|
|
+ .t-image {
|
|
|
|
+ background: #fff;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
.l-icon {
|
|
.l-icon {
|
|
width: 40px;
|
|
width: 40px;
|
|
height: 40px;
|
|
height: 40px;
|
|
@@ -1886,6 +2119,7 @@ const onSuccess = (success: boolean) => {
|
|
p {
|
|
p {
|
|
position: absolute;
|
|
position: absolute;
|
|
right: 16px;
|
|
right: 16px;
|
|
|
|
+ color: var(--color-desc);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
.pay-footer {
|
|
.pay-footer {
|