gcz před 2 roky
rodič
revize
a7ab39756b

+ 87 - 19
center/addrForm.vue

@@ -1,5 +1,11 @@
 <template>
 	<view class="pages">
+		<u-navbar
+			title="收货地址"
+			:autoBack="true"
+			 :safeAreaInsetTop="true"
+		>
+		</u-navbar>
 		<view class="page-wrap">
 			<view class="view-wrap">
 				<u--form
@@ -9,19 +15,19 @@
 					ref="uForm"
 					labelWidth="80"
 					>
-					<u-form-item label="姓名" prop="name" borderBottom ref="name">
-						<u--input v-model="model.name" placeholder="请输入收货人姓名" border="none"></u--input>
+					<u-form-item label="姓名" prop="receiveName" borderBottom ref="receiveName">
+						<u--input v-model="model.receiveName" placeholder="请输入收货人姓名" border="none"></u--input>
 					</u-form-item>
-					<u-form-item label="手机号码" prop="mobile" borderBottom ref="mobile">
-						<u--input v-model="model.mobile" placeholder="请输入收货人手机号码" border="none"></u--input>
+					<u-form-item label="手机号码" prop="receivePhone" borderBottom ref="receivePhone">
+						<u--input v-model="model.receivePhone" placeholder="请输入收货人手机号码" border="none"></u--input>
 					</u-form-item>
-					<u-form-item label="所在地区" prop="phone" borderBottom ref="phone">
+					<u-form-item label="所在地区" prop="receiveAdress" borderBottom ref="receiveAdress">
 						<view class="1" @tap="showRegionPicker">
-							<u--input v-model="model.phone" placeholder="省市区县、乡镇等" border="none"></u--input>
+							<u--input v-model="model.receiveAdress" placeholder="省市区县、乡镇等" border="none"></u--input>
 						</view>
 					</u-form-item>
-					<u-form-item label="详细地址" prop="phone" borderBottom ref="phone">
-						<u--textarea v-model="model.phone" placeholder="街道楼牌号等" ></u--textarea>
+					<u-form-item label="详细地址" prop="address" borderBottom ref="address">
+						<u--textarea v-model="model.address" placeholder="街道楼牌号等" ></u--textarea>
 					</u-form-item>
 				</u--form>
 			</view>
@@ -31,31 +37,41 @@
 					<view class="tip">提醒:每次下单会默认推荐该地址</view>
 				</view>
 				<view class="right">
-					<u-switch v-model="defaultValue" size="24" inactiveColor="#ddd" @change="defaultChange"></u-switch>
+					<u-switch v-model="model.ifDefault" :activeValue="Number(1)" :inactiveValue="Number(0)" size="24" activeColor="#5ac725" inactiveColor="#ddd" @change="defaultChange"></u-switch>
 				</view>
 			</view>
 			<view class="full-btn" @click="submit">保存</view>
 		</view>
+		<map v-if="showMap" />
 	</view>
 </template>
 
 <script>
