Browse Source

修改一些问题

sslyg 3 years ago
parent
commit
69465ef1ca

+ 24 - 17
App.vue

@@ -18,7 +18,7 @@
 					url: '/pages/index/index'
 				});
 			}
-			uni.$on(["login_succeeded","logout"], () => {
+			uni.$on(["login_succeeded", "logout"], () => {
 				if (this.$store.state.user.group_id === 2) {
 					let iconIndex = 2
 					// #ifdef H5
@@ -54,20 +54,25 @@
 				}
 			});
 			uni.onTabBarMidButtonTap(() => {
-				uni.chooseImage({
-					count: 1,
-					sourceType: ['camera']
-				})
-
+				if (this.$store.state.user.token) {
+					uni.chooseImage({
+						count: 1,
+						sourceType: ['camera']
+					})
+				} else {
+					uni.navigateTo({
+						url: "pages/user/login"
+					})
+				}
 			})
-			uni.$on("refresh_userinfo",()=>{
+			uni.$on("refresh_userinfo", () => {
 				this.$http.get({
-						url: "/user/current",
-						success: (res) => {
-							this.$store.dispatch("user/save",res.data.data)
-						}
-					})
-				
+					url: "/user/current",
+					success: (res) => {
+						this.$store.dispatch("user/save", res.data.data)
+					}
+				})
+
 			})
 		},
 		onShow: function() {
@@ -180,13 +185,15 @@
 	uni-button:after {
 		border: none;
 	}
+
 	@font-face {
-		font-family:"Roboto";
-		src: url(static/Roboto-Regular.ttf);		
+		font-family: "Roboto";
+		src: url(static/Roboto-Regular.ttf);
 	}
+
 	@font-face {
-		font-family:"Roboto-Bold";
-		src: url(static/Roboto-Bold.ttf);		
+		font-family: "Roboto-Bold";
+		src: url(static/Roboto-Bold.ttf);
 	}
 
 	/*每个页面公共css */

+ 1 - 1
http.js

@@ -1,6 +1,6 @@
 import store from './store'
 
-const baseUrl =  process.env.NODE_ENV === 'development' ? "http://192.168.1.200:8000":"http://sxzg.dev.ssly.live:8000";
+const baseUrl =  process.env.NODE_ENV === 'development' ? "http://192.168.1.200:8000":"http://sxzg.dejucehua.club";
 const baseApiUrl = baseUrl + "/api";
 
 function initPramas() {

+ 14 - 9
manifest.json

@@ -25,20 +25,23 @@
             /* android打包配置 */
             "android" : {
                 "permissions" : [
-                    "<uses-permission android:name=\"android.permission.CHANGE_NETWORK_STATE\"/>",
-                    "<uses-permission android:name=\"android.permission.MOUNT_UNMOUNT_FILESYSTEMS\"/>",
-                    "<uses-permission android:name=\"android.permission.VIBRATE\"/>",
-                    "<uses-permission android:name=\"android.permission.READ_LOGS\"/>",
-                    "<uses-permission android:name=\"android.permission.ACCESS_WIFI_STATE\"/>",
+                    "<uses-feature android:name=\"android.hardware.camera\"/>",
                     "<uses-feature android:name=\"android.hardware.camera.autofocus\"/>",
+                    "<uses-permission android:name=\"android.permission.ACCESS_COARSE_LOCATION\"/>",
                     "<uses-permission android:name=\"android.permission.ACCESS_NETWORK_STATE\"/>",
+                    "<uses-permission android:name=\"android.permission.ACCESS_WIFI_STATE\"/>",
                     "<uses-permission android:name=\"android.permission.CAMERA\"/>",
+                    "<uses-permission android:name=\"android.permission.CHANGE_NETWORK_STATE\"/>",
+                    "<uses-permission android:name=\"android.permission.CHANGE_WIFI_STATE\"/>",
+                    "<uses-permission android:name=\"android.permission.FLASHLIGHT\"/>",
                     "<uses-permission android:name=\"android.permission.GET_ACCOUNTS\"/>",
+                    "<uses-permission android:name=\"android.permission.INTERNET\"/>",
+                    "<uses-permission android:name=\"android.permission.MOUNT_UNMOUNT_FILESYSTEMS\"/>",
+                    "<uses-permission android:name=\"android.permission.READ_LOGS\"/>",
                     "<uses-permission android:name=\"android.permission.READ_PHONE_STATE\"/>",
-                    "<uses-permission android:name=\"android.permission.CHANGE_WIFI_STATE\"/>",
+                    "<uses-permission android:name=\"android.permission.VIBRATE\"/>",
                     "<uses-permission android:name=\"android.permission.WAKE_LOCK\"/>",
-                    "<uses-permission android:name=\"android.permission.FLASHLIGHT\"/>",
-                    "<uses-feature android:name=\"android.hardware.camera\"/>",
+                    "<uses-permission android:name=\"android.permission.WRITE_EXTERNAL_STORAGE\"/>",
                     "<uses-permission android:name=\"android.permission.WRITE_SETTINGS\"/>"
                 ]
             },
@@ -51,7 +54,9 @@
                     "alipay" : {
                         "__platform__" : [ "ios", "android" ]
                     }
-                }
+                },
+                "push" : {},
+                "share" : {}
             },
             "splashscreen" : {
                 "androidStyle" : "default",

+ 26 - 14
pages.json

@@ -42,7 +42,7 @@
 		}, {
 			"path": "pages/order/back-order",
 			"style": {
-				"navigationBarTitleText": "待货",
+				"navigationBarTitleText": "待货",
 				"enablePullDownRefresh": true
 			}
 
@@ -84,7 +84,13 @@
 				"navigationBarTitleText": "登录",
 				"enablePullDownRefresh": false,
 				"navigationBarBackgroundColor": "#ff5d5b",
-				"backgroundColor": "#ff5d5b"
+				"backgroundColor": "#ff5d5b",
+				"app-plus": {
+					"popGesture": "none",
+					"titleNView": {
+						"autoBackButton": false
+					}
+				}
 			}
 		}, {
 			"path": "pages/user/find-pass",
@@ -265,7 +271,8 @@
 			"path": "pages/user/safe-pass",
 			"style": {
 				"navigationBarTitleText": "设置",
-				"enablePullDownRefresh": false
+				"enablePullDownRefresh": false,
+				"backgroundColorTop": "#ff5d5b"
 			}
 
 		}, {
@@ -297,7 +304,7 @@
 							"disabled": false //disable时点击输入框不置焦,可以跳到新页面搜索
 						},
 						"buttons": [{
-							"text": "搜索",							
+							"text": "搜索",
 							"width": "auto",
 							"fontSize": "14px"
 						}]
