Browse Source

Merge branch 'test' of git.oschina.net:yiguanjia/php into test

洪海涛 8 năm trước cách đây
mục cha
commit
0234c2c048
1 tập tin đã thay đổi với 70 bổ sung58 xóa
  1. 70 58
      www/vue/src/components/balanceLog.vue

+ 70 - 58
www/vue/src/components/balanceLog.vue

@@ -15,23 +15,27 @@
 			<div class="btn-recharge" @click="recharge">充值</div>
 			<button-tab>
 				<button-tab-item selected @on-item-click="consoleIndex(1)">充值</button-tab-item>
-				<button-tab-item @on-item-click="consoleIndex(2)">消</button-tab-item>
+				<button-tab-item :selected="!isSelected" @on-item-click="consoleIndex(2)">消</button-tab-item>
 			</button-tab>
 		</div>
-		<div style="color: #0b0b0b" v-for="(item, index) in tmp">
-			<group>
-				<cell
-					:title="item.time"
-					is-link
-					value-align="left"
-					:border-intent="false"
-					:arrow-direction="isActive === index ? 'up' : 'down'" @click.native="show(index)"></cell>
-				<p class="slide" :class="{ animate: isActive == index }">
-					<span style="display: block;text-align: left;">金额:{{item.amount}}</span>
-					<span style="display: block;text-align: left;">支付用途:{{item.memo}}</span>
-					<span style="display: block;text-align: left;">交易类型:{{item.type_str}}</span>
-				</p>
-			</group>
+		<div style="margin-top: 165px;">
+			<div style="color: #0b0b0b" v-for="(item, index) in tmp">
+
+				<group>
+					<cell
+							:title="item.time"
+							is-link
+							value-align="left"
+							:border-intent="false"
+							:arrow-direction="isActive === index ? 'up' : 'down'" @click.native="show(index)"></cell>
+					<p class="slide" :class="{ animate: isActive == index }">
+						<span v-if="frontColor" style="display: block;text-align: left;color: green;">充值金额:{{item.amount}}</span>
+						<span v-else style="display: block;text-align: left;color: red;" >消费金额:{{item.amount}}</span>
+						<span style="display: block;text-align: left;">支付用途:{{item.memo}}</span>
+						<span style="display: block;text-align: left;">交易类型:{{item.type_str}}</span>
+					</p>
+				</group>
+			</div>
 		</div>
 		<!--<div style="margin-top: 165px;">-->
 		<!--<h5>45</h5>-->
@@ -76,13 +80,16 @@
         tmp: [],
         tmpL: -1,
         timeStatus: {},
-        moduleShow: false
+        moduleShow: false,
+	      frontColor: 1,
+        isSelected: true
       }
     },
     components: {
       Tab, TabItem, ButtonTab, ButtonTabItem, Sticky, Cell, Group
     },
-    beforeCreate () {
+    created () {
+      this.consoleIndex(1)
     },
     methods: {
       time () {
@@ -99,6 +106,9 @@
       },
       determine () {
         this.moduleShow = false
+        this.consoleIndex(1)
+        this.isSelected = true
+        console.log(this.isSelected)
       },
       modalTime (index) {
         switch (index) {
@@ -130,47 +140,49 @@
         }
       },
       consoleIndex (index) {
-        if (this.tmpL === -1) {
-          let balanceInfo = {
-            id: config.userId,
-            start_time: this.year + '-' + this.month + '-01',
-            end_time: this.year + '-' + this.month + '-30',
-          }
-          this.tmp = balanceList(index, balanceInfo)
-          this.tmpL = 1
+        if (index === 1) {
+          this.frontColor = 1
+        } else {
+          this.frontColor = 0
         }
-        console.log(this.tmp)
+				let balanceInfo = {
+				 id: config.userId,
+				 start_time: this.year + '-' + this.month + '-01',
+				 end_time: this.year + '-' + this.month + '-30',
+				 }
+        //  let balanceInfo = {id: config.userId, start_time: '2016-11-01', end_time: '2016-11-30'}
+        this.balanceList(index, balanceInfo)
       },
       recharge () {
         this.$router.push({path: '/recharge'})
+      },
+      balanceList (index, balanceInfo) {
+        let t = []
+        let j = 0
+        axios.post('o2o/user/getUserBalanceLog', qs.stringify(balanceInfo)).then(res => {
+          console.log(index)
+          if (index === 1) {
+            j = 0
+            for (let i in res.data.message) {
+              if (res.data.message[i].amount > 0 && res.data.message[i].memo !== '微信下订单' && res.data.message[i].memo !== '下订单') {
+                t[j++] = res.data.message[i]
+              }
+            }
+          } else if (index === 2) {
+            // 消费
+            j = 0
+            for (let i in res.data.message) {
+              if (res.data.message[i].memo === '微信下订单' || res.data.message[i].memo === '下订单' || res.data.message[i].amount < 0) {
+                t[j++] = res.data.message[i]
+              }
+            }
+          }
+          this.tmp = t
+        })
       }
     }
   }
   // let balanceInfo = {id: config.userId, start_time: '2016-11-01', end_time: '2016-11-30'}
-  function balanceList(index, balanceInfo) {
-    let t = []
-    let j = 0
-    axios.post('o2o/user/getUserBalanceLog', qs.stringify(balanceInfo)).then(res => {
-      if (index === 1) {
-        j = 0
-        for (let i in res.data.message) {
-          if (res.data.message[i].amount > 0 && res.data.message[i].memo !== '微信下订单' && res.data.message[i].memo !== '下订单') {
-            t[j++] = res.data.message[i]
-          }
-        }
-      } else if (index === 2) {
-        // 消费
-        j = 0
-        for (let i in res.data.message) {
-          if (res.data.message[i].memo === '微信下订单' || res.data.message[i].memo === '下订单' || res.data.message[i].amount < 0) {
-            t[j++] = res.data.message[i]
-          }
-        }
-      }
-    })
-    console.log(t)
-    return t
-  }
 </script>
 
 <style lang="less" scoped>
@@ -249,7 +261,7 @@
 			border: 1px solid rgb(197, 159, 0);
 		}
 	}
-	
+
 	.balance-content {
 		background-color: green;
 		padding: 5%;
@@ -257,14 +269,14 @@
 		font-size: 25px;
 		// border-radius: 15px;
 	}
-	
+
 	.vux-button-group {
 		margin-top: 66px;
 		& > a.vux-button-group-current {
 			background-color: #927603 !important;
 		}
 	}
-	
+
 	.recharge-details {
 		width: 100%;
 		margin-bottom: 10px;
@@ -318,7 +330,7 @@
 			border-bottom: 1px solid rgba(0, 0, 0, 0.3);
 		}
 	}
-	
+
 	/*	.show {
 			background-color: black;
 			height: 500px;
@@ -336,13 +348,13 @@
 		max-height: 0;
 		transition: max-height .5s cubic-bezier(0, 1, 0, 1) -.1s;
 	}
-	
+
 	.animate {
 		max-height: 9999px;
 		transition-timing-function: cubic-bezier(0.5, 0, 1, 0);
 		transition-delay: 0s;
 	}
-	
+
 	/*模态框*/
 	.o2o-modal {
 		top: 0;
@@ -414,14 +426,14 @@
 			}
 		}
 	}
-	
+
 	/*模态框动画*/
 	.modal-start {
 		overflow: hidden;
 		max-height: 0;
 		transition: max-height .5s cubic-bezier(0, 1, 0, 1) -.1s;
 	}
-	
+
 	.modalEnd {
 		max-height: 9999px;
 		transition-timing-function: cubic-bezier(0.5, 0, 1, 0);