lyy@qq.com 1 년 전
부모
커밋
d712d639ab

+ 11 - 0
env/dev.js

@@ -0,0 +1,11 @@
+const ENV_PATH = {
+  serverPath: 'http://36.137.224.81:8030', // 请求前缀地址
+  //serverFilePath: 'https://lsfdev.benyuntech.com/data/access', // 文件前缀地址
+  appId: 'wxfc1ae62fd810717d', // 小程序 appid
+  appName: '销售小程序', // 小程序名称(登录页面显示的名称)
+  name: '销售系统', // 小程序名称
+  // webSocketURL: 'wss://lsfdev.benyuntech.com/ws/websocket', // websocket url
+  logo: '/1679883944003-logo1.png', // 登录页面显示的 logo
+}
+
+module.exports = ENV_PATH

+ 19 - 12
main.js

@@ -42,17 +42,21 @@ Vue.prototype.$request = function(method, url, data, isJSON, hideLoading, showEr
 		if (!hideLoading) {
 			uni.showLoading({
 				title: '请稍后...'
-			});
+			})
 		}
 
 		// 过滤 null,undefind,'' 的参数
 		for (let key in data) {
 			if (data[key] === null || data[key] === undefined || data[key] === '') {
-				delete data[key];
+				delete data[key]
 			}
 		}
 
 		const token = uni.getStorageSync('token');
+		const tenantId = uni.getStorageSync('tenantId');
+		if (tenantId) {
+			data.tenantId = tenantId;
+		}
 		url = url.indexOf('http') === 0 ? url : `${Vue.prototype.serverPath}${url}`;
 		uni.request({
 			url,
@@ -61,19 +65,22 @@ Vue.prototype.$request = function(method, url, data, isJSON, hideLoading, showEr
 			header: {
 				"Content-Type": "application/x-www-form-urlencoded;charset=UTF-8",
 				// 'Content-Type': isJSON ? '' : 'application/x-www-form-urlencoded',
-				'Authorization': `Bearer ${token}`,
-				'tenantId': Vue.prototype.tenantId
+				// 'Authorization': `Bearer ${token}`,
+				'Authorization': 'Bearer ' + token,
+				clientId: '8871d05eacc4406083d3bb0a085b6999',
+				// 'tenantId': Vue.prototype.tenantId
+				// 'tenantId': `${tenantId}`
 			},
 			success: (res) => {
 				uni.hideLoading();
-				if (res.data.code === 0) {
+				if (res.data.code === 200) {
 					resolve(res.data);
 				} else {
 					if (showErrMsg) {
 						resolve({
 							result: false,
 							msg: res.data.msg
-						});
+						})
 					} else {
 						resolve(false);
 						if (this.$refs && this.$refs.uNotify) {
@@ -82,18 +89,18 @@ Vue.prototype.$request = function(method, url, data, isJSON, hideLoading, showEr
 								top: 0,
 								message: res.data.msg,
 								icon: 'error-circle'
-							});
+							})
 						}
 					}
 				}
 			},
 			fail: (err) => {
-				uni.hideLoading();
-				resolve(false);
+				uni.hideLoading()
+				resolve(false)
 			}
