linbl пре 1 година
родитељ
комит
d88615cda3

+ 16 - 8
pages.json

@@ -92,15 +92,23 @@
 			"path": "pages/goodsManage/oneMarket/goodsHandle",
 			"style": {
 				"navigationBarTitleText": "商品管理",
-				"app-plus": {
-					"titleNView": {
-						"backgroundColor": "#ff4200",
-						"titleColor": "#fff"
-					}
-				}
+				"enablePullDownRefresh": true
+			}
+		},
+		{
+			"path": "pages/goodsManage/oneMarket/addGoods",
+			"style": {
+				"navigationBarTitleText": "新增商品",
+				"enablePullDownRefresh": false
+			}
+		},
+		{
+			"path": "pages/goodsManage/oneMarket/editGoods",
+			"style": {
+				"navigationBarTitleText": "编辑商品",
+				"enablePullDownRefresh": false
 			}
 		}
-
 		, {
 			"path": "pages/twoMarket/purchaser/product/list",
 			"style": {
@@ -238,4 +246,4 @@
 		"navigationBarTitleText": "边民互市贸易",
 		"navigationBarBackgroundColor": "#0081FF"
 	}
-}
+}

+ 128 - 0
pages/goodsManage/oneMarket/addGoods.vue

@@ -0,0 +1,128 @@
+<template>
+	<view class="cmain">
+		<view class="form_group">
+			<view class="lable re">监管商品类型</view>
+			<input type="text" placeholder="请输入" v-model="item.id" />
+		</view>
+		<view class="form_group">
+			<view class="lable re">商品名称</view>
+			<input type="text" placeholder="请输入" v-model="item.goodsName" />
+		</view>
+		<view class="form_group">
+			<view class="lable re">商品产地</view>
+			<input type="text" placeholder="请输入" v-model="item.placeOrigin" />
+		</view>
+		<view class="form_group">
+			<view class="lable re">商品类型</view>
+			<picker @change="pickerChangeGoodsTypes" :value="index1" :range="goodsTypes" range-key="label">
+				<view >{{goodsTypes[index1].label}}</view>
+			</picker>
+			<!-- <input type="text" placeholder="请输入" v-model="item.goodsType" /> -->
+			<!-- <u-input type="select" v-model="item.goodsType" border="false" placeholder="请选择商品类型" @click="show = true"/>
+			<u-action-sheet :list="goodsTypes" v-model="show" @click="actionSheetCallback"/> -->
+		</view>
+		<view class="form_group">
+			<view class="lable re">商品单位</view>
+			<input type="text" placeholder="请输入" v-model="item.goodsUnits" />
+		</view>
+		<view class="form_group">
+			<view class="lable re">商品价格</view><!-- (0=下架,1=在售) -->
+			<input type="text" placeholder="请输入" v-model="item.price" />
+		</view>
+		<view class="form_group">
+			<view class="lable re">商品数量</view>
+			<input type="text" placeholder="请输入" v-model="item.stock" />
+		</view>
+		<view class="form_group">
+			<view class="lable re">净重</view>
+			<input type="text" placeholder="请输入" v-model="item.netWeight" />
+		</view>
+		<view class="form_group">
+			<view class="lable re">毛重</view>
+			<input type="text" placeholder="请输入" v-model="item.grossWeight" />
+		</view>
+		<view class="form_group">
+			<view class="lable re">商品状态</view>
+			<picker @change="pickerChangeGoodsStatus" :value="index2" :range="goodsStatus" range-key="label">
+				<view >{{goodsStatus[index2].label}}</view>
+			</picker>
+			<!-- <input type="text" placeholder="请输入" v-model="item.goodsStatus" /> -->
+		</view>
+		<view class="form_group">
+			<view class="lable re">商品描述</view>
+			<input type="text" placeholder="请输入" v-model="item.description" />
+		</view>
+		<view class="form_group">
+			<view class="lable re">商品图片</view>
+			<card v-model="item.goodsImg" pic="../../static/images/yyzz.png"></card>
+		</view>
+		<button class="btn" @click="save()">新增商品提交</button>
+	</view>
+</template>
+
+<script>
+	export default {
+		data() {
+			return {
+				id: 0,
+				item: {goodsType:''},
+				index1: 0,
+				index2: 1,
+				goodsTypes: [
+					{label:'请选择',value:0},
+					{label:'水果',value:1},
+					{label:'药品',value:2},
+					{label:'茶叶',value:3},
+				],
+				goodsStatus: [
+					{label:'下架',value:0},
+					{label:'在售',value:1}
+				],
+				show: false,
+			}
+		},
+		methods: {
+			pickerChangeGoodsTypes: function(e) { //商品类型选择器
+				this.index1 = e.detail.value;
+			},
+			pickerChangeGoodsStatus: function(e) { //商品状态选择器
+				this.index2 = e.detail.value;
+			},
+			// 点击actionSheet回调
+			actionSheetCallback(index) {
+				console.log('index',index)
+				this.item.goodsType = this.goodsTypes[index].label;
+			},
+			save() {
+				/* let rule = [
+					{ name: 'typeCode', checkType: 'notnull', errorMsg: '请输入编码' },
+					{ name: 'typeName', checkType: 'notnull', errorMsg: '请输入名称' },
+					{ name: 'status', checkType: 'notnull', errorMsg: '请选择状态' }
+				]; */
+				/* if (!this.verify.check(this.item, rule)) {
+					uni.showModal({ content: this.verify.error, showCancel: false });
+					return false;
+				} */
+				this.http.request({
+					url: '/level-one-server/app/TbGoodsTransit/transactionGoods',
+					method:'POST',
+					data: this.item,
+					success: res => {
+						uni.showToast({ title: '操作成功' });
+						setTimeout(() => {
+							uni.$emit('ctype');
+							uni.navigateBack();
+						}, 1000);
+					}
+				});
+			}
+
+		}
+	}
+</script>
+
+<style lang="scss">
+.btn {
+	margin-top: 25px;
+}
+</style>

+ 129 - 0
pages/goodsManage/oneMarket/editGoods.vue

@@ -0,0 +1,129 @@
+<template>
+	<view class="cmain">
+		<view class="form_group">
+			<view class="lable re">监管商品类型</view>
+			<input type="text" placeholder="请输入" v-model="item.declareOdd" />
+		</view>
+		<view class="form_group">
+			<view class="lable re">商品名称</view>
+			<input type="text" placeholder="请输入" v-model="item.goodsName" />
+		</view>
+		<view class="form_group">
+			<view class="lable re">商品产地</view>
+			<input type="text" placeholder="请输入" v-model="item.placeOrigin" />
+		</view>
+		<view class="form_group">
+			<view class="lable re">商品类型</view>
+			<input type="text" placeholder="请输入" v-model="item.goodsType" />
+			<!-- <u-input type="select" v-model="item.goodsType" border="false" placeholder="请选择商品类型" @click="show = true"/>
+			<u-action-sheet :list="goodsTypes" v-model="show" @click="actionSheetCallback"/> -->
+		</view>
+		<view class="form_group">
+			<view class="lable re">商品单位</view>
+			<input type="text" placeholder="请输入" v-model="item.goodsUnits" />
+		</view>
+		<view class="form_group">
+			<view class="lable re">商品价格</view>
+			<input type="text" placeholder="请输入" v-model="item.price" />
+		</view>
+		<view class="form_group">
+			<view class="lable re">商品数量</view>
+			<input type="text" placeholder="请输入" v-model="item.stock" />
+		</view>
+		<view class="form_group">
+			<view class="lable re">净重</view>
+			<input type="text" placeholder="请输入" v-model="item.netWeight" />
+		</view>
+		<view class="form_group">
+			<view class="lable re">毛重</view>
+			<input type="text" placeholder="请输入" v-model="item.grossWeight" />
+		</view>
+		<view class="form_group">
+			<view class="lable re">商品状态</view>
+			<input type="text" placeholder="请输入" v-model="item.goodsStatus" />
+		</view>
+		<view class="form_group">
+			<view class="lable re">商品描述</view>
+			<input type="text" placeholder="请输入" v-model="item.description" />
+		</view>
+		<view class="form_group">
+			<view class="lable re">商品图片</view>
+			<card v-model="item.goodsImg" pic="../../static/images/yyzz.png"></card>
+		</view>
+		<button class="btn" @click="save()">修改商品提交</button>
+	</view>
+</template>
+
+<script>
+	export default {
+		data() {
+			return {
+				id: 0,
+				item: {goodsType:''},
+				goodsTypes: [
+					{label:'水果'},
+					{label:'药品'},
+					{label:'茶叶'},
+				],
+				show: false,
+			}
+		},
+		onLoad(option) {
+			console.log('111111',option.id)
+			this.id = option.id
+			if(undefined != this.id && null != this.id && 0 != this.id) {
+				this.getGoodsTransitDetail();
+			}
+		},
+		methods: {
+			// 获取商品详情
+			getGoodsTransitDetail(){
+				this.http.request({
+					url: '/level-one-server/app/TbGoodsTransit/update',
+					method:'POST',
+					data: {id:this.id},
+					success: res => {
+						this.item = res.data.data;
+						//uni.showToast({ title: '操作成功' });
+						
+					}
+				});
+			},
+			// 点击actionSheet回调
+			actionSheetCallback(index) {
+				console.log('index',index)
+				this.item.goodsType = this.goodsTypes[index].label;
+			},
+			save() {
+				/* let rule = [
+					{ name: 'typeCode', checkType: 'notnull', errorMsg: '请输入编码' },
+					{ name: 'typeName', checkType: 'notnull', errorMsg: '请输入名称' },
+					{ name: 'status', checkType: 'notnull', errorMsg: '请选择状态' }
+				]; */
+				/* if (!this.verify.check(this.item, rule)) {
+					uni.showModal({ content: this.verify.error, showCancel: false });
+					return false;
+				} */
+				this.http.request({
+					url: '/level-one-server/app/TbGoodsTransit/transactionGoods',
+					method:'POST',
+					data: this.item,
+					success: res => {
+						uni.showToast({ title: '操作成功' });
+						setTimeout(() => {
+							uni.$emit('ctype');
+							uni.navigateBack();
+						}, 1000);
+					}
+				});
+			}
+
+		}
+	}
+</script>
+
+<style lang="scss">
+.btn {
+	margin-top: 25px;
+}
+</style>

+ 191 - 22
pages/goodsManage/oneMarket/goodsHandle.vue

@@ -1,22 +1,52 @@
 <template>
 	<view>
-		<navigation-bar title="商品管理" background-color="#fff" front-color="#000000" />
-		<u-list class="list" width="100%" @scrolltolower="scrolltolower">
+		<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">
 			<u-list-item v-for="(item, index) in goods" :key="index">
-				<view class="card" @click="toDetails(item.id)">
+				<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>
+							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>
 				</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>
 	</view>
 </template>
 
@@ -25,40 +55,151 @@
 		data() {
 			return {
 				loadmoreStatus: 'loadmore',
-				goods: []
+				form: {},
+				goods: [],
+				orders: [],
+				item: {},
+				active: 1,
+				title: '商品管理',
+				tabList: [
+					{
+						id: 1,
+						name: "商品列表"
+					},
+					{
+						id: 2,
+						name: "订单列表"
+					}
+				],
+
 			}
 		},
 		onLoad() {
 			this.getTransitList()
 		},
 		methods: {
+			// 商品列表
 			getTransitList() {
-				
-				this.$api.getTransitList().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.form = {
+					isOrders: 0,//是否已被下单[0=未被下单,1=已被下单]
+					//enterpriseConfirm: ,//商铺确认情况[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.goods = resp.data.data;
+						this.goods.forEach((item, index) => {
+							if (index === this.goods.length - 1) {
+								this.loadmoreStatus = 'nomore'
+							} else {
+								this.loadmoreStatus = 'loadmore'
+							}
+						})
+					}
+				});
 			},
-			scrolltolower() {
+			// 删除商品
+			deleteGoods(id) {
+				console.log('id',id)
+				this.http.request({
+					url: '/level-one-server/app/TbGoodsTransit/deleteById',
+					data: {id : id},
+					method: 'POST',
+					success: resp => {
+						console.log('删除商品',resp)
+					}
+				});
+			},
+			// 新增商品
+			addGoods() {
+				this.$common.to('/pages/goodsManage/oneMarket/addGoods')
+			},
+			// 编辑商品
+			editGoods(id) {
+				this.$common.to('/pages/goodsManage/oneMarket/editGoods?id='+id)
+			},
+			scrolltolower1() {
 				this.getTransitList()
 			},
-			
-			toDetails(id) {
-				this.$common.to('/pages/goodsDetails/goodsDetails?id='+id)
+
+			// 订单列表
+			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: '操作成功' });
+					}
+				});
+			},
+			scrolltolower2() {
+				this.getTransitList()
+			},
+
+
+
+			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()
+				}
 			}
 		}
 	}
 </script>
 
 <style>
+	.custom-style {
+		width: 20%;
+		height: 100rpx;
+		font-size: 20rpx;
+	}
 	.list {
-		height: 100%;
+		height: 90%;
 		border-radius: 10rpx;
 		background-color: #fff;
 	}
@@ -94,4 +235,32 @@
 		top: 50rpx;
 		/* left: 5rpx; */
 	}
-</style>
+	.tab{
+		position: absolute;
+		bottom: 1rpx;
+		width: 100%;
+		height: 100rpx;
+		display: flex;
+		align-items: center;
+		justify-content: center;
+		border-top: #CFCFCF 1rpx solid;
+	}
+
+	.tabBtn{
+		width: 35%;
+		height: 100%;
+		display: flex;
+		align-items: center;
+		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>