123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257 |
- <template>
- <mobile-frame>
- <view class="main">
- <view class="one">
- <view class="one_1" v-if="barActive=='0'">
- <scroll-view scroll-y="true" class="scroll-view">
- <view class="content">
- <u-parse :content="info.content.value"></u-parse>
- </view>
- </scroll-view>
- </view>
- <view class="one_2" v-else-if="barActive=='1'">
- <view class="one_2_1">
- <input type="text" v-model="searchInfo.name" @blur="toInput" placeholder="搜索商品">
- </view>
- <view class="one_2_2">
- <scroll-view scroll-y="true" class="scroll-view" @scrolltolower="toPage" @scroll="toScroll">
- <view class="list-scroll-view">
- <view class="pubu">
- <view class="list" v-for="(item,index) in list" :key="index">
- {{item.goods}}
- </view>
- </view>
- <view class="is_bottom" v-if="is_bottom">
- <text>我们也是有底线的!</text>
- </view>
- </view>
- </scroll-view>
- </view>
- </view>
- </view>
- <view class="two">
- <view class="list" v-for="(item,index) in barList" :key="index" @tap="barChange(index,item)">
- <view class="icon">
- <text :class="['iconfont',barActive==index?item.acticon:item.icon]"></text>
- </view>
- <view :class="['name',barActive==index?'activename':'']">
- {{item.name}}
- </view>
- </view>
- </view>
- </view>
- </mobile-frame>
- </template>
- <script>
- import uParse from "@/components/u-parse/u-parse.vue";
- export default {
- components: {
- uParse,
- },
- data() {
- return {
- id: '',
- barActive: '0',
- barList: [ //底部菜单
- {
- icon: 'icon-shangdian',
- acticon: "icon-shangdian-copy",
- name: '活动详情'
- },
- {
- icon: 'icon-shangpinfenlei',
- acticon: "icon-shangpinfenlei-copy",
- name: '商品列表'
- }
- ],
- // 详情
- info: {},
- // 商品列表
- list: [],
- total: 0,
- page: 0,
- skip: 0,
- limit: 6,
- // 查询
- searchInfo: {},
- // 数据是否触底
- is_bottom: false,
- scrollTop: 0,
- };
- },
- onLoad: function(e) {
- const that = this;
- that.$set(that, `id`, e.id || '634fa595e4ed552882f05a6f');
- },
- onShow: function() {
- const that = this;
- that.searchAct();
- },
- methods: {
- async searchAct() {
- const that = this;
- if (that.id) {
- // 查询详情
- let res = await that.$api(`/platformAct/${that.id}`, 'GET');
- if (res.errcode == '0') {
- uni.setNavigationBarTitle({
- title: res.data.title
- });
- that.$set(that, `info`, res.data)
- }
- that.search()
- }
- },
- // 查询列表
- async search() {
- const that = this;
- // 查询商品列表
- let info = {
- skip: that.skip,
- limit: that.limit,
- platformAct: that.id
- }
- let res = await that.$api(`/goodsJoinAct`, 'GET', {
- ...info,
- ...that.searchInfo
- })
- if (res.errcode == '0') {
- let list = [...that.list, ...res.data];
- that.$set(that, `list`, list)
- that.$set(that, `total`, res.total)
- }
- },
- toPage() {
- const that = this;
- let list = that.list;
- let limit = that.limit;
- if (that.total > list.length) {
- uni.showLoading({
- title: '加载中',
- mask: true
- })
- let page = that.page + 1;
- that.$set(that, `page`, page)
- let skip = page * limit;
- that.$set(that, `skip`, skip)
- that.search();
- uni.hideLoading();
- } else that.$set(that, `is_bottom`, true)
- },
- toScroll(e) {
- const that = this;
- let up = that.scrollTop;
- that.$set(that, `scrollTop`, e.detail.scrollTop);
- let num = Math.sign(up - e.detail.scrollTop);
- if (num == 1) that.$set(that, `is_bottom`, false);
- },
- // 输入框
- toInput(e) {
- const that = this;
- if (e.detail.value) that.$set(that.searchInfo, `name`, e.detail.value);
- that.clearPage();
- that.search();
- },
- // 选择底部菜单
- barChange(index, item) {
- const that = this;
- that.$set(that, `barActive`, index);
- // uni.setNavigationBarTitle({
- // title: item.name
- // });
- },
- // 清空列表
- clearPage() {
- const that = this;
- that.$set(that, `list`, [])
- that.$set(that, `skip`, 0)
- that.$set(that, `limit`, 6)
- that.$set(that, `page`, 0)
- }
- }
- }
- </script>
- <style lang="scss">
- .main {
- display: flex;
- flex-direction: column;
- width: 100vw;
- height: 100vh;
- .one {
- position: relative;
- flex-grow: 1;
- .one_1 {
- height: 92vh;
- .content {
- padding: 2vw;
- }
- image {
- width: 100% !important;
- }
- }
- .one_2 {
- height: 92vh;
- .one_2_1 {
- border-bottom: 1px solid var(--f85Color);
- padding: 2vw;
- input {
- padding: 2vw;
- background-color: var(--f1Color);
- font-size: var(--font14Size);
- border-radius: 5px;
- }
- }
- .one_2_2 {
- padding: 2vw;
- }
- }
- }
- .two {
- display: flex;
- flex-direction: row;
- justify-content: space-around;
- border-top: 1px solid #f1f1f1;
- .list {
- padding: 1vw 0;
- text-align: center;
- .icon {}
- .name {
- font-size: 12px;
- }
- .activename {
- color: var(--fFB1Color);
- }
- }
- }
- }
- .scroll-view {
- position: absolute;
- top: 0;
- left: 0;
- right: 0;
- bottom: 0;
- .list-scroll-view {
- display: flex;
- flex-direction: row;
- flex-wrap: wrap;
- }
- }
- </style>
|