Browse Source

购物车增加长按删除

sslygzs 3 years ago
parent
commit
eee4913677

+ 1 - 1
App.vue

@@ -26,7 +26,7 @@
 					// #endif
 					uni.setTabBarItem({
 						index: iconIndex,
-						text: '我的商品',
+						text: '商品',
 						pagePath: '/pages/product/my-product-tabbar',
 						iconPath: "static/images/kan.png",
 						selectedIconPath: "static/images/kan_selected.png",

+ 18 - 10
pages/order/back-order.vue

@@ -1,6 +1,6 @@
 <template>
 	<view id="order" class="order">
-		<view  v-if="orders.length===0" style="margin: 20upx auto;text-align: center; font-size: 28upx;color: #999999;">
+		<view v-if="orders.length===0" style="margin: 20upx auto;text-align: center; font-size: 28upx;color: #999999;">
 			暂无任何订单
 		</view>
 		<view class="order-list">
@@ -34,7 +34,8 @@
 					总价 <text class="warning">¥{{order.total_amount}}</text>
 				</view>
 				<view class="option">
-					<button v-if="order.status === 'wait_pay'" class="pay-btn" type="default" @tap="openCashier(order.order_no)">立即支付</button>
+					<button v-if="order.status === 'wait_pay'" class="pay-btn" type="default"
+						@tap="openCashier(order.order_no)">立即支付</button>
 					<button v-if="order.status === 'wait_sign'" class="confirm-btn" type="default">确认收货</button>
 				</view>
 			</view>
@@ -54,12 +55,19 @@
 		},
 		onLoad() {
 			if (this.$store.state.user.group_id === 2) {
-					this.orderStatus = 'wait_deliver'
-				}
-				if (this.$store.state.user.group_id === 3) {
-					this.orderStatus = 'wait_pay'
-				}
-			
+				this.orderStatus = 'wait_deliver'
+				uni.setNavigationBarTitle({
+					title: "我的待发货"
+				})
+			}
+			if (this.$store.state.user.group_id === 3) {
+				this.orderStatus = 'wait_pay'
+				uni.setNavigationBarTitle({
+					title: "我的待付款"
+				})
+
+			}
+
 			this.getOrdersData();
 		},
 		onPageScroll(e) {
@@ -74,12 +82,12 @@
 		methods: {
 			openDetails(id) {
 				uni.navigateTo({
-					url: "order-details?id="+id
+					url: "order-details?id=" + id
 				})
 			},
 			openCashier(order_no) {
 				uni.navigateTo({
-					url: "cashier?order_no="+order_no
+					url: "cashier?order_no=" + order_no
 				})
 			},
 			getOrdersData() {

+ 1 - 1
pages/product/product-details.vue

@@ -20,7 +20,7 @@
 				<text class="stock">剩余库存{{product.stock}}</text>
 			</view>
 			<view class="row row-3">
-				<text class="sxj-icon">省心价</text>
+				<text class="sxj-icon" style="padding: 0upx 6upx;">省心价</text>
 				<text class="price">¥{{product.price}}</text>
 			</view>
 		</view>

+ 22 - 3
pages/shopping-cart/shopping-cart.vue

@@ -11,7 +11,8 @@
 				<view class="factory-name">{{seller.seller_nickname?seller.seller_nickname:'省心直供(该厂家暂未设置昵称)'}}</view>
 			</view>
 			<view class="shopping-cart-info">
-				<view class="product-item" v-for="product in seller.products">
+				<view class="product-item" v-for="product in seller.products"
+					@longpress="longpress(product.id,product.spec_index)">
 					<view class="select">
 						<checkbox class="checkbox" :checked="product.checked"
 							@tap="select(product.id,product.spec_index)" />
@@ -98,7 +99,7 @@
 				})
 			},
 			subnum(id, num, spec_index) {
-				if (num === 0) {
+				if (num === 1) {
 					uni.showModal({
 						title: "移除商品",
 						content: "确认移除该商品?",
@@ -108,7 +109,6 @@
 									id: id,
 									num: num,
 									spec_index: spec_index
-
 								})
 							}
 						}
@@ -130,6 +130,25 @@
 					spec_index: spec_index
 				})
 			},
