tong 4 years ago
parent
commit
eb52898485
2 changed files with 170 additions and 208 deletions
  1. 113 92
      pages/me/Settlement-center/index.vue
  2. 57 116
      pages/me/Statistical-task/index.vue

+ 113 - 92
pages/me/Settlement-center/index.vue

@@ -9,27 +9,29 @@
 					<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,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>
-					</view>
-					<view class="content-five-view">
-						{{item.usableMoney}}元
-					</view>
-					<view>						
+					<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>
+						</view>
+						<view class="content-five-view">
+							{{item.usableMoney}}元
+						</view>
+						<view>
 							<label>
-								<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)"/>
+								<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)" />
+								<checkbox @click="checkbox" disabled v-if="item.usableMoney==0" color="#FFCC33" style="transform:scale(0.7)" />
 							</label>
-					</view>
+						</view>
 
-				</view>
+					</view>
 				</checkbox-group>
 			</view>
 		</view>
@@ -38,6 +40,7 @@
 </template>
 
 <script>
+	import {mapMutations} from 'vuex'
 	import {
 		request
 	} from '../../../common/request/request'
@@ -48,7 +51,7 @@
 				datalist: [],
 				agentId: '',
 				Arry: [],
-				brandCodeCheckList:[],
+				brandCodeCheckList: [],
 				amount: '',
 				choice: 0,
 				kunnr: '',
@@ -59,39 +62,51 @@
 				checked: true,
 				list: [{}],
 				checkboxList: [],
-				idList:[],
-				listaa:['a','b','c'],
-				checkedAllList:[],
+				idList: [],
+				listaa: ['a', 'b', 'c'],
+				checkedAllList: [],
 				// isCheckedAll:false
 			};
 		},
 		created() {
 			this.getData()
 		},
-		computed:{
-			ckeck(){
+		computed: {
+			ckeck() {
 				return this.checkboxList
 			}
 		},
 		methods: {
+			...mapMutations(["inStore"]),
 			// 获取结算中心数据
 			getData() {
 				request({
 						url: '/myapp/storeSettlementCenter',
 						method: 'post',
 						data: {
-							'storeId':this.$store.state.storeInfo.storeId,
-							'userId':this.$store.state.storeInfo.userId
+							'storeId': this.$store.state.storeInfo.storeId,
+							'userId': this.$store.state.storeInfo.userId
 						}
 					}).then(res => {
-						console.log(res.data)
-						this.datalist = res.data.data
-						this.Arry.length = this.datalist.length
-						// 每个新建数组长度为空,全选为false
-						for(var i=0;i<this.datalist.length;i++){
-							this.Arry[i] = []
-							this.checkboxList[i] = false
-						}
+						if (res.data.code == 0) {
+							console.log(res.data)
+							this.datalist = res.data.data
+							this.Arry.length = this.datalist.length
+							// 每个新建数组长度为空,全选为false
+							for (var i = 0; i < this.datalist.length; i++) {
+								this.Arry[i] = []
+								this.checkboxList[i] = false
+							}
+							this.inStore()
+						}else {
+						console.log(res)
+						uni.showToast({
+							title: res.data.msg,
+							icon: "none",
+							duration: _this.$store.state.showToastDuration
+						});
+					}
+
 					}).catch(err => {
 						console.log(err + "")
 					})
@@ -105,88 +120,94 @@
 			},
 
 			checkboxChange1() {
-			
+
+			},
+			// 置灰选择框
+			checkbox() {
+				this.$u.toast('奖励金额不能为0!');
 			},
 			// 选中某个复选框时,由checkbox时触发
 			// ,bollean,index
-			checkboxChange(e,index,dataArr){
+			checkboxChange(e, index, dataArr) {
 				console.log(index)
 				console.log(e)
 				let newArr = []
 				console.log(this.Arry)
-				e.detail.value.forEach((item) =>{
+				e.detail.value.forEach((item) => {
 					var obj = {
-						"storeId":this.$store.state.storeInfo.storeId,
+						"storeId": this.$store.state.storeInfo.storeId,
 						"amount": JSON.parse(item).usableMoney,
 						"brandCode": JSON.parse(item).brandCode,
 						"kunnr": JSON.parse(item).kunnr,
-						'userId':this.$store.state.storeInfo.userId
+						'userId': this.$store.state.storeInfo.userId
 					}
 					console.log(obj)
 					newArr.push(obj)
 				})
 				this.Arry[index] = newArr
 				console.log(newArr)
-				if(this.Arry[index].length == dataArr.filter((item)=>{
-					return item.usableMoney != 0
-				}).length ){
+				// 判断他是否全选
+				if (this.Arry[index].length == dataArr.filter((item) => {
+						return item.usableMoney != 0
+					}).length) {
 					this.$set(this.checkboxList, index, true);
-					}else{
+				} 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
-								});
-								this.getData()
-								
-							}else {
-								uni.showToast({
-								    title: '核销返利失败',
-									icon: false,
-								    duration: 2000
-								});
-							}
-							
-						}).catch(err => {
-							console.log(err)
-						})
-						.finally(() => {
-							setTimeout(() => {
-								uni.hideLoading();
-								this.loading = false;
-							}, 1000)
-					
-						})
+
+			// 核销返利
+			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
+							});
+						}
+
+					}).catch(err => {
+						console.log(err)
+					})
+					.finally(() => {
+						setTimeout(() => {
+							uni.hideLoading();
+							this.loading = false;
+						}, 1000)
+
+					})
 			},
 			// 选中任一checkbox时,由checkbox-group触发
