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

商城配件对接完成

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