提交 4d9eac81 authored 作者: 刘旭's avatar 刘旭

商城配件对接完成

上级 bed33059
......@@ -107,10 +107,11 @@
</view>
</view>
</view>
<view
v-if="
<!-- v-if="
JSON.stringify(goodsInfo.partsData) !== '[]' && goodsInfo.partsData
"
" -->
<view
v-if="JSON.stringify(partList) !== '[]' && partList"
class="specification-item"
>
<view class="item-title">配件(多选)</view>
......@@ -119,7 +120,7 @@
>
<view class="item-wrapper">
<view
v-for="(item, index) in goodsInfo.partsData"
v-for="(item, index) in partList"
:key="item.id"
class="item-content"
:class="[item.show ? 'actived' : '']"
......@@ -496,6 +497,7 @@ export default {
selectShop: {}, // 存放最后选中的商品
selectNum: this.minBuyNum || 1, // 选中数量
outFoStock: false, // 是否全部sku都缺货
partList: undefined, // 监听赋值配件
openTime: 0,
themeColor: {
// 默认主题
......@@ -592,7 +594,7 @@ export default {
methods: {
// 选择配件
tapParts(row, index) {
this.goodsInfo.partsData[index].show = !this.goodsInfo.partsData[index].show;
this.partList[index].show = !this.partList[index].show;
this.$emit('select-parts', row);
},
// 初始化
......@@ -1277,6 +1279,15 @@ export default {
that.$emit('change', newVal);
},
},
localdata: {
// immediate: true,
deep: true,
handler: function(newVal, oldValue) {
let that = this;
that.partList = that.localdata.partsData;
// console.log(that.localdata, 'localdata');
},
},
},
};
</script>
......
......@@ -124,6 +124,7 @@ let init = (data: any, id: number, partsData?: any) => {
spec_list: specificationList,
partsData
};
// console.log(goodsInfo.value, 'goodsInfo.value');
productList = []
specificationList = []
};
......@@ -326,7 +327,7 @@ const handleClose = () => {
skuPopupRef.value.handClose()
}
// 重置页面数据
// 重置页面数据
let reload = () => {
let pages = getCurrentPages(); //获取所有页面的数组对象
let currPage: any = pages[pages.length - 1]; //当前页面
......@@ -339,7 +340,7 @@ defineExpose({
skuKey,
skuMode,
init,
handleClose,
handleClose
});
</script>
......
......@@ -168,7 +168,6 @@ onLoad((options: any) => {
data: options.id
})
initDetails(options.id)
initParts(options.id)
});
let selectedGoodsItem = ref()
......@@ -204,7 +203,15 @@ const selected = (data: any) => {
bool = true
}
})
if(productId) initAttribute(productId)
console.log(productId);
if(productId) {
let productIds = productId
initAttribute(productIds)
initParts(detailId.value, productIds)
setTimeout(() => {
goodsSkuRef.value.init(detailData.value, detailId.value, partsData.value)
}, 50)
}
else attributeData.value = null
}
......@@ -268,7 +275,6 @@ const initAttribute = (productId: number) => {
orderAttribute({ productId }).then((res: any) => {
if(res.data.code === 200) {
attributeData.value = res.data.data
console.log('Attribute', res);
}
})
}
......@@ -308,8 +314,8 @@ const initDetails = (id: number) => {
}
// 获取商品配件
const initParts = (id: number) => {
goodsParts({ goodsId: id }).then((res: any) => {
const initParts = (goodsId: number, productId: number) => {
goodsParts({ goodsId, productId }).then((res: any) => {
if(res.data.code === 200) {
res.data.data.forEach((item: any) => {
item['show'] = false
......
......@@ -101,25 +101,6 @@ let toIndex = () => {
// 生成报价
let generateQuote = () => {
// let data = [] as any;
// let flag = true;
// detailData.value.map((item: any) => {
// if (typeof item.unitPrice === 'undefined') {
// flag = false;
// return uni.showToast({
// title: `请填写 ${item.goodsName} 单价`,
// icon: 'none',
// });
// } else
// data.push({
// goodsName: item.goodsName,
// unitPrice: item.unitPrice,
// });
// });
// if (flag)
// uni.navigateTo({
// url: `../order/quotation?orderId=${orderId.value}`,
// });
uni.navigateTo({
url: `../order/quotation?orderId=${orderId.value}&lineId=${lineId.value}`,
});
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论