9.18/3
This commit is contained in:
@@ -3,28 +3,37 @@
|
||||
<view class="search">
|
||||
<input v-model="kw" placeholder="搜索供应商名称/电话" @confirm="search" />
|
||||
<button size="mini" @click="search">搜索</button>
|
||||
<button size="mini" :type="debtOnly ? 'primary' : 'default'" @click="toggleDebtOnly">只看欠款</button>
|
||||
</view>
|
||||
<scroll-view scroll-y class="list">
|
||||
<view class="item" v-for="s in suppliers" :key="s.id" @click="select(s)">
|
||||
<view class="name">{{ s.name }}</view>
|
||||
<view class="meta">{{ s.mobile || '—' }}</view>
|
||||
<view class="meta">
|
||||
{{ s.mobile || '—' }}
|
||||
<text v-if="typeof s.apPayable === 'number'">|应付:¥ {{ Number(s.apPayable).toFixed(2) }}</text>
|
||||
</view>
|
||||
</view>
|
||||
</scroll-view>
|
||||
<view class="bottom">
|
||||
<button class="primary" @click="createSupplier">新增供应商</button>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { get } from '../../common/http.js'
|
||||
export default {
|
||||
data() { return { kw: '', suppliers: [] } },
|
||||
data() { return { kw: '', debtOnly: false, suppliers: [] } },
|
||||
onLoad() { this.search() },
|
||||
methods: {
|
||||
toggleDebtOnly() { this.debtOnly = !this.debtOnly; this.search() },
|
||||
async search() {
|
||||
try {
|
||||
const res = await get('/api/suppliers', { kw: this.kw, page: 1, size: 50 })
|
||||
const res = await get('/api/suppliers', { kw: this.kw, debtOnly: this.debtOnly, page: 1, size: 50 })
|
||||
this.suppliers = Array.isArray(res?.list) ? res.list : (Array.isArray(res) ? res : [])
|
||||
} catch(e) { uni.showToast({ title: '加载失败', icon: 'none' }) }
|
||||
},
|
||||
createSupplier() { uni.navigateTo({ url: '/pages/supplier/form' }) },
|
||||
select(s) {
|
||||
const opener = getCurrentPages()[getCurrentPages().length-2]
|
||||
if (opener && opener.$vm) {
|
||||
|
||||
Reference in New Issue
Block a user