GoodsDetails.vue
7.52 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
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
<template>
<view class="page">
<!-- banner -->
<view class="banner">
<swiper class="screen-swiper round-dot" indicator-dots="true" circular="true" autoplay="true"
interval="5000" duration="500">
<swiper-item v-for="(item, index) in swiperList" :key="index">
<image :src="baseUrl + item.url" style="width: 100%;height: 100%;" mode="aspectFill"></image>
<!-- <video src="{{item.url}}" autoplay loop muted show-play-btn="{{false}}" controls="{{false
}}" objectFit="cover" wx:if="{{item.type == 'video'}}"></video> -->
</swiper-item>
</swiper>
</view>
<view class="gd-content">
<view class="goodscontent">
<view class="goods-box">
<!-- 标题 -->
<view class="goods-title">
<view class="goods-title-top">{{returnData.title}}</view>
<view class="goods-title-text">{{returnData.remark}}</view>
<view class="goods-fx">
<image src="../../static/fx.png"></image>
</view>
</view>
</view>
</view>
<!-- <view class="list-middle">
<view class="list-middle-list">
<view>产地</view>
<view class="list-middle-list-text">四川大凉山</view>
</view>
<view class="list-middle-list">
<view>规格</view>
<view class="list-middle-list-text">精品</view>
</view>
<view class="list-middle-list">
<view>物流</view>
<view class="list-middle-list-text">包邮(部分地区除外)</view>
</view>
</view> -->
<view class="feed-list">
<view class="feed-list-box">
<view class="feed-list-box-left">
<!-- <view><image src="../../static/img/logo.png"></image></view> -->
<view>
<view class="feed-list-box-name">{{this.companyName}}</view>
<!-- <view class="feed-list-box-add"><image src="../../static/kefu1.png"></image>成都市锦江区带永明路666号</view> -->
</view>
</view>
<view><view class="feed-list-box-btn" @click="toCompanyInfo(returnData.comapny)">查看</view></view>
</view>
<!-- <view>
<scroll-view class="scroll-view" scroll-x="true">
<view class="item">
<image src="../../static/img/add.jpg"></image>
</view>
<view class="item">
<image src="../../static/img/add.jpg"></image>
</view>
<view class="item">
<image src="../../static/img/add.jpg"></image>
</view>
<view class="item">
<image src="../../static/img/add.jpg"></image>
</view>
</scroll-view>
</view> -->
</view>
<view class="goods-list">
<view class="list">
<!-- 商品介绍 -->
<view class="products-introduction" ref="products">
<view class="title">
<text>商品介绍</text>
</view>
<view class="content" v-html="web_content"></view>
</view>
</view>
</view>
</view>
<!-- 底部 -->
<view class="page-footer">
<view class="footer-fn">
<view class="list">
<image src="../../static/detail2.png"></image>
<text>收藏</text>
</view>
</view>
<view class="footer-buy">
<view class="buy-at" @click="callPhone(phoneNumber)">
<image src="../../static/detail1.png"></image>
<text>打电话</text>
</view>
</view>
</view>
</view>
</template>
<script>
import request from '@/utils/request.js'
import { data } from '../../uview-ui/libs/mixin/mixin';
export default {
data() {
return {
TabShow: 0,
isMore: false,
AttentionShow: 0,
swiperList: [{
id: 0,
type: 'image',
url: '/static/img/add.jpg'
},
{
id: 1,
type: 'image',
url: '/static/img/add.jpg'
}
],
web_content: '<div class="m-img"><img src="../../static/img/add.jpg"><div class="tools" hidden><i class="fa fa-arrow-up move-up"></i><i class="fa fa-arrow-down move-down"></i><em class="move-remove" hidden ><i class="fa fa-times" aria-hidden="true"></i> 移除</em><div class="cover"></div></div></div>',
PageScrollTop: 0,
type: 0,
id:'',
returnData:{},
baseUrl:'http://deyanggaoxin.fengshiyun.com',
companyName:'',
phoneNumber:'',
// 公司id
companyId:''
};
},
onLoad(options) {
let data = JSON.parse(options.data)
console.log(data)
this.id = data.id
this.getProDetail()
// this.getCompanyPhone()
},
onPageScroll(e) {
this.PageScrollTop = e.scrollTop;
},
methods: {
// 获取产品详情
getProDetail(){
request({
url:`/api/Extend/baseproduct/${this.id}`,
methd:'get',
data:{}
}).then(res=>{
if(res.code === 200){
console.log(res)
this.returnData = res.data
this.companyId = this.returnData.comapny
this.companyName = res.data.companyName
this.web_content = this.returnData.content
if(res.data.companyName === null){
this.companyName === res.data.comapny
}
if(res.data.images.length >= 0){
this.swiperList = res.data.images.map(it=>{
return {
type:'image',
id:it.fileId,
url:it.url
}
})
this.swiperList = JSON.parse(JSON.stringify(this.swiperList))
// console.log(res.data.images.length)
// console.log(this.swiperList)
}
}
}).then(data=>{
request({
url:`/api/permission/organize/${this.companyId}`,
// url:`/api/permission/organize/bbf6effe-6354-11ed-b582-00163e2cec73`,
method:'get',
data:{}
}).then(res=>{
console.log('电话号码返回结果',res)
if(res.code === 200){
this.phoneNumber = res.data.fuzerendianhua
console.log("电话号码", this.phoneNumber)
}else{
uni.showToast({
icon:'error',
title:"获取信息失败,请重试!"
})
}
})
})
},
onCouponTab(type) {
this.TabShow = type;
},
/**
* 返回
*/
onBack() {
uni.navigateBack();
},
/**
* tab
*/
onTab(type) {
this.TabShow = type;
switch (type) {
case 0:
uni.pageScrollTo({
scrollTop: 0,
duration: 300
});
break;
case 1:
uni.createSelectorQuery().select(".evaluate-data").boundingClientRect((data) => { //data - 各种参数
uni.pageScrollTo({
scrollTop: this.PageScrollTop + data.top - 50,
duration: 300
});
}).exec()
break;
case 2:
uni.createSelectorQuery().select(".products-introduction").boundingClientRect((
data) => { //data - 各种参数
uni.pageScrollTo({
scrollTop: this.PageScrollTop + data.top - 50,
duration: 300
});
}).exec()
break;
}
},
// 跳转到公司详情
toCompanyInfo(item){
uni.navigateTo({
url: `/pages/companyDetail/companyDetail?data=${JSON.stringify(item)}`
})
},
// 拨打电话
callPhone(phoneNumber){
if (uni.getSystemInfoSync().platform == 'android' || uni.getSystemInfoSync().platform == 'ios') {
uni.showModal({
title: '温馨提示',
content: '确定要拨打电话吗?',
success: function (res) {
if (res.confirm) {
// 使用plus的API拨打电话
plus.device.dial(phoneNumber, true);
}
}
})
} else {
// 非APP平台时,使用uniapp自带的API拨打电话
uni.makePhoneCall({
phoneNumber: phoneNumber,
success: function () {
console.log('拨打电话成功!');
},
fail: function () {
console.log('拨打电话失败!');
}
});
}
}
}
};
</script>
<style scoped lang="scss">
@import 'GoodsDetails.scss';
</style>