|
@@ -5,39 +5,28 @@
|
|
|
<view class="content" v-for="(item,index) in datalist" :key="index">
|
|
|
<view class="content-one">
|
|
|
</view>
|
|
|
- <text class="content-two">{{item.agentName}}</text>
|
|
|
- <text class="content-three" @click="button(index)" :key='index'>核销返利</text>
|
|
|
+ <view style="display: flex;justify-content: space-between;">
|
|
|
+ <text class="content-two">{{item.agentName}}</text>
|
|
|
+ <text class="content-three" @click="button(index)">核销返利</text>
|
|
|
+ </view>
|
|
|
+
|
|
|
<view class="content-four">
|
|
|
<text>品牌</text>
|
|
|
<text>奖励</text>
|
|
|
<text @click="checkedAll(index,item)" :key='index'>全选</text>
|
|
|
</view>
|
|
|
- <checkbox-group @change="checkboxChange($event,index)">
|
|
|
+ <checkbox-group @change="checkboxChange($event,index,item.storegentBrandList)">
|
|
|
<view class="content-five" v-for="(item,brandIndex) in item.storegentBrandList" :key="brandIndex">
|
|
|
<view class="content-five-img">
|
|
|
<u-image width="100%" height="65%" scaleType="matrix" :src="item.logoUrl"></u-image>
|
|
|
- <!-- {{ item.brandCode }} -->
|
|
|
</view>
|
|
|
<view class="content-five-view">
|
|
|
{{item.usableMoney}}元
|
|
|
</view>
|
|
|
- <view>
|
|
|
- <!-- <u-checkbox-group @change="checkboxGroupChange" :disabled="item.usableMoney==0?true:false">
|
|
|
- <u-checkbox @change="checkboxChange(storegentBrandList[index],checkboxList[index],index)" v-model="checkboxList[index]" :key="index"></u-checkbox>
|
|
|
- </u-checkbox-group> -->
|
|
|
- <view class="" v-show="false">
|
|
|
- {{index}}
|
|
|
- {{ '^^^^' + checkboxList[index] }}
|
|
|
- {{ '&&&' + isCheckedAll }}
|
|
|
- </view>
|
|
|
-
|
|
|
+ <view>
|
|
|
<label>
|
|
|
- <checkbox :value="JSON.stringify(item)" :checked="checkboxList[index]" :disabled="item.usableMoney==0" color="#FFCC33" style="transform:scale(0.7)"/>
|
|
|
+ <checkbox v-model="JSON.stringify(item)" :value="JSON.stringify(item)" :checked="checkboxList[index]" :disabled="item.usableMoney==0" v-if="item.usableMoney!=0" color="#FFCC33" style="transform:scale(0.7)"/>
|
|
|
</label>
|
|
|
- <!-- <label>
|
|
|
- <checkbox value="cb" color="#FFCC33" style="transform:scale(0.7)" />未选中
|
|
|
- </label> -->
|
|
|
-
|
|
|
</view>
|
|
|
|
|
|
</view>
|
|
@@ -71,12 +60,19 @@
|
|
|
list: [{}],
|
|
|
checkboxList: [],
|
|
|
idList:[],
|
|
|
- isCheckedAll:false
|
|
|
+ listaa:['a','b','c'],
|
|
|
+ checkedAllList:[],
|
|
|
+ // isCheckedAll:false
|
|
|
};
|
|
|
},
|
|
|
created() {
|
|
|
this.getData()
|
|
|
},
|
|
|
+ computed:{
|
|
|
+ ckeck(){
|
|
|
+ return this.checkboxList
|
|
|
+ }
|
|
|
+ },
|
|
|
methods: {
|
|
|
// 获取结算中心数据
|
|
|
getData() {
|
|
@@ -95,7 +91,7 @@
|
|
|
// this.checkboxList.length = this.datalist.length
|
|
|
for(var i=0;i<this.datalist.length;i++){
|
|
|
this.Arry[i] = []
|
|
|
- this.checkboxList.push(false)
|
|
|
+ this.checkboxList[i] = false
|
|
|
}
|
|
|
console.log(this.checkboxList)
|
|
|
console.log(res.data.data[0].storegentBrandList)
|
|
@@ -130,19 +126,16 @@
|
|
|
},
|
|
|
|
|
|
checkboxChange1() {
|
|
|
- console.log("###")
|
|
|
+
|
|
|
},
|
|
|
// 选中某个复选框时,由checkbox时触发
|
|
|
// ,bollean,index
|
|
|
- checkboxChange(e,index){
|
|
|
+ checkboxChange(e,index,dataArr){
|
|
|
console.log(e)
|
|
|
let newArr = []
|
|
|
// this.Arry.length = this.datalist.length
|
|
|
// this.Arry[index] = []
|
|
|
console.log(this.Arry)
|
|
|
- // 调用数组的每个元素并将元素传递给回调函数
|
|
|
- // item回调函数
|
|
|
- // JSON.parse()将回调函数字符串转为对象取出
|
|
|
e.detail.value.forEach((item) =>{
|
|
|
var obj = {
|
|
|
"storeId":this.$store.state.storeInfo.storeId,
|
|
@@ -156,77 +149,88 @@
|
|
|
newArr.push(obj)
|
|
|
})
|
|
|
this.Arry[index] = newArr
|
|
|
- console.log(this.Arry[index])
|
|
|
- console.log('%%%%%%',this.Arry)
|
|
|
+ if(this.Arry[index].length == dataArr.filter((item)=>{
|
|
|
+ return item.usableMoney != 0
|
|
|
+ }).length ){
|
|
|
+ this.$set(this.checkboxList, index, true);
|
|
|
+ }else{
|
|
|
+ this.$set(this.checkboxList, index, false);
|
|
|
+ }
|
|
|
},
|
|
|
- // 核销返利
|
|
|
- button(index) {
|
|
|
- console.log(index)
|
|
|
- console.log(this.Arry[index])
|
|
|
- request({
|
|
|
- url: '/myapp/storeCancel',
|
|
|
- method: 'post',
|
|
|
- data: this.Arry[index]
|
|
|
- }).then(res => {
|
|
|
- console.log(res)
|
|
|
- if(res.data.msg=="success") {
|
|
|
- uni.showToast({
|
|
|
- title: '核销返利成功',
|
|
|
- duration: 2000
|
|
|
- });
|
|
|
+ // 核销返利
|
|
|
+ button(index) {
|
|
|
+ console.log(index)
|
|
|
+ console.log(this.Arry[index])
|
|
|
+ request({
|
|
|
+ url: '/myapp/storeCancel',
|
|
|
+ method: 'post',
|
|
|
+ data: this.Arry[index]
|
|
|
+ }).then(res => {
|
|
|
+ console.log(res)
|
|
|
+ if(res.data.msg=="success") {
|
|
|
+ uni.showToast({
|
|
|
+ title: '核销返利成功',
|
|
|
+ duration: 2000
|
|
|
+ });
|
|
|
+ this.getData()
|
|
|
+
|
|
|
+ }else {
|
|
|
+ uni.showToast({
|
|
|
+ title: '核销返利失败',
|
|
|
+ icon: false,
|
|
|
+ duration: 2000
|
|
|
+ });
|
|
|
+ }
|
|
|
|
|
|
- }else {
|
|
|
- uni.showToast({
|
|
|
- title: '核销返利失败',
|
|
|
- icon: false,
|
|
|
- duration: 2000
|
|
|
- });
|
|
|
- }
|
|
|
-
|
|
|
- }).catch(err => {
|
|
|
- console.log(err)
|
|
|
- })
|
|
|
- .finally(() => {
|
|
|
- setTimeout(() => {
|
|
|
- uni.hideLoading();
|
|
|
- this.loading = false;
|
|
|
- }, 1000)
|
|
|
-
|
|
|
- })
|
|
|
-
|
|
|
+ }).catch(err => {
|
|
|
+ console.log(err)
|
|
|
+ })
|
|
|
+ .finally(() => {
|
|
|
+ setTimeout(() => {
|
|
|
+ uni.hideLoading();
|
|
|
+ this.loading = false;
|
|
|
+ }, 1000)
|
|
|
+
|
|
|
+ })
|
|
|
},
|
|
|
// 选中任一checkbox时,由checkbox-group触发
|
|
|
checkboxGroupChange(e) {
|
|
|
// console.log(e);
|
|
|
+ // console.log("###");
|
|
|
},
|
|
|
// 全选
|
|
|
checkedAll(index,e) {
|
|
|
console.log(e)
|
|
|
- this.isCheckedAll = !this.isCheckedAll
|
|
|
+ // this.isCheckedAll = !this.isCheckedAll
|
|
|
+ // this.Arry[index] = []
|
|
|
console.log(index,e)
|
|
|
let newArr=[]
|
|
|
- console.log(this.checkboxList)
|
|
|
+ // this.isCheckedAll = !this.isCheckedAll
|
|
|
if(this.Arry[index].length == e.storegentBrandList.filter((item)=>{
|
|
|
- return item.usableMoney !=0
|
|
|
+ return item.usableMoney != 0
|
|
|
}).length ){
|
|
|
- this.checkboxList[index] = false
|
|
|
+ this.$set(this.checkboxList, index, false);
|
|
|
this.Arry[index] = []
|
|
|
}else{
|
|
|
- this.checkboxList[index] = true
|
|
|
+ this.$set(this.checkboxList, index, true);
|
|
|
for(var i=0;i<e.storegentBrandList.length;i++){
|
|
|
if( e.storegentBrandList[i].usableMoney !=0){
|
|
|
var obj = {
|
|
|
- "storeId":this.$store.state.storeInfo.storeId,
|
|
|
+ "storeId": "3000",
|
|
|
"amount": e.storegentBrandList[i].usableMoney,
|
|
|
"brandCode": e.storegentBrandList[i].brandCode,
|
|
|
"kunnr": e.storegentBrandList[i].agentId
|
|
|
}
|
|
|
newArr.push(obj)
|
|
|
}
|
|
|
+
|
|
|
}
|
|
|
this.Arry[index] = newArr
|
|
|
}
|
|
|
- console.log(this.Arry,this.checkboxList)
|
|
|
+
|
|
|
+ console.log(this.Arry,this.checkboxList)
|
|
|
+
|
|
|
+
|
|
|
}
|
|
|
},
|
|
|
}
|
|
@@ -287,9 +291,8 @@
|
|
|
height: 40rpx;
|
|
|
display: inline-block;
|
|
|
background-color: #3A9FF2;
|
|
|
- position: relative;
|
|
|
- top: -14rpx;
|
|
|
- left: 430rpx;
|
|
|
+ margin-top: -20rpx;
|
|
|
+ margin-right: 20rpx;
|
|
|
border-radius: 10rpx;
|
|
|
font-size: 24rpx;
|
|
|
color: #fff;
|
|
@@ -315,7 +318,7 @@
|
|
|
margin-left: 100rpx;
|
|
|
font-weight: bolder;
|
|
|
margin-right: 30rpx;
|
|
|
- padding-bottom: 40rpx;
|
|
|
+ padding-bottom: 20rpx;
|
|
|
}
|
|
|
|
|
|
.content-five-img {
|
|
@@ -325,6 +328,6 @@
|
|
|
}
|
|
|
|
|
|
.content-five-view {
|
|
|
- margin-left: -100rpx;
|
|
|
+ margin-left: -150rpx;
|
|
|
}
|
|
|
</style>
|