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

解决报价相同bug

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