Blame view

lvdao-miniapp/pages/orderList/orderList.vue 4.02 KB
3f535f30   杨鑫   '初始'
1
2
  <template>
  	<view class="page">
866d1a6a   wesley88   1
3
  		<u-tabs active-color="#26c570" :list="list" :current="current" @change="change"></u-tabs>
6b583a85   wesley88   1
4
  		<view v-if="alllist.length == 0" style="text-align: center;margin-top: 50rpx;" class="tit1">暂无数据</view>
866d1a6a   wesley88   1
5
  		<view style="padding: 0 20rpx;">
a72e57a5   wesley88   1
6
  			<view v-for="(item,index) in alllist" :key="index" @click="gopath('/pages/orderList/orderListdetails',item.orderId)"
866d1a6a   wesley88   1
7
  				style="background: #fff;margin-top: 40rpx;padding: 30rpx;border-radius: 18rpx;">
a72e57a5   wesley88   1
8
  				<view style="display: flex;align-items: center;justify-content: space-between;margin-bottom: 20rpx;">
866d1a6a   wesley88   1
9
  					<view style="display: flex;align-items: center;">
a72e57a5   wesley88   1
10
  						<view class="t1" style="margin-right: 15rpx;">订单号:{{item.orderId}}</view>
866d1a6a   wesley88   1
11
12
  						<u-icon name="arrow-right" color="#979797" size="24"></u-icon>
  					</view>
a72e57a5   wesley88   1
13
14
15
16
17
18
19
  					<view class="t1">
  						<span v-if="item.state === 1">待付款</span>
  						<span v-if="item.state === 2">待发货</span>
  						<span v-if="item.state === 3">待收货</span>
  						<span v-if="item.state === 4">已完成</span>
  						<span v-if="item.state === 5">已关闭</span>
  					</view>
866d1a6a   wesley88   1
20
  				</view>
a72e57a5   wesley88   1
21
22
  				<view v-for="(item1,index1) in item.products" :key="index1"
  					style="display: flex;justify-content: space-between;align-items: center;margin-bottom: 20rpx;">
866d1a6a   wesley88   1
23
24
  					<view style="display: flex;">
  						<view>
a72e57a5   wesley88   1
25
26
  							<image style="width: 200rpx;height: 200rpx;bitem-radius: 18rpx;overflow: hidden;" mode="aspectFill"
  								:src="imgurl+item1.image"></image>
866d1a6a   wesley88   1
27
28
  						</view>
  						<view
a72e57a5   wesley88   1
29
30
31
  							style="display: flex;flex-direction: column;justify-content: space-between;margin-left: 15rpx;">
  							<view>{{item1.productName}}</view>
  							<view v-if="item1.value">规格:{{ item1.value }}</view>
866d1a6a   wesley88   1
32
33
  						</view>
  					</view>
a72e57a5   wesley88   1
34
35
36
  					<view style="display: flex;flex-direction: column;justify-content: space-between;height: 200rpx;text-align: right;">
  						<view class="t1">¥ {{item1.productPrice*item1.number}}</view>
  						<view class="t1">X{{ item1.number }}</view>
866d1a6a   wesley88   1
37
38
39
40
41
  					</view>
  				</view>
  				<view
  					style="display: flex;justify-content: space-between;padding-top: 30rpx;border-top: 2rpx solid #eee;align-items: center;">
  					<view>
a72e57a5   wesley88   1
42
43
  							共{{item.products.length}}件商品,合计
  							<text style="color: red;">¥{{ item.price }}</text>
866d1a6a   wesley88   1
44
  					</view>
a72e57a5   wesley88   1
45
46
47
48
49
  					<!-- 下单时间: -->
  					<view class="t1">{{item.createTime}}</view>
  					<!-- 					<view
  						style="background: #26c570;color: #fff;bitem-radius: 36rpx;font-size: 20rpx;padding: 14rpx 20rpx;">
  						查看详情</view> -->
ad7d1a78   杨鑫   '最新'
50
51
  				</view>
  			</view>
866d1a6a   wesley88   1
52
  		</view>
