1726837603@qq.com 4 anni fa
parent
commit
92307ef6eb

+ 11 - 0
.hbuilderx/launch.json

@@ -0,0 +1,11 @@
+{ // launch.json 配置了启动调试时相关设置,configurations下节点名称可为 app-plus/h5/mp-weixin/mp-baidu/mp-alipay/mp-qq/mp-toutiao/mp-360/
+  // launchtype项可配置值为local或remote, local代表前端连本地云函数,remote代表前端连云端云函数
+    "version": "0.0",
+    "configurations": [{
+            "type": "uniCloud",
+            "default": {
+                "launchtype": "remote"
+            }
+        }
+    ]
+}

+ 12 - 2
src/components/tabbar/tabbar.vue

@@ -93,6 +93,11 @@ export default {
               center;
             background-size: contain;
           }
+		  .dataAnalyse{
+			  background: url('../../static/images/data.png') no-repeat center
+			    center;
+			  background-size: contain;
+		  }
         }
         .text {
           margin-top: 3upx;
@@ -100,7 +105,7 @@ export default {
           color: rgb(183, 183, 183);
         }
       }
-     
+
       .active {
         .icon {
           .index {
@@ -115,6 +120,11 @@ export default {
             background: url('../../static/images/shop_active.png') no-repeat center center;
             background-size: contain;
           }
+					.dataAnalyse{
+									background: url('../../static/images/data_active.png') no-repeat center
+										center;
+									background-size: contain;
+					}
         }
         .text {
           color: #7d66f3;
@@ -123,4 +133,4 @@ export default {
     }
   }
 }
-</style>
+</style>

+ 18 - 2
src/pages.json

@@ -171,7 +171,17 @@
         "navigationBarTextStyle": "black"
 			}
 		}
