代码更新
This commit is contained in:
@@ -27,7 +27,7 @@
|
||||
<view class="u-flex">
|
||||
<view>{{item.nickName}}</view>
|
||||
</view>
|
||||
<view class="u-m-t-12 ">手机号:{{item.telephone}}</view>
|
||||
<view class="u-m-t-12 ">手机号:{{item.phone}}</view>
|
||||
<view class=" u-font-24 u-m-t-12 u-flex">
|
||||
<text class="color-999" v-if="!item.isVip">非会员</text>
|
||||
<text class="color-main" v-else>会员</text>
|
||||
@@ -63,28 +63,49 @@
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import * as Api from '@/http/yskApi/shop-user.js'
|
||||
import {
|
||||
onLoad
|
||||
} from '@dcloudio/uni-app'
|
||||
import {
|
||||
reactive,
|
||||
onBeforeMount,
|
||||
ref
|
||||
} from 'vue';
|
||||
import { onLoad } from '@dcloudio/uni-app'
|
||||
import { reactive, onBeforeMount, ref } from 'vue';
|
||||
import { shopUserList } from '@/api/shopUser.js';
|
||||
|
||||
let nouser = ref(false)
|
||||
let timer = null
|
||||
|
||||
function emitChooser(data) {
|
||||
uni.$emit('choose-user', data)
|
||||
timer = setTimeout(() => {
|
||||
uni.navigateBack()
|
||||
}, 100)
|
||||
}
|
||||
onBeforeMount(() => {
|
||||
clearInterval(timer)
|
||||
})
|
||||
|
||||
const query = reactive({
|
||||
page: 1,
|
||||
name: '',
|
||||
totalElements: 0,
|
||||
size: 10,
|
||||
isVip: 1
|
||||
})
|
||||
const list = reactive([])
|
||||
let hasAjax = ref(false)
|
||||
|
||||
/**
|
||||
* 获取用户列表
|
||||
*/
|
||||
async function getUser() {
|
||||
const res = await shopUserList(query)
|
||||
hasAjax.value = true
|
||||
list.length = res.records.length
|
||||
for (let i in res.records) {
|
||||
list[i] = {
|
||||
...res.records[i],
|
||||
checked: false
|
||||
}
|
||||
}
|
||||
query.totalElements = res.totalRow
|
||||
console.log(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 用户选择
|
||||
* @param {Object} index
|
||||
* @param {Object} item
|
||||
*/
|
||||
function chooseUser(index, item) {
|
||||
if (index === undefined || item === undefined) {
|
||||
nouser.value = true
|
||||
@@ -100,33 +121,12 @@
|
||||
emitChooser(item)
|
||||
}
|
||||
}
|
||||
|
||||
const query = reactive({
|
||||
page: 1,
|
||||
name: '',
|
||||
totalElements: 0,
|
||||
size: 10,
|
||||
isVip: 1
|
||||
})
|
||||
const list = reactive([])
|
||||
let hasAjax = ref(false)
|
||||
async function getUser() {
|
||||
const {
|
||||
content,
|
||||
totalElements
|
||||
} = await Api.queryAllShopUser(query)
|
||||
hasAjax.value = true
|
||||
list.length = content.length
|
||||
for (let i in content) {
|
||||
list[i] = {
|
||||
...content[i],
|
||||
checked: false
|
||||
}
|
||||
}
|
||||
query.totalElements = totalElements
|
||||
console.log(list);
|
||||
function emitChooser(data) {
|
||||
uni.$emit('choose-user', data)
|
||||
timer = setTimeout(() => {
|
||||
uni.navigateBack()
|
||||
}, 100)
|
||||
}
|
||||
|
||||
function pageChange(e) {
|
||||
query.page = e
|
||||
getUser()
|
||||
|
||||
Reference in New Issue
Block a user