@@ -305,17 +312,22 @@
 				}
 			}
 
+		}, {
+			"path": "pages/user/agent",
+			"style": {
+				"navigationBarTitleText": "代理会员中心",
+				"enablePullDownRefresh": false
+			}
+
+		}, {
+			"path": "pages/order/deposit",
+			"style": {
+				"navigationBarTitleText": "缴纳保证金",
+				"enablePullDownRefresh": false
+			}
+
 		}
-	    ,{
-            "path" : "pages/user/agent",
-            "style" :                                                                                    
-            {
-                "navigationBarTitleText": "代理会员中心",
-                "enablePullDownRefresh": false
-            }
-            
-        }
-    ],
+	],
 	"globalStyle": {
 		"navigationBarTextStyle": "white",
 		"navigationBarTitleText": "省心直供",

+ 40 - 3
pages/order/back-order.vue

@@ -1,5 +1,21 @@
 <template>
-	<view id="order" class="order">
+	<view id="order" class="order">		
+		<view class="header" v-if="$store.state.user.group_id === 2">
+			<view class="title">
+				我的待发货
+			</view>
+			<view style="position: relative;">
+				<view class="sub-title">待发货订单</view>
+			</view>
+		</view>
+		<view class="header" v-if="$store.state.user.group_id === 3">
+			<view class="title">
+				我的待收货
+			</view>
+			<view style="position: relative;">
+				<view class="sub-title">待收货订单</view>
+			</view>
+		</view>
 		<view v-if="orders.length===0" style="margin: 20upx auto;text-align: center; font-size: 28upx;color: #999999;">
 			暂无任何订单
 		</view>
@@ -53,7 +69,7 @@
 				pageLoading: false
 			}
 		},