-			checkboxGroupChange(e) {
-			},
+			checkboxGroupChange(e) {},
 			// 全选
-			checkedAll(index,e) {
-				console.log(index,e)
-				let newArr=[]
-				if(this.Arry[index].length == e.storegentBrandList.filter((item)=>{
-					return item.usableMoney != 0
-				}).length ){
+			checkedAll(index, e) {
+				console.log(index, e)
+				let newArr = []
+				// 根据奖励金额是否为0判断全选取消全选
+				if (this.Arry[index].length == e.storegentBrandList.filter((item) => {
+						return item.usableMoney != 0
+					}).length) {
 					this.$set(this.checkboxList, index, false);
 					this.Arry[index] = []
-				}else{
+				} else {
 					this.$set(this.checkboxList, index, true);
-					for(var i=0;i<e.storegentBrandList.length;i++){
-						if( e.storegentBrandList[i].usableMoney !=0){
+					for (var i = 0; i < e.storegentBrandList.length; i++) {
+						if (e.storegentBrandList[i].usableMoney != 0) {
 							var obj = {
 								"storeId": this.$store.state.storeInfo.storeId,
 								"amount": e.storegentBrandList[i].usableMoney,
@@ -195,14 +216,14 @@
 							}
 							newArr.push(obj)
 						}
-						
+
 					}
 					this.Arry[index] = newArr
 				}
-				
-				console.log(this.Arry,this.checkboxList)
-				
-				
+
+				console.log(this.Arry, this.checkboxList)
+
+
 			}
 		},
 	}
@@ -264,7 +285,7 @@
 		display: inline-block;
 		background-color: #3A9FF2;
 		margin-top: -20rpx;
-		margin-right: 20rpx;
+		margin-right: 15rpx;
 		border-radius: 10rpx;
 		font-size: 24rpx;
 		color: #fff;
@@ -278,7 +299,7 @@
 		font-weight: bolder;
 		font-size: 26rpx;
 		margin-top: 40rpx;
-		margin-left: 80rpx;
+		margin-left: 70rpx;
 		margin-right: 50rpx;
 	}
 
@@ -300,6 +321,6 @@
 	}
 
 	.content-five-view {
-		margin-left: -150rpx;
+		margin-left: -100rpx;
 	}
 </style>

+ 57 - 116
pages/me/Statistical-task/index.vue

@@ -24,9 +24,9 @@
 					</view>
 					<view class="content-one">
 						<!--  -->
-						<canvas :canvas-id="'mouthPie' + index" :id="'mouthPie' + index" class="charts" @touchstart="touchPie($event,'mouthPie' + index)" ></canvas>
+						<canvas :canvas-id="'mouthPie' + index" :id="'mouthPie' + index" class="charts" @touchstart="touchPie($event,'mouthPie' + index)"></canvas>
 						<!-- -->
-						<canvas :canvas-id="'quarterPie' + index" :id="'quarterPie' + index" class="charts"  @touchstart="touchPie($event,'quarterPie' + index)"></canvas>
+						<canvas :canvas-id="'quarterPie' + index" :id="'quarterPie' + index" class="charts" @touchstart="touchPie($event,'quarterPie' + index)"></canvas>
 					</view>
 				</view>
 			</view>
