Blame view

src/pages/user/user.vue 10.5 KB
0db291810   BigBoss   “-mcomfirmOder页面
1
  <template>
fb85b244c   BigBoss   user页面
2
  	<view class="wrap">
55ddb3f8a   范牧   登陆逻辑修改
3
  		<view v-if="isAuth" class="content">
fb85b244c   BigBoss   user页面
4
5
  			<view class="userInfo">
  				<view class="info">
55ddb3f8a   范牧   登陆逻辑修改
6
  					<image :src="headerphoto" mode="aspectFill"></image>
fb85b244c   BigBoss   user页面
7
  					<view class="infoText">
55ddb3f8a   范牧   登陆逻辑修改
8
  						<text class="userName">{{nickName}}</text>
fb85b244c   BigBoss   user页面
9
10
11
12
13
14
15
16
17
  					</view>
  				</view>
  				<view class="service">
  					<image src="../../static/serviceLogo.png" mode="aspectFill"></image>
  				</view>
  			</view>
  			<view class="myOrder">
  				<view class="orderHeader">
  					<text>全部订单</text>
72a08fa45   BigBoss   icon
18
  					<view class="btn" @click="toMyOrder">
fb85b244c   BigBoss   user页面
19
20
21
22
23
  						全部
  						<image src="../../static/right.png" mode="aspectFill"></image>
  					</view>
  				</view>
  				<view class="orderBody">
ab4209caf   喻鹏   update
24
25
  					<view class="item waitPay" @click="toMyOrderPaying">
  						<image src="../../static/waitDeliver.png" mode="aspectFill"></image>
fb85b244c   BigBoss   user页面
26
27
  						<text>待付款</text>
  					</view>
ab4209caf   喻鹏   update
28
  					<view class="item waitDeliver" @click="toPredelivery" >
db5b5fe00   喻鹏   "修改样式细节"
29
  						<image src="../../static/waitPay.png" mode="aspectFill"></image>
fb85b244c   BigBoss   user页面
30
31
  						<text>待发货</text>
  					</view>
ab4209caf   喻鹏   update
32
  					<view class="item waitReceive" @click="torefunProgress">
fb85b244c   BigBoss   user页面
33
34
35
  						<image src="../../static/waitReceive.png" mode="aspectFill"></image>
  						<text>待收货</text>
  					</view>
ab4209caf   喻鹏   update
36
  					<view class="item service" @click="torefundment">
fb85b244c   BigBoss   user页面
37
38
39
40
41
42
43
44
45
46
47
48
49
  						<image src="../../static/service.png" mode="aspectFill"></image>
  						<text>退换/售后</text>
  					</view>
  				</view>
  			</view>
  			<view class="recommend">
  				<view class="title">
  					<view class="line"></view>
  					<view class="text">精选推荐</view>
  					<view class="line"></view>
  				</view>
  				<!-- 商品列表 -->
  				<view class="goods-list">
cc196c33c   喻鹏   购物车和用户推荐接口渲染
50
51
52
53
54
55
56
  					<scroll-view enable-flex @scrolltolower="handleScrolltolower" scroll-y class="product-list">
  						<block v-for="(goods) in userRecommandList " :key="goods.list.sk_id">
  							<view class="product" v-for="(item) in goods.list" :key="item.sk_id">
  								<Card :goods="item" ></Card>
  							</view>
  						</block>
  					</scroll-view>
fb85b244c   BigBoss   user页面
57
58
59
  					<view class="loading-text">{{loadingText}}</view>
  				</view>
  			</view>
0db291810   BigBoss   “-mcomfirmOder页面
60
  		</view>
55ddb3f8a   范牧   登陆逻辑修改
61
62
63
64
65
66
67
68
69
70
71
  		<view v-else class="auth">
  			<view class="icon"></view>
  			<view class="divider"></view>
  			<view class="title">申请获取以下权限</view>
  			<view class="text">获得您的公开信息(昵称、头像等)</view>
  			<button 
  			 type="primary"
  			 open-type="getUserInfo"
  			 @getuserinfo="onGotUserInfo"
  			>授权登陆</button>
  		</view>
0db291810   BigBoss   “-mcomfirmOder页面
72
73
74
75
  	</view>
  </template>
  
  <script>
55ddb3f8a   范牧   登陆逻辑修改
76
77
78
  	import Card from "@/components/CommodityCard/CommodityCard.vue";
  	import store from '@/store';
  