-		onLoad() {
+		onShow() {
 			if (this.$store.state.user.group_id === 2) {
 				this.orderStatus = 'wait_deliver'
 				uni.setNavigationBarTitle({
@@ -117,7 +133,7 @@
 			},
 			refresh() {
 				this.page = 1;
-				this.products = [];
+				this.orders = [];
 				this.getOrdersData()
 					.then(uni.stopPullDownRefresh())
 					.catch(uni.stopPullDownRefresh());
@@ -128,6 +144,27 @@
 </script>
 
 <style lang="scss">
+	.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;
+		}
+
+	}
+	
 	.order {
 		overflow: hidden;
 	}

+ 183 - 0
pages/order/deposit.vue

@@ -0,0 +1,183 @@
+<template>
+	<view style="overflow: hidden;">
+		<payment-pasword ref="paymentPassword" mode="1" @submit="balancePay"></payment-pasword>
+		<timer-tips v-if="orders.length" :createtime="orders[0].createtime"></timer-tips>
+		<view class="money-info">
+			保证金:{{deposit}}元
+		</view>
+		<!-- <view class="sum">合计:{{total_amount_sum|priceFilter}}元</view> -->
+
+		<view class="pay-method">
+			<view class="label">请选择支付方式</view>
+			<view>
+				<view class="item" :class="{'active':pay_method==='alipay'}"
+					@tap="pay_method='alipay',pay_provider='alipay'">
+					<image class="image" src="../../static/alipay.png" mode="scaleToFill"
+						style="width: 50upx;height: 50upx;"></image>支付宝
+				</view>
+				<view class="item" :class="{'active':pay_method==='wechat'}"
+					@tap="pay_method='wechat',pay_provider='wxpay'">
+					<image class="image" src="../../static/wxpay.png" mode="scaleToFill"
+						style="width: 50upx;height: 50upx;"></image>微信支付
+				</view>
+				<!-- 				<view class="item" :class="{'active':pay_method==='balance'}" @tap="pay_method='balance'">
+					<image class="image" src="../../static/logo.png" mode="scaleToFill"
+						style="width: 50upx;height: 50upx;"></image>使用余额({{$store.state.user.money}})
+				</view> -->
+			</view>
+			<view class="" style="margin-top: 40upx;">
+				<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 {
+				deposit: 2000,
+				pay_method: "alipay",
+				pay_provider: "alipay",
+				orders: [],
+				order_no: ""
+			}
+		},
+		components: {
+			paymentPasword
+		},
+		computed: {
+			total_amount_sum() {
+				return deposit;
+			}
+		},
+
+		onLoad(option) {
+			this.order_no = option.order_no;
+			// this.getCashierData();
+		},
+		methods: {
+			getCashierData() {
+				this.$http.get({
+					url: "/order/cashier",
+					data: {
+						order_no: this.order_no
+					},
+					success: (res) => {
+						this.orders = res.data.data.map((value) => {
+							value.products_json = JSON.parse(value.products_snapshot)
+							return value;
+						})
+					}
+				})
+			},
+			balancePay(e) {
+				console.log(e)
+				this.$http.post({
+					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({
+						url: '/order/pay',
+						data: {
+							'order_no': this.order_no,
+							'pay_method': this.pay_method,
+							'amount': this.total_amount_sum
+
+						},
+						success: (res) => {
+
+							uni.requestPayment({
+								provider: this.pay_provider,
+								orderInfo: res.data.data,
+								success: (res) => {
+									uni.showModal({
+										content: JSON.stringify(res)
+									})
+								},
+								fail: (res) => {
+									uni.showModal({
+										content: "支付失败",
+									})
+								}
+							})
+						}
+					})
+
+				} else {
+					this.$refs.paymentPassword.modalFun('show');
+				}
+			}
+		}
+	}
+</script>
+
+<style lang="scss" scoped>
+	.order {
+		overflow: hidden;
+	}
+
+	.money-info {
+		font-size: 50upx;
+		text-align: center;
+		margin: 150upx;
+	}
+
+	.sum {
+		margin: 20upx;
+		font-size: 30upx;
+		text-align: right;
+		font-weight: bold;
+	}
+
+	.pay-method {
+		margin: 20upx;
+		padding: 20upx;
+		background: white;
+
+		.label {
+			font-size: 30upx;
+			margin-bottom: 20upx;
+		}
+
+		.item {
+			height: 80upx;
+			display: flex;
+			align-items: center;
+			font-size: 30upx;
+			border-bottom: 2upx solid #F5F5F5;
+
+			.image {
+				margin-right: 10upx;
+			}
+
+			&.active {
+				background: url(../../static/gou.png) no-repeat;
+				background-size: 40upx 40upx;
+				background-position: 600upx 20upx;
+			}
+		}
+	}
+
+	.pay-btn {
+		margin: 20upx 0;
+		background: $primary-color;
+		color: white;
+		font-size: 32upx;
+		font-weight: bold;
+	}
+</style>

+ 30 - 0
pages/shopping-cart/shopping-cart.vue

@@ -1,5 +1,14 @@
 <template>
 	<view class="shopping-cart">
+		<view class="header">
+			<view class="title">
+				我的购物车
+			</view>
+			<view style="position: relative;">
+				<view class="sub-title">购物车订单</view>
+			</view>
+		</view>
+		
 		<view v-if="cart.length===0" style="margin: 20upx auto;text-align: center; font-size: 28upx;color: #999999;">
 			暂未添加任何商品
 		</view>
@@ -184,6 +193,27 @@
 </script>
 
 <style lang="scss">
+	.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;
+		}
+	
+	}
+	
 	.shopping-cart {
 		padding-bottom: 80upx;
 		overflow: hidden;

+ 28 - 5
pages/user/bind-alipay.vue

@@ -12,11 +12,11 @@
 		<view class="main">
 			<view class="input-item inline-form">
 				<label class="label" for="">姓名</label>
-				<input class="input" type="text" placeholder="输入支付宝收款人姓名">
+				<input class="input" type="text" placeholder="输入支付宝收款人姓名" v-model="form.alipay_name">
 			</view>
 			<view class="input-item inline-form">
 				<label class="label" for="">支付宝号</label>
-				<input class="input" type="text" placeholder="支付宝账户">
+				<input class="input" type="text" placeholder="支付宝账户" v-model="form.alipay">
 			</view>
 			<view class="input-item inline-form">
 				<label class="label" for="">手机号码</label>
@@ -27,12 +27,12 @@
 			</view>
 			<view class="input-item inline-form">
 				<label class="label" for="">验证码</label>
-				<input class="input" type="text" placeholder="请输入验证码">
+				<input class="input" type="text" placeholder="请输入验证码" v-model="form.captcha">
 			</view>
 		</view>
 
 		<view class="submit-btn-wrapper">
-			<button class="btn submit-btn" type="default">确认修改</button>
+			<button class="btn submit-btn" type="default" @tap="submit()">确认修改</button>
 		</view>
 	</view>
 </template>
@@ -47,13 +47,19 @@
 				sendable: true,
 				countdown: time,
 				form: {
-					mobile: ""
+					type: "mobile",				
+					mobile: "",
+					alipay:"",
+					alipay_name:"",
+					captcha:""
 				}
 				
 			}
 		},
 		onLoad() {
 			this.form.mobile = this.$store.state.user.mobile
+			this.form.alipay = this.$store.state.user.alipay
+			this.form.alipay_name = this.$store.state.user.alipay_name
 		},
 		methods: {
 			sendSms() {
@@ -86,6 +92,23 @@
 				}
 			},
 			submit(){
+				if (this.$verified.required(this.form.alipay_name, "请输入收款人姓名")
+					&&this.$verified.required(this.form.alipay, "请输入支付宝账户")
+				 && this.$verified.required(this.form.captcha, "请输入验证码")) {
+						this.$http.post({
+							url: "/user/bindalipay",
+							data: this.form,
+							success: (res) => {
+								uni.showToast({
+									title: "支付宝绑定成功",
+									icon: "none",
+									success() {
+										setTimeout(uni.navigateBack(), 1000)
+									}
+								})
+							}
+						})
+					}
 				
 			}
 		}