+	import map from "./map.vue";
 	export default {
+		components:{
+			map
+		},
 		data() {
 			return {
-				defaultValue:false,
+				saveType:'',
+				id:'',
+				showMap:false,
 				model: {
-					name:'',
-					phone:''
+					receiveName:'',
+					receivePhone:'',
+					receiveAdress:'',
+					address:'',
+					ifDefault:0,
 				},
 				rules:{
-					'name': {
+					'receiveName': {
 						type: 'string',
 						required: true,
 						message: '请填写姓名',
 						trigger: ['blur', 'change']
 					},
-					mobile: [
+					receivePhone: [
 						{
 							required: true, 
 							message: '请输入手机号',
@@ -72,15 +88,31 @@
 							// 触发器可以同时用blur和change
 							trigger: ['change','blur'],
 						}
-					]
-					
+					],
+					'receiveAdress': {
+						type: 'string',
+						required: true,
+						message: '请选择所在地区',
+						trigger: ['blur', 'change']
+					},
+					'address': {
+						type: 'string',
+						required: true,
+						message: '请填详细地址',
+						trigger: ['blur', 'change']
+					},
 				}
 			}
 		},
 		onShow() {		
 		},
-		onLoad() {
-
+		onLoad(page) {
+			console.log('page',page);
+			this.saveType = page.type;
+			this.id = page.id;
+			if(this.id){
+				this.getAddrById(this.id)
+			}
 		},
 		onReady() {
 			//如果需要兼容微信小程序,并且校验规则中含有方法等,只能通过setRules方法设置规则。
@@ -94,15 +126,51 @@
 				console.log('defaultChange',e)
 			},
 			showRegionPicker() {
-				// this.show = true;
+				// this.showMap = true;
 				uni.$u.route('/center/map');
 			},
+			getAddrById(id){
+				this.$u.api.getAddrById({id:id}).then(res=>{
+					console.log('getAddrByIdres',res.data);
+					const { receiveName, receivePhone, receiveAdress, address, ifDefault } = res.data;
+					Object.assign(this.model, { receiveName, receivePhone, receiveAdress, address, ifDefault });
+				}).catch(err=>{
+					console.log('getAddrById',err);
+				})
+			},
 			submit() {
 				this.$refs.uForm.validate().then(res => {
+					console.log('this.model',this.model);
 					uni.$u.toast('校验通过')
+					if(this.saveType=='edit'){
+						this.editAddr()
+					}else{
+						this.addAddr()
+					}
 				}).catch(errors => {
 					uni.$u.toast('校验失败')
 				})
+			},
+			addAddr(){
+				this.$u.api.addAddr(this.model).then(res=>{
+					// console.log('res',res);
+					uni.$u.route('/center/addrlist', {
+						type: 'redirectTo'
+					});
+				}).catch(err=>{
+					console.log('addAddr',err.data);
+				})
+			},
+			editAddr(){
+				this.model.id = this.id;
+				this.$u.api.editAddr(this.model).then(res=>{
+					// console.log('res',res);
+					uni.$u.route('/center/addrlist', {
+						type: 'redirectTo'
+					});
+				}).catch(err=>{
+					console.log('addAddr',err.data);
+				})
 			}
 		}
 	}

+ 70 - 9
center/addrlist.vue

@@ -9,20 +9,27 @@
 		</u-navbar>
 		<view class="page-wrap">
 			<view class="full-btn" @click="newAddr">新增收货地址</view>
-			<view class="addr u-flex" @click="editAddr(item)" v-for="item in 20" :key="item">
-				<view class="icon-wrap" v-if="item==1">
+			<view v-if="dataList.length>0" class="addr" @click="addrClick(item)" v-for="(item,index) in dataList" :key="item.id">
+				<u-swipe-action>
+				<u-swipe-action-item :show="item.show" :index="index" @click.stop="swipeClick(index)" :options="options">
+				<view class="u-flex">
+				<view class="icon-wrap" v-if="item.ifDefault==1">
 					<u-icon size="36rpx" :name="staticUrl+'/img/arrows.png'"></u-icon>
 				</view>
 				<view class="info u-flex-1">
 					<view class="up">
-						<text>张晓霞</text>
-						<text>182 ****2542</text>
-						<text class="default" v-if="item==1">默认</text>
+						<text>{{item.receiveName}}</text>
+						<text>{{item.receivePhone}}</text>
+						<text class="default" v-if="item.ifDefault==1">默认</text>
 					</view>
-					<view class="down">广东省广州市越秀区腾讯大厦32楼3002号</view>
+					<view class="down">{{item.receiveAdress}}{{item.address}}</view>
 				</view>
-				<u-icon name="edit-pen" color="#333" size="20"></u-icon>
+				<u-icon name="edit-pen" color="#333" size="20" @click.native.stop="editAddr(item)"></u-icon>
+				</view>
+				</u-swipe-action-item>
+				</u-swipe-action>
 			</view>
+			<u-empty v-else mode="list"></u-empty>
 		</view>
 	</view>
 </template>
@@ -32,11 +39,25 @@
 		data() {
 			return {
 				staticUrl:this.$commonConfig.staticUrl,
+				dataList:[],
+				options:[
+					{
+						text: '删除',
+						style: {
+							backgroundColor: '#FF3C3F',
+							'padding-left':'10px'
+						}
+					}
+				],
+				fromPage:'',
 			}
 		},
-		onShow() {		
+		onShow() {	
+			this.getAddrList();
 		},
-		onLoad() {
+		onLoad(page) {
+			console.log('page',page);
+			this.fromPage = page.from;
 
 		},
 		methods: {
@@ -48,6 +69,46 @@
 			},
 			editAddr(item){
 				uni.$u.route('/center/addrForm', {type: 'edit',id:item.id});
+			},
+			getAddrList(){
+				this.$u.api.addrList().then(res=>{
+					this.dataList = res.data.rows;
+					}).catch(err=>{
+					console.log('getAddrList',err.data);
+				})
+			},
+			swipeClick(index){
+				let that = this;
+				// console.log('swipeClick',this.dataList[index]);
+				let item = this.dataList[index];
+				uni.showModal({
+					title: '温馨提示',
+					content: '确定要删除吗?',
+					success: res => {
+						if (res.confirm) {
+							that.deleteAddr(item.id);
+						}
+					},
+					complete:()=>{}
+				})
+			},
+			deleteAddr(id){
+				this.$u.api.delAddr({id:id}).then(res=>{
+					this.getAddrList()
+					}).catch(err=>{
+					console.log('deleteAddr',err.data);
+				})
+			},
+			addrClick(item){
+				console.log('selectAddr',item);
+				if(this.fromPage == 'submitorder'){
+					let pages = getCurrentPages();             //获取所有页面栈实例列表
+					let nowPage = pages[ pages.length - 1];    //当前页页面实例
+					let prevPage = pages[ pages.length - 2 ];  //上一页页面实例
+					prevPage.$vm.fromPage = 'addrlist';
+					prevPage.$vm.theAddr = item;         // 修改上一页data里面的content参数值
+					uni.navigateBack()
+				}
 			}
 		}
 	}

+ 31 - 9
center/center.vue

@@ -39,10 +39,10 @@
 		<view class="order-state">
 			<view class="title">我的订单</view>
 			<view class="u-flex u-row-between">
-				<view class="state" @click="orderClick(item)" v-for="(item,index) in orderState" :key="index">
+				<view class="state" @click="orderClick(item,index)" v-for="(item,index) in orderState" :key="index">
 					<view class="up">
 						<u-icon :name="item.ico" color="#333333" size="60rpx"></u-icon>
-						<u-badge v-if="item.badge" type="error" max="99" :value="item.badge" :absolute="true" :offset="[0,0]"></u-badge>
+						<u-badge v-if="item.badge" type="error" max="99" :value="orderBadge[item.badge]" :absolute="true" :offset="[0,0]"></u-badge>
 					</view>
 					<view class="down">{{item.name}}</view>
 				</view>
@@ -78,12 +78,19 @@
 				avatar:this.$commonConfig.staticUrl+'/img/avatar.png',
 				memberInfo:{},
 				orderState:[
-					{name:'全部订单',ico:this.$commonConfig.staticUrl+'/img/orderstateico-all.png'},
-					{name:'待付款',ico:this.$commonConfig.staticUrl+'/img/orderstateico-01.png',badge:'4'},
-					{name:'待收货',ico:this.$commonConfig.staticUrl+'/img/orderstateico-02.png'},
-					{name:'待评价',ico:this.$commonConfig.staticUrl+'/img/orderstateico-03.png'},
-					{name:'退款/售后',ico:this.$commonConfig.staticUrl+'/img/orderstateico-04.png'},
+					{name:'全部订单',status:'',ico:this.$commonConfig.staticUrl+'/img/orderstateico-all.png'},
+					{name:'待付款',status:'0',ico:this.$commonConfig.staticUrl+'/img/orderstateico-01.png',badge:'noPayNum'},
+					{name:'待收货',status:'2',ico:this.$commonConfig.staticUrl+'/img/orderstateico-02.png',badge:'collectNum'},
+					{name:'待评价',status:'3',ico:this.$commonConfig.staticUrl+'/img/orderstateico-03.png',badge:'commentNum'},
+					{name:'退款/售后',status:'7',ico:this.$commonConfig.staticUrl+'/img/orderstateico-04.png',badge:'refundNum'},
 				],
+				orderBadge:{
+					noPayNum:'0',
+					deliverNum:'0',
+					collectNum:'0',
+					commentNum:'0',
+					refundNum:'0',
+				},
 				tools:[
 					{name:'充值中心',url:'/center/addrlist',ico:this.$commonConfig.staticUrl+'/img/tool-chongzhi.png'},
 					{name:'地址管理',url:'/center/addrlist',ico:this.$commonConfig.staticUrl+'/img/tool-map.png'},
@@ -91,7 +98,8 @@
 			}
 		},
 		onShow() {	
-			this.getMemberInfo()
+			this.getMemberInfo();
+			this.statisticsOrder();
 		},
 		onLoad() {
 
@@ -110,8 +118,22 @@
 				console.log('item',item);
 				uni.$u.route(item.url);
 			},
-			orderClick(item){
+			orderClick(item,index){
 				console.log('item',item);
+				uni.$u.route('/shopping/order', {
+					current: index,
+					type: 'redirectTo'
+				});
+			},
+			statisticsOrder(){
+				this.$u.api.statisticsOrder().then(res=>{
+					let data = res.data || {};
+					this.orderBadge = Object.assign(this.orderBadge,data)
+					// console.log('statisticsOrder',res.data);
+					// console.log('this.orderBadge',this.orderBadge);
+					}).catch(err=>{
+					console.log('memberInfo',err.data);
+				})
 			}
 		}
 	}

+ 11 - 4
center/map.vue

@@ -1,5 +1,5 @@
 <template>
-	<view class="map-page" v-if="false">
+	<view class="map-page">
 		<map id="map" class="map" :latitude="latitude" :longitude="longitude" :markers="covers"
 			@regionchange="regionchange"></map>
 		<cover-view class="btn-box">
@@ -28,9 +28,16 @@
 					console.log('详细地址:' + res.address);
 					console.log('纬度:' + res.latitude);
 					console.log('经度:' + res.longitude);
