Commit 6f00cff2 authored by 刘文虎's avatar 刘文虎
parents c2d42b79 f867451d
Pipeline #2909 canceled with stages
...@@ -14,7 +14,7 @@ export async function getCollectionCode(data) { ...@@ -14,7 +14,7 @@ export async function getCollectionCode(data) {
export async function setCollectionCode(data) { export async function setCollectionCode(data) {
return request({ return request({
url: `/rest/collectionCode`, url: `/rest/collectionCode`,
method: 'POSt', method: 'POST',
data, data,
noLoading: true noLoading: true
}) })
...@@ -29,3 +29,33 @@ export async function getBusinessCard(data) { ...@@ -29,3 +29,33 @@ export async function getBusinessCard(data) {
noLoading: true noLoading: true
}) })
} }
// 查询名片操作履历
export async function getBusinessCardRecord(data) {
return request({
url: `/rest/businessCard/viewRecord`,
method: 'GET',
data,
noLoading: true
})
}
// 名片操作统计
export async function operateStatistics(data) {
return request({
url: `/rest/businessCard/operateStatistics`,
method: 'GET',
data,
noLoading: true
})
}
// 新增更新名片
export async function editBusinessCard(data) {
return request({
url: `/rest/businessCard`,
method: 'POST',
data,
noLoading: true
})
}
\ No newline at end of file
...@@ -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.title }}</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">
...@@ -33,7 +33,7 @@ ...@@ -33,7 +33,7 @@
<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.title }}</view> <view class="title-view title-blue">{{ info. frontTitle }}</view>
<view <view
class="right-view" class="right-view"
hover-class="u-hover-class" hover-class="u-hover-class"
...@@ -81,7 +81,7 @@ ...@@ -81,7 +81,7 @@
</view> </view>
</view> </view>
<view class="bottom-view"> <view class="bottom-view">
<view class="title-view">{{ info.title }}</view> <view class="title-view">{{ info. frontTitle }}</view>
</view> </view>
</template> </template>
</view> </view>
...@@ -110,17 +110,17 @@ export default { ...@@ -110,17 +110,17 @@ export default {
return this.baseUrl + 'muban1zhengmian@3x.png' return this.baseUrl + 'muban1zhengmian@3x.png'
}, },
isGreen() { isGreen() {
return this.info.type == 'green' return this.info. coverUrl == 'green'
}, },
isBlue() { isBlue() {
return this.info.type == 'blue' return this.info. coverUrl == 'blue'
}, },
isBlack() { isBlack() {
return this.info.type == 'black' return this.info. coverUrl == 'black'
}, },
// green 绿;blue 蓝;black 黑; // green 绿;blue 蓝;black 黑;
settings() { settings() {
switch (this.info.type) { switch (this.info. coverUrl) {
case 'green': case 'green':
return { return {
color: '#02A074', color: '#02A074',
......
...@@ -33,7 +33,7 @@ ...@@ -33,7 +33,7 @@
:clearable="false" :clearable="false"
:custom-style="customStyle" :custom-style="customStyle"
:placeholder-style="placeholderStyle" :placeholder-style="placeholderStyle"
v-model="form.phone" v-model="form.address"
placeholder="填写地址" placeholder="填写地址"
/> />
</u-form-item> </u-form-item>
...@@ -44,7 +44,7 @@ ...@@ -44,7 +44,7 @@
:clearable="false" :clearable="false"
:custom-style="customStyle" :custom-style="customStyle"
:placeholder-style="placeholderStyle" :placeholder-style="placeholderStyle"
v-model="form.title" v-model="form.frontTitle"
@input="handleInput" @input="handleInput"
placeholder="填写正面标题,不超过12个字" placeholder="填写正面标题,不超过12个字"
/> />
...@@ -61,13 +61,16 @@ ...@@ -61,13 +61,16 @@
<view <view
:class=" :class="
'image-view ' + 'image-view ' +
(form.currentIndex == index ? 'is-select' : '') (form.coverUrl == types[index] ? 'is-select' : '')
" "
@click="handleClickSelect(index)" @click="handleClickSelect(index)"
> >
<image :src="item[0]"></image> <image :src="item[0]"></image>
</view> </view>
<view class="top-image-view" v-if="form.currentIndex == index"> <view
class="top-image-view"
v-if="form.coverUrl == types[index]"
>
<image :src="yixuanzemubanImage"></image> <image :src="yixuanzemubanImage"></image>
</view> </view>
<view <view
...@@ -90,7 +93,7 @@ ...@@ -90,7 +93,7 @@
:clearable="false" :clearable="false"
:custom-style="customStyle" :custom-style="customStyle"
:placeholder-style="placeholderStyle" :placeholder-style="placeholderStyle"
v-model="form.phone" v-model="form.backTitle"
placeholder="填写正面标题,不超过12个字" placeholder="填写正面标题,不超过12个字"
/> />
</u-form-item> </u-form-item>
...@@ -104,7 +107,7 @@ ...@@ -104,7 +107,7 @@
:clearable="false" :clearable="false"
:custom-style="customAreaStyle" :custom-style="customAreaStyle"
:placeholder-style="placeholderStyle" :placeholder-style="placeholderStyle"
v-model="form.phone" v-model="form.backContext"
placeholder="填写服务内容 举例:家电维修安装、清洗服" placeholder="填写服务内容 举例:家电维修安装、清洗服"
/> />
</view> </view>
...@@ -117,35 +120,41 @@ ...@@ -117,35 +120,41 @@
:custom-style="customConFirm" :custom-style="customConFirm"
@click="handleClickSure" @click="handleClickSure"
:disabled="!canConfirm" :disabled="!canConfirm"
:loading="buttonLoading"
> >
<view class="confirm-view">确定</view> <view class="confirm-view">确定</view>
</u-button> </u-button>
</view> </view>
<PopImage :visible.sync="visible" :images="currentImages"/> <PopImage :visible.sync="visible" :images="currentImages" />
</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'
export default { export default {
components: { components: {
NavbarRight, NavbarRight,
PopImage PopImage,
}, },
data() { data() {
return { return {
loading: false, loading: false,
info: {}, cardId: '',
form: { form: {
date: '', address: '',
time: '', backContext: '',
currentIndex: 0, backTitle: '',
coverUrl: 'green',
frontTitle: '',
name: '',
phone: '',
}, },
maxlength: 12, maxlength: 12,
visible: false, visible: false,
currentImages: [] currentImages: [],
} }
}, },
computed: { computed: {
...@@ -155,11 +164,14 @@ export default { ...@@ -155,11 +164,14 @@ export default {
yixuanzemubanImage() { yixuanzemubanImage() {
return this.baseUrl + 'yixuanzemuban@3x.png' return this.baseUrl + 'yixuanzemuban@3x.png'
}, },
types() {
return ['green', 'blue', 'black']
},
templates() { templates() {
return [ return [
[this.baseUrl + '1zhengmian@3x.png',this.baseUrl + '1fanmian@3x.png'], [this.baseUrl + '1zhengmian@3x.png', this.baseUrl + '1fanmian@3x.png'],
[this.baseUrl + '2zhengmian@3x.png',this.baseUrl + '2fanmian@3x.png'], [this.baseUrl + '2zhengmian@3x.png', this.baseUrl + '2fanmian@3x.png'],
[this.baseUrl + '3zhengmian@3x.png',this.baseUrl + '3fanmian@3x.png'], [this.baseUrl + '3zhengmian@3x.png', this.baseUrl + '3fanmian@3x.png'],
] ]
}, },
dianjiyulanImage() { dianjiyulanImage() {
...@@ -191,35 +203,42 @@ export default { ...@@ -191,35 +203,42 @@ export default {
{ {
required: true, required: true,
message: '请填写姓名', message: '请填写姓名',
trigger: ['change', 'blur'], // trigger: ['change', 'blur'],
}, },
], ],
phone: [ phone: [
{ {
required: true, required: true,
message: '请填写电话', message: '请填写电话',
trigger: ['change', 'blur'], // trigger: ['change', 'blur'],
}, },
], ],
address: [ address: [
{ {
required: true, required: true,
message: '请填写地址', message: '请填写地址',
trigger: ['change', 'blur'], // trigger: ['change', 'blur'],
}, },
], ],
title: [ frontTitle: [
{ {
required: true, required: true,
message: '请填写正面标题', message: '请填写正面标题',
trigger: ['change', 'blur'], // trigger: ['change', 'blur'],
}, },
], ],
backTitle: [ backTitle: [
{ {
required: true, required: true,
message: '填写背面标题', message: '填写背面标题',
trigger: ['change', 'blur'], // trigger: ['change', 'blur'],
},
],
backContext: [
{
required: true,
message: '填写背面标题',
// trigger: ['change', 'blur'],
}, },
], ],
} }
...@@ -233,18 +252,20 @@ export default { ...@@ -233,18 +252,20 @@ export default {
} }
}, },
canConfirm() { canConfirm() {
console.log( for (var item in this.form) {
'---------canConfirm------------', console.log('------canConfirm------', item)
this.form.name && this.form.a if (!this.form[item]) {
) return false
return this.form.name && this.form.a }
}
return true
}, },
}, },
onLoad(options) { onLoad(options) {
if (options && options.billId) { if (options && options.cardId) {
this.billId = options.billId this.cardId = options.cardId
this.loading = true this.loading = true
this.init() this.getBusinessCard()
} }
}, },
onReady() { onReady() {
...@@ -253,40 +274,57 @@ export default { ...@@ -253,40 +274,57 @@ export default {
onUnload() {}, onUnload() {},
onShow() {}, onShow() {},
methods: { methods: {
init() { getBusinessCard() {
this.loading = true
getBusinessCard()
.then((res) => {
var data = res.data
if (data) {
this.form = {
id: res.id,
address: res.data,
backContext: res.backContext,
backTitle: res.backTitle,
coverUrl: res.coverUrl,
frontTitle: res.frontTitle,
name: res.name,
phone: res.phone,
}
}
this.loading = false
})
.catch((res) => {
this.loading = false
})
},
editbusinessCard() {
this.buttonLoading = true
editbusinessCard(this.form)
.then((res) => {
if (res.data) {
this.buttonLoading = false
uni.$emit('card-refresh')
this.$u.route({
type: 'back',
})
}
})
.catch((res) => {
this.loading = false this.loading = false
this.form = {} })
}, },
previewTemplate(index) { previewTemplate(index) {
this.visible = true
this.currentImages = this.templates[index] this.currentImages = this.templates[index]
this.visible = true
// uni.previewImage({
// urls: this.templates,
// current: index,
// longPressActions: {
// success: function (data) {
// console.log(
// '选中了第' +
// (data.tapIndex + 1) +
// '个按钮,第' +
// (data.index + 1) +
// '张图片'
// )
// },
// fail: function (err) {
// console.log(err.errMsg)
// },
// },
// })
}, },
handleClickSelect(index) { handleClickSelect(index) {
this.form.currentIndex = index this.form.coverUrl = this.types[index]
}, },
handleClickSure() { handleClickSure() {
this.$refs.uForm.validate((valid) => { this.$refs.uForm.validate((valid) => {
if (valid) { if (valid) {
console.log('验证通过') console.log('验证通过')
this.editbusinessCard()
} else { } else {
console.log('验证失败') console.log('验证失败')
} }
...@@ -296,7 +334,7 @@ export default { ...@@ -296,7 +334,7 @@ export default {
// 直接给input设maxlength输入拼音的时候有影响 // 直接给input设maxlength输入拼音的时候有影响
if (event.length > this.maxlength) { if (event.length > this.maxlength) {
this.$nextTick(() => { this.$nextTick(() => {
this.form.title = event.substring(0, this.maxlength) this.form.frontTitle = event.substring(0, this.maxlength)
}) })
} }
}, },
......
...@@ -2,20 +2,36 @@ ...@@ -2,20 +2,36 @@
<view class="visiting-card"> <view class="visiting-card">
<NavbarRight title="电子名片" imageWidth="20" /> <NavbarRight title="电子名片" imageWidth="20" />
<view class="content-view"> <view class="content-view">
<scroll-view
scroll-y
style="height: 100%; width: 100%"
@scrolltolower="reachBottom"
scroll-anchoring
refresher-enabled="true"
:refresher-triggered="triggered"
:refresher-threshold="100"
refresher-background="#F6F7FA"
@refresherrefresh="onRefresh"
@refresherrestore="onRestore"
enable-back-to-top
>
<view class="card-view"> <view class="card-view">
<view class="no-card" v-if="!info.card"> <view class="loading-view" v-if="loadingCard"
><u-loading mode="flower"></u-loading
></view>
<view class="no-card" v-else-if="!info.id">
<view <view
class="add-item-button" class="add-item-button"
hover-class="u-hover-class" hover-class="u-hover-class"
@click="$u.throttle(handleClickAdd, 500)" @click="$u.throttle(handleClickAdd, 500)"
> >
<u-icon name="plus" color="#02A074" size="36"></u-icon> <u-icon name="plus" color="#02A074" size="36"></u-icon>
<view class="add-text">添加明细</view> <view class="add-text">创建名片</view>
</view> </view>
</view> </view>
<template v-else> <template v-else>
<view class="card-content"> <view class="card-content">
<Card :info="info.card" /> <Card :info="info" />
</view> </view>
<view class="tool-view"> <view class="tool-view">
<view <view
...@@ -35,14 +51,21 @@ ...@@ -35,14 +51,21 @@
</view> </view>
<view class="detail-view"> <view class="detail-view">
<view class="info-view"> <view class="info-view">
<view class="item-view" v-for="(item, key) in infoKeys" :key="key"> <view
<template v-if="key.indexOf('0') == -1"> class="item-view"
<view hover-class="u-hover-class" @click="handleChangeList(key)"> v-for="(item, index) in infoKeys"
<view class="count-view">{{ info[key] }}</view> :key="index"
<view>{{ item }}</view> >
<template v-if="item.key">
<view
hover-class="u-hover-class"
@click="handleChangeList(index)"
>
<view class="count-view">{{ info[item.key] || 0 }}</view>
<view>{{ item.text }}</view>
</view> </view>
<view class="mark-view"> <view class="mark-view">
<image v-if="currentKey == key" :src="markImage"></image> <image v-if="currentIndex == index" :src="markImage"></image>
</view> </view>
</template> </template>
<view class="line-view-column" v-else></view> <view class="line-view-column" v-else></view>
...@@ -54,6 +77,11 @@ ...@@ -54,6 +77,11 @@
<view v-for="(item, index) in list" :key="index"> <view v-for="(item, index) in list" :key="index">
<CellRelation :member="item" /> <CellRelation :member="item" />
</view> </view>
<view
class="load-more-view"
v-show="(current == 1 && !loading) || current > 1"
><u-loadmore :status="loadStatus" bgColor="#F6F7FA"></u-loadmore
></view>
</view> </view>
<NoData <NoData
v-else-if="!loading" v-else-if="!loading"
...@@ -63,6 +91,7 @@ ...@@ -63,6 +91,7 @@
/> />
</view> </view>
</view> </view>
</scroll-view>
</view> </view>
</view> </view>
</template> </template>
...@@ -72,6 +101,11 @@ import NavbarRight from '@/components/navbar-right' ...@@ -72,6 +101,11 @@ import NavbarRight from '@/components/navbar-right'
import NoData from '@/components/no-data' import NoData from '@/components/no-data'
import Card from '@/components/cell-card' import Card from '@/components/cell-card'
import CellRelation from '@/components/cell-relation' import CellRelation from '@/components/cell-relation'
import {
getBusinessCard,
getBusinessCardRecord,
operateStatistics,
} from '@/api/card/index.js'
export default { export default {
components: { components: {
...@@ -83,9 +117,16 @@ export default { ...@@ -83,9 +117,16 @@ export default {
data() { data() {
return { return {
info: {}, info: {},
statistics: {},
list: [], list: [],
currentKey: 'looked',
loading: true, loading: true,
current: 1,
size: 20,
loadStatus: 'loading',
triggered: true,
_freshing: false,
loadingCard: false,
currentIndex: 0,
} }
}, },
computed: { computed: {
...@@ -99,13 +140,29 @@ export default { ...@@ -99,13 +140,29 @@ export default {
return this.baseUrl + 'mingpianwuxinxi@3x.png' return this.baseUrl + 'mingpianwuxinxi@3x.png'
}, },
infoKeys() { infoKeys() {
return { // {view:浏览;call:拨打电话;list:通讯录},可用值:VIEW,CALL,LIST
looked: '被查看', return [
'00': '', {
call: '拨打电话', key: 'viewCount',
'000': '', text: '被查看',
address: '加通讯录', type: 'VIEW',
} },
{},
{
key: 'callCount',
text: '拨打电话',
type: 'CALL',
},
{},
{
key: 'listCount',
text: '加通讯录',
type: 'LIST',
},
]
},
currentInfo() {
return this.infoKeys[this.currentIndex]
}, },
toolInfos() { toolInfos() {
return [ return [
...@@ -114,58 +171,124 @@ export default { ...@@ -114,58 +171,124 @@ export default {
{ text: '转发', image: this.baseUrl + 'zhuanfamingp@3x.png' }, { text: '转发', image: this.baseUrl + 'zhuanfamingp@3x.png' },
] ]
}, },
lastId() {
return this.list.length > 0 ? this.list[this.list.length - 1].id : ''
},
}, },
onLoad() { onLoad() {
this.getInfo() this._freshing = false
this.initInfo()
uni.$on('card-refresh', (res) => {
this.initInfo()
})
},
onUnload() {
uni.$off('card-refresh')
}, },
onUnload() {},
onShow() {}, onShow() {},
methods: { methods: {
getInfo() { initInfo() {
this.info = { this.getBusinessCard()
looked: '44', this.getBusinessCardRecord()
call: '0', this.operateStatistics()
address: '2',
card: {
type: 'green',
title: '扳手专业品牌家电维修',
name: '小扳手',
address:
'dfsafdsafdasf发撒范德萨范德萨发的范德萨范大师傅的范德萨范大事发声的范德萨范德萨发撒发',
phone: '131231241314',
qrCode: 'http://static-book.kaying.cc/icon/beijing%403x.png',
}, },
} reloadList() {
this.list = [ this.current = 1
{ this.loadStatus = 'loading'
nickname: 'fsafdsa', this.operateStatistics()
avatar: 'http://static-book.kaying.cc/icon/beijing%403x.png',
createTime: '2087-32-32 21:99:00',
}, },
{ onRefresh() {
nickname: 'gsdsaf', if (this._freshing) return
avatar: '', this._freshing = true
createTime: '2087-32-32 21:99:00', this.initInfo()
}, },
{ onRestore() {
nickname: 'fsajyrtfdsa', this.triggered = 'restore' // 需要重置
avatar: 'http://static-book.kaying.cc/icon/beijing%403x.png',
createTime: '2087-32-32 21:99:00',
}, },
] // 滚动底部
reachBottom(e) {
this.current += 1
if (this.loadStatus != 'loadmore') return
this.loadStatus == 'loading'
this.operateStatistics()
},
getBusinessCard() {
this.loadingCard = true
getBusinessCard()
.then((res) => {
if (res.data) {
this.info = res.data
}
this.loadingCard = false
})
.catch((res) => {
this.loadingCard = false
})
},
getBusinessCardRecord(url) {
if (this.current == 1) {
this.loading = true
}
getBusinessCardRecord({
current: this.current,
size: this.size,
type: this.currentInfo.type,
lastId: this.lastId,
})
.then((res) => {
if (this.current == 1) {
this.list = []
}
if (res.data) {
this.records.push(...res.data)
// 更新底部加载状态
this.loadStatus =
res.total > this.data.length ? 'loadmore' : 'nomore'
}
this.$nextTick(() => {
if (this._freshing) {
this.triggered = false
this._freshing = false
}
})
this.loading = false
})
.catch((res) => {
this.loading = false this.loading = false
})
}, },
handleChangeList(key) { operateStatistics() {
this.currentKey = key
this.loading = true this.loading = true
this.getInfo() operateStatistics()
.then((res) => {
if (res.data) {
this.loading = false
this.statistics = res.data
}
})
.catch((res) => {
this.loading = false
})
}, },
handleClickAdd() { handleChangeList(index) {
this.currentIndex = index
this.reloadList()
},
handleClickTool(index) {
if (index == 0) {
this.$u.route({ this.$u.route({
url: 'pages/card/create', url: 'pages/card/create',
params: { params: {
cardId: id, cardId: this.info.id,
},
})
} else if (index == 1) {
} else if (index == 2) {
} }
},
handleClickAdd() {
this.$u.route({
url: 'pages/card/create',
}) })
}, },
}, },
...@@ -183,6 +306,12 @@ export default { ...@@ -183,6 +306,12 @@ export default {
overflow: auto; overflow: auto;
padding: 24rpx 24rpx 44rpx 24rpx; padding: 24rpx 24rpx 44rpx 24rpx;
.card-view { .card-view {
.loading-view {
display: flex;
align-items: center;
justify-content: center;
height: 420rpx;
}
.no-card { .no-card {
display: flex; display: flex;
justify-content: center; justify-content: center;
......
...@@ -186,7 +186,6 @@ export default { ...@@ -186,7 +186,6 @@ export default {
receivableAmount: '', receivableAmount: '',
actualAmount: '', actualAmount: '',
repairTime: '', repairTime: '',
partTime: '',
address: '', address: '',
latitude: '', latitude: '',
longitude: '', longitude: '',
...@@ -343,7 +342,6 @@ export default { ...@@ -343,7 +342,6 @@ export default {
receivableAmount: data.receivableAmount, receivableAmount: data.receivableAmount,
actualAmount: data.actualAmount, actualAmount: data.actualAmount,
repairTime: data.repairTime, repairTime: data.repairTime,
partTime: data.partTime,
address: data.address, address: data.address,
latitude: data.latitude, latitude: data.latitude,
longitude: data.longitude, longitude: data.longitude,
...@@ -403,6 +401,8 @@ export default { ...@@ -403,6 +401,8 @@ export default {
if (res.code == 0) { if (res.code == 0) {
if (this.billId) { if (this.billId) {
uni.$emit('maintain-bill-detail') uni.$emit('maintain-bill-detail')
} else {
uni.$emit('maintain-bill-list')
} }
this.billId = res.data this.billId = res.data
this.toParticulars() this.toParticulars()
......
...@@ -440,8 +440,7 @@ export default { ...@@ -440,8 +440,7 @@ export default {
}) })
.then((res) => { .then((res) => {
if (res.code == 0) { if (res.code == 0) {
uni.$off('maintain-bill-detail') uni.$emit('maintain-bill-list')
uni.$emit('maintain-bill-detail')
this.$refs.uToast.show({ this.$refs.uToast.show({
title: '删除成功', title: '删除成功',
type: 'success', type: 'success',
......
...@@ -173,14 +173,14 @@ export default { ...@@ -173,14 +173,14 @@ export default {
}, },
}, },
onLoad() { onLoad() {
uni.$on('maintain-bill-detail', (res) => { uni.$on('maintain-bill-list', (res) => {
this.reloadList() this.reloadList()
}) })
this._freshing = false this._freshing = false
this.reloadList() this.reloadList()
}, },
onUnload() { onUnload() {
uni.$off('maintain-bill-detail') uni.$off('maintain-bill-list')
}, },
onShow() {}, onShow() {},
methods: { methods: {
......
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