-		});
-	});
-};
+		})
+	})
+}
 
 Vue.prototype.autoLogin = async () => { // 小程序自动登录
 	return new Promise(resolve => {

+ 0 - 7
pages.json

@@ -15,13 +15,6 @@
 				"enablePullDownRefresh" : false
 			}
 		},
-		{
-			"path" : "pages/classify/detail",
-			"style" : 
-			{
-				"navigationBarTitleText" : "商品详情"
-			}
-		},
 		{
 			"path" : "pages/diningList/diningList",
 			"style" : 

+ 11 - 6
pages/classify/classify.vue

@@ -4,8 +4,8 @@
 			<u-row justify="space-between" customStyle="margin-bottom: 10px">
 				<u-col span="3">
 					<view class="icon-container-l">
-						<uni-badge size="small" :text="100" absolute="rightTop">
-							<u-icon label="自提" labelPos="bottom" size="38" name="order"></u-icon>
+						<uni-badge size="normal" :text="txts" absolute="rightTop">
+							<u-icon :name="iconCooking" label="自提" labelPos="bottom" size="32" ></u-icon>
 						</uni-badge>
 					</view>
 				</u-col>
@@ -17,7 +17,7 @@
 				</view>
 				<u-col span="3">
 					<view class="icon-container-r">
-						<u-icon label="我的" labelPos="bottom" size="38" name="account"></u-icon>
+						<u-icon label="我的" labelPos="bottom" size="32" :name="iconPeople"></u-icon>
 					</view>
 				</u-col>
 			</u-row>
@@ -51,7 +51,7 @@
 				<view class="w-full dflex-b">
 					<view class="price">{{item.goods_price}}</view>
 					<view>
-						<u-button type="primary" shape="circle" size="small" icon="map"
+						<u-button type="primary" shape="circle" size='small' icon="shopping-cart-fill"
 							color="linear-gradient(to right, #F54319, #FF6D20)" @click="goCart"></u-button>
 					</view>
 				</view>
@@ -74,15 +74,20 @@
 
 <script>
 	import cartPopupVue from '../../components/cartPopup.vue'
+	import iconCooking from '../../static/cooking.png'
+	import iconPeople from '../../static/people.png'
 	export default {
 		components: {
-			cartPopupVue
+			cartPopupVue,
 		},
 		data() {
 			return {
 				onIndex: 0,
 				show: false,
+				iconCooking: iconCooking, 
+				iconPeople: iconPeople,
 				tags: 1,
+				txts: 1,
 				goods: [ // 购物车数据列表
 					{
 						id: 1,
@@ -136,7 +141,7 @@
 			},
 			toDetial() {
 				uni.navigateTo({
-					url: `/pages/classify/detail`
+					url: `/pages/goodDetail/goodDetail`
 				})
 			}
 		}

+ 16 - 14
pages/diningCar/diningCar.vue

@@ -4,17 +4,17 @@
 			<view class="box linear2" style="height:100vh;">
 				<view class="boxContent2" style="margin-top:50%;">
 					<view class="clearfix" style="margin-bottom: 10px;">
-						<text class="fz26px" style="font-weight: bold;">{{dingName}}</text>
+						<text class="fz26px" style="font-weight: bold;">{{dinList.name ? dinList.name : '无'}}</text>
 						<u-line dashed></u-line>
 					</view>
 					<view class="flex-container">
 						<text class="flex-item">营业状态</text>
-						<u-tag class="flex-item tag-item" plain :text="tags ? '营业中' : '离线'" :type="tags ? 'success' : 'error'" size="mini"></u-tag>
+						<u-tag class="flex-item tag-item" plain :text="dinList.openState ? '营业中' : '离线'" :type="dinList.openState ? 'success' : 'error'" size="mini"></u-tag>
 					</view>
 					<text>客服电话:18011111111</text>
 				</view>
 				<view class="footer">
-					<u-button type="primary" shape="circle" text="拨打客服电话"
+					<u-button type="primary" shape="circle" icon="phone" text="拨打客服电话"
 						color="linear-gradient(to right, #F54319, #FF6D20)" @click="call()"></u-button>
 				</view>
 			</view>
@@ -28,14 +28,19 @@
 			return {
 				img: 'https://cdn.uviewui.com/uview/album/1.jpg',
 				orderinfo: {},
-				dinList: {},
-				tags: 1,
-				dingName: '23333'
+				dinList: {
+					name: '23333',
+					openState: 1,
+				},
+				
 			}
 		},
-		created() {
-			this.fatchDate()
+		onLoad(e) {
+		  this.fatchDate(e.id);
 		},
+		// created() {
+		// 	this.fatchDate(e.id)
+		// },
 		methods: {
 			call() {
 				if (this.orderinfo.shopCall) {
@@ -49,12 +54,9 @@
 					})
 				}
 			},
-			fatchDate() {
-				const params = {
-					id: '1111'
-				}
-				//const result = await this.$request('get', '/diningCar/{id}')
-				const result = this.$request('get', '/diningCar', params)
+			fatchDate(e) {
+				console.log('e===========================e', e)
+				const result = this.$request('get', '/sale/diningCar/queryDiningCarById', {id: e})
 				if (result) {
 					this.dinList = result.data
 				}

+ 132 - 33
pages/diningList/diningList.vue

@@ -1,19 +1,26 @@
 <template>
-	<view class="mt20px">
-		<view class="contain">
-			<view class="box" :class="{ 'boxed-border': showBorder }">
-				<view class="container">
+	<view>
+		<view class="btnS">
+			<view style="width: 90%;">
+				<u-search :clearabled="true" shape="round" :showAction="false" v-model="seaName"></u-search>
+			</view>
+		</view>
+		
+		<view class="contain" style="margin: 10px 0;" v-for="(item, index)  in tableData" :key="index">
+			<view class="box" :class="{ 'boxed-border': item.isAsc }" >
+				<view class="container" @click="carList">
 					<view class="text-container">
-						<view class="flex-item">{{dingName}}</view>
-						<u-tag plain :text="tags ? '营业中' : '离线'" :type="tags ? 'success' : 'error'" size="mini"></u-tag>
-					</view>
-					<view class="icon-container">
-						<u-icon name="plus-circle" size="24" @click="call"></u-icon>
-						<u-icon style="margin-left: 10px;" name="info-circle" size="24" @click="btnIC"></u-icon>
+						<view class="flex-item">{{item.name}}</view>
+						<u-tag plain :text="item.openState ? '营业中' : '离线'" :type="item.openState ? 'success' : 'error'" size="mini"></u-tag>
 					</view>
 				</view>
-				<view :class="{ 'btnbor': showBorder }" v-if="showBorder">
-					<u-tag text="镂空" bgColor='#FF6D20' borderColor='#FF6D20' icon="map"></u-tag>
+				<view class="icon-container">
+						<u-icon name="phone" size="28" @click.stop="call"></u-icon>
+						<u-icon style="margin-left: 10px;" name="info-circle" size="28" @click.stop="btnIC(item)"></u-icon>
+					</view>
+				<view :class="{ 'btnbor': item.isAsc }" v-if="item.isAsc">
+					<!-- <u-tag text="当前" bgColor='#FF6D20' borderColor='#FF6D20' icon="checkmark-circle"></u-tag> -->
+					<image src="../../static/danqian.png" class="img-ding"></image>
 				</view>
 			</view>
 		</view>
@@ -24,18 +31,44 @@
 	export default {
 		data() {
 			return {
-				tags: 1,
-				showBorder: false,
-				dingName: '23333',
+				seaName:'',
 				orderinfo: {},
-				tableData: []
+				tableData: [
+					{
+						dingName: '23333',
+						tags: 1,
+						showBorder: true,
+					},
+					{
+						dingName: '门店',
+						tags: 1,
+						showBorder: false,
+					},
+					{
+						dingName: '店家',
+						tags: 1,
+						showBorder: false,
+					}
+				],
+				page: {
+					pageNum: 1,
+					pageSize: 20,
+					total: 0,
+					totalPage: 0
+				},
+				status: 'loading'
 			}
 		},
 		created() {
 			this.fatchDate()
 		},
 		methods: {
-			call() {
+			searchClick() {
+				
+			},
+			async call() {
+				const response = await this.$request('get', '/sale/customer/queryCustomer', this.tableData.customerId);
+				
 				if (this.orderinfo.shopCall) {
 					uni.makePhoneCall({
 						phoneNumber: this.orderinfo.shopCall
@@ -47,18 +80,46 @@
 					})
 				}
 			},
-			btnIC() {
+			btnIC(e) {
+				console.log('e=================', e)
 				uni.navigateTo({
-					url: `/pages/diningCar/diningCar`
+					url: `/pages/diningCar/diningCar?id=${e.id}`
 				})
 			},
-			fatchDate() {
-				//const result = await this.$request('get', '/diningCar/{id}')
-				const result = this.$request('get', '/diningCar/queryDiningCar')
-				if (result) {
-					console.log('result', result.data)
-					this.tableData = result.data
+			carList() {
+				uni.navigateTo({
+					url: `/pages/classify/classify`
+				})
+			},
+			async fatchDate() {
+				var queryParams = {
+					"pageSize": this.page.pageSize,
+					"pageNum": this.page.pageNum
+				}
+				try {
+					const response = await this.$request('get', '/sale/diningCar/queryDiningCar', queryParams);
+					console.log('response', response)
+				
+					const data = response.rows; // 假设 res.rows 是一个数组
+					console.log('response.rows', response.rows);
+					if (response.code === 200) {
+						const li = data;
+						if (this.page.pageNum === 1) {
+							this.tableData = li;
+						} else {
+							this.tableData = this.tableData.concat(li);
+						}
+						this.page.total = data.count;
+						this.page.totalPage = Math.ceil(data.count / this.page.pageSize);
+						this.status = this.page.totalPage === 0 || this.page.totalPage === this.page.pageNum ?
+							'noMore' : 'more';
+					} else {
+						this.$toast(data.msg);
+					}
+				} catch (err) {
+					console.error('请求异常', err);
 				}
+
 			}
 		}
 	}
@@ -76,7 +137,27 @@
 		border-radius: 20rpx;
 		background-color: #fff;
 
+		.btnbor {
+			margin: -32rpx -20rpx 0;
+			// margin-right: -11px;
+			// margin-top: -15px;
+			float: right;
+			position: relative; // 设置为相对定位
 
+			&::after {
+				content: '';
+				display: block;
+				width: 100%;
+				height: 100%;
+				border: 1px solid #FF6D20;
+				border-radius: 20rpx;
+				position: absolute;
+				top: 0;
+				right: 0;
+				background-color: #fff;
+				z-index: -1; // 使边框在图片下面
+			}
+		}
 	}
 
 	.boxed-border {
@@ -86,11 +167,11 @@
 		border-radius: 20rpx;
 		/* 添加圆角 */
 
-		.btnbor {
-			margin-right: -11px;
-			margin-top: -3px;
-			float: right;
-		}
+		// .btnbor {
+		// 	margin-right: -11px;
+		// 	margin-top: -15px;
+		// 	float: right;
+		// }
 	}
 
 	.box:hover {
@@ -118,7 +199,7 @@
 	}
 
 	.flex-item {
-		margin-bottom: 10px; 
+		margin-bottom: 10px;
 	}
 
 	.tag-item {
@@ -133,7 +214,25 @@
 		/* 水平排列子元素 */
 		justify-content: flex-end;
 		/* 子元素右对齐 */
-		margin-top: -30px;
-		gap: 10px; /* 设置图标之间的距离 */
+		margin-top: -55px;
+		right: 0;
+		bottom: 0;
+		gap: 10px;
+		/* 设置图标之间的距离 */
+	}
+
+	.img-ding {
+		width: 83px;
+		height: 30px;
+		position: absolute;
+		right: 0;
+		top: 0;
+		margin: 0; // 清除 margin 属性,以避免与边框重叠
+	}
+	.btnS {
+		display: flex;
+		justify-content: center;
+		align-items: center;
+		margin-top: 5px;
 	}
 </style>

+ 42 - 22
pages/login/login.vue

@@ -1,6 +1,12 @@
 <template>
 	<view>
-		<u-button @click="loginUse">点击登录</u-button>
+		<image :src="src" class="img"></image>
+		<view class="btn">
+			<view style="width: 80%;">
+				<u-button shape="circle" color="linear-gradient(to right, #F54319, #FF6D20)"
+					@click="loginUse">点击登录</u-button>
+			</view>
+		</view>
 	</view>
 </template>
 
@@ -9,7 +15,8 @@
 		name: 'MyLogin',
 		data() {
 			return {
-				infoData: {}
+				infoData: {},
+				src: '../../static/first.png'
 			}
 		},
 		methods: {
@@ -17,28 +24,31 @@
 				wx.login({
 					success: async (e) => {
 						console.log('数据:', e)
-						const result = await this.$request('post', '/miniLogin?tenantId=000000&code=' + e.code)
-						console.log('登录成功:', result)
-						// 处理响应数据
-						if (!result) {
-							console.log('登录成功:', result.data)
-							var token = result.data.access_token;
-							var haveOpenid = result.data.open_id;
-							uni.setStorageSync("token", token);
-							success: (result) => {
-								console.log('登录成功:', result)
-								uni.hideLoading()
+						try {
+							const result = await this.$request('post', '/auth/miniLogin', {
+								tenantId: '000000',
+								clientId: '8871d05eacc4406083d3bb0a085b6999',
+								code: e.code
+							})
+							console.log('登录成功:', result);
+							if (result && result.result !== false) {
+								var token = result.data.accessToken;
+								var haveOpenid = result.data.openId;
+								var tenantId = result.data.tenantId
+								uni.setStorageSync("token", token);
 								uni.navigateTo({
-									url: `/pages/classify/classify`
-								})
-							};
-							fail: (result) => {
-								uni.hideLoading()
+									url: `/pages/diningList/diningList`
+								});
+							} else {
+								// 处理错误情况
 							}
+						} catch (error) {
+							// 处理请求失败的情况
+							console.error('登录失败:', error);
 						}
 					}
 				})
-				
+
 				// let that = this;
 				// wx.login({
 				// 	success: function(e) {
@@ -55,7 +65,7 @@
 				// 			success: res => {
 				// 				console.log('登录成功:', res)
 				// 				uni.hideLoading()
-				// 				var token = res.data.data.access_token;
+				// 				var token = res.data.data.accessToken;
 				// 				console.log('token:', token)
 				// 				uni.setStorageSync("token", token);
 				// 				uni.navigateTo({
@@ -71,12 +81,22 @@
 				// 		})
 				// 	}
 				// })
-				
+
 			}
 		}
 	}
 </script>
 
-<style>
+<style lang="scss" scoped>
+	.img {
+		height: 375px;
+		width: 100%;
+	}
 
+	.btn {
+		display: flex;
+		justify-content: center;
+		align-items: center;
+		margin-top: 20px;
+	}
 </style>

BIN
static/aftersale.png


BIN
static/bookmarko.png


BIN
static/clocko.png


BIN
static/close.png


BIN
static/cooking.png


BIN
static/dangq.png


BIN
static/danqian.png


BIN
static/first.png


BIN
static/people.png


BIN
static/service.png


BIN
static/sign.png


BIN
static/stLine.png


BIN
static/stLineuser.png


+ 104 - 0
vue.config.js

@@ -0,0 +1,104 @@
+// 读取 manifest.json ,修改后重新写入
+const {
+  log
+} = require('console')
+const fs = require('fs')
+const package_json = require('./package.json')
+const manifestPath = `${__dirname}/manifest.json`
+const pagePath = `${__dirname}/pages.json`
+const scssPath = `${__dirname}/uni.scss`
+let Manifest = fs.readFileSync(manifestPath, {
+  encoding: 'utf-8'
+})
+let Pagejson = fs.readFileSync(pagePath, {
+  encoding: 'utf-8'
+})
+let Scss = fs.readFileSync(scssPath, {
+  encoding: 'utf-8'
+})
+
+function replaceManifest(path, value) { // 修改 manifest.json 的配置
+  const arr = path.split('.')
+  const len = arr.length
+  const lastItem = arr[len - 1]
+
+  let i = 0
+  let ManifestArr = Manifest.split(/\n/)
+
+  for (let index = 0; index < ManifestArr.length; index++) {
+    const item = ManifestArr[index]
+    if (new RegExp(`"${arr[i]}"`).test(item)) ++i;
+    if (i === len) {
+      const hasComma = /,/.test(item)
+      ManifestArr[index] = item.replace(new RegExp(`"${lastItem}"[\\s\\S]*:[\\s\\S]*`), `"${lastItem}": ${value}${hasComma ? ',' : ''}`)
+      break;
+    }
+  }
+
+  Manifest = ManifestArr.join('\n')
+}
+
+function replacePagejson(path, value) { // 修改 pages.json 的配置
+  const arr = path.split('.')
+  const len = arr.length
+  const lastItem = arr[len - 1]
+
+  let i = 0
+  let PagejsonArr = Pagejson.split(/\n/)
+
+  for (let index = 0; index < PagejsonArr.length; index++) {
+    const item = PagejsonArr[index]
+    if (new RegExp(`"${arr[i]}"`).test(item)) ++i;
+    if (i === len) {
+      const hasComma = /,/.test(item)
+      PagejsonArr[index] = item.replace(new RegExp(`"${lastItem}"[\\s\\S]*:[\\s\\S]*`), `"${lastItem}": ${value}${hasComma ? ',' : ''}`)
+      break;
+    }
+  }
+
+  Pagejson = PagejsonArr.join('\n')
+}
+
+function replaceScssPath(path, value) { // 修改 uni.scss.json 的配置
+  const arr = path.split('.')
+  const len = arr.length
+  const lastItem = arr[len - 1]
+
+  let i = 0
+  let ScssArr = Scss.split(/\n/)
+  for (let index = 0; index < ScssArr.length; index++) {
+    const item = ScssArr[index]
+    const hasComma = /,/.test(item)
+    const reg = new RegExp(`${lastItem}[\\s\\S]*:[\\s\\S]*`)
+    ScssArr[index] = item.replace(reg, `${lastItem}: ${value};`)
+  }
+
+  Scss = ScssArr.join('\n')
+}
+// 使用
+if (process.env.UNI_SCRIPT) {
+  const path = package_json['uni-app']['scripts'][process.env.UNI_SCRIPT]['env']['ENV_PATH'] // 配置文件路径
+  const config = require(path) // 读取配置信息
+  replaceManifest('mp-weixin.appid', `"${config.appId}"`) // 更新 appid
+  replacePagejson('globalStyle.navigationBarTitleText', `"${config.name}"`) // 更新 pages.json
+  replaceScssPath('base-img-url', `'${config.serverFilePath}'`)
+}
+
+// 更新 manifest.json
+fs.writeFileSync(manifestPath, Manifest, {
+  "flag": "w"
+})
+
+// 更新 pages.json
+fs.writeFileSync(pagePath, Pagejson, {
+  "flag": "w"
+})
+
+// 更新 uni.scss
+fs.writeFileSync(scssPath, Scss, {
+  "flag": "w"
+})
+
+module.exports = {
+  // ...
+}