Explorar o código

优化订单模块

zhengjinyi hai 1 ano
pai
achega
dc0ca40cbe

+ 9 - 9
components/cm-module/headerNavbar/header-back.vue

@@ -18,6 +18,7 @@
 				lineHeight: navbarBtn.height + 'px;'
 			}"
 		>
+			
 			<text v-if="isShare" @click="handleNavigateBack" class="iconfont icon-shouye"></text>
 			<text v-else @click="handleNavigateBack" class="iconfont icon-fanhui"></text>
 		</view>
@@ -67,7 +68,6 @@ export default {
 	},
 	data() {
 		return {
-			haveBack: true, // 是否有返回按钮,true 有 false 没有 若从分享页进入则为 false
 			statusBarHeight: 0, // 状态栏高度
 			navbarHeight: 0, // 顶部导航栏高度
 			navbarBtn: {
@@ -83,7 +83,7 @@ export default {
 		}
 	},
 	created() {
-		console.log('isShare', this.isShare)
+		
 		let statusBarHeight = this.systeminfo.statusBarHeight // 状态栏高度
 		let headerPosi = this.headerBtnPosi // 胶囊位置信息
 		this.fontSizeSetting = this.systeminfo.fontSizeSetting
@@ -109,17 +109,17 @@ export default {
 			bottom: headerPosi.bottom - headerPosi.height - statusBarHeight, // 屏幕宽度 - 胶囊right
 			right: this.systeminfo.screenWidth - headerPosi.right
 		}
-		let haveBack
 		if (getCurrentPages().length === 1) {
 			// 当只有一个页面时
-			haveBack = false
+			this.haveBack = false // 获取是否是通过分享进入的小程序
 		} else {
-			haveBack = true
+			this.haveBack = true // 获取是否是通过分享进入的小程序
 		}
-		;(this.haveBack = haveBack), // 获取是否是通过分享进入的小程序
-			(this.statusBarHeight = statusBarHeight),
-			(this.navbarHeight = headerPosi.bottom + btnPosi.bottom), // 原胶囊bottom + 现胶囊bottom
-			(this.navbarBtn = btnPosi)
+		console.log('isShare', this.isShare)
+		console.log('haveBack', this.haveBack)
+	    this.statusBarHeight=statusBarHeight,
+	    this.navbarHeight= headerPosi.bottom + btnPosi.bottom, // 原胶囊bottom + 现胶囊bottom
+	    this.navbarBtn=btnPosi
 	},
 	watch: {
 		screenTab(newVal, oldVal) {

+ 2 - 3
pages/goods/product.vue

@@ -14,15 +14,14 @@
 			:headerColor="headerColor"
 			:type="isShareType"
 			:page="backPage"
-		>
-		</custom-p>
+		/>
 		<tui-skeleton
 			v-if="!skeletonShow"
 			backgroundColor="#fafafa"
 			borderRadius="10rpx"
 			:isLoading="true"
 			:loadingType="5"
-		></tui-skeleton>
+		/>
 		<template v-else>
 			<view class="container-product tui-skeleton">
 				<view class="container-product-main">

+ 7 - 7
pages/login/information.vue

@@ -239,7 +239,7 @@ export default {
 				this.$util.msg('请选择机构地址', 2000)
 				return
 			}
-			if (this.params.addressDetail == '') {
+			if (this.params.address == '') {
 				this.$util.msg('请填写机构详细地址', 2000)
 				return
 			}
@@ -269,16 +269,16 @@ export default {
 		showMulLinkageThreePicker() {
 			this.isShowInput = true
 			this.$refs.mpvueCityPicker.show()
-		},
+		}, 
 		onConfirm(e) {
-			this.addressData.address = e.name
-			this.addressData.townId = e.townCode
-			this.addressData.cityId = e.cityCode
-			this.addressData.provinceId = e.provinceCode
+			this.handleAddress = e.name
+			this.params.townId = e.townCode
+			this.params.cityId = e.cityCode
+			this.params.provinceId = e.provinceCode
 		},
 		onTextareaInput(e) {
 			//文本框获取焦点
-			this.addressData.addressDetail = e.detail.value
+			this.params.address = e.detail.value
 		},
 		showTextareaFocus() {
 			//文本框获取焦点

+ 50 - 14
pages/user/order/order-list.vue

@@ -1,13 +1,6 @@
 <template>
 	<view class="container" :style="{ paddingTop: navbarHeight + 'px' }">
 		<!-- 自定义返回 -->
-		<header-back
-			:systeminfo="systeminfo"
-			:navbar-data="nvabarData"
-			:headerBtnPosi="headerBtnPosi"
-			:isDelete="isDelete"
-			@navigatePath="handlNavigatePath"
-		/>
 		<tui-skeleton
 			v-if="skeletonShow"
 			backgroundColor="#fafafa"
@@ -16,6 +9,14 @@
 			:loadingType="5"
 		/>
 		<template v-else>
+			<header-back
+				:systeminfo="systeminfo"
+				:navbar-data="nvabarData"
+				:headerBtnPosi="headerBtnPosi"
+				:isDelete="isDelete"
+				:isShare="isShare"
+				@navigatePath="handlNavigatePath"
+			/>
 			<view class="order-section-top" :style="{ marginTop: navbarHeight + 'px' }">
 				<scroll-view scroll-x scroll-with-animation class="tab-view" :scroll-left="scrollLeft">
 					<view
@@ -45,7 +46,7 @@
 								v-if="tabItem.loaded === true && tabItem.orderList.length === 0"
 								:typeIndex="currentTab"
 								:navbarHeight="navbarHeight"
-							></empty>
+							/>
 							<!-- 列表 -->
 							<view v-else class="tui-order-content">
 								<view
@@ -167,6 +168,9 @@
 </template>
 
 <script>
+import { mapState, mapMutations } from 'vuex'
+import authorize from '@/common/config/authorize.js'
+import wxLogin from '@/common/config/wxLogin.js'
 import headerBack from '@/components/cm-module/headerNavbar/header-back' //自定义导航
 import cmListButton from './components/cm-list-button' //按钮
 import modalLayer from '@/components/modal-layer'
@@ -213,6 +217,7 @@ export default {
 			scrollTop: 0,
 			skeletonShow: true,
 			isDelete: false,
+			isShare: false,
 			isClickChange: false,
 			isShareModal: false, //控制分享弹窗
 			isModalLayer: false,
@@ -245,15 +250,26 @@ export default {
 			]
 		}
 	},
+	computed: {
+		...mapState(['hasLogin'])
+	},
 	onLoad(e) {
 		if (e.type === 'detele') {
 			this.isDelete = true
 		}
-		this.currentTab = e.state
-		console.log('currentTab', this.currentTab)
+		this.currentTab = e.state ? e.state : 0
+		if (getCurrentPages().length === 1) {
+			// 当只有一个页面时
+			this.isShare = true // 获取是否是通过分享进入的小程序
+		} else {
+			this.isShare = false // 获取是否是通过分享进入的小程序
+		}
 		this.isOnloadFlag = true
 		this.getHeaderTopHeight() //设置自定义导航高度
-		this.initStorage()
+		setTimeout(()=>{
+			console.log('hasLogin', this.hasLogin)
+			this.initStorage()
+		},2000)
 	},
 	filters: {
 		NumFormat(value) {
@@ -284,9 +300,16 @@ export default {
 	methods: {
 		async initStorage() {
 			//初始化
-			const usrInfo = await this.$api.getStorage()
-			this.listQuery.userId = usrInfo.userId ? usrInfo.userId : 0
-			this.getOrderDatainit(this.currentTab)
+			if(this.hasLogin){
+				const usrInfo = await this.$api.getStorage()
+				this.listQuery.userId = usrInfo.userId ? usrInfo.userId : 0
+				this.getOrderDatainit(this.currentTab)
+			}else{
+				this.modal = true
+				this.skeletonShow = false
+				this.contentModalText = '您还未登录,请先登录!'
+				this.handleModelEven = 99
+			}
 		},
 		// 滚动切换标签样式
 		onChange: function(e) {
@@ -473,10 +496,20 @@ export default {
 					case 4: //确认订单
 						this.affirmOrder()
 						break
+					case 99: //未登录跳转
+						this.handleNavLogin()
+						break
 				}
 			}
 			this.modal = false
 		},
+		//未登录跳转
+		handleNavLogin(){
+		    const pages = getCurrentPages()
+		    const page = pages[pages.length - 1]
+		    uni.setStorageSync('LOGIN_REDIRECT_URL', page.$page.fullPath)
+		    this.$api.redirectTo('/pages/login/login')
+		},
 		async confirmReceipt() {
 			//确认收货
 			try {
@@ -528,6 +561,8 @@ export default {
 		handlNavigatePath(data) {
 			if(data.type === 'navigateTo'){
 				this.$api.navigateTo(data.url)
+			}else if(data.type === 'switchTab'){
+				this.$api.switchTabTo(data.url)
 			}
 		},
 		handButtonShareConfirm(data) {
@@ -610,6 +645,7 @@ export default {
 	},
 	onShow() {
 		this.isModalLayer = false
+		wxLogin.wxLoginAuthorize()
 	}
 }
 </script>

+ 1 - 1
pages/user/order/order-sharelogin.vue

@@ -6,7 +6,7 @@
 			borderRadius="10rpx"
 			:isLoading="true"
 			:loadingType="5"
-		></tui-skeleton>
+		/>
 		<template v-else>
 			<view class="container-main clearfix">
 				<view class="main-title">此订单包含如下商品:</view>

+ 2 - 2
services/config.env.js

@@ -5,8 +5,8 @@ if(process.env.NODE_ENV === 'development'){
     // URL_CONFIG = 'http://192.168.2.68:18002'	 //涛涛联调地址
     // URL_CONFIG = 'http://192.168.2.102:18002' //志国联调地址
     // URL_CONFIG = 'http://192.168.2.103:18002' // 陈凯联调
-    URL_CONFIG = 'https://core-b.caimei365.com'
-    // URL_CONFIG = 'https://core.caimei365.com'  
+    // URL_CONFIG = 'https://core-b.caimei365.com'
+    URL_CONFIG = 'https://core.caimei365.com'  
 }else{
     // 生产环境
     // URL_CONFIG = 'https://core-b.caimei365.com'