Kaynağa Gözat

下单地址运费多次触发

wcni 5 yıl önce
ebeveyn
işleme
316b07f944

+ 3 - 3
common/request.js

@@ -3,8 +3,8 @@ const request = function(options) {
      options.url = baseUrl + options.url;
      try {
        // 获取放入缓存的字段token obj.header["token"] = userToken;
-      //const token = uni.getStorageSync('sessionId');
-	   const token = 'eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJodHRwczpcL1wvd3d3LnF6YWl3YW5nLmNvbSIsImlhdCI6MTU5MTI0MDg5NiwiZXhwIjoxNTkyMTA0ODk2LCJuYmYiOjE1OTEyNDA4OTYsInN1YiI6MTAwLCJwcnYiOiJlOWEzOWM4YWY2MDFmMjRjM2YwN2Y0NDYzMjJhNTZjODA1YzVjZGU2In0.gJTUiEVvMtHv8GGzUWZO_OSsG0hSrJ4sQDdCrtqQcTM';
+      const token = uni.getStorageSync('sessionId');
+	  // const token = 'eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJodHRwczpcL1wvd3d3LnF6YWl3YW5nLmNvbSIsImlhdCI6MTU5MTI0MDg5NiwiZXhwIjoxNTkyMTA0ODk2LCJuYmYiOjE1OTEyNDA4OTYsInN1YiI6MTAwLCJwcnYiOiJlOWEzOWM4YWY2MDFmMjRjM2YwN2Y0NDYzMjJhNTZjODA1YzVjZGU2In0.gJTUiEVvMtHv8GGzUWZO_OSsG0hSrJ4sQDdCrtqQcTM';
        if (token) { // 如果存在token 配置请求头
          options.header = {
            'X-TOKEN' : token,
@@ -14,7 +14,7 @@ const request = function(options) {
            // uni.navigateTo({
            // 	url:'/pages/myCenter/logion'
            // })
-		 //  return;
+		 //return;
         }
      } catch (err) {
       console.log(err)

+ 0 - 153
component/navTab.vue

@@ -1,153 +0,0 @@
-<template>
-	<view class="navTabBox">
-		<view class="longTab">
-			<scroll-view scroll-x="true" style="white-space: nowrap; display: flex" scroll-with-animation :scroll-left="isLeft-changeLeft">
-				<view
-					class="longItem"
-					:style="'min-width:' + isWidth + 'px'"
-					:data-index="index"
-					:class="index === tabClick ? 'click' : ''"
-					v-for="(item, index) in tabTitle"
-					:key="index"
-					:id="'id' + index"
-					@click="longClick(index)"
-				>
-					{{ item }}
-				</view>
-				<view class="underlineBox" :style="'transform:translateX(' + isLeft + 'px);width:' + lineWidth + 'px'"><view class="underline"></view></view>
-			</scroll-view>
-		</view>
-	</view>
-</template>
-
-<script>
-export default {
-	name: 'navTab',
-	props: {
-		tabTitle: {
-			type: Array
-		}
-	},
-	data() {
-		return {
-			tabClick: 0, //导航栏被点击
-			isLeft: 0, //导航栏下划线位置
-			isWidth: 0, //每个导航栏占位
-			tabLeft: 0,
-			leftList:[],
-			lineWidth:0,
-			wWidth:0
-		};
-	},
-	computed: {
-		changeLeft() {
-			return this.wWidth/2 - this.leftList[this.tabClick]/2
-		}
-	},
-	created() {
-		var that = this;
-		// 获取设备宽度
-		uni.getSystemInfo({
-			success(e) {
-				that.wWidth = e.windowWidth;
-				if (that.tabTitle.length <= 5) {
-					that.isWidth = e.windowWidth / that.tabTitle.length; //宽度除以导航标题个数=一个导航所占宽度
-				} else {
-					that.isWidth = e.windowWidth / 5;
-				}
-			}
-		});
-		console.log('load')
-	},
-	onReady() {
-		console.log('ready')
-		const query = uni.createSelectorQuery().in(this);
-		query.selectAll('.longItem').boundingClientRect(data => {
-		  console.log(data)
-		  this.leftList = data.map((item,index)=>{
-			  return item.width
-		  })
-		  this.lineWidth = this.leftList[0]
-		}).exec();
-		console.log(this.leftList)
-	},
-	methods: {
-		// 导航栏点击
-		longClick(index) {
-			this.tabClick = index; //设置导航点击了哪一个
-			// this.isLeft = index * this.isWidth; //设置下划线位置
-			this.isLeft = this.leftList.reduce((acc,cur,curIndex)=>{
-				if(curIndex <index){
-					return acc+cur
-				}else{
-					return acc
-				}
-			},0); //设置下划线位置
-			this.lineWidth = this.leftList[index]
-			console.log(this.isLeft)
-			this.$emit('changeTab', index); //设置swiper的第几页
-			// this.$parent.currentTab = index //设置swiper的第几页
-		}
-	}
-};
-</script>
-
-<style lang="scss">
-.navTabBox {
-	width: 100vw;
-	color: rgba(255, 255, 255, 0.5);
-	.click {
-		color: white;
-	}
-	.longTab {
-		width: 100%;
-		.longItem {
-			height: 90upx;
-			display: inline-block;
-			line-height: 90upx;
-			text-align: center;
-		}
-		.underlineBox {
-			height: 3px;
-			width: 20%;
-			display: flex;
-			align-content: center;
-			justify-content: center;
-			transition: 0.5s;
-			.underline {
-				width: 84upx;
-				height: 4px;
-				background-color: white;
-			}
-		}
-	}
-	.shortTab {
-		width: 100%;
-		.navTab {
-			display: flex;
-			width: 100%;
-			height: 90upx;
-			position: relative;
-			.navTabItem {
-				display: flex;
-				align-items: center;
-				justify-content: center;
-				width: 100%;
-				font-size: 28upx;
-			}
-		}
-		.underlineBox {
-			height: 3px;
-			display: flex;
-			align-content: center;
-			justify-content: center;
-			transition: 0.5s;
-			.underline {
-				width: 84upx;
-				height: 3px;
-				background-color: white;
-			}
-		}
-	}
-}
-</style>

+ 8 - 5
pages/index/cart.vue

@@ -167,11 +167,14 @@
 						 goods: JSON.stringify(goods)
 					 },
 					 success:(res) => {
-						 let order_id = res.data.data.order_id;
-						 let store = this.store.store_id;
-						 uni.navigateTo({
-						   url: `/pages/index/sureBuy?store=${store}&prices=${prices}&order_id=${order_id}`
-						 });
+						 if(res.data.code == 1000) {
+							 let order_id = res.data.data.order_id;
+							 let store = this.store.store_id;
+							 uni.navigateTo({
+							   url: `/pages/index/sureBuy?store=${store}&prices=${prices}&order_id=${order_id}`
+							 });
+						 }
+						
 					 }
 				 })
 			},