+			longpress(id, spec_index) {
+				uni.showActionSheet({
+					itemList: ['删除'],
+					itemColor: "#FF5D5B",
+					success: (res)=> {
+						if (res.tapIndex === 0) {
+							this.$store.commit("cart/remove", {
+								id: id,
+								spec_index: spec_index
+							})
+							uni.showToast({
+								icon: "none",
+								title: "删除成功"
+							})
+						}
+					},
+
+				})
+			},
 			buy() {
 				let i = 0;
 				let postData = {}

+ 4 - 4
pages/user/login.vue

@@ -6,13 +6,13 @@
 		<view class="login-from">
 			<view class="input-item">
 				<label for="">
-					<image src="../../static/images/login/phone.png" style="width: 30upx;height: 40upx;" mode=""></image>
+					<image src="../../static/images/login/phone.png" style="width: 30upx;height: 40upx;margin-top: 4upx;" mode=""></image>
 				</label>
 				<input type="text" placeholder="请输入账号" v-model="account">
 			</view>
 			<view class="input-item" style="margin-bottom: 20upx;">
 				<label for="">
-					<image src="../../static/images/login/lock.png" style="width: 30upx;height: 40upx;" mode=""></image>
+					<image src="../../static/images/login/lock.png" style="width: 30upx;height: 40upx;margin-top: 4upx;" mode=""></image>
 				</label>
 				<input type="password" placeholder="请输入密码" v-model="password">
 			</view>
@@ -128,7 +128,7 @@
 	.input-item {
 		display: flex;
 		margin-bottom: 48upx;
-
+		align-items: center;
 		label {
 			width: 50upx;
 		}
@@ -137,7 +137,7 @@
 			border-bottom: 2upx solid $primary-color;
 			flex-grow: 1;
 			padding: 5upx;
-			font-size: 30upx;
+			font-size: 28upx;
 		}
 	}
 

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

@@ -29,10 +29,14 @@
 					<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 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>
+				<view v-if="user_type===3" class="row">
+					<view class="col">不可提现金额:<text>0</text></view>
+					<!-- <view class="col"><button class="btn jiaona-btn">立即缴纳</button></view> -->
+				</view>
 			</view>
 			<view class="vip-center">
 				<view class="text">代理会员中心<text class="sub">(特权独享)</text></view>
@@ -58,7 +62,7 @@
 						<view class="icon">
 							<image class="image" src="../../static/images/menu/b2.png" mode=""></image>
 						</view>
-						<view class="name">我的收藏</view>
+						<view class="name">我的商品</view>
 					</navigator>
 				</view>
 				<view v-if="user_type===3">
@@ -66,7 +70,7 @@
 						<view class="icon">
 							<image class="image" src="../../static/images/menu/b2.png" mode=""></image>
 						</view>
-						<view class="name">我的商品</view>
+						<view class="name">我的收藏</view>
 					</navigator>
 				</view>
 				<view>
@@ -138,7 +142,7 @@
 			}
 		}),
 		onShow() {
-			this.$emit("refresh_userinfo")
+			uni.$emit("refresh_userinfo")
 		},
 		onNavigationBarButtonTap(e) {
 			// console.log(e)
@@ -268,7 +272,7 @@
 			background: white;
 			border-radius: 20upx;
 			padding: 20upx;
-
+			font-family: sans-serif;
 			.row {
 				color: #333;
 				display: flex;
@@ -295,7 +299,7 @@
 				}
 
 				& .col:last-child {
-					text-align: right;
+					// text-align: right;
 					font-size: 28upx;
 				}
 			}

+ 2 - 0
store/modules/user.js

@@ -1,7 +1,9 @@
 const defaults = {
+	id:0,
 	nickname: "未设置昵称",
 	group_id: 3,
 	token: "",
+	money: "0.00"
 }
 const state = JSON.parse(JSON.stringify(defaults));
 

+ 3 - 0
verified.js

@@ -10,6 +10,9 @@ export default {
 	},
 	password(str) {
 		return /^[0-9a-z<>?:"|{},./;'/[]]{6,20}$/i.test(str) || tips("密码必须为6至20位数字与字母的组合")
+	},
+	password(str) {
+		return /^\d{6}$/i.test(str) || tips("安全密码必须由6位数字组成")
 	}
 }