Selaa lähdekoodia

app商品管理

linbl 1 vuosi sitten
vanhempi
commit
cfe6a9b882

+ 29 - 2
pages.json

@@ -94,8 +94,26 @@
 		},{
 			"path": "pages/goodsManage/oneMarket/goodsHandle",
 			"style": {
-				"navigationBarTitleText": "商品管理",
-				"enablePullDownRefresh": true
+				"navigationBarTitleText": "",
+				"enablePullDownRefresh": true,
+				"navigationStyle": "custom",
+				"app-plus": {
+					"titleNView": {
+						"autoBackButton": false
+					}
+				}
+				/*"app-plus": {
+					"titleNView": {
+						"buttons": [{
+							"text": "新增商品",
+							"type": "none",
+							"color": "#fff",
+							"fontSize": "15px",
+							"float": "right",
+							"width": "80px"
+						}]
+					}
+				} */
 			}
 		},
 		{
@@ -227,6 +245,15 @@
             }
             
         }
+        ,{
+            "path" : "pages/goodsManage/oneMarket/goodsOrders",
+            "style" :                                                                                    
+            {
+                "navigationBarTitleText": "订单列表",
+                "enablePullDownRefresh": true
+            }
+            
+        }
     ],
 	"tabBar": {
 		"color": "#7A7E83",

+ 1 - 1
pages/goodsManage/oneMarket/editGoods.vue

@@ -79,7 +79,7 @@
 			// 获取商品详情
 			getGoodsTransitDetail(){
 				this.http.request({
-					url: '/level-one-server/app/TbGoodsTransit/update',
+					url: '/level-one-server/app/TbGoodsTransit/getById',
 					method:'POST',
 					data: {id:this.id},
 					success: res => {

+ 116 - 157
pages/goodsManage/oneMarket/goodsHandle.vue

@@ -1,51 +1,51 @@
 <template>
 	<view>
-		<navigation-bar :title="title" background-color="#fff" front-color="#000000" />
-
-		<u-button v-if="active==1" style="width: 20%;margin-left: 6px;" type="primary" @click="addGoods()">新增商品</u-button>
-		<u-list v-if="active==1" class="list" width="100%" @scrolltolower="scrolltolower1">
+		<uni-nav-bar color="#fff" height="60" left-icon="back" @clickLeft="back()" @clickRight="rightClick()"
+			 right-text="新增商品" :border="false" backgroundColor="#0081ff" title="商品管理" />
+		</u-navbar>
+		
+		<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)" -->
-					<view class="card-body">
-						<image
-							src="https://img11.360buyimg.com/n7/jfs/t1/94448/29/2734/524808/5dd4cc16E990dfb6b/59c256f85a8c3757.jpg"
-							mode="aspectFill" class="img">
-						</image>
-						<view class="txt">
-							<view style="font-size: 30rpx;height: 140rpx;">{{item.goodsName}}</view>
-							<view class="piece">{{item.price}} 元</view>
-						</view>
-						<u-button class="custom-style" type="primary" @click="editGoods(item.id)">编辑</u-button>
-						<u-button class="custom-style" type="error" @click.stop="deleteGoods(item.id)">删除</u-button>
+				<view class="item-box">
+					<view class="goods-item">
+						<u-row>
+							<u-col span="5" @click="toDetails(item.id)">
+								<u--image :showLoading="true" src="" width="270rpx" height="220rpx"></u--image>
+							</u-col>
+							<u-col span="7">
+								<view class="t1 txt" @click="toDetails(item.id)">
+									<text>{{item.goodsName}}</text>
+								</view>
+								<view class="txt">
+									<text v-if="item.grossWeight">{{item.grossWeight}}吨</text>
+								</view>
+								<view class="txt" v-if="item.tradeAreaName">
+									<u-tag style="width: 250rpx" :text="item.tradeAreaName" plain size="mini"></u-tag>
+								</view>
+								<view class="t4">
+									<view class="price">¥{{item.price}}</view>
+									<view class="edit" @click="editGoods(item.id)">
+										<u-icon color="#fff" name="edit-pen-fill" size="30"></u-icon>
+									</view>
+									<view class="delete" @click="deleteGoods(item.id)">
+										<u-icon color="#fff" name="warning-fill" size="30"></u-icon>
+									</view>
+								</view>
+							</u-col>
+						</u-row>
 					</view>
 				</view>
 			</u-list-item>
-			<u-loadmore v-if="goods" :status="loadmoreStatus" margin-top="20" @loadmore="clickLoadMore" margin-bottom="50" />
 		</u-list>
-
-		<u-list v-if="active==2" class="list" width="100%" @scrolltolower="scrolltolower2">
-			<u-list-item v-for="(item, index) in orders" :key="index">
-				<view class="card" ><!-- @click="toDetails(item.id)" -->
-					<view class="card-body">
-						<image
-							src="https://img11.360buyimg.com/n7/jfs/t1/94448/29/2734/524808/5dd4cc16E990dfb6b/59c256f85a8c3757.jpg"
-							mode="aspectFill" class="img">
-						</image>
-						<view class="txt">
-							<view style="font-size: 30rpx;height: 140rpx;">{{item.goodsName}}</view>
-							<view class="piece">{{item.price}} 元</view>
-						</view>
-						<u-button class="custom-style" type="primary" @click="orderConfirm(item.id,1)">确认</u-button>
-						<u-button class="custom-style" type="warning" @click="orderConfirm(item.id,2)">拒绝</u-button>
-					</view>
-				</view>
-			</u-list-item>
-			<u-loadmore v-if="orders" :status="loadmoreStatus" margin-top="20" @loadmore="clickLoadMore" margin-bottom="50" />
-		</u-list>
-
-		<order v-if="active==3"></order>
+		
+		
 		<view class="tab">
-			<view :class="active==item.id ? 'active-btn' : 'tabBtn'" v-for="item in tabList" :key="item.id" @click="tabClick(item.id)">{{item.name}}</view>
+			<!-- <view class="tabBtn" @click="BtnClick(1)">
+				<u-icon label="商品列表" size="30" color="#ef732a" labelColor="#ef732a" name="shopping"></u-icon>
+			</view> -->
+			<view class="tabBtn" @click="BtnClick()">
+				<u-icon label="订单列表" size="30" color="#1E90FF" labelColor="#1E90FF" name="order"></u-icon>
+			</view>
 		</view>
 	</view>
 </template>
@@ -59,18 +59,7 @@
 				goods: [],
 				orders: [],
 				item: {},
-				active: 1,
-				title: '商品管理',
-				tabList: [
-					{
-						id: 1,
-						name: "商品列表"
-					},
-					{
-						id: 2,
-						name: "订单列表"
-					}
-				],
+				
 
 			}
 		},
@@ -114,139 +103,118 @@
 					}
 				});
 			},