@@ -56,62 +56,38 @@
 				pixelRatio: 1,
 				piearr: [],
 				textarea: '',
-				// pieObj:{
-				// 	series:[
-				// 		{
-				// 			data:60,
-				// 			name:'已完成'
-				// 		},
-				// 		{
-				// 			data:40,
-				// 			name:'未完成'
-				// 		},
-				// 	]
-				// },
-				// pieObj2:{
-				// 	series:[
-				// 		{
-				// 			data:60,
-				// 			name:'已完成'
-				// 		},
-				// 		{
-				// 			data:40,
-				// 			name:'未完成'
-				// 		},
-				// 	]
-				// }
 			}
 		},
 		onLoad() {
-			
+
 			_self = this;
 			_self.cWidth = uni.upx2px(370);
 			_self.cHeight = uni.upx2px(320);
 			// this.showPie('canvasRing')
 		},
 		created() {
-			
+
 		},
 		onShow() {
 			this.getDate()
 		},
-		
+
 		methods: {
 			getDate() {
 				request({
 						url: '/myapp/storeBrandTask',
 						method: 'post',
 						data: {
-							"storeId":this.$store.state.storeInfo.storeId,
-							'userId':this.$store.state.storeInfo.userId
+							"storeId": this.$store.state.storeInfo.storeId,
+							'userId': this.$store.state.storeInfo.userId
 
 						}
 					}).then(res => {
 						console.log(res)
 						this.orderList = res.data.data
 						this.getPieData()
-						
-						
+
+
 						// this.showPie('mouthPie0',monthPie);
 					}).catch(err => {
 						console.log(err)
@@ -123,67 +99,53 @@
 						}, 300)
 					})
 			},
