|
@@ -1,40 +1,57 @@
|
|
<template>
|
|
<template>
|
|
<view>
|
|
<view>
|
|
- <view class="search">
|
|
|
|
- <u-search placeholder="搜索商品名或车牌号" v-model="param.goodsName" bgColor="white" @search="refresh()" :animation="true" actionText="取消" @clear="refresh()"></u-search>
|
|
|
|
- <view class="clear"></view>
|
|
|
|
- </view>
|
|
|
|
- <view class="goodsList">
|
|
|
|
- <view class="sort-list">
|
|
|
|
- <view class="sort-item" :class="{ active: item.check }" v-for="(item, index) in sort" :key="index" @click="select(item, index)">
|
|
|
|
- <text>{{ item.name }}</text>
|
|
|
|
- <text v-if="index > 0 && item.isAsc == 'desc'" class="icon"></text>
|
|
|
|
- <text v-if="index > 0 && item.isAsc == 'asc'" class="icon"></text>
|
|
|
|
|
|
+ <view style="position: relative;z-index: 999;height:150px;">
|
|
|
|
+ <view style="position: fixed;width: 100%;background-color: white;">
|
|
|
|
+ <u-tabs :list="tab" @click="clickSearchType" :lineHeight="5"></u-tabs>
|
|
|
|
+ <view class="search">
|
|
|
|
+ <u-search placeholder="搜索商品名或车牌号" v-model="param.goodsName" bgColor="#e2e2e2" @search="refresh()"
|
|
|
|
+ :animation="true" actionText="取消" @clear="refresh()"></u-search>
|
|
|
|
+ <view class="clear"></view>
|
|
</view>
|
|
</view>
|
|
- <view class="type" @click="go()">
|
|
|
|
- <text>{{ param.goodsType || '分类' }}</text>
|
|
|
|
- <text class="icon"></text>
|
|
|
|
|
|
+ <view class="sort-list">
|
|
|
|
+ <view class="sort-item" :class="{ active: item.check }" v-for="(item, index) in sort" :key="index"
|
|
|
|
+ @click="select(item, index)">
|
|
|
|
+ <text>{{ item.name }}</text>
|
|
|
|
+ <text v-if="index > 0 && item.isAsc == 'desc'" class="icon"></text>
|
|
|
|
+ <text v-if="index > 0 && item.isAsc == 'asc'" class="icon"></text>
|
|
|
|
+ </view>
|
|
|
|
+ <!-- <view class="type" @click="go()">
|
|
|
|
+ <text>{{ param.goodsType || '分类' }}</text>
|
|
|
|
+ <text class="icon"></text>
|
|
|
|
+ </view> -->
|
|
</view>
|
|
</view>
|
|
</view>
|
|
</view>
|
|
|
|
+ </view>
|
|
|
|
+ <view class="goodsList">
|
|
<view class="item" v-for="(item, index) in list" :key="index" @click="detail(item)">
|
|
<view class="item" v-for="(item, index) in list" :key="index" @click="detail(item)">
|
|
- <view class="title">{{ item.leaderName }}</view>
|
|
|
|
|
|
+ <view class="title">
|
|
|
|
+ <text v-if="currentOrderType==2">{{ item.leaderName }}</text>
|
|
|
|
+ <text v-if="currentOrderType==1">{{ item.shopName }}</text>
|
|
|
|
+ </view>
|
|
<view class="check" @click.stop="selected(item)" v-if="user.userType == 3">
|
|
<view class="check" @click.stop="selected(item)" v-if="user.userType == 3">
|
|
<text class="check icon" v-if="item.check" style="color: #4581fb"></text>
|
|
<text class="check icon" v-if="item.check" style="color: #4581fb"></text>
|
|
<text class="check icon" v-else></text>
|
|
<text class="check icon" v-else></text>
|
|
</view>
|
|
</view>
|
|
<view class="con">
|
|
<view class="con">
|
|
- <view class="productName omit">{{ item.goodsName }}</view>
|
|
|
|
- <view class="desc">车牌号 {{ item.veNo }}</view>
|
|
|
|
|
|
+ <view class="productName omit">
|
|
|
|
+ <text v-if="currentOrderType==2">{{ item.goodsName }}</text>
|
|
|
|
+ <text v-if="currentOrderType==1">{{ item.goodsNames }}</text>
|
|
|
|
+ </view>
|
|
|
|
+ <view class="desc">车牌号 <text style="font-weight: bold;margin-left: 5px;"> {{ item.veNo }}</text>
|
|
|
|
+ </view>
|
|
<view class="desc omit">
|
|
<view class="desc omit">
|
|
- <text>重量 {{ item.totalWeight }}{{ item.goodsUnit }}</text>
|
|
|
|
|
|
+ <text v-if="currentOrderType==2">重量 {{ item.totalWeight }}{{ item.goodsUnit }}</text>
|
|
|
|
+ <text v-if="currentOrderType==1">重量 {{ item.sumNetWt }} kg</text>
|
|
<text>{{ item.tradeAreaName }}</text>
|
|
<text>{{ item.tradeAreaName }}</text>
|
|
</view>
|
|
</view>
|
|
- <view class="price">上架金额 ¥ {{ item.resalePrice }}</view>
|
|
|
|
|
|
+ <view class="price" v-if="currentOrderType==2"> ¥ {{ item.resalePrice }}</view>
|
|
|
|
+ <view class="price" v-if="currentOrderType==1"> ¥ {{ item.sumUpPrice }}</view>
|
|
<view class="op">
|
|
<view class="op">
|
|
<view class="date">{{ item.createTime }}</view>
|
|
<view class="date">{{ item.createTime }}</view>
|
|
<template>
|
|
<template>
|
|
- <view class="icon btn" v-if="user.userType == 3" @click.stop="addCar(item)"></view>
|
|
|
|
- <view class="btn" v-if="user.userType == 3" @click.stop="buy(item)">购买</view>
|
|
|
|
|
|
+ <view class="icon btn" v-if="user.userType == 3&¤tOrderType==2"
|
|
|
|
+ @click.stop="addCar(item)"></view>
|
|
|
|
+ <view class="btn" v-if="user.userType == 3" @click.stop="buy(item)">购买</view>
|
|
</template>
|
|
</template>
|
|
</view>
|
|
</view>
|
|
</view>
|
|
</view>
|
|
@@ -43,11 +60,11 @@
|
|
<u-empty v-if="!loadMore && list.length == 0"></u-empty>
|
|
<u-empty v-if="!loadMore && list.length == 0"></u-empty>
|
|
</view>
|
|
</view>
|
|
<productType v-model="show"></productType>
|
|
<productType v-model="show"></productType>
|
|
- <button class="addBtn" @click="goCar()" v-if="user.userType == 3">
|
|
|
|
|
|
+ <button class="addBtn" @click="goCar()" v-if="user.userType == 3&¤tOrderType==2">
|
|
<text class="icon"></text>
|
|
<text class="icon"></text>
|
|
<view class="bag animated" :class="{ bounce: add }" v-if="cars > 0">{{ cars }}</view>
|
|
<view class="bag animated" :class="{ bounce: add }" v-if="cars > 0">{{ cars }}</view>
|
|
</button>
|
|
</button>
|
|
- <view class="mfooter" v-if="selects.length > 0&&user.userType == 3">
|
|
|
|
|
|
+ <view class="mfooter" v-if="selects.length > 0">
|
|
<view class="flex">
|
|
<view class="flex">
|
|
<view class="f">
|
|
<view class="f">
|
|
<button class="btn" @click="buy({})">立即购买({{ selects.length }})</button>
|
|
<button class="btn" @click="buy({})">立即购买({{ selects.length }})</button>
|
|
@@ -58,150 +75,237 @@
|
|
</template>
|
|
</template>
|
|
|
|
|
|
<script>
|
|
<script>
|
|
-export default {
|
|
|
|
- data() {
|
|
|
|
- return {
|
|
|
|
- user: this.getUser(),
|
|
|
|
- show: false,
|
|
|
|
- isAsc: 'desc',
|
|
|
|
- cars: 0,
|
|
|
|
- add: false,
|
|
|
|
- sort: [
|
|
|
|
- { name: '综合', sortName: 'id', isAsc: 'desc', check: false },
|
|
|
|
- { name: '日期', sortName: 'create_time', isAsc: 'desc', check: false },
|
|
|
|
- { name: '金额', sortName: 'resale_price', isAsc: 'desc', check: false }
|
|
|
|
- ],
|
|
|
|
- list: [],
|
|
|
|
- param: { pageNo: 1, pageSize: 10 },
|
|
|
|
- loadMore: true,
|
|
|
|
- selects: []
|
|
|
|
- };
|
|
|
|
- },
|
|
|
|
- onLoad(e) {
|
|
|
|
- this.getData();
|
|
|
|
- //选择商品分类
|
|
|
|
- uni.$on('productType', res => {
|
|
|
|
- this.param.typeCode = res.no;
|
|
|
|
- this.param.goodsType = res.name;
|
|
|
|
- this.refresh();
|
|
|
|
- });
|
|
|
|
- },
|
|
|
|
- methods: {
|
|
|
|
- select(item, index) {
|
|
|
|
- this.sort.forEach(it => (it.check = false));
|
|
|
|
- item.check = true;
|
|
|
|
- if (index > 0) {
|
|
|
|
- this.isAsc = this.isAsc == 'desc' ? 'asc' : 'desc';
|
|
|
|
- item.isAsc = this.isAsc;
|
|
|
|
- }
|
|
|
|
- this.param.orderBy = item.sortName + ' ' + this.isAsc;
|
|
|
|
- this.refresh();
|
|
|
|
|
|
+ export default {
|
|
|
|
+ data() {
|
|
|
|
+ return {
|
|
|
|
+ tab: [{
|
|
|
|
+ name: '整车',
|
|
|
|
+ orderType: 1
|
|
|
|
+ },
|
|
|
|
+ {
|
|
|
|
+ name: '非整车',
|
|
|
|
+ orderType: 2
|
|
|
|
+ },
|
|
|
|
+ ],
|
|
|
|
+ currentOrderType: 1,
|
|
|
|
+ user: this.getUser(),
|
|
|
|
+ show: false,
|
|
|
|
+ isAsc: 'desc',
|
|
|
|
+ cars: 0,
|
|
|
|
+ add: false,
|
|
|
|
+ sort: [{
|
|
|
|
+ name: '综合',
|
|
|
|
+ sortName: 'id',
|
|
|
|
+ isAsc: 'desc',
|
|
|
|
+ check: false
|
|
|
|
+ },
|
|
|
|
+ {
|
|
|
|
+ name: '日期',
|
|
|
|
+ sortName: 'create_time',
|
|
|
|
+ isAsc: 'desc',
|
|
|
|
+ check: false
|
|
|
|
+ },
|
|
|
|
+ {
|
|
|
|
+ name: '金额',
|
|
|
|
+ sortName: 'resale_price',
|
|
|
|
+ isAsc: 'desc',
|
|
|
|
+ check: false
|
|
|
|
+ }
|
|
|
|
+ ],
|
|
|
|
+ list: [],
|
|
|
|
+ param: {
|
|
|
|
+ pageNo: 1,
|
|
|
|
+ pageSize: 10
|
|
|
|
+ },
|
|
|
|
+ loadMore: true,
|
|
|
|
+ selects: []
|
|
|
|
+ };
|
|
},
|
|
},
|
|
- getData() {
|
|
|
|
- this.http.request({
|
|
|
|
- url: '/level-two-server/app/TbOrders/getLevelTwoList',
|
|
|
|
- data: this.param,
|
|
|
|
- loading: 'false',
|
|
|
|
- success: res => {
|
|
|
|
- this.loadMore = parseInt(res.data.pageCount) > this.param.pageNo;
|
|
|
|
- this.list.push(...res.data.data);
|
|
|
|
- }
|
|
|
|
|
|
+ onLoad(e) {
|
|
|
|
+
|
|
|
|
+ //选择商品分类
|
|
|
|
+ uni.$on('productType', res => {
|
|
|
|
+ this.param.typeCode = res.no;
|
|
|
|
+ this.param.goodsType = res.name;
|
|
|
|
+ this.refresh();
|
|
});
|
|
});
|
|
},
|
|
},
|
|
- //多选购买
|
|
|
|
- selected(item) {
|
|
|
|
- item.check = !item.check;
|
|
|
|
- this.$forceUpdate();
|
|
|
|
- this.selects = this.list.filter(item => item.check);
|
|
|
|
|
|
+ onShow() {
|
|
|
|
+ this.init();
|
|
|
|
+ this.query();
|
|
},
|
|
},
|
|
- //选择分类
|
|
|
|
- go() {
|
|
|
|
- uni.navigateTo({ url: '/pages/market/productType?current=' + this.param.current + '&now=' + this.param.now });
|
|
|
|
- },
|
|
|
|
- detail(item) {
|
|
|
|
- uni.navigateTo({ url: '/pages/market/two/detail?orderId=' + item.id });
|
|
|
|
- },
|
|
|
|
- addCar(item) {
|
|
|
|
- this.add = true;
|
|
|
|
- this.http.request({
|
|
|
|
- url: '/level-two-server/app/TbOrdersCart/add',
|
|
|
|
- method: 'POST',
|
|
|
|
- data: { orderId: item.id },
|
|
|
|
- success: res => {
|
|
|
|
- this.cars++;
|
|
|
|
- setTimeout(() => {
|
|
|
|
- this.add = false;
|
|
|
|
- }, 500);
|
|
|
|
- uni.showToast({ title: '添加成功' });
|
|
|
|
|
|
+ methods: {
|
|
|
|
+ clickSearchType(e) {
|
|
|
|
+ let orderType = e.orderType;
|
|
|
|
+ if (this.currentOrderType == orderType) {
|
|
|
|
+ return;
|
|
}
|
|
}
|
|
- });
|
|
|
|
- },
|
|
|
|
- goCar() {
|
|
|
|
- uni.navigateTo({ url: '/pages/market/two/purchaser/order/cart' });
|
|
|
|
- },
|
|
|
|
- buy(item) {
|
|
|
|
- if (item.id) {
|
|
|
|
|
|
+ this.currentOrderType = orderType;
|
|
|
|
+ this.init();
|
|
|
|
+ this.query();
|
|
|
|
+ },
|
|
|
|
+ init() {
|
|
|
|
+ this.list = [];
|
|
|
|
+ this.param = {
|
|
|
|
+ pageNo: 1,
|
|
|
|
+ pageSize: 10
|
|
|
|
+ }
|
|
|
|
+ },
|
|
|
|
+ query() {
|
|
|
|
+ if (this.currentOrderType == 2) {
|
|
|
|
+ this.getData();
|
|
|
|
+ } else {
|
|
|
|
+ this.getWholeData();
|
|
|
|
+ }
|
|
|
|
+ },
|
|
|
|
+ select(item, index) {
|
|
|
|
+ this.sort.forEach(it => (it.check = false));
|
|
|
|
+ item.check = true;
|
|
|
|
+ if (index > 0) {
|
|
|
|
+ this.isAsc = this.isAsc == 'desc' ? 'asc' : 'desc';
|
|
|
|
+ item.isAsc = this.isAsc;
|
|
|
|
+ }
|
|
|
|
+ item.sortName=item.sortName=='resale_price'&&this.currentOrderType==1?item.sortName='sumUpPrice':item.sortName;
|
|
|
|
+ this.param.orderBy = item.sortName + ' ' + this.isAsc;
|
|
|
|
+ this.refresh();
|
|
|
|
+ },
|
|
|
|
+ getWholeData() {
|
|
|
|
+ this.http.request({
|
|
|
|
+ url: '/level-one-server/app/HtTradeSettlement/getOnSaleList',
|
|
|
|
+ data: this.param,
|
|
|
|
+ loading: 'false',
|
|
|
|
+ success: res => {
|
|
|
|
+ this.loadMore = parseInt(res.data.pageCount) > this.param.pageNo;
|
|
|
|
+ this.list.push(...res.data.data);
|
|
|
|
+ }
|
|
|
|
+ });
|
|
|
|
+ },
|
|
|
|
+ getData() {
|
|
|
|
+ this.http.request({
|
|
|
|
+ url: '/level-two-server/app/TbOrders/getLevelTwoList',
|
|
|
|
+ data: this.param,
|
|
|
|
+ loading: 'false',
|
|
|
|
+ success: res => {
|
|
|
|
+ this.loadMore = parseInt(res.data.pageCount) > this.param.pageNo;
|
|
|
|
+ this.list.push(...res.data.data);
|
|
|
|
+ }
|
|
|
|
+ });
|
|
|
|
+ },
|
|
|
|
+ //多选购买
|
|
|
|
+ selected(item) {
|
|
|
|
+ item.check = !item.check;
|
|
|
|
+ this.$forceUpdate();
|
|
|
|
+ this.selects = this.list.filter(item => item.check);
|
|
|
|
+ },
|
|
|
|
+ //选择分类
|
|
|
|
+ go() {
|
|
uni.navigateTo({
|
|
uni.navigateTo({
|
|
- url: '/pages/market/two/purchaser/buy/buy?orderId=' + item.id
|
|
|
|
|
|
+ url: '/pages/market/productType?current=' + this.param.current + '&now=' + this.param.now
|
|
});
|
|
});
|
|
- } else {
|
|
|
|
|
|
+ },
|
|
|
|
+ detail(item) {
|
|
uni.navigateTo({
|
|
uni.navigateTo({
|
|
- url: '/pages/market/two/purchaser/buy/buy?orderId=' + this.selects.map(item => item.id)
|
|
|
|
|
|
+ url: '/pages/market/two/purchaser/buy/detail?id=' + item.id + '&type=' + this.currentOrderType
|
|
});
|
|
});
|
|
|
|
+ },
|
|
|
|
+ addCar(item) {
|
|
|
|
+ this.add = true;
|
|
|
|
+ this.http.request({
|
|
|
|
+ url: '/level-two-server/app/TbOrdersCart/add',
|
|
|
|
+ method: 'POST',
|
|
|
|
+ data: {
|
|
|
|
+ orderId: item.id
|
|
|
|
+ },
|
|
|
|
+ success: res => {
|
|
|
|
+ this.cars++;
|
|
|
|
+ setTimeout(() => {
|
|
|
|
+ this.add = false;
|
|
|
|
+ }, 500);
|
|
|
|
+ uni.showToast({
|
|
|
|
+ title: '添加成功'
|
|
|
|
+ });
|
|
|
|
+ }
|
|
|
|
+ });
|
|
|
|
+ },
|
|
|
|
+ goCar() {
|
|
|
|
+ uni.navigateTo({
|
|
|
|
+ url: '/pages/market/two/purchaser/order/cart'
|
|
|
|
+ });
|
|
|
|
+ },
|
|
|
|
+ buy(item) {
|
|
|
|
+ let ids = undefined;
|
|
|
|
+ if (item.id) {
|
|
|
|
+ ids = item.id;
|
|
|
|
+ } else {
|
|
|
|
+ ids = this.selects.map(item => item.id)
|
|
|
|
+ }
|
|
|
|
+ if (this.currentOrderType == 2) {
|
|
|
|
+ uni.navigateTo({
|
|
|
|
+ url: '/pages/market/two/purchaser/buy/buy?orderId=' + ids
|
|
|
|
+ });
|
|
|
|
+ return;
|
|
|
|
+ }
|
|
|
|
+ uni.navigateTo({
|
|
|
|
+ url: '/pages/market/two/purchaser/buy/buyWhole?ids=' + ids
|
|
|
|
+ });
|
|
|
|
+ },
|
|
|
|
+ //刷新数据
|
|
|
|
+ refresh() {
|
|
|
|
+ this.loadMore = true;
|
|
|
|
+ this.param.pageNo = 1;
|
|
|
|
+ this.list = [];
|
|
|
|
+ this.selects = [];
|
|
|
|
+ this.query();
|
|
}
|
|
}
|
|
},
|
|
},
|
|
- //刷新数据
|
|
|
|
- refresh() {
|
|
|
|
- this.loadMore = true;
|
|
|
|
- this.param.pageNo = 1;
|
|
|
|
- this.list = [];
|
|
|
|
- this.selects=[];
|
|
|
|
- this.getData();
|
|
|
|
- }
|
|
|
|
- },
|
|
|
|
- //下拉刷新
|
|
|
|
- onPullDownRefresh() {
|
|
|
|
- setTimeout(() => {
|
|
|
|
- this.refresh();
|
|
|
|
- uni.stopPullDownRefresh();
|
|
|
|
- }, 1000);
|
|
|
|
- },
|
|
|
|
- //上拉加载
|
|
|
|
- onReachBottom() {
|
|
|
|
- if (this.loadMore) {
|
|
|
|
- this.param.pageNo++;
|
|
|
|
- this.getData();
|
|
|
|
|
|
+ //下拉刷新
|
|
|
|
+ onPullDownRefresh() {
|
|
|
|
+ setTimeout(() => {
|
|
|
|
+ this.refresh();
|
|
|
|
+ uni.stopPullDownRefresh();
|
|
|
|
+ }, 1000);
|
|
|
|
+ },
|
|
|
|
+ //上拉加载
|
|
|
|
+ onReachBottom() {
|
|
|
|
+ if (this.loadMore) {
|
|
|
|
+ this.param.pageNo++;
|
|
|
|
+ this.query();
|
|
|
|
+ }
|
|
}
|
|
}
|
|
- }
|
|
|
|
-};
|
|
|
|
|
|
+ };
|
|
</script>
|
|
</script>
|
|
|
|
|
|
<style lang="scss">
|
|
<style lang="scss">
|
|
-page {
|
|
|
|
- background-color: $pg;
|
|
|
|
-}
|
|
|
|
-.goodsList .item .con {
|
|
|
|
- width: 98%;
|
|
|
|
-}
|
|
|
|
-.con {
|
|
|
|
- .btn {
|
|
|
|
- float: right;
|
|
|
|
- background-color: $main-color;
|
|
|
|
- height: 20px;
|
|
|
|
- position: relative;
|
|
|
|
- color: white;
|
|
|
|
- padding: 5px 20px;
|
|
|
|
- margin-left: 10px;
|
|
|
|
|
|
+ page {
|
|
|
|
+ background-color: $pg;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ .goodsList .item .con {
|
|
|
|
+ width: 98%;
|
|
}
|
|
}
|
|
- .icon {
|
|
|
|
- line-height: 20px;
|
|
|
|
|
|
+
|
|
|
|
+ .con {
|
|
|
|
+ .btn {
|
|
|
|
+ float: right;
|
|
|
|
+ background-color: $main-color;
|
|
|
|
+ height: 20px;
|
|
|
|
+ position: relative;
|
|
|
|
+ color: white;
|
|
|
|
+ padding: 5px 20px;
|
|
|
|
+ margin-left: 10px;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ .icon {
|
|
|
|
+ line-height: 20px;
|
|
|
|
+ }
|
|
}
|
|
}
|
|
-}
|
|
|
|
-.mfooter {
|
|
|
|
- background-color: #ffffff00;
|
|
|
|
- border: 0px;
|
|
|
|
- .btn{
|
|
|
|
- background-color: #F44336;
|
|
|
|
|
|
+
|
|
|
|
+ .mfooter {
|
|
|
|
+ background-color: #ffffff00;
|
|
|
|
+ border: 0px;
|
|
|
|
+
|
|
|
|
+ .btn {
|
|
|
|
+ background-color: #F44336;
|
|
|
|
+ }
|
|
}
|
|
}
|
|
-}
|
|
|
|
-</style>
|
|
|
|
|
|
+</style>
|