-					that.latitude = res.latitude
-					that.longitude = res.longitude
-					that.submit()
+					that.latitude = res.latitude;
+					that.longitude = res.longitude;
+					
+					let pages = getCurrentPages();             //获取所有页面栈实例列表
+					let nowPage = pages[ pages.length - 1];    //当前页页面实例
+					let prevPage = pages[ pages.length - 2 ];  //上一页页面实例
+					prevPage.$vm.model.receiveAdress= res.address;         // 修改上一页data里面的content参数值
+					uni.navigateBack()
+					
+					// that.submit()
 				},
 			    fail: () => {
 			      uni.showToast({

+ 65 - 0
common/apiurl.js

@@ -32,6 +32,16 @@ const apiurl = {
 		url: '/memberInfo/update',
 		type: 'put'
 	},
+	//轮播图
+	swiperList: {
+		url: '/advList/pageList',
+		type: 'get'
+	},
+	//轮播图详情
+	swiperDetails: {
+		url: '/advList/selectById',
+		type: 'get'
+	},
 	// 商品分类信息
 	goodsTypeTree: {
 		url: '/goodsType/tree',
@@ -72,6 +82,11 @@ const apiurl = {
 		url: '/shopGoods/pageList',
 		type: 'get'
 	},
+	// 热销商品列表
+	topGoodList: {
+		url: '/goods/selectTopGoodList',
+		type: 'get'
+	},
 	// 动态类型列表
 	shopNewsType: {
 		url: '/shopNewsType/list',
@@ -103,6 +118,56 @@ const apiurl = {
 		url: '/goodsCart/pageList',
 		type: 'get'
 	},
+	// 修改购物车商品数量
+	updateQuantity: {
+		url: '/goodsCart/updateQuantity',
+		type: 'post'
+	},
+	// 批量移除
+	deleteCarts: {
+		url: '/goodsCart/deleteByIds',
+		type: 'delete'
+	},
+	// 地址列表
+	addrList: {
+		url: '/memberAddress/pageList',
+		type: 'get'
+	},
+	// 添加地址
+	addAddr: {
+		url: '/memberAddress/insert',
+		type: 'post'
+	},
+	// 查看详情
+	getAddrById: {
+		url: '/memberAddress/selectById',
+		type: 'get'
+	},
+	// 修改地址
+	editAddr: {
+		url: '/memberAddress/update',
+		type: 'put'
+	},
+	// 删除地址
+	delAddr: {
+		url: '/memberAddress/deleteById',
+		type: 'delete'
+	},
+	// 查询登录用户订单量
+	statisticsOrder: {
+		url: '/order/statisticsOrder',
+		type: 'get'
+	},
+	// 订单列表
+	orderList: {
+		url: '/order/pageList',
+		type: 'get'
+	},
+	// 订单详情
+	orderDetails: {
+		url: '/order/selectById',
+		type: 'get'
+	},
 }
 
 

+ 232 - 0
credits/credits.vue

@@ -0,0 +1,232 @@
+<template>
+	<view class="page-wrap">
+		<u-navbar
+			title="积分商城"
+			:autoBack="true"
+			 :safeAreaInsetTop="true"
+		>
+		</u-navbar>
+		<view class="header">
+			<u--image class="image" :src="staticUrl+'/img/credits-header.png'" width="100%" height="260rpx"></u--image>
+			<view class="inner">
+				<view class="top u-flex u-row-between">
+					<text>积分商城</text>
+					<view class="right u-flex">
+						<u-icon name="error-circle" color="#fff" size="34rpx"></u-icon>
+						<text>规则</text>
+					</view>
+				</view>
+				<view class="num">64565</view>
+				<view class="bottom">
+					<text>积分明细</text>
+				</view>
+			</view>
+		</view>
+		<view class="tabs-wrap">
+			<u-tabs 
+			:list="tabsList" 
+			lineColor="#00A447" 
+			 :activeStyle="{color:'#333','font-weight': '600','font-size':'30rpx'}"
+			 :inactiveStyle="{color:'#999'}"
+			@click="tabsClick"></u-tabs>
+		</view>
+		<view class="">
+			<mescroll-body class="" ref="mescrollRef" @init="mescrollInit" @down="downCallback" @up="upCallback" :down="downOption" :up="upOption">
+				<view class="credit-product u-flex u-flex-wrap">
+					<view class="credit-product-item" v-for="(item,index) in dataList" :key="item.id">
+						<view class="pic">
+							<u--image class="image" :src="item.mainImg" width="100%" height="340rpx"></u--image>
+						</view>
+						<view class="text">
+							<view class="til ellipsis-2">
+								{{item.title||'测试标题测试标题测试标题测试标题测试标题测试标题'}}
+							</view>
+							<view class="price">¥54.00</view>
+							<view class="bottom u-flex u-row-between">
+								<text>+20000积分</text>
+								<text class="btn">兑换</text>
+							</view>
+						</view>
+					</view>
+				</view>
+			</mescroll-body>
+		</view>
+	</view>
+</template>
+
+<script>
+	// 引入mescroll-mixins.js
+	import MescrollMixin from "@/uni_modules/mescroll-uni/components/mescroll-uni/mescroll-mixins.js";
+	export default {
+		mixins: [MescrollMixin], // 使用mixin
+		data() {
+			return {
+				staticUrl:this.$commonConfig.staticUrl,
+				tabsList:[
+					{name:'全部'},
+					{name:'推荐'},
+					{name:'美食'},
+					{name:'饮料'},
+					{name:'住行'},
+					{name:'其他'}
+				],
+				typeId:'',
+				dataList:[{id:1},{id:2},{id:3}],
+			}
+		},
+		onShow() {	
+		},
+		onLoad() {
+
+		},
+		methods: {
+			/*下拉刷新的回调, 重置列表为第一页 (此处可删,mixins已默认)
+			downCallback(){
+				this.mescroll.resetUpScroll();
+			},
+			/*上拉加载的回调*/
+			upCallback(page) {
+				// 此处可以继续请求其他接口
+				// if(page.num == 1){
+				// 	// 请求其他接口...
+				// }
+			
+				// 如果希望先请求其他接口,再触发upCallback,可参考以下写法
+				// if(!this.hasTypeId){
+				// 	this.shopNewsType();
+				// 	return // 此处return,先获取xx
+				// }
+			
+				let pageNum = page.num; // 页码, 默认从1开始
+				let pageSize = page.size; // 页长, 默认每页10条
+			
+				let params = {
+					pageNum : page.num,
+					pageSize :  page.size,
+					type : this.typeId,
+				}
+				// console.log('this.params',params);
+				this.$u.api.shopNewsList(params).then(data => {
+					console.log('data',JSON.parse(JSON.stringify(data)));
+					// 接口返回的当前页数据列表 (数组)
+					let curPageData = data.data.rows;
+					// console.log('curPageData',JSON.parse(JSON.stringify(curPageData)));
+					// 接口返回的当前页数据长度 (如列表有26个数据,当前页返回8个,则curPageLen=8)
+					let curPageLen = curPageData.length; 
+					// 接口返回的总页数 (如列表有26个数据,每页10条,共3页; 则totalPage=3)
+					// let totalPage =  data.data.data.totalPage; 
+					// 接口返回的总数据量(如列表有26个数据,每页10条,共3页; 则totalSize=26)
+					let totalSize = data.data.total; 
+					// 接口返回的是否有下一页 (true/false)
+					// let hasNext = data.xxx; 
+					// console.log('totalPage',totalPage,'curPageLen',curPageLen);
+					//设置列表数据
+					if(page.num == 1) this.dataList = []; //如果是第一页需手动置空列表
+					this.dataList = this.dataList.concat(curPageData); //追加新数据
+					// 请求成功,隐藏加载状态
+					//方法一(推荐): 后台接口有返回列表的总页数 totalPage
+					// this.mescroll.endByPage(curPageLen, totalPage); 
+					//方法二(推荐): 后台接口有返回列表的总数据量 totalSize
+					this.mescroll.endBySize(curPageLen, totalSize); 
+				}).catch(err => {
+					this.mescroll.endErr()
+					console.log(err)
+				});	
+			
+			},
+			/*若希望重新加载列表,只需调用此方法即可(内部会自动page.num=1,再主动触发up.callback)*/
+			reloadList() {
+				this.mescroll.resetUpScroll();
+			},
+			tabsClick(item){
+				this.typeId = item.id;
+				this.reloadList()
+				// console.log('item',item);
+			},
+		}
+	}
+</script>
+<style>
+	page{
+		background-color: #F5F5F5;
+	}
+</style>
+<style lang="scss" scoped>
+.header{
+	color: #fff;
+	position: relative;
+	height: 260rpx;
+	margin-bottom: 30rpx;
+	/deep/ .u-image{
+		position: absolute;
+		left: 0;
+		right: 0;
+		top: 0;
+		z-index: -1;
+	}
+	.inner{
+		padding: 40rpx;
+		.top{
+			font-size: 26rpx;
+			text{margin-left: 10rpx;}
+			margin-bottom: 30rpx;
+		}
+		.num{
+			font-size: 50rpx;
+			font-weight: 600;
+			color: #FFFFFF;
+			line-height: 58rpx;
+		}
+		.bottom{
+			text-align: right;
+			text{
+				display: inline-block;
+				padding: 4rpx 20rpx;
+				background: rgba(0,0,0,0.2);
+				color: #fff;
+				border-radius: 23rpx;
+				font-size: 22rpx;
+			}
+		}
+	}
+}
+.tabs-wrap{
+	background-color: #fff;
+	margin-bottom: 10rpx;
+}
+.credit-product{
+	margin-top: 20rpx;
+	&-item{
+		width: 47%;
+		background-color: #fff;
+		margin-bottom: 30rpx;
+		&:nth-child(even){
+			margin-left: 6%;
+		}
+		.text{
+			padding: 20rpx;
+			.price{
+				margin-top: 17rpx;
+				font-size: 24rpx;
+				font-weight: 600;
+				color: #FF3C3F;
+				line-height: 33rpx;
+			}
+		}
+		.bottom{
+			font-size: 30rpx;
+			font-weight: 600;
+			color: #00A447;
+			line-height: 42rpx;
+			.btn{
+				font-size: 22rpx;
+				font-weight: 400;
+				color: #FFFFFF;
+				padding: 5rpx 18rpx;
+				background: #00A447;
+				border-radius: 4px;
+			}
+		}
+	}
+}
+</style>

+ 6 - 1
manifest.json

@@ -57,7 +57,12 @@
             "postcss" : true
         },
         "usingComponents" : true,
-        "permission" : {}
+        "permission" : {
+			"scope.userLocation": {
+				"desc": "你的位置信息将用于小程序位置接口的效果展示"
+			}
+		},
+		"requiredPrivateInfos": ["getLocation", "chooseLocation"]
     },
     "mp-alipay" : {
         "usingComponents" : true

+ 26 - 0
pages.json

@@ -100,6 +100,20 @@
 						"navigationBarTitleText": "购物车",
 						"navigationStyle": "custom"
 					}
+				},
+				{
+					"path": "order",
+					"style": {
+						"navigationBarTitleText": "我的订单",
+						"navigationStyle": "custom"
+					}
+				},
+				{
+					"path": "orderdetails",
+					"style": {
+						"navigationBarTitleText": "订单详情",
+						"navigationStyle": "custom"
+					}
 				}
 			]
 		},