0db291810   BigBoss   “-mcomfirmOder页面
79
  	export default {
fb85b244c   BigBoss   user页面
80
81
82
  		components: {
  			'Card':Card
  			},
0db291810   BigBoss   “-mcomfirmOder页面
83
84
  		data() {
  			return {
fb85b244c   BigBoss   user页面
85
86
  				//商品数据
  				goodsList:[
ab4209caf   喻鹏   update
87
  					{ goods_id: 0, img: "/static/img/goods/p1.jpg", name: '商品名称',originCost:'¥198',price: '¥168', slogan:'1235人浏览' },
fb85b244c   BigBoss   user页面
88
89
90
91
92
93
94
95
96
97
  					{ goods_id: 1, img: '/static/img/goods/p2.jpg', name: '商品名称',originCost:'¥198',price: '¥168', slogan:'1235人浏览' },
  					{ goods_id: 2, img: '/static/img/goods/p3.jpg', name: '商品名称',originCost:'¥198',price: '¥168', slogan:'1235人浏览' },
  					{ goods_id: 3, img: '/static/img/goods/p4.jpg', name: '商品名称',originCost:'¥198',price: '¥168', slogan:'1235人浏览' },
  					{ goods_id: 4, img: '/static/img/goods/p5.jpg', name: '商品名称',originCost:'¥198',price: '¥168', slogan:'1235人浏览' },
  					{ goods_id: 5, img: '/static/img/goods/p6.jpg', name: '商品名称',originCost:'¥198',price: '¥168', slogan:'1235人浏览' },
  					{ goods_id: 6, img: '/static/img/goods/p7.jpg', name: '商品名称',originCost:'¥198',price: '¥168', slogan:'1235人浏览' },
  					{ goods_id: 7, img: '/static/img/goods/p8.jpg', name: '商品名称',originCost:'¥198',price: '¥168', slogan:'1235人浏览' },
  					{ goods_id: 8, img: '/static/img/goods/p9.jpg', name: '商品名称',originCost:'¥198',price: '¥168', slogan:'1235人浏览' },
  					{ goods_id: 9, img: '/static/img/goods/p10.jpg', name: '商品名称',originCost:'¥198',price: '¥168', slogan:'1235人浏览' }
  				],
cc196c33c   喻鹏   购物车和用户推荐接口渲染
98
99
  				isAuth: true, // 是否显示授权页面,
  				pagesnum:1 // 分页请求初始值
0db291810   BigBoss   “-mcomfirmOder页面
100
101
102
  			}
  		},
  		onLoad() {
55ddb3f8a   范牧   登陆逻辑修改
103
104
105
106
107
108
109
110
111
112
113
  			// 判断是否授权
  			uni.getSetting({
  				success(res) {
  					console.log('authSetting',res.authSetting)
  					if(res.authSetting['scope.userInfo'] === true) {
  						this.isAuth = true
  					} else {
  						this.isAuth = false
  					}
  				}
  			})
cc196c33c   喻鹏   购物车和用户推荐接口渲染
114
  			
55ddb3f8a   范牧   登陆逻辑修改
115
116
117
118
119
120
121
122
  		},
  		computed: {
  			nickName() {
  				console.log('nickName', this.$store.state.user.userInfo)
  				return this.$store.state.user.userInfo.nickName;
  			},
  			headerphoto() {
  				return this.$store.state.user.userInfo.headerphoto;
f72f302c7   范牧   合并冲突
123
  			},
db5b5fe00   喻鹏   "修改样式细节"
124
125
126
  			userRecommandList() {
  				console.log('recommandList', this.$store.state.userRecommand.recommandList);
  				return this.$store.state.userRecommand.recommandList;
55ddb3f8a   范牧   登陆逻辑修改
127
  			}
0db291810   BigBoss   “-mcomfirmOder页面
128
  		},
cc196c33c   喻鹏   购物车和用户推荐接口渲染
129
130
131
  		onLoad:function(){
  			console.log('usr-my',this.$store.state.user.userInfo)
  			
f72f302c7   范牧   合并冲突
132
  			store.dispatch('userRecommand/getRecommandList', {
cc196c33c   喻鹏   购物车和用户推荐接口渲染
133
134
135
136
137
  				// uid:468,
  				uid: this.$store.state.user.userInfo.uid,
  				// openid:"oc8cg0d-0mFIInO4LyrCFtInPWr4",
  				openid:this.$store.state.user.userInfo.openid,
  				page: this.pagesnum
f72f302c7   范牧   合并冲突
138
139
  			});
  		},
cc196c33c   喻鹏   购物车和用户推荐接口渲染
140
  
0db291810   BigBoss   “-mcomfirmOder页面
141
  		methods: {
55ddb3f8a   范牧   登陆逻辑修改
142
143
144
145
146
147
148
149
150
151
152
  			// 授权
  			onGotUserInfo(e) {
  				console.log('anthInfo', e);
  				if(e.detail.errMsg == 'getUserInfo:ok') {
  					const { fromInfo } = this.$store.state.user;
  					console.log('=====la', fromInfo)
  					// 用户授权成功
  					store.dispatch('user/getUserInfo', fromInfo);
  					this.isAuth = true
  				}
  			},
72a08fa45   BigBoss   icon
153
154
  			toMyOrder(){
  				uni.navigateTo({
0508098fe   BigBoss   首页筛选列表接口获取
155
  					url: '../myOrder/myOrder?current=0',
72a08fa45   BigBoss   icon
156
157
158
159
  					success: res => {},
  					fail: () => {},
  					complete: () => {}
  				});
066667dc4   BigBoss   add refundProgress
160
161
162
  			},
  			toPredelivery(){
  				uni.navigateTo({
0508098fe   BigBoss   首页筛选列表接口获取
163
  					url: '../myOrder/myOrder?current=2',
066667dc4   BigBoss   add refundProgress
164
165
166
167
168
169
170
  					success: res => {},
  					fail: () => {},
  					complete: () => {}
  				});
  			},
  			toMyOrderPaying(){
  				uni.navigateTo({
0508098fe   BigBoss   首页筛选列表接口获取
171
  					url: '../myOrder/myOrder?current=1',
066667dc4   BigBoss   add refundProgress
172
173
174
175
  					success: res => {},
  					fail: () => {},
  					complete: () => {}
  				});
ab4209caf   喻鹏   update
176
177
178
179
180
181
182
183
184
185
  			},
  			torefundment(){
  				uni.navigateTo({
  					url:'../refundment/refundment',
  				})
  			},
  			torefunProgress(){
  				uni.navigateTo({
  					url:'../refundProgress/refundProgress'
  				})
cc196c33c   喻鹏   购物车和用户推荐接口渲染
186
187
188
189
190
191
192
193
194
  			},
  			handleScrolltolower(){
  				// console.log('usr-my',this.$store.state.user.userInfo)
  				this.pagesnum++;
  				store.dispatch('userRecommand/getRecommandList', {
  					uid: this.$store.state.user.userInfo.uid,
  					openid:this.$store.state.user.userInfo.openid,
  					page: this.pagesnum
  				});
72a08fa45   BigBoss   icon
195
  			}
0db291810   BigBoss   “-mcomfirmOder页面
196
197
198
199
  		}
  	}
  </script>
  
