Pārlūkot izejas kodu

宝霆运营小程序页面和功能实现

oyq28 2 gadi atpakaļ
vecāks
revīzija
5875da1486

+ 1 - 1
imcs-bt-fe/imcs-bt-fe/uni-mall/components/mx-datepicker/mx-datepicker.vue

@@ -492,7 +492,7 @@
 				};
 				//定义默认格式
 				let defaultFormat = {
-					'date': 'yyyy/mm/dd',
+					'date': 'yyyy-mm-dd',
 					'time': 'hh:ii' + (this.showSeconds ? ':ss' : ''),
 					'datetime': ''
 				};

+ 14 - 12
imcs-bt-fe/imcs-bt-fe/uni-mall/pages/auth/login/login.vue

@@ -86,18 +86,20 @@
 						tenantView: "0000",
 						key: util.randomNum(24, 16)
 					})
-					.then(({
-						data
-					}) => {
+					.then(function(data) {
 						console.log(data)
-						uni.setStorageSync('userInfo', data.name);
-						uni.setStorageSync('X-Nideshop-Token', data.token);
-						uni.setStorageSync('wxToken', data.token);
-						uni.setStorageSync('userId', data.userId);
-
-						uni.redirectTo({
-							url: '/pages/index/index',
-						})
+						uni.setStorageSync('userInfo', data.data.name);
+						//uni.setStorageSync('X-Nideshop-Token', data.token);
+						uni.setStorageSync('token', 'Bearer '+ data.data.token);						
+						uni.setStorageSync('userId', data.data.userId);						
+						if(data.code == 0){							
+							//uni.redirectTo({
+							//	url: '/pages/index/index',
+							//})
+							uni.switchTab({
+							   url: '/pages/index/index',
+							})
+						}
 						/*
 						that.$store.commit("LOGIN", {
 							'token': data.token,
@@ -116,7 +118,7 @@
 						}).catch(error => {
 							this.keyLock = true
 						}) */
-					}).catch(e => {
+					}).catch(e => {					
 						this.keyLock = true						
 						uni.showModal({
 							title: '提示',

+ 23 - 21
imcs-bt-fe/imcs-bt-fe/uni-mall/pages/device/device.vue

@@ -4,7 +4,8 @@
 			<navigator :url="'../device/deviceDetail?id='+item.id" class="item" v-for="(item, index) in deviceList"
 				:key="index">
 				<view class="img-bg">
-					<image :src="item.pic_url" background-size="cover"></image>
+					<image :src="item.imgUrl" background-size="cover" v-if="item.imgUrl"></image>
+					<image :src="item.pic" background-size="cover" v-if="item.pic"></image>
 				</view>
 				<view class="txt-box">
 					<view class="line">
@@ -27,7 +28,7 @@
 
 <script>
 	const util = require("@/utils/util.js");
-	const api = require('@/utils/api.js');
+	const api = require('@/utils/api.js');	
 	export default {
 		data() {
 			return {
@@ -36,53 +37,54 @@
 						id: 1,
 						address: "泥城扩路镇223号,三层",
 						status: "1",
-						pic_url: "http://yanxuan.nosdn.127.net/c1c62211a17b71a634fa0c705d11fb42.png"
+						pic: "http://yanxuan.nosdn.127.net/c1c62211a17b71a634fa0c705d11fb42.png"
 					},
 					{
 						name: "果奶机02",
 						id: 1,
 						address: "泥城扩路镇223号,三层",
 						status: "2",
-						pic_url: "http://yanxuan.nosdn.127.net/c1c62211a17b71a634fa0c705d11fb42.png"
+						pic: "http://yanxuan.nosdn.127.net/c1c62211a17b71a634fa0c705d11fb42.png"
 					},
 					{
 						name: "果奶机03",
 						id: 1,
 						address: "泥城扩路镇223号,三层",
 						status: "3",
-						pic_url: "http://yanxuan.nosdn.127.net/c1c62211a17b71a634fa0c705d11fb42.png"
+						pic: "http://yanxuan.nosdn.127.net/c1c62211a17b71a634fa0c705d11fb42.png"
 					}
 				],
-				page: 1,
-				size: 10,
+				queryParams: util.initQueryParams(),
 				totalPages: 1
 			}
 		},
 		methods: {
-			getdeviceList: function() {
+			getdeviceList: function(type) {
 				let that = this;
-				util.request(api.DeviceList, {
-					page: that.page,
-					size: that.size
-				}).then(function(res) {
-					if (res.errno === 0) {
-						//that.deviceList = that.deviceList.concat(res.data.data)
-						//that.totalPages = res.data.totalPages
+				if(type!=null){
+					//this.queryParams.model.status = type
+				}
+				util.request(api.DeviceList, this.queryParams, 'post', 'application/json').then(function(res) {
+					if (res.code === 0) {
+						console.log(res.data);
+						that.deviceList = that.deviceList.concat(res.data.records)
+						that.totalPages = res.data.pages
 					}
 				});
 			}
 		},
 		onReachBottom() {
-			if (this.totalPages > this.page) {
-				this.page = this.page + 1
+			if (this.totalPages > this.queryParams.current) {
+				this.queryParams.current = this.queryParams.current + 1
 			} else {
 				return false;
 			}
-
-			this.getdeviceList();
+			let type = this.$route.query.type;
+			this.getdeviceList(type);
 		},
-		onLoad: function() {
-			this.getdeviceList();
+		onLoad: function() {		
+			let type = this.$route.query.type;
+			this.getdeviceList(type);
 		}
 	}
 </script>

+ 31 - 2
imcs-bt-fe/imcs-bt-fe/uni-mall/pages/device/deviceDetail.vue

@@ -2,7 +2,7 @@
 	<view class="container">
 		<view class="a-section a-popular">
 			<view class="b">
-				<image class="img" :src="device.pic_url" background-size="cover"></image>
+				<image class="img" :src="device.pic" background-size="cover"></image>
 				<view class="right">
 					<view class="text">
 						<text class="name">{{device.name}}</text>
@@ -48,6 +48,8 @@
 </template>
 
 <script>
+	const util = require("@/utils/util.js");
+	const api = require('@/utils/api.js');
 	export default {
 		data() {
 			return {
@@ -87,6 +89,32 @@
 					content: "缺料"
 				}]
 			}
+		},
+	    methods: {
+			getDeviceDetail(){
+				let that = this;
+				util.request(api.DeviceDetail, {
+					equId: this.$route.query.id
+				},'GET','application/json').then(function(res) {
+					if (res.code === 0) {
+						that.device = res.data;
+					}
+				});
+			},
+			getMaterialData(){
+				let that = this;
+				util.request(api.MaterialList, {
+					equId: this.$route.query.id
+				},'GET','application/json').then(function(res) {
+					if (res.errno === 0) {
+						that.materialList = res.data;
+					}
+				});
+			},
+			onLoad: function() {				
+				this.getDeviceDetail();
+				this.getMaterialData();
+			}
 		}
 	}
 </script>
@@ -250,10 +278,11 @@
 		color: #b4282d;
 		font-size: 24rpx;
 	}
+
 	.title {
 		margin-left: 30rpx;
 		font-size: 30rpx;
 		height: 60rpx;
-		line-height: 60rpx;		
+		line-height: 60rpx;
 	}
 </style>

+ 30 - 18
imcs-bt-fe/imcs-bt-fe/uni-mall/pages/index/index.vue

@@ -129,8 +129,9 @@
 					</navigator>
 				</view>
 				<view class="item" v-for="(item, index) in device" :key="index">
-					<navigator :url="'/pages/goods/goods?id='+item.id">
-						<image class="img" :src="item.pic_url" background-size="cover"></image>
+					<navigator :url="'/pages/device/device?id='+item.id">
+						<image class="img" :src="item.imgUrl" background-size="cover" v-if="item.imgUrl"></image>
+						<image class="img" :src="item.pic" background-size="cover" v-else-if="item.pic"></image>
 						<view class="right">
 							<view class="text">
 								<text class="name">{{item.name}}</text>
@@ -143,12 +144,13 @@
 						</view>
 					</navigator>
 				</view>
+				<!--
 				<view class="item item-b item-more">
 					<navigator class="more-a">
 						<view class="txt">更多</view>
 						<image class="icon" src="../../static/images/icon_go_more.png" background-size="cover"></image>
 					</navigator>
-				</view>
+				</view>-->
 			</view>
 		</view>
 
@@ -182,6 +184,7 @@
 <script>
 	const api = require('@/utils/api.js');
 	const util = require("@/utils/util.js")
+	import {CodeToText} from 'element-china-area-data'
 	export default {
 		data() {
 			return {
@@ -217,21 +220,21 @@
 						id: 1,
 						address: "泥城扩路镇223号,三层",
 						status: "1",
-						pic_url: "http://yanxuan.nosdn.127.net/c1c62211a17b71a634fa0c705d11fb42.png"
+						pic: "http://yanxuan.nosdn.127.net/c1c62211a17b71a634fa0c705d11fb42.png"
 					},
 					{
 						name: "果奶机02",
 						id: 1,
 						address: "泥城扩路镇223号,三层",
 						status: "2",
-						pic_url: "http://yanxuan.nosdn.127.net/c1c62211a17b71a634fa0c705d11fb42.png"
+						pic: "http://yanxuan.nosdn.127.net/c1c62211a17b71a634fa0c705d11fb42.png"
 					},
 					{
 						name: "果奶机03",
 						id: 1,
 						address: "泥城扩路镇223号,三层",
 						status: "3",
-						pic_url: "http://yanxuan.nosdn.127.net/c1c62211a17b71a634fa0c705d11fb42.png"
+						pic: "http://yanxuan.nosdn.127.net/c1c62211a17b71a634fa0c705d11fb42.png"
 					},
 				],
 				channel: [{
@@ -239,7 +242,7 @@
 						id: 1,
 						name: "设备总数",
 						sort_order: 1,
-						url: "/pages/goods/goods?id=1",
+						url: "/pages/device/device",
 						val: "3"
 					},
 					{
@@ -247,7 +250,7 @@
 						id: 2,
 						name: "异常设备",
 						sort_order: 2,
-						url: "/pages/device/device?id=2",
+						url: "/pages/device/device?type=2",
 						val: "1"
 					},
 					{
@@ -255,7 +258,7 @@
 						id: 3,
 						name: "缺料设备",
 						sort_order: 3,
-						url: "/pages/device/device?id=3",
+						url: "/pages/device/device?type=3",
 						val: "4"
 					},
 					{
@@ -285,24 +288,33 @@
 				]
 			}
 		},
+		filters: {
+		    getCodeNames(code){
+			   if(code==null) return '';
+		       let arr = code.split(',')
+		       return arr.length>1 ? arr.map(item => {
+		          return CodeToText[item]
+		       }).join('/') : '';
+		    }
+		},
 		methods: {
 			getIndexData: function() {
 				let that = this;
-				if (!that.newGoods.length) {
+				if (that.newGoods.length) {
 					util.request(api.IndexUrlNewGoods).then(function(res) {
 						if (res.errno === 0) {
 							//that.newGoods = res.data.newGoodsList
 						}
 					});
 				}
-				if (!that.hotGoods.length) {
+				if (that.hotGoods.length) {
 					util.request(api.IndexUrlHotGoods).then(function(res) {
 						if (res.errno === 0) {
 							that.hotGoods = res.data.hotGoodsList
 						}
 					});
 				}
-				if (!that.topics.length) {
+				if (that.topics.length) {
 					util.request(api.IndexUrlTopic).then(function(res) {
 						if (res.errno === 0) {
 							//that.topics = res.data.topicList
@@ -310,21 +322,21 @@
 					});
 				}
 				if (that.device.length) {
-					util.request(api.IndexUrlDevice).then(function(res) {
-						console.log(res)
-						if (res.errno === 0) {
-							that.device = res.data.deviceList
+					let params = util.initQueryParams({});
+					util.request(api.IndexUrlDevice, params, 'POST', 'application/json').then(function(res) {						
+						if (res.code === 0) {
+							that.device = res.data.records
 						}
 					});
 				}
-				if (!that.brands.length) {
+				if (that.brands.length) {
 					util.request(api.IndexUrlBrand).then(function(res) {
 						if (res.errno === 0) {
 							that.brands = res.data.brandList
 						}
 					});
 				}
-				if (!that.floorGoods.length) {
+				if (that.floorGoods.length) {
 					util.request(api.IndexUrlCategory).then(function(res) {
 						if (res.errno === 0) {
 							//that.floorGoods = res.data.categoryList

+ 15 - 18
imcs-bt-fe/imcs-bt-fe/uni-mall/pages/material/material.vue

@@ -1,8 +1,5 @@
 <template>
-	<view class="container">
-		<uni-card :is-shadow="false" is-full>
-			<text class="uni-h6">原料</text>
-		</uni-card>
+	<view class="container">		
 		<uni-section title="原料" type="line" padding>
 			<uni-grid :column="4" :highlight="true">
 				<uni-grid-item v-for="(item, index) in categoryList" :index="index" :key="index" style="height:400px;">
@@ -24,10 +21,9 @@
 								v-if="item.status===1">
 								<view class="progress-view"></view>
 							</view>
-						</view>
-
-						<text class="errMsg" v-if="item.status===1">{{item.errMsg}}</text>
-						<text class="tip">{{item.val}}ml</text>
+							<text class="errMsg" v-if="item.status===1">{{item.errMsg}}</text>
+							<text class="tip">{{item.val}}ml</text>
+						</view>						
 
 						<view class="num">
 							<uni-badge class="uni-badge-left-margin" :text="item.id" type="primary"
@@ -39,8 +35,7 @@
 		</uni-section>
 		<uni-section title="操作记录" type="line" padding>
 			<uni-list>
-				<uni-list-item title="时间"></uni-list-item>
-				<uni-list-item title="操作"></uni-list-item>
+				<uni-list-item title="时间"></uni-list-item>				
 			</uni-list>
 			<uni-table border stripe emptyText="暂无更多数据">
 				<!-- 表头行 -->
@@ -163,7 +158,8 @@
 				editShow: false,
 				materials: ['燕麦', '魔芋粉', '牛肉粉', '红薯粉', '蜂蜜'],
 				material: {
-					id: '',
+					equId: '',
+					barrelCode:'',
 					name: '',
 					surplus: '',
 					specs: '',
@@ -282,29 +278,30 @@
 	}
 
 	.grid-item-box .num {
-		position: absolute;
-		bottom: 30rpx;
-		left: 45%;
+		position: relative;	
 		margin: 0 auto;
+		z-index: 999;
 	}
 
 	.grid-item-box .tip {
 		position: absolute;
-		bottom: 150rpx;
-		left: 45%;
+		bottom: 20rpx;
+		left: 30%;
 		margin: 0 auto;
 		color: #fff;
 		z-index: 999;
+		text-align: center;
 	}
 
 	.grid-item-box .errMsg {
 		position: absolute;
-		left: 45%;
+		left: 30%;
 		top: 120rpx;
 		font-size: 36rpx;
 		width: 80rpx;
 		color: #ff0000;
 		z-index: 9999;
+		margin: 0 auto;
 	}
 
 	.fb-type {
@@ -361,7 +358,7 @@
 <style scoped>
 	.progressContainer {
 		position: relative;
-		width: 200rpx;
+		width: 160rpx;
 		height: 600rpx;
 		background-color: #ddd;
 		overflow: hidden;

+ 3 - 2
imcs-bt-fe/imcs-bt-fe/uni-mall/pages/material/materialDetail.vue

@@ -100,7 +100,8 @@
 					{
 						value: "2022-08-01",
 						text: "2022-08-01"
-					}],
+					}
+				],
 
 				material: {
 					id: '',
@@ -158,7 +159,7 @@
 					} else {
 						util.toast(res.data);
 					}
-                });
+				});
 			}
 		},
 	}

+ 20 - 15
imcs-bt-fe/imcs-bt-fe/uni-mall/pages/search/search.vue

@@ -31,7 +31,7 @@
 			</view>
 			<view class="shelper-list" v-if="keyword">
 				<view class="item" hover-class="navigator-hover" v-for="(item, index) in helpKeyword" :key="index" @tap="onKeywordTap"
-				 :data-keyword="item">{{item}}</view>
+				 :data-keyword="item">{{item.name}}</view>
 			</view>
 		</view>
 
@@ -79,11 +79,12 @@
 	export default {
 		data() {
 			return {
-				keywrod: '',
+				keyword: '',
 				searchStatus: false,
 				goodsList: [],
 				helpKeyword: [],
 				historyKeyword: [],
+				deviceList: [],
 				categoryFilter: false,
 				currentSortType: 'default',
 				currentSortOrder: '',
@@ -91,7 +92,7 @@
 				defaultKeyword: {},
 				hotKeyword: [],
 				page: 1,
-				size: 20,
+				size: 10,
 				currentSortType: 'id',
 				currentSortOrder: 'desc',
 				categoryId: 0
@@ -107,7 +108,7 @@
 			},
 			getSearchKeyword() {
 				let that = this;
-				util.request(api.SearchIndex).then(function(res) {
+				util.request(api.SearchIndex,{},'GET',"application/json").then(function(res) {
 					if (res.errno === 0) {
 						that.historyKeyword = res.data.historyKeywordList
 						that.defaultKeyword = res.data.defaultKeyword
@@ -124,9 +125,9 @@
 			getHelpKeyword: function() {
 				let that = this;
 				util.request(api.SearchHelper, {
-					keyword: that.keyword
-				}).then(function(res) {
-					if (res.errno === 0) {
+					name: that.keyword
+				},'GET',"application/json").then(function(res) {
+					if (res.code === 0) {
 						that.helpKeyword = res.data;
 					}
 				});
@@ -166,18 +167,21 @@
 					that.getSearchKeyword();
 				});
 			},
-			onKeywordTap: function(event) {
-
+			onKeywordTap: function(event) {				
 				this.getSearchResult(event.target.dataset.keyword);
 
 			},
 			getSearchResult(keyword) {
-				this.keyword = keyword
+				this.keyword = keyword.name
 				this.page = 1
 				this.categoryId = 0
 				this.goodsList = []
-
-				this.getGoodsList();
+                
+				uni.navigateTo({
+					url: '/pages/device/deviceDetail?id='+keyword.id
+				})
+				//this.getGoodsList();
+				
 			},
 			openSortFilter: function(event) {
 				let that = this;
@@ -231,7 +235,7 @@
 			}
 		},
 		onLoad: function() {
-			this.getSearchKeyword();
+			//this.getSearchKeyword();
 		}
 	}
 </script>
@@ -249,7 +253,7 @@
 
 	.search-header {
 		position: fixed;
-		top: 0;
+		top: 90rpx;
 		width: 750rpx;
 		height: 91rpx;
 		display: flex;
@@ -258,6 +262,7 @@
 		padding: 0 31.25rpx;
 		font-size: 29rpx;
 		color: #333;
+		margin: 0 auto;
 	}
 
 	.search-header .input-box {
@@ -311,7 +316,7 @@
 	.no-search {
 		height: auto;
 		overflow: hidden;
-		margin-top: 91rpx;
+		margin-top: 120rpx;
 	}
 
 	.serach-keywords {

+ 59 - 26
imcs-bt-fe/imcs-bt-fe/uni-mall/pages/ucenter/order/order.vue

@@ -32,7 +32,7 @@
 			</view>
 		</view>
 		<mx-date-picker :show="showPicker" :type="type" :value="value" :show-tips="true" :begin-text="'开始'"           
-			 :end-text="'结束'" :show-seconds="true" @confirm="onSelected" @cancel="onSelected" />
+			 :end-text="'结束'" :show-seconds="true" @confirm="onSelected" @cancel="onCancel" />
 
 		<view class="statistics">
 			<view class="cell">
@@ -40,7 +40,7 @@
 				<text class="txt">订单总数</text>
 			</view>
 			<view class="cell">
-				<text class="val">{{orderAmount}}</text>
+				<text class="val">{{orderSum}}</text>
 				<text class="txt">订单销售总金额</text>
 			</view>
 		</view>
@@ -52,11 +52,11 @@
 					<view class="r">{{item.status==='1'?'生产中':(item.status==='2'?'生产失败':'生产完成')}}</view>
 				</view>
 				<view class="h">
-					<view class="l">订单编号:{{item.orderSn||''}}</view>
-					<view class="r">¥{{item.price}}</view>
+					<view class="l">订单编号:{{item.id||''}}</view>
+					<view class="r">¥{{item.orderAmount}}</view>
 				</view>
 				<view class="h">
-					<view class="l">会员名称:{{item.memberName||''}}</view>
+					<view class="l">会员名称:{{item.orderMemberName||''}}</view>
 				</view>
 				<view class="h">
 					<view class="l">设备名称:{{item.deviceName||''}}</view>
@@ -90,7 +90,10 @@
 				index: 0,
 				index2: 0,
 				deviceId: '',
-				deviceList: [{id:'', name:'全部'},{
+				deviceList: [{
+					id: '',
+					name: '全部'
+				}, {
 					id: 1,
 					name: "果奶机1"
 				}, {
@@ -101,7 +104,7 @@
 					name: "果奶机3"
 				}],
 				orderCount: 2,
-				orderAmount: '32.8',
+				orderSum: 0.0,
 				array: ['全部', '开门', '关门'],
 				orderList: [{
 					name: '美式咖啡',
@@ -131,9 +134,9 @@
 					price: '15.0',
 					errorMsg: ''
 				}],
-				page: 1,
-				size: 10,
-				totalPages: 1
+				queryParams: util.initQueryParams(),
+				totalPages: 1,
+				totalPages2: 1
 			}
 		},
 		components: {
@@ -148,7 +151,7 @@
 				this.deviceId = this.deviceList[this.index].id
 			},
 			bindDateChange: function(e) {
-			  this.date = e.detail.value
+				this.date = e.detail.value
 			},
 			onShowDatePicker(type) { //显示
 				console.log(JSON.stringify(type))
@@ -162,33 +165,58 @@
 				if (e) {
 					this[this.type] = e.value;
 				}
+				this.orderList = []
+				this.queryParams.current = 1
+				this.getOrderList()
+			},
+			onCancel(e) {
+				this.range = []
+				this.showPicker = false;
+				if (e) {
+					this[this.type] = '';
+				}
+				this.orderList = []
+				this.queryParams.current = 1
 				this.getOrderList()
 			},
 			getDeviceList() {
 				let that = this;
-				util.request(api.DeviceList, {
-					page: that.page,
-					size: that.size
-				}, 'GET').then(function(res) {
-					if (res.errno === 0) {
+				util.request(api.DeviceList, {}, 'post', 'application/json').then(function(res) {
+					if (res.code === 0) {
 						//that.orderList = that.orderList.concat(res.data.data)
 						//that.page = res.data.currentPage + 1
-						//that.totalPages = res.data.totalPages
-						//that.deviceList = res.data;
+						that.totalPages2 = res.total
+						that.deviceList = res.data.records
 					}
 				});
 			},
 			getOrderList() {
 				let that = this;
-
-				util.request(api.OrderList, {
-					page: that.page,
-					size: that.size
-				}, 'GET').then(function(res) {
-					if (res.errno === 0) {
-						//that.orderList = that.orderList.concat(res.data.data)
+				if (that.index2 > 0) {
+					that.queryParams.model.orderEquId = that.index2;
+				} else {
+					that.queryParams.model = {}
+				}
+				if (that.range.length > 0) {
+					that.queryParams.map.createTime_st = that.range[0];
+					that.queryParams.map.createTime_ed = that.range[1];
+				} else {
+					that.queryParams.map = {}
+				}
+				util.request(api.OrderList, that.queryParams, 'post', 'application/json').then(function(res) {
+					if (res.code === 0) {						
+						res.data.records = res.data.records.filter(item=>{
+							if(item.id==null){							   
+							   that.orderSum = item.orderSum;
+							   return false
+							}
+							return true;
+						})
+						console.log(res.data.records[0])
+						that.orderList = that.orderList.concat(res.data.records);
 						//that.page = res.data.currentPage + 1
-						//that.totalPages = res.data.totalPages
+						that.totalPages = res.data.pages
+						that.orderCount = res.data.total;
 					}
 				});
 			},
@@ -207,6 +235,11 @@
 		 * 页面上拉触底事件的处理函数
 		 */
 		onReachBottom: function() {
+			if (this.totalPages > this.queryParams.current) {
+				this.queryParams.current = this.queryParams.current + 1
+			} else {
+				return false;
+			}
 			this.getOrderList()
 		},
 		onShow: function(options) {

+ 6 - 6
imcs-bt-fe/imcs-bt-fe/uni-mall/utils/api.js

@@ -6,7 +6,7 @@ module.exports = {
 	IndexUrlCategory: 'index/category', //首页底部的分类及商品列表
 	IndexUrlBanner: 'index/banner', //首页banner
 	IndexUrlChannel: 'index/channel', //banner下的分类
-	IndexUrlDevice:  'getEqu',   //设备
+	IndexUrlDevice:  'getEquList',   //设备
 	CatalogList: 'catalog/index', //分类目录全部分类数据接口
 	CatalogCurrent: 'catalog/current', //分类目录当前分类数据接口
 
@@ -23,8 +23,8 @@ module.exports = {
 	BrandList: 'brand/list', //品牌列表
 	BrandDetail: 'brand/detail', //品牌详情
 	
-	DeviceList: 'device/list', //设备列表
-	DeviceDetail: 'device/detail', //设备详情
+	DeviceList: 'getEquList', //设备列表
+	DeviceDetail: 'equDetails', //设备详情
 
 	CartList: 'cart/index', //获取购物车的数据
 	CartAdd: 'cart/add', // 添加商品到购物车
@@ -50,7 +50,7 @@ module.exports = {
 	TopicRelated: 'topic/related', //相关专题
 
 	SearchIndex: 'search/index', //搜索页面数据
-	SearchHelper: 'search/helper', //搜索帮助
+	SearchHelper: 'getEquByName', //搜索帮助
 	SearchClearHistory: 'search/clearhistory', //搜索帮助
 
 	AddressList: 'address/list', //收货地址列表
@@ -60,13 +60,13 @@ module.exports = {
 
 	RegionList: 'region/list', //获取区域列表
 
-	OrderList: 'getorderList', //订单列表
+	OrderList: 'equOrders', //订单列表
 	OrderDetail: 'order/detail', //订单详情
 	OrderCancel: 'order/cancelOrder', //取消订单
 	OrderConfirm: 'order/confirmOrder', //确认收货
 	
 	DoorList: 'door/door',
-	MaterialList: 'material/list',
+	MaterialList: 'barrelList',
 	MaterialDetail: 'material/detail',
 	MaterialUpdate: 'material/update',
 

+ 34 - 26
imcs-bt-fe/imcs-bt-fe/uni-mall/utils/util.js

@@ -1,12 +1,12 @@
 const utils = {
 	// 域名
 	//domain: 'https://fly2you.cn/',
-	domain: 'https://gn.baotingsmart.com/',
-	// domain: 'http://192.168.1.3:8080/',
+	//domain: 'https://gn.baotingsmart.com/',
+	domain: 'http://127.0.0.1:8764/',
 	//接口地址
 	interfaceUrl: function(params) {
 		//return utils.domain + 'platform/api/'
-		return utils.domain + (params != "" ? params : 'miniApp/') 
+		return utils.domain + (params != "" ? params : 'opsApi/') 
 	},
 	toast: function(text, duration, success) {
 		uni.showToast({
@@ -94,7 +94,7 @@ const utils = {
 				data: postData,
 				header: {
 					'content-type': contentType,
-					'X-Nideshop-Token': utils.getToken(),
+					'token': utils.getToken(),
 					'Authorization': 'Basic enVpaG91X3VpOnp1aWhvdV91aV9zZWNyZXQ='
 				},
 				method: method, //'GET','POST'
@@ -102,13 +102,12 @@ const utils = {
 				success: (res) => {
 					if (loadding && !hideLoading) {
 						uni.hideLoading()
-					}
-					if (res.statusCode === 200) {
-						if (res.data.errno === 401) {							
-							utils.modal('温馨提示', '您还没有登录,是否去登录', true, (confirm) => {
+					}					
+					if (res.statusCode === 401 || res.data.code === 40005 || res.data.code === 40001) {							
+						utils.modal('温馨提示', '您还没有登录,是否去登录', true, (confirm) => {
 								if (confirm) {
 									uni.redirectTo({
-										url: '/pages/auth/btnAuth/btnAuth',
+										url: '/pages/auth/login/login',
 									})
 								} else {
 									uni.navigateBack({
@@ -121,15 +120,10 @@ const utils = {
 									})
 								}
 							})
-						} else if (res.data.errno === 500) {
-							utils.toast(res.data.msg)
-						} else if (res.data.errno === 404) {
-							utils.toast(res.data.msg)
-						} else {
-							resolve(res.data);
-						}
-					} else {
-						reject(res.data.msg);
+					}else if (res.statusCode === 200){
+						resolve(res.data);
+					}else {						
+						reject(res.data);
 					}
 				},
 				fail: (res) => {
@@ -140,10 +134,10 @@ const utils = {
 					clearTimeout(utils.delayed)
 					utils.delayed = null;
 					if (res.statusCode === 200) {
-						if (res.data.errno === 0 || res.data.errno === 401) {
+						if (res.data.code === 0) {
 							uni.hideLoading()
-						} else {
-							utils.toast(res.data.msg)
+						}else{
+							utils.toast(res.data.msg);
 						}
 					} else {
 						utils.toast('服务器开小差了~')
@@ -204,7 +198,7 @@ const utils = {
 	},
 	//获取token
 	getToken: function() {
-		return uni.getStorageSync("X-Nideshop-Token")
+		return uni.getStorageSync("token")
 	},
 	//去空格
 	trim: function(value) {
@@ -444,8 +438,8 @@ const utils = {
 		});
 	},
 	loginH5: function(data){
-		data.interfaceUrl = "api/"
-		return utils.request("oauth/anno/token", data, "post", "application/json");
+		data.interfaceUrl = "/"
+		return utils.request("anno/token", data, "post", "application/json");
 	},
 	randomNum: function(len, radix) {
 	  const chars = '0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz'.split('')
@@ -473,8 +467,21 @@ const utils = {
 	    }
 	  }
 	  return uuid.join('') + new Date().getTime()
+	},
+	initQueryParams:function(params){
+		const defParams = {
+		    size: 10,
+		    current: 1,
+		    sort: 'id',
+		    order: 'descending',
+		    model: {
+		
+		    },
+		    map: {},
+		    timeRange: null
+		  };
+		return params ? { ...defParams, ...params } : defParams;
 	}
-	
 }
 
 module.exports = {
@@ -506,5 +513,6 @@ module.exports = {
 	payOrder: utils.payOrder,
 	login: utils.login,
 	loginH5: utils.loginH5,
-	randomNum: utils.randomNum
+	randomNum: utils.randomNum,
+	initQueryParams: utils.initQueryParams
 }