Przeglądaj źródła

Merge branch 'master' of http://git.liuniu946.com/xiemingyang/zhengyi

hwq 4 lat temu
rodzic
commit
5c2c8a486b

+ 66 - 0
api/functionalUnit.js

@@ -0,0 +1,66 @@
+import request from '@/utils/request'
+
+//获取优惠券列表
+export function getCouponsList(data,types) {
+	//优惠券状态 0全部 1未使用 2已使用
+	return request({
+		url: '/api/coupons/user/'+types,
+		method: 'get',
+		data
+	});
+}
+
+//领取优惠券
+export function setCoupons(data) {
+	return request({
+		url: '/api/coupon/receive',
+		method: 'post',
+		data
+	});
+}
+
+//获取可使用优惠券
+export function couponsOrder(data,price) {
+	return request({
+		url: '/api/coupons/order/'+price,
+		method: 'get',
+		data
+	});
+}
+
+
+//	积分列表
+export function integrallist(data) {
+	return request({
+		url: '/api/integral/list',
+		method: 'get',
+		data
+	});
+}
+
+
+// 获取签到列表
+export function signList(data) {
+	return request({
+		url: '/api/sign/list',
+		method: 'get',
+		data
+	});
+}
+// 点击签到
+export function integral(data) {
+	return request({
+		url: '/api/sign/integral',
+		method: 'post',
+		data
+	});
+}
+
+// 签到信息
+export function signUser(data) {
+	return request({
+		url: '/api/sign/user',
+		method: 'post',
+		data
+	});
+}

+ 0 - 34
api/user.js

@@ -128,14 +128,6 @@ export function getSpreadPeople(data){
 		data
 	})
 }
-//我的会员
-export function getMyTvillage(data){
-	return request({
-		url:'/api/mytvillage',
-		method:'get',
-		data
-	})
-}
 
 //推广佣金/提现总和 
 //3=佣金,4=提现
@@ -145,30 +137,4 @@ export function getSpreadCount(data,type) {
 		method:'get',
 		data
 	})
-}
-//我的实体店
-export function getMyStore(data) {
-	return request({
-		url:'/api/mystore',
-		method:'get',
-		data
-	})
-}
-
-//申请会员 店长
-export function enter(data) {
-	return request({
-		url:'/api/enter',
-		method:'post',
-		data
-	})
-}
-
-//编辑门店
-export function editStore(data) {
-	return request({
-		url:'/api/store_edit',
-		method:'post',
-		data
-	})
 }

+ 8 - 0
api/wallet.js

@@ -98,5 +98,13 @@ export function balance(data) {
 	});
 }
 
+//积分明细
+export function integral(data,state) {
+	return request({
+		url: '/api/integral/list'+state,
+		method: 'get',
+		data
+	});
+}
 
 

+ 190 - 140
pages.json

@@ -8,34 +8,19 @@
 			}
 		},
 		{
-			"path": "pages/category/category",
+			"path": "pages/public/register",
 			"style": {
-				// #ifdef APP-PLUS
-				"navigationStyle": "custom",
-				// #endif
-				// #ifndef MP
+				"navigationBarTitleText": "注册",
 				"app-plus": {
-					"bounce": "none",
 					"titleNView": {
-						"searchInput": {
-							"backgroundColor": "rgba(231, 231, 231,.7)",
-							"borderRadius": "16px",
-							"placeholder": "商品搜索",
-							"disabled": true,
-							"placeholderColor": "#606266",
-							"align": "left"
-						}
+						"type": "transparent"
 					}
-				},
-				// #endif
-				"navigationBarTitleText": "分类",
-				"navigationBarBackgroundColor": "#FFFFFF"
+				}
 			}