-			// 新增商品
-			addGoods() {
-				this.$common.to('/pages/goodsManage/oneMarket/addGoods')
-			},
 			// 编辑商品
 			editGoods(id) {
 				this.$common.to('/pages/goodsManage/oneMarket/editGoods?id='+id)
 			},
-			scrolltolower1() {
+			scrolltolower() {
 				this.getTransitList()
 			},
-
-			// 订单列表
-			getOrderTransitList() {
-				this.form = {
-					isOrders: 1,//是否已被下单[0=未被下单,1=已被下单]
-					enterpriseConfirm: 0,//商铺确认情况[0=待确认,1=已确认,2=拒绝]
-					goodsStatus: 1,//商品状态(0=下架,1=在售)
-				}
-				this.http.request({
-					url: '/level-one-server/app/TbGoodsTransit/getTransitList',
-					data: this.form,
-					method: 'POST',
-					success: resp => {
-						console.log('resp',resp)
-						this.orders = resp.data.data;
-						/* this.orders.forEach((item, index) => {
-							if (index === this.orders.length - 1) {
-								this.loadmoreStatus = 'nomore'
-							} else {
-								this.loadmoreStatus = 'loadmore'
-							}
-						}) */
-					}
-				});
+			BtnClick(type) {
+				uni.navigateTo({
+					url: '/pages/goodsManage/oneMarket/goodsOrders'
+				})
 			},
-			// 商家确认
-			orderConfirm(id,status) {
-				this.form = {
-					id: id,
-					//isOrders: 0,//是否已被下单[0=未被下单,1=已被下单]
-					enterpriseConfirm: status,//商铺确认情况[0=待确认,1=已确认,2=拒绝]
-					//goodsStatus: 1,//商品状态(0=下架,1=在售)
-				}
-				this.http.request({
-					url: '/level-one-server/app/TbGoodsTransit/update',
-					data: this.form,
-					method: 'POST',
-					success: resp => {
-						console.log('resp',resp)
-						uni.showToast({ title: '操作成功' });
-					}
+			back() {
+				uni.switchTab({
+					url: '/pages/index/index'
 				});
 			},
-			scrolltolower2() {
-				this.getTransitList()
+			rightClick() {
+				this.$common.to('/pages/goodsManage/oneMarket/addGoods')
 			},
 
-
-
-			change(index) {
-				console.log(index)
-				this.active = index
-			},
-			tabClick(id) {
-				this.active = id
-				if(id==1) {
-					this.title='商品管理'
-					this.getTransitList()
-				}else if(id==2) {
-					this.title='订单确认'
-					this.getOrderTransitList()
-				}
-			}
-		}
+			
+		}/* ,
+		onNavigationBarButtonTap(e) { //导航栏新增商品按钮
+			this.$common.to('/pages/goodsManage/oneMarket/addGoods')
+		} */
 	}
 </script>
 
-<style>
-	.custom-style {
-		width: 20%;
-		height: 100rpx;
-		font-size: 20rpx;
-	}
+<style lang="scss">
+
 	.list {
-		height: 90%;
+		height: auto;
 		border-radius: 10rpx;
-		background-color: #fff;
+		margin: 15rpx;
 	}
 
-	.card {
-		padding: 10rpx;
+	.goods-item {
+		margin-bottom: 8rpx;
 	}
 
-	.card-body {
-		display: flex;
-		height: 300rpx;
-		width: 100%;
-		/* border: #888 1rpx solid; */
-		box-shadow:  1rpx 1rpx #888;
+	.item-box {
+		height: 230rpx;
+		width: 90%;
+		padding: 20rpx;
+		background-color: #fff;
+		border: 1rpx #FFF solid;
+		margin: 10rpx 0rpx;
 		border-radius: 10rpx;
 	}
 
-	.img {
-		height: 300rpx;
-		width: 300rpx;
-		margin-right: 10rpx;
+	.txt {
+		/* height: 50rpx; */
+		margin-bottom: 20rpx;
 	}
 
-	.txt {
-		padding: 10rpx;
-		width: 300rpx;
+	.t1 {
+		font-size: 32rpx;
+		font-weight: bold;
+		word-wrap: break-word;
+		position: relative;
+		top: 1rpx;
+		right: 5rpx;
 	}
 
-	.piece {
-		margin: 50rpx 10rpx;
-		color: red;
+	.t4 {
+		display: flex;
 		position: relative;
-		top: 50rpx;
-		/* left: 5rpx; */
+		bottom: 1rpx;
+		right: 5rpx;
+	}
+	
+	.price {
+		color: #ef732a;
+		width: 400rpx;
+		font-weight: bold;
 	}
-	.tab{
-		position: absolute;
+
+	.edit {
+		background-color: #0081ff;
+		width: 60rpx;
+		height: 60rpx;
+		border-radius: 30rpx;
+		text-align: center;
+		display: flex;
+		align-items: center;
+		justify-content: center;
+	}
+	.delete {
+		background-color: indianred;
+		width: 60rpx;
+		height: 60rpx;
+		border-radius: 30rpx;
+		text-align: center;
+		display: flex;
+		align-items: center;
+		justify-content: center;
+	}
+	.tab {
+		position: fixed;
 		bottom: 1rpx;
 		width: 100%;
 		height: 100rpx;
 		display: flex;
 		align-items: center;
 		justify-content: center;
-		border-top: #CFCFCF 1rpx solid;
+		border-top: #ffffff 1rpx solid;
+		background-color: #ffffff;
 	}
+	
 
-	.tabBtn{
+	.tabBtn {
 		width: 35%;
 		height: 100%;
 		display: flex;
@@ -254,13 +222,4 @@
 		justify-content: center;
 		margin: 0 30rpx;
 	}
-	.active-btn{
-		width: 35%;
-		height: 100%;
-		display: flex;
-		align-items: center;
-		justify-content: center;
-		color: #fff;
-		background-color: #00BFFF;
-	}
 </style>

+ 173 - 0
pages/goodsManage/oneMarket/goodsOrders.vue

@@ -0,0 +1,173 @@
+<template>
+	<view>
+		
+		<u-list class="list" width="100%" @scrolltolower="scrolltolower">
+			<u-list-item v-for="(item, index) in orders" :key="index">
+				<view class="item-box">
+					<view class="goods-item">
+						<u-row>
+							<u-col span="5" @click="toDetails(item.id)">
+								<u--image :showLoading="true" src="" width="270rpx" height="220rpx"></u--image>
+							</u-col>
+							<u-col span="7">
+								<view class="t1 txt" @click="toDetails(item.id)">
+									<text>{{item.goodsName}}</text>
+								</view>
+								<view class="txt">
+									<text v-if="item.grossWeight">{{item.grossWeight}}吨</text>
+								</view>
+								<view class="txt" v-if="item.tradeAreaName">
+									<u-tag style="width: 250rpx" :text="item.tradeAreaName" plain size="mini"></u-tag>
+								</view>
+								<view class="t4">
+									<view class="price">¥{{item.price}}</view>
+									<!-- 接受 商铺确认情况[0=待确认,1=已确认,2=拒绝]-->
+									<view class="edit" @click="orderConfirm(item.id,1)">
+										<u-icon color="#fff" name="edit-pen-fill" size="30"></u-icon>
+									</view>
+									<!-- 拒绝 -->
+									<view class="delete" @click="orderConfirm(item.id,2)">
+										<u-icon color="#fff" name="edit-pen-fill" size="30"></u-icon>
+									</view>
+								</view>
+							</u-col>
+						</u-row>
+					</view>
+				</view>
+			</u-list-item>
+		</u-list>
+		
+	</view>
+</template>
+
+<script>
+	export default {
+		data() {
+			return {
+				loadmoreStatus: 'loadmore',
+				form: {},
+				orders: [],
+			}
+		},
+		onLoad() {
+			this.getOrderTransitList()
+		},
+		methods: {
+			// 订单列表
+			getOrderTransitList() {
+				this.form = {
+					isOrders: 1,//是否已被下单[0=未被下单,1=已被下单]
+					enterpriseConfirm: 0,//商铺确认情况[0=待确认,1=已确认,2=拒绝]
+					goodsStatus: 1,//商品状态(0=下架,1=在售)
+				}
+				this.http.request({
+					url: '/level-one-server/app/TbGoodsTransit/getTransitList',
+					data: this.form,
+					method: 'POST',
+					success: resp => {
+						console.log('resp',resp)
+						this.orders = resp.data.data;
+						this.orders.forEach((item, index) => {
+							if (index === this.orders.length - 1) {
+								this.loadmoreStatus = 'nomore'
+							} else {
+								this.loadmoreStatus = 'loadmore'
+							}
+						})
+					}
+				});
+			},
+			// 商家确认
+			orderConfirm(id,status) {
+				this.form = {
+					id: id,
+					//isOrders: 0,//是否已被下单[0=未被下单,1=已被下单]
+					enterpriseConfirm: status,//商铺确认情况[0=待确认,1=已确认,2=拒绝]
+					//goodsStatus: 1,//商品状态(0=下架,1=在售)
+				}
+				this.http.request({
+					url: '/level-one-server/app/TbGoodsTransit/update',
+					data: this.form,
+					method: 'POST',
+					success: resp => {
+						console.log('resp',resp)
+						uni.showToast({ title: '操作成功' });
+					}
+				});
+			},
+			scrolltolower() {
+				this.getOrderTransitList()
+			}
+		}
+	}
+</script>
+
+<style lang="scss">
+	.list {
+		height: auto;
+		border-radius: 10rpx;
+		margin: 15rpx;
+	}
+
+	.goods-item {
+		margin-bottom: 8rpx;
+	}
+
+	.item-box {
+		height: 230rpx;
+		width: 90%;
+		padding: 20rpx;
+		background-color: #fff;
+		border: 1rpx #FFF solid;
+		margin: 10rpx 0rpx;
+		border-radius: 10rpx;
+	}
+
+	.txt {
+		/* height: 50rpx; */
+		margin-bottom: 20rpx;
+	}
+
+	.t1 {
+		font-size: 32rpx;
+		font-weight: bold;
+		word-wrap: break-word;
+		position: relative;
+		top: 1rpx;
+		right: 5rpx;
+	}
+
+	.t4 {
+		display: flex;
+		position: relative;
+		bottom: 1rpx;
+		right: 5rpx;
+	}
+	
+	.price {
+		color: #ef732a;
+		width: 400rpx;
+		font-weight: bold;
+	}
+
+	.edit {
+		background-color: #0081ff;
+		width: 60rpx;
+		height: 60rpx;
+		border-radius: 30rpx;
+		text-align: center;
+		display: flex;
+		align-items: center;
+		justify-content: center;
+	}
+	.delete {
+		background-color: indianred;
+		width: 60rpx;
+		height: 60rpx;
+		border-radius: 30rpx;
+		text-align: center;
+		display: flex;
+		align-items: center;
+		justify-content: center;
+	}
+</style>

+ 7 - 1
pages/oneMarket/oneMarket.vue

@@ -86,7 +86,7 @@
 			return {
 				loadmoreStatus: 'loadmore',
 				goods: [],
-				active: '',
+				active: 1,
 				title: '一级市场',
 				show: false,
 				typeList: [],
@@ -101,8 +101,14 @@
 		// },
 		methods: {
 			getGoodsList() {
+				let form = {
+					isOrders: 0,//是否已被下单[0=未被下单,1=已被下单]
+					//enterpriseConfirm: ,//商铺确认情况[0=待确认,1=已确认,2=拒绝]
+					goodsStatus: 1,//商品状态(0=下架,1=在售)
+				}
 				this.http.request({
 					url: '/level-one-server/TbGoodsTransit/getTransitList',
+					data: form,
 					success: res => {
 						this.goods = res.data.data;
 						this.goods.forEach((item, index) => {