作者 刘晓艳

成品

@@ -11,12 +11,39 @@ Page({ @@ -11,12 +11,39 @@ Page({
11 */ 11 */
12 data: { 12 data: {
13 showModal: false, 13 showModal: false,
14 - monthList: ["1月", "2月", "3月", "4月", "5月", "6月", "7月", "8月", "9月", "10月", "11月", "12月"], 14 + modalTitle: ["选择时间", "选择地磅", "选择货物"],
  15 + modalNum: 2,
  16 + monthList: ["货物名字", "车间后方大转盘", "车间后方大转盘炒股的人格", "车间后方大转盘", "车间后方大转盘", "车间后方大转盘炒股的人格", "车间后方大转盘", "车间后方大转盘", "车间后方大转盘炒股的人格", "车间后方大转盘", "车间后方大转盘", "车间后方大转盘炒股的人格", "车间后方大转盘", "车间后方大转盘", "车间后方大转盘", "车间后方大转盘", "车间后方大转盘", "车间后方大转盘", ],
15 time: '2019.01.01-2019.01.31', 17 time: '2019.01.01-2019.01.31',
16 - changeColor: -1, 18 + changeColor: 0,
  19 + tabList: ["出库", "流水"],
  20 + tabNum: 0,
  21 + tableTitle: ["时间", "地磅", "货物名称", "重量(T)"],
  22 + trList: [{
  23 + date: "09.12",
  24 + position: "大厅左上角",
  25 + name: "名字妙哉妙",
  26 + num: "18",
  27 + btn: "详情"
  28 + },
  29 + {
  30 + date: "09.12",
  31 + position: "大厅左上角",
  32 + name: "啦啦啦啦啦啦啦啦啦啦",
  33 + num: "18",
  34 + btn: "详情"
  35 + },
  36 + {
  37 + date: "09.12",
  38 + position: "车间后方大转盘",
  39 + name: "啦啦啦啦啦啦啦啦啦啦",
  40 + num: "18",
  41 + btn: "详情"
  42 + },
  43 + ],
17 ec: { 44 ec: {
18 45
19 - onInit: function (canvas, width, height) { 46 + onInit: function(canvas, width, height) {
20 47
21 chart = echarts.init(canvas, null, { 48 chart = echarts.init(canvas, null, {
22 49
@@ -37,32 +64,15 @@ Page({ @@ -37,32 +64,15 @@ Page({
37 }, 64 },
38 65
39 }, 66 },
40 - choice(e) {  
41 - let index = e.currentTarget.dataset.id;  
42 - index = index + 1  
43 - if (index == 1 || index == 3 || index == 5 || index == 7 || index == 8 || index == 10 || index == 12) {  
44 - this.setData({  
45 - time: "(" + "2019." + "0" + index + ".01" + "-2019" + index + ".31" + ")"  
46 - })  
47 - } else {  
48 - this.setData({  
49 - time: "(" + "2019." + "0" + index + ".01" + "-2019" + index + ".30" + ")"  
50 - })  
51 - }  
52 - this.setData({  
53 - changeColor: index - 1  
54 - })  
55 - },  
56 - three() { 67 + changeTab(e) {
57 this.setData({ 68 this.setData({
58 - time: '近30天',  
59 - showt: !this.data.showt 69 + tabNum: e.currentTarget.dataset.id
60 }) 70 })
  71 +
61 }, 72 },
62 toShowModal(e) { 73 toShowModal(e) {
63 this.setData({ 74 this.setData({
64 showModal: true 75 showModal: true
65 -  
66 }) 76 })
67 }, 77 },
68 78
@@ -71,19 +81,26 @@ Page({ @@ -71,19 +81,26 @@ Page({
71 showModal: false 81 showModal: false
72 }); 82 });
73 }, 83 },
  84 + choice(e) {
  85 +
  86 + this.setData({
  87 + changeColor: e.currentTarget.dataset.id
  88 + })
  89 + },
74 /** 90 /**
75 * 生命周期函数--监听页面加载 91 * 生命周期函数--监听页面加载
76 */ 92 */
77 - onLoad: function (options) { 93 + onLoad: function(options) {
78 94
79 this.echartsComponnet = this.selectComponent('#mychart'); 95 this.echartsComponnet = this.selectComponent('#mychart');
80 96
  97 +
81 //如果是第一次绘制 98 //如果是第一次绘制
82 99
83 if (!Chart) { 100 if (!Chart) {
84 -  
85 this.init_echarts(); //初始化图表 101 this.init_echarts(); //初始化图表
86 102
  103 +
87 } else { 104 } else {
88 105
89 this.setOption(Chart); //更新数据 106 this.setOption(Chart); //更新数据
@@ -93,7 +110,7 @@ Page({ @@ -93,7 +110,7 @@ Page({
93 }, 110 },
94 //初始化图表 111 //初始化图表
95 112
96 - init_echarts: function () { 113 + init_echarts: function() {
97 114
98 this.echartsComponnet.init((canvas, width, height) => { 115 this.echartsComponnet.init((canvas, width, height) => {
99 116
@@ -117,7 +134,7 @@ Page({ @@ -117,7 +134,7 @@ Page({
117 134
118 }, 135 },
119 136
120 - setOption: function (Chart) { 137 + setOption: function(Chart) {
121 138
122 Chart.clear(); // 清除 139 Chart.clear(); // 清除
123 140
@@ -178,7 +195,7 @@ Page({ @@ -178,7 +195,7 @@ Page({
178 195
179 position: 'left', 196 position: 'left',
180 197
181 - name: '千瓦时', //纵坐标名称 198 + name: '重量', //纵坐标名称
182 199
183 nameTextStyle: { //在name值存在下,设置name的样式 200 nameTextStyle: { //在name值存在下,设置name的样式
184 201
@@ -188,12 +205,12 @@ Page({ @@ -188,12 +205,12 @@ Page({
188 205
189 }, 206 },
190 207
191 - splitNumber: 5, //坐标轴的分割段数 208 + splitNumber: 10, //坐标轴的分割段数
192 209
193 210
194 min: 0, 211 min: 0,
195 212
196 - max: 500, 213 + max: 100,
197 214
198 }, 215 },
199 216
@@ -201,7 +218,7 @@ Page({ @@ -201,7 +218,7 @@ Page({
201 218
202 type: 'line', 219 type: 'line',
203 220
204 - data: [100, 120, 123, 142, 231, 231, 123, 341, 234, 432, 100, 120, 123, 142, 231, 231, 123, 341, 234, 432, 100, 120, 123, 142, 231, 231, 123, 341, 234, 432, 253], 221 + data: [10, 12, 13, 14, 23, 31, 23, 31, 48, 43, 1, 100, 23, 42, 21, 31, 23, 34, 97, 43, 59, 67, 82, 42, 23, 31, 13, 34, 34, 43, 25],
205 222
206 symbol: 'true', 223 symbol: 'true',
207 224
@@ -211,7 +228,7 @@ Page({ @@ -211,7 +228,7 @@ Page({
211 228
212 lineStyle: { 229 lineStyle: {
213 230
214 - color: '#6495F8' 231 + color: '#ED3676'
215 232
216 } 233 }
217 234
@@ -234,49 +251,62 @@ Page({ @@ -234,49 +251,62 @@ Page({
234 /** 251 /**
235 * 生命周期函数--监听页面初次渲染完成 252 * 生命周期函数--监听页面初次渲染完成
236 */ 253 */
237 - onReady: function () { 254 + onReady: function() {
238 255
239 }, 256 },
240 257
241 /** 258 /**
242 * 生命周期函数--监听页面显示 259 * 生命周期函数--监听页面显示
243 */ 260 */
244 - onShow: function () { 261 + onShow: function() {
  262 + this.echartsComponnet = this.selectComponent('#mychart');
  263 +
  264 +
  265 + //如果是第一次绘制
245 266
  267 + if (!Chart) {
  268 + this.init_echarts(); //初始化图表
  269 +
  270 +
  271 + } else {
  272 +
  273 + this.setOption(Chart); //更新数据
  274 +
  275 + }
246 }, 276 },
247 277
248 /** 278 /**
249 * 生命周期函数--监听页面隐藏 279 * 生命周期函数--监听页面隐藏
250 */ 280 */
251 - onHide: function () { 281 + onHide: function() {
252 282
253 }, 283 },
254 284
255 /** 285 /**
256 * 生命周期函数--监听页面卸载 286 * 生命周期函数--监听页面卸载
257 */ 287 */
258 - onUnload: function () { 288 + onUnload: function() {
259 289
260 }, 290 },
261 291
262 /** 292 /**
263 * 页面相关事件处理函数--监听用户下拉动作 293 * 页面相关事件处理函数--监听用户下拉动作
264 */ 294 */
265 - onPullDownRefresh: function () { 295 + onPullDownRefresh: function() {
266 296
267 }, 297 },
268 298
269 /** 299 /**
270 * 页面上拉触底事件的处理函数 300 * 页面上拉触底事件的处理函数
271 */ 301 */
272 - onReachBottom: function () { 302 + onReachBottom: function() {
273 303
274 }, 304 },
275 305
276 /** 306 /**
277 * 用户点击右上角分享 307 * 用户点击右上角分享
278 */ 308 */
279 - onShareAppMessage: function () { 309 + onShareAppMessage: function() {
280 310
281 } 311 }
282 }) 312 })
1 { 1 {
2 "navigationBarTextStyle": "black", 2 "navigationBarTextStyle": "black",
3 "navigationBarTitleText": "成品", 3 "navigationBarTitleText": "成品",
4 - "usingComponents": {} 4 + "usingComponents": {
  5 + "ec-canvas": "../../ec-canvas/ec-canvas"
  6 + }
5 } 7 }
1 <!--pages/qiyeyongdian/detail/detail.wxml--> 1 <!--pages/qiyeyongdian/detail/detail.wxml-->
2 -<!-- 日期选择 --> 2 +<!-- 货物信息 -->
3 <view class="modal-mask" bindtap="hideModal" wx:if="{{showModal}}"></view> 3 <view class="modal-mask" bindtap="hideModal" wx:if="{{showModal}}"></view>
4 <view wx:if="{{showModal}}"> 4 <view wx:if="{{showModal}}">
5 <view class="modal-content"> 5 <view class="modal-content">
6 - <!-- 年份 -->  
7 - <view class="modal_year">2019年</view> 6 + <!-- 选项卡 -->
  7 + <view class="modal_year">
  8 + <view class="modal_single {{modalNum == index ?'modal_choice':''}}" wx:for="{{modalTitle}}" wx:key="">{{item}}</view>
  9 + </view>
8 <!-- 月份 --> 10 <!-- 月份 -->
  11 + <scroll-view scroll-y style="height: 400px;">
9 <view class="modal_month"> 12 <view class="modal_month">
10 <view class="month_single {{changeColor == index?'change':''}}" wx:for="{{monthList}}" wx:key="" data-id="{{index}}" catchtap="choice">{{item}}</view> 13 <view class="month_single {{changeColor == index?'change':''}}" wx:for="{{monthList}}" wx:key="" data-id="{{index}}" catchtap="choice">{{item}}</view>
11 </view> 14 </view>
12 - <view class="date_descript {{showt==true?'tactive':''}}" bindtap="three">近30天</view> 15 + </scroll-view>
13 <view class='btns'> 16 <view class='btns'>
14 <view class="cacle" bindtap="hideModal">取消</view> 17 <view class="cacle" bindtap="hideModal">取消</view>
15 <view class="cacle sure" bindtap="hideModal">确定</view> 18 <view class="cacle sure" bindtap="hideModal">确定</view>
16 </view> 19 </view>
17 </view> 20 </view>
18 </view> 21 </view>
  22 +<!-- 选项卡 -->
  23 +<view class="tab">
  24 + <view wx:for="{{tabList}}" wx:key="" class="tab_single {{tabNum == index?'tab_border':''}}" bindtap='changeTab' data-id="{{index}}">{{item}}</view>
  25 +</view>
19 <!-- 月份 --> 26 <!-- 月份 -->
20 <view class="search_month"> 27 <view class="search_month">
21 <view class="rowimg"> 28 <view class="rowimg">
22 <image src='/img/row.png' class="left"></image> 29 <image src='/img/row.png' class="left"></image>
23 </view> 30 </view>
24 - <view class="date_time" bindtap='toShowModal'>  
25 - <!-- 近30天(2019.03.01-2019.03.30) -->  
26 - 2019.06 31 + <view class="date_time">
  32 + <!-- 出库 -->
  33 + <view wx:if="{{tabNum == 0}}">2019.06</view>
  34 + <!-- 流水 -->
  35 + <view wx:if="{{tabNum == 1}}">{{time}}</view>
27 <view class="rowimg"> 36 <view class="rowimg">
28 <image src='/img/row.png' class="down"></image> 37 <image src='/img/row.png' class="down"></image>
29 </view> 38 </view>
@@ -32,15 +41,39 @@ @@ -32,15 +41,39 @@
32 <image src='/img/row.png'></image> 41 <image src='/img/row.png'></image>
33 </view> 42 </view>
34 </view> 43 </view>
35 -<!-- 折线图 -->  
36 -<view class="charts_line"> 44 +<!-- 出库 -->
  45 +<view wx:if="{{tabNum == 0}}">
  46 + <view class="cp_title">
  47 + 成品出库信息
  48 + </view>
  49 + <view class="total">
  50 + 重量总计(吨)
  51 + <text>1000</text>
  52 + </view>
  53 + <!-- 折线图 -->
  54 + <view class="charts_line">
37 <view class="chart"> 55 <view class="chart">
38 <ec-canvas id="mychart" canvas-id="mychart-line" ec="{{ ec }}"></ec-canvas> 56 <ec-canvas id="mychart" canvas-id="mychart-line" ec="{{ ec }}"></ec-canvas>
39 -<!-- <ec-canvas id="mychart-dom-graph" canvas-id="mychart-graph" ec="{{ec}}"></ec-canvas> -->  
40 </view> 57 </view>
41 -  
42 <view class="total_power"> 58 <view class="total_power">
43 - <view>2019.06</view> 59 + <view>2019年6月</view>
  60 + </view>
  61 + </view>
  62 +</view>
  63 +<!-- 流水 -->
  64 +<view wx:if="{{tabNum == 1}}">
  65 + <view class="second_total">重量总计(吨):1000</view>
  66 + <!-- 数据 -->
  67 + <view class="table">
  68 + <view class="table_title">
  69 + <view wx:for="{{tableTitle}}" wx:key="">{{item}}</view>
  70 + </view>
  71 + <view class="table_tr" wx:for="{{trList}}" wx:key="">
  72 + <view class="tr_time">{{item.date}}</view>
  73 + <view class="tr_pos">{{item.position}}</view>
  74 + <view class="tr_name">{{item.name}}</view>
  75 + <view class="tr_time">{{item.num}}</view>
  76 + <view class="tr_btn" bindtap='toShowModal'>{{item.btn}}</view>
  77 + </view>
44 </view> 78 </view>
45 -  
46 </view> 79 </view>
@@ -29,16 +29,14 @@ @@ -29,16 +29,14 @@
29 29
30 .down { 30 .down {
31 transform: rotate(90deg); 31 transform: rotate(90deg);
32 - margin-left: 10rpx 32 + margin-left: 10rpx;
33 } 33 }
34 34
35 /* 折线图 */ 35 /* 折线图 */
36 36
37 -  
38 -  
39 .chart { 37 .chart {
40 width: 750rpx; 38 width: 750rpx;
41 - height: 394rpx; 39 + height: 494rpx;
42 margin: 0 auto; 40 margin: 0 auto;
43 display: flex; 41 display: flex;
44 justify-content: center; 42 justify-content: center;
@@ -94,14 +92,48 @@ ec-canvas { @@ -94,14 +92,48 @@ ec-canvas {
94 border-radius: 2rpx; 92 border-radius: 2rpx;
95 } 93 }
96 94
97 -/* 年份 */ 95 +/* 弹出框选项卡 */
98 96
99 .modal_year { 97 .modal_year {
100 - padding: 38rpx;  
101 - border: 1rpx solid #f5f5f5; 98 + display: flex;
  99 + flex-direction: row;
  100 + justify-content: space-around;
  101 + align-items: center;
102 font-size: 28rpx; 102 font-size: 28rpx;
103 color: #666; 103 color: #666;
104 - text-align: center; 104 + padding-top: 20rpx;
  105 + border:1rpx solid #f5f5f5;
  106 + border-left:none;
  107 + border-right: none;
  108 +}
  109 +.modal_single{
  110 + border-bottom:4rpx solid #fff;
  111 +}
  112 +.modal_choice{
  113 + border-bottom-color: #FF9400;
  114 + color: #FF9400;
  115 + font-weight: 600;
  116 + padding-bottom:20rpx;
  117 +}
  118 +/* 选项卡 */
  119 +
  120 +.tab {
  121 + display: flex;
  122 + flex-direction: row;
  123 + justify-content: space-around;
  124 + align-items: center;
  125 + padding-top: 20rpx;
  126 + color: #ff9400;
  127 + border-top: 1rpx solid #f5f5f5;
  128 +}
  129 +
  130 +.tab_single {
  131 + padding-bottom: 20rpx;
  132 + border-bottom: 4rpx solid #fff;
  133 +}
  134 +
  135 +.tab_border {
  136 + border-bottom: 4rpx solid #ff9400;
105 } 137 }
106 138
107 /* 月份 */ 139 /* 月份 */
@@ -110,17 +142,17 @@ ec-canvas { @@ -110,17 +142,17 @@ ec-canvas {
110 display: flex; 142 display: flex;
111 flex-wrap: wrap; 143 flex-wrap: wrap;
112 flex-direction: row; 144 flex-direction: row;
113 - margin: 40rpx 0 30rpx; 145 + margin: 50rpx 30rpx;
  146 + justify-content: space-between;
114 } 147 }
115 148
116 .month_single { 149 .month_single {
117 - width: 33.333%;  
118 - height: 120rpx;  
119 - text-align: center; 150 + background-color: #F9F8FE;
  151 + padding: 20rpx 56rpx 15rpx;
120 border-radius: 6rpx; 152 border-radius: 6rpx;
121 font-size: 32rpx; 153 font-size: 32rpx;
122 color: #333; 154 color: #333;
123 - line-height: 120rpx; 155 + margin-bottom: 30rpx;
124 } 156 }
125 157
126 .change { 158 .change {
@@ -139,9 +171,48 @@ ec-canvas { @@ -139,9 +171,48 @@ ec-canvas {
139 background: rgba(244, 244, 244, 1); 171 background: rgba(244, 244, 244, 1);
140 border-radius: 6rpx; 172 border-radius: 6rpx;
141 } 173 }
142 -.tactive{ 174 +
  175 +.tactive {
143 background: #ff9400; 176 background: #ff9400;
144 - color:#fff; 177 + color: #fff;
  178 +}
  179 +
  180 +/* 标题 */
  181 +
  182 +.cp_title {
  183 + color: #333;
  184 + font-size: 32rpx;
  185 + font-weight: bold;
  186 + padding: 30rpx 54rpx 41rpx;
  187 + position: relative;
  188 +}
  189 +
  190 +.cp_title::after {
  191 + position: absolute;
  192 + content: "";
  193 + display: block;
  194 + left: 30rpx;
  195 + top: 35rpx;
  196 + width: 8rpx;
  197 + height: 35rpx;
  198 + background-color: #ff9400;
  199 + border-radius: 4rpx;
  200 +}
  201 +
  202 +/* 重量总计 */
  203 +
  204 +.total {
  205 + padding-left: 30rpx;
  206 + color: #666;
  207 + font-size: 20rpx;
  208 + display: flex;
  209 + flex-direction: row;
  210 + align-items: center;
  211 +}
  212 +
  213 +.total text {
  214 + font-size: 32rpx;
  215 + color: #333;
145 } 216 }
146 217
147 .btns { 218 .btns {
@@ -165,3 +236,58 @@ ec-canvas { @@ -165,3 +236,58 @@ ec-canvas {
165 color: #ff9400; 236 color: #ff9400;
166 border-left: 1rpx solid #f5f5f5; 237 border-left: 1rpx solid #f5f5f5;
167 } 238 }
  239 +
  240 +/* 流水 */
  241 +
  242 +.second_total {
  243 + padding: 40rpx 30rpx 20rpx;
  244 + display: flex;
  245 + justify-content: flex-end;
  246 + flex-direction: row;
  247 + font-size: 28rpx;
  248 +}
  249 +
  250 +.table_title {
  251 + display: flex;
  252 + flex-direction: row;
  253 + justify-content: space-around;
  254 + align-items: center;
  255 + padding: 30rpx 0 20rpx;
  256 + font-size: 28rpx;
  257 + color: #666;
  258 + border: 1rpx solid #f5f5f5;
  259 +}
  260 +
  261 +.table_tr {
  262 + display: flex;
  263 + flex-direction: row;
  264 + justify-content: space-around;
  265 + align-items: center;
  266 + padding: 30rpx 0 20rpx;
  267 + font-size: 24rpx;
  268 + color: #666;
  269 + border-bottom: 1rpx solid #f5f5f5;
  270 +}
  271 +
  272 +.tr_time {
  273 + font-size: 28rpx;
  274 + color: #333;
  275 +}
  276 +
  277 +.tr_btn {
  278 + color: #ffb77e;
  279 +}
  280 +
  281 +.tr_name {
  282 + width: 120rpx;
  283 + white-space: nowrap;
  284 + overflow: hidden;
  285 + text-overflow: ellipsis;
  286 +}
  287 +
  288 +.tr_pos {
  289 + width: 120rpx;
  290 + white-space: nowrap;
  291 + overflow: hidden;
  292 + text-overflow: ellipsis;
  293 +}