Browse Source

订单测试

mym 1 year ago
parent
commit
82bd551c55

+ 6 - 7
pages.json

@@ -68,7 +68,12 @@
 			"path": "pages/oneMarket/oneMarket",
 			"style": {
 				"navigationBarTitleText": "",
-				"enablePullDownRefresh": false
+				"enablePullDownRefresh": false,
+				"app-plus": {
+					"titleNView": {
+						"autoBackButton": false
+					}
+				}
 			}
 
 		}, {
@@ -198,12 +203,6 @@
 				"text": "首页"
 			},
 			{
-				"pagePath": "pages/order/order",
-				"iconPath": "static/tab/dd.png",
-				"selectedIconPath": "static/tab/dd_s.png",
-				"text": "订单"
-			},
-			{
 				"pagePath": "pages/message/message",
 				"iconPath": "static/tab/xx.png",
 				"selectedIconPath": "static/tab/xxs.png",

+ 34 - 16
pages/goodsDetails/goodsDetails.vue

@@ -23,7 +23,7 @@
 		</view>
 		<view class="footer">
 			<u-button class="custom-style" type="warning" @click="addCar()">加入购物车</u-button>
-			<u-button class="custom-style" type="error">立即购买</u-button>
+			<u-button class="custom-style" type="error" @click="buy()">提交订单</u-button>
 		</view>
 		<!-- <u-popup :show="show" @close="close" @open="open">
 			<view>
@@ -56,15 +56,16 @@
 		},
 		methods: {
 			getGoodsDetails() {
-				let params = {
-					id: this.id
-				}
-				this.$api.getGoodsDetails(params).then(res => {
-					this.goods = res.data
-					if (this.goods) {
-						this.type = this.goods.goodsType.toString().split("、")
+				this.http.request({
+					url: '/level-one-server/TbGoodsTransit/getById',
+					data: {id: this.id},
+					success: res => {
+						this.goods = res.data.data;
+						if (this.goods) {
+							this.type = this.goods.goodsType.toString().split("、")
+						}
 					}
-				})
+				});
 			},
 			minus() {
 				if (this.num == 1) {
@@ -78,7 +79,6 @@
 				this.num++
 			},
 			addCar() {
-				// this.show = true
 				let user = uni.getStorageSync("info")
 				let params = {
 					buyUserId: user.id,
@@ -86,17 +86,35 @@
 					shopId: this.goods.shopId,
 					tradeAreaId: this.goods.tradeAreaId,
 					saleGoodsInfoId: this.goods.id,
-					// buyUserType: user.userType,
-					// buyType: parseInt(2),
 					goodsImg: this.goods.goodsImg,
 					goodsName: this.goods.goodsName,
 					// buyNum: parseInt(this.num)
 				}
-				this.$api.addCar(params).then(res => {
-					if(res.code == 200) {
-						this.$common.toast(res.msg)
+				this.http.request({
+					url: '/level-one-server/app/TbGoodsCart/addGoodsInShopCart',
+					data: params,
+					contentType: 'application/json; charset=utf-8',
+					method: 'POST',
+					success: res => {
+						setTimeout(function (){
+							uni.showToast({title: res.data.data.msg});
+						},1000)
+					}
+				});
+			},
+			// 立即购买
+			buy() {
+				this.http.request({
+					url: '/level-one-server/app/TbGoodsTransit/purchaseLevelOntGoodsTransit',
+					data: { goodsTransitId: this.goods.id },
+					method: 'POST',
+					contentType: 'application/json; charset=utf-8',
+					success: res => {
+						setTimeout(function (){
+							uni.showToast({title: res.data.data.msg});
+						},1000)
 					}
-				})
+				});
 			}
 		}
 	}

+ 23 - 17
pages/index/index.vue

@@ -73,8 +73,11 @@ export default {
 	},
 	methods: {
 		getBannerList() {
-			this.$api.getBannerList().then(resp => {
-				this.bannerList = resp.data;
+			this.http.request({
+				url: '/level-one-server/app/TbBanner/getList',
+				success: res => {
+					this.bannerList = res.data.data;
+				}
 			});
 		},
 		getRoleMenu() {
@@ -92,25 +95,28 @@ export default {
 		},
 		getMenu() {
 			let menu = uni.getStorageSync('menu');
-			this.$api.getMenu().then(res => {
-				menu.map((item2, index1) => {
-					res.data.map((item1, index) => {
-						if (parseInt(item1.id) == parseInt(item2)) {
-							this.menuList.push(item1);
-						}
+			this.http.request({
+				url: '/sp-admin/AppMenu/getList',
+				success: res => {
+					let data = res.data.data
+					menu.map((item2, index1) => {
+						data.map((item1, index) => {
+							if (parseInt(item1.id) == parseInt(item2)) {
+								this.menuList.push(item1);
+							}
+						});
 					});
-					this.$forceUpdate();
-				});
+				}
 			});
 		},
 		getNewsList() {
-			this.$api
-				.getNewestList({
-					limit: 4
-				})
-				.then(resp => {
-					this.newsList = resp.data;
-				});
+			this.http.request({
+				url: '/level-one-server/app/TbPortNews/getNewestList',
+				data: { limit: 4 },
+				success: res => {
+					this.newsList = res.data.data;
+				}
+			});
 		},
 		navTo(path) {
 			this.$common.to(path);

+ 5 - 2
pages/login/chooseRole.vue

@@ -26,8 +26,11 @@ export default {
 	},
 	methods: {
 		getList() {
-			this.$api.getIdentifyList().then(res => {
-				this.roles = res.data;
+			this.http.request({
+				url: '/sp-admin/app/AppRole/getList',
+				success: res => {
+					this.roles = res.data.data;
+				}
 			});
 		},
 		next() {

+ 1 - 1
pages/login/login.vue

@@ -10,7 +10,7 @@
 		<view class="dk">
 			<view class="bg">
 				<text class="icon">&#xe8b9;</text>
-				<input type="number" v-model="form.phone" placeholder="请输入手机号" />
+				<input type="number" v-model="form.phone" maxlength="11" placeholder="请输入手机号" />
 			</view>
 			<view class="bg">
 				<text class="icon">&#xe8b2;</text>

+ 104 - 69
pages/login/register.vue

@@ -13,12 +13,16 @@
 			<view class="bg">
 				<text class="icon">&#xe8b2;</text>
 				<input :password="show" v-model="form.password" placeholder="请输入密码" />
-				<view class="label"><view class="icon" :class="{ active: !show }" @click="show = !show">&#xe7a6;</view></view>
+				<view class="label">
+					<view class="icon" :class="{ active: !show }" @click="show = !show">&#xe7a6;</view>
+				</view>
 			</view>
 			<view class="bg">
 				<text class="icon">&#xe8b2;</text>
 				<input :password="show" v-model="form.rePassword" placeholder="确认密码" />
-				<view class="label"><view class="icon" :class="{ active: !show }" @click="show = !show">&#xe7a6;</view></view>
+				<view class="label">
+					<view class="icon" :class="{ active: !show }" @click="show = !show">&#xe7a6;</view>
+				</view>
 			</view>
 			<view class="xy">
 				<u-checkbox-group class="checkbox" v-model="form.checked">
@@ -35,79 +39,110 @@
 </template>
 
 <script>
-export default {
-	data() {
-		return {
-			show: true,
-			time: 60,
-			code: '获取验证码',
-			form: {}
-		};
-	},
-	onLoad(option) {
-		this.form.type = option.type;
-	},
-	created() {},
-	methods: {
-		startCount() {
-			setTimeout(() => {
+	export default {
+		data() {
+			return {
+				show: true,
+				time: 60,
+				code: '获取验证码',
+				form: {}
+			};
+		},
+		onLoad(option) {
+			this.form.type = option.type;
+		},
+		created() {},
+		methods: {
+			startCount() {
+				setTimeout(() => {
+					let time = this.time;
+					if (time == 0) {
+						this.code = '重新获取';
+						this.time = 60;
+						return;
+					}
+					this.time = --time;
+					this.code = time + '后重新获取';
+					this.startCount();
+				}, 1000);
+			},
+			getCode() {
 				let time = this.time;
-				if (time == 0) {
-					this.code = '重新获取';
-					this.time = 60;
+				if (time > 0 && time < 60) {
+					return;
+				}
+				let phone = this.form.phone;
+				if (!this.$common.isPhone(phone)) {
+					this.$common.toast('请输入正确的手机号');
 					return;
 				}
-				this.time = --time;
-				this.code = time + '后重新获取';
 				this.startCount();
-			}, 1000);
-		},
-		getCode() {
-			let time = this.time;
-			if (time > 0 && time < 60) {
-				return;
-			}
-			let phone = this.form.phone;
-			if (!this.$common.isPhone(phone)) {
-				this.$common.toast('请输入正确的手机号');
-				return;
-			}
-			this.startCount();
-			this.$api.getPhoneSmsCode().then(resp => {
-				this.$common.toast('已发送');
-			});
-		},
-		submit() {
-			let rule = [
-				{ name: 'phone', checkType: 'phone', errorMsg: '请输入正确的手机号码' },
-				{ name: 'smsCode', checkType: 'notnull', errorMsg: '请输入验证码' },
-				{ name: 'password', checkType: 'notnull', errorMsg: '请输入密码' },
-				{ name: 'rePassword', checkType: 'same', checkRule: this.form.password, errorMsg: '两次输入不一致' },
-				{ name: 'checked', checkType: 'notnull', errorMsg: '请同意并勾选协议' }
-			];
-			if (!this.verify.check(this.form, rule)) {
-				uni.showModal({ content: this.verify.error, showCancel: false });
-				return false;
-			}
-			this.$api.doRefister(this.form).then(res => {
-				if (res.code == 200) {
-					uni.$u.toast('注册成功');
-					uni.navigateTo({
-						url: '/pages/login/login'
+				this.$api.getPhoneSmsCode().then(resp => {
+					this.$common.toast('已发送');
+				});
+			},
+			submit() {
+				let rule = [{
+						name: 'phone',
+						checkType: 'phone',
+						errorMsg: '请输入正确的手机号码'
+					},
+					{
+						name: 'smsCode',
+						checkType: 'notnull',
+						errorMsg: '请输入验证码'
+					},
+					{
+						name: 'password',
+						checkType: 'notnull',
+						errorMsg: '请输入密码'
+					},
+					{
+						name: 'rePassword',
+						checkType: 'same',
+						checkRule: this.form.password,
+						errorMsg: '两次输入不一致'
+					},
+					{
+						name: 'checked',
+						checkType: 'notnull',
+						errorMsg: '请同意并勾选协议'
+					}
+				];
+				if (!this.verify.check(this.form, rule)) {
+					uni.showModal({
+						content: this.verify.error,
+						showCancel: false
 					});
+					return false;
 				}
-			});
-		},
-		toLogin() {
-			uni.navigateTo({
-				url: '/pages/login/login'
-			});
-		},
-		getAgreement(id) {
-			uni.navigateTo({ url: '/pages/login/userAgreement?id=' + id });
+				this.http.request({
+					url: '/sp-admin/app/AppUser/register',
+					data: this.form,
+					contentType: 'application/json; charset=utf-8',
+					method: 'POST',
+					success: resp => {
+						setTimeout(function (){
+							uni.showToast({title: '注册成功'});
+							uni.navigateTo({
+								url: '/pages/login/login'
+							});
+						},1000)
+					}
+				});
+			},
+			toLogin() {
+				uni.navigateTo({
+					url: '/pages/login/login'
+				});
+			},
+			getAgreement(id) {
+				uni.navigateTo({
+					url: '/pages/login/userAgreement?id=' + id
+				});
+			}
 		}
-	}
-};
+	};
 </script>
 
-<style lang="scss"></style>
+<style lang="scss"></style>

+ 10 - 7
pages/login/userAgreement.vue

@@ -26,13 +26,16 @@
 				let params = {
 					id: this.id
 				}
-				this.$api.getAgreement(params).then(res => {
-					console.log(res)
-					this.title = res.data.type
-					this.content = res.data.content
-				}).catch(err => {
-					console.log(err)
-				})
+				this.http.request({
+					url: '/level-one-server/app/TbAgreement/getById',
+					data: params,
+					method: 'get',
+					success: res => {
+						let data = res.data.data
+						this.title = data.type
+						this.content = data.content
+					}
+				});
 			},
 			back() {
 				uni.navigateBack({

+ 35 - 25
pages/oneMarket/oneMarket.vue

@@ -1,6 +1,6 @@
 <template>
 	<view>
-		<navigation-bar title="一级市场" background-color="#fff" front-color="#000000" />
+		<navigation-bar title="一级市场" background-color="#fff" front-color="#000000" :left-button="null" />
 		<u-list class="list" width="100%" @scrolltolower="scrolltolower">
 			<u-list-item v-for="(item, index) in goods" :key="index">
 				<view class="card" @click="toDetails(item.id)">
@@ -15,8 +15,14 @@
 					</view>
 				</view>
 			</u-list-item>
-			<u-loadmore v-if="goods" :status="loadmoreStatus" margin-top="20" @loadmore="clickLoadMore" margin-bottom="50" />
+			<!-- 	<u-loadmore v-if="goods" :status="loadmoreStatus" margin-top="20" @loadmore="clickLoadMore"
+				margin-bottom="50" /> -->
 		</u-list>
+		<view style="padding: 20px; display: flex;">
+			<u-button type="primary" text="市场"></u-button>
+			<u-button type="primary" text="购物车"></u-button>
+			<u-button type="primary" text="订单列表" @click="swiTap"></u-button>
+		</view>
 	</view>
 </template>
 
@@ -25,40 +31,44 @@
 		data() {
 			return {
 				loadmoreStatus: 'loadmore',
-				goods: []
+				goods: [],
+				active: 1,
 			}
 		},
 		onLoad() {
 			this.getGoodsList()
 			// this.loadmore()
 		},
+		// onShow() {
+		// 	var a = document.getElementsByClassName('uni-page-head-hd')[0]
+		// 	a.style.display = 'none';
+		// },
 		methods: {
 			getGoodsList() {
-				// let params = {
-				// 	goodsType: 1
-				// }
-				this.$api.getGoodsList().then(res => {
-					this.goods = res.data
-					this.goods.forEach((item, index) => {
-						if (index === this.goods.length - 1) {
-							this.loadmoreStatus = 'nomore'
-						} else {
-							this.loadmoreStatus = 'loadmore'
-						}
-					})
-				})
+				this.http.request({
+					url: '/level-one-server/TbGoodsTransit/getTransitList',
+					success: res => {
+						this.goods = res.data.data;
+						this.goods.forEach((item, index) => {
+							if (index === this.goods.length - 1) {
+								this.loadmoreStatus = 'nomore'
+							} else {
+								this.loadmoreStatus = 'loadmore'
+							}
+						})
+					}
+				});
 			},
 			scrolltolower() {
 				this.getGoodsList()
 			},
-			// loadmore() {
-			// 	if (this.loadmoreStatus === 'loadmore') {
-			// 		this.pageNo++;
-			// 		this.loadmoreStatus = 'loading'
-			// 	}
-			// }
 			toDetails(id) {
-				this.$common.to('/pages/goodsDetails/goodsDetails?id='+id)
+				this.$common.to('/pages/goodsDetails/goodsDetails?id=' + id)
+			},
+			swiTap() {
+				uni.navigateTo({
+					url: '/pages/order/order'
+				})
 			}
 		}
 	}
@@ -66,7 +76,7 @@
 
 <style>
 	.list {
-		height: 100%;
+		height: auto;
 		border-radius: 10rpx;
 		background-color: #fff;
 	}
@@ -80,7 +90,7 @@
 		height: 300rpx;
 		width: 100%;
 		/* border: #888 1rpx solid; */
-		box-shadow:  1rpx 1rpx #888;
+		box-shadow: 1rpx 1rpx #888;
 		border-radius: 10rpx;
 	}
 

+ 88 - 6
pages/order/order.vue

@@ -1,6 +1,54 @@
 <template>
 	<view>
-		<u-tabs :list="list" :is-scroll="false" :current="current" @change="change"></u-tabs>
+		<u-tabs lineWidth="50" :list="list" itemStyle="height:60rpx;width: 100rpx;" :is-scroll="false" :current="current"
+			@change="change"></u-tabs>
+		<u-list style="margin-top: 10rpx" @scrolltolower="scrolltolower">
+			<u-list-item v-for="(item, index) in orderList" :key="index">
+				<view class="item-box">
+					<view class="goods-item">
+						<u-row>
+							<u-col span="10">
+								{{item.shopName}}
+							</u-col>
+							<u-col span="2" v-if="item.finishStatus">
+								已完成
+							</u-col>
+							<u-col span="2" v-else-if="item.resaleStatus">
+								转售中
+							</u-col>
+							<u-col span="2" v-else>
+								待确认
+							</u-col>
+						</u-row>
+					</view>
+					<view class="goods-item">
+						<u-row>
+							<u-col span="4">
+								<u--image :showLoading="true" :src="src" width="230rpx" height="210rpx"></u--image>
+							</u-col>
+							<u-col span="5">
+								<u--text lines="1" size="18" :text="item.goodsNames"></u--text>
+								<u--text prefixIcon="map" style="margin-top: 40rpx;" lineHeight="70" iconStyle="font-size: 20px"  lines="1" :text="item.tradeAreaName"></u--text>
+							</u-col>
+							<u-col span="3">
+								<u--text color="#FF4500" align="center" lineHeight="50" size="20" lines="1" :text="`¥${item.totalPrice}`"></u--text>
+								<u--text lines="1" align="center" :text="`${item.totalWeight}吨`"></u--text>
+							</u-col>
+						</u-row>
+					</view>
+					<view class="goods-item">
+						<u-row>
+							<u-col span="9">
+								{{item.tradeTime}}
+							</u-col>
+							<u-col span="3">
+								<u-button type="error" size="mini" text="通知商家"></u-button>
+							</u-col>
+						</u-row>
+					</view>
+				</view>
+			</u-list-item>
+		</u-list>
 	</view>
 </template>
 
@@ -13,18 +61,52 @@
 				}, {
 					name: '待确认'
 				}, {
+					name: '申报中'
+				}, {
+					name: '已完成'
+				}, {
+					name: '转售中'
+				}, {
 					name: '已取消'
 				}],
-				current: 0
+				current: 0,
+				orderList: [],
+				status: 0
 			}
 		},
-		onLoad() {},
+		onLoad() {
+			this.getOrderList()
+		},
 		methods: {
-
-
+			change(item) {
+				this.current = item.index
+			},
+			getOrderList() {
+				this.http.request({
+					url: '/level-one-server/app/TbOrder/getList',
+					success: res => {
+						this.orderList = res.data.data;
+					}
+				});
+			}
 		}
 	}
 </script>
 
-<style>
+<style lang="scss">
+	page{
+		padding: 15rpx;
+	}
+	
+	.goods-item{
+		margin-bottom: 8rpx;
+	}
+	
+	.item-box{
+		height: 300rpx;
+		padding: 10rpx;
+		border: 1rpx #888 solid;
+		margin: 10rpx 0rpx;
+		border-radius: 10rpx;
+	}
 </style>

+ 1 - 1
utils/request.js

@@ -1,5 +1,5 @@
 // const server = 'http://127.0.0.1:8080';
-const server = 'http://192.168.88.36:8080';
+const server = 'http://192.168.88.34:8080';