cart.vue
4.36 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
<template>
<view class="page">
<customHead mode='searchNav' :title='headtitle'></customHead>
<view class="coupon-tab">
<view class="list" :class="{'action':TabShow===index}" v-for="(item,index) in TypeData"
@click="onCouponTab(index,item)">
<text>{{item.name}}</text>
<text class="line"></text>
</view>
</view>
<view class="goods-list">
<view class="list">
<view class="cart-box" v-for="item in ComData">
<view class="cart-box-top">
<view class="cart-box-img">
<image :src="item.image[0]==null?'../../static/img/head.jpg':(BASE_URL+item.image[0].url)"></image>
</view>
<view class="cart-box-text">
<view class="one-omit my-qymc">{{item.name}}</view>
<view><text class="my-one-omit">{{item.synopsis}}</text></view>
</view>
<view>
<view class="cart-box-btn" @click="freeTell(item.phone)">
<image src="../../static/kefu.png"></image>联系客服
</view>
</view>
</view>
<view class="cart-box-list" v-for="Info in item.goods" @click="OrderDetails(Info.id,item.phone)">
<view class="cart-box-img">
<image :src="Info.cover[0]==null?'../../static/img/head.jpg':(BASE_URL+Info.cover[0].url)"></image>
</view>
<view class="cart-box-text">
<view class="one-omit my-qymc">{{Info.name}}</view>
</view>
<view>
<view class="cart-box-btn">¥{{Info.price}}</view>
</view>
</view>
</view>
</view>
</view>
<!-- tabbar -->
<!-- tabbar -->
<TabBar :tabBarShow="2"></TabBar>
</view>
</template>
<script>
import BASE_URL from '@/common/config.js'
import TabBar from '../../components/TabBar/TabBar.vue';
// 引入mescroll-mixins.js
import MescrollMixin from "@/components/mescroll-uni/mescroll-mixins.js";
import customHead from "@/components/xy-customhead/xy-customhead.vue";
export default {
mixins: [MescrollMixin], // 使用mixin
components: {
TabBar,
customHead,
},
data() {
return {
BASE_URL,
headtitle: '铭钛招聘',
TabShow: 0,
mescroll: null, // mescroll实例对象 (此行可删,mixins已默认)
// 下拉刷新的配置(可选, 绝大部分情况无需配置)
downOption: {},
// 上拉加载的配置(可选, 绝大部分情况无需配置)
upOption: {
use: false,
toTop: {
src: '',
}
},
isEdit: false,
query: {
currentPage: 1,
pageSize: 10
},
comQuery: {
type: "",
currentPage: 1,
pageSize: 10
},
TypeData: [],
ComData: [],
};
},
onReady() {
uni.hideTabBar()
},
onLoad(e) {
this.Gettbgoodstype();
},
methods: {
freeTell(phone) {
wx.makePhoneCall({
phoneNumber: phone, //仅为示例,并非真实的电话号码
success: function() {
console.log("拨打电话成功!")
},
fail: function() {
console.log("拨打电话失败!")
}
})
},
Gettbgoodstype() {
this.API.Gettbgoodstype(this.query).then(res => {
this.TypeData = res.data.list;
this.comQuery.type = this.TypeData[0].id;
this.GettGetListCom();
});
},
GettGetListCom() {
this.API.GettGetListCom(this.comQuery).then(res => {
this.ComData = res.data;
console.log(this.ComData)
});
},
onCouponTab(index, item) {
this.TabShow = index;
this.comQuery.type = item.id;
this.GettGetListCom();
},
/*下拉刷新的回调, 有三种处理方式:*/
downCallback() {
this.mescroll.endSuccess();
},
/*上拉加载的回调*/
upCallback(page) {
setTimeout(() => {
this.mescroll.endByPage(10, 20);
}, 2000)
},
OrderDetails(id,phone) {
uni.navigateTo({
url: '/pages/OrderDetails/OrderDetails?id='+id+'&phone='+phone,
})
},
/**
* 跳转点击
* @param {String} type 跳转类型
*/
onSkip(type) {
switch (type) {
case 'classify':
uni.navigateTo({
url: '/pages/SearchGoodsList/SearchGoodsList',
})
break;
case 'goods':
uni.navigateTo({
url: '/pages/GoodsDetails/GoodsDetails',
animationType: 'zoom-fade-out',
animationDuration: 200
})
break;
}
}
}
}
</script>
<style scoped lang="scss">
@import 'cart.scss';
</style>