积分商城单选改多选,电子对账单限制到油站
This commit is contained in:
@@ -48,7 +48,9 @@
|
|||||||
paramter: {
|
paramter: {
|
||||||
currentPage: 1,
|
currentPage: 1,
|
||||||
pagesize: 20,
|
pagesize: 20,
|
||||||
params: {},
|
params: {
|
||||||
|
siteId: uni.getStorageSync('oilSitePriceId')
|
||||||
|
},
|
||||||
},
|
},
|
||||||
dataList: [],
|
dataList: [],
|
||||||
optionsList: [{
|
optionsList: [{
|
||||||
@@ -63,7 +65,7 @@
|
|||||||
}, {
|
}, {
|
||||||
text: '金额异常',
|
text: '金额异常',
|
||||||
value: ''
|
value: ''
|
||||||
}],
|
}]
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -77,22 +79,22 @@
|
|||||||
selectOptions(index) {
|
selectOptions(index) {
|
||||||
this.currentIndex = index
|
this.currentIndex = index
|
||||||
this.paramter.currentPage = 1
|
this.paramter.currentPage = 1
|
||||||
|
this.paramter.params ={
|
||||||
|
siteId: uni.getStorageSync('oilSitePriceId')
|
||||||
|
}
|
||||||
if(index == 0){
|
if(index == 0){
|
||||||
this.paramter.params ={}
|
|
||||||
this.paramter.params.status = '5'
|
this.paramter.params.status = '5'
|
||||||
}else if(index ==1){
|
}else if(index ==1){
|
||||||
this.paramter.params ={}
|
|
||||||
this.paramter.params.status = '1'
|
this.paramter.params.status = '1'
|
||||||
}else if(index ==2){
|
}else if(index ==2){
|
||||||
this.paramter.params ={}
|
|
||||||
this.paramter.params.status = '2'
|
this.paramter.params.status = '2'
|
||||||
}else if(index ==3){
|
}else if(index ==3){
|
||||||
this.paramter.params ={}
|
|
||||||
this.paramter.params.status = '3'
|
this.paramter.params.status = '3'
|
||||||
}
|
}
|
||||||
this.getByPage()
|
this.getByPage()
|
||||||
},
|
},
|
||||||
getByPage(){
|
getByPage(){
|
||||||
|
// this.parameter.params.siteId = this.siteId
|
||||||
serve.getByPage(this.paramter).then(res=>{
|
serve.getByPage(this.paramter).then(res=>{
|
||||||
if (res.code === 20000) {
|
if (res.code === 20000) {
|
||||||
if (!res.data.list.length&&this.paramter.currentPage!=1) {
|
if (!res.data.list.length&&this.paramter.currentPage!=1) {
|
||||||
|
|||||||
@@ -62,10 +62,8 @@
|
|||||||
<view class="uni-px-5" v-for="(item,index) in attributesList">
|
<view class="uni-px-5" v-for="(item,index) in attributesList">
|
||||||
<view style="display: inline-block;">{{item.attributeName}}:</view>
|
<view style="display: inline-block;">{{item.attributeName}}:</view>
|
||||||
<view style="display: inline-block;">
|
<view style="display: inline-block;">
|
||||||
<uni-data-checkbox v-if="index==0" mode="tag" @change="changeRadio(item,index)"
|
<uni-data-checkbox mode="tag"
|
||||||
v-model="radioAttributes" :localdata="item.attributesList"></uni-data-checkbox>
|
@change="changeCheckBox(item,index)" multiple v-model="item.checkboxAttributes"
|
||||||
<uni-data-checkbox v-else-if="index!=0" mode="tag"
|
|
||||||
@change="changeCheckBox(item,index)" multiple v-model="checkboxAttributes"
|
|
||||||
:localdata="item.attributesList"></uni-data-checkbox>
|
:localdata="item.attributesList"></uni-data-checkbox>
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
@@ -95,9 +93,10 @@
|
|||||||
<view style="margin: 10rpx 0;">
|
<view style="margin: 10rpx 0;">
|
||||||
<text style="color: red;">*</text>
|
<text style="color: red;">*</text>
|
||||||
<text>规格:</text>
|
<text>规格:</text>
|
||||||
<text v-if="checkboxAttributes.length==0">{{radioAttributes}}</text>
|
<text v-for="(value,key,index) in JSON.parse(items.attributeJson)">
|
||||||
<text
|
<text v-if="index==0">{{value}}</text>
|
||||||
v-if="checkboxAttributes.length>0">{{radioAttributes}}+{{checkboxAttributes[index]}}</text>
|
<text v-else> + {{value}}</text>
|
||||||
|
</text>
|
||||||
</view>
|
</view>
|
||||||
<view class="tagButton">
|
<view class="tagButton">
|
||||||
<input type="text" v-model="items.marketPrice" placeholder="市场价格" />
|
<input type="text" v-model="items.marketPrice" placeholder="市场价格" />
|
||||||
@@ -139,10 +138,6 @@
|
|||||||
</view>
|
</view>
|
||||||
|
|
||||||
</view>
|
</view>
|
||||||
<!-- <view>
|
|
||||||
<view>详情图片:<text style="color: #999999;">最多可上传10张图片</text></view>
|
|
||||||
<view></view>
|
|
||||||
</view> -->
|
|
||||||
</uni-forms>
|
</uni-forms>
|
||||||
<view class="buttons">
|
<view class="buttons">
|
||||||
<view id="previous" @click="changeBox">上一步</view>
|
<view id="previous" @click="changeBox">上一步</view>
|
||||||
@@ -216,8 +211,7 @@
|
|||||||
stock: '',
|
stock: '',
|
||||||
integral: ''
|
integral: ''
|
||||||
}],
|
}],
|
||||||
radioAttributes: '',
|
|
||||||
checkboxAttributes: [],
|
|
||||||
stockList: [],
|
stockList: [],
|
||||||
checkedList: []
|
checkedList: []
|
||||||
}
|
}
|
||||||
@@ -275,12 +269,6 @@
|
|||||||
})
|
})
|
||||||
checkboxArr[index].checked = true; //改变当前选中的checked值
|
checkboxArr[index].checked = true; //改变当前选中的checked值
|
||||||
|
|
||||||
// if (checkboxArr[index].checked == false) {
|
|
||||||
// checkboxArr[index].checked = true; //改变当前选中的checked值
|
|
||||||
|
|
||||||
// } else {
|
|
||||||
// checkboxArr[index].checked = false; //改变当前选中的checked值
|
|
||||||
// }
|
|
||||||
if (checkboxArr[0].checked == true) {
|
if (checkboxArr[0].checked == true) {
|
||||||
this.productDate.newMark = 1
|
this.productDate.newMark = 1
|
||||||
} else {
|
} else {
|
||||||
@@ -355,14 +343,13 @@
|
|||||||
integral: ''
|
integral: ''
|
||||||
}]
|
}]
|
||||||
this.stockList = []
|
this.stockList = []
|
||||||
this.radioAttributes = ''
|
|
||||||
this.checkboxAttributes = []
|
|
||||||
if (this.productDate.attributesTypeId) {
|
if (this.productDate.attributesTypeId) {
|
||||||
this.attributesTypeList.forEach(tab => {
|
this.attributesTypeList.forEach(tab => {
|
||||||
if (tab.value == this.productDate.attributesTypeId) {
|
if (tab.value == this.productDate.attributesTypeId) {
|
||||||
this.attributesList = tab.attributesList
|
this.attributesList = tab.attributesList
|
||||||
this.attributesList.forEach(tab => {
|
this.attributesList.forEach(tab => {
|
||||||
tab.attributesList = []
|
tab.attributesList = []
|
||||||
|
tab.checkboxAttributes=[]
|
||||||
tab.attributeContent.split(',').forEach(item => {
|
tab.attributeContent.split(',').forEach(item => {
|
||||||
tab.attributesList.push({
|
tab.attributesList.push({
|
||||||
value: item,
|
value: item,
|
||||||
@@ -378,34 +365,53 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
},
|
},
|
||||||
changeRadio(item, index) {
|
|
||||||
if (JSON.stringify(this.checkedList) == '[]') {
|
|
||||||
this.checkedList.push({
|
|
||||||
attributeId: item.id,
|
|
||||||
checked: this.radioAttributes
|
|
||||||
})
|
|
||||||
} else {
|
|
||||||
this.checkedList[index].checked = this.radioAttributes
|
|
||||||
}
|
|
||||||
this.stockCheck()
|
|
||||||
},
|
|
||||||
changeCheckBox(item, index) {
|
changeCheckBox(item, index) {
|
||||||
if (this.checkedList.length < index + 1) {
|
if (this.checkedList.length < index + 1) {
|
||||||
this.checkedList.push({
|
this.checkedList.push({
|
||||||
attributeId: item.id,
|
attributeId: item.id,
|
||||||
checked: item.attributesList[index].value
|
checked: item.checkboxAttributes[index]
|
||||||
})
|
})
|
||||||
} else {
|
} else {
|
||||||
let checked = []
|
let checked = []
|
||||||
this.checkboxAttributes.forEach(tab => {
|
item.checkboxAttributes.forEach(tab => {
|
||||||
checked.push(tab)
|
checked.push(tab)
|
||||||
})
|
})
|
||||||
this.checkedList[index].checked = checked.join(',')
|
this.checkedList[index].checked = checked.join(',')
|
||||||
this.checkedList.checked
|
|
||||||
}
|
}
|
||||||
this.stockCheck()
|
let arrays = []
|
||||||
|
this.attributesList.forEach(tab=>{
|
||||||
|
arrays.push(tab.checkboxAttributes)
|
||||||
|
})
|
||||||
|
let arrList = this.combineArrays(arrays)
|
||||||
|
this.stockCheck(arrList)
|
||||||
},
|
},
|
||||||
stockCheck() {
|
combineArrays(arr) {
|
||||||
|
if (arr.length === 0) {
|
||||||
|
return [];
|
||||||
|
} else if (arr.length === 1) {
|
||||||
|
return arr[0];
|
||||||
|
} else if (arr.length === 2 && JSON.stringify(arr[1])=='[]') {
|
||||||
|
let result = [];
|
||||||
|
arr[0].forEach(tab=>{
|
||||||
|
result.push([tab])
|
||||||
|
})
|
||||||
|
return result;
|
||||||
|
} else {
|
||||||
|
let result = [];
|
||||||
|
let subCombinations = this.combineArrays(arr.slice(1));
|
||||||
|
for (let elem of arr[0]) {
|
||||||
|
if (Array.isArray(subCombinations)) {
|
||||||
|
for (let subComb of subCombinations) {
|
||||||
|
result.push([elem].concat(subComb));
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
result.push([elem, subCombinations]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
},
|
||||||
|
stockCheck(arrList) {
|
||||||
this.stockList = []
|
this.stockList = []
|
||||||
let obj = {
|
let obj = {
|
||||||
marketPrice: '',
|
marketPrice: '',
|
||||||
@@ -413,46 +419,23 @@
|
|||||||
stock: '',
|
stock: '',
|
||||||
integral: ''
|
integral: ''
|
||||||
}
|
}
|
||||||
if (this.attributesList.length == 1) {
|
arrList.forEach(tab=>{
|
||||||
let data = {}
|
let data = {}
|
||||||
let name = this.attributesList[0].attributeName
|
let tabName = ''
|
||||||
let value = this.radioAttributes
|
let tabValue = ''
|
||||||
data[name] = value
|
tab.forEach((item,i)=>{
|
||||||
obj.attributeJson = JSON.stringify(data)
|
tabName = this.attributesList[i].attributeName
|
||||||
this.stockList.push(obj)
|
tabValue = item
|
||||||
} else {
|
|
||||||
this.attributesList.forEach((item, ind) => {
|
|
||||||
if (ind != 0) {
|
|
||||||
this.checkboxAttributes.forEach((tab, index) => {
|
|
||||||
let data = {}
|
|
||||||
let tabName = this.attributesList[ind].attributeName
|
|
||||||
let tabValue = tab
|
|
||||||
data[tabName] = tabValue
|
data[tabName] = tabValue
|
||||||
|
})
|
||||||
obj.attributeJson = JSON.stringify(data)
|
obj.attributeJson = JSON.stringify(data)
|
||||||
let stockObj = JSON.parse(JSON.stringify(obj))
|
let stockObj = JSON.parse(JSON.stringify(obj))
|
||||||
this.stockList.push(stockObj)
|
this.stockList.push(stockObj)
|
||||||
})
|
})
|
||||||
}
|
|
||||||
})
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
deleteCheckAll(i) {
|
deleteCheckAll(i) {
|
||||||
if (this.checkboxAttributes.length > 1) {
|
|
||||||
this.checkboxAttributes.splice(i, 1)
|
|
||||||
} else {
|
|
||||||
this.checkboxAttributes.splice(i, 1)
|
|
||||||
this.radioAttributes = ''
|
|
||||||
}
|
|
||||||
this.stockList.splice(i, 1)
|
this.stockList.splice(i, 1)
|
||||||
},
|
},
|
||||||
deleteRadio() {
|
|
||||||
this.radioAttributes = ''
|
|
||||||
},
|
|
||||||
changeChecked(item) {
|
|
||||||
item.checked = !item.checked
|
|
||||||
},
|
|
||||||
addStockList() {
|
addStockList() {
|
||||||
this.stockList.forEach(tab => {
|
this.stockList.forEach(tab => {
|
||||||
tab.marketPrice = this.bottonList[0].marketPrice
|
tab.marketPrice = this.bottonList[0].marketPrice
|
||||||
@@ -551,14 +534,14 @@
|
|||||||
},
|
},
|
||||||
addCompleted() {
|
addCompleted() {
|
||||||
if (this.radioItem[0].checked = true) {
|
if (this.radioItem[0].checked = true) {
|
||||||
this.productDate.newMark == '1'
|
this.productDate.newMark == 1
|
||||||
} else {
|
} else {
|
||||||
this.productDate.newMark == '2'
|
this.productDate.newMark == 2
|
||||||
}
|
}
|
||||||
if (this.radioItem[1].checked = true) {
|
if (this.radioItem[1].checked = true) {
|
||||||
this.productDate.recommend == '1'
|
this.productDate.recommend == 1
|
||||||
} else {
|
} else {
|
||||||
this.productDate.recommend == '2'
|
this.productDate.recommend == 2
|
||||||
}
|
}
|
||||||
if (!this.productDate.attributesTypeId) {
|
if (!this.productDate.attributesTypeId) {
|
||||||
uni.showToast({
|
uni.showToast({
|
||||||
@@ -567,24 +550,15 @@
|
|||||||
})
|
})
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
if(this.attributesList.length==1){
|
this.attributesList.forEach(tab=>{
|
||||||
if(!this.radioAttributes){
|
if(JSON.stringify(tab.checkboxAttributes) == '[]'){
|
||||||
uni.showToast({
|
uni.showToast({
|
||||||
title: '请选择商品规格',
|
title: '请选择商品规格',
|
||||||
icon: 'none'
|
icon: 'none'
|
||||||
})
|
})
|
||||||
return
|
throw Error(`请选择商品规格!`)
|
||||||
}
|
}
|
||||||
}
|
|
||||||
if(this.attributesList.length>1){
|
|
||||||
if(JSON.stringify(this.checkboxAttributes) == '[]'){
|
|
||||||
uni.showToast({
|
|
||||||
title: '请选择商品规格',
|
|
||||||
icon: 'none'
|
|
||||||
})
|
})
|
||||||
return
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (JSON.stringify(this.stockList.length) == '[]') {
|
if (JSON.stringify(this.stockList.length) == '[]') {
|
||||||
uni.showToast({
|
uni.showToast({
|
||||||
title: '请选择商品规格',
|
title: '请选择商品规格',
|
||||||
|
|||||||
@@ -62,10 +62,8 @@
|
|||||||
<view class="uni-px-5" v-for="(item,index) in attributesList">
|
<view class="uni-px-5" v-for="(item,index) in attributesList">
|
||||||
<view style="display: inline-block;">{{item.attributeName}}:</view>
|
<view style="display: inline-block;">{{item.attributeName}}:</view>
|
||||||
<view style="display: inline-block;">
|
<view style="display: inline-block;">
|
||||||
<uni-data-checkbox v-if="index==0" mode="tag" @change="changeRadio(item,index)"
|
<uni-data-checkbox mode="tag" @change="changeCheckBox(item,index)" multiple
|
||||||
v-model="radioAttributes" :localdata="item.attributesList"></uni-data-checkbox>
|
v-model="item.checkboxAttributes"
|
||||||
<uni-data-checkbox v-else-if="index!=0" mode="tag"
|
|
||||||
@change="changeCheckBox(item,index)" multiple v-model="checkboxAttributes"
|
|
||||||
:localdata="item.attributesList"></uni-data-checkbox>
|
:localdata="item.attributesList"></uni-data-checkbox>
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
@@ -98,9 +96,10 @@
|
|||||||
<view style="margin: 10rpx 0;">
|
<view style="margin: 10rpx 0;">
|
||||||
<text style="color: red;">*</text>
|
<text style="color: red;">*</text>
|
||||||
<text>规格:</text>
|
<text>规格:</text>
|
||||||
<text v-if="checkboxAttributes.length==0">{{radioAttributes}}</text>
|
<text v-for="(value,key,index) in JSON.parse(tab.attributeJson)">
|
||||||
<text
|
<text v-if="index==0">{{value}}</text>
|
||||||
v-if="checkboxAttributes.length>0">{{radioAttributes}}+{{checkboxAttributes[index]}}</text>
|
<text v-else> + {{value}}</text>
|
||||||
|
</text>
|
||||||
</view>
|
</view>
|
||||||
<view class="tagButton">
|
<view class="tagButton">
|
||||||
<input type="text" v-model="tab.marketPrice" placeholder="市场价格" />
|
<input type="text" v-model="tab.marketPrice" placeholder="市场价格" />
|
||||||
@@ -142,10 +141,6 @@
|
|||||||
</view>
|
</view>
|
||||||
|
|
||||||
</view>
|
</view>
|
||||||
<!-- <view>
|
|
||||||
<view>详情图片:<text style="color: #999999;">最多可上传10张图片</text></view>
|
|
||||||
<view></view>
|
|
||||||
</view> -->
|
|
||||||
</uni-forms>
|
</uni-forms>
|
||||||
<view class="buttons">
|
<view class="buttons">
|
||||||
<view id="previous" @click="changeBox">上一步</view>
|
<view id="previous" @click="changeBox">上一步</view>
|
||||||
@@ -218,8 +213,7 @@
|
|||||||
stock: '',
|
stock: '',
|
||||||
integral: ''
|
integral: ''
|
||||||
}],
|
}],
|
||||||
radioAttributes: '',
|
|
||||||
checkboxAttributes: [],
|
|
||||||
stockList: [],
|
stockList: [],
|
||||||
checkedList: []
|
checkedList: []
|
||||||
}
|
}
|
||||||
@@ -260,11 +254,12 @@
|
|||||||
} else {
|
} else {
|
||||||
this.radioItem[1].checked = false
|
this.radioItem[1].checked = false
|
||||||
}
|
}
|
||||||
this.attributesTypeList.forEach(tab => {
|
this.attributesTypeList.forEach(tabs => {
|
||||||
if (tab.value == this.productDate.attributesTypeId) {
|
if (tabs.value == this.productDate.attributesTypeId) {
|
||||||
this.attributesList = tab.attributesList
|
this.attributesList = tabs.attributesList
|
||||||
this.attributesList.forEach(tab => {
|
this.attributesList.forEach(tab => {
|
||||||
tab.attributesList = []
|
tab.attributesList = []
|
||||||
|
tab.checkboxAttributes = []
|
||||||
tab.attributeContent.split(',').forEach(item => {
|
tab.attributeContent.split(',').forEach(item => {
|
||||||
tab.attributesList.push({
|
tab.attributesList.push({
|
||||||
value: item,
|
value: item,
|
||||||
@@ -275,21 +270,9 @@
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
this.checkedList = this.productDate.checkedList
|
this.checkedList = this.productDate.checkedList
|
||||||
if (this.productDate.checkedList.length == 1) {
|
|
||||||
this.radioAttributes = this.productDate.checkedList[0].checked
|
|
||||||
} else {
|
|
||||||
this.checkboxAttributes = []
|
|
||||||
this.productDate.checkedList.forEach((tab, index) => {
|
this.productDate.checkedList.forEach((tab, index) => {
|
||||||
if (index == 0) {
|
this.attributesList[index].checkboxAttributes = tab.checked.split(',')
|
||||||
this.radioAttributes = this.productDate.checkedList[0].checked
|
|
||||||
} else {
|
|
||||||
tab.checked.split(',').forEach(item => {
|
|
||||||
this.checkboxAttributes.push(item)
|
|
||||||
})
|
})
|
||||||
|
|
||||||
}
|
|
||||||
})
|
|
||||||
}
|
|
||||||
this.stockList = this.productDate.stockList
|
this.stockList = this.productDate.stockList
|
||||||
|
|
||||||
|
|
||||||
@@ -329,12 +312,6 @@
|
|||||||
})
|
})
|
||||||
checkboxArr[index].checked = true; //改变当前选中的checked值
|
checkboxArr[index].checked = true; //改变当前选中的checked值
|
||||||
|
|
||||||
// if (checkboxArr[index].checked == false) {
|
|
||||||
// checkboxArr[index].checked = true; //改变当前选中的checked值
|
|
||||||
|
|
||||||
// } else {
|
|
||||||
// checkboxArr[index].checked = false; //改变当前选中的checked值
|
|
||||||
// }
|
|
||||||
if (checkboxArr[0].checked == true) {
|
if (checkboxArr[0].checked == true) {
|
||||||
this.productDate.newMark = 1
|
this.productDate.newMark = 1
|
||||||
} else {
|
} else {
|
||||||
@@ -409,14 +386,13 @@
|
|||||||
integral: ''
|
integral: ''
|
||||||
}]
|
}]
|
||||||
this.stockList = []
|
this.stockList = []
|
||||||
this.radioAttributes = ''
|
|
||||||
this.checkboxAttributes = []
|
|
||||||
if (this.productDate.attributesTypeId) {
|
if (this.productDate.attributesTypeId) {
|
||||||
this.attributesTypeList.forEach(tab => {
|
this.attributesTypeList.forEach(tab => {
|
||||||
if (tab.value == this.productDate.attributesTypeId) {
|
if (tab.value == this.productDate.attributesTypeId) {
|
||||||
this.attributesList = tab.attributesList
|
this.attributesList = tab.attributesList
|
||||||
this.attributesList.forEach(tab => {
|
this.attributesList.forEach(tab => {
|
||||||
tab.attributesList = []
|
tab.attributesList = []
|
||||||
|
tab.checkboxAttributes = []
|
||||||
tab.attributeContent.split(',').forEach(item => {
|
tab.attributeContent.split(',').forEach(item => {
|
||||||
tab.attributesList.push({
|
tab.attributesList.push({
|
||||||
value: item,
|
value: item,
|
||||||
@@ -431,37 +407,55 @@
|
|||||||
this.attributesList = []
|
this.attributesList = []
|
||||||
}
|
}
|
||||||
|
|
||||||
},
|
|
||||||
changeRadio(item, index) {
|
|
||||||
if (JSON.stringify(this.checkedList) == '[]') {
|
|
||||||
this.checkedList.push({
|
|
||||||
attributeId: item.id,
|
|
||||||
checked: this.radioAttributes
|
|
||||||
})
|
|
||||||
} else {
|
|
||||||
this.checkedList[index].checked = this.radioAttributes
|
|
||||||
}
|
|
||||||
this.stockCheck()
|
|
||||||
|
|
||||||
},
|
},
|
||||||
changeCheckBox(item, index) {
|
changeCheckBox(item, index) {
|
||||||
if (this.checkedList.length < index + 1) {
|
if (this.checkedList.length < index + 1) {
|
||||||
this.checkedList.push({
|
this.checkedList.push({
|
||||||
attributeId: item.id,
|
attributeId: item.id,
|
||||||
checked: item.attributesList[index].value
|
checked: item.checkboxAttributes[index]
|
||||||
})
|
})
|
||||||
} else {
|
} else {
|
||||||
let checked = []
|
let checked = []
|
||||||
this.checkboxAttributes.forEach(tab => {
|
item.checkboxAttributes.forEach(tab => {
|
||||||
checked.push(tab)
|
checked.push(tab)
|
||||||
})
|
})
|
||||||
this.checkedList[index].checked = checked.join(',')
|
this.checkedList[index].checked = checked.join(',')
|
||||||
this.checkedList.checked
|
|
||||||
}
|
}
|
||||||
this.stockCheck()
|
let arrays = []
|
||||||
|
this.attributesList.forEach(tab => {
|
||||||
|
arrays.push(tab.checkboxAttributes)
|
||||||
|
})
|
||||||
|
let arrList = this.combineArrays(arrays)
|
||||||
|
this.stockCheck(arrList)
|
||||||
|
|
||||||
},
|
},
|
||||||
stockCheck() {
|
combineArrays(arr) {
|
||||||
|
if (arr.length === 0) {
|
||||||
|
return [];
|
||||||
|
} else if (arr.length === 1) {
|
||||||
|
return arr[0];
|
||||||
|
} else if (arr.length === 2 && JSON.stringify(arr[1]) == '[]') {
|
||||||
|
let result = [];
|
||||||
|
arr[0].forEach(tab => {
|
||||||
|
result.push([tab])
|
||||||
|
})
|
||||||
|
return result;
|
||||||
|
} else {
|
||||||
|
let result = [];
|
||||||
|
let subCombinations = this.combineArrays(arr.slice(1));
|
||||||
|
for (let elem of arr[0]) {
|
||||||
|
if (Array.isArray(subCombinations)) {
|
||||||
|
for (let subComb of subCombinations) {
|
||||||
|
result.push([elem].concat(subComb));
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
result.push([elem, subCombinations]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
},
|
||||||
|
stockCheck(arrList) {
|
||||||
this.stockList = []
|
this.stockList = []
|
||||||
let obj = {
|
let obj = {
|
||||||
marketPrice: '',
|
marketPrice: '',
|
||||||
@@ -469,43 +463,23 @@
|
|||||||
stock: '',
|
stock: '',
|
||||||
integral: ''
|
integral: ''
|
||||||
}
|
}
|
||||||
if (this.attributesList.length == 1) {
|
arrList.forEach(tab => {
|
||||||
let data = {}
|
let data = {}
|
||||||
let name = this.attributesList[0].attributeName
|
let tabName = ''
|
||||||
let value = this.radioAttributes
|
let tabValue = ''
|
||||||
data[name] = value
|
tab.forEach((item, i) => {
|
||||||
obj.attributeJson = JSON.stringify(data)
|
tabName = this.attributesList[i].attributeName
|
||||||
this.stockList.push(obj)
|
tabValue = item
|
||||||
} else {
|
|
||||||
this.attributesList.forEach((item, ind) => {
|
|
||||||
if (ind != 0) {
|
|
||||||
this.checkboxAttributes.forEach((tab, index) => {
|
|
||||||
let data = {}
|
|
||||||
let tabName = this.attributesList[ind].attributeName
|
|
||||||
let tabValue = tab
|
|
||||||
data[tabName] = tabValue
|
data[tabName] = tabValue
|
||||||
|
})
|
||||||
obj.attributeJson = JSON.stringify(data)
|
obj.attributeJson = JSON.stringify(data)
|
||||||
let stockObj = JSON.parse(JSON.stringify(obj))
|
let stockObj = JSON.parse(JSON.stringify(obj))
|
||||||
this.stockList.push(stockObj)
|
this.stockList.push(stockObj)
|
||||||
})
|
})
|
||||||
}
|
|
||||||
})
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
deleteCheckAll(i) {
|
deleteCheckAll(i) {
|
||||||
if (this.checkboxAttributes.length > 1) {
|
|
||||||
this.checkboxAttributes.splice(i, 1)
|
|
||||||
} else {
|
|
||||||
this.checkboxAttributes.splice(i, 1)
|
|
||||||
this.radioAttributes = ''
|
|
||||||
}
|
|
||||||
this.stockList.splice(i, 1)
|
this.stockList.splice(i, 1)
|
||||||
},
|
},
|
||||||
deleteRadio() {
|
|
||||||
this.radioAttributes = ''
|
|
||||||
},
|
|
||||||
addStockList() {
|
addStockList() {
|
||||||
this.stockList.forEach(tab => {
|
this.stockList.forEach(tab => {
|
||||||
tab.marketPrice = this.bottonList[0].marketPrice
|
tab.marketPrice = this.bottonList[0].marketPrice
|
||||||
@@ -551,7 +525,7 @@
|
|||||||
})
|
})
|
||||||
},
|
},
|
||||||
fail(err) {
|
fail(err) {
|
||||||
console.log('相机调用失败',err)
|
console.log('相机调用失败', err)
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
@@ -601,33 +575,24 @@
|
|||||||
},
|
},
|
||||||
addCompleted() {
|
addCompleted() {
|
||||||
if (this.radioItem[0].checked = true) {
|
if (this.radioItem[0].checked = true) {
|
||||||
this.productDate.newMark == '1'
|
this.productDate.newMark == 1
|
||||||
} else {
|
} else {
|
||||||
this.productDate.newMark == '2'
|
this.productDate.newMark == 2
|
||||||
}
|
}
|
||||||
if (this.radioItem[1].checked = true) {
|
if (this.radioItem[1].checked = true) {
|
||||||
this.productDate.recommend == '1'
|
this.productDate.recommend == 1
|
||||||
} else {
|
} else {
|
||||||
this.productDate.recommend == '2'
|
this.productDate.recommend == 2
|
||||||
}
|
}
|
||||||
if(this.attributesList.length==1){
|
this.attributesList.forEach(tab => {
|
||||||
if(!this.radioAttributes){
|
if (JSON.stringify(tab.checkboxAttributes) == '[]') {
|
||||||
uni.showToast({
|
uni.showToast({
|
||||||
title: '请选择商品规格',
|
title: '请选择商品规格',
|
||||||
icon: 'none'
|
icon: 'none'
|
||||||
})
|
})
|
||||||
return
|
throw Error(`请选择商品规格!`)
|
||||||
}
|
}
|
||||||
}
|
|
||||||
if(this.attributesList.length>1){
|
|
||||||
if(JSON.stringify(this.checkboxAttributes) == '[]'){
|
|
||||||
uni.showToast({
|
|
||||||
title: '请选择商品规格',
|
|
||||||
icon: 'none'
|
|
||||||
})
|
})
|
||||||
return
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (!this.productDate.attributesTypeId) {
|
if (!this.productDate.attributesTypeId) {
|
||||||
uni.showToast({
|
uni.showToast({
|
||||||
title: '请选择规格',
|
title: '请选择规格',
|
||||||
|
|||||||
Reference in New Issue
Block a user