fb85b244c   BigBoss   user页面
200
201
202
203
204
205
  <style lang="scss">
  	.warp{
  		font-size: 24rpx;
  		background-color: #f2f2f2;
  		height: 100vh;
  	}
0db291810   BigBoss   “-mcomfirmOder页面
206
207
208
209
210
  	.content {
  		display: flex;
  		flex-direction: column;
  		align-items: center;
  		justify-content: center;
fb85b244c   BigBoss   user页面
211
  		background-color: #F2F2F2;
0db291810   BigBoss   “-mcomfirmOder页面
212
  	}
fb85b244c   BigBoss   user页面
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
  	.userInfo{
  		background-image: linear-gradient(270deg, #FFA481 0%, #FF6B4A 66%);
  		width: 100%;
  		height: 240rpx;
  		color: #FFFFFF;
  		padding: 60rpx 82rpx 80rpx 44rpx;
  		box-sizing: border-box;
  		display: flex;
  		flex-direction: row;
  		justify-content: space-between;
  		align-items: flex-start;
  		.info{
  			display: flex;
  			flex-direction: row;
  			justify-content: space-between;
  			align-items: center;
  			image{
  				border-radius: 50rpx;
  				height: 100rpx ;
  				width: 100rpx;
  				margin-right: 40rpx;
  			}
  			.infoText{
  				display: flex;
  				flex-direction: column;
  				justify-content: space-between;
  				align-items: flex-scetart;
  				.userName{
  					font-size: 18px;
  					color: #FFFFFF;
  					margin-bottom: 8rpx;
  				}
  				.nickName{
  					font-size: 12px;
  					color: #FFFFFF;
  				}
  			}
  		}
  		.service{
55ddb3f8a   范牧   登陆逻辑修改
252
  			margin-top: 20rpx;
fb85b244c   BigBoss   user页面
253
254
255
256
257
  			image{
  				height: 36rpx;
  				width: 36rpx;
  			}
  		}
0db291810   BigBoss   “-mcomfirmOder页面
258
  	}
fb85b244c   BigBoss   user页面
259
260
261
262
263
264
265
  	.myOrder{
  		width: 100%;
  		height: 296rpx;
  		margin-top: 20rpx;
  		margin-bottom: 20rpx;
  		padding: 0 40rpx;
  		box-sizing: border-box;
9ff2df1bf   范牧   文件名称规范
266
267
268
  		background: #FFFFFF;
  		box-shadow: 0 0 4px 0 rgba(133,107,107,0.10);
  		border-radius: 6px;
fb85b244c   BigBoss   user页面
269
  		border-radius: 6px;
0db291810   BigBoss   “-mcomfirmOder页面
270
  		display: flex;
fb85b244c   BigBoss   user页面
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
  		flex-direction: column;
  		justify-content: space-around;
  		align-items: center;
  		.orderHeader{
  			width: 100%;
  			height: 100rpx;
  			display: flex;
  			flex-direction: row;
  			justify-content: space-between;
  			align-items: center;
  			border-bottom: 1px solid #E9E9E9;;
  			font-weight: bold;
  			font-size: 18px;
  			color: #333333;
  			.btn{
  				font-size: 12px;
  				color: #999999;
  				image{
  					margin-left: 20rpx;
  					height: 16rpx;
  					width: 8rpx;
  				}
  			}
  		}
  		.orderBody{
  			width: 100%;
  			display: flex;
  			flex-direction: row;
  			justify-content: space-between;
  			align-items: center;
  			.item{
  				display: flex;
  				flex-direction: column;
  				align-items: center;
  				image{
  					width: 46rpx;
  					height: 46rpx;
  				}
  				text{
  					margin-top: 24rpx;
9ff2df1bf   范牧   文件名称规范
311
  					font-size: 12px;
fb85b244c   BigBoss   user页面
312
313
314
315
  					color: #333333;
  				}
  			}
  		}
0db291810   BigBoss   “-mcomfirmOder页面
316
  	}
fb85b244c   BigBoss   user页面
317
318
319
320
321
  	.recommend{
  		background: #FFFFFF;
  		box-shadow: 0 0 4px 0 rgba(133,107,107,0.10);
  		border-radius: 6px;
  		border-radius: 6px;
ab4209caf   喻鹏   update
322
  		width: 100%;
fb85b244c   BigBoss   user页面
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
  		.title{
  			display: flex;
  			flex-direction: row;
  			align-items: center;
  			justify-content: space-between;
  			padding: 20rpx 40rpx;
  			.line{
  				width: 264rpx;
  				height: 1rpx;
  				border-bottom: 1px solid #EAEAEA;
  			}
  			.text{
  				font-family: PingFangSC-Medium;
  				font-size: 14px;
  				color: #333333;
  				letter-spacing: -0.26px;
  				text-align: justify;
  				line-height: 24px;
  			}
  		}
  		.goods-list{
  			.loading-text{
  				width: 100%;
  				display: flex;
  				justify-content: center;
  				align-items: center;
  				height: 30px;
  				color: #979797;
  				font-size: 12px;
  			}
  			.product-list{
  				width: 92%;
  				padding: 0 4% 3vw 4%; 
  				display: flex;
cc196c33c   喻鹏   购物车和用户推荐接口渲染
357
  				height: 200px;
fb85b244c   BigBoss   user页面
358
359
360
361
362
  				justify-content: space-between;
  				flex-wrap: wrap;
  				.product{
  					width: 48%;
  					margin: 0 0 20rpx 0;
9ff2df1bf   范牧   文件名称规范
363
  					background: #FFFFFF;
fb85b244c   BigBoss   user页面
364
365
366
367
  					border: 1px solid #F2F2F2;
  				}
  			}
  		}
0db291810   BigBoss   “-mcomfirmOder页面
368
  	}
55ddb3f8a   范牧   登陆逻辑修改
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
  	.auth {
  		height: 100vh;
  		display: flex;
    		flex-direction: column;
    		align-items: center;
  		.icon {
  			width: 140rpx;
  			height: 140rpx;
  			border-radius: 50%;
  			margin-top: 100rpx;
  			background-color: grey;
  		}
  		.divider {
  			height: 1rpx;
  			width: 600rpx;
  			margin-top: 80rpx;
  			background-color: #E6E3E3;
  		}
  		.title {
  			width: 600rpx;
  			margin-top: 50rpx;
  			text-align: left;
  		}
  		.text {
  			width: 600rpx;
  			margin-top: 30rpx;
  			text-align: left;
  			color: #E6E3E3;
  		}
  		button {
  			width: 450rpx;
  			height: 80rpx;
  			line-height: 80rpx;
  			margin-top: 80rpx;
  			border-radius: 30rpx;
  		}
  	}
fb85b244c   BigBoss   user页面
406
  
9ff2df1bf   范牧   文件名称规范
407
  </style>