-		},
-		{
-			"path": "pages/product/product",
+		}, {
+			"path": "pages/public/login",
 			"style": {
-				"navigationBarTitleText": "详情展示",
+				"navigationBarTitleText": "登录",
 				"app-plus": {
 					"titleNView": {
 						"type": "transparent"
@@ -44,145 +29,204 @@
 			}
 		},
 		{
-			"path": "pages/cart/cart",
+			"path": "pages/public/wxLogin",
 			"style": {
-				"navigationBarTitleText": "购物车",
-				"navigationBarBackgroundColor": "#fff",
-				"navigationBarTextStyle": "black"
-
+				"navigationBarTitleText": "微信登录",
+				"app-plus": {
+					"titleNView": {
+						"type": "transparent"
+					}
+				}
 			}
 		},
 		{
-			"path": "pages/user/user",
+			"path": "pages/public/forget",
 			"style": {
-				"navigationBarTitleText": "个人中心",
-				"navigationStyle": "custom"
+				"navigationBarTitleText": "忘记密码",
+				"app-plus": {
+					"titleNView": {
+						"type": "transparent"
+					}
+				}
 			}
 		},
 		{
-			"path": "pages/user/accounts",
+			"path": "pages/product/reply",
 			"style": {
-				"navigationBarTextStyle": "black",
-				"navigationBarBackgroundColor": "transparent",
+				"navigationBarTitleText": "商品评价",
 				"app-plus": {
 					"titleNView": {
-						"type": "float",
-						"titleText": "我的佣金"
+						"type": "transparent"
 					}
 				}
 			}
 		},
 		{
-			"path": "pages/user/integral",
+			"path": "pages/product/product",
 			"style": {
-				"navigationBarTextStyle": "black",
-				"navigationBarBackgroundColor": "transparent",
+				"navigationBarTitleText": "详情展示",
 				"app-plus": {
 					"titleNView": {
-						"type": "float",
-						"titleText": "我的积分"
+						"type": "transparent"
 					}
 				}
 			}
 		},
 		{
-			"path": "pages/user/extend",
+			"path": "pages/product/list",
 			"style": {
-				"navigationBarTextStyle": "black",
-				"navigationBarBackgroundColor": "transparent",
+				"enablePullDownRefresh": true,
+				"navigationBarTitleText": "商品列表"
+			}
+		},
+		{
+			"path": "pages/product/search",
+			"style": {
+				"enablePullDownRefresh": true,
+				// #ifdef APP-PLUS
+				"navigationStyle": "custom",
+				// #endif
+				// #ifndef MP || APP-PLUS
 				"app-plus": {
 					"titleNView": {
-						"type": "float",
-						"titleText": "我的推广"
+						"searchInput": {
+							"backgroundColor": "rgba(231, 231, 231,.7)",
+							"borderRadius": "16px",
+							"placeholder": "请输入关键字",
+							"disabled": false,
+							"placeholderColor": "#606266",
+							"align": "left"
+						},
+						"buttons": [{
+							"text": "搜索",
+							"fontSize": "14",
+							"color": "#303133",
+							"background": "rgba(0,0,0,0)",
+							"width": "40px"
+						}]
 					}
-				}
+				},
+				// #endif
+				"navigationBarTitleText": "搜索"
 			}
 		},
 		{
-			"path": "pages/user/transfer",
+			"path": "pages/set/set",
 			"style": {
-				"navigationBarTitleText": "佣金转账",
-				"navigationBarBackgroundColor": "#fff",
-				"navigationBarTextStyle": "black"
-
+				"navigationBarTitleText": "设置"
 			}
 		},
 		{
-			"path": "pages/user/submit",
+			"path": "pages/set/address",
 			"style": {
-				"navigationBarTitleText": "提交成功",
-				"navigationBarBackgroundColor": "#fff",
-				"navigationBarTextStyle": "black"
-
+				"navigationBarTitleText": "收货地址"
 			}
 		},
 		{
-			"path": "pages/user/jiedian",
+			"path": "pages/set/addressManage",
 			"style": {
-				"navigationBarTextStyle": "black",
-				"navigationBarBackgroundColor": "transparent",
-				"app-plus": {
-					"titleNView": {
-						"type": "float",
-						"titleText": "我的接点"
-					}
-				}
+				"navigationBarTitleText": ""
 			}
 		},
 		{
-			"path": "pages/user/withdraw",
+			"path": "pages/set/phone",
 			"style": {
-				"navigationBarTitleText": "提现",
-				"navigationBarBackgroundColor": "#fff",
-				"navigationBarTextStyle": "black"
-
+				"navigationBarTitleText": "实名认证"
 			}
 		},
 		{
-			"path": "pages/user/refer",
+			"path": "pages/set/password",
 			"style": {
-				"navigationBarTitleText": "提交申请",
-				"navigationBarBackgroundColor": "#fff",
-				"navigationBarTextStyle": "black"
+				"navigationBarTitleText": "修改密码"
 			}
 		},
 		{
-			"path": "pages/user/shezhi",
+				"path": "pages/set/userinfo",
+				"style": {
+					"navigationBarTitleText": "修改资料"
+				}
+		},
+		{
+			"path": "pages/cart/cart",
 			"style": {
-				"navigationBarTitleText": "设置",
-				"navigationBarBackgroundColor": "#fff",
-				"navigationBarTextStyle": "black"
+				"navigationBarTitleText": "购物车"
 			}
 		},
+
 		{
-			"path": "pages/story/story",
+			"path": "pages/user/user",
 			"style": {
-				"navigationBarTitleText": "品牌故事",
-				"navigationBarBackgroundColor": "#fff",
-				"navigationBarTextStyle": "black"
-
+				// #ifndef MP-WEIXIN
+				"navigationStyle": "custom",
+				// #endif
+				"navigationBarTitleText": "个人中心"
 			}
 		},
 		{
-			"path": "pages/story/storyDetail",
+			"path": "pages/user/award",
 			"style": {
-				// "navigationBarTitleText": "品牌故事",
-				"navigationStyle": "custom"
+				"navigationBarTitleText": "奖励明细",
+				"app-plus": {
+					"titleNView": {
+						"type": "transparent"
+					}
+				}
 			}
 		},
 		{
-			"path": "pages/order/order",
+			"path": "pages/user/withdrawal",
+			"style": {
+				"navigationBarTitleText": "奖励提现"
+			}
+		},
+		// {
+		// 	"path": "pages/user/notice",
+		// 	"style": {
+		// 		"navigationBarTitleText": "通知"
+		// 	}
+		// },
+		// {
+		// 	"path": "pages/user/scoreAccumulate",
+		// 	"style": {
+		// 		"navigationBarTitleText": "积分明细"
+		// 	}
+		// },
+		{
+			"path": "pages/user/extension",
 			"style": {
 				"navigationBarTextStyle": "black",
 				"navigationBarBackgroundColor": "transparent",
 				"app-plus": {
 					"titleNView": {
 						"type": "float",
-						"titleText": "我的订单"
+						"titleText": "我的推广"
 					}
 				}
 			}
 		},
+		// {
+		// 	"path": "pages/user/applyMember",
+		// 	"style": {
+		// 		"navigationStyle": "custom",
+		// 		"navigationBarTitleText": "申请会员"
+		// 	}
+		// },
+		// {
+		// 	"path": "pages/user/minMember",
+		// 	"style": {
+		// 		"navigationStyle": "custom",
+		// 		"navigationBarTitleText": "我的会员"
+		// 	}
+		// },
+		{
+			"path": "pages/order/order",
+			"style": {
+				"navigationBarTitleText": "我的订单",
+				"app-plus": {
+					"bounce": "none"
+				}
+			}
+		},
 		{
 			"path": "pages/order/expressInfo",
 			"style": {
@@ -215,38 +259,7 @@
 			"style": {
 				"navigationBarTitleText": "创建订单"
 			}
-		},
-		{
-			"path": "pages/set/address",
-			"style": {
-				"navigationBarTitleText": "收货地址"
-			}
-		},
-		{
-			"path": "pages/set/addressManage",
-			"style": {
-				"navigationBarTitleText": ""
-			}
-		},
-		{
-			"path": "pages/set/phone",
-			"style": {
-				"navigationBarTitleText": "实名认证"
-			}
-		},
-		{
-			"path": "pages/set/password",
-			"style": {
-				"navigationBarTitleText": "修改密码"
-			}
-		},
-		{
-			"path": "pages/set/userinfo",
-			"style": {
-				"navigationBarTitleText": "修改资料"
-			}
-		},
-		{
+		}, {
 			"path": "pages/money/pay",
 			"style": {
 				"navigationBarTitleText": "支付"
@@ -261,12 +274,10 @@
 		{
 			"path": "pages/money/wallet",
 			"style": {
-				"navigationBarTextStyle": "black",
-				"navigationBarBackgroundColor": "transparent",
+				"navigationBarTitleText": "我的钱包",
 				"app-plus": {
 					"titleNView": {
-						"type": "float",
-						"titleText": "我的钱包"
+						"type": "transparent"
 					}
 				}
 			}
@@ -290,49 +301,88 @@
 			}
 		},
 		{
-			"path": "pages/public/register",
+			"path": "pages/category/category",
 			"style": {
-				"navigationBarTitleText": "注册",
+				// #ifdef APP-PLUS
+				"navigationStyle": "custom",
+				// #endif
+				// #ifndef MP
 				"app-plus": {
+					"bounce": "none",
 					"titleNView": {
-						"type": "transparent"
+						"searchInput": {
+							"backgroundColor": "rgba(231, 231, 231,.7)",
+							"borderRadius": "16px",
+							"placeholder": "输入关键词搜索",
+							"disabled": true,
+							"placeholderColor": "#606266",
+							"align": "left"
+						}
 					}
-				}
+				},
+				// #endif
+				"navigationBarTitleText": "分类"
 			}
-		}, {
-			"path": "pages/public/login",
+		},
+		{
+			"path": "pages/redirect/redirect",
 			"style": {
-				"navigationBarTitleText": "登录",
+				"navigationBarTitleText": "微信登录跳转页面",
 				"app-plus": {
-					"titleNView": {
-						"type": "transparent"
-					}
+					"titleNView": false
 				}
 			}
 		},
 		{
-			"path": "pages/public/wxLogin",
+			"path": "pages/user/shareQrCode",
 			"style": {
-				"navigationBarTitleText": "微信登录",
+				"navigationBarTitleText": "邀请好友"
+			}
+		},
+		{
+			"path": "pages/story/story",
+			"style": {
+				"navigationBarTitleText": "品牌故事"
+			}
+		},
+		{
+			"path": "pages/story/storyDetail",
+			"style": {
+				"navigationStyle": "custom"
+			}
+		},
+		{
+			"path": "pages/user/jiedian",
+			"style": {
+				"navigationBarBackgroundColor": "transparent",
 				"app-plus": {
 					"titleNView": {
-						"type": "transparent"
+						"type": "float",
+						"titleText": "我的接点"
 					}
 				}
 			}
 		},
 		{
-			"path": "pages/public/forget",
+			"path": "pages/user/integral",
 			"style": {
-				"navigationBarTitleText": "忘记密码",
+				"navigationBarTextStyle": "black",
+				"navigationBarBackgroundColor": "transparent",
 				"app-plus": {
 					"titleNView": {
-						"type": "transparent"
+						"type": "float",
+						"titleText": "我的积分"
 					}
 				}
 			}
 		}
 	],
+	"globalStyle": {
+		"navigationBarTextStyle": "black",
+		"navigationBarTitleText": "uni-app",
+		"navigationBarBackgroundColor": "#FFFFFF",
+		"backgroundColor": "#f8f8f8"
+	},
 	"tabBar": {
 		"color": "#C0C4CC",
 		"selectedColor": "#3F7C1F",

+ 535 - 535
pages/cart/cart.vue

@@ -1,535 +1,535 @@
-<template>
-	<view class="container">
-		<!-- 空白页 -->
-		<view v-if="!hasLogin || empty === true" class="empty">
-			<image src="/static/error/emptyCart.png" class="emptyImg" mode="aspectFit"></image>
-			<view v-if="hasLogin" class="empty-tips">
-				空空如也
-				<navigator class="navigator" v-if="hasLogin" url="../index/index" open-type="switchTab">随便逛逛></navigator>
-			</view>
-			<view v-else class="empty-tips">
-				空空如也
-				<view class="navigator" @click="navToLogin">去登陆></view>
-			</view>
-		</view>
-		<view v-else>
-			<!-- 购物车头部 -->
-			<view class="cart-hand flex">
-				<view class="hand-tit">
-					购物车共 <text>{{ ' '+cartList.length}} 件</text>商品
-				</view>
-				<view class="hand-btn" @click="clearCart()">
-					清空购物车
-				</view>
-			</view>
-			<!-- 列表 -->
-			<view class="cart-list">
-				<block v-for="(item, index) in cartList" :key="item.id">
-					<view class="cart-item" :class="{ 'b-b': index !== cartList.length - 1 }">
-						<view class="image-wrapper">
-							<image
-								:src="item.productInfo.image"
-								:class="[item.loaded]"
-								mode="aspectFill"
-								lazy-load
-								@load="onImageLoad('cartList', index)"
-								@error="onImageError('cartList', index)"
-							></image>
-							<view class="iconfont iconroundcheckfill checkbox" :class="{ checked: item.checked }" @click="check('item', index)"></view>
-						</view>
-						<view class="item-right">
-							<text class="clamp title">{{ item.productInfo.store_name }}</text>
-							<text class="attr">{{ item.productInfo.attrInfo.suk }}</text>
-							<text class="price">¥{{ item.productInfo.price }}</text>
-							<view class="munbox flex" >
-								<image src="../../static/img/reduce.png" mode="" @click="reduce(item,index)"></image>
-								<input type="number" :value="item.cart_num" disabled/>
-								<image src="../../static/img/add.png" mode="" @click="add(item)"></image>
-							</view>
-						</view>
-					</view>
-				</block>
-			</view>
-			<!-- 底部菜单栏 -->
-			<view class="action-section">
-				<view class="checkbox">
-					<view class="iconfont iconroundcheckfill icon-checked-box" @click="check('all')" :class="{ 'icon-checked': allChecked }"></view>
-				</view>
-				<view class="total-box">
-					<text class="price">¥{{ total }}</text>
-					
-				</view>
-				<button type="primary" class="no-border confirm-btn" @click="createOrder">去结算</button>
-			</view>
-		</view>
-	</view>
-</template>
-
-<script>
-// import { getCartList, getCartNum, cartDel } from '@/api/user.js';
-import { mapState } from 'vuex';
-import uniNumberBox from '@/components/uni-number-box.vue';
-import { saveUrl, interceptor } from '@/utils/loginUtils.js';
-export default {
-	components: {
-		uniNumberBox
-	},
-	data() {
-		return {
-			total: 0, //总价格
-			allChecked: false, //全选状态  true|false
-			empty: false, //空白页现实  true|false
-			cartList: []
-		};
-	},
-	onShow() {
-		// 只有登录时才加载数据
-		if (this.hasLogin) {
-			this.loadData();
-		}
-	},
-	watch: {
-		//显示空白页
-		cartList(e) {
-			let empty = e.length === 0 ? true : false;
-			if (this.empty !== empty) {
-				this.empty = empty;
-			}
-		}
-	},
-	computed: {
-		...mapState('user', ['hasLogin'])
-	},
-	methods: {
-		reduce(item,index) {
-			if(item.cart_num == 1) {
-				uni.showModal({
-					content: '删除该商品?',
-					success: e => {
-						if (e.confirm) {
-							this.deleteCartItem(index)
-						}
-					}
-				});
-				
-			}else {
-				item.cart_num--
-				this.newNumberChange(item)
-			}
-		},
-		add(item) {
-			console.log(item)
-			if(item.productInfo.stock > item.cart_num) {
-				item.cart_num++
-				this.newNumberChange(item)
-			}else {
-				return 
-			}
-		},
-		//请求数据
-		async loadData() {
-			let obj = this;
-			getCartList({})
-				.then(function(e) {
-					// 获取当前购物车物品增加数量
-					let nub = obj.cartList.length;
-					// 获取之前对象数组
-					let aArray = obj.cartList.reverse();
-					// 获取返回数据对象数组
-					let bArray = e.data.valid.reverse();
-					obj.cartList = bArray
-						.map((item, ind) => {
-							// 设置返回数据默认为勾选状态
-							item.checked = true;
-							// 获取相同数组之前对象的数据
-							let carlist = aArray[ind];
-							// 判断之前是否已经加载完毕
-							if (carlist && carlist.loaded == 'loaded') {
-								item.loaded = 'loaded';
-							}
-							return item;
-						})
-						.reverse();
-					obj.calcTotal(); //计算总价
-				})
-				.catch(function(e) {
-					console.log(e);
-				});
-		},
-		//监听image加载完成
-		onImageLoad(key, index) {
-			// 修改载入完成后图片class样式
-			this.$set(this[key][index], 'loaded', 'loaded');
-		},
-		//监听image加载失败
-		onImageError(key, index) {
-			this[key][index].image = '/static/error/errorImage.jpg';
-		},
-		// 跳转到登录页
-		navToLogin() {
-			// 保存地址
-			saveUrl();
-			// 登录拦截
-			interceptor();
-		},
-		//选中状态处理
-		check(type, index) {
-			if (type === 'item') {
-				this.cartList[index].checked = !this.cartList[index].checked;
-			} else {
-				const checked = !this.allChecked;
-				const list = this.cartList;
-				list.forEach(item => {
-					item.checked = checked;
-				});
-				this.allChecked = checked;
-			}
-			this.calcTotal(type);
-		},
-		//数量
-		numberChange(data) {
-			let arr = this.cartList[data.index];
-			arr.cart_num = data.number;
-			getCartNum({ id: arr.id, number: data.number })
-				.then(e => {
-					console.log(e);
-				})
-				.catch(function(e) {
-					console.log(e);
-				});
-			this.calcTotal();
-		},
-		newNumberChange(item) {
-			getCartNum({ id: item.id, number: item.cart_num })
-				.then(e => {
-					console.log(e);
-				})
-				.catch(function(e) {
-					console.log(e);
-				});
-			this.calcTotal();
-		},
-		//删除
-		deleteCartItem(index) {
-			let list = this.cartList;
-			let row = list[index];
-			let id = row.id;
-			cartDel({
-				ids: id
-			});
-			this.cartList.splice(index, 1);
-			uni.hideLoading();
-			this.calcTotal();
-		},
-		//清空
-		clearCart() {
-			uni.showModal({
-				content: '清空购物车?',
-				success: e => {
-					if (e.confirm) {
-						let st = this.cartList.map(e => {
-							return e.id;
-						});
-						cartDel({
-							ids: st.join(',')
-						}).then(e => {
-							console.log(e);
-						});
-						this.cartList = [];
-					}
-				}
-			});
-		},
-		//计算总价
-		calcTotal() {
-			let list = this.cartList;
-			if (list.length === 0) {
-				this.empty = true;
-				return;
-			}
-			let total = 0;
-			let checked = true;
-			list.forEach(item => {
-				if (item.checked === true) {
-					total += item.productInfo.price * item.cart_num;
-				} else if (checked === true) {
-					checked = false;
-				}
-			});
-			this.allChecked = checked;
-			this.total = Number(total.toFixed(2));
-		},
-		//创建订单
-		createOrder() {
-			let list = this.cartList;
-			let goodsData = [];
-			list.forEach(item => {
-				if (item.checked) {
-					goodsData.push(item.id);
-				}
-			});
-
-			uni.navigateTo({
-				url: '/pages/order/createOrder?id=' + goodsData.join(',')
-			});
-		}
-	}
-};
-</script>
-
-<style lang="scss">
-.container {
-	padding-bottom: 134rpx;
-	background-color: $page-color-base;
-	/* 空白页 */
-	.empty {
-		position: fixed;
-		left: 0;
-		top: 0;
-		width: 100%;
-		height: 100vh;
-		padding-bottom: 100rpx;
-		display: flex;
-		justify-content: center;
-		flex-direction: column;
-		align-items: center;
-		background: #fff;
-		.emptyImg {
-			width: 300rpx;
-			height: 250rpx;
-			margin-bottom: 30rpx;
-		}
-		.empty-tips {
-			display: flex;
-			font-size: $font-sm + 2rpx;
-			color: $font-color-disabled;
-			.navigator {
-				color: $uni-color-primary;
-				margin-left: 16rpx;
-			}
-		}
-	}
-}
-/* 购物车列表项 */
-.cart-item {
-	width: 710rpx;
-	height: 210rpx;
-	background: #FFFFFF;
-	box-shadow: 0px 0px 10rpx 0rpx rgba(0, 0, 0, 0.1);
-	border-radius: 10rpx;
-	margin: 20rpx auto;
-	
-	display: flex;
-	position: relative;
-	padding: 30rpx 26rpx 30rpx 80rpx;
-	.image-wrapper {
-		width: 150rpx;
-		height: 150rpx;
-		flex-shrink: 0;
-		position: relative;
-		image {
-			border-radius: 8rpx;
-		}
-	}
-	.checkbox {
-		position: absolute;
-		top: 0;
-		bottom: 0;
-		left: -65rpx;
-		margin: auto 0;
-		height: 50rpx;
-		z-index: 8;
-		font-size: 44rpx;
-		line-height: 1;
-		padding: 4rpx;
-		color: $font-color-disabled;
-		background: #fff;
-		border-radius: 50px;
-	}
-	.item-right {
-		display: flex;
-		flex-direction: column;
-		flex: 1;
-		overflow: hidden;
-		position: relative;
-		padding-left: 30rpx;
-		.munbox {
-			width: 144rpx;
-			height: 44rpx;
-			position: absolute;
-			bottom: 0;
-			right: 0;
-			input {
-				display: inline-block;
-				text-align: center;
-			}
-			image {
-				flex-shrink: 0;
-				width: 44rpx;
-				height: 44rpx;
-			}
-		}
-		.title,
-		.price {
-			font-size: $font-base + 2rpx;
-			color: $font-color-dark;
-			height: 40rpx;
-			line-height: 40rpx;
-		}
-		.attr {
-			font-size: $font-sm + 2rpx;
-			color: $font-color-light;
-			height: 50rpx;
-			line-height: 50rpx;
-			
-			font-size: 26rpx;
-			font-family: PingFang SC;
-			font-weight: bold;
-			color: #999999;
-		}
-		.price {
-			// height: 50rpx;
-			// line-height: 50rpx;
-			padding-top: 20rpx;
-			font-size: 34rpx;
-			font-family: PingFang SC;
-			font-weight: bold;
-			color: #FF4C4C;
-		}
-		.step {
-			margin-top: 20rpx;
-		}
-		.title {
-			font-size: 34rpx;
-			font-family: PingFang SC;
-			font-weight: bold;
-			color: #333333;
-		}
-	}
-	.del-btn {
-		padding: 4rpx 10rpx;
-		font-size: 34rpx;
-		height: 50rpx;
-		color: $font-color-light;
-	}
-}
-/* 底部栏 */
-.action-section {
-	/* #ifdef H5 */
-	margin-bottom: 100rpx;
-	/* #endif */
-	position: fixed;
-	left: 30rpx;
-	bottom: 30rpx;
-	z-index: 95;
-	display: flex;
-	align-items: center;
-	width: 690rpx;
-	height: 100rpx;
-	padding: 0 30rpx;
-	background: rgba(255, 255, 255, 0.9);
-	box-shadow: 0 0 20rpx 0 rgba(0, 0, 0, 0.5);
-	border-radius: 16rpx;
-	.checkbox {
-		height: 52rpx;
-		position: relative;
-		.icon-checked-box {
-			border-radius: 50rpx;
-			background-color: #ffffff;
-			width: 52rpx;
-			height: 100%;
-			position: relative;
-			z-index: 5;
-			font-size: 53rpx;
-			line-height: 1;
-			color: $font-color-light;
-		}
-		.icon-checked {
-			color: $base-color;
-		}
-	}
-	.clear-btn {
-		position: absolute;
-		left: 26rpx;
-		top: 0;
-		z-index: 4;
-		width: 0;
-		height: 52rpx;
-		line-height: 52rpx;
-		padding-left: 38rpx;
-		font-size: $font-base;
-		color: #fff;
-		background: $font-color-disabled;
-		border-radius: 0 50px 50px 0;
-		opacity: 0;
-		transition: 0.2s;
-		&.show {
-			opacity: 1;
-			width: 120rpx;
-		}
-	}
-	.total-box {
-		flex: 1;
-		display: flex;
-		flex-direction: column;
-		text-align: right;
-		padding-right: 40rpx;
-		
-		.price {
-			font-size: $font-lg;
-			color: $font-color-dark;
-		}
-		.coupon {
-			font-size: $font-sm;
-			color: $font-color-light;
-			text {
-				color: $font-color-dark;
-			}
-		}
-	}
-	.confirm-btn {
-		padding: 0 38rpx;
-		margin: 0;
-		border-radius: 100px;
-		height: 76rpx;
-		line-height: 76rpx;
-		font-size: $font-base + 2rpx;
-		background: $base-color;
-	}
-}
-/* 复选框选中状态 */
-.action-section .checkbox.checked,
-.cart-item .checkbox.checked {
-	color: $base-color;
-}
-.cart-hand {
-	width: 750rpx;
-	height: 88rpx;
-	background: #FFFFFF;
-	font-size: 30rpx;
-	font-family: PingFang SC;
-	font-weight: bold;
-	color: #333333;
-	line-height: 88rpx;
-	padding-left: 28rpx;
-	padding-right: 26rpx;
-	.hand-tit {
-		text {
-			color: #FF4C4C;
-		}
-	
-	}
-	.hand-btn {
-		width: 164rpx;
-		height: 62rpx;
-		border: 2rpx solid #FF4C4C;
-		border-radius: 31rpx;
-		font-size: 26rpx;
-		font-family: PingFang SC;
-		font-weight: bold;
-		color: #FF4C4C;
-		line-height: 62rpx;
-		text-align: center;
-	}
-}
-</style>
+<template>
+	<view class="container">
+		<!-- 空白页 -->
+		<view v-if="!hasLogin || empty === true" class="empty">
+			<image src="/static/error/emptyCart.png" class="emptyImg" mode="aspectFit"></image>
+			<view v-if="hasLogin" class="empty-tips">
+				空空如也
+				<navigator class="navigator" v-if="hasLogin" url="../index/index" open-type="switchTab">随便逛逛></navigator>
+			</view>
+			<view v-else class="empty-tips">
+				空空如也
+				<view class="navigator" @click="navToLogin">去登陆></view>
+			</view>
+		</view>
+		<view v-else>
+			<!-- 购物车头部 -->
+			<view class="cart-hand flex">
+				<view class="hand-tit">
+					购物车共 <text>{{ ' '+cartList.length}} 件</text>商品
+				</view>
+				<view class="hand-btn" @click="clearCart()">
+					清空购物车
+				</view>
+			</view>
+			<!-- 列表 -->
+			<view class="cart-list">
+				<block v-for="(item, index) in cartList" :key="item.id">
+					<view class="cart-item" :class="{ 'b-b': index !== cartList.length - 1 }">
+						<view class="image-wrapper">
+							<image
+								:src="item.productInfo.image"
+								:class="[item.loaded]"
+								mode="aspectFill"
+								lazy-load
+								@load="onImageLoad('cartList', index)"
+								@error="onImageError('cartList', index)"
+							></image>
+							<view class="iconfont iconroundcheckfill checkbox" :class="{ checked: item.checked }" @click="check('item', index)"></view>
+						</view>
+						<view class="item-right">
+							<text class="clamp title">{{ item.productInfo.store_name }}</text>
+							<text class="attr">{{ item.productInfo.attrInfo.suk }}</text>
+							<text class="price">¥{{ item.productInfo.price }}</text>
+							<view class="munbox flex" >
+								<image src="../../static/img/reduce.png" mode="" @click="reduce(item,index)"></image>
+								<input type="number" :value="item.cart_num" disabled/>
+								<image src="../../static/img/add.png" mode="" @click="add(item)"></image>
+							</view>
+						</view>
+					</view>
+				</block>
+			</view>
+			<!-- 底部菜单栏 -->
+			<view class="action-section">
+				<view class="checkbox">
+					<view class="iconfont iconroundcheckfill icon-checked-box" @click="check('all')" :class="{ 'icon-checked': allChecked }"></view>
+				</view>
+				<view class="total-box">
+					<text class="price">¥{{ total }}</text>
+					
+				</view>
+				<button type="primary" class="no-border confirm-btn" @click="createOrder">去结算</button>
+			</view>
+		</view>
+	</view>
+</template>
+
+<script>
+import { getCartList, getCartNum, cartDel } from '@/api/user.js';
+import { mapState } from 'vuex';
+import uniNumberBox from '@/components/uni-number-box.vue';
+import { saveUrl, interceptor } from '@/utils/loginUtils.js';
+export default {
+	components: {
+		uniNumberBox
+	},
+	data() {
+		return {
+			total: 0, //总价格
+			allChecked: false, //全选状态  true|false
+			empty: false, //空白页现实  true|false
+			cartList: []
+		};
+	},
+	onShow() {
+		// 只有登录时才加载数据
+		if (this.hasLogin) {
+			this.loadData();
+		}
+	},
+	watch: {
+		//显示空白页
+		cartList(e) {
+			let empty = e.length === 0 ? true : false;
+			if (this.empty !== empty) {
+				this.empty = empty;
+			}
+		}
+	},
+	computed: {
+		...mapState('user', ['hasLogin'])
+	},
+	methods: {
+		reduce(item,index) {
+			if(item.cart_num == 1) {
+				uni.showModal({
+					content: '删除该商品?',
+					success: e => {
+						if (e.confirm) {
+							this.deleteCartItem(index)
+						}
+					}
+				});
+				
+			}else {
+				item.cart_num--
+				this.newNumberChange(item)
+			}
+		},
+		add(item) {
+			console.log(item)
+			if(item.productInfo.stock > item.cart_num) {
+				item.cart_num++
+				this.newNumberChange(item)
+			}else {
+				return 
+			}
+		},
+		//请求数据
+		async loadData() {
+			let obj = this;
+			getCartList({})
+				.then(function(e) {
+					// 获取当前购物车物品增加数量
+					let nub = obj.cartList.length;
+					// 获取之前对象数组
+					let aArray = obj.cartList.reverse();
+					// 获取返回数据对象数组
+					let bArray = e.data.valid.reverse();
+					obj.cartList = bArray
+						.map((item, ind) => {
+							// 设置返回数据默认为勾选状态
+							item.checked = true;
+							// 获取相同数组之前对象的数据
+							let carlist = aArray[ind];
+							// 判断之前是否已经加载完毕
+							if (carlist && carlist.loaded == 'loaded') {
+								item.loaded = 'loaded';
+							}
+							return item;
+						})
+						.reverse();
+					obj.calcTotal(); //计算总价
+				})
+				.catch(function(e) {
+					console.log(e);
+				});
+		},
+		//监听image加载完成
+		onImageLoad(key, index) {
+			// 修改载入完成后图片class样式
+			this.$set(this[key][index], 'loaded', 'loaded');
+		},
+		//监听image加载失败
+		onImageError(key, index) {
+			this[key][index].image = '/static/error/errorImage.jpg';
+		},
+		// 跳转到登录页
+		navToLogin() {
+			// 保存地址
+			saveUrl();
+			// 登录拦截
+			interceptor();
+		},
+		//选中状态处理
+		check(type, index) {
+			if (type === 'item') {
+				this.cartList[index].checked = !this.cartList[index].checked;
+			} else {
+				const checked = !this.allChecked;
+				const list = this.cartList;
+				list.forEach(item => {
+					item.checked = checked;
+				});
+				this.allChecked = checked;
+			}
+			this.calcTotal(type);
+		},
+		//数量
+		numberChange(data) {
+			let arr = this.cartList[data.index];
+			arr.cart_num = data.number;
+			getCartNum({ id: arr.id, number: data.number })
+				.then(e => {
+					console.log(e);
+				})
+				.catch(function(e) {
+					console.log(e);
+				});
+			this.calcTotal();
+		},
+		newNumberChange(item) {
+			getCartNum({ id: item.id, number: item.cart_num })
+				.then(e => {
+					console.log(e);
+				})
+				.catch(function(e) {
+					console.log(e);
+				});
+			this.calcTotal();
+		},
+		//删除
+		deleteCartItem(index) {
+			let list = this.cartList;
+			let row = list[index];
+			let id = row.id;
+			cartDel({
+				ids: id
+			});
+			this.cartList.splice(index, 1);
+			uni.hideLoading();
+			this.calcTotal();
+		},
+		//清空
+		clearCart() {
+			uni.showModal({
+				content: '清空购物车?',
+				success: e => {
+					if (e.confirm) {
+						let st = this.cartList.map(e => {
+							return e.id;
+						});
+						cartDel({
+							ids: st.join(',')
+						}).then(e => {
+							console.log(e);
+						});
+						this.cartList = [];
+					}
+				}
+			});
+		},
+		//计算总价
+		calcTotal() {
+			let list = this.cartList;
+			if (list.length === 0) {
+				this.empty = true;
+				return;
+			}
+			let total = 0;
+			let checked = true;
+			list.forEach(item => {
+				if (item.checked === true) {
+					total += item.productInfo.price * item.cart_num;
+				} else if (checked === true) {
+					checked = false;
+				}
+			});
+			this.allChecked = checked;
+			this.total = Number(total.toFixed(2));
+		},
+		//创建订单
+		createOrder() {
+			let list = this.cartList;
+			let goodsData = [];
+			list.forEach(item => {
+				if (item.checked) {
+					goodsData.push(item.id);
+				}
+			});
+
+			uni.navigateTo({
+				url: '/pages/order/createOrder?id=' + goodsData.join(',')
+			});
+		}
+	}
+};
+</script>
+
+<style lang="scss">
+.container {
+	padding-bottom: 134rpx;
+	background-color: $page-color-base;
+	/* 空白页 */
+	.empty {
+		position: fixed;
+		left: 0;
+		top: 0;
+		width: 100%;
+		height: 100vh;
+		padding-bottom: 100rpx;
+		display: flex;
+		justify-content: center;
+		flex-direction: column;
+		align-items: center;
+		background: #fff;
+		.emptyImg {
+			width: 300rpx;
+			height: 250rpx;
+			margin-bottom: 30rpx;
+		}
+		.empty-tips {
+			display: flex;
+			font-size: $font-sm + 2rpx;
+			color: $font-color-disabled;
+			.navigator {
+				color: $uni-color-primary;
+				margin-left: 16rpx;
+			}
+		}
+	}
+}
+/* 购物车列表项 */
+.cart-item {
+	width: 710rpx;
+	height: 210rpx;
+	background: #FFFFFF;
+	box-shadow: 0px 0px 10rpx 0rpx rgba(0, 0, 0, 0.1);
+	border-radius: 10rpx;
+	margin: 20rpx auto;
+	
+	display: flex;
+	position: relative;
+	padding: 30rpx 26rpx 30rpx 80rpx;
+	.image-wrapper {
+		width: 150rpx;
+		height: 150rpx;
+		flex-shrink: 0;
+		position: relative;
+		image {
+			border-radius: 8rpx;
+		}
+	}
+	.checkbox {
+		position: absolute;
+		top: 0;
+		bottom: 0;
+		left: -65rpx;
+		margin: auto 0;
+		height: 50rpx;
+		z-index: 8;
+		font-size: 44rpx;
+		line-height: 1;
+		padding: 4rpx;
+		color: $font-color-disabled;
+		background: #fff;
+		border-radius: 50px;
+	}
+	.item-right {
+		display: flex;
+		flex-direction: column;
+		flex: 1;
+		overflow: hidden;
+		position: relative;
+		padding-left: 30rpx;
+		.munbox {
+			width: 144rpx;
+			height: 44rpx;
+			position: absolute;
+			bottom: 0;
+			right: 0;
+			input {
+				display: inline-block;
+				text-align: center;
+			}
+			image {
+				flex-shrink: 0;
+				width: 44rpx;
+				height: 44rpx;
+			}
+		}
+		.title,
+		.price {
+			font-size: $font-base + 2rpx;
+			color: $font-color-dark;
+			height: 40rpx;
+			line-height: 40rpx;
+		}
+		.attr {
+			font-size: $font-sm + 2rpx;
+			color: $font-color-light;
+			height: 50rpx;
+			line-height: 50rpx;
+			
+			font-size: 26rpx;
+			font-family: PingFang SC;
+			font-weight: bold;
+			color: #999999;
+		}
+		.price {
+			// height: 50rpx;
+			// line-height: 50rpx;
+			padding-top: 20rpx;
+			font-size: 34rpx;
+			font-family: PingFang SC;
+			font-weight: bold;
+			color: #FF4C4C;
+		}
+		.step {
+			margin-top: 20rpx;
+		}
+		.title {
+			font-size: 34rpx;
+			font-family: PingFang SC;
+			font-weight: bold;
+			color: #333333;
+		}
+	}
+	.del-btn {
+		padding: 4rpx 10rpx;
+		font-size: 34rpx;
+		height: 50rpx;
+		color: $font-color-light;
+	}
+}
+/* 底部栏 */
+.action-section {
+	/* #ifdef H5 */
+	margin-bottom: 100rpx;
+	/* #endif */
+	position: fixed;
+	left: 30rpx;
+	bottom: 30rpx;
+	z-index: 95;
+	display: flex;
+	align-items: center;
+	width: 690rpx;
+	height: 100rpx;
+	padding: 0 30rpx;
+	background: rgba(255, 255, 255, 0.9);
+	box-shadow: 0 0 20rpx 0 rgba(0, 0, 0, 0.5);
+	border-radius: 16rpx;
+	.checkbox {
+		height: 52rpx;
+		position: relative;
+		.icon-checked-box {
+			border-radius: 50rpx;
+			background-color: #ffffff;
+			width: 52rpx;
+			height: 100%;
+			position: relative;
+			z-index: 5;
+			font-size: 53rpx;
+			line-height: 1;
+			color: $font-color-light;
+		}
+		.icon-checked {
+			color: $base-color;
+		}
+	}
+	.clear-btn {
+		position: absolute;
+		left: 26rpx;
+		top: 0;
+		z-index: 4;
+		width: 0;
+		height: 52rpx;
+		line-height: 52rpx;
+		padding-left: 38rpx;
+		font-size: $font-base;
+		color: #fff;
+		background: $font-color-disabled;
+		border-radius: 0 50px 50px 0;
+		opacity: 0;
+		transition: 0.2s;
+		&.show {
+			opacity: 1;
+			width: 120rpx;
+		}
+	}
+	.total-box {
+		flex: 1;
+		display: flex;
+		flex-direction: column;
+		text-align: right;
+		padding-right: 40rpx;
+		
+		.price {
+			font-size: $font-lg;
+			color: $font-color-dark;
+		}
+		.coupon {
+			font-size: $font-sm;
+			color: $font-color-light;
+			text {
+				color: $font-color-dark;
+			}
+		}
+	}
+	.confirm-btn {
+		padding: 0 38rpx;
+		margin: 0;
+		border-radius: 100px;
+		height: 76rpx;
+		line-height: 76rpx;
+		font-size: $font-base + 2rpx;
+		background: $base-color;
+	}
+}
+/* 复选框选中状态 */
+.action-section .checkbox.checked,
+.cart-item .checkbox.checked {
+	color: $base-color;
+}
+.cart-hand {
+	width: 750rpx;
+	height: 88rpx;
+	background: #FFFFFF;
+	font-size: 30rpx;
+	font-family: PingFang SC;
+	font-weight: bold;
+	color: #333333;
+	line-height: 88rpx;
+	padding-left: 28rpx;
+	padding-right: 26rpx;
+	.hand-tit {
+		text {
+			color: #FF4C4C;
+		}
+	
+	}
+	.hand-btn {
+		width: 164rpx;
+		height: 62rpx;
+		border: 2rpx solid #FF4C4C;
+		border-radius: 31rpx;
+		font-size: 26rpx;
+		font-family: PingFang SC;
+		font-weight: bold;
+		color: #FF4C4C;
+		line-height: 62rpx;
+		text-align: center;
+	}
+}
+</style>

+ 2 - 2
pages/index/index.vue

@@ -73,10 +73,10 @@
 						</view>
 						<view class="box-price">
 							<view class="price-left">
-								¥2690
+								¥{{item.price}}
 							</view>
 							<view class="price-right">
-								¥360
+								¥{{item.ot_price}}
 							</view>
 						</view>
 					</view>

+ 13 - 15
pages/order/order.vue

@@ -48,9 +48,9 @@
 							<text class="num">{{ item.cartInfo.length }}</text>
 							件商品 合计
-							<text class="price">{{ moneyNum(item.pay_price)}}</text>
-							(含邮费
-							<text class="price">{{ moneyNum(item.pay_postage)}}</text>
+							<text class="price">{{ moneyNum(item.pay_price)}}</text>
+							(含邮费
+							<text class="price">{{ moneyNum(item.pay_postage)}}</text>
 						</view>
 						<view class="action-box b-t" v-if="item.status != 5">
@@ -84,7 +84,7 @@ export default {
 			navList: [
 				{
 					state: 0,
-					text: '全部',
+					text: '待付款',
 					loadingType: 'more',
 					orderList: [],
 					page: 1, //当前页数
@@ -92,7 +92,7 @@ export default {
 				},
 				{
 					state: 1,
-					text: '待付款',
+					text: '待发货',
 					loadingType: 'more',
 					orderList: [],
 					page: 1, //当前页数
@@ -100,7 +100,7 @@ export default {
 				},
 				{
 					state: 2,
-					text: '待货',
+					text: '待货',
 					loadingType: 'more',
 					orderList: [],
 					page: 1, //当前页数
@@ -108,7 +108,7 @@ export default {
 				},
 				{
 					state: 3,
-					text: '待收货',
+					text: '待评价',
 					loadingType: 'more',
 					orderList: [],
 					page: 1, //当前页数
@@ -301,16 +301,16 @@ export default {
 				stateTipColor = '#fa436a';
 			switch (+state) {
 				case 0:
-					stateTip = '全部';
+					stateTip = '待付款';
 					break;
 				case 1:
-					stateTip = '待付款';
+					stateTip = '待发货';
 					break;
 				case 2:
-					stateTip = '待货';
+					stateTip = '待货';
 					break;
 				case 3:
-					stateTip = '待收货';
+					stateTip = '待评价';
 					break;
 				case 4:
 					stateTip = '已完成';
@@ -346,6 +346,7 @@ page,
 .navbar {
 	display: flex;
 	height: 40px;
+	padding: 0 5px;
 	background: #fff;
 	box-shadow: 0 1px 5px rgba(0, 0, 0, 0.06);
 	position: relative;
@@ -358,10 +359,7 @@ page,
 		height: 100%;
 		font-size: 15px;
 		color: $font-color-dark;
-		position: relative;
-		margin-top: 80rpx;
-		background-color: #fff;
-		border-top: 1rpx solid #F8F6F6;
+		position: relative;
 		&.current {
 			color: $base-color;
 			&:after {

+ 414 - 0
pages/product/list.vue

@@ -0,0 +1,414 @@
+<template>
+	<view class="content">
+		<view class="navbar" :style="{ position: headerPosition, top: headerTop }">
+			<view class="nav-item" :class="{ current: filterIndex === 0 }" @click="tabClick(0)">综合排序</view>
+			<view class="nav-item" :class="{ current: filterIndex === 1 }" @click="tabClick(1)">
+				<text>销量优先</text>
+				<view class="p-box">
+					<text :class="{ active: numberOrder === 1 && filterIndex === 1 }" class="iconfont iconfold"></text>
+					<text :class="{ active: numberOrder === 2 && filterIndex === 1 }" class="iconfont iconfold xia"></text>
+				</view>
+			</view>
+			<view class="nav-item" :class="{ current: filterIndex === 2 }" @click="tabClick(2)">
+				<text>价格</text>
+				<view class="p-box">
+					<text :class="{ active: priceOrder === 1 && filterIndex === 2 }" class="iconfont iconfold"></text>
+					<text :class="{ active: priceOrder === 2 && filterIndex === 2 }" class="iconfont iconfold xia"></text>
+				</view>
+			</view>
+			<text class="cate-item iconfont iconapps" @click="toggleCateMask('show')"></text>
+		</view>
+		<view class="goods-list">
+			<view v-for="(item, index) in goodsList" :key="index" class="goods-item" @click="navToDetailPage(item)">
+				<view class="image-wrapper"><image :src="item.image" mode="aspectFill"></image></view>
+				<text class="title clamp">{{ item.title }}</text>
+				<view class="price-box">
+					<text class="price">{{ item.price }}</text>
+					<text>已售 {{ item.sales }}</text>
+				</view>
+			</view>
+		</view>
+		<uni-load-more :status="loadingType"></uni-load-more>
+
+		<view class="cate-mask" :class="cateMaskState === 0 ? 'none' : cateMaskState === 1 ? 'show' : ''" @click="toggleCateMask">
+			<view class="cate-content" @click.stop.prevent="stopPrevent" @touchmove.stop.prevent="stopPrevent">
+				<scroll-view scroll-y class="cate-list">
+					<view v-for="item in cateList" :key="item.id">
+						<view class="cate-item b-b two">{{ item.cate_name }}</view>
+						<view v-for="tItem in item.children" :key="tItem.id" class="cate-item b-b" :class="{ active: tItem.id == cateId }" @click="changeCate(tItem)">
+							{{ tItem.cate_name }}
+						</view>
+					</view>
+				</scroll-view>
+			</view>
+		</view>
+	</view>
+</template>
+
+<script>
+import uniLoadMore from '@/components/uni-load-more/uni-load-more.vue';
+import { getProducts } from '@/api/product.js';
+import { getCategoryList } from '@/api/product.js';
+export default {
+	components: {
+		uniLoadMore
+	},
+	data() {
+		return {
+			cateMaskState: 0, //分类面板展开状态
+			headerPosition: 'fixed',
+			headerTop: '0px',
+			loadingType: 'more', //加载更多状态
+			filterIndex: 0, //查询类型
+			numberOrder: 0, //1 销量从低到高 2销量从高到低
+			limit: 6, //每次加载数据条数
+			page: 0, //当前页数
+			cateId: 0, //已选三级分类id
+			priceOrder: 0, //1 价格从低到高 2价格从高到低
+			cateList: [], //分类列表
+			goodsList: [] //商品列表
+		};
+	},
+
+	onLoad(options) {
+		// #ifdef H5
+		this.headerTop = document.getElementsByTagName('uni-page-head')[0].offsetHeight + 'px';
+		// #endif
+		this.cateId = options.tid;
+		this.loadCateList(options.fid, options.sid);
+		this.loadData();
+	},
+	onPageScroll(e) {
+		//兼容iOS端下拉时顶部漂移
+		if (e.scrollTop >= 0) {
+			this.headerPosition = 'fixed';
+		} else {
+			this.headerPosition = 'absolute';
+		}
+	},
+	//下拉刷新
+	onPullDownRefresh() {
+		this.loadData('refresh');
+	},
+	//监听页面是否滚动到底部加载更多
+	onReachBottom() {
+		this.loadData();
+	},
+	methods: {
+		//加载分类
+		async loadCateList(fid, sid) {
+			let obj = this;
+			getCategoryList({}).then(function(e) {
+				console.log(e);
+				e.data.forEach(function(e) {
+					if (e.id == fid) {
+						obj.cateList = e.children;
+						return;
+					}
+				});
+				console.log(obj.cateList);
+			});
+		},
+		//加载商品 ,带下拉刷新和上滑加载
+		async loadData(type = 'add', loading) {
+			let obj = this;
+			let data = {
+				page: obj.page,
+				limit: obj.limit,
+				sid: obj.cateId //分类id
+			};
+			//没有更多直接返回
+			if (type === 'add') {
+				if (obj.loadingType === 'nomore') {
+					return;
+				}
+				obj.loadingType = 'loading';
+			} else {
+				obj.loadingType = 'more';
+			}
+			if (type === 'refresh') {
+				// 清空数组
+				obj.goodsList = [];
+				obj.page = 1
+			}
+			if (this.filterIndex == 1) {
+				console.log( obj.salesOrder);
+				data.salesOrder = obj.numberOrder == 1 ? 'asc' : 'desc';
+			}
+			if (this.filterIndex == 2) {
+				console.log( obj.priceOrder);
+				data.priceOrder = obj.priceOrder == 1 ? 'asc' : 'desc';
+			}
+			getProducts(data).then(function(e) {
+				console.log(e.data);
+				obj.goodsList = obj.goodsList.concat(e.data);
+				//判断是否还有下一页,有是more  没有是nomore
+				if (obj.limit==e.data.length) {
+					obj.page++
+					obj.loadingType='more'
+				} else{
+					obj.loadingType='nomore'
+				}
+				if (type === 'refresh') {
+					if (loading == 1) {
+						uni.hideLoading();
+					} else {
+						uni.stopPullDownRefresh();
+					}
+				}
+			});
+		},
+		//筛选点击
+		tabClick(index) {
+			// 防止重复点击综合排序
+			if (this.filterIndex === 0 && this.filterIndex === index) {
+				return;
+			}
+			this.filterIndex = index;
+			// 判断是否为销量优先
+			if (index === 1) {
+				this.numberOrder = this.numberOrder === 1 ? 2 : 1;
+			}
+			// 判断是否为价格优先
+			if (index === 2) {
+				this.priceOrder = this.priceOrder === 1 ? 2 : 1;
+			}
+			// 初始化页数
+			this.page = 1;
+			// 初始化数组
+			uni.pageScrollTo({
+				duration: 300,
+				scrollTop: 0
+			});
+			this.loadData('refresh', 1);
+			uni.showLoading({
+				title: '正在加载'
+			});
+		},
+		//显示分类面板
+		toggleCateMask(type) {
+			let timer = type === 'show' ? 10 : 300;
+			let state = type === 'show' ? 1 : 0;
+			this.cateMaskState = 2;
+			setTimeout(() => {
+				this.cateMaskState = state;
+			}, timer);
+		},
+		//分类点击
+		changeCate(item) {
+			this.cateId = item.id;
+			// 显示右侧分类
+			this.toggleCateMask();
+			// 滚轮返回顶部
+			uni.pageScrollTo({
+				duration: 300,
+				scrollTop: 0
+			});
+			// 初始化查询页数
+			this.page = 1
+			// 重新加载数据
+			this.loadData('refresh', 1);
+			uni.showLoading({
+				title: '正在加载'
+			});
+		},
+		//详情
+		navToDetailPage(item) {
+			let id = item.id;
+			uni.navigateTo({
+				url: `/pages/product/product?id=${id}`
+			});
+		},
+		stopPrevent() {}
+	}
+};
+</script>
+
+<style lang="scss">
+page,
+.content {
+	background: $page-color-base;
+}
+.content {
+	padding-top: 96rpx;
+}
+
+.navbar {
+	position: fixed;
+	left: 0;
+	top: var(--window-top);
+	display: flex;
+	width: 100%;
+	height: 80rpx;
+	background: #fff;
+	box-shadow: 0 2rpx 10rpx rgba(0, 0, 0, 0.06);
+	z-index: 10;
+	.nav-item {
+		flex: 1;
+		display: flex;
+		justify-content: center;
+		align-items: center;
+		height: 100%;
+		font-size: 30rpx;
+		color: $font-color-dark;
+		position: relative;
+		&.current {
+			color: $base-color;
+			&:after {
+				content: '';
+				position: absolute;
+				left: 50%;
+				bottom: 0;
+				transform: translateX(-50%);
+				width: 120rpx;
+				height: 0;
+				border-bottom: 4rpx solid $base-color;
+			}
+		}
+	}
+	.p-box {
+		display: flex;
+		flex-direction: column;
+		.iconfont {
+			display: flex;
+			align-items: center;
+			justify-content: center;
+			width: 30rpx;
+			height: 14rpx;
+			line-height: 1;
+			margin-left: 4rpx;
+			font-size: 26rpx;
+			color: #888;
+			&.active {
+				color: $base-color;
+			}
+		}
+		.xia {
+			transform: scaleY(-1);
+		}
+	}
+	.cate-item {
+		display: flex;
+		justify-content: center;
+		align-items: center;
+		height: 100%;
+		width: 80rpx;
+		position: relative;
+		font-size: 44rpx;
+		&:after {
+			content: '';
+			position: absolute;
+			left: 0;
+			top: 50%;
+			transform: translateY(-50%);
+			border-left: 1px solid #ddd;
+			width: 0;
+			height: 36rpx;
+		}
+	}
+}
+
+/* 分类 */
+.cate-mask {
+	position: fixed;
+	left: 0;
+	top: var(--window-top);
+	bottom: 0;
+	width: 100%;
+	background: rgba(0, 0, 0, 0);
+	z-index: 95;
+	transition: 0.3s;
+
+	.cate-content {
+		width: 630rpx;
+		height: 100%;
+		background: #fff;
+		float: right;
+		transform: translateX(100%);
+		transition: 0.3s;
+	}
+	&.none {
+		display: none;
+	}
+	&.show {
+		background: rgba(0, 0, 0, 0.4);
+
+		.cate-content {
+			transform: translateX(0);
+		}
+	}
+}
+.cate-list {
+	display: flex;
+	flex-direction: column;
+	height: 100%;
+	.cate-item {
+		display: flex;
+		align-items: center;
+		height: 90rpx;
+		padding-left: 30rpx;
+		font-size: 28rpx;
+		color: #555;
+		position: relative;
+	}
+	.two {
+		height: 64rpx;
+		color: #303133;
+		font-size: 30rpx;
+		background: #f8f8f8;
+	}
+	.active {
+		color: $base-color;
+	}
+}
+
+/* 商品列表 */
+.goods-list {
+	display: flex;
+	flex-wrap: wrap;
+	padding: 0 30rpx;
+	background: #fff;
+	.goods-item {
+		display: flex;
+		flex-direction: column;
+		width: 48%;
+		padding-bottom: 40rpx;
+		&:nth-child(2n + 1) {
+			margin-right: 4%;
+		}
+	}
+	.image-wrapper {
+		width: 100%;
+		height: 330rpx;
+		border-radius: 3px;
+		overflow: hidden;
+		image {
+			width: 100%;
+			height: 100%;
+			opacity: 1;
+		}
+	}
+	.title {
+		font-size: $font-lg;
+		color: $font-color-dark;
+		line-height: 80rpx;
+	}
+	.price-box {
+		display: flex;
+		align-items: center;
+		justify-content: space-between;
+		padding-right: 10rpx;
+		font-size: 24rpx;
+		color: $font-color-light;
+	}
+	.price {
+		font-size: $font-lg;
+		color: $uni-color-primary;
+		line-height: 1;
+		&:before {
+			content: '¥';
+			font-size: 26rpx;
+		}
+	}
+}
+</style>

+ 3 - 7
pages/product/product.vue

@@ -354,6 +354,7 @@
 						productId: item.id //商品编号
 					})
 					.then(function(e) {
+						console.log(e,'ddddddddddddddd')
 						uni.showToast({
 							title: '成功加入购物车',
 							type: 'top',
@@ -548,13 +549,8 @@
 					integralId: '',
 				};
 				console.log(obj.goodsType, 'obj.goodsType77777777777777777777')
-				if (obj.goodsType == 1) {
-					data.secKillId = obj.goodsObjact.id
-					data.new = 1;
-				}
-				if (obj.goodsType == 2) {
-					data.new = 1;
-					data.integralId = obj.goodsObjact.id
+				if(obj.type == 2) {
+					data.new = 0
 				}
 				cartAdd(data)
 					.then(function(e) {

+ 278 - 0
pages/product/reply.vue

@@ -0,0 +1,278 @@
+<template>
+	<view class="container">
+		<view class="reply_btn flex_item">
+			<view class="btn" v-for="(item, index) in navList" :key="index" :class="{ current: tabCurrentIndex === index }" @click="tabClick(index)">
+				{{ item.text }}({{ item.number }})
+			</view>
+		</view>
+		<swiper :current="tabCurrentIndex" class="swiper-box" :style="{ height: maxheight + 'px' }" duration="300" @change="changeTab">
+			<swiper-item class="tab-content" v-for="(tabItem, tabIndex) in navList" :key="tabIndex">
+				<scroll-view class="list-scroll-content" scroll-y @scrolltolower="loadDate">
+					<!-- 评论列表 -->
+					<view v-for="(item, index) in tabItem.orderList" :key="index" class="eva-box">
+						<view class="row-1 flex1">
+							<image class="portrait" :src="item.avatar" mode="aspectFill"></image>
+							<view class="right flex1">
+								<view>
+									<view class="name flex1">
+										<view>{{ item.nickname }}</view>
+										<!-- <image src="../../static/label/vip.png"></image> -->
+									</view>
+									<uniRate class="rate" disabled size="10" margin="1" :value="item.product_score" ></uniRate>
+								</view>
+								<view class="bot">
+									<text class="attr"></text>
+									<text class="time">{{ item.add_time }}</text>
+								</view>
+							</view>
+						</view>
+						<view class="con">{{ item.comment }}</view>
+						<view class="con_box">
+							<view class="con_image" v-for="ls in item.pics"><image :src="ls"></image></view>
+						</view>
+					</view>
+					<uni-load-more :status="tabItem.loadingType"></uni-load-more>
+				</scroll-view>
+			</swiper-item>
+		</swiper>
+	</view>
+</template>
+
+<script>
+import { reply_config, reply_list } from '@/api/product.js';
+import uniRate from '@/components/uni-rate/uni-rate.vue';
+export default {
+	components: {
+		uniRate
+	},
+	watch: {},
+	data() {
+		return {
+			maxheight: '',
+			id: '', //商品id
+			list: '', //评论列表
+			reply: '', //评论配置
+			tabCurrentIndex: 0,
+			navList: [
+				{
+					state: 0,
+					text: '全部',
+					loadingType: 'more',
+					number: '',
+					orderList: [],
+					page: 1, //当前页数
+					limit: 5 //每次信息条数
+				},
+				{
+					state: 1,
+					text: '好评',
+					loadingType: 'more',
+					number: '',
+					orderList: [],
+					page: 1, //当前页数
+					limit: 5 //每次信息条数
+				},
+				{
+					state: 3,
+					text: '差评',
+					loadingType: 'more',
+					number: '',
+					orderList: [],
+					page: 1, //当前页数
+					limit:5 //每次信息条数
+				},
+				{
+					state: 2,
+					text: '中评',
+					loadingType: 'more',
+					number: '',
+					orderList: [],
+					page: 1, //当前页数
+					limit: 5 //每次信息条数
+				}
+			]
+		};
+	},
+	computed: {},
+	onReady() {
+		// 初始化获取页面宽度
+		uni.createSelectorQuery()
+			.select('.container')
+			.fields(
+				{
+					size: true
+				},
+				data => {
+					// 保存头部高度
+					this.maxheight = data.height - Math.floor((data.width / 750) * 145);
+				}
+			)
+			.exec();
+	},
+	onLoad(option) {
+		this.id = option.id;
+	},
+	onShow() {
+		let obj = this;
+		reply_config({}, this.id).then(function({ data }) {
+			obj.reply = data;
+			obj.navList[0].number = obj.reply.sum_count;
+			obj.navList[1].number = obj.reply.good_count;
+			obj.navList[2].number = obj.reply.poor_count;
+			obj.navList[3].number = obj.reply.in_count;
+		});
+		this.loadDate();
+	},
+	methods: {
+		async loadDate(source) {
+			//这里是将订单挂载到tab列表下
+			let index = this.tabCurrentIndex;
+			let navItem = this.navList[index];
+			let state = navItem.state;
+			if (source === 'tabChange' && navItem.loaded === true) {
+				//tab切换只有第一次需要加载数据
+				return;
+			}
+			if (navItem.loadingType === 'loading') {
+				//防止重复加载
+				return;
+			}
+			if (navItem.loadingType === 'noMore') {
+				//防止重复加载
+				return;
+			}
+			// 修改当前对象状态为加载中
+			navItem.loadingType = 'loading';
+			reply_list(
+				{
+					type: state,
+					page: navItem.page,
+					limit: navItem.limit
+				},
+				this.id
+			)
+				.then(({ data }) => {
+					let arr = data;
+					navItem.orderList = navItem.orderList.concat(arr);
+					console.log(navItem.orderList,111)
+					navItem.page++;
+					if (navItem.limit == data.length) {
+						//判断是否还有数据, 有改为 more, 没有改为noMore
+						navItem.loadingType = 'more';
+						return;
+					} else {
+						//判断是否还有数据, 有改为 more, 没有改为noMore
+						navItem.loadingType = 'noMore';
+					}
+					this.$set(navItem, 'loaded', true);
+				})
+				.catch(e => {
+					console.log(e);
+				});
+		},
+		// async GetList(){
+		// 	let obj = this;
+		// 	reply_list({}, obj.id).then(function({ data }) {
+		// 		// console.log(data)
+		// 		obj.list = data;
+		// 	});
+		// },
+		//跳转接口
+		navTo(url) {
+			uni.navigateTo({
+				url
+			});
+		},
+		//swiper 切换
+		changeTab(e) {
+			this.tabCurrentIndex = e.target.current;
+			this.loadDate('tabChange');
+		},
+		//顶部tab点击
+		tabClick(index) {
+			this.tabCurrentIndex = index;
+		}
+	}
+};
+</script>
+
+<style lang="scss">
+page {
+	background: #ffffff;
+	height: 100%;
+	.container {
+		height: 100%;
+		padding: 25rpx 25rpx;
+		padding-top: 120rpx;
+		.swiper-box {
+			// height: 100%;
+			.list-scroll-content {
+				height: 100%;
+			}
+		}
+	}
+}
+.reply_btn {
+	padding: 15rpx 0rpx;
+	.btn {
+		padding: 10rpx 25rpx;
+		font-size: 24rpx;
+		background: #f4f4f4;
+		margin-right: 25rpx;
+	}
+	.current {
+		background-color: #e93323 !important;
+		color: #ffffff !important;
+	}
+}
+.eva-box {
+	padding: 20rpx 0;
+	// height: 100%;
+	.row-1{
+		.portrait {
+			flex-shrink: 0;
+			width: 80rpx;
+			height: 80rpx;
+			border-radius: 100px;
+		}
+		.right {
+			flex: 1;
+			font-size: $font-base;
+			color: $font-color-base;
+			padding-left: 26rpx;
+			.name{
+				margin-bottom: 20rpx;
+				image{
+					width: 35rpx;
+					height: 25rpx;
+				}
+			}
+			.bot {
+				display: flex;
+				justify-content: space-between;
+				font-size: $font-sm;
+				color: $font-color-light;
+			}
+		}
+	}
+	.con {
+		font-size:24rpx;
+		font-weight:500;
+		color:rgba(84,84,86,1);
+		padding: 20rpx 0 35rpx 0;
+		letter-spacing: 3rpx;
+	}
+	.con_image {
+		width: 150rpx;
+		height: 150rpx;
+		display: inline-block;
+		margin-right: 20rpx;
+		image {
+			width: 100%;
+			height: 100%;
+		}
+	}
+}
+
+
+</style>

+ 122 - 0
pages/redirect/redirect.vue

@@ -0,0 +1,122 @@
+<template>
+	<view>
+	</view>
+</template>
+<script>
+import { getUserInfo } from '@/api/user.js';
+import { mapMutations,mapState } from 'vuex';
+// #ifdef H5
+import { wechatAuth } from '@/api/wx';
+// #endif
+// #ifdef MP-WEIXIN
+import { wechatMpAuth } from '@/api/wx';
+// #endif
+export default {
+	computed: {
+		...mapState('user',['urlFile'])
+	},
+	onLoad(option) {
+		let obj = this;
+		// 判断是否需要保存定向地址
+		// #ifdef H5
+		this.loadH5()
+		// #endif
+		// #ifdef MP-WEIXIN
+		this.loadMp(option)
+		// #endif
+	},
+	methods: {
+		...mapMutations('user',['login', 'setUserInfo']),
+		// #ifdef H5
+		loadH5() {
+			let obj = this;
+			let url = window.location.href;
+			let code = url.match(/code=([0-9]|[a-z]|[A-Z])*/g)[0].replace('code=', '');
+			let spread = uni.getStorageSync('spread')||'';
+			wechatAuth({
+				code: code,
+				spread:spread,
+			}).then(({ data }) => {
+				obj.wchatAuth(data);
+			}).catch((e) => {
+				uni.showModal({
+					title: '错误',
+					content: JSON.stringify(e),
+					showCancel: false,
+				});
+			});;
+		},
+		// #endif
+		// #ifdef MP-WEIXIN
+		loadMp(option) {
+			let obj = this;
+			// 获取登录授权页数据
+			let user = obj.$api.prePage().userInfo;
+			// #ifndef MP
+			// 获取推广人id
+			let spread_spid = uni.getStorageSync('spread') || '';
+			// #endif
+			// #ifdef MP
+			// 小程序推广人
+			let spread_code = uni.getStorageSync('spread_code') || '';
+			// #endif
+			wechatMpAuth({
+				code: option.code,
+				iv: user.target.iv,
+				encryptedData: user.target.encryptedData,
+				// #ifndef MP
+				spread_spid: spread_spid,
+				// #endif
+				// #ifdef MP
+				spread_code:spread_code
+				// #endif
+			}).then(({ data }) => {
+				obj.wchatAuth(data);
+			}).catch((e) => {
+				uni.showModal({
+					title: '错误',
+					content: JSON.stringify(e),
+					showCancel: false,
+				});
+			});
+		},
+		// #endif
+		wchatAuth(data) {
+			let obj = this;
+			// 保存token
+			uni.setStorageSync('token', data.token);
+			// 获取用户基础信息
+			getUserInfo({}).then(e => {
+				obj.login();
+				// 保存返回用户数据
+				obj.setUserInfo(e.data);
+				let ur = uni.getStorageSync('present')|| '/pages/index/index';
+				// 用于处理缓存bug
+				if (ur=='pages/product/product') {
+					ur = '/pages/index/index'
+				}
+				uni.switchTab({
+					url: ur,
+					fail(e) {
+						uni.navigateTo({
+							url: ur,
+							fail(e) {
+								uni.navigateTo({
+									url: '/pages/index/index',
+								});
+							}
+						});
+					}
+				});
+			}).catch((e) => {
+				uni.showModal({
+					title: '错误',
+					content: JSON.stringify(e),
+					showCancel: false,
+				});
+			});;
+		}
+	}
+};
+</script>
+<style></style>

+ 21 - 18
pages/set/userinfo.vue

@@ -38,9 +38,9 @@
   	</view>
   	<view class="row b-b flex" v-if="userInfo.account || userInfo.phone">
   		<text class="tit">用户账号</text>
-  		<input class="input" v-model="userInfo.account || userInfo.phone" type="number" disabled="true" placeholder-class="placeholder" />
+  		<input class="input" v-model="userInfo.account || userInfo.phone" type="number" disabled="true" placeholder-class="placeholder" style="color: #999;"/>
   	</view>
-  	<view class="submit-box flex" >
+  	<view class="submit-box" >
   		<view class="submit" @click="edit">确认修改</view>
   		<view class="submit" @click="toLogout">退出登录</view>
   	</view>
@@ -52,7 +52,7 @@
   import uniList from '@/components/uni-list/uni-list.vue';
   import uniListItem from '@/components/uni-list-item/uni-list-item.vue';
   import { mapState, mapMutations } from 'vuex';
-  import { logout } from '@/api/set.js';
+  import { logout } from '@/api/set.js';
 
   import {
   		uploads,edit,upload
@@ -64,7 +64,7 @@
   	},
   	data() {
   		return {
-  			userInfo:{},
+  			userInfo:{},
 			pics:[],
   		};
   	},
@@ -94,25 +94,28 @@
   				}
   			});
   		},
-  		imgsub() {
-			let obj = this
-			upload({
-				filename: ''
-			}).then(res => {
-				console.log(res[0].url)
-				obj.userInfo.avatar = res[0].url
+  		imgsub() {
+			let obj = this
+			upload({
+				filename: ''
+			}).then(res => {
+				console.log(res[0].url)
+				obj.userInfo.avatar = res[0].url
 			});
   		},
   		edit() {
-  			const that = this;
-			uni.showLoading({
-				title: '提交中...',
-				mask:true
-			})
+  			const that = this;
+			uni.showLoading({
+				title: '提交中...',
+				mask:true
+			})
+			if(this.userInfo.nickname == '') {
+				return this.$api.msg('昵称不能为空!')
+			}
   			edit({
   				avatar: this.userInfo.avatar,
   				nickname: this.userInfo.nickname
-  			}).then( e =>{
+  			}).then( e =>{
 				uni.hideLoading()
   				that.$api.msg('修改成功');
   				setTimeout(()=> {
@@ -191,7 +194,7 @@
   		.submit{
   			margin: 40rpx auto;
   			width: 560rpx;
-  			background-color: #ff4c4b;
+  			background-color: #6EAB4E;
   			color: #FFFFFF;
   			text-align: center;
   			padding:26rpx 0rpx;

+ 343 - 0
pages/user/award.vue

@@ -0,0 +1,343 @@
+<template>
+	<view class="content">
+		<view class="content-money">
+			<view class="money-box">
+				<image src="../../static/img/img33.png" mode=""></image>
+				<view class="money">
+					<text>¥</text>
+					{{ money | getMoneyStyle }}
+				</view>
+			</view>
+		</view>
+		<view class="navbar">
+			<view v-for="(item, index) in navList" :key="index" class="nav-item" :class="{ current: tabCurrentIndex === index }" @click="tabClick(index)">{{ item.text }}</view>
+		</view>
+		<swiper :current="tabCurrentIndex" :style="{ height: maxheight + 'px' }" class="swiper-box" duration="300" @change="changeTab">
+			<swiper-item class="tab-content" v-for="(tabItem, tabIndex) in navList" :key="tabIndex">
+				<scroll-view scroll-y="true" class="list-scroll-content" @scrolltolower="loadData">
+					<!-- 空白页 -->
+					<empty v-if="tabItem.loaded === true && tabItem.orderList.length === 0"></empty>
+					<!-- 订单列表 -->
+					<view class="order-item flex" v-for="(item, index) in tabItem.orderList" :key="index" @click="showItem(item)">
+						<view class="title-box">
+							<view class="title">
+								<text>{{ item.title }} </text>
+								<!-- <text>{{item.status == 0 ? (' ' + ' ' + ' (冻结中)'):''}}</text> -->
+							</view>
+							<view class="time">
+								<text>{{ item.add_time }}</text>
+							</view>
+						</view>
+						<view class="money">
+							<text>{{ (item.pm == 0 ? '-' : '+') + item.number }}</text>
+						</view>
+					</view>
+					<uni-load-more :status="tabItem.loadingType"></uni-load-more>
+				</scroll-view>
+			</swiper-item>
+		</swiper>
+		<view class="moneyTx" ><view class="btn" @click="navto('./withdrawal')">提现</view></view>
+	</view>
+</template>
+
+<script>
+import { getSpreadCount } from '@/api/user.js';
+import { spreadCommission, userBalance } from '@/api/wallet.js';
+import { mapState, mapMutations } from 'vuex';
+import { getMoneyStyle } from '@/utils/rocessor.js';
+import uniLoadMore from '@/components/uni-load-more/uni-load-more.vue';
+import empty from '@/components/empty';
+export default {
+	filters: {
+		getMoneyStyle
+	},
+	components: {
+		empty,
+		uniLoadMore
+	},
+	computed: {
+		...mapState('user', ['userInfo', 'orderInfo', 'hasLogin'])
+	},
+	onReady() {
+		//初始化获取页面宽度
+		uni.createSelectorQuery()
+			.select('.content')
+			.fields(
+				{
+					size: true
+				},
+				data => {
+					console.log(data);
+					console.log(Math.floor((data.width / 750) * 300));
+					//保存头部高度
+					this.maxheight = data.height - Math.floor((data.width / 750) * 570);
+					console.log(this.maxheight);
+				}
+			)
+			.exec();
+	},
+	data() {
+		return {
+			// 头部图高度
+			maxheight: '',
+			tabCurrentIndex: 0,
+			navList: [
+				{
+					state: 0,
+					text: '收入',
+					loadingType: 'more',
+					orderList: [],
+					page: 1, //当前页面
+					limit: 10 //每次信息条数
+				},
+				{
+					state: 1,
+					text: '支出',
+					loadingType: 'more',
+					orderList: [],
+					page: 1, //当前页面
+					limit: 10 //每次信息条数
+				}
+			],
+			money: ''
+		};
+	},
+	onLoad(options) {},
+	onShow() {
+		this.loadData();
+		//获取用户余额
+		getSpreadCount({}, 3).then(({ data }) => {
+			console.log(data);
+			this.money = data.count;
+		});
+		// userBalance({}).then(({ data }) => {
+		// 	this.money = data.orderStatusSum;
+		// });
+	},
+	methods: {
+		navto(e) {
+			uni.navigateTo({
+				url: e
+			});
+		},
+		async loadData(source) {
+			//这里时将订单挂载到tab列表下
+			let index = this.tabCurrentIndex;
+			let navItem = this.navList[index];
+			let state = navItem.state + 3;
+			if (source === 'tabChange' && navItem.loaded === true) {
+				//tab切换只有第一次需要加载数据
+				return;
+			}
+			if (navItem.loadingType === 'loading') {
+				//防止重复加载
+				return;
+			}
+			//修改当前对象状态为加载中
+			navItem.loadingType = 'loading';
+
+			spreadCommission(
+				{
+					page: navItem.page,
+					limit: navItem.limit
+				},
+				state
+			)
+				.then(({ data }) => {
+					if (data.length > 0) {
+						navItem.orderList = navItem.orderList.concat(data[0].list);
+						console.log(navItem.orderList);
+						navItem.page++;
+					}
+					//判断是否还有数据, 有改为more, 没有改为noMore
+					if (navItem.limit == data.length) {
+						navItem.loadingType = 'more';
+						return;
+					} else {
+						navItem.loadingType = 'noMore';
+					}
+					uni.hideLoading();
+					this.$set(navItem, 'loaded', true);
+				})
+				.catch(e => {
+					console.log(e);
+				});
+		},
+		//swiper 切换
+		changeTab(e) {
+			this.tabCurrentIndex = e.target.current;
+			this.loadData('tabChange');
+		},
+		//顶部tab点击
+		tabClick(index) {
+			this.tabCurrentIndex = index;
+		},
+		showItem(item) {
+			uni.showModal({
+				title: '佣金明细',
+				content: item.mark,
+				showCancel: false
+			});
+		}
+	}
+};
+</script>
+
+<style lang="scss">
+page {
+	background: #ffffff;
+	height: 100%;
+}
+.content-money {
+	padding-bottom: 30rpx;
+	background: $page-color-base;
+	.buttom-box {
+		background-color: #ffffff;
+		text-align: center;
+		margin: 0 30rpx;
+		padding: 20rpx 0;
+		border-radius: $border-radius-sm;
+		margin-top: -60rpx;
+		.buttom {
+			font-size: $font-lg;
+			flex-grow: 1;
+		}
+		.interval {
+			width: 2px;
+			height: 60rpx;
+			background-color: #eeeeee;
+		}
+		.icon {
+			height: 50rpx;
+			width: 48rpx;
+			margin: 0 auto;
+			.icon-img {
+				width: 100%;
+				height: 100%;
+			}
+		}
+	}
+}
+.money-box {
+	// background-color: $base-color;
+	// padding-top: var(--status-bar-height);
+	height: 400rpx;
+	color: #ff4c4c;
+	text-align: center;
+	position: relative;
+	image {
+		position: absolute;
+		top: 0;
+		right: 0;
+		height: 100%;
+		width: 100%;
+		// z-index: 1;
+	}
+	.text {
+		padding-top: 147rpx;
+		font-size: $font-sm;
+		position: relative;
+	}
+	.money {
+		padding-top: 175rpx;
+		// margin: auto 0;
+		font-size: 56rpx;
+		font-weight: bold;
+		color: #ff4c4c;
+		position: relative;
+		.money-icon {
+			font-size: 38rpx;
+			font-weight: bold;
+			color: #ff4c4c;
+		}
+	}
+}
+
+.navbar {
+	display: flex;
+	height: 40px;
+	padding: 0 5px;
+	background: #fff;
+	box-shadow: 0 1px 5px rgba(0, 0, 0, 0.06);
+	position: relative;
+	z-index: 10;
+	.nav-item {
+		flex: 1;
+		display: flex;
+		justify-content: center;
+		align-items: center;
+		height: 100%;
+		font-size: 15px;
+		color: $font-color-dark;
+		position: relative;
+		&.current {
+			color: $base-color;
+			&:after {
+				content: '';
+				position: absolute;
+				left: 50%;
+				bottom: 0;
+				transform: translateX(-50%);
+				width: 44px;
+				height: 0;
+				border-bottom: 2px solid $base-color;
+			}
+		}
+	}
+}
+//列表
+
+.swiper-box {
+	padding-top: 10rpx;
+	.order-item {
+		padding: 20rpx 30rpx;
+		line-height: 1.5;
+		.title-box {
+			.title {
+				font-size: $font-lg;
+				color: $font-color-base;
+			}
+			.time {
+				font-size: $font-base;
+				color: $font-color-light;
+			}
+		}
+		.money {
+			color: #fd5b23;
+			font-size: $font-lg;
+		}
+	}
+}
+.list-scroll-content {
+	height: 100%;
+}
+.content {
+	height: 100%;
+	.empty-content {
+		background-color: #ffffff;
+	}
+}
+.moneyTx {
+	width: 750rpx;
+	height: 88rpx;
+	background-color: #fff;
+	.btn {
+		margin: 0 auto;
+		width: 674rpx;
+		height: 88rpx;
+		line-height: 88rpx;
+		background: #ff4c4c;
+		border-radius: 44rpx;
+		font-size: 36rpx;
+		font-family: PingFang SC;
+		font-weight: 500;
+		color: #ffffff;
+	}
+	position: fixed;
+	bottom: 51rpx;
+	right: 0;
+	left: 0;
+	text-align: center;
+	margin: 0 auto;
+}
+</style>

+ 458 - 0
pages/user/extension.vue

@@ -0,0 +1,458 @@
+ <template>
+ 	<view class="content">
+ 		<view class="content-money">
+ 			<view class="money-box">
+ 				<image class="tuiguang_bg" src="../../static/image/jiedian.png"></image>
+ 			 <view class="money-frame">
+ 				 <view class="money_num">
+ 					{{userInfo.spread_count || '0'}}
+ 					<text class="money_ren">人</text>
+ 				</view>
+ 			 </view>
+ 			</view>
+ 			<view class="flex buttom-box">
+ 				<view class="buttom"  @click="tabClick(0)">
+ 					<view class="money">{{total || 0}}</view>
+ 					<text class="text" :class="{ current: tabCurrentIndex === 0 }">一级推广</text>
+ 				</view>
+ 				<view class="buttom"  @click="tabClick(1)">
+ 					<view class="money">{{totalLevel || 0}}</view>
+ 					<text class="text" :class="{ current: tabCurrentIndex === 1 }">二级推广</text>
+ 				</view>
+ 			</view>
+ 		</view>
+ 		<swiper :current="tabCurrentIndex" :style="{ height: maxheight + 'px' }" class="swiper-box" duration="300" @change="changeTab">
+ 			<swiper-item class="tab-content" v-for="(tabItem, tabIndex) in navList" :key="tabIndex">
+				<!-- <view class="tg-wrapper">
+					<view class="tg-box">
+						<view class="tg-item">
+							<view class="tg-tit">
+								会员
+							</view>
+							<view class="tg-val">
+								10人
+							</view>
+						</view>
+						<view class="tg-jg"></view>
+						<view class="tg-item">
+							<view class="tg-tit">
+								店长
+							</view>
+							<view class="tg-val">
+								10人
+							</view>
+						</view>
+						<view class="tg-jg"></view>
+						<view class="tg-item">
+							<view class="tg-tit">
+								代理
+							</view>
+							<view class="tg-val">
+								10人
+							</view>
+						</view>
+					</view>
+				</view> -->
+ 				<scroll-view class="list-scroll-content" scroll-y @scrolltolower="loadData">
+ 					<!-- 空白页 -->
+ 					<empty v-if="tabItem.loaded === true && tabItem.orderList.length === 0"></empty>
+ 
+ 					<!-- 订单列表 -->
+ 					<view v-for="(item, index) in tabItem.orderList" :key="index" class="order-item flex">
+ 						<view class="title-box flex_item">
+ 							<view class="title-avatar"><image :src="item.avatar"></image></view>
+ 							<view class="list_tpl">
+ 								<view class="time">
+ 									<text>{{ item.time }}</text>
+ 								</view>
+ 							</view>
+ 						</view>
+ 					</view>
+ 					<uni-load-more :status="tabItem.loadingType"></uni-load-more>
+ 				</scroll-view>
+ 			</swiper-item>
+ 		</swiper>
+ 	</view>
+ </template>
+ <script>
+ import { getExtensionData,getUserInfo ,getSpreadPeople} from '@/api/user.js';
+ import { mapState, mapMutations } from 'vuex';
+ import uniLoadMore from '@/components/uni-load-more/uni-load-more.vue';
+ import empty from '@/components/empty';
+ export default {
+ 	components: {
+ 		empty,
+ 		uniLoadMore,
+ 	},
+ 	onReady() {
+ 		// 初始化获取页面宽度
+ 		uni.createSelectorQuery()
+ 			.select('.content')
+ 			.fields(
+ 				{
+ 					size: true
+ 				},
+ 				data => {
+ 					// console.log(data);
+ 					// console.log(Math.floor((data.width / 750) * 300));
+ 					// 保存头部高度
+ 					this.maxheight = data.height - Math.floor((data.width / 750) * 470) - 44;
+ 					// console.log(this.maxheight);
+ 				}
+ 			)
+ 			.exec();
+ 	},
+ 	data() {
+ 		return {
+ 			// 头部图高度
+ 			maxheight: '',
+ 			tabCurrentIndex: 0,
+ 			navList: [
+ 				{
+ 					state: 0,
+ 					text: '一级推广',
+ 					loadingType: 'more',
+ 					orderList: [],
+ 					page: 1, //当前页数
+ 					limit: 10 //每次信息条数
+ 				},
+ 				{
+ 					state: 1,
+ 					text: '二级推广',
+ 					loadingType: 'more',
+ 					orderList: [],
+ 					page: 1, //当前页数
+ 					limit: 10 //每次信息条数
+ 				}
+ 			],
+ 			all:'',
+ 			list:'',
+ 			total:'',
+ 			totalLevel:'',
+ 			img:'http://kaifa.crmeb.net/uploads/attach/2019/08/20190807/723adbdd4e49a0f9394dfc700ab5dba3.png',
+			userInfo: {}
+ 		};
+ 	},
+ 	onLoad(options) {},
+ 	onShow() {
+ 		this.loadData();
+		this.loadAll()
+ 	},
+ 	methods: {
+ 		// 页面跳转
+ 		navto(e) {
+ 			uni.navigateTo({
+ 				url: e
+ 			});
+ 		},
+ 		//获取推广人数信息
+ 		async loadData(source) {
+ 			//这里是将订单挂载到tab列表下
+ 			let index = this.tabCurrentIndex;
+ 			let navItem = this.navList[index];
+ 			let state = navItem.state;
+ 			if (source === 'tabChange' && navItem.loaded === true) {
+ 				//tab切换只有第一次需要加载数据
+ 				return;
+ 			}
+ 			if (navItem.loadingType === 'loading') {
+ 				//防止重复加载
+ 				return;
+ 			}
+ 			if (navItem.loadingType === 'noMore') {
+ 				//防止重复加载
+ 				return;
+ 			}
+ 			// 修改当前对象状态为加载中
+ 			navItem.loadingType = 'loading';
+ 			getSpreadPeople(
+ 				{
+ 					page: navItem.page,
+ 					limit: navItem.limit,
+ 					keyword:'',
+					// sort: 'ASC/DESC',
+					// level: index,
+ 					// sort:'uid desc'
+					// sort: 'pay_price ASC'
+ 					grade:state
+ 				},
+ 			)
+ 				.then(({ data }) => {
+ 					console.log(data);
+ 					
+ 					this.total = data.total;
+ 					this.totalLevel =data.totalLevel;
+ 					// this.all = this.total + this.totalLevel;
+ 					if (data.list.length > 0) {
+ 						this.list = data.list;
+ 						navItem.orderList = navItem.orderList.concat(data.list);
+ 						navItem.page++;
+ 					}
+ 					this.$nextTick(function(){
+ 						if (navItem.limit == data.list.length) {
+ 							//判断是否还有数据, 有改为 more, 没有改为noMore
+ 							navItem.loadingType = 'more';
+ 							return;
+ 						} else {
+ 							//判断是否还有数据, 有改为 more, 没有改为noMore
+ 							navItem.loadingType = 'noMore';
+ 						}
+ 					})
+ 					this.$set(navItem, 'loaded', true);
+ 				})
+ 				.catch(e => {
+ 					console.log(e);
+ 				});
+ 		},
+ 		//swiper 切换
+ 		changeTab(e) {
+ 			this.tabCurrentIndex = e.target.current;
+ 			this.loadData('tabChange');
+ 		},
+ 		//顶部tab点击
+ 		tabClick(index) {
+ 			this.tabCurrentIndex = index;
+ 		},
+ 		// 点击返回 我的页面
+ 		toBack(){
+ 			uni.switchTab({
+ 				url:'/pages/user/user'
+ 			})
+ 		},
+		loadAll(){
+			getUserInfo().then(res => {
+				this.userInfo = res.data
+				console.log(res,'6666666666666666666')
+			});
+		}
+ 	}
+ };
+ </script>
+ 
+ <style lang="scss">
+ page {
+ 	background: #ffffff;
+ 	height: 100%;
+ }
+ .content-money {
+ 	// padding-bottom: 30rpx;
+ 	background: $page-color-base;
+ 	.buttom-box {
+ 		position: relative;
+ 		background-color: #ffffff;
+ 		text-align: center;
+ 		padding: 30rpx 0;
+ 		.buttom {
+ 			flex-grow: 1;
+ 		}
+ 		.money{
+ 			
+ 			font-size: 32rpx;
+ 			font-weight: bold;
+ 			color: #3F7C1F;
+ 		}
+ 		.text {
+ 			padding-bottom: 26rpx;
+ 			font-size: 28rpx;
+ 			font-weight: 500;
+ 			color: #666666;
+ 			&.current {
+ 				border-bottom: 2px solid #3F7C1F;
+ 			}
+ 		}
+ 		.icon {
+ 			height: 50rpx;
+ 			width: 48rpx;
+ 			margin: 0 auto;
+ 			.icon-img {
+ 				width: 100%;
+ 				height: 100%;
+ 			}
+ 		}
+ 	}
+ }
+ .money-box {
+ 	// background: $base-color;
+ 	height: 380rpx;
+ 	color: #FF4C4C;
+ 	text-align: center;
+ 	font-size: 35rpx;
+ 	position: relative;
+ 	// padding-top: 60rpx;
+ 	.header{
+ 		position: absolute;
+ 		left: 0;
+ 		top: 0;
+ 		width: 100%;
+ 		height: 80rpx;
+ 		font-size: 36rpx;
+ 		font-weight: bold;
+ 		z-index: 99;
+ 		display: flex;
+ 		justify-content: center;
+ 		align-items: center;
+ 	}
+ 	.goback-box{
+ 		position: absolute;
+ 		left: 29rpx;
+ 		top: 0;
+ 		height: 80rpx;
+ 		display: flex;
+ 		align-items: center;
+ 	}
+ 	.goback{
+ 		z-index: 100;
+ 		width: 34rpx;
+ 		height: 34rpx;
+ 	}
+ 	.tuiguang_bg {
+ 		width: 100%;
+ 		height: 400rpx;
+ 		position: relative;
+ 	}
+ 	.money_img{
+ 		width: 100%;
+ 		height: 120rpx;
+ 		text-align: center;
+ 		padding-top: 50rpx;
+ 		padding-bottom: 135rpx;
+ 		image{
+ 			width:120rpx;
+ 			height: 120rpx;
+ 			border: 4rpx solid #FD5F6F;
+ 			border-radius: 50%;
+ 		}
+ 	}
+ 	.money-frame {
+ 		position: absolute;
+ 		top: 0;
+ 		width: 100%;
+ 		padding-top: 120rpx;
+ 		// left: 30rpx;
+ 		// height: 460rpx;
+ 		// display: flex;
+ 		// align-items: flex-start;
+ 		// flex-direction: column;
+ 		// justify-content: center;
+ 	}
+ 	.money_name{
+ 		width: 100%;
+ 		text-align: center;
+ 		font-size: 32rpx;
+ 		font-family: PingFang SC;
+ 		font-weight: bold;
+ 		color: #FFFFFF;
+ 		
+ 	}
+ 	.money_num {
+		padding-top: 50rpx;
+ 		font-size: 72rpx;
+ 		font-family: PingFang SC;
+ 		font-weight: bold;
+ 		color: #3F7C1F;
+ 		.money_ren {
+ 			font-size: 36rpx;
+ 		}
+ 	}
+ }
+ 
+ // 列表
+ 
+ .swiper-box {
+ 	// padding-top: 10rpx;
+ 	.order-item {
+ 		padding: 20rpx 30rpx;
+ 		line-height: 1.5;
+ 		.title-box {
+ 			width: 100%;
+ 			.title-avatar{
+ 				width: 100rpx;
+ 				height: 100rpx;
+ 				margin-right: 25rpx;
+ 				image{
+ 					width: 100%;
+ 					height: 100%;
+ 					border-radius: 100%;
+ 				}
+ 			}
+ 			.list_tpl{
+ 				width: 85%;
+ 				.title {
+ 					font-size: $font-lg;
+ 					color: $font-color-base;
+ 					overflow:hidden;            //超出的文本隐藏
+ 					text-overflow:ellipsis;     //溢出用省略号显示
+ 					white-space:nowrap;
+					 justify-content: flex-start;
+					image {
+						margin-left: 9rpx;
+						width: 147rpx;
+						height: 32rpx;
+					}
+ 				}
+ 				.time {
+ 					margin-top: 15rpx;
+ 					font-size: 22rpx;
+ 					color: $font-color-light;
+ 				}
+ 			}
+ 		}
+ 		.money {
+ 			color: #DB1935;
+ 			font-size: $font-lg;
+ 		}
+ 	}
+ }
+ .list-scroll-content {
+ 	height: 100%;
+ }
+ .content {
+ 	height: 100%;
+ 	.empty-content {
+ 		background-color: #ffffff;
+ 	}
+ }
+ .tg-wrapper {
+	width: 100%;
+	background-color: #f7f7f7;
+	
+	padding: 20rpx 0;
+	.tg-box {
+		display: flex;
+		justify-content: center;
+		width: 690rpx;
+		height: 143rpx;
+		background-color: #fff;
+		margin: 0 auto;
+		align-items: center;
+		.tg-item {
+			width: 33%;
+			display: flex;
+			flex-direction: column;
+			justify-content: center;
+			align-items: center;
+			.tg-tit {
+				font-size: 24rpx;
+				font-family: PingFang SC;
+				font-weight: bold;
+				color: #333333;
+				
+			}
+			.tg-val {
+				padding-top: 15rpx;
+				font-size: 34rpx;
+				font-family: PingFang SC;
+				font-weight: bold;
+				color: #333333;
+				
+			}
+		}
+		.tg-jg {
+			width: 1rpx;
+			height: 51rpx;
+			background: #DDDDDD;
+		}
+	}
+ }
+ </style>
+ 

+ 76 - 41
pages/user/integral.vue

@@ -9,17 +9,16 @@
 		<view class="navbar">
 			<view class="nav-item" v-for="(item, index) in navList" :key="index"
 				:class="{ current: tabCurrentIndex === index }" @click="tabClick(index)">{{ item.text }}</view>
-		
+
 		</view>
-		<swiper class="swiper-box" :current="tabCurrentIndex" duration="300" @change="changeTab"
-			>
+		<swiper class="swiper-box" :current="tabCurrentIndex" duration="300" @change="changeTab">
 			<swiper-item class="tab-content" v-for="(tabItem, tabIndex) in navList" :key="tabIndex">
 				<!-- 空白页 -->
-				<!-- <empty v-if="tabItem.loaded === true && tabItem.orderList.length === 0"></empty> -->
+				<empty v-if="tabItem.loaded === true && tabItem.orderList.length === 0"></empty>
 				<!-- 推广奖励 -->
-				<scroll-view class="scorll" scroll-y="true" >
+				<scroll-view class="scorll" scroll-y="true">
 					<view class="cost">
-						<view class="award" v-for="item in 10">
+						<view class="award" v-for="item in tabItem ">
 							<view class="award-left">
 								<view class="text">消费赠送</view>
 								<view class="time">2021-8-26 09:30</view>
@@ -28,20 +27,30 @@
 						</view>
 					</view>
 				</scroll-view>
-		
+
 			</swiper-item>
 		</swiper>
-	</view>
-</template>
-
+	</view>
+</template>
+
 <script>
-export default {
-	data () {
-		return {
-			height: '',
+	// 组件
+	import uniLoadMore from '@/components/uni-load-more/uni-load-more.vue';
+	import empty from '@/components/empty';
+	//接口
+	import { integral } from '@/api/wallet.js';
+	export default {
+		components: {
+			empty,
+			uniLoadMore
+		},
+		data() {
+			return {
+				height: '',
 				tabCurrentIndex: 0,
-				navList: [{
-						state: 1,
+				navList: [
+					{
+						state: 0,
 						text: '收入',
 						loadingType: 'more',
 						orderList: [],
@@ -49,7 +58,7 @@ export default {
 						limit: 10 //每次信息条数
 					},
 					{
-						state: 2,
+						state: 1,
 						text: '支出',
 						loadingType: 'more',
 						orderList: [],
@@ -59,50 +68,75 @@ export default {
 				],
 				list: [],
 				money: ''
-		}
-	},
-	methods: {
-		//swiper 切换
-		changeTab (e) {
-			this.tabCurrentIndex = e.target.current;
-			this.loadData('tabChange')
+			}
 		},
-		//顶部tab点击
-		tabClick(index) {
-			this.tabCurrentIndex = index;
+		methods: {
+			//swiper 切换
+			changeTab(e) {
+				this.tabCurrentIndex = e.target.current;
+				this.loadData('tabChange')
+			},
+			//顶部tab点击
+			tabClick(index) {
+				this.tabCurrentIndex = index;
+			},
+			loadData(type) {
+				let obj = this
+				let index = obj.tabCurrentIndex
+				let navItem = obj.navList[index]
+				if(navItem.loadingType == 'loading' || navItem.loadingType == 'noMore') {
+					return 
+				}
+				if(type == 'tabChange' && navItem.loaded == 'loaded') {
+					return 
+				}
+				navItem.loadingType == 'loading';
+				integral({
+					page: navItem.page,
+					limit: navItem.limit
+				},navItem.state).then( res => {
+					console.log(res)
+				})
+				
+			}
 		}
 	}
-}
-</script>
-
+</script>
+
 <style lang="scss">
 	.container {
 		width: 750rpx;
 		height: 1334rpx;
 		background-color: #f1f1f1;
+
 		.header {
+			position: relative;
 			image {
 				width: 750rpx;
 				height: 400rpx;
 			}
+
 			.money {
 				font-size: 72rpx;
 				font-family: PingFang SC;
 				font-weight: 500;
 				color: #3F7C1F;
-				top: 15%;
 				position: absolute;
+				top: 50%;
 				left: 50%;
-				transform: translate(-50%);
+				transform: translate(-50% ,-50%);
 			}
 		}
+
 		.swiper-box {
 			height: calc(100% - 500rpx);
 			background-color: #FFFFFF;
 		}
+
 		.scorll {
 			height: 90%;
 		}
+
 		.navbar {
 			display: flex;
 			height: 100rpx;
@@ -112,7 +146,7 @@ export default {
 			position: relative;
 			z-index: 10;
 			margin-top: 25rpx;
-		
+
 			.nav-item {
 				flex: 1;
 				display: flex;
@@ -122,10 +156,10 @@ export default {
 				font-size: 15px;
 				color: #999999;
 				position: relative;
-		
+
 				&.current {
 					color: #333333;
-		
+
 					&:after {
 						content: '';
 						position: absolute;
@@ -139,11 +173,12 @@ export default {
 				}
 			}
 		}
+
 		.cost {
 			width: 750rpx;
 			height: auto;
 			background-color: #fff;
-		
+
 			.award {
 				width: 701rpx;
 				height: 132rpx;
@@ -152,13 +187,13 @@ export default {
 				display: flex;
 				justify-content: space-between;
 				align-items: center;
-		
+
 				.award-left {
 					width: 221rpx;
 					height: 40rpx;
 					margin-left: 30rpx;
 					margin-bottom: 35rpx;
-		
+
 					.text {
 						width: 182rpx;
 						height: 30rpx;
@@ -168,7 +203,7 @@ export default {
 						color: #666666;
 						margin-bottom: 16rpx;
 					}
-		
+
 					.time {
 						width: 221rpx;
 						height: 20rpx;
@@ -178,7 +213,7 @@ export default {
 						color: #AEAEAE;
 					}
 				}
-		
+
 				.award-right {
 					font-size: 36rpx;
 					font-family: PingFang SC;
@@ -188,5 +223,5 @@ export default {
 				}
 			}
 		}
-	}
+	}
 </style>

+ 307 - 0
pages/user/shareQrCode.vue

@@ -0,0 +1,307 @@
+<template>
+	<view class="andr-shQ-padL30 andr-shQ-padR30 andr-shQ-Flex andr-shQ-FlexDirC">
+		<view class="andr-shQ-w100B andr-shQ-Flex andr-shQ-JusCC">
+			<swiper class="imgw750h375 matop"  :indicator-dots="false" :current="current" @change="currentChange" >
+				<swiper-item v-for="(item, index) in rwmListArr" :key="index"><image :src="item.wap_poster" mode="aspectFit" class="imgw750h375" /></swiper-item>
+			</swiper>
+		</view>
+		<view class="baocun" @click="comfirm(userInfo.uid+'')">复制邀请码</view>
+		<!-- #ifdef H5 -->
+		<!-- <view class="baocun">长按二维码保存图片</view> -->
+		
+		<!-- #endif -->
+		<!-- #ifdef MP-WEIXIN -->
+		<view class="baocun" @click="seav">保存图片并转发</view>
+		<!-- <button open-type="share" class="baocun btn" v-if="scLoading == 2">分享到微信</button> -->
+		<!-- #endif -->
+	</view>
+</template>
+<script>
+import { mapState } from 'vuex';
+import { spreadBanner } from '@/api/user.js';
+import { interceptor, saveUrl } from '@/utils/loginUtils';
+// #ifdef H5
+import { weixindata } from '@/utils/wxAuthorized';
+// #endif
+export default {
+	data() {
+		return {
+			rwmListArr: [],
+			current: 0,
+			imgSrc: ''
+		};
+	},
+	onLoad(option) {
+		uni.showLoading({
+			title: '邀请图生成中',
+			mask: true
+		});
+		// 判断是否强制登录
+		this.loadCodeList();
+		// #ifdef MP-WEIXIN
+		uni.authorize({
+			scope: 'scope.writePhotosAlbum',
+			complete() {}
+		});
+		// #endif
+	},
+	onShow() {
+		if (this.loginInterceptor && !this.hasLogin) {
+			saveUrl();
+			// 登录拦截
+			interceptor();
+		}
+	},
+    //下拉刷新
+    onPullDownRefresh() {
+    	let obj = this;
+    	//监听下拉刷新动作的执行方法,每次手动下拉刷新都会执行一次
+    	setTimeout(function() {
+    		obj.loadCodeList();
+    		uni.stopPullDownRefresh(); //停止下拉刷新动画
+    	}, 1000);
+    },
+	computed: {
+		...mapState(['weichatObj', 'baseURL', 'urlFile']),
+		...mapState('user', ['userInfo', 'orderInfo', 'hasLogin'])
+	},
+	methods: {
+		comfirm(text) {
+			// let text = this.userInfo.uid
+			console.log(text);
+			const result = this.uniCopy(text);
+			if (result === false) {
+				uni.showToast({
+					title: '不支持'
+				});
+			} else {
+				uni.showToast({
+					title: '复制成功',
+					icon: 'none'
+				});
+			}
+			// this.$refs.popup.close();
+		},
+		uniCopy(content) {
+			/**
+			 * 小程序端 和 app端的复制逻辑
+			 */
+			//#ifndef H5
+			uni.setClipboardData({
+				data: content,
+				success: function() {
+					console.log('success');
+					return true;
+				}
+			});
+			//#endif
+		
+			/**
+			 * H5端的复制逻辑
+			 */
+			// #ifdef H5
+			if (!document.queryCommandSupported('copy')) {
+				//为了兼容有些浏览器 queryCommandSupported 的判断
+				// 不支持
+				return false;
+			}
+			let textarea = document.createElement('textarea');
+			textarea.value = content;
+			textarea.readOnly = 'readOnly';
+			document.body.appendChild(textarea);
+			textarea.select(); // 选择对象
+			textarea.setSelectionRange(0, content.length); //核心
+			let result = document.execCommand('copy'); // 执行浏览器复制命令
+			textarea.remove();
+			return result;
+			// #endif
+		},
+		loadCodeList() {
+			let self = this;
+			// 加载二维码信息
+			// let andrUid = uni.getStorageSync('andrUid')||'';
+			spreadBanner({
+				// #ifdef H5
+				type: 2,
+				// #endif
+				// #ifdef MP
+				type: 1,
+				// #endif
+			}).then(e => {
+				if (e.status == 200) {
+					console.log(e.data)
+					self.rwmListArr = e.data;
+					// #ifdef H5
+					self.imgSrc = self.rwmListArr[0].wap_poster;
+					// #endif
+					// #ifdef MP-WEIXIN
+					self.imgSrc = self.rwmListArr[0].poster;
+					// #endif
+				}
+				uni.hideLoading();
+			});
+		},
+		currentChange(e) {
+			this.current = e.detail.current;
+		},
+		// onShareAppMessage(options){
+		// 	console.log(options,'options')
+		// 	let userInfo = uni.getStorageSync('userInfo');
+		// 	console.log(userInfo)
+		//   let obj = this;
+		//   // 设置菜单中的转发按钮触发转发事件时的转发内容
+		//   let shareObj = {
+		//     title: "邀请好友领券",        // 默认是小程序的名称(可以写slogan等)
+		//     path: '/pages/index/index?spread='+userInfo.uid,        // 默认是当前页面,必须是以‘/’开头的完整路径
+		//     imageUrl: obj.imgSrc,
+		//     success: function(res){
+		//       // 转发成功之后的回调
+		//       if(res.errMsg == 'shareAppMessage:ok'){
+		//       }
+		//     },
+		//     fail: function(){
+		//       // 转发失败之后的回调
+		//       if(res.errMsg == 'shareAppMessage:fail cancel'){
+		//         // 用户取消转发
+		//       }else if(res.errMsg == 'shareAppMessage:fail'){
+		//         // 转发失败,其中 detail message 为详细失败信息
+		//       }
+		//     }
+		//   };
+		//   // 来自页面内的按钮的转发
+		//   if( options.from == 'button' ){
+		//     // 此处可以修改 shareObj 中的内容
+		//     shareObj.path = '/pages/index/index?spread='+userInfo.uid;
+		//         console.log(shareObj.path,'shareObj.path')
+		//   }
+		//   // 返回shareObj
+		//   return shareObj;
+		// },
+		// scClick() {
+		// 	let self = this;
+		// 	// #ifdef H5
+		// 	self.imgSrc = self.rwmListArr[self.current].wap_poster;
+		// 	// #endif
+		// 	// #ifdef MP-WEIXIN
+		// 	self.imgSrc = self.rwmListArr[self.current].poster;
+		// 	// #endif
+		// },
+		// #ifdef MP-WEIXIN
+		seav() {
+			uni.getImageInfo({
+				src: this.imgSrc,
+				complete: function (result) {
+					let path = result.path;
+					uni.getSetting({
+						success(res) {
+							console.log(res)
+							if (!res.authSetting['scope.writePhotosAlbum']) {
+								uni.authorize({
+									scope:'scope.writePhotosAlbum',
+									success(res) {
+										uni.saveImageToPhotosAlbum({
+											filePath:path,
+											complete(result) {
+											}
+										});
+									},
+									complete(result) {
+									    uni.showToast({
+									         title: '请先授权保存图片',
+									         duration: 2000,
+											 icon:'none'
+									    });
+										obj.seav();
+									}
+								})
+							}else{
+								uni.saveImageToPhotosAlbum({
+									filePath:path,
+									complete(result) {
+									     uni.showToast({
+									         title: '保存图片成功!',
+									         duration: 2000,
+											 icon:'none'
+									     });
+									}
+								});
+							}
+						}
+					});
+				}
+			});
+		}
+		// #endif
+	}
+};
+</script>
+
+<style lang="scss">
+.imgw750h375 {
+	width: 700rpx;
+	height: 958rpx;
+}
+.matop{
+	margin-top: 40rpx;
+}
+.andr-shQ-padL30 {
+	padding-left: 30rpx;
+}
+.andr-shQ-padR30 {
+	padding-right: 30rpx;
+}
+.andr-shQ-Flex {
+	display: flex;
+}
+.andr-shQ-FlexDirC {
+	flex-direction: column;
+}
+.andr-shQ-w100B {
+	width: 100%;
+}
+.andr-shQ-JusCC {
+	justify-content: center;
+}
+.andr-shQ-marginT30 {
+	margin-top: 30rpx;
+}
+.andr-shQ-bgc06B163 {
+	background-color: $base-color;
+}
+.andr-shQ-cFFF {
+	color: #ffffff;
+}
+.andr-shQ-bdR50 {
+	border-radius: 50rpx;
+}
+.andr-shQ-h86 {
+	height: 86rpx;
+}
+.andr-shQ-AIC {
+	align-items: center;
+}
+.baocun {
+	color: #ffffff;
+	background: $base-color;
+	text-align: center;
+	width: 80%;
+	margin: 50rpx auto;
+	font-size: 28rpx;
+	padding: 25rpx 0rpx;
+	border-radius: 50rpx;
+}
+.btn{
+	padding: 0rpx 0rpx !important;
+	margin: 0rpx auto;
+	margin-bottom: 100rpx;
+}
+/* #ifdef H5 */
+.cbnagan {
+	width: 80%;
+	background: $base-color;
+	margin: 50rpx auto;
+	font-size: 28rpx;
+	text-align: center;
+}
+/* #endif */
+</style>

+ 32 - 10
pages/user/user.vue

@@ -11,11 +11,11 @@
 					<image :src=" userInfo.avatar || '../../static/error/missing-face.png' "></image>
 					<view class="info-box">
 						<view class="username">{{ userInfo.nickname || '游客' }}</view>
-						<view class="phone">{{userInfo.phone}}</view>
+						<view class="phone" v-if="userInfo.phone">{{userInfo.phone | phone}}</view>
 					</view>
 				</view>
 				<!-- 设置 -->
-				<view class="infor-right" @click="nav('/pages/user/shezhi')">
+				<view class="infor-right" @click="nav('/pages/set/userinfo')">
 					<image src="../../static/img/img18.png" mode="scaleToFill"></image>
 					<view class="setting">设置</view>
 				</view>
@@ -28,15 +28,15 @@
 				</view>
 				<!-- 订单栏 -->
 				<view class="order-section">
-					<view class="order-item" @click="nav('/pages/order/order?state=1')">
+					<view class="order-item" @click="nav('/pages/order/order?state=0')">
 						<image src="../../static/img/img19.png" mode="scaleToFill"></image>
 						<view class="text">待付款</view>
 					</view>
-					<view class="order-item" @click="nav('/pages/order/order?state=2')">
+					<view class="order-item" @click="nav('/pages/order/order?state=1')">
 						<image src="../../static/img/img20.png" mode="scaleToFill"></image>
 						<view class="text">待发货</view>
 					</view>
-					<view class="order-item" @click="nav('/pages/order/order?state=3')">
+					<view class="order-item" @click="nav('/pages/order/order?state=2')">
 						<image src="../../static/img/img21.png" mode="scaleToFill"></image>
 						<view class="text">待收货</view>
 					</view>
@@ -55,7 +55,7 @@
 					<image src="../../static/img/img26.png" mode="scaleToFill"></image>
 					<view class="text">我的余额</view>
 				</view>
-				<view class="order-item" @click="nav('/pages/user/accounts')">
+				<view class="order-item" @click="nav('/pages/user/award')">
 					<image src="../../static/img/img23.png" mode="scaleToFill"></image>
 					<view class="text">我的佣金</view>
 				</view>
@@ -63,7 +63,7 @@
 					<image src="../../static/img/img24.png" mode="scaleToFill"></image>
 					<view class="text">我的积分</view>
 				</view>
-				<view class="order-item" @click="nav('/pages/user/extend')">
+				<view class="order-item" @click="nav('/pages/user/extension')">
 					<image src="../../static/img/img25.png" mode="scaleToFill"></image>
 					<view class="text">我的推广</view>
 				</view>
@@ -121,6 +121,7 @@
 	import uniPopup from '@/components/uni-popup/uni-popup.vue';
 	import uniCopy from '@/utils/uni-copy.js';
 	import { mapState, mapMutations } from 'vuex';
+	import { saveUrl, interceptor } from '@/utils/loginUtils.js';
 	export default {
 		components: {
 			uniPopup
@@ -130,6 +131,16 @@
 				text:'123465'
 			}
 		},
+		filters: {
+			phone(val) {
+				let str = ''
+				if(val) {
+					val = "" + val;
+					str = val.substr(0,3) + "****" + val.substr(7)
+				}
+				return str
+			}
+		},
 		onShow() {
 			//判断是否已经登录
 			if (this.hasLogin) {
@@ -180,9 +191,17 @@
 			},
 			nav(url) {
 				console.log(url)
-				uni.navigateTo({
-					url
-				})
+				if(!this.hasLogin) {
+					// 保存地址
+					saveUrl();
+					// 登录拦截
+					interceptor();
+				}else {
+					uni.navigateTo({
+						url
+					})
+				}
+				
 			},
 			open(){
 				console.log('点击出现弹窗');
@@ -249,6 +268,8 @@
 				image {
 					width: 126.5rpx;
 					height: 126.5rpx;
+					border-radius: 50%;
+					flex-shrink: 0;
 				}
 
 				.info-box {
@@ -263,6 +284,7 @@
 				}
 
 				.phone {
+					padding-top: 10rpx;
 					font-size: 26rpx;
 					font-family: PingFang SC;
 					font-weight: 500;

+ 312 - 0
pages/user/withdrawal.vue

@@ -0,0 +1,312 @@
+<template>
+	<view class="content">
+		<!-- <uni-notice-bar single="true" text="每月25号到月底可提现上月结算余额"></uni-notice-bar> -->
+		<view class="content-money">
+			<view class="flex ">
+				<view class="buttom">
+					<view class="icon">{{ money | getMoneyStyle }}</view>
+					<text class="text">可提现金额</text>
+				</view>
+				<view class="interval"></view>
+				<view class="buttom">
+					<view class=" icon">{{ freeze | getMoneyStyle }}</view>
+					<text class="text">待审核提现金额</text>
+				</view>
+			</view>
+		</view>
+		<view class="row-box">
+			<view class="title">提现金额</view>
+			<view class="row">
+				<text class="tit">¥</text>
+				<input class="input" type="number" v-model="withdrawal" :placeholder="'最低提现金额' + minPrice + '元'" placeholder-class="placeholder" />
+				<view class="buttom" @click="withdrawal = money">全部提现</view>
+			</view>
+		</view>
+		<!-- #ifndef MP-WEIXIN -->
+		<view class="list" v-if="!weichatBsrowser">
+			<radio-group @change="tabRadio">
+				<label>
+					<view class="box">
+						<view class="icon iconfont iconweixin1"></view>
+						<view class="title-box">
+							<view class="title"><text>提现至微信</text></view>
+						</view>
+						<view class="right"><radio value="weixin" color="#5dbc7c" :checked="type == 'weixin'" /></view>
+					</view>
+				</label>
+				<!-- <label>
+					<view class="box">
+						<view class="icon iconfont iconzhifubao"></view>
+						<view class="title-box">
+							<view class="title">
+								<text v-if="aliData.fullname">提现至支付宝</text>
+								<text v-else>请创建支付宝账号</text>
+							</view>
+							<view class="node">
+								<text v-if="aliData.fullname">真实姓名({{ aliData.fullname }})</text>
+							</view>
+						</view>
+						<view class="right"><radio value="alipay" color="#5dbc7c" :checked="type == 'alipay'" /></view>
+					</view>
+				</label> -->
+				<label>
+					<view class="box">
+						<view class="icon iconfont"><image class="icon-img" src="../../static/icon/i8.png" mode="aspectFit"></image></view>
+						<view class="title-box">
+							<view class="title">
+								<text v-if="bankData.bankno">{{ bankData.bank + ' ' + bankData.bankno }}</text>
+								<text v-else>请创建银行账号</text>
+							</view>
+							<view class="node">
+								<text v-if="bankData.fullname">真实姓名({{ bankData.fullname }})</text>
+							</view>
+						</view>
+						<view class="right"><radio value="bank" color="#5dbc7c" :checked="type == 'bank'" /></view>
+					</view>
+				</label>
+			</radio-group>
+		</view>
+		<!-- #endif -->
+		<button class="add-btn up" @click="confirm">提交申请</button>
+		<button class="add-btn modified" v-if="!weichatBsrowser" @click="navTo('/pages/money/account')">账号管理</button>
+	</view>
+</template>
+
+<script>
+import { getMoneyStyle } from '@/utils/rocessor.js';
+import { extractCash, extractBank, aliInfo, bankInfo } from '@/api/wallet.js';
+import uniNoticeBar from '@/components/uni-notice-bar/uni-notice-bar.vue';
+export default {
+	filters: {
+		getMoneyStyle
+	},
+	components: {
+		uniNoticeBar
+	},
+	data() {
+		return {
+			type: 'weixin', //提现方式
+			money: '0.00', //可提现金额
+			freeze: '0.0', //冻结金额
+			withdrawal: '', //提现金额
+			minPrice: '', //最少提现金额
+			aliData: {},
+			bankData: {},
+			// #ifdef H5
+			weichatBsrowser: false
+			// #endif
+		};
+	},
+	onLoad(options) {
+		// #ifdef H5
+		this.weichatBsrowser = uni.getStorageSync('weichatBrowser');
+		// #endif
+		//加载提现信息
+		this.loadData();
+		// 加载提款账号信息
+		this.loadAli();
+		this.loadBank();
+	},
+	methods: {
+		// 更新数据
+		dataUp(){
+			this.loadAli();
+			this.loadBank();
+		},
+		//加载数据
+		async loadAli(source) {
+			aliInfo({}).then(e => {
+				this.aliData = e.data;
+			});
+		},
+		// 加载银行卡信息
+		async loadBank() {
+			bankInfo({}).then(e => {
+				this.bankData = e.data;
+			});
+		},
+		// 加载余额信息
+		async loadData() {
+			extractBank({}).then(({ data }) => {
+				this.money = data.moneyCount;//可提现余额
+				this.minPrice = data.minPrice;//最小提现
+				this.freeze =data.inmoneyCount//提现中的余额
+			});
+		},
+		// 跳转
+		navTo(url) {
+			uni.navigateTo({
+				url: url
+			});
+		},
+		// 切换选中对象
+		tabRadio(e) {
+			this.type = e.detail.value;
+		},
+		// 提交
+		confirm() {
+			let data = {
+				extract_type: this.type, //bank -银行卡 alipay-支付宝 weixin-微信
+				money: this.withdrawal, //金额
+				money_type: 1//0佣金1余额
+			}
+			if (this.type=='alipay') {
+				data.name = this.aliData.fullname;
+				data.alipay_code = this.aliData.alino;
+			}
+			if (this.type=='bank') {
+				data.name = this.bankData.fullname;
+				data.bankname = this.bankData.bank;
+				data.cardnum = this.bankData.bankno;
+			}
+			
+			
+			extractCash(data)
+				.then(e => {
+					uni.showToast({
+						title: '提交成功',
+						duration: 2000,
+						position: 'top'
+					});
+				})
+				.catch(e => {
+					console.log();
+				});
+		}
+	}
+};
+</script>
+
+<style lang="scss">
+page {
+	height: 100%;
+}
+.content-money {
+	padding: 30rpx 0;
+	background: #ffffff;
+}
+.flex {
+	background-color: #ffffff;
+	text-align: center;
+	margin: 0 30rpx;
+	border-radius: $border-radius-sm;
+	.buttom {
+		font-size: $font-lg;
+		width: 50%;
+	}
+	.interval {
+		width: 2px;
+		height: 60rpx;
+		background-color: #eeeeee;
+	}
+	.icon {
+		background-size: 100%;
+		font-size: 42rpx;
+		color: $font-color-dark;
+		font-weight: bold;
+		background-repeat: no-repeat;
+		background-position: center;
+	}
+	.text {
+		color: $font-color-light;
+	}
+}
+
+.row-box {
+	margin-top: 30rpx;
+	padding: 20rpx 30rpx;
+	background: #fff;
+	.title {
+		font-size: $font-base + 2rpx;
+		color: $font-color-dark;
+	}
+	.row {
+		display: flex;
+		align-items: center;
+		position: relative;
+		height: 80rpx;
+		.tit {
+			flex-shrink: 0;
+			width: 40rpx;
+			font-size: 30rpx;
+			color: $font-color-dark;
+		}
+		.input {
+			flex: 1;
+			font-size: 30rpx;
+			color: $font-color-dark;
+		}
+		.iconlocation {
+			font-size: 36rpx;
+			color: $font-color-light;
+		}
+
+		.buttom {
+			color: $font-color-spec;
+			font-size: $font-base;
+		}
+	}
+}
+.add-btn {
+	&.modified {
+		color: $base-color;
+	}
+	&.up {
+		background-color: $base-color;
+		color: #fff;
+	}
+	display: flex;
+	align-items: center;
+	justify-content: center;
+	width: 690rpx;
+	height: 80rpx;
+	margin: 0 auto;
+	margin-top: 30rpx;
+	font-size: $font-lg;
+	border-radius: 10rpx;
+	// box-shadow: 1px 2px 5px rgba(219, 63, 96, 0.4);
+}
+
+.list {
+	padding-left: 30rpx;
+	margin-top: 30rpx;
+	background-color: #ffffff;
+	.box {
+		display: flex;
+		align-items: center;
+		width: 100%;
+		height: 120rpx;
+		border-bottom: 1px solid $border-color-light;
+		.icon {
+			font-size: 48rpx;
+			padding-right: 20rpx;
+			.icon-img {
+				height: 50rpx;
+				width: 50rpx;
+			}
+		}
+		.iconweixin1 {
+			color: #18bf16;
+		}
+		.iconzhifubao {
+			color: #08aaec;
+		}
+		.title-box {
+			flex-grow: 1;
+			text-align: left;
+			.title {
+				font-size: $font-base + 2rpx;
+				color: $font-color-base;
+			}
+			.node {
+				font-size: $font-sm;
+				color: $font-color-light;
+			}
+		}
+	}
+}
+/deep/ .uni-radio-input {
+	width: 45rpx;
+	height: 45rpx;
+}
+</style>

BIN
static/icon/i8.png