-  ],
+      ,{
+            "path" : "pages/dataAnalyse/dataAnalyse",
+            "style" :
+            {
+                "navigationBarTitleText": "数据分析",
+                "navigationBarTextStyle": "black",
+                "navigationBarBackgroundColor":"#ffcd00"
+            }
+
+        }
+    ],
   "tabBar": {
   	"color": "#b7b7b7",
 		"selectedColor": "#7d66f3",
@@ -190,7 +200,13 @@
 			"text": "店铺首页",
 			"iconPath": "static/images/index.png",
 			"selectedIconPath": "static/images/index_active.png"
-    },
+    },
+		{
+			"pagePath" : "pages/dataAnalyse/dataAnalyse",
+			"text": "数据分析",
+			"iconPath": "static/images/data.png",
+			"selectedIconPath": "static/images/data_active.png"
+		},
     {
       "pagePath":"pages/order/order",
       "text": "订单管理",

+ 503 - 0
src/pages/dataAnalyse/dataAnalyse.vue

@@ -0,0 +1,503 @@
+<template>
+	<view class="dataAnalyse">
+		这是数据分析
+		<view class="header">
+			<view class="header-warp">
+				<view class="header-left">
+					<view class="uni-list">
+						<view class="uni-list-cell">
+							<view class="uni-list-cell-db">
+								<picker @change="bindPickerChange" :value="index" :range="shopArray" range-key="name">
+									<view class="uni-input" >{{ shopArray[index].name }}</view>
+								</picker>
+								<image src="../../static/images/downicon.png" mode="" class="icon"></image>
+							</view>
+						</view>
+					</view>
+				</view>
+				<view class="header-bar header-center">数据分析</view>
+				<view class="header-right">
+					<image src="../../static/images/seticon.png" mode="" class="icon" @tap="tosetting"></image>
+				</view>
+			</view>
+			<view class="tabS">
+				<view class="tab" :class="activeTab==0?'active_Tab':''" @tap="upTab(0)">
+					<picker mode="date" :value="startDate" @change=startChange($event)>
+						<view class="uni-input" >{{startDate}}</view>
+					</picker>
+					<image src="../../static/images/downicon.png" mode="" class="icon"></image>
+				</view>
+				至
+				<view class="tab" :class="activeTab==1?'active_Tab':''" @tap="upTab(1)">
+					<picker mode="date" :value="endDate" @change=endChange($event)>
+						<view class="uni-input" >{{endDate}}</view>
+					</picker>
+					<image src="../../static/images/downicon.png" mode="" class="icon"></image>
+				</view>
+
+			</view>
+
+		</view>
+
+		<view class="" style="height: 102rpx;"></view>
+		<view class="btnS">
+				<view class="btn" :class="activeBtn==0?'active_Btn':''" @tap="upBtn(0)">
+					售检分析
+				</view>
+				<view class="btn" :class="activeBtn==1?'active_Btn':''" @tap="upBtn(1)">
+					用户分析
+				</view>
+		</view>
+		<view class="sale_box" v-if="activeBtn==0">
+			<view class="box" v-if="intradayData">
+					<view class="advanceBox">
+									<view class="text">
+										<text>预订人次</text>
+										<text>{{intradayData.ydrc}}</text>
+									</view>
+									<view class="text">
+										<text>销售金额</text>
+										<text>{{intradayData.xsje}}</text>
+									</view>
+							</view>
+							<view class="advanceBox">
+									<view class="text">
+										<text>入园人次</text>
+										<text>{{intradayData.ryrc}}</text>
+									</view>
+									<view class="text">
+										<text>核销金额</text>
+										<text>{{intradayData.hxje}}</text>
+									</view>
+							</view>
+			</view>
+			<view class="box">
+					<view class="title">
+							店铺订单量排行榜前(10)
+					</view>
+					<view class="orderBox">
+						
+					</view>
+			</view>
+
+		</view>
+		<view class="user_box" v-else>
+
+		</view>
+		<tabBar :currentIndex="typeNum"></tabBar>
+	</view>
+</template>
+
+<script>
+	import uCharts from '../../js_sdk/u-charts/u-charts/u-charts';
+	import moment from '@/common/moment';
+	let _self;
+	let canvaLineA = null;
+	let canvaPie = null;
+	let shopSellLine = null;
+	let shopMoneyLine = null;
+	let getDataBuyTime = null;
+	export default {
+		data() {
+			return {
+			intradayData:{},
+			uderName: '',
+			typeNum:null,
+			shopID: null,
+			index: 0,
+			activeTab:0,
+			activeBtn:0,
+			shopArray: [{ name: '全部', id: 0 }],
+			loading: true,
+			// 遮罩层
+			isShowMask: false,
+			iconShow: false,
+			masktxt: '',
+			// 商品销售走势
+			shopwidth: '',
+			shopheight: '',
+
+			// 销售金额走势
+			moneywidth: '',
+			moneyheight: '',
+
+			// 未来七天
+			cWidth: '',
+			cHeight: '',
+
+			// 饼图数据
+			bWidth: '',
+			bHeight: '',
+
+			pixelRatio: 1, // 像素比
+			ordernum: '', // 订单号
+
+			orderMessage: {},
+			todayforday: moment(new Date()).format('YYYY-MM-DD HH:mm:ss'),
+			today: moment(new Date()).format('YYYY-MM-DD'),
+			this_day: moment(new Date()).format('YYYY.MM.DD'),
+			startDate:moment(new Date()).format('YYYY-MM-DD'),
+			endDate:moment(new Date()).format('YYYY-MM-DD'),
+			}
+		},
+		mounted() {
+			// this.today = this.todayforday = this.this_day = moment(new Date()).format('YYYY-MM-DD')
+			this.getIntradayData()
+		},
+		onShow() {
+		  this.todayforday = moment().format('YYYY-MM-DD HH:mm:ss')
+		  _self = this;
+		  this.cWidth = uni.upx2px(690); // upx2px 转换为px
+		  this.cHeight = uni.upx2px(300);
+		  this.bWidth = uni.upx2px(690);
+		  this.bHeight = uni.upx2px(500);
+			this.getShopList()
+		  getDataBuyTime = setInterval(() => {
+		    this.todayforday = moment().format('YYYY-MM-DD HH:mm:ss')
+		    this.loading = false;
+		    this.getShopList();
+		    // this.$mHelper.toast(`自动更新数据${moment().format('h:mm:ss')}`);
+		  }, 1011 * 60 * 5);
+		},
+		methods: {
+				// 选择商铺
+				bindPickerChange(e) {
+				  this.loading = true;
+				  this.shopID = null;
+				  this.index = e.detail.value;
+				  this.shopID = this.shopArray[this.index].id;
+				  // this.getPendingData();
+					console.log(123,this.shopID)
+				  // this.futureDayData();
+				  // this.shopSellData();
+				  // this.shopSellTrend();
+				  // this.shopSellMoneyTrend();
+				  this.loading = false;
+				},
+				// 获取店铺列表
+				async getShopList() {
+				  this.loading = true
+				  await this.$http.get('/homePage/getShopByMerId').then((res) => {
+				    if (res.data && res.code === 200) {
+				      let newarr = [{ name: '全部', id: 0 }];
+				      this.shopArray = newarr.concat(res.data);
+				      // this.getPendingData();
+				      this.shopSellTrend();
+				      this.shopSellMoneyTrend();
+				      this.futureDayData();
+				      this.shopSellData();
+				      this.loading = false
+				    }
+				  })
+				},
+
+				// 未来七天
+				async futureDayData() {
+				  this.loadingMore3 = true;
+				  if (this.shopID === 0) {
+				    this.shopID = '';
+				  }
+				  await this.$http
+				    .get('/homePage/getData0', {
+				      date: this.todayforday,
+				      shopId: this.shopID,
+				    })
+				    .then(async (res) => {
+				      if (res.data) {
+				        let LineA = {
+				          categories: [],
+				          series: [],
+				        };
+				        res.data.forEach((ele) => {
+				          LineA.series.push(ele.num);
+				          LineA.categories.push(ele.date.slice(5));
+				        });
+				        // _self.showLineA('canvasLineA', LineA);
+				      }
+				    });
+				},
+				// // 待处理事物
+				// async getPendingData() {
+				//   this.loading = true
+				//   if (this.shopID === 0) {
+				//     this.shopID = '';
+				//   }
+				//   await this.$http
+				//     .get('/homePage/pendingTransaction', {
+				//       date: this.todayforday,
+				//       shopId: this.shopID,
+				//     })
+				//     .then(async (res) => {
+				//       if (res.data) {
+				//         this.pendingData.store = res.data.shopCheck;
+				//         this.pendingData.shop = res.data.goodsCheck;
+				//         this.pendingData.shelf = res.data.upGoods;
+				//         this.pendingData.payorder = res.data.payNum;
+				//         this.pendingData.refund = res.data.refundNum;
+				//         this.loading = false
+				//       }
+				//     });
+				// },
+				startChange(e){
+					this.startDate = e.detail.value
+
+					this.getIntradayData()
+				},
+				endChange(e){
+					this.endDate = e.detail.value
+					this.getIntradayData()
+				},
+				// 商品销售占比
+				async shopSellData() {
+				  this.loadingMore4 = true;
+				  await this.$http
+				    .get('/homePage/getData1', {
+				      date: this.todayforday,
+				      shopId: this.shopID,
+				    })
+				    .then(async (res) => {
+				      let pie = {
+				        series: [],
+				      };
+				      if (res.data.length > 0) {
+				        for (let i = 0; i < res.data.length; i++) {
+				          let element = res.data[i];
+				          pie.series.push({ name: element.name, data: element.value });
+				        }
+				        // _self.showPie('shopecharts', pie);
+				      } else {
+				        pie.series = [{ name: '无数据', data: 0 }];
+				        // _self.showPie('shopecharts', pie);
+				      }
+				    });
+				},
+    // 商品销售数量走势
+    async shopSellTrend() {
+      this.loadingMore1 = true;
+      if (this.shopID === 0) {
+        this.shopI = '';
+      }
+      await this.$http
+        .get('/homePage/getData2', {
+          date: this.todayforday,
+          shopId: this.shopID,
+        })
+        .then(async (res) => {
+          if (res.data) {
+            let shopSellData = {
+              xdata: [],
+              jrdata: [],
+              zrdata: [],
+            };
+
+            res.data.forEach((ele) => {
+              shopSellData.xdata.push(ele.time);
+              shopSellData.jrdata.push(ele.jr);
+              shopSellData.zrdata.push(ele.zr);
+            });
+            // _self.shopSellEcharts('shopsellEcharts', shopSellData);
+          }
+        });
+    },
+		// 商品销售金额走势
+		async shopSellMoneyTrend() {
+		  this.loadingMore2 = true;
+		  if (this.shopID === 0) {
+		    this.shopI = '';
+		  }
+		  await this.$http
+		    .get('/homePage/getData3', {
+		      date: this.todayforday,
+		      shopId: this.shopID,
+		    })
+		    .then(async (res) => {
+		      if (res.data) {
+		        let shopMoney = {
+		          xdata: [],
+		          jrdata: [],
+		          zrdata: [],
+		        };
+
+		        res.data.forEach((ele) => {
+		          shopMoney.xdata.push(ele.time);
+		          shopMoney.jrdata.push(ele.jr);
+		          shopMoney.zrdata.push(ele.zr);
+		        });
+		        // _self.shopMoneyEcharts('shopmoneyEcharts', shopMoney);
+		      }
+		    });
+		},
+				upTab(index){
+				this.activeTab = index
+				},
+				upBtn(index){
+				this.activeBtn = index
+				},
+				// 跳转设置页
+				tosetting() {
+				  this.$mRouter.push({ route: '/pages/index/setting/setting' });
+				},
+				// 获取售检分析顶部数据
+				getIntradayData(){
+					console.log("today",this.today)
+					let data = {
+						dateType:'%Y-%m-%d',
+						filterType:"day",
+						shopId:this.shopID,
+						startDate:this.startDate,
+						endDate:this.endDate,
+						returnType:"%d"
+					};
+					this.$http.post('dataAnalyse/intradayData',data).then((res) => {
+					  if (res.code === 200 && res.msg === 'OK') {
+					    this.$mHelper.toast('提交成功!');
+							this.intradayData=res.data
+							console.log()
+					    // setTimeout(() => {
+					    //   this.$mRouter.back();
+					    // }, 800);
+					  }
+					});
+				}
+		},
+		computed:{
+		  logingname: function (){
+		     if ( this.uderName.indexOf('@') != -1) {
+		      return this.uderName.slice(this.uderName.indexOf('@')+1)
+		    } else {
+		      return this.uderName
+		    }
+		  }
+		},
+		onReady () {
+		  this.uderName = uni.getStorageSync('scenicMessage').name
+		},
+		onLoad () {
+		  this.typeNum = this.$mStore.state.roleIndex
+		},
+	}
+</script>
+
+<style lang="scss" scoped>
+		.header {
+		  width: 100%;
+		  padding: 0 30rpx;
+		  background-color: $barColor;
+		  position: fixed;
+		  top: 0;
+		  box-sizing: border-box;
+		  z-index: 99;
+		  .header-warp {
+		    display: flex;
+		    height: 80rpx;
+		    color: #231726;
+		    background-color: #ffcc01;
+		    position: relative;
+		    .header-left {
+		      position: absolute;
+		      font-size: 28rpx;
+		      .uni-list:after {
+		        border-color: transparent;
+		      }
+		      .uni-list-cell-db {
+		        height: 80rpx;
+		        font-size: 28rpx;
+		        display: flex;
+		        justify-content: center;
+		        align-items: center;
+		        background-color: $barColor;
+
+		        .icon {
+		          width: 17rpx;
+		          height: 12rpx;
+		          margin-left: 10rpx;
+		        }
+		      }
+		    }
+
+		    .header-center {
+		      flex: 1;
+		      font-size: 36rpx;
+		      font-weight: 700;
+		      text-align: center;
+		      line-height: 80rpx;
+		    }
+
+		    .header-right {
+		      position: absolute;
+		      right: 0;
+		      top: 50%;
+		      margin-top: -20rpx;
+		      .icon {
+		        width: 40rpx;
+		        height: 40rpx;
+		      }
+		    }
+		  }
+			.tabS{
+				display: flex;
+				justify-content: left;
+				align-items: center;
+				.tab{
+					flex: 1;
+					text-align: center;
+					padding: 10rpx 0;
+					// border: 0.5rpx solid #999;
+					display: flex;
+					justify-content: center;
+					align-items: center;
+					.icon {
+		          width: 17rpx;
+		          height: 12rpx;
+		          margin-left: 10rpx;
+		        }
+				}
+				.active_tab{
+					border: 0.5rpx solid #b15cfa;
+					color: #b15cfa;
+					background-color: #FFFFFF;
+					border-bottom: 0;
+				}
+			}
+		}
+			.btnS{
+				padding: 0 30rpx;
+				display: flex;
+				justify-content: left;
+				background-color: #FFFFFF;
+				.btn{
+					flex: 1;
+					text-align: center;
+					padding: 10rpx 0;
+				}
+				.active_Btn{
+					// border: 0.5rpx solid #b15cfa;
+					// color: #b15cfa;
+					// background-color: #FFFFFF;
+					border-bottom:2rpx solid #b15cfa;
+				}
+			}
+			.sale_box{
+				padding: 0 30rpx;
+				.box{
+					display: flex;
+					justify-content: 	left;
+					background-color: #E0E0E0;
+					margin-top: 30rpx;
+					padding: 20rpx;
+					border-radius: 10rpx;
+					.advanceBox{
+						height: 200rpx;
+						flex: 1;
+						text-align: center;
+						display: flex;
+						flex-direction: column;
+						justify-content: space-between;
+						.text{
+							height: 60rpx;
+							line-height: 60rpx;
+						}
+					}
+				}
+			}
+</style>

+ 4 - 4
src/pages/goods/goods.vue

@@ -14,11 +14,11 @@
           <text class="txt" @tap="searchByname">搜索</text>
         </view>
         <view class="btn-time">
-          <image
+          <!-- <image
             src="../../static/images/addicon.png"
             class="timeicon"
             @tap="topage()"
-          ></image>
+          ></image> -->
         </view>
       </view>
 
@@ -104,7 +104,7 @@
             >{{ item.sort === 0 ? '置顶' : '取消置顶' }}</view
           >
           <!-- <view class="btn sold" @tap="passGet(item.id)">审核</view> -->
-          <view class="btn compile" @tap="topage(item.id)">编辑</view>
+          <!-- <view class="btn compile" @tap="topage(item.id)">编辑</view> -->
           <view class="btn delete" @tap="deleteshop(item.id)">删除</view>
         </view>
       </view>
@@ -321,7 +321,7 @@ export default {
             this.$mHelper.toast('无权限访问')
           }
         }
