From 3bdac82e0066f97307fc6a7177cecdf89a5ba7e1 Mon Sep 17 00:00:00 2001 From: whycq <whycq> Date: 星期四, 07 四月 2022 09:23:39 +0800 Subject: [PATCH] # --- pages/basics/demo.vue | 230 +++++++++++++++++--------------------------------------- 1 files changed, 71 insertions(+), 159 deletions(-) diff --git a/pages/basics/demo.vue b/pages/basics/demo.vue index 81c4b06..d670295 100644 --- a/pages/basics/demo.vue +++ b/pages/basics/demo.vue @@ -1,36 +1,46 @@ <template> <view> - <scroll-view> - <view class="demo-tab"> - <checkbox-group @change="checkbox"> - <label v-for="(item,index) in data" :key="index" class="demo-list bg-false" :class="'bg-'+item.checked" > - <view class="demo-list-left"> - <checkbox :value="item.id+''" :checked="item.checked" /> - </view> - <view class="demo-list-right"> - <view><text style="width: 90rpx;">璁㈠崟 | </text>{{item.orderNo}}<text>搴忓彿锛歿{index+1}} </text></view> - <view><text >鍟嗗搧缂栫爜锛�</text>{{item.matnr}}</view> - <view ><text>搴斿叆鏁伴噺锛�</text><view class="text-num">{{item.anfme}}</view><text>鍟嗗搧鍚嶇О锛�</text>{{item.maktx}}</view> - <view><text>宸插叆鏁伴噺锛�</text><view class="text-num">{{item.inQty}}</view><text>璁㈠崟鐘舵�侊細</text>{{item.state$}}</view> - </view> - </label> - </checkbox-group> + <!-- 鎼滅储鏍� --> + <view> + <view class="cu-bar bg-white search"> + <view class="search-form radius"> + <text class="cuIcon-search"></text> + <input v-model="orderNo" :adjust-position="false" type="text" placeholder="鎵爜 / 杈撳叆 (鍗曟嵁缂栧彿)" confirm-type="search" @input="search()"></input> + <text class="cuIcon-close" @click="reset()"></text> + </view> + <view class="action"> + <button class="cu-btn bg-yellow" style="color: #fff;">鎼� 绱�</button> + </view> </view> - </scroll-view> - <view class="foot flex justify-around"> - <label> - <checkbox :checked="check" @click="allChecked()">{{checkText}}</checkbox> - </label> - <label> - <text @click="reChecked()">鍙嶉��</text> - </label> - <label for=""> - <button class="cu-btn bg-yellow lg" @click="shangjia()">涓婃灦</button> - </label> - <label for=""> - <button class="cu-btn bg-yellow lg">鎾ら攢涓婃灦</button> - </label> - + </view> + <view class="margin-top"> + <uni-table border stripe type="selection" emptyText="娌℃湁鏇村鏁版嵁"> + <!-- 琛ㄥご --> + <uni-tr > + <uni-th align="center" width="200">璁㈠崟</uni-th> + <uni-th align="center">搴斿叆搴撻噺</uni-th> + <uni-th align="center">宸插叆搴撻噺</uni-th> + <uni-th align="center" width="200">鍟嗗搧缂栫爜</uni-th> + <uni-th align="center">鍟嗗搧鍚嶇О</uni-th> + <uni-th align="center">璁㈠崟鐘舵��</uni-th> + <uni-th align="center"width="200">鎿嶄綔</uni-th> + </uni-tr> + <!-- 琛ㄤ綋 --> + <uni-tr v-for="(item, index) in tabData" :key="index"> + <uni-td align="center">{{item.orderNo}}</uni-td> + <uni-td align="center">{{item.anfme}}</uni-td> + <uni-td align="center">{{item.inQty}}</uni-td> + <uni-td align="center">{{item.matnr}}</uni-td> + <uni-td align="center">{{item.maktx}}</uni-td> + <uni-td align="center">{{item.state$}}</uni-td> + <uni-td> + <view class="flex justify-around"> + <button class="cu-btn bg-orange sm">涓� 鏋�</button> + <button class="cu-btn bg-red sm">鎾ら攢涓婃灦</button> + </view> + </uni-td> + </uni-tr> + </uni-table> </view> </view> </template> @@ -39,30 +49,39 @@ export default { data() { return { - data: [], - check:false, - checkText:'鍏ㄩ��', - checkedData:[], + tabData: [], + searchData: {}, + orderNo: '', + needData:{}, } }, - mounted() { + mounted(){ const UIP = uni.getStorageSync('UIP'); this.baseIP = UIP; const UPORT = uni.getStorageSync('UPORT'); this.basePORT = UPORT; this.render() }, + onLoad() { + + }, methods: { - // 琛ㄦ牸鍔犺浇 - render(param) { + // 鎼滅储 + search() { let that = this; - if(param) { - that.needData['order_no'] = param; - that.getData(); - } else { - that.getData(); - } + // that.tabData.forEach(function(e){ + // that.searchData = e.orderNo + // }) + this.render(that.orderNo) }, + // 閲嶇疆 + reset() { + let that = this; + that.orderNo = ''; + that.needData['order_no'] = ''; + that.getData(); + }, + // 鑾峰彇琛ㄦ牸鏁版嵁 getData() { let that = this uni.request({ @@ -72,133 +91,26 @@ success(res) { var res = res.data if (res.code === 200) { - that.data = res.data.records + that.tabData = res.data.records } } }) }, - checkbox: function (e) { - var items = this.data, - values = e.detail.value; - for (var i = 0, lenI = items.length; i < lenI; ++i) { - const item = items[i] - item.id = item.id + '' - if(values.indexOf(item.id) >= 0){ - this.$set(item,'checked',true) - }else{ - this.$set(item,'checked',false) - } - } - if (values.length == items.length) { - this.check = true - this.checkText = "鍙栨秷鍏ㄩ��" + + // 琛ㄦ牸鍔犺浇 + render(param) { + let that = this; + if(param) { + that.needData['order_no'] = param; + that.getData(); } else { - this.check = false - this.checkText = "鍏ㄩ��" - } - }, - reChecked() { // 鍙嶉�� - var checkArr = [] - for (var i = 0; i < this.data.length;i++) { - if (this.data[i].checked == true) { - this.$set(this.data[i],'checked',false) - }else{ - this.$set(this.data[i],'checked',true) - } - if (this.data[i].checked == true) { - checkArr.push(this.data[i].checked) - } - } - if (checkArr.length == this.data.length) { - this.check = true - this.checkText = "鍙栨秷鍏ㄩ��" - } else { - this.check = false - this.checkText = "鍏ㄩ��" - } - }, - allChecked(e){ // 鍏ㄩ�� - if (this.check == true) { - for (var i = 0; i < this.data.length;i++) { - this.$set(this.data[i],'checked',false) - } - this.check = false - this.checkText = "鍏ㄩ��" - } else { - for (var i = 0; i < this.data.length;i++) { - this.$set(this.data[i],'checked',true) - } - this.check = true - this.checkText = "鍙栨秷鍏ㄩ��" + that.getData(); } - }, - shangjia() { - this.checkedData = [] - for (var i = 0; i < this.data.length; i++) { - if (this.data[i].checked == true) { - this.checkedData.push(this.data[i]) - } - } - console.log(this.checkedData) } } } </script> <style> - .bg-false { - background-color: #FFFFFF; - } - .bg-true { - background-color: #ebebeb; - } - .demo-tab { - } - .demo-list { - - border-bottom: 1px solid #d8d8d8; - height: 160rpx; - } - .demo-list:last-child { - margin-bottom: 99rpx; - } - label { - display: block; - } - .demo-list-left { - display: inline-block; - width: 100rpx; - text-align: center; - height: 150rpx; - line-height: 150rpx; - } - .demo-list-right { - display: inline-block; - width: 650rpx; - float: right; - } - - .demo-list-right text { - display: inline-block; - width: 150rpx; - } - .text-num { - display: inline-block; - width: 90rpx; - } - - .foot { - width: 100%; - height: 100rpx; - line-height: 100rpx; - background-color: #ffffff; - position: fixed; - bottom: 0; - border-top: 1rpx solid #d8d8d8; - } - checkbox { - /* transform:scale(0.7) */ - } - </style> -- Gitblit v1.9.1