+ 1 - 0
pages/index/index.vue

@@ -331,6 +331,7 @@
 			_this.amapPlugin.getRegeo({  
 				success: (data) => {
 					console.log(data);
+					console.log(data.formatted_address);
 					this.isrefesh = true;
 					this.location = data[0].name;
 					this.lat = data[0].latitude; // 经度

+ 14 - 5
pages/index/sureBuy.vue

@@ -213,12 +213,17 @@
 			// this.prices = prices; 
 			this.getorder(); // 获取订单详情
 			 uni.$on("getadress",(adress)=>{
+				    console.log("klkkkk")
 			        this.choseadress = adress;
 					this.address_id = this.choseadress.address_id;
 					//this.getorder();
 					this.getralodprice();
 			 })
 		},
+		onUnload() {
+			uni.$off();
+		},
+		
 		methods: {
 			readshouknow() {
 				this.ishow = true;
@@ -361,11 +366,15 @@
 						remark: this.remark
 					},
 					success: (res) => {
-						let order_id = res.data.data.order_id; // 订单id
-						let prices = this.prices;
-						uni.navigateTo({
-							url:`/pages/myOrder/paymoment?order_id=${order_id}&prices=${prices}`
-						})
+						if(res.data.code == 1000) {
+							let order_id = res.data.data.order_id; // 订单id
+							let prices = this.prices;
+							let isform = 2;
+							uni.navigateTo({
+								url:`/pages/myOrder/paymoment?order_id=${order_id}&prices=${prices}?isform=${isform}`
+							})
+						}
+						
 					}
 				})
 			},