-      });        
+      });
     },
     // 删除商品
     async deleteshop (id) {

+ 7 - 8
src/pages/index/index.vue

@@ -211,13 +211,13 @@
 
 					</view>
 				</view>
-
-				<!-- 数据概况 -->
+<!-- 
+				数据概况
 				<view class="data">
 					<view class="qiun-bg-white qiun-title-bar qiun-common-mt">
 						<view class="qiun-title-dot-light">数据概况</view>
 					</view>
-          <!-- 产品销售数量走势 -->
+          产品销售数量走势
 					<view class="echarts shopsell">
 						<view class="title">
 							<view class="left">
@@ -235,7 +235,7 @@
               <image class="shopsellimg" :src="shopsellimg" v-if="!loadingMore1"></image>
 						</view>
 					</view>
-          <!-- 产品销售金额走势 -->
+          产品销售金额走势
 					<view class="echarts shopmoney">
 						<view class="title">
 							<view class="left">
@@ -253,7 +253,7 @@
               <image class="shopmoneyimg" :src="shopmoneyimg" v-if="!loadingMore2"></image>
 						</view>
 					</view>
-          <!-- 未来7天预定 -->
+          未来7天预定
 					<view class="echarts future">
 						<view class="title">
 							<view class="left">
@@ -271,7 +271,7 @@
 					</view>
 				</view>
 
-				<!-- 商品销售占比 -->
+				商品销售占比
 				<view class="shop-echarts-warp">
 					<view class="title">
 						商品销售占比
@@ -281,7 +281,7 @@
             <text class="loadingMore" v-if="loadingMore4">加载中...</text>
             <image class="shopimg" :src="shopimg" v-if="!loadingMore4"></image>
 					</view>
-				</view>
+				</view> -->
 
         <view style="height:80upx"></view>
 			</view>
@@ -501,7 +501,6 @@ export default {
     tosetting() {
       this.$mRouter.push({ route: '/pages/index/setting/setting' });
     },
-
     // 获取店铺列表
     async getShopList() {
       this.loading = true

+ 14 - 15
src/pages/public/login.vue

@@ -6,8 +6,7 @@
       <image
         class="logo"
         mode="widthFix"
-        src="@/static/img/logo-xd.png"
-      ></image>
+        src="@/static/img/logo-xd.png"></image>
       <view class="title">商家端管理后台登录</view>
     </view>
     <!-- 设置白色背景防止软键盘把下部绝对定位元素顶上来盖住输入框等 -->
@@ -67,9 +66,9 @@ export default {
   data() {
     return {
       loginParams: {
-        username: 'wljq',
+        username: 'xiudo',
         code: '',
-        password: 'Ectrip2020',
+        password: '123456',
         uuid: null,
       },
       codeImage: null,
@@ -89,20 +88,20 @@ export default {
   },
 
   // 页面生命周期 监听页面加载是否加载完成
-  onLoad() {   
+  onLoad() {
     this.getCaptchaImage();
-    
+
     // #ifdef MP-WEIXIN
     uni.hideHomeButton()  // 会话过期更改页面跳转到登录页的跳转方式,并隐藏小房子
     // #endif
   },
- 
-  methods: {  
+
+  methods: {
     // 统一跳转路由
     navTo() {
       this.$mRouter.redirectTo({ route: '/pages/public/resetpassword' });
     },
-   
+
 
 		// 获取验证码
     async getCaptchaImage() {
@@ -117,7 +116,7 @@ export default {
         });
     },
     // 提交表单
-    async toLogin() {  
+    async toLogin() {
       let cheRes, loginApi;
       if (this.loginByPass) {
         loginApi = loginByPass;
@@ -130,12 +129,12 @@ export default {
       if (!cheRes) {
         this.$mHelper.toast(this.$mGraceChecker.error);
         return;
-      }    
+      }
       this.handleLogin(this.loginParams, loginApi);
     },
     // 登录
     async handleLogin(params, loginApi) {
-      this.btnLoading = true;  
+      this.btnLoading = true;
       await this.$http
         .post(loginApi, params)
         .then( async r => {
@@ -152,8 +151,8 @@ export default {
           });
 
           this.$mHelper.toast('恭喜您,登录成功!');
-          
-          this.$mRouter.reLaunch({ route: `/pages/${rolelist[0].code}/${rolelist[0].code}`}); 
+
+          this.$mRouter.reLaunch({ route: `/pages/${rolelist[0].code}/${rolelist[0].code}`});
           this.btnLoading = false;
 
         })
@@ -275,7 +274,7 @@ export default {
 	margin-bottom: 30upx;
 	background-color: #fff;
 	border-bottom: 1px solid #e7e7e7;
-	
+
 
   .tit {
     height: 50upx;

BIN
src/static/images/data.png


BIN
src/static/images/data_active.png