gcz hace 2 años
padre
commit
7b84be1085

+ 12 - 3
center/addrForm.vue

@@ -54,6 +54,7 @@
 		},
 		data() {
 			return {
+				fromPage:'',
 				saveType:'',
 				id:'',
 				showMap:false,
@@ -113,6 +114,7 @@
 			if(this.id){
 				this.getAddrById(this.id)
 			}
+			this.fromPage = page.from;
 		},
 		onReady() {
 			//如果需要兼容微信小程序,并且校验规则中含有方法等,只能通过setRules方法设置规则。
@@ -154,9 +156,16 @@
 			addAddr(){
 				this.$u.api.addAddr(this.model).then(res=>{
 					// console.log('res',res);
-					uni.$u.route('/center/addrlist', {
-						type: 'redirectTo'
-					});
+					if(this.fromPage=='cart'){
+						uni.$u.route('/shopping/cart', {
+							// type: 'redirectTo'
+						});
+					}else{
+						uni.$u.route('/center/addrlist', {
+							type: 'redirectTo'
+						});
+					}
+					
 				}).catch(err=>{
 					console.log('addAddr',err.data);
 				})

+ 1 - 1
center/addrlist.vue

@@ -65,7 +65,7 @@
 				console.log('leftClick',e);
 			},
 			newAddr(){
-				uni.$u.route('/center/addrForm', {type: 'add'});
+				uni.$u.route('/center/addrForm', {type: 'add',from:this.fromPage});
 			},
 			editAddr(item){
 				uni.$u.route('/center/addrForm', {type: 'edit',id:item.id});

+ 1 - 0
center/center.vue

@@ -152,6 +152,7 @@
 <style>
 page{
 	background-color: #F5F5F5;
+	padding-top: 60px;
 }
 </style>
 <style lang="scss" scoped>

+ 10 - 0
common/apiurl.js

@@ -189,6 +189,16 @@ const apiurl = {
 		url: '/order/refundSubmit',
 		type: 'post'
 	},
+	// 订单退款详情
+	refundInfo: {
+		url: '/order/refundInfo',
+		type: 'post'
+	},
+	// 订单确认收货
+	confirmReceipt: {
+		url: '/order/confirm',
+		type: 'post'
+	},
 	// 订单查询物流
 	getDilevery: {
 		url: '/order/getDilevery',

+ 5 - 1
components/tabbar.vue

@@ -114,7 +114,7 @@ export default {
 			1: {
 			  url: '/shopping/producTypetList',
 			  query: {
-				type: 'reLaunch'
+				navType: 'navigateTo'
 			  }
 			},
 			2: '/xushuo/xushuo',
@@ -127,6 +127,10 @@ export default {
 		  if (typeof targetRoute === 'string') {
 			uni.reLaunch({url: targetRoute});
 		  } else if (typeof targetRoute === 'object') {
+			  if(targetRoute.query.navType=='navigateTo'){
+				  this.$u.route(targetRoute.url, targetRoute.query);
+				  return
+			  }
 			let queryParams = uni.$u.queryParams(targetRoute.query);
 			uni.reLaunch({url: targetRoute.url+queryParams});
 		  }

+ 7 - 0
pages.json

@@ -164,6 +164,13 @@
 						"navigationBarTitleText": "申请退款",
 						"navigationStyle": "custom"
 					}
+				},
+				{
+					"path": "viewRefund",
+					"style": {
+						"navigationBarTitleText": "查看退款",
+						"navigationStyle": "custom"
+					}
 				}
 			]
 		},

+ 4 - 3
pages/index/index.vue

@@ -29,7 +29,7 @@
 				</view>
 				<view class="u-flex">
 					<u-icon :size="advantageSize" class="icon" :name="staticUrl+'/img/pei.png'"></u-icon>
-					假一赔十
+					会员服务
 					</view>
 				<view class="u-flex">
 					<u-icon :size="advantageSize" class="icon" :name="staticUrl+'/img/rmb.png'"></u-icon>
@@ -38,10 +38,10 @@
 			</view>
 			
 			<view class="icon-nav u-flex u-row-around">
-				<view class="nav-item" @click="$u.route('/shopping/paysuccess',{type:'reLaunch'})">
+				<!-- <view class="nav-item" @click="$u.route('/shopping/paysuccess',{type:'reLaunch'})">
 					<u--image class="image" :src="staticUrl+'/img/index-nav-4.png'" width="101rpx" height="101rpx"></u--image>
 					需要删除
-				</view>
+				</view> -->
 				<view class="nav-item" @click="$u.route('/shopping/productList',{typeId:1,typeName:'特价专区',type:'reLaunch'})">
 					<u--image class="image" :src="staticUrl+'/img/index-nav-1.png'" width="101rpx" height="101rpx"></u--image>
 					特价专区
@@ -201,6 +201,7 @@
 <style>
 page{
 	background-color: #F9F9F9;
+	padding-top: 60px;
 }
 </style>
 <style lang="scss" scoped>

+ 17 - 11
pages/login/login.vue

@@ -216,17 +216,23 @@
 				let _this = this;
 				this.$u.api.memberInfo({id:userid}).then(res=> {
 					if(res.code ===200) {
-						this.$u.vuex('vuex_member_info', res.data)
-						if(res.data.name){
-							_this.hasUserInfo = true;
-							_this.userInfo = res.data;
-							uni.navigateTo({
-								url: '/pages/index/index'
-							})
-						}else{
-							_this.showAuthorizeUser = true
-							// uni.hideLoading()
-						}
+						this.$u.vuex('vuex_member_info', res.data);
+						this.$u.vuex('vuex_member_info.avatar', 'https://mmbiz.qpic.cn/mmbiz/icTdbqWNOwNRna42FI242Lcia07jQodd2FJGIYQfG0LAJGFxM4FbnQP6yfMxBgJ0F3YRqJCJ1aPAK2dQagdusBZg/0');
+						this.$u.vuex('vuex_member_info.name', '微信用户');
+						uni.navigateTo({
+							url: '/pages/index/index'
+						})
+						// 下面需要获取微信头像和昵称
+						// if(res.data.name){
+						// 	_this.hasUserInfo = true;
+						// 	_this.userInfo = res.data;
+						// 	uni.navigateTo({
+						// 		url: '/pages/index/index'
+						// 	})
+						// }else{
+						// 	_this.showAuthorizeUser = true
+						// 	// uni.hideLoading()
+						// }
 						// console.log('---------登陆成功')
 						
 					}

+ 50 - 10
shopping/cart.vue

@@ -90,6 +90,7 @@
 				<view class="btn" v-else>去结算</view>
 			</view>
 		</view>
+		<u-toast ref="uToast"></u-toast>
     </view>
 </template>
 <script>
@@ -98,6 +99,7 @@
 		mixins: [MescrollMixin], // 使用mixin
         data() {
             return {
+				hasAddr:false,
 				buyNowId:null,//立即购买id
 				buyNowName:'',//立即购买商品
 				staticUrl:this.$commonConfig.staticUrl,
@@ -160,6 +162,9 @@
 			this.buyNowId = page.buyNowId;
 			this.buyNowName = page.buyNowName;
 		},
+		onShow() {
+			this.getAddrList();
+		},
         methods: {
 			/*下拉刷新的回调, 重置列表为第一页 (此处可删,mixins已默认)
 			downCallback(){
@@ -291,18 +296,41 @@
 			submitorder(){
 				// console.log('submitorder',this.selectGoods);
 				let param = {};
+				if(!this.hasAddr){
+					// this.$refs.uToast.show({
+					// 	type: 'error',
+					// 	title: '提示',
+					// 	message: "请先去'我的-地址管理'设置收货地址!",
+					// 	duration:3000
+					// })
+					uni.showModal({
+						title: '温馨提示',
+						content: '请先设置地址!',
+						success: res => {
+							if (res.confirm) {
+								uni.$u.route('/center/addrlist', {
+									from: 'cart'
+								});
+							}
+						}
+					})
+					return
+				}
 				param.goodsList = this.selectGoods.map(item=>{
 					return {goodsId:item.goodsId,quantity:item.quantity}
 				})
-				// console.log('param',param);
-				this.$u.api.getSettlement(param).then(res=>{
-					uni.$u.route('/shopping/submitorder', {
-						selectGoods: JSON.stringify(res.data),
-					});
-					// console.log('submitorder',res.data);
-				}).catch(err=>{
-					console.log('getSettlement',err.data);
-				})
+				this.$u.vuex('cartGoods', param.goodsList);
+				uni.$u.route('/shopping/submitorder', {});
+				// // console.log('param',param);取消在这个获取订单结算详情
+				// this.$u.api.getSettlement(param).then(res=>{
+				// 	console.log('submitorder',res.data);
+				// 	// return
+				// 	uni.$u.route('/shopping/submitorder', {
+				// 		selectGoods: JSON.stringify(res.data),
+				// 	});
+				// }).catch(err=>{
+				// 	console.log('getSettlement',err.data);
+				// })
 			},
 			delSelect(){
 				let that = this;
@@ -322,7 +350,19 @@
 						}
 					}
 				})
-			}
+			},
+			getAddrList(){
+				this.$u.api.addrList().then(res=>{
+					// this.dataList = res.data.rows;
+					if( res.data.total>0){
+						this.hasAddr = true;
+					}else{
+						this.hasAddr = false;
+					}
+				}).catch(err=>{
+					console.log('getAddrList',err.data);
+				})
+			},
         }
     }
 </script>

+ 53 - 17
shopping/order.vue

@@ -120,10 +120,13 @@
 			// console.log('page',page);
 			const status = page.status;
 			const index = this.tabsList.findIndex(item => item.status === status);
-			this.tabsCurrent = index || 0;
+			this.tabsCurrent = index>=0?index:0;
+			
 		},
 		onShow() {
-			this.hasfetch&&this.reloadList()
+			setTimeout(()=>{
+				this.hasfetch&&this.reloadList()
+			},500)
 		},
 		methods: {
 			leftClick(){
@@ -154,7 +157,7 @@
 				let params = {
 					pageNum : page.num,
 					pageSize :  page.size,
-					status : this.tabsList[this.tabsCurrent].status,
+					status : this.tabsList[this.tabsCurrent]?.status||'',
 					// status : this.tabsList[this.tabsCurrent].status,
 				}
 				// console.log('this.params',params);
@@ -213,7 +216,8 @@
 				  evaluate:this.evaluate,
 				  refund:this.refund,
 				  cancelOrder:this.cancelOrder,
-				  viewRefund:this.viewRefund
+				  viewRefund:this.viewRefund,
+				  confirmReceipt:this.confirmReceipt
 				};
 				// console.log('funObj[fun]',funObj[fun]);
 				if (fun in funObj) {
@@ -248,24 +252,56 @@
 			},
 			cancelOrder(item){
 				let that = this;
+				uni.showModal({
+				    title: '提示',
+				    content: '确认取消吗!',
+				    success: res => {
+				        if (res.confirm) {
+				            this.$u.api.cancelOrder({orderId:item.id}).then(res=>{
+				            	this.$refs.uToast.show({
+				            		message:res.msg,
+				            		complete() {
+				            			that.reloadList();
+				            		}
+				            	});
+				            	// uni.$u.toast(res.msg);
+				            	console.log('res',res.data);
+				            }).catch(err=>{
+				            	console.log('cancelOrder',err);
+				            })
+				        }
+				    }
+				});
 				// console.log('logistics',item);
-				this.$u.api.cancelOrder({orderId:item.id}).then(res=>{
-					this.$refs.uToast.show({
-						message:res.msg,
-						complete() {
-							that.reloadList();
-						}
-					});
-					// uni.$u.toast(res.msg);
-					console.log('res',res.data);
-				}).catch(err=>{
-					console.log('cancelOrder',err);
-				})
+				
 			},
 			viewRefund(item){
 				uni.$u.route('/shopping/viewRefund', {
-					id: item.id
+					orderId: item.id
 				});
+			},
+			confirmReceipt(item){
+				let that = this;
+				uni.showModal({
+				    title: '提示',
+				    content: '确认收货吗!',
+				    success: res => {
+				        if (res.confirm) {
+				            this.$u.api.confirmReceipt({orderId:item.id}).then(res=>{
+								uni.showToast({
+									title:res.msg,
+									duration:2000,
+									complete() {
+										that.reloadList();
+									}
+								});
+				            	console.log('res',res.data);
+				            }).catch(err=>{
+				            	console.log('confirmReceipt',err);
+				            })
+				        }
+				    }
+				})
 			}
 		}
 	}

+ 0 - 1
shopping/orderdetails.vue

@@ -176,7 +176,6 @@
 <style>
 	page{
 		background-color: #F5F5F5;
-		/* padding-top: 50px; */
 	}
 </style>
 <style lang="scss" scoped>

+ 1 - 1
shopping/producTypetList.vue

@@ -88,7 +88,7 @@
 				</mescroll-body>
 			</view>
 		</view>
-		<tabbar :tabbarIndexProps="Number(1)" />
+		<!-- <tabbar :tabbarIndexProps="Number(1)" /> -->
 		<cartfixed ref="cartfixed" @getCartList="getCartList" />
 		<u-toast ref="uToast"></u-toast>
 	</view>

+ 4 - 1
shopping/productdetails.vue

@@ -66,7 +66,9 @@
 		<view class="detail view-wrap">
 			<view class="til">详情</view>
 			<view class="con">
-				{{details.detail}}
+				<!-- <view class="" v-html="details.detail"></view> -->
+				<u-parse :content="details.detail"></u-parse>
+				<!-- {{details.detail}} -->
 			</view>
 		</view>
 		<view class="details-tool-wrap">
@@ -263,6 +265,7 @@
 	}
 	.con{
 		// background-color: #F5F5F5;
+		img{max-width: 100%;}
 	}
 }
 .details-tool-wrap{

+ 16 - 6
shopping/submitorder.vue

@@ -127,13 +127,21 @@
             }
         },
 		onLoad(page) {
-			// console.log('page',page);
-			this.setData(page.selectGoods,true)
+			// this.setData(page.selectGoods)
+			console.log('this.cartGoods',this.cartGoods);
+			if(this.cartGoods){
+				console.log('this',this);
+				this.orderInfo.goodsList = this.cartGoods;
+				this.settlement();
+				// this.getSettlement();
+			}
 		},
 		onShow() {
 			if(this.fromPage=='addrlist'){
 				this.settlement()
 			}
+			console.log('cartGoods===',this.cartGoods);
+			
 		},
 		computed: {
 			totalWeight() {
@@ -192,20 +200,22 @@
 					receiveId:this.receive.id
 				};
 				param.goodsList = this.orderInfo.goodsList.map(item=>{
-					return {goodsId:item.id,quantity:item.quantity}
+					return {goodsId:item.id||item.goodsId,quantity:item.quantity}
 				});
 				console.log('param',param);
 				this.$u.api.getSettlement(param).then(res=>{
 					console.log('res',res.data);
-					this.setData(res.data,false)
+					this.setData(res.data)
 					
 				}).catch(err=>{
 					console.log('getSettlement',err);
 				})
 			},
-			setData(originData,isString){
+			setData(originData){
+				console.log('originData',originData);
+				let dataType = typeof originData;
 				let jsonData;
-				if(isString){
+				if(dataType=='string'){
 					jsonData = JSON.parse(originData);
 				}else{
 					jsonData = originData

+ 116 - 0
shopping/viewRefund.vue

@@ -0,0 +1,116 @@
+<template>
+	<view class="">
+		<u-navbar
+			title="退款/售后"
+			:autoBack="true"
+			 :safeAreaInsetTop="true"
+		>
+		</u-navbar>
+		<view class="page-wrap">
+			<view class="status">{{pageData.status|filterRefundState}}</view>
+			<view class="box">
+				<view class="order-product page-wrap">
+					<view class="product u-flex" v-for="(item,index) in pageData.goodsList" :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">
+									<text class="price">¥ <text class="price-num">{{item.price}}</text></text>
+								</view>
+								<u-number-box v-model="item.quantity" :disabled="true" @change="changeQuantity(index, $event)" integer></u-number-box>
+							</view>
+						</view>
+					</view>
+				</view>
+			</view>
+			<view class="box order-info page-wrap">
+				<view class="order-info-item" v-for="(item,index) in orderInfo" :key="index">
+					<text class="til">{{item.til}}</text>
+					<text class="con">
+						<text v-if="item.isMoney">¥</text>
+						{{pageData[item.con]}}
+					</text>
+				</view>
+			</view>
+		</view>
+	</view>
+</template>
+
+<script>
+	export default {
+		data() {
+			return {
+				orderId:'',
+				pageData:{},
+				orderInfo:[
+					{til:'订单编号',con:'orderNum'},
+					{til:'申请金额',con:'orderAmount',isMoney:true},
+					// {til:'申请件数',con:'quantity'},
+					{til:'申请原因',con:'refundReason'},
+					{til:'问题描述',con:'remark'},
+				]
+			}
+		},
+		onShow() {
+			this.getData()
+		},
+		onLoad(page) {
+			this.orderId =page.orderId
+		},
+		methods: {
+			getData(){
+				this.$u.api.refundInfo({orderId:this.orderId}).then(res=>{
+					this.pageData = res.data
+					console.log('res',res.data);
+				}).catch(err=>{
+					console.log('refundInfo',err);
+				})
+			}
+		}
+	}
+</script>
+<style>
+	page{
+		background-color: #F5F5F5;
+	}
+</style>
+<style lang="scss" scoped>
+.status{
+	text-align: center;
+	font-size: 32rpx;
+	font-weight: 600;
+	color: #FFB100;
+	line-height: 45rpx;
+	margin-bottom: 20rpx;
+}
+.box{
+	background-color: #fff;
+	border-radius: 8rpx;
+	margin-bottom: 20rpx;
+}
+.order-info{
+	.order-info-item{
+		font-size: 30rpx;
+		font-weight: 400;
+		color: #333333;
+		line-height: 42rpx;
+		padding: 30rpx 20rpx;
+		&:not(:last-child){
+			border-bottom: 0.5px solid #eee;
+		}
+		.til{
+			font-size: 24rpx;
+			font-weight: 400;
+			color: #999999;
+			margin-right: 90rpx;
+		}
+	}
+}
+</style>

+ 1 - 0
store/index.js

@@ -35,6 +35,7 @@ const store = new Vuex.Store({
 		vuex_member_info: lifeData.vuex_member_info ? lifeData.vuex_member_info : {},
 		vuex_user_info: lifeData.vuex_user_info ? lifeData.vuex_user_info : {},
 		vuex_wechatOpenid:lifeData.vuex_wechatOpenid ? lifeData.vuex_wechatOpenid : '',
+		cartGoods:[],//购物车商品
 		// vuex_version: '1.0.1',
 	},
 	mutations: {

+ 4 - 1
uni.scss

@@ -79,7 +79,10 @@ $uni-color-paragraph: #3F536E; // 文章段落颜色
 $uni-font-size-paragraph:15px;
 
 page{
-	padding-top: 60px;
+	padding-top: 104px;
+	// &:has(.u-navbar){
+	// 	padding-top: 104px;
+	// }
 }
 // @import url("@/static/css/flex.scss");
 .u-flex {

+ 6 - 0
utils/filter.js

@@ -92,6 +92,12 @@ Vue.filter("filterDilevery", function(val) {
 	return dileveryList[val]
 });
 
+// 退款状态
+Vue.filter("filterRefundState", function(val) {	
+	let dileveryList = ['申请中', '退款成功', '退款失败', '退款中']
+	return dileveryList[val]
+});
+
 // 评分文字
 Vue.filter("rateText", function(val) {	
 	let rateList = ['很差', '差', '一般', '很好', '非常好']

+ 1 - 0
xushuo/xushuo.vue

@@ -168,6 +168,7 @@ page{
 	background-repeat: no-repeat;
 	background-position: left top;
 	background-size: 100% auto;
+	padding-top: 60px;
 }
 </style>
 <style lang="scss" scoped>