|
@@ -8,7 +8,7 @@
|
|
|
<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>
|
|
|
+ <view class="uni-input" >{{ shopArray[index].name }}</view>
|
|
|
</picker>
|
|
|
<image src="../../static/images/downicon.png" mode="" class="icon"></image>
|
|
|
</view>
|
|
@@ -62,11 +62,12 @@
|
|
|
销售总额
|
|
|
</view>
|
|
|
<view class="num">
|
|
|
- 1848,123
|
|
|
+ {{sellSun.num}}
|
|
|
</view>
|
|
|
<view class="ratio">
|
|
|
<view class="detail">
|
|
|
- <image src="../../static/images/down.png" class="icon"> 10% <text class="compare">同比上月</text>
|
|
|
+ <image src="../../static/images/down.png" class="icon" v-if="sellSun.num < 0">
|
|
|
+ <image src="../../static/images/up.png" class="icon" v-if="sellSun.num>0"> {{ sellSun.percent }}% <text class="compare">{{ sellSun.status ? '无增长' :'同比上月' }}</text>
|
|
|
</view>
|
|
|
</view>
|
|
|
</view>
|
|
@@ -77,14 +78,15 @@
|
|
|
<view class="item order">
|
|
|
<view class="left">
|
|
|
<view class="title">
|
|
|
- 销售总额
|
|
|
+ 订单总量
|
|
|
</view>
|
|
|
<view class="num">
|
|
|
- 1848,123
|
|
|
+ {{orderSun.num}}
|
|
|
</view>
|
|
|
<view class="ratio">
|
|
|
<view class="detail">
|
|
|
- <image src="../../static/images/down.png" class="icon"> 10% <text class="compare">同比上月</text>
|
|
|
+ <image src="../../static/images/down.png" class="icon" v-if="orderSun.num < 0">
|
|
|
+ <image src="../../static/images/up.png" class="icon" v-if="orderSun.num>0"> {{ orderSun.percent }}% <text class="compare">{{ orderSun.status ? '无增长' :'同比上月' }}</text>
|
|
|
</view>
|
|
|
</view>
|
|
|
</view>
|
|
@@ -95,14 +97,15 @@
|
|
|
<view class="item todayseale">
|
|
|
<view class="left">
|
|
|
<view class="title">
|
|
|
- 销售总额
|
|
|
+ 今日销售额
|
|
|
</view>
|
|
|
<view class="num">
|
|
|
- 1848,123
|
|
|
+ {{todaysellSun.num}}
|
|
|
</view>
|
|
|
<view class="ratio">
|
|
|
<view class="detail">
|
|
|
- <image src="../../static/images/down.png" class="icon"> 10% <text class="compare">同比上月</text>
|
|
|
+ <image src="../../static/images/down.png" class="icon" v-if="todaysellSun.num < 0">
|
|
|
+ <image src="../../static/images/up.png" class="icon" v-if="todaysellSun.num>0"> {{ todaysellSun.percent }}% <text class="compare">{{ todaysellSun.status ? '无增长' :'同比上月' }}</text>
|
|
|
</view>
|
|
|
</view>
|
|
|
</view>
|
|
@@ -113,14 +116,15 @@
|
|
|
<view class="item todayorder">
|
|
|
<view class="left">
|
|
|
<view class="title">
|
|
|
- 销售总额
|
|
|
+ 今日订单量
|
|
|
</view>
|
|
|
<view class="num">
|
|
|
- 1848,123
|
|
|
+ {{todayorderSun.num}}
|
|
|
</view>
|
|
|
<view class="ratio">
|
|
|
<view class="detail">
|
|
|
- <image src="../../static/images/down.png" class="icon"> 10% <text class="compare">同比上月</text>
|
|
|
+ <image src="../../static/images/down.png" class="icon" v-if="todayorderSun.num < 0">
|
|
|
+ <image src="../../static/images/up.png" class="icon" v-if="todayorderSun.num>0"> {{ todayorderSun.percent }}% <text class="compare">{{ todayorderSun.status ? '无增长' :'同比上月' }}</text>
|
|
|
</view>
|
|
|
</view>
|
|
|
</view>
|
|
@@ -139,28 +143,45 @@
|
|
|
<view class="todo-list">
|
|
|
<view class="item">
|
|
|
<view class="title">
|
|
|
- 带发货订单
|
|
|
+ 待审核店铺
|
|
|
</view>
|
|
|
<view class="num">
|
|
|
- 1802
|
|
|
+ {{ pendingData.store }}
|
|
|
</view>
|
|
|
</view>
|
|
|
<view class="item">
|
|
|
<view class="title">
|
|
|
- 带发货订单
|
|
|
+ 待审核商品
|
|
|
</view>
|
|
|
<view class="num">
|
|
|
- 1802
|
|
|
+ {{ pendingData.shop }}
|
|
|
</view>
|
|
|
</view>
|
|
|
<view class="item">
|
|
|
<view class="title">
|
|
|
- 带发货订单
|
|
|
+ 待上架产品
|
|
|
+ </view>
|
|
|
+ <view class="num">
|
|
|
+ {{ pendingData.shelf }}
|
|
|
+ </view>
|
|
|
+ </view>
|
|
|
+ <view class="item">
|
|
|
+ <view class="title">
|
|
|
+ 待退款订单
|
|
|
+ </view>
|
|
|
+ <view class="num">
|
|
|
+ {{ pendingData.refund }}
|
|
|
+ </view>
|
|
|
+ </view>
|
|
|
+ <view class="item ">
|
|
|
+ <view class="title">
|
|
|
+ 已支付订单
|
|
|
</view>
|
|
|
<view class="num">
|
|
|
- 1802
|
|
|
+ {{ pendingData.payorder }}
|
|
|
</view>
|
|
|
</view>
|
|
|
+
|
|
|
</view>
|
|
|
</view>
|
|
|
|
|
@@ -218,7 +239,8 @@ export default {
|
|
|
data() {
|
|
|
return {
|
|
|
loading: false,
|
|
|
- shopArray: ['仙女山'],
|
|
|
+ shopArray: [{ name: '全部', id: 0 }],
|
|
|
+ shopID: 0,
|
|
|
index: 0,
|
|
|
cWidth: '',
|
|
|
cHeight: '',
|
|
@@ -226,6 +248,39 @@ export default {
|
|
|
ordernum: null, // 订单号
|
|
|
today: moment().format('YYYY-MM-DD'),
|
|
|
|
|
|
+ theKeyList: [],
|
|
|
+
|
|
|
+ // 数据还可以优化
|
|
|
+ sellSun: {
|
|
|
+ num: 0,
|
|
|
+ percent: 0,
|
|
|
+ status: null,
|
|
|
+ },
|
|
|
+ todaysellSun: {
|
|
|
+ num: 0,
|
|
|
+ percent: 0,
|
|
|
+ status: null,
|
|
|
+ },
|
|
|
+ orderSun: {
|
|
|
+ num: 0,
|
|
|
+ percent: 0,
|
|
|
+ status: null,
|
|
|
+ },
|
|
|
+ todayorderSun: {
|
|
|
+ num: 0,
|
|
|
+ percent: 0,
|
|
|
+ status: null,
|
|
|
+ },
|
|
|
+
|
|
|
+ // 待处理事物
|
|
|
+ pendingData: {
|
|
|
+ store: 0,
|
|
|
+ shop: 0,
|
|
|
+ shelf: 0,
|
|
|
+ payorder: 0,
|
|
|
+ refund: 0,
|
|
|
+ },
|
|
|
+
|
|
|
// 饼图数据
|
|
|
bWidth: '',
|
|
|
bHeight: '',
|
|
@@ -245,17 +300,22 @@ export default {
|
|
|
this.cHeight = uni.upx2px(300);
|
|
|
this.bWidth = uni.upx2px(690);
|
|
|
this.bHeight = uni.upx2px(300);
|
|
|
- this.getServerData();
|
|
|
+ // this.getServerData();
|
|
|
|
|
|
this.getShopList();
|
|
|
- // this.getExponentData();
|
|
|
+ this.getExponentData();
|
|
|
+ this.getPendingData();
|
|
|
+ this.futureDayData();
|
|
|
},
|
|
|
methods: {
|
|
|
-
|
|
|
// 选择商铺
|
|
|
- bindPickerChange (e) {
|
|
|
- console.log(e);
|
|
|
- this.index = e.detail.value
|
|
|
+ bindPickerChange(e) {
|
|
|
+ this.shopID = null;
|
|
|
+ this.index = e.detail.value;
|
|
|
+ this.shopID = this.shopArray[this.index].id;
|
|
|
+ this.getExponentData();
|
|
|
+ this.getPendingData();
|
|
|
+ this.futureDayData();
|
|
|
},
|
|
|
// 跳转设置页
|
|
|
tosetting() {
|
|
@@ -263,25 +323,89 @@ export default {
|
|
|
},
|
|
|
|
|
|
// 获取店铺列表
|
|
|
- async getShopList () {
|
|
|
- await this.$http.get('/homePage/getShopByMerId',{}).then( async (res)=>{
|
|
|
+ async getShopList() {
|
|
|
+ await this.$http.get('/homePage/getShopByMerId').then((res) => {
|
|
|
if (res.data && res.code === 200) {
|
|
|
- let arry = []
|
|
|
- console.log(res);
|
|
|
- this.shopArray = res.data
|
|
|
+ let newarr = [{ name: '全部', id: 0 }];
|
|
|
+ this.shopArray = newarr.concat(res.data);
|
|
|
}
|
|
|
- })
|
|
|
+ });
|
|
|
},
|
|
|
|
|
|
// 关键指数
|
|
|
- async getExponentData () {
|
|
|
- await this.$http.get("homePage/gjzs",{
|
|
|
- date: this.today,
|
|
|
- shopId: 1
|
|
|
- }).then( async (res) =>{
|
|
|
- console.log('--------');
|
|
|
- console.log(res);
|
|
|
- })
|
|
|
+ async getExponentData() {
|
|
|
+ if (this.shopID === 0) {
|
|
|
+ this.shopID = '';
|
|
|
+ }
|
|
|
+ await this.$http
|
|
|
+ .get('/homePage/gjzs', {
|
|
|
+ date: this.today,
|
|
|
+ shopId: this.shopID,
|
|
|
+ })
|
|
|
+ .then(async (res) => {
|
|
|
+ if (res.code === 200 && res.data) {
|
|
|
+ let todaynum = 0;
|
|
|
+ let yesnum = 0;
|
|
|
+ // 销售总额
|
|
|
+ this.dataDo(res.data.xsze, this.sellSun);
|
|
|
+ // 今日销售总额
|
|
|
+ this.dataDo(res.data.jrxxe, this.todaysellSun);
|
|
|
+ // 订单总量
|
|
|
+ this.dataDo(res.data.xsze, this.orderSun);
|
|
|
+ // 今日订单总量
|
|
|
+ this.dataDo(res.data.xsze, this.todayorderSun);
|
|
|
+ }
|
|
|
+ });
|
|
|
+ },
|
|
|
+
|
|
|
+ // 指数数据处理
|
|
|
+ dataDo(data, itemEle) {
|
|
|
+ let todaynum = 0;
|
|
|
+ let yesnum = 0;
|
|
|
+ data.forEach((element) => {
|
|
|
+ if (element.time === 'all') {
|
|
|
+ itemEle.num = (element.num / 100).toFixed(2);
|
|
|
+ } else if (element.time === 'dy') {
|
|
|
+ todaynum = element.num;
|
|
|
+ } else if (element.time === 'sy') {
|
|
|
+ yesnum = element.num;
|
|
|
+ }
|
|
|
+ });
|
|
|
+ if (yesnum === 0) {
|
|
|
+ itemEle.percent = 100;
|
|
|
+ } else {
|
|
|
+ itemEle.percent = (todaynum - yesnum) / yesnum;
|
|
|
+ }
|
|
|
+
|
|
|
+ if (yesnum === todaynum) {
|
|
|
+ itemEle.percent = 0;
|
|
|
+ itemEle.status = true;
|
|
|
+ } else {
|
|
|
+ itemEle.status = false;
|
|
|
+ }
|
|
|
+
|
|
|
+ return itemEle;
|
|
|
+ },
|
|
|
+
|
|
|
+ // 待处理事物
|
|
|
+ async getPendingData() {
|
|
|
+ if (this.shopID === 0) {
|
|
|
+ this.shopID = '';
|
|
|
+ }
|
|
|
+ await this.$http
|
|
|
+ .get('/homePage/pendingTransaction', {
|
|
|
+ date: this.today,
|
|
|
+ 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;
|
|
|
+ }
|
|
|
+ });
|
|
|
},
|
|
|
|
|
|
seting() {
|
|
@@ -298,40 +422,66 @@ export default {
|
|
|
});
|
|
|
},
|
|
|
// 搜索订单
|
|
|
- searchOrder () {
|
|
|
-
|
|
|
+ searchOrder() {
|
|
|
// 判断该订单是否兑换,存在等状态,若存在且未使用(两个状态),则跳转订单兑换页面
|
|
|
|
|
|
- this.$mRouter.push({route: "/pages/index/conversion"})
|
|
|
-
|
|
|
+ this.$mRouter.push({ route: '/pages/index/conversion' });
|
|
|
},
|
|
|
|
|
|
- // 数据处理
|
|
|
- getServerData() {
|
|
|
- uni.request({
|
|
|
- url: 'https://www.ucharts.cn/data.json',
|
|
|
- data: {},
|
|
|
- success: function (res) {
|
|
|
- let LineA = {
|
|
|
- categories: [],
|
|
|
- series: [],
|
|
|
- };
|
|
|
- //这里我后台返回的是数组,所以用等于,如果您后台返回的是单条数据,需要push进去
|
|
|
- LineA.categories = res.data.data.LineA.categories;
|
|
|
- LineA.series = res.data.data.LineA.series;
|
|
|
- _self.showLineA('canvasLineA', LineA);
|
|
|
-
|
|
|
- let pie = {
|
|
|
- series: [],
|
|
|
- };
|
|
|
- pie.series = res.data.data.Pie.series;
|
|
|
- _self.showPie('shopecharts', pie);
|
|
|
- },
|
|
|
- fail: () => {
|
|
|
- _self.tips = '网络错误,小程序端请检查合法域名';
|
|
|
- },
|
|
|
- });
|
|
|
+ // 未来七天
|
|
|
+ async futureDayData() {
|
|
|
+ if (this.shopID === 0) {
|
|
|
+ this.shopID = '';
|
|
|
+ }
|
|
|
+ await this.$http
|
|
|
+ .get('/homePage/getData0', {
|
|
|
+ date: this.today,
|
|
|
+ shopId: this.shopID,
|
|
|
+ })
|
|
|
+ .then(async (res) => {
|
|
|
+ if (res.data) {
|
|
|
+ console.log(res.data);
|
|
|
+ let LineA = {
|
|
|
+ categories: [],
|
|
|
+ series: [],
|
|
|
+ };
|
|
|
+ res.data.forEach((ele) => {
|
|
|
+ LineA.series.push(ele.num);
|
|
|
+ LineA.categories.push(ele.date.slice(5))
|
|
|
+ });
|
|
|
+ console.log(LineA);
|
|
|
+ this.showLineA('canvasLineA',LineA);
|
|
|
+ }
|
|
|
+ });
|
|
|
},
|
|
|
+
|
|
|
+ // // 数据处理
|
|
|
+ // getServerData() {
|
|
|
+ // uni.request({
|
|
|
+ // url: 'https://www.ucharts.cn/data.json',
|
|
|
+ // data: {},
|
|
|
+ // success: function (res) {
|
|
|
+ // let LineA = {
|
|
|
+ // categories: [],
|
|
|
+ // series: [],
|
|
|
+ // };
|
|
|
+ // //这里我后台返回的是数组,所以用等于,如果您后台返回的是单条数据,需要push进去
|
|
|
+ // LineA.categories = res.data.data.LineA.categories;
|
|
|
+ // LineA.series = res.data.data.LineA.series;
|
|
|
+ // _self.showLineA('canvasLineA', LineA);
|
|
|
+
|
|
|
+ // let pie = {
|
|
|
+ // series: [],
|
|
|
+ // };
|
|
|
+ // pie.series = res.data.data.Pie.series;
|
|
|
+ // _self.showPie('shopecharts', pie);
|
|
|
+ // },
|
|
|
+ // fail: () => {
|
|
|
+ // _self.tips = '网络错误,小程序端请检查合法域名';
|
|
|
+ // },
|
|
|
+ // });
|
|
|
+ // },
|
|
|
+
|
|
|
// 图表
|
|
|
showLineA(canvasId, chartData) {
|
|
|
canvaLineA = new uCharts({
|
|
@@ -372,6 +522,7 @@ export default {
|
|
|
},
|
|
|
});
|
|
|
},
|
|
|
+
|
|
|
touchLineA(e) {
|
|
|
canvaLineA.showToolTip(e, {
|
|
|
format: function (item, category) {
|
|
@@ -386,12 +537,11 @@ export default {
|
|
|
$this: _self,
|
|
|
canvasId: canvasId,
|
|
|
type: 'pie',
|
|
|
- fontSize: 11,
|
|
|
+ fontSize: 12,
|
|
|
legend: {
|
|
|
show: true,
|
|
|
position: 'left',
|
|
|
- margin: 10,
|
|
|
- itemGap: 20,
|
|
|
+ itemGap: 250,
|
|
|
},
|
|
|
background: '#FFFFFF',
|
|
|
pixelRatio: _self.pixelRatio,
|
|
@@ -432,10 +582,10 @@ export default {
|
|
|
height: 80rpx;
|
|
|
color: #231726;
|
|
|
background-color: #ffcc01;
|
|
|
-
|
|
|
+ position: relative;
|
|
|
.header-left {
|
|
|
+ position: absolute;
|
|
|
font-size: 28rpx;
|
|
|
-
|
|
|
.uni-list:after {
|
|
|
border-color: transparent;
|
|
|
}
|
|
@@ -464,10 +614,10 @@ export default {
|
|
|
}
|
|
|
|
|
|
.header-right {
|
|
|
- display: flex;
|
|
|
- justify-content: center;
|
|
|
- align-items: center;
|
|
|
-
|
|
|
+ position: absolute;
|
|
|
+ right: 0;
|
|
|
+ top: 50%;
|
|
|
+ margin-top: -20upx;
|
|
|
.icon {
|
|
|
width: 40rpx;
|
|
|
height: 40rpx;
|
|
@@ -534,7 +684,7 @@ export default {
|
|
|
top: 234upx;
|
|
|
background-color: #fff;
|
|
|
width: 686upx;
|
|
|
- padding:0 38upx;
|
|
|
+ padding: 0 38upx;
|
|
|
box-shadow: 0 10upx 10upx rgba($color: #242424, $alpha: 0.1);
|
|
|
z-index: 100;
|
|
|
border-radius: 10upx;
|
|
@@ -686,8 +836,9 @@ export default {
|
|
|
|
|
|
.todo-list {
|
|
|
display: flex;
|
|
|
- justify-content: center;
|
|
|
+ // justify-content: center;
|
|
|
align-items: center;
|
|
|
+ flex-wrap: wrap;
|
|
|
margin-top: 30rpx;
|
|
|
background-color: #ffffff;
|
|
|
box-sizing: border-box;
|
|
@@ -700,6 +851,7 @@ export default {
|
|
|
justify-content: center;
|
|
|
align-items: center;
|
|
|
flex-direction: column;
|
|
|
+ margin-bottom: 30upx;
|
|
|
|
|
|
.title {
|
|
|
color: $subheadColor;
|