123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147 |
- <template>
- <view class="page">
- <view class="mainBody">
- <scroll-view class="scroll-view_H" scroll-x="true" @scroll="scroll" scroll-left="0">
- <view class="item" :class="{'active':tab===0}" @click="checkTab(0)">
- <text class="left">全部</text>
- <view class="line"></view>
- </view>
- <view class="item" :class="{'active':tab===item.id}" @click="checkTab(item.id)"
- v-for="(item,index) in cate" :key="index">
- <text class="left">{{item.name}}</text>
- <view class="line"></view>
- </view>
- </scroll-view>
- </view>
- <view class="list_info">
- <block v-for="(item,index) in list" :key="index">
- <view class="item" @click="goDetail(item)">
- <view class="avator">
- <image class="icon" :src="item.image" mode="aspectFill">
- </image>
- </view>
- <view class="tit">
- <view class="name">{{item.name}}</view>
- <view class="desc" v-if="false">市场价:¥{{item.price}}</view>
- </view>
- <view class="list_mem">
- <image class="icon" v-for="(item2,index2) in item.mem_list" :src="item2.avator"
- mode="aspectFill" v-if="index2 < 8 && item2.avator != ''" />
- </view>
- <view class="btn_submit" @click="JoinIt(item)" v-if="item.status == 1">加入心愿</view>
- <view class="btn_submit gray" v-if="item.status == 2">已加入</view>
- </view>
- </block>
- <view class="blankHeight"></view>
- </view>
- <DialogBox ref="DialogBox"></DialogBox>
- <ToastW3 ref="ToastW3"></ToastW3>
- </view>
- </template>
- <script>
- export default {
- components: {},
- data() {
- return {
- tab: 0,
- scrollTop: 0,
- old: {
- scrollTop: 0
- },
- list: [],
- cate: [],
- }
- },
- onLoad() {},
- onShow() {
- this.loadData();
- },
- onNavigationBarButtonTap(e) {
- if (e.index === 0) {
- uni.navigateTo({
- url: '/pages/my/wishList'
- });
- }
- },
- methods: {
- onBack() {},
- checkTab(tab) {
- this.tab = tab;
- this.loadData();
- },
- scroll: function(e) {
- console.log(e)
- this.old.scrollTop = e.detail.scrollTop
- },
- goDetail(item) {
- uni.navigateTo({
- url: '/pages/my/wishDetail?id=' + item.id,
- })
- },
- loadData() {
- uni.request({
- url: this.$apiHost + '/Wish/getList',
- data: {
- uuid: getApp().globalData.uuid,
- cid: this.tab,
- },
- header: {
- 'content-type': 'application/json'
- },
- success: (res) => {
- console.log("res", res.data)
- this.list = res.data.list;
- this.cate = res.data.cate;
- }
- });
- },
- JoinIt(item) {
- let that = this;
- this.$refs['DialogBox'].confirm({
- title: '加入心愿',
- content: '是否确定加入心愿',
- DialogType: 'inquiry',
- btn1: '否',
- btn2: '是',
- animation: 0
- }).then((res) => {
- uni.request({
- url: this.$apiHost + "/Wish/joinit",
- data: {
- uuid: getApp().globalData.uuid,
- id: item.id
- },
- header: {
- "content-type": "application/json"
- },
- success: (res) => {
- console.log("----", res.data.list);
- // uni.showToast({
- // title: res.data.str,
- // icon: 'none'
- // })
- that.$refs['ToastW3'].showToast({
- title: res.data.str,
- animation: 0
- });
- if (res.data.success == "yes") {
- that.loadData()
- }
- },
- complete: (com) => {
- uni.hideLoading();
- },
- });
- })
- }
- }
- }
- </script>
- <style scoped lang="scss">
- @import 'wish.scss';
- </style>
|