Przeglądaj źródła

商品搜索、商铺订单搜索、阶梯价格显示及总价计算、iphoneX兼容问题优化

zhengjinyi 5 lat temu
rodzic
commit
d960844582

+ 10 - 0
App.vue

@@ -7,6 +7,16 @@
 	export default {
 		onLaunch: function() {
 			this.refresh()
+			let _self = this;
+			 uni.getSystemInfo({
+				 success: res => {
+					 let modelmes = res.model;
+					 if (modelmes.search('iPhone X') != -1) { //XS,XR,XS MAX均可以适配
+					   this.$store.dispatch('setVariableFun',true)
+					 }
+					 // uni.setStorageSync('modelmes', modelmes)
+				 }
+			 })
 		},
 		methods:{
 			getCheekeyCode(){// 根据微信的code获取用户登录状态:1已登录过 -1未登录过

+ 2 - 1
components/module/orderDetails/orderButton.vue

@@ -1,5 +1,5 @@
 <template name="button">
-	<view class="button-template">
+	<view class="button-template" :style="{paddingBottom :isIphoneX ? '68rpx' : '0rpx'}">
 		<!-- 底部按钮 -->
 		<view class="button-content">
 			<view class="btn btn-share" @click.stop="onShareCode">
@@ -37,6 +37,7 @@
 		data() {
 			return{
 				btnState:this.initStatus(),
+				isIphoneX:this.$store.state.isIphoneX,
 				mapStateArr:[
 					{label:'isQuery',val:[4,5,12,13,33,22,23,32,77],status: true},
 					{label:'isDelete',val:[6],status: true},

+ 4 - 3
components/uni-search/go-search.vue

@@ -58,7 +58,7 @@
 			};
 		},
 		created() {
-			this.initGetSerachRecord()
+			// this.initGetSerachRecord()
 		},
 		methods: {
 			initGetSerachRecord(){
@@ -95,12 +95,14 @@
 			},
 			onFocus () { //输入框获取焦点时触发
 				this.inputEmpty(this.searchText)
+				this.initGetSerachRecord()
 			},
 			delInputText () { //清除输入框内容
 				this.searchText = ''
 				this.isShowClose = false
 				this.$parent.isShowWrapper = false
 				this.inputEmpty(this.searchText)
+				this.initGetSerachRecord()
 			},
 			keywordsClick (item) {	//关键词搜索与历史搜索
 				this.searchText = item;
@@ -127,11 +129,10 @@
 				})
 			},
 			inputEmpty(val){
-				this.initGetSerachRecord()
 				this.$parent.isShowWrapper = false
 				if(val != ''){
 					this.isShowClose = true
-				}else{
+				}else{					
 					this.isShowClose = false
 				}
 			}

+ 4 - 4
components/uni-search/or-search.vue

@@ -58,13 +58,13 @@
 			};
 		},
 		created() {
-			this.initGetSerachRecord()
+			// this.initGetSerachRecord()
 		},
 		methods: {
 			initGetSerachRecord(){
 				authorize.getCode('weixin').then(wechatcode =>{
 					// console.log(wechatcode);
-					this.$api.get('/search/record',{organizeID:this.userOrganizeID,code:wechatcode},
+					this.$api.get('/search/history',{organizeID:this.userOrganizeID,code:wechatcode},
 						response =>{
 							// console.log(response);
 							if(response.code == '1'){
@@ -95,6 +95,7 @@
 			},
 			onFocus () { //输入框获取焦点时触发
 				this.inputEmpty(this.searchText)
+				this.initGetSerachRecord()
 			},
 			delInputText () { //清除输入框内容
 				this.searchText = ''
@@ -113,7 +114,7 @@
 				this.isShowDelModal = false;
 				authorize.getCode('weixin').then(wechatcode =>{
 					// console.log(wechatcode);
-					this.$api.get('/search/delete',{organizeID:this.userOrganizeID,code:wechatcode},
+					this.$api.get('/search/deleteOrderRecord',{organizeID:this.userOrganizeID,code:wechatcode},
 						response =>{
 							// console.log(response);
 							if(response.code == '1'){
@@ -127,7 +128,6 @@
 				})
 			},
 			inputEmpty(val){
-				this.initGetSerachRecord()
 				this.$parent.isShowWrapper = false
 				if(val != ''){
 					this.isShowClose = true

+ 5 - 3
pages/goods/product.vue

@@ -108,7 +108,7 @@
 			<!-- 底部按钮 -->
 			<view class="menu">
 				<view class="isLower" v-if="goodsData.disabled">该商品已下架~</view>
-				<view class="bottom-btn">
+				<view class="bottom-btn" :style="{paddingBottom :isIphoneX ? '68rpx' : '0rpx'}">
 					<view class="bottom-le">
 						<view class="item-bt" @click="this.$api.switchTabTo('/pages/tabBar/home/home')">
 							<image src="../../static/home-current@3x.png"></image>
@@ -233,18 +233,20 @@
 				goodListData:[],
 				headerBtnPosi:	this.setHeaderBtnPosi(), //获取设备顶部胶囊高度
 				systeminfo: this.setSysteminfo(),		 //获取设备信息
+				isIphoneX:this.$store.state.isIphoneX,
 				windowHeight: '',
 				headerColor:false,
 				nvabarData: {							 //顶部自定义导航
 					showCapsule: 1, // 是否显示左上角图标   1表示显示    0表示不显示
 					title: '', 		// 导航栏 中间的标题
-				}
+				},
 			}
 		},
 		onLoad(option) {
 			let self = this;
 			this.productID = option.id;//获取商品ID
 			this.tabCurrentIndex = 1;// 页面显示是默认选中第一个	
+			console.log(this.isIphoneX)
 		},
 		methods:{
 			initData(){// 初始化商品详情查询
@@ -400,7 +402,7 @@
 			toConfirmation(){//跳转确认订单页面
 				this.specClass = 'hide';
 				let productStp ={
-						allPrice:this.number*this.retailPrice,
+						allPrice:this.number*this.buyRetailPrice,
 						allCount:this.number,
 						id:this.productData.id,
 						productCount:this.number,

+ 43 - 36
pages/search/search-order.vue

@@ -91,6 +91,7 @@
 	import shareAlert from '@/components/module/modelAlert/shareAlert'			 //分享弹窗
 	import modelAlert from '@/components/module/modelAlert/modelAlert'			 //删除弹窗
 	import cancelAlert from '@/components/module/modelAlert/cancelAlert'		 //取消弹窗
+	import authorize from '@/config/authorize.js'
 	export default {
 		components: {
 			orSearch,
@@ -105,6 +106,7 @@
 		data() {
 			return {
 				themeClass: 'block',
+				searchInputVal:'',
 				isShowWrapper:false,
 				isModallayer:false,
 				isShowEmpty:false,
@@ -144,8 +146,8 @@
 		},
 		methods:{
 			getSearchText(e) {
-				this.isShowWrapper = true
-				this.getOrderDatainit(4)
+				this.searchInputVal = e
+				this.getOrderDatainit()
 			},
 			setScrollHeight() {
 				const {windowHeight, pixelRatio} = wx.getSystemInfoSync();
@@ -155,55 +157,60 @@
 			getOrderDatainit(index,source){
 				/**
 				 * @订单初始化加载  仅加载第一页码
-				 * @param:orderState(订单状态:0全部,1待付款,2待发货,3已发货,4退货款)
+				 * @param:code(微信返回的用户code)
+				 * @param:searchWord(搜索关键词)
 				 * @param:userID(用户ID)
 				 * @param:index(页码数)
 				 * @param:pageSize(每页条数)
 				 * @param:organizeID(全局变量组织ID)
 				 */ 
-				this.$api.getStorage().then((resolve) =>{
-					this.userID = resolve.userID
-					let param = {orderState:index,userID:this.userID,index:1,pageSize:this.pageSize,organizeID:this.userOrganizeID};
-					this.$api.lodingGet('/order/myOrder',param,
-						response => {
-							if(response.code === '1'){
-								const _responseData = response.data.results
-								if(_responseData && _responseData.length > 0){
-									let filrerData = _responseData.filter(item=>{
-										//添加不同状态下订单的表现形式
-										item = Object.assign(item, this.orderStateExp(item.state));
-										return item;
-									});
-									this.orderList =[];
-									filrerData.forEach(item=>{
-										this.orderList.push(item);
-									})
-									this.hasNextPage = response.data.hasNextPage;
-									if(this.hasNextPage){
-										this.pullUpOn = false
-										this.nomoreText = '上拉显示更多'
-									}else{
-										if(this.orderList.length < 2){
-											this.pullUpOn = true
-										}else{
+				authorize.getCode('weixin').then(wechatcode =>{
+					this.$api.getStorage().then((resolve) =>{
+						this.userID = resolve.userID
+						let params = {code:wechatcode,searchWord:this.searchInputVal,userID:this.userID,index:1,pageSize:this.pageSize,organizeID:this.userOrganizeID};
+						this.$api.lodingGet('/search/order',params,
+							response => {
+								if(response.code === '1'){
+									this.isShowWrapper = true
+									const _responseData = response.data.results;
+									if(_responseData && _responseData.length > 0){
+										let filrerData = _responseData.filter(item=>{
+											//添加不同状态下订单的表现形式
+											item = Object.assign(item, this.orderStateExp(item.state));
+											return item;
+										});
+										this.orderList =[];
+										filrerData.forEach(item=>{
+											this.orderList.push(item);
+										})
+										this.hasNextPage = response.data.hasNextPage;
+										if(this.hasNextPage){
 											this.pullUpOn = false
-											this.nomoreText = '已至底部'
+											this.nomoreText = '上拉显示更多'
+										}else{
+											if(this.orderList.length < 2){
+												this.pullUpOn = true
+											}else{
+												this.pullUpOn = false
+												this.nomoreText = '已至底部'
+											}
 										}
+										this.isShowEmpty = false
+									}else{
+										this.isShowEmpty = true
 									}
 								}else{
-									this.isShowEmpty = true
+									this.$util.msg(response.msg,2000);
 								}
-							}else{
-								this.$util.msg(response.msg,2000);
 							}
-						}
-					)	
+						)	
+					})
 				})
 			}, 
 			getOnReachBottomData(index){//上拉加载
 				this.pageNum+=1
-				let param = {orderState:index,userID:this.userID,index:this.pageNum,pageSize:this.pageSize,organizeID:this.userOrganizeID}
-				this.$api.get('/order/myOrder',param,
+				let params = {code:wechatcode,searchWord:this.searchInputVal,userID:this.userID,index:1,pageSize:this.pageSize,organizeID:this.userOrganizeID};
+				this.$api.get('/search/order',params,
 					response => {
 						if(response.code === '1'){
 							let resData = response.data.results

+ 1 - 1
pages/search/search.vue

@@ -25,7 +25,7 @@
 				</view>
 			</scroll-view>
 			<view class="empty-container" v-if="showEmpty">
-				<image class="empty-container-image" src="https://admin-b.caimei365.com/userfiles/1/images/photo/2020/02/%E7%A9%BA%E7%8A%B6%E6%80%81%403x.png"></image>
+				<image class="empty-container-image" src="https://img.caimei365.com/group1/M00/03/8D/Cmis215XHXWAHCoqAAELHadZ9Xg365.png"></image>
 				<text class="error-text">抱歉,没有相关商品!</text>
 			</view>
 			<!-- 透明模态层 -->

+ 2 - 1
pages/user/order/create-order.vue

@@ -38,7 +38,7 @@
 			</view>
 		</view>
 		<!-- 底部 -->
-		<view class="footer">
+		<view class="footer" :style="{paddingBottom :isIphoneX ? '68rpx' : '0rpx'}">
 			<view class="footer-le">
 				<view class="footer-count">
 					<text>共{{allCount}}件商品</text>
@@ -96,6 +96,7 @@
 				invoiceData:{},			  //初始化发票信息
 				freightData:{},			  //邮费数据
 				orderInfo:[],			  //提交的商品信息
+				isIphoneX:this.$store.state.isIphoneX
 			}
 		},
 		onLoad(option){//商品数据

+ 2 - 1
pages/user/order/order-cashier.vue

@@ -29,7 +29,7 @@
 						<view class="warning">请在网银转账备注中填写上述订单标识,或者直接复制本订单的订单标识,方便财务快速审核,提高发货速度。</view>
 					</view>					
 				</view>	
-				<view class="cash-btn">
+				<view class="cash-btn" :style="{paddingBottom :isIphoneX ? '68rpx' : '0rpx'}">
 					<view class="btn btn-share" @click="onShareCode">分享订单<view class="tips" v-if="isShareCode">分享码:{{shareCode}}</view></view>
 					<view class="btn btn-query" @click="this.$api.navigateTo('/pages/user/order/order-details?type=confim&orderID='+shareOrderID)">查看订单</view>
 					<view class="btn btn-makes" @click="this.$api.switchTabTo('/pages/tabBar/home/home')">继续采购</view>
@@ -68,6 +68,7 @@
 				emptyWrapperH: '',
 				headerBtnPosi:	this.setHeaderBtnPosi(),//获取设备顶部胶囊高度
 				systeminfo:this.setSysteminfo(),		 //获取设备信息
+				isIphoneX:this.$store.state.isIphoneX,
 				nvabarData: {							 //顶部自定义导航
 					showCapsule: 1, // 是否显示左上角图标   1表示显示    0表示不显示
 					title: '收银台', // 导航栏 中间的标题

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

@@ -521,7 +521,7 @@
 	}
 
 	.active {
-		border-bottom: 4rpx solid $color-system;
+		border-bottom: 6rpx solid $color-system;
 	}
 
 	.active .tab-bar-title {

+ 2 - 1
pages/user/order/order-sharedetails.vue

@@ -18,7 +18,7 @@
 		<!-- 退款记录 -->
 		<refund-record ref="refund" v-if="isRequest" :returnedPurchaseList="returnedPurchaseList" :returnedPurchaseFee="returnedPurchaseFee"></refund-record>
 		<!-- 底部button -->
-		<view class="button-content">
+		<view class="button-content" :style="{paddingBottom :isIphoneX ? '68rpx' : '0rpx'}">
 			<view class="btn btn-query" v-if="btnState.isQuery" @click.stop="queryLogistics">查看物流</view>
 		</view>
 	</view>
@@ -64,6 +64,7 @@
 				discernReceiptList:{},		//支付信息初始化
 				receiptAmount:0,			//支付金额
 				returnedPurchaseFee:0,		//退款金额
+				isIphoneX:this.$store.state.isIphoneX,
 				btnState:{
 					isQuery:false
 				},

+ 9 - 2
store/index.js

@@ -10,6 +10,7 @@ const store = new Vuex.Store({
 		userInfo: {},
 		user_key: {},
 		cartNumber:0,
+		isIphoneX:false
 	},
 	mutations: {
 		login(state, provider) {
@@ -46,10 +47,16 @@ const store = new Vuex.Store({
 					index: 1,
 				})
 			}
+		},
+		setChangeVar(state,variable){
+			//单一的改变某一个变量
+			state.isIphoneX = variable;
 		}
 	},
-	actions: {
-	
+	actions:{
+		setVariableFun:function(context,vData){
+			context.commit('setChangeVar',vData)
+		},
 	}
 })