+ 1 - 3
pages/myCenter/index.vue

@@ -10,12 +10,11 @@
 						<image :src="userInfo.avatarUrl"></image>
 					</view>
                     <view v-if="successlogion&&hasLogin">
-						<view  style="font-size: 34upx;margin-bottom: 32upx;">{{menberinfo.member_name}}</view>
+						<view  style="font-size: 34upx;margin-bottom: 32upx;">{{userInfo.member_name}}</view>
 						<view style="font-size: 24upx"  @click="goAdress(3)" >圈币{{menberinfo.member_points}}></view>
 					</view>
 					
 					<view v-if="!successlogion && hasLogin">
-						
 						<view  style="font-size: 34upx;margin-bottom: 32upx;">{{userInfo.nickName}}</view>
 						<view style="font-size: 24upx"  @click="goAdress(3)" >请绑定手机号></view>
 					</view>
@@ -105,7 +104,6 @@
 		<van-cell @click="goAdress(8)"  title="意见反馈" is-link>
 			<template slot="icon">
 				<image style="width: 29upx;height: 29upx;
-				
 				margin-right: 8upx;
 				vertical-align:middle"
 				src="../../static/service.png" />

+ 5 - 2
pages/myCenter/logion.vue

@@ -57,9 +57,9 @@
 				let  that = this;
 				    uni.getUserInfo({
 					     success: (res) => {
-							 console.log(res.userInfo);
 							 that.login(res.userInfo);
 							 that.showDialog(true); // 改变haslogion的值
+							 console.log(this.userInfo);
 							 that.$msg("授权成功");
 							 if(this.successlogion) {
 								uni.navigateBack();
@@ -81,6 +81,7 @@
 							  console.log(this.getcode);
 											let encryptedData = e.detail.encryptedData;
 											let iv = e.detail.iv;
+											console.log(this.userInfo);
 											// 调取注册账号
 											this.request({
 												url: '/v1/entry/mp_account',
@@ -88,7 +89,9 @@
 												data: {
 													code: this.getcode.code,
 													encryptedData: encryptedData,
-													iv: iv
+													iv: iv,
+													name: this.userInfo.nickName,
+													avatar: this.userInfo.avatarUrl
 												},
 												success: (res) => {
 													let token = res.data.data.token;

+ 4 - 7
pages/myOrder/adress.vue

@@ -63,7 +63,6 @@
 			  })
 		},
 		methods: {
-			
 			// 全选
 			onChange(a) {
 				this.isAll = !this.isAll;
@@ -82,8 +81,6 @@
 						  this.checkboxList = [];
 						  this.pricelist = [];
 					}
-					
-				
 			},
 			
 			// 地址管理
@@ -103,13 +100,13 @@
 					 price.push(array[item].address_id)
 				})
 				this.pricelist = price;
-			
-				  
-			   
 			},
 			// 删除地址
 			onClickButton() {
-				
+				if(this.pricelist.length == 0) {
+					this.$msg("赶快去新增地址吧");
+					return;
+				}
 				let address_ids = this.pricelist.join(',');
 				this.request({
 					url: '/v1/member/address_drop',

+ 6 - 6
pages/myOrder/adressManger.vue

@@ -20,7 +20,7 @@
 			<view style="display: flex;flex-direction: row;justify-content: space-between;padding:40upx 32upx;">
 				<view>请选择</view>
 				<view>{{adress}}</view>
-				<view>确定</view>
+				<view @click="cancelCity">确定</view>
 			</view>
 			<scroll-view style="height: 100%;"  :scroll-top="scrollTop" scroll-y="true"  @scroll="scroll"  @scrolltoupper="upper" @scrolltolower="lower"
 			  refresher-enabled="true">
@@ -133,10 +133,10 @@
 			cancelCity() {
 				this.show = false;
 			},
-			choseCity(e) {
-				console.log(e);
-				this.show = false;
-			},
+			// choseCity(e) {
+			// 	console.log(e);
+			// 	this.show = false;
+			// },
 			
 			//提交
 			confirm(){ 
@@ -164,7 +164,7 @@
 				params.address_mob_phone= data.mobile;
 				params.address_realname= data.name;
 				params.area_info= data.addressName;
-				params.is_free=0
+				params.is_free=0;
 				if(this.manageType == 'edit') {
 					url = '/v1/member/address_edit';
 					params.address_id = this.address_id;

+ 16 - 5
pages/myOrder/finsh.vue

@@ -13,19 +13,30 @@
 	export default {
 		data() {
 			return{
-				order_id:''
+				order_id:'',
+				isform: 0,
 			}
 		},
 		onLoad(e) {
+			console.log(e);
 			this.order_id = e.order_id;
+			this.isform = e.isform; // 1 从订单过来  2 从购物车过来
 		},
 		methods:{
 			// ji xu gou wu
 			submitRemin() {
-				uni.$emit('finshlist')
-				uni.navigateBack({
-				    delta: 2
-				});
+				console.log(this.isform);
+				if(this.isform == 1) {
+					uni.switchTab({
+						url: '/pages/myOrder/index'
+					})
+					uni.$emit('finshlist');
+				}else {
+					uni.navigateTo({
+						url: '/pages/index/cart'
+					})
+				}
+				
 			},
 			// cha kan ding dan xiang qing 
 			lookfor() {

+ 12 - 4
pages/myOrder/index.vue

@@ -1,6 +1,6 @@
 <template>
 	<view>
-		<van-tabs :active="active"  @change="changeselect" >
+		<van-tabs :active="active"  @change="changeselect" style="width: 20%!important;">
 		  <van-tab v-for="(item, index) in menu" :name="index" :title="item.name">
 		  </van-tab>
 		</van-tabs>
@@ -120,7 +120,7 @@
 			      this.getlist();
 			  })
 			
-			  uni.$on(" finshlist",()=>{
+			  uni.$on("finshlist",()=>{
 				  this.page = 1;
 			  	  this.order_list = [];
 			      this.getlist();
@@ -140,6 +140,10 @@
 				})
 			}
 		},
+		onUnload() {
+			uni.$off();
+		},
+		
 		watch:{
 			'successlogion':function(val) {
 			   if(val) {
@@ -281,10 +285,10 @@
 				let prices = e.order_amount;
 				this.order_id = e.order_id;
 				let order_id = e.order_id;
-			
+			    let isform = 1;
 				if(e.operate == '去付款') {
 					uni.navigateTo({
-				      url:`/pages/myOrder/paymoment?order_id=${order_id}&prices=${prices}`
+				      url:`/pages/myOrder/paymoment?order_id=${order_id}&prices=${prices}&isform=${isform}`
 				    })
 				}else if(e.operate == '删除') {
 					this.titles = '确认删除订单?'
@@ -414,4 +418,8 @@
 		border: 1px solid #C0C4CC;
 		padding: 8upx;
 	}
+		
+	.van-tab {
+		flex-basis: 20%!important;
+	}
 </style>

+ 6 - 2
pages/myOrder/paymoment.vue

@@ -53,9 +53,12 @@
 			}
 		},
 		onLoad(e) {
+			console.log(e);
+			console.log("支付");
 			this.prices = e.prices;
 			this.order_id = e.order_id;
 			this.getuserInfo();
+			this.isform = e.isform;
 			//this.ratio_points = e.ratio_points;
 			// this.isform = e.isform;  // 1 dingdanfukuanguolai
 			// if(this.ratio_points > 0) {
@@ -109,8 +112,9 @@
 					success: (res) => {
 						if(res.data.code == 1000) {
 							setTimeout(()=> {
+								let isform = this.isform;
 								uni.navigateTo({
-									url: `/pages/myOrder/finsh?isform=${this.isform}&order_id=${this.order_id}`
+									url: `/pages/myOrder/finsh?isform=${isform}&order_id=${this.order_id}`
 								})
 								//uni.navigateBack()
 							}, 1000)
@@ -143,7 +147,7 @@
 								    signType: 'MD5',
 								    paySign: wx.paySign,
 								    success:  (res) => {
-										let isform = 2;
+										let isform = this.isform;
 										let order_id = this.order_id;
 										uni.navigateTo({
 											url: `/pages/myOrder/finsh?isform=${isform}&order_id=${order_id}`