Browse Source

新增一些页面

sslygzs 3 years ago
parent
commit
6b16a6c290

+ 9 - 1
App.vue

@@ -60,7 +60,15 @@
 				})
 
 			})
-
+			uni.$on("refresh_userinfo",()=>{
+				this.$http.get({
+						url: "/user/current",
+						success: (res) => {
+							this.$store.dispatch("user/save",res.data.data)
+						}
+					})
+				
+			})
 		},
 		onShow: function() {
 			console.log('App Show')

+ 224 - 0
components/sanshui-modal/index.vue

@@ -0,0 +1,224 @@
+<template>
+	<view class="ss-modal-body" :class="{'ss-modal-active' : animation, 'ss-modal-H5Top': _H5Top, 'ss-modal-H5Bottom': _H5Bottom}" :data-platform="platform">
+		<view class="ss-modal" :class="'ss-modal-' + position +' ' + 'ss-modal-' + mode">
+			<slot></slot>
+		</view>
+		<view v-if="_mask" class="uni-mask" @touchmove.stop.prevent="moveHandle" catchtouchmove="true" @click.stop="hide()"></view>
+	</view>
+</template>
+
+<script>
+	const systemInfo = uni.getSystemInfoSync();
+	export default {
+		data () {
+			return {
+				animation: false,
+				platform: systemInfo.platform
+			}
+		},
+		props: {
+			/*
+			* 参数说明(定位)
+			*/
+			position: {//可能值  top  left  right bottom middle
+				type: String,
+				default: 'middle'
+			},
+			/*
+			* 参数说明
+			* full 宽度100%
+			* insert 80%宽度内联小框
+			* cover 宽度高度100%
+			*/
+			mode: {
+				type: String,
+				default: 'full'
+			},
+			mask: {
+				type: [Boolean, String],
+				default: true
+			},
+			/*
+			* H5置顶
+			*/
+			H5Top: {
+				type: [Boolean, String],
+				default: true
+			},
+			/*
+			* H5置底
+			*/
+			H5Bottom: {
+				type: [Boolean, String],
+				default: true
+			},
+		},
+		computed: {
+			_mask() {
+				return String(this.mask) === 'false' ? false : true;
+			},
+			_H5Top() {
+				return String(this.H5Top) === 'false' ? false : true;
+			},
+			_H5Bottom() {
+				return String(this.H5Bottom) === 'false' ? false : true;
+			}
+		},
+		watch: {
+			animation(val) {
+				this.$emit('change', val);
+			}
+		},
+		methods: {
+			moveHandle() {
+				return ;
+			},
+			show () {
+				this.animation = true;
+				return true;
+			},
+			hide () {
+				this.animation = false;
+				return false;
+			},
+			toggle () {
+				return !this.animation ? this.show() : this.hide()
+			}
+		}
+	}
+</script>
+
+<style lang="scss">
+	// 弹窗公用样式
+	.ss-modal-body{
+		box-sizing: border-box;
+		opacity: 0;
+		position: fixed;
+		top: 44px;
+		bottom: 50px;
+		left: 0;
+		width: 100%;
+		pointer-events: none;
+		transform: translateX(0);
+		transition: all .2s linear;
+		z-index: 98;
+		&.ss-modal-active{
+			pointer-events: auto;
+			opacity: 1;
+		}
+	}
+	
+	/* #ifdef H5 */
+		.ss-modal-body.ss-modal-H5Top{
+			top: 0;
+			z-index: 999;
+		}
+		.ss-modal-body.ss-modal-H5Bottom{
+			bottom: 0;
+			z-index: 999;
+		}
+	/* #endif */
+	
+	.ss-modal-body .uni-mask{
+		z-index: 1;
+		position: fixed;
+		top: 0;
+		right: 0;
+		left: 0;
+		bottom: 0;
+		background: rgba(0,0,0,.6);
+	}
+	.ss-modal{
+		position: fixed;
+		z-index: 2;
+		transition: inherit;
+		/deep/ .gmy-float-touch{
+			display: none;
+		}
+	}
+	.ss-modal-middle{
+		top: 50%;
+		left: 50%;
+		transform: translate(-50%, -50%);
+	}
+	.ss-modal-cover{
+		width: 100%;
+		// width: 100vw;
+		width: calc(100% + 3px);
+		// width: calc(100vw + 2px);//清除translate带来了计算误差
+		height: 100%;
+		// height: 100vw;
+		height: calc(100% + 3px);
+		// height: calc(100vh + 2px);//清除translate带来了计算误差
+		left: 0;
+		top: 0;
+		transform: translate(100%, 0);
+	}
+	.ss-modal-top{
+		left: 50%;
+		z-index: 98;
+		width: 100%;
+		height: auto;
+		transform: translate(-50%, -100%);
+		& + .uni-mask{
+			z-index: 97;
+		}
+	}
+	.ss-modal-full{
+		width: 100%;
+		width: calc(100% + 3px);//清除translate带来了计算误差
+		left: 0;
+		transform: translate(0, -100%);
+	}
+	.ss-modal-full.ss-modal-top{
+		transform: translate(0, -200%);
+	}
+	.ss-modal-full.ss-modal-bottom{
+		transform: translate(0, 100%);
+		transition: inherit;
+	}
+	.ss-modal-right{
+		right: 0;
+		max-width: 80%;
+	}
+	.ss-modal-left{
+		left: 0;
+		max-width: 80%;
+	}
+	.ss-modal-middle.ss-modal-insert {
+		min-width: 380rpx;
+		min-height: 380rpx;
+		max-width: 102%;
+		max-height: 80%;
+		transform: translate(-50%, -50%);
+		background: none;
+		box-shadow: none;
+	}
+	.ss-modal-body{
+		opacity: 0;
+		pointer-events: none;
+	}
+	.ss-modal-active{
+		opacity: 1;
+		pointer-events: auto;
+		.ss-modal-top{
+			top: 44px;
+			transform: translate(-50%, 0);
+		}
+		.ss-modal-full{
+			transform: translate(0, -50%);
+		}
+		.ss-modal-full.ss-modal-top{
+			transform: translate(0, 0);
+		}
+		.ss-modal-bottom{
+			transform: translate(0, 0);
+		}
+		.ss-modal-cover{
+			transform: translate(0, 0);
+		}
+	}
+	.ss-modal-bottom{
+		bottom: 0;
+	}
+</style>

File diff suppressed because it is too large
+ 639 - 0
components/sanshui-payment-password/index.vue


+ 2 - 2
http.js

@@ -1,6 +1,6 @@
 import store from './store'
 
-const baseUrl =  process.env.NODE_ENV === 'development' ? "http://192.168.1.101:8000":"http://sxzg.ngrok.ssly.site";
+const baseUrl =  process.env.NODE_ENV === 'development' ? "http://sxzg.ngrok.ssly.site":"http://sxzg.ngrok.ssly.site";
 const baseApiUrl = baseUrl + "/api";
 
 function initPramas() {
@@ -29,7 +29,7 @@ function initPramas() {
 				res.data = JSON.parse(res.data)
 			} catch (err) {}
 		}
-		if (res.data.code === 0) {
+		if (res.data.code === 0||res.data.code ===500) {
 			uni.showToast({
 				title: res.data.msg,
 				icon: "none"

+ 45 - 0
pages.json

@@ -236,6 +236,51 @@
             }
             
         }
+        ,{
+            "path" : "pages/user/withdraw",
+            "style" :                                                                                    
+            {
+                "navigationBarTitleText": "提现",
+                "enablePullDownRefresh": false
+            }
+            
+        }
+        ,{
+            "path" : "pages/user/bind-alipay",
+            "style" :                                                                                    
+            {
+                "navigationBarTitleText": "绑定支付宝",
+                "enablePullDownRefresh": false
+            }
+            
+        }
+        ,{
+            "path" : "pages/user/nickname",
+            "style" :                                                                                    
+            {
+                "navigationBarTitleText": "修改昵称",
+                "enablePullDownRefresh": false
+            }
+            
+        }
+        ,{
+            "path" : "pages/user/collection",
+            "style" :                                                                                    
+            {
+                "navigationBarTitleText": "我的收藏",
+                "enablePullDownRefresh": false
+            }
+            
+        }
+        ,{
+            "path" : "pages/user/safe-pass",
+            "style" :                                                                                    
+            {
+                "navigationBarTitleText": "设置安全密码",
+                "enablePullDownRefresh": false
+            }
+            
+        }
     ],
 	"globalStyle": {
 		"navigationBarTextStyle": "white",

+ 24 - 16
pages/order/cashier.vue

@@ -1,5 +1,6 @@
 <template>
 	<view style="overflow: hidden;">
+		<payment-pasword ref="paymentPassword" mode="1" @submit="balancePay"></payment-pasword>
 		<timer-tips :createtime="orders[0].createtime"></timer-tips>
 		<view class="order-list">
 			<view class="order-item" v-for="order in orders">
@@ -52,11 +53,11 @@
 				<button class="pay-btn" type="default" @tap="pay">立即支付</button>
 			</view>
 		</view>
-
 	</view>
 </template>
 
 <script>
+	import paymentPasword from "@/components/sanshui-payment-password/index.vue"
 	export default {
 		data() {
 			return {
@@ -66,6 +67,9 @@
 				order_no: ""
 			}
 		},
+		components: {
+			paymentPasword
+		},
 		computed: {
 			total_amount_sum() {
 				return this.orders.reduce((prev, cur) => {
@@ -93,6 +97,23 @@
 					}
 				})
 			},
+			balancePay(e) {
+				console.log(e)
+				this.$http.get({
+					url: '/order/balancePay',
+					data: {
+						'order_no': this.order_no,
+						'pay_method': this.pay_method,
+						'amount': this.total_amount_sum,
+						'safe_pass': e.value
+					},
+					success: (res) => {
+						uni.navigateTo({
+							url: "/pages/order/order",
+						})
+					}
+				})
+			},
 			pay() {
 				if (this.pay_method !== 'balance') {
 					this.$http.get({
@@ -122,22 +143,9 @@
 						}
 					})
 
-				} else {					
-					this.$http.get({
-						url: '/order/balancePay',
-						data: {
-							'order_no': this.order_no,
-							'pay_method': this.pay_method,
-							'amount': this.total_amount_sum
-						},
-						success: (res) => {
-							uni.navigateTo({
-								url:"/pages/order/order",
-							})
-						}
-					})
+				} else {
+					this.$refs.paymentPassword.modalFun('show');
 				}
-
 			}
 		}
 	}

+ 55 - 5
pages/product/product-details.vue

@@ -56,9 +56,12 @@
 		<view class="footer">
 			<view class="collect">
 				<view>
-					<uni-icons type="heart" size="24"></uni-icons>
+					<uni-icons v-if="collectionStatus" @tap="delCollection()" type="heart-filled" size="24"
+						color="#ff5d5b"></uni-icons>
+					<uni-icons v-if="!collectionStatus" @tap="addCollection()" type="heart" size="24"></uni-icons>
 				</view>
-				<view style="font-size: 24upx;">收藏</view>
+				<view v-if="collectionStatus" style="font-size: 24upx;color:#ff5d5b ;">已收藏</view>
+				<view v-if="!collectionStatus" style="font-size: 24upx;">收藏</view>
 			</view>
 
 			<view class="btn-group">
@@ -141,6 +144,7 @@
 				detailsIsOpen: false,
 				curSpecIndex: 0,
 				num: 1,
+				collectionStatus: false
 			}
 		},
 		computed: {
@@ -152,6 +156,7 @@
 			this.getLikeProductsData();
 			this.product.id = option.id;
 			this.getProductData();
+			this.getCollectionStatus();
 		},
 		methods: {
 			getLikeProductsData() {
@@ -178,6 +183,51 @@
 					}
 				})
 			},
