当前位置:网站首页>Uni app wechat applet - Mall (8) - order details
Uni app wechat applet - Mall (8) - order details
2022-07-19 01:31:00 【Xu xiaoshuo】
In our last article, we wrote about the design and implementation of the product details page , This article describes the order details , Order details are nothing more than the classification of several states of goods , Refer to a treasure , Divide the goods into pending payments 、 To be delivered 、 To be received 、 Completed and other States , And then use Vant Weapp In the component “Tab TAB ” Classify its status , And then use “Card Commodity card ” The component displays the goods under the corresponding tab .
The renderings are as follows :



stay “Card Commodity card ” Used a tag The slot uses unused colors and words in the upper right corner to indicate the status of the product , In all orders , You can see the product information in all States .
The specific code is as follows :
<template>
<view class="orderTabs">
<!-- Set all order header navigation bar
sticky Turn on sticky layout
swipeable Open the slide switch tab
-->
<van-tabs sticky @click="orderTabs" :active="active">
<van-tab v-for="item in navArr" :title="item.title" :name="item.name" :key="item.name">
<view class="navTabs">
<van-swipe-cell v-for="(datas,index) in showDatas" :key="datas.orderId">
<view class="chengboxs">
</view>
<van-card class="goods-card" :desc="' The order number :'+datas.orderId" :num="datas.orderNum" :price="formatPrice(datas.orderPrice)"
:title="datas.orderTitle" :thumb="datas.thumb">
<view slot="tags">
<van-tag class="vantags" v-if="tagsShow" size="medium" :type="datas.orderType">{
{datas.orderStateText}}</van-tag>
</view>
</van-card>
</van-swipe-cell>
</view>
</van-tab>
</van-tabs>
</view>
</template>
<script>
export default {
data() {
return {
active: 'all', // The default display state
showDatas: [], // The data that needs to be displayed
tagsShow: true,
navArr: [{
title: ' All orders ',
name: 'all'
},
{
title: ' To be paid ',
name: 'dfk'
},
{
title: ' To be delivered ',
name: 'dfh'
},
{
title: ' To be received ',
name: 'dsh'
},
{
title: ' Completed ',
name: 'ywc'
},
{
title: ' Cancelled ',
name: 'yqx'
}
],
navDatas: [{
orderId: 202008010001,
orderState: 'dfk',
orderStateText: ' To be paid ',
orderType: 'primary',
orderTitle: ' Three squirrel gift bags (1)',
orderPrice: 19.00,
orderNum: 1,
thumb: '/static/images/goodsimg/szss.jpg'
},
{
orderId: 202008010002,
orderState: 'dfh',
orderStateText: ' To be delivered ',
orderType: 'primary',
orderTitle: ' Three squirrel gift bags (2)',
orderPrice: 29.00,
orderNum: 2,
thumb: '/static/images/goodsimg/szss.jpg'
},
{
orderId: 202008010003,
orderState: 'dsh',
orderStateText: ' To be received ',
orderType: 'primary',
orderTitle: ' Three squirrel gift bags (3)',
orderPrice: 39.00,
orderNum: 3,
thumb: '/static/images/goodsimg/szss.jpg'
},
{
orderId: 202008010004,
orderState: 'ywc',
orderStateText: ' Completed ',
orderType: 'success',
orderTitle: ' Three squirrel gift bags (4)',
orderPrice: 49.00,
orderNum: 4,
thumb: '/static/images/goodsimg/szss.jpg'
},
{
orderId: 202008010005,
orderState: 'yqx',
orderStateText: ' Cancelled ',
orderType: 'warning',
orderTitle: ' Three squirrel gift bags (5)',
orderPrice: 59.00,
orderNum: 5,
thumb: '/static/images/goodsimg/szss.jpg'
},
{
orderId: 202008010005,
orderState: 'dfk',
orderStateText: ' To be paid ',
orderType: 'primary',
orderTitle: ' Three squirrel gift bags (6)',
orderPrice: 69.00,
orderNum: 6,
thumb: '/static/images/goodsimg/szss.jpg'
}
]
}
},
onLoad() {
},
methods: {
// Label switching
orderTabs(e) {
var that = this;
that.showDatas = [];
console.log(e.detail);
for (var i = 0; i < that.navDatas.length; i++) {
if (e.detail.name == that.navDatas[i].orderState) {
that.showDatas.push(that.navDatas[i])
} else if (e.detail.name == 'all') {
that.showDatas = that.navDatas
}
}
console.log(that.showDatas);
},
// Calculate the price
formatPrice(price) {
return price.toFixed(2);
},
},
onLoad: function(option) {
this.active = option.active
this.showDatas = [];
for (var i = 0; i < this.navDatas.length; i++) {
if (option.active == this.navDatas[i].orderState) {
this.showDatas.push(this.navDatas[i])
} else if (option.active == 'all') {
this.showDatas = this.navDatas
}
}
}
}
</script>
<style>
.navTabs {
width: 100%;
height: 100%;
margin-bottom: 5%;
}
.navTabs .goods-card {
margin-bottom: 20rpx;
}
.vantags {
position: absolute;
top: -2rpx;
right: -20rpx;
}
.chengboxs {
margin-top: 10rpx;
}
</style>
The design and implementation of the order details page is relatively simple , This article will be written here first , If there is anything wrong with the content of the article , Still hope more , thank you ~
边栏推荐
- 智能指针(shared_ptr、unique_ptr、weak_ptr)
- Day13 mixed view base class
- How to modify the color of a line of text in the elemtnui table (elemtnui table modifies the color of a line of text)
- 自己封装的风格化的开关卡片组件
- C Programming Language (2nd Edition)--读书笔记--1.5.4
- 微信推送-模版消息参数配置
- Oracle database parameter change
- three.js初体验:模拟一个小树杈的生长
- (九)Shell 输入输出重定向
- 量化行业知识汇总
猜你喜欢
![Understand PHP from [Fifth space 2021] easycleanup_ session](/img/fc/95332d488dd6096f3a3f6a9fb11644.png)
Understand PHP from [Fifth space 2021] easycleanup_ session