+ 3 - 0
pages/user/login.vue

@@ -53,6 +53,9 @@
 				password: ''
 			}
 		},
+		onBackPress() {
+			return false;
+		},
 		methods: {
 			login() {
 				if (this.$verified.account(this.account) &&

+ 2 - 2
pages/user/safe-pass.vue

@@ -23,11 +23,11 @@
 			</view>
 			<view class="input-item inline-form">
 				<label class="label" for="">新密码</label>
-				<input class="input" type="password" placeholder="请输入新密码" maxlength="6" v-model="form.newsafepass">
+				<input class="input" type="password" placeholder="请输入新支付密码" maxlength="6" v-model="form.newsafepass">
 			</view>
 			<view class="input-item inline-form">
 				<label class="label" for="">确认密码</label>
-				<input class="input" type="password" placeholder="请输入新密码" maxlength="6" v-model="form.comfirmpass">
+				<input class="input" type="password" placeholder="请输入新支付密码" maxlength="6" v-model="form.comfirmpass">
 			</view>
 		</view>
 		<view style="margin: 10upx 40upx;font-size: 26upx;color: red;">*支付密码必须为6位数字</view>

+ 6 - 1
pages/user/user-center.vue

@@ -32,7 +32,7 @@
 				</view>
 				<view v-if="user_type===2" class="row">
 					<view class="col">保证金(元):<text>0.00</text><text class="tips">(保证金2000元)</text></view>
-					<view class="col"><button class="btn jiaona-btn">立即缴纳</button></view>
+					<view class="col"><button class="btn jiaona-btn"  @tap="goToDeposit">立即缴纳</button></view>
 				</view>
 				<view v-if="user_type===3" class="row">
 					<view class="col">不可提现金额:<text>0</text></view>
@@ -174,6 +174,11 @@
 					url: "/pages/user/withdraw"
 				})
 			},