+			getCollectionStatus() {
+				this.$http.get({
+					url: "/collection/status",
+					data: {
+						product_id: this.product.id
+					},
+					success: (res) => {
+						this.collectionStatus = res.data.data
+					}
+				})
+			},
+			addCollection() {
+				this.$http.post({
+					url: "/collection/add",
+					data: {
+						product_id: this.product.id
+					},
+					success: (res) => {
+						this.collectionStatus = true;
+						uni.showToast({
+							title: res.data.msg,
+							icon: "none",
+						})
+
+					}
+				})
+
+			},
+			delCollection() {
+				this.$http.post({
+					url: "/collection/del",
+					data: {
+						product_id: this.product.id
+					},
+					success: (res) => {
+						this.collectionStatus = false;
+						uni.showToast({
+							title: res.data.msg,
+							icon: "none",
+						})
+
+					}
+				})
+
+			},
 			addCart() {
 				this.$store.dispatch("cart/add", {
 					id: this.product.id,
@@ -199,9 +249,9 @@
 					data: {
 						'products[]': JSON.stringify(data)
 					},
-					success: (res) => {						
+					success: (res) => {
 						uni.navigateTo({
-							url: "/pages/order/cashier?order_no="+res.data.data
+							url: "/pages/order/cashier?order_no=" + res.data.data
 						})
 					}
 				})
@@ -384,7 +434,7 @@
 		}
 
 		.collect {
-			margin-left: 20upx;
+			width: 100upx;
 			display: flex;
 			flex-direction: column;
 			align-items: center;

+ 17 - 13
pages/product/product-edit.vue

@@ -91,19 +91,22 @@
 		},
 		onLoad(option) {
 			console.log(option)
-			this.$http.get({
-				url: "/product",
-				data: {
-					id: option.id
-				},
-				success: (res) => {
-					this.mainImages = res.data.data.images.split(",")
-					this.form.name = res.data.data.name
-					this.form.details = res.data.data.details
-					this.specs = JSON.parse(res.data.data.specs)
-					this.form.id = res.data.data.id
-				}
-			})
+			if (option.id) {
+				this.$http.get({
+					url: "/product",
+					data: {
+						id: option.id
+					},
+					success: (res) => {
+						this.mainImages = res.data.data.images.split(",")
+						this.form.name = res.data.data.name
+						this.form.details = res.data.data.details
+						this.specs = JSON.parse(res.data.data.specs)
+						this.form.id = res.data.data.id
+					}
+				})
+
+			}
 		},
 		methods: {
 			imageUploader(path, callback) {
@@ -277,6 +280,7 @@
 
 		.input {
 			flex-grow: 1;
+			font-size: 28upx;
 		}
 	}
 

+ 172 - 0
pages/user/bind-alipay.vue

@@ -0,0 +1,172 @@
+<template>
+	<view class="body">
+		<view class="header-bg">
+
+		</view>
+		<view class="header">
+			<view class="title">
+				绑定支付宝
+			</view>
+		</view>
+
+		<view class="main">
+			<view class="input-item inline-form">
+				<label class="label" for="">姓名</label>
+				<input class="input" type="text" placeholder="输入支付宝收款人姓名">
+			</view>
+			<view class="input-item inline-form">
+				<label class="label" for="">支付宝号</label>
+				<input class="input" type="text" placeholder="支付宝账户">
+			</view>
+			<view class="input-item inline-form">
+				<label class="label" for="">手机号码</label>
+				<input class="input" type="text" placeholder="" v-model="form.mobile" disabled="true">
+				<button class="send-vcode" @tap="sendSms()"
+					:disabled="!sendable">{{sendable?'获取验证码':countdown+'秒'}}</button>
+
+			</view>
+			<view class="input-item inline-form">
+				<label class="label" for="">验证码</label>
+				<input class="input" type="text" placeholder="请输入验证码">
+			</view>
+		</view>
+
+		<view class="submit-btn-wrapper">
+			<button class="btn submit-btn" type="default">确认修改</button>
+		</view>
+	</view>
+</template>
+
+<script>
+	let timeInterval = null;
+	const time = 120;
+
+	export default {
+		data() {
+			return {
+				sendable: true,
+				countdown: time,
+				form: {
+					mobile: ""
+				}
+				
+			}
+		},
+		onLoad() {
+			this.form.mobile = this.$store.state.user.mobile
+		},
+		methods: {
+			sendSms() {
+				if (this.sendable && this.$verified.mobile(this.form.mobile)) {
+					this.sendable = false;
+
+					this.$http.get({
+						url: '/sms/send',
+						data: {
+							mobile: this.form.mobile,
+							event: "bind-alipay"
+						},
+						success: (res) => {
+							uni.showToast({
+								title: res.data.msg,
+								icon: "none"
+							})
+							timeInterval = setInterval(() => {
+								if (this.countdown-- === 0) {
+									clearInterval(timeInterval)
+									this.countdown = time;
+									this.sendable = true;
+								}
+							}, 1000)
+						},
+						fail: () => {
+							this.sendable = true;
+						}
+					})
+				}
+			}
+		}
+	}
+</script>
+
+<style lang="scss" scoped>
+	.body {
+		position: relative;
+		overflow: hidden;
+	}
+
+	.header-bg {
+		background: $primary-color;
+		height: 100upx;
+		position: absolute;
+		top: 0;
+		width: 100%;
+	}
+
+	.header {
+		margin: 20upx;
+		background: white;
+		text-align: center;
+		border-radius: 20upx;
+		position: relative;
+		z-index: 1;
+
+		.title {
+			height: 100upx;
+			font-size: 32upx;
+			line-height: 100upx;
+			// font-weight: bold;
+		}
+	}
+
+	.main {
+		margin: 20upx;
+		background: white;
+		border-radius: 10upx;
+	}
+
+	.input-item.inline-form {
+		display: flex;
+		align-items: center;
+		height: 80upx;
+		font-size: 28upx;
+		padding: 0 20upx;
+		position: relative;
+		color: #999999;
+
+		.label {
+			width: 160upx;
+			// flex: 1 1 160upx;
+
+		}
+
+		.input {
+			flex-grow: 1;
+			font-size: 28upx;
+		}
+	}
+
+	.send-vcode {
+		background: $primary-color;
+		color: white;
+		font-size: 24upx;
+		position: absolute;
+		padding: 5upx 0;
+		width: 160upx;
+		line-height: normal;
+		right: 0upx;
+		top: 20upx;
+	}
+
+	.submit-btn-wrapper {
+		margin-top: 80upx;
+
+		.submit-btn {
+			font-size: 30upx;
+			line-height: 60upx;
+			width: 250upx;
+			background: $primary-color;
+			color: white;
+		}
+	}
+</style>

+ 195 - 0
pages/user/collection.vue

@@ -0,0 +1,195 @@
+<template>
+	<view class="my-product">
+		<view class="header">
+			<view class="title">
+				收藏的商品
+			</view>
+			<view style="position: relative;">
+				<view class="sub-title">全部宝贝</view>
+				<view class="release">
+					管理
+				</view>
+			</view>
+		</view>
+		<view v-if="products.length===0"
+			style="margin: 20upx auto;text-align: center; font-size: 28upx;color: #999999;">
+			暂未收藏任何商品
+		</view>
+		<view class="product-list">
+			<view class="product-item" v-for="product in products" @tap="goToEdit(product.id)">
+				<view class="product-image">
+					<image class="image" :src="product.images|imagesFilter" mode="scaleToFill"></image>
+				</view>
+				<view>
+					<view class="row row-1">
+						<text class="title"><text class="sxzg-icon">省心直供</text>{{product.name}}</text>
+					</view>
+					<view class="row row-2">
+						<text class="org-price">¥{{product.org_price}}</text>
+					</view>
+					<view class="row row-3">
+						<text class="sxj-icon">省心价</text>
+						<text class="price">¥{{product.price}}</text>
+					</view>
+					<view class="row row-4">
+						<text>发布日期:</text>
+						<text class="time">{{product.createtime|datetimeFilter}}</text>
+					</view>
+				</view>
+
+			</view>
+		</view>
+	</view>
+</template>
+
+<script>
+	export default {
+		data() {
+			return {
+				page: 1,
+				pageLoading: false,
+				products: []
+			}
+		},
+		onLoad() {
+			// this.getProductData();
+		},
+
+		onPageScroll(e) {
+			const query = uni.createSelectorQuery();
+			query.select("#my-product").boundingClientRect(data => {
+				if (e.scrollTop > data.height - uni.getSystemInfoSync().windowHeight * 2) {
+					// this.getProductData();
+				}
+			}).exec();
+		},
+		onPullDownRefresh() {
+			this.refresh();
+		},
+		onShow() {
+			this.refresh();
+		},
+		methods: {
+
+		}
+	}
+</script>
+
+<style lang="scss" scoped>
+	.my-product {
+		overflow: hidden;
+	}
+
+	.header {
+		margin: 20upx;
+		background: white;
+		text-align: center;
+		border-radius: 20upx;
+		padding-bottom: 10upx;
+
+		.title {
+			height: 100upx;
+			font-size: 32upx;
+			line-height: 100upx;
+			// font-weight: bold;
+		}
+
+		.sub-title {
+			font-size: 28upx;
+			color: #999999;
+		}
+
+		.release {
+			position: absolute;
+			right: 20upx;
+			font-size: 24upx;
+			bottom: 4upx;
+		}
+	}
+
+
+	.product-list {
+		.product-item {
+			display: flex;
+			background: white;
+			margin: 20upx;
+			padding: 20upx;
+
+			.product-image {
+				width: 180upx;
+				height: 180upx;
+				margin-right: 20upx;
+			}
+
+			.image {
+				width: 180upx;
+				height: 180upx;
+				background: #EEEEEE;
+			}
+		}
+
+		.sxzg-icon {
+			color: $primary-color;
+			font-size: 16rpx;
+			width: 80rpx;
+			text-align: center;
+			line-height: normal;
+			border: 2rpx solid $primary-color;
+			border-radius: 20rpx;
+			display: inline-block;
+			position: relative;
+			top: -4rpx;
+			margin-right: 10upx;
+			// transform: scale(0.9);
+		}
+
+		.title {
+			font-size: 24rpx;
+			display: inline-block;
+			white-space: normal;
+			display: -webkit-box;
+			-webkit-box-orient: vertical;
+			-webkit-line-clamp: 2;
+			overflow: hidden;
+			height: 68upx;
+		}
+
+		.row {
+			// padding: 0 10upx;
+		}
+
+		.row-2 {
+			display: flex;
+			justify-content: space-between;
+		}
+
+		.org-price {
+			font-size: 26rpx;
+			color: #cccccc;
+		}
+
+		.org-price {
+			text-decoration: line-through;
+		}
+
+		.sxj-icon {
+			background: $primary-color;
+			color: white;
+			font-size: 20upx;
+			padding: 0 5upx;
+			border-radius: 5upx;
+			vertical-align: middle;
+		}
+
+		.price {
+			font-size: 26rpx;
+			color: $primary-color;
+			font-weight: bold;
+		}
+
+		.row-4 {
+			font-size: 24upx;
+			color: #999999;
+		}
+	}
+</style>

+ 127 - 0
pages/user/nickname.vue

@@ -0,0 +1,127 @@
+<template>
+	<view class="body">
+		<view class="header-bg">
+
+		</view>
+		<view class="header">
+			<view class="title">
+				昵称
+			</view>
+		</view>
+
+		<view class="main">
+			<view class="input-item inline-form">
+				<input class="input" type="text" placeholder="请输入新昵称" v-model="form.nickname">
+			</view>
+		</view>
+		<view class="submit-btn-wrapper">
+			<button class="btn submit-btn" type="default" @tap="submit">确认修改</button>
+		</view>
+
+	</view>
+</template>
+
+<script>
+	export default {
+		data() {
+			return {
+				form: {
+					nickname: ""
+				}
+			}
+		},
+		onLoad() {
+			this.form.nickname = this.$store.state.user.nickname
+		},
+		methods: {
+			submit() {
+				if (this.$verified.required(this.form.nickname, "请输入新昵称")) {
+					this.$http.post({
+						url: "/user/profile",
+						data: this.form,
+						success: (res) => {
+							uni.$emit("refresh_userinfo")
+							uni.showToast({
+								title:"昵称修改成功",
+								icon:"none",
+								success() {
+									setTimeout(uni.navigateBack(),1000)									
+								}
+							})
+						}
+					})
+				}
+			}
+		}
+	}
+</script>
+
+<style lang="scss" scoped>
+	.body {
+		position: relative;
+		overflow: hidden;
+	}
+
+	.header-bg {
+		background: $primary-color;
+		height: 100upx;
+		position: absolute;
+		top: 0;
+		width: 100%;
+	}
+
+	.header {
+		margin: 20upx;
+		background: white;
+		text-align: center;
+		border-radius: 20upx;
+		position: relative;
+		z-index: 1;
+
+		.title {
+			height: 100upx;
+			font-size: 32upx;
+			line-height: 100upx;
+			// font-weight: bold;
+		}
+	}
+
+	.main {
+		margin: 20upx;
+		background: white;
+		border-radius: 10upx;
+	}
+
+	.input-item.inline-form {
+		display: flex;
+		align-items: center;
+		height: 80upx;
+		font-size: 28upx;
+		padding: 0 20upx;
+		position: relative;
+		color: #999999;
+
+		.label {
+			width: 160upx;
+			// flex: 1 1 160upx;
+
+		}
+
+		.input {
+			flex-grow: 1;
+			font-size: 28upx;
+		}
+	}
+
+	.submit-btn-wrapper {
+		margin-top: 80upx;
+
+		.submit-btn {
+			font-size: 30upx;
+			line-height: 60upx;
+			width: 250upx;
+			background: $primary-color;
+			color: white;
+		}
+	}
+</style>

+ 171 - 0
pages/user/safe-pass.vue

@@ -0,0 +1,171 @@
+<template>
+	<view class="body">
+		<view class="header-bg">
+
+		</view>
+		<view class="header">
+			<view class="title">
+				设置安全密码
+			</view>
+		</view>
+
+		<view class="main">
+			<view class="input-item inline-form">
+				<label class="label" for="">手机号码</label>
+				<input class="input" type="text" placeholder="" v-model="form.mobile" disabled="true">
+
+			</view>
+			<view class="input-item inline-form">
+				<label class="label" for="">验证码</label>
+				<input class="input" type="text" placeholder="请输入验证码">
+				<button class="send-vcode" @tap="sendSms()"
+					:disabled="!sendable">{{sendable?'获取验证码':countdown+'秒'}}</button>
+			</view>
+			<view class="input-item inline-form">
+				<label class="label" for="">新密码</label>
+				<input class="input" type="password" placeholder="请输入新密码" maxlength="6">
+			</view>
+			<view class="input-item inline-form">
+				<label class="label" for="">确认密码</label>
+				<input class="input" type="password" placeholder="请输入新密码" maxlength="6">
+			</view>
+		</view>
+		<view style="margin: 10upx 40upx;font-size: 26upx;color: red;">*安全密码必须为6位数字</view>
+		<view class="submit-btn-wrapper">
+			<button class="btn submit-btn" type="default">确认修改</button>
+		</view>
+	</view>
+</template>
+
+<script>
+	let timeInterval = null;
+	const time = 120;
+
+	export default {
+		data() {
+			return {
+				sendable: true,
+				countdown: time,
+				form: {
+					mobile: ""
+				}
+			}
+		},
+		onLoad() {
+			this.form.mobile = this.$store.state.user.mobile
+		},
+		methods: {
+			sendSms() {
+				if (this.sendable && this.$verified.mobile(this.form.mobile)) {
+					this.sendable = false;
+
+					this.$http.get({
+						url: '/sms/send',
+						data: {
+							mobile: this.form.mobile,
+							event: "bind-alipay"
+						},
+						success: (res) => {
+							uni.showToast({
+								title: res.data.msg,
+								icon: "none"
+							})
+							timeInterval = setInterval(() => {
+								if (this.countdown-- === 0) {
+									clearInterval(timeInterval)
+									this.countdown = time;
+									this.sendable = true;
+								}
+							}, 1000)
+						},
+						fail: () => {
+							this.sendable = true;
+						}
+					})
+				}
+			}
+		}
+	}
+</script>
+
+<style lang="scss" scoped>
+	.body {
+		position: relative;
+		overflow: hidden;
+	}
+
+	.header-bg {
+		background: $primary-color;
+		height: 100upx;
+		position: absolute;
+		top: 0;
+		width: 100%;
+	}
+
+	.header {
+		margin: 20upx;
+		background: white;
+		text-align: center;
+		border-radius: 20upx;
+		position: relative;
+		z-index: 1;
+
+		.title {
+			height: 100upx;
+			font-size: 32upx;
+			line-height: 100upx;
+			// font-weight: bold;
+		}
+	}
+
+	.main {
+		margin: 20upx;
+		background: white;
+		border-radius: 10upx;
+	}
+
+	.input-item.inline-form {
+		display: flex;
+		align-items: center;
+		height: 80upx;
+		font-size: 28upx;
+		padding: 0 20upx;
+		position: relative;
+		color: #999999;
+
+		.label {
+			width: 160upx;
+			// flex: 1 1 160upx;
+
+		}
+
+		.input {
+			flex-grow: 1;
+			font-size: 28upx;
+		}
+	}
+
+	.send-vcode {
+		background: $primary-color;
+		color: white;
+		font-size: 24upx;
+		position: absolute;
+		padding: 5upx 0;
+		width: 160upx;
+		line-height: normal;
+		right: 0upx;
+		top: 20upx;
+	}
+
+	.submit-btn-wrapper {
+		margin-top: 80upx;
+
+		.submit-btn {
+			font-size: 30upx;
+			line-height: 60upx;
+			width: 250upx;
+			background: $primary-color;
+			color: white;
+		}
+	}
+</style>

+ 21 - 6
pages/user/setting.vue

@@ -10,7 +10,7 @@
 					昵称 <text class="info">{{nickname}}</text>
 				</view>
 				<view class="option">
-					修改
+					<navigator url="/pages/user/nickname" hover-class="none">修改</navigator>
 				</view>
 			</view>
 		</view>
@@ -18,7 +18,11 @@
 		<view class="block b2">
 			<view class="row">
 				<view class="label">支付宝绑定</view>
-				<view class="option">未绑定</view>
+				<view class="option">
+					<navigator url="/pages/user/bind-alipay" hover-class="none">
+						未绑定
+					</navigator>
+				</view>
 			</view>
 			<view class="line"></view>
 			<view class="row">
@@ -38,11 +42,22 @@
 				<view class="option"></view>
 			</view>
 		</view>
-
 		<view class="block b4">
 			<view class="row">
+				<view class="label">安全密码</view>
+				<view class="option">
+					<navigator url="/pages/user/safe-pass" hover-class="none">
+						未设置
+					</navigator>
+				</view>
+			</view>
+		</view>
+
+		<view class="block b5">
+			<view class="row">
 				<view class="label">清除缓存 <text class="info">{{fileSizeString}}</text></view>
-				<view class="option"><button class="clear-cache-btn" type="default" @tap="clearCache()">清除缓存</button></view>
+				<view class="option"><button class="clear-cache-btn" type="default" @tap="clearCache()">清除缓存</button>
+				</view>
 			</view>
 		</view>
 
@@ -114,7 +129,7 @@
 							if (entry.isDirectory) {
 								entry.removeRecursively(function(entry) { //递归删除其下的所有文件及子目录  
 									uni.showToast({
-										icon:'none',
+										icon: 'none',
 										title: '缓存清理完成',
 										duration: 2000
 									});
@@ -132,7 +147,7 @@
 				} else { // ios暂时未找到清理缓存的方法,以下是官方提供的方法,但是无效,会报错  
 					plus.cache.clear(function() {
 						uni.showToast({
-							icon:'none',
+							icon: 'none',
 							title: '缓存清理完成',
 							duration: 2000
 						});

+ 21 - 10
pages/user/user-center.vue

@@ -26,8 +26,8 @@
 		<view class="body">
 			<view class="money">
 				<view class="row">
-					<view class="col">可提现金额(元):<text class="warning">{{balance}}</text></view>
-					<view class="col"><button class="btn tixian-btn">立即提现</button></view>
+					<view class="col">可提现金额(元):<text class="warning">{{$store.state.user.money}}</text></view>
+					<view class="col"><button class="btn tixian-btn" @tap="goToWithdrew">立即提现</button></view>
 				</view>
 				<view class="row">
 					<view class="col">保证金(元):<text>0.00</text><text class="tips">(保证金2000元)</text></view>
@@ -53,11 +53,19 @@
 						<view class="name">订单管理</view>
 					</navigator>
 				</view>
-				<view>
+				<view v-if="user_type===2">
 					<navigator url="/pages/product/my-product" open-type="navigate" hover-class="none">
 						<view class="icon">
 							<image class="image" src="../../static/images/menu/b2.png" mode=""></image>
 						</view>
+						<view class="name">我的收藏</view>
+					</navigator>
+				</view>
+				<view v-if="user_type===3">
+					<navigator url="/pages/user/collection" open-type="navigate" hover-class="none">
+						<view class="icon">
+							<image class="image" src="../../static/images/menu/b2.png" mode=""></image>
+						</view>
 						<view class="name">我的商品</view>
 					</navigator>
 				</view>
@@ -129,13 +137,8 @@
 				return 'H' + ('00000000' + state.user.id).slice(-6);
 			}
 		}),
-		onLoad() {
-			this.$http.get({
-				url: "/user/current",
-				success: (res) => {
-					this.balance = res.data.data.money
-				}
-			})
+		onShow() {
+			this.$emit("refresh_userinfo")
 		},
 		onNavigationBarButtonTap(e) {
 			// console.log(e)
@@ -153,6 +156,14 @@
 				default:
 					break;
 			}
+		},
+		methods: {
+			goToWithdrew() {
+				uni.navigateTo({
+					url: "/pages/user/withdraw"
+				})
+			},
+
 		}
 	}
 </script>

+ 1 - 1
pages/user/vcode-login.vue

@@ -38,7 +38,7 @@
 
 <script>
 	let timeInterval = null;
-	const time = 120
+	const time = 120;
 
 	export default {
 		data() {

+ 134 - 0
pages/user/withdraw.vue

@@ -0,0 +1,134 @@
+<template>
+	<view class="withdraw">
+		<view class="header-bg"></view>
+		<view class="block">
+			<view class="account">
+				<image class="image" src="../../static/alipay.png" mode=""></image>
+				<view class="text">
+					<navigator url="/pages/user/bind-alipay" hover-class="none">
+						<view style="margin-bottom: 20upx;">支付宝</view>
+						<view>还没有添加支付宝账号,请点击添加</view>
+					</navigator>
+				</view>
+				<uni-icons type="arrowright" size="24" color="#CCCCCC" style="margin-left: auto;"></uni-icons>
+			</view>
+
+			<view class="withdraw-input-wrapper">
+				<input class="input" type="text" value="" placeholder="请输入提现金额,当前可提取余额为0.00元" />
+			</view>
+			<view class="withdraw-button-wrapper">
+				<button class="btn" type="default">确认提取</button>
+			</view>
+		</view>
+		<view class="block remind-wrapper">
+			<view class="title">
+				重要提醒
+			</view>
+			<view class="li">
+				1.当天可提现的最高金额为100元。
+			</view>
+			<view class="li">
+				2.单笔提现金额最低30元起。
+			</view>
+		</view>
+	</view>
+</template>
+
+<script>
+	export default {
+		data() {
+			return {
+
+			}
+		},
+		methods: {
+
+		}
+	}
+</script>
+
+<style lang="scss" scoped>
+	.withdraw {
+		position: relative;
+		overflow: hidden;
+	}
+
+	.header-bg {
+		background: $primary-color;
+		height: 100upx;
+		position: absolute;
+		top: 0;
+		width: 100%;
+	}
+
+	.block {
+		background: white;
+		border-radius: 20upx;
+		margin: 20upx;
+		padding: 20upx;
+		position: relative;
+		z-index: 1;
+	}
+
+	.account {
+		display: flex;
+		background: #eeeeee;
+		padding: 20upx;
+		align-items: center;
+		border-radius: 10upx;
+		margin: 10upx 0;
+
+		.image {
+			width: 100upx;
+			height: 100upx;
+		}
+
+		.text {
+			font-size: 24upx;
+			color: #999;
+			margin-left: 50upx;
+		}
+	}
+
+	.withdraw-input-wrapper {
+		margin-top: 40upx;
+	}
+
+	.input {
+		background: #eeeeee;
+		padding: 20upx;
+		font-size: 24upx;
+		border-radius: 10upx;
+	}
+
+	.withdraw-button-wrapper {
+		margin-top: 40upx;
+
+		.btn {
+			font-size: 32upx;
+			background: $primary-color;
+			color: white;
+		}
+
+	}
+
+	.remind-wrapper {
+		.title {
+			font-size: 30upx;
+			border-bottom: #999999 solid 2upx;
+			width: 60%;
+			margin: auto;
+			text-align: center;
+			padding: 20upx;
+			margin-bottom: 40upx;
+			color: #999999;
+		}
+
+		.li {
+			font-size: 24upx;
+			color: #999999;
+			margin-bottom: 20upx;
+			margin-left: 50upx;
+		}
+	}
+</style>