123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158 |
- <template>
- <view>
- <view style="background-color: #fd4b09;">
- <u-tabs :list="tabbar" @click="click" lineColor="#fff" :activeStyle="{ color: '#fff' }" keyName="title"
- :inactiveStyle="{ color: '#ffffff80' }">></u-tabs>
- <view style="padding: 20rpx;">
- <u-search placeholder="请输入设备名称" v-model="name" @custom="custom"></u-search>
- </view>
- </view>
- <view class="list" v-for="(item1, index1) in itemArrTwo" :key="index1">
- <view>
- <u--image :showLoading="true" :src="item1.url" width="80px" height="80px" @click="click"></u--image>
- </view>
- <view class="list__item" @click="choice(item1,index1)">
- <view class="list__item__user-name">{{item1.cname}}</view>
- </view>
- </view>
- <u-loading-page loading-mode="spinner" :loading="loading"></u-loading-page>
- <u-modal :show="show" :content="'是否确认选择:'+this.form.cname" @confirm="confirm" @cancel="show = false"
- :showCancelButton="true" style="text-align: center;"></u-modal>
- </view>
- </template>
- <script>
- import {
- goodsdescDescList,
- goodstypeTree
- } from '@/api/device/index.js'
- const indexList = () => {
- const indexList = []
- const charCodeOfA = 'A'.charCodeAt(0)
- for (let i = 0; i < 26; i++) {
- indexList.push(String.fromCharCode(charCodeOfA + i))
- }
- indexList.push('#')
- return indexList
- }
- export default {
- data() {
- return {
- name: '',
- indexList: indexList(),
- itemArrTwo: [],
- loading: true,
- show: false,
- form: {},
- params: {},
- re: {
- current: 1,
- size: 20
- },
- tabbar: []
- }
- },
- onLoad(params) {
- this.params = {
- ...params,
- adminProfiles: uni.getStorageSync('userInfo').user_id
- }
- goodstypeTree().then(res => {
- var data = res.data
- var datas = {title: '全部', id: null}
- data.unshift(datas)
- this.tabbar = data
- })
- goodsdescDescList(this.re).then(res => {
- this.itemArrTwo = res.data.records
- this.loading = false
- })
- },
- onReachBottom() {
- this.re.current++;
- goodsdescDescList(this.re).then(res => {
- this.itemArrTwo = this.itemArrTwo.concat(res.data.records);
- })
- },
- computed: {
- itemArr() {
- return this.indexList.map((item, index) => {
- return this.itemArrTwo[index]
- })
- }
- },
- onNavigationBarButtonTap(e) {
- uni.$u.route('/pages/views/customer/customerDetails');
- },
- methods: {
- click(tab) {
- this.re.goodsTypeId = tab.id
- this.name = ''
- goodsdescDescList(this.re).then(res => {
- this.itemArrTwo = res.data.records
- this.loading = false
- })
- },
- custom() {
- this.loading = true
- goodsdescDescList({
- ...this.re,
- cname: this.name
- }).then(res => {
- this.itemArrTwo = res.data.records
- this.loading = false
- })
- },
- choice(item1, index1) {
- this.form = item1
- this.show = true
- },
- confirm() {
- let pages = getCurrentPages() // 获取当前页面栈的实例,以数组形式按栈的顺序给出,第一个元素为首页,最后一个元素为当前页面。
- let prevPage = pages[pages.length - 2] //上一页页面实例
- prevPage.$vm.machineOtherFun(this.form)
- uni.navigateBack()
- }
- }
- }
- </script>
- <style lang="scss">
- .list {
-
- background-color: #fff;
-
- display: flex;
- padding: 20rpx;
-
- border-top: 1px solid #f0f0f0;
- // border-bottom: 1px solid red;
- &__item {
- @include flex;
- padding: 6px 12px;
- align-items: center;
- justify-content: space-between;
- &__user-name {
- font-size: 32rpx;
- color: $u-main-color;
- }
- &__user-tel {
- font-size: 32rpx;
- margin-right: 20rpx;
- color: $u-main-color;
- }
- }
- &__footer {
- color: $u-tips-color;
- font-size: 14px;
- text-align: center;
- margin: 15px 0;
- }
- }
- </style>
|