|
@@ -18,6 +18,10 @@
|
|
|
</view>
|
|
|
<view class="item" v-for="(item, index) in list" :key="index" @click="detail(item)">
|
|
|
<view class="title">{{ item.createName }}</view>
|
|
|
+ <view class="check" @click.stop="selected(item)">
|
|
|
+ <text class="check icon" v-if="item.check" style="color: #4581fb"></text>
|
|
|
+ <text class="check icon" v-else></text>
|
|
|
+ </view>
|
|
|
<image src="../../../static/news.jpg" mode="aspectFill" class="pic"></image>
|
|
|
<view class="con">
|
|
|
<view class="productName omit">{{ item.goodsName }}</view>
|
|
@@ -35,6 +39,13 @@
|
|
|
<text class="icon"></text>
|
|
|
<view class="bag animated" :class="{ bounce: add }" v-if="cars > 0">{{ cars }}</view>
|
|
|
</button>
|
|
|
+ <view class="mfooter" v-if="selects.length > 0">
|
|
|
+ <view class="flex">
|
|
|
+ <view class="f">
|
|
|
+ <button class="btn" @click="buy({})">立即购买({{ selects.length }})</button>
|
|
|
+ </view>
|
|
|
+ </view>
|
|
|
+ </view>
|
|
|
</view>
|
|
|
</template>
|
|
|
|
|
@@ -54,11 +65,14 @@ export default {
|
|
|
],
|
|
|
list: [],
|
|
|
param: { pageNo: 1, pageSize: 10 },
|
|
|
- loadMore: true
|
|
|
+ loadMore: true,
|
|
|
+ selects: []
|
|
|
};
|
|
|
},
|
|
|
+ onShow(){
|
|
|
+ this.refresh();
|
|
|
+ },
|
|
|
onLoad(e) {
|
|
|
- this.getData();
|
|
|
//选择商品分类
|
|
|
uni.$on('productType', res => {
|
|
|
this.param.goodsType = res.name;
|
|
@@ -89,6 +103,12 @@ export default {
|
|
|
}
|
|
|
});
|
|
|
},
|
|
|
+ //多选购买
|
|
|
+ selected(item) {
|
|
|
+ item.check = !item.check;
|
|
|
+ this.$forceUpdate();
|
|
|
+ this.selects = this.list.filter(item => item.check);
|
|
|
+ },
|
|
|
//选择分类
|
|
|
go() {
|
|
|
uni.navigateTo({ url: '/pages/market/productType?current=' + this.param.current + '&now=' + this.param.now });
|
|
@@ -115,13 +135,22 @@ export default {
|
|
|
uni.navigateTo({ url: '/pages/market/two/purchaser/order/cart' });
|
|
|
},
|
|
|
buy(item) {
|
|
|
- uni.navigateTo({ url: '/pages/market/two/purchaser/buy/buy?orderId=' + item.id });
|
|
|
+ if (item.id) {
|
|
|
+ uni.navigateTo({
|
|
|
+ url: '/pages/market/two/purchaser/buy/buy?orderId=' + item.id
|
|
|
+ });
|
|
|
+ } else {
|
|
|
+ uni.navigateTo({
|
|
|
+ url: '/pages/market/two/purchaser/buy/buy?orderId=' + this.selects.map(item => item.id)
|
|
|
+ });
|
|
|
+ }
|
|
|
},
|
|
|
//刷新数据
|
|
|
refresh() {
|
|
|
this.loadMore = true;
|
|
|
this.param.pageNum = 1;
|
|
|
this.list = [];
|
|
|
+ this.selects=[];
|
|
|
this.getData();
|
|
|
}
|
|
|
},
|
|
@@ -162,4 +191,11 @@ page {
|
|
|
line-height: 20px;
|
|
|
}
|
|
|
}
|
|
|
+.mfooter {
|
|
|
+ background-color: #ffffff00;
|
|
|
+ border: 0px;
|
|
|
+ .btn{
|
|
|
+ background-color: #F44336;
|
|
|
+ }
|
|
|
+}
|
|
|
</style>
|