积分商城单选改多选,电子对账单限制到油站

pull/9/head
zhangyouji 7 months ago
parent dfbafd8ea8
commit 2796a734f6
  1. 14
      packageElectron/index.vue
  2. 166
      packageIntegral/productAddition/index.vue
  3. 175
      packageIntegral/productUpdate/index.vue

@ -48,7 +48,9 @@
paramter: {
currentPage: 1,
pagesize: 20,
params: {},
params: {
siteId: uni.getStorageSync('oilSitePriceId')
},
},
dataList: [],
optionsList: [{
@ -63,7 +65,7 @@
}, {
text: '金额异常',
value: ''
}],
}]
}
@ -77,22 +79,22 @@
selectOptions(index) {
this.currentIndex = index
this.paramter.currentPage = 1
this.paramter.params ={
siteId: uni.getStorageSync('oilSitePriceId')
}
if(index == 0){
this.paramter.params ={}
this.paramter.params.status = '5'
}else if(index ==1){
this.paramter.params ={}
this.paramter.params.status = '1'
}else if(index ==2){
this.paramter.params ={}
this.paramter.params.status = '2'
}else if(index ==3){
this.paramter.params ={}
this.paramter.params.status = '3'
}
this.getByPage()
},
getByPage(){
// this.parameter.params.siteId = this.siteId
serve.getByPage(this.paramter).then(res=>{
if (res.code === 20000) {
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 style="display: inline-block;">{{item.attributeName}}</view>
<view style="display: inline-block;">
<uni-data-checkbox v-if="index==0" mode="tag" @change="changeRadio(item,index)"
v-model="radioAttributes" :localdata="item.attributesList"></uni-data-checkbox>
<uni-data-checkbox v-else-if="index!=0" mode="tag"
@change="changeCheckBox(item,index)" multiple v-model="checkboxAttributes"
<uni-data-checkbox mode="tag"
@change="changeCheckBox(item,index)" multiple v-model="item.checkboxAttributes"
:localdata="item.attributesList"></uni-data-checkbox>
</view>
@ -95,9 +93,10 @@
<view style="margin: 10rpx 0;">
<text style="color: red;">*</text>
<text>规格</text>
<text v-if="checkboxAttributes.length==0">{{radioAttributes}}</text>
<text
v-if="checkboxAttributes.length>0">{{radioAttributes}}+{{checkboxAttributes[index]}}</text>
<text v-for="(value,key,index) in JSON.parse(items.attributeJson)">
<text v-if="index==0">{{value}}</text>
<text v-else> + {{value}}</text>
</text>
</view>
<view class="tagButton">
<input type="text" v-model="items.marketPrice" placeholder="市场价格" />
@ -139,10 +138,6 @@
</view>
</view>
<!-- <view>
<view>详情图片<text style="color: #999999;">最多可上传10张图片</text></view>
<view></view>
</view> -->
</uni-forms>
<view class="buttons">
<view id="previous" @click="changeBox">上一步</view>
@ -216,8 +211,7 @@
stock: '',
integral: ''
}],
radioAttributes: '',
checkboxAttributes: [],
stockList: [],
checkedList: []
}
@ -275,12 +269,6 @@
})
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) {
this.productDate.newMark = 1
} else {
@ -355,14 +343,13 @@
integral: ''
}]
this.stockList = []
this.radioAttributes = ''
this.checkboxAttributes = []
if (this.productDate.attributesTypeId) {
this.attributesTypeList.forEach(tab => {
if (tab.value == this.productDate.attributesTypeId) {
this.attributesList = tab.attributesList
this.attributesList.forEach(tab => {
tab.attributesList = []
tab.checkboxAttributes=[]
tab.attributeContent.split(',').forEach(item => {
tab.attributesList.push({
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) {
if (this.checkedList.length < index + 1) {
this.checkedList.push({
attributeId: item.id,
checked: item.attributesList[index].value
checked: item.checkboxAttributes[index]
})
} else {
let checked = []
this.checkboxAttributes.forEach(tab => {
item.checkboxAttributes.forEach(tab => {
checked.push(tab)
})
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 = []
let obj = {
marketPrice: '',
@ -413,46 +419,23 @@
stock: '',
integral: ''
}
if (this.attributesList.length == 1) {
arrList.forEach(tab=>{
let data = {}
let name = this.attributesList[0].attributeName
let value = this.radioAttributes
data[name] = value
obj.attributeJson = JSON.stringify(data)
this.stockList.push(obj)
} 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
obj.attributeJson = JSON.stringify(data)
let stockObj = JSON.parse(JSON.stringify(obj))
this.stockList.push(stockObj)
})
}
let tabName = ''
let tabValue = ''
tab.forEach((item,i)=>{
tabName = this.attributesList[i].attributeName
tabValue = item
data[tabName] = tabValue
})
}
obj.attributeJson = JSON.stringify(data)
let stockObj = JSON.parse(JSON.stringify(obj))
this.stockList.push(stockObj)
})
},
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)
},
deleteRadio() {
this.radioAttributes = ''
},
changeChecked(item) {
item.checked = !item.checked
},
addStockList() {
this.stockList.forEach(tab => {
tab.marketPrice = this.bottonList[0].marketPrice
@ -550,16 +533,16 @@
return /^[0-9]+$/.test(value);
},
addCompleted() {
if (this.radioItem[0].checked = true) {
this.productDate.newMark == '1'
} else {
this.productDate.newMark == '2'
}
if (this.radioItem[1].checked = true) {
this.productDate.recommend == '1'
} else {
this.productDate.recommend == '2'
}
if (this.radioItem[0].checked = true) {
this.productDate.newMark == 1
} else {
this.productDate.newMark == 2
}
if (this.radioItem[1].checked = true) {
this.productDate.recommend == 1
} else {
this.productDate.recommend == 2
}
if (!this.productDate.attributesTypeId) {
uni.showToast({
title: '请选择请选择规格',
@ -567,26 +550,17 @@
})
return
}
if(this.attributesList.length==1){
if(!this.radioAttributes){
this.attributesList.forEach(tab=>{
if(JSON.stringify(tab.checkboxAttributes) == '[]'){
uni.showToast({
title: '请选择商品规格',
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) == '[]') {
uni.showToast({
uni.showToast({
title: '请选择商品规格',
icon: 'none'
})
@ -926,4 +900,4 @@
.hidden {
display: none;
}
</style>
</style>

@ -62,10 +62,8 @@
<view class="uni-px-5" v-for="(item,index) in attributesList">
<view style="display: inline-block;">{{item.attributeName}}</view>
<view style="display: inline-block;">
<uni-data-checkbox v-if="index==0" mode="tag" @change="changeRadio(item,index)"
v-model="radioAttributes" :localdata="item.attributesList"></uni-data-checkbox>
<uni-data-checkbox v-else-if="index!=0" mode="tag"
@change="changeCheckBox(item,index)" multiple v-model="checkboxAttributes"
<uni-data-checkbox mode="tag" @change="changeCheckBox(item,index)" multiple
v-model="item.checkboxAttributes"
:localdata="item.attributesList"></uni-data-checkbox>
</view>
@ -98,9 +96,10 @@
<view style="margin: 10rpx 0;">
<text style="color: red;">*</text>
<text>规格</text>
<text v-if="checkboxAttributes.length==0">{{radioAttributes}}</text>
<text
v-if="checkboxAttributes.length>0">{{radioAttributes}}+{{checkboxAttributes[index]}}</text>
<text v-for="(value,key,index) in JSON.parse(tab.attributeJson)">
<text v-if="index==0">{{value}}</text>
<text v-else> + {{value}}</text>
</text>
</view>
<view class="tagButton">
<input type="text" v-model="tab.marketPrice" placeholder="市场价格" />
@ -142,10 +141,6 @@
</view>
</view>
<!-- <view>
<view>详情图片<text style="color: #999999;">最多可上传10张图片</text></view>
<view></view>
</view> -->
</uni-forms>
<view class="buttons">
<view id="previous" @click="changeBox">上一步</view>
@ -218,8 +213,7 @@
stock: '',
integral: ''
}],
radioAttributes: '',
checkboxAttributes: [],
stockList: [],
checkedList: []
}
@ -260,11 +254,12 @@
} else {
this.radioItem[1].checked = false
}
this.attributesTypeList.forEach(tab => {
if (tab.value == this.productDate.attributesTypeId) {
this.attributesList = tab.attributesList
this.attributesTypeList.forEach(tabs => {
if (tabs.value == this.productDate.attributesTypeId) {
this.attributesList = tabs.attributesList
this.attributesList.forEach(tab => {
tab.attributesList = []
tab.checkboxAttributes = []
tab.attributeContent.split(',').forEach(item => {
tab.attributesList.push({
value: item,
@ -275,21 +270,9 @@
}
})
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) => {
if (index == 0) {
this.radioAttributes = this.productDate.checkedList[0].checked
} else {
tab.checked.split(',').forEach(item => {
this.checkboxAttributes.push(item)
})
}
})
}
this.productDate.checkedList.forEach((tab, index) => {
this.attributesList[index].checkboxAttributes = tab.checked.split(',')
})
this.stockList = this.productDate.stockList
@ -329,12 +312,6 @@
})
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) {
this.productDate.newMark = 1
} else {
@ -409,14 +386,13 @@
integral: ''
}]
this.stockList = []
this.radioAttributes = ''
this.checkboxAttributes = []
if (this.productDate.attributesTypeId) {
this.attributesTypeList.forEach(tab => {
if (tab.value == this.productDate.attributesTypeId) {
this.attributesList = tab.attributesList
this.attributesList.forEach(tab => {
tab.attributesList = []
tab.checkboxAttributes = []
tab.attributeContent.split(',').forEach(item => {
tab.attributesList.push({
value: item,
@ -431,37 +407,55 @@
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) {
if (this.checkedList.length < index + 1) {
this.checkedList.push({
attributeId: item.id,
checked: item.attributesList[index].value
checked: item.checkboxAttributes[index]
})
} else {
let checked = []
this.checkboxAttributes.forEach(tab => {
item.checkboxAttributes.forEach(tab => {
checked.push(tab)
})
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 = []
let obj = {
marketPrice: '',
@ -469,43 +463,23 @@
stock: '',
integral: ''
}
if (this.attributesList.length == 1) {
arrList.forEach(tab => {
let data = {}
let name = this.attributesList[0].attributeName
let value = this.radioAttributes
data[name] = value
obj.attributeJson = JSON.stringify(data)
this.stockList.push(obj)
} 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
obj.attributeJson = JSON.stringify(data)
let stockObj = JSON.parse(JSON.stringify(obj))
this.stockList.push(stockObj)
})
}
let tabName = ''
let tabValue = ''
tab.forEach((item, i) => {
tabName = this.attributesList[i].attributeName
tabValue = item
data[tabName] = tabValue
})
}
obj.attributeJson = JSON.stringify(data)
let stockObj = JSON.parse(JSON.stringify(obj))
this.stockList.push(stockObj)
})
},
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)
},
deleteRadio() {
this.radioAttributes = ''
},
addStockList() {
this.stockList.forEach(tab => {
tab.marketPrice = this.bottonList[0].marketPrice
@ -551,7 +525,7 @@
})
},
fail(err) {
console.log('相机调用失败',err)
console.log('相机调用失败', err)
}
})
},
@ -601,33 +575,24 @@
},
addCompleted() {
if (this.radioItem[0].checked = true) {
this.productDate.newMark == '1'
this.productDate.newMark == 1
} else {
this.productDate.newMark == '2'
this.productDate.newMark == 2
}
if (this.radioItem[1].checked = true) {
this.productDate.recommend == '1'
this.productDate.recommend == 1
} else {
this.productDate.recommend == '2'
this.productDate.recommend == 2
}
if(this.attributesList.length==1){
if(!this.radioAttributes){
this.attributesList.forEach(tab => {
if (JSON.stringify(tab.checkboxAttributes) == '[]') {
uni.showToast({
title: '请选择商品规格',
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) {
uni.showToast({
title: '请选择规格',

Loading…
Cancel
Save