@@ -163,6 +177,18 @@
 					}
 				}
 			]
+		},
+		{
+			"root": "credits",
+			"pages": [
+				{
+					"path": "credits",
+					"style": {
+						"navigationBarTitleText": "积分商城",
+						"navigationStyle": "custom"
+					}
+				}
+			]
 		}
 	],
 	"preloadRule": {

+ 26 - 19
pages/index/index.vue

@@ -7,6 +7,7 @@
 			<u-swiper
 				:list="bannerList"
 				indicator
+				keyName="sliderImg"
 				indicatorMode="dot"
 				@click="bannerClick"
 			></u-swiper>
@@ -34,7 +35,7 @@
 					<u--image class="image" :src="staticUrl+'/img/index-nav-2.png'" width="101rpx" height="101rpx"></u--image>
 					爆款专区
 				</view>
-				<view class="nav-item">
+				<view class="nav-item" @click="$u.route('/credits/credits',{type:'redirectTo'})">
 					<u--image class="image" :src="staticUrl+'/img/index-nav-3.png'" width="101rpx" height="101rpx"></u--image>
 					积分商城
 				</view>
@@ -50,10 +51,10 @@
 			<view class="hot-product">
 				<view class="single-til u-flex u-row-between">
 					<text class="text">热销产品</text>
-					<view class="u-flex" @click="$u.route('/shopping/productList',{typeId:1,typeName:'热销产品',type:'redirectTo'})">
+					<!-- <view class="u-flex" @click="$u.route('/shopping/productList',{typeId:1,typeName:'热销产品',type:'redirectTo'})">
 						<text class="more-text">更多</text>
 						<u-icon name="arrow-right" color="#676767" size="24rpx"></u-icon>
-					</view>
+					</view> -->
 				</view>
 				<view class="product u-flex" @click="$u.route('/shopping/productdetails',{id:item.id})" v-for="item in hotGoods" :key="item.id">
 					<u--image :showLoading="true" :src="item.mainImg" width="180rpx" height="180rpx"></u--image>
@@ -82,7 +83,7 @@
 				</view>
 			</view>
 			<tabbar :tabbarIndexProps='0' />
-			<cartfixed ref="cartfixed" @addToCart="addToCart" />
+			<cartfixed ref="cartfixed" @getCartList="getCartList" />
 		</view>
 		<u-toast ref="uToast"></u-toast>
 	</view>
@@ -100,16 +101,7 @@
 			return {
 				staticUrl:this.$commonConfig.staticUrl,
 				advantageSize:20,
-				bannerList: [{
-                    url: 'https://cdn.uviewui.com/uview/swiper/swiper1.png',
-                    title: '昨夜星辰昨夜风,画楼西畔桂堂东'
-                },{
-                    url: 'https://cdn.uviewui.com/uview/swiper/swiper2.png',
-                    title: '身无彩凤双飞翼,心有灵犀一点通'
-                },{
-                    url: 'https://cdn.uviewui.com/uview/swiper/swiper3.png',
-                    title: '谁念西风独自凉,萧萧黄叶闭疏窗,沉思往事立残阳'
-                }],
+				bannerList: [],
 				hotGoods:[]
 			}
 		},
@@ -118,17 +110,32 @@
 			// console.log('userInfo',userInfo);
 			this.getHotGoods()
 		},
+		onShow() {
+			this.$refs.cartfixed.getCartList();
+			this.swiperList();
+		},
 		methods: {
+			swiperList(){
+				this.$u.api.swiperList({postion:1}).then(res=>{
+					this.bannerList = res.data.rows;
+					// console.log('res',res.data.rows);
+				}).catch(err=>{
+					console.log('swiperList',err.data);
+				})
+			},
 			bannerClick(e){
-				console.log('bannerClick',e);
+				// console.log('bannerClick',this.bannerList[e]);
+				uni.$u.route('/xushuo/dynamicdetails', {
+					type: 'swiperDetail',
+					id: e.id
+				});
 			},
 			getHotGoods(){
-				// {id:'111233',pageNum:1,pageSize:3,isExplode:1}
-				this.$u.api.memberGoodList({pageNum:1,pageSize:3,isExplode:1}).then(res=>{
+				this.$u.api.topGoodList({pageNum:1,pageSize:20}).then(res=>{
 					this.hotGoods = res.data.rows;
 					console.log('res',res);
 				}).catch(err=>{
-					console.log('err11111',err.data);
+					console.log('getHotGoods',err.data);
 				})
 			},
 			addCart(id){
@@ -138,7 +145,7 @@
 						type:"success",
 						message:res.msg
 					});
-					this.$refs.cartfixed.addToCart(1);
+					this.$refs.cartfixed.getCartList();
 					console.log('res',res);
 					}).catch(err=>{
 					console.log('addCart',err.data);

+ 58 - 9
shopping/cart.vue

@@ -8,22 +8,23 @@
 		>
 		</u-navbar>
         <view class="product-list">
-			<view class="til">
+			<view class="til u-flex u-row-between">
 				<u-checkbox-group @change="allCheckboxChange">
 					<u-checkbox shape="circle" :checked="allChecked" :name="allCheckbox.name" label="商品列表"></u-checkbox>
 				</u-checkbox-group>
+				<text class="delbtn" @click="delSelect" v-if="selectGoods.length>0">删除</text>
 			</view>
 			<mescroll-body class="" ref="mescrollRef" @init="mescrollInit" @down="downCallback" @up="upCallback" :down="downOption" :up="upOption">
 				<u-checkbox-group placement="column" @change="checkboxChange" >
 				<view v-for="(item,index) in dataList" :key="item.id" class="product">
 					<u-swipe-action>
-					<u-swipe-action-item :show="true" :index="index" @click="swipeClick(index)" :options="options">
+					<u-swipe-action-item :show="item.show" :index="index" @click="swipeClick(index)" :options="options">
 					<view class="swipe-action">
 					<view class="swipe-action__content u-flex">
 					 <u-checkbox shape="circle" activeColor="#00A447" :key="index" :name="item.name" :checked="item.checked" @change="toggleCheck(index)" class="checkbox" />
-					<u--image :showLoading="true" :src="item.mainImg" width="180rpx" height="180rpx"></u--image>
+					<u--image @click="$u.route('/shopping/productdetails',{id:item.goodsId})" :showLoading="true" :src="item.mainImg" width="180rpx" height="180rpx"></u--image>
 					<view class="text">
-						<view class="name ellipsis-2">{{item.goodsName}}</view>
+						<view class="name ellipsis-2" @click="$u.route('/shopping/productdetails',{id:item.goodsId})">{{item.goodsName}}</view>
 						<view class="u-flex u-row-between">
 							<view class="left">
 								<view class="up">
@@ -41,7 +42,7 @@
 									<!-- <text class="sales gray">销量999+</text> -->
 								</view>
 							</view>
-							<u-number-box v-model="item.quantity" @change="changeQuantity(index, $event)"></u-number-box>
+							<u-number-box v-model="item.quantity" @change="changeQuantity(index, $event)" integer></u-number-box>
 						</view>
 					</view>
 					</view>
@@ -111,6 +112,7 @@
                 // 购物车列表
                 dataList: [],
 				total:10,
+				deleteArr:[],
             }
         },
 		watch:{
@@ -236,23 +238,44 @@
             },
             // 改变商品数量
             changeQuantity(index, value) {
-                this.dataList[index].quantity = value
+				this.changeQuantityApi(this.dataList[index].id,value.value)
             },