+			goToDeposit(){
+				uni.navigateTo({
+					url: '/pages/order/deposit'
+				});
+			}
 
 		}
 	}

+ 37 - 5
pages/user/withdraw.vue

@@ -6,18 +6,18 @@
 				<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>
+						<view style="margin-bottom: 20upx;">{{this.form.name?this.form.name:'支付宝'}}</view>
+						<view>{{this.form.account?this.form.account:'还没有添加支付宝账号,请点击添加'}}</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元" />
+				<input class="input" type="text" v-model="form.money" :placeholder="`请输入提现金额,当前可提取余额为${money}元`" />
 			</view>
 			<view class="withdraw-button-wrapper">
-				<button class="btn" type="default">确认提取</button>
+				<button class="btn" type="default" @tap="submit">确认提取</button>
 			</view>
 		</view>
 		<view class="block remind-wrapper">
@@ -38,10 +38,42 @@
 	export default {
 		data() {
 			return {
-
+				form: {
+					account: "",
+					name: "",
+					money: undefined,
+				}
 			}
 		},
+		onShow() {
+			uni.$emit("refresh_userinfo");
+			this.form.account = this.$store.state.user.alipay
+			this.form.name = this.$store.state.user.alipay_name
+			this.money = this.$store.state.user.money
+		},
 		methods: {
+			submit() {
+				if (this.$verified.required(this.form.account,"请选择支付宝账户")
+				&&this.$verified.required(this.form.name,"请选择支付宝账户")
+				&&this.$verified.required(this.form.money,"请输入您要提取的金额")) {
+					this.$http.post({
+						url: "/withdraw/create",
+						data: this.form,
+						success: (res) => {
+							console.log(res)
+							uni.showModal({
+								title: "提现",
+								content: "提交成功,平台将于三个工作日之内为您处理",
+								success: (res) => {
+									if (res.confirm) {
+										uni.navigateBack()
+									}
+								}
+							})
+						}
+					})
+				}
+			}
 
 		}
 	}

+ 3 - 1
store/modules/user.js

@@ -5,7 +5,9 @@ const defaults = {
 	token: "",
 	money: "0.00",
 	invite_code: "-----",
-	mobile: ""
+	mobile: "",
+	alipay: "",
+	alipay_name: "",
 }
 const state = JSON.parse(JSON.stringify(defaults));
 

+ 1 - 1
verified.js

@@ -1,6 +1,6 @@
 export default {
 	required(str, msg) {
-		return str.length > 0 || tips(msg)
+		return !!str && str.length > 0 || tips(msg)
 	},
 	mobile(str) {
 		return /^1\d{10}$/.test(str) || tips("请输入正确的手机号")