123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315 |
- <template>
- <view class="container">
- <uni-nav-bar title="门店信息" backgroundColor='#03803B' color="#fff" left-icon="left" fixed statusBar
- @clickLeft='goBack()' @clickRight="addDetails">
- <block slot="right">
- <view>
- <image class="nav-right" src="@/static/images/home/store/add.png" />
- </view>
- </block>
- </uni-nav-bar>
- <scroll-view scroll-y="true" :refresher-enabled="true" :refresher-triggered="triggered"
- @scrolltolower="loadMore" @refresherrefresh="onRefresh" class="scroll-view" :scroll-top="scrollTop"
- @scroll="handleScroll">
- <view style="background-color: #fff;">
- <uni-search-bar bgColor="#F6F6F6 " v-model="searchValue" placeholder="请输入店铺名称" @confirm="searchChange"
- @cancel="searchChange" @clear="searchChange">
- </uni-search-bar>
- </view>
- <view class="list">
- <u-empty v-if='dataList.length==0' mode="list">
- </u-empty>
- <view style="margin-top: 30rpx;" v-for="(item, index) in dataList" :key="index" @click="inEdit(item)">
- <uni-swipe-action>
- <uni-swipe-action-item>
- <view class="tab-bar-item">
- <image class="icon" :src="item.url" />
- <view class="text">
- <view class="text_title">
- <text style="color: #03803B;">门店名称:</text>
- <text style="color: #6A6A6A" class='uni-lastmsg'>{{item.cname||'-'}}</text>
- </view>
- <view class="text_content">
- <text style="color: #03803B;">前置仓:</text>
- <text style="color: #6A6A6A"
- class='uni-lastmsg'>{{item.deliveryWarehouseName||'暂无仓库'}}</text>
- <text style="color: #03803B;margin-left: 10rpx;">价格:</text>
- <text style="color: #6A6A6A"
- class='uni-lastmsg2'>¥{{item.priceSystem||0}}</text>
- </view>
- <view class="text_foot">
- <text style="color: #03803B;">电话:</text>
- <text style="color: #6A6A6A">{{item.tel}}</text>
- </view>
- </view>
- <view class="menu">
- <view class="">
- <image class="edit" src="@/static/images/home/store/edit.png" />
- </view>
- <view class="">
- <image class="QR" src="@/static/images/home/store/QR.png"
- @click.stop="inQR(item)" />
- </view>
- </view>
- </view>
- <template v-slot:right>
- <view @click.stop="onClick(item)"
- style="width: 120rpx;background-color:#e43d33;display: flex;justify-content: center;align-items: center;color: #fff;">
- <text>删除</text>
- </view>
- </template>
- </uni-swipe-action-item>
- </uni-swipe-action>
- </view>
- </view>
- <view v-if="loading" class="loading">加载中...</view>
- <view v-if="noMore" class="no-more">没有更多数据了</view>
- </scroll-view>
- </view>
- </template>
- <script>
- import {
- getList,
- remove
- } from '@/api/home/store.js'
- export default {
- data() {
- return {
- triggered: false,
- searchValue: null,
- page: {
- current: 1,
- size: 10,
- total: 0,
- },
- dataList: [],
- loading: false,
- noMore: false,
- scrollTop: 0,
- oldScrollTop: 0
- }
- },
- onLoad() {
- this.getList()
- },
- // onReachBottom() {
- // if (!this.noMore) {
- // this.page.current += 1
- // this.getList()
- // }
- // },
- methods: {
- onClick(row) {
- let _this = this
- uni.showModal({
- title: '提示',
- content: '是否确认删除?',
- success: function(res) {
- if (res.confirm) {
- uni.showLoading({
- title: '加载中',
- mask: true
- });
- remove(row.id).then(res => {
- uni.showToast({
- title: '操作成功',
- icon: 'none',
- duration: 2000
- });
- _this.onRefresh()
- })
- .finally(() => {
- uni.hideLoading()
- });
- }
- }
- });
- },
- handleScroll(e) {
- this.oldScrollTop = e.detail.scrollTop
- },
- loadMore() {
- if (!this.noMore) {
- this.page.current += 1
- this.getList()
- }
- },
- onRefresh() {
- if (this.triggered) return;
- this.triggered = true;
- this.noMore = false;
- // 模拟异步请求
- setTimeout(() => {
- this.page.current = 1
- this.dataList = []
- this.getList()
- }, 500);
- },
- addDetails() {
- uni.navigateTo({
- url: '/pages/home/store/details'
- });
- },
- inEdit(row) {
- uni.navigateTo({
- url: '/pages/home/store/details?id=' + row.id,
- });
- },
- inQR(row) {
- uni.showToast({
- title: '暂无二维码',
- icon: 'none'
- });
- },
- searchChange(res) {
- this.triggered = true;
- this.noMore = false;
- // 模拟异步请求
- setTimeout(() => {
- this.page.current = 1
- this.dataList = []
- this.getList()
- }, 500);
- },
- getList() {
- const obj = {
- retrieve: this.searchValue,
- current: this.page.current,
- size: this.page.size
- }
- this.loading = true
- uni.showLoading({
- title: '加载中',
- mask: true
- });
- getList(obj).then(res => {
- this.dataList = [...this.dataList, ...res.data.records]
- if (res.data.total <= this.dataList.length) {
- this.noMore = true
- }
- })
- .finally(() => {
- uni.hideLoading()
- this.loading = false
- this.triggered = false
- });
- },
- goBack() {
- uni.navigateBack({
- delta: 1,
- });
- }
- }
- }
- </script>
- <style lang="scss" scoped>
- .scroll-view {
- flex: 1;
- height: 100%;
- /* 关键样式:防止内容被裁剪 */
- overflow-anchor: none;
- }
- .container {
- height: 100vh;
- display: flex;
- flex-direction: column;
- }
- .loading,
- .no-more {
- text-align: center;
- padding: 20px;
- color: #999;
- }
- .uni-lastmsg {
- width: 150rpx;
- white-space: nowrap;
- overflow: hidden;
- text-overflow: ellipsis;
- display: block;
- /* 需明确设置display */
- }
- .uni-lastmsg2 {
- width: 140rpx;
- white-space: nowrap;
- overflow: hidden;
- text-overflow: ellipsis;
- display: block;
- /* 需明确设置display */
- }
- .nav-right {
- width: 54rpx;
- height: 54rpx;
- }
- .list {
- width: 100%;
- .tab-bar-item {
- background-color: #fff;
- padding: 30rpx 62rpx;
- display: flex;
- .icon {
- width: 140rpx;
- height: 140rpx;
- background: #909090;
- border-radius: 14rpx;
- }
- .text {
- padding: 0rpx 17rpx;
- display: flex;
- flex-direction: column;
- justify-content: space-between;
- height: 140rpx;
- .text_title {
- display: flex;
- height: 44rpx;
- font-weight: 500;
- font-size: 28rpx;
- color: #6A6A6A;
- }
- .text_content {
- display: flex;
- margin-top: 8rpx;
- font-size: 28rpx;
- font-weight: 500;
- }
- .text_foot {
- font-size: 28rpx;
- font-weight: 500;
- }
- }
- .menu {
- position: absolute;
- right: 62rpx;
- .edit {
- margin-top: 10rpx;
- width: 30rpx;
- height: 33rpx;
- }
- .QR {
- margin-top: 54rpx;
- width: 30rpx;
- height: 31rpx;
- }
- }
- }
- }
- </style>
|