3f535f30   杨鑫   '初始'
53
54
55
56
57
58
59
  	</view>
  </template>
  
  <script>
  	export default {
  		data() {
  			return {
866d1a6a   wesley88   1
60
61
  				list: [
  					{
a72e57a5   wesley88   1
62
  						type:'',
866d1a6a   wesley88   1
63
  						name: '全部'
a72e57a5   wesley88   1
64
  					},
866d1a6a   wesley88   1
65
  					{
a72e57a5   wesley88   1
66
  						type:'1',
866d1a6a   wesley88   1
67
  						name: '待付款'
a72e57a5   wesley88   1
68
  					},
866d1a6a   wesley88   1
69
  					{
a72e57a5   wesley88   1
70
  						type:'2',
866d1a6a   wesley88   1
71
72
73
  						name: '待发货',
  					},
  					{
a72e57a5   wesley88   1
74
  						type:'3',
866d1a6a   wesley88   1
75
76
77
  						name: '已发货',
  					},
  					{
a72e57a5   wesley88   1
78
  						type:'4',
866d1a6a   wesley88   1
79
80
81
  						name: '已完成',
  					},
  					{
a72e57a5   wesley88   1
82
  						type:'5',
866d1a6a   wesley88   1
83
84
85
86
  						name: '已关闭',
  					},
  				],
  				current: 0,
a72e57a5   wesley88   1
87
  				alllist: [],
3f535f30   杨鑫   '初始'
88
  				pageindex: {
3f535f30   杨鑫   '初始'
89
90
  					page: 1,
  					pageSize: 10,
a72e57a5   wesley88   1
91
  					state:''
3f535f30   杨鑫   '初始'
92
  				},
a72e57a5   wesley88   1
93
94
  				imgurl: '',
  				total:0
3f535f30   杨鑫   '初始'
95
96
  			};
  		},
a72e57a5   wesley88   1
97
98
  		onLoad(optiong) {
  			this.imgurl = this.$img
6b583a85   wesley88   1
99
100
101
102
103
104
105
  			if(uni.getStorageSync('shopId')) {
  				this.getALL()
  			} else {
  				
  			}
  			
  			
3f535f30   杨鑫   '初始'
106
  		},
a72e57a5   wesley88   1
107
108
109
110
111
112
  		onReachBottom (e){
  			console.error(e)
  			if (this.alllist.length < this.total) {
  				this.pageindex.page++
  				this.getALL()
  			}
3f535f30   杨鑫   '初始'
113
114
  		},
  		methods: {
a72e57a5   wesley88   1
115
116
117
118
119
  			gopath(url,id){
  				uni.navigateTo({
  					url:url+'?id='+id
  				})
  			},
3f535f30   杨鑫   '初始'
120
  			getALL() {
a72e57a5   wesley88   1
121
122
123
124
125
126
  				this.$http.sendRequest('/order/getAll', 'POST', this.pageindex, 1).then(res => {
  					//成功回调	
  					this.alllist = [...this.alllist,...res.data.data.list]
  					this.total = res.data.data.total
  					console.error(this.alllist)
  				})
866d1a6a   wesley88   1
127
128
129
  			},
  			change(index) {
  				this.current = index;
a72e57a5   wesley88   1
130
131
132
133
134
135
136
137
  				if(this.current == 0) {
  					this.pageindex.state = ''
  				} else {
  					this.pageindex.state = this.list[this.current].type
  				}
  				this.pageindex.page = 1
  				this.alllist = []
  				this.getALL()
3f535f30   杨鑫   '初始'
138
139
140
141
142
143
144
  			}
  
  		}
  	}
  </script>
  
  <style scoped lang="scss">
a72e57a5   wesley88   1
145
  	.page {}
3f535f30   杨鑫   '初始'
146
  
866d1a6a   wesley88   1
147
148
149
  	.t1 {
  		font-size: 26rpx;
  		color: #979797;
3f535f30   杨鑫   '初始'
150
  	}
3f535f30   杨鑫   '初始'
151
  </style>