123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129 |
- <template><page-meta :root-font-size="fontSize+'px'"></page-meta>
- <seller-base :show="false"><view style="position: absolute;top:0;right:0;left:0;bottom:0" class="scroll-view-wrapper div container">
- <view class="div common-header-wrap">
- <view class="status-holder"></view>
- <view :style="'height:'+navHeight+'px'"></view>
- <view class="common-header-holder"></view>
- <view class="common-header-fixed">
- <title-header />
- <uni-nav-bar title="门店列表" class="common-header" left-icon="back" @clickLeft="goBack()">
- </uni-nav-bar>
- </view>
- </view>
- <view class="scroll-view div pb-30" style="position:relative">
- <scroll-view style="position: absolute;top:0;right:0;left:0;bottom:0" class="div" @scrolltolower="loadMore" scroll-y="true">
- <view class="div chain" v-if="chain_list && chain_list.length">
- <view class="div" v-for="item in chain_list" :key="item.chain_id" @click="onEdit(item.chain_id)">
- <flex-line :is-link="true" :show-border="true"><text class="span line-name">{{item.chain_addressname}}</text></flex-line>
- </view>
- </view>
- <empty-record v-else-if="chain_list && !chain_list.length"></empty-record>
- </scroll-view>
- <view class='common-add-btn-wrapper'><view class="div common-btn common-add-btn" @click="goAdd">新增</view></view>
- </view>
- </view>
- </seller-base>
- </template>
- <script>
- import {getFontSize} from '@/util/common'
- import TitleHeader from '../../TitleHeader'
- import { urlencode } from '@/util/common'
- import SellerBase from '../SellerBase'
- import EmptyRecord from '../../EmptyRecord'
- import { getChainList } from '../../../api/sellerChain'
- import flexLine from '../../flexLine'
- export default {
- name: 'Chain',
- components:{
- TitleHeader,
- SellerBase,
- EmptyRecord,
- flexLine
- },
- computed:{
- fontSize(){
- return getFontSize()
- },
- },
- data(){
- return {
- navHeight: 0,
- // 配送员列表
- chain_list: false,
- params: { 'page': 0, 'per_page': 10 },
- loading: false, // 是否加载更多
- isMore: true // 是否有更多
- }
- },
- onShow: function () {
- this.reload()
- },
- mounted(){
- // #ifdef MP-WEIXIN
- this.navHeight = uni.getMenuButtonBoundingClientRect().height
- // #endif
- },
- methods:{
- goBack(){uni.navigateBack({delta:1})},
- goAdd () {
- uni.navigateTo({url:'/pages/seller/chain/ChainForm'+'?'+urlencode({ action: 'add' })})
- },
- onEdit (chain_id) {
- uni.navigateTo({url:'/pages/seller/chain/ChainForm'+'?'+urlencode({ chain_id: chain_id })})
- },
- getChainList (ispush) {
- uni.showLoading({ title: '加载中' })
- getChainList({}, this.params).then(res => {
- if (ispush && this.chain_list) {
- this.chain_list = this.chain_list.concat(res.result.chain_list)
- } else {
- this.chain_list = res.result.chain_list
- }
- if (res.result.hasmore) {
- this.isMore = true
- } else {
- this.isMore = false
- }
- this.loading = false
- uni.hideLoading()
- }).catch(function (error) {
- this.loading = false
- uni.showToast({icon:'none',title: error.message})
- uni.hideLoading()
- })
- },
- loadMore () {
- if (this.loading) {
- return
- }
- this.loading = true
- this.params.page = ++this.params.page
- if (this.isMore) {
- this.getChainList(true)
- }
- },
- reload () {
- // 重新加载数据
- this.params.page = 0
- this.isMore = true
- this.loading = false
- this.chain_list = []
- this.loadMore()
- }
- }
- }
- </script>
- <style scoped lang="scss">
- .common-header{
- .btn{background: #000;color: #fff;box-shadow: 0px 2px 4px #d2d2d2;}
- }
- .scroll-view-wrapper{display: flex;flex-direction: column;}
- .scroll-view{flex:1}
- .chain{background: #fff;padding: 0 $pageSpace}
- .chain .li{line-height:1rem;padding:.5rem 1rem;background:#fff;font-size:$subFontSize}
- .chain .i{float:right}
- </style>
|