+			changeQuantityApi(id,num){
+				this.$u.api.updateQuantity({id:id,quantity:num}).then(res=>{
+					// this.dataList[index].quantity = num
+					console.log('res',res.data);
+					}).catch(err=>{
+					console.log('changeQuantityApi',err.data);
+				})
+			},
             // 结算
             checkout() {
                 // TODO: 跳转到支付页面
             },
 			swipeClick(index){
+				let that = this;
 				console.log('swipeClick',index);
-				console.log('swipeClick',this.dataList[index]);
+				// console.log('swipeClick',this.dataList[index]);
+				let item = this.dataList[index];
 				uni.showModal({
 					title: '温馨提示',
 					content: '确定要删除吗?',
 					success: res => {
 						if (res.confirm) {
-							//执行删除操作
+							// console.log('',that);
+							that.deleteArr = [];
+							that.deleteArr.push(item.id);
+							that.deleteCarts();
 						}
-					}
+					},
+					complete:()=>{}
+				})
+			},
+			deleteCarts(){
+				this.$u.api.deleteCarts(this.deleteArr).then(res=>{
+					this.reloadList()
+					}).catch(err=>{
+					console.log('deleteCarts',err.data);
 				})
 			},
 			submitorder(){
@@ -260,6 +283,25 @@
 				uni.$u.route('/shopping/submitorder', {
 					selectGoods: JSON.stringify(this.selectGoods),
 				});
+			},
+			delSelect(){
+				let that = this;
+				let delArr = [];
+				delArr = this.selectGoods.map(item=>{
+					return item.id;
+				});
+				uni.showModal({
+					title: '温馨提示',
+					content: '确定要删除吗?',
+					success: res => {
+						if (res.confirm) {
+							// console.log('',that);
+							that.deleteArr = [];
+							that.deleteArr = delArr
+							that.deleteCarts();
+						}
+					}
+				})
 			}
         }
     }
