9.18/3
This commit is contained in:
@@ -6,7 +6,7 @@
|
||||
<button size="mini" :type="debtOnly ? 'primary' : 'default'" @click="toggleDebtOnly">只看欠款</button>
|
||||
</view>
|
||||
<scroll-view scroll-y class="list">
|
||||
<view class="item" v-for="c in customers" :key="c.id" @click="select(c)">
|
||||
<view class="item" v-for="c in customers" :key="c.id" @click="openDetail(c)">
|
||||
<view class="name">{{ c.name }}</view>
|
||||
<view class="meta">
|
||||
{{ c.mobile || '—' }}
|
||||
@@ -25,6 +25,7 @@
|
||||
export default {
|
||||
data() { return { kw: '', debtOnly: false, customers: [] } },
|
||||
onLoad() { this.search() },
|
||||
onShow() { this.search() },
|
||||
methods: {
|
||||
toggleDebtOnly() { this.debtOnly = !this.debtOnly; this.search() },
|
||||
async search() {
|
||||
@@ -35,13 +36,17 @@
|
||||
},
|
||||
createCustomer() { uni.navigateTo({ url: '/pages/customer/form' }) },
|
||||
select(c) {
|
||||
const opener = getCurrentPages()[getCurrentPages().length-2]
|
||||
if (opener && opener.$vm) {
|
||||
opener.$vm.order.customerId = c.id
|
||||
opener.$vm.customerName = c.name
|
||||
const pages = getCurrentPages()
|
||||
const prev = pages.length >= 2 ? pages[pages.length - 2] : null
|
||||
const vm = prev && prev.$vm ? prev.$vm : null
|
||||
if (vm && vm.order) {
|
||||
vm.order.customerId = c.id
|
||||
vm.customerName = c.name
|
||||
}
|
||||
uni.navigateBack()
|
||||
}
|
||||
,
|
||||
openDetail(c) { uni.navigateTo({ url: '/pages/customer/detail?id=' + c.id }) }
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
Reference in New Issue
Block a user