uniapp 实现销售订单页面-风格1

24 篇文章 2 订阅

1.效果图片

 2.源代码

<template>
	<view class="container">
	   <u-navbar back-text="返回" title-color="#fff" back-icon-color="#ffffff" 
			:is-fixed="true" :is-back="true" 
			:back-text-style="{'color':'#fff'}"
			:background="background"  
			:custom-back="goback">
		    <view class="slot-wrap">
		    	<view class="search-wrap" >
		    		<!-- 如果使用u-search组件,必须要给v-model绑定一个变量 -->
		    		<u-search v-model="selectParams.keyWord" 
					@search="search()"  :placeholder="placeholder" 
					:show-action="false"  height="56" 
					:action-style="{color: '#fff'}"></u-search>
		    	</view>
		    </view>		
		</u-navbar>
	   <scroll-view scroll-y  style="height: 100%;width: 100%;" 
	      @scrolltolower="reachBottom" enable-back-to-top>
		   <!-- 正文内容 -->  
		   <view class="content"> 
		       <view   v-for="(item,index) in dataList" :key="index">
			   <view class="item">
				     <view class="item-top">
				     		<view class="item-top-left">
								{{msgType}}
							</view>
							<view class="item-top-right">
							   •••
							</view>
				     </view>
					 <view class="item-content">
					 	  <view class="item-content-item">
							  {{cmpName}}
						  </view>
						  <view class="item-content-item">
							  <view class="item-content-item-left">客户:</view>
							  <view class="item-content-item-right">
								  {{item.khaname_long}}
							  </view>
						  </view>
						  <view class="item-content-item">
							  <view class="item-content-item-left">单号:</view>
							  <view class="item-content-item-right">
								  {{item.prdacode}}
							  </view>
						  </view>
						  <view class="item-content-item">
							  <view class="item-content-item-left">项数:</view>
							  <view class="item-content-item-right">
								  {{item.items}}
							  </view>
						  </view>
						  <view class="item-content-item">
							  <view class="item-content-item-left">数量:</view>
							  <view class="item-content-item-right">
								  {{item.qty}}
							  </view>
						  </view>
						  <view class="item-content-item">
							  <view class="item-content-item-left">金额:</view>
							  <view class="item-content-item-right">
								  {{item.sy}} 元
							  </view>
						  </view>
						  <view class="item-content-item">
							  <view class="item-content-item-left">备注:</view>
							  <view class="item-content-item-right">
								  {{item.remark}}
							  </view>
						  </view>
					 </view>
					 <view class="item-btn" @click="showItem(item)">
					 		<view class="item-btn-left">查看详情</view>		 
							<u-icon name="arrow-right" class="item-btn-right"></u-icon>
					 </view>
			     </view>
		      </view>	   
		    </view>	   
		   <u-loadmore :status="loadStatus[0]" bgColor="#f2f2f2">  
		   </u-loadmore>
	      </scroll-view>

	</view>		
</template>

<script>
	export default {
		data() {
			return {
				background: {
					'background-image': 'linear-gradient(45deg, rgb(28, 187, 180), rgb(141, 198, 63))'
				},
				placeholder:"客户名称,生产单号,客户单号",
				selectParams:{
					keyWord:'',
					pageSize:3,
					pageIndex:1
				},
				list:[{
						name: '销售订单'
					}],
				current:0,
				swiperCurrent:0,
				totalPages:0,
				dataList:[],
				loadStatus: ['loadmore','loadmore','loadmore'],
				msgType:"销售订单通知",
				cmpName:"佛山市金属制品有限公司-销售订单"
				
			}
		},
		
		onLoad() {
			this.getOrderList()
		},
		
		methods: {		
			goback(){
				uni.reLaunch({url:'/pages/index/index'}) //要用这个才可以
			},
			async getOrderList(){
				const res = await this.$u.api.xsbillddList(this.selectParams)
				for(let i = 0,length = res.length;i<length;i++)
				{
					res[i].sy = parseFloat(res[i].sy).toFixed(2)
					res[i].qty = parseFloat(res[i].qty).toFixed(2)
					this.dataList.push(res[i])
				}
				if(res.length>0)
				{
					this.totalPages =Math.ceil(res[0].guid_count/
					this.selectParams.pageSize)
				}
				this.loadStatus.splice(0,1,"loadmore")
				
			},
			search(){
				this.selectParams.pageIndex = 1
				this.totalPages = 0
				this.dataList = []
				this.getOrderList()
			},
			reachBottom(){
				this.loadStatus.splice(0,1,"loading")
				setTimeout(() => {
					if(this.selectParams.pageIndex<this.totalPages)
					{
					   this.selectParams.pageIndex  = this.selectParams.pageIndex  + 1
					   this.getOrderList();	
					}
					else{
						this.loadStatus.splice(0,1,"nomore")
					}
				}, 500);
			},
			// 查看详情
			showItem(item){
				const aguid = item.aguid
				console.log(aguid)
				const option = {aguid}
				this.$u.route('/pages/xsbilldd/xsbillddDetail',option)
			}
		}
	}