@@ -287,6 +329,13 @@
 	}
 	.til{
 		margin-bottom: 20rpx;
+		.delbtn{
+			font-size: 26rpx;
+			border: 1px solid #999;
+			color: #666;
+			padding: 5rpx 20rpx;
+			border-radius: 20rpx;
+		}
 	}
 }
 .recommend{

+ 278 - 0
shopping/order.vue

@@ -0,0 +1,278 @@
+<template>
+	<view class="pages">
+		<u-navbar
+			title="我的订单"
+			:autoBack="true"
+			 :safeAreaInsetTop="true"
+		>
+		</u-navbar>
+		<view class="tabs-wrap">
+			<u-tabs 
+			:list="tabsList" 
+			lineColor="#00A447" 
+			:current="tabsCurrent"
+			 :activeStyle="{color:'#333','font-weight': '600','font-size':'30rpx'}"
+			 :inactiveStyle="{color:'#999'}"
+			@click="tabsClick"></u-tabs>
+		</view>
+		<view class="page-wrap">
+			<mescroll-body class="" ref="mescrollRef" @init="mescrollInit" @down="downCallback" @up="upCallback" :down="downOption" :up="upOption">
+				<view class="order">
+					<view v-for="(item,index) in orderListWithClass" class="order-item" 
+						:class="item.class"
+						@click="goOrderDetails(item.id)" :key="item.id">
+						<view class="top u-flex u-row-between">
+							<text>订单号:887784332234423</text>
+							<text class="status">{{item.status|filterOrderState}}</text>
+						</view>
+						<view class="center u-flex u-row-between">
+							<view class="left u-flex">
+								<u--image :showLoading="true" :src="item.mainImg" width="128rpx" height="128rpx"></u--image>
+								<view class="text">
+									<view class="name ellipsis-2">goodsName{{item.goodsName}}</view>
+									<view class="specification ellipsis-1">规格:{{item.specification}}</view>
+								</view>
+							</view>
+							<view class="right">
+								<u-icon name="arrow-right" color="#999" size="24"></u-icon>
+								<text class="price red">¥ <text class="price-num">{{item.price||'1600'}}</text></text>
+							</view>
+						</view>
+						<view class="bottom u-flex u-row-between">
+							<view class="left">更多</view>
+							<view class="right u-flex">
+								<view 
+									class="btn"
+									:class="btn.class"
+									@click.stop="clickEven(btn.fun)"
+									v-for="(btn,index) in statusBtn[item.status]" :key="index">
+									{{btn.name}}
+								</view>
+							</view>
+						</view>
+					</view>
+				</view>
+			</mescroll-body>
+		</view>
+	</view>
+</template>
+
+<script>
+	// 引入mescroll-mixins.js
+	import MescrollMixin from "@/uni_modules/mescroll-uni/components/mescroll-uni/mescroll-mixins.js";
+	export default {
+		mixins: [MescrollMixin], // 使用mixin
+		components:{
+			
+		},
+		data() {
+			return {
+				tabsCurrent:1,
+				tabsList:[
+					{name:'全部',status:'',},
+					{name:'待付款',status:'0',},
+					{name:'待收货',status:'2'},
+					{name:'待评价',status:'3'},
+					{name:'退款/售后',status:'7'}
+				],
+				status:'',
+				dataList:[{status:0},{status:1},{status:2},{status:3},{status:4}],
+				statusBtn:{
+					0:[{name:'取消订单',fun:'cancel ',class:''},{name:'去支付',fun:'pay',class:'red'}],
+					1:[{name:'申请退款',fun:'refund',class:'green'}],
+					2:[{name:'查看物流',fun:'logistics',class:''},{name:'确认收货',fun:'confirmReceipt',class:'green'}],
+					3:[{name:'查看物流',fun:'logistics',class:''},{name:'评价',fun:'evaluate',class:'green'}],
+					// 4:[{name:'查看物流',fun:'logistics',class:''},{name:'评价',fun:'evaluate',class:'green'}],
+					5:[{name:'查看退款',fun:'viewRefund',class:'green'}],
+					// 6:[{name:'查看退款',fun:'viewRefund',class:'green'}],
+					// 7:[{name:'查看退款',fun:'viewRefund',class:'green'}]
+				}
+			}
+		},
+		computed: {
+		  orderListWithClass() {
+		      return this.dataList.map(order => {
+		        return {
+		          ...order,
+		          class: {
+		            1: 'status-1',
+		            2: 'status-2',
+		            3: 'status-3',
+		            4: 'status-4',
+		            5: 'status-5',
+		            6: 'status-6',
+		            7: 'status-7',
+		            8: 'status-8'
+		          }[order.status] || ''
+		        }
+		      })
+		    }
+		},
+		onLoad(page) {
+			console.log('page',page);
+			this.tabsCurrent = page.current || 0;
+		},
+		methods: {
+			/*下拉刷新的回调, 重置列表为第一页 (此处可删,mixins已默认)
+			downCallback(){
+				this.mescroll.resetUpScroll();
+			},
+			/*上拉加载的回调*/
+			upCallback(page) {
+				return
+				// 此处可以继续请求其他接口
+				// if(page.num == 1){
+				// 	// 请求其他接口...
+				// }
+			
+				// 如果希望先请求其他接口,再触发upCallback,可参考以下写法
+				// if(!this.hasTypeId){
+				// 	this.shopNewsType();
+				// 	return // 此处return,先获取xx
+				// }
+			
+				let pageNum = page.num; // 页码, 默认从1开始
+				let pageSize = page.size; // 页长, 默认每页10条
+
+				let params = {
+					pageNum : page.num,
+					pageSize :  page.size,
+					status : this.tabsList[this.tabsCurrent].status,
+				}
+				// console.log('this.params',params);
+				this.$u.api.orderList(params).then(data => {
+					console.log('data',JSON.parse(JSON.stringify(data)));
+					// 接口返回的当前页数据列表 (数组)
+					let curPageData = data.data.rows;
+					// console.log('curPageData',JSON.parse(JSON.stringify(curPageData)));
+					// 接口返回的当前页数据长度 (如列表有26个数据,当前页返回8个,则curPageLen=8)
+					let curPageLen = curPageData.length; 
+					// 接口返回的总页数 (如列表有26个数据,每页10条,共3页; 则totalPage=3)
+					// let totalPage =  data.data.data.totalPage; 
+					// 接口返回的总数据量(如列表有26个数据,每页10条,共3页; 则totalSize=26)
+					let totalSize = data.data.total; 
+					// 接口返回的是否有下一页 (true/false)
+					// let hasNext = data.xxx; 
+					// console.log('totalPage',totalPage,'curPageLen',curPageLen);
+					//设置列表数据
+					if(page.num == 1) this.dataList = []; //如果是第一页需手动置空列表
+					this.dataList = this.dataList.concat(curPageData); //追加新数据
+					// 请求成功,隐藏加载状态
+					//方法一(推荐): 后台接口有返回列表的总页数 totalPage
+					// this.mescroll.endByPage(curPageLen, totalPage); 
+					//方法二(推荐): 后台接口有返回列表的总数据量 totalSize
+					this.mescroll.endBySize(curPageLen, totalSize); 
+				}).catch(err => {
+					this.mescroll.endErr()
+					console.log(err)
+				});	
+			
+			},
+			/*若希望重新加载列表,只需调用此方法即可(内部会自动page.num=1,再主动触发up.callback)*/
+			reloadList() {
+				this.mescroll.resetUpScroll();
+			},
+			tabsClick(item){
+				this.status = item.status;
+				this.reloadList()
+				// console.log('item',item);
+			},
+			goOrderDetails(id){
+				uni.$u.route('/shopping/orderdetails', {
+					id: id
+				});
+			},
+			pay(){
+				console.log('pay');
+			},
+			clickEven(fun){
+				// console.log('fun',fun);
+				let funObj = {
+				  'pay': this.pay
+				};
+				if (fun in funObj) {
+				  funObj[fun]();
+				}
+			}
+		}
+	}
+</script>
+<style>
+page{
+	background-color: #F5F5F5;
+}
+</style>
+<style lang="scss" scoped>
+.tabs-wrap{
+	background-color: #fff;
+	margin-bottom: 10rpx;
+}
+.list-item{
+	overflow: hidden;
+	width: 48%;
+	margin-bottom: 30rpx;
+	background-color: #fff;
+	.image-wrap{
+		margin-bottom: 20rpx;
+	}
+}
+.order-item{
+	margin-bottom: 20rpx;
+	background-color: #fff;
+	padding: 30rpx 20rpx;
+	border-radius: 8rpx;
+	.top{
+		margin-bottom: 20rpx;
+		padding-bottom: 20rpx;
+		font-size: 24rpx;
+		font-weight: 400;
+		color: #999999;
+		border-bottom: 0.5px solid #eee;
+		.status{font-size: 24rpx;}
+	}
+	.center{
+		margin-bottom: 20rpx;
+		padding-bottom: 20rpx;
+		border-bottom: 0.5px solid #eee;
+		.text{
+			margin-left: 20rpx;
+			.specification{
+				font-size: 24rpx;
+				font-weight: 400;
+				color: #999999;
+				margin-top: 16rpx;
+			}
+		}
+		.right{
+			text-align: right;
+			/deep/.u-icon{
+				margin-bottom: 10rpx;
+				justify-content: flex-end;
+			}
+		}
+	}
+	.bottom{
+		font-size: 24rpx;
+		.left{color: #333;}
+		.right{
+			.btn{
+				padding: 12rpx 20rpx;
+				border: 1px solid #333;
+				text-align: center;
+				margin-left: 20rpx;
+				border-radius: 28rpx;
+				&.red{border-color: #FF3C3F;}
+				&.green{color: #00A447;border-color: #00A447;}
+			}
+		}
+	}
+	&.status-0{.status{color:#FF3C3F;}}
+	&.status-1{.status{color:#FF3C3F;}}
+	&.status-2{.status{color:#0099EB;}}
+	&.status-3{.status{color:#00A447;}}
+	&.status-4{.status{color:#FF3C3F;}}
+	&.status-5{.status{color:#FF3C3F;}}
+	&.status-6{.status{color:#FF3C3F;}}
+	&.status-7{.status{color:#FFB100;}}
+}
+</style>

+ 259 - 0
shopping/orderdetails.vue

@@ -0,0 +1,259 @@
+<template>
+    <view class="">
+		<u-navbar
+			:title="title"
+			@leftClick="leftClick"
+			:autoBack="true"
+			 :safeAreaInsetTop="true"
+		>
+		</u-navbar>
+        <view class="addr page-wrap u-flex u-row-between">
+        	<view class="left">
+        		<view class="top">
+        			<text class="label" v-if="isDefaultAddr">默认</text>{{theAddr.address}}
+        		</view>
+				<view class="center">{{theAddr.receiveAdress}}</view>
+				<view class="bottom">{{theAddr.receiveName}} {{theAddr.receivePhone}}</view>
+        	</view>
+			<!-- <u-icon name="arrow-right" color="#676767" size="20" @click="selectAddr"></u-icon> -->
+        </view>
+		<!-- <view class="payway page-wrap u-flex u-row-between">
+			<view class="left">支付方式</view>
+			<view class="u-flex">
+				微信支付
+				<u-icon name="arrow-right" color="#676767" size="20"></u-icon>
+			</view>
+		</view> -->
+		<view class="order-product page-wrap">
+			<view class="product u-flex" v-for="(item,index) in dataList" :key="item.id">
+				<u--image :showLoading="true" :src="item.mainImg" width="180rpx" height="180rpx"></u--image>
+				<view class="text">
+					<view class="up">
+						<view class="name ellipsis-2">{{item.goodsName}}</view>
+						<view class="info">
+							{{item.specification}}
+							{{item.unit}}
+						</view>
+					</view>
+					<view class="down u-flex u-row-between">
+						<view class="left">
+							<view class="" v-if="vuex_member_info.levelType>1">
+								<text class="price">¥ <text class="price-num">{{item.vipPrice}}</text></text>
+								<text class="vip-icon">VIP</text>
+								<text class="original-price gray line-through">¥ {{item.salePrice}}</text>
+							</view>
+							<view class="" v-else>
+								<text class="price">¥ <text class="price-num">{{item.salePrice}}</text></text>
+							</view>
+						</view>
+						<u-number-box v-model="item.quantity" @change="changeQuantity(index, $event)" integer></u-number-box>
+					</view>
+				</view>
+			</view>
+		</view>
+		<view class="page-wrap order-reduced">
+			<view class="reduced-item u-flex u-row-between u-border-bottom">
+				<view class="left">
+					<text>优惠券</text>
+					<text class="label">已选一张</text>
+				</view>
+				<view class="right u-flex">
+					<text class="price red">-¥ <text class="price-num">1000</text></text>
+					<!-- <u-icon name="arrow-right" color="#676767" size="20"></u-icon> -->
+				</view>
+			</view>
+			<view class="reduced-item integral u-flex u-row-between">
+				<view class="left">
+					<text>积分</text>
+					<text class="num">3676</text>
+					<text class="tip">满1000可用</text>
+				</view>
+				<view class="right u-flex">
+					<text class="price red" v-if="useIntegral">-¥ <text class="price-num">1000</text></text>
+					<u-checkbox-group @change="integralCheckboxChange">
+						<u-checkbox shape="circle" activeColor="#02AB35" name="integral" ></u-checkbox>
+					</u-checkbox-group>
+				</view>
+			</view>
+		</view>
+		<view class="page-wrap total">
+			<view class="total-item u-flex u-row-between u-border-bottom">
+				<view class="left">
+					商品金额
+				</view>
+				<view class="right">
+					¥2399.00
+				</view>
+			</view>
+			<view class="total-item u-flex u-row-between">
+				<view class="left">
+					运费
+					<text class="gray">总重:40kg</text>
+				</view>
+				<view class="right">
+					+ ¥2399.00
+				</view>
+			</view>
+		</view>
+		<view class="cart-bottom">
+			<view class="inner u-flex u-row-between">
+				<view class="left u-flex">
+					<view class="total-price">
+						待支付:<text class="red">¥4322.00</text>
+					</view>
+				</view>
+				<view class="btn">去结算</view>
+			</view>
+		</view>
+    </view>
+</template>
+<script>
+    export default {
+        data() {
+            return {
+				id:'',
+				title:'订单详情',
+				fromPage:'',
+				useIntegral:false,
+				dataList:[],
+				theAddr:{},
+				isDefaultAddr:false,
+            }
+        },
+		onLoad(page) {
+			// console.log('page',page);
+			this.id = page.id;
+		},
+		onShow() {
+		},
+        methods: {
+			leftClick(e){
+				console.log('leftClick',e);
+			},
+        }
+    }
+</script>
+<style>
+	page{
+		background-color: #F5F5F5;
+		/* padding-top: 50px; */
+	}
+</style>
+<style lang="scss" scoped>
+.page-wrap{
+	background-color: #fff;
+	margin-bottom: 20rpx;
+}
+.addr{
+	.top{
+		margin-bottom: 16rpx;
+		font-size: 26rpx;
+		color: #999;
+		.label{
+			background-color: #FFEBEB;
+			border: 1px solid #FF5F62;
+			color: #FF5F62;
+			padding: 5rpx 20rpx;
+			border-radius: 30rpx;
+			margin-right: 10rpx;
+		}
+	}
+	.center{
+		margin-bottom: 10rpx;
+		font-size: 30rpx;
+		color: #333;
+		line-height: 50rpx;
+		font-weight: 600;
+	}
+	.bottom{
+		font-size: 30rpx;
+		color: #666;
+	}
+}
+.order-reduced{
+	.reduced-item{
+		padding-bottom: 30rpx;
+		&:not(:last-child){
+			margin-bottom: 30rpx;
+		}
+		.label{
+			border-radius: 2px;
+			border: 1px solid #FF3C3F;
+			margin-left: 20rpx;
+			font-size: 20rpx;
+			color: #FF3C3F;
+			padding: 0 10rpx;
+		}
+	}
+	.integral{
+		.num{
+			font-size: 30rpx;
+			color: #02AB35;
+			font-weight: 600;
+			margin-left: 30rpx;
+			margin-right: 16rpx;
+		}
+		.tip{
+			font-size: 24rpx;
+			color: #999;
+		}
+		.price{
+			margin-right: 10rpx;
+		}
+	}
+}
+.total{
+	.total-item{
+		padding-bottom: 30rpx;
+		&:not(:last-child){
+			margin-bottom: 30rpx;
+		}
+		.right{
+			font-weight: 600;
+		}
+	}
+	.gray{
+		font-size: 24rpx;
+		margin-left: 15rpx;
+	}
+}
+.cart-bottom{
+	height: 98rpx;
+	.inner{
+		position: fixed;
+		background-color: #fff;
+		height: 98rpx;
+		left: 0;
+		right: 0;
+		bottom: 0;
+		padding: 0 20rpx;
+		.total-price{
+			font-size: 30rpx;
+			color: #333;
+			font-weight: 600;
+			margin-left: 30rpx;
+		}
+		.btn{
+			height: 80rpx;
+			line-height: 80rpx;
+			border-radius: 50rpx;
+			padding: 0 50rpx;
+			background-color: #FF3C3F;
+			color: #fff;
+			text-align: center;
+		}
+	}
+}
+.product{
+	.text{
+		.name{
+			height: auto;
+		}
+		.info{
+			font-size: 24rpx;
+			font-weight: 400;
+			color: #666666;
+		}
+	}
+}
+</style>

+ 4 - 2
shopping/producTypetList.vue

@@ -11,6 +11,7 @@
 				placeholder="输入搜索内容" 
 				prefixIcon="search" 
 				shape="circle"
+				v-model="params.goodsName"
 				@confirm="search"
 				:customStyle="{'border-color':'#00A447!important'}"
 				prefixIconStyle="font-size: 22px;color: #333"></u--input>
@@ -205,11 +206,12 @@
 				this.mescroll.resetUpScroll();
 			},
 			search(e){
-				console.log('search',e)
+				this.reloadList();
 			},
 			getgoodsTypeTree(){
 				this.$u.api.goodsTypeTree().then(res=>{
-					this.goodsTypeTree = res.data;
+					this.goodsTypeTree = res.data.filter(item=> item.child.length>0);
+					console.log('this.goodsTypeTree',this.goodsTypeTree);
 					let data = uni.$u.deepClone(this.goodsTypeTree[this.typesIndex]);
 					// console.log('this.goodsTypeTree',this.goodsTypeTree);
 					// console.log('data',data);

+ 31 - 6
shopping/productList.vue

@@ -40,23 +40,26 @@
 										<text class="sales gray">销量 {{item.saleCount}}</text>
 									</view>
 								</view>
-								<u--image :showLoading="false" :src="staticUrl+'/img/add.png'" width="48rpx" height="48rpx"></u--image>
+								<u--image :showLoading="false" @click.native.stop="addCart(item.id)" :src="staticUrl+'/img/add.png'" width="48rpx" height="48rpx"></u--image>
 							</view>
 						</view>
 					</view>
 				</view>
 			</view>
 		</mescroll-body>
+		<cartfixed ref="cartfixed" @getCartList="getCartList" />
+		<u-toast ref="uToast"></u-toast>
 	</view>
 </template>
 
 <script>
 	// 引入mescroll-mixins.js
 	import MescrollMixin from "@/uni_modules/mescroll-uni/components/mescroll-uni/mescroll-mixins.js";
+	import cartfixed from "../components/cartfixed.vue"
 	export default {
 		mixins: [MescrollMixin], // 使用mixin
 		components: {
-			
+			cartfixed
 		},
 		data() {
 			return {
@@ -86,6 +89,9 @@
 			this.params.typeId = page.typeId;
 			this.typeName = page.typeName||'产品';
 		},
+		onShow() {
+			this.$refs.cartfixed.getCartList();
+		},
 		methods: {
 			/*下拉刷新的回调, 重置列表为第一页 (此处可删,mixins已默认)
 			downCallback(){
@@ -99,18 +105,23 @@
 				// }
 
 				// 如果希望先请求其他接口,再触发upCallback,可参考以下写法
-				if(!this.params.typeId){
-					
+				let nameSearchArr = ['特价专区','爆款专区'];
+				if(!this.params.typeId && !nameSearchArr.includes(this.typeName)){
+					this.mescroll.endErr()
 					return // 此处return,先获取xx
 				}
 
 				let pageNum = page.num; // 页码, 默认从1开始
 				let pageSize = page.size; // 页长, 默认每页10条
-				if(this.typeName=='爆款专区'){
+				if(this.typeName=='特价专区'){
+					this.params.typeId = '';
+					this.params.isSpecial = 1;
+				}else if(this.typeName=='爆款专区'){
 					this.params.typeId = '';
 					this.params.isExplode = 1;
 				}
 				this.params = Object.assign(this.params,{pageNum:pageNum,pageSize:pageSize});
+				console.log('this.params',this.params);
 				this.$u.api.memberGoodList(this.params).then(data => {
 					console.log('data',JSON.parse(JSON.stringify(data)));
 					// 接口返回的当前页数据列表 (数组)
@@ -144,8 +155,22 @@
 				this.mescroll.resetUpScroll();
 			},
 			search(e){
-				this.reloadList();
+				this.mescroll.resetUpScroll();
+				// this.reloadList();
 				console.log('search',e)
+			},
+			addCart(id){
+				// console.log('addCart',id);
+				this.$u.api.addCart({goodsId:id}).then(res=>{
+					this.$refs.uToast.show({
+						type:"success",
+						message:res.msg
+					});
+					this.$refs.cartfixed.getCartList();
+					console.log('res',res);
+					}).catch(err=>{
+					console.log('addCart',err.data);
+				})
 			}
 		}
 	}

+ 91 - 11
shopping/submitorder.vue

@@ -10,22 +10,46 @@
         <view class="addr page-wrap u-flex u-row-between">
         	<view class="left">
         		<view class="top">
-        			<text class="label">默认</text>广东省广州市越秀区
+        			<text class="label" v-if="isDefaultAddr">默认</text>{{theAddr.address}}
         		</view>
-				<view class="center">顶峰路334号腾讯大厦32楼3002号</view>
-				<view class="bottom">张小娴 185 4568 8877</view>
+				<view class="center">{{theAddr.receiveAdress}}</view>
+				<view class="bottom">{{theAddr.receiveName}} {{theAddr.receivePhone}}</view>
         	</view>
 			<u-icon name="arrow-right" color="#676767" size="20" @click="selectAddr"></u-icon>
         </view>
-		<view class="payway page-wrap u-flex u-row-between">
+		<!-- <view class="payway page-wrap u-flex u-row-between">
 			<view class="left">支付方式</view>
 			<view class="u-flex">
 				微信支付
 				<u-icon name="arrow-right" color="#676767" size="20"></u-icon>
 			</view>
-		</view>
+		</view> -->
 		<view class="order-product page-wrap">
-			
+			<view class="product u-flex" v-for="(item,index) in dataList" :key="item.id">
+				<u--image :showLoading="true" :src="item.mainImg" width="180rpx" height="180rpx"></u--image>
+				<view class="text">
+					<view class="up">
+						<view class="name ellipsis-2">{{item.goodsName}}</view>
+						<view class="info">
+							{{item.specification}}
+							{{item.unit}}
+						</view>
+					</view>
+					<view class="down u-flex u-row-between">
+						<view class="left">
+							<view class="" v-if="vuex_member_info.levelType>1">
+								<text class="price">¥ <text class="price-num">{{item.vipPrice}}</text></text>
+								<text class="vip-icon">VIP</text>
+								<text class="original-price gray line-through">¥ {{item.salePrice}}</text>
+							</view>
+							<view class="" v-else>
+								<text class="price">¥ <text class="price-num">{{item.salePrice}}</text></text>
+							</view>
+						</view>
+						<u-number-box v-model="item.quantity" @change="changeQuantity(index, $event)" integer></u-number-box>
+					</view>
+				</view>
+			</view>
 		</view>
 		<view class="page-wrap order-reduced">
 			<view class="reduced-item u-flex u-row-between u-border-bottom">
@@ -87,11 +111,22 @@
     export default {
         data() {
             return {
+				fromPage:'',
 				useIntegral:false,
+				dataList:[],
+				theAddr:{},
+				isDefaultAddr:false,
             }
         },
 		onLoad(page) {
-			console.log('page',page);
+			// console.log('page',page);
+			// console.log('selectGoods',JSON.parse(page.selectGoods));
+			this.dataList = JSON.parse(page.selectGoods);
+		},
+		onShow() {
+			if(this.fromPage!='addrlist'){
+				this.getAddrList()
+			}
 		},
         methods: {
 			leftClick(e){
@@ -101,10 +136,43 @@
 				this.useIntegral = e[0] && e[0] === 'integral' ? true : false;
 			},
 			selectAddr(){
-				uni.$u.route('/pages/center/addrlist', {
+				uni.$u.route('/center/addrlist', {
 					from: 'submitorder'
 				});
-			}
+			},
+			getAddrList(){
+				this.$u.api.addrList().then(res=>{
+					this.theAddr = res.data.rows;
+					let defaultAddress;
+					let firstAddress = res.data.rows[0];
+					 res.data.rows.forEach(address => {
+					  if (address.ifDefault) { // 如果有默认地址标识
+						defaultAddress = address;
+						this.isDefaultAddr = true;
+					  }
+					});
+				
+					if (!defaultAddress) { // 如果没有默认地址标识
+					  defaultAddress = firstAddress;
+					}
+					this.theAddr = defaultAddress;
+				}).catch(err=>{
+					console.log('getAddrList',err.data);
+				})
+			},
+			// 改变商品数量
+			changeQuantity(index, value) {
+				
+				this.changeQuantityApi(this.dataList[index].id,value.value)
+			},
+			changeQuantityApi(id,num){
+				this.$u.api.updateQuantity({id:id,quantity:num}).then(res=>{
+					// this.dataList[index].quantity = num
+					console.log('res',res.data);
+					}).catch(err=>{
+					console.log('changeQuantityApi',err.data);
+				})
+			},
         }
     }
 </script>
@@ -134,8 +202,8 @@
 		}
 	}
 	.center{
-		margin-bottom: 16rpx;
-		font-size: 36rpx;
+		margin-bottom: 10rpx;
+		font-size: 30rpx;
 		color: #333;
 		line-height: 50rpx;
 		font-weight: 600;
@@ -219,4 +287,16 @@
 		}
 	}
 }
+.product{
+	.text{
+		.name{
+			height: auto;
+		}
+		.info{
+			font-size: 24rpx;
+			font-weight: 400;
+			color: #666666;
+		}
+	}
+}
 </style>

+ 1 - 1
utils/filter.js

@@ -82,7 +82,7 @@ Vue.filter("filterToFixed", function(val) {
 
 // 订单状态
 Vue.filter("filterOrderState", function(val) {	
-	let orderList = ['审核中', '待付款', '待发货', '待收货', '已完成', '售后', '已关闭', '酒业出库', '物流出库']
+	let orderList = ['待支付', '待出库', '待收货', '待评论', '己取消', '己退款', '己完成', '待退款']
 	return orderList[val]
 });
 

+ 17 - 2
xushuo/dynamicdetails.vue

@@ -27,6 +27,7 @@ export default{
 	data(){
 		return{
 			id:null,
+			type:'',
 			pageData:{
 				title:'',
 				content:''
@@ -35,8 +36,14 @@ export default{
 	},
 	onLoad(page) {
 		this.id = page.id;
-		this.getDetails(this.id);
-		this.addViewCount(this.id);
+		this.type = page.type;
+		if(this.type=='swiperDetail'){
+			this.swiperDetails(this.id);
+		}else{
+			this.getDetails(this.id);
+			this.addViewCount(this.id);
+		}
+		
 	},
 	methods:{
 		getDetails(id){
@@ -47,6 +54,14 @@ export default{
 				console.log('shopNews',err.data);
 			})
 		},
+		getSwiperDetails(id){
+			this.$u.api.swiperDetails({id:id}).then(res=>{
+				this.pageData = res.data;
+				// console.log('res',res);
+				}).catch(err=>{
+				console.log('getSwiperDetails',err.data);
+			})
+		},
 		addViewCount(id){
 			this.$u.api.addViewCount({id:id}).then(res=>{
 				// console.log('res',res);