123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350 |
- <template>
- <view class="content flex flex_column">
- <div class="p-header" @click="openShlef">
- <text>{{curShelfName||'全部客户'}}</text>
- <u-icon name="arrow-right"></u-icon>
- </div>
- <div class="e-chart">
- <div class="card-box">
- <div class="card-tits">
- 销售单
- </div>
- <div class="card-body">
- <div class="data-box flex">
- <div>
- <div class="data-amount">
- 60
- </div>
- <div class="data-label">销售产品数量(个)</div>
- </div>
- <div>
- <div class="data-amount">
- <u-count-to :end-val="1235.65" separator="," :decimals="2"></u-count-to>
- </div>
- <div class="data-label">销售金额(元)</div>
- </div>
- </div>
- <qiun-data-charts
- type="line"
- :chartData="chartData"
- />
- </div>
- </div>
- <div class="card-box">
- <div class="card-tits">
- 货架订单
- </div>
- <div class="card-body">
- <div class="data-box flex">
- <div>
- <div class="data-amount">
- 60
- </div>
- <div class="data-label">取货产品数量(个)</div>
- </div>
- <div>
- <div class="data-amount">
- <u-count-to :end-val="1235.65" separator="," :decimals="2"></u-count-to>
- </div>
- <div class="data-label">取货产品金额(元)</div>
- </div>
- </div>
- <qiun-data-charts
- type="line"
- :chartData="chartData"
- />
- </div>
- </div>
- <div class="card-box">
- <div class="card-tits">
- 急送订单
- </div>
- <div class="card-body">
- <div class="data-box flex">
- <div>
- <div class="data-amount">
- 60
- </div>
- <div class="data-label">急送产品数量(个)</div>
- </div>
- <div>
- <div class="data-amount">
- <u-count-to :end-val="1235.65" separator="," :decimals="2"></u-count-to>
- </div>
- <div class="data-label">急送产品金额(元)</div>
- </div>
- </div>
- <qiun-data-charts
- type="line"
- :chartData="chartData"
- />
- </div>
- </div>
- </div>
- <!-- 筛选项 -->
- <u-popup v-model="showSearch" mode="right" width="70%">
- <view class="tabBox">
- <view class="tabs">
- <view class="flex">
- <view :class="item.val==curTab?'active':'all'" v-for="item in placeTab" :key="item.val" @click="tabChange(item)">{{item.name}}</view>
- </view>
- </view>
- <view class="flex align_center form-item-inp" style="padding: 0 30rpx;" v-if="curTab == 6">
- <u-input clearable v-model="dateArray" disabled placeholder="请选择时间段" @click="showDate=true" />
- <u-icon name="arrow-down" color="#999"></u-icon>
- </view>
- <view class="form-footer-btn">
- <u-button class="handle-btn" shape="circle" size="medium" hover-class="none" @click="handleClean">重置</u-button>
- <u-button class="handle-btn" shape="circle" size="medium" hover-class="none" :custom-style="customBtnStyle" @click="handleSearch">查询</u-button>
- </view>
- </view>
- </u-popup>
- <!-- 选择日期范围 -->
- <u-calendar v-model="showDate" @change="dateChange" mode="range"></u-calendar>
- </view>
- </template>
- <script>
- import chooseShelf from './chooseShelf.vue'
- export default {
- components: { chooseShelf },
- data() {
- return {
- shelfSn: '',
- curShelfName: '',
- chartData: {},
- showSearch: false,
- showDate: false,
- dateArray: '',
- customBtnStyle: { // 自定义按钮样式
- borderColor: this.$config('primaryColor'),
- backgroundColor: this.$config('primaryColor'),
- color: '#fff'
- },
- queryPramas:{
- beginDate: '',
- endDate: ''
- },
- placeTab: [
- {
- name:'今日',
- val: '0'
- },
- {
- name:'昨日',
- val: '1'
- },
- {
- name:'本周',
- val: '2'
- },
-
- {
- name:'上周',
- val: '3'
- },
- {
- name:'本月',
- val: '4'
- },
- {
- name:'上月',
- val: '5'
- },
- {
- name:'自定义',
- val: '6'
- }
- ],
- curTab: '',
- webView: null
- }
- },
- onLoad() {
- uni.$on('chooseShelfOk',(data)=>{
- this.shelfSn = data.shelfSn
- this.curShelfName = data.shelfName
- })
- this.getServerData()
- this.webView = this.$mp.page.$getAppWebview();
- // 默认数据
- this.tabChange(this.placeTab[2])
- },
- onUnload() {
- uni.$off("chooseShelfOk")
- },
- onNavigationBarButtonTap() {
- this.showSearch = true
- },
- onBackPress() {
- if(this.showSearch){
- this.showSearch = false
- return true
- }
- },
- methods: {
- // 时间 change
- dateChange(date){
- this.dateArray = date.startDate + ' ~ ' + date.endDate
- this.queryPramas.beginDate = date.startDate
- this.queryPramas.endDate = date.endDate
- this.webView.setTitleNViewButtonStyle(0, {
- "text":"\ue626 "+date.startDate+"~"+date.endDate,
- "color": "#00aaff",
- "width": "180px"
- });
- },
- tabChange(data){
- this.curTab = data.val
- if(data.val != 6){
- this.webView.setTitleNViewButtonStyle(0, {
- "text":"\ue626 "+data.name,
- "color": "#00aaff",
- "width": "80px"
- });
- }else{
- this.dateArray = ''
- this.queryPramas.beginDate = ''
- this.queryPramas.endDate = ''
- }
- },
- handleClean(){
- this.tabChange(this.placeTab[2])
- this.showSearch = false
- },
- handleSearch(){
- if(this.curTab == 6){
- if(this.queryPramas.beginDate&&this.queryPramas.endDate){
- this.getServerData()
- this.showSearch = false
- }else{
- uni.showToast({
- icon:'none',
- title: "请选择时间段"
- })
- }
- }else{
- this.getServerData()
- this.showSearch = false
- }
- },
- getServerData() {
- //模拟从服务器获取数据时的延时
- setTimeout(() => {
- //模拟服务器返回数据,如果数据格式和标准格式不同,需自行按下面的格式拼接
- let res = {
- categories: ["8-7","8-6","8-9","8-10","8-11","8-12"],
- series: [
- {
- name: "销售金额",
- data: [35,8,25,37,4,20],
- label:{
- position: 'top'
- }
- },
- ]
- };
- this.chartData = JSON.parse(JSON.stringify(res));
- }, 500);
- },
- openShlef(){
- uni.navigateTo({
- url: "/pages/statistics/chooseShelf?shelfSn="+this.shelfSn
- })
- }
- }
- }
- </script>
- <style lang="less">
- .content{
- height: 100vh;
- width: 100%;
- .p-header{
- background-color: #fff;
- text-align: center;
- padding-bottom: 20rpx;
- }
- .e-chart{
- flex-grow: 1;
- padding: 20rpx;
- font-size: 28rpx;
- overflow: auto;
- .card-box{
- background-color: #fff;
- margin-bottom: 20rpx;
- border-radius: 16rpx;
- overflow: hidden;
- > div{
- padding: 20rpx;
- &:first-child{
- padding-bottom: 0;
- }
- }
- .card-tits{
- font-weight: bold;
- }
- .data-box{
- padding-bottom: 20rpx;
- > div{
- width: 50%;
- text-align: center;
- border-right: 1rpx solid #eee;
- &:last-child{
- border:0;
- }
- .data-amount{
- font-size: 50rpx;
- }
- .data-label{
- color: #999;
- font-size: 24rpx;
- }
- }
- }
- }
- }
- // 筛选
- .tabBox{
- height: 100vh;
- .tabs{
- flex-grow: 1;
- overflow: auto;
- padding: 20rpx;
- > view{
- flex-wrap: wrap;
- justify-content: space-between;
- > view{
- width: 45%;
- border: 1rpx solid #eee;
- padding: 15rpx;
- border-radius: 50rpx;
- text-align: center;
- margin-bottom: 15rpx;
- }
- .active{
- border:0;
- background-color: #0485F6;
- color: #fff;
- }
- }
- }
- .form-item-inp{
- border-bottom: 1rpx solid #eee;
- }
- .form-footer-btn{
- margin: 30upx;
- display: flex;
- justify-content: space-between;
- }
- .form-footer-btn {
- display: flex;
- .handle-btn {
- font-size: 28upx;
- margin: 0 10upx;
- flex: 1;
- }
- }
- }
- }
- </style>
|