Commit bd6059cc authored by 刘文虎's avatar 刘文虎
parents 7dbd2d42 1e160f2a
Pipeline #2918 canceled with stages
...@@ -58,4 +58,35 @@ export async function editBusinessCard(data) { ...@@ -58,4 +58,35 @@ export async function editBusinessCard(data) {
data, data,
noLoading: true noLoading: true
}) })
} }
\ No newline at end of file
// 拨打电话
export async function operateCall(data) {
return request({
url: `/rest/businessCard/call/${data.businessCardId}`,
method: 'GET',
data,
noLoading: true
})
}
// 查看名片
export async function operateView(data) {
return request({
url: `/rest/businessCard/view/${data.businessCardId}`,
method: 'GET',
data,
noLoading: true
})
}
// 加通讯录
export async function operateJoinList(data) {
return request({
url: `/rest/businessCard/joinList/${data.businessCardId}`,
method: 'GET',
data,
noLoading: true
})
}
...@@ -5,8 +5,8 @@ ...@@ -5,8 +5,8 @@
</view> </view>
<view class="content-view"> <view class="content-view">
<view v-if="info.backTitle" class="title-view">{{ info.backTitle }}</view> <view v-if="info.backTitle" class="title-view">{{ info.backTitle }}</view>
<view v-if="info.backContent" class="text-view"> <view v-if="info.backContext" class="text-view">
<text>{{ info.backContent }}</text> <text>{{ info.backContext }}</text>
</view> </view>
</view> </view>
</view> </view>
...@@ -33,7 +33,7 @@ export default { ...@@ -33,7 +33,7 @@ export default {
}, },
// green 绿;blue 蓝;black 黑; // green 绿;blue 蓝;black 黑;
image() { image() {
switch (this.info.type) { switch (this.info.coverUrl) {
case 'green': case 'green':
return this.baseUrl + 'muban1fanmian@3x.png' return this.baseUrl + 'muban1fanmian@3x.png'
case 'blue': case 'blue':
...@@ -85,6 +85,7 @@ export default { ...@@ -85,6 +85,7 @@ export default {
font-weight: bold; font-weight: bold;
color: #ffffff; color: #ffffff;
margin-bottom: 24rpx; margin-bottom: 24rpx;
text-align: center;
} }
} }
} }
......
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
</view> </view>
<view class="content-view"> <view class="content-view">
<view class="top-view"> <view class="top-view">
<view class="title-view">{{ info. frontTitle }}</view> <view class="title-view">{{ info.frontTitle }}</view>
</view> </view>
<view class="name-view">{{ info.name }}</view> <view class="name-view">{{ info.name }}</view>
<view class="info-view"> <view class="info-view">
...@@ -20,12 +20,14 @@ ...@@ -20,12 +20,14 @@
<view class="value-view">{{ info.address }}</view> <view class="value-view">{{ info.address }}</view>
</view> </view>
</view> </view>
<view <view class="right-view">
class="right-view" <QRCode
hover-class="u-hover-class" ref="qr-code"
@click="$u.throttle(previewQRCode, 500)" canvas-id="qr-code"
> :value="shareUrl"
<image :src="info.qrCode"></image> :size="size"
@complete="complete"
/>
</view> </view>
</view> </view>
</view> </view>
...@@ -33,13 +35,15 @@ ...@@ -33,13 +35,15 @@
<template v-else-if="isBlue"> <template v-else-if="isBlue">
<view class="content-view"> <view class="content-view">
<view class="top-view top-blue"> <view class="top-view top-blue">
<view class="title-view title-blue">{{ info. frontTitle }}</view> <view class="title-view title-blue">{{ info.frontTitle }}</view>
<view <view class="right-view">
class="right-view" <QRCode
hover-class="u-hover-class" ref="qr-code"
@click="$u.throttle(previewQRCode, 500)" canvas-id="qr-code"
> :value="shareUrl"
<image :src="info.qrCode"></image> :size="size"
@complete="complete"
/>
</view> </view>
</view> </view>
<view class="name-view">{{ info.name }}</view> <view class="name-view">{{ info.name }}</view>
...@@ -71,24 +75,32 @@ ...@@ -71,24 +75,32 @@
<view class="value-view">{{ info.address }}</view> <view class="value-view">{{ info.address }}</view>
</view> </view>
</view> </view>
<view <view class="right-view">
class="right-view" <QRCode
hover-class="u-hover-class" ref="qr-code"
@click="$u.throttle(previewQRCode, 500)" canvas-id="qr-code"
> :value="shareUrl"
<image :src="info.qrCode"></image> :size="size"
@complete="complete"
/>
</view> </view>
</view> </view>
</view> </view>
<view class="bottom-view"> <view class="bottom-view">
<view class="title-view">{{ info. frontTitle }}</view> <view class="title-view">{{ info.frontTitle }}</view>
</view> </view>
</template> </template>
</view> </view>
</template> </template>
<script> <script>
import { card_share_url } from '@/utils/config.js'
import QRCode from '@/components/Sansnn-uQRCode/components/u-qrcode/u-qrcode.vue'
export default { export default {
components: {
QRCode,
},
props: { props: {
info: { info: {
type: Object, type: Object,
...@@ -100,6 +112,7 @@ export default { ...@@ -100,6 +112,7 @@ export default {
data() { data() {
return { return {
loading: true, loading: true,
size: 60,
} }
}, },
computed: { computed: {
...@@ -110,17 +123,20 @@ export default { ...@@ -110,17 +123,20 @@ export default {
return this.baseUrl + 'muban1zhengmian@3x.png' return this.baseUrl + 'muban1zhengmian@3x.png'
}, },
isGreen() { isGreen() {
return this.info. coverUrl == 'green' return this.info.coverUrl == 'green'
}, },
isBlue() { isBlue() {
return this.info. coverUrl == 'blue' return this.info.coverUrl == 'blue'
}, },
isBlack() { isBlack() {
return this.info. coverUrl == 'black' return this.info.coverUrl == 'black'
},
shareUrl() {
return card_share_url + `?cardId=${this.info.id}`
}, },
// green 绿;blue 蓝;black 黑; // green 绿;blue 蓝;black 黑;
settings() { settings() {
switch (this.info. coverUrl) { switch (this.info.coverUrl) {
case 'green': case 'green':
return { return {
color: '#02A074', color: '#02A074',
...@@ -137,28 +153,26 @@ export default { ...@@ -137,28 +153,26 @@ export default {
} }
}, },
}, },
watch: {
'info.id'(val) {
if (val) {
this.remake()
}
},
},
methods: { methods: {
previewQRCode() { remake() {
uni.previewImage({ this.$nextTick(() => {
urls: [this.info.qrCode], this.$refs['qr-code'].remake()
current: 0,
longPressActions: {
success: function (data) {
console.log(
'选中了第' +
(data.tapIndex + 1) +
'个按钮,第' +
(data.index + 1) +
'张图片'
)
},
fail: function (err) {
console.log(err.errMsg)
},
},
}) })
}, },
complete(e) {
if (e.success) {
console.log('生成成功')
} else {
console.log('生成失败')
}
},
}, },
} }
</script> </script>
......
...@@ -115,6 +115,9 @@ ...@@ -115,6 +115,9 @@
</view> </view>
</u-form> </u-form>
</view> </view>
<view class="loading-view" v-if="loading"
><u-loading mode="flower"></u-loading
></view>
<view class="bottom-view"> <view class="bottom-view">
<u-button <u-button
:custom-style="customConFirm" :custom-style="customConFirm"
...@@ -126,13 +129,14 @@ ...@@ -126,13 +129,14 @@
</u-button> </u-button>
</view> </view>
<PopImage :visible.sync="visible" :images="currentImages" /> <PopImage :visible.sync="visible" :images="currentImages" />
<u-toast ref="uToast" />
</view> </view>
</template> </template>
<script> <script>
import NavbarRight from '@/components/navbar-right' import NavbarRight from '@/components/navbar-right'
import PopImage from '@/components/pop-image' import PopImage from '@/components/pop-image'
import { editbusinessCard } from '@/api/card/index.js' import { editBusinessCard, getBusinessCard } from '@/api/card/index.js'
export default { export default {
components: { components: {
...@@ -253,7 +257,6 @@ export default { ...@@ -253,7 +257,6 @@ export default {
}, },
canConfirm() { canConfirm() {
for (var item in this.form) { for (var item in this.form) {
console.log('------canConfirm------', item)
if (!this.form[item]) { if (!this.form[item]) {
return false return false
} }
...@@ -281,14 +284,14 @@ export default { ...@@ -281,14 +284,14 @@ export default {
var data = res.data var data = res.data
if (data) { if (data) {
this.form = { this.form = {
id: res.id, id: data.id,
address: res.data, address: data.address,
backContext: res.backContext, backContext: data.backContext,
backTitle: res.backTitle, backTitle: data.backTitle,
coverUrl: res.coverUrl, coverUrl: data.coverUrl,
frontTitle: res.frontTitle, frontTitle: data.frontTitle,
name: res.name, name: data.name,
phone: res.phone, phone: data.phone,
} }
} }
this.loading = false this.loading = false
...@@ -297,20 +300,27 @@ export default { ...@@ -297,20 +300,27 @@ export default {
this.loading = false this.loading = false
}) })
}, },
editbusinessCard() { editBusinessCard() {
this.buttonLoading = true this.buttonLoading = true
editbusinessCard(this.form) editBusinessCard(this.form)
.then((res) => { .then((res) => {
if (res.data) { if (res.data) {
this.buttonLoading = false this.buttonLoading = false
uni.$emit('card-refresh') uni.$emit('card-refresh')
this.$u.route({ this.$refs.uToast.show({
type: 'back', title: this.cardId ? '编辑成功' : '创建成功',
}) type: 'success',
duration: 1500,
callback: () => {
this.$u.route({
type: 'back',
})
},
})
} }
}) })
.catch((res) => { .catch((res) => {
this.loading = false this.buttonLoading = false
}) })
}, },
previewTemplate(index) { previewTemplate(index) {
...@@ -324,7 +334,7 @@ export default { ...@@ -324,7 +334,7 @@ export default {
this.$refs.uForm.validate((valid) => { this.$refs.uForm.validate((valid) => {
if (valid) { if (valid) {
console.log('验证通过') console.log('验证通过')
this.editbusinessCard() this.editBusinessCard()
} else { } else {
console.log('验证失败') console.log('验证失败')
} }
...@@ -458,5 +468,15 @@ export default { ...@@ -458,5 +468,15 @@ export default {
font-size: 32rpx; font-size: 32rpx;
} }
} }
.loading-view {
width: 100%;
background-color: transparent;
display: flex;
align-items: center;
justify-content: center;
top: 50%;
left: 0;
position: fixed;
}
} }
</style> </style>
...@@ -106,6 +106,7 @@ import { ...@@ -106,6 +106,7 @@ import {
getBusinessCardRecord, getBusinessCardRecord,
operateStatistics, operateStatistics,
} from '@/api/card/index.js' } from '@/api/card/index.js'
import { mapGetters } from 'vuex'
export default { export default {
components: { components: {
...@@ -130,6 +131,7 @@ export default { ...@@ -130,6 +131,7 @@ export default {
} }
}, },
computed: { computed: {
...mapGetters(['userInfo']),
baseUrl() { baseUrl() {
return process.uniEnv.qn_base_url return process.uniEnv.qn_base_url
}, },
...@@ -139,6 +141,12 @@ export default { ...@@ -139,6 +141,12 @@ export default {
noDataImage() { noDataImage() {
return this.baseUrl + 'mingpianwuxinxi@3x.png' return this.baseUrl + 'mingpianwuxinxi@3x.png'
}, },
shareTitle() {
return `"${this.info.name}"的名片`
},
shareParams() {
return `?cardId=${this.info.id}&shareUserId=${this.userInfo.id}`
},
infoKeys() { infoKeys() {
// {view:浏览;call:拨打电话;list:通讯录},可用值:VIEW,CALL,LIST // {view:浏览;call:拨打电话;list:通讯录},可用值:VIEW,CALL,LIST
return [ return [
...@@ -291,6 +299,22 @@ export default { ...@@ -291,6 +299,22 @@ export default {
url: 'pages/card/create', url: 'pages/card/create',
}) })
}, },
// 朋友圈
onShareTimeline(res) {
return {
title: this.shareTitle,
path: 'pages/pages/share' + this.shareParams,
// imageUrl: ''
}
},
// 好友
onShareAppMessage(res) {
return {
title: this.shareTitle,
path: 'pages/pages/share' + this.shareParams,
// imageUrl: ''
}
},
}, },
} }
</script> </script>
......
...@@ -7,9 +7,12 @@ ...@@ -7,9 +7,12 @@
</view> </view>
<CardBack :info="info" /> <CardBack :info="info" />
</view> </view>
<view class="loading-view" v-if="loading"
><u-loading mode="flower"></u-loading
></view>
<view class="bottom-view"> <view class="bottom-view">
<view class="left-view"> <view class="left-view">
<u-button :custom-style="customScan" @click="handleClickScan"> <u-button :custom-style="customCall" @click="handleClickCall">
<view class="image-view"> <view class="image-view">
<image :src="bodadianhuaImage"></image> <image :src="bodadianhuaImage"></image>
</view> </view>
...@@ -19,7 +22,7 @@ ...@@ -19,7 +22,7 @@
<view class="right-view"> <view class="right-view">
<u-button <u-button
:custom-style="customConFirm" :custom-style="customConFirm"
@click="handleClickConFirm" @click="handleClickConfirm"
class="confirm-button" class="confirm-button"
> >
<view class="image-view"> <view class="image-view">
...@@ -29,6 +32,7 @@ ...@@ -29,6 +32,7 @@
</u-button> </u-button>
</view> </view>
</view> </view>
<u-toast ref="uToast" />
</view> </view>
</template> </template>
...@@ -36,7 +40,13 @@ ...@@ -36,7 +40,13 @@
import NavbarRight from '@/components/navbar-right' import NavbarRight from '@/components/navbar-right'
import Card from '@/components/cell-card' import Card from '@/components/cell-card'
import CardBack from '@/components/cell-card-back' import CardBack from '@/components/cell-card-back'
import {
getBusinessCard,
operateCall,
operateView,
operateJoinList,
} from '@/api/card/index.js'
import { mapGetters } from 'vuex'
export default { export default {
components: { components: {
NavbarRight, NavbarRight,
...@@ -47,9 +57,12 @@ export default { ...@@ -47,9 +57,12 @@ export default {
return { return {
cardId: '', cardId: '',
info: {}, info: {},
// shareUserId: '',
loading: false,
} }
}, },
computed: { computed: {
...mapGetters(['userInfo']),
baseUrl() { baseUrl() {
return process.uniEnv.qn_base_url return process.uniEnv.qn_base_url
}, },
...@@ -59,7 +72,7 @@ export default { ...@@ -59,7 +72,7 @@ export default {
cunrutongxunluImage() { cunrutongxunluImage() {
return this.baseUrl + 'cunrutongxunlu@3x.png' return this.baseUrl + 'cunrutongxunlu@3x.png'
}, },
customScan() { customCall() {
return { return {
color: 'transparent', color: 'transparent',
'background-color': '#ffffff', 'background-color': '#ffffff',
...@@ -77,32 +90,137 @@ export default { ...@@ -77,32 +90,137 @@ export default {
width: '332rpx', width: '332rpx',
} }
}, },
shareTitle() {
return `"${this.info.name}"的名片`
},
shareParams() {
return `?cardId=${this.info.id}&shareUserId=${this.userInfo.id}`
},
}, },
onLoad(options) { onLoad(options) {
if (options && options.cardId) { // 测试数据
this.cardId = options.cardId // options.cardId = '1551401777033641984'
// if (options && options.shareUserId) {
// this.shareUserId = options.shareUserId
// }
if (options.q) {
// 扫码进的
const q = decodeURIComponent(options.q)
this.initOptions(q)
} else {
if (options && options.cardId) {
this.cardId = options.cardId
}
} }
this.init() this.getBusinessCard()
this.operateView()
}, },
onShow() {}, onShow() {},
methods: { methods: {
init() { getCardId(q) {
this.loading = false var array = q.split('?')
this.info = { if (array.length > 1) {
type: 'black', var arr = array[1].split('&')
title: '扳手专业品牌家电维修', for (var item of arr) {
name: '小扳手', if (item.indexOf('cardId=') != -1) {
address: this.cardId = item.split('=')[1]
'dfsafdsafdasf发撒范德萨范德萨发的范德萨范大师傅的范德萨范大事发声的范德萨范德萨发撒发', break
phone: '131231241314', }
qrCode: 'http://static-book.kaying.cc/icon/beijing%403x.png', }
backTitle: '范德萨范德萨范德萨范撒地方', }
backContent: `家电维修安装、清洗保养服务、二手家电回收\n水电维修服务、家具维保服务、家居清洗美化`, },
getBusinessCard() {
this.loading = true
getBusinessCard()
.then((res) => {
if (res.data) {
this.info = res.data
}
this.loading = false
})
.catch((res) => {
this.loading = false
})
},
operateCall() {
this.loading = true
operateCall({
businessCardId: this.cardId,
})
.then((res) => {
this.loading = false
})
.catch((res) => {
this.loading = false
})
},
operateView() {
this.loading = true
operateView({
businessCardId: this.cardId,
})
.then((res) => {
this.loading = false
})
.catch((res) => {
this.loading = false
})
},
operateJoinList() {
this.loading = true
operateJoinList({
businessCardId: this.cardId,
})
.then((res) => {
this.loading = false
})
.catch((res) => {
this.loading = false
})
},
handleClickCall() {
if (this.info.phone) {
uni.makePhoneCall({
phoneNumber: this.info.phone,
})
}
this.operateCall()
},
handleClickConfirm() {
uni.addPhoneContact({
nickName: this.info.name,
mobilePhoneNumber: this.info.phone,
success: () => {
this.$refs.uToast.show({
title: '保存成功',
type: 'success',
duration: 1500,
callback: () => {},
})
},
fail: () => {
console.log('fail')
},
})
this.operateJoinList()
},
// 朋友圈
onShareTimeline(res) {
return {
title: this.shareTitle,
path: 'pages/pages/share' + this.shareParams,
// imageUrl: ''
}
},
// 好友
onShareAppMessage(res) {
return {
title: this.shareTitle,
path: 'pages/pages/share' + this.shareParams,
// imageUrl: ''
} }
}, },
handleClickScan() {},
handleClickConfirm() {},
}, },
} }
</script> </script>
...@@ -175,5 +293,15 @@ export default { ...@@ -175,5 +293,15 @@ export default {
} }
} }
} }
.loading-view {
width: 100%;
background-color: transparent;
display: flex;
align-items: center;
justify-content: center;
top: 50%;
left: 0;
position: fixed;
}
} }
</style> </style>
...@@ -266,7 +266,12 @@ export default { ...@@ -266,7 +266,12 @@ export default {
return this.$u.timeFormat(new Date(string).getTime(), 'yyyy年mm月') return this.$u.timeFormat(new Date(string).getTime(), 'yyyy年mm月')
}, },
}, },
onLoad() {}, onLoad(options) {
if (options.q) {
const q = decodeURIComponent(options.q) // 获取到二维码原始链接内容
console.log(q)
}
},
onShow() { onShow() {
console.log('----------------') console.log('----------------')
this.userInfo this.userInfo
......
...@@ -159,33 +159,29 @@ ...@@ -159,33 +159,29 @@
</view> </view>
</template> </template>
</view> </view>
<PopQRCode <PopQRCode :visible.sync="visible" :title="shareTitle" :url="shareUrl" />
:visible.sync="visible" <u-toast ref="uToast" />
:title="shareTitle"
:url="shareUrl"
/>
<u-toast ref="uToast" />
</view> </view>
</template> </template>
<script> <script>
import NavbarRight from '@/components/navbar-right' import NavbarRight from '@/components/navbar-right'
import PopQRCode from '@/components/pop-qrCode' import PopQRCode from '@/components/pop-qrCode'
import { repairDetail,repairSign } from '@/api/maintain/index.js' import { repairDetail, repairSign } from '@/api/maintain/index.js'
import { mapGetters } from 'vuex' import { mapGetters } from 'vuex'
import { maintain_share_url } from '@/utils/config.js'; import { maintain_share_url } from '@/utils/config.js'
export default { export default {
components: { components: {
NavbarRight, NavbarRight,
PopQRCode PopQRCode,
}, },
data() { data() {
return { return {
billId: '', billId: '',
info: { info: {
settleState: {}, settleState: {},
sendStatus: {} sendStatus: {},
}, },
visible: false, visible: false,
shareUserId: '', shareUserId: '',
...@@ -207,7 +203,7 @@ export default { ...@@ -207,7 +203,7 @@ export default {
return maintain_share_url + this.shareParams return maintain_share_url + this.shareParams
}, },
receive() { receive() {
return this.shareUserId && (this.shareUserId != this.userInfo.id) return this.shareUserId && this.shareUserId != this.userInfo.id
}, },
isOver() { isOver() {
return this.info.settleState.code == 'YES' return this.info.settleState.code == 'YES'
...@@ -322,8 +318,19 @@ export default { ...@@ -322,8 +318,19 @@ export default {
if (options && options.billId) { if (options && options.billId) {
this.billId = options.billId this.billId = options.billId
} }
if (options && options.shareUserId) {
this.shareUserId = options.shareUserId if (options.q) {
// 扫码进的
const q = decodeURIComponent(options.q)
this.initOptions(q)
} else {
if (options && options.billId) {
this.billId = options.billId
}
if (options && options.shareUserId) {
this.shareUserId = options.shareUserId
}
} }
// 测试数据 // 测试数据
...@@ -333,6 +340,20 @@ export default { ...@@ -333,6 +340,20 @@ export default {
}, },
onShow() {}, onShow() {},
methods: { methods: {
initOptions(q) {
var array = q.split('?')
if (array.length > 1) {
var arr = array[1].split('&')
for (var item of arr) {
if (item.indexOf('billId=') != -1) {
this.billId = item.split('=')[1]
}
if (item.indexOf('shareUserId=') != -1) {
this.shareUserId = item.split('=')[1]
}
}
}
},
toMainIndex() { toMainIndex() {
this.$u.route({ this.$u.route({
url: 'pages/index/index', url: 'pages/index/index',
...@@ -377,7 +398,7 @@ export default { ...@@ -377,7 +398,7 @@ export default {
}, },
repairSign() { repairSign() {
this.buttonLoading = true this.buttonLoading = true
repairSign({id: this.billId}) repairSign({ id: this.billId })
.then((res) => { .then((res) => {
if (res.code == 0) { if (res.code == 0) {
this.repairDetail() this.repairDetail()
...@@ -385,8 +406,7 @@ export default { ...@@ -385,8 +406,7 @@ export default {
title: '签收成功', title: '签收成功',
type: 'success', type: 'success',
duration: 1500, duration: 1500,
callback: () => { callback: () => {},
},
}) })
this.buttonLoading = false this.buttonLoading = false
} }
...@@ -401,7 +421,7 @@ export default { ...@@ -401,7 +421,7 @@ export default {
type: 'switchTab', type: 'switchTab',
}) })
}, },
handleClickScan(){ handleClickScan() {
this.visible = true this.visible = true
}, },
handleClickPreview(index) { handleClickPreview(index) {
......
...@@ -19,6 +19,7 @@ export const UPLOAD_FILE_HOST = process.uniEnv.qn_asset_url; // 服务器用户 ...@@ -19,6 +19,7 @@ export const UPLOAD_FILE_HOST = process.uniEnv.qn_asset_url; // 服务器用户
export const maintain_share_url = 'https://system.banshouhui.com/maintainqrcode' // pages/maintain-bill/show二维码地址 export const maintain_share_url = 'https://system.banshouhui.com/maintainqrcode' // pages/maintain-bill/show二维码地址
export const index_share_url = 'https://system.banshouhui.com/indexqrcode' // pages/index/index二维码地址 export const index_share_url = 'https://system.banshouhui.com/indexqrcode' // pages/index/index二维码地址
export const card_share_url = 'https://system.banshouhui.com/shareqrcode' // pages/card/share二维码地址
export const whiteList = ['/pages/index/index', '/pages/index/schedule/schedule', '/pages/index/bill/bill', export const whiteList = ['/pages/index/index', '/pages/index/schedule/schedule', '/pages/index/bill/bill',
'/pages/index/mine/mine', '/pages/login/login', '/pages/login/quick-login/quick-login', '/pages/index/mine/mine', '/pages/login/login', '/pages/login/quick-login/quick-login',
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment