Bläddra i källkod

完善求购需求管理

李书文 1 år sedan
förälder
incheckning
ea748efe21

+ 1 - 0
common/style.scss

@@ -539,6 +539,7 @@
 		margin-bottom: 10px;
 		box-shadow: 0 2px 12px 0 rgba(0, 0, 0, 0.08);
 		.top {
+			overflow: hidden;
 			.title {
 				font-size: 15px;
 				margin-bottom: 10px;

+ 16 - 20
pages.json

@@ -104,7 +104,7 @@
 		{
 			"path": "pages/market/two/purchaser/buy/list",
 			"style": {
-				"navigationBarTitleText": "商品采购",
+				"navigationBarTitleText": "采购需求管理",
 				"enablePullDownRefresh": true,
 				"app-plus": {
 					"titleNView": {
@@ -295,26 +295,22 @@
 				}
 			}
 
+		}, {
+			"path": "pages/market/one/merchant/goods/selects",
+			"style": {
+				"navigationBarTitleText": "选择商品",
+				"enablePullDownRefresh": true
+			}
+
+		}, {
+			"path": "pages/market/one/merchant/goods/area",
+			"style": {
+				"navigationBarTitleText": "选择互市区",
+				"enablePullDownRefresh": false
+			}
+
 		}
-	    ,{
-            "path" : "pages/market/one/merchant/goods/selects",
-            "style" :                                                                                    
-            {
-                "navigationBarTitleText": "选择商品",
-                "enablePullDownRefresh": true
-            }
-            
-        }
-        ,{
-            "path" : "pages/market/one/merchant/goods/area",
-            "style" :                                                                                    
-            {
-                "navigationBarTitleText": "选择互市区",
-                "enablePullDownRefresh": false
-            }
-            
-        }
-    ],
+	],
 	"tabBar": {
 		"color": "#7A7E83",
 		"selectedColor": "#4581fb",

+ 3 - 3
pages/market/two/purchaser/buy/add.vue

@@ -33,7 +33,7 @@
 			</view>
 			<view class="form_group">
 				<view class="lable">商品编号</view>
-				<input placeholder="请输入" v-model="item.goodsNo" :disabled="true"/>
+				<input placeholder="请输入" v-model="item.goodsNo" :disabled="true" />
 			</view>
 			<view class="form_group">
 				<view class="lable re">计价单位</view>
@@ -54,7 +54,7 @@
 		<view class="mfooter">
 			<view class="flex">
 				<view class="f">
-					<button class="save btn" @click="save(0)">保存</button>
+					<button class="save btn" @click="save(0)">取消发布</button>
 				</view>
 				<view class="f">
 					<button class="btn" @click="save(1)">一键发布</button>
@@ -135,9 +135,9 @@ export default {
 		//保存或发布
 		save(isRelease) {
 			let rule = [
+				{ name: 'addressName', checkType: 'notnull', errorMsg: '请选择一个收货地址' },
 				{ name: 'tradeAreaName', checkType: 'notnull', errorMsg: '请选择互市区' },
 				{ name: 'goodsName', checkType: 'notnull', errorMsg: '请选择商品' },
-				{ name: 'addressName', checkType: 'notnull', errorMsg: '请选择地址' },
 				{ name: 'goodsQuantity', checkType: 'notnull', errorMsg: '请输入数量' },
 				{ name: 'arrivalTime', checkType: 'notnull', errorMsg: '请选择到货日期' }
 			];

+ 56 - 16
pages/market/two/purchaser/buy/list.vue

@@ -7,8 +7,9 @@
 			<view class="item" v-for="(item, index) in list" :key="index" @click="detail(item)">
 				<view class="top">
 					<view class="title omit">{{ item.goodsName }}</view>
-					<view class="icon">&#xe852;</view>
-					<view class="clear"></view>
+					<view class="state" v-if="item.isRelease == 0" @click.stop="del(item)" style="color: #f44336">删除</view>
+					<view class="state" style="color: #4581fb" v-if="item.isRelease == 1">发布中</view>
+					<view class="state" style="color: #4CAF50" v-if="item.isOrders == 1">已接单</view>
 				</view>
 				<view class="con">
 					<view class="flex fs">
@@ -22,18 +23,14 @@
 				</view>
 				<view class="op">
 					<view class="flex">
-						<view class="f rline">
-							<text class="icon" style="color: #ff660d">&#xe668;</text>
-							<text>编辑</text>
-						</view>
-						<view class="f">
-							<text class="icon" style="color: #0081ff">&#xe743;</text>
-							<text>发布</text>
-						</view>
+						<view class="f rline" v-if="item.isRelease == 0" @click.stop="edit(item)">编辑</view>
+						<view class="f" v-if="item.isRelease == 0" style="color: #4581fb" @click.stop="op(item, 1)">发布</view>
+						<view class="f" v-if="item.isRelease == 1" style="color: #f44336" @click.stop="op(item, 0)">取消发布</view>
 					</view>
 				</view>
-				<view class="clear"></view>
 			</view>
+			<view class="loading" v-if="loadMore"><u-loadmore :status="loadMore ? 'loading' : 'nomore'" /></view>
+			<u-empty v-if="!loadMore && list.length == 0"></u-empty>
 		</view>
 	</view>
 </template>
@@ -42,11 +39,12 @@
 export default {
 	data() {
 		return {
-			tab: [//isRelease:是否发布[0=待发布,1=已发布]  isOrders:是否被接单[0=待接单,1=已被接单]
-				{ name: '全部', isRelease: '' ,isOrders: ''},
-				{ name: '待发布', isRelease: 0 ,isOrders: 0},
-				{ name: '发布中', isRelease: 1 ,isOrders: 0},
-				{ name: '已接单', isRelease: 1 ,isOrders: 1},
+			tab: [
+				//isRelease:是否发布[0=待发布,1=已发布]  isOrders:是否被接单[0=待接单,1=已被接单]
+				{ name: '全部', isRelease: '', isOrders: '' },
+				{ name: '待发布', isRelease: 0, isOrders: 0 },
+				{ name: '发布中', isRelease: 1, isOrders: 0 },
+				{ name: '已接单', isRelease: 1, isOrders: 1 }
 				//{ name: '已确认', isRelease: 1 ,isOrders: 1},
 				//{ name: '已完成', isRelease: 1 ,isOrders: 1}
 			],
@@ -57,6 +55,9 @@ export default {
 	},
 	onLoad(e) {
 		this.getData();
+		uni.$on('purchaser_buy_list', res => {
+			this.refresh();
+		});
 	},
 	methods: {
 		getData() {
@@ -79,6 +80,45 @@ export default {
 		detail(item) {
 			uni.navigateTo({ url: '/pages/market/two/purchaser/buy/detail?id=' + item.id });
 		},
+		edit(item) {
+			uni.navigateTo({ url: '/pages/market/two/purchaser/buy/add?id=' + item.id });
+		},
+		op(item, isRelease) {
+			uni.showModal({
+				title: '提示',
+				content: isRelease == 0 ? '确定取消发布' : '确定发布到市场?',
+				success: res => {
+					if (res.confirm) {
+						this.http.request({
+							url: '/level-two-server/app/TbGoodsDemand/changeState',
+							method: 'POST',
+							data: { id: item.id, isRelease: isRelease },
+							success: res => {
+								uni.showToast({ title: '操作成功' });
+								item.isRelease = isRelease;
+							}
+						});
+					}
+				}
+			});
+		},
+		del(item) {
+			uni.showModal({
+				title: '提示',
+				content: '确定删除该需求?',
+				success: res => {
+					if (res.confirm) {
+						this.http.request({
+							url: '/level-two-server/app/TbGoodsDemand/delete?id=' + item.id,
+							success: res => {
+								uni.showToast({ title: '删除成功' });
+								this.list.splice(this.list.indexOf(item), 1);
+							}
+						});
+					}
+				}
+			});
+		},
 		//刷新数据
 		refresh() {
 			this.loadMore = true;

+ 1 - 1
pages/personal/personal.vue

@@ -72,7 +72,7 @@
 					<view class="out">
 						<view class="int">
 							<view class="icon ioc" style="background-color: #e1f6e9; color: #47cf74">&#xe634;</view>
-							<view class="tit">收购管理</view>
+							<view class="tit">采购需求</view>
 						</view>
 					</view>
 				</view>