JSX compilation

uni-app微信公众号(4)——地址管理页面

Oracle database 12C parameter files (SPFILE and pfile)
![[GFCTF 2021]Baby_ Cve-2021-41773 on the web](/img/e0/7541860509b3b77f758447e377f2f7.png)
[GFCTF 2021]Baby_ Cve-2021-41773 on the web

gtest与gmock的安装与使用

深度之眼三——(4,5)】数学:矩阵特征值与特征向量2

Maker-鸿蒙应用开发培训笔记02

From catf1ag two-hour AK match pwn/attack killing, summarize the common command guide of emergency response

鼠标右键菜单添加快速打开选项遇见的错误:
随机推荐
Oracle automatic storage management 18C step-by-step installation -1
Day04 routing layer
js截取字符串前几位或者截取字符串后几位
Deployment of cobalstrike (with resources)
“我的”Bug大全(转载)
深度之眼三——(7)】数学:svd分解的应用
Buuctf [bjdctf2020]ezphp1 detailed explanation
mock平台的使用说明
uniapp调用地图,进行位置查询,标记定位
微信推送-模版消息参数配置
uni-app微信公众号(5)——新增、修改地址
Eye of depth III - (6)] mathematics: matrix diagonalization and quadratic form 1
Add, delete, modify and check the connection between the two tables
2022年暑假ACM热身练习2(总结)
Understand PHP from [Fifth space 2021] easycleanup_ session
缤纷彩色文字广告代码,文字广告代码美化版,给网站添加文字广告教程
js替换字符串某个字符,js修改字符串中指定字符
Eye of depth III - (7)] mathematics: application of SVD decomposition
Vue项目部署,清理缓存
XSS simple summary