|
|
@@ -59,7 +59,6 @@ export default {
|
|
|
if (this.selectList) {
|
|
|
for (const item of this.selectList) {
|
|
|
const itemInfo = this.getSelectItemById(item.id, item.classId);
|
|
|
- console.log('算价格的:itemInfo',itemInfo)
|
|
|
if (itemInfo && !this.$util.isEmpty(itemInfo.bigPrice) && !this.$util.isEmpty(itemInfo.smallPrice)) {
|
|
|
if(item.userPrice>0){
|
|
|
price += Number(item.userPrice);
|
|
|
@@ -112,23 +111,23 @@ export default {
|
|
|
}
|
|
|
},
|
|
|
onShow(){
|
|
|
- if(this.pageType == 'bill' && !this.$util.isEmpty(this.option.customId)){
|
|
|
- if(uni.getStorageSync('selectList'+this.pageType+'_custom_'+this.option.customId)){
|
|
|
- this.setSelectInfoByType({ type: this.pageType, info: uni.getStorageSync('selectList'+this.pageType+'_custom_'+this.option.customId) })
|
|
|
- }
|
|
|
- }else if(this.option.modifyProductKey){
|
|
|
+ if (this.autoLoad) {
|
|
|
+ this.initData();
|
|
|
+ }
|
|
|
+ if(this.option.modifyProductKey){
|
|
|
if(uni.getStorageSync('selectList'+this.option.modifyProductKey)){
|
|
|
- this.setSelectInfoByType({ type: this.pageType, info: uni.getStorageSync('selectList'+this.option.modifyProductKey) })
|
|
|
- uni.removeStorageSync('selectList'+this.option.modifyProductKey)
|
|
|
+ //this.setSelectInfoByType({ type: this.pageType, info: uni.getStorageSync('selectList'+this.option.modifyProductKey) })
|
|
|
+ //uni.removeStorageSync('selectList'+this.option.modifyProductKey)
|
|
|
}
|
|
|
+ }else if(this.pageType == 'bill' && !this.$util.isEmpty(this.option.customId)){
|
|
|
+ if(uni.getStorageSync('selectList'+this.pageType+'_custom_'+this.option.customId)){
|
|
|
+ //this.setSelectInfoByType({ type: this.pageType, info: uni.getStorageSync('selectList'+this.pageType+'_custom_'+this.option.customId) })
|
|
|
+ }
|
|
|
}else{
|
|
|
if(uni.getStorageSync('selectList'+this.pageType)){
|
|
|
this.setSelectInfoByType({ type: this.pageType, info: uni.getStorageSync('selectList'+this.pageType) })
|
|
|
}
|
|
|
}
|
|
|
- if (this.autoLoad) {
|
|
|
- this.initData();
|
|
|
- }
|
|
|
},
|
|
|
methods: {
|
|
|
...mapActions(["setSelectInfoByType", "resetSelectInfoByType"]),
|
|
|
@@ -152,20 +151,22 @@ export default {
|
|
|
},
|
|
|
//请求商品数据
|
|
|
async initData(extendInfo) {
|
|
|
- //extendInfo调用时的扩展参数 如 shopId
|
|
|
try {
|
|
|
- let params = {
|
|
|
- // py: this.py,
|
|
|
- type: this.type
|
|
|
- };
|
|
|
+ let params = {type: this.type}
|
|
|
if (extendInfo) {
|
|
|
params = { ...params, ...extendInfo };
|
|
|
}
|
|
|
const { data } = await getProductDataApi(params);
|
|
|
this.filterProductInfo = '';
|
|
|
+
|
|
|
+ let directList = [];
|
|
|
+
|
|
|
data.forEach(element => {
|
|
|
- element.child &&
|
|
|
- element.child.forEach(child => {
|
|
|
+ element.child && element.child.forEach(child => {
|
|
|
+
|
|
|
+ //组合出一维数组给下面使用 shish 20210811
|
|
|
+ directList[child.id] = child
|
|
|
+
|
|
|
child.classId = element.classId;
|
|
|
child.className = element.className;
|
|
|
child.realityWeight = 0;
|
|
|
@@ -173,10 +174,53 @@ export default {
|
|
|
});
|
|
|
});
|
|
|
this.productInfo = data;
|
|
|
+
|
|
|
+ if(this.option.modifyProductKey){
|
|
|
+ if(uni.getStorageSync('selectList'+this.option.modifyProductKey)){
|
|
|
+ let currentInfo = uni.getStorageSync('selectList'+this.option.modifyProductKey)
|
|
|
+ console.log('ccccc',currentInfo)
|
|
|
+ if(!this.$util.isEmpty(currentInfo)){
|
|
|
+
|
|
|
+ currentInfo.forEach((currentItem,currentIndex,currentArray)=>{
|
|
|
+ let currentId = currentItem.id
|
|
|
+ if(directList[currentId]){
|
|
|
+ currentArray[currentIndex].bigPrice = directList[currentId].bigPrice
|
|
|
+ currentArray[currentIndex].smallPrice = directList[currentId].smallPrice
|
|
|
+ let bPrice = currentItem.bigCount * Number(directList[currentId].bigPrice)
|
|
|
+ let sPrice = currentItem.smallCount * Number(directList[currentId].smallPrice)
|
|
|
+ let currentUserPrice = (bPrice+sPrice).toFixed(2)
|
|
|
+ currentArray[currentIndex].userPrice = currentUserPrice
|
|
|
+ }
|
|
|
+ })
|
|
|
+
|
|
|
+ this.setSelectInfoByType({ type: this.pageType, info: currentInfo})
|
|
|
+ uni.removeStorageSync('selectList'+this.option.modifyProductKey)
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }else if(this.pageType == 'bill' && !this.$util.isEmpty(this.option.customId)){
|
|
|
+ if(uni.getStorageSync('selectList'+this.pageType+'_custom_'+this.option.customId)){
|
|
|
+ let currentInfo = uni.getStorageSync('selectList'+this.pageType+'_custom_'+this.option.customId)
|
|
|
+ if(!this.$util.isEmpty(currentInfo)){
|
|
|
+ currentInfo.forEach((currentItem,currentIndex,currentArray)=>{
|
|
|
+ let currentId = currentItem.id
|
|
|
+ if(directList[currentId]){
|
|
|
+ currentArray[currentIndex].bigPrice = directList[currentId].bigPrice
|
|
|
+ currentArray[currentIndex].smallPrice = directList[currentId].smallPrice
|
|
|
+ let bPrice = currentItem.bigCount * Number(directList[currentId].bigPrice)
|
|
|
+ let sPrice = currentItem.smallCount * Number(directList[currentId].smallPrice)
|
|
|
+ let currentUserPrice = (bPrice+sPrice).toFixed(2)
|
|
|
+ currentArray[currentIndex].userPrice = currentUserPrice
|
|
|
+ }
|
|
|
+ })
|
|
|
+ this.setSelectInfoByType({ type: this.pageType, info: currentInfo })
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
this.classIndex = 0;
|
|
|
this.scroll_into_view = 'class_0';
|
|
|
this.scrollPushList();
|
|
|
- console.log('this.filterProductInfo',this.filterProductInfo)
|
|
|
} catch (error) {} finally {
|
|
|
uni.hideLoading();
|
|
|
}
|
|
|
@@ -345,7 +389,6 @@ export default {
|
|
|
}
|
|
|
//点加号时增加花材补充userPrice字段 shish 20210728
|
|
|
list.forEach(function(product,index,array){
|
|
|
- console.log(product.id,item.id,'id')
|
|
|
if(product.id == item.id){
|
|
|
let ratio = product.ratio <= 0 ? 1 : product.ratio
|
|
|
let smallUnitPrice = (product.price / ratio).toFixed(2)
|
|
|
@@ -423,7 +466,6 @@ export default {
|
|
|
}
|
|
|
//点减号时减少花材补充userPrice字段 shish 20210728
|
|
|
list.forEach(function(product,index,array){
|
|
|
- console.log(product.id,item.id,'id')
|
|
|
if(product.id == item.id){
|
|
|
let ratio = product.ratio <= 0 ? 1 : product.ratio
|
|
|
let smallUnitPrice = (product.price / ratio).toFixed(2)
|
|
|
@@ -447,7 +489,6 @@ export default {
|
|
|
}else{
|
|
|
for (let index = 0; index < list.length; index++) {
|
|
|
const element = list[index];
|
|
|
- console.log("相应ID","element.id == item.id ",element.id ,item.id )
|
|
|
if (element.id == item.id ) {
|
|
|
list.splice(index, 1);
|
|
|
//客户采购的地方会出现二个花材需要合并
|
|
|
@@ -553,7 +594,6 @@ export default {
|
|
|
const query = uni.createSelectorQuery().in(this); //获得实力
|
|
|
//获取多个节点方式
|
|
|
query.selectAll(".selectAll").boundingClientRect(data=>{
|
|
|
- // console.log(data); //得到class类名为 selectAll的数组集合
|
|
|
this.top_list = data.map(item=>{
|
|
|
return Math.ceil(item.top);
|
|
|
});
|