|
@@ -59,21 +59,41 @@
|
|
|
<view class="zero five">
|
|
|
<view class="five_pubu">
|
|
|
<view class="list" v-for="(item,index) in marketList" :key="index" @tap="toBuy(item)">
|
|
|
- <image class="image" :src="item.file&&item.file.length>0?item.file[0].url:''" mode="">
|
|
|
- </image>
|
|
|
- <view class="name textOver">
|
|
|
- {{item.name}}
|
|
|
- </view>
|
|
|
- <view class="other">
|
|
|
- <view class="money">
|
|
|
- <view class="money_1">
|
|
|
- <text>¥</text><text>{{item.sell_money||0}}</text>
|
|
|
+ <view v-if="market_type=='1'">
|
|
|
+ <image class="image" :src="item.file&&item.file.length>0?item.file[0].url:''" mode="">
|
|
|
+ </image>
|
|
|
+ <view class="name textOver">
|
|
|
+ {{item.name}}
|
|
|
+ </view>
|
|
|
+ <view class="other">
|
|
|
+ <view class="money">
|
|
|
+ <view class="money_1">
|
|
|
+ <text>¥</text><text>{{item.sell_money||0}}</text>
|
|
|
+ </view>
|
|
|
+ <view class="money_2">
|
|
|
+ <text>¥</text><text>{{item.flow_money||0}}</text>
|
|
|
+ </view>
|
|
|
</view>
|
|
|
- <view class="money_2">
|
|
|
- <text>¥</text><text>{{item.flow_money||0}}</text>
|
|
|
+ </view>
|
|
|
+ </view>
|
|
|
+ <view v-else-if="market_type=='2'">
|
|
|
+ <image class="image" :src="item.goods.file&&item.goods.file.length?item.goods.file[0].url:''" mode="">
|
|
|
+ </image>
|
|
|
+ <view class="name textOver">
|
|
|
+ <text>{{item.goods.name}}</text>
|
|
|
+ </view>
|
|
|
+ <view class="other">
|
|
|
+ <view class="money">
|
|
|
+ <view class="money_1">
|
|
|
+ <text>¥</text><text>{{item.sell_money||0}}</text>
|
|
|
+ </view>
|
|
|
+ <view class="money_2">
|
|
|
+ <text>¥</text><text>{{item.flow_money||0}}</text>
|
|
|
+ </view>
|
|
|
</view>
|
|
|
</view>
|
|
|
</view>
|
|
|
+
|
|
|
</view>
|
|
|
</view>
|
|
|
</view>
|
|
@@ -101,6 +121,8 @@
|
|
|
],
|
|
|
platformactList: [ //平台活动
|
|
|
],
|
|
|
+ market_type: '1',
|
|
|
+ platformAct: '',
|
|
|
marketList: [ //商品列表
|
|
|
],
|
|
|
total: 0,
|
|
@@ -114,7 +136,6 @@
|
|
|
},
|
|
|
};
|
|
|
},
|
|
|
- onLoad: function() {},
|
|
|
onShow: function() {
|
|
|
const that = this;
|
|
|
that.search();
|
|
@@ -149,11 +170,28 @@
|
|
|
show_index: 0
|
|
|
});
|
|
|
if (res.errcode == '0') that.$set(that, `platformactList`, res.data);
|
|
|
- // 首页产品列表
|
|
|
- res = await that.$api(`/viewGoods/indexGoodsList`, `GET`, {
|
|
|
+ // 首页产品查询
|
|
|
+ that.searchMarket()
|
|
|
+ },
|
|
|
+ // 首页产品查询
|
|
|
+ async searchMarket() {
|
|
|
+ const that = this;
|
|
|
+ let res;
|
|
|
+ let info = {
|
|
|
skip: that.skip,
|
|
|
limit: that.limit
|
|
|
- });
|
|
|
+ };
|
|
|
+ if (that.market_type == '1') {
|
|
|
+ // 首页产品列表
|
|
|
+ res = await that.$api(`/viewGoods/indexGoodsList`, `GET`, {
|
|
|
+ ...info
|
|
|
+ });
|
|
|
+ } else if (that.market_type == '2') {
|
|
|
+ info.platformAct = that.platformAct
|
|
|
+ res = await that.$api(`/goodsJoinAct`, 'GET', {
|
|
|
+ ...info,
|
|
|
+ })
|
|
|
+ }
|
|
|
if (res.errcode == '0') {
|
|
|
let list = [...that.marketList, ...res.data];
|
|
|
that.$set(that, `marketList`, list);
|
|
@@ -197,16 +235,20 @@
|
|
|
toAct(e) {
|
|
|
const that = this;
|
|
|
that.clearPage();
|
|
|
- uni.navigateTo({
|
|
|
- url: `/pagesRest/activity/info?id=${e._id}`
|
|
|
- })
|
|
|
+ that.$set(that, `market_type`, '2');
|
|
|
+ that.$set(that, `platformAct`, e._id);
|
|
|
+ that.searchMarket();
|
|
|
+ // uni.navigateTo({
|
|
|
+ // url: `/pagesRest/activity/info?id=${e._id}`
|
|
|
+ // })
|
|
|
},
|
|
|
// 购买
|
|
|
toBuy(e) {
|
|
|
const that = this;
|
|
|
+ let id = that.market_type == '1' ? e._id : that.market_type == '2' ? e.goods._id : '';
|
|
|
that.clearPage();
|
|
|
uni.navigateTo({
|
|
|
- url: `/pagesHome/order/detail?id=${e.id||e._id}`
|
|
|
+ url: `/pagesHome/order/detail?id=${id}`
|
|
|
})
|
|
|
},
|
|
|
toPath(e) {
|
|
@@ -234,10 +276,8 @@
|
|
|
that.$set(that, `page`, page)
|
|
|
let skip = page * limit;
|
|
|
that.$set(that, `skip`, skip)
|
|
|
- that.search();
|
|
|
+ that.searchMarket();
|
|
|
uni.hideLoading();
|
|
|
- } else {
|
|
|
- // that.$set(that, `is_bottom`, true)
|
|
|
}
|
|
|
},
|
|
|
// 计算高度
|
|
@@ -257,7 +297,8 @@
|
|
|
that.$set(that, `marketList`, [])
|
|
|
that.$set(that, `skip`, 0)
|
|
|
that.$set(that, `limit`, 6)
|
|
|
- that.$set(that, `page`, 0)
|
|
|
+ that.$set(that, `page`, 0);
|
|
|
+ that.$set(that, `market_type`, '1');
|
|
|
}
|
|
|
}
|
|
|
}
|