提交 476c1ec3 authored 作者: 刘旭's avatar 刘旭

解决报价相同bug

上级 e94ea407
...@@ -54,15 +54,15 @@ ...@@ -54,15 +54,15 @@
{{ item_value.name }} {{ item_value.name }}
</view> </view>
<u-input v-if="item.isPlus && item.isCustom" style="width: 170rpx;" <u-input v-if="item.isPlus && item.isCustom" style="width: 170rpx;"
v-model="item.custom" placeholder="自定义规格" placeholder-style="font-size: 12px" v-model="item.custom" placeholder="定制属性" placeholder-style="font-size: 12px"
type="text" border-color="#f4f4f4" height="50" clearable border focus type="text" border-color="#f4f4f4" height="50" clearable border
@blur="onBlur($event, index1)" @confirm="onConfirm($event, index1)" /> @blur="onBlur($event, index1)" @confirm="onConfirm($event, index1)" />
</view> </view>
<!-- <view v-if="item.isPlus && item.isCustom"> <!-- <view v-if="item.isPlus && item.isCustom">
<u-icon name="plus-circle" color="#999" size="36" @click="onPlus(index1)"></u-icon> <u-icon name="plus-circle" color="#999" size="36" @click="onPlus(index1)"></u-icon>
</view> </view>
<view v-if="!item.isPlus && item.isCustom" style="margin-bottom: 12rpx; width: 200rpx;"> <view v-if="!item.isPlus && item.isCustom" style="margin-bottom: 12rpx; width: 200rpx;">
<u-input v-model="item.custom" placeholder="自定义规格" type="text" <u-input v-model="item.custom" placeholder="定制属性" type="text"
border-color="#2979ff" height="50" clearable border focus border-color="#2979ff" height="50" clearable border focus
@blur="onBlur($event, index1)" @confirm="onConfirm($event, index1)" /> @blur="onBlur($event, index1)" @confirm="onConfirm($event, index1)" />
</view> --> </view> -->
......
...@@ -268,6 +268,8 @@ let togoods = (data: any) => { ...@@ -268,6 +268,8 @@ let togoods = (data: any) => {
sku: data.specifications, sku: data.specifications,
num: data.number num: data.number
}, },
partIds: data.partIds,
partList: data.partList,
isDefaultSku: true isDefaultSku: true
}) })
} }
......
...@@ -74,7 +74,7 @@ let onConfirm = (val: string, index: number) => { ...@@ -74,7 +74,7 @@ let onConfirm = (val: string, index: number) => {
let selectParts = (data: any) => { let selectParts = (data: any) => {
let index = partsIds.value.indexOf(data.id) let index = partsIds.value.indexOf(data.id)
if (index === -1) { if (index === -1) {
if (data.show = true) partsIds.value.push(data.id) if (data.show) partsIds.value.push(data.id)
} else partsIds.value.splice(index, 1) } else partsIds.value.splice(index, 1)
} }
......
...@@ -101,7 +101,7 @@ const specStore = useSpecStore() ...@@ -101,7 +101,7 @@ const specStore = useSpecStore()
const goodsSkuRef = ref() const goodsSkuRef = ref()
const attrPopup = ref(false); const attrPopup = ref(false);
const detailData: any = ref(); const detailData: any = ref();
const partsData = ref(); const partsData = ref([] as any);
const tabButtons = ref(['商品详情']); const tabButtons = ref(['商品详情']);
let current = ref(0); let current = ref(0);
let attributeData = ref([] as any) let attributeData = ref([] as any)
...@@ -233,10 +233,19 @@ const buttonClick = () => { ...@@ -233,10 +233,19 @@ const buttonClick = () => {
// 如果从购物车来的,即存有默认值,需赋值到sku // 如果从购物车来的,即存有默认值,需赋值到sku
if (specStore.isDefaultSku) { if (specStore.isDefaultSku) {
goodsSkuRef.value.defaultSelect = specStore.defaultSelect goodsSkuRef.value.defaultSelect = specStore.defaultSelect
specStore.$patch({ if (specStore.partIds.length > 0) {
defaultSelect: {}, setTimeout(() => {
isDefaultSku: false partsData.value.forEach((item: any) => {
}) console.log(item.id, specStore.partIds);
if (specStore.partIds.indexOf(item.id) !== -1) {
item.show = true
}
});
goodsSkuRef.value.partsIds = specStore.partIds
specStore.$reset() // 重置数据
}, 100);
} else specStore.$reset() // 重置数据
} else resultSku() } else resultSku()
goodsSkuRef.value.init(detailData.value, detailId.value, partsData.value) goodsSkuRef.value.init(detailData.value, detailId.value, partsData.value)
goodsSkuRef.value.skuKey = true goodsSkuRef.value.skuKey = true
......
...@@ -17,7 +17,7 @@ ...@@ -17,7 +17,7 @@
item.iconUrl.split('http').length > 1 item.iconUrl.split('http').length > 1
? item.iconUrl ? item.iconUrl
: baseUrl + item.iconUrl : baseUrl + item.iconUrl
" :size="50"></u-icon> " :size="60"></u-icon>
<view class="grid-text">{{ item.name }}</view> <view class="grid-text">{{ item.name }}</view>
</u-grid-item> </u-grid-item>
</block> </block>
......
...@@ -111,15 +111,6 @@ let download = () => { ...@@ -111,15 +111,6 @@ let download = () => {
// }); // });
}; };
// 获取下载pdf信息
// let initPdf = (orderId: number) => {
// getOrderPdf({ orderId }).then((res: any) => {
// if (res.data.code === 200) {
// console.log(res, 'pdf');
// }
// });
// };
onBackPress((options: any) => { onBackPress((options: any) => {
if (options.from === 'navigateBack') { if (options.from === 'navigateBack') {
return false; return false;
......
...@@ -128,7 +128,7 @@ ...@@ -128,7 +128,7 @@
<u-picker mode="region" v-model="pickerShow1" @confirm="regionConfirm1"></u-picker> <u-picker mode="region" v-model="pickerShow1" @confirm="regionConfirm1"></u-picker>
<u-picker mode="time" v-model="pickerDateShow" @confirm="dateConfirm"></u-picker> <u-picker mode="time" v-model="pickerDateShow" @confirm="dateConfirm"></u-picker>
<u-select v-model="guaranteeShow" :list="guaranteeList" @confirm="guaranteeConfirm"></u-select> <u-select v-model="guaranteeShow" :list="guaranteeList" @confirm="guaranteeConfirm"></u-select>
<order-form ref="orderRef" @onSubmit="onSubmit" /> <!-- <order-form ref="orderRef" @onSubmit="onSubmit" /> -->
<u-modal v-model="showModel" :content="content" @confirm="modelConfirm" @cancel="modelCancel" showCancelButton> <u-modal v-model="showModel" :content="content" @confirm="modelConfirm" @cancel="modelCancel" showCancelButton>
</u-modal> </u-modal>
</template> </template>
...@@ -141,7 +141,7 @@ import { orderDetail, getTax } from '@/api/index'; ...@@ -141,7 +141,7 @@ import { orderDetail, getTax } from '@/api/index';
import { getProductLineMultipleDetail } from '@/api/productLine'; import { getProductLineMultipleDetail } from '@/api/productLine';
import { quotationExist } from '@/api/cart' import { quotationExist } from '@/api/cart'
import config from '@/utils/config'; import config from '@/utils/config';
import orderForm from './components/orderForm.vue'; // import orderForm from './components/orderForm.vue';
let { proxy }: any = getCurrentInstance() as ComponentInternalInstance let { proxy }: any = getCurrentInstance() as ComponentInternalInstance
let orderRef = ref() let orderRef = ref()
...@@ -308,7 +308,6 @@ let priceCheck = (val: any, index: number) => { ...@@ -308,7 +308,6 @@ let priceCheck = (val: any, index: number) => {
let submit = () => { let submit = () => {
// 保证单价必填 // 保证单价必填
new Promise((resolve, reject) => { new Promise((resolve, reject) => {
console.log(detailData.value, '....');
let flag = true let flag = true
detailData.value.map((item: any) => { detailData.value.map((item: any) => {
if (item.unitPrice === undefined || item.unitPrice === '') { if (item.unitPrice === undefined || item.unitPrice === '') {
...@@ -324,37 +323,17 @@ let submit = () => { ...@@ -324,37 +323,17 @@ let submit = () => {
uFormRef.value?.validate((valid: any, err: any) => { uFormRef.value?.validate((valid: any, err: any) => {
if (valid) { if (valid) {
// 同步价格 // 同步价格
quotationData.value.items.forEach((item: any) => { quotationData.value.items.forEach((item: any, i: number) => {
detailData.value.map((res: any) => { detailData.value.map((res: any, r: number) => {
if (item.goodsName == res.goodsName) { if (i === r) {
item.price = res.unitPrice item.price = res.unitPrice
} }
}) })
}) })
// if (lineId.value) {
// // 同步价格
// quotationData.value.items.forEach((item: any) => {
// detailData.value.map((res: any) => {
// if (item.goodsName == res.goodsName) {
// item.price = res.unitPrice
// }
// })
// })
// } else {
// // 同步价格
// quotationData.value.items.forEach((item: any) => {
// detailData.value.map((res: any) => {
// if (item.goodsName == res.goodsName) {
// item.price = res.unitPrice
// }
// })
// })
// }
let data = { let data = {
items: quotationData.value.items, items: quotationData.value.items,
quotation: formData.value, quotation: formData.value,
}; };
fillQuotation(data).then((res: any) => { fillQuotation(data).then((res: any) => {
if (res.data.code === 200) showModel.value = true if (res.data.code === 200) showModel.value = true
}); });
...@@ -470,7 +449,7 @@ let initQuotaionData = (id: number) => { ...@@ -470,7 +449,7 @@ let initQuotaionData = (id: number) => {
} }
}) })
}) })
console.log(detailData.value); // console.log(detailData.value);
} else initQuotation(orderId.value) } else initQuotation(orderId.value)
// console.log(res, '订单详情信息'); // console.log(res, '订单详情信息');
} }
...@@ -488,27 +467,6 @@ let initQuotaionData = (id: number) => { ...@@ -488,27 +467,6 @@ let initQuotaionData = (id: number) => {
} }
} }
}); });
// 查询产品线
if (lineId.value) {
} else
// 查询普通商品
orderDetail({ orderId: id }).then((res: any) => {
if (res.data.code === 200) {
detailData.value = res.data.data.orderGoods
// 从quotationData获取 在detailData中添加 合同报价字段
if (quotationData.value) {
quotationData.value.items.map((item: any) => {
detailData.value.map((detail: any) => {
if (item.goodsName == detail.goodsName) {
detail.contractQuotation = item.contractQuotation
}
})
})
} else initQuotation(orderId.value)
console.log(res, '订单详情信息');
}
});
} }
// 获取税率 // 获取税率
......
...@@ -26,7 +26,9 @@ export let useSpecStore = defineStore('specData', { ...@@ -26,7 +26,9 @@ export let useSpecStore = defineStore('specData', {
state: () => { state: () => {
return { return {
defaultSelect: {}, // 数据 defaultSelect: {}, // 数据
isDefaultSku: false // 默认值 isDefaultSku: false, // 是否存在默认值
partIds: [] as any,
partList: []
} }
} }
}) })
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论