Răsfoiți Sursa

Merge branch 'master' of http://git.aseanbusiness.cn/qzyReal/market-app-ui

mym 1 an în urmă
părinte
comite
7557dc2806

+ 13 - 1
pages/market/one/leader/cart.vue

@@ -16,7 +16,7 @@
 				<view class="clear"></view>
 				<view class="op">
 					<view class="date">{{ item.createTime }}</view>
-					<view class="an btn" @click.stop="confirm(item.id, 1, '确认接单?')">立即够买</view>
+					<view class="an btn" @click.stop="buy(item)">立即够买</view>
 				</view>
 			</view>
 			<u-empty v-if="list.length == 0"></u-empty>
@@ -47,6 +47,18 @@ export default {
 		detail(item) {
 			uni.navigateTo({ url: '/pages/market/one/detail?id=' + item.publishGoodsId });
 		},
+		// 立即购买
+		buy(item) {
+			this.http.request({
+				url: '/level-one-server/app/TbGoodsTransit/purchaseLevelOntGoodsTransit',
+				data: { goodsTransitId: item.publishGoodsId },
+				method: 'POST',
+				contentType: 'application/json; charset=utf-8',
+				success: res => {
+					uni.redirectTo({ url: '/pages/market/one/leader/success' });
+				}
+			});
+		},
 		del(item) {
 			let ids = item.id || this.list.map(i => i.id);
 			uni.showModal({

+ 24 - 22
pages/market/one/list.vue

@@ -43,28 +43,9 @@ export default {
 		return {
 			show: false,
 			user: this.getUser(),
-			sort: [
-				{
-					name: '综合',
-					key: 1,
-					isAsc: 'desc',
-					check: false
-				},
-				{
-					name: '日期',
-					key: 2,
-					isAsc: 'desc',
-					check: false
-				},
-				{
-					name: '价格',
-					key: 3,
-					isAsc: 'desc',
-					check: false
-				}
-			],
+			sort: [{ name: '综合' }, { name: '日期' }, { name: '价格' }],
 			list: [],
-			param: { pageNo: 1, pageSize: 10, },
+			param: { pageNo: 1, pageSize: 10 },
 			loadMore: true
 		};
 	},
@@ -74,7 +55,7 @@ export default {
 	methods: {
 		getData() {
 			this.http.request({
-				url: '/level-one-server/TbGoodsTransit/getTransitList',
+				url: '/level-one-server/app/TbGoodsTransit/getList',
 				data: this.param,
 				loading: 'false',
 				success: res => {
@@ -107,6 +88,27 @@ export default {
 		},
 		detail(id) {
 			uni.navigateTo({ url: '/pages/market/one/detail?id=' + id });
+		},
+		//刷新数据
+		refresh() {
+			this.loadMore = true;
+			this.param.pageNo = 1;
+			this.list = [];
+			this.getData();
+		}
+	},
+	//下拉刷新
+	onPullDownRefresh() {
+		setTimeout(() => {
+			this.refresh();
+			uni.stopPullDownRefresh();
+		}, 1000);
+	},
+	//上拉加载
+	onReachBottom() {
+		if (this.loadMore) {
+			this.param.pageNo++;
+			this.getData();
 		}
 	}
 };

+ 63 - 11
pages/market/one/merchant/goods/add.vue

@@ -2,14 +2,21 @@
 	<view>
 		<view class="cmain">
 			<view class="form_group">
-				<view class="lable re">海关申报单号</view>
-				<input placeholder="请输入" v-model="item.declareOdd" />
+				<view class="lable re">贸易区域</view>
+				<picker :range="tradeAreaList" @change="pickerTradeArea($event)" range-key="name">
+					<input placeholder="请选择" v-model="item.tradeAreaName" :disabled="true" />
+					<view class="icon more">&#xe8f2;</view>
+				</picker>
 			</view>
 			<view class="form_group">
 				<view class="lable re">商品名称</view>
-				<input placeholder="请输入" v-model="item.goodsName" />
+				<picker v-if="flag === '新增商品'" :range="goodsList" @change="pickerGoods($event)" range-key="name">
+					<input placeholder="请选择" v-model="item.goodsName" :disabled="true" />
+					<view class="icon more">&#xe8f2;</view>
+				</picker>
+				<input v-else placeholder="请选择" v-model="item.goodsName" :disabled="true" disabled="true"/>
 			</view>
-			<view class="form_group">
+			<!-- <view class="form_group">
 				<view class="lable re">商品产地</view>
 				<input placeholder="请输入" v-model="item.placeOrigin" />
 			</view>
@@ -26,7 +33,7 @@
 					<input placeholder="请选择" v-model="item.goodsUnits" :disabled="true" />
 					<view class="icon more">&#xe8f2;</view>
 				</picker>
-			</view>
+			</view> -->
 			<view class="form_group">
 				<view class="lable re">商品价格</view>
 				<input type="number" placeholder="请输入" v-model="item.price" />
@@ -54,10 +61,10 @@
 					<view class="icon more">&#xe8f2;</view>
 				</picker>
 			</view>
-			<view class="form_group">
+			<!-- <view class="form_group">
 				<view class="lable re">商品描述</view>
 				<textarea v-model="item.description" placeholder="请输入"></textarea>
-			</view>
+			</view> -->
 		</view>
 	</view>
 </template>
@@ -66,16 +73,20 @@
 export default {
 	data() {
 		return {
+			flag: '新增商品',
 			item: {},
 			dict: {
 				goodsType: ['水果', '药品', '茶叶'],
 				goodsUnits: ['吨', '个', '柜'],
 				goodsStatus: ['在售', '下架']
-			}
+			},
+			goodsList: [],
+			tradeAreaList: []
 		};
 	},
 	onLoad(e) {
 		if (e.id) {
+			this.flag = '编辑商品'
 			this.http.request({
 				url: '/level-one-server/app/TbGoodsTransit/getById?id=' + e.id,
 				success: res => {
@@ -83,26 +94,67 @@ export default {
 					uni.setNavigationBarTitle({ title: '编辑商品' });
 				}
 			});
-		}
+		};
+		this.getGoodsList();
+		this.getTradeAreaList();
 	},
 	methods: {
 		picker(e, tag) {
 			this.item[tag] = this.dict[tag][e.detail.value];
 			this.$forceUpdate();
+		},
+		pickerGoods(e) {
+			this.item['goodsName'] = this.goodsList[e.detail.value].name;
+			this.$forceUpdate();
+			if(this.flag == '新增商品') {
+				this.item.id = this.goodsList[e.detail.value].id;
+			}
+		},
+		pickerTradeArea(e) {
+			this.item['tradeAreaName'] = this.tradeAreaList[e.detail.value].name;
+			this.$forceUpdate();
+			this.item.tradeAreaId = this.tradeAreaList[e.detail.value].id;
+		},
+		// 获取监管商品列表
+		getGoodsList() {
+			this.http.request({
+				url: '/level-one-server/app/TbGoods/getList',
+				method: 'POST',
+				success: res => {
+					this.goodsList = res.data.data;
+					console.log("监管商品列表",this.goodsList);
+				}
+			});
+		},
+		// 获取贸易区域列表
+		getTradeAreaList() {
+			this.http.request({
+				url: '/level-one-server/app/TbTradeArea/getList',
+				method: 'POST',
+				success: res => {
+					this.tradeAreaList = res.data.data;
+					console.log("贸易区域列表",this.tradeAreaList);
+				}
+			});
 		}
 	},
 	onNavigationBarButtonTap() {
 		let rule = [
 			{ name: 'goodsName', checkType: 'notnull', errorMsg: '请输入商品名称' },
-			{ name: 'placeOrigin', checkType: 'notnull', errorMsg: '请输入商品产地' },
 			{ name: 'goodsStatus', checkType: 'notnull', errorMsg: '请选择状态' }
 		];
 		if (!this.verify.check(this.item, rule)) {
 			uni.showModal({ content: this.verify.error, showCancel: false });
 			return false;
 		}
+		let url = '';
+		if(this.flag == '新增商品') {
+			url = '/level-one-server/app/TbGoodsTransit/transactionGoods';
+		} else {
+			url = '/level-one-server/app/TbGoodsTransit/update';
+		}
 		this.http.request({
-			url: '/level-one-server/app/TbGoodsTransit/transactionGoods',
+			url: url,
 			method: 'POST',
 			data: this.item,
 			success: res => {