-			getPieData(){
+			getPieData() {
 				console.log('5555')
-				for(var i=0;i<this.orderList.length;i++){
-					var  monthPie = {
+				for (var i = 0; i < this.orderList.length; i++) {
+					var monthPie = {
 						series: []
 					};
 					var quarterPie = {
 						series: []
 					}
-					for(var j=0;j<this.orderList[i].storeMonthList.length;j++){
+					for (var j = 0; j < this.orderList[i].storeMonthList.length; j++) {
 						let monthObj = {
-							data:null,
-							name:'',
-							percent:'',
-							format:(val)=>{
-									console.log(val)
-									// return val.toFixed(0) + ''
-									return val * 100 + '%'
-									}
-							
+							data: null,
+							name: '',
+							percent: '',
+							format: (val) => {
+								console.log(val)
+								// return val.toFixed(0) + ''
+								return val * 100 + '%'
+							}
+
 						}
 						let quarterObj = {
-							data:null,
-							name:'',
-							percent:'',
-							format:(val)=>{
-									console.log(val)
-									// return val.toFixed(0) + ''
-									
-									return val * 100 + '%'
-									}
+							data: null,
+							name: '',
+							percent: '',
+							format: (val) => {
+								console.log(val)
+								return val * 100 + '%'
+							}
 						}
-						
-						
 						monthObj.data = this.orderList[i].storeMonthList[j].data
 						monthObj.name = this.orderList[i].storeMonthList[j].name
 						monthObj.percent = this.orderList[i].storeMonthList[j].percent
-						
 						quarterObj.data = this.orderList[i].storeQuarterList[j].data
 						quarterObj.name = this.orderList[i].storeQuarterList[j].name
 						quarterObj.percent = this.orderList[i].storeQuarterList[j].percent
-						
-						// console.log('^^^^',monthObj)
-						// console.log('9999999',quarterObj)
 						monthPie.series.push(monthObj)
 						quarterPie.series.push(quarterObj)
-						// console.log(quarterPie.series[0].format)
 					}
-					
-					// console.log(`mouthPie${i}`,monthPie,quarterPie)
-					
-					 this.showPie(`mouthPie${i}`,monthPie);
-					 this.showPie(`quarterPie${i}`,quarterPie)
-					// this[`${this.refVal}`]
+					this.showPie(`mouthPie${i}`, monthPie);
+					this.showPie(`quarterPie${i}`, quarterPie)
 				}
-				// this.showPie('mouthPie0',monthPie);
 			},
 			showPie(canvasId, chartData) {
 				console.log('88888')
-				console.log(canvasId,chartData)
-				canvasObj[canvasId]=new uCharts({
+				console.log(canvasId, chartData)
+				canvasObj[canvasId] = new uCharts({
 					$this: _self,
 					canvasId: canvasId,
 					type: 'ring',
@@ -197,8 +159,6 @@
 						padding: 0,
 						lineHeight: 26,
 						margin: 6,
-						//backgroundColor:'rgba(41,198,90,0.2)',
-						//borderColor :'rgba(41,198,90,0.5)',
 						borderWidth: 1
 					},
 					background: '#fff',
@@ -210,7 +170,7 @@
 					disablePieStroke: true,
 					dataLabel: true,
 					subtitle: {
-						name:chartData.series[0].percent ,
+						name: chartData.series[0].percent,
 						color: '#7cb5ec',
 						fontSize: 12 * _self.pixelRatio,
 					},
@@ -223,38 +183,19 @@
 						pie: {
 							ringWidth: 12 * _self.pixelRatio,
 							labelWidth: 0.1,
-							offsetAngle:0
+							offsetAngle: 0
 						}
 					},
 				});
-				// this.piearr = canvaPie.opts.series;
 			},
-			// touchRing(e) {
-			// 	canvaRing.touchLegend(e, {
-			// 		animation: false
-			// 	});
-			// 	canvaRing.showToolTip(e, {
-			// 		format: function(item) {
-			// 			return item.name + ':' + item.data
-			// 		}
-			// 	});
-			// },
-			touchPie(e,id){
-				console.log(e,id)
-				
-				// canvaPie.touchLegend(e, {
-				// 	animation: false
-				// });
+			touchPie(e, id) {
+				console.log(e, id)
 				canvasObj[id].showToolTip(e, {
-						format: function (item) {
-								return item.name + ':' + item.data 
-						}
+					format: function(item) {
+						return item.name + ':' + item.data
+					}
 				});
 			},
-			
-			
-			
-			
 		}
 	}
 </script>
@@ -266,9 +207,9 @@
 		height: 331rpx;
 		background: url(../../../static/sailun/background.png) no-repeat;
 		background-size: 750rpx 331rpx;
-	
+
 	}
-	
+
 	.qiun-charts-one {
 		width: 6rpx;
 		height: 30rpx;
@@ -277,7 +218,7 @@
 		top: 20rpx;
 		left: 30rpx;
 	}
-	
+
 	.qiun-charts-two {
 		position: relative;
 		top: -18rpx;
@@ -285,7 +226,7 @@
 		font-size: 26rpx;
 		font-weight: bold;
 	}
-	
+
 	.content {
 		width: 702rpx;
 		height: 410rpx;
@@ -295,23 +236,23 @@
 		margin: 0 auto;
 		position: relative;
 		top: 20rpx;
-	
+
 		margin-bottom: 40rpx;
-	
+
 	}
-	
+
 	.content-one {
 		display: flex;
 		justify-content: space-between;
 	}
-	
+
 	.charts {
 		width: 380rpx;
 		height: 450rpx;
 		position: relative;
 		top: -20rpx;
 	}
-	
+
 	.qiun-charts-three>view:nth-child(1) {
 		width: 24rpx;
 		height: 24rpx;
@@ -321,10 +262,10 @@
 		top: 20rpx;
 		left: 30rpx;
 	}
-	
+
 	.qiun-charts-three>view:nth-child(2) {
-		width: 180rpx;
-		height: 22rpx;
+		width: 210rpx;
+		line-height: 26rpx;
 		background-color: #000000;
 		color: #fff;
 		font-size: 15rpx;
@@ -335,12 +276,12 @@
 		left: 40rpx;
 		border-top-right-radius: 12rpx;
 	}
-	
+
 	.qiun-charts-four {
 		position: relative;
 		right: 200rpx;
 	}
-	
+
 	.qiun-charts-four>view:nth-child(1) {
 		width: 24rpx;
 		height: 24rpx;
@@ -350,10 +291,10 @@
 		top: 20rpx;
 		left: 30rpx;
 	}
-	
+
 	.qiun-charts-four>view:nth-child(2) {
-		width: 150rpx;
-		height: 22rpx;
+		width: 180rpx;
+		line-height: 26rpx;
 		background-color: #000000;
 		color: #fff;
 		font-size: 15rpx;