cardDetail.vue
7.3 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
276
277
278
279
280
281
<template>
<view class="content">
<view class="detail_top">
<!-- 公司名称 -->
<view class="company_name">{{ cardDetail.company_name }}</view>
<!-- 名片正反面 -->
<view>
<image class="card_pic" :src="cardDetail.front_image" mode=""></image>
<view class="card_tips">名片正面</view>
</view>
<view>
<image class="card_pic" :src="cardDetail.reverse_image" mode=""></image>
<view class="card_tips">名片反面</view>
</view>
</view>
<!-- 公司简介 -->
<view class="company_intro">
<view class="company_title_wrap"><view class="company_title">公司简介</view></view>
<view class="company_detail">
<view class="company_detail_box">
<view class="">{{ cardDetail.brief }}</view>
<view class="company_pic_wrap flex_wrap_no">
<view class="company_pic_single" @click="showImg(item)" v-for="(item, index) in cardDetail.brief_images" :key="index"><image :src="item" mode=""></image></view>
</view>
</view>
</view>
</view>
<!-- 经营范围 -->
<view class="company_intro">
<view class="company_title_wrap"><view class="company_title">经营范围</view></view>
<view class="company_detail">
<view class="company_detail_box">
<view class="">{{ cardDetail.scope }}</view>
<view class="company_pic_wrap flex_wrap_no">
<view class="company_pic_single" @click="showImg(item)" v-for="(item, index) in cardDetail.scope_images" :key="index"><image :src="item" mode=""></image></view>
</view>
</view>
</view>
</view>
<!-- 联系方式 -->
<view class="company_intro">
<view class="company_title_wrap"><view class="company_title">联系方式</view></view>
<!-- 地址 -->
<view class="contact_code">
<view class="layer_nobetween">
<!-- 二维码 -->
<view class="qr_code" @click="showImg(cardDetail.wechat_image)"><image :src="cardDetail.wechat_image" mode=""></image></view>
<!-- 姓名 地址 -->
<view class="contact_r flex_star_between">
<view class="">联系人:{{ cardDetail.name }}</view>
<view class="" v-if="cardDetail.phone">电话:{{ cardDetail.phone }}</view>
<view class="" v-if="cardDetail.site">地址:{{ cardDetail.site }}</view>
</view>
</view>
</view>
<!-- 各种联系方式 -->
<view class="contact_single layer_between" v-if="cardDetail.fax">
<view class="layer_between">
<image class="contact_icon" src="../../static/phone.png" mode=""></image>
传真
</view>
<view class="" @click="copyFax()">{{ cardDetail.fax }}</view>
</view>
<view class="contact_single layer_between" v-if="cardDetail.mobile">
<view class="layer_between">
<image class="contact_icon" src="../../static/tel.png" mode=""></image>
手机号
</view>
<view class="" @click="callUp()">{{ cardDetail.mobile }}</view>
</view>
<view class="contact_single layer_between" v-if="cardDetail.qq">
<view class="layer_between">
<image class="contact_icon" src="../../static/qq.png" mode=""></image>
QQ
</view>
<view class="" @click="copyQQ()">{{ cardDetail.qq }}</view>
</view>
<view class="contact_single no_bottom layer_between" v-if="cardDetail.wechat">
<view class="layer_between">
<image class="contact_icon" src="../../static/weixin.png" mode=""></image>
微信
</view>
<view class="" @click="copyWx()">{{ cardDetail.wechat }}</view>
</view>
</view>
<!-- 图片放大 -->
<view class="tx_mask" v-if="isShowImg" @click="closDialog()"></view>
<view class="mask_content" v-if="isShowImg" @click="closDialog()" @longpress="saveImg()">
<image :src="img" mode="widthFix"></image>
</view>
<!-- 收藏按钮 -->
<view class="collect_btn" @click="collectCard()">{{cardDetail.is_collect == 1?"取消收藏":"收藏名片"}}</view>
</view>
</template>
<script>
import App from '../../App.vue';
export default {
data() {
return {
id: '',
imgList: [],
cardDetail: '',
token: '',
// 图片放大
isShowImg:false,
img:"",
};
},
methods: {
// 图片放大
showImg(img){
this.isShowImg = true
this.img = img;
},
saveImg(){
let t = this ;
uni.downloadFile({
url: t.img,
success: function(res) {
uni.saveImageToPhotosAlbum({
filePath: res.tempFilePath,
success: function() {
uni.showToast({
title: '保存成功',
icon: 'none',
duration: 1500
});
t.isShowImg = false
},
fail: function(err) {
if (err.errMsg === "saveImageToPhotosAlbum:fail auth deny" || err.errMsg ===
"saveImageToPhotosAlbum:fail:auth denied") {
uni.showToast({
title: '需要您授权保存相册',
icon:none,
duration: 1500,
success: modalSuccess => {
uni.openSetting({
success(settingdata) {
if (settingdata.authSetting['scope.writePhotosAlbum']) {
uni.showToast({
title: '获取权限成功',
icon: 'none',
duration: 1500
});
} else {
uni.showToast({
title: '获取权限失败',
icon: 'none',
duration: 1500
});
}
},
fail(failData) {
console.log("failData", failData)
},
complete(finishData) {
console.log("finishData", finishData)
}
})
}
})
}
},
});
}
});
},
closDialog(){
this.isShowImg = false
},
// 名片详情
getCarDetail() {
let t = this;
let url = '/api/goods/goods_detail';
let params = {
goods_id: this.id
};
App.post(url, params).then(res => {
this.cardDetail = res;
});
},
// 复制传真
copyFax() {
uni.setClipboardData({
data: this.cardDetail.fax,
success: function() {
uni.showToast({
title: '复制成功',
icon: 'success'
});
}
});
},
// 复制qq
copyQQ() {
uni.setClipboardData({
data: this.cardDetail.qq,
success: function() {
uni.showToast({
title: '复制成功',
icon: 'success'
});
}
});
},
// 复制微信
copyWx() {
uni.setClipboardData({
data: this.cardDetail.wechat,
success: function() {
uni.showToast({
title: '复制成功',
icon: 'success'
});
}
});
},
// 拨打电话
callUp() {
uni.makePhoneCall({
phoneNumber: this.cardDetail.mobile
});
},
// 收藏名片
collectCard() {
if (this.token) {
let url = '/api/collect/collect';
let params = {
goods_id:this.id
};
App.post(url,params)
.then(res=>{
uni.showToast({
title:'操作成功',
icon:'success',
duration:1500
})
setTimeout(function(){
uni.navigateBack({
delta:1
})
},1500)
})
} else {
uni.navigateTo({
url: '/pages/start/start'
});
}
}
},
onLoad(option) {
this.token = uni.getStorageSync('token');
this.id = option.id;
// 获取名片详情
this.getCarDetail();
},
onShareAppMessage: function (res) {
var that = this;
// 来自页面内转发按钮
return {
title: '分享',
path: "/pages/index/cardDetail?id="+that.id
}
}
};
</script>
<style>
@import url('../../style/cardDetail');
</style>