</script>

<style>
/* #ifndef H5 */
page {
	height: 100%;
	background-color: #f2f2f2;
}
/* #endif */
</style>

<style lang="scss" scoped>
	
    .container{
		display: flex;
		flex-direction: column;
		height: calc(100vh - var(--window-top));
		width: 100%;
		.slot-wrap{
			display: flex;
			align-items: center;
			flex: 1;
			.search-wrap{
				margin: 0 20rpx;
				flex: 1;
			}
		}
		.content{
			flex:1;
			.item{
				height:650rpx;
				margin-left: 49rpx;
				margin-top:15rpx;
				margin-right:49rpx;
				border-radius: 15rpx;
				background-color:#FFFF;
				.item-top{
					padding-left: 52rpx;
					padding-right: 52rpx;
					padding-top: 48rpx;
					display: flex;
					justify-content: space-between;
					align-items: center;
					.item-top-left{
						font-size: 44rpx;
					}
					.item-top-right {
						font-size: 44rpx;
					}
				}
				.item-content{
					height: 450rpx;
					border-bottom:1rpx solid #e8e8e8 ;
					background-color: #FFFFFF;
					.item-content-item{
						color: #777777;
						padding-left: 52rpx;
						padding-top: 20rpx;
						font-size:32rpx ;
						display:flex;
						flex-direction: row;
						.item-content-item-left{
							color:#8b8b8b;
							padding-right: 35rpx;
						}
						.item-content-item-right{
							color:#1b286e;
						}
					}
					
				}
				.item-btn{
					height: 60rpx;
					font-size: 36rpx;
					padding-top: 20rpx;
					padding-left: 52rpx;
					background-color: #FFFFFF;
					display: flex;
					justify-content: space-between;
					align-items: center;
					.item-btn-right{
						margin-right: 50rpx;
						color:#e8e8e8;
					}
				}
			}
		}
	}
</style>

  • 2
    点赞
  • 11
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论
UniApp 是一款跨平台的应用开发框架,可以在一个项目中同时开发出小程序、App、H5 等多个平台的应用。要实现类似于 Vue-Router 的功能,可以按照以下步骤进行: 1. 添加路由配置:在项目的根目录下找到`pages.json`文件,该文件是 UniApp页面配置文件。在该文件中,添加一个 `pages` 数组,用来存放所有的页面路径,以及页面的配置信息。每个页面都可以配置一个 `name`,用于标识该页面,在后续路由跳转时使用。 2. 创建路由实例:在 main.js(或者其他入口文件)中,创建一个路由实例并导出供全局使用。在路由实例中可以定义多个路由映射关系,比如可以使用一个数组,将路由的 path 和 component 关联起来。 3. 在页面中使用路由:在需要跳转的页面中,使用 `uni.navigateTo` 或者 `uni.switchTab`等方法来触发路由的跳转。 4. 监听路由事件:如果需要在路由跳转前或者跳转后进行额外的处理,可以监听路由跳转的生命周期事件,如 `beforeEnter`、`beforeLeave`、`afterEnter` 等。在这些事件的回调函数中执行相应的逻辑。 5. 获取路由参数:在目标页面中,可以通过 `this.$route.query` 或者使用 uni-app 封装的 `$mp.query` 来获取传递的路由参数。 通过以上步骤,我们可以在 UniApp实现类似于 Vue-Router 的路由功能。在 UniApp 中,路由的使用方式与 Vue-Router 类似,但可能存在一些细微的差别。可以参考 UniApp 的官方文档和示例代码,更深入地了解如何使用 UniApp 的